From 6274b0677c1c65815c525b9b199f1ce5c6fb97fc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 27 Mar 2026 15:00:26 +0100 Subject: tui plugins (#19347) --- packages/plugin/src/index.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'packages/plugin/src/index.ts') 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 +export type PluginOptions = Record + +export type Config = Omit & { + plugin?: Array +} + +export type Plugin = (input: PluginInput, options?: PluginOptions) => Promise + +export type PluginModule = { + id?: string + server?: Plugin +} type Rule = { key: string @@ -72,7 +83,7 @@ export type AuthHook = { when?: Rule } > - authorize(inputs?: Record): Promise + authorize(inputs?: Record): Promise } | { 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 config?: (input: Config) => Promise -- cgit v1.2.3