/** * Minimal TUI plugin API surface. * * The installed @opencode-ai/plugin SDK does not ship a /tui subpath yet, * so we define just enough type structure for the delegation TUI plugin to * compile. These types mirror the upstream TuiPluginApi shape and will be * replaced by the real import once the SDK publishes it. */ /** Opaque JSX.Element stand-in — the host provides the real type at runtime. */ export type AnyElement = any; export interface TuiRouteDefinition { name: string; render: (input: { params?: Record; }) => AnyElement; } export interface TuiCommand { title: string; value: string; description?: string; category?: string; keybind?: string; suggested?: boolean; hidden?: boolean; enabled?: boolean; onSelect?: () => void; } export interface TuiDialogSelectOption { title: string; value: Value; description?: string; footer?: AnyElement | string; category?: string; disabled?: boolean; onSelect?: () => void; } export interface TuiDialogSelectProps { title: string; placeholder?: string; options: TuiDialogSelectOption[]; flat?: boolean; onSelect?: (option: TuiDialogSelectOption) => void; skipFilter?: boolean; current?: Value; } export interface TuiDialogStack { replace: (render: () => AnyElement, onClose?: () => void) => void; clear: () => void; } export interface TuiSlotPlugin { setup?: () => void; slots: Record) => AnyElement>; } export interface TuiPluginApi { app: { readonly version: string; }; command: { register: (cb: () => TuiCommand[]) => () => void; trigger: (value: string) => void; show: () => void; }; route: { register: (routes: TuiRouteDefinition[]) => () => void; navigate: (name: string, params?: Record) => void; readonly current: { name: string; params?: Record; }; }; ui: { DialogSelect: (props: TuiDialogSelectProps) => AnyElement; toast: (input: { variant?: "info" | "success" | "warning" | "error"; title?: string; message: string; duration?: number; }) => void; dialog: TuiDialogStack; }; state: { readonly ready: boolean; readonly path: { state: string; config: string; worktree: string; directory: string; }; }; slots: { register: (plugin: TuiSlotPlugin & { id?: never; }) => string; }; lifecycle: { readonly signal: AbortSignal; onDispose: (fn: () => void | Promise) => () => void; }; } export type PluginOptions = any; export interface TuiPluginMeta { state: "first" | "updated" | "same"; id: string; source: string; spec: string; target: string; } export type TuiPlugin = (api: TuiPluginApi, options: PluginOptions | undefined, meta: TuiPluginMeta) => Promise; export interface TuiPluginModule { id?: string; tui: TuiPlugin; server?: never; } //# sourceMappingURL=types.d.ts.map