@opencode-ai/plugin 0.0.0-snapshot-memory-202603252349 → 0.0.0-snapshot-tui-plugins-202603262107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config } from "@opencode-ai/sdk";
1
+ import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config as SDKConfig } from "@opencode-ai/sdk";
2
2
  import type { BunShell } from "./shell.js";
3
3
  import { type ToolDefinition } from "./tool.js";
4
4
  export * from "./tool.js";
@@ -15,7 +15,15 @@ export type PluginInput = {
15
15
  serverUrl: URL;
16
16
  $: BunShell;
17
17
  };
18
- export type Plugin = (input: PluginInput) => Promise<Hooks>;
18
+ export type PluginOptions = Record<string, unknown>;
19
+ export type Config = Omit<SDKConfig, "plugin"> & {
20
+ plugin?: Array<string | [string, PluginOptions]>;
21
+ };
22
+ export type Plugin = (input: PluginInput, options?: PluginOptions) => Promise<Hooks>;
23
+ export type PluginModule = {
24
+ id?: string;
25
+ server?: Plugin;
26
+ };
19
27
  type Rule = {
20
28
  key: string;
21
29
  op: "eq" | "neq";
@@ -49,7 +57,7 @@ export type AuthHook = {
49
57
  condition?: (inputs: Record<string, string>) => boolean;
50
58
  when?: Rule;
51
59
  }>;
52
- authorize(inputs?: Record<string, string>): Promise<AuthOuathResult>;
60
+ authorize(inputs?: Record<string, string>): Promise<AuthOAuthResult>;
53
61
  } | {
54
62
  type: "api";
55
63
  label: string;
@@ -84,7 +92,7 @@ export type AuthHook = {
84
92
  }>;
85
93
  })[];
86
94
  };
87
- export type AuthOuathResult = {
95
+ export type AuthOAuthResult = {
88
96
  url: string;
89
97
  instructions: string;
90
98
  } & ({
@@ -97,6 +105,7 @@ export type AuthOuathResult = {
97
105
  access: string;
98
106
  expires: number;
99
107
  accountId?: string;
108
+ enterpriseUrl?: string;
100
109
  } | {
101
110
  key: string;
102
111
  })) | {
@@ -112,12 +121,15 @@ export type AuthOuathResult = {
112
121
  access: string;
113
122
  expires: number;
114
123
  accountId?: string;
124
+ enterpriseUrl?: string;
115
125
  } | {
116
126
  key: string;
117
127
  })) | {
118
128
  type: "failed";
119
129
  }>;
120
130
  });
131
+ /** @deprecated Use AuthOAuthResult instead. */
132
+ export type AuthOuathResult = AuthOAuthResult;
121
133
  export interface Hooks {
122
134
  event?: (input: {
123
135
  event: Event;
package/dist/tui.d.ts ADDED
@@ -0,0 +1,343 @@
1
+ import type { OpencodeClient, Event, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus, Workspace, Config as SdkConfig } from "@opencode-ai/sdk/v2";
2
+ import type { CliRenderer, ParsedKey, RGBA } from "@opentui/core";
3
+ import type { JSX, SolidPlugin } from "@opentui/solid";
4
+ import type { Config as PluginConfig, PluginModule, PluginOptions } from "./index.js";
5
+ export type { CliRenderer, SlotMode } from "@opentui/core";
6
+ export type TuiRouteCurrent = {
7
+ name: "home";
8
+ } | {
9
+ name: "session";
10
+ params: {
11
+ sessionID: string;
12
+ initialPrompt?: unknown;
13
+ };
14
+ } | {
15
+ name: string;
16
+ params?: Record<string, unknown>;
17
+ };
18
+ export type TuiRouteDefinition = {
19
+ name: string;
20
+ render: (input: {
21
+ params?: Record<string, unknown>;
22
+ }) => JSX.Element;
23
+ };
24
+ export type TuiCommand = {
25
+ title: string;
26
+ value: string;
27
+ description?: string;
28
+ category?: string;
29
+ keybind?: string;
30
+ suggested?: boolean;
31
+ hidden?: boolean;
32
+ enabled?: boolean;
33
+ slash?: {
34
+ name: string;
35
+ aliases?: string[];
36
+ };
37
+ onSelect?: () => void;
38
+ };
39
+ export type TuiKeybind = {
40
+ name: string;
41
+ ctrl: boolean;
42
+ meta: boolean;
43
+ shift: boolean;
44
+ super?: boolean;
45
+ leader: boolean;
46
+ };
47
+ export type TuiKeybindMap = Record<string, string>;
48
+ export type TuiKeybindSet = {
49
+ readonly all: TuiKeybindMap;
50
+ get: (name: string) => string;
51
+ match: (name: string, evt: ParsedKey) => boolean;
52
+ print: (name: string) => string;
53
+ };
54
+ export type TuiDialogProps = {
55
+ size?: "medium" | "large";
56
+ onClose: () => void;
57
+ children?: JSX.Element;
58
+ };
59
+ export type TuiDialogStack = {
60
+ replace: (render: () => JSX.Element, onClose?: () => void) => void;
61
+ clear: () => void;
62
+ setSize: (size: "medium" | "large") => void;
63
+ readonly size: "medium" | "large";
64
+ readonly depth: number;
65
+ readonly open: boolean;
66
+ };
67
+ export type TuiDialogAlertProps = {
68
+ title: string;
69
+ message: string;
70
+ onConfirm?: () => void;
71
+ };
72
+ export type TuiDialogConfirmProps = {
73
+ title: string;
74
+ message: string;
75
+ onConfirm?: () => void;
76
+ onCancel?: () => void;
77
+ };
78
+ export type TuiDialogPromptProps = {
79
+ title: string;
80
+ description?: () => JSX.Element;
81
+ placeholder?: string;
82
+ value?: string;
83
+ onConfirm?: (value: string) => void;
84
+ onCancel?: () => void;
85
+ };
86
+ export type TuiDialogSelectOption<Value = unknown> = {
87
+ title: string;
88
+ value: Value;
89
+ description?: string;
90
+ footer?: JSX.Element | string;
91
+ category?: string;
92
+ disabled?: boolean;
93
+ onSelect?: () => void;
94
+ };
95
+ export type TuiDialogSelectProps<Value = unknown> = {
96
+ title: string;
97
+ placeholder?: string;
98
+ options: TuiDialogSelectOption<Value>[];
99
+ flat?: boolean;
100
+ onMove?: (option: TuiDialogSelectOption<Value>) => void;
101
+ onFilter?: (query: string) => void;
102
+ onSelect?: (option: TuiDialogSelectOption<Value>) => void;
103
+ skipFilter?: boolean;
104
+ current?: Value;
105
+ };
106
+ export type TuiToast = {
107
+ variant?: "info" | "success" | "warning" | "error";
108
+ title?: string;
109
+ message: string;
110
+ duration?: number;
111
+ };
112
+ export type TuiThemeCurrent = {
113
+ readonly primary: RGBA;
114
+ readonly secondary: RGBA;
115
+ readonly accent: RGBA;
116
+ readonly error: RGBA;
117
+ readonly warning: RGBA;
118
+ readonly success: RGBA;
119
+ readonly info: RGBA;
120
+ readonly text: RGBA;
121
+ readonly textMuted: RGBA;
122
+ readonly selectedListItemText: RGBA;
123
+ readonly background: RGBA;
124
+ readonly backgroundPanel: RGBA;
125
+ readonly backgroundElement: RGBA;
126
+ readonly backgroundMenu: RGBA;
127
+ readonly border: RGBA;
128
+ readonly borderActive: RGBA;
129
+ readonly borderSubtle: RGBA;
130
+ readonly diffAdded: RGBA;
131
+ readonly diffRemoved: RGBA;
132
+ readonly diffContext: RGBA;
133
+ readonly diffHunkHeader: RGBA;
134
+ readonly diffHighlightAdded: RGBA;
135
+ readonly diffHighlightRemoved: RGBA;
136
+ readonly diffAddedBg: RGBA;
137
+ readonly diffRemovedBg: RGBA;
138
+ readonly diffContextBg: RGBA;
139
+ readonly diffLineNumber: RGBA;
140
+ readonly diffAddedLineNumberBg: RGBA;
141
+ readonly diffRemovedLineNumberBg: RGBA;
142
+ readonly markdownText: RGBA;
143
+ readonly markdownHeading: RGBA;
144
+ readonly markdownLink: RGBA;
145
+ readonly markdownLinkText: RGBA;
146
+ readonly markdownCode: RGBA;
147
+ readonly markdownBlockQuote: RGBA;
148
+ readonly markdownEmph: RGBA;
149
+ readonly markdownStrong: RGBA;
150
+ readonly markdownHorizontalRule: RGBA;
151
+ readonly markdownListItem: RGBA;
152
+ readonly markdownListEnumeration: RGBA;
153
+ readonly markdownImage: RGBA;
154
+ readonly markdownImageText: RGBA;
155
+ readonly markdownCodeBlock: RGBA;
156
+ readonly syntaxComment: RGBA;
157
+ readonly syntaxKeyword: RGBA;
158
+ readonly syntaxFunction: RGBA;
159
+ readonly syntaxVariable: RGBA;
160
+ readonly syntaxString: RGBA;
161
+ readonly syntaxNumber: RGBA;
162
+ readonly syntaxType: RGBA;
163
+ readonly syntaxOperator: RGBA;
164
+ readonly syntaxPunctuation: RGBA;
165
+ readonly thinkingOpacity: number;
166
+ };
167
+ export type TuiTheme = {
168
+ readonly current: TuiThemeCurrent;
169
+ readonly selected: string;
170
+ has: (name: string) => boolean;
171
+ set: (name: string) => boolean;
172
+ install: (jsonPath: string) => Promise<void>;
173
+ mode: () => "dark" | "light";
174
+ readonly ready: boolean;
175
+ };
176
+ export type TuiKV = {
177
+ get: <Value = unknown>(key: string, fallback?: Value) => Value;
178
+ set: (key: string, value: unknown) => void;
179
+ readonly ready: boolean;
180
+ };
181
+ export type TuiState = {
182
+ readonly ready: boolean;
183
+ readonly config: SdkConfig;
184
+ readonly provider: ReadonlyArray<Provider>;
185
+ readonly path: {
186
+ state: string;
187
+ config: string;
188
+ worktree: string;
189
+ directory: string;
190
+ };
191
+ readonly vcs: {
192
+ branch?: string;
193
+ } | undefined;
194
+ readonly workspace: {
195
+ list: () => ReadonlyArray<Workspace>;
196
+ get: (workspaceID: string) => Workspace | undefined;
197
+ };
198
+ session: {
199
+ count: () => number;
200
+ diff: (sessionID: string) => ReadonlyArray<TuiSidebarFileItem>;
201
+ todo: (sessionID: string) => ReadonlyArray<TuiSidebarTodoItem>;
202
+ messages: (sessionID: string) => ReadonlyArray<Message>;
203
+ status: (sessionID: string) => SessionStatus | undefined;
204
+ permission: (sessionID: string) => ReadonlyArray<PermissionRequest>;
205
+ question: (sessionID: string) => ReadonlyArray<QuestionRequest>;
206
+ };
207
+ part: (messageID: string) => ReadonlyArray<Part>;
208
+ lsp: () => ReadonlyArray<TuiSidebarLspItem>;
209
+ mcp: () => ReadonlyArray<TuiSidebarMcpItem>;
210
+ };
211
+ type TuiConfigView = Pick<PluginConfig, "$schema" | "theme" | "keybinds" | "plugin"> & NonNullable<PluginConfig["tui"]> & {
212
+ plugin_enabled?: Record<string, boolean>;
213
+ };
214
+ export type TuiApp = {
215
+ readonly version: string;
216
+ };
217
+ type Frozen<Value> = Value extends (...args: never[]) => unknown ? Value : Value extends ReadonlyArray<infer Item> ? ReadonlyArray<Frozen<Item>> : Value extends object ? {
218
+ readonly [Key in keyof Value]: Frozen<Value[Key]>;
219
+ } : Value;
220
+ export type TuiSidebarMcpItem = {
221
+ name: string;
222
+ status: McpStatus["status"];
223
+ error?: string;
224
+ };
225
+ export type TuiSidebarLspItem = Pick<LspStatus, "id" | "root" | "status">;
226
+ export type TuiSidebarTodoItem = Pick<Todo, "content" | "status">;
227
+ export type TuiSidebarFileItem = {
228
+ file: string;
229
+ additions: number;
230
+ deletions: number;
231
+ };
232
+ export type TuiSlotMap = {
233
+ app: {};
234
+ home_logo: {};
235
+ home_bottom: {};
236
+ sidebar_title: {
237
+ session_id: string;
238
+ title: string;
239
+ share_url?: string;
240
+ };
241
+ sidebar_content: {
242
+ session_id: string;
243
+ };
244
+ sidebar_footer: {
245
+ session_id: string;
246
+ };
247
+ };
248
+ export type TuiSlotContext = {
249
+ theme: TuiTheme;
250
+ };
251
+ type SlotCore = SolidPlugin<TuiSlotMap, TuiSlotContext>;
252
+ export type TuiSlotPlugin = Omit<SlotCore, "id"> & {
253
+ id?: never;
254
+ };
255
+ export type TuiSlots = {
256
+ register: (plugin: TuiSlotPlugin) => string;
257
+ };
258
+ export type TuiEventBus = {
259
+ on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
260
+ type: Type;
261
+ }>) => void) => () => void;
262
+ };
263
+ export type TuiDispose = () => void | Promise<void>;
264
+ export type TuiLifecycle = {
265
+ readonly signal: AbortSignal;
266
+ onDispose: (fn: TuiDispose) => () => void;
267
+ };
268
+ export type TuiPluginState = "first" | "updated" | "same";
269
+ export type TuiPluginEntry = {
270
+ id: string;
271
+ source: "file" | "npm" | "internal";
272
+ spec: string;
273
+ target: string;
274
+ requested?: string;
275
+ version?: string;
276
+ modified?: number;
277
+ first_time: number;
278
+ last_time: number;
279
+ time_changed: number;
280
+ load_count: number;
281
+ fingerprint: string;
282
+ };
283
+ export type TuiPluginMeta = TuiPluginEntry & {
284
+ state: TuiPluginState;
285
+ };
286
+ export type TuiPluginStatus = {
287
+ id: string;
288
+ source: TuiPluginEntry["source"];
289
+ spec: string;
290
+ target: string;
291
+ enabled: boolean;
292
+ active: boolean;
293
+ };
294
+ export type TuiWorkspace = {
295
+ current: () => string | undefined;
296
+ set: (workspaceID?: string) => void;
297
+ };
298
+ export type TuiPluginApi = {
299
+ app: TuiApp;
300
+ command: {
301
+ register: (cb: () => TuiCommand[]) => () => void;
302
+ trigger: (value: string) => void;
303
+ };
304
+ route: {
305
+ register: (routes: TuiRouteDefinition[]) => () => void;
306
+ navigate: (name: string, params?: Record<string, unknown>) => void;
307
+ readonly current: TuiRouteCurrent;
308
+ };
309
+ ui: {
310
+ Dialog: (props: TuiDialogProps) => JSX.Element;
311
+ DialogAlert: (props: TuiDialogAlertProps) => JSX.Element;
312
+ DialogConfirm: (props: TuiDialogConfirmProps) => JSX.Element;
313
+ DialogPrompt: (props: TuiDialogPromptProps) => JSX.Element;
314
+ DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value>) => JSX.Element;
315
+ toast: (input: TuiToast) => void;
316
+ dialog: TuiDialogStack;
317
+ };
318
+ keybind: {
319
+ match: (key: string, evt: ParsedKey) => boolean;
320
+ print: (key: string) => string;
321
+ create: (defaults: TuiKeybindMap, overrides?: Record<string, unknown>) => TuiKeybindSet;
322
+ };
323
+ readonly tuiConfig: Frozen<TuiConfigView>;
324
+ kv: TuiKV;
325
+ state: TuiState;
326
+ theme: TuiTheme;
327
+ client: OpencodeClient;
328
+ scopedClient: (workspaceID?: string) => OpencodeClient;
329
+ workspace: TuiWorkspace;
330
+ event: TuiEventBus;
331
+ renderer: CliRenderer;
332
+ slots: TuiSlots;
333
+ plugins: {
334
+ list: () => ReadonlyArray<TuiPluginStatus>;
335
+ activate: (id: string) => Promise<boolean>;
336
+ deactivate: (id: string) => Promise<boolean>;
337
+ };
338
+ lifecycle: TuiLifecycle;
339
+ };
340
+ export type TuiPlugin = (api: TuiPluginApi, options: PluginOptions | undefined, meta: TuiPluginMeta) => Promise<void>;
341
+ export type TuiPluginModule = PluginModule & {
342
+ tui?: TuiPlugin;
343
+ };
package/dist/tui.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/plugin",
4
- "version": "0.0.0-snapshot-memory-202603252349",
4
+ "version": "0.0.0-snapshot-tui-plugins-202603262107",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -16,16 +16,34 @@
16
16
  "./tool": {
17
17
  "import": "./dist/tool.js",
18
18
  "types": "./dist/tool.d.ts"
19
+ },
20
+ "./tui": {
21
+ "import": "./dist/tui.js",
22
+ "types": "./dist/tui.d.ts"
19
23
  }
20
24
  },
21
25
  "files": [
22
26
  "dist"
23
27
  ],
24
28
  "dependencies": {
25
- "@opencode-ai/sdk": "0.0.0-snapshot-memory-202603252349",
29
+ "@opencode-ai/sdk": "0.0.0-snapshot-tui-plugins-202603262107",
26
30
  "zod": "4.1.8"
27
31
  },
32
+ "peerDependencies": {
33
+ "@opentui/core": ">=0.1.90",
34
+ "@opentui/solid": ">=0.1.90"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@opentui/core": {
38
+ "optional": true
39
+ },
40
+ "@opentui/solid": {
41
+ "optional": true
42
+ }
43
+ },
28
44
  "devDependencies": {
45
+ "@opentui/core": "0.1.90",
46
+ "@opentui/solid": "0.1.90",
29
47
  "@tsconfig/node22": "22.0.2",
30
48
  "@types/node": "22.13.9",
31
49
  "typescript": "5.8.2",