diff options
| author | Sebastian <[email protected]> | 2026-03-27 15:00:26 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-27 15:00:26 +0100 |
| commit | 6274b0677c1c65815c525b9b199f1ce5c6fb97fc (patch) | |
| tree | 399fdba174e350c2f86c2deba047ac8b17ce43bf /packages/plugin/src/index.ts | |
| parent | d8ad8338f5311ac6692ebc362d28389e028f6aad (diff) | |
| download | opencode-6274b0677c1c65815c525b9b199f1ce5c6fb97fc.tar.gz opencode-6274b0677c1c65815c525b9b199f1ce5c6fb97fc.zip | |
tui plugins (#19347)
Diffstat (limited to 'packages/plugin/src/index.ts')
| -rw-r--r-- | packages/plugin/src/index.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 8bdb51a2a..d289689b9 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -9,7 +9,7 @@ import type { Message, Part, Auth, - Config, + Config as SDKConfig, } from "@opencode-ai/sdk" import type { BunShell } from "./shell.js" @@ -32,7 +32,18 @@ export type PluginInput = { $: BunShell } -export type Plugin = (input: PluginInput) => Promise<Hooks> +export type PluginOptions = Record<string, unknown> + +export type Config = Omit<SDKConfig, "plugin"> & { + plugin?: Array<string | [string, PluginOptions]> +} + +export type Plugin = (input: PluginInput, options?: PluginOptions) => Promise<Hooks> + +export type PluginModule = { + id?: string + server?: Plugin +} type Rule = { key: string @@ -72,7 +83,7 @@ export type AuthHook = { when?: Rule } > - authorize(inputs?: Record<string, string>): Promise<AuthOuathResult> + authorize(inputs?: Record<string, string>): Promise<AuthOAuthResult> } | { type: "api" @@ -116,7 +127,7 @@ export type AuthHook = { )[] } -export type AuthOuathResult = { url: string; instructions: string } & ( +export type AuthOAuthResult = { url: string; instructions: string } & ( | { method: "auto" callback(): Promise< @@ -161,6 +172,9 @@ export type AuthOuathResult = { url: string; instructions: string } & ( } ) +/** @deprecated Use AuthOAuthResult instead. */ +export type AuthOuathResult = AuthOAuthResult + export interface Hooks { event?: (input: { event: Event }) => Promise<void> config?: (input: Config) => Promise<void> |
