@opencode-ai/plugin 0.0.0-snapshot-tui-plugins-202603271347 → 0.0.0-tui-v2-202606261840
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/example-workspace.d.ts +3 -0
- package/dist/example-workspace.js +30 -0
- package/dist/example.js +1 -1
- package/dist/index.d.ts +67 -2
- package/dist/tool.d.ts +16 -2
- package/dist/tui.d.ts +196 -43
- package/dist/tui.js +7 -1
- package/dist/v2/effect/agent.d.ts +12 -0
- package/dist/v2/effect/agent.js +1 -0
- package/dist/v2/effect/aisdk.d.ts +17 -0
- package/dist/v2/effect/aisdk.js +1 -0
- package/dist/v2/effect/catalog.d.ts +29 -0
- package/dist/v2/effect/catalog.js +1 -0
- package/dist/v2/effect/command.d.ts +11 -0
- package/dist/v2/effect/command.js +1 -0
- package/dist/v2/effect/context.d.ts +21 -0
- package/dist/v2/effect/context.js +1 -0
- package/dist/v2/effect/event.d.ts +8 -0
- package/dist/v2/effect/event.js +1 -0
- package/dist/v2/effect/filesystem.d.ts +23 -0
- package/dist/v2/effect/filesystem.js +1 -0
- package/dist/v2/effect/index.d.ts +3 -0
- package/dist/v2/effect/index.js +1 -0
- package/dist/v2/effect/integration.d.ts +46 -0
- package/dist/v2/effect/integration.js +1 -0
- package/dist/v2/effect/location.d.ts +6 -0
- package/dist/v2/effect/location.js +1 -0
- package/dist/v2/effect/npm.d.ts +7 -0
- package/dist/v2/effect/npm.js +1 -0
- package/dist/v2/effect/path.d.ts +8 -0
- package/dist/v2/effect/path.js +1 -0
- package/dist/v2/effect/plugin.d.ts +11 -0
- package/dist/v2/effect/plugin.js +3 -0
- package/dist/v2/effect/reference.d.ts +10 -0
- package/dist/v2/effect/reference.js +1 -0
- package/dist/v2/effect/registration.d.ts +10 -0
- package/dist/v2/effect/registration.js +1 -0
- package/dist/v2/effect/skill.d.ts +9 -0
- package/dist/v2/effect/skill.js +1 -0
- package/dist/v2/options.d.ts +1 -0
- package/dist/v2/options.js +1 -0
- package/dist/v2/promise/agent.d.ts +6 -0
- package/dist/v2/promise/agent.js +1 -0
- package/dist/v2/promise/aisdk.d.ts +17 -0
- package/dist/v2/promise/aisdk.js +1 -0
- package/dist/v2/promise/catalog.d.ts +6 -0
- package/dist/v2/promise/catalog.js +1 -0
- package/dist/v2/promise/command.d.ts +6 -0
- package/dist/v2/promise/command.js +1 -0
- package/dist/v2/promise/context.d.ts +21 -0
- package/dist/v2/promise/context.js +1 -0
- package/dist/v2/promise/index.d.ts +12 -0
- package/dist/v2/promise/index.js +1 -0
- package/dist/v2/promise/integration.d.ts +12 -0
- package/dist/v2/promise/integration.js +1 -0
- package/dist/v2/promise/plugin.d.ts +10 -0
- package/dist/v2/promise/plugin.js +3 -0
- package/dist/v2/promise/reference.d.ts +6 -0
- package/dist/v2/promise/reference.js +1 -0
- package/dist/v2/promise/registration.d.ts +9 -0
- package/dist/v2/promise/registration.js +1 -0
- package/dist/v2/promise/skill.d.ts +6 -0
- package/dist/v2/promise/skill.js +1 -0
- package/package.json +30 -7
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mkdir, rm } from "node:fs/promises";
|
|
2
|
+
export const FolderWorkspacePlugin = async ({ experimental_workspace }) => {
|
|
3
|
+
experimental_workspace.register("folder", {
|
|
4
|
+
name: "Folder",
|
|
5
|
+
description: "Create a blank folder",
|
|
6
|
+
configure(config) {
|
|
7
|
+
const rand = "" + Math.random();
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
directory: `/tmp/folder/folder-${rand}`,
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
async create(config) {
|
|
14
|
+
if (!config.directory)
|
|
15
|
+
return;
|
|
16
|
+
await mkdir(config.directory, { recursive: true });
|
|
17
|
+
},
|
|
18
|
+
async remove(config) {
|
|
19
|
+
await rm(config.directory, { recursive: true, force: true });
|
|
20
|
+
},
|
|
21
|
+
target(config) {
|
|
22
|
+
return {
|
|
23
|
+
type: "local",
|
|
24
|
+
directory: config.directory,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return {};
|
|
29
|
+
};
|
|
30
|
+
export default FolderWorkspacePlugin;
|
package/dist/example.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part,
|
|
1
|
+
import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Config as SDKConfig } from "@opencode-ai/sdk";
|
|
2
|
+
import type { Provider as ProviderV2, Model as ModelV2, Auth } 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";
|
|
@@ -7,11 +8,39 @@ export type ProviderContext = {
|
|
|
7
8
|
info: Provider;
|
|
8
9
|
options: Record<string, any>;
|
|
9
10
|
};
|
|
11
|
+
export type WorkspaceInfo = {
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
name: string;
|
|
15
|
+
branch: string | null;
|
|
16
|
+
directory: string | null;
|
|
17
|
+
extra: unknown | null;
|
|
18
|
+
projectID: string;
|
|
19
|
+
};
|
|
20
|
+
export type WorkspaceTarget = {
|
|
21
|
+
type: "local";
|
|
22
|
+
directory: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "remote";
|
|
25
|
+
url: string | URL;
|
|
26
|
+
headers?: HeadersInit;
|
|
27
|
+
};
|
|
28
|
+
export type WorkspaceAdapter = {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
configure(config: WorkspaceInfo): WorkspaceInfo | Promise<WorkspaceInfo>;
|
|
32
|
+
create(config: WorkspaceInfo, env: Record<string, string | undefined>, from?: WorkspaceInfo): Promise<void>;
|
|
33
|
+
remove(config: WorkspaceInfo): Promise<void>;
|
|
34
|
+
target(config: WorkspaceInfo): WorkspaceTarget | Promise<WorkspaceTarget>;
|
|
35
|
+
};
|
|
10
36
|
export type PluginInput = {
|
|
11
37
|
client: ReturnType<typeof createOpencodeClient>;
|
|
12
38
|
project: Project;
|
|
13
39
|
directory: string;
|
|
14
40
|
worktree: string;
|
|
41
|
+
experimental_workspace: {
|
|
42
|
+
register(type: string, adapter: WorkspaceAdapter): void;
|
|
43
|
+
};
|
|
15
44
|
serverUrl: URL;
|
|
16
45
|
$: BunShell;
|
|
17
46
|
};
|
|
@@ -22,7 +51,8 @@ export type Config = Omit<SDKConfig, "plugin"> & {
|
|
|
22
51
|
export type Plugin = (input: PluginInput, options?: PluginOptions) => Promise<Hooks>;
|
|
23
52
|
export type PluginModule = {
|
|
24
53
|
id?: string;
|
|
25
|
-
server
|
|
54
|
+
server: Plugin;
|
|
55
|
+
tui?: never;
|
|
26
56
|
};
|
|
27
57
|
type Rule = {
|
|
28
58
|
key: string;
|
|
@@ -87,6 +117,7 @@ export type AuthHook = {
|
|
|
87
117
|
type: "success";
|
|
88
118
|
key: string;
|
|
89
119
|
provider?: string;
|
|
120
|
+
metadata?: Record<string, string>;
|
|
90
121
|
} | {
|
|
91
122
|
type: "failed";
|
|
92
123
|
}>;
|
|
@@ -108,6 +139,7 @@ export type AuthOAuthResult = {
|
|
|
108
139
|
enterpriseUrl?: string;
|
|
109
140
|
} | {
|
|
110
141
|
key: string;
|
|
142
|
+
metadata?: Record<string, string>;
|
|
111
143
|
})) | {
|
|
112
144
|
type: "failed";
|
|
113
145
|
}>;
|
|
@@ -124,13 +156,22 @@ export type AuthOAuthResult = {
|
|
|
124
156
|
enterpriseUrl?: string;
|
|
125
157
|
} | {
|
|
126
158
|
key: string;
|
|
159
|
+
metadata?: Record<string, string>;
|
|
127
160
|
})) | {
|
|
128
161
|
type: "failed";
|
|
129
162
|
}>;
|
|
130
163
|
});
|
|
164
|
+
export type ProviderHookContext = {
|
|
165
|
+
auth?: Auth;
|
|
166
|
+
};
|
|
167
|
+
export type ProviderHook = {
|
|
168
|
+
id: string;
|
|
169
|
+
models?: (provider: ProviderV2, ctx: ProviderHookContext) => Promise<Record<string, ModelV2>>;
|
|
170
|
+
};
|
|
131
171
|
/** @deprecated Use AuthOAuthResult instead. */
|
|
132
172
|
export type AuthOuathResult = AuthOAuthResult;
|
|
133
173
|
export interface Hooks {
|
|
174
|
+
dispose?: () => Promise<void>;
|
|
134
175
|
event?: (input: {
|
|
135
176
|
event: Event;
|
|
136
177
|
}) => Promise<void>;
|
|
@@ -139,6 +180,7 @@ export interface Hooks {
|
|
|
139
180
|
[key: string]: ToolDefinition;
|
|
140
181
|
};
|
|
141
182
|
auth?: AuthHook;
|
|
183
|
+
provider?: ProviderHook;
|
|
142
184
|
/**
|
|
143
185
|
* Called when a new message is received
|
|
144
186
|
*/
|
|
@@ -168,6 +210,7 @@ export interface Hooks {
|
|
|
168
210
|
temperature: number;
|
|
169
211
|
topP: number;
|
|
170
212
|
topK: number;
|
|
213
|
+
maxOutputTokens: number | undefined;
|
|
171
214
|
options: Record<string, any>;
|
|
172
215
|
}) => Promise<void>;
|
|
173
216
|
"chat.headers"?: (input: {
|
|
@@ -225,6 +268,11 @@ export interface Hooks {
|
|
|
225
268
|
}, output: {
|
|
226
269
|
system: string[];
|
|
227
270
|
}) => Promise<void>;
|
|
271
|
+
"experimental.provider.small_model"?: (input: {
|
|
272
|
+
provider: ProviderV2;
|
|
273
|
+
}, output: {
|
|
274
|
+
model?: ModelV2;
|
|
275
|
+
}) => Promise<void>;
|
|
228
276
|
/**
|
|
229
277
|
* Called before session compaction starts. Allows plugins to customize
|
|
230
278
|
* the compaction prompt.
|
|
@@ -238,6 +286,23 @@ export interface Hooks {
|
|
|
238
286
|
context: string[];
|
|
239
287
|
prompt?: string;
|
|
240
288
|
}) => Promise<void>;
|
|
289
|
+
/**
|
|
290
|
+
* Called after compaction succeeds and before a synthetic user
|
|
291
|
+
* auto-continue message is added.
|
|
292
|
+
*
|
|
293
|
+
* - `enabled`: Defaults to `true`. Set to `false` to skip the synthetic
|
|
294
|
+
* user "continue" turn.
|
|
295
|
+
*/
|
|
296
|
+
"experimental.compaction.autocontinue"?: (input: {
|
|
297
|
+
sessionID: string;
|
|
298
|
+
agent: string;
|
|
299
|
+
model: Model;
|
|
300
|
+
provider: ProviderContext;
|
|
301
|
+
message: UserMessage;
|
|
302
|
+
overflow: boolean;
|
|
303
|
+
}, output: {
|
|
304
|
+
enabled: boolean;
|
|
305
|
+
}) => Promise<void>;
|
|
241
306
|
"experimental.text.complete"?: (input: {
|
|
242
307
|
sessionID: string;
|
|
243
308
|
messageID: string;
|
package/dist/tool.d.ts
CHANGED
|
@@ -30,14 +30,28 @@ type AskInput = {
|
|
|
30
30
|
[key: string]: any;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
export type ToolAttachment = {
|
|
34
|
+
type: "file";
|
|
35
|
+
mime: string;
|
|
36
|
+
url: string;
|
|
37
|
+
filename?: string;
|
|
38
|
+
};
|
|
39
|
+
export type ToolResult = string | {
|
|
40
|
+
title?: string;
|
|
41
|
+
output: string;
|
|
42
|
+
metadata?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
attachments?: ToolAttachment[];
|
|
46
|
+
};
|
|
33
47
|
export declare function tool<Args extends z.ZodRawShape>(input: {
|
|
34
48
|
description: string;
|
|
35
49
|
args: Args;
|
|
36
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<
|
|
50
|
+
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
|
|
37
51
|
}): {
|
|
38
52
|
description: string;
|
|
39
53
|
args: Args;
|
|
40
|
-
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<
|
|
54
|
+
execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
|
|
41
55
|
};
|
|
42
56
|
export declare namespace tool {
|
|
43
57
|
var schema: typeof z;
|
package/dist/tui.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type { OpencodeClient, Event, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus,
|
|
2
|
-
import type { CliRenderer,
|
|
1
|
+
import type { AgentPart, OpencodeClient, Event, FilePart, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, Session, SessionStatus, TextPart, Config as SdkConfig } from "@opencode-ai/sdk/v2";
|
|
2
|
+
import type { CliRenderer, KeyEvent, RGBA, Renderable, SlotMode } from "@opentui/core";
|
|
3
|
+
import type { Binding, Keymap } from "@opentui/keymap";
|
|
4
|
+
import { type BindingConfig, type CreateBindingLookupOptions, type KeySequenceFormatPart, type SequenceBindingLike } from "@opentui/keymap/extras";
|
|
3
5
|
import type { JSX, SolidPlugin } from "@opentui/solid";
|
|
4
|
-
import type { Config as PluginConfig,
|
|
5
|
-
export type { CliRenderer, SlotMode } from "@opentui/core";
|
|
6
|
+
import type { Config as PluginConfig, PluginOptions } from "./index.js";
|
|
7
|
+
export type { CliRenderer, KeyEvent, Renderable, SlotMode } from "@opentui/core";
|
|
8
|
+
export { stringifyKeySequence, stringifyKeyStroke } from "@opentui/keymap";
|
|
9
|
+
export type { Binding, KeyLike, KeySequencePart, KeyStringifyInput, StringifyOptions } from "@opentui/keymap";
|
|
10
|
+
export { formatCommandBindings, formatKeySequence } from "@opentui/keymap/extras";
|
|
11
|
+
export type { BindingConfig, BindingLookup, BindingValue, CreateBindingLookupOptions, FormatCommandBindingsOptions, FormatKeySequenceOptions, KeySequenceFormatPart, SequenceBindingLike, } from "@opentui/keymap/extras";
|
|
12
|
+
export declare function createBindingLookup(config: BindingConfig<Renderable, KeyEvent> | undefined, options?: CreateBindingLookupOptions<Renderable, KeyEvent>): import("@opentui/keymap/extras").BindingLookup<Renderable, KeyEvent>;
|
|
6
13
|
export type TuiRouteCurrent = {
|
|
7
14
|
name: "home";
|
|
8
15
|
} | {
|
|
9
16
|
name: "session";
|
|
10
17
|
params: {
|
|
11
18
|
sessionID: string;
|
|
12
|
-
|
|
19
|
+
prompt?: unknown;
|
|
13
20
|
};
|
|
14
21
|
} | {
|
|
15
22
|
name: string;
|
|
@@ -21,6 +28,20 @@ export type TuiRouteDefinition = {
|
|
|
21
28
|
params?: Record<string, unknown>;
|
|
22
29
|
}) => JSX.Element;
|
|
23
30
|
};
|
|
31
|
+
export type TuiKeys = {
|
|
32
|
+
formatSequence: (parts: readonly KeySequenceFormatPart[] | undefined) => string;
|
|
33
|
+
formatBindings: (bindings: readonly SequenceBindingLike[] | undefined) => string | undefined;
|
|
34
|
+
};
|
|
35
|
+
export type TuiKeymap = Keymap<Renderable, KeyEvent>;
|
|
36
|
+
export type TuiModeApi = {
|
|
37
|
+
current: () => string;
|
|
38
|
+
push: (mode: string) => () => void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Legacy `api.command` shape kept so v1 plugins can initialize. Remove in v2.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Use `api.keymap.registerLayer({ commands, bindings })` instead.
|
|
44
|
+
*/
|
|
24
45
|
export type TuiCommand = {
|
|
25
46
|
title: string;
|
|
26
47
|
value: string;
|
|
@@ -34,22 +55,21 @@ export type TuiCommand = {
|
|
|
34
55
|
name: string;
|
|
35
56
|
aliases?: string[];
|
|
36
57
|
};
|
|
37
|
-
onSelect?: () => void
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
print: (name: string) => string;
|
|
58
|
+
onSelect?: (dialog?: TuiDialogStack) => void | Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Legacy `api.command` API kept so v1 plugins can initialize. Remove in v2.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use `api.keymap.registerLayer`, `api.keymap.dispatchCommand`, and
|
|
64
|
+
* `api.keymap.dispatchCommand("command.palette.show")` instead.
|
|
65
|
+
*/
|
|
66
|
+
export type TuiCommandApi = {
|
|
67
|
+
/** @deprecated Use `api.keymap.registerLayer({ commands, bindings })` instead. */
|
|
68
|
+
register: (cb: () => TuiCommand[]) => () => void;
|
|
69
|
+
/** @deprecated Use `api.keymap.dispatchCommand(name)` instead. */
|
|
70
|
+
trigger: (value: string) => void;
|
|
71
|
+
/** @deprecated Use `api.keymap.dispatchCommand("command.palette.show")` instead. */
|
|
72
|
+
show: () => void;
|
|
53
73
|
};
|
|
54
74
|
export type TuiDialogProps = {
|
|
55
75
|
size?: "medium" | "large" | "xlarge";
|
|
@@ -80,6 +100,8 @@ export type TuiDialogPromptProps = {
|
|
|
80
100
|
description?: () => JSX.Element;
|
|
81
101
|
placeholder?: string;
|
|
82
102
|
value?: string;
|
|
103
|
+
busy?: boolean;
|
|
104
|
+
busyText?: string;
|
|
83
105
|
onConfirm?: (value: string) => void;
|
|
84
106
|
onCancel?: () => void;
|
|
85
107
|
};
|
|
@@ -103,12 +125,96 @@ export type TuiDialogSelectProps<Value = unknown> = {
|
|
|
103
125
|
skipFilter?: boolean;
|
|
104
126
|
current?: Value;
|
|
105
127
|
};
|
|
128
|
+
export type TuiPromptInfo = {
|
|
129
|
+
input: string;
|
|
130
|
+
mode?: "normal" | "shell";
|
|
131
|
+
parts: (Omit<FilePart, "id" | "messageID" | "sessionID"> | Omit<AgentPart, "id" | "messageID" | "sessionID"> | (Omit<TextPart, "id" | "messageID" | "sessionID"> & {
|
|
132
|
+
source?: {
|
|
133
|
+
text: {
|
|
134
|
+
start: number;
|
|
135
|
+
end: number;
|
|
136
|
+
value: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}))[];
|
|
140
|
+
};
|
|
141
|
+
export type TuiPromptRef = {
|
|
142
|
+
focused: boolean;
|
|
143
|
+
current: TuiPromptInfo;
|
|
144
|
+
set(prompt: TuiPromptInfo): void;
|
|
145
|
+
reset(): void;
|
|
146
|
+
blur(): void;
|
|
147
|
+
focus(): void;
|
|
148
|
+
submit(): void;
|
|
149
|
+
};
|
|
150
|
+
export type TuiPromptProps = {
|
|
151
|
+
sessionID?: string;
|
|
152
|
+
visible?: boolean;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
onSubmit?: () => void;
|
|
155
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
156
|
+
hint?: JSX.Element;
|
|
157
|
+
right?: JSX.Element;
|
|
158
|
+
showPlaceholder?: boolean;
|
|
159
|
+
placeholders?: {
|
|
160
|
+
normal?: string[];
|
|
161
|
+
shell?: string[];
|
|
162
|
+
};
|
|
163
|
+
};
|
|
106
164
|
export type TuiToast = {
|
|
107
165
|
variant?: "info" | "success" | "warning" | "error";
|
|
108
166
|
title?: string;
|
|
109
167
|
message: string;
|
|
110
168
|
duration?: number;
|
|
111
169
|
};
|
|
170
|
+
export type TuiAttentionWhen = "always" | "focused" | "blurred";
|
|
171
|
+
export declare const TuiAttentionSoundNames: readonly ["default", "question", "permission", "error", "done", "subagent_done"];
|
|
172
|
+
export type TuiAttentionSoundName = (typeof TuiAttentionSoundNames)[number];
|
|
173
|
+
export type TuiAttentionSound = boolean | {
|
|
174
|
+
name?: TuiAttentionSoundName;
|
|
175
|
+
volume?: number;
|
|
176
|
+
when?: TuiAttentionWhen;
|
|
177
|
+
};
|
|
178
|
+
export type TuiAttentionNotification = boolean | {
|
|
179
|
+
when?: TuiAttentionWhen;
|
|
180
|
+
};
|
|
181
|
+
export type TuiAttentionSoundPack = {
|
|
182
|
+
id: string;
|
|
183
|
+
name?: string;
|
|
184
|
+
sounds: Partial<Record<TuiAttentionSoundName, string>>;
|
|
185
|
+
};
|
|
186
|
+
export type TuiAttentionSoundPackInfo = {
|
|
187
|
+
id: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
active: boolean;
|
|
190
|
+
builtin: boolean;
|
|
191
|
+
};
|
|
192
|
+
export type TuiAttentionSoundboardActivateOptions = {
|
|
193
|
+
persist?: boolean;
|
|
194
|
+
};
|
|
195
|
+
export type TuiAttentionSoundboard = {
|
|
196
|
+
registerPack(pack: TuiAttentionSoundPack): () => void;
|
|
197
|
+
activate(id: string, options?: TuiAttentionSoundboardActivateOptions): boolean;
|
|
198
|
+
current(): string;
|
|
199
|
+
list(): ReadonlyArray<TuiAttentionSoundPackInfo>;
|
|
200
|
+
};
|
|
201
|
+
export type TuiAttentionNotifyInput = {
|
|
202
|
+
title?: string;
|
|
203
|
+
message: string;
|
|
204
|
+
notification?: TuiAttentionNotification;
|
|
205
|
+
sound?: TuiAttentionSound;
|
|
206
|
+
};
|
|
207
|
+
export type TuiAttentionNotifySkipReason = "attention_disabled" | "empty_message" | "blurred" | "focused" | "focus_unknown" | "renderer_destroyed";
|
|
208
|
+
export type TuiAttentionNotifyResult = {
|
|
209
|
+
ok: boolean;
|
|
210
|
+
notification: boolean;
|
|
211
|
+
sound: boolean;
|
|
212
|
+
skipped?: TuiAttentionNotifySkipReason;
|
|
213
|
+
};
|
|
214
|
+
export type TuiAttention = {
|
|
215
|
+
notify(input: TuiAttentionNotifyInput): Promise<TuiAttentionNotifyResult>;
|
|
216
|
+
soundboard: TuiAttentionSoundboard;
|
|
217
|
+
};
|
|
112
218
|
export type TuiThemeCurrent = {
|
|
113
219
|
readonly primary: RGBA;
|
|
114
220
|
readonly secondary: RGBA;
|
|
@@ -190,13 +296,11 @@ export type TuiState = {
|
|
|
190
296
|
};
|
|
191
297
|
readonly vcs: {
|
|
192
298
|
branch?: string;
|
|
299
|
+
default_branch?: string;
|
|
193
300
|
} | undefined;
|
|
194
|
-
readonly workspace: {
|
|
195
|
-
list: () => ReadonlyArray<Workspace>;
|
|
196
|
-
get: (workspaceID: string) => Workspace | undefined;
|
|
197
|
-
};
|
|
198
301
|
session: {
|
|
199
302
|
count: () => number;
|
|
303
|
+
get: (sessionID: string) => Session | undefined;
|
|
200
304
|
diff: (sessionID: string) => ReadonlyArray<TuiSidebarFileItem>;
|
|
201
305
|
todo: (sessionID: string) => ReadonlyArray<TuiSidebarTodoItem>;
|
|
202
306
|
messages: (sessionID: string) => ReadonlyArray<Message>;
|
|
@@ -208,8 +312,27 @@ export type TuiState = {
|
|
|
208
312
|
lsp: () => ReadonlyArray<TuiSidebarLspItem>;
|
|
209
313
|
mcp: () => ReadonlyArray<TuiSidebarMcpItem>;
|
|
210
314
|
};
|
|
211
|
-
type
|
|
315
|
+
type TuiBindingLookupView = {
|
|
316
|
+
readonly bindings: ReadonlyArray<Binding<Renderable, KeyEvent>>;
|
|
317
|
+
get: (command: string) => ReadonlyArray<Binding<Renderable, KeyEvent>>;
|
|
318
|
+
has: (command: string) => boolean;
|
|
319
|
+
gather: (name: string, commands: readonly string[]) => ReadonlyArray<Binding<Renderable, KeyEvent>>;
|
|
320
|
+
pick: (name: string, commands: readonly string[]) => Binding<Renderable, KeyEvent>[];
|
|
321
|
+
omit: (name: string, commands: readonly string[]) => Binding<Renderable, KeyEvent>[];
|
|
322
|
+
};
|
|
323
|
+
type TuiAttentionConfigView = {
|
|
324
|
+
enabled: boolean;
|
|
325
|
+
notifications: boolean;
|
|
326
|
+
sound: boolean;
|
|
327
|
+
volume: number;
|
|
328
|
+
sound_pack: string;
|
|
329
|
+
sounds: Partial<Record<TuiAttentionSoundName, string>>;
|
|
330
|
+
};
|
|
331
|
+
type TuiConfigView = Pick<PluginConfig, "$schema" | "theme" | "plugin"> & NonNullable<PluginConfig["tui"]> & {
|
|
332
|
+
leader_timeout: number;
|
|
333
|
+
attention: TuiAttentionConfigView;
|
|
212
334
|
plugin_enabled?: Record<string, boolean>;
|
|
335
|
+
keybinds: TuiBindingLookupView;
|
|
213
336
|
};
|
|
214
337
|
export type TuiApp = {
|
|
215
338
|
readonly version: string;
|
|
@@ -229,10 +352,26 @@ export type TuiSidebarFileItem = {
|
|
|
229
352
|
additions: number;
|
|
230
353
|
deletions: number;
|
|
231
354
|
};
|
|
232
|
-
export type
|
|
355
|
+
export type TuiHostSlotMap = {
|
|
233
356
|
app: {};
|
|
357
|
+
app_bottom: {};
|
|
234
358
|
home_logo: {};
|
|
359
|
+
home_prompt: {
|
|
360
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
361
|
+
};
|
|
362
|
+
home_prompt_right: {};
|
|
363
|
+
session_prompt: {
|
|
364
|
+
session_id: string;
|
|
365
|
+
visible?: boolean;
|
|
366
|
+
disabled?: boolean;
|
|
367
|
+
on_submit?: () => void;
|
|
368
|
+
ref?: (ref: TuiPromptRef | undefined) => void;
|
|
369
|
+
};
|
|
370
|
+
session_prompt_right: {
|
|
371
|
+
session_id: string;
|
|
372
|
+
};
|
|
235
373
|
home_bottom: {};
|
|
374
|
+
home_footer: {};
|
|
236
375
|
sidebar_title: {
|
|
237
376
|
session_id: string;
|
|
238
377
|
title: string;
|
|
@@ -245,15 +384,25 @@ export type TuiSlotMap = {
|
|
|
245
384
|
session_id: string;
|
|
246
385
|
};
|
|
247
386
|
};
|
|
387
|
+
export type TuiSlotMap<Slots extends Record<string, object> = {}> = TuiHostSlotMap & Slots;
|
|
388
|
+
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>;
|
|
389
|
+
export type TuiSlotProps<Name extends string = string, Slots extends Record<string, object> = {}> = {
|
|
390
|
+
name: Name;
|
|
391
|
+
mode?: SlotMode;
|
|
392
|
+
children?: JSX.Element;
|
|
393
|
+
} & TuiSlotShape<Name, Slots>;
|
|
248
394
|
export type TuiSlotContext = {
|
|
249
395
|
theme: TuiTheme;
|
|
250
396
|
};
|
|
251
|
-
type SlotCore = SolidPlugin<TuiSlotMap
|
|
252
|
-
export type TuiSlotPlugin = Omit<SlotCore
|
|
397
|
+
type SlotCore<Slots extends Record<string, object> = {}> = SolidPlugin<TuiSlotMap<Slots>, TuiSlotContext>;
|
|
398
|
+
export type TuiSlotPlugin<Slots extends Record<string, object> = {}> = Omit<SlotCore<Slots>, "id"> & {
|
|
253
399
|
id?: never;
|
|
254
400
|
};
|
|
255
401
|
export type TuiSlots = {
|
|
256
|
-
register:
|
|
402
|
+
register: {
|
|
403
|
+
(plugin: TuiSlotPlugin): string;
|
|
404
|
+
<Slots extends Record<string, object>>(plugin: TuiSlotPlugin<Slots>): string;
|
|
405
|
+
};
|
|
257
406
|
};
|
|
258
407
|
export type TuiEventBus = {
|
|
259
408
|
on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
|
|
@@ -309,10 +458,17 @@ export type TuiWorkspace = {
|
|
|
309
458
|
};
|
|
310
459
|
export type TuiPluginApi = {
|
|
311
460
|
app: TuiApp;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
461
|
+
attention: TuiAttention;
|
|
462
|
+
/**
|
|
463
|
+
* Legacy `api.command` API kept so v1 plugins can initialize. Remove in v2.
|
|
464
|
+
*
|
|
465
|
+
* @deprecated Use `api.keymap.registerLayer`, `api.keymap.dispatchCommand`, and
|
|
466
|
+
* `api.keymap.dispatchCommand("command.palette.show")` instead.
|
|
467
|
+
*/
|
|
468
|
+
command?: TuiCommandApi;
|
|
469
|
+
keys: TuiKeys;
|
|
470
|
+
keymap: TuiKeymap;
|
|
471
|
+
mode: TuiModeApi;
|
|
316
472
|
route: {
|
|
317
473
|
register: (routes: TuiRouteDefinition[]) => () => void;
|
|
318
474
|
navigate: (name: string, params?: Record<string, unknown>) => void;
|
|
@@ -324,21 +480,16 @@ export type TuiPluginApi = {
|
|
|
324
480
|
DialogConfirm: (props: TuiDialogConfirmProps) => JSX.Element;
|
|
325
481
|
DialogPrompt: (props: TuiDialogPromptProps) => JSX.Element;
|
|
326
482
|
DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value>) => JSX.Element;
|
|
483
|
+
Slot: <Name extends string>(props: TuiSlotProps<Name>) => JSX.Element | null;
|
|
484
|
+
Prompt: (props: TuiPromptProps) => JSX.Element;
|
|
327
485
|
toast: (input: TuiToast) => void;
|
|
328
486
|
dialog: TuiDialogStack;
|
|
329
487
|
};
|
|
330
|
-
keybind: {
|
|
331
|
-
match: (key: string, evt: ParsedKey) => boolean;
|
|
332
|
-
print: (key: string) => string;
|
|
333
|
-
create: (defaults: TuiKeybindMap, overrides?: Record<string, unknown>) => TuiKeybindSet;
|
|
334
|
-
};
|
|
335
488
|
readonly tuiConfig: Frozen<TuiConfigView>;
|
|
336
489
|
kv: TuiKV;
|
|
337
490
|
state: TuiState;
|
|
338
491
|
theme: TuiTheme;
|
|
339
492
|
client: OpencodeClient;
|
|
340
|
-
scopedClient: (workspaceID?: string) => OpencodeClient;
|
|
341
|
-
workspace: TuiWorkspace;
|
|
342
493
|
event: TuiEventBus;
|
|
343
494
|
renderer: CliRenderer;
|
|
344
495
|
slots: TuiSlots;
|
|
@@ -352,6 +503,8 @@ export type TuiPluginApi = {
|
|
|
352
503
|
lifecycle: TuiLifecycle;
|
|
353
504
|
};
|
|
354
505
|
export type TuiPlugin = (api: TuiPluginApi, options: PluginOptions | undefined, meta: TuiPluginMeta) => Promise<void>;
|
|
355
|
-
export type TuiPluginModule =
|
|
356
|
-
|
|
506
|
+
export type TuiPluginModule = {
|
|
507
|
+
id?: string;
|
|
508
|
+
tui: TuiPlugin;
|
|
509
|
+
server?: never;
|
|
357
510
|
};
|
package/dist/tui.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { createBindingLookup as createKeymapBindingLookup, } from "@opentui/keymap/extras";
|
|
2
|
+
export { stringifyKeySequence, stringifyKeyStroke } from "@opentui/keymap";
|
|
3
|
+
export { formatCommandBindings, formatKeySequence } from "@opentui/keymap/extras";
|
|
4
|
+
export function createBindingLookup(config, options) {
|
|
5
|
+
return createKeymapBindingLookup(config ?? {}, options);
|
|
6
|
+
}
|
|
7
|
+
export const TuiAttentionSoundNames = ["default", "question", "permission", "error", "done", "subagent_done"];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentV2Info } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Hooks } from "./registration.js";
|
|
3
|
+
export interface AgentDraft {
|
|
4
|
+
list(): readonly AgentV2Info[];
|
|
5
|
+
get(id: string): AgentV2Info | undefined;
|
|
6
|
+
default(id: string | undefined): void;
|
|
7
|
+
update(id: string, update: (agent: AgentV2Info) => void): void;
|
|
8
|
+
remove(id: string): void;
|
|
9
|
+
}
|
|
10
|
+
export type AgentHooks = Hooks<{
|
|
11
|
+
transform: AgentDraft;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LanguageModelV3 } from "@ai-sdk/provider";
|
|
2
|
+
import type { ModelV2Info } from "@opencode-ai/sdk/v2/types";
|
|
3
|
+
import type { Hooks } from "./registration.js";
|
|
4
|
+
export type AISDKHooks = Hooks<{
|
|
5
|
+
sdk: {
|
|
6
|
+
readonly model: ModelV2Info;
|
|
7
|
+
readonly package: string;
|
|
8
|
+
readonly options: Record<string, any>;
|
|
9
|
+
sdk?: any;
|
|
10
|
+
};
|
|
11
|
+
language: {
|
|
12
|
+
readonly model: ModelV2Info;
|
|
13
|
+
readonly sdk: any;
|
|
14
|
+
readonly options: Record<string, any>;
|
|
15
|
+
language?: LanguageModelV3;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ModelV2Info, ProviderV2Info } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Hooks } from "./registration.js";
|
|
3
|
+
export interface CatalogProviderRecord {
|
|
4
|
+
readonly provider: ProviderV2Info;
|
|
5
|
+
readonly models: ReadonlyMap<string, ModelV2Info>;
|
|
6
|
+
}
|
|
7
|
+
export interface CatalogDraft {
|
|
8
|
+
readonly provider: {
|
|
9
|
+
list(): readonly CatalogProviderRecord[];
|
|
10
|
+
get(providerID: string): CatalogProviderRecord | undefined;
|
|
11
|
+
update(providerID: string, update: (provider: ProviderV2Info) => void): void;
|
|
12
|
+
remove(providerID: string): void;
|
|
13
|
+
};
|
|
14
|
+
readonly model: {
|
|
15
|
+
get(providerID: string, modelID: string): ModelV2Info | undefined;
|
|
16
|
+
update(providerID: string, modelID: string, update: (model: ModelV2Info) => void): void;
|
|
17
|
+
remove(providerID: string, modelID: string): void;
|
|
18
|
+
readonly default: {
|
|
19
|
+
get(): {
|
|
20
|
+
providerID: string;
|
|
21
|
+
modelID: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
set(providerID: string, modelID: string): void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type CatalogHooks = Hooks<{
|
|
28
|
+
transform: CatalogDraft;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandV2Info } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Hooks } from "./registration.js";
|
|
3
|
+
export interface CommandDraft {
|
|
4
|
+
list(): readonly CommandV2Info[];
|
|
5
|
+
get(name: string): CommandV2Info | undefined;
|
|
6
|
+
update(name: string, update: (command: CommandV2Info) => void): void;
|
|
7
|
+
remove(name: string): void;
|
|
8
|
+
}
|
|
9
|
+
export type CommandHooks = Hooks<{
|
|
10
|
+
transform: CommandDraft;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PluginOptions } from "../options.js";
|
|
2
|
+
import type { AgentHooks } from "./agent.js";
|
|
3
|
+
import type { AISDKHooks } from "./aisdk.js";
|
|
4
|
+
import type { CatalogHooks } from "./catalog.js";
|
|
5
|
+
import type { CommandHooks } from "./command.js";
|
|
6
|
+
import type { IntegrationHooks } from "./integration.js";
|
|
7
|
+
import type { PluginDomain } from "./plugin.js";
|
|
8
|
+
import type { ReferenceHooks } from "./reference.js";
|
|
9
|
+
import type { SkillHooks } from "./skill.js";
|
|
10
|
+
import type { Reload } from "./registration.js";
|
|
11
|
+
export interface PluginContext {
|
|
12
|
+
readonly options: PluginOptions;
|
|
13
|
+
readonly agent: AgentHooks & Reload;
|
|
14
|
+
readonly aisdk: AISDKHooks;
|
|
15
|
+
readonly catalog: CatalogHooks & Reload;
|
|
16
|
+
readonly command: CommandHooks & Reload;
|
|
17
|
+
readonly integration: IntegrationHooks & Reload;
|
|
18
|
+
readonly plugin: PluginDomain;
|
|
19
|
+
readonly reference: ReferenceHooks & Reload;
|
|
20
|
+
readonly skill: SkillHooks & Reload;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Event as SDKEvent } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Stream } from "effect";
|
|
3
|
+
export type EventMap = {
|
|
4
|
+
[Item in SDKEvent as Item["type"]]: Item;
|
|
5
|
+
};
|
|
6
|
+
export interface Event {
|
|
7
|
+
subscribe<Type extends keyof EventMap>(type: Type): Stream.Stream<EventMap[Type]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FileSystemEntry } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Effect } from "effect";
|
|
3
|
+
export interface FileSystem {
|
|
4
|
+
read(input: {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
}): Effect.Effect<{
|
|
7
|
+
readonly content: Uint8Array;
|
|
8
|
+
readonly mime: string;
|
|
9
|
+
}>;
|
|
10
|
+
list(input?: {
|
|
11
|
+
readonly path?: string;
|
|
12
|
+
}): Effect.Effect<FileSystemEntry[]>;
|
|
13
|
+
find(input: {
|
|
14
|
+
readonly query: string;
|
|
15
|
+
readonly type?: "file" | "directory";
|
|
16
|
+
readonly limit?: number;
|
|
17
|
+
}): Effect.Effect<FileSystemEntry[]>;
|
|
18
|
+
glob(input: {
|
|
19
|
+
readonly pattern: string;
|
|
20
|
+
readonly path?: string;
|
|
21
|
+
readonly limit?: number;
|
|
22
|
+
}): Effect.Effect<readonly FileSystemEntry[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { define } from "./plugin.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ConnectionInfo, CredentialOAuth, CredentialValue, IntegrationEnvMethod, IntegrationInputs, IntegrationKeyMethod, IntegrationMethod, IntegrationOAuthMethod, IntegrationRef } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Effect, Scope } from "effect";
|
|
3
|
+
import type { Hooks } from "./registration.js";
|
|
4
|
+
export type IntegrationOAuthAuthorization = {
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly instructions: string;
|
|
7
|
+
} & ({
|
|
8
|
+
readonly mode: "auto";
|
|
9
|
+
readonly callback: Effect.Effect<CredentialOAuth, unknown>;
|
|
10
|
+
} | {
|
|
11
|
+
readonly mode: "code";
|
|
12
|
+
readonly callback: (code: string) => Effect.Effect<CredentialOAuth, unknown>;
|
|
13
|
+
});
|
|
14
|
+
export type IntegrationOAuthMethodRegistration = {
|
|
15
|
+
readonly integrationID: string;
|
|
16
|
+
readonly method: IntegrationOAuthMethod;
|
|
17
|
+
readonly authorize: (inputs: IntegrationInputs) => Effect.Effect<IntegrationOAuthAuthorization, unknown, Scope.Scope>;
|
|
18
|
+
readonly refresh?: (credential: CredentialOAuth) => Effect.Effect<CredentialOAuth, unknown>;
|
|
19
|
+
readonly label?: (credential: CredentialOAuth) => string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type IntegrationMethodRegistration = IntegrationOAuthMethodRegistration | {
|
|
22
|
+
readonly integrationID: string;
|
|
23
|
+
readonly method: IntegrationKeyMethod;
|
|
24
|
+
} | {
|
|
25
|
+
readonly integrationID: string;
|
|
26
|
+
readonly method: IntegrationEnvMethod;
|
|
27
|
+
};
|
|
28
|
+
export interface IntegrationDraft {
|
|
29
|
+
list(): readonly IntegrationRef[];
|
|
30
|
+
get(id: string): IntegrationRef | undefined;
|
|
31
|
+
update(id: string, update: (integration: IntegrationRef) => void): void;
|
|
32
|
+
remove(id: string): void;
|
|
33
|
+
readonly method: {
|
|
34
|
+
list(integrationID: string): readonly IntegrationMethod[];
|
|
35
|
+
update(input: IntegrationMethodRegistration): void;
|
|
36
|
+
remove(integrationID: string, method: IntegrationMethod): void;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface IntegrationHooks extends Hooks<{
|
|
40
|
+
transform: IntegrationDraft;
|
|
41
|
+
}> {
|
|
42
|
+
readonly connection: {
|
|
43
|
+
readonly active: (integrationID: string) => Effect.Effect<ConnectionInfo | undefined>;
|
|
44
|
+
readonly resolve: (connection: ConnectionInfo) => Effect.Effect<CredentialValue | undefined, unknown>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Effect, Scope } from "effect";
|
|
2
|
+
import type { PluginContext } from "./context.js";
|
|
3
|
+
export interface Plugin<R = Scope.Scope> {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly effect: (context: PluginContext) => Effect.Effect<void, never, R>;
|
|
6
|
+
}
|
|
7
|
+
export declare function define<R = Scope.Scope>(plugin: Plugin<R>): Plugin<R>;
|
|
8
|
+
export interface PluginDomain {
|
|
9
|
+
readonly add: (plugin: Plugin) => Effect.Effect<void>;
|
|
10
|
+
readonly remove: (id: string) => Effect.Effect<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReferenceGitSource, ReferenceLocalSource } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Hooks } from "./registration.js";
|
|
3
|
+
export interface ReferenceDraft {
|
|
4
|
+
add(name: string, source: ReferenceLocalSource | ReferenceGitSource): void;
|
|
5
|
+
remove(name: string): void;
|
|
6
|
+
list(): readonly (readonly [string, ReferenceLocalSource | ReferenceGitSource])[];
|
|
7
|
+
}
|
|
8
|
+
export type ReferenceHooks = Hooks<{
|
|
9
|
+
transform: ReferenceDraft;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Effect, Scope } from "effect";
|
|
2
|
+
export interface Registration {
|
|
3
|
+
readonly dispose: Effect.Effect<void>;
|
|
4
|
+
}
|
|
5
|
+
export interface Reload {
|
|
6
|
+
readonly reload: () => Effect.Effect<void>;
|
|
7
|
+
}
|
|
8
|
+
export type Hooks<Spec> = {
|
|
9
|
+
readonly [Name in keyof Spec]: (callback: (input: Spec[Name]) => Effect.Effect<void> | void) => Effect.Effect<Registration, never, Scope.Scope>;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SkillV2Source } from "@opencode-ai/sdk/v2/types";
|
|
2
|
+
import type { Hooks } from "./registration.js";
|
|
3
|
+
export interface SkillDraft {
|
|
4
|
+
source(source: SkillV2Source): void;
|
|
5
|
+
list(): readonly SkillV2Source[];
|
|
6
|
+
}
|
|
7
|
+
export type SkillHooks = Hooks<{
|
|
8
|
+
transform: SkillDraft;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PluginOptions = Readonly<Record<string, any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LanguageModelV3 } from "@ai-sdk/provider";
|
|
2
|
+
import type { ModelV2Info } from "@opencode-ai/sdk/v2/types";
|
|
3
|
+
import type { Hooks } from "./registration.js";
|
|
4
|
+
export type AISDKHooks = Hooks<{
|
|
5
|
+
sdk: {
|
|
6
|
+
readonly model: ModelV2Info;
|
|
7
|
+
readonly package: string;
|
|
8
|
+
readonly options: Record<string, any>;
|
|
9
|
+
sdk?: any;
|
|
10
|
+
};
|
|
11
|
+
language: {
|
|
12
|
+
readonly model: ModelV2Info;
|
|
13
|
+
readonly sdk: any;
|
|
14
|
+
readonly options: Record<string, any>;
|
|
15
|
+
language?: LanguageModelV3;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PluginOptions } from "../options.js";
|
|
2
|
+
import type { AgentHooks } from "./agent.js";
|
|
3
|
+
import type { AISDKHooks } from "./aisdk.js";
|
|
4
|
+
import type { CatalogHooks } from "./catalog.js";
|
|
5
|
+
import type { CommandHooks } from "./command.js";
|
|
6
|
+
import type { IntegrationHooks } from "./integration.js";
|
|
7
|
+
import type { PluginDomain } from "./plugin.js";
|
|
8
|
+
import type { ReferenceHooks } from "./reference.js";
|
|
9
|
+
import type { SkillHooks } from "./skill.js";
|
|
10
|
+
import type { Reload } from "./registration.js";
|
|
11
|
+
export interface PluginContext {
|
|
12
|
+
readonly options: PluginOptions;
|
|
13
|
+
readonly agent: AgentHooks & Reload;
|
|
14
|
+
readonly aisdk: AISDKHooks;
|
|
15
|
+
readonly catalog: CatalogHooks & Reload;
|
|
16
|
+
readonly command: CommandHooks & Reload;
|
|
17
|
+
readonly integration: IntegrationHooks & Reload;
|
|
18
|
+
readonly plugin: PluginDomain;
|
|
19
|
+
readonly reference: ReferenceHooks & Reload;
|
|
20
|
+
readonly skill: SkillHooks & Reload;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { PluginContext } from "./context.js";
|
|
2
|
+
export type { PluginOptions } from "../options.js";
|
|
3
|
+
export { define } from "./plugin.js";
|
|
4
|
+
export type { Plugin, PluginDomain } from "./plugin.js";
|
|
5
|
+
export type { Registration, Reload } from "./registration.js";
|
|
6
|
+
export type { AgentDraft, AgentHooks } from "./agent.js";
|
|
7
|
+
export type { AISDKHooks } from "./aisdk.js";
|
|
8
|
+
export type { CatalogDraft, CatalogHooks, CatalogProviderRecord } from "./catalog.js";
|
|
9
|
+
export type { CommandDraft, CommandHooks } from "./command.js";
|
|
10
|
+
export type { IntegrationDraft, IntegrationHooks, IntegrationMethodRegistration } from "./integration.js";
|
|
11
|
+
export type { ReferenceDraft, ReferenceHooks } from "./reference.js";
|
|
12
|
+
export type { SkillDraft, SkillHooks } from "./skill.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { define } from "./plugin.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IntegrationDraft, IntegrationMethodRegistration } from "../effect/integration.js";
|
|
2
|
+
import type { CredentialValue } from "@opencode-ai/sdk/v2/types";
|
|
3
|
+
import type { Hooks } from "./registration.js";
|
|
4
|
+
export type { IntegrationDraft, IntegrationMethodRegistration };
|
|
5
|
+
export interface IntegrationHooks extends Hooks<{
|
|
6
|
+
transform: IntegrationDraft;
|
|
7
|
+
}> {
|
|
8
|
+
readonly connection: {
|
|
9
|
+
readonly active: (integrationID: string) => Promise<import("@opencode-ai/sdk/v2/types").ConnectionInfo | undefined>;
|
|
10
|
+
readonly resolve: (connection: import("@opencode-ai/sdk/v2/types").ConnectionInfo) => Promise<CredentialValue | undefined>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginContext } from "./context.js";
|
|
2
|
+
export interface Plugin {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly setup: (context: PluginContext) => Promise<void> | void;
|
|
5
|
+
}
|
|
6
|
+
export declare function define(plugin: Plugin): Plugin;
|
|
7
|
+
export interface PluginDomain {
|
|
8
|
+
readonly add: (plugin: Plugin) => Promise<void>;
|
|
9
|
+
readonly remove: (id: string) => Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Registration {
|
|
2
|
+
readonly dispose: () => Promise<void>;
|
|
3
|
+
}
|
|
4
|
+
export interface Reload {
|
|
5
|
+
readonly reload: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export type Hooks<Spec> = {
|
|
8
|
+
readonly [Name in keyof Spec]: (callback: (input: Spec[Name]) => Promise<void> | void) => Promise<Registration>;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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-
|
|
4
|
+
"version": "0.0.0-tui-v2-202606261840",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -20,32 +20,55 @@
|
|
|
20
20
|
"./tui": {
|
|
21
21
|
"import": "./dist/tui.js",
|
|
22
22
|
"types": "./dist/tui.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./v2/effect": {
|
|
25
|
+
"import": "./dist/v2/effect/index.js",
|
|
26
|
+
"types": "./dist/v2/effect/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./v2/effect/integration": {
|
|
29
|
+
"import": "./dist/v2/effect/integration.js",
|
|
30
|
+
"types": "./dist/v2/effect/integration.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./v2/effect/plugin": {
|
|
33
|
+
"import": "./dist/v2/effect/plugin.js",
|
|
34
|
+
"types": "./dist/v2/effect/plugin.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./v2/promise": {
|
|
37
|
+
"import": "./dist/v2/promise/index.js",
|
|
38
|
+
"types": "./dist/v2/promise/index.d.ts"
|
|
23
39
|
}
|
|
24
40
|
},
|
|
25
41
|
"files": [
|
|
26
42
|
"dist"
|
|
27
43
|
],
|
|
28
44
|
"dependencies": {
|
|
29
|
-
"@
|
|
45
|
+
"@ai-sdk/provider": "3.0.8",
|
|
46
|
+
"@opencode-ai/sdk": "0.0.0-tui-v2-202606261840",
|
|
47
|
+
"effect": "4.0.0-beta.83",
|
|
30
48
|
"zod": "4.1.8"
|
|
31
49
|
},
|
|
32
50
|
"peerDependencies": {
|
|
33
|
-
"@opentui/core": ">=0.
|
|
34
|
-
"@opentui/
|
|
51
|
+
"@opentui/core": ">=0.3.4",
|
|
52
|
+
"@opentui/keymap": ">=0.3.4",
|
|
53
|
+
"@opentui/solid": ">=0.3.4"
|
|
35
54
|
},
|
|
36
55
|
"peerDependenciesMeta": {
|
|
37
56
|
"@opentui/core": {
|
|
38
57
|
"optional": true
|
|
39
58
|
},
|
|
59
|
+
"@opentui/keymap": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
40
62
|
"@opentui/solid": {
|
|
41
63
|
"optional": true
|
|
42
64
|
}
|
|
43
65
|
},
|
|
44
66
|
"devDependencies": {
|
|
45
|
-
"@opentui/core": "0.
|
|
46
|
-
"@opentui/
|
|
67
|
+
"@opentui/core": "0.3.4",
|
|
68
|
+
"@opentui/keymap": "0.3.4",
|
|
69
|
+
"@opentui/solid": "0.3.4",
|
|
47
70
|
"@tsconfig/node22": "22.0.2",
|
|
48
|
-
"@types/node": "
|
|
71
|
+
"@types/node": "24.12.2",
|
|
49
72
|
"typescript": "5.8.2",
|
|
50
73
|
"@typescript/native-preview": "7.0.0-dev.20251207.1"
|
|
51
74
|
}
|