@@ -81,16 +81,16 @@ declare module "@opencode-ai/plugin/tui" {
8181 }
8282
8383 export type TuiDialogProps = {
84- size ?: "medium" | "large"
84+ size ?: "medium" | "large" | "xlarge"
8585 onClose : ( ) => void
8686 children ?: JSX . Element
8787 }
8888
8989 export type TuiDialogStack = {
9090 replace : ( render : ( ) => JSX . Element , onClose ?: ( ) => void ) => void
9191 clear : ( ) => void
92- setSize : ( size : "medium" | "large" ) => void
93- readonly size : "medium" | "large"
92+ setSize : ( size : "medium" | "large" | "xlarge" ) => void
93+ readonly size : "medium" | "large" | "xlarge"
9494 readonly depth : number
9595 readonly open : boolean
9696 }
@@ -247,9 +247,17 @@ declare module "@opencode-ai/plugin/tui" {
247247 mcp : ( ) => ReadonlyArray < TuiSidebarMcpItem >
248248 }
249249
250- // Inlined : Pick<PluginConfig, "$schema" | "theme" | "keybinds" | "plugin"> & NonNullable<PluginConfig["tui"]>
250+ // Upstream : Pick<PluginConfig, "$schema" | "theme" | "keybinds" | "plugin"> & NonNullable<PluginConfig["tui"]> & { plugin_enabled?: Record<string, boolean> }
251251 // PluginConfig (opencode.json schema) is not re-exported by @opencode-ai/plugin at installed version.
252- type TuiConfigView = Record < string , unknown >
252+ // Approximation using known TUI-native config keys:
253+ type TuiConfigView = {
254+ $schema ?: string
255+ theme ?: string
256+ keybinds ?: Record < string , string >
257+ plugin ?: Record < string , unknown >
258+ plugin_enabled ?: Record < string , boolean >
259+ [ key : string ] : unknown
260+ }
253261
254262 type Frozen < Value > = Value extends ( ...args : never [ ] ) => unknown
255263 ? Value
@@ -263,37 +271,6 @@ declare module "@opencode-ai/plugin/tui" {
263271 readonly version : string
264272 }
265273
266- export type TuiApi = {
267- app : TuiApp
268- command : {
269- register : ( cb : ( ) => TuiCommand [ ] ) => ( ) => void
270- trigger : ( value : string ) => void
271- }
272- route : {
273- register : ( routes : TuiRouteDefinition [ ] ) => ( ) => void
274- navigate : ( name : string , params ?: Record < string , unknown > ) => void
275- readonly current : TuiRouteCurrent
276- }
277- ui : {
278- Dialog : ( props : TuiDialogProps ) => JSX . Element
279- DialogAlert : ( props : TuiDialogAlertProps ) => JSX . Element
280- DialogConfirm : ( props : TuiDialogConfirmProps ) => JSX . Element
281- DialogPrompt : ( props : TuiDialogPromptProps ) => JSX . Element
282- DialogSelect : < Value = unknown > ( props : TuiDialogSelectProps < Value > ) => JSX . Element
283- toast : ( input : TuiToast ) => void
284- dialog : TuiDialogStack
285- }
286- keybind : {
287- match : ( key : string , evt : ParsedKey ) => boolean
288- print : ( key : string ) => string
289- create : ( defaults : TuiKeybindMap , overrides ?: Record < string , unknown > ) => TuiKeybindSet
290- }
291- readonly tuiConfig : Frozen < TuiConfigView >
292- kv : TuiKV
293- state : TuiState
294- theme : TuiTheme
295- }
296-
297274 export type TuiSidebarMcpItem = {
298275 name : string
299276 status : McpStatus [ "status" ]
@@ -356,7 +333,7 @@ declare module "@opencode-ai/plugin/tui" {
356333 export type TuiPluginState = "first" | "updated" | "same"
357334
358335 export type TuiPluginEntry = {
359- name : string
336+ id : string
360337 source : "file" | "npm" | "internal"
361338 spec : string
362339 target : string
@@ -374,21 +351,84 @@ declare module "@opencode-ai/plugin/tui" {
374351 state : TuiPluginState
375352 }
376353
354+ export type TuiPluginStatus = {
355+ id : string
356+ source : "file" | "npm" | "internal"
357+ spec : string
358+ target : string
359+ enabled : boolean
360+ active : boolean
361+ }
362+
363+ export type TuiPluginInstallOptions = {
364+ global ?: boolean
365+ }
366+
367+ export type TuiPluginInstallResult =
368+ | {
369+ ok : true
370+ dir : string
371+ tui : boolean
372+ }
373+ | {
374+ ok : false
375+ message : string
376+ missing ?: boolean
377+ }
378+
377379 export type TuiWorkspace = {
378380 current : ( ) => string | undefined
379381 set : ( workspaceID ?: string ) => void
380382 }
381383
382- export type TuiHostPluginApi < Renderer = CliRenderer > = TuiApi & {
384+ // Flat TuiPluginApi matching upstream spec from PR #19347.
385+ // Previous local shim split this into TuiApi -> TuiHostPluginApi -> TuiPluginApi;
386+ // the upstream API is a single flat type.
387+ export type TuiPluginApi < Renderer = CliRenderer > = {
388+ app : TuiApp
389+ command : {
390+ register : ( cb : ( ) => TuiCommand [ ] ) => ( ) => void
391+ trigger : ( value : string ) => void
392+ }
393+ route : {
394+ register : ( routes : TuiRouteDefinition [ ] ) => ( ) => void
395+ navigate : ( name : string , params ?: Record < string , unknown > ) => void
396+ readonly current : TuiRouteCurrent
397+ }
398+ ui : {
399+ Dialog : ( props : TuiDialogProps ) => JSX . Element
400+ DialogAlert : ( props : TuiDialogAlertProps ) => JSX . Element
401+ DialogConfirm : ( props : TuiDialogConfirmProps ) => JSX . Element
402+ DialogPrompt : ( props : TuiDialogPromptProps ) => JSX . Element
403+ DialogSelect : < Value = unknown > ( props : TuiDialogSelectProps < Value > ) => JSX . Element
404+ toast : ( input : TuiToast ) => void
405+ dialog : TuiDialogStack
406+ }
407+ keybind : {
408+ match : ( key : string , evt : ParsedKey ) => boolean
409+ print : ( key : string ) => string
410+ create : ( defaults : TuiKeybindMap , overrides ?: Record < string , unknown > ) => TuiKeybindSet
411+ }
412+ readonly tuiConfig : Frozen < TuiConfigView >
413+ kv : TuiKV
414+ state : TuiState
415+ theme : TuiTheme
383416 client : ReturnType < typeof createOpencodeClientV2 >
384417 scopedClient : ( workspaceID ?: string ) => ReturnType < typeof createOpencodeClientV2 >
385418 workspace : TuiWorkspace
386419 event : TuiEventBus
387420 renderer : Renderer
388- }
389-
390- export type TuiPluginApi < Renderer = CliRenderer > = TuiHostPluginApi < Renderer > & {
391421 slots : TuiSlots
422+ plugins : {
423+ list : ( ) => ReadonlyArray < TuiPluginStatus >
424+ activate : ( id : string ) => Promise < boolean >
425+ deactivate : ( id : string ) => Promise < boolean >
426+ add : ( spec : string ) => Promise < boolean >
427+ install : (
428+ spec : string ,
429+ options ?: TuiPluginInstallOptions ,
430+ ) => Promise < TuiPluginInstallResult >
431+ }
392432 lifecycle : TuiLifecycle
393433 }
394434
0 commit comments