diff options
| author | David Hill <[email protected]> | 2025-11-04 21:36:46 +0000 |
|---|---|---|
| committer | David Hill <[email protected]> | 2025-11-04 21:36:46 +0000 |
| commit | 7088bfabd773e2f076aab1c9d2468c04feff0570 (patch) | |
| tree | 67edc3c55bbf4110c8f6c2c12be2f9a0a4ba463a /packages/plugin | |
| parent | dbdbfb85431eb12b3159992b301fdba54b026ab8 (diff) | |
| parent | fe94bb8e50ed9625e553cc7bd79d3a02889c2979 (diff) | |
| download | opencode-7088bfabd773e2f076aab1c9d2468c04feff0570.tar.gz opencode-7088bfabd773e2f076aab1c9d2468c04feff0570.zip | |
Merge branch 'dev' of https://github.com/sst/opencode into dev
Diffstat (limited to 'packages/plugin')
| -rw-r--r-- | packages/plugin/package.json | 2 | ||||
| -rw-r--r-- | packages/plugin/src/index.ts | 61 |
2 files changed, 60 insertions, 3 deletions
diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 897931489..0ad4afe63 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "1.0.20", + "version": "1.0.23", "type": "module", "scripts": { "typecheck": "tsgo --noEmit", diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 9c2647c60..f103749bd 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -39,13 +39,35 @@ export interface Hooks { | { type: "oauth" label: string - authorize(): Promise< + prompts?: Array< + | { + type: "text" + key: string + message: string + placeholder?: string + validate?: (value: string) => string | undefined + condition?: (inputs: Record<string, string>) => boolean + } + | { + type: "select" + key: string + message: string + options: Array<{ + label: string + value: string + hint?: string + }> + condition?: (inputs: Record<string, string>) => boolean + } + > + authorize(inputs?: Record<string, string>): Promise< { url: string; instructions: string } & ( | { method: "auto" callback(): Promise< | ({ type: "success" + provider?: string } & ( | { refresh: string @@ -64,6 +86,7 @@ export interface Hooks { callback(code: string): Promise< | ({ type: "success" + provider?: string } & ( | { refresh: string @@ -80,7 +103,41 @@ export interface Hooks { ) > } - | { type: "api"; label: string } + | { + type: "api" + label: string + prompts?: Array< + | { + type: "text" + key: string + message: string + placeholder?: string + validate?: (value: string) => string | undefined + condition?: (inputs: Record<string, string>) => boolean + } + | { + type: "select" + key: string + message: string + options: Array<{ + label: string + value: string + hint?: string + }> + condition?: (inputs: Record<string, string>) => boolean + } + > + authorize?(inputs?: Record<string, string>): Promise< + | { + type: "success" + key: string + provider?: string + } + | { + type: "failed" + } + > + } )[] } /** |
