tui plugins (#19347)

This commit is contained in:
Sebastian
2026-03-27 15:00:26 +01:00
committed by GitHub
parent d8ad8338f5
commit 6274b0677c
91 changed files with 10544 additions and 898 deletions
+18 -4
View File
@@ -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>