diff options
Diffstat (limited to 'packages/plugin/src')
| -rw-r--r-- | packages/plugin/src/index.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index a264cf5aa..473cac8a9 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -11,6 +11,7 @@ import type { Auth, Config as SDKConfig, } from "@opencode-ai/sdk" +import type { Provider as ProviderV2, Model as ModelV2 } from "@opencode-ai/sdk/v2" import type { BunShell } from "./shell.js" import { type ToolDefinition } from "./tool.js" @@ -173,6 +174,15 @@ export type AuthOAuthResult = { url: string; instructions: string } & ( } ) +export type ProviderHookContext = { + auth?: Auth +} + +export type ProviderHook = { + id: string + models?: (provider: ProviderV2, ctx: ProviderHookContext) => Promise<Record<string, ModelV2>> +} + /** @deprecated Use AuthOAuthResult instead. */ export type AuthOuathResult = AuthOAuthResult @@ -183,6 +193,7 @@ export interface Hooks { [key: string]: ToolDefinition } auth?: AuthHook + provider?: ProviderHook /** * Called when a new message is received */ |
