@opencode-ai/plugin 1.3.13 → 1.3.14
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 +9 -0
- package/dist/tui.d.ts +57 -6
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config as SDKConfig } from "@opencode-ai/sdk";
|
|
2
|
+
import type { Provider as ProviderV2, Model as ModelV2 } from "@opencode-ai/sdk/v2";
|
|
2
3
|
import type { BunShell } from "./shell.js";
|
|
3
4
|
import { type ToolDefinition } from "./tool.js";
|
|
4
5
|
export * from "./tool.js";
|
|
@@ -129,6 +130,13 @@ export type AuthOAuthResult = {
|
|
|
129
130
|
type: "failed";
|
|
130
131
|
}>;
|
|
131
132
|
});
|
|
133
|
+
export type ProviderHookContext = {
|
|
134
|
+
auth?: Auth;
|
|
135
|
+
};
|
|
136
|
+
export type ProviderHook = {
|
|
137
|
+
id: string;
|
|
138
|
+
models?: (provider: ProviderV2, ctx: ProviderHookContext) => Promise<Record<string, ModelV2>>;
|
|
139
|
+
};
|
|
132
140
|
/** @deprecated Use AuthOAuthResult instead. */
|
|
133
141
|
export type AuthOuathResult = AuthOAuthResult;
|
|
134
142
|
export interface Hooks {
|
|
@@ -140,6 +148,7 @@ export interface Hooks {
|
|
|
140
148
|
[key: string]: ToolDefinition;
|
|
141
149
|
};
|
|
142
150
|
auth?: AuthHook;
|
|
151
|
+
provider?: ProviderHook;
|
|
143
152
|
/**
|
|
144
153
|
* Called when a new message is received
|
|
145
154
|
*/
|
package/dist/tui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
1
|
+
import type { AgentPart, OpencodeClient, Event, FilePart, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus, TextPart, Workspace, Config as SdkConfig } from "@opencode-ai/sdk/v2";
|
|
2
|
+
import type { CliRenderer, ParsedKey, RGBA, SlotMode } from "@opentui/core";
|
|
3
3
|
import type { JSX, SolidPlugin } from "@opentui/solid";
|
|
4
4
|
import type { Config as PluginConfig, PluginOptions } from "./index.js";
|
|
5
5
|
export type { CliRenderer, SlotMode } from "@opentui/core";
|
|
@@ -105,12 +105,37 @@ export type TuiDialogSelectProps<Value = unknown> = {
|
|
|
105
105
|
skipFilter?: boolean;
|
|
106
106
|
current?: Value;
|
|
107
107
|
};
|
|
108
|
+
export type TuiPromptInfo = {
|
|
109
|
+
input: string;
|
|
110
|
+
mode?: "normal" | "shell";
|
|
111
|
+
parts: (Omit<FilePart, "id" | "messageID" | "sessionID"> | Omit<AgentPart, "id" | "messageID" | "sessionID"> | (Omit<TextPart, "id" | "messageID" | "sessionID"> & {
|
|
112
|
+
source?: {
|
|
113
|
+
text: {
|
|
114
|
+
start: number;
|
|
115
|
+
end: number;
|
|
116
|
+
value: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
}))[];
|
|
120
|
+
};
|
|
121
|
+
export type TuiPromptRef = {
|
|
122
|
+
focused: boolean;
|
|
123
|
+
current: TuiPromptInfo;
|
|
124
|
+
set(prompt: TuiPromptInfo): void;
|
|
125
|
+
reset(): void;
|
|
126
|
+
blur(): void;
|
|
127
|
+
focus(): void;
|
|
128
|
+
submit(): void;
|
|
129
|
+
};
|
|
108
130
|
export type TuiPromptProps = {
|
|
131
|
+
sessionID?: string;
|
|
109
132
|
workspaceID?: string;
|
|
110
133
|
visible?: boolean;
|
|
111
134
|
disabled?: boolean;
|
|
112
135
|
onSubmit?: () => void;
|
|
136
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
113
137
|
hint?: JSX.Element;
|
|
138
|
+
right?: JSX.Element;
|
|
114
139
|
showPlaceholder?: boolean;
|
|
115
140
|
placeholders?: {
|
|
116
141
|
normal?: string[];
|
|
@@ -243,11 +268,25 @@ export type TuiSidebarFileItem = {
|
|
|
243
268
|
additions: number;
|
|
244
269
|
deletions: number;
|
|
245
270
|
};
|
|
246
|
-
export type
|
|
271
|
+
export type TuiHostSlotMap = {
|
|
247
272
|
app: {};
|
|
248
273
|
home_logo: {};
|
|
249
274
|
home_prompt: {
|
|
250
275
|
workspace_id?: string;
|
|
276
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
277
|
+
};
|
|
278
|
+
home_prompt_right: {
|
|
279
|
+
workspace_id?: string;
|
|
280
|
+
};
|
|
281
|
+
session_prompt: {
|
|
282
|
+
session_id: string;
|
|
283
|
+
visible?: boolean;
|
|
284
|
+
disabled?: boolean;
|
|
285
|
+
on_submit?: () => void;
|
|
286
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
287
|
+
};
|
|
288
|
+
session_prompt_right: {
|
|
289
|
+
session_id: string;
|
|
251
290
|
};
|
|
252
291
|
home_bottom: {};
|
|
253
292
|
home_footer: {};
|
|
@@ -263,15 +302,25 @@ export type TuiSlotMap = {
|
|
|
263
302
|
session_id: string;
|
|
264
303
|
};
|
|
265
304
|
};
|
|
305
|
+
export type TuiSlotMap<Slots extends Record<string, object> = {}> = TuiHostSlotMap & Slots;
|
|
306
|
+
type TuiSlotShape<Name extends string, Slots extends Record<string, object>> = Name extends keyof TuiHostSlotMap ? TuiHostSlotMap[Name] : Name extends keyof Slots ? Slots[Name] : Record<string, unknown>;
|
|
307
|
+
export type TuiSlotProps<Name extends string = string, Slots extends Record<string, object> = {}> = {
|
|
308
|
+
name: Name;
|
|
309
|
+
mode?: SlotMode;
|
|
310
|
+
children?: JSX.Element;
|
|
311
|
+
} & TuiSlotShape<Name, Slots>;
|
|
266
312
|
export type TuiSlotContext = {
|
|
267
313
|
theme: TuiTheme;
|
|
268
314
|
};
|
|
269
|
-
type SlotCore = SolidPlugin<TuiSlotMap
|
|
270
|
-
export type TuiSlotPlugin = Omit<SlotCore
|
|
315
|
+
type SlotCore<Slots extends Record<string, object> = {}> = SolidPlugin<TuiSlotMap<Slots>, TuiSlotContext>;
|
|
316
|
+
export type TuiSlotPlugin<Slots extends Record<string, object> = {}> = Omit<SlotCore<Slots>, "id"> & {
|
|
271
317
|
id?: never;
|
|
272
318
|
};
|
|
273
319
|
export type TuiSlots = {
|
|
274
|
-
register:
|
|
320
|
+
register: {
|
|
321
|
+
(plugin: TuiSlotPlugin): string;
|
|
322
|
+
<Slots extends Record<string, object>>(plugin: TuiSlotPlugin<Slots>): string;
|
|
323
|
+
};
|
|
275
324
|
};
|
|
276
325
|
export type TuiEventBus = {
|
|
277
326
|
on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
|
|
@@ -330,6 +379,7 @@ export type TuiPluginApi = {
|
|
|
330
379
|
command: {
|
|
331
380
|
register: (cb: () => TuiCommand[]) => () => void;
|
|
332
381
|
trigger: (value: string) => void;
|
|
382
|
+
show: () => void;
|
|
333
383
|
};
|
|
334
384
|
route: {
|
|
335
385
|
register: (routes: TuiRouteDefinition[]) => () => void;
|
|
@@ -342,6 +392,7 @@ export type TuiPluginApi = {
|
|
|
342
392
|
DialogConfirm: (props: TuiDialogConfirmProps) => JSX.Element;
|
|
343
393
|
DialogPrompt: (props: TuiDialogPromptProps) => JSX.Element;
|
|
344
394
|
DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value>) => JSX.Element;
|
|
395
|
+
Slot: <Name extends string>(props: TuiSlotProps<Name>) => JSX.Element | null;
|
|
345
396
|
Prompt: (props: TuiPromptProps) => JSX.Element;
|
|
346
397
|
toast: (input: TuiToast) => void;
|
|
347
398
|
dialog: TuiDialogStack;
|
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": "1.3.
|
|
4
|
+
"version": "1.3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@opencode-ai/sdk": "1.3.
|
|
29
|
+
"@opencode-ai/sdk": "1.3.14",
|
|
30
30
|
"zod": "4.1.8"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@opentui/core": ">=0.1.
|
|
34
|
-
"@opentui/solid": ">=0.1.
|
|
33
|
+
"@opentui/core": ">=0.1.96",
|
|
34
|
+
"@opentui/solid": ">=0.1.96"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@opentui/core": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@opentui/core": "0.1.
|
|
46
|
-
"@opentui/solid": "0.1.
|
|
45
|
+
"@opentui/core": "0.1.96",
|
|
46
|
+
"@opentui/solid": "0.1.96",
|
|
47
47
|
"@tsconfig/node22": "22.0.2",
|
|
48
48
|
"@types/node": "22.13.9",
|
|
49
49
|
"typescript": "5.8.2",
|