@vetta-org/plugin-sdk 0.0.3 → 0.1.0
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/activity-tab.d.ts +18 -0
- package/dist/activity-tab.d.ts.map +1 -0
- package/dist/activity-tab.js +12 -0
- package/dist/activity-tab.js.map +1 -0
- package/dist/agent.d.ts +211 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +2 -0
- package/dist/agent.js.map +1 -0
- package/dist/app-actions.d.ts +63 -0
- package/dist/app-actions.d.ts.map +1 -0
- package/dist/app-actions.js +12 -0
- package/dist/app-actions.js.map +1 -0
- package/dist/command.d.ts +25 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +2 -0
- package/dist/command.js.map +1 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -0
- package/dist/conversation.d.ts +56 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +2 -0
- package/dist/conversation.js.map +1 -0
- package/dist/disposable.d.ts +4 -0
- package/dist/disposable.d.ts.map +1 -0
- package/dist/disposable.js +2 -0
- package/dist/disposable.js.map +1 -0
- package/dist/fs.d.ts +43 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +2 -0
- package/dist/fs.js.map +1 -0
- package/dist/hooks.d.ts +37 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +39 -0
- package/dist/hooks.js.map +1 -0
- package/dist/host-bridge.d.ts +14 -0
- package/dist/host-bridge.d.ts.map +1 -0
- package/dist/host-bridge.js +12 -0
- package/dist/host-bridge.js.map +1 -0
- package/dist/i18n.d.ts +35 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +29 -0
- package/dist/i18n.js.map +1 -0
- package/dist/images.d.ts +17 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +2 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +32 -1478
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -99
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +57 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +2 -0
- package/dist/manifest.js.map +1 -0
- package/dist/network.d.ts +38 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +2 -0
- package/dist/network.js.map +1 -0
- package/dist/official.d.ts +519 -0
- package/dist/official.d.ts.map +1 -0
- package/dist/official.js +2 -0
- package/dist/official.js.map +1 -0
- package/dist/permissions.d.ts +2 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +2 -0
- package/dist/permissions.js.map +1 -0
- package/dist/prompt-attachment.d.ts +15 -0
- package/dist/prompt-attachment.d.ts.map +1 -0
- package/dist/prompt-attachment.js +2 -0
- package/dist/prompt-attachment.js.map +1 -0
- package/dist/scenario.d.ts +9 -0
- package/dist/scenario.d.ts.map +1 -0
- package/dist/scenario.js +2 -0
- package/dist/scenario.js.map +1 -0
- package/dist/settings.d.ts +13 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +2 -0
- package/dist/settings.js.map +1 -0
- package/dist/storage.d.ts +31 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -0
- package/dist/storage.js.map +1 -0
- package/dist/ui.d.ts +368 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +2 -0
- package/dist/ui.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,1481 +1,35 @@
|
|
|
1
|
-
import type { ComponentType, ReactNode } from "react";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* @vetta-org/plugin-sdk public surface.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
* `@vetta/
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export type ConversationScenario
|
|
10
|
-
export type PluginPermission
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
autoApprove?: string[];
|
|
38
|
-
startupTimeout?: number;
|
|
39
|
-
debug?: boolean;
|
|
40
|
-
displayName?: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
/** 该 server 的工具允许出现的工作模式 slug(agent_mode 轴,缺省/空 = 通用)。见 ADR-0046。 */
|
|
43
|
-
agent_mode?: string | string[];
|
|
44
|
-
};
|
|
45
|
-
export interface PluginAgentManifest {
|
|
46
|
-
systemPrompt?: {
|
|
47
|
-
/**
|
|
48
|
-
* Plugin-packaged prompt contribution file paths. Main-process aggregation
|
|
49
|
-
* resolves these relative to the installed plugin root.
|
|
50
|
-
*/
|
|
51
|
-
promptPaths?: string[];
|
|
52
|
-
};
|
|
53
|
-
/** Plugin-packaged skill files or directories to add to the agent resource graph. */
|
|
54
|
-
skillPaths?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* Plugin-scoped MCP servers. Either a relative path to `.mcp.json`
|
|
57
|
-
* (shape `{ mcpServers: { ... } }`) or an inline map of server configs.
|
|
58
|
-
* Requires permission `agent.mcp.control`. Never written into user mcp.json.
|
|
59
|
-
*/
|
|
60
|
-
mcpServers?: string | Record<string, PluginMcpServerConfig>;
|
|
61
|
-
/** Declarative tool visibility policy. Names are tool ids after registration. */
|
|
62
|
-
toolPolicy?: {
|
|
63
|
-
allow?: string[];
|
|
64
|
-
deny?: string[];
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export interface Disposable {
|
|
68
|
-
dispose(): void;
|
|
69
|
-
}
|
|
70
|
-
export interface PluginGlobalSlotContribution {
|
|
71
|
-
id: string;
|
|
72
|
-
component: ComponentType;
|
|
73
|
-
}
|
|
74
|
-
export interface PluginAudioMetadata {
|
|
75
|
-
/** Embedded title; preview renderers should fall back to file.name. */
|
|
76
|
-
title?: string;
|
|
77
|
-
artist?: string;
|
|
78
|
-
/** Embedded cover art as a Data URL when available. */
|
|
79
|
-
coverDataUrl?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface PluginPreviewUrlOptions {
|
|
82
|
-
/** Optional media hint for ambiguous containers such as webm. */
|
|
83
|
-
mediaKind?: "audio" | "video";
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* The file handed to a file-preview plugin component. The host does NOT
|
|
87
|
-
* pre-read or guess encoding — the plugin decides whether to read text or
|
|
88
|
-
* bytes. `path` is also exposed for plugins that prefer native fetch.
|
|
89
|
-
*/
|
|
90
|
-
export interface PluginPreviewFile {
|
|
91
|
-
path: string | null;
|
|
92
|
-
name: string;
|
|
93
|
-
extension: string;
|
|
94
|
-
mime: string;
|
|
95
|
-
size: number;
|
|
96
|
-
/** Read the file as a UTF-8 string. */
|
|
97
|
-
readText(): Promise<string>;
|
|
98
|
-
/** Read the raw file bytes. */
|
|
99
|
-
readBytes(): Promise<ArrayBuffer>;
|
|
100
|
-
/** A fetchable streaming URL for the file (Range-capable). */
|
|
101
|
-
getUrl(options?: PluginPreviewUrlOptions): string;
|
|
102
|
-
/**
|
|
103
|
-
* Subscribe to on-disk changes of this file. The listener fires (debounced
|
|
104
|
-
* by the host) whenever the file's contents change, letting previews update
|
|
105
|
-
* live. Returns a Disposable; call dispose() to stop watching. A no-op for
|
|
106
|
-
* files without a real path (url-only sources).
|
|
107
|
-
*/
|
|
108
|
-
watch(listener: () => void): Disposable;
|
|
109
|
-
/**
|
|
110
|
-
* Host-provided audio metadata for local media files. Returns null when the
|
|
111
|
-
* host cannot provide metadata, e.g. url-only sources or unsupported files.
|
|
112
|
-
*/
|
|
113
|
-
getAudioMetadata?(): Promise<PluginAudioMetadata | null>;
|
|
114
|
-
}
|
|
115
|
-
export interface PluginFilePreviewProps {
|
|
116
|
-
file: PluginPreviewFile;
|
|
117
|
-
}
|
|
118
|
-
export interface PluginFilePreviewContribution {
|
|
119
|
-
/** Lower-case extensions without the dot, e.g. ["svg"]. */
|
|
120
|
-
extensions: string[];
|
|
121
|
-
component: ComponentType<PluginFilePreviewProps>;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* An activity-panel tab contributed by a plugin. Registering only adds the
|
|
125
|
-
* tab to the "addable pool" — it renders only after the user attaches it in
|
|
126
|
-
* the activity panel (scoped by session cwd).
|
|
127
|
-
*/
|
|
128
|
-
export interface PluginActivityTabContribution {
|
|
129
|
-
id: string;
|
|
130
|
-
label: string;
|
|
131
|
-
/** Tab icon as a React node (not an iconify class string). */
|
|
132
|
-
icon?: ReactNode;
|
|
133
|
-
component: ComponentType;
|
|
134
|
-
/**
|
|
135
|
-
* 允许该标签卡出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:
|
|
136
|
-
* 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如
|
|
137
|
-
* `["project", "conversation"]`)。会话页插槽据此随对话类型显隐。
|
|
138
|
-
*/
|
|
139
|
-
scope_use?: readonly ConversationScenario[];
|
|
140
|
-
}
|
|
141
|
-
/** Options for {@link PluginUiApi.openActivityTab}. */
|
|
142
|
-
export interface PluginOpenActivityTabOptions {
|
|
143
|
-
/**
|
|
144
|
-
* Desired panel width as it opens: a pixel number, or `"max"` for the widest
|
|
145
|
-
* the current window allows. The host clamps to its min/max bounds. Omit to
|
|
146
|
-
* keep the user's current width.
|
|
147
|
-
*/
|
|
148
|
-
width?: number | "max";
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* A reference to an image produced out-of-band by the host (e.g. an image
|
|
152
|
-
* tool's result). The bytes are NOT carried inline — `url` is a host media
|
|
153
|
-
* URL (Range-capable, usable directly as an `<img src>`).
|
|
154
|
-
*/
|
|
155
|
-
export interface PluginImageRef {
|
|
156
|
-
id: string;
|
|
157
|
-
url: string;
|
|
158
|
-
mimeType?: string;
|
|
159
|
-
/**
|
|
160
|
-
* The edit-lineage root id this image belongs to (base image + all its edits
|
|
161
|
-
* share one rootId). Lets the host dedup per-message previews — only the
|
|
162
|
-
* latest message producing a given rootId renders the version swiper.
|
|
163
|
-
*/
|
|
164
|
-
rootId?: string;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Decoration a plugin contributes to the next outgoing prompt while its input
|
|
168
|
-
* action is active. `metadata` is shallow-merged into the prompt request's
|
|
169
|
-
* `metadata` bag, which the agent turn can read (e.g. `{ imageMode: true }`).
|
|
170
|
-
*/
|
|
171
|
-
export interface PluginPromptDecoration {
|
|
172
|
-
metadata?: Record<string, unknown>;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* An action button shown in a row beneath the AI input bar. Rendered as a
|
|
176
|
-
* toggle: clicking activates, clicking again deactivates. While active, the
|
|
177
|
-
* host calls `decoratePrompt()` before each send and merges the returned
|
|
178
|
-
* metadata into the outgoing prompt request. The plugin owns any side state
|
|
179
|
-
* (it is the same Module Federation instance as its other slots).
|
|
180
|
-
*/
|
|
181
|
-
export interface PluginInputActionContribution {
|
|
182
|
-
id: string;
|
|
183
|
-
label: string;
|
|
184
|
-
/** Button icon as a React node (not an iconify class string). */
|
|
185
|
-
icon?: ReactNode;
|
|
186
|
-
/** Whether the action begins in the active state. Defaults to false. */
|
|
187
|
-
defaultActive?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
* 该输入动作所依赖的 agent 工具名。设置后,仅当该工具在当前会话处于激活(按工具的
|
|
190
|
-
* scope_use 解析)时才显示这个 badge——避免在工具被场景屏蔽(如批量任务)时仍显示一个
|
|
191
|
-
* 点了也无效的开关。不设则始终显示。例如「图像生成」设为 "generate_image"。
|
|
192
|
-
*/
|
|
193
|
-
requiresActiveTool?: string;
|
|
194
|
-
/**
|
|
195
|
-
* 允许该 toggle 出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:
|
|
196
|
-
* 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现。与 `requiresActiveTool`
|
|
197
|
-
* 取「与」:两者都满足才显示。
|
|
198
|
-
*/
|
|
199
|
-
scope_use?: readonly ConversationScenario[];
|
|
200
|
-
/**
|
|
201
|
-
* When true, this plugin's agent contributions (tools / skills / MCP /
|
|
202
|
-
* systemPrompt) and Activity Tabs are hard-isolated: inactive until this
|
|
203
|
-
* toggle is on (ADR-0041, knowledgeMode-style). Default false.
|
|
204
|
-
*/
|
|
205
|
-
hardIsolation?: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Fired when the user toggles the action; `active` is the new state. Return
|
|
208
|
-
* `false` when `active` is true to VETO the activation (e.g. the plugin needs
|
|
209
|
-
* configuration first) — the toggle stays off. Deactivation can't be vetoed.
|
|
210
|
-
*/
|
|
211
|
-
onToggle?(active: boolean): boolean | void;
|
|
212
|
-
/**
|
|
213
|
-
* Called by the host before sending while the action is active. The
|
|
214
|
-
* returned metadata is merged into the outgoing prompt request.
|
|
215
|
-
*/
|
|
216
|
-
decoratePrompt?(): PluginPromptDecoration | void;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* A declarative, serializable descriptor for one card rendered beneath a
|
|
220
|
-
* message. `type` selects a registered card renderer; `key` drives cross-turn
|
|
221
|
-
* dedup (same key across turns = one logical card, shown only under its latest
|
|
222
|
-
* anchor); `payload` carries STABLE REFERENCES (e.g. image ids), not a content
|
|
223
|
-
* snapshot — the renderer resolves live state from it. `title`/`icon` label the
|
|
224
|
-
* card's tab (override the renderer's registration defaults). Rides a tool
|
|
225
|
-
* result's out-of-band `details.cards`; crosses the agent→host boundary, so
|
|
226
|
-
* `icon` is an icon-symbol string, not a node.
|
|
227
|
-
*/
|
|
228
|
-
export interface CardDescriptor {
|
|
229
|
-
type: string;
|
|
230
|
-
key?: string;
|
|
231
|
-
payload?: unknown;
|
|
232
|
-
title?: string;
|
|
233
|
-
icon?: string;
|
|
234
|
-
}
|
|
235
|
-
/** A pending (in-flight) tool call handed to a renderer's `pendingFor`. */
|
|
236
|
-
export interface PluginPendingToolCall {
|
|
237
|
-
toolName: string;
|
|
238
|
-
args: Record<string, unknown>;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Props for a card renderer. `descriptor` is the card's data; `pending` is true
|
|
242
|
-
* while it was synthesized from an in-flight tool (render a skeleton); `message`
|
|
243
|
-
* is the anchoring conversation message.
|
|
244
|
-
*/
|
|
245
|
-
export interface PluginCardProps {
|
|
246
|
-
descriptor: CardDescriptor;
|
|
247
|
-
pending: boolean;
|
|
248
|
-
message: ConversationMessage;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* A card renderer registered by a plugin, keyed by `type`. A descriptor whose
|
|
252
|
-
* `type` matches is rendered by `component`. `title`/`icon` are the default tab
|
|
253
|
-
* label/icon (a descriptor may override `title`). `pendingFor`, given an
|
|
254
|
-
* in-flight tool call, returns a provisional descriptor so a skeleton card
|
|
255
|
-
* appears (and claims a tab) before the tool's result lands — or null when this
|
|
256
|
-
* renderer doesn't handle that tool. The `type` must be globally unique across
|
|
257
|
-
* plugins (convention: prefix with the plugin id, e.g. "image-gen:preview").
|
|
258
|
-
*/
|
|
259
|
-
export interface PluginCardRendererContribution {
|
|
260
|
-
type: string;
|
|
261
|
-
component: ComponentType<PluginCardProps>;
|
|
262
|
-
title?: string;
|
|
263
|
-
/** Default tab icon as a React node (not an iconify class string). */
|
|
264
|
-
icon?: ReactNode;
|
|
265
|
-
pendingFor?: (toolCall: PluginPendingToolCall) => CardDescriptor | null;
|
|
266
|
-
}
|
|
267
|
-
/** A tool call handed to a tool-call slot renderer. */
|
|
268
|
-
export interface PluginToolCallSlotToolCall {
|
|
269
|
-
toolCallId: string;
|
|
270
|
-
toolName: string;
|
|
271
|
-
args: Record<string, unknown>;
|
|
272
|
-
status: "pending" | "success" | "error";
|
|
273
|
-
result?: string;
|
|
274
|
-
isError?: boolean;
|
|
275
|
-
}
|
|
276
|
-
export interface PluginToolCallSlotProps {
|
|
277
|
-
toolCall: PluginToolCallSlotToolCall;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* A component that **replaces the host's default inline transcript rendering**
|
|
281
|
-
* for a specific tool (matched by `toolName`; first registered renderer wins).
|
|
282
|
-
* This is how a plugin renders rich UI for its OWN agent tool's output — plugin
|
|
283
|
-
* tools cannot emit `details.cards`, so the message card system (registerCardRenderer)
|
|
284
|
-
* does not serve them; the tool-call slot does.
|
|
285
|
-
*/
|
|
286
|
-
export interface PluginToolCallSlotContribution {
|
|
287
|
-
id: string;
|
|
288
|
-
toolName: string;
|
|
289
|
-
component: ComponentType<PluginToolCallSlotProps>;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* A card rendered at the bottom of the message list for the LATEST turn — NOT
|
|
293
|
-
* bound to a tool call. The host mounts `component` in the footer slot and
|
|
294
|
-
* re-mounts it each session/turn; the plugin owns visibility entirely (it reads
|
|
295
|
-
* live state via SDK hooks — `useActiveConversation`, `useConversationMessages`,
|
|
296
|
-
* `ctx.conversation.on("turn-end")` — and returns `null` to render nothing,
|
|
297
|
-
* e.g. git renders only inside a repo that has changes). `scope_use` gates which
|
|
298
|
-
* conversation scenarios it may appear in (**fail-closed**, mirrors the other
|
|
299
|
-
* slots). `id` must be unique within the plugin.
|
|
300
|
-
*/
|
|
301
|
-
export interface PluginTurnCardContribution {
|
|
302
|
-
id: string;
|
|
303
|
-
component: ComponentType;
|
|
304
|
-
/**
|
|
305
|
-
* 允许该 turn 卡出现的对话场景 slug 列表(镜像其它插槽的 scope_use)。**fail-closed**:
|
|
306
|
-
* 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如 `["project"]`)。
|
|
307
|
-
*/
|
|
308
|
-
scope_use?: readonly ConversationScenario[];
|
|
309
|
-
}
|
|
310
|
-
export interface PluginUiApi {
|
|
311
|
-
registerGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;
|
|
312
|
-
/**
|
|
313
|
-
* Register a preview component keyed by file extension. The host dispatches
|
|
314
|
-
* registered extensions before its built-in fallback renderers; first
|
|
315
|
-
* registrant wins on conflict.
|
|
316
|
-
*/
|
|
317
|
-
registerFilePreview(contribution: PluginFilePreviewContribution): Disposable;
|
|
318
|
-
/**
|
|
319
|
-
* Register an activity-panel tab into the addable pool. The user attaches
|
|
320
|
-
* it manually via the panel's "+" picker; attach records are keyed by the
|
|
321
|
-
* session cwd.
|
|
322
|
-
*/
|
|
323
|
-
registerActivityTab(contribution: PluginActivityTabContribution): Disposable;
|
|
324
|
-
/**
|
|
325
|
-
* Register a toggle action shown beneath the AI input bar. While active,
|
|
326
|
-
* its `decoratePrompt()` annotates the next outgoing prompt.
|
|
327
|
-
*/
|
|
328
|
-
registerInputAction(contribution: PluginInputActionContribution): Disposable;
|
|
329
|
-
/**
|
|
330
|
-
* Register a card renderer keyed by `type`. Cards rendered beneath a message
|
|
331
|
-
* come from tool results' out-of-band `details.cards` (or `pendingFor` for
|
|
332
|
-
* in-flight tools); the host resolves each card's `type` to a registered
|
|
333
|
-
* renderer. Multiple cards under one message are shown as a tab-switcher
|
|
334
|
-
* ("收纳") or a flat list.
|
|
335
|
-
*/
|
|
336
|
-
registerCardRenderer(contribution: PluginCardRendererContribution): Disposable;
|
|
337
|
-
/**
|
|
338
|
-
* Register a renderer that replaces the host's default inline transcript UI
|
|
339
|
-
* for a tool call (matched by `toolName`). The complement to card renderers:
|
|
340
|
-
* use it to render UI for a plugin's own agent tool output.
|
|
341
|
-
*/
|
|
342
|
-
registerToolCallSlot(contribution: PluginToolCallSlotContribution): Disposable;
|
|
343
|
-
/**
|
|
344
|
-
* Register a card rendered at the bottom of the message list for the latest
|
|
345
|
-
* turn — NOT bound to a tool call. The host mounts the component in the
|
|
346
|
-
* footer slot; the plugin owns visibility (return `null` to render nothing,
|
|
347
|
-
* e.g. git renders only in a repo with changes). Gated by `scope_use`
|
|
348
|
-
* (fail-closed). Needs the `ui.slot.turn-card` permission.
|
|
349
|
-
*/
|
|
350
|
-
registerTurnCard(contribution: PluginTurnCardContribution): Disposable;
|
|
351
|
-
/**
|
|
352
|
-
* Programmatically attach (if needed) and activate one of this plugin's
|
|
353
|
-
* own activity tabs in the current conversation's activity panel. `tabId`
|
|
354
|
-
* is the contribution id passed to registerActivityTab. Any payload (e.g.
|
|
355
|
-
* which image to edit) is passed via the plugin's own in-memory state.
|
|
356
|
-
*
|
|
357
|
-
* Pass `options.width` to size the panel as it opens — a pixel number, or
|
|
358
|
-
* `"max"` to expand it to the widest the current window allows (the host
|
|
359
|
-
* still clamps to its min/max and auto-hides the sidebar when needed). Omit
|
|
360
|
-
* to leave the user's current width untouched.
|
|
361
|
-
*/
|
|
362
|
-
openActivityTab(tabId: string, options?: PluginOpenActivityTabOptions): void;
|
|
363
|
-
/**
|
|
364
|
-
* Bind (or clear, with `null`) an image as the "edit target" for the next
|
|
365
|
-
* outgoing prompt. The host renders it as a thumbnail capsule in the AI input
|
|
366
|
-
* bar's top capsule strip and, at send time, injects `metadata.editImageId`
|
|
367
|
-
* (the ref's id) so this turn edits that image. One-shot: cleared after the
|
|
368
|
-
* prompt is sent (or when the user closes the capsule). Only the image
|
|
369
|
-
* reference (id/url) crosses over — bytes stay out-of-band.
|
|
370
|
-
*/
|
|
371
|
-
setEditImageAttachment(ref: PluginImageRef | null): void;
|
|
372
|
-
/**
|
|
373
|
-
* Open the host's global full-screen image previewer for the given image.
|
|
374
|
-
* Only the image reference (id/url) crosses over — bytes stay out-of-band.
|
|
375
|
-
*
|
|
376
|
-
* Pass `group` (e.g. all images of the message) to open as an image group:
|
|
377
|
-
* the previewer shows a thumbnail strip + arrows and starts at `ref`.
|
|
378
|
-
*/
|
|
379
|
-
previewImage(ref: PluginImageRef, group?: PluginImageRef[]): void;
|
|
380
|
-
/**
|
|
381
|
-
* Open the app settings, scrolled to and highlighting THIS plugin's own
|
|
382
|
-
* settings section (e.g. so the user can fill in a required API key/model).
|
|
383
|
-
* The host owns the navigation; the plugin only asks to jump there.
|
|
384
|
-
*/
|
|
385
|
-
openPluginSettings(): void;
|
|
386
|
-
/**
|
|
387
|
-
* Show a global toast in the host UI (bottom-right). No permission required.
|
|
388
|
-
* Prefer this over swallowing errors into opaque UI copy: pass `error` so
|
|
389
|
-
* the host attaches a one-click "copy stack" action for the user.
|
|
390
|
-
*
|
|
391
|
-
* Capture `ctx.ui.notify` in `activate` if React components need it
|
|
392
|
-
* (components do not receive `ctx`).
|
|
393
|
-
*/
|
|
394
|
-
notify(options: PluginNotifyOptions): void;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Options for {@link PluginUiApi.notify}. Surfaces a host toast so users can
|
|
398
|
-
* see plugin failures without opening DevTools.
|
|
399
|
-
*/
|
|
400
|
-
export interface PluginNotifyOptions {
|
|
401
|
-
/** Toast body. Required even when `error` is set (user-facing summary). */
|
|
402
|
-
message: string;
|
|
403
|
-
/** Defaults to plugin display name when omitted. */
|
|
404
|
-
title?: string;
|
|
405
|
-
/** Defaults to `"info"`; when `error` is set and variant omitted, host uses `"error"`. */
|
|
406
|
-
variant?: "info" | "success" | "warning" | "error";
|
|
407
|
-
/**
|
|
408
|
-
* Optional failure cause. Host formats message + stack and adds a
|
|
409
|
-
* "复制堆栈" action so the user can paste it into bug reports / chat.
|
|
410
|
-
*/
|
|
411
|
-
error?: unknown;
|
|
412
|
-
/**
|
|
413
|
-
* Auto-dismiss delay in ms. `0` keeps the toast until dismissed.
|
|
414
|
-
* Defaults: sticky (`0`) when `error` is present, otherwise host default (~4s).
|
|
415
|
-
*/
|
|
416
|
-
durationMs?: number;
|
|
417
|
-
}
|
|
418
|
-
export interface ConversationState {
|
|
419
|
-
/** Active session runtimeId, or null when no conversation is active. */
|
|
420
|
-
id: string | null;
|
|
421
|
-
cwd: string | null;
|
|
422
|
-
sessionPath: string | null;
|
|
423
|
-
model: string | null;
|
|
424
|
-
isStreaming: boolean;
|
|
425
|
-
}
|
|
426
|
-
export interface ConversationMessage {
|
|
427
|
-
id: string;
|
|
428
|
-
role: "user" | "assistant" | "compaction";
|
|
429
|
-
text: string;
|
|
430
|
-
timestamp?: number;
|
|
431
|
-
}
|
|
432
|
-
export type ConversationEvent = {
|
|
433
|
-
type: "turn-start";
|
|
434
|
-
} | {
|
|
435
|
-
type: "turn-end";
|
|
436
|
-
stopReason: string;
|
|
437
|
-
} | {
|
|
438
|
-
type: "message-added";
|
|
439
|
-
message: ConversationMessage;
|
|
440
|
-
} | {
|
|
441
|
-
type: "message-updated";
|
|
442
|
-
delta: string;
|
|
443
|
-
} | {
|
|
444
|
-
type: "tool-call-start";
|
|
445
|
-
toolCallId: string;
|
|
446
|
-
toolName: string;
|
|
447
|
-
} | {
|
|
448
|
-
type: "tool-call-end";
|
|
449
|
-
toolCallId: string;
|
|
450
|
-
toolName: string;
|
|
451
|
-
isError: boolean;
|
|
452
|
-
} | {
|
|
453
|
-
type: "conversation-changed";
|
|
454
|
-
conversation: ConversationState;
|
|
455
|
-
};
|
|
456
|
-
export interface PluginConversationApi {
|
|
457
|
-
/** Send a prompt into the active conversation (renders as a user turn). */
|
|
458
|
-
sendPrompt(text: string): Promise<void>;
|
|
459
|
-
/** Fill the input bar without sending; the user can edit and send. */
|
|
460
|
-
insertText(text: string): void;
|
|
461
|
-
/** Abort the active conversation's current turn. */
|
|
462
|
-
abort(): Promise<void>;
|
|
463
|
-
/** Subscribe to real-time conversation events. */
|
|
464
|
-
on(listener: (event: ConversationEvent) => void): Disposable;
|
|
465
|
-
}
|
|
466
|
-
export type PluginJsonSchema = object;
|
|
467
|
-
export interface PluginAgentToolApi {
|
|
468
|
-
fs: PluginFsApi;
|
|
469
|
-
conversation: PluginConversationApi;
|
|
470
|
-
}
|
|
471
|
-
export interface PluginAgentToolRegistration<TInput = unknown> {
|
|
472
|
-
id: string;
|
|
473
|
-
name?: string;
|
|
474
|
-
label?: string;
|
|
475
|
-
description: string;
|
|
476
|
-
parameters: PluginJsonSchema;
|
|
477
|
-
timeoutMs?: number;
|
|
478
|
-
/**
|
|
479
|
-
* 允许该工具出现的对话场景 slug 列表。**fail-closed**:未声明/空数组 = 所有场景都不激活。
|
|
480
|
-
* 插件须显式声明。
|
|
481
|
-
*/
|
|
482
|
-
scope_use?: readonly ConversationScenario[];
|
|
483
|
-
/** 需要的会话能力 slug(如 "knowledge");全满足才激活。一般插件无需设置。 */
|
|
484
|
-
requires?: string[];
|
|
485
|
-
/** 允许该工具出现的工作模式 slug(agent_mode 轴,如 "work"/"coding")。缺省/空 = 通用。见 ADR-0046。 */
|
|
486
|
-
agent_mode?: readonly string[];
|
|
487
|
-
context?: {
|
|
488
|
-
conversation?: "summary" | "messages";
|
|
489
|
-
};
|
|
490
|
-
handler: PluginAgentToolHandler<TInput>;
|
|
491
|
-
}
|
|
492
|
-
export interface PluginSystemPromptBlock {
|
|
493
|
-
id: string;
|
|
494
|
-
content: string;
|
|
495
|
-
priority?: number;
|
|
496
|
-
enabled?: boolean;
|
|
497
|
-
}
|
|
498
|
-
export type PluginDynamicSystemPromptOperation = {
|
|
499
|
-
type: "addBlock";
|
|
500
|
-
block: PluginSystemPromptBlock;
|
|
501
|
-
} | {
|
|
502
|
-
type: "replaceBlock";
|
|
503
|
-
blockId: string;
|
|
504
|
-
block: Omit<PluginSystemPromptBlock, "id">;
|
|
505
|
-
} | {
|
|
506
|
-
type: "updateBlock";
|
|
507
|
-
blockId: string;
|
|
508
|
-
patch: Partial<Pick<PluginSystemPromptBlock, "content" | "priority" | "enabled">>;
|
|
509
|
-
} | {
|
|
510
|
-
type: "removeBlock";
|
|
511
|
-
blockId: string;
|
|
512
|
-
} | {
|
|
513
|
-
type: "setBlockEnabled";
|
|
514
|
-
blockId: string;
|
|
515
|
-
enabled: boolean;
|
|
516
|
-
} | {
|
|
517
|
-
type: "setToolEnabled";
|
|
518
|
-
toolName: string;
|
|
519
|
-
enabled: boolean;
|
|
520
|
-
} | {
|
|
521
|
-
type: "requestContinuation";
|
|
522
|
-
result: PluginContinuationResult;
|
|
523
|
-
};
|
|
524
|
-
export interface PluginSystemPromptMessage {
|
|
525
|
-
role: string;
|
|
526
|
-
text: string;
|
|
527
|
-
timestamp?: number;
|
|
528
|
-
toolName?: string;
|
|
529
|
-
}
|
|
530
|
-
export interface PluginSystemPromptProviderContext {
|
|
531
|
-
plugin: {
|
|
532
|
-
id: string;
|
|
533
|
-
providerId: string;
|
|
534
|
-
settings: Readonly<Record<string, unknown>>;
|
|
535
|
-
};
|
|
536
|
-
session: {
|
|
537
|
-
id: string;
|
|
538
|
-
cwd: string;
|
|
539
|
-
scenario: ConversationScenario;
|
|
540
|
-
};
|
|
541
|
-
model: {
|
|
542
|
-
provider: string;
|
|
543
|
-
id: string;
|
|
544
|
-
api: string;
|
|
545
|
-
input: readonly string[];
|
|
546
|
-
contextWindow?: number;
|
|
547
|
-
maxTokens?: number;
|
|
548
|
-
};
|
|
549
|
-
conversation: {
|
|
550
|
-
messages: readonly PluginSystemPromptMessage[];
|
|
551
|
-
messageCount: number;
|
|
552
|
-
};
|
|
553
|
-
runtime: {
|
|
554
|
-
activeToolNames: readonly string[];
|
|
555
|
-
availableToolNames: readonly string[];
|
|
556
|
-
runIndex: number;
|
|
557
|
-
};
|
|
558
|
-
trigger: {
|
|
559
|
-
kind: "agent-run";
|
|
560
|
-
timestamp: number;
|
|
561
|
-
};
|
|
562
|
-
systemPrompt?: {
|
|
563
|
-
base: {
|
|
564
|
-
blocks?: readonly PluginSystemPromptBlockView[];
|
|
565
|
-
rendered?: string;
|
|
566
|
-
};
|
|
567
|
-
current: {
|
|
568
|
-
blocks?: readonly PluginSystemPromptBlockView[];
|
|
569
|
-
rendered?: string;
|
|
570
|
-
};
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
export interface PluginSystemPromptBlockView extends PluginSystemPromptBlock {
|
|
574
|
-
type: string;
|
|
575
|
-
source: {
|
|
576
|
-
kind: "core" | "plugin";
|
|
577
|
-
pluginId?: string;
|
|
578
|
-
};
|
|
579
|
-
priority: number;
|
|
580
|
-
enabled: boolean;
|
|
581
|
-
}
|
|
582
|
-
export interface PluginAgentActions {
|
|
583
|
-
systemPrompt: {
|
|
584
|
-
addBlock(block: PluginSystemPromptBlock): void;
|
|
585
|
-
replaceBlock(blockId: string, block: Omit<PluginSystemPromptBlock, "id">): void;
|
|
586
|
-
updateBlock(blockId: string, patch: Partial<Pick<PluginSystemPromptBlock, "content" | "priority" | "enabled">>): void;
|
|
587
|
-
removeBlock(blockId: string): void;
|
|
588
|
-
setBlockEnabled(blockId: string, enabled: boolean): void;
|
|
589
|
-
};
|
|
590
|
-
tools: {
|
|
591
|
-
setEnabled(toolName: string, enabled: boolean): void;
|
|
592
|
-
enable(toolName: string): void;
|
|
593
|
-
disable(toolName: string): void;
|
|
594
|
-
};
|
|
595
|
-
continuation: {
|
|
596
|
-
request(result: PluginContinuationResult): void;
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
export interface PluginAgentHandlerContext<TTrigger> {
|
|
600
|
-
invocationId: string;
|
|
601
|
-
plugin: {
|
|
602
|
-
id: string;
|
|
603
|
-
contributionId: string;
|
|
604
|
-
settings: Readonly<Record<string, unknown>>;
|
|
605
|
-
};
|
|
606
|
-
session: PluginSystemPromptProviderContext["session"];
|
|
607
|
-
model: PluginSystemPromptProviderContext["model"];
|
|
608
|
-
conversation: PluginSystemPromptProviderContext["conversation"];
|
|
609
|
-
runtime: PluginSystemPromptProviderContext["runtime"];
|
|
610
|
-
trigger: TTrigger;
|
|
611
|
-
systemPrompt?: PluginSystemPromptProviderContext["systemPrompt"];
|
|
612
|
-
actions: PluginAgentActions;
|
|
613
|
-
host: PluginAgentToolApi;
|
|
614
|
-
}
|
|
615
|
-
export type PluginAgentToolHandler<TInput = unknown> = (context: PluginAgentHandlerContext<{
|
|
616
|
-
kind: "tool-call";
|
|
617
|
-
timestamp: number;
|
|
618
|
-
toolCallId: string;
|
|
619
|
-
toolId: string;
|
|
620
|
-
toolName: string;
|
|
621
|
-
input: TInput;
|
|
622
|
-
}>) => unknown | Promise<unknown>;
|
|
623
|
-
export type PluginSystemPromptProviderHandler = (context: PluginAgentHandlerContext<{
|
|
624
|
-
kind: "agent-run";
|
|
625
|
-
timestamp: number;
|
|
626
|
-
}>) => void | PluginDynamicSystemPromptOperation[] | Promise<void | PluginDynamicSystemPromptOperation[]>;
|
|
627
|
-
export interface PluginSystemPromptProviderRegistration {
|
|
628
|
-
id: string;
|
|
629
|
-
timeoutMs?: number;
|
|
630
|
-
/**
|
|
631
|
-
* Large context is opt-in. Omitted fields are not serialized across the
|
|
632
|
-
* host/renderer boundary.
|
|
633
|
-
*/
|
|
634
|
-
context?: {
|
|
635
|
-
systemPrompt?: "none" | "blocks" | "rendered" | "full";
|
|
636
|
-
conversation?: "summary" | "messages";
|
|
637
|
-
};
|
|
638
|
-
handler: PluginSystemPromptProviderHandler;
|
|
639
|
-
}
|
|
640
|
-
export interface PluginAgentApi {
|
|
641
|
-
registerTool<TInput = unknown>(registration: PluginAgentToolRegistration<TInput>): Disposable;
|
|
642
|
-
/** Register a provider evaluated before every Agent run. */
|
|
643
|
-
registerSystemPromptProvider(registration: PluginSystemPromptProviderRegistration): Disposable;
|
|
644
|
-
/**
|
|
645
|
-
* Register a policy consulted when the agent reaches a natural stopping point.
|
|
646
|
-
* Return null to allow the agent to stop, or a message to continue with another turn.
|
|
647
|
-
*/
|
|
648
|
-
registerContinuationProvider(registration: PluginContinuationRegistration): Disposable;
|
|
649
|
-
}
|
|
650
|
-
export interface PluginContinuationResult {
|
|
651
|
-
text: string;
|
|
652
|
-
/** Stable key used by the host to suppress duplicate continuations in a session. */
|
|
653
|
-
idempotencyKey?: string;
|
|
654
|
-
}
|
|
655
|
-
export type PluginContinuationHandler = (context: PluginAgentHandlerContext<{
|
|
656
|
-
kind: "continuation";
|
|
657
|
-
timestamp: number;
|
|
658
|
-
}>) => PluginContinuationResult | null | Promise<PluginContinuationResult | null>;
|
|
659
|
-
export interface PluginContinuationRegistration {
|
|
660
|
-
id: string;
|
|
661
|
-
timeoutMs?: number;
|
|
662
|
-
context?: {
|
|
663
|
-
conversation?: "summary" | "messages";
|
|
664
|
-
};
|
|
665
|
-
handler: PluginContinuationHandler;
|
|
666
|
-
}
|
|
667
|
-
export type PluginAppActionEffect = "read" | "write" | "execute";
|
|
668
|
-
export interface PluginAppActionExample<TInput = unknown> {
|
|
669
|
-
description: string;
|
|
670
|
-
input: TInput;
|
|
671
|
-
}
|
|
672
|
-
export interface PluginAppActionHandlerContext<TInput = unknown> {
|
|
673
|
-
invocationId: string;
|
|
674
|
-
plugin: {
|
|
675
|
-
id: string;
|
|
676
|
-
actionId: string;
|
|
677
|
-
settings: Readonly<Record<string, unknown>>;
|
|
678
|
-
};
|
|
679
|
-
input: TInput;
|
|
680
|
-
signal: AbortSignal;
|
|
681
|
-
}
|
|
682
|
-
export type PluginAppActionHandler<TInput = unknown> = (context: PluginAppActionHandlerContext<TInput>) => unknown | Promise<unknown>;
|
|
683
|
-
export type PluginAppActionReadyHandler<TInput = unknown> = (context: PluginAppActionHandlerContext<TInput>) => void | Promise<void>;
|
|
684
|
-
/** 插件 Action 向宿主返回稳定错误码与可序列化详情。 */
|
|
685
|
-
export declare class PluginAppActionError extends Error {
|
|
686
|
-
readonly code: string;
|
|
687
|
-
readonly details?: unknown;
|
|
688
|
-
constructor(code: string, message: string, details?: unknown);
|
|
689
|
-
}
|
|
690
|
-
export interface PluginAppActionApprovalPresentation {
|
|
691
|
-
id: string;
|
|
692
|
-
title: string;
|
|
693
|
-
description: string;
|
|
694
|
-
}
|
|
695
|
-
export interface PluginAppActionApproval {
|
|
696
|
-
/** 默认使用的宿主审批界面。 */
|
|
697
|
-
defaultPresentation: string;
|
|
698
|
-
/** 可用的宿主审批界面;仅官方插件可以声明。 */
|
|
699
|
-
presentations: PluginAppActionApprovalPresentation[];
|
|
700
|
-
/** 根据 input.operation 自动选择审批界面,不要求 Agent 传 approvalUi。 */
|
|
701
|
-
presentationByOperation?: Record<string, string>;
|
|
702
|
-
/** 某 operation 明确允许的附加审批界面;宿主仍会拒绝未列出的调用方选择。 */
|
|
703
|
-
alternativePresentationsByOperation?: Record<string, string[]>;
|
|
704
|
-
}
|
|
705
|
-
export interface PluginAppActionRegistration<TInput = unknown> {
|
|
706
|
-
/** 插件内局部 id;宿主公开为 `plugin.<pluginId>.<id>`。 */
|
|
707
|
-
id: string;
|
|
708
|
-
/** 可信官方插件可指定稳定公共 id;若 id 已被占用则后到者忽略(先注册为准)。 */
|
|
709
|
-
publicId?: string;
|
|
710
|
-
title: string;
|
|
711
|
-
summary: string;
|
|
712
|
-
description?: string;
|
|
713
|
-
keywords?: string[];
|
|
714
|
-
effect: PluginAppActionEffect;
|
|
715
|
-
/** 官方插件可引用宿主已有审批界面;不能关闭 effect 对应的审批。 */
|
|
716
|
-
approval?: PluginAppActionApproval;
|
|
717
|
-
inputSchema: PluginJsonSchema;
|
|
718
|
-
examples?: PluginAppActionExample<TInput>[];
|
|
719
|
-
timeoutMs?: number;
|
|
720
|
-
/** 审批前业务就绪校验;失败时不会向用户弹出审批。 */
|
|
721
|
-
assertReady?: PluginAppActionReadyHandler<TInput>;
|
|
722
|
-
handler: PluginAppActionHandler<TInput>;
|
|
723
|
-
}
|
|
724
|
-
export interface PluginAppActionsApi {
|
|
725
|
-
register<TInput = unknown>(registration: PluginAppActionRegistration<TInput>): Disposable;
|
|
726
|
-
}
|
|
727
|
-
export interface PluginOfficialGeneralSettings {
|
|
728
|
-
workspacePath: string;
|
|
729
|
-
defaultExecutionMode?: "sandbox" | "full-access";
|
|
730
|
-
notificationsEnabled: boolean;
|
|
731
|
-
debugMode: boolean;
|
|
732
|
-
sandbox: unknown;
|
|
733
|
-
}
|
|
734
|
-
export type PluginOfficialGeneralSettingsUpdate = {
|
|
735
|
-
operation: "set-notifications";
|
|
736
|
-
enabled: boolean;
|
|
737
|
-
} | {
|
|
738
|
-
operation: "set-execution-mode";
|
|
739
|
-
mode: "sandbox" | "full-access";
|
|
740
|
-
} | {
|
|
741
|
-
operation: "set-workspace";
|
|
742
|
-
path: string;
|
|
743
|
-
};
|
|
744
|
-
export interface PluginOfficialExperimentalSettings {
|
|
745
|
-
vettaCli: boolean;
|
|
746
|
-
promptPrediction: boolean;
|
|
747
|
-
agentSkills: boolean;
|
|
748
|
-
}
|
|
749
|
-
export interface PluginOfficialDownloadItem {
|
|
750
|
-
id: string;
|
|
751
|
-
url: string;
|
|
752
|
-
filename: string;
|
|
753
|
-
path: string;
|
|
754
|
-
totalBytes: number;
|
|
755
|
-
receivedBytes: number;
|
|
756
|
-
status: "queued" | "downloading" | "paused" | "completed" | "failed" | "canceled";
|
|
757
|
-
error?: string;
|
|
758
|
-
createdAt: number;
|
|
759
|
-
completedAt?: number;
|
|
760
|
-
speedBytesPerSec?: number;
|
|
761
|
-
}
|
|
762
|
-
export interface PluginOfficialUpdaterState {
|
|
763
|
-
phase: "idle" | "checking" | "available" | "downloading" | "ready" | "installing" | "error";
|
|
764
|
-
currentVersion: string;
|
|
765
|
-
latestVersion?: string;
|
|
766
|
-
releaseNote?: string;
|
|
767
|
-
progress?: number;
|
|
768
|
-
downloadedBytes?: number;
|
|
769
|
-
totalBytes?: number;
|
|
770
|
-
assetFileName?: string;
|
|
771
|
-
error?: string;
|
|
772
|
-
pendingInstall: boolean;
|
|
773
|
-
}
|
|
774
|
-
export type PluginOfficialWebhookKind = "feishu" | "dingtalk";
|
|
775
|
-
export interface PluginOfficialWebhookEndpoint {
|
|
776
|
-
id: string;
|
|
777
|
-
kind: PluginOfficialWebhookKind;
|
|
778
|
-
name: string;
|
|
779
|
-
enabled: boolean;
|
|
780
|
-
createdAt: string;
|
|
781
|
-
updatedAt: string;
|
|
782
|
-
urlMask?: string;
|
|
783
|
-
hasSignSecret?: boolean;
|
|
784
|
-
}
|
|
785
|
-
export interface PluginOfficialWebhookProvider {
|
|
786
|
-
kind: PluginOfficialWebhookKind;
|
|
787
|
-
displayName: string;
|
|
788
|
-
iconClass?: string;
|
|
789
|
-
}
|
|
790
|
-
export interface PluginOfficialWebhookCreateInput {
|
|
791
|
-
kind: PluginOfficialWebhookKind;
|
|
792
|
-
name: string;
|
|
793
|
-
webhookUrl: string;
|
|
794
|
-
signSecret?: string;
|
|
795
|
-
enabled?: boolean;
|
|
796
|
-
}
|
|
797
|
-
export interface PluginOfficialWebhookUpdateInput {
|
|
798
|
-
name?: string;
|
|
799
|
-
enabled?: boolean;
|
|
800
|
-
webhookUrl?: string;
|
|
801
|
-
signSecret?: string;
|
|
802
|
-
}
|
|
803
|
-
export interface PluginOfficialWebhookMessage {
|
|
804
|
-
title?: string;
|
|
805
|
-
text: string;
|
|
806
|
-
level?: "info" | "warn" | "error" | "success";
|
|
807
|
-
}
|
|
808
|
-
export interface PluginOfficialWebhookSendResult {
|
|
809
|
-
ok: boolean;
|
|
810
|
-
error?: string;
|
|
811
|
-
}
|
|
812
|
-
export interface PluginOfficialSkillInfo {
|
|
813
|
-
name: string;
|
|
814
|
-
alias?: string;
|
|
815
|
-
description: string;
|
|
816
|
-
source: string;
|
|
817
|
-
type: "skill" | "scene";
|
|
818
|
-
}
|
|
819
|
-
export type PluginOfficialInstalledSkill = {
|
|
820
|
-
name: string;
|
|
821
|
-
version: string;
|
|
822
|
-
installedAt: string;
|
|
823
|
-
source: "market" | "custom";
|
|
824
|
-
enabled: boolean;
|
|
825
|
-
type?: "skill" | "scene";
|
|
826
|
-
alias?: string;
|
|
827
|
-
marketDescription?: string;
|
|
828
|
-
description?: string;
|
|
829
|
-
};
|
|
830
|
-
export interface PluginOfficialShortcutBinding {
|
|
831
|
-
id: string;
|
|
832
|
-
defaultShortcut: string;
|
|
833
|
-
shortcut: string;
|
|
834
|
-
isDefault: boolean;
|
|
835
|
-
}
|
|
836
|
-
export interface PluginOfficialQuickPanelSettings {
|
|
837
|
-
trigger: "none" | "mod" | "alt" | "shift";
|
|
838
|
-
postSendBehavior: "foreground" | "background";
|
|
839
|
-
}
|
|
840
|
-
export interface PluginOfficialImStatus {
|
|
841
|
-
enabled: boolean;
|
|
842
|
-
transport: string;
|
|
843
|
-
agentModel: {
|
|
844
|
-
provider: string;
|
|
845
|
-
model: string;
|
|
846
|
-
reasoningLevel?: string;
|
|
847
|
-
} | null;
|
|
848
|
-
wechatBound: boolean;
|
|
849
|
-
feishuAppId: string | null;
|
|
850
|
-
runtime: unknown;
|
|
851
|
-
}
|
|
852
|
-
export interface PluginOfficialImLog {
|
|
853
|
-
level: string;
|
|
854
|
-
msg: string;
|
|
855
|
-
time: string;
|
|
856
|
-
fields?: Record<string, unknown>;
|
|
857
|
-
}
|
|
858
|
-
export interface PluginOfficialMcpServerSummary {
|
|
859
|
-
name: string;
|
|
860
|
-
type: "http" | "stdio";
|
|
861
|
-
disabled: boolean;
|
|
862
|
-
command?: string;
|
|
863
|
-
url?: string;
|
|
864
|
-
}
|
|
865
|
-
export interface PluginOfficialMcpServerDetail {
|
|
866
|
-
name: string;
|
|
867
|
-
type?: "http" | "stdio";
|
|
868
|
-
command?: string;
|
|
869
|
-
args?: string[];
|
|
870
|
-
env?: Record<string, string>;
|
|
871
|
-
cwd?: string;
|
|
872
|
-
url?: string;
|
|
873
|
-
headers?: Record<string, string>;
|
|
874
|
-
disabled?: boolean;
|
|
875
|
-
autoApprove?: string[];
|
|
876
|
-
startupTimeout?: number;
|
|
877
|
-
debug?: boolean;
|
|
878
|
-
}
|
|
879
|
-
export type PluginOfficialMcpUpsertData = {
|
|
880
|
-
type?: "stdio";
|
|
881
|
-
command?: string;
|
|
882
|
-
args?: string[];
|
|
883
|
-
env?: Record<string, string>;
|
|
884
|
-
cwd?: string;
|
|
885
|
-
disabled?: boolean;
|
|
886
|
-
autoApprove?: string[];
|
|
887
|
-
startupTimeout?: number;
|
|
888
|
-
debug?: boolean;
|
|
889
|
-
} | {
|
|
890
|
-
type: "http";
|
|
891
|
-
url?: string;
|
|
892
|
-
headers?: Record<string, string>;
|
|
893
|
-
disabled?: boolean;
|
|
894
|
-
autoApprove?: string[];
|
|
895
|
-
startupTimeout?: number;
|
|
896
|
-
debug?: boolean;
|
|
897
|
-
};
|
|
898
|
-
export type PluginOfficialExecutionMode = "inherit" | "sandbox" | "full-access";
|
|
899
|
-
export interface PluginOfficialSelectedSkill {
|
|
900
|
-
name: string;
|
|
901
|
-
alias?: string;
|
|
902
|
-
type: "skill" | "scene";
|
|
903
|
-
}
|
|
904
|
-
export interface PluginOfficialBatchProjectCreateData {
|
|
905
|
-
name: string;
|
|
906
|
-
prompt: string;
|
|
907
|
-
modelKey?: string;
|
|
908
|
-
folders: string[];
|
|
909
|
-
concurrency: number;
|
|
910
|
-
executionMode?: PluginOfficialExecutionMode;
|
|
911
|
-
artifactPatterns?: string[];
|
|
912
|
-
notifyEnabled?: boolean;
|
|
913
|
-
timeoutMinutes?: number;
|
|
914
|
-
skill?: PluginOfficialSelectedSkill;
|
|
915
|
-
}
|
|
916
|
-
export interface PluginOfficialBatchProjectUpdateData {
|
|
917
|
-
name?: string;
|
|
918
|
-
prompt?: string;
|
|
919
|
-
modelKey?: string;
|
|
920
|
-
concurrency?: number;
|
|
921
|
-
executionMode?: PluginOfficialExecutionMode;
|
|
922
|
-
artifactPatterns?: string[];
|
|
923
|
-
notifyEnabled?: boolean;
|
|
924
|
-
timeoutMinutes?: number;
|
|
925
|
-
newFolders?: string[];
|
|
926
|
-
skill?: PluginOfficialSelectedSkill | null;
|
|
927
|
-
}
|
|
928
|
-
export interface PluginOfficialSchedulerTaskCreateData {
|
|
929
|
-
name: string;
|
|
930
|
-
prompt: string;
|
|
931
|
-
cron: string;
|
|
932
|
-
isOnce: boolean;
|
|
933
|
-
enabled?: boolean;
|
|
934
|
-
cwd: string;
|
|
935
|
-
modelKey?: string;
|
|
936
|
-
executionMode?: PluginOfficialExecutionMode;
|
|
937
|
-
skill?: PluginOfficialSelectedSkill;
|
|
938
|
-
}
|
|
939
|
-
export interface PluginOfficialSchedulerTaskUpdateData {
|
|
940
|
-
name?: string;
|
|
941
|
-
prompt?: string;
|
|
942
|
-
cron?: string;
|
|
943
|
-
isOnce?: boolean;
|
|
944
|
-
enabled?: boolean;
|
|
945
|
-
cwd?: string;
|
|
946
|
-
modelKey?: string | null;
|
|
947
|
-
executionMode?: PluginOfficialExecutionMode;
|
|
948
|
-
skill?: PluginOfficialSelectedSkill | null;
|
|
949
|
-
}
|
|
950
|
-
export interface PluginOfficialModelSummary {
|
|
951
|
-
id: string;
|
|
952
|
-
name?: string;
|
|
953
|
-
api?: string;
|
|
954
|
-
reasoning?: boolean;
|
|
955
|
-
}
|
|
956
|
-
export interface PluginOfficialProviderSummary {
|
|
957
|
-
id: string;
|
|
958
|
-
displayName: string;
|
|
959
|
-
baseUrl?: string;
|
|
960
|
-
api?: string;
|
|
961
|
-
hasApiKey: boolean;
|
|
962
|
-
modelCount: number;
|
|
963
|
-
models: PluginOfficialModelSummary[];
|
|
964
|
-
}
|
|
965
|
-
export interface PluginOfficialProviderDetail {
|
|
966
|
-
baseUrl?: string;
|
|
967
|
-
apiKey?: string;
|
|
968
|
-
api?: string;
|
|
969
|
-
displayName?: string;
|
|
970
|
-
authHeader?: boolean;
|
|
971
|
-
headers?: Record<string, string>;
|
|
972
|
-
models?: Array<{
|
|
973
|
-
id: string;
|
|
974
|
-
name?: string;
|
|
975
|
-
api?: string;
|
|
976
|
-
reasoning?: boolean;
|
|
977
|
-
contextWindow?: number;
|
|
978
|
-
maxTokens?: number;
|
|
979
|
-
}>;
|
|
980
|
-
}
|
|
981
|
-
export interface PluginOfficialProviderUpsertData {
|
|
982
|
-
baseUrl?: string;
|
|
983
|
-
apiKey?: string;
|
|
984
|
-
api?: string;
|
|
985
|
-
displayName?: string;
|
|
986
|
-
authHeader?: boolean;
|
|
987
|
-
headers?: Record<string, string>;
|
|
988
|
-
models?: Array<{
|
|
989
|
-
id: string;
|
|
990
|
-
name?: string;
|
|
991
|
-
api?: string;
|
|
992
|
-
reasoning?: boolean;
|
|
993
|
-
contextWindow?: number;
|
|
994
|
-
maxTokens?: number;
|
|
995
|
-
}>;
|
|
996
|
-
}
|
|
997
|
-
export interface PluginOfficialProjectEntry {
|
|
998
|
-
path: string;
|
|
999
|
-
name?: string;
|
|
1000
|
-
}
|
|
1001
|
-
export interface PluginOfficialPluginSummary {
|
|
1002
|
-
id: string;
|
|
1003
|
-
name: string;
|
|
1004
|
-
version: string;
|
|
1005
|
-
enabled: boolean;
|
|
1006
|
-
required: boolean;
|
|
1007
|
-
source: string;
|
|
1008
|
-
permissions: string[];
|
|
1009
|
-
description?: string;
|
|
1010
|
-
devWatch?: unknown;
|
|
1011
|
-
}
|
|
1012
|
-
export interface PluginOfficialKnowledgeBase {
|
|
1013
|
-
id: string;
|
|
1014
|
-
name: string;
|
|
1015
|
-
updatedAt: number;
|
|
1016
|
-
isDefault: boolean;
|
|
1017
|
-
nodes: unknown[];
|
|
1018
|
-
}
|
|
1019
|
-
export interface PluginOfficialKnowledgeProcessingSettings {
|
|
1020
|
-
enabled?: boolean;
|
|
1021
|
-
pollIntervalMinutes?: number;
|
|
1022
|
-
processingModelKey?: string;
|
|
1023
|
-
processingModelReasoningLevel?: string;
|
|
1024
|
-
agentConcurrency?: number;
|
|
1025
|
-
ocrConcurrency?: number;
|
|
1026
|
-
}
|
|
1027
|
-
/** 仅宿主验证为官方来源的插件可以调用;普通插件调用时由宿主拒绝。 */
|
|
1028
|
-
export interface PluginOfficialApi {
|
|
1029
|
-
general: {
|
|
1030
|
-
getSettings(): Promise<PluginOfficialGeneralSettings>;
|
|
1031
|
-
setSettings(input: PluginOfficialGeneralSettingsUpdate): Promise<PluginOfficialGeneralSettingsUpdate>;
|
|
1032
|
-
};
|
|
1033
|
-
agent: {
|
|
1034
|
-
getExperimental(): Promise<PluginOfficialExperimentalSettings>;
|
|
1035
|
-
setExperimental(input: Partial<PluginOfficialExperimentalSettings>): Promise<PluginOfficialExperimentalSettings>;
|
|
1036
|
-
};
|
|
1037
|
-
downloads: {
|
|
1038
|
-
list(): Promise<PluginOfficialDownloadItem[]>;
|
|
1039
|
-
cancel(id: string): Promise<void>;
|
|
1040
|
-
};
|
|
1041
|
-
updater: {
|
|
1042
|
-
getState(): Promise<PluginOfficialUpdaterState>;
|
|
1043
|
-
getCurrentVersion(): Promise<string>;
|
|
1044
|
-
check(): Promise<PluginOfficialUpdaterState>;
|
|
1045
|
-
download(): Promise<PluginOfficialUpdaterState>;
|
|
1046
|
-
install(): Promise<void>;
|
|
1047
|
-
dismiss(): Promise<void>;
|
|
1048
|
-
cancel(): Promise<void>;
|
|
1049
|
-
};
|
|
1050
|
-
webhook: {
|
|
1051
|
-
list(): Promise<PluginOfficialWebhookEndpoint[]>;
|
|
1052
|
-
listProviders(): Promise<PluginOfficialWebhookProvider[]>;
|
|
1053
|
-
create(input: PluginOfficialWebhookCreateInput): Promise<PluginOfficialWebhookEndpoint>;
|
|
1054
|
-
update(id: string, input: PluginOfficialWebhookUpdateInput): Promise<PluginOfficialWebhookEndpoint>;
|
|
1055
|
-
setEnabled(id: string, enabled: boolean): Promise<PluginOfficialWebhookEndpoint>;
|
|
1056
|
-
delete(id: string): Promise<void>;
|
|
1057
|
-
test(id: string): Promise<PluginOfficialWebhookSendResult>;
|
|
1058
|
-
send(id: string, message: PluginOfficialWebhookMessage): Promise<PluginOfficialWebhookSendResult>;
|
|
1059
|
-
};
|
|
1060
|
-
skills: {
|
|
1061
|
-
list(cwd?: string): Promise<PluginOfficialSkillInfo[]>;
|
|
1062
|
-
getManifest(): Promise<Record<string, PluginOfficialInstalledSkill>>;
|
|
1063
|
-
setEnabled(name: string, enabled: boolean): Promise<{
|
|
1064
|
-
name: string;
|
|
1065
|
-
enabled: boolean;
|
|
1066
|
-
}>;
|
|
1067
|
-
uninstall(name: string, type?: "skill" | "scene"): Promise<void>;
|
|
1068
|
-
};
|
|
1069
|
-
shortcuts: {
|
|
1070
|
-
listAvailableActions(): Array<{
|
|
1071
|
-
id: string;
|
|
1072
|
-
defaultShortcut: string;
|
|
1073
|
-
}>;
|
|
1074
|
-
get(): Promise<{
|
|
1075
|
-
bindings: PluginOfficialShortcutBinding[];
|
|
1076
|
-
quickPanel: PluginOfficialQuickPanelSettings;
|
|
1077
|
-
}>;
|
|
1078
|
-
setBinding(id: string, shortcut: string): Promise<{
|
|
1079
|
-
bindings: PluginOfficialShortcutBinding[];
|
|
1080
|
-
}>;
|
|
1081
|
-
resetBinding(id: string): Promise<{
|
|
1082
|
-
bindings: PluginOfficialShortcutBinding[];
|
|
1083
|
-
shortcut: string;
|
|
1084
|
-
}>;
|
|
1085
|
-
resetAllBindings(): Promise<{
|
|
1086
|
-
bindings: PluginOfficialShortcutBinding[];
|
|
1087
|
-
}>;
|
|
1088
|
-
setQuickPanelTrigger(trigger: PluginOfficialQuickPanelSettings["trigger"]): Promise<PluginOfficialQuickPanelSettings>;
|
|
1089
|
-
setQuickPanelBehavior(behavior: PluginOfficialQuickPanelSettings["postSendBehavior"]): Promise<PluginOfficialQuickPanelSettings>;
|
|
1090
|
-
};
|
|
1091
|
-
im: {
|
|
1092
|
-
getStatus(): Promise<PluginOfficialImStatus>;
|
|
1093
|
-
getLogs(limit?: number): Promise<PluginOfficialImLog[]>;
|
|
1094
|
-
setEnabled(enabled: boolean): Promise<{
|
|
1095
|
-
status: unknown;
|
|
1096
|
-
}>;
|
|
1097
|
-
restart(): Promise<{
|
|
1098
|
-
status: unknown;
|
|
1099
|
-
}>;
|
|
1100
|
-
setAgentModel(modelKey: string | null, reasoningLevel?: string): Promise<{
|
|
1101
|
-
status: unknown;
|
|
1102
|
-
}>;
|
|
1103
|
-
assertModelKeyExists(modelKey: string): Promise<void>;
|
|
1104
|
-
};
|
|
1105
|
-
mcp: {
|
|
1106
|
-
list(): Promise<PluginOfficialMcpServerSummary[]>;
|
|
1107
|
-
get(name: string): Promise<PluginOfficialMcpServerDetail>;
|
|
1108
|
-
listNames(): Promise<string[]>;
|
|
1109
|
-
upsert(name: string, data: PluginOfficialMcpUpsertData): Promise<PluginOfficialMcpServerDetail>;
|
|
1110
|
-
setEnabled(name: string, enabled: boolean): Promise<void>;
|
|
1111
|
-
remove(name: string): Promise<void>;
|
|
1112
|
-
};
|
|
1113
|
-
models: {
|
|
1114
|
-
list(): Promise<{
|
|
1115
|
-
defaultModel: string | null;
|
|
1116
|
-
providers: PluginOfficialProviderSummary[];
|
|
1117
|
-
}>;
|
|
1118
|
-
get(provider?: string): Promise<unknown>;
|
|
1119
|
-
probe(provider: string, model: string): Promise<{
|
|
1120
|
-
ok: boolean;
|
|
1121
|
-
message?: string;
|
|
1122
|
-
error?: string;
|
|
1123
|
-
}>;
|
|
1124
|
-
listProviderIds(): Promise<string[]>;
|
|
1125
|
-
assertModelKeyExists(modelKey: string, operation?: string): Promise<void>;
|
|
1126
|
-
setDefault(modelKey: string): Promise<{
|
|
1127
|
-
defaultModel: string;
|
|
1128
|
-
}>;
|
|
1129
|
-
upsertProvider(provider: string, data: PluginOfficialProviderUpsertData): Promise<PluginOfficialProviderDetail>;
|
|
1130
|
-
removeProvider(provider: string): Promise<void>;
|
|
1131
|
-
};
|
|
1132
|
-
projects: {
|
|
1133
|
-
list(): Promise<{
|
|
1134
|
-
workspacePath: string;
|
|
1135
|
-
projects: PluginOfficialProjectEntry[];
|
|
1136
|
-
archivedProjects: PluginOfficialProjectEntry[];
|
|
1137
|
-
}>;
|
|
1138
|
-
listSessions(cwd: string): Promise<unknown[]>;
|
|
1139
|
-
listRuntimeProjects(): Promise<unknown[]>;
|
|
1140
|
-
create(name: string, path?: string): Promise<PluginOfficialProjectEntry>;
|
|
1141
|
-
open(path: string, name?: string): Promise<PluginOfficialProjectEntry>;
|
|
1142
|
-
rename(path: string, name: string): Promise<PluginOfficialProjectEntry>;
|
|
1143
|
-
archive(path: string): Promise<void>;
|
|
1144
|
-
unarchive(path: string): Promise<void>;
|
|
1145
|
-
remove(path: string): Promise<void>;
|
|
1146
|
-
};
|
|
1147
|
-
plugins: {
|
|
1148
|
-
list(): Promise<PluginOfficialPluginSummary[]>;
|
|
1149
|
-
get(id: string): Promise<PluginOfficialPluginSummary>;
|
|
1150
|
-
setEnabled(id: string, enabled: boolean): Promise<PluginOfficialPluginSummary>;
|
|
1151
|
-
installFromUrl(url: string): Promise<PluginOfficialPluginSummary>;
|
|
1152
|
-
installFromPath(path: string, options?: {
|
|
1153
|
-
grantedPermissions?: string[];
|
|
1154
|
-
enable?: boolean;
|
|
1155
|
-
}): Promise<PluginOfficialPluginSummary>;
|
|
1156
|
-
uninstall(id: string): Promise<void>;
|
|
1157
|
-
reload(id: string): Promise<PluginOfficialPluginSummary>;
|
|
1158
|
-
};
|
|
1159
|
-
knowledge: {
|
|
1160
|
-
list(): Promise<PluginOfficialKnowledgeBase[]>;
|
|
1161
|
-
fileStatuses(): Promise<Record<string, unknown>>;
|
|
1162
|
-
isProcessing(): Promise<boolean>;
|
|
1163
|
-
getProcessing(): Promise<PluginOfficialKnowledgeProcessingSettings>;
|
|
1164
|
-
create(name: string): Promise<void>;
|
|
1165
|
-
rename(name: string, newName: string): Promise<void>;
|
|
1166
|
-
delete(name: string): Promise<void>;
|
|
1167
|
-
addFiles(kbId: string, paths: string[], move?: boolean): Promise<void>;
|
|
1168
|
-
deleteEntry(kbId: string, relPath: string): Promise<void>;
|
|
1169
|
-
scanNow(): Promise<{
|
|
1170
|
-
skipped: boolean;
|
|
1171
|
-
reason?: string;
|
|
1172
|
-
}>;
|
|
1173
|
-
retryFailed(): Promise<{
|
|
1174
|
-
skipped: boolean;
|
|
1175
|
-
reason?: string;
|
|
1176
|
-
}>;
|
|
1177
|
-
setProcessing(data: Partial<{
|
|
1178
|
-
enabled: boolean;
|
|
1179
|
-
pollIntervalMinutes: 3 | 5 | 10 | 30;
|
|
1180
|
-
processingModelKey: string | null;
|
|
1181
|
-
processingModelReasoningLevel: string | null;
|
|
1182
|
-
agentConcurrency: number;
|
|
1183
|
-
ocrConcurrency: number;
|
|
1184
|
-
}>): Promise<PluginOfficialKnowledgeProcessingSettings>;
|
|
1185
|
-
};
|
|
1186
|
-
batchTasks: {
|
|
1187
|
-
listProjects(): Promise<unknown[]>;
|
|
1188
|
-
getProject(projectId: string): Promise<unknown>;
|
|
1189
|
-
listProjectIds(): Promise<string[]>;
|
|
1190
|
-
createProject(data: PluginOfficialBatchProjectCreateData): Promise<unknown>;
|
|
1191
|
-
updateProject(projectId: string, data: PluginOfficialBatchProjectUpdateData): Promise<unknown>;
|
|
1192
|
-
deleteProject(projectId: string): Promise<unknown>;
|
|
1193
|
-
runTask(projectId: string, taskId: string): Promise<unknown>;
|
|
1194
|
-
retryTask(projectId: string, taskId: string): Promise<unknown>;
|
|
1195
|
-
stopTask(projectId: string, taskId: string): Promise<unknown>;
|
|
1196
|
-
deleteTask(projectId: string, taskId: string): Promise<unknown>;
|
|
1197
|
-
resumeTask(projectId: string, taskId: string): Promise<unknown>;
|
|
1198
|
-
resumeTaskWithText(projectId: string, taskId: string, text: string): Promise<unknown>;
|
|
1199
|
-
deleteTaskSession(projectId: string, taskId: string): Promise<unknown>;
|
|
1200
|
-
batchDelete(projectId: string): Promise<unknown>;
|
|
1201
|
-
batchStart(projectId: string): Promise<unknown>;
|
|
1202
|
-
batchStop(projectId: string): Promise<unknown>;
|
|
1203
|
-
batchReset(projectId: string): Promise<unknown>;
|
|
1204
|
-
batchResetFailed(projectId: string, taskIds: string[]): Promise<unknown>;
|
|
1205
|
-
};
|
|
1206
|
-
scheduler: {
|
|
1207
|
-
listTasks(): Promise<unknown[]>;
|
|
1208
|
-
getTask(taskId: string): Promise<unknown>;
|
|
1209
|
-
listTaskIds(): Promise<string[]>;
|
|
1210
|
-
getHistory(taskId: string): Promise<unknown[]>;
|
|
1211
|
-
createTask(data: PluginOfficialSchedulerTaskCreateData): Promise<unknown>;
|
|
1212
|
-
updateTask(taskId: string, data: PluginOfficialSchedulerTaskUpdateData): Promise<unknown>;
|
|
1213
|
-
deleteTask(taskId: string): Promise<unknown>;
|
|
1214
|
-
setEnabled(taskId: string, enabled: boolean): Promise<unknown>;
|
|
1215
|
-
runNow(taskId: string): Promise<unknown>;
|
|
1216
|
-
abort(taskId: string): Promise<unknown>;
|
|
1217
|
-
};
|
|
1218
|
-
appearance: {
|
|
1219
|
-
help(): Promise<unknown>;
|
|
1220
|
-
get(): Promise<unknown>;
|
|
1221
|
-
set(input: {
|
|
1222
|
-
mode?: "light" | "dark" | "auto";
|
|
1223
|
-
themeId?: string;
|
|
1224
|
-
cursorStyle?: "default" | "stoat";
|
|
1225
|
-
}): Promise<unknown>;
|
|
1226
|
-
setLanguage(language: "zh" | "en"): Promise<unknown>;
|
|
1227
|
-
listThemeIds(): string[];
|
|
1228
|
-
};
|
|
1229
|
-
navigation: {
|
|
1230
|
-
help(): unknown;
|
|
1231
|
-
resolveOpen(input: {
|
|
1232
|
-
target: string;
|
|
1233
|
-
tab?: string;
|
|
1234
|
-
section?: string;
|
|
1235
|
-
}): {
|
|
1236
|
-
hashPath: string;
|
|
1237
|
-
resolved: unknown;
|
|
1238
|
-
};
|
|
1239
|
-
open(input: {
|
|
1240
|
-
target: string;
|
|
1241
|
-
tab?: string;
|
|
1242
|
-
section?: string;
|
|
1243
|
-
}): Promise<unknown>;
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
export interface PluginFsEntry {
|
|
1247
|
-
name: string;
|
|
1248
|
-
path: string;
|
|
1249
|
-
isDirectory: boolean;
|
|
1250
|
-
size: number;
|
|
1251
|
-
modifiedAt: number;
|
|
1252
|
-
}
|
|
1253
|
-
export interface PluginFsFileRef {
|
|
1254
|
-
name: string;
|
|
1255
|
-
path: string;
|
|
1256
|
-
relPath: string;
|
|
1257
|
-
}
|
|
1258
|
-
export interface PluginFsStatResult {
|
|
1259
|
-
size: number;
|
|
1260
|
-
modifiedAt: number;
|
|
1261
|
-
createdAt: number;
|
|
1262
|
-
}
|
|
1263
|
-
export interface PluginFsReadResult {
|
|
1264
|
-
content: string;
|
|
1265
|
-
encoding: "utf8" | "base64";
|
|
1266
|
-
}
|
|
1267
|
-
export interface PluginFsApi {
|
|
1268
|
-
readDir(dirPath: string): Promise<PluginFsEntry[]>;
|
|
1269
|
-
readFile(filePath: string): Promise<PluginFsReadResult>;
|
|
1270
|
-
/** Pass `encoding: "base64"` to write binary payloads (decoded from base64 text). */
|
|
1271
|
-
writeFile(filePath: string, content: string, encoding?: "utf8" | "base64"): Promise<void>;
|
|
1272
|
-
stat(filePath: string): Promise<PluginFsStatResult | null>;
|
|
1273
|
-
rename(oldPath: string, newPath: string): Promise<void>;
|
|
1274
|
-
delete(targetPath: string): Promise<void>;
|
|
1275
|
-
move(sourcePath: string, destDir: string): Promise<void>;
|
|
1276
|
-
createDirectory(dirPath: string): Promise<void>;
|
|
1277
|
-
listFilesRecursive(rootPath: string): Promise<PluginFsFileRef[]>;
|
|
1278
|
-
}
|
|
1279
|
-
export interface PluginCommandRunOptions {
|
|
1280
|
-
/** Working directory. Must resolve inside a host-allowed root (e.g. a project). */
|
|
1281
|
-
cwd?: string;
|
|
1282
|
-
/** Extra environment entries, merged over the host process env (PATH preserved). */
|
|
1283
|
-
env?: Record<string, string>;
|
|
1284
|
-
/** Hard timeout in ms; the host clamps to its own maximum. */
|
|
1285
|
-
timeoutMs?: number;
|
|
1286
|
-
}
|
|
1287
|
-
export interface PluginCommandRunResult {
|
|
1288
|
-
stdout: string;
|
|
1289
|
-
stderr: string;
|
|
1290
|
-
/** Process exit code; null when the process was killed by a signal/timeout. */
|
|
1291
|
-
exitCode: number | null;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Run an allowed host command (e.g. `git`). execFile semantics — NO shell, args
|
|
1295
|
-
* are passed as an array (no string splitting, no injection). The executable
|
|
1296
|
-
* must be declared in plugin.json's `commands` and currently enabled by the
|
|
1297
|
-
* user; otherwise the call is rejected (and the host notifies the user). Needs
|
|
1298
|
-
* the `agent.command.run` permission.
|
|
1299
|
-
*/
|
|
1300
|
-
export interface PluginCommandApi {
|
|
1301
|
-
run(file: string, args?: string[], options?: PluginCommandRunOptions): Promise<PluginCommandRunResult>;
|
|
1302
|
-
}
|
|
1303
|
-
export interface PluginPermissionApi {
|
|
1304
|
-
has(permission: PluginPermission): boolean;
|
|
1305
|
-
require(permission: PluginPermission): void;
|
|
1306
|
-
}
|
|
1307
|
-
export interface PluginGenerateImageInput {
|
|
1308
|
-
prompt: string;
|
|
1309
|
-
/** Output size (e.g. "1024x1024"), decided by the agent and forwarded to the model. */
|
|
1310
|
-
size?: string;
|
|
1311
|
-
/** Optional reference id for grouping (e.g. the conversation/session). */
|
|
1312
|
-
sessionId?: string;
|
|
1313
|
-
}
|
|
1314
|
-
export interface PluginEditImageInput {
|
|
1315
|
-
prompt: string;
|
|
1316
|
-
/**
|
|
1317
|
-
* Source image to edit. Either an existing host image id (continue a
|
|
1318
|
-
* lineage) or raw base64 bytes (e.g. a user upload).
|
|
1319
|
-
*/
|
|
1320
|
-
source: {
|
|
1321
|
-
imageId: string;
|
|
1322
|
-
} | {
|
|
1323
|
-
data: string;
|
|
1324
|
-
mimeType: string;
|
|
1325
|
-
};
|
|
1326
|
-
sessionId?: string;
|
|
1327
|
-
}
|
|
1328
|
-
/**
|
|
1329
|
-
* Image generation, routed to the host's main-process image service (single
|
|
1330
|
-
* implementation shared with the agent's built-in image tool). Bytes are
|
|
1331
|
-
* stored out-of-band; results are returned as host media references.
|
|
1332
|
-
*/
|
|
1333
|
-
export interface PluginImagesApi {
|
|
1334
|
-
/** Text-to-image. Resolves to the produced image reference(s). */
|
|
1335
|
-
generate(input: PluginGenerateImageInput): Promise<PluginImageRef[]>;
|
|
1336
|
-
/** Image-to-image edit, producing the next version in a lineage. */
|
|
1337
|
-
edit(input: PluginEditImageInput): Promise<PluginImageRef[]>;
|
|
1338
|
-
/** The edit lineage (base image + its edits, oldest first) for an image. */
|
|
1339
|
-
lineage(imageId: string): Promise<PluginImageRef[]>;
|
|
1340
|
-
/**
|
|
1341
|
-
* Every edit lineage the given session touched (generated or edited a version
|
|
1342
|
-
* in), newest lineage first; each lineage's versions oldest → newest. The
|
|
1343
|
-
* sessionId is the agent session id — derive it from the active conversation's
|
|
1344
|
-
* `sessionPath` (the UUID embedded in the session file name).
|
|
1345
|
-
*/
|
|
1346
|
-
sessionLineages(sessionId: string): Promise<PluginImageRef[][]>;
|
|
1347
|
-
}
|
|
1348
|
-
/**
|
|
1349
|
-
* Read-side access to this plugin's settings (the values configured against
|
|
1350
|
-
* the `contributes.settings` schema declared in plugin.json, namespaced by
|
|
1351
|
-
* plugin id). Writes go through the host's settings UI, not the plugin.
|
|
1352
|
-
*/
|
|
1353
|
-
export interface PluginSettingsApi {
|
|
1354
|
-
get<T = unknown>(key: string): T | undefined;
|
|
1355
|
-
getAll(): Record<string, unknown>;
|
|
1356
|
-
/** Fired when any of this plugin's setting values change. */
|
|
1357
|
-
onChange(listener: (values: Record<string, unknown>) => void): Disposable;
|
|
1358
|
-
}
|
|
1359
|
-
/** A flat catalog: translation key → localized string. */
|
|
1360
|
-
export type PluginLocaleCatalog = Record<string, string>;
|
|
1361
|
-
/** Every catalog a plugin ships, keyed by locale code (e.g. "zh", "en"). */
|
|
1362
|
-
export type PluginLocales = Record<string, PluginLocaleCatalog>;
|
|
1363
|
-
/** Replace `{{name}}` placeholders in a resolved string with `params`. */
|
|
1364
|
-
export declare function interpolatePluginText(text: string, params?: Record<string, string | number>): string;
|
|
1365
|
-
/**
|
|
1366
|
-
* Resolve a bare catalog key against a plugin's catalogs. Fallback chain:
|
|
1367
|
-
* current-locale catalog → the plugin's `defaultLocale` catalog → the bare key
|
|
1368
|
-
* itself (a dev signal for a missing translation). Then interpolate `{{params}}`.
|
|
1369
|
-
*/
|
|
1370
|
-
export declare function resolveCatalogKey(key: string, locales: PluginLocales, currentLocale: string, defaultLocale: string, params?: Record<string, string | number>): string;
|
|
1371
|
-
/**
|
|
1372
|
-
* Resolve a host-rendered plugin string. A value of the exact form `%key%` is a
|
|
1373
|
-
* catalog key (resolved via {@link resolveCatalogKey}); any other string is a
|
|
1374
|
-
* literal and returned unchanged — backwards compatible with bare strings.
|
|
1375
|
-
*/
|
|
1376
|
-
export declare function resolvePluginText(raw: string, locales: PluginLocales, currentLocale: string, defaultLocale: string, params?: Record<string, string | number>): string;
|
|
1377
|
-
export type PluginTranslate = (key: string, params?: Record<string, string | number>) => string;
|
|
1378
|
-
/**
|
|
1379
|
-
* This plugin's i18n surface on the context. `locale` always equals the host's
|
|
1380
|
-
* current language; `t` resolves a BARE catalog key (no `%...%` wrapper) against
|
|
1381
|
-
* this plugin's catalogs at the current locale. Imperative — for plugin React
|
|
1382
|
-
* components prefer the reactive {@link useTranslation} hook.
|
|
1383
|
-
*/
|
|
1384
|
-
export interface PluginI18nApi {
|
|
1385
|
-
/** The host's current locale code (e.g. "zh"). */
|
|
1386
|
-
readonly locale: string;
|
|
1387
|
-
/** Resolve a bare catalog key at the current locale, with optional `{{params}}`. */
|
|
1388
|
-
t: PluginTranslate;
|
|
1389
|
-
/** Fired when the host language changes. */
|
|
1390
|
-
onChange(listener: (locale: string) => void): Disposable;
|
|
1391
|
-
}
|
|
1392
|
-
/** 工作模式(agent_mode 轴,见 ADR-0046)。宿主 Work/Coding,未来可能扩展。 */
|
|
1393
|
-
export type AgentMode = "work" | "coding";
|
|
1394
|
-
export interface PluginContext {
|
|
1395
|
-
plugin: {
|
|
1396
|
-
id: string;
|
|
1397
|
-
version: string;
|
|
1398
|
-
};
|
|
1399
|
-
permissions: PluginPermissionApi;
|
|
1400
|
-
ui: PluginUiApi;
|
|
1401
|
-
conversation: PluginConversationApi;
|
|
1402
|
-
agent: PluginAgentApi;
|
|
1403
|
-
appActions: PluginAppActionsApi;
|
|
1404
|
-
official: PluginOfficialApi;
|
|
1405
|
-
fs: PluginFsApi;
|
|
1406
|
-
command: PluginCommandApi;
|
|
1407
|
-
images: PluginImagesApi;
|
|
1408
|
-
settings: PluginSettingsApi;
|
|
1409
|
-
i18n: PluginI18nApi;
|
|
1410
|
-
/** 当前工作模式(agent_mode 轴)。开发者据此做模式定制。见 ADR-0046。 */
|
|
1411
|
-
getAgentMode(): AgentMode;
|
|
1412
|
-
/** 订阅工作模式变更(纯全局实时切换)。返回 Disposable 取消订阅。 */
|
|
1413
|
-
onAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;
|
|
1414
|
-
}
|
|
1415
|
-
export interface PluginDefinition {
|
|
1416
|
-
activate(ctx: PluginContext): void | Promise<void>;
|
|
1417
|
-
deactivate?(): void | Promise<void>;
|
|
1418
|
-
}
|
|
1419
|
-
export declare function definePlugin(plugin: PluginDefinition): PluginDefinition;
|
|
1420
|
-
export interface PluginHostBridge {
|
|
1421
|
-
useActiveConversation(): ConversationState;
|
|
1422
|
-
useConversationMessages(): ConversationMessage[];
|
|
1423
|
-
useEditImageAttachment(): PluginImageRef | null;
|
|
1424
|
-
/** Reactive: the host's current locale code (e.g. "zh"). */
|
|
1425
|
-
useLocale(): string;
|
|
1426
|
-
conversation: PluginConversationApi;
|
|
1427
|
-
}
|
|
1428
|
-
export declare function __setPluginHostBridge(bridge: PluginHostBridge): void;
|
|
1429
|
-
export interface ActivityTabContextValue {
|
|
1430
|
-
/**
|
|
1431
|
-
* The cwd scope of the activity panel this tab is rendered in — the same
|
|
1432
|
-
* key the attach record uses. Do NOT substitute useActiveConversation().cwd:
|
|
1433
|
-
* on the project detail page the panel cwd is the project's, while the
|
|
1434
|
-
* active conversation may belong to another project (or be null).
|
|
1435
|
-
*/
|
|
1436
|
-
cwd: string | null;
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
* Internal: the host wraps attached activity-tab components in this context's
|
|
1440
|
-
* Provider. Module Federation shares this single SDK instance, so the value
|
|
1441
|
-
* the host provides is visible to plugin components.
|
|
1442
|
-
*/
|
|
1443
|
-
export declare const __ActivityTabContext: import("react").Context<ActivityTabContextValue>;
|
|
1444
|
-
/** The panel scope of the activity tab this component is rendered in. */
|
|
1445
|
-
export declare function useActivityTab(): ActivityTabContextValue;
|
|
1446
|
-
export interface PluginI18nContextValue {
|
|
1447
|
-
/** This plugin's catalogs, keyed by locale code. */
|
|
1448
|
-
locales: PluginLocales;
|
|
1449
|
-
/** Fallback locale when a key is missing in the current locale. */
|
|
1450
|
-
defaultLocale: string;
|
|
1451
|
-
}
|
|
1452
|
-
/**
|
|
1453
|
-
* Internal: the host wraps plugin-rendered components in this context's Provider,
|
|
1454
|
-
* carrying THIS plugin's catalogs. Module Federation shares this single SDK
|
|
1455
|
-
* instance, so the value the host provides is visible to {@link useTranslation}.
|
|
1456
|
-
*/
|
|
1457
|
-
export declare const __PluginI18nContext: import("react").Context<PluginI18nContextValue>;
|
|
1458
|
-
export interface PluginTranslation {
|
|
1459
|
-
/** The host's current locale code (e.g. "zh"). */
|
|
1460
|
-
locale: string;
|
|
1461
|
-
/** Resolve a bare catalog key at the current locale, with optional `{{params}}`. */
|
|
1462
|
-
t: PluginTranslate;
|
|
1463
|
-
}
|
|
1464
|
-
/**
|
|
1465
|
-
* Reactive translation for plugin React components — re-renders when the host
|
|
1466
|
-
* language changes. `t` resolves a BARE catalog key (no `%...%` wrapper) against
|
|
1467
|
-
* THIS plugin's catalogs; the host provides them via __PluginI18nContext.
|
|
1468
|
-
*/
|
|
1469
|
-
export declare function useTranslation(): PluginTranslation;
|
|
1470
|
-
/** Reactive: the currently-active conversation's state. */
|
|
1471
|
-
export declare function useActiveConversation(): ConversationState;
|
|
1472
|
-
/** Reactive: the active conversation's messages. */
|
|
1473
|
-
export declare function useConversationMessages(): ConversationMessage[];
|
|
1474
|
-
/**
|
|
1475
|
-
* Reactive: the image currently bound as the edit target via
|
|
1476
|
-
* `ui.setEditImageAttachment` (or null). Single source of truth for the
|
|
1477
|
-
* "selected for edit" highlight — clears automatically when the host drops the
|
|
1478
|
-
* attachment (send, capsule close, or session switch).
|
|
1479
|
-
*/
|
|
1480
|
-
export declare function useEditImageAttachment(): PluginImageRef | null;
|
|
4
|
+
* Implementation is split by domain under `src/*.ts`; this barrel re-exports
|
|
5
|
+
* the stable package API. Prefer importing from `@vetta-org/plugin-sdk` rather
|
|
6
|
+
* than deep paths.
|
|
7
|
+
*/
|
|
8
|
+
export type { ConversationScenario } from "./scenario.js";
|
|
9
|
+
export type { PluginPermission } from "./permissions.js";
|
|
10
|
+
export type { Disposable } from "./disposable.js";
|
|
11
|
+
export type { PluginMcpServerConfig, PluginAgentManifest } from "./manifest.js";
|
|
12
|
+
export type { ConversationState, ConversationMessage, ConversationEvent, PluginConversationApi, } from "./conversation.js";
|
|
13
|
+
export type { PluginGlobalSlotContribution, PluginAudioMetadata, PluginPreviewUrlOptions, PluginPreviewFile, PluginFilePreviewProps, PluginFilePreviewContribution, PluginActivityTabContribution, PluginCaptureRegion, PluginOpenActivityTabOptions, PluginPromptDecoration, PluginInputActionContribution, CardDescriptor, PluginPendingToolCall, PluginCardProps, PluginCardRendererContribution, PluginToolCallSlotToolCall, PluginToolCallSlotProps, PluginToolCallSlotContribution, PluginTurnCardContribution, PluginNotifyOptions, PluginUiApi, } from "./ui.js";
|
|
14
|
+
export type { PluginJsonSchema, PluginAgentToolApi, PluginAgentToolRegistration, PluginSystemPromptBlock, PluginDynamicSystemPromptOperation, PluginSystemPromptMessage, PluginSystemPromptProviderContext, PluginSystemPromptBlockView, PluginAgentActions, PluginAgentHandlerContext, PluginAgentToolHandler, PluginSystemPromptProviderHandler, PluginSystemPromptProviderRegistration, PluginContinuationResult, PluginContinuationHandler, PluginContinuationRegistration, PluginAgentApi, } from "./agent.js";
|
|
15
|
+
export type { PluginAppActionEffect, PluginAppActionExample, PluginAppActionHandlerContext, PluginAppActionHandler, PluginAppActionReadyHandler, PluginAppActionApprovalPresentation, PluginAppActionApproval, PluginAppActionRegistration, PluginAppActionsApi, } from "./app-actions.js";
|
|
16
|
+
export { PluginAppActionError } from "./app-actions.js";
|
|
17
|
+
export type { PluginOfficialGeneralSettings, PluginOfficialGeneralSettingsUpdate, PluginOfficialExperimentalSettings, PluginOfficialDownloadItem, PluginOfficialUpdaterState, PluginOfficialWebhookKind, PluginOfficialWebhookEndpoint, PluginOfficialWebhookProvider, PluginOfficialWebhookCreateInput, PluginOfficialWebhookUpdateInput, PluginOfficialWebhookMessage, PluginOfficialWebhookSendResult, PluginOfficialSkillInfo, PluginOfficialInstalledSkill, PluginOfficialShortcutBinding, PluginOfficialQuickPanelSettings, PluginOfficialImStatus, PluginOfficialImLog, PluginOfficialMcpServerSummary, PluginOfficialMcpServerDetail, PluginOfficialMcpUpsertData, PluginOfficialExecutionMode, PluginOfficialSelectedSkill, PluginOfficialBatchProjectCreateData, PluginOfficialBatchProjectUpdateData, PluginOfficialSchedulerTaskCreateData, PluginOfficialSchedulerTaskUpdateData, PluginOfficialModelSummary, PluginOfficialProviderSummary, PluginOfficialProviderDetail, PluginOfficialProviderUpsertData, PluginOfficialProjectEntry, PluginOfficialPluginSummary, PluginOfficialKnowledgeBase, PluginOfficialKnowledgeProcessingSettings, PluginOfficialApi, } from "./official.js";
|
|
18
|
+
export type { PluginFsEntry, PluginFsFileRef, PluginFsBinaryReadResult, PluginFsStatResult, PluginFsReadResult, PluginFsApi, } from "./fs.js";
|
|
19
|
+
export type { PluginCommandRunOptions, PluginCommandRunResult, PluginCommandApi, } from "./command.js";
|
|
20
|
+
export type { PluginImageRef } from "./images.js";
|
|
21
|
+
export type { PluginPromptAttachment } from "./prompt-attachment.js";
|
|
22
|
+
export type { PluginNetworkApi, PluginNetworkBody, PluginNetworkRequest, PluginNetworkResponse, } from "./network.js";
|
|
23
|
+
export type { PluginPutBlobInput, PluginStorageApi, PluginStoredBlob, PluginStoredBlobRef, } from "./storage.js";
|
|
24
|
+
export type { PluginSettingsApi } from "./settings.js";
|
|
25
|
+
export type { PluginLocaleCatalog, PluginLocales, PluginTranslate, PluginI18nApi, } from "./i18n.js";
|
|
26
|
+
export { interpolatePluginText, resolveCatalogKey, resolvePluginText } from "./i18n.js";
|
|
27
|
+
export type { PluginPermissionApi, AgentMode, PluginContext, PluginDefinition } from "./context.js";
|
|
28
|
+
export { definePlugin } from "./context.js";
|
|
29
|
+
export type { PluginHostBridge } from "./host-bridge.js";
|
|
30
|
+
export { __setPluginHostBridge } from "./host-bridge.js";
|
|
31
|
+
export type { ActivityTabContextValue } from "./activity-tab.js";
|
|
32
|
+
export { __ActivityTabContext, useActivityTab } from "./activity-tab.js";
|
|
33
|
+
export type { PluginI18nContextValue, PluginTranslation } from "./hooks.js";
|
|
34
|
+
export { __PluginI18nContext, useTranslation, useActiveConversation, useConversationMessages, usePromptAttachment, } from "./hooks.js";
|
|
1481
35
|
//# sourceMappingURL=index.d.ts.map
|