@vetta-org/plugin-sdk 0.3.15 → 0.3.17
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/conversation.d.ts +11 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/generation-metrics.d.ts +102 -0
- package/dist/generation-metrics.d.ts.map +1 -0
- package/dist/generation-metrics.js +23 -0
- package/dist/generation-metrics.js.map +1 -0
- package/dist/hooks.d.ts +10 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +18 -0
- package/dist/hooks.js.map +1 -1
- package/dist/host-bridge.d.ts +3 -0
- package/dist/host-bridge.d.ts.map +1 -1
- package/dist/host-bridge.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest-schema.d.ts +2 -2
- package/dist/manifest-schema.d.ts.map +1 -1
- package/dist/official.d.ts +0 -7
- package/dist/official.d.ts.map +1 -1
- package/dist/official.js.map +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +1 -0
- package/dist/permissions.js.map +1 -1
- package/dist/ui.d.ts +93 -15
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/docs/README.md +2 -1
- package/docs/conversation-and-agent.md +63 -0
- package/docs/permissions.md +1 -0
- package/docs/styling-and-pitfalls.md +1 -0
- package/docs/ui-slots.md +61 -36
- package/package.json +1 -1
package/dist/official.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"official.js","sourceRoot":"","sources":["../src/official.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginOfficialGeneralSettings {\n\tworkspacePath: string;\n\tdefaultExecutionMode?: \"sandbox\" | \"full-access\";\n\tnotificationsEnabled: boolean;\n\tdebugMode: boolean;\n\tsandbox: unknown;\n}\n\nexport type PluginOfficialGeneralSettingsUpdate =\n\t| { operation: \"set-notifications\"; enabled: boolean }\n\t| { operation: \"set-execution-mode\"; mode: \"sandbox\" | \"full-access\" }\n\t| { operation: \"set-workspace\"; path: string };\n\nexport interface PluginOfficialExperimentalSettings {\n\tvettaCli: boolean;\n\tpromptPrediction: boolean;\n\tagentSkills: boolean;\n}\n\nexport interface PluginOfficialImageGenerationSettings {\n\ttextToImageProviderId?: string;\n\ttextToImageModelId?: string;\n\timageToImageProviderId?: string;\n\timageToImageModelId?: string;\n}\n\nexport type PluginOfficialImageGenerationSettingsUpdate = {\n\ttextToImageProviderId?: string | null;\n\ttextToImageModelId?: string | null;\n\timageToImageProviderId?: string | null;\n\timageToImageModelId?: string | null;\n};\n\nexport interface PluginOfficialDownloadItem {\n\tid: string;\n\turl: string;\n\tfilename: string;\n\tpath: string;\n\ttotalBytes: number;\n\treceivedBytes: number;\n\tstatus: \"queued\" | \"downloading\" | \"paused\" | \"completed\" | \"failed\" | \"canceled\";\n\terror?: string;\n\tcreatedAt: number;\n\tcompletedAt?: number;\n\tspeedBytesPerSec?: number;\n}\n\nexport interface PluginOfficialUpdaterState {\n\tphase: \"idle\" | \"checking\" | \"available\" | \"downloading\" | \"ready\" | \"installing\" | \"error\";\n\tcurrentVersion: string;\n\tlatestVersion?: string;\n\treleaseNote?: string;\n\tprogress?: number;\n\tdownloadedBytes?: number;\n\ttotalBytes?: number;\n\tassetFileName?: string;\n\terror?: string;\n}\n\nexport type PluginOfficialWebhookKind = \"feishu\" | \"dingtalk\";\n\nexport interface PluginOfficialWebhookEndpoint {\n\tid: string;\n\tkind: PluginOfficialWebhookKind;\n\tname: string;\n\tenabled: boolean;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\turlMask?: string;\n\thasSignSecret?: boolean;\n}\n\nexport interface PluginOfficialWebhookProvider {\n\tkind: PluginOfficialWebhookKind;\n\tdisplayName: string;\n\ticonClass?: string;\n}\n\nexport interface PluginOfficialWebhookCreateInput {\n\tkind: PluginOfficialWebhookKind;\n\tname: string;\n\twebhookUrl: string;\n\tsignSecret?: string;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialWebhookUpdateInput {\n\tname?: string;\n\tenabled?: boolean;\n\twebhookUrl?: string;\n\tsignSecret?: string;\n}\n\nexport interface PluginOfficialWebhookMessage {\n\ttitle?: string;\n\ttext: string;\n\tlevel?: \"info\" | \"warn\" | \"error\" | \"success\";\n}\n\nexport interface PluginOfficialWebhookSendResult {\n\tok: boolean;\n\terror?: string;\n}\n\nexport interface PluginOfficialSkillInfo {\n\tname: string;\n\talias?: string;\n\tdescription: string;\n\tsource: string;\n\ttype: \"skill\";\n}\n\nexport type PluginOfficialInstalledSkill = {\n\tname: string;\n\tversion: string;\n\tinstalledAt: string;\n\tsource: \"market\" | \"custom\";\n\tenabled: boolean;\n\ttype?: \"skill\";\n\talias?: string;\n\tmarketDescription?: string;\n\tdescription?: string;\n};\n\nexport interface PluginOfficialShortcutBinding {\n\tid: string;\n\tdefaultShortcut: string;\n\tshortcut: string;\n\tisDefault: boolean;\n}\n\nexport interface PluginOfficialQuickPanelSettings {\n\ttrigger: \"none\" | \"mod\" | \"alt\" | \"shift\";\n\tpostSendBehavior: \"foreground\" | \"background\";\n}\n\nexport interface PluginOfficialImStatus {\n\tenabled: boolean;\n\ttransport: string;\n\tagentModel: { provider: string; model: string; reasoningLevel?: string } | null;\n\twechatBound: boolean;\n\tfeishuAppId: string | null;\n\truntime: unknown;\n}\n\nexport interface PluginOfficialImLog {\n\tlevel: string;\n\tmsg: string;\n\ttime: string;\n\tfields?: Record<string, unknown>;\n}\n\n/**\n * MCP 配置落点。省略时只操作全局 `~/.vetta/agent/mcp.json`;\n * `scope: \"project\"` 必须同时给出项目根 `cwd`,读写 `<cwd>/.vetta/mcp.json`。\n * 只给 `cwd` 时读操作会把项目一并纳入,写操作仍默认全局。\n */\nexport interface PluginOfficialMcpTarget {\n\tscope?: \"global\" | \"project\";\n\tcwd?: string;\n}\n\nexport interface PluginOfficialMcpServerSummary {\n\tname: string;\n\ttype: \"http\" | \"sse\" | \"stdio\";\n\tdisabled: boolean;\n\tcommand?: string;\n\turl?: string;\n\t/** 仅在传了 `scope` 或 `cwd` 时返回。 */\n\tscope?: \"global\" | \"project\";\n\t/** 来自项目根 `.mcp.json`:Vetta 只读取,不会改写。 */\n\treadOnly?: boolean;\n}\n\nexport interface PluginOfficialMcpServerDetail {\n\tname: string;\n\ttype?: \"http\" | \"sse\" | \"stdio\";\n\tcommand?: string;\n\targs?: string[];\n\tenv?: Record<string, string>;\n\tcwd?: string;\n\turl?: string;\n\theaders?: Record<string, string>;\n\tdisabled?: boolean;\n\tautoApprove?: string[];\n\tstartupTimeout?: number;\n\tdebug?: boolean;\n\tscope?: \"global\" | \"project\";\n\treadOnly?: boolean;\n}\n\nexport type PluginOfficialMcpUpsertData =\n\t| {\n\t\t\ttype?: \"stdio\";\n\t\t\tcommand?: string;\n\t\t\targs?: string[];\n\t\t\tenv?: Record<string, string>;\n\t\t\tcwd?: string;\n\t\t\tdisabled?: boolean;\n\t\t\tautoApprove?: string[];\n\t\t\tstartupTimeout?: number;\n\t\t\tdebug?: boolean;\n\t }\n\t| {\n\t\t\t/** `sse` 是旧式 HTTP+SSE 传输,仅为兼容仍在使用它的服务器。 */\n\t\t\ttype: \"http\" | \"sse\";\n\t\t\turl?: string;\n\t\t\theaders?: Record<string, string>;\n\t\t\tdisabled?: boolean;\n\t\t\tautoApprove?: string[];\n\t\t\tstartupTimeout?: number;\n\t\t\tdebug?: boolean;\n\t };\n\nexport type PluginOfficialExecutionMode = \"inherit\" | \"sandbox\" | \"full-access\";\n\nexport interface PluginOfficialSelectedSkill {\n\tname: string;\n\talias?: string;\n\ttype: \"skill\";\n}\n\nexport interface PluginOfficialBatchProjectCreateData {\n\tname: string;\n\tprompt: string;\n\tmodelKey?: string;\n\tfolders: string[];\n\tconcurrency: number;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tartifactPatterns?: string[];\n\tnotifyEnabled?: boolean;\n\ttimeoutMinutes?: number;\n\tskill?: PluginOfficialSelectedSkill;\n}\n\nexport interface PluginOfficialBatchProjectUpdateData {\n\tname?: string;\n\tprompt?: string;\n\tmodelKey?: string;\n\tconcurrency?: number;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tartifactPatterns?: string[];\n\tnotifyEnabled?: boolean;\n\ttimeoutMinutes?: number;\n\tnewFolders?: string[];\n\tskill?: PluginOfficialSelectedSkill | null;\n}\n\n/** 「重复」:精确到分钟,按本机时区;星期 0 = 周日;interval 为固定间隔;custom 为 5 段 cron。 */\nexport type PluginOfficialSchedulerSchedule =\n\t| { kind: \"once\"; at: number }\n\t| { kind: \"hourly\"; minute: number }\n\t| { kind: \"daily\"; hour: number; minute: number }\n\t| { kind: \"weekly\"; weekdays: number[]; hour: number; minute: number }\n\t| { kind: \"monthly\"; days: Array<number | \"last\">; hour: number; minute: number }\n\t/** 从 startAt(毫秒时间戳)起每 everyMinutes 分钟一次,1–10080。 */\n\t| { kind: \"interval\"; everyMinutes: number; startAt: number }\n\t| { kind: \"custom\"; cron: string };\n\n/**\n * 运行会话策略:projectCwd 为会话所属项目的路径,省略即落在默认「对话」里。\n * same-session 的 sessionPath 为 null 表示首次执行时新建一个会话,之后一直复用。\n */\nexport type PluginOfficialSchedulerRunTarget =\n\t| { mode: \"new-session\"; projectCwd?: string }\n\t| { mode: \"same-session\"; projectCwd?: string; sessionPath: string | null };\n\n/** 省略即「跟随默认模型」。 */\nexport interface PluginOfficialSchedulerModel {\n\tkey: string;\n\treasoning?: string;\n}\n\nexport interface PluginOfficialSchedulerNotification {\n\twebhookIds: string[];\n\twhen: \"always\" | \"success\" | \"failure\";\n\t/** 支持 {{name}} {{status}} {{startedAt}} {{duration}} {{reply}} {{error}}。 */\n\ttemplate: string;\n}\n\nexport interface PluginOfficialSchedulerTaskCreateData {\n\tname: string;\n\tprompt: string;\n\tschedule: PluginOfficialSchedulerSchedule;\n\trunTarget: PluginOfficialSchedulerRunTarget;\n\tmodel?: PluginOfficialSchedulerModel;\n\tnotification?: PluginOfficialSchedulerNotification;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialSchedulerTaskUpdateData {\n\tname?: string;\n\tprompt?: string;\n\tschedule?: PluginOfficialSchedulerSchedule;\n\trunTarget?: PluginOfficialSchedulerRunTarget;\n\tmodel?: PluginOfficialSchedulerModel | null;\n\tnotification?: PluginOfficialSchedulerNotification | null;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialModelSummary {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n}\n\nexport interface PluginOfficialProviderSummary {\n\tid: string;\n\tdisplayName: string;\n\tbaseUrl?: string;\n\tapi?: string;\n\thasApiKey: boolean;\n\t/** 图标 symbol;配合 `ProviderIcon` 解析为内置图标,无则不画图标。 */\n\ticon?: string;\n\t/**\n\t * true = 来自登录后服务端下发的远程目录(如 Vetta Go),凭据是账号登录态而非本地\n\t * API Key,因此不会出现在本地模型配置里,也不可用 `upsertProvider` / `removeProvider` 改。\n\t */\n\tremote?: boolean;\n\tmodelCount: number;\n\tmodels: PluginOfficialModelSummary[];\n}\n\nexport interface PluginOfficialProviderDetail {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: Array<{\n\t\tid: string;\n\t\tname?: string;\n\t\tapi?: string;\n\t\treasoning?: boolean;\n\t\tcontextWindow?: number;\n\t\tmaxTokens?: number;\n\t}>;\n}\n\nexport interface PluginOfficialProviderUpsertData {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: Array<{\n\t\tid: string;\n\t\tname?: string;\n\t\tapi?: string;\n\t\treasoning?: boolean;\n\t\tcontextWindow?: number;\n\t\tmaxTokens?: number;\n\t}>;\n}\n\nexport interface PluginOfficialProjectEntry {\n\tpath: string;\n\tname?: string;\n}\n\nexport interface PluginOfficialPluginSummary {\n\tid: string;\n\tname: string;\n\tversion: string;\n\tactiveVersion: string;\n\tpendingVersion?: string;\n\tenabled: boolean;\n\trequired: boolean;\n\tsource: string;\n\tpermissions: string[];\n\tdescription?: string;\n\trootPath?: string;\n\tdevWatch?: unknown;\n}\n\nexport interface PluginOfficialPluginChangedEvent {\n\treason?: string;\n\tpluginId?: string;\n}\n\nexport interface PluginOfficialSaveCopyOptions {\n\tdefaultFileName?: string;\n\ttitle?: string;\n\tfilters?: Array<{ name: string; extensions: string[] }>;\n}\n\n/** `official.dialog.openFiles` 的选项。 */\nexport interface PluginOfficialOpenFilesOptions {\n\ttitle?: string;\n\tfilters?: Array<{ name: string; extensions: string[] }>;\n\t/** 允许多选,默认单选。 */\n\tmultiple?: boolean;\n\t/** 单个文件的字节上限,超过则抛错。默认 64MB。 */\n\tmaxBytes?: number;\n}\n\n/** 用户在文件对话框里选中的一个文件,内容随选择一起回传。 */\nexport interface PluginOfficialOpenedFile {\n\tpath: string;\n\tname: string;\n\t/** base64 编码的文件内容。 */\n\tdata: string;\n}\n\nexport interface PluginOfficialKnowledgeBase {\n\tid: string;\n\tname: string;\n\tupdatedAt: number;\n\tisDefault: boolean;\n\tnodes: unknown[];\n}\n\nexport interface PluginOfficialKnowledgeProcessingSettings {\n\tenabled?: boolean;\n\tpollIntervalMinutes?: number;\n\tprocessingModelKey?: string;\n\tprocessingModelReasoningLevel?: string;\n\tagentConcurrency?: number;\n\tocrConcurrency?: number;\n}\n\n/** 由 `official.sessions.create` 新建的后台会话句柄。 */\nexport interface PluginOfficialSessionHandle {\n\t/** 进程内 runtime id,用于 prompt / abort / subscribe。重启后失效。 */\n\tsessionId: string;\n\t/** 会话文件绝对路径,跨重启稳定,用于持久化与跳转。 */\n\tsessionPath: string;\n\t/** 实际运行目录(「对话」项目会落到 per-session 子目录,见 ADR-0007)。 */\n\tcwd?: string;\n}\n\n/** 会话运行态变化广播(按 sessionPath 标识,跨重启稳定)。 */\nexport interface PluginOfficialSessionRunningEvent {\n\tsessionPath: string;\n\trunning: boolean;\n\tsessionId?: string;\n}\n\n/**\n * 会话文件此刻允许做什么。\n *\n * 同一份会话文件可能正被另一个运行时占用、或已不可读,宿主自己点会话时就是按这几\n * 位分流的(可续聊 / 只读查看 / 完全打不开)。插件在跳转前必须先看它,否则会把用户\n * 送进一个打不开的会话,且失败发生在导航之后、很难解释。\n */\nexport interface PluginOfficialSessionAccess {\n\t/** 能否读取历史。为 false 时连只读查看都不行。 */\n\treadHistory: boolean;\n\t/** 能否在对话页续聊。 */\n\tinteractiveResume: boolean;\n\trename: boolean;\n\tdelete: boolean;\n}\n\n/** 会话历史条目(`official.sessions.list` 返回),按 `modifiedAt` 倒序。 */\nexport interface PluginOfficialSessionSummary {\n\tpath: string;\n\tcwd?: string;\n\tfirstMessage?: string;\n\tmodifiedAt?: number;\n\taccess: PluginOfficialSessionAccess;\n}\n\n/**\n * 导航目标。多数目标只要 `target`;`target: \"new-session\"` 这类带参数的目标另需\n * `cwd`(项目绝对路径),缺了会被宿主拒绝而不是跳到一个空页面。\n */\nexport interface PluginOfficialNavigationOpenInput {\n\ttarget: string;\n\ttab?: string;\n\tsection?: string;\n\t/** 仅 `target: \"new-session\"` 使用:要新建会话的项目目录。 */\n\tcwd?: string;\n\t/**\n\t * 仅 `target: \"new-session\"` 使用:预置到输入框的草稿文本,不发送,用户可继续编辑。\n\t *\n\t * 用输入框的文本形态书写行内 token(`@skill:名字` / `@mcp:名字` / `@/abs/path`),\n\t * 宿主会把它们渲染成对应的 badge。在导航发生**之前**写入该 cwd 的新会话草稿位,\n\t * 所以不会被新会话页自己的草稿恢复覆盖;该 cwd 上已有的未发送草稿会被替换。\n\t */\n\tdraft?: string;\n}\n\n/** 仅宿主验证为官方来源的插件可以调用;普通插件调用时由宿主拒绝。 */\nexport interface PluginOfficialApi {\n\tgeneral: {\n\t\tgetSettings(): Promise<PluginOfficialGeneralSettings>;\n\t\tsetSettings(input: PluginOfficialGeneralSettingsUpdate): Promise<PluginOfficialGeneralSettingsUpdate>;\n\t};\n\tagent: {\n\t\tgetExperimental(): Promise<PluginOfficialExperimentalSettings>;\n\t\tsetExperimental(input: Partial<PluginOfficialExperimentalSettings>): Promise<PluginOfficialExperimentalSettings>;\n\t\tgetImageGeneration(): Promise<PluginOfficialImageGenerationSettings>;\n\t\tsetImageGeneration(\n\t\t\tinput: PluginOfficialImageGenerationSettingsUpdate,\n\t\t): Promise<PluginOfficialImageGenerationSettings>;\n\t};\n\tdownloads: {\n\t\tlist(): Promise<PluginOfficialDownloadItem[]>;\n\t\tcancel(id: string): Promise<void>;\n\t};\n\tupdater: {\n\t\tgetState(): Promise<PluginOfficialUpdaterState>;\n\t\tgetCurrentVersion(): Promise<string>;\n\t\tcheck(): Promise<PluginOfficialUpdaterState>;\n\t\tdownload(): Promise<PluginOfficialUpdaterState>;\n\t\tinstall(): Promise<void>;\n\t\tdismiss(): Promise<void>;\n\t\tcancel(): Promise<void>;\n\t};\n\twebhook: {\n\t\tlist(): Promise<PluginOfficialWebhookEndpoint[]>;\n\t\tlistProviders(): Promise<PluginOfficialWebhookProvider[]>;\n\t\tcreate(input: PluginOfficialWebhookCreateInput): Promise<PluginOfficialWebhookEndpoint>;\n\t\tupdate(id: string, input: PluginOfficialWebhookUpdateInput): Promise<PluginOfficialWebhookEndpoint>;\n\t\tsetEnabled(id: string, enabled: boolean): Promise<PluginOfficialWebhookEndpoint>;\n\t\tdelete(id: string): Promise<void>;\n\t\ttest(id: string): Promise<PluginOfficialWebhookSendResult>;\n\t\tsend(id: string, message: PluginOfficialWebhookMessage): Promise<PluginOfficialWebhookSendResult>;\n\t};\n\tskills: {\n\t\tlist(cwd?: string): Promise<PluginOfficialSkillInfo[]>;\n\t\tgetManifest(): Promise<Record<string, PluginOfficialInstalledSkill>>;\n\t\tsetEnabled(name: string, enabled: boolean): Promise<{ name: string; enabled: boolean }>;\n\t\tuninstall(name: string, type?: \"skill\"): Promise<void>;\n\t\t/**\n\t\t * 从能力市场按 slug 安装 skill(产品文案:能力)。\n\t\t * 下载在主进程完成;密钥类凭证不经过此 API。\n\t\t */\n\t\tinstallFromMarket(\n\t\t\ttype: \"skill\",\n\t\t\tslug: string,\n\t\t): Promise<{ name: string; type: \"skill\"; version: string; updated: boolean }>;\n\t};\n\tshortcuts: {\n\t\tlistAvailableActions(): Array<{ id: string; defaultShortcut: string }>;\n\t\tget(): Promise<{ bindings: PluginOfficialShortcutBinding[]; quickPanel: PluginOfficialQuickPanelSettings }>;\n\t\tsetBinding(id: string, shortcut: string): Promise<{ bindings: PluginOfficialShortcutBinding[] }>;\n\t\tresetBinding(id: string): Promise<{ bindings: PluginOfficialShortcutBinding[]; shortcut: string }>;\n\t\tresetAllBindings(): Promise<{ bindings: PluginOfficialShortcutBinding[] }>;\n\t\tsetQuickPanelTrigger(trigger: PluginOfficialQuickPanelSettings[\"trigger\"]): Promise<PluginOfficialQuickPanelSettings>;\n\t\tsetQuickPanelBehavior(\n\t\t\tbehavior: PluginOfficialQuickPanelSettings[\"postSendBehavior\"],\n\t\t): Promise<PluginOfficialQuickPanelSettings>;\n\t};\n\tim: {\n\t\tgetStatus(): Promise<PluginOfficialImStatus>;\n\t\tgetLogs(limit?: number): Promise<PluginOfficialImLog[]>;\n\t\tsetEnabled(enabled: boolean): Promise<{ status: unknown }>;\n\t\trestart(): Promise<{ status: unknown }>;\n\t\tsetAgentModel(\n\t\t\tmodelKey: string | null,\n\t\t\treasoningLevel?: string,\n\t\t): Promise<{ status: unknown }>;\n\t\tassertModelKeyExists(modelKey: string): Promise<void>;\n\t\t/**\n\t\t * 写入飞书凭证。Agent 应省略 appSecret 等密钥,由审批弹窗让用户手填。\n\t\t * 空字符串密钥字段表示保持现有值不改。\n\t\t */\n\t\tsetFeishuConfig(input: {\n\t\t\tenabled?: boolean;\n\t\t\tappId?: string;\n\t\t\tappSecret?: string;\n\t\t\tverificationToken?: string;\n\t\t\tencryptKey?: string;\n\t\t\tbaseUrl?: string;\n\t\t}): Promise<{ ok: boolean; error?: string }>;\n\t};\n\tmcp: {\n\t\tlist(target?: PluginOfficialMcpTarget): Promise<PluginOfficialMcpServerSummary[]>;\n\t\tget(name: string, target?: PluginOfficialMcpTarget): Promise<PluginOfficialMcpServerDetail>;\n\t\tlistNames(target?: PluginOfficialMcpTarget): Promise<string[]>;\n\t\tupsert(\n\t\t\tname: string,\n\t\t\tdata: PluginOfficialMcpUpsertData,\n\t\t\ttarget?: PluginOfficialMcpTarget,\n\t\t): Promise<PluginOfficialMcpServerDetail>;\n\t\tsetEnabled(name: string, enabled: boolean, target?: PluginOfficialMcpTarget): Promise<void>;\n\t\tremove(name: string, target?: PluginOfficialMcpTarget): Promise<void>;\n\t};\n\tmodels: {\n\t\t/**\n\t\t * 用户当前可选的全部模型:本地配置的 provider **加上**登录后服务端下发的远程目录\n\t\t * (Vetta Go 等,`remote: true`)。同一个 `provider/modelId` 以本地为准。\n\t\t * 与宿主输入栏模型选择器同一口径。\n\t\t */\n\t\tlist(): Promise<{ defaultModel: string | null; providers: PluginOfficialProviderSummary[] }>;\n\t\tget(provider?: string): Promise<unknown>;\n\t\tprobe(provider: string, model: string): Promise<{ ok: boolean; message?: string; error?: string }>;\n\t\tlistProviderIds(): Promise<string[]>;\n\t\tassertModelKeyExists(modelKey: string, operation?: string): Promise<void>;\n\t\tsetDefault(modelKey: string): Promise<{ defaultModel: string }>;\n\t\tupsertProvider(provider: string, data: PluginOfficialProviderUpsertData): Promise<PluginOfficialProviderDetail>;\n\t\t/** Removes the provider when present. Repeated removal is an idempotent no-op. */\n\t\tremoveProvider(provider: string): Promise<void>;\n\t};\n\tprojects: {\n\t\tlist(): Promise<{\n\t\t\tworkspacePath: string;\n\t\t\tprojects: PluginOfficialProjectEntry[];\n\t\t\tarchivedProjects: PluginOfficialProjectEntry[];\n\t\t}>;\n\t\tlistSessions(cwd: string): Promise<unknown[]>;\n\t\tlistRuntimeProjects(): Promise<unknown[]>;\n\t\tcreate(name: string, path?: string): Promise<PluginOfficialProjectEntry>;\n\t\topen(path: string, name?: string): Promise<PluginOfficialProjectEntry>;\n\t\trename(path: string, name: string): Promise<PluginOfficialProjectEntry>;\n\t\tarchive(path: string): Promise<void>;\n\t\tunarchive(path: string): Promise<void>;\n\t\tremove(path: string): Promise<void>;\n\t};\n\tplugins: {\n\t\tlist(): Promise<PluginOfficialPluginSummary[]>;\n\t\tget(id: string): Promise<PluginOfficialPluginSummary>;\n\t\tsetEnabled(id: string, enabled: boolean): Promise<PluginOfficialPluginSummary>;\n\t\tinstallFromUrl(\n\t\t\turl: string,\n\t\t\toptions?: { initiator?: \"plugin-cli\" },\n\t\t): Promise<PluginOfficialPluginSummary>;\n\t\tinstallFromPath(\n\t\t\tpath: string,\n\t\t\toptions?: {\n\t\t\t\tinitiator?: \"plugin-cli\" | \"plugin-workbench\";\n\t\t\t\tgrantedPermissions?: string[];\n\t\t\t\tenable?: boolean;\n\t\t\t\tsource?: \"archive\" | \"npm\";\n\t\t\t\texpectedSha256?: string;\n\t\t\t\texpectedId?: string;\n\t\t\t\texpectedVersion?: string;\n\t\t\t\tnpm?: {\n\t\t\t\t\tpackageName: string;\n\t\t\t\t\trequestedSpec: string;\n\t\t\t\t\tresolvedVersion: string;\n\t\t\t\t\tintegrity?: string;\n\t\t\t\t};\n\t\t\t},\n\t\t): Promise<PluginOfficialPluginSummary>;\n\t\tuninstall(id: string): Promise<void>;\n\t\treload(id: string): Promise<PluginOfficialPluginSummary>;\n\t\tgrantPermissions(id: string, permissions: PluginPermission[]): Promise<PluginOfficialPluginSummary>;\n\t\tstartDevWatch(id: string, projectDir: string): Promise<PluginOfficialPluginSummary>;\n\t\tstopDevWatch(id: string): Promise<void>;\n\t\tonChanged(handler: (event?: PluginOfficialPluginChangedEvent) => void): () => void;\n\t};\n\tdialog: {\n\t\tsaveCopy(sourcePath: string, options?: PluginOfficialSaveCopyOptions): Promise<string | null>;\n\t\t/**\n\t\t * 打开原生文件选择框,并把选中文件的**内容**一起返回。\n\t\t *\n\t\t * 插件的 `ctx.fs` 只能读已授权的项目根,因此「选个文件再自己去读」这条路走不通;\n\t\t * 这个接口不放宽任何目录授权,插件能看到的只有用户这次亲手选中的文件。\n\t\t * 用户取消时返回空数组。\n\t\t */\n\t\topenFiles(options?: PluginOfficialOpenFilesOptions): Promise<PluginOfficialOpenedFile[]>;\n\t};\n\tshell: {\n\t\t/**\n\t\t * 在系统文件管理器里定位并选中这个路径。\n\t\t *\n\t\t * 与 `ui.openExternal` 分工:那个只放行 http/https,用来把链接交给浏览器;\n\t\t * 这个只做「显示这个本地路径」,不能用来拉起任意协议。\n\t\t */\n\t\tshowItemInFolder(path: string): Promise<void>;\n\t};\n\tknowledge: {\n\t\tlist(): Promise<PluginOfficialKnowledgeBase[]>;\n\t\tfileStatuses(): Promise<Record<string, unknown>>;\n\t\tisProcessing(): Promise<boolean>;\n\t\tgetProcessing(): Promise<PluginOfficialKnowledgeProcessingSettings>;\n\t\tcreate(name: string): Promise<void>;\n\t\trename(name: string, newName: string): Promise<void>;\n\t\tdelete(name: string): Promise<void>;\n\t\taddFiles(kbId: string, paths: string[], move?: boolean): Promise<void>;\n\t\tdeleteEntry(kbId: string, relPath: string): Promise<void>;\n\t\tscanNow(): Promise<{ skipped: boolean; reason?: string }>;\n\t\tretryFailed(): Promise<{ skipped: boolean; reason?: string }>;\n\t\tsetProcessing(\n\t\t\tdata: Partial<{\n\t\t\t\tenabled: boolean;\n\t\t\t\tpollIntervalMinutes: 3 | 5 | 10 | 30;\n\t\t\t\tprocessingModelKey: string | null;\n\t\t\t\tprocessingModelReasoningLevel: string | null;\n\t\t\t\tagentConcurrency: number;\n\t\t\t\tocrConcurrency: number;\n\t\t\t}>,\n\t\t): Promise<PluginOfficialKnowledgeProcessingSettings>;\n\t};\n\tbatchTasks: {\n\t\tlistProjects(): Promise<unknown[]>;\n\t\tgetProject(projectId: string): Promise<unknown>;\n\t\tlistProjectIds(): Promise<string[]>;\n\t\tcreateProject(data: PluginOfficialBatchProjectCreateData): Promise<unknown>;\n\t\tupdateProject(projectId: string, data: PluginOfficialBatchProjectUpdateData): Promise<unknown>;\n\t\tdeleteProject(projectId: string): Promise<unknown>;\n\t\trunTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tretryTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tstopTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tdeleteTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tresumeTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tresumeTaskWithText(projectId: string, taskId: string, text: string): Promise<unknown>;\n\t\tdeleteTaskSession(projectId: string, taskId: string): Promise<unknown>;\n\t\tbatchDelete(projectId: string): Promise<unknown>;\n\t\tbatchStart(projectId: string): Promise<unknown>;\n\t\tbatchStop(projectId: string): Promise<unknown>;\n\t\tbatchReset(projectId: string): Promise<unknown>;\n\t\tbatchResetFailed(projectId: string, taskIds: string[]): Promise<unknown>;\n\t};\n\tscheduler: {\n\t\tlistTasks(): Promise<unknown[]>;\n\t\tgetTask(taskId: string): Promise<unknown>;\n\t\tlistTaskIds(): Promise<string[]>;\n\t\tgetHistory(taskId: string): Promise<unknown[]>;\n\t\tcreateTask(data: PluginOfficialSchedulerTaskCreateData): Promise<unknown>;\n\t\tupdateTask(taskId: string, data: PluginOfficialSchedulerTaskUpdateData): Promise<unknown>;\n\t\tdeleteTask(taskId: string): Promise<unknown>;\n\t\tsetEnabled(taskId: string, enabled: boolean): Promise<unknown>;\n\t\trunNow(taskId: string): Promise<unknown>;\n\t\tabort(taskId: string): Promise<unknown>;\n\t};\n\tappearance: {\n\t\thelp(): Promise<unknown>;\n\t\tget(): Promise<unknown>;\n\t\tset(input: {\n\t\t\tmode?: \"light\" | \"dark\" | \"auto\";\n\t\t\tthemeId?: string;\n\t\t}): Promise<unknown>;\n\t\tsetLanguage(language: \"zh\" | \"en\"): Promise<unknown>;\n\t\tlistThemeIds(): string[];\n\t};\n\t/**\n\t * 后台会话编排。会话本体跑在主进程,创建后即使宿主停留在别的页面也会继续执行,\n\t * 因此系统插件可以据此做「多任务并发派单」类工作台(如看板)。\n\t */\n\tsessions: {\n\t\t/**\n\t\t * 在 `cwd` 下新建一个会话;不发送任何 prompt。\n\t\t *\n\t\t * 传 `modelKey`(`provider/modelId`)时写入该会话的模型设置,后续无论是插件\n\t\t * 继续 `prompt`、还是用户在对话页手动接着聊,都用这个模型;不传则跟随宿主全局默认。\n\t\t */\n\t\tcreate(input: { cwd: string; title?: string; modelKey?: string }): Promise<PluginOfficialSessionHandle>;\n\t\t/**\n\t\t * 向会话发起一轮对话。streaming 中会进入该会话的输入队列(ADR-0060)。\n\t\t *\n\t\t * `options.modelKey` 只钉住**这一轮**用哪个模型(不改会话设置);要让整个会话\n\t\t * 都用某个模型,在 `create` 时传 `modelKey`。\n\t\t */\n\t\tprompt(\n\t\t\tsessionId: string,\n\t\t\ttext: string,\n\t\t\toptions?: { modelKey?: string },\n\t\t): Promise<{ status: \"sent\" | \"queued\" | \"failed\"; error?: { message: string } }>;\n\t\t/** 中止会话当前回合。 */\n\t\tabort(sessionId: string): Promise<void>;\n\t\t/** 重命名会话(写入会话文件标题),用于把看板卡片标题同步到会话列表。 */\n\t\trename(sessionPath: string, name: string): Promise<void>;\n\t\t/** 列出某目录下的历史会话。 */\n\t\tlist(cwd: string): Promise<PluginOfficialSessionSummary[]>;\n\t\t/** 当前处于 agent loop 中的会话文件路径快照。 */\n\t\tlistRunning(): Promise<string[]>;\n\t\t/**\n\t\t * 当前有会话在跑的项目 cwd(去重)。\n\t\t *\n\t\t * 需要「这个项目忙不忙」时用它,不要拿 `listRunning()` 的路径去比对 cwd:会话文件\n\t\t * 默认落在按 cwd 编码的分片目录里,那个编码不可逆且会让不同项目撞进同一分片。\n\t\t */\n\t\tlistRunningCwds(): Promise<string[]>;\n\t\t/** 订阅运行态翻转;返回取消订阅函数。 */\n\t\tonRunningChanged(handler: (event: PluginOfficialSessionRunningEvent) => void): () => void;\n\t\t/** 把宿主导航到该会话的对话页。 */\n\t\topen(input: { cwd: string; sessionPath: string }): Promise<void>;\n\t};\n\tnavigation: {\n\t\thelp(): unknown;\n\t\tresolveOpen(input: PluginOfficialNavigationOpenInput): {\n\t\t\thashPath: string;\n\t\t\tresolved: unknown;\n\t\t};\n\t\topen(input: PluginOfficialNavigationOpenInput): Promise<unknown>;\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"official.js","sourceRoot":"","sources":["../src/official.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginOfficialGeneralSettings {\n\tworkspacePath: string;\n\tdefaultExecutionMode?: \"sandbox\" | \"full-access\";\n\tnotificationsEnabled: boolean;\n\tdebugMode: boolean;\n\tsandbox: unknown;\n}\n\nexport type PluginOfficialGeneralSettingsUpdate =\n\t| { operation: \"set-notifications\"; enabled: boolean }\n\t| { operation: \"set-execution-mode\"; mode: \"sandbox\" | \"full-access\" }\n\t| { operation: \"set-workspace\"; path: string };\n\nexport interface PluginOfficialExperimentalSettings {\n\tvettaCli: boolean;\n\tpromptPrediction: boolean;\n\tagentSkills: boolean;\n}\n\nexport interface PluginOfficialImageGenerationSettings {\n\ttextToImageProviderId?: string;\n\ttextToImageModelId?: string;\n\timageToImageProviderId?: string;\n\timageToImageModelId?: string;\n}\n\nexport type PluginOfficialImageGenerationSettingsUpdate = {\n\ttextToImageProviderId?: string | null;\n\ttextToImageModelId?: string | null;\n\timageToImageProviderId?: string | null;\n\timageToImageModelId?: string | null;\n};\n\nexport interface PluginOfficialDownloadItem {\n\tid: string;\n\turl: string;\n\tfilename: string;\n\tpath: string;\n\ttotalBytes: number;\n\treceivedBytes: number;\n\tstatus: \"queued\" | \"downloading\" | \"paused\" | \"completed\" | \"failed\" | \"canceled\";\n\terror?: string;\n\tcreatedAt: number;\n\tcompletedAt?: number;\n\tspeedBytesPerSec?: number;\n}\n\nexport interface PluginOfficialUpdaterState {\n\tphase: \"idle\" | \"checking\" | \"available\" | \"downloading\" | \"ready\" | \"installing\" | \"error\";\n\tcurrentVersion: string;\n\tlatestVersion?: string;\n\treleaseNote?: string;\n\tprogress?: number;\n\tdownloadedBytes?: number;\n\ttotalBytes?: number;\n\tassetFileName?: string;\n\terror?: string;\n}\n\nexport type PluginOfficialWebhookKind = \"feishu\" | \"dingtalk\";\n\nexport interface PluginOfficialWebhookEndpoint {\n\tid: string;\n\tkind: PluginOfficialWebhookKind;\n\tname: string;\n\tenabled: boolean;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\turlMask?: string;\n\thasSignSecret?: boolean;\n}\n\nexport interface PluginOfficialWebhookProvider {\n\tkind: PluginOfficialWebhookKind;\n\tdisplayName: string;\n\ticonClass?: string;\n}\n\nexport interface PluginOfficialWebhookCreateInput {\n\tkind: PluginOfficialWebhookKind;\n\tname: string;\n\twebhookUrl: string;\n\tsignSecret?: string;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialWebhookUpdateInput {\n\tname?: string;\n\tenabled?: boolean;\n\twebhookUrl?: string;\n\tsignSecret?: string;\n}\n\nexport interface PluginOfficialWebhookMessage {\n\ttitle?: string;\n\ttext: string;\n\tlevel?: \"info\" | \"warn\" | \"error\" | \"success\";\n}\n\nexport interface PluginOfficialWebhookSendResult {\n\tok: boolean;\n\terror?: string;\n}\n\nexport interface PluginOfficialSkillInfo {\n\tname: string;\n\talias?: string;\n\tdescription: string;\n\tsource: string;\n\ttype: \"skill\";\n}\n\nexport type PluginOfficialInstalledSkill = {\n\tname: string;\n\tversion: string;\n\tinstalledAt: string;\n\tsource: \"market\" | \"custom\";\n\tenabled: boolean;\n\ttype?: \"skill\";\n\talias?: string;\n\tmarketDescription?: string;\n\tdescription?: string;\n};\n\nexport interface PluginOfficialShortcutBinding {\n\tid: string;\n\tdefaultShortcut: string;\n\tshortcut: string;\n\tisDefault: boolean;\n}\n\nexport interface PluginOfficialImStatus {\n\tenabled: boolean;\n\ttransport: string;\n\tagentModel: { provider: string; model: string; reasoningLevel?: string } | null;\n\twechatBound: boolean;\n\tfeishuAppId: string | null;\n\truntime: unknown;\n}\n\nexport interface PluginOfficialImLog {\n\tlevel: string;\n\tmsg: string;\n\ttime: string;\n\tfields?: Record<string, unknown>;\n}\n\n/**\n * MCP 配置落点。省略时只操作全局 `~/.vetta/agent/mcp.json`;\n * `scope: \"project\"` 必须同时给出项目根 `cwd`,读写 `<cwd>/.vetta/mcp.json`。\n * 只给 `cwd` 时读操作会把项目一并纳入,写操作仍默认全局。\n */\nexport interface PluginOfficialMcpTarget {\n\tscope?: \"global\" | \"project\";\n\tcwd?: string;\n}\n\nexport interface PluginOfficialMcpServerSummary {\n\tname: string;\n\ttype: \"http\" | \"sse\" | \"stdio\";\n\tdisabled: boolean;\n\tcommand?: string;\n\turl?: string;\n\t/** 仅在传了 `scope` 或 `cwd` 时返回。 */\n\tscope?: \"global\" | \"project\";\n\t/** 来自项目根 `.mcp.json`:Vetta 只读取,不会改写。 */\n\treadOnly?: boolean;\n}\n\nexport interface PluginOfficialMcpServerDetail {\n\tname: string;\n\ttype?: \"http\" | \"sse\" | \"stdio\";\n\tcommand?: string;\n\targs?: string[];\n\tenv?: Record<string, string>;\n\tcwd?: string;\n\turl?: string;\n\theaders?: Record<string, string>;\n\tdisabled?: boolean;\n\tautoApprove?: string[];\n\tstartupTimeout?: number;\n\tdebug?: boolean;\n\tscope?: \"global\" | \"project\";\n\treadOnly?: boolean;\n}\n\nexport type PluginOfficialMcpUpsertData =\n\t| {\n\t\t\ttype?: \"stdio\";\n\t\t\tcommand?: string;\n\t\t\targs?: string[];\n\t\t\tenv?: Record<string, string>;\n\t\t\tcwd?: string;\n\t\t\tdisabled?: boolean;\n\t\t\tautoApprove?: string[];\n\t\t\tstartupTimeout?: number;\n\t\t\tdebug?: boolean;\n\t }\n\t| {\n\t\t\t/** `sse` 是旧式 HTTP+SSE 传输,仅为兼容仍在使用它的服务器。 */\n\t\t\ttype: \"http\" | \"sse\";\n\t\t\turl?: string;\n\t\t\theaders?: Record<string, string>;\n\t\t\tdisabled?: boolean;\n\t\t\tautoApprove?: string[];\n\t\t\tstartupTimeout?: number;\n\t\t\tdebug?: boolean;\n\t };\n\nexport type PluginOfficialExecutionMode = \"inherit\" | \"sandbox\" | \"full-access\";\n\nexport interface PluginOfficialSelectedSkill {\n\tname: string;\n\talias?: string;\n\ttype: \"skill\";\n}\n\nexport interface PluginOfficialBatchProjectCreateData {\n\tname: string;\n\tprompt: string;\n\tmodelKey?: string;\n\tfolders: string[];\n\tconcurrency: number;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tartifactPatterns?: string[];\n\tnotifyEnabled?: boolean;\n\ttimeoutMinutes?: number;\n\tskill?: PluginOfficialSelectedSkill;\n}\n\nexport interface PluginOfficialBatchProjectUpdateData {\n\tname?: string;\n\tprompt?: string;\n\tmodelKey?: string;\n\tconcurrency?: number;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tartifactPatterns?: string[];\n\tnotifyEnabled?: boolean;\n\ttimeoutMinutes?: number;\n\tnewFolders?: string[];\n\tskill?: PluginOfficialSelectedSkill | null;\n}\n\n/** 「重复」:精确到分钟,按本机时区;星期 0 = 周日;interval 为固定间隔;custom 为 5 段 cron。 */\nexport type PluginOfficialSchedulerSchedule =\n\t| { kind: \"once\"; at: number }\n\t| { kind: \"hourly\"; minute: number }\n\t| { kind: \"daily\"; hour: number; minute: number }\n\t| { kind: \"weekly\"; weekdays: number[]; hour: number; minute: number }\n\t| { kind: \"monthly\"; days: Array<number | \"last\">; hour: number; minute: number }\n\t/** 从 startAt(毫秒时间戳)起每 everyMinutes 分钟一次,1–10080。 */\n\t| { kind: \"interval\"; everyMinutes: number; startAt: number }\n\t| { kind: \"custom\"; cron: string };\n\n/**\n * 运行会话策略:projectCwd 为会话所属项目的路径,省略即落在默认「对话」里。\n * same-session 的 sessionPath 为 null 表示首次执行时新建一个会话,之后一直复用。\n */\nexport type PluginOfficialSchedulerRunTarget =\n\t| { mode: \"new-session\"; projectCwd?: string }\n\t| { mode: \"same-session\"; projectCwd?: string; sessionPath: string | null };\n\n/** 省略即「跟随默认模型」。 */\nexport interface PluginOfficialSchedulerModel {\n\tkey: string;\n\treasoning?: string;\n}\n\nexport interface PluginOfficialSchedulerNotification {\n\twebhookIds: string[];\n\twhen: \"always\" | \"success\" | \"failure\";\n\t/** 支持 {{name}} {{status}} {{startedAt}} {{duration}} {{reply}} {{error}}。 */\n\ttemplate: string;\n}\n\nexport interface PluginOfficialSchedulerTaskCreateData {\n\tname: string;\n\tprompt: string;\n\tschedule: PluginOfficialSchedulerSchedule;\n\trunTarget: PluginOfficialSchedulerRunTarget;\n\tmodel?: PluginOfficialSchedulerModel;\n\tnotification?: PluginOfficialSchedulerNotification;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialSchedulerTaskUpdateData {\n\tname?: string;\n\tprompt?: string;\n\tschedule?: PluginOfficialSchedulerSchedule;\n\trunTarget?: PluginOfficialSchedulerRunTarget;\n\tmodel?: PluginOfficialSchedulerModel | null;\n\tnotification?: PluginOfficialSchedulerNotification | null;\n\tenabled?: boolean;\n}\n\nexport interface PluginOfficialModelSummary {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n}\n\nexport interface PluginOfficialProviderSummary {\n\tid: string;\n\tdisplayName: string;\n\tbaseUrl?: string;\n\tapi?: string;\n\thasApiKey: boolean;\n\t/** 图标 symbol;配合 `ProviderIcon` 解析为内置图标,无则不画图标。 */\n\ticon?: string;\n\t/**\n\t * true = 来自登录后服务端下发的远程目录(如 Vetta Go),凭据是账号登录态而非本地\n\t * API Key,因此不会出现在本地模型配置里,也不可用 `upsertProvider` / `removeProvider` 改。\n\t */\n\tremote?: boolean;\n\tmodelCount: number;\n\tmodels: PluginOfficialModelSummary[];\n}\n\nexport interface PluginOfficialProviderDetail {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: Array<{\n\t\tid: string;\n\t\tname?: string;\n\t\tapi?: string;\n\t\treasoning?: boolean;\n\t\tcontextWindow?: number;\n\t\tmaxTokens?: number;\n\t}>;\n}\n\nexport interface PluginOfficialProviderUpsertData {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: Array<{\n\t\tid: string;\n\t\tname?: string;\n\t\tapi?: string;\n\t\treasoning?: boolean;\n\t\tcontextWindow?: number;\n\t\tmaxTokens?: number;\n\t}>;\n}\n\nexport interface PluginOfficialProjectEntry {\n\tpath: string;\n\tname?: string;\n}\n\nexport interface PluginOfficialPluginSummary {\n\tid: string;\n\tname: string;\n\tversion: string;\n\tactiveVersion: string;\n\tpendingVersion?: string;\n\tenabled: boolean;\n\trequired: boolean;\n\tsource: string;\n\tpermissions: string[];\n\tdescription?: string;\n\trootPath?: string;\n\tdevWatch?: unknown;\n}\n\nexport interface PluginOfficialPluginChangedEvent {\n\treason?: string;\n\tpluginId?: string;\n}\n\nexport interface PluginOfficialSaveCopyOptions {\n\tdefaultFileName?: string;\n\ttitle?: string;\n\tfilters?: Array<{ name: string; extensions: string[] }>;\n}\n\n/** `official.dialog.openFiles` 的选项。 */\nexport interface PluginOfficialOpenFilesOptions {\n\ttitle?: string;\n\tfilters?: Array<{ name: string; extensions: string[] }>;\n\t/** 允许多选,默认单选。 */\n\tmultiple?: boolean;\n\t/** 单个文件的字节上限,超过则抛错。默认 64MB。 */\n\tmaxBytes?: number;\n}\n\n/** 用户在文件对话框里选中的一个文件,内容随选择一起回传。 */\nexport interface PluginOfficialOpenedFile {\n\tpath: string;\n\tname: string;\n\t/** base64 编码的文件内容。 */\n\tdata: string;\n}\n\nexport interface PluginOfficialKnowledgeBase {\n\tid: string;\n\tname: string;\n\tupdatedAt: number;\n\tisDefault: boolean;\n\tnodes: unknown[];\n}\n\nexport interface PluginOfficialKnowledgeProcessingSettings {\n\tenabled?: boolean;\n\tpollIntervalMinutes?: number;\n\tprocessingModelKey?: string;\n\tprocessingModelReasoningLevel?: string;\n\tagentConcurrency?: number;\n\tocrConcurrency?: number;\n}\n\n/** 由 `official.sessions.create` 新建的后台会话句柄。 */\nexport interface PluginOfficialSessionHandle {\n\t/** 进程内 runtime id,用于 prompt / abort / subscribe。重启后失效。 */\n\tsessionId: string;\n\t/** 会话文件绝对路径,跨重启稳定,用于持久化与跳转。 */\n\tsessionPath: string;\n\t/** 实际运行目录(「对话」项目会落到 per-session 子目录,见 ADR-0007)。 */\n\tcwd?: string;\n}\n\n/** 会话运行态变化广播(按 sessionPath 标识,跨重启稳定)。 */\nexport interface PluginOfficialSessionRunningEvent {\n\tsessionPath: string;\n\trunning: boolean;\n\tsessionId?: string;\n}\n\n/**\n * 会话文件此刻允许做什么。\n *\n * 同一份会话文件可能正被另一个运行时占用、或已不可读,宿主自己点会话时就是按这几\n * 位分流的(可续聊 / 只读查看 / 完全打不开)。插件在跳转前必须先看它,否则会把用户\n * 送进一个打不开的会话,且失败发生在导航之后、很难解释。\n */\nexport interface PluginOfficialSessionAccess {\n\t/** 能否读取历史。为 false 时连只读查看都不行。 */\n\treadHistory: boolean;\n\t/** 能否在对话页续聊。 */\n\tinteractiveResume: boolean;\n\trename: boolean;\n\tdelete: boolean;\n}\n\n/** 会话历史条目(`official.sessions.list` 返回),按 `modifiedAt` 倒序。 */\nexport interface PluginOfficialSessionSummary {\n\tpath: string;\n\tcwd?: string;\n\tfirstMessage?: string;\n\tmodifiedAt?: number;\n\taccess: PluginOfficialSessionAccess;\n}\n\n/**\n * 导航目标。多数目标只要 `target`;`target: \"new-session\"` 这类带参数的目标另需\n * `cwd`(项目绝对路径),缺了会被宿主拒绝而不是跳到一个空页面。\n */\nexport interface PluginOfficialNavigationOpenInput {\n\ttarget: string;\n\ttab?: string;\n\tsection?: string;\n\t/** 仅 `target: \"new-session\"` 使用:要新建会话的项目目录。 */\n\tcwd?: string;\n\t/**\n\t * 仅 `target: \"new-session\"` 使用:预置到输入框的草稿文本,不发送,用户可继续编辑。\n\t *\n\t * 用输入框的文本形态书写行内 token(`@skill:名字` / `@mcp:名字` / `@/abs/path`),\n\t * 宿主会把它们渲染成对应的 badge。在导航发生**之前**写入该 cwd 的新会话草稿位,\n\t * 所以不会被新会话页自己的草稿恢复覆盖;该 cwd 上已有的未发送草稿会被替换。\n\t */\n\tdraft?: string;\n}\n\n/** 仅宿主验证为官方来源的插件可以调用;普通插件调用时由宿主拒绝。 */\nexport interface PluginOfficialApi {\n\tgeneral: {\n\t\tgetSettings(): Promise<PluginOfficialGeneralSettings>;\n\t\tsetSettings(input: PluginOfficialGeneralSettingsUpdate): Promise<PluginOfficialGeneralSettingsUpdate>;\n\t};\n\tagent: {\n\t\tgetExperimental(): Promise<PluginOfficialExperimentalSettings>;\n\t\tsetExperimental(input: Partial<PluginOfficialExperimentalSettings>): Promise<PluginOfficialExperimentalSettings>;\n\t\tgetImageGeneration(): Promise<PluginOfficialImageGenerationSettings>;\n\t\tsetImageGeneration(\n\t\t\tinput: PluginOfficialImageGenerationSettingsUpdate,\n\t\t): Promise<PluginOfficialImageGenerationSettings>;\n\t};\n\tdownloads: {\n\t\tlist(): Promise<PluginOfficialDownloadItem[]>;\n\t\tcancel(id: string): Promise<void>;\n\t};\n\tupdater: {\n\t\tgetState(): Promise<PluginOfficialUpdaterState>;\n\t\tgetCurrentVersion(): Promise<string>;\n\t\tcheck(): Promise<PluginOfficialUpdaterState>;\n\t\tdownload(): Promise<PluginOfficialUpdaterState>;\n\t\tinstall(): Promise<void>;\n\t\tdismiss(): Promise<void>;\n\t\tcancel(): Promise<void>;\n\t};\n\twebhook: {\n\t\tlist(): Promise<PluginOfficialWebhookEndpoint[]>;\n\t\tlistProviders(): Promise<PluginOfficialWebhookProvider[]>;\n\t\tcreate(input: PluginOfficialWebhookCreateInput): Promise<PluginOfficialWebhookEndpoint>;\n\t\tupdate(id: string, input: PluginOfficialWebhookUpdateInput): Promise<PluginOfficialWebhookEndpoint>;\n\t\tsetEnabled(id: string, enabled: boolean): Promise<PluginOfficialWebhookEndpoint>;\n\t\tdelete(id: string): Promise<void>;\n\t\ttest(id: string): Promise<PluginOfficialWebhookSendResult>;\n\t\tsend(id: string, message: PluginOfficialWebhookMessage): Promise<PluginOfficialWebhookSendResult>;\n\t};\n\tskills: {\n\t\tlist(cwd?: string): Promise<PluginOfficialSkillInfo[]>;\n\t\tgetManifest(): Promise<Record<string, PluginOfficialInstalledSkill>>;\n\t\tsetEnabled(name: string, enabled: boolean): Promise<{ name: string; enabled: boolean }>;\n\t\tuninstall(name: string, type?: \"skill\"): Promise<void>;\n\t\t/**\n\t\t * 从能力市场按 slug 安装 skill(产品文案:能力)。\n\t\t * 下载在主进程完成;密钥类凭证不经过此 API。\n\t\t */\n\t\tinstallFromMarket(\n\t\t\ttype: \"skill\",\n\t\t\tslug: string,\n\t\t): Promise<{ name: string; type: \"skill\"; version: string; updated: boolean }>;\n\t};\n\tshortcuts: {\n\t\tlistAvailableActions(): Array<{ id: string; defaultShortcut: string }>;\n\t\tget(): Promise<{ bindings: PluginOfficialShortcutBinding[] }>;\n\t\tsetBinding(id: string, shortcut: string): Promise<{ bindings: PluginOfficialShortcutBinding[] }>;\n\t\tresetBinding(id: string): Promise<{ bindings: PluginOfficialShortcutBinding[]; shortcut: string }>;\n\t\tresetAllBindings(): Promise<{ bindings: PluginOfficialShortcutBinding[] }>;\n\t};\n\tim: {\n\t\tgetStatus(): Promise<PluginOfficialImStatus>;\n\t\tgetLogs(limit?: number): Promise<PluginOfficialImLog[]>;\n\t\tsetEnabled(enabled: boolean): Promise<{ status: unknown }>;\n\t\trestart(): Promise<{ status: unknown }>;\n\t\tsetAgentModel(\n\t\t\tmodelKey: string | null,\n\t\t\treasoningLevel?: string,\n\t\t): Promise<{ status: unknown }>;\n\t\tassertModelKeyExists(modelKey: string): Promise<void>;\n\t\t/**\n\t\t * 写入飞书凭证。Agent 应省略 appSecret 等密钥,由审批弹窗让用户手填。\n\t\t * 空字符串密钥字段表示保持现有值不改。\n\t\t */\n\t\tsetFeishuConfig(input: {\n\t\t\tenabled?: boolean;\n\t\t\tappId?: string;\n\t\t\tappSecret?: string;\n\t\t\tverificationToken?: string;\n\t\t\tencryptKey?: string;\n\t\t\tbaseUrl?: string;\n\t\t}): Promise<{ ok: boolean; error?: string }>;\n\t};\n\tmcp: {\n\t\tlist(target?: PluginOfficialMcpTarget): Promise<PluginOfficialMcpServerSummary[]>;\n\t\tget(name: string, target?: PluginOfficialMcpTarget): Promise<PluginOfficialMcpServerDetail>;\n\t\tlistNames(target?: PluginOfficialMcpTarget): Promise<string[]>;\n\t\tupsert(\n\t\t\tname: string,\n\t\t\tdata: PluginOfficialMcpUpsertData,\n\t\t\ttarget?: PluginOfficialMcpTarget,\n\t\t): Promise<PluginOfficialMcpServerDetail>;\n\t\tsetEnabled(name: string, enabled: boolean, target?: PluginOfficialMcpTarget): Promise<void>;\n\t\tremove(name: string, target?: PluginOfficialMcpTarget): Promise<void>;\n\t};\n\tmodels: {\n\t\t/**\n\t\t * 用户当前可选的全部模型:本地配置的 provider **加上**登录后服务端下发的远程目录\n\t\t * (Vetta Go 等,`remote: true`)。同一个 `provider/modelId` 以本地为准。\n\t\t * 与宿主输入栏模型选择器同一口径。\n\t\t */\n\t\tlist(): Promise<{ defaultModel: string | null; providers: PluginOfficialProviderSummary[] }>;\n\t\tget(provider?: string): Promise<unknown>;\n\t\tprobe(provider: string, model: string): Promise<{ ok: boolean; message?: string; error?: string }>;\n\t\tlistProviderIds(): Promise<string[]>;\n\t\tassertModelKeyExists(modelKey: string, operation?: string): Promise<void>;\n\t\tsetDefault(modelKey: string): Promise<{ defaultModel: string }>;\n\t\tupsertProvider(provider: string, data: PluginOfficialProviderUpsertData): Promise<PluginOfficialProviderDetail>;\n\t\t/** Removes the provider when present. Repeated removal is an idempotent no-op. */\n\t\tremoveProvider(provider: string): Promise<void>;\n\t};\n\tprojects: {\n\t\tlist(): Promise<{\n\t\t\tworkspacePath: string;\n\t\t\tprojects: PluginOfficialProjectEntry[];\n\t\t\tarchivedProjects: PluginOfficialProjectEntry[];\n\t\t}>;\n\t\tlistSessions(cwd: string): Promise<unknown[]>;\n\t\tlistRuntimeProjects(): Promise<unknown[]>;\n\t\tcreate(name: string, path?: string): Promise<PluginOfficialProjectEntry>;\n\t\topen(path: string, name?: string): Promise<PluginOfficialProjectEntry>;\n\t\trename(path: string, name: string): Promise<PluginOfficialProjectEntry>;\n\t\tarchive(path: string): Promise<void>;\n\t\tunarchive(path: string): Promise<void>;\n\t\tremove(path: string): Promise<void>;\n\t};\n\tplugins: {\n\t\tlist(): Promise<PluginOfficialPluginSummary[]>;\n\t\tget(id: string): Promise<PluginOfficialPluginSummary>;\n\t\tsetEnabled(id: string, enabled: boolean): Promise<PluginOfficialPluginSummary>;\n\t\tinstallFromUrl(\n\t\t\turl: string,\n\t\t\toptions?: { initiator?: \"plugin-cli\" },\n\t\t): Promise<PluginOfficialPluginSummary>;\n\t\tinstallFromPath(\n\t\t\tpath: string,\n\t\t\toptions?: {\n\t\t\t\tinitiator?: \"plugin-cli\" | \"plugin-workbench\";\n\t\t\t\tgrantedPermissions?: string[];\n\t\t\t\tenable?: boolean;\n\t\t\t\tsource?: \"archive\" | \"npm\";\n\t\t\t\texpectedSha256?: string;\n\t\t\t\texpectedId?: string;\n\t\t\t\texpectedVersion?: string;\n\t\t\t\tnpm?: {\n\t\t\t\t\tpackageName: string;\n\t\t\t\t\trequestedSpec: string;\n\t\t\t\t\tresolvedVersion: string;\n\t\t\t\t\tintegrity?: string;\n\t\t\t\t};\n\t\t\t},\n\t\t): Promise<PluginOfficialPluginSummary>;\n\t\tuninstall(id: string): Promise<void>;\n\t\treload(id: string): Promise<PluginOfficialPluginSummary>;\n\t\tgrantPermissions(id: string, permissions: PluginPermission[]): Promise<PluginOfficialPluginSummary>;\n\t\tstartDevWatch(id: string, projectDir: string): Promise<PluginOfficialPluginSummary>;\n\t\tstopDevWatch(id: string): Promise<void>;\n\t\tonChanged(handler: (event?: PluginOfficialPluginChangedEvent) => void): () => void;\n\t};\n\tdialog: {\n\t\tsaveCopy(sourcePath: string, options?: PluginOfficialSaveCopyOptions): Promise<string | null>;\n\t\t/**\n\t\t * 打开原生文件选择框,并把选中文件的**内容**一起返回。\n\t\t *\n\t\t * 插件的 `ctx.fs` 只能读已授权的项目根,因此「选个文件再自己去读」这条路走不通;\n\t\t * 这个接口不放宽任何目录授权,插件能看到的只有用户这次亲手选中的文件。\n\t\t * 用户取消时返回空数组。\n\t\t */\n\t\topenFiles(options?: PluginOfficialOpenFilesOptions): Promise<PluginOfficialOpenedFile[]>;\n\t};\n\tshell: {\n\t\t/**\n\t\t * 在系统文件管理器里定位并选中这个路径。\n\t\t *\n\t\t * 与 `ui.openExternal` 分工:那个只放行 http/https,用来把链接交给浏览器;\n\t\t * 这个只做「显示这个本地路径」,不能用来拉起任意协议。\n\t\t */\n\t\tshowItemInFolder(path: string): Promise<void>;\n\t};\n\tknowledge: {\n\t\tlist(): Promise<PluginOfficialKnowledgeBase[]>;\n\t\tfileStatuses(): Promise<Record<string, unknown>>;\n\t\tisProcessing(): Promise<boolean>;\n\t\tgetProcessing(): Promise<PluginOfficialKnowledgeProcessingSettings>;\n\t\tcreate(name: string): Promise<void>;\n\t\trename(name: string, newName: string): Promise<void>;\n\t\tdelete(name: string): Promise<void>;\n\t\taddFiles(kbId: string, paths: string[], move?: boolean): Promise<void>;\n\t\tdeleteEntry(kbId: string, relPath: string): Promise<void>;\n\t\tscanNow(): Promise<{ skipped: boolean; reason?: string }>;\n\t\tretryFailed(): Promise<{ skipped: boolean; reason?: string }>;\n\t\tsetProcessing(\n\t\t\tdata: Partial<{\n\t\t\t\tenabled: boolean;\n\t\t\t\tpollIntervalMinutes: 3 | 5 | 10 | 30;\n\t\t\t\tprocessingModelKey: string | null;\n\t\t\t\tprocessingModelReasoningLevel: string | null;\n\t\t\t\tagentConcurrency: number;\n\t\t\t\tocrConcurrency: number;\n\t\t\t}>,\n\t\t): Promise<PluginOfficialKnowledgeProcessingSettings>;\n\t};\n\tbatchTasks: {\n\t\tlistProjects(): Promise<unknown[]>;\n\t\tgetProject(projectId: string): Promise<unknown>;\n\t\tlistProjectIds(): Promise<string[]>;\n\t\tcreateProject(data: PluginOfficialBatchProjectCreateData): Promise<unknown>;\n\t\tupdateProject(projectId: string, data: PluginOfficialBatchProjectUpdateData): Promise<unknown>;\n\t\tdeleteProject(projectId: string): Promise<unknown>;\n\t\trunTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tretryTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tstopTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tdeleteTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tresumeTask(projectId: string, taskId: string): Promise<unknown>;\n\t\tresumeTaskWithText(projectId: string, taskId: string, text: string): Promise<unknown>;\n\t\tdeleteTaskSession(projectId: string, taskId: string): Promise<unknown>;\n\t\tbatchDelete(projectId: string): Promise<unknown>;\n\t\tbatchStart(projectId: string): Promise<unknown>;\n\t\tbatchStop(projectId: string): Promise<unknown>;\n\t\tbatchReset(projectId: string): Promise<unknown>;\n\t\tbatchResetFailed(projectId: string, taskIds: string[]): Promise<unknown>;\n\t};\n\tscheduler: {\n\t\tlistTasks(): Promise<unknown[]>;\n\t\tgetTask(taskId: string): Promise<unknown>;\n\t\tlistTaskIds(): Promise<string[]>;\n\t\tgetHistory(taskId: string): Promise<unknown[]>;\n\t\tcreateTask(data: PluginOfficialSchedulerTaskCreateData): Promise<unknown>;\n\t\tupdateTask(taskId: string, data: PluginOfficialSchedulerTaskUpdateData): Promise<unknown>;\n\t\tdeleteTask(taskId: string): Promise<unknown>;\n\t\tsetEnabled(taskId: string, enabled: boolean): Promise<unknown>;\n\t\trunNow(taskId: string): Promise<unknown>;\n\t\tabort(taskId: string): Promise<unknown>;\n\t};\n\tappearance: {\n\t\thelp(): Promise<unknown>;\n\t\tget(): Promise<unknown>;\n\t\tset(input: {\n\t\t\tmode?: \"light\" | \"dark\" | \"auto\";\n\t\t\tthemeId?: string;\n\t\t}): Promise<unknown>;\n\t\tsetLanguage(language: \"zh\" | \"en\"): Promise<unknown>;\n\t\tlistThemeIds(): string[];\n\t};\n\t/**\n\t * 后台会话编排。会话本体跑在主进程,创建后即使宿主停留在别的页面也会继续执行,\n\t * 因此系统插件可以据此做「多任务并发派单」类工作台(如看板)。\n\t */\n\tsessions: {\n\t\t/**\n\t\t * 在 `cwd` 下新建一个会话;不发送任何 prompt。\n\t\t *\n\t\t * 传 `modelKey`(`provider/modelId`)时写入该会话的模型设置,后续无论是插件\n\t\t * 继续 `prompt`、还是用户在对话页手动接着聊,都用这个模型;不传则跟随宿主全局默认。\n\t\t */\n\t\tcreate(input: { cwd: string; title?: string; modelKey?: string }): Promise<PluginOfficialSessionHandle>;\n\t\t/**\n\t\t * 向会话发起一轮对话。streaming 中会进入该会话的输入队列(ADR-0060)。\n\t\t *\n\t\t * `options.modelKey` 只钉住**这一轮**用哪个模型(不改会话设置);要让整个会话\n\t\t * 都用某个模型,在 `create` 时传 `modelKey`。\n\t\t */\n\t\tprompt(\n\t\t\tsessionId: string,\n\t\t\ttext: string,\n\t\t\toptions?: { modelKey?: string },\n\t\t): Promise<{ status: \"sent\" | \"queued\" | \"failed\"; error?: { message: string } }>;\n\t\t/** 中止会话当前回合。 */\n\t\tabort(sessionId: string): Promise<void>;\n\t\t/** 重命名会话(写入会话文件标题),用于把看板卡片标题同步到会话列表。 */\n\t\trename(sessionPath: string, name: string): Promise<void>;\n\t\t/** 列出某目录下的历史会话。 */\n\t\tlist(cwd: string): Promise<PluginOfficialSessionSummary[]>;\n\t\t/** 当前处于 agent loop 中的会话文件路径快照。 */\n\t\tlistRunning(): Promise<string[]>;\n\t\t/**\n\t\t * 当前有会话在跑的项目 cwd(去重)。\n\t\t *\n\t\t * 需要「这个项目忙不忙」时用它,不要拿 `listRunning()` 的路径去比对 cwd:会话文件\n\t\t * 默认落在按 cwd 编码的分片目录里,那个编码不可逆且会让不同项目撞进同一分片。\n\t\t */\n\t\tlistRunningCwds(): Promise<string[]>;\n\t\t/** 订阅运行态翻转;返回取消订阅函数。 */\n\t\tonRunningChanged(handler: (event: PluginOfficialSessionRunningEvent) => void): () => void;\n\t\t/** 把宿主导航到该会话的对话页。 */\n\t\topen(input: { cwd: string; sessionPath: string }): Promise<void>;\n\t};\n\tnavigation: {\n\t\thelp(): unknown;\n\t\tresolveOpen(input: PluginOfficialNavigationOpenInput): {\n\t\t\thashPath: string;\n\t\t\tresolved: unknown;\n\t\t};\n\t\topen(input: PluginOfficialNavigationOpenInput): Promise<unknown>;\n\t};\n}\n"]}
|
package/dist/permissions.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const PLUGIN_PERMISSIONS: readonly ["ui.slot.global", "ui.slot.ability-detail", "ui.slot.file-preview", "ui.slot.activity-tab", "ui.slot.bottom-panel", "terminal.run", "ui.slot.input-action", "ui.slot.message", "ui.slot.tool-call", "ui.slot.turn-card", "ui.slot.workspace-view", "ui.slot.new-session-context", "ui.slot.header-action", "ui.shortcuts.register", "conversation.draft.read", "ui.file-explorer.decorations", "ui.file-explorer.context-menu", "ui.file-explorer.toolbar", "workspace.read", "agent.session.read", "agent.session.write", "agent.command.run", "agent.command.spawn", "capture.offscreen", "browser.read", "browser.open", "browser.interact", "browser.profile.persist", "browser.attach", "browser.runtime.manage", "agent.systemPrompt.read", "agent.systemPrompt.write", "agent.systemPrompt.fullControl", "agent.skills.control", "agent.mcp.control", "agent.tools.control", "agent.tools.register", "agent.toolHandler.execute", "agent.hooks.register", "agent.hookHandler.execute", "agent.state.read", "agent.state.write", "agent.continuation.register", "agent.runtime.configure", "app.actions.register", "app.actionHandler.execute", "ai.models.list", "ai.complete", "models.manage", "fs.read", "fs.write", "network.fetch", "storage.read", "storage.write", "media.generate", "media.provider.register", "ai.ocr.recognize", "ai.ocr.provider.register", "settings.read", "settings.write", "secrets.read", "secrets.write", "shell.openExternal"];
|
|
1
|
+
export declare const PLUGIN_PERMISSIONS: readonly ["ui.slot.global", "ui.slot.ability-detail", "ui.slot.file-preview", "ui.slot.activity-tab", "ui.slot.bottom-panel", "terminal.run", "ui.slot.input-action", "ui.slot.message", "ui.slot.tool-call", "ui.slot.turn-card", "ui.slot.workspace-view", "ui.slot.new-session-context", "ui.slot.header-action", "ui.shortcuts.register", "conversation.draft.read", "ui.file-explorer.decorations", "ui.file-explorer.context-menu", "ui.file-explorer.toolbar", "workspace.read", "agent.session.read", "agent.session.metrics", "agent.session.write", "agent.command.run", "agent.command.spawn", "capture.offscreen", "browser.read", "browser.open", "browser.interact", "browser.profile.persist", "browser.attach", "browser.runtime.manage", "agent.systemPrompt.read", "agent.systemPrompt.write", "agent.systemPrompt.fullControl", "agent.skills.control", "agent.mcp.control", "agent.tools.control", "agent.tools.register", "agent.toolHandler.execute", "agent.hooks.register", "agent.hookHandler.execute", "agent.state.read", "agent.state.write", "agent.continuation.register", "agent.runtime.configure", "app.actions.register", "app.actionHandler.execute", "ai.models.list", "ai.complete", "models.manage", "fs.read", "fs.write", "network.fetch", "storage.read", "storage.write", "media.generate", "media.provider.register", "ai.ocr.recognize", "ai.ocr.provider.register", "settings.read", "settings.write", "secrets.read", "secrets.write", "shell.openExternal"];
|
|
2
2
|
export type PluginPermission = (typeof PLUGIN_PERMISSIONS)[number];
|
|
3
3
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,46CAiErB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC","sourcesContent":["export const PLUGIN_PERMISSIONS = [\n\t\"ui.slot.global\",\n\t\"ui.slot.ability-detail\",\n\t\"ui.slot.file-preview\",\n\t\"ui.slot.activity-tab\",\n\t\"ui.slot.bottom-panel\",\n\t\"terminal.run\",\n\t\"ui.slot.input-action\",\n\t\"ui.slot.message\",\n\t\"ui.slot.tool-call\",\n\t\"ui.slot.turn-card\",\n\t\"ui.slot.workspace-view\",\n\t\"ui.slot.new-session-context\",\n\t\"ui.slot.header-action\",\n\t\"ui.shortcuts.register\",\n\t\"conversation.draft.read\",\n\t\"ui.file-explorer.decorations\",\n\t\"ui.file-explorer.context-menu\",\n\t\"ui.file-explorer.toolbar\",\n\t\"workspace.read\",\n\t\"agent.session.read\",\n\t\"agent.session.metrics\",\n\t\"agent.session.write\",\n\t\"agent.command.run\",\n\t\"agent.command.spawn\",\n\t\"capture.offscreen\",\n\t\"browser.read\",\n\t\"browser.open\",\n\t\"browser.interact\",\n\t\"browser.profile.persist\",\n\t\"browser.attach\",\n\t\"browser.runtime.manage\",\n\t\"agent.systemPrompt.read\",\n\t\"agent.systemPrompt.write\",\n\t\"agent.systemPrompt.fullControl\",\n\t\"agent.skills.control\",\n\t\"agent.mcp.control\",\n\t\"agent.tools.control\",\n\t\"agent.tools.register\",\n\t\"agent.toolHandler.execute\",\n\t\"agent.hooks.register\",\n\t\"agent.hookHandler.execute\",\n\t\"agent.state.read\",\n\t\"agent.state.write\",\n\t\"agent.continuation.register\",\n\t\"agent.runtime.configure\",\n\t\"app.actions.register\",\n\t\"app.actionHandler.execute\",\n\t\"ai.models.list\",\n\t\"ai.complete\",\n\t\"models.manage\",\n\t\"fs.read\",\n\t\"fs.write\",\n\t\"network.fetch\",\n\t\"storage.read\",\n\t\"storage.write\",\n\t\"media.generate\",\n\t\"media.provider.register\",\n\t\"ai.ocr.recognize\",\n\t\"ai.ocr.provider.register\",\n\t\"settings.read\",\n\t\"settings.write\",\n\t\"secrets.read\",\n\t\"secrets.write\",\n\t\"shell.openExternal\",\n] as const;\n\nexport type PluginPermission = (typeof PLUGIN_PERMISSIONS)[number];\n"]}
|
package/dist/permissions.js
CHANGED
package/dist/permissions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,gBAAgB;IAChB,wBAAwB;IACxB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,sBAAsB;IACtB,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,wBAAwB;IACxB,6BAA6B;IAC7B,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,8BAA8B;IAC9B,+BAA+B;IAC/B,0BAA0B;IAC1B,gBAAgB;IAChB,oBAAoB;IACpB,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,yBAAyB;IACzB,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;IACzB,0BAA0B;IAC1B,gCAAgC;IAChC,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,2BAA2B;IAC3B,sBAAsB;IACtB,2BAA2B;IAC3B,kBAAkB;IAClB,mBAAmB;IACnB,6BAA6B;IAC7B,yBAAyB;IACzB,sBAAsB;IACtB,2BAA2B;IAC3B,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,SAAS;IACT,UAAU;IACV,eAAe;IACf,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,yBAAyB;IACzB,kBAAkB;IAClB,0BAA0B;IAC1B,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,oBAAoB;CACX,CAAC","sourcesContent":["export const PLUGIN_PERMISSIONS = [\n\t\"ui.slot.global\",\n\t\"ui.slot.ability-detail\",\n\t\"ui.slot.file-preview\",\n\t\"ui.slot.activity-tab\",\n\t\"ui.slot.bottom-panel\",\n\t\"terminal.run\",\n\t\"ui.slot.input-action\",\n\t\"ui.slot.message\",\n\t\"ui.slot.tool-call\",\n\t\"ui.slot.turn-card\",\n\t\"ui.slot.workspace-view\",\n\t\"ui.slot.new-session-context\",\n\t\"ui.slot.header-action\",\n\t\"ui.shortcuts.register\",\n\t\"conversation.draft.read\",\n\t\"ui.file-explorer.decorations\",\n\t\"ui.file-explorer.context-menu\",\n\t\"ui.file-explorer.toolbar\",\n\t\"workspace.read\",\n\t\"agent.session.read\",\n\t\"agent.session.write\",\n\t\"agent.command.run\",\n\t\"agent.command.spawn\",\n\t\"capture.offscreen\",\n\t\"browser.read\",\n\t\"browser.open\",\n\t\"browser.interact\",\n\t\"browser.profile.persist\",\n\t\"browser.attach\",\n\t\"browser.runtime.manage\",\n\t\"agent.systemPrompt.read\",\n\t\"agent.systemPrompt.write\",\n\t\"agent.systemPrompt.fullControl\",\n\t\"agent.skills.control\",\n\t\"agent.mcp.control\",\n\t\"agent.tools.control\",\n\t\"agent.tools.register\",\n\t\"agent.toolHandler.execute\",\n\t\"agent.hooks.register\",\n\t\"agent.hookHandler.execute\",\n\t\"agent.state.read\",\n\t\"agent.state.write\",\n\t\"agent.continuation.register\",\n\t\"agent.runtime.configure\",\n\t\"app.actions.register\",\n\t\"app.actionHandler.execute\",\n\t\"ai.models.list\",\n\t\"ai.complete\",\n\t\"models.manage\",\n\t\"fs.read\",\n\t\"fs.write\",\n\t\"network.fetch\",\n\t\"storage.read\",\n\t\"storage.write\",\n\t\"media.generate\",\n\t\"media.provider.register\",\n\t\"ai.ocr.recognize\",\n\t\"ai.ocr.provider.register\",\n\t\"settings.read\",\n\t\"settings.write\",\n\t\"secrets.read\",\n\t\"secrets.write\",\n\t\"shell.openExternal\",\n] as const;\n\nexport type PluginPermission = (typeof PLUGIN_PERMISSIONS)[number];\n"]}
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,gBAAgB;IAChB,wBAAwB;IACxB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,cAAc;IACd,sBAAsB;IACtB,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,wBAAwB;IACxB,6BAA6B;IAC7B,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,8BAA8B;IAC9B,+BAA+B;IAC/B,0BAA0B;IAC1B,gBAAgB;IAChB,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,yBAAyB;IACzB,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;IACzB,0BAA0B;IAC1B,gCAAgC;IAChC,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,2BAA2B;IAC3B,sBAAsB;IACtB,2BAA2B;IAC3B,kBAAkB;IAClB,mBAAmB;IACnB,6BAA6B;IAC7B,yBAAyB;IACzB,sBAAsB;IACtB,2BAA2B;IAC3B,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,SAAS;IACT,UAAU;IACV,eAAe;IACf,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,yBAAyB;IACzB,kBAAkB;IAClB,0BAA0B;IAC1B,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,oBAAoB;CACX,CAAC","sourcesContent":["export const PLUGIN_PERMISSIONS = [\n\t\"ui.slot.global\",\n\t\"ui.slot.ability-detail\",\n\t\"ui.slot.file-preview\",\n\t\"ui.slot.activity-tab\",\n\t\"ui.slot.bottom-panel\",\n\t\"terminal.run\",\n\t\"ui.slot.input-action\",\n\t\"ui.slot.message\",\n\t\"ui.slot.tool-call\",\n\t\"ui.slot.turn-card\",\n\t\"ui.slot.workspace-view\",\n\t\"ui.slot.new-session-context\",\n\t\"ui.slot.header-action\",\n\t\"ui.shortcuts.register\",\n\t\"conversation.draft.read\",\n\t\"ui.file-explorer.decorations\",\n\t\"ui.file-explorer.context-menu\",\n\t\"ui.file-explorer.toolbar\",\n\t\"workspace.read\",\n\t\"agent.session.read\",\n\t\"agent.session.metrics\",\n\t\"agent.session.write\",\n\t\"agent.command.run\",\n\t\"agent.command.spawn\",\n\t\"capture.offscreen\",\n\t\"browser.read\",\n\t\"browser.open\",\n\t\"browser.interact\",\n\t\"browser.profile.persist\",\n\t\"browser.attach\",\n\t\"browser.runtime.manage\",\n\t\"agent.systemPrompt.read\",\n\t\"agent.systemPrompt.write\",\n\t\"agent.systemPrompt.fullControl\",\n\t\"agent.skills.control\",\n\t\"agent.mcp.control\",\n\t\"agent.tools.control\",\n\t\"agent.tools.register\",\n\t\"agent.toolHandler.execute\",\n\t\"agent.hooks.register\",\n\t\"agent.hookHandler.execute\",\n\t\"agent.state.read\",\n\t\"agent.state.write\",\n\t\"agent.continuation.register\",\n\t\"agent.runtime.configure\",\n\t\"app.actions.register\",\n\t\"app.actionHandler.execute\",\n\t\"ai.models.list\",\n\t\"ai.complete\",\n\t\"models.manage\",\n\t\"fs.read\",\n\t\"fs.write\",\n\t\"network.fetch\",\n\t\"storage.read\",\n\t\"storage.write\",\n\t\"media.generate\",\n\t\"media.provider.register\",\n\t\"ai.ocr.recognize\",\n\t\"ai.ocr.provider.register\",\n\t\"settings.read\",\n\t\"settings.write\",\n\t\"secrets.read\",\n\t\"secrets.write\",\n\t\"shell.openExternal\",\n] as const;\n\nexport type PluginPermission = (typeof PLUGIN_PERMISSIONS)[number];\n"]}
|
package/dist/ui.d.ts
CHANGED
|
@@ -368,6 +368,12 @@ export interface PluginOpenActivityTabOptions extends PluginActivityTabTargetOpt
|
|
|
368
368
|
* widest the window allows — `"max"` keeps following window resizes until the
|
|
369
369
|
* user drags the divider. The host clamps to its min/max bounds. Omit to keep
|
|
370
370
|
* the user's current width.
|
|
371
|
+
*
|
|
372
|
+
* Applied when the tab is attached for the first time, or when this call opens
|
|
373
|
+
* a closed panel — the panel then slides in at this width in one motion.
|
|
374
|
+
* Ignored when the panel is already open with the tab attached (the user's
|
|
375
|
+
* width stands), and for calls made while `activate` is still running, since
|
|
376
|
+
* those replay on every reload.
|
|
371
377
|
*/
|
|
372
378
|
width?: number | "max";
|
|
373
379
|
}
|
|
@@ -630,16 +636,35 @@ export interface PluginNewSessionContextContribution {
|
|
|
630
636
|
render(context: PluginNewSessionContext): ReactNode;
|
|
631
637
|
}
|
|
632
638
|
/**
|
|
633
|
-
* 顶栏动作的下拉菜单项。点击一项执行 `onSelect`
|
|
639
|
+
* 顶栏动作的下拉菜单项。点击一项执行 `onSelect` 并关闭菜单(`checkbox` / `radio` 例外,见
|
|
640
|
+
* {@link PluginHeaderActionMenuItemKind})。
|
|
641
|
+
*/
|
|
642
|
+
/**
|
|
643
|
+
* 菜单项的类型。省略即普通命令项;其余类型让「列表就是状态」的场景(分支列表、开关、
|
|
644
|
+
* 加载中、空态)不必退化成纯文字:
|
|
645
|
+
* - `checkbox` / `radio`:`checked` 决定勾选标记,点它触发 `onSelect` 后菜单不自动关(适合切换开关);
|
|
646
|
+
* - `label`:分组标题,不可点;
|
|
647
|
+
* - `loading` / `empty`:占位行,自动禁用、不可点;
|
|
648
|
+
* - `submenu`:`children` 是下一级菜单项(只支持一层)。
|
|
634
649
|
*/
|
|
650
|
+
export type PluginHeaderActionMenuItemKind = "item" | "checkbox" | "radio" | "label" | "loading" | "empty" | "submenu";
|
|
635
651
|
export interface PluginHeaderActionMenuItem {
|
|
636
652
|
/** 项在菜单内唯一的 id。 */
|
|
637
653
|
id: string;
|
|
654
|
+
/** 默认 `item`。 */
|
|
655
|
+
kind?: PluginHeaderActionMenuItemKind;
|
|
638
656
|
label: string;
|
|
639
|
-
/** 菜单项前的图标,16px
|
|
657
|
+
/** 菜单项前的图标,16px 方框内显示。`checkbox` / `radio` 已选中时换成勾选标记。 */
|
|
640
658
|
icon?: ReactNode;
|
|
641
|
-
|
|
659
|
+
/** `submenu` 且给了 `children` 时可省略。 */
|
|
660
|
+
onSelect?: () => void;
|
|
661
|
+
/** `submenu` 的下一级菜单项。 */
|
|
662
|
+
children?: readonly PluginHeaderActionMenuItem[];
|
|
663
|
+
/** `checkbox` / `radio` 是否已选中。 */
|
|
664
|
+
checked?: boolean;
|
|
642
665
|
disabled?: boolean;
|
|
666
|
+
/** 禁用原因:禁用时排在 `title` 之前显示,用户才知道为什么点不了。 */
|
|
667
|
+
disabledReason?: string;
|
|
643
668
|
/** 危险操作(红色)。 */
|
|
644
669
|
destructive?: boolean;
|
|
645
670
|
/** 在这一项之前画一条分隔线。 */
|
|
@@ -650,30 +675,73 @@ export interface PluginHeaderActionPopoverProps {
|
|
|
650
675
|
/** 关闭气泡(例如内容里点了「完成」)。 */
|
|
651
676
|
close: () => void;
|
|
652
677
|
}
|
|
678
|
+
/** 角标与图标的语义色,跟随宿主主题;`neutral` 为默认。 */
|
|
679
|
+
export type PluginHeaderActionTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
680
|
+
/** 气泡尺寸:`sm` 约 16rem,`md`(默认)约 24rem,`lg` 约 32rem。 */
|
|
681
|
+
export type PluginHeaderActionPopoverSize = "sm" | "md" | "lg";
|
|
682
|
+
/**
|
|
683
|
+
* 气泡的容器形态。默认 `popover`(贴着按钮的小浮层);内容是有输入框、列表等需要专注的界面时
|
|
684
|
+
* 用 `dialog`(宿主居中对话框,带标题栏与关闭按钮,宽度由 `size` 决定)。
|
|
685
|
+
*/
|
|
686
|
+
export type PluginHeaderActionPopoverHost = "popover" | "dialog";
|
|
687
|
+
/** 气泡声明:直接给组件,或给组件加容器参数。 */
|
|
688
|
+
export type PluginHeaderActionPopover = ComponentType<PluginHeaderActionPopoverProps> | {
|
|
689
|
+
component: ComponentType<PluginHeaderActionPopoverProps>;
|
|
690
|
+
size?: PluginHeaderActionPopoverSize;
|
|
691
|
+
host?: PluginHeaderActionPopoverHost;
|
|
692
|
+
title?: string;
|
|
693
|
+
};
|
|
694
|
+
/** 顶栏动作此刻能拿到的上下文:它在哪个页面、当前工作目录是什么。 */
|
|
695
|
+
export interface PluginHeaderActionContext {
|
|
696
|
+
/**
|
|
697
|
+
* 当前页面。`conversation` = 会话页;`new-session` = 新会话页(还没有消息,
|
|
698
|
+
* 顶栏只有置顶与活动面板开关)。
|
|
699
|
+
*/
|
|
700
|
+
surface: PluginHeaderActionSurface;
|
|
701
|
+
/** 当前工作目录;没有项目(例如空白新会话)时为 `null`。 */
|
|
702
|
+
cwd: string | null;
|
|
703
|
+
}
|
|
704
|
+
/** 顶栏动作可以出现的页面。 */
|
|
705
|
+
export type PluginHeaderActionSurface = "conversation" | "new-session";
|
|
653
706
|
/**
|
|
654
707
|
* 顶栏动作此刻的**声明**,由 {@link PluginHeaderActionContribution.useAction} 返回。
|
|
655
708
|
*
|
|
656
709
|
* 宿主用它统一渲染成与内置按钮完全一致的一格;插件能决定的只有下面这些字段,没有 `className`、
|
|
657
|
-
* `style
|
|
710
|
+
* `style`,也无法替换按钮本身。默认**只有图标**,名称靠悬浮提示(`title`)显示;需要把状态
|
|
711
|
+
* 写在脸上时用 `label`(宽屏才显示,窄了自动退回图标)。
|
|
658
712
|
* `click` / `menuItems` / `popover` **三选一**:
|
|
659
713
|
* 同时给多个时按 `menuItems` > `popover` > `onClick` 取第一个;一个都没有则该动作不显示。
|
|
660
714
|
*
|
|
661
|
-
* 宿主会校验并截断:`title` 最长 40 字(超出截断),`menuItems` 最多
|
|
715
|
+
* 宿主会校验并截断:`title` 最长 40 字、`label` 最长 24 字(超出截断),`menuItems` 最多
|
|
662
716
|
* 20 项,`badge` 只接受数字(≥ 1,超过 99 显示 `99+`)或 `true`(红点)。
|
|
663
717
|
*/
|
|
664
718
|
export interface PluginHeaderActionState {
|
|
665
|
-
/**
|
|
719
|
+
/** 必填。悬浮提示、无障碍名称(按钮上不显示文字时,用户全靠它认出这个动作)。 */
|
|
666
720
|
title: string;
|
|
667
721
|
/**
|
|
668
722
|
* 必填。图标节点,宿主放进 16px 的固定方框里并忽略指针事件,建议直接用
|
|
669
723
|
* iconify 的 `<span className="icon-[solar--…]" />`。
|
|
670
724
|
*/
|
|
671
725
|
icon: ReactNode;
|
|
726
|
+
/**
|
|
727
|
+
* 图标右侧的文字,用于「状态本身就是文字」的动作(分支名、当前模型、同步落后数)。
|
|
728
|
+
* 最长 24 字;顶栏有位置时显示,被收纳、页头挤窄、顶栏超过 4 格时自动退回纯图标。
|
|
729
|
+
*/
|
|
730
|
+
label?: string;
|
|
672
731
|
/** 角标:数字显示计数,`true` 显示红点。被收纳时宿主会把它汇总到收纳入口上。 */
|
|
673
732
|
badge?: number | boolean;
|
|
733
|
+
/** 角标与图标的语义色,默认 `neutral`(灰色数字 / 本色图标)。 */
|
|
734
|
+
tone?: PluginHeaderActionTone;
|
|
674
735
|
/** 选中态(例如面板已打开)。 */
|
|
675
736
|
active?: boolean;
|
|
676
737
|
disabled?: boolean;
|
|
738
|
+
/** 禁用原因:禁用时替代 `title` 显示,用户才知道为什么点不了。 */
|
|
739
|
+
disabledReason?: string;
|
|
740
|
+
/**
|
|
741
|
+
* 处于选中态时,即使被收纳也要在活动面板开关左侧露出来(例如「正在录制」这类必须可见的状态)。
|
|
742
|
+
* 只在顶栏有活动面板开关的页面上生效。
|
|
743
|
+
*/
|
|
744
|
+
promoteWhenActive?: boolean;
|
|
677
745
|
/** 点击直接执行。 */
|
|
678
746
|
onClick?: () => void;
|
|
679
747
|
/** 点击向下弹出下拉菜单。 */
|
|
@@ -682,20 +750,21 @@ export interface PluginHeaderActionState {
|
|
|
682
750
|
* 点击弹出气泡,内容是你自己的组件。气泡的背景、圆角、投影由宿主固定,宽高随内容自适应;
|
|
683
751
|
* 被收纳时它会在收纳托盘里**内联展开**(宽约 260px),内容请能在这个宽度下正常显示。
|
|
684
752
|
*/
|
|
685
|
-
popover?:
|
|
753
|
+
popover?: PluginHeaderActionPopover;
|
|
686
754
|
}
|
|
687
755
|
/**
|
|
688
|
-
*
|
|
756
|
+
* 会话页与新会话页顶栏右侧按钮组里的一格(`ui.slot.header-action`)。
|
|
689
757
|
*
|
|
690
758
|
* 顶栏右侧是**宿主统一管理的一个按钮组**:内置按钮(导出 / 置顶 / 终端 / 底部面板)与所有插件
|
|
691
759
|
* 贡献排在同一组里,外观由宿主决定,插件不能自定义样式。显示规则:
|
|
692
760
|
* - 顶栏最多显示 7 格(不含最右侧固定的「活动面板」开关),内置与插件共用这 7 个名额;
|
|
693
761
|
* - 超出的、以及用户主动收起的动作进入「收纳」托盘(悬浮在按钮组上时,组下方出现的小白条);
|
|
694
762
|
* - 用户可以在托盘里拖动调整顺序、决定哪些在顶栏哪些收纳,这份布局按动作 id 记在本机;
|
|
695
|
-
* -
|
|
763
|
+
* - 新装插件的动作:顶栏还有空位就排进去,否则进收纳,不会挤走用户已有的布局;
|
|
764
|
+
* - `pin: "prefer"` 只是「用户没调整过时优先上栏」的建议,仍然用户可以改、也不突破 7 格上限。
|
|
696
765
|
* 所以插件**不能**假定自己一定在顶栏上,也不能依赖相邻的是谁。
|
|
697
766
|
*
|
|
698
|
-
*
|
|
767
|
+
* 出现页面由 `surfaces` 决定,默认只有会话页。
|
|
699
768
|
*/
|
|
700
769
|
export interface PluginHeaderActionContribution {
|
|
701
770
|
/** 贡献 id,在本插件内唯一,最长 64 字符。用户的布局按 `${插件 id}:${id}` 记忆,请不要随意改名。 */
|
|
@@ -705,17 +774,25 @@ export interface PluginHeaderActionContribution {
|
|
|
705
774
|
* 同值按插件 id、贡献 id 稳定排序。
|
|
706
775
|
*/
|
|
707
776
|
order?: number;
|
|
777
|
+
/** 出现在哪些页面,默认 `["conversation"]`。 */
|
|
778
|
+
surfaces?: readonly PluginHeaderActionSurface[];
|
|
779
|
+
/**
|
|
780
|
+
* 初始布局建议。`"prefer"` 表示用户没调整过布局时优先占用顶栏的一个名额
|
|
781
|
+
* (仍受 7 格上限与用户后来的调整约束);默认 `"normal"`,即先待在收纳托盘里。
|
|
782
|
+
*/
|
|
783
|
+
pin?: "normal" | "prefer";
|
|
708
784
|
/**
|
|
709
785
|
* 返回动作此刻的声明,返回 `null` 表示当前不适用(例如没有项目目录),宿主不显示也不占位。
|
|
710
786
|
*
|
|
711
|
-
* 这是一个 **React hook
|
|
787
|
+
* 这是一个 **React hook**:宿主在对应页面顶栏挂载期间一直调用它,所以可以在里面用任意 hook
|
|
712
788
|
* (`useActiveConversation()`、`useTranslation()`、你自己的 store……),数据变化时自然重新声明。
|
|
789
|
+
* 入参给出当前页面与工作目录,可以据此决定是否出现、显示什么。
|
|
713
790
|
* 约束:
|
|
714
791
|
* - 渲染期必须是纯计算,不要在里面发请求、起定时器;这类副作用放进 `useEffect`;
|
|
715
792
|
* - 抛错只会让这一项消失(错误边界隔离),不会影响其它动作;
|
|
716
793
|
* - 每次渲染都可以返回新对象,宿主不依赖引用相等。
|
|
717
794
|
*/
|
|
718
|
-
useAction: () => PluginHeaderActionState | null;
|
|
795
|
+
useAction: (context: PluginHeaderActionContext) => PluginHeaderActionState | null;
|
|
719
796
|
}
|
|
720
797
|
/**
|
|
721
798
|
* 宿主左侧侧边栏此刻的形态。给插件自适应布局用——尤其是沉浸式工作区视图:
|
|
@@ -877,9 +954,10 @@ export interface PluginUiApi {
|
|
|
877
954
|
* `"max"` 是一种持续状态而非一次性求值:窗口尺寸变化时面板跟着变宽变窄,直到
|
|
878
955
|
* 用户拖动分隔条或有人写入具体像素为止。传数字则是一次性的固定宽度。
|
|
879
956
|
*
|
|
880
|
-
* 与 `openActivityTab(id, { width })`
|
|
881
|
-
*
|
|
882
|
-
*
|
|
957
|
+
* 与 `openActivityTab(id, { width })` 的区别:那里的宽度只在「标签卡首次 attach」
|
|
958
|
+
* 或「把关着的面板翻开」时生效,且 activate 里的调用除外(避免重放覆盖用户手拖的
|
|
959
|
+
* 宽度);这个是命令式的,每次调用都生效,供插件在自己的标签卡被激活、进入某种
|
|
960
|
+
* 视图时按需调整。用户随后仍可拖动。
|
|
883
961
|
*/
|
|
884
962
|
setActivityPanelWidth(width: number | "max"): void;
|
|
885
963
|
/**
|