@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.
Files changed (89) hide show
  1. package/dist/activity-tab.d.ts +18 -0
  2. package/dist/activity-tab.d.ts.map +1 -0
  3. package/dist/activity-tab.js +12 -0
  4. package/dist/activity-tab.js.map +1 -0
  5. package/dist/agent.d.ts +211 -0
  6. package/dist/agent.d.ts.map +1 -0
  7. package/dist/agent.js +2 -0
  8. package/dist/agent.js.map +1 -0
  9. package/dist/app-actions.d.ts +63 -0
  10. package/dist/app-actions.d.ts.map +1 -0
  11. package/dist/app-actions.js +12 -0
  12. package/dist/app-actions.js.map +1 -0
  13. package/dist/command.d.ts +25 -0
  14. package/dist/command.d.ts.map +1 -0
  15. package/dist/command.js +2 -0
  16. package/dist/command.js.map +1 -0
  17. package/dist/context.d.ts +47 -0
  18. package/dist/context.d.ts.map +1 -0
  19. package/dist/context.js +4 -0
  20. package/dist/context.js.map +1 -0
  21. package/dist/conversation.d.ts +56 -0
  22. package/dist/conversation.d.ts.map +1 -0
  23. package/dist/conversation.js +2 -0
  24. package/dist/conversation.js.map +1 -0
  25. package/dist/disposable.d.ts +4 -0
  26. package/dist/disposable.d.ts.map +1 -0
  27. package/dist/disposable.js +2 -0
  28. package/dist/disposable.js.map +1 -0
  29. package/dist/fs.d.ts +43 -0
  30. package/dist/fs.d.ts.map +1 -0
  31. package/dist/fs.js +2 -0
  32. package/dist/fs.js.map +1 -0
  33. package/dist/hooks.d.ts +37 -0
  34. package/dist/hooks.d.ts.map +1 -0
  35. package/dist/hooks.js +39 -0
  36. package/dist/hooks.js.map +1 -0
  37. package/dist/host-bridge.d.ts +14 -0
  38. package/dist/host-bridge.d.ts.map +1 -0
  39. package/dist/host-bridge.js +12 -0
  40. package/dist/host-bridge.js.map +1 -0
  41. package/dist/i18n.d.ts +35 -0
  42. package/dist/i18n.d.ts.map +1 -0
  43. package/dist/i18n.js +29 -0
  44. package/dist/i18n.js.map +1 -0
  45. package/dist/images.d.ts +17 -0
  46. package/dist/images.d.ts.map +1 -0
  47. package/dist/images.js +2 -0
  48. package/dist/images.js.map +1 -0
  49. package/dist/index.d.ts +32 -1478
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +12 -99
  52. package/dist/index.js.map +1 -1
  53. package/dist/manifest.d.ts +57 -0
  54. package/dist/manifest.d.ts.map +1 -0
  55. package/dist/manifest.js +2 -0
  56. package/dist/manifest.js.map +1 -0
  57. package/dist/network.d.ts +38 -0
  58. package/dist/network.d.ts.map +1 -0
  59. package/dist/network.js +2 -0
  60. package/dist/network.js.map +1 -0
  61. package/dist/official.d.ts +519 -0
  62. package/dist/official.d.ts.map +1 -0
  63. package/dist/official.js +2 -0
  64. package/dist/official.js.map +1 -0
  65. package/dist/permissions.d.ts +2 -0
  66. package/dist/permissions.d.ts.map +1 -0
  67. package/dist/permissions.js +2 -0
  68. package/dist/permissions.js.map +1 -0
  69. package/dist/prompt-attachment.d.ts +15 -0
  70. package/dist/prompt-attachment.d.ts.map +1 -0
  71. package/dist/prompt-attachment.js +2 -0
  72. package/dist/prompt-attachment.js.map +1 -0
  73. package/dist/scenario.d.ts +9 -0
  74. package/dist/scenario.d.ts.map +1 -0
  75. package/dist/scenario.js +2 -0
  76. package/dist/scenario.js.map +1 -0
  77. package/dist/settings.d.ts +13 -0
  78. package/dist/settings.d.ts.map +1 -0
  79. package/dist/settings.js +2 -0
  80. package/dist/settings.js.map +1 -0
  81. package/dist/storage.d.ts +31 -0
  82. package/dist/storage.d.ts.map +1 -0
  83. package/dist/storage.js +2 -0
  84. package/dist/storage.js.map +1 -0
  85. package/dist/ui.d.ts +368 -0
  86. package/dist/ui.d.ts.map +1 -0
  87. package/dist/ui.js +2 -0
  88. package/dist/ui.js.map +1 -0
  89. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"official.js","sourceRoot":"","sources":["../src/official.ts"],"names":[],"mappings":"","sourcesContent":["export 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 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\" | \"scene\";\n}\n\nexport type PluginOfficialInstalledSkill = {\n\tname: string;\n\tversion: string;\n\tinstalledAt: string;\n\tsource: \"market\" | \"custom\";\n\tenabled: boolean;\n\ttype?: \"skill\" | \"scene\";\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\nexport interface PluginOfficialMcpServerSummary {\n\tname: string;\n\ttype: \"http\" | \"stdio\";\n\tdisabled: boolean;\n\tcommand?: string;\n\turl?: string;\n}\n\nexport interface PluginOfficialMcpServerDetail {\n\tname: string;\n\ttype?: \"http\" | \"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}\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\ttype: \"http\";\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\" | \"scene\";\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\nexport interface PluginOfficialSchedulerTaskCreateData {\n\tname: string;\n\tprompt: string;\n\tcron: string;\n\tisOnce: boolean;\n\tenabled?: boolean;\n\tcwd: string;\n\tmodelKey?: string;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tskill?: PluginOfficialSelectedSkill;\n}\n\nexport interface PluginOfficialSchedulerTaskUpdateData {\n\tname?: string;\n\tprompt?: string;\n\tcron?: string;\n\tisOnce?: boolean;\n\tenabled?: boolean;\n\tcwd?: string;\n\tmodelKey?: string | null;\n\texecutionMode?: PluginOfficialExecutionMode;\n\tskill?: PluginOfficialSelectedSkill | null;\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\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\tenabled: boolean;\n\trequired: boolean;\n\tsource: string;\n\tpermissions: string[];\n\tdescription?: string;\n\tdevWatch?: unknown;\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/** 仅宿主验证为官方来源的插件可以调用;普通插件调用时由宿主拒绝。 */\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};\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\" | \"scene\"): Promise<void>;\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};\n\tmcp: {\n\t\tlist(): Promise<PluginOfficialMcpServerSummary[]>;\n\t\tget(name: string): Promise<PluginOfficialMcpServerDetail>;\n\t\tlistNames(): Promise<string[]>;\n\t\tupsert(name: string, data: PluginOfficialMcpUpsertData): Promise<PluginOfficialMcpServerDetail>;\n\t\tsetEnabled(name: string, enabled: boolean): Promise<void>;\n\t\tremove(name: string): Promise<void>;\n\t};\n\tmodels: {\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\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(url: string): Promise<PluginOfficialPluginSummary>;\n\t\tinstallFromPath(\n\t\t\tpath: string,\n\t\t\toptions?: { grantedPermissions?: string[]; enable?: boolean },\n\t\t): Promise<PluginOfficialPluginSummary>;\n\t\tuninstall(id: string): Promise<void>;\n\t\treload(id: string): Promise<PluginOfficialPluginSummary>;\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\tcursorStyle?: \"default\" | \"stoat\";\n\t\t}): Promise<unknown>;\n\t\tsetLanguage(language: \"zh\" | \"en\"): Promise<unknown>;\n\t\tlistThemeIds(): string[];\n\t};\n\tnavigation: {\n\t\thelp(): unknown;\n\t\tresolveOpen(input: { target: string; tab?: string; section?: string }): {\n\t\t\thashPath: string;\n\t\t\tresolved: unknown;\n\t\t};\n\t\topen(input: { target: string; tab?: string; section?: string }): Promise<unknown>;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export type PluginPermission = "ui.slot.global" | "ui.slot.file-preview" | "ui.slot.activity-tab" | "ui.slot.input-action" | "ui.slot.message" | "ui.slot.tool-call" | "ui.slot.turn-card" | "agent.session.read" | "agent.session.write" | "agent.command.run" | "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.state.read" | "agent.state.write" | "agent.continuation.register" | "agent.runtime.configure" | "app.actions.register" | "app.actionHandler.execute" | "fs.read" | "fs.write" | "network.fetch" | "storage.read" | "storage.write" | "settings.read" | "settings.write";
2
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACzB,gBAAgB,GAChB,sBAAsB,GACtB,sBAAsB,GACtB,sBAAsB,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,yBAAyB,GACzB,0BAA0B,GAC1B,gCAAgC,GAChC,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GACtB,2BAA2B,GAC3B,kBAAkB,GAClB,mBAAmB,GACnB,6BAA6B,GAC7B,yBAAyB,GACzB,sBAAsB,GACtB,2BAA2B,GAC3B,SAAS,GACT,UAAU,GACV,eAAe,GACf,cAAc,GACd,eAAe,GACf,eAAe,GACf,gBAAgB,CAAC","sourcesContent":["export type PluginPermission =\n\t| \"ui.slot.global\"\n\t| \"ui.slot.file-preview\"\n\t| \"ui.slot.activity-tab\"\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| \"agent.session.read\"\n\t| \"agent.session.write\"\n\t| \"agent.command.run\"\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.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| \"fs.read\"\n\t| \"fs.write\"\n\t| \"network.fetch\"\n\t| \"storage.read\"\n\t| \"storage.write\"\n\t| \"settings.read\"\n\t| \"settings.write\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"","sourcesContent":["export type PluginPermission =\n\t| \"ui.slot.global\"\n\t| \"ui.slot.file-preview\"\n\t| \"ui.slot.activity-tab\"\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| \"agent.session.read\"\n\t| \"agent.session.write\"\n\t| \"agent.command.run\"\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.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| \"fs.read\"\n\t| \"fs.write\"\n\t| \"network.fetch\"\n\t| \"storage.read\"\n\t| \"storage.write\"\n\t| \"settings.read\"\n\t| \"settings.write\";\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * One-shot plugin-owned context attached to the next outgoing prompt.
3
+ *
4
+ * The host renders only the label/icon, merges metadata and hidden instructions
5
+ * at send time, then clears the attachment. Domain payloads stay in plugin
6
+ * storage or out-of-band references.
7
+ */
8
+ export interface PluginPromptAttachment {
9
+ id: string;
10
+ label: string;
11
+ icon?: string;
12
+ instructions?: string[];
13
+ metadata?: Record<string, unknown>;
14
+ }
15
+ //# sourceMappingURL=prompt-attachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-attachment.d.ts","sourceRoot":"","sources":["../src/prompt-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC","sourcesContent":["/**\n * One-shot plugin-owned context attached to the next outgoing prompt.\n *\n * The host renders only the label/icon, merges metadata and hidden instructions\n * at send time, then clears the attachment. Domain payloads stay in plugin\n * storage or out-of-band references.\n */\nexport interface PluginPromptAttachment {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\tinstructions?: string[];\n\tmetadata?: Record<string, unknown>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompt-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-attachment.js","sourceRoot":"","sources":["../src/prompt-attachment.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * One-shot plugin-owned context attached to the next outgoing prompt.\n *\n * The host renders only the label/icon, merges metadata and hidden instructions\n * at send time, then clears the attachment. Domain payloads stay in plugin\n * storage or out-of-band references.\n */\nexport interface PluginPromptAttachment {\n\tid: string;\n\tlabel: string;\n\ticon?: string;\n\tinstructions?: string[];\n\tmetadata?: Record<string, unknown>;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 对话场景 slug——决定一个工具 / 会话页插槽在哪些类型的会话里激活或可见。
3
+ *
4
+ * 本类型在 plugin-sdk 内本地定义(SDK 零依赖,不引入宿主包),与宿主
5
+ * `@vetta/coding-agent` 的 `ConversationScenario` 保持一一对应;任一侧增删场景时两边须同步,
6
+ * 否则宿主回传的 scenario 与此 union 不一致会触发编译错误(即为期望的漂移护栏)。
7
+ */
8
+ export type ConversationScenario = "im-claw" | "conversation" | "project" | "batch" | "automation" | "kb-processing" | "cli";
9
+ //# sourceMappingURL=scenario.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../src/scenario.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC7B,SAAS,GACT,cAAc,GACd,SAAS,GACT,OAAO,GACP,YAAY,GACZ,eAAe,GACf,KAAK,CAAC","sourcesContent":["/**\n * 对话场景 slug——决定一个工具 / 会话页插槽在哪些类型的会话里激活或可见。\n *\n * 本类型在 plugin-sdk 内本地定义(SDK 零依赖,不引入宿主包),与宿主\n * `@vetta/coding-agent` 的 `ConversationScenario` 保持一一对应;任一侧增删场景时两边须同步,\n * 否则宿主回传的 scenario 与此 union 不一致会触发编译错误(即为期望的漂移护栏)。\n */\nexport type ConversationScenario =\n\t| \"im-claw\" // Claw IM 对话\n\t| \"conversation\" // 普通对话\n\t| \"project\" // 普通项目中对话\n\t| \"batch\" // 批量任务对话\n\t| \"automation\" // 自动化任务对话\n\t| \"kb-processing\" // 知识库加工对话\n\t| \"cli\"; // 裸 CLI / SDK 消费者\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scenario.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.js","sourceRoot":"","sources":["../src/scenario.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 对话场景 slug——决定一个工具 / 会话页插槽在哪些类型的会话里激活或可见。\n *\n * 本类型在 plugin-sdk 内本地定义(SDK 零依赖,不引入宿主包),与宿主\n * `@vetta/coding-agent` 的 `ConversationScenario` 保持一一对应;任一侧增删场景时两边须同步,\n * 否则宿主回传的 scenario 与此 union 不一致会触发编译错误(即为期望的漂移护栏)。\n */\nexport type ConversationScenario =\n\t| \"im-claw\" // Claw IM 对话\n\t| \"conversation\" // 普通对话\n\t| \"project\" // 普通项目中对话\n\t| \"batch\" // 批量任务对话\n\t| \"automation\" // 自动化任务对话\n\t| \"kb-processing\" // 知识库加工对话\n\t| \"cli\"; // 裸 CLI / SDK 消费者\n"]}
@@ -0,0 +1,13 @@
1
+ import type { Disposable } from "./disposable.js";
2
+ /**
3
+ * Read-side access to this plugin's settings (the values configured against
4
+ * the `contributes.settings` schema declared in plugin.json, namespaced by
5
+ * plugin id). Writes go through the host's settings UI, not the plugin.
6
+ */
7
+ export interface PluginSettingsApi {
8
+ get<T = unknown>(key: string): T | undefined;
9
+ getAll(): Record<string, unknown>;
10
+ /** Fired when any of this plugin's setting values change. */
11
+ onChange(listener: (values: Record<string, unknown>) => void): Disposable;
12
+ }
13
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC7C,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,UAAU,CAAC;CAC1E","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\n/**\n * Read-side access to this plugin's settings (the values configured against\n * the `contributes.settings` schema declared in plugin.json, namespaced by\n * plugin id). Writes go through the host's settings UI, not the plugin.\n */\nexport interface PluginSettingsApi {\n\tget<T = unknown>(key: string): T | undefined;\n\tgetAll(): Record<string, unknown>;\n\t/** Fired when any of this plugin's setting values change. */\n\tonChange(listener: (values: Record<string, unknown>) => void): Disposable;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\n/**\n * Read-side access to this plugin's settings (the values configured against\n * the `contributes.settings` schema declared in plugin.json, namespaced by\n * plugin id). Writes go through the host's settings UI, not the plugin.\n */\nexport interface PluginSettingsApi {\n\tget<T = unknown>(key: string): T | undefined;\n\tgetAll(): Record<string, unknown>;\n\t/** Fired when any of this plugin's setting values change. */\n\tonChange(listener: (values: Record<string, unknown>) => void): Disposable;\n}\n"]}
@@ -0,0 +1,31 @@
1
+ export interface PluginStoredBlobRef {
2
+ id: string;
3
+ url: string;
4
+ mimeType: string;
5
+ }
6
+ export interface PluginStoredBlob {
7
+ data: string;
8
+ mimeType: string;
9
+ }
10
+ export interface PluginPutBlobInput {
11
+ id?: string;
12
+ data: string;
13
+ mimeType: string;
14
+ }
15
+ /**
16
+ * Private persistent storage scoped to the current plugin.
17
+ *
18
+ * JSON keys and file paths are relative to the plugin namespace. Blob bytes are
19
+ * base64 encoded at the bridge boundary and exposed through a host media URL.
20
+ */
21
+ export interface PluginStorageApi {
22
+ readJson<T>(key: string): Promise<T | null>;
23
+ writeJson(key: string, value: unknown): Promise<void>;
24
+ list(prefix?: string): Promise<string[]>;
25
+ readFile(path: string): Promise<string | null>;
26
+ writeFile(path: string, data: string): Promise<void>;
27
+ putBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;
28
+ readBlob(id: string): Promise<PluginStoredBlob | null>;
29
+ getBlobRef(id: string): Promise<PluginStoredBlobRef | null>;
30
+ }
31
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACjE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACvD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CAC5D","sourcesContent":["export interface PluginStoredBlobRef {\n\tid: string;\n\turl: string;\n\tmimeType: string;\n}\n\nexport interface PluginStoredBlob {\n\tdata: string;\n\tmimeType: string;\n}\n\nexport interface PluginPutBlobInput {\n\tid?: string;\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Private persistent storage scoped to the current plugin.\n *\n * JSON keys and file paths are relative to the plugin namespace. Blob bytes are\n * base64 encoded at the bridge boundary and exposed through a host media URL.\n */\nexport interface PluginStorageApi {\n\treadJson<T>(key: string): Promise<T | null>;\n\twriteJson(key: string, value: unknown): Promise<void>;\n\tlist(prefix?: string): Promise<string[]>;\n\treadFile(path: string): Promise<string | null>;\n\twriteFile(path: string, data: string): Promise<void>;\n\tputBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;\n\treadBlob(id: string): Promise<PluginStoredBlob | null>;\n\tgetBlobRef(id: string): Promise<PluginStoredBlobRef | null>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginStoredBlobRef {\n\tid: string;\n\turl: string;\n\tmimeType: string;\n}\n\nexport interface PluginStoredBlob {\n\tdata: string;\n\tmimeType: string;\n}\n\nexport interface PluginPutBlobInput {\n\tid?: string;\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Private persistent storage scoped to the current plugin.\n *\n * JSON keys and file paths are relative to the plugin namespace. Blob bytes are\n * base64 encoded at the bridge boundary and exposed through a host media URL.\n */\nexport interface PluginStorageApi {\n\treadJson<T>(key: string): Promise<T | null>;\n\twriteJson(key: string, value: unknown): Promise<void>;\n\tlist(prefix?: string): Promise<string[]>;\n\treadFile(path: string): Promise<string | null>;\n\twriteFile(path: string, data: string): Promise<void>;\n\tputBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;\n\treadBlob(id: string): Promise<PluginStoredBlob | null>;\n\tgetBlobRef(id: string): Promise<PluginStoredBlobRef | null>;\n}\n"]}
package/dist/ui.d.ts ADDED
@@ -0,0 +1,368 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import type { ConversationMessage } from "./conversation.js";
3
+ import type { Disposable } from "./disposable.js";
4
+ import type { PluginImageRef } from "./images.js";
5
+ import type { PluginPromptAttachment } from "./prompt-attachment.js";
6
+ import type { ConversationScenario } from "./scenario.js";
7
+ export interface PluginGlobalSlotContribution {
8
+ id: string;
9
+ component: ComponentType;
10
+ }
11
+ export interface PluginAudioMetadata {
12
+ /** Embedded title; preview renderers should fall back to file.name. */
13
+ title?: string;
14
+ artist?: string;
15
+ /** Embedded cover art as a Data URL when available. */
16
+ coverDataUrl?: string;
17
+ }
18
+ export interface PluginPreviewUrlOptions {
19
+ /** Optional media hint for ambiguous containers such as webm. */
20
+ mediaKind?: "audio" | "video";
21
+ }
22
+ /**
23
+ * The file handed to a file-preview plugin component. The host does NOT
24
+ * pre-read or guess encoding — the plugin decides whether to read text or
25
+ * bytes. `path` is also exposed for plugins that prefer native fetch.
26
+ */
27
+ export interface PluginPreviewFile {
28
+ path: string | null;
29
+ name: string;
30
+ extension: string;
31
+ mime: string;
32
+ size: number;
33
+ /** Read the file as a UTF-8 string. */
34
+ readText(): Promise<string>;
35
+ /** Read the raw file bytes. */
36
+ readBytes(): Promise<ArrayBuffer>;
37
+ /** A fetchable streaming URL for the file (Range-capable). */
38
+ getUrl(options?: PluginPreviewUrlOptions): string;
39
+ /**
40
+ * Subscribe to on-disk changes of this file. The listener fires (debounced
41
+ * by the host) whenever the file's contents change, letting previews update
42
+ * live. Returns a Disposable; call dispose() to stop watching. A no-op for
43
+ * files without a real path (url-only sources).
44
+ */
45
+ watch(listener: () => void): Disposable;
46
+ /**
47
+ * Host-provided audio metadata for local media files. Returns null when the
48
+ * host cannot provide metadata, e.g. url-only sources or unsupported files.
49
+ */
50
+ getAudioMetadata?(): Promise<PluginAudioMetadata | null>;
51
+ }
52
+ export interface PluginFilePreviewProps {
53
+ file: PluginPreviewFile;
54
+ }
55
+ export interface PluginFilePreviewContribution {
56
+ /** Lower-case extensions without the dot, e.g. ["svg"]. */
57
+ extensions: string[];
58
+ component: ComponentType<PluginFilePreviewProps>;
59
+ }
60
+ /**
61
+ * An activity-panel tab contributed by a plugin. Registering only adds the
62
+ * tab to the "addable pool" — it renders only after the user attaches it in
63
+ * the activity panel (scoped by session cwd).
64
+ */
65
+ export interface PluginActivityTabContribution {
66
+ id: string;
67
+ label: string;
68
+ /** Tab icon as a React node (not an iconify class string). */
69
+ icon?: ReactNode;
70
+ component: ComponentType;
71
+ /**
72
+ * 允许该标签卡出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:
73
+ * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如
74
+ * `["project", "conversation"]`)。会话页插槽据此随对话类型显隐。
75
+ */
76
+ scope_use?: readonly ConversationScenario[];
77
+ /**
78
+ * 注册后是否默认在标签栏里(缺省 `true`)。声明 `false` 表示「出现条件由我
79
+ * 自己决定」——注册只是入池,之后由 {@link PluginUiApi.setActivityTabVisible}
80
+ * 或 {@link PluginUiApi.openActivityTab} 决定何时上栏(如 git 只在仓库目录、
81
+ * 工作台跟随输入栏 toggle)。无论哪种,用户仍可用减号手动隐藏。
82
+ */
83
+ initiallyVisible?: boolean;
84
+ }
85
+ /** Options for {@link PluginUiApi.openActivityTab}. */
86
+ export interface PluginOpenActivityTabOptions {
87
+ /**
88
+ * Desired panel width as it opens: a pixel number, or `"max"` for the widest
89
+ * the current window allows. The host clamps to its min/max bounds. Omit to
90
+ * keep the user's current width.
91
+ */
92
+ width?: number | "max";
93
+ }
94
+ export interface PluginCaptureRegion {
95
+ x: number;
96
+ y: number;
97
+ width: number;
98
+ height: number;
99
+ }
100
+ /**
101
+ * Decoration a plugin contributes to the next outgoing prompt while its input
102
+ * action is active. `metadata` is shallow-merged into the prompt request and
103
+ * `instructions` are appended as hidden, model-visible guidance.
104
+ */
105
+ export interface PluginPromptDecoration {
106
+ metadata?: Record<string, unknown>;
107
+ /** Hidden plugin-owned instructions appended to the next agent turn. */
108
+ instructions?: string[];
109
+ }
110
+ /**
111
+ * An action button shown in a row beneath the AI input bar. Rendered as a
112
+ * toggle: clicking activates, clicking again deactivates. While active, the
113
+ * host calls `decoratePrompt()` before each send and merges the returned
114
+ * metadata into the outgoing prompt request. The plugin owns any side state
115
+ * (it is the same Module Federation instance as its other slots).
116
+ */
117
+ export interface PluginInputActionContribution {
118
+ id: string;
119
+ label: string;
120
+ /** Button icon as a React node (not an iconify class string). */
121
+ icon?: ReactNode;
122
+ /** Whether the action begins in the active state. Defaults to false. */
123
+ defaultActive?: boolean;
124
+ /**
125
+ * 该输入动作所依赖的 agent 工具名。设置后,仅当该工具在当前会话处于激活(按工具的
126
+ * scope_use 解析)时才显示这个 badge——避免在工具被场景屏蔽(如批量任务)时仍显示一个
127
+ * 点了也无效的开关。不设则始终显示。例如「图像生成」设为 "generate_image"。
128
+ */
129
+ requiresActiveTool?: string;
130
+ /**
131
+ * 允许该 toggle 出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:
132
+ * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现。与 `requiresActiveTool`
133
+ * 取「与」:两者都满足才显示。
134
+ */
135
+ scope_use?: readonly ConversationScenario[];
136
+ /**
137
+ * When true, this plugin's agent contributions (tools / skills / MCP /
138
+ * systemPrompt) and Activity Tabs are hard-isolated: inactive until this
139
+ * toggle is on (ADR-0041, knowledgeMode-style). Default false.
140
+ */
141
+ hardIsolation?: boolean;
142
+ /**
143
+ * Fired when the user toggles the action; `active` is the new state. Return
144
+ * `false` when `active` is true to VETO the activation (e.g. the plugin needs
145
+ * configuration first) — the toggle stays off. Deactivation can't be vetoed.
146
+ */
147
+ onToggle?(active: boolean): boolean | void;
148
+ /**
149
+ * Called by the host before sending while the action is active. The
150
+ * returned metadata is merged into the outgoing prompt request.
151
+ */
152
+ decoratePrompt?(): PluginPromptDecoration | void;
153
+ }
154
+ /**
155
+ * A declarative, serializable descriptor for one card rendered beneath a
156
+ * message. `type` selects a registered card renderer; `key` drives cross-turn
157
+ * dedup (same key across turns = one logical card, shown only under its latest
158
+ * anchor); `payload` carries STABLE REFERENCES (e.g. image ids), not a content
159
+ * snapshot — the renderer resolves live state from it. `title`/`icon` label the
160
+ * card's tab (override the renderer's registration defaults). Rides a tool
161
+ * result's out-of-band `details.cards`; crosses the agent→host boundary, so
162
+ * `icon` is an icon-symbol string, not a node.
163
+ */
164
+ export interface CardDescriptor {
165
+ type: string;
166
+ key?: string;
167
+ payload?: unknown;
168
+ title?: string;
169
+ icon?: string;
170
+ }
171
+ /** A pending (in-flight) tool call handed to a renderer's `pendingFor`. */
172
+ export interface PluginPendingToolCall {
173
+ toolName: string;
174
+ args: Record<string, unknown>;
175
+ }
176
+ /**
177
+ * Props for a card renderer. `descriptor` is the card's data; `pending` is true
178
+ * while it was synthesized from an in-flight tool (render a skeleton); `message`
179
+ * is the anchoring conversation message.
180
+ */
181
+ export interface PluginCardProps {
182
+ descriptor: CardDescriptor;
183
+ pending: boolean;
184
+ message: ConversationMessage;
185
+ }
186
+ /**
187
+ * A card renderer registered by a plugin, keyed by `type`. A descriptor whose
188
+ * `type` matches is rendered by `component`. `title`/`icon` are the default tab
189
+ * label/icon (a descriptor may override `title`). `pendingFor`, given an
190
+ * in-flight tool call, returns a provisional descriptor so a skeleton card
191
+ * appears (and claims a tab) before the tool's result lands — or null when this
192
+ * renderer doesn't handle that tool. The `type` must be globally unique across
193
+ * plugins (convention: prefix with the plugin id, e.g. "image-gen:preview").
194
+ */
195
+ export interface PluginCardRendererContribution {
196
+ type: string;
197
+ component: ComponentType<PluginCardProps>;
198
+ title?: string;
199
+ /** Default tab icon as a React node (not an iconify class string). */
200
+ icon?: ReactNode;
201
+ pendingFor?: (toolCall: PluginPendingToolCall) => CardDescriptor | null;
202
+ }
203
+ /** A tool call handed to a tool-call slot renderer. */
204
+ export interface PluginToolCallSlotToolCall {
205
+ toolCallId: string;
206
+ toolName: string;
207
+ args: Record<string, unknown>;
208
+ status: "pending" | "success" | "error";
209
+ result?: string;
210
+ isError?: boolean;
211
+ }
212
+ export interface PluginToolCallSlotProps {
213
+ toolCall: PluginToolCallSlotToolCall;
214
+ }
215
+ /**
216
+ * A component that **replaces the host's default inline transcript rendering**
217
+ * for a specific tool (matched by `toolName`; first registered renderer wins).
218
+ * This is how a plugin renders rich UI for its OWN agent tool's output — plugin
219
+ * tools cannot emit `details.cards`, so the message card system (registerCardRenderer)
220
+ * does not serve them; the tool-call slot does.
221
+ */
222
+ export interface PluginToolCallSlotContribution {
223
+ id: string;
224
+ toolName: string;
225
+ component: ComponentType<PluginToolCallSlotProps>;
226
+ }
227
+ /**
228
+ * A card rendered at the bottom of the message list for the LATEST turn — NOT
229
+ * bound to a tool call. The host mounts `component` in the footer slot and
230
+ * re-mounts it each session/turn; the plugin owns visibility entirely (it reads
231
+ * live state via SDK hooks — `useActiveConversation`, `useConversationMessages`,
232
+ * `ctx.conversation.on("turn-end")` — and returns `null` to render nothing,
233
+ * e.g. git renders only inside a repo that has changes). `scope_use` gates which
234
+ * conversation scenarios it may appear in (**fail-closed**, mirrors the other
235
+ * slots). `id` must be unique within the plugin.
236
+ */
237
+ export interface PluginTurnCardContribution {
238
+ id: string;
239
+ component: ComponentType;
240
+ /**
241
+ * 允许该 turn 卡出现的对话场景 slug 列表(镜像其它插槽的 scope_use)。**fail-closed**:
242
+ * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如 `["project"]`)。
243
+ */
244
+ scope_use?: readonly ConversationScenario[];
245
+ }
246
+ /**
247
+ * Options for {@link PluginUiApi.notify}. Surfaces a host toast so users can
248
+ * see plugin failures without opening DevTools.
249
+ */
250
+ export interface PluginNotifyOptions {
251
+ /** Toast body. Required even when `error` is set (user-facing summary). */
252
+ message: string;
253
+ /** Defaults to plugin display name when omitted. */
254
+ title?: string;
255
+ /** Defaults to `"info"`; when `error` is set and variant omitted, host uses `"error"`. */
256
+ variant?: "info" | "success" | "warning" | "error";
257
+ /**
258
+ * Optional failure cause. Host formats message + stack and adds a
259
+ * "复制堆栈" action so the user can paste it into bug reports / chat.
260
+ */
261
+ error?: unknown;
262
+ /**
263
+ * Auto-dismiss delay in ms. `0` keeps the toast until dismissed.
264
+ * Defaults: sticky (`0`) when `error` is present, otherwise host default (~4s).
265
+ */
266
+ durationMs?: number;
267
+ }
268
+ export interface PluginUiApi {
269
+ registerGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;
270
+ /**
271
+ * Register a preview component keyed by file extension. The host dispatches
272
+ * registered extensions before its built-in fallback renderers; first
273
+ * registrant wins on conflict.
274
+ */
275
+ registerFilePreview(contribution: PluginFilePreviewContribution): Disposable;
276
+ /**
277
+ * Register an activity-panel tab into the addable pool. The user attaches
278
+ * it manually via the panel's "+" picker; attach records are keyed by the
279
+ * session cwd.
280
+ */
281
+ registerActivityTab(contribution: PluginActivityTabContribution): Disposable;
282
+ /**
283
+ * Register a toggle action shown beneath the AI input bar. While active,
284
+ * its `decoratePrompt()` annotates the next outgoing prompt.
285
+ */
286
+ registerInputAction(contribution: PluginInputActionContribution): Disposable;
287
+ /**
288
+ * Register a card renderer keyed by `type`. Cards rendered beneath a message
289
+ * come from tool results' out-of-band `details.cards` (or `pendingFor` for
290
+ * in-flight tools); the host resolves each card's `type` to a registered
291
+ * renderer. Multiple cards under one message are shown as a tab-switcher
292
+ * ("收纳") or a flat list.
293
+ */
294
+ registerCardRenderer(contribution: PluginCardRendererContribution): Disposable;
295
+ /**
296
+ * Register a renderer that replaces the host's default inline transcript UI
297
+ * for a tool call (matched by `toolName`). The complement to card renderers:
298
+ * use it to render UI for a plugin's own agent tool output.
299
+ */
300
+ registerToolCallSlot(contribution: PluginToolCallSlotContribution): Disposable;
301
+ /**
302
+ * Register a card rendered at the bottom of the message list for the latest
303
+ * turn — NOT bound to a tool call. The host mounts the component in the
304
+ * footer slot; the plugin owns visibility (return `null` to render nothing,
305
+ * e.g. git renders only in a repo with changes). Gated by `scope_use`
306
+ * (fail-closed). Needs the `ui.slot.turn-card` permission.
307
+ */
308
+ registerTurnCard(contribution: PluginTurnCardContribution): Disposable;
309
+ /**
310
+ * Programmatically attach (if needed) and activate one of this plugin's
311
+ * own activity tabs in the current conversation's activity panel. `tabId`
312
+ * is the contribution id passed to registerActivityTab. Any payload (e.g.
313
+ * which image to edit) is passed via the plugin's own in-memory state.
314
+ *
315
+ * Pass `options.width` to size the panel as it opens — a pixel number, or
316
+ * `"max"` to expand it to the widest the current window allows (the host
317
+ * still clamps to its min/max and auto-hides the sidebar when needed). Omit
318
+ * to leave the user's current width untouched.
319
+ */
320
+ openActivityTab(tabId: string, options?: PluginOpenActivityTabOptions): void;
321
+ /**
322
+ * 把本插件的某个活动面板标签卡在当前会话里上栏 / 下栏,**不激活也不展开
323
+ * 面板**——`openActivityTab` 是「用户此刻要看它」,这个是「它现在该不该在
324
+ * 栏里」。配合 `initiallyVisible: false` 使用,插件即可完全掌握自己标签卡的
325
+ * 出现条件(如 git 只在仓库目录里上栏、工作台跟随输入栏 toggle)。
326
+ *
327
+ * 上栏记录按会话 cwd 持久化(ADR-0026),所以只需在条件变化时调用一次;
328
+ * 用户随后用减号手动隐藏的结果不会被重复调用覆盖。当前没有活动会话时为
329
+ * no-op(无处记录),插件应在会话就绪后重新判定。
330
+ */
331
+ setActivityTabVisible(tabId: string, visible: boolean): void;
332
+ /**
333
+ * Bind or clear plugin-owned one-shot context for the next outgoing prompt.
334
+ * The host renders its label/icon, merges metadata and hidden instructions,
335
+ * then clears it after send or when the user closes the capsule.
336
+ */
337
+ setPromptAttachment(attachment: PluginPromptAttachment | null): void;
338
+ /**
339
+ * Open the host's global full-screen image previewer for the given image.
340
+ * Only the image reference (id/url) crosses over — bytes stay out-of-band.
341
+ *
342
+ * Pass `group` (e.g. all images of the message) to open as an image group:
343
+ * the previewer shows a thumbnail strip + arrows and starts at `ref`.
344
+ */
345
+ previewImage(ref: PluginImageRef, group?: PluginImageRef[]): void;
346
+ /**
347
+ * Open the app settings, scrolled to and highlighting THIS plugin's own
348
+ * settings section (e.g. so the user can fill in a required API key/model).
349
+ * The host owns the navigation; the plugin only asks to jump there.
350
+ */
351
+ openPluginSettings(): void;
352
+ /**
353
+ * Capture a rectangle in the current Vetta window and open the host save
354
+ * dialog. Coordinates use renderer DIP values such as getBoundingClientRect().
355
+ * Requires `ui.slot.activity-tab`.
356
+ */
357
+ captureRegion(rect: PluginCaptureRegion, defaultFileName: string): Promise<string | null>;
358
+ /**
359
+ * Show a global toast in the host UI (bottom-right). No permission required.
360
+ * Prefer this over swallowing errors into opaque UI copy: pass `error` so
361
+ * the host attaches a one-click "copy stack" action for the user.
362
+ *
363
+ * Capture `ctx.ui.notify` in `activate` if React components need it
364
+ * (components do not receive `ctx`).
365
+ */
366
+ notify(options: PluginNotifyOptions): void;
367
+ }
368
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"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","sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\nimport type { ConversationMessage } from \"./conversation.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginImageRef } from \"./images.js\";\nimport type { PluginPromptAttachment } from \"./prompt-attachment.js\";\nimport type { ConversationScenario } from \"./scenario.js\";\n\nexport interface PluginGlobalSlotContribution {\n\tid: string;\n\tcomponent: ComponentType;\n}\n\nexport interface PluginAudioMetadata {\n\t/** Embedded title; preview renderers should fall back to file.name. */\n\ttitle?: string;\n\tartist?: string;\n\t/** Embedded cover art as a Data URL when available. */\n\tcoverDataUrl?: string;\n}\n\nexport interface PluginPreviewUrlOptions {\n\t/** Optional media hint for ambiguous containers such as webm. */\n\tmediaKind?: \"audio\" | \"video\";\n}\n\n/**\n * The file handed to a file-preview plugin component. The host does NOT\n * pre-read or guess encoding — the plugin decides whether to read text or\n * bytes. `path` is also exposed for plugins that prefer native fetch.\n */\nexport interface PluginPreviewFile {\n\tpath: string | null;\n\tname: string;\n\textension: string;\n\tmime: string;\n\tsize: number;\n\t/** Read the file as a UTF-8 string. */\n\treadText(): Promise<string>;\n\t/** Read the raw file bytes. */\n\treadBytes(): Promise<ArrayBuffer>;\n\t/** A fetchable streaming URL for the file (Range-capable). */\n\tgetUrl(options?: PluginPreviewUrlOptions): string;\n\t/**\n\t * Subscribe to on-disk changes of this file. The listener fires (debounced\n\t * by the host) whenever the file's contents change, letting previews update\n\t * live. Returns a Disposable; call dispose() to stop watching. A no-op for\n\t * files without a real path (url-only sources).\n\t */\n\twatch(listener: () => void): Disposable;\n\t/**\n\t * Host-provided audio metadata for local media files. Returns null when the\n\t * host cannot provide metadata, e.g. url-only sources or unsupported files.\n\t */\n\tgetAudioMetadata?(): Promise<PluginAudioMetadata | null>;\n}\n\nexport interface PluginFilePreviewProps {\n\tfile: PluginPreviewFile;\n}\n\nexport interface PluginFilePreviewContribution {\n\t/** Lower-case extensions without the dot, e.g. [\"svg\"]. */\n\textensions: string[];\n\tcomponent: ComponentType<PluginFilePreviewProps>;\n}\n\n/**\n * An activity-panel tab contributed by a plugin. Registering only adds the\n * tab to the \"addable pool\" — it renders only after the user attaches it in\n * the activity panel (scoped by session cwd).\n */\nexport interface PluginActivityTabContribution {\n\tid: string;\n\tlabel: string;\n\t/** Tab icon as a React node (not an iconify class string). */\n\ticon?: ReactNode;\n\tcomponent: ComponentType;\n\t/**\n\t * 允许该标签卡出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:\n\t * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如\n\t * `[\"project\", \"conversation\"]`)。会话页插槽据此随对话类型显隐。\n\t */\n\tscope_use?: readonly ConversationScenario[];\n\t/**\n\t * 注册后是否默认在标签栏里(缺省 `true`)。声明 `false` 表示「出现条件由我\n\t * 自己决定」——注册只是入池,之后由 {@link PluginUiApi.setActivityTabVisible}\n\t * 或 {@link PluginUiApi.openActivityTab} 决定何时上栏(如 git 只在仓库目录、\n\t * 工作台跟随输入栏 toggle)。无论哪种,用户仍可用减号手动隐藏。\n\t */\n\tinitiallyVisible?: boolean;\n}\n\n/** Options for {@link PluginUiApi.openActivityTab}. */\nexport interface PluginOpenActivityTabOptions {\n\t/**\n\t * Desired panel width as it opens: a pixel number, or `\"max\"` for the widest\n\t * the current window allows. The host clamps to its min/max bounds. Omit to\n\t * keep the user's current width.\n\t */\n\twidth?: number | \"max\";\n}\n\nexport interface PluginCaptureRegion {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\n/**\n * Decoration a plugin contributes to the next outgoing prompt while its input\n * action is active. `metadata` is shallow-merged into the prompt request and\n * `instructions` are appended as hidden, model-visible guidance.\n */\nexport interface PluginPromptDecoration {\n\tmetadata?: Record<string, unknown>;\n\t/** Hidden plugin-owned instructions appended to the next agent turn. */\n\tinstructions?: string[];\n}\n\n/**\n * An action button shown in a row beneath the AI input bar. Rendered as a\n * toggle: clicking activates, clicking again deactivates. While active, the\n * host calls `decoratePrompt()` before each send and merges the returned\n * metadata into the outgoing prompt request. The plugin owns any side state\n * (it is the same Module Federation instance as its other slots).\n */\nexport interface PluginInputActionContribution {\n\tid: string;\n\tlabel: string;\n\t/** Button icon as a React node (not an iconify class string). */\n\ticon?: ReactNode;\n\t/** Whether the action begins in the active state. Defaults to false. */\n\tdefaultActive?: boolean;\n\t/**\n\t * 该输入动作所依赖的 agent 工具名。设置后,仅当该工具在当前会话处于激活(按工具的\n\t * scope_use 解析)时才显示这个 badge——避免在工具被场景屏蔽(如批量任务)时仍显示一个\n\t * 点了也无效的开关。不设则始终显示。例如「图像生成」设为 \"generate_image\"。\n\t */\n\trequiresActiveTool?: string;\n\t/**\n\t * 允许该 toggle 出现的对话场景 slug 列表(镜像工具的 scope_use)。**fail-closed**:\n\t * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现。与 `requiresActiveTool`\n\t * 取「与」:两者都满足才显示。\n\t */\n\tscope_use?: readonly ConversationScenario[];\n\t/**\n\t * When true, this plugin's agent contributions (tools / skills / MCP /\n\t * systemPrompt) and Activity Tabs are hard-isolated: inactive until this\n\t * toggle is on (ADR-0041, knowledgeMode-style). Default false.\n\t */\n\thardIsolation?: boolean;\n\t/**\n\t * Fired when the user toggles the action; `active` is the new state. Return\n\t * `false` when `active` is true to VETO the activation (e.g. the plugin needs\n\t * configuration first) — the toggle stays off. Deactivation can't be vetoed.\n\t */\n\tonToggle?(active: boolean): boolean | void;\n\t/**\n\t * Called by the host before sending while the action is active. The\n\t * returned metadata is merged into the outgoing prompt request.\n\t */\n\tdecoratePrompt?(): PluginPromptDecoration | void;\n}\n\n/**\n * A declarative, serializable descriptor for one card rendered beneath a\n * message. `type` selects a registered card renderer; `key` drives cross-turn\n * dedup (same key across turns = one logical card, shown only under its latest\n * anchor); `payload` carries STABLE REFERENCES (e.g. image ids), not a content\n * snapshot — the renderer resolves live state from it. `title`/`icon` label the\n * card's tab (override the renderer's registration defaults). Rides a tool\n * result's out-of-band `details.cards`; crosses the agent→host boundary, so\n * `icon` is an icon-symbol string, not a node.\n */\nexport interface CardDescriptor {\n\ttype: string;\n\tkey?: string;\n\tpayload?: unknown;\n\ttitle?: string;\n\ticon?: string;\n}\n\n/** A pending (in-flight) tool call handed to a renderer's `pendingFor`. */\nexport interface PluginPendingToolCall {\n\ttoolName: string;\n\targs: Record<string, unknown>;\n}\n\n/**\n * Props for a card renderer. `descriptor` is the card's data; `pending` is true\n * while it was synthesized from an in-flight tool (render a skeleton); `message`\n * is the anchoring conversation message.\n */\nexport interface PluginCardProps {\n\tdescriptor: CardDescriptor;\n\tpending: boolean;\n\tmessage: ConversationMessage;\n}\n\n/**\n * A card renderer registered by a plugin, keyed by `type`. A descriptor whose\n * `type` matches is rendered by `component`. `title`/`icon` are the default tab\n * label/icon (a descriptor may override `title`). `pendingFor`, given an\n * in-flight tool call, returns a provisional descriptor so a skeleton card\n * appears (and claims a tab) before the tool's result lands — or null when this\n * renderer doesn't handle that tool. The `type` must be globally unique across\n * plugins (convention: prefix with the plugin id, e.g. \"image-gen:preview\").\n */\nexport interface PluginCardRendererContribution {\n\ttype: string;\n\tcomponent: ComponentType<PluginCardProps>;\n\ttitle?: string;\n\t/** Default tab icon as a React node (not an iconify class string). */\n\ticon?: ReactNode;\n\tpendingFor?: (toolCall: PluginPendingToolCall) => CardDescriptor | null;\n}\n\n/** A tool call handed to a tool-call slot renderer. */\nexport interface PluginToolCallSlotToolCall {\n\ttoolCallId: string;\n\ttoolName: string;\n\targs: Record<string, unknown>;\n\tstatus: \"pending\" | \"success\" | \"error\";\n\tresult?: string;\n\tisError?: boolean;\n}\n\nexport interface PluginToolCallSlotProps {\n\ttoolCall: PluginToolCallSlotToolCall;\n}\n\n/**\n * A component that **replaces the host's default inline transcript rendering**\n * for a specific tool (matched by `toolName`; first registered renderer wins).\n * This is how a plugin renders rich UI for its OWN agent tool's output — plugin\n * tools cannot emit `details.cards`, so the message card system (registerCardRenderer)\n * does not serve them; the tool-call slot does.\n */\nexport interface PluginToolCallSlotContribution {\n\tid: string;\n\ttoolName: string;\n\tcomponent: ComponentType<PluginToolCallSlotProps>;\n}\n\n/**\n * A card rendered at the bottom of the message list for the LATEST turn — NOT\n * bound to a tool call. The host mounts `component` in the footer slot and\n * re-mounts it each session/turn; the plugin owns visibility entirely (it reads\n * live state via SDK hooks — `useActiveConversation`, `useConversationMessages`,\n * `ctx.conversation.on(\"turn-end\")` — and returns `null` to render nothing,\n * e.g. git renders only inside a repo that has changes). `scope_use` gates which\n * conversation scenarios it may appear in (**fail-closed**, mirrors the other\n * slots). `id` must be unique within the plugin.\n */\nexport interface PluginTurnCardContribution {\n\tid: string;\n\tcomponent: ComponentType;\n\t/**\n\t * 允许该 turn 卡出现的对话场景 slug 列表(镜像其它插槽的 scope_use)。**fail-closed**:\n\t * 未声明/空数组 = 任何会话都不显示;声明后仅在列出的场景里出现(如 `[\"project\"]`)。\n\t */\n\tscope_use?: readonly ConversationScenario[];\n}\n\n/**\n * Options for {@link PluginUiApi.notify}. Surfaces a host toast so users can\n * see plugin failures without opening DevTools.\n */\nexport interface PluginNotifyOptions {\n\t/** Toast body. Required even when `error` is set (user-facing summary). */\n\tmessage: string;\n\t/** Defaults to plugin display name when omitted. */\n\ttitle?: string;\n\t/** Defaults to `\"info\"`; when `error` is set and variant omitted, host uses `\"error\"`. */\n\tvariant?: \"info\" | \"success\" | \"warning\" | \"error\";\n\t/**\n\t * Optional failure cause. Host formats message + stack and adds a\n\t * \"复制堆栈\" action so the user can paste it into bug reports / chat.\n\t */\n\terror?: unknown;\n\t/**\n\t * Auto-dismiss delay in ms. `0` keeps the toast until dismissed.\n\t * Defaults: sticky (`0`) when `error` is present, otherwise host default (~4s).\n\t */\n\tdurationMs?: number;\n}\n\nexport interface PluginUiApi {\n\tregisterGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;\n\t/**\n\t * Register a preview component keyed by file extension. The host dispatches\n\t * registered extensions before its built-in fallback renderers; first\n\t * registrant wins on conflict.\n\t */\n\tregisterFilePreview(contribution: PluginFilePreviewContribution): Disposable;\n\t/**\n\t * Register an activity-panel tab into the addable pool. The user attaches\n\t * it manually via the panel's \"+\" picker; attach records are keyed by the\n\t * session cwd.\n\t */\n\tregisterActivityTab(contribution: PluginActivityTabContribution): Disposable;\n\t/**\n\t * Register a toggle action shown beneath the AI input bar. While active,\n\t * its `decoratePrompt()` annotates the next outgoing prompt.\n\t */\n\tregisterInputAction(contribution: PluginInputActionContribution): Disposable;\n\t/**\n\t * Register a card renderer keyed by `type`. Cards rendered beneath a message\n\t * come from tool results' out-of-band `details.cards` (or `pendingFor` for\n\t * in-flight tools); the host resolves each card's `type` to a registered\n\t * renderer. Multiple cards under one message are shown as a tab-switcher\n\t * (\"收纳\") or a flat list.\n\t */\n\tregisterCardRenderer(contribution: PluginCardRendererContribution): Disposable;\n\t/**\n\t * Register a renderer that replaces the host's default inline transcript UI\n\t * for a tool call (matched by `toolName`). The complement to card renderers:\n\t * use it to render UI for a plugin's own agent tool output.\n\t */\n\tregisterToolCallSlot(contribution: PluginToolCallSlotContribution): Disposable;\n\t/**\n\t * Register a card rendered at the bottom of the message list for the latest\n\t * turn — NOT bound to a tool call. The host mounts the component in the\n\t * footer slot; the plugin owns visibility (return `null` to render nothing,\n\t * e.g. git renders only in a repo with changes). Gated by `scope_use`\n\t * (fail-closed). Needs the `ui.slot.turn-card` permission.\n\t */\n\tregisterTurnCard(contribution: PluginTurnCardContribution): Disposable;\n\t/**\n\t * Programmatically attach (if needed) and activate one of this plugin's\n\t * own activity tabs in the current conversation's activity panel. `tabId`\n\t * is the contribution id passed to registerActivityTab. Any payload (e.g.\n\t * which image to edit) is passed via the plugin's own in-memory state.\n\t *\n\t * Pass `options.width` to size the panel as it opens — a pixel number, or\n\t * `\"max\"` to expand it to the widest the current window allows (the host\n\t * still clamps to its min/max and auto-hides the sidebar when needed). Omit\n\t * to leave the user's current width untouched.\n\t */\n\topenActivityTab(tabId: string, options?: PluginOpenActivityTabOptions): void;\n\t/**\n\t * 把本插件的某个活动面板标签卡在当前会话里上栏 / 下栏,**不激活也不展开\n\t * 面板**——`openActivityTab` 是「用户此刻要看它」,这个是「它现在该不该在\n\t * 栏里」。配合 `initiallyVisible: false` 使用,插件即可完全掌握自己标签卡的\n\t * 出现条件(如 git 只在仓库目录里上栏、工作台跟随输入栏 toggle)。\n\t *\n\t * 上栏记录按会话 cwd 持久化(ADR-0026),所以只需在条件变化时调用一次;\n\t * 用户随后用减号手动隐藏的结果不会被重复调用覆盖。当前没有活动会话时为\n\t * no-op(无处记录),插件应在会话就绪后重新判定。\n\t */\n\tsetActivityTabVisible(tabId: string, visible: boolean): void;\n\t/**\n\t * Bind or clear plugin-owned one-shot context for the next outgoing prompt.\n\t * The host renders its label/icon, merges metadata and hidden instructions,\n\t * then clears it after send or when the user closes the capsule.\n\t */\n\tsetPromptAttachment(attachment: PluginPromptAttachment | null): void;\n\t/**\n\t * Open the host's global full-screen image previewer for the given image.\n\t * Only the image reference (id/url) crosses over — bytes stay out-of-band.\n\t *\n\t * Pass `group` (e.g. all images of the message) to open as an image group:\n\t * the previewer shows a thumbnail strip + arrows and starts at `ref`.\n\t */\n\tpreviewImage(ref: PluginImageRef, group?: PluginImageRef[]): void;\n\t/**\n\t * Open the app settings, scrolled to and highlighting THIS plugin's own\n\t * settings section (e.g. so the user can fill in a required API key/model).\n\t * The host owns the navigation; the plugin only asks to jump there.\n\t */\n\topenPluginSettings(): void;\n\t/**\n\t * Capture a rectangle in the current Vetta window and open the host save\n\t * dialog. Coordinates use renderer DIP values such as getBoundingClientRect().\n\t * Requires `ui.slot.activity-tab`.\n\t */\n\tcaptureRegion(rect: PluginCaptureRegion, defaultFileName: string): Promise<string | null>;\n\t/**\n\t * Show a global toast in the host UI (bottom-right). No permission required.\n\t * Prefer this over swallowing errors into opaque UI copy: pass `error` so\n\t * the host attaches a one-click \"copy stack\" action for the user.\n\t *\n\t * Capture `ctx.ui.notify` in `activate` if React components need it\n\t * (components do not receive `ctx`).\n\t */\n\tnotify(options: PluginNotifyOptions): void;\n}\n"]}
package/dist/ui.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ui.js.map