@vetta-org/plugin-sdk 0.3.4 → 0.3.5
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/hooks.d.ts +8 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +9 -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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ui.d.ts +27 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/docs/manifest.md +10 -6
- package/docs/ui-slots.md +41 -0
- package/package.json +1 -1
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConversationMessage, ConversationState } from "./conversation.js";
|
|
2
2
|
import type { PluginLocales, PluginTranslate } from "./i18n.js";
|
|
3
3
|
import type { PluginPromptAttachment } from "./prompt-attachment.js";
|
|
4
|
+
import type { PluginSidebarState } from "./ui.js";
|
|
4
5
|
export interface PluginI18nContextValue {
|
|
5
6
|
/** This plugin's catalogs, keyed by locale code. */
|
|
6
7
|
locales: PluginLocales;
|
|
@@ -34,4 +35,11 @@ export declare function useConversationMessages(): ConversationMessage[];
|
|
|
34
35
|
* Clears automatically after send, capsule close, or session switch.
|
|
35
36
|
*/
|
|
36
37
|
export declare function usePromptAttachment(): PluginPromptAttachment | null;
|
|
38
|
+
/**
|
|
39
|
+
* Reactive: 宿主左侧侧边栏此刻的形态,变化时自动重渲染。
|
|
40
|
+
*
|
|
41
|
+
* 沉浸式工作区视图尤其需要它:侧边栏收起时宿主页头会长出「展开侧边栏」按钮压在左上角,
|
|
42
|
+
* 视图画在那一带的东西要让位。返回值引用稳定,可直接进 useEffect 依赖。
|
|
43
|
+
*/
|
|
44
|
+
export declare function useSidebarState(): PluginSidebarState;
|
|
37
45
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIlD,MAAM,WAAW,sBAAsB;IACtC,oDAAoD;IACpD,OAAO,EAAE,aAAa,CAAC;IACvB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iDAG9B,CAAC;AAEH,MAAM,WAAW,iBAAiB;IACjC,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,CAAC,EAAE,eAAe,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,CAQlD;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,IAAI,iBAAiB,CAEzD;AAED,oDAAoD;AACpD,wBAAgB,uBAAuB,IAAI,mBAAmB,EAAE,CAE/D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,sBAAsB,GAAG,IAAI,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAEpD","sourcesContent":["import { createContext, useCallback, useContext } from \"react\";\nimport type { ConversationMessage, ConversationState } from \"./conversation.js\";\nimport { requireBridge } from \"./host-bridge.js\";\nimport type { PluginLocales, PluginTranslate } from \"./i18n.js\";\nimport { resolveCatalogKey } from \"./i18n.js\";\nimport type { PluginPromptAttachment } from \"./prompt-attachment.js\";\nimport type { PluginSidebarState } from \"./ui.js\";\n\n// ─── i18n context (host-provided, per plugin) ───\n\nexport interface PluginI18nContextValue {\n\t/** This plugin's catalogs, keyed by locale code. */\n\tlocales: PluginLocales;\n\t/** Fallback locale when a key is missing in the current locale. */\n\tdefaultLocale: string;\n}\n\n/**\n * Internal: the host wraps plugin-rendered components in this context's Provider,\n * carrying THIS plugin's catalogs. Module Federation shares this single SDK\n * instance, so the value the host provides is visible to {@link useTranslation}.\n */\nexport const __PluginI18nContext = createContext<PluginI18nContextValue>({\n\tlocales: {},\n\tdefaultLocale: \"zh\",\n});\n\nexport interface PluginTranslation {\n\t/** The host's current locale code (e.g. \"zh\"). */\n\tlocale: string;\n\t/** Resolve a bare catalog key at the current locale, with optional `{{params}}`. */\n\tt: PluginTranslate;\n}\n\n/**\n * Reactive translation for plugin React components — re-renders when the host\n * language changes. `t` resolves a BARE catalog key (no `%...%` wrapper) against\n * THIS plugin's catalogs; the host provides them via __PluginI18nContext.\n */\nexport function useTranslation(): PluginTranslation {\n\tconst locale = requireBridge().useLocale();\n\tconst { locales, defaultLocale } = useContext(__PluginI18nContext);\n\tconst t = useCallback<PluginTranslate>(\n\t\t(key, params) => resolveCatalogKey(key, locales, locale, defaultLocale, params),\n\t\t[locales, locale, defaultLocale],\n\t);\n\treturn { locale, t };\n}\n\n/** Reactive: the currently-active conversation's state. */\nexport function useActiveConversation(): ConversationState {\n\treturn requireBridge().useActiveConversation();\n}\n\n/** Reactive: the active conversation's messages. */\nexport function useConversationMessages(): ConversationMessage[] {\n\treturn requireBridge().useConversationMessages();\n}\n\n/**\n * Reactive: the plugin-owned one-shot context attached to the next prompt.\n * Clears automatically after send, capsule close, or session switch.\n */\nexport function usePromptAttachment(): PluginPromptAttachment | null {\n\treturn requireBridge().usePromptAttachment();\n}\n\n/**\n * Reactive: 宿主左侧侧边栏此刻的形态,变化时自动重渲染。\n *\n * 沉浸式工作区视图尤其需要它:侧边栏收起时宿主页头会长出「展开侧边栏」按钮压在左上角,\n * 视图画在那一带的东西要让位。返回值引用稳定,可直接进 useEffect 依赖。\n */\nexport function useSidebarState(): PluginSidebarState {\n\treturn requireBridge().useSidebarState();\n}\n"]}
|
package/dist/hooks.js
CHANGED
|
@@ -36,4 +36,13 @@ export function useConversationMessages() {
|
|
|
36
36
|
export function usePromptAttachment() {
|
|
37
37
|
return requireBridge().usePromptAttachment();
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Reactive: 宿主左侧侧边栏此刻的形态,变化时自动重渲染。
|
|
41
|
+
*
|
|
42
|
+
* 沉浸式工作区视图尤其需要它:侧边栏收起时宿主页头会长出「展开侧边栏」按钮压在左上角,
|
|
43
|
+
* 视图画在那一带的东西要让位。返回值引用稳定,可直接进 useEffect 依赖。
|
|
44
|
+
*/
|
|
45
|
+
export function useSidebarState() {
|
|
46
|
+
return requireBridge().useSidebarState();
|
|
47
|
+
}
|
|
39
48
|
//# sourceMappingURL=hooks.js.map
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../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ourcesContent":["import { createContext, useCallback, useContext } from \"react\";\nimport type { ConversationMessage, ConversationState } from \"./conversation.js\";\nimport { requireBridge } from \"./host-bridge.js\";\nimport type { PluginLocales, PluginTranslate } from \"./i18n.js\";\nimport { resolveCatalogKey } from \"./i18n.js\";\nimport type { PluginPromptAttachment } from \"./prompt-attachment.js\";\nimport type { PluginSidebarState } from \"./ui.js\";\n\n// ─── i18n context (host-provided, per plugin) ───\n\nexport interface PluginI18nContextValue {\n\t/** This plugin's catalogs, keyed by locale code. */\n\tlocales: PluginLocales;\n\t/** Fallback locale when a key is missing in the current locale. */\n\tdefaultLocale: string;\n}\n\n/**\n * Internal: the host wraps plugin-rendered components in this context's Provider,\n * carrying THIS plugin's catalogs. Module Federation shares this single SDK\n * instance, so the value the host provides is visible to {@link useTranslation}.\n */\nexport const __PluginI18nContext = createContext<PluginI18nContextValue>({\n\tlocales: {},\n\tdefaultLocale: \"zh\",\n});\n\nexport interface PluginTranslation {\n\t/** The host's current locale code (e.g. \"zh\"). */\n\tlocale: string;\n\t/** Resolve a bare catalog key at the current locale, with optional `{{params}}`. */\n\tt: PluginTranslate;\n}\n\n/**\n * Reactive translation for plugin React components — re-renders when the host\n * language changes. `t` resolves a BARE catalog key (no `%...%` wrapper) against\n * THIS plugin's catalogs; the host provides them via __PluginI18nContext.\n */\nexport function useTranslation(): PluginTranslation {\n\tconst locale = requireBridge().useLocale();\n\tconst { locales, defaultLocale } = useContext(__PluginI18nContext);\n\tconst t = useCallback<PluginTranslate>(\n\t\t(key, params) => resolveCatalogKey(key, locales, locale, defaultLocale, params),\n\t\t[locales, locale, defaultLocale],\n\t);\n\treturn { locale, t };\n}\n\n/** Reactive: the currently-active conversation's state. */\nexport function useActiveConversation(): ConversationState {\n\treturn requireBridge().useActiveConversation();\n}\n\n/** Reactive: the active conversation's messages. */\nexport function useConversationMessages(): ConversationMessage[] {\n\treturn requireBridge().useConversationMessages();\n}\n\n/**\n * Reactive: the plugin-owned one-shot context attached to the next prompt.\n * Clears automatically after send, capsule close, or session switch.\n */\nexport function usePromptAttachment(): PluginPromptAttachment | null {\n\treturn requireBridge().usePromptAttachment();\n}\n\n/**\n * Reactive: 宿主左侧侧边栏此刻的形态,变化时自动重渲染。\n *\n * 沉浸式工作区视图尤其需要它:侧边栏收起时宿主页头会长出「展开侧边栏」按钮压在左上角,\n * 视图画在那一带的东西要让位。返回值引用稳定,可直接进 useEffect 依赖。\n */\nexport function useSidebarState(): PluginSidebarState {\n\treturn requireBridge().useSidebarState();\n}\n"]}
|
package/dist/host-bridge.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ConversationMessage, ConversationState, PluginConversationApi } from "./conversation.js";
|
|
2
2
|
import type { PluginPromptAttachment } from "./prompt-attachment.js";
|
|
3
|
+
import type { PluginSidebarState } from "./ui.js";
|
|
3
4
|
export interface PluginHostBridge {
|
|
4
5
|
useActiveConversation(): ConversationState;
|
|
5
6
|
useConversationMessages(): ConversationMessage[];
|
|
6
7
|
usePromptAttachment(): PluginPromptAttachment | null;
|
|
7
8
|
/** Reactive: the host's current locale code (e.g. "zh"). */
|
|
8
9
|
useLocale(): string;
|
|
10
|
+
/** Reactive: the host sidebar's current shape (collapsed / narrow / visible). */
|
|
11
|
+
useSidebarState(): PluginSidebarState;
|
|
9
12
|
conversation: PluginConversationApi;
|
|
10
13
|
}
|
|
11
14
|
export declare function __setPluginHostBridge(bridge: PluginHostBridge): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-bridge.d.ts","sourceRoot":"","sources":["../src/host-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"host-bridge.d.ts","sourceRoot":"","sources":["../src/host-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAUlD,MAAM,WAAW,gBAAgB;IAChC,qBAAqB,IAAI,iBAAiB,CAAC;IAC3C,uBAAuB,IAAI,mBAAmB,EAAE,CAAC;IACjD,mBAAmB,IAAI,sBAAsB,GAAG,IAAI,CAAC;IACrD,4DAA4D;IAC5D,SAAS,IAAI,MAAM,CAAC;IACpB,iFAAiF;IACjF,eAAe,IAAI,kBAAkB,CAAC;IACtC,YAAY,EAAE,qBAAqB,CAAC;CACpC;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAEpE;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,IAAI,gBAAgB,CAKhD","sourcesContent":["import type { ConversationMessage, ConversationState, PluginConversationApi } from \"./conversation.js\";\nimport type { PluginPromptAttachment } from \"./prompt-attachment.js\";\nimport type { PluginSidebarState } from \"./ui.js\";\n\n// ─── Host bridge ───\n//\n// React hooks and conversation state read the host's jotai store. plugin-sdk\n// cannot depend on desktop-app, so the host injects its implementation at\n// startup (installPluginHostShim → __setPluginHostBridge). Module Federation\n// makes host and plugins share this single pluginSdk instance, so the bridge\n// the host sets is visible to the hooks the plugin calls.\n\nexport interface PluginHostBridge {\n\tuseActiveConversation(): ConversationState;\n\tuseConversationMessages(): ConversationMessage[];\n\tusePromptAttachment(): PluginPromptAttachment | null;\n\t/** Reactive: the host's current locale code (e.g. \"zh\"). */\n\tuseLocale(): string;\n\t/** Reactive: the host sidebar's current shape (collapsed / narrow / visible). */\n\tuseSidebarState(): PluginSidebarState;\n\tconversation: PluginConversationApi;\n}\n\nlet hostBridge: PluginHostBridge | undefined;\n\nexport function __setPluginHostBridge(bridge: PluginHostBridge): void {\n\thostBridge = bridge;\n}\n\n/** Package-internal: throws if the host has not installed the bridge yet. */\nexport function requireBridge(): PluginHostBridge {\n\tif (!hostBridge) {\n\t\tthrow new Error(\"Vetta plugin host bridge is not installed\");\n\t}\n\treturn hostBridge;\n}\n"]}
|
package/dist/host-bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-bridge.js","sourceRoot":"","sources":["../src/host-bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host-bridge.js","sourceRoot":"","sources":["../src/host-bridge.ts"],"names":[],"mappings":"AAuBA,IAAI,UAAwC,CAAC;AAE7C,MAAM,UAAU,qBAAqB,CAAC,MAAwB,EAAQ;IACrE,UAAU,GAAG,MAAM,CAAC;AAAA,CACpB;AAED,6EAA6E;AAC7E,MAAM,UAAU,aAAa,GAAqB;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,UAAU,CAAC;AAAA,CAClB","sourcesContent":["import type { ConversationMessage, ConversationState, PluginConversationApi } from \"./conversation.js\";\nimport type { PluginPromptAttachment } from \"./prompt-attachment.js\";\nimport type { PluginSidebarState } from \"./ui.js\";\n\n// ─── Host bridge ───\n//\n// React hooks and conversation state read the host's jotai store. plugin-sdk\n// cannot depend on desktop-app, so the host injects its implementation at\n// startup (installPluginHostShim → __setPluginHostBridge). Module Federation\n// makes host and plugins share this single pluginSdk instance, so the bridge\n// the host sets is visible to the hooks the plugin calls.\n\nexport interface PluginHostBridge {\n\tuseActiveConversation(): ConversationState;\n\tuseConversationMessages(): ConversationMessage[];\n\tusePromptAttachment(): PluginPromptAttachment | null;\n\t/** Reactive: the host's current locale code (e.g. \"zh\"). */\n\tuseLocale(): string;\n\t/** Reactive: the host sidebar's current shape (collapsed / narrow / visible). */\n\tuseSidebarState(): PluginSidebarState;\n\tconversation: PluginConversationApi;\n}\n\nlet hostBridge: PluginHostBridge | undefined;\n\nexport function __setPluginHostBridge(bridge: PluginHostBridge): void {\n\thostBridge = bridge;\n}\n\n/** Package-internal: throws if the host has not installed the bridge yet. */\nexport function requireBridge(): PluginHostBridge {\n\tif (!hostBridge) {\n\t\tthrow new Error(\"Vetta plugin host bridge is not installed\");\n\t}\n\treturn hostBridge;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { Disposable } from "./disposable.js";
|
|
|
12
12
|
export type { PluginAgentManifest, PluginBrowserManifest, PluginCliProviderManifest, PluginServiceArtifact, PluginServicePlatform, PluginServiceProviderManifest, PluginServiceRuntimeKind, PluginManifest, PluginManifestInput, PluginManifestResourceReference, PluginMcpServerConfig, PluginNetworkManifest, PluginSkillPresentation, PluginSkillPresentationRule, } from "./manifest.js";
|
|
13
13
|
export type { PluginFileExplorerEntry, PluginWorkspaceRoot, PluginFileExplorerWhen, PluginFileExplorerActionContext, PluginFileExplorerContextMenuContribution, PluginFileExplorerToolbarContext, PluginFileExplorerToolbarContribution, PluginFileExplorerDecoration, PluginFileExplorerDecorationProvider, PluginFileExplorerChange, PluginFileExplorerRevealOptions, PluginFileExplorerApi, } from "./file-explorer.js";
|
|
14
14
|
export type { ConversationState, ConversationMessage, ConversationEvent, ConversationQueueState, CreateSessionOptions, PluginConversationApi, SendPromptResult, } from "./conversation.js";
|
|
15
|
-
export type { PluginGlobalSlotContribution, PluginAbilityDetailSlotContribution, PluginAbilityDetailSlotProps, PluginNavBadge, PluginNavBadgeTone, PluginWorkspaceViewProps, PluginWorkspaceViewContribution, PluginWorkspaceViewHeader, PluginAudioMetadata, PluginPreviewUrlOptions, PluginPreviewFile, PluginPreviewFileRef, PluginFilePreviewProps, PluginFilePreviewContribution, PluginActivityTabContribution, PluginActivityTabRetention, PluginActivityTabTargetOptions, PluginCaptureRegion, PluginOpenActivityTabOptions, PluginPromptDecoration, PluginInputActionContribution, PluginNewSessionContext, PluginNewSessionContextActivation, PluginNewSessionContextContribution, PluginNewSessionTarget, CardDescriptor, PluginPendingToolCall, PluginCardProps, PluginCardRendererContribution, PluginToolCallSlotToolCall, PluginToolCallSlotProps, PluginToolCallSlotContribution, PluginTurnCardContribution, PluginNotifyOptions, PluginUiApi, } from "./ui.js";
|
|
15
|
+
export type { PluginGlobalSlotContribution, PluginAbilityDetailSlotContribution, PluginAbilityDetailSlotProps, PluginNavBadge, PluginNavBadgeTone, PluginWorkspaceViewProps, PluginWorkspaceViewContribution, PluginWorkspaceViewHeader, PluginSidebarState, PluginAudioMetadata, PluginPreviewUrlOptions, PluginPreviewFile, PluginPreviewFileRef, PluginFilePreviewProps, PluginFilePreviewContribution, PluginActivityTabContribution, PluginActivityTabRetention, PluginActivityTabTargetOptions, PluginCaptureRegion, PluginOpenActivityTabOptions, PluginPromptDecoration, PluginInputActionContribution, PluginNewSessionContext, PluginNewSessionContextActivation, PluginNewSessionContextContribution, PluginNewSessionTarget, CardDescriptor, PluginPendingToolCall, PluginCardProps, PluginCardRendererContribution, PluginToolCallSlotToolCall, PluginToolCallSlotProps, PluginToolCallSlotContribution, PluginTurnCardContribution, PluginNotifyOptions, PluginUiApi, } from "./ui.js";
|
|
16
16
|
export type { PluginShortcutScopeKind, PluginShortcutWhen, PluginShortcutBinding, PluginShortcutScopeContribution, PluginRegisterShortcutScope, UsePluginShortcutScopeOptions, } from "./shortcuts.js";
|
|
17
17
|
export { usePluginShortcutScope } from "./shortcuts.js";
|
|
18
18
|
export type { PluginJsonSchema, PluginAgentToolApi, PluginAgentToolRegistration, PluginSystemPromptBlock, PluginDynamicSystemPromptOperation, PluginSystemPromptMessage, PluginSystemPromptProviderContext, PluginSystemPromptBlockView, PluginAgentActions, PluginAgentHandlerContext, PluginAgentToolHandler, PluginCodingAgentHookEvent, PluginCodingAgentHookEventName, PluginCodingAgentHookEventOf, PluginCodingAgentHookHandler, PluginCodingAgentHookHandlerContext, PluginCodingAgentHookRegistration, PluginCodingAgentHookResult, PluginCodingAgentHookTool, PluginCodingAgentPermissionMode, PluginSystemPromptProviderHandler, PluginSystemPromptProviderRegistration, PluginContinuationResult, PluginContinuationHandler, PluginContinuationRegistration, PluginAgentApi, } from "./agent.js";
|
|
@@ -50,5 +50,5 @@ export { __setPluginHostBridge } from "./host-bridge.js";
|
|
|
50
50
|
export type { ActivityTabContextValue } from "./activity-tab.js";
|
|
51
51
|
export { __ActivityTabContext, useActivityTab } from "./activity-tab.js";
|
|
52
52
|
export type { PluginI18nContextValue, PluginTranslation } from "./hooks.js";
|
|
53
|
-
export { __PluginI18nContext, useTranslation, useActiveConversation, useConversationMessages, usePromptAttachment, } from "./hooks.js";
|
|
53
|
+
export { __PluginI18nContext, useTranslation, useActiveConversation, useConversationMessages, usePromptAttachment, useSidebarState, } from "./hooks.js";
|
|
54
54
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EACX,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,GAC3B,MAAM,eAAe,CAAC;AAGvB,YAAY,EACX,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,yCAAyC,EACzC,gCAAgC,EAChC,qCAAqC,EACrC,4BAA4B,EAC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yB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,YAAY,EACX,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,aAAa,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGxF,YAAY,EACX,mBAAmB,EACnB,SAAS,EACT,uBAAuB,EACvB,aAAa,EACb,gBAAgB,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGzE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,YAAY,CAAC","sourcesContent":["/**\n * @vetta-org/plugin-sdk public surface.\n *\n * Implementation is split by domain under `src/*.ts`; this barrel re-exports\n * the stable package API. Prefer importing from `@vetta-org/plugin-sdk` rather\n * than deep paths.\n */\n\n// Core primitives\nexport type { ConversationScenario } from \"./scenario.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\nexport type { Disposable } from \"./disposable.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginManifestResourceReference,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n} from \"./manifest.js\";\n\n// File explorer\nexport type {\n\tPluginFileExplorerEntry,\n\tPluginWorkspaceRoot,\n\tPluginFileExplorerWhen,\n\tPluginFileExplorerActionContext,\n\tPluginFileExplorerContextMenuContribution,\n\tPluginFileExplorerToolbarContext,\n\tPluginFileExplorerToolbarContribution,\n\tPluginFileExplorerDecoration,\n\tPluginFileExplorerDecorationProvider,\n\tPluginFileExplorerChange,\n\tPluginFileExplorerRevealOptions,\n\tPluginFileExplorerApi,\n} from \"./file-explorer.js\";\n\n// Conversation\nexport type {\n\tConversationState,\n\tConversationMessage,\n\tConversationEvent,\n\tConversationQueueState,\n\tCreateSessionOptions,\n\tPluginConversationApi,\n\tSendPromptResult,\n} from \"./conversation.js\";\n\n// UI slots\nexport type {\n\tPluginGlobalSlotContribution,\n\tPluginAbilityDetailSlotContribution,\n\tPluginAbilityDetailSlotProps,\n\tPluginNavBadge,\n\tPluginNavBadgeTone,\n\tPluginWorkspaceViewProps,\n\tPluginWorkspaceViewContribution,\n\tPluginWorkspaceViewHeader,\n\tPluginAudioMetadata,\n\tPluginPreviewUrlOptions,\n\tPluginPreviewFile,\n\tPluginPreviewFileRef,\n\tPluginFilePreviewProps,\n\tPluginFilePreviewContribution,\n\tPluginActivityTabContribution,\n\tPluginActivityTabRetention,\n\tPluginActivityTabTargetOptions,\n\tPluginCaptureRegion,\n\tPluginOpenActivityTabOptions,\n\tPluginPromptDecoration,\n\tPluginInputActionContribution,\n\tPluginNewSessionContext,\n\tPluginNewSessionContextActivation,\n\tPluginNewSessionContextContribution,\n\tPluginNewSessionTarget,\n\tCardDescriptor,\n\tPluginPendingToolCall,\n\tPluginCardProps,\n\tPluginCardRendererContribution,\n\tPluginToolCallSlotToolCall,\n\tPluginToolCallSlotProps,\n\tPluginToolCallSlotContribution,\n\tPluginTurnCardContribution,\n\tPluginNotifyOptions,\n\tPluginUiApi,\n} from \"./ui.js\";\n\n// Keyboard shortcuts (host ShortcutScopeStack)\nexport type {\n\tPluginShortcutScopeKind,\n\tPluginShortcutWhen,\n\tPluginShortcutBinding,\n\tPluginShortcutScopeContribution,\n\tPluginRegisterShortcutScope,\n\tUsePluginShortcutScopeOptions,\n} from \"./shortcuts.js\";\nexport { usePluginShortcutScope } from \"./shortcuts.js\";\n\n// Agent runtime\nexport type {\n\tPluginJsonSchema,\n\tPluginAgentToolApi,\n\tPluginAgentToolRegistration,\n\tPluginSystemPromptBlock,\n\tPluginDynamicSystemPromptOperation,\n\tPluginSystemPromptMessage,\n\tPluginSystemPromptProviderContext,\n\tPluginSystemPromptBlockView,\n\tPluginAgentActions,\n\tPluginAgentHandlerContext,\n\tPluginAgentToolHandler,\n\tPluginCodingAgentHookEvent,\n\tPluginCodingAgentHookEventName,\n\tPluginCodingAgentHookEventOf,\n\tPluginCodingAgentHookHandler,\n\tPluginCodingAgentHookHandlerContext,\n\tPluginCodingAgentHookRegistration,\n\tPluginCodingAgentHookResult,\n\tPluginCodingAgentHookTool,\n\tPluginCodingAgentPermissionMode,\n\tPluginSystemPromptProviderHandler,\n\tPluginSystemPromptProviderRegistration,\n\tPluginContinuationResult,\n\tPluginContinuationHandler,\n\tPluginContinuationRegistration,\n\tPluginAgentApi,\n} from \"./agent.js\";\nexport { PLUGIN_CODING_AGENT_HOOK_EVENT_NAMES } from \"./agent.js\";\n\n// App actions\nexport type {\n\tPluginAppActionEffect,\n\tPluginAppActionExample,\n\tPluginAppActionHandlerContext,\n\tPluginAppActionHandler,\n\tPluginAppActionReadyHandler,\n\tPluginAppActionApprovalPresentation,\n\tPluginAppActionApproval,\n\tPluginAppActionRegistration,\n\tPluginAppActionUsage,\n\tPluginAppActionsApi,\n} from \"./app-actions.js\";\nexport { PluginAppActionError } from \"./app-actions.js\";\n\n// Host-managed AI\nexport type {\n\tPluginAiApi,\n\tPluginAiChatAssistantMessage,\n\tPluginAiChatMessage,\n\tPluginAiChatRequest,\n\tPluginAiChatResult,\n\tPluginAiChatTool,\n\tPluginAiChatToolResultMessage,\n\tPluginAiChatUserMessage,\n\tPluginAiCompleteRequest,\n\tPluginAiCompleteResult,\n\tPluginAiStreamOptions,\n\tPluginAiTextDeltaEvent,\n\tPluginAiModel,\n\tPluginAiModelListResult,\n\tPluginAiToolCall,\n\tPluginAiUsage,\n} from \"./ai.js\";\n\n// Official host capabilities\nexport type {\n\tPluginOfficialGeneralSettings,\n\tPluginOfficialGeneralSettingsUpdate,\n\tPluginOfficialExperimentalSettings,\n\tPluginOfficialDownloadItem,\n\tPluginOfficialUpdaterState,\n\tPluginOfficialWebhookKind,\n\tPluginOfficialWebhookEndpoint,\n\tPluginOfficialWebhookProvider,\n\tPluginOfficialWebhookCreateInput,\n\tPluginOfficialWebhookUpdateInput,\n\tPluginOfficialWebhookMessage,\n\tPluginOfficialWebhookSendResult,\n\tPluginOfficialSkillInfo,\n\tPluginOfficialInstalledSkill,\n\tPluginOfficialShortcutBinding,\n\tPluginOfficialQuickPanelSettings,\n\tPluginOfficialImStatus,\n\tPluginOfficialImLog,\n\tPluginOfficialMcpServerSummary,\n\tPluginOfficialMcpServerDetail,\n\tPluginOfficialMcpUpsertData,\n\tPluginOfficialExecutionMode,\n\tPluginOfficialSelectedSkill,\n\tPluginOfficialBatchProjectCreateData,\n\tPluginOfficialBatchProjectUpdateData,\n\tPluginOfficialSchedulerTaskCreateData,\n\tPluginOfficialSchedulerTaskUpdateData,\n\tPluginOfficialModelSummary,\n\tPluginOfficialProviderSummary,\n\tPluginOfficialProviderDetail,\n\tPluginOfficialProviderUpsertData,\n\tPluginOfficialProjectEntry,\n\tPluginOfficialSessionHandle,\n\tPluginOfficialNavigationOpenInput,\n\tPluginOfficialOpenFilesOptions,\n\tPluginOfficialOpenedFile,\n\tPluginOfficialSessionAccess,\n\tPluginOfficialSessionRunningEvent,\n\tPluginOfficialSessionSummary,\n\tPluginOfficialPluginSummary,\n\tPluginOfficialKnowledgeBase,\n\tPluginOfficialKnowledgeProcessingSettings,\n\tPluginOfficialApi,\n} from \"./official.js\";\n\n// Files / command / images / secrets\nexport type {\n\tPluginFsEntry,\n\tPluginFsFileRef,\n\tPluginFsBinaryReadResult,\n\tPluginFsStatResult,\n\tPluginFsReadResult,\n\tPluginFsApi,\n} from \"./fs.js\";\nexport type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnOptions,\n\tPluginCommandSpawnExit,\n\tPluginCommandSpawnStatus,\n\tPluginCommandSpawnHandle,\n\tPluginCommandApi,\n} from \"./command.js\";\nexport type {\n\tPluginCliProviderApi,\n\tPluginCliProviderPhase,\n\tPluginCliProviderStatus,\n} from \"./cli-provider.js\";\nexport type {\n\tPluginServiceApi,\n\tPluginServiceArtifactPayload,\n\tPluginServiceConnection,\n\tPluginServiceHostPlatform,\n\tPluginServicePhase,\n\tPluginServiceRequest,\n\tPluginServiceResponse,\n\tPluginServiceStatus,\n\tPluginServiceDataEncoding,\n} from \"./service-provider.js\";\nexport type { PluginModelDefinition, PluginModelProviderConfig, PluginModelsApi } from \"./models.js\";\nexport type {\n\tPluginBrowserAction,\n\tPluginBrowserActionResult,\n\tPluginBrowserApi,\n\tPluginBrowserPageState,\n\tPluginBrowserProfile,\n\tPluginBrowserRuntimePhase,\n\tPluginBrowserRuntimeStatus,\n\tPluginBrowserScreenshot,\n\tPluginBrowserSession,\n\tPluginBrowserSessionOptions,\n\tPluginBrowserSessionStatus,\n\tPluginBrowserSnapshot,\n\tPluginBrowserSource,\n\tPluginBrowserTextContent,\n} from \"./browser.js\";\nexport type {\n\tPluginCaptureApi,\n\tPluginOffscreenCaptureOptions,\n\tPluginOffscreenCaptureResult,\n} from \"./capture.js\";\nexport type { PluginImageRef } from \"./images.js\";\nexport type {\n\tPluginArtifactDestination,\n\tPluginArtifactRef,\n\tPluginArtifactsApi,\n\tPluginPersistedArtifact,\n} from \"./artifacts.js\";\nexport type {\n\tPluginJob,\n\tPluginJobFailure,\n\tPluginJobProgress,\n\tPluginJobRef,\n\tPluginJobsApi,\n\tPluginJobStatus,\n\tPluginJobWaitOptions,\n} from \"./jobs.js\";\nexport type {\n\tPluginMediaApi,\n\tPluginMediaArtifact,\n\tPluginMediaCapability,\n\tPluginMediaComposeRequest,\n\tPluginMediaDimensions,\n\tPluginMediaErrorCode,\n\tPluginMediaFailure,\n\tPluginMediaGenerateRequest,\n\tPluginMediaGenerationInputSlot,\n\tPluginMediaGenerationMode,\n\tPluginMediaGenerationModeCapability,\n\tPluginMediaInput,\n\tPluginMediaInputSource,\n\tPluginMediaInputUploadRequest,\n\tPluginMediaJob,\n\tPluginMediaKind,\n\tPluginMediaOperation,\n\tPluginMediaOutput,\n\tPluginMediaOutputKind,\n\tPluginMediaProviderDescriptor,\n\tPluginMediaProviderArtifact,\n\tPluginMediaProviderArtifactSource,\n\tPluginMediaProviderHandlerContext,\n\tPluginMediaProviderInput,\n\tPluginMediaProviderJob,\n\tPluginMediaProviderRegistration,\n\tPluginMediaProviderSubmitRequest,\n\tPluginMediaSubmitRequest,\n\tPluginMediaTranscodeRequest,\n\tPluginMediaTransferResponse,\n} from \"./media.js\";\n// OCR Provider protocol\nexport type {\n\tOcrBlock,\n\tOcrClient,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrInput,\n\tOcrProgress,\n\tOcrProviderContext,\n\tOcrProviderDescriptor,\n\tOcrProviderInput,\n\tOcrProviderRegistration,\n\tOcrProviderRequest,\n\tOcrProviderResult,\n\tOcrRequest,\n\tOcrResult,\n\tOcrTransferResponse,\n\tOcrUploadRequest,\n} from \"./ocr.js\";\nexport { PluginMediaError } from \"./media.js\";\nexport type {\n\tPluginPromptAttachment,\n\tPluginPromptContext,\n\tPluginPromptContextJsonValue,\n} from \"./prompt-attachment.js\";\nexport { definePluginPromptContext } from \"./prompt-attachment.js\";\nexport type {\n\tPluginNetworkApi,\n\tPluginNetworkBody,\n\tPluginNetworkRequest,\n\tPluginNetworkResponse,\n} from \"./network.js\";\nexport type { PluginGatewayApi, PluginGatewayRequest, PluginGatewayResponse } from \"./gateway.js\";\nexport type {\n\tPluginPutBlobInput,\n\tPluginPutBlobFromFileInput,\n\tPluginStorageApi,\n\tPluginStorageChange,\n\tPluginStorageCommitOptions,\n\tPluginStorageCommitResult,\n\tPluginStorageEncoding,\n\tPluginStorageSnapshot,\n\tPluginStorageWrite,\n\tPluginStoredBlob,\n\tPluginStoredBlobRef,\n} from \"./storage.js\";\nexport { readJsonFile, writeJsonFile } from \"./storage.js\";\nexport type { PluginSecretsApi } from \"./secrets.js\";\n\n// i18n\nexport type {\n\tPluginLocaleCatalog,\n\tPluginLocales,\n\tPluginTranslate,\n\tPluginI18nApi,\n} from \"./i18n.js\";\nexport { interpolatePluginText, resolveCatalogKey, resolvePluginText } from \"./i18n.js\";\n\n// Context & lifecycle\nexport type {\n\tPluginPermissionApi,\n\tAgentMode,\n\tPluginActivationCleanup,\n\tPluginContext,\n\tPluginDefinition,\n} from \"./context.js\";\nexport { definePlugin } from \"./context.js\";\n\n// Host bridge (host-injected; plugins use hooks)\nexport type { PluginHostBridge } from \"./host-bridge.js\";\nexport { __setPluginHostBridge } from \"./host-bridge.js\";\n\n// Activity tab context\nexport type { ActivityTabContextValue } from \"./activity-tab.js\";\nexport { __ActivityTabContext, useActivityTab } from \"./activity-tab.js\";\n\n// React hooks\nexport type { PluginI18nContextValue, PluginTranslation } from \"./hooks.js\";\nexport {\n\t__PluginI18nContext,\n\tuseTranslation,\n\tuseActiveConversation,\n\tuseConversationMessages,\n\tusePromptAttachment,\n} from \"./hooks.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,Y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E,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGzE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,GACf,MAAM,YAAY,CAAC","sourcesContent":["/**\n * @vetta-org/plugin-sdk public surface.\n *\n * Implementation is split by domain under `src/*.ts`; this barrel re-exports\n * the stable package API. Prefer importing from `@vetta-org/plugin-sdk` rather\n * than deep paths.\n */\n\n// Core primitives\nexport type { ConversationScenario } from \"./scenario.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\nexport type { Disposable } from \"./disposable.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginManifestResourceReference,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n} from \"./manifest.js\";\n\n// File explorer\nexport type {\n\tPluginFileExplorerEntry,\n\tPluginWorkspaceRoot,\n\tPluginFileExplorerWhen,\n\tPluginFileExplorerActionContext,\n\tPluginFileExplorerContextMenuContribution,\n\tPluginFileExplorerToolbarContext,\n\tPluginFileExplorerToolbarContribution,\n\tPluginFileExplorerDecoration,\n\tPluginFileExplorerDecorationProvider,\n\tPluginFileExplorerChange,\n\tPluginFileExplorerRevealOptions,\n\tPluginFileExplorerApi,\n} from \"./file-explorer.js\";\n\n// Conversation\nexport type {\n\tConversationState,\n\tConversationMessage,\n\tConversationEvent,\n\tConversationQueueState,\n\tCreateSessionOptions,\n\tPluginConversationApi,\n\tSendPromptResult,\n} from \"./conversation.js\";\n\n// UI slots\nexport type {\n\tPluginGlobalSlotContribution,\n\tPluginAbilityDetailSlotContribution,\n\tPluginAbilityDetailSlotProps,\n\tPluginNavBadge,\n\tPluginNavBadgeTone,\n\tPluginWorkspaceViewProps,\n\tPluginWorkspaceViewContribution,\n\tPluginWorkspaceViewHeader,\n\tPluginSidebarState,\n\tPluginAudioMetadata,\n\tPluginPreviewUrlOptions,\n\tPluginPreviewFile,\n\tPluginPreviewFileRef,\n\tPluginFilePreviewProps,\n\tPluginFilePreviewContribution,\n\tPluginActivityTabContribution,\n\tPluginActivityTabRetention,\n\tPluginActivityTabTargetOptions,\n\tPluginCaptureRegion,\n\tPluginOpenActivityTabOptions,\n\tPluginPromptDecoration,\n\tPluginInputActionContribution,\n\tPluginNewSessionContext,\n\tPluginNewSessionContextActivation,\n\tPluginNewSessionContextContribution,\n\tPluginNewSessionTarget,\n\tCardDescriptor,\n\tPluginPendingToolCall,\n\tPluginCardProps,\n\tPluginCardRendererContribution,\n\tPluginToolCallSlotToolCall,\n\tPluginToolCallSlotProps,\n\tPluginToolCallSlotContribution,\n\tPluginTurnCardContribution,\n\tPluginNotifyOptions,\n\tPluginUiApi,\n} from \"./ui.js\";\n\n// Keyboard shortcuts (host ShortcutScopeStack)\nexport type {\n\tPluginShortcutScopeKind,\n\tPluginShortcutWhen,\n\tPluginShortcutBinding,\n\tPluginShortcutScopeContribution,\n\tPluginRegisterShortcutScope,\n\tUsePluginShortcutScopeOptions,\n} from \"./shortcuts.js\";\nexport { usePluginShortcutScope } from \"./shortcuts.js\";\n\n// Agent runtime\nexport type {\n\tPluginJsonSchema,\n\tPluginAgentToolApi,\n\tPluginAgentToolRegistration,\n\tPluginSystemPromptBlock,\n\tPluginDynamicSystemPromptOperation,\n\tPluginSystemPromptMessage,\n\tPluginSystemPromptProviderContext,\n\tPluginSystemPromptBlockView,\n\tPluginAgentActions,\n\tPluginAgentHandlerContext,\n\tPluginAgentToolHandler,\n\tPluginCodingAgentHookEvent,\n\tPluginCodingAgentHookEventName,\n\tPluginCodingAgentHookEventOf,\n\tPluginCodingAgentHookHandler,\n\tPluginCodingAgentHookHandlerContext,\n\tPluginCodingAgentHookRegistration,\n\tPluginCodingAgentHookResult,\n\tPluginCodingAgentHookTool,\n\tPluginCodingAgentPermissionMode,\n\tPluginSystemPromptProviderHandler,\n\tPluginSystemPromptProviderRegistration,\n\tPluginContinuationResult,\n\tPluginContinuationHandler,\n\tPluginContinuationRegistration,\n\tPluginAgentApi,\n} from \"./agent.js\";\nexport { PLUGIN_CODING_AGENT_HOOK_EVENT_NAMES } from \"./agent.js\";\n\n// App actions\nexport type {\n\tPluginAppActionEffect,\n\tPluginAppActionExample,\n\tPluginAppActionHandlerContext,\n\tPluginAppActionHandler,\n\tPluginAppActionReadyHandler,\n\tPluginAppActionApprovalPresentation,\n\tPluginAppActionApproval,\n\tPluginAppActionRegistration,\n\tPluginAppActionUsage,\n\tPluginAppActionsApi,\n} from \"./app-actions.js\";\nexport { PluginAppActionError } from \"./app-actions.js\";\n\n// Host-managed AI\nexport type {\n\tPluginAiApi,\n\tPluginAiChatAssistantMessage,\n\tPluginAiChatMessage,\n\tPluginAiChatRequest,\n\tPluginAiChatResult,\n\tPluginAiChatTool,\n\tPluginAiChatToolResultMessage,\n\tPluginAiChatUserMessage,\n\tPluginAiCompleteRequest,\n\tPluginAiCompleteResult,\n\tPluginAiStreamOptions,\n\tPluginAiTextDeltaEvent,\n\tPluginAiModel,\n\tPluginAiModelListResult,\n\tPluginAiToolCall,\n\tPluginAiUsage,\n} from \"./ai.js\";\n\n// Official host capabilities\nexport type {\n\tPluginOfficialGeneralSettings,\n\tPluginOfficialGeneralSettingsUpdate,\n\tPluginOfficialExperimentalSettings,\n\tPluginOfficialDownloadItem,\n\tPluginOfficialUpdaterState,\n\tPluginOfficialWebhookKind,\n\tPluginOfficialWebhookEndpoint,\n\tPluginOfficialWebhookProvider,\n\tPluginOfficialWebhookCreateInput,\n\tPluginOfficialWebhookUpdateInput,\n\tPluginOfficialWebhookMessage,\n\tPluginOfficialWebhookSendResult,\n\tPluginOfficialSkillInfo,\n\tPluginOfficialInstalledSkill,\n\tPluginOfficialShortcutBinding,\n\tPluginOfficialQuickPanelSettings,\n\tPluginOfficialImStatus,\n\tPluginOfficialImLog,\n\tPluginOfficialMcpServerSummary,\n\tPluginOfficialMcpServerDetail,\n\tPluginOfficialMcpUpsertData,\n\tPluginOfficialExecutionMode,\n\tPluginOfficialSelectedSkill,\n\tPluginOfficialBatchProjectCreateData,\n\tPluginOfficialBatchProjectUpdateData,\n\tPluginOfficialSchedulerTaskCreateData,\n\tPluginOfficialSchedulerTaskUpdateData,\n\tPluginOfficialModelSummary,\n\tPluginOfficialProviderSummary,\n\tPluginOfficialProviderDetail,\n\tPluginOfficialProviderUpsertData,\n\tPluginOfficialProjectEntry,\n\tPluginOfficialSessionHandle,\n\tPluginOfficialNavigationOpenInput,\n\tPluginOfficialOpenFilesOptions,\n\tPluginOfficialOpenedFile,\n\tPluginOfficialSessionAccess,\n\tPluginOfficialSessionRunningEvent,\n\tPluginOfficialSessionSummary,\n\tPluginOfficialPluginSummary,\n\tPluginOfficialKnowledgeBase,\n\tPluginOfficialKnowledgeProcessingSettings,\n\tPluginOfficialApi,\n} from \"./official.js\";\n\n// Files / command / images / secrets\nexport type {\n\tPluginFsEntry,\n\tPluginFsFileRef,\n\tPluginFsBinaryReadResult,\n\tPluginFsStatResult,\n\tPluginFsReadResult,\n\tPluginFsApi,\n} from \"./fs.js\";\nexport type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnOptions,\n\tPluginCommandSpawnExit,\n\tPluginCommandSpawnStatus,\n\tPluginCommandSpawnHandle,\n\tPluginCommandApi,\n} from \"./command.js\";\nexport type {\n\tPluginCliProviderApi,\n\tPluginCliProviderPhase,\n\tPluginCliProviderStatus,\n} from \"./cli-provider.js\";\nexport type {\n\tPluginServiceApi,\n\tPluginServiceArtifactPayload,\n\tPluginServiceConnection,\n\tPluginServiceHostPlatform,\n\tPluginServicePhase,\n\tPluginServiceRequest,\n\tPluginServiceResponse,\n\tPluginServiceStatus,\n\tPluginServiceDataEncoding,\n} from \"./service-provider.js\";\nexport type { PluginModelDefinition, PluginModelProviderConfig, PluginModelsApi } from \"./models.js\";\nexport type {\n\tPluginBrowserAction,\n\tPluginBrowserActionResult,\n\tPluginBrowserApi,\n\tPluginBrowserPageState,\n\tPluginBrowserProfile,\n\tPluginBrowserRuntimePhase,\n\tPluginBrowserRuntimeStatus,\n\tPluginBrowserScreenshot,\n\tPluginBrowserSession,\n\tPluginBrowserSessionOptions,\n\tPluginBrowserSessionStatus,\n\tPluginBrowserSnapshot,\n\tPluginBrowserSource,\n\tPluginBrowserTextContent,\n} from \"./browser.js\";\nexport type {\n\tPluginCaptureApi,\n\tPluginOffscreenCaptureOptions,\n\tPluginOffscreenCaptureResult,\n} from \"./capture.js\";\nexport type { PluginImageRef } from \"./images.js\";\nexport type {\n\tPluginArtifactDestination,\n\tPluginArtifactRef,\n\tPluginArtifactsApi,\n\tPluginPersistedArtifact,\n} from \"./artifacts.js\";\nexport type {\n\tPluginJob,\n\tPluginJobFailure,\n\tPluginJobProgress,\n\tPluginJobRef,\n\tPluginJobsApi,\n\tPluginJobStatus,\n\tPluginJobWaitOptions,\n} from \"./jobs.js\";\nexport type {\n\tPluginMediaApi,\n\tPluginMediaArtifact,\n\tPluginMediaCapability,\n\tPluginMediaComposeRequest,\n\tPluginMediaDimensions,\n\tPluginMediaErrorCode,\n\tPluginMediaFailure,\n\tPluginMediaGenerateRequest,\n\tPluginMediaGenerationInputSlot,\n\tPluginMediaGenerationMode,\n\tPluginMediaGenerationModeCapability,\n\tPluginMediaInput,\n\tPluginMediaInputSource,\n\tPluginMediaInputUploadRequest,\n\tPluginMediaJob,\n\tPluginMediaKind,\n\tPluginMediaOperation,\n\tPluginMediaOutput,\n\tPluginMediaOutputKind,\n\tPluginMediaProviderDescriptor,\n\tPluginMediaProviderArtifact,\n\tPluginMediaProviderArtifactSource,\n\tPluginMediaProviderHandlerContext,\n\tPluginMediaProviderInput,\n\tPluginMediaProviderJob,\n\tPluginMediaProviderRegistration,\n\tPluginMediaProviderSubmitRequest,\n\tPluginMediaSubmitRequest,\n\tPluginMediaTranscodeRequest,\n\tPluginMediaTransferResponse,\n} from \"./media.js\";\n// OCR Provider protocol\nexport type {\n\tOcrBlock,\n\tOcrClient,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrInput,\n\tOcrProgress,\n\tOcrProviderContext,\n\tOcrProviderDescriptor,\n\tOcrProviderInput,\n\tOcrProviderRegistration,\n\tOcrProviderRequest,\n\tOcrProviderResult,\n\tOcrRequest,\n\tOcrResult,\n\tOcrTransferResponse,\n\tOcrUploadRequest,\n} from \"./ocr.js\";\nexport { PluginMediaError } from \"./media.js\";\nexport type {\n\tPluginPromptAttachment,\n\tPluginPromptContext,\n\tPluginPromptContextJsonValue,\n} from \"./prompt-attachment.js\";\nexport { definePluginPromptContext } from \"./prompt-attachment.js\";\nexport type {\n\tPluginNetworkApi,\n\tPluginNetworkBody,\n\tPluginNetworkRequest,\n\tPluginNetworkResponse,\n} from \"./network.js\";\nexport type { PluginGatewayApi, PluginGatewayRequest, PluginGatewayResponse } from \"./gateway.js\";\nexport type {\n\tPluginPutBlobInput,\n\tPluginPutBlobFromFileInput,\n\tPluginStorageApi,\n\tPluginStorageChange,\n\tPluginStorageCommitOptions,\n\tPluginStorageCommitResult,\n\tPluginStorageEncoding,\n\tPluginStorageSnapshot,\n\tPluginStorageWrite,\n\tPluginStoredBlob,\n\tPluginStoredBlobRef,\n} from \"./storage.js\";\nexport { readJsonFile, writeJsonFile } from \"./storage.js\";\nexport type { PluginSecretsApi } from \"./secrets.js\";\n\n// i18n\nexport type {\n\tPluginLocaleCatalog,\n\tPluginLocales,\n\tPluginTranslate,\n\tPluginI18nApi,\n} from \"./i18n.js\";\nexport { interpolatePluginText, resolveCatalogKey, resolvePluginText } from \"./i18n.js\";\n\n// Context & lifecycle\nexport type {\n\tPluginPermissionApi,\n\tAgentMode,\n\tPluginActivationCleanup,\n\tPluginContext,\n\tPluginDefinition,\n} from \"./context.js\";\nexport { definePlugin } from \"./context.js\";\n\n// Host bridge (host-injected; plugins use hooks)\nexport type { PluginHostBridge } from \"./host-bridge.js\";\nexport { __setPluginHostBridge } from \"./host-bridge.js\";\n\n// Activity tab context\nexport type { ActivityTabContextValue } from \"./activity-tab.js\";\nexport { __ActivityTabContext, useActivityTab } from \"./activity-tab.js\";\n\n// React hooks\nexport type { PluginI18nContextValue, PluginTranslation } from \"./hooks.js\";\nexport {\n\t__PluginI18nContext,\n\tuseTranslation,\n\tuseActiveConversation,\n\tuseConversationMessages,\n\tusePromptAttachment,\n\tuseSidebarState,\n} from \"./hooks.js\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -16,5 +16,5 @@ export { interpolatePluginText, resolveCatalogKey, resolvePluginText } from "./i
|
|
|
16
16
|
export { definePlugin } from "./context.js";
|
|
17
17
|
export { __setPluginHostBridge } from "./host-bridge.js";
|
|
18
18
|
export { __ActivityTabContext, useActivityTab } from "./activity-tab.js";
|
|
19
|
-
export { __PluginI18nContext, useTranslation, useActiveConversation, useConversationMessages, usePromptAttachment, } from "./hooks.js";
|
|
19
|
+
export { __PluginI18nContext, useTranslation, useActiveConversation, useConversationMessages, usePromptAttachment, useSidebarState, } from "./hooks.js";
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA+FtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AA+BxD,OAAO,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAelE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgMxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAM9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAqBnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAU3D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAUxF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,YAAY,CAAC","sourcesContent":["/**\n * @vetta-org/plugin-sdk public surface.\n *\n * Implementation is split by domain under `src/*.ts`; this barrel re-exports\n * the stable package API. Prefer importing from `@vetta-org/plugin-sdk` rather\n * than deep paths.\n */\n\n// Core primitives\nexport type { ConversationScenario } from \"./scenario.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\nexport type { Disposable } from \"./disposable.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginManifestResourceReference,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n} from \"./manifest.js\";\n\n// File explorer\nexport type {\n\tPluginFileExplorerEntry,\n\tPluginWorkspaceRoot,\n\tPluginFileExplorerWhen,\n\tPluginFileExplorerActionContext,\n\tPluginFileExplorerContextMenuContribution,\n\tPluginFileExplorerToolbarContext,\n\tPluginFileExplorerToolbarContribution,\n\tPluginFileExplorerDecoration,\n\tPluginFileExplorerDecorationProvider,\n\tPluginFileExplorerChange,\n\tPluginFileExplorerRevealOptions,\n\tPluginFileExplorerApi,\n} from \"./file-explorer.js\";\n\n// Conversation\nexport type {\n\tConversationState,\n\tConversationMessage,\n\tConversationEvent,\n\tConversationQueueState,\n\tCreateSessionOptions,\n\tPluginConversationApi,\n\tSendPromptResult,\n} from \"./conversation.js\";\n\n// UI slots\nexport type {\n\tPluginGlobalSlotContribution,\n\tPluginAbilityDetailSlotContribution,\n\tPluginAbilityDetailSlotProps,\n\tPluginNavBadge,\n\tPluginNavBadgeTone,\n\tPluginWorkspaceViewProps,\n\tPluginWorkspaceViewContribution,\n\tPluginWorkspaceViewHeader,\n\tPluginAudioMetadata,\n\tPluginPreviewUrlOptions,\n\tPluginPreviewFile,\n\tPluginPreviewFileRef,\n\tPluginFilePreviewProps,\n\tPluginFilePreviewContribution,\n\tPluginActivityTabContribution,\n\tPluginActivityTabRetention,\n\tPluginActivityTabTargetOptions,\n\tPluginCaptureRegion,\n\tPluginOpenActivityTabOptions,\n\tPluginPromptDecoration,\n\tPluginInputActionContribution,\n\tPluginNewSessionContext,\n\tPluginNewSessionContextActivation,\n\tPluginNewSessionContextContribution,\n\tPluginNewSessionTarget,\n\tCardDescriptor,\n\tPluginPendingToolCall,\n\tPluginCardProps,\n\tPluginCardRendererContribution,\n\tPluginToolCallSlotToolCall,\n\tPluginToolCallSlotProps,\n\tPluginToolCallSlotContribution,\n\tPluginTurnCardContribution,\n\tPluginNotifyOptions,\n\tPluginUiApi,\n} from \"./ui.js\";\n\n// Keyboard shortcuts (host ShortcutScopeStack)\nexport type {\n\tPluginShortcutScopeKind,\n\tPluginShortcutWhen,\n\tPluginShortcutBinding,\n\tPluginShortcutScopeContribution,\n\tPluginRegisterShortcutScope,\n\tUsePluginShortcutScopeOptions,\n} from \"./shortcuts.js\";\nexport { usePluginShortcutScope } from \"./shortcuts.js\";\n\n// Agent runtime\nexport type {\n\tPluginJsonSchema,\n\tPluginAgentToolApi,\n\tPluginAgentToolRegistration,\n\tPluginSystemPromptBlock,\n\tPluginDynamicSystemPromptOperation,\n\tPluginSystemPromptMessage,\n\tPluginSystemPromptProviderContext,\n\tPluginSystemPromptBlockView,\n\tPluginAgentActions,\n\tPluginAgentHandlerContext,\n\tPluginAgentToolHandler,\n\tPluginCodingAgentHookEvent,\n\tPluginCodingAgentHookEventName,\n\tPluginCodingAgentHookEventOf,\n\tPluginCodingAgentHookHandler,\n\tPluginCodingAgentHookHandlerContext,\n\tPluginCodingAgentHookRegistration,\n\tPluginCodingAgentHookResult,\n\tPluginCodingAgentHookTool,\n\tPluginCodingAgentPermissionMode,\n\tPluginSystemPromptProviderHandler,\n\tPluginSystemPromptProviderRegistration,\n\tPluginContinuationResult,\n\tPluginContinuationHandler,\n\tPluginContinuationRegistration,\n\tPluginAgentApi,\n} from \"./agent.js\";\nexport { PLUGIN_CODING_AGENT_HOOK_EVENT_NAMES } from \"./agent.js\";\n\n// App actions\nexport type {\n\tPluginAppActionEffect,\n\tPluginAppActionExample,\n\tPluginAppActionHandlerContext,\n\tPluginAppActionHandler,\n\tPluginAppActionReadyHandler,\n\tPluginAppActionApprovalPresentation,\n\tPluginAppActionApproval,\n\tPluginAppActionRegistration,\n\tPluginAppActionUsage,\n\tPluginAppActionsApi,\n} from \"./app-actions.js\";\nexport { PluginAppActionError } from \"./app-actions.js\";\n\n// Host-managed AI\nexport type {\n\tPluginAiApi,\n\tPluginAiChatAssistantMessage,\n\tPluginAiChatMessage,\n\tPluginAiChatRequest,\n\tPluginAiChatResult,\n\tPluginAiChatTool,\n\tPluginAiChatToolResultMessage,\n\tPluginAiChatUserMessage,\n\tPluginAiCompleteRequest,\n\tPluginAiCompleteResult,\n\tPluginAiStreamOptions,\n\tPluginAiTextDeltaEvent,\n\tPluginAiModel,\n\tPluginAiModelListResult,\n\tPluginAiToolCall,\n\tPluginAiUsage,\n} from \"./ai.js\";\n\n// Official host capabilities\nexport type {\n\tPluginOfficialGeneralSettings,\n\tPluginOfficialGeneralSettingsUpdate,\n\tPluginOfficialExperimentalSettings,\n\tPluginOfficialDownloadItem,\n\tPluginOfficialUpdaterState,\n\tPluginOfficialWebhookKind,\n\tPluginOfficialWebhookEndpoint,\n\tPluginOfficialWebhookProvider,\n\tPluginOfficialWebhookCreateInput,\n\tPluginOfficialWebhookUpdateInput,\n\tPluginOfficialWebhookMessage,\n\tPluginOfficialWebhookSendResult,\n\tPluginOfficialSkillInfo,\n\tPluginOfficialInstalledSkill,\n\tPluginOfficialShortcutBinding,\n\tPluginOfficialQuickPanelSettings,\n\tPluginOfficialImStatus,\n\tPluginOfficialImLog,\n\tPluginOfficialMcpServerSummary,\n\tPluginOfficialMcpServerDetail,\n\tPluginOfficialMcpUpsertData,\n\tPluginOfficialExecutionMode,\n\tPluginOfficialSelectedSkill,\n\tPluginOfficialBatchProjectCreateData,\n\tPluginOfficialBatchProjectUpdateData,\n\tPluginOfficialSchedulerTaskCreateData,\n\tPluginOfficialSchedulerTaskUpdateData,\n\tPluginOfficialModelSummary,\n\tPluginOfficialProviderSummary,\n\tPluginOfficialProviderDetail,\n\tPluginOfficialProviderUpsertData,\n\tPluginOfficialProjectEntry,\n\tPluginOfficialSessionHandle,\n\tPluginOfficialNavigationOpenInput,\n\tPluginOfficialOpenFilesOptions,\n\tPluginOfficialOpenedFile,\n\tPluginOfficialSessionAccess,\n\tPluginOfficialSessionRunningEvent,\n\tPluginOfficialSessionSummary,\n\tPluginOfficialPluginSummary,\n\tPluginOfficialKnowledgeBase,\n\tPluginOfficialKnowledgeProcessingSettings,\n\tPluginOfficialApi,\n} from \"./official.js\";\n\n// Files / command / images / secrets\nexport type {\n\tPluginFsEntry,\n\tPluginFsFileRef,\n\tPluginFsBinaryReadResult,\n\tPluginFsStatResult,\n\tPluginFsReadResult,\n\tPluginFsApi,\n} from \"./fs.js\";\nexport type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnOptions,\n\tPluginCommandSpawnExit,\n\tPluginCommandSpawnStatus,\n\tPluginCommandSpawnHandle,\n\tPluginCommandApi,\n} from \"./command.js\";\nexport type {\n\tPluginCliProviderApi,\n\tPluginCliProviderPhase,\n\tPluginCliProviderStatus,\n} from \"./cli-provider.js\";\nexport type {\n\tPluginServiceApi,\n\tPluginServiceArtifactPayload,\n\tPluginServiceConnection,\n\tPluginServiceHostPlatform,\n\tPluginServicePhase,\n\tPluginServiceRequest,\n\tPluginServiceResponse,\n\tPluginServiceStatus,\n\tPluginServiceDataEncoding,\n} from \"./service-provider.js\";\nexport type { PluginModelDefinition, PluginModelProviderConfig, PluginModelsApi } from \"./models.js\";\nexport type {\n\tPluginBrowserAction,\n\tPluginBrowserActionResult,\n\tPluginBrowserApi,\n\tPluginBrowserPageState,\n\tPluginBrowserProfile,\n\tPluginBrowserRuntimePhase,\n\tPluginBrowserRuntimeStatus,\n\tPluginBrowserScreenshot,\n\tPluginBrowserSession,\n\tPluginBrowserSessionOptions,\n\tPluginBrowserSessionStatus,\n\tPluginBrowserSnapshot,\n\tPluginBrowserSource,\n\tPluginBrowserTextContent,\n} from \"./browser.js\";\nexport type {\n\tPluginCaptureApi,\n\tPluginOffscreenCaptureOptions,\n\tPluginOffscreenCaptureResult,\n} from \"./capture.js\";\nexport type { PluginImageRef } from \"./images.js\";\nexport type {\n\tPluginArtifactDestination,\n\tPluginArtifactRef,\n\tPluginArtifactsApi,\n\tPluginPersistedArtifact,\n} from \"./artifacts.js\";\nexport type {\n\tPluginJob,\n\tPluginJobFailure,\n\tPluginJobProgress,\n\tPluginJobRef,\n\tPluginJobsApi,\n\tPluginJobStatus,\n\tPluginJobWaitOptions,\n} from \"./jobs.js\";\nexport type {\n\tPluginMediaApi,\n\tPluginMediaArtifact,\n\tPluginMediaCapability,\n\tPluginMediaComposeRequest,\n\tPluginMediaDimensions,\n\tPluginMediaErrorCode,\n\tPluginMediaFailure,\n\tPluginMediaGenerateRequest,\n\tPluginMediaGenerationInputSlot,\n\tPluginMediaGenerationMode,\n\tPluginMediaGenerationModeCapability,\n\tPluginMediaInput,\n\tPluginMediaInputSource,\n\tPluginMediaInputUploadRequest,\n\tPluginMediaJob,\n\tPluginMediaKind,\n\tPluginMediaOperation,\n\tPluginMediaOutput,\n\tPluginMediaOutputKind,\n\tPluginMediaProviderDescriptor,\n\tPluginMediaProviderArtifact,\n\tPluginMediaProviderArtifactSource,\n\tPluginMediaProviderHandlerContext,\n\tPluginMediaProviderInput,\n\tPluginMediaProviderJob,\n\tPluginMediaProviderRegistration,\n\tPluginMediaProviderSubmitRequest,\n\tPluginMediaSubmitRequest,\n\tPluginMediaTranscodeRequest,\n\tPluginMediaTransferResponse,\n} from \"./media.js\";\n// OCR Provider protocol\nexport type {\n\tOcrBlock,\n\tOcrClient,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrInput,\n\tOcrProgress,\n\tOcrProviderContext,\n\tOcrProviderDescriptor,\n\tOcrProviderInput,\n\tOcrProviderRegistration,\n\tOcrProviderRequest,\n\tOcrProviderResult,\n\tOcrRequest,\n\tOcrResult,\n\tOcrTransferResponse,\n\tOcrUploadRequest,\n} from \"./ocr.js\";\nexport { PluginMediaError } from \"./media.js\";\nexport type {\n\tPluginPromptAttachment,\n\tPluginPromptContext,\n\tPluginPromptContextJsonValue,\n} from \"./prompt-attachment.js\";\nexport { definePluginPromptContext } from \"./prompt-attachment.js\";\nexport type {\n\tPluginNetworkApi,\n\tPluginNetworkBody,\n\tPluginNetworkRequest,\n\tPluginNetworkResponse,\n} from \"./network.js\";\nexport type { PluginGatewayApi, PluginGatewayRequest, PluginGatewayResponse } from \"./gateway.js\";\nexport type {\n\tPluginPutBlobInput,\n\tPluginPutBlobFromFileInput,\n\tPluginStorageApi,\n\tPluginStorageChange,\n\tPluginStorageCommitOptions,\n\tPluginStorageCommitResult,\n\tPluginStorageEncoding,\n\tPluginStorageSnapshot,\n\tPluginStorageWrite,\n\tPluginStoredBlob,\n\tPluginStoredBlobRef,\n} from \"./storage.js\";\nexport { readJsonFile, writeJsonFile } from \"./storage.js\";\nexport type { PluginSecretsApi } from \"./secrets.js\";\n\n// i18n\nexport type {\n\tPluginLocaleCatalog,\n\tPluginLocales,\n\tPluginTranslate,\n\tPluginI18nApi,\n} from \"./i18n.js\";\nexport { interpolatePluginText, resolveCatalogKey, resolvePluginText } from \"./i18n.js\";\n\n// Context & lifecycle\nexport type {\n\tPluginPermissionApi,\n\tAgentMode,\n\tPluginActivationCleanup,\n\tPluginContext,\n\tPluginDefinition,\n} from \"./context.js\";\nexport { definePlugin } from \"./context.js\";\n\n// Host bridge (host-injected; plugins use hooks)\nexport type { PluginHostBridge } from \"./host-bridge.js\";\nexport { __setPluginHostBridge } from \"./host-bridge.js\";\n\n// Activity tab context\nexport type { ActivityTabContextValue } from \"./activity-tab.js\";\nexport { __ActivityTabContext, useActivityTab } from \"./activity-tab.js\";\n\n// React hooks\nexport type { PluginI18nContextValue, PluginTranslation } from \"./hooks.js\";\nexport {\n\t__PluginI18nContext,\n\tuseTranslation,\n\tuseActiveConversation,\n\tuseConversationMessages,\n\tusePromptAttachment,\n} from \"./hooks.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAgGtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AA+BxD,OAAO,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAelE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgMxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAM9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAqBnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAU3D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAUxF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,GACf,MAAM,YAAY,CAAC","sourcesContent":["/**\n * @vetta-org/plugin-sdk public surface.\n *\n * Implementation is split by domain under `src/*.ts`; this barrel re-exports\n * the stable package API. Prefer importing from `@vetta-org/plugin-sdk` rather\n * than deep paths.\n */\n\n// Core primitives\nexport type { ConversationScenario } from \"./scenario.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\nexport type { Disposable } from \"./disposable.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginManifestResourceReference,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n} from \"./manifest.js\";\n\n// File explorer\nexport type {\n\tPluginFileExplorerEntry,\n\tPluginWorkspaceRoot,\n\tPluginFileExplorerWhen,\n\tPluginFileExplorerActionContext,\n\tPluginFileExplorerContextMenuContribution,\n\tPluginFileExplorerToolbarContext,\n\tPluginFileExplorerToolbarContribution,\n\tPluginFileExplorerDecoration,\n\tPluginFileExplorerDecorationProvider,\n\tPluginFileExplorerChange,\n\tPluginFileExplorerRevealOptions,\n\tPluginFileExplorerApi,\n} from \"./file-explorer.js\";\n\n// Conversation\nexport type {\n\tConversationState,\n\tConversationMessage,\n\tConversationEvent,\n\tConversationQueueState,\n\tCreateSessionOptions,\n\tPluginConversationApi,\n\tSendPromptResult,\n} from \"./conversation.js\";\n\n// UI slots\nexport type {\n\tPluginGlobalSlotContribution,\n\tPluginAbilityDetailSlotContribution,\n\tPluginAbilityDetailSlotProps,\n\tPluginNavBadge,\n\tPluginNavBadgeTone,\n\tPluginWorkspaceViewProps,\n\tPluginWorkspaceViewContribution,\n\tPluginWorkspaceViewHeader,\n\tPluginSidebarState,\n\tPluginAudioMetadata,\n\tPluginPreviewUrlOptions,\n\tPluginPreviewFile,\n\tPluginPreviewFileRef,\n\tPluginFilePreviewProps,\n\tPluginFilePreviewContribution,\n\tPluginActivityTabContribution,\n\tPluginActivityTabRetention,\n\tPluginActivityTabTargetOptions,\n\tPluginCaptureRegion,\n\tPluginOpenActivityTabOptions,\n\tPluginPromptDecoration,\n\tPluginInputActionContribution,\n\tPluginNewSessionContext,\n\tPluginNewSessionContextActivation,\n\tPluginNewSessionContextContribution,\n\tPluginNewSessionTarget,\n\tCardDescriptor,\n\tPluginPendingToolCall,\n\tPluginCardProps,\n\tPluginCardRendererContribution,\n\tPluginToolCallSlotToolCall,\n\tPluginToolCallSlotProps,\n\tPluginToolCallSlotContribution,\n\tPluginTurnCardContribution,\n\tPluginNotifyOptions,\n\tPluginUiApi,\n} from \"./ui.js\";\n\n// Keyboard shortcuts (host ShortcutScopeStack)\nexport type {\n\tPluginShortcutScopeKind,\n\tPluginShortcutWhen,\n\tPluginShortcutBinding,\n\tPluginShortcutScopeContribution,\n\tPluginRegisterShortcutScope,\n\tUsePluginShortcutScopeOptions,\n} from \"./shortcuts.js\";\nexport { usePluginShortcutScope } from \"./shortcuts.js\";\n\n// Agent runtime\nexport type {\n\tPluginJsonSchema,\n\tPluginAgentToolApi,\n\tPluginAgentToolRegistration,\n\tPluginSystemPromptBlock,\n\tPluginDynamicSystemPromptOperation,\n\tPluginSystemPromptMessage,\n\tPluginSystemPromptProviderContext,\n\tPluginSystemPromptBlockView,\n\tPluginAgentActions,\n\tPluginAgentHandlerContext,\n\tPluginAgentToolHandler,\n\tPluginCodingAgentHookEvent,\n\tPluginCodingAgentHookEventName,\n\tPluginCodingAgentHookEventOf,\n\tPluginCodingAgentHookHandler,\n\tPluginCodingAgentHookHandlerContext,\n\tPluginCodingAgentHookRegistration,\n\tPluginCodingAgentHookResult,\n\tPluginCodingAgentHookTool,\n\tPluginCodingAgentPermissionMode,\n\tPluginSystemPromptProviderHandler,\n\tPluginSystemPromptProviderRegistration,\n\tPluginContinuationResult,\n\tPluginContinuationHandler,\n\tPluginContinuationRegistration,\n\tPluginAgentApi,\n} from \"./agent.js\";\nexport { PLUGIN_CODING_AGENT_HOOK_EVENT_NAMES } from \"./agent.js\";\n\n// App actions\nexport type {\n\tPluginAppActionEffect,\n\tPluginAppActionExample,\n\tPluginAppActionHandlerContext,\n\tPluginAppActionHandler,\n\tPluginAppActionReadyHandler,\n\tPluginAppActionApprovalPresentation,\n\tPluginAppActionApproval,\n\tPluginAppActionRegistration,\n\tPluginAppActionUsage,\n\tPluginAppActionsApi,\n} from \"./app-actions.js\";\nexport { PluginAppActionError } from \"./app-actions.js\";\n\n// Host-managed AI\nexport type {\n\tPluginAiApi,\n\tPluginAiChatAssistantMessage,\n\tPluginAiChatMessage,\n\tPluginAiChatRequest,\n\tPluginAiChatResult,\n\tPluginAiChatTool,\n\tPluginAiChatToolResultMessage,\n\tPluginAiChatUserMessage,\n\tPluginAiCompleteRequest,\n\tPluginAiCompleteResult,\n\tPluginAiStreamOptions,\n\tPluginAiTextDeltaEvent,\n\tPluginAiModel,\n\tPluginAiModelListResult,\n\tPluginAiToolCall,\n\tPluginAiUsage,\n} from \"./ai.js\";\n\n// Official host capabilities\nexport type {\n\tPluginOfficialGeneralSettings,\n\tPluginOfficialGeneralSettingsUpdate,\n\tPluginOfficialExperimentalSettings,\n\tPluginOfficialDownloadItem,\n\tPluginOfficialUpdaterState,\n\tPluginOfficialWebhookKind,\n\tPluginOfficialWebhookEndpoint,\n\tPluginOfficialWebhookProvider,\n\tPluginOfficialWebhookCreateInput,\n\tPluginOfficialWebhookUpdateInput,\n\tPluginOfficialWebhookMessage,\n\tPluginOfficialWebhookSendResult,\n\tPluginOfficialSkillInfo,\n\tPluginOfficialInstalledSkill,\n\tPluginOfficialShortcutBinding,\n\tPluginOfficialQuickPanelSettings,\n\tPluginOfficialImStatus,\n\tPluginOfficialImLog,\n\tPluginOfficialMcpServerSummary,\n\tPluginOfficialMcpServerDetail,\n\tPluginOfficialMcpUpsertData,\n\tPluginOfficialExecutionMode,\n\tPluginOfficialSelectedSkill,\n\tPluginOfficialBatchProjectCreateData,\n\tPluginOfficialBatchProjectUpdateData,\n\tPluginOfficialSchedulerTaskCreateData,\n\tPluginOfficialSchedulerTaskUpdateData,\n\tPluginOfficialModelSummary,\n\tPluginOfficialProviderSummary,\n\tPluginOfficialProviderDetail,\n\tPluginOfficialProviderUpsertData,\n\tPluginOfficialProjectEntry,\n\tPluginOfficialSessionHandle,\n\tPluginOfficialNavigationOpenInput,\n\tPluginOfficialOpenFilesOptions,\n\tPluginOfficialOpenedFile,\n\tPluginOfficialSessionAccess,\n\tPluginOfficialSessionRunningEvent,\n\tPluginOfficialSessionSummary,\n\tPluginOfficialPluginSummary,\n\tPluginOfficialKnowledgeBase,\n\tPluginOfficialKnowledgeProcessingSettings,\n\tPluginOfficialApi,\n} from \"./official.js\";\n\n// Files / command / images / secrets\nexport type {\n\tPluginFsEntry,\n\tPluginFsFileRef,\n\tPluginFsBinaryReadResult,\n\tPluginFsStatResult,\n\tPluginFsReadResult,\n\tPluginFsApi,\n} from \"./fs.js\";\nexport type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnOptions,\n\tPluginCommandSpawnExit,\n\tPluginCommandSpawnStatus,\n\tPluginCommandSpawnHandle,\n\tPluginCommandApi,\n} from \"./command.js\";\nexport type {\n\tPluginCliProviderApi,\n\tPluginCliProviderPhase,\n\tPluginCliProviderStatus,\n} from \"./cli-provider.js\";\nexport type {\n\tPluginServiceApi,\n\tPluginServiceArtifactPayload,\n\tPluginServiceConnection,\n\tPluginServiceHostPlatform,\n\tPluginServicePhase,\n\tPluginServiceRequest,\n\tPluginServiceResponse,\n\tPluginServiceStatus,\n\tPluginServiceDataEncoding,\n} from \"./service-provider.js\";\nexport type { PluginModelDefinition, PluginModelProviderConfig, PluginModelsApi } from \"./models.js\";\nexport type {\n\tPluginBrowserAction,\n\tPluginBrowserActionResult,\n\tPluginBrowserApi,\n\tPluginBrowserPageState,\n\tPluginBrowserProfile,\n\tPluginBrowserRuntimePhase,\n\tPluginBrowserRuntimeStatus,\n\tPluginBrowserScreenshot,\n\tPluginBrowserSession,\n\tPluginBrowserSessionOptions,\n\tPluginBrowserSessionStatus,\n\tPluginBrowserSnapshot,\n\tPluginBrowserSource,\n\tPluginBrowserTextContent,\n} from \"./browser.js\";\nexport type {\n\tPluginCaptureApi,\n\tPluginOffscreenCaptureOptions,\n\tPluginOffscreenCaptureResult,\n} from \"./capture.js\";\nexport type { PluginImageRef } from \"./images.js\";\nexport type {\n\tPluginArtifactDestination,\n\tPluginArtifactRef,\n\tPluginArtifactsApi,\n\tPluginPersistedArtifact,\n} from \"./artifacts.js\";\nexport type {\n\tPluginJob,\n\tPluginJobFailure,\n\tPluginJobProgress,\n\tPluginJobRef,\n\tPluginJobsApi,\n\tPluginJobStatus,\n\tPluginJobWaitOptions,\n} from \"./jobs.js\";\nexport type {\n\tPluginMediaApi,\n\tPluginMediaArtifact,\n\tPluginMediaCapability,\n\tPluginMediaComposeRequest,\n\tPluginMediaDimensions,\n\tPluginMediaErrorCode,\n\tPluginMediaFailure,\n\tPluginMediaGenerateRequest,\n\tPluginMediaGenerationInputSlot,\n\tPluginMediaGenerationMode,\n\tPluginMediaGenerationModeCapability,\n\tPluginMediaInput,\n\tPluginMediaInputSource,\n\tPluginMediaInputUploadRequest,\n\tPluginMediaJob,\n\tPluginMediaKind,\n\tPluginMediaOperation,\n\tPluginMediaOutput,\n\tPluginMediaOutputKind,\n\tPluginMediaProviderDescriptor,\n\tPluginMediaProviderArtifact,\n\tPluginMediaProviderArtifactSource,\n\tPluginMediaProviderHandlerContext,\n\tPluginMediaProviderInput,\n\tPluginMediaProviderJob,\n\tPluginMediaProviderRegistration,\n\tPluginMediaProviderSubmitRequest,\n\tPluginMediaSubmitRequest,\n\tPluginMediaTranscodeRequest,\n\tPluginMediaTransferResponse,\n} from \"./media.js\";\n// OCR Provider protocol\nexport type {\n\tOcrBlock,\n\tOcrClient,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrInput,\n\tOcrProgress,\n\tOcrProviderContext,\n\tOcrProviderDescriptor,\n\tOcrProviderInput,\n\tOcrProviderRegistration,\n\tOcrProviderRequest,\n\tOcrProviderResult,\n\tOcrRequest,\n\tOcrResult,\n\tOcrTransferResponse,\n\tOcrUploadRequest,\n} from \"./ocr.js\";\nexport { PluginMediaError } from \"./media.js\";\nexport type {\n\tPluginPromptAttachment,\n\tPluginPromptContext,\n\tPluginPromptContextJsonValue,\n} from \"./prompt-attachment.js\";\nexport { definePluginPromptContext } from \"./prompt-attachment.js\";\nexport type {\n\tPluginNetworkApi,\n\tPluginNetworkBody,\n\tPluginNetworkRequest,\n\tPluginNetworkResponse,\n} from \"./network.js\";\nexport type { PluginGatewayApi, PluginGatewayRequest, PluginGatewayResponse } from \"./gateway.js\";\nexport type {\n\tPluginPutBlobInput,\n\tPluginPutBlobFromFileInput,\n\tPluginStorageApi,\n\tPluginStorageChange,\n\tPluginStorageCommitOptions,\n\tPluginStorageCommitResult,\n\tPluginStorageEncoding,\n\tPluginStorageSnapshot,\n\tPluginStorageWrite,\n\tPluginStoredBlob,\n\tPluginStoredBlobRef,\n} from \"./storage.js\";\nexport { readJsonFile, writeJsonFile } from \"./storage.js\";\nexport type { PluginSecretsApi } from \"./secrets.js\";\n\n// i18n\nexport type {\n\tPluginLocaleCatalog,\n\tPluginLocales,\n\tPluginTranslate,\n\tPluginI18nApi,\n} from \"./i18n.js\";\nexport { interpolatePluginText, resolveCatalogKey, resolvePluginText } from \"./i18n.js\";\n\n// Context & lifecycle\nexport type {\n\tPluginPermissionApi,\n\tAgentMode,\n\tPluginActivationCleanup,\n\tPluginContext,\n\tPluginDefinition,\n} from \"./context.js\";\nexport { definePlugin } from \"./context.js\";\n\n// Host bridge (host-injected; plugins use hooks)\nexport type { PluginHostBridge } from \"./host-bridge.js\";\nexport { __setPluginHostBridge } from \"./host-bridge.js\";\n\n// Activity tab context\nexport type { ActivityTabContextValue } from \"./activity-tab.js\";\nexport { __ActivityTabContext, useActivityTab } from \"./activity-tab.js\";\n\n// React hooks\nexport type { PluginI18nContextValue, PluginTranslation } from \"./hooks.js\";\nexport {\n\t__PluginI18nContext,\n\tuseTranslation,\n\tuseActiveConversation,\n\tuseConversationMessages,\n\tusePromptAttachment,\n\tuseSidebarState,\n} from \"./hooks.js\";\n"]}
|
package/dist/ui.d.ts
CHANGED
|
@@ -554,6 +554,19 @@ export interface PluginNewSessionContextContribution {
|
|
|
554
554
|
width?: "input" | "wide";
|
|
555
555
|
render(context: PluginNewSessionContext): ReactNode;
|
|
556
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* 宿主左侧侧边栏此刻的形态。给插件自适应布局用——尤其是沉浸式工作区视图:
|
|
559
|
+
* 侧边栏收起时宿主页头会长出「展开侧边栏」按钮并占住左上角,视图自己画在那一带的
|
|
560
|
+
* 东西需要让位。
|
|
561
|
+
*/
|
|
562
|
+
export interface PluginSidebarState {
|
|
563
|
+
/** 用户手动收起了侧边栏。窄屏下这一位仍然只反映用户意愿,不受窗口宽度影响。 */
|
|
564
|
+
collapsed: boolean;
|
|
565
|
+
/** 窗口窄到侧边栏改走悬浮覆盖,不再占据左侧一栏。 */
|
|
566
|
+
narrow: boolean;
|
|
567
|
+
/** 侧边栏此刻是否实际占着左边那一栏。等价于 `!collapsed && !narrow`,多数自适应只需要这一位。 */
|
|
568
|
+
visible: boolean;
|
|
569
|
+
}
|
|
557
570
|
export interface PluginUiApi {
|
|
558
571
|
registerGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;
|
|
559
572
|
registerAbilityDetailSlot(contribution: PluginAbilityDetailSlotContribution): Disposable;
|
|
@@ -747,5 +760,19 @@ export interface PluginUiApi {
|
|
|
747
760
|
* (components do not receive `ctx`).
|
|
748
761
|
*/
|
|
749
762
|
notify(options: PluginNotifyOptions): void;
|
|
763
|
+
/**
|
|
764
|
+
* 读当前侧边栏形态。无需权限——这是纯布局信息,不含任何用户数据。
|
|
765
|
+
*
|
|
766
|
+
* React 组件请改用 `useSidebarState()`:它会在状态变化时重渲染,不必自己订阅。
|
|
767
|
+
* 这一对只为拿不到 hook 的地方准备(`activate()` 内、工具处理器、命令式绘制的画布)。
|
|
768
|
+
*/
|
|
769
|
+
getSidebarState(): PluginSidebarState;
|
|
770
|
+
/**
|
|
771
|
+
* 订阅侧边栏形态变化——用户收起/展开侧边栏、或窗口跨过窄屏阈值时触发。
|
|
772
|
+
* 返回 Disposable 取消订阅;请在插件失活时释放。
|
|
773
|
+
*
|
|
774
|
+
* 回调按值去重:拖窗口不会把它打成回调风暴,只有三元组真的变了才通知。
|
|
775
|
+
*/
|
|
776
|
+
onSidebarStateChanged(listener: (state: PluginSidebarState) => void): Disposable;
|
|
750
777
|
}
|
|
751
778
|
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAA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,IAAI,CAAC;IACnD;;;;;OAKG;IACH,mBAAmB,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;IACrE;;;;;;OAMG;IACH,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAClE;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;IAC9E;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1F;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC3C","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\";\nimport type { PluginShortcutScopeContribution } from \"./shortcuts.js\";\n\nexport interface PluginGlobalSlotContribution {\n\tid: string;\n\tcomponent: ComponentType;\n}\n\nexport interface PluginAbilityDetailSlotProps {\n\tabilityId: string;\n\tinstalled: boolean;\n\tenabled: boolean;\n}\n\n/** Inline setup/status surface rendered near the top of one ability detail page. */\nexport interface PluginAbilityDetailSlotContribution {\n\tid: string;\n\tabilityId: string;\n\tcomponent: ComponentType<PluginAbilityDetailSlotProps>;\n}\n\n/**\n * Props handed to a workspace-view component. A workspace view owns the whole\n * content area, so unlike panel slots it is addressed by its own route and can\n * be deep-linked; the host passes back its identity so one component can serve\n * several registered views.\n */\nexport interface PluginWorkspaceViewProps {\n\t/** The contribution id as registered (NOT namespaced). */\n\tviewId: string;\n\t/** The owning plugin id. */\n\tpluginId: string;\n}\n\n/**\n * Badge tone. The host maps it to its own theme colors — a plugin cannot pick a\n * raw color, so badges stay consistent with the built-in navigation entries.\n */\nexport type PluginNavBadgeTone = \"accent\" | \"danger\" | \"default\" | \"warning\";\n\n/**\n * A badge on the plugin's sidebar navigation entry.\n *\n * `beta` is the host's own preset — it renders exactly like the built-in\n * 知识库 Beta 标识, wording included (and localized by the host), so plugins do\n * not have to spell \"Beta\" themselves in every locale.\n *\n * `count` renders `99+` past 99 and disappears at 0 — an unread badge showing\n * \"0\" is worse than no badge.\n */\nexport type PluginNavBadge =\n\t| { kind: \"beta\" }\n\t| { kind: \"text\"; text: string; tone?: PluginNavBadgeTone }\n\t| { kind: \"count\"; count: number; tone?: PluginNavBadgeTone }\n\t| { kind: \"dot\"; tone?: PluginNavBadgeTone };\n\n/**\n * A **workspace view**(工作区视图): a full-page surface a plugin contributes to\n * the host's primary navigation. It is the plugin counterpart of a built-in page\n * such as 自动化 / 知识库 — the host gives it its own route\n * (`/workspace/<pluginId>/<viewId>`) and a sidebar entry, and the plugin owns the\n * entire content area while it is open.\n *\n * Use it for standalone workbenches that are NOT bound to one conversation\n * (dashboards, boards, consoles). Conversation-scoped UI belongs in an\n * {@link PluginActivityTabContribution activity tab}; floating UI belongs in a\n * {@link PluginGlobalSlotContribution global slot}.\n */\nexport interface PluginWorkspaceViewContribution {\n\t/** Unique within the plugin; the host namespaces it as `${pluginId}:${id}`. */\n\tid: string;\n\t/** Sidebar entry label. Supports `%catalogKey%` i18n lookup. */\n\tlabel: string;\n\t/**\n\t * Sidebar entry icon as an **iconify class string** (e.g.\n\t * `\"icon-[solar--widget-5-linear]\"`) — NOT a React node, because the host\n\t * renders it inside its own nav button and persists nav layout by key.\n\t *\n\t * Omit it to inherit the plugin's own `plugin.json` icon: a packaged image\n\t * (svg / png / webp …) is masked with the theme's foreground color, so a plugin\n\t * that ships artwork does not have to find a lookalike in an icon set. Set\n\t * {@link PluginWorkspaceViewContribution.iconTint} to `false` to keep its colors.\n\t */\n\ticon?: string;\n\t/**\n\t * Whether an image icon is tinted with the theme's foreground color. Defaults to\n\t * `true`, which keeps the entry consistent with the built-in navigation and legible\n\t * in every theme.\n\t *\n\t * Pass `false` for a full-color logo. Weigh it first: the entry renders at 16px\n\t * beside monochrome built-ins, and a fixed-color image cannot follow the active\n\t * theme — a dark logo can disappear on a dark sidebar. Has no effect on Iconify\n\t * class icons, which are always tinted.\n\t */\n\ticonTint?: boolean;\n\t/** Optional one-line description; shown as the nav entry tooltip. */\n\tdescription?: string;\n\t/**\n\t * Initial badge on the sidebar entry. `{ kind: \"text\" }` supports the same\n\t * `%catalogKey%` i18n lookup as {@link label}. Update it at runtime with\n\t * {@link PluginUiApi.setWorkspaceViewBadge}.\n\t */\n\tbadge?: PluginNavBadge;\n\t/** Zero-props aside from {@link PluginWorkspaceViewProps}. */\n\tcomponent: ComponentType<PluginWorkspaceViewProps>;\n\t/** Sort hint among this plugin's own views (ascending). Defaults to 0. */\n\tnavOrder?: number;\n\t/**\n\t * Whether this view takes a sidebar entry. Defaults to `true`.\n\t *\n\t * Pass `false` for a surface users open occasionally — a setup page, a\n\t * diagnostics console. It then lives only under Settings → More options,\n\t * where the host lists every off-sidebar view and opens it inside the\n\t * settings shell, so switching between such pages stays one click.\n\t *\n\t * The sidebar is a scarce, user-curated space: a plugin that always claims a\n\t * slot pushes the entries someone actually uses into the overflow menu.\n\t */\n\tsidebar?: boolean;\n}\n\n/**\n * What a workspace view puts into the **host page header** — the window's top\n * bar that also carries the drag region, the macOS traffic-light gutter and the\n * sidebar trigger.\n *\n * Without this the header still renders, showing the app name above the\n * plugin's own toolbar — two stacked bars. Set `hideTitle` and move the view's\n * toolbar in here and the surface gets a single, host-consistent header.\n *\n * `left` / `right` are ReactNodes rendered by the host inside that bar (left:\n * right after the sidebar trigger; right: before the window controls). They are\n * rendered in the plugin's i18n + CSS scope, so `useTranslation()` and the\n * plugin's own classes work as usual. Pass fresh nodes whenever the view's\n * state changes — this is a live setter, not a one-time registration.\n */\nexport interface PluginWorkspaceViewHeader {\n\t/** Replaces the host title text. Supports `%catalogKey%` i18n lookup. */\n\ttitle?: string;\n\t/** Drop the host title entirely (use when {@link left} carries its own). */\n\thideTitle?: boolean;\n\t/** Rendered in the header's left cluster, after the sidebar trigger. */\n\tleft?: ReactNode;\n\t/** Rendered in the header's action cluster, before the window controls. */\n\tright?: ReactNode;\n\t/**\n\t * Float the host header OVER the view instead of stacking above it. The view\n\t * then owns the full content height, and its top `~44px` sit under the\n\t * transparent header strip (window drag region / traffic lights / sidebar\n\t * trigger all keep working on top). Use for immersive full-page surfaces\n\t * whose own hero starts at the very top; leave unset for toolbar-style\n\t * headers that need their own opaque row.\n\t */\n\timmersive?: boolean;\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\n/**\n * A file handed to {@link PluginUiApi.previewFile} — the *opening* side of the\n * global previewer, the mirror image of {@link PluginPreviewFile} (which is the\n * *rendering* side). Bytes never cross over: the host reads the source itself.\n *\n * Exactly one of `path` (local absolute path) or `url` (host media / http URL)\n * must be given. `path` is the shape the host's own file tree uses, so the\n * previewer also offers \"在 Finder 中显示\" for it.\n */\nexport interface PluginPreviewFileRef {\n\t/** Local absolute path. Requires the `fs.read` permission. */\n\tpath?: string;\n\t/** Fetchable URL (host media URL or http/https). Requires `ui.slot.message`. */\n\turl?: string;\n\t/**\n\t * Display name **including the extension** — the previewer dispatches to a\n\t * renderer by this extension, not by `mimeType`. Optional for `path`\n\t * sources (the host falls back to the path's basename).\n\t */\n\tname?: string;\n\tmimeType?: string;\n\t/** Byte size, shown in the previewer's download detail when known. */\n\tsize?: number;\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 */\n/** Host residency policy for an activity-panel tab. */\nexport type PluginActivityTabRetention = \"active-only\" | \"warm\" | \"pinned\";\n\nexport interface PluginActivityTabContribution {\n\tid: string;\n\tlabel: string;\n\t/**\n\t * Tab icon as a React node (not an iconify class string).\n\t * Omit to inherit the host-resolved brand icon from `plugin.json#icon`\n\t * (`ctx.plugin.iconUrl`). Prefer omitting for package brand icons so the\n\t * plugin never loads assets via absolute `/…` paths or host protocols.\n\t */\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\t/**\n\t * Component residency while the tab is inactive. Defaults to `\"warm\"`:\n\t * visited tabs stay mounted in the host's bounded LRU cache. Use\n\t * `\"active-only\"` for cheap, stateless content and `\"pinned\"` for runtimes\n\t * that must never be evicted while available.\n\t */\n\tretention?: PluginActivityTabRetention;\n\t/**\n\t * @deprecated Use {@link PluginActivityTabContribution.retention}. `true`\n\t * maps to `\"pinned\"`; `false` maps to `\"active-only\"`.\n\t */\n\tkeepAliveWhenAvailable?: boolean;\n}\n\n/** Explicit conversation scope for an activity-tab command. */\nexport interface PluginActivityTabTargetOptions {\n\t/**\n\t * Absolute cwd whose activity-tab state should be changed. Omit to target\n\t * the conversation currently displayed by the host. Tool handlers and\n\t * background work should pass the triggering session's cwd so a foreground\n\t * navigation change cannot redirect the command to another conversation.\n\t */\n\tcwd?: string;\n}\n\n/** Options for {@link PluginUiApi.openActivityTab}. */\nexport interface PluginOpenActivityTabOptions extends PluginActivityTabTargetOptions {\n\t/**\n\t * Desired panel width as it opens: a pixel number, or `\"max\"` to track the\n\t * widest the window allows — `\"max\"` keeps following window resizes until the\n\t * user drags the divider. The host clamps to its min/max bounds. Omit to keep\n\t * 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\" | \"cancelled\";\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\n/**\n * 新会话上下文区的激活条件。**只能写本插件自己的东西**——填别人的 id 一律不生效。\n *\n * 这条限制是故意的:否则插件 A 可以声明「只要用户选了 B 的智能体我就上屏」,把别人的\n * 使用场景劫持过来。\n *\n * 各字段取并集:任意一条命中即激活。至少要声明一条——全空等于「任何新会话都上屏」,宿主拒掉。\n */\nexport interface PluginNewSessionContextActivation {\n\t/** 本插件在 manifest 里声明的智能体 id(不带 `plugin:` 前缀)。 */\n\tagents?: readonly string[];\n\t/** 本插件在 manifest 里声明的团队 id。省略则任意「含本插件成员的团队」都算命中。 */\n\tteams?: readonly string[];\n\t/** 本插件提供的 skill 名;用户在输入框里提到时命中。 */\n\tskills?: readonly string[];\n\t/** 本插件提供的 MCP server 名。 */\n\tmcpServers?: readonly string[];\n}\n\n/** 用户在新会话页当前选中的对话目标。 */\nexport interface PluginNewSessionTarget {\n\treadonly kind: \"agent\" | \"team\";\n\t/** Agent 档案 id 或团队 id。 */\n\treadonly id: string;\n\t/** 目标若由本插件贡献,这里给出 manifest 里的那个 id。 */\n\treadonly contributedId?: string;\n}\n\n/**\n * 渲染上下文。这是一个**会继续生长的对象**:后续新增字段不会破坏既有插件,所以按需\n * 解构、不要假定它只有这些键。\n */\nexport interface PluginNewSessionContext {\n\treadonly target: PluginNewSessionTarget | null;\n\t/** 输入框里提到的、属于本插件的能力。 */\n\treadonly mentionedAbilities: {\n\t\treadonly skills: readonly string[];\n\t\treadonly mcpServers: readonly string[];\n\t};\n\t/**\n\t * 输入框中尚未发送的文本。需要 `conversation.draft.read` 权限,未授予时恒为空串。\n\t *\n\t * 只在本贡献处于激活状态时提供——插件拿不到「用户随便打点什么」的全程流水。\n\t */\n\treadonly draft: string;\n\t/** 当前工作区目录;未选择项目时为 null。 */\n\treadonly cwd: string | null;\n\t/** 回写输入栏。刻意不提供「直接发送」:越过发送前这道关不属于本区职责。 */\n\treadonly composer: {\n\t\t/** 把资源挂成附件,随下一次发送带走。 */\n\t\tattach(attachment: PluginPromptAttachment): void;\n\t\t/**\n\t\t * 往草稿里插一段文本。始终是插入而非替换,免得抹掉用户已经打的内容。\n\t\t *\n\t\t * `position` 缺省为 `\"end\"`(光标处)。`\"start\"` 插到最前面,适合「先定题、细节\n\t\t * 由用户补」这类写法——用户点完多半光标并不在开头,位置只能由调用方定死。\n\t\t */\n\t\tinsertText(text: string, options?: { position?: \"start\" | \"end\" }): void;\n\t};\n}\n\n/**\n * 新会话页输入框下方的一块内容(`ui.slot.new-session-context`)。\n *\n * 与 input-action 的分工:那是发送前的开关,这是发送前的**上下文**——把用户接下来多半\n * 要用到的素材摆出来。激活与否由宿主按 {@link PluginNewSessionContextActivation} 裁决,\n * 插件只负责在被激活后渲染,因此拿不到用户逐键输入的全程内容。\n *\n * 同时有多个贡献上屏时,宿主会在该区域顶部出 tabbar;只有一个时直接渲染内容。\n */\nexport interface PluginNewSessionContextContribution {\n\tid: string;\n\t/** tabbar 上的标题;只有一个贡献上屏时不展示。 */\n\tlabel: string;\n\t/** tab 图标;省略时用插件自己的图标。 */\n\ticon?: ReactNode;\n\tactivateWhen: PluginNewSessionContextActivation;\n\t/**\n\t * 横向占位。`\"input\"`(默认)与输入框同宽,适合补充说明一类的窄内容;`\"wide\"` 铺满\n\t * 页面可用宽度,留给画廊、素材墙这类「内容本身就是主角」的东西——把它们压在输入框\n\t * 宽度里,每一项都会小到看不清。\n\t */\n\twidth?: \"input\" | \"wide\";\n\trender(context: PluginNewSessionContext): ReactNode;\n}\n\nexport interface PluginUiApi {\n\tregisterGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;\n\tregisterAbilityDetailSlot(contribution: PluginAbilityDetailSlotContribution): Disposable;\n\t/** Render an opaque setup URL as a host-themed PNG data URL. */\n\tcreateQrCode(text: string): Promise<string>;\n\t/**\n\t * Register a **workspace view**(工作区视图)— a full-page surface with its own\n\t * route and sidebar entry, on par with the host's built-in pages. Needs the\n\t * `ui.slot.workspace-view` permission (missing permission = **warn+noop**).\n\t *\n\t * The entry lands in the sidebar's「更多」收纳 by default; the user can pin it\n\t * to the top region or reorder it, and that layout is remembered.\n\t */\n\tregisterWorkspaceView(contribution: PluginWorkspaceViewContribution): Disposable;\n\t/**\n\t * Register a **new-session context block** — content shown beneath the input\n\t * on the new-session page, surfaced only when the user's current selection or\n\t * draft matches {@link PluginNewSessionContextActivation}. Needs the\n\t * `ui.slot.new-session-context` permission (missing permission = **warn+noop**).\n\t */\n\tregisterNewSessionContext(contribution: PluginNewSessionContextContribution): Disposable;\n\t/**\n\t * Navigate to one of this plugin's own workspace views. `viewId` is the\n\t * contribution id passed to {@link PluginUiApi.registerWorkspaceView}. No-op\n\t * when the view is not registered (e.g. permission missing).\n\t */\n\topenWorkspaceView(viewId: string): void;\n\t/**\n\t * Update (or clear, with `null`) the badge on one of this plugin's workspace\n\t * view entries. Re-registering the view is NOT a way to do this — it would\n\t * remount the whole surface — so live badges (unread counts, status dots)\n\t * must come through here.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewBadge(viewId: string, badge: PluginNavBadge | null): void;\n\t/**\n\t * Fill (or clear, with `null`) the host page header while one of this\n\t * plugin's workspace views is open. Call it from the view component (an\n\t * effect that re-runs on state change) and clear it on unmount — the host\n\t * keeps the entry keyed by view, and only applies it on that view's route.\n\t *\n\t * The header itself is never removed: it owns the window drag region and the\n\t * macOS traffic-light gutter. This is how a view takes it over instead.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewHeader(viewId: string, header: PluginWorkspaceViewHeader | null): void;\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 * Register a keyboard shortcut scope on the host's shared ShortcutScopeStack\n\t * (same path as host UI: modal > overlay > surface > app). Needs\n\t * `ui.shortcuts.register`. Plugins cannot use kind `\"app\"` (reserved for\n\t * host-configurable global actions). Prefer {@link usePluginShortcutScope}\n\t * from React components with a module-captured `registerShortcutScope`.\n\t */\n\tregisterShortcutScope(contribution: PluginShortcutScopeContribution): Disposable;\n\t/**\n\t * Programmatically attach (if needed) and activate one of this plugin's\n\t * own activity tabs in a 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\t * Omit `options.cwd` for the conversation currently displayed by the host.\n\t * Tool handlers and background work should pass their session cwd explicitly.\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 * 会话;工具 handler 与后台任务应通过 `options.cwd` 传入自己的会话 cwd。既没有\n\t * 显式 cwd、也没有活动会话时为 no-op(无处记录)。\n\t */\n\tsetActivityTabVisible(tabId: string, visible: boolean, options?: PluginActivityTabTargetOptions): void;\n\t/**\n\t * 直接设置活动面板宽度:像素值,或 `\"max\"` 表示「跟随窗口拉满」(宿主仍会夹到\n\t * 自己的 min/max 内,必要时自动收起侧边栏)。\n\t *\n\t * `\"max\"` 是一种持续状态而非一次性求值:窗口尺寸变化时面板跟着变宽变窄,直到\n\t * 用户拖动分隔条或有人写入具体像素为止。传数字则是一次性的固定宽度。\n\t *\n\t * 与 `openActivityTab(id, { width })` 的区别:那里的宽度只在标签卡首次 attach\n\t * 时生效(避免 activate 重放覆盖用户手拖的宽度);这个是命令式的,每次调用都\n\t * 生效,供插件在自己的标签卡被激活、进入某种视图时按需调整。用户随后仍可拖动。\n\t */\n\tsetActivityPanelWidth(width: number | \"max\"): void;\n\t/**\n\t * Bind or clear plugin-owned context for outgoing prompts. The host renders\n\t * its label/icon and carries a structured `context` as a versioned snapshot.\n\t * Attachments default to one-shot; `lifecycle: \"sticky\"` remains until the\n\t * plugin or user clears 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 host's global file previewer for any file — the general form of\n\t * {@link PluginUiApi.previewImage}, which only takes image URLs. Accepts a\n\t * local absolute `path` (the shape the host's own file tree uses) as well as\n\t * a `url`; the previewer dispatches by the file's extension, so a file type\n\t * some plugin registered via `registerFilePreview` lands in that renderer.\n\t *\n\t * Pass `group` (e.g. all outputs of one run) to open as a group: images get\n\t * the thumbnail strip + arrows, and the previewer starts at `file`.\n\t *\n\t * Permissions: `fs.read` as soon as any entry carries a `path` (it hands a\n\t * local file to the host to read); `ui.slot.message` for url-only calls,\n\t * same gate as `previewImage`.\n\t */\n\tpreviewFile(file: PluginPreviewFileRef, group?: PluginPreviewFileRef[]): 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 * Copy an image to the system clipboard. Takes a `data:image/...;base64,`\n\t * URL and goes through the native clipboard, so it does not depend on the\n\t * renderer's `ClipboardItem` support. No permission required — the plugin\n\t * can only write what it already rendered.\n\t */\n\tcopyImage(dataUrl: string): Promise<void>;\n\t/**\n\t * Hand a URL to the OS default browser (Electron `shell.openExternal`) —\n\t * NOT the in-app browser panel. Only `http:`/`https:` are accepted; the host\n\t * rejects every other protocol, so this cannot be used to launch arbitrary\n\t * schemes. Needs `shell.openExternal`.\n\t */\n\topenExternal(url: string): Promise<void>;\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"]}
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,WAAW,4BAA4B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,oFAAoF;AACpF,MAAM,WAAW,mCAAmC;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;I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aAAa,CAAC,IAAI,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1F;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,eAAe,IAAI,kBAAkB,CAAC;IACtC;;;;;OAKG;IACH,qBAAqB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,UAAU,CAAC;CACjF","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\";\nimport type { PluginShortcutScopeContribution } from \"./shortcuts.js\";\n\nexport interface PluginGlobalSlotContribution {\n\tid: string;\n\tcomponent: ComponentType;\n}\n\nexport interface PluginAbilityDetailSlotProps {\n\tabilityId: string;\n\tinstalled: boolean;\n\tenabled: boolean;\n}\n\n/** Inline setup/status surface rendered near the top of one ability detail page. */\nexport interface PluginAbilityDetailSlotContribution {\n\tid: string;\n\tabilityId: string;\n\tcomponent: ComponentType<PluginAbilityDetailSlotProps>;\n}\n\n/**\n * Props handed to a workspace-view component. A workspace view owns the whole\n * content area, so unlike panel slots it is addressed by its own route and can\n * be deep-linked; the host passes back its identity so one component can serve\n * several registered views.\n */\nexport interface PluginWorkspaceViewProps {\n\t/** The contribution id as registered (NOT namespaced). */\n\tviewId: string;\n\t/** The owning plugin id. */\n\tpluginId: string;\n}\n\n/**\n * Badge tone. The host maps it to its own theme colors — a plugin cannot pick a\n * raw color, so badges stay consistent with the built-in navigation entries.\n */\nexport type PluginNavBadgeTone = \"accent\" | \"danger\" | \"default\" | \"warning\";\n\n/**\n * A badge on the plugin's sidebar navigation entry.\n *\n * `beta` is the host's own preset — it renders exactly like the built-in\n * 知识库 Beta 标识, wording included (and localized by the host), so plugins do\n * not have to spell \"Beta\" themselves in every locale.\n *\n * `count` renders `99+` past 99 and disappears at 0 — an unread badge showing\n * \"0\" is worse than no badge.\n */\nexport type PluginNavBadge =\n\t| { kind: \"beta\" }\n\t| { kind: \"text\"; text: string; tone?: PluginNavBadgeTone }\n\t| { kind: \"count\"; count: number; tone?: PluginNavBadgeTone }\n\t| { kind: \"dot\"; tone?: PluginNavBadgeTone };\n\n/**\n * A **workspace view**(工作区视图): a full-page surface a plugin contributes to\n * the host's primary navigation. It is the plugin counterpart of a built-in page\n * such as 自动化 / 知识库 — the host gives it its own route\n * (`/workspace/<pluginId>/<viewId>`) and a sidebar entry, and the plugin owns the\n * entire content area while it is open.\n *\n * Use it for standalone workbenches that are NOT bound to one conversation\n * (dashboards, boards, consoles). Conversation-scoped UI belongs in an\n * {@link PluginActivityTabContribution activity tab}; floating UI belongs in a\n * {@link PluginGlobalSlotContribution global slot}.\n */\nexport interface PluginWorkspaceViewContribution {\n\t/** Unique within the plugin; the host namespaces it as `${pluginId}:${id}`. */\n\tid: string;\n\t/** Sidebar entry label. Supports `%catalogKey%` i18n lookup. */\n\tlabel: string;\n\t/**\n\t * Sidebar entry icon as an **iconify class string** (e.g.\n\t * `\"icon-[solar--widget-5-linear]\"`) — NOT a React node, because the host\n\t * renders it inside its own nav button and persists nav layout by key.\n\t *\n\t * Omit it to inherit the plugin's own `plugin.json` icon: a packaged image\n\t * (svg / png / webp …) is masked with the theme's foreground color, so a plugin\n\t * that ships artwork does not have to find a lookalike in an icon set. Set\n\t * {@link PluginWorkspaceViewContribution.iconTint} to `false` to keep its colors.\n\t */\n\ticon?: string;\n\t/**\n\t * Whether an image icon is tinted with the theme's foreground color. Defaults to\n\t * `true`, which keeps the entry consistent with the built-in navigation and legible\n\t * in every theme.\n\t *\n\t * Pass `false` for a full-color logo. Weigh it first: the entry renders at 16px\n\t * beside monochrome built-ins, and a fixed-color image cannot follow the active\n\t * theme — a dark logo can disappear on a dark sidebar. Has no effect on Iconify\n\t * class icons, which are always tinted.\n\t */\n\ticonTint?: boolean;\n\t/** Optional one-line description; shown as the nav entry tooltip. */\n\tdescription?: string;\n\t/**\n\t * Initial badge on the sidebar entry. `{ kind: \"text\" }` supports the same\n\t * `%catalogKey%` i18n lookup as {@link label}. Update it at runtime with\n\t * {@link PluginUiApi.setWorkspaceViewBadge}.\n\t */\n\tbadge?: PluginNavBadge;\n\t/** Zero-props aside from {@link PluginWorkspaceViewProps}. */\n\tcomponent: ComponentType<PluginWorkspaceViewProps>;\n\t/** Sort hint among this plugin's own views (ascending). Defaults to 0. */\n\tnavOrder?: number;\n\t/**\n\t * Whether this view takes a sidebar entry. Defaults to `true`.\n\t *\n\t * Pass `false` for a surface users open occasionally — a setup page, a\n\t * diagnostics console. It then lives only under Settings → More options,\n\t * where the host lists every off-sidebar view and opens it inside the\n\t * settings shell, so switching between such pages stays one click.\n\t *\n\t * The sidebar is a scarce, user-curated space: a plugin that always claims a\n\t * slot pushes the entries someone actually uses into the overflow menu.\n\t */\n\tsidebar?: boolean;\n}\n\n/**\n * What a workspace view puts into the **host page header** — the window's top\n * bar that also carries the drag region, the macOS traffic-light gutter and the\n * sidebar trigger.\n *\n * Without this the header still renders, showing the app name above the\n * plugin's own toolbar — two stacked bars. Set `hideTitle` and move the view's\n * toolbar in here and the surface gets a single, host-consistent header.\n *\n * `left` / `right` are ReactNodes rendered by the host inside that bar (left:\n * right after the sidebar trigger; right: before the window controls). They are\n * rendered in the plugin's i18n + CSS scope, so `useTranslation()` and the\n * plugin's own classes work as usual. Pass fresh nodes whenever the view's\n * state changes — this is a live setter, not a one-time registration.\n */\nexport interface PluginWorkspaceViewHeader {\n\t/** Replaces the host title text. Supports `%catalogKey%` i18n lookup. */\n\ttitle?: string;\n\t/** Drop the host title entirely (use when {@link left} carries its own). */\n\thideTitle?: boolean;\n\t/** Rendered in the header's left cluster, after the sidebar trigger. */\n\tleft?: ReactNode;\n\t/** Rendered in the header's action cluster, before the window controls. */\n\tright?: ReactNode;\n\t/**\n\t * Float the host header OVER the view instead of stacking above it. The view\n\t * then owns the full content height, and its top `~44px` sit under the\n\t * transparent header strip (window drag region / traffic lights / sidebar\n\t * trigger all keep working on top). Use for immersive full-page surfaces\n\t * whose own hero starts at the very top; leave unset for toolbar-style\n\t * headers that need their own opaque row.\n\t */\n\timmersive?: boolean;\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\n/**\n * A file handed to {@link PluginUiApi.previewFile} — the *opening* side of the\n * global previewer, the mirror image of {@link PluginPreviewFile} (which is the\n * *rendering* side). Bytes never cross over: the host reads the source itself.\n *\n * Exactly one of `path` (local absolute path) or `url` (host media / http URL)\n * must be given. `path` is the shape the host's own file tree uses, so the\n * previewer also offers \"在 Finder 中显示\" for it.\n */\nexport interface PluginPreviewFileRef {\n\t/** Local absolute path. Requires the `fs.read` permission. */\n\tpath?: string;\n\t/** Fetchable URL (host media URL or http/https). Requires `ui.slot.message`. */\n\turl?: string;\n\t/**\n\t * Display name **including the extension** — the previewer dispatches to a\n\t * renderer by this extension, not by `mimeType`. Optional for `path`\n\t * sources (the host falls back to the path's basename).\n\t */\n\tname?: string;\n\tmimeType?: string;\n\t/** Byte size, shown in the previewer's download detail when known. */\n\tsize?: number;\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 */\n/** Host residency policy for an activity-panel tab. */\nexport type PluginActivityTabRetention = \"active-only\" | \"warm\" | \"pinned\";\n\nexport interface PluginActivityTabContribution {\n\tid: string;\n\tlabel: string;\n\t/**\n\t * Tab icon as a React node (not an iconify class string).\n\t * Omit to inherit the host-resolved brand icon from `plugin.json#icon`\n\t * (`ctx.plugin.iconUrl`). Prefer omitting for package brand icons so the\n\t * plugin never loads assets via absolute `/…` paths or host protocols.\n\t */\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\t/**\n\t * Component residency while the tab is inactive. Defaults to `\"warm\"`:\n\t * visited tabs stay mounted in the host's bounded LRU cache. Use\n\t * `\"active-only\"` for cheap, stateless content and `\"pinned\"` for runtimes\n\t * that must never be evicted while available.\n\t */\n\tretention?: PluginActivityTabRetention;\n\t/**\n\t * @deprecated Use {@link PluginActivityTabContribution.retention}. `true`\n\t * maps to `\"pinned\"`; `false` maps to `\"active-only\"`.\n\t */\n\tkeepAliveWhenAvailable?: boolean;\n}\n\n/** Explicit conversation scope for an activity-tab command. */\nexport interface PluginActivityTabTargetOptions {\n\t/**\n\t * Absolute cwd whose activity-tab state should be changed. Omit to target\n\t * the conversation currently displayed by the host. Tool handlers and\n\t * background work should pass the triggering session's cwd so a foreground\n\t * navigation change cannot redirect the command to another conversation.\n\t */\n\tcwd?: string;\n}\n\n/** Options for {@link PluginUiApi.openActivityTab}. */\nexport interface PluginOpenActivityTabOptions extends PluginActivityTabTargetOptions {\n\t/**\n\t * Desired panel width as it opens: a pixel number, or `\"max\"` to track the\n\t * widest the window allows — `\"max\"` keeps following window resizes until the\n\t * user drags the divider. The host clamps to its min/max bounds. Omit to keep\n\t * 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\" | \"cancelled\";\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\n/**\n * 新会话上下文区的激活条件。**只能写本插件自己的东西**——填别人的 id 一律不生效。\n *\n * 这条限制是故意的:否则插件 A 可以声明「只要用户选了 B 的智能体我就上屏」,把别人的\n * 使用场景劫持过来。\n *\n * 各字段取并集:任意一条命中即激活。至少要声明一条——全空等于「任何新会话都上屏」,宿主拒掉。\n */\nexport interface PluginNewSessionContextActivation {\n\t/** 本插件在 manifest 里声明的智能体 id(不带 `plugin:` 前缀)。 */\n\tagents?: readonly string[];\n\t/** 本插件在 manifest 里声明的团队 id。省略则任意「含本插件成员的团队」都算命中。 */\n\tteams?: readonly string[];\n\t/** 本插件提供的 skill 名;用户在输入框里提到时命中。 */\n\tskills?: readonly string[];\n\t/** 本插件提供的 MCP server 名。 */\n\tmcpServers?: readonly string[];\n}\n\n/** 用户在新会话页当前选中的对话目标。 */\nexport interface PluginNewSessionTarget {\n\treadonly kind: \"agent\" | \"team\";\n\t/** Agent 档案 id 或团队 id。 */\n\treadonly id: string;\n\t/** 目标若由本插件贡献,这里给出 manifest 里的那个 id。 */\n\treadonly contributedId?: string;\n}\n\n/**\n * 渲染上下文。这是一个**会继续生长的对象**:后续新增字段不会破坏既有插件,所以按需\n * 解构、不要假定它只有这些键。\n */\nexport interface PluginNewSessionContext {\n\treadonly target: PluginNewSessionTarget | null;\n\t/** 输入框里提到的、属于本插件的能力。 */\n\treadonly mentionedAbilities: {\n\t\treadonly skills: readonly string[];\n\t\treadonly mcpServers: readonly string[];\n\t};\n\t/**\n\t * 输入框中尚未发送的文本。需要 `conversation.draft.read` 权限,未授予时恒为空串。\n\t *\n\t * 只在本贡献处于激活状态时提供——插件拿不到「用户随便打点什么」的全程流水。\n\t */\n\treadonly draft: string;\n\t/** 当前工作区目录;未选择项目时为 null。 */\n\treadonly cwd: string | null;\n\t/** 回写输入栏。刻意不提供「直接发送」:越过发送前这道关不属于本区职责。 */\n\treadonly composer: {\n\t\t/** 把资源挂成附件,随下一次发送带走。 */\n\t\tattach(attachment: PluginPromptAttachment): void;\n\t\t/**\n\t\t * 往草稿里插一段文本。始终是插入而非替换,免得抹掉用户已经打的内容。\n\t\t *\n\t\t * `position` 缺省为 `\"end\"`(光标处)。`\"start\"` 插到最前面,适合「先定题、细节\n\t\t * 由用户补」这类写法——用户点完多半光标并不在开头,位置只能由调用方定死。\n\t\t */\n\t\tinsertText(text: string, options?: { position?: \"start\" | \"end\" }): void;\n\t};\n}\n\n/**\n * 新会话页输入框下方的一块内容(`ui.slot.new-session-context`)。\n *\n * 与 input-action 的分工:那是发送前的开关,这是发送前的**上下文**——把用户接下来多半\n * 要用到的素材摆出来。激活与否由宿主按 {@link PluginNewSessionContextActivation} 裁决,\n * 插件只负责在被激活后渲染,因此拿不到用户逐键输入的全程内容。\n *\n * 同时有多个贡献上屏时,宿主会在该区域顶部出 tabbar;只有一个时直接渲染内容。\n */\nexport interface PluginNewSessionContextContribution {\n\tid: string;\n\t/** tabbar 上的标题;只有一个贡献上屏时不展示。 */\n\tlabel: string;\n\t/** tab 图标;省略时用插件自己的图标。 */\n\ticon?: ReactNode;\n\tactivateWhen: PluginNewSessionContextActivation;\n\t/**\n\t * 横向占位。`\"input\"`(默认)与输入框同宽,适合补充说明一类的窄内容;`\"wide\"` 铺满\n\t * 页面可用宽度,留给画廊、素材墙这类「内容本身就是主角」的东西——把它们压在输入框\n\t * 宽度里,每一项都会小到看不清。\n\t */\n\twidth?: \"input\" | \"wide\";\n\trender(context: PluginNewSessionContext): ReactNode;\n}\n\n/**\n * 宿主左侧侧边栏此刻的形态。给插件自适应布局用——尤其是沉浸式工作区视图:\n * 侧边栏收起时宿主页头会长出「展开侧边栏」按钮并占住左上角,视图自己画在那一带的\n * 东西需要让位。\n */\nexport interface PluginSidebarState {\n\t/** 用户手动收起了侧边栏。窄屏下这一位仍然只反映用户意愿,不受窗口宽度影响。 */\n\tcollapsed: boolean;\n\t/** 窗口窄到侧边栏改走悬浮覆盖,不再占据左侧一栏。 */\n\tnarrow: boolean;\n\t/** 侧边栏此刻是否实际占着左边那一栏。等价于 `!collapsed && !narrow`,多数自适应只需要这一位。 */\n\tvisible: boolean;\n}\n\nexport interface PluginUiApi {\n\tregisterGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;\n\tregisterAbilityDetailSlot(contribution: PluginAbilityDetailSlotContribution): Disposable;\n\t/** Render an opaque setup URL as a host-themed PNG data URL. */\n\tcreateQrCode(text: string): Promise<string>;\n\t/**\n\t * Register a **workspace view**(工作区视图)— a full-page surface with its own\n\t * route and sidebar entry, on par with the host's built-in pages. Needs the\n\t * `ui.slot.workspace-view` permission (missing permission = **warn+noop**).\n\t *\n\t * The entry lands in the sidebar's「更多」收纳 by default; the user can pin it\n\t * to the top region or reorder it, and that layout is remembered.\n\t */\n\tregisterWorkspaceView(contribution: PluginWorkspaceViewContribution): Disposable;\n\t/**\n\t * Register a **new-session context block** — content shown beneath the input\n\t * on the new-session page, surfaced only when the user's current selection or\n\t * draft matches {@link PluginNewSessionContextActivation}. Needs the\n\t * `ui.slot.new-session-context` permission (missing permission = **warn+noop**).\n\t */\n\tregisterNewSessionContext(contribution: PluginNewSessionContextContribution): Disposable;\n\t/**\n\t * Navigate to one of this plugin's own workspace views. `viewId` is the\n\t * contribution id passed to {@link PluginUiApi.registerWorkspaceView}. No-op\n\t * when the view is not registered (e.g. permission missing).\n\t */\n\topenWorkspaceView(viewId: string): void;\n\t/**\n\t * Update (or clear, with `null`) the badge on one of this plugin's workspace\n\t * view entries. Re-registering the view is NOT a way to do this — it would\n\t * remount the whole surface — so live badges (unread counts, status dots)\n\t * must come through here.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewBadge(viewId: string, badge: PluginNavBadge | null): void;\n\t/**\n\t * Fill (or clear, with `null`) the host page header while one of this\n\t * plugin's workspace views is open. Call it from the view component (an\n\t * effect that re-runs on state change) and clear it on unmount — the host\n\t * keeps the entry keyed by view, and only applies it on that view's route.\n\t *\n\t * The header itself is never removed: it owns the window drag region and the\n\t * macOS traffic-light gutter. This is how a view takes it over instead.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewHeader(viewId: string, header: PluginWorkspaceViewHeader | null): void;\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 * Register a keyboard shortcut scope on the host's shared ShortcutScopeStack\n\t * (same path as host UI: modal > overlay > surface > app). Needs\n\t * `ui.shortcuts.register`. Plugins cannot use kind `\"app\"` (reserved for\n\t * host-configurable global actions). Prefer {@link usePluginShortcutScope}\n\t * from React components with a module-captured `registerShortcutScope`.\n\t */\n\tregisterShortcutScope(contribution: PluginShortcutScopeContribution): Disposable;\n\t/**\n\t * Programmatically attach (if needed) and activate one of this plugin's\n\t * own activity tabs in a 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\t * Omit `options.cwd` for the conversation currently displayed by the host.\n\t * Tool handlers and background work should pass their session cwd explicitly.\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 * 会话;工具 handler 与后台任务应通过 `options.cwd` 传入自己的会话 cwd。既没有\n\t * 显式 cwd、也没有活动会话时为 no-op(无处记录)。\n\t */\n\tsetActivityTabVisible(tabId: string, visible: boolean, options?: PluginActivityTabTargetOptions): void;\n\t/**\n\t * 直接设置活动面板宽度:像素值,或 `\"max\"` 表示「跟随窗口拉满」(宿主仍会夹到\n\t * 自己的 min/max 内,必要时自动收起侧边栏)。\n\t *\n\t * `\"max\"` 是一种持续状态而非一次性求值:窗口尺寸变化时面板跟着变宽变窄,直到\n\t * 用户拖动分隔条或有人写入具体像素为止。传数字则是一次性的固定宽度。\n\t *\n\t * 与 `openActivityTab(id, { width })` 的区别:那里的宽度只在标签卡首次 attach\n\t * 时生效(避免 activate 重放覆盖用户手拖的宽度);这个是命令式的,每次调用都\n\t * 生效,供插件在自己的标签卡被激活、进入某种视图时按需调整。用户随后仍可拖动。\n\t */\n\tsetActivityPanelWidth(width: number | \"max\"): void;\n\t/**\n\t * Bind or clear plugin-owned context for outgoing prompts. The host renders\n\t * its label/icon and carries a structured `context` as a versioned snapshot.\n\t * Attachments default to one-shot; `lifecycle: \"sticky\"` remains until the\n\t * plugin or user clears 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 host's global file previewer for any file — the general form of\n\t * {@link PluginUiApi.previewImage}, which only takes image URLs. Accepts a\n\t * local absolute `path` (the shape the host's own file tree uses) as well as\n\t * a `url`; the previewer dispatches by the file's extension, so a file type\n\t * some plugin registered via `registerFilePreview` lands in that renderer.\n\t *\n\t * Pass `group` (e.g. all outputs of one run) to open as a group: images get\n\t * the thumbnail strip + arrows, and the previewer starts at `file`.\n\t *\n\t * Permissions: `fs.read` as soon as any entry carries a `path` (it hands a\n\t * local file to the host to read); `ui.slot.message` for url-only calls,\n\t * same gate as `previewImage`.\n\t */\n\tpreviewFile(file: PluginPreviewFileRef, group?: PluginPreviewFileRef[]): 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 * Copy an image to the system clipboard. Takes a `data:image/...;base64,`\n\t * URL and goes through the native clipboard, so it does not depend on the\n\t * renderer's `ClipboardItem` support. No permission required — the plugin\n\t * can only write what it already rendered.\n\t */\n\tcopyImage(dataUrl: string): Promise<void>;\n\t/**\n\t * Hand a URL to the OS default browser (Electron `shell.openExternal`) —\n\t * NOT the in-app browser panel. Only `http:`/`https:` are accepted; the host\n\t * rejects every other protocol, so this cannot be used to launch arbitrary\n\t * schemes. Needs `shell.openExternal`.\n\t */\n\topenExternal(url: string): Promise<void>;\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\t/**\n\t * 读当前侧边栏形态。无需权限——这是纯布局信息,不含任何用户数据。\n\t *\n\t * React 组件请改用 `useSidebarState()`:它会在状态变化时重渲染,不必自己订阅。\n\t * 这一对只为拿不到 hook 的地方准备(`activate()` 内、工具处理器、命令式绘制的画布)。\n\t */\n\tgetSidebarState(): PluginSidebarState;\n\t/**\n\t * 订阅侧边栏形态变化——用户收起/展开侧边栏、或窗口跨过窄屏阈值时触发。\n\t * 返回 Disposable 取消订阅;请在插件失活时释放。\n\t *\n\t * 回调按值去重:拖窗口不会把它打成回调风暴,只有三元组真的变了才通知。\n\t */\n\tonSidebarStateChanged(listener: (state: PluginSidebarState) => void): Disposable;\n}\n"]}
|
package/dist/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"","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\";\nimport type { PluginShortcutScopeContribution } from \"./shortcuts.js\";\n\nexport interface PluginGlobalSlotContribution {\n\tid: string;\n\tcomponent: ComponentType;\n}\n\nexport interface PluginAbilityDetailSlotProps {\n\tabilityId: string;\n\tinstalled: boolean;\n\tenabled: boolean;\n}\n\n/** Inline setup/status surface rendered near the top of one ability detail page. */\nexport interface PluginAbilityDetailSlotContribution {\n\tid: string;\n\tabilityId: string;\n\tcomponent: ComponentType<PluginAbilityDetailSlotProps>;\n}\n\n/**\n * Props handed to a workspace-view component. A workspace view owns the whole\n * content area, so unlike panel slots it is addressed by its own route and can\n * be deep-linked; the host passes back its identity so one component can serve\n * several registered views.\n */\nexport interface PluginWorkspaceViewProps {\n\t/** The contribution id as registered (NOT namespaced). */\n\tviewId: string;\n\t/** The owning plugin id. */\n\tpluginId: string;\n}\n\n/**\n * Badge tone. The host maps it to its own theme colors — a plugin cannot pick a\n * raw color, so badges stay consistent with the built-in navigation entries.\n */\nexport type PluginNavBadgeTone = \"accent\" | \"danger\" | \"default\" | \"warning\";\n\n/**\n * A badge on the plugin's sidebar navigation entry.\n *\n * `beta` is the host's own preset — it renders exactly like the built-in\n * 知识库 Beta 标识, wording included (and localized by the host), so plugins do\n * not have to spell \"Beta\" themselves in every locale.\n *\n * `count` renders `99+` past 99 and disappears at 0 — an unread badge showing\n * \"0\" is worse than no badge.\n */\nexport type PluginNavBadge =\n\t| { kind: \"beta\" }\n\t| { kind: \"text\"; text: string; tone?: PluginNavBadgeTone }\n\t| { kind: \"count\"; count: number; tone?: PluginNavBadgeTone }\n\t| { kind: \"dot\"; tone?: PluginNavBadgeTone };\n\n/**\n * A **workspace view**(工作区视图): a full-page surface a plugin contributes to\n * the host's primary navigation. It is the plugin counterpart of a built-in page\n * such as 自动化 / 知识库 — the host gives it its own route\n * (`/workspace/<pluginId>/<viewId>`) and a sidebar entry, and the plugin owns the\n * entire content area while it is open.\n *\n * Use it for standalone workbenches that are NOT bound to one conversation\n * (dashboards, boards, consoles). Conversation-scoped UI belongs in an\n * {@link PluginActivityTabContribution activity tab}; floating UI belongs in a\n * {@link PluginGlobalSlotContribution global slot}.\n */\nexport interface PluginWorkspaceViewContribution {\n\t/** Unique within the plugin; the host namespaces it as `${pluginId}:${id}`. */\n\tid: string;\n\t/** Sidebar entry label. Supports `%catalogKey%` i18n lookup. */\n\tlabel: string;\n\t/**\n\t * Sidebar entry icon as an **iconify class string** (e.g.\n\t * `\"icon-[solar--widget-5-linear]\"`) — NOT a React node, because the host\n\t * renders it inside its own nav button and persists nav layout by key.\n\t *\n\t * Omit it to inherit the plugin's own `plugin.json` icon: a packaged image\n\t * (svg / png / webp …) is masked with the theme's foreground color, so a plugin\n\t * that ships artwork does not have to find a lookalike in an icon set. Set\n\t * {@link PluginWorkspaceViewContribution.iconTint} to `false` to keep its colors.\n\t */\n\ticon?: string;\n\t/**\n\t * Whether an image icon is tinted with the theme's foreground color. Defaults to\n\t * `true`, which keeps the entry consistent with the built-in navigation and legible\n\t * in every theme.\n\t *\n\t * Pass `false` for a full-color logo. Weigh it first: the entry renders at 16px\n\t * beside monochrome built-ins, and a fixed-color image cannot follow the active\n\t * theme — a dark logo can disappear on a dark sidebar. Has no effect on Iconify\n\t * class icons, which are always tinted.\n\t */\n\ticonTint?: boolean;\n\t/** Optional one-line description; shown as the nav entry tooltip. */\n\tdescription?: string;\n\t/**\n\t * Initial badge on the sidebar entry. `{ kind: \"text\" }` supports the same\n\t * `%catalogKey%` i18n lookup as {@link label}. Update it at runtime with\n\t * {@link PluginUiApi.setWorkspaceViewBadge}.\n\t */\n\tbadge?: PluginNavBadge;\n\t/** Zero-props aside from {@link PluginWorkspaceViewProps}. */\n\tcomponent: ComponentType<PluginWorkspaceViewProps>;\n\t/** Sort hint among this plugin's own views (ascending). Defaults to 0. */\n\tnavOrder?: number;\n\t/**\n\t * Whether this view takes a sidebar entry. Defaults to `true`.\n\t *\n\t * Pass `false` for a surface users open occasionally — a setup page, a\n\t * diagnostics console. It then lives only under Settings → More options,\n\t * where the host lists every off-sidebar view and opens it inside the\n\t * settings shell, so switching between such pages stays one click.\n\t *\n\t * The sidebar is a scarce, user-curated space: a plugin that always claims a\n\t * slot pushes the entries someone actually uses into the overflow menu.\n\t */\n\tsidebar?: boolean;\n}\n\n/**\n * What a workspace view puts into the **host page header** — the window's top\n * bar that also carries the drag region, the macOS traffic-light gutter and the\n * sidebar trigger.\n *\n * Without this the header still renders, showing the app name above the\n * plugin's own toolbar — two stacked bars. Set `hideTitle` and move the view's\n * toolbar in here and the surface gets a single, host-consistent header.\n *\n * `left` / `right` are ReactNodes rendered by the host inside that bar (left:\n * right after the sidebar trigger; right: before the window controls). They are\n * rendered in the plugin's i18n + CSS scope, so `useTranslation()` and the\n * plugin's own classes work as usual. Pass fresh nodes whenever the view's\n * state changes — this is a live setter, not a one-time registration.\n */\nexport interface PluginWorkspaceViewHeader {\n\t/** Replaces the host title text. Supports `%catalogKey%` i18n lookup. */\n\ttitle?: string;\n\t/** Drop the host title entirely (use when {@link left} carries its own). */\n\thideTitle?: boolean;\n\t/** Rendered in the header's left cluster, after the sidebar trigger. */\n\tleft?: ReactNode;\n\t/** Rendered in the header's action cluster, before the window controls. */\n\tright?: ReactNode;\n\t/**\n\t * Float the host header OVER the view instead of stacking above it. The view\n\t * then owns the full content height, and its top `~44px` sit under the\n\t * transparent header strip (window drag region / traffic lights / sidebar\n\t * trigger all keep working on top). Use for immersive full-page surfaces\n\t * whose own hero starts at the very top; leave unset for toolbar-style\n\t * headers that need their own opaque row.\n\t */\n\timmersive?: boolean;\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\n/**\n * A file handed to {@link PluginUiApi.previewFile} — the *opening* side of the\n * global previewer, the mirror image of {@link PluginPreviewFile} (which is the\n * *rendering* side). Bytes never cross over: the host reads the source itself.\n *\n * Exactly one of `path` (local absolute path) or `url` (host media / http URL)\n * must be given. `path` is the shape the host's own file tree uses, so the\n * previewer also offers \"在 Finder 中显示\" for it.\n */\nexport interface PluginPreviewFileRef {\n\t/** Local absolute path. Requires the `fs.read` permission. */\n\tpath?: string;\n\t/** Fetchable URL (host media URL or http/https). Requires `ui.slot.message`. */\n\turl?: string;\n\t/**\n\t * Display name **including the extension** — the previewer dispatches to a\n\t * renderer by this extension, not by `mimeType`. Optional for `path`\n\t * sources (the host falls back to the path's basename).\n\t */\n\tname?: string;\n\tmimeType?: string;\n\t/** Byte size, shown in the previewer's download detail when known. */\n\tsize?: number;\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 */\n/** Host residency policy for an activity-panel tab. */\nexport type PluginActivityTabRetention = \"active-only\" | \"warm\" | \"pinned\";\n\nexport interface PluginActivityTabContribution {\n\tid: string;\n\tlabel: string;\n\t/**\n\t * Tab icon as a React node (not an iconify class string).\n\t * Omit to inherit the host-resolved brand icon from `plugin.json#icon`\n\t * (`ctx.plugin.iconUrl`). Prefer omitting for package brand icons so the\n\t * plugin never loads assets via absolute `/…` paths or host protocols.\n\t */\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\t/**\n\t * Component residency while the tab is inactive. Defaults to `\"warm\"`:\n\t * visited tabs stay mounted in the host's bounded LRU cache. Use\n\t * `\"active-only\"` for cheap, stateless content and `\"pinned\"` for runtimes\n\t * that must never be evicted while available.\n\t */\n\tretention?: PluginActivityTabRetention;\n\t/**\n\t * @deprecated Use {@link PluginActivityTabContribution.retention}. `true`\n\t * maps to `\"pinned\"`; `false` maps to `\"active-only\"`.\n\t */\n\tkeepAliveWhenAvailable?: boolean;\n}\n\n/** Explicit conversation scope for an activity-tab command. */\nexport interface PluginActivityTabTargetOptions {\n\t/**\n\t * Absolute cwd whose activity-tab state should be changed. Omit to target\n\t * the conversation currently displayed by the host. Tool handlers and\n\t * background work should pass the triggering session's cwd so a foreground\n\t * navigation change cannot redirect the command to another conversation.\n\t */\n\tcwd?: string;\n}\n\n/** Options for {@link PluginUiApi.openActivityTab}. */\nexport interface PluginOpenActivityTabOptions extends PluginActivityTabTargetOptions {\n\t/**\n\t * Desired panel width as it opens: a pixel number, or `\"max\"` to track the\n\t * widest the window allows — `\"max\"` keeps following window resizes until the\n\t * user drags the divider. The host clamps to its min/max bounds. Omit to keep\n\t * 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\" | \"cancelled\";\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\n/**\n * 新会话上下文区的激活条件。**只能写本插件自己的东西**——填别人的 id 一律不生效。\n *\n * 这条限制是故意的:否则插件 A 可以声明「只要用户选了 B 的智能体我就上屏」,把别人的\n * 使用场景劫持过来。\n *\n * 各字段取并集:任意一条命中即激活。至少要声明一条——全空等于「任何新会话都上屏」,宿主拒掉。\n */\nexport interface PluginNewSessionContextActivation {\n\t/** 本插件在 manifest 里声明的智能体 id(不带 `plugin:` 前缀)。 */\n\tagents?: readonly string[];\n\t/** 本插件在 manifest 里声明的团队 id。省略则任意「含本插件成员的团队」都算命中。 */\n\tteams?: readonly string[];\n\t/** 本插件提供的 skill 名;用户在输入框里提到时命中。 */\n\tskills?: readonly string[];\n\t/** 本插件提供的 MCP server 名。 */\n\tmcpServers?: readonly string[];\n}\n\n/** 用户在新会话页当前选中的对话目标。 */\nexport interface PluginNewSessionTarget {\n\treadonly kind: \"agent\" | \"team\";\n\t/** Agent 档案 id 或团队 id。 */\n\treadonly id: string;\n\t/** 目标若由本插件贡献,这里给出 manifest 里的那个 id。 */\n\treadonly contributedId?: string;\n}\n\n/**\n * 渲染上下文。这是一个**会继续生长的对象**:后续新增字段不会破坏既有插件,所以按需\n * 解构、不要假定它只有这些键。\n */\nexport interface PluginNewSessionContext {\n\treadonly target: PluginNewSessionTarget | null;\n\t/** 输入框里提到的、属于本插件的能力。 */\n\treadonly mentionedAbilities: {\n\t\treadonly skills: readonly string[];\n\t\treadonly mcpServers: readonly string[];\n\t};\n\t/**\n\t * 输入框中尚未发送的文本。需要 `conversation.draft.read` 权限,未授予时恒为空串。\n\t *\n\t * 只在本贡献处于激活状态时提供——插件拿不到「用户随便打点什么」的全程流水。\n\t */\n\treadonly draft: string;\n\t/** 当前工作区目录;未选择项目时为 null。 */\n\treadonly cwd: string | null;\n\t/** 回写输入栏。刻意不提供「直接发送」:越过发送前这道关不属于本区职责。 */\n\treadonly composer: {\n\t\t/** 把资源挂成附件,随下一次发送带走。 */\n\t\tattach(attachment: PluginPromptAttachment): void;\n\t\t/**\n\t\t * 往草稿里插一段文本。始终是插入而非替换,免得抹掉用户已经打的内容。\n\t\t *\n\t\t * `position` 缺省为 `\"end\"`(光标处)。`\"start\"` 插到最前面,适合「先定题、细节\n\t\t * 由用户补」这类写法——用户点完多半光标并不在开头,位置只能由调用方定死。\n\t\t */\n\t\tinsertText(text: string, options?: { position?: \"start\" | \"end\" }): void;\n\t};\n}\n\n/**\n * 新会话页输入框下方的一块内容(`ui.slot.new-session-context`)。\n *\n * 与 input-action 的分工:那是发送前的开关,这是发送前的**上下文**——把用户接下来多半\n * 要用到的素材摆出来。激活与否由宿主按 {@link PluginNewSessionContextActivation} 裁决,\n * 插件只负责在被激活后渲染,因此拿不到用户逐键输入的全程内容。\n *\n * 同时有多个贡献上屏时,宿主会在该区域顶部出 tabbar;只有一个时直接渲染内容。\n */\nexport interface PluginNewSessionContextContribution {\n\tid: string;\n\t/** tabbar 上的标题;只有一个贡献上屏时不展示。 */\n\tlabel: string;\n\t/** tab 图标;省略时用插件自己的图标。 */\n\ticon?: ReactNode;\n\tactivateWhen: PluginNewSessionContextActivation;\n\t/**\n\t * 横向占位。`\"input\"`(默认)与输入框同宽,适合补充说明一类的窄内容;`\"wide\"` 铺满\n\t * 页面可用宽度,留给画廊、素材墙这类「内容本身就是主角」的东西——把它们压在输入框\n\t * 宽度里,每一项都会小到看不清。\n\t */\n\twidth?: \"input\" | \"wide\";\n\trender(context: PluginNewSessionContext): ReactNode;\n}\n\nexport interface PluginUiApi {\n\tregisterGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;\n\tregisterAbilityDetailSlot(contribution: PluginAbilityDetailSlotContribution): Disposable;\n\t/** Render an opaque setup URL as a host-themed PNG data URL. */\n\tcreateQrCode(text: string): Promise<string>;\n\t/**\n\t * Register a **workspace view**(工作区视图)— a full-page surface with its own\n\t * route and sidebar entry, on par with the host's built-in pages. Needs the\n\t * `ui.slot.workspace-view` permission (missing permission = **warn+noop**).\n\t *\n\t * The entry lands in the sidebar's「更多」收纳 by default; the user can pin it\n\t * to the top region or reorder it, and that layout is remembered.\n\t */\n\tregisterWorkspaceView(contribution: PluginWorkspaceViewContribution): Disposable;\n\t/**\n\t * Register a **new-session context block** — content shown beneath the input\n\t * on the new-session page, surfaced only when the user's current selection or\n\t * draft matches {@link PluginNewSessionContextActivation}. Needs the\n\t * `ui.slot.new-session-context` permission (missing permission = **warn+noop**).\n\t */\n\tregisterNewSessionContext(contribution: PluginNewSessionContextContribution): Disposable;\n\t/**\n\t * Navigate to one of this plugin's own workspace views. `viewId` is the\n\t * contribution id passed to {@link PluginUiApi.registerWorkspaceView}. No-op\n\t * when the view is not registered (e.g. permission missing).\n\t */\n\topenWorkspaceView(viewId: string): void;\n\t/**\n\t * Update (or clear, with `null`) the badge on one of this plugin's workspace\n\t * view entries. Re-registering the view is NOT a way to do this — it would\n\t * remount the whole surface — so live badges (unread counts, status dots)\n\t * must come through here.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewBadge(viewId: string, badge: PluginNavBadge | null): void;\n\t/**\n\t * Fill (or clear, with `null`) the host page header while one of this\n\t * plugin's workspace views is open. Call it from the view component (an\n\t * effect that re-runs on state change) and clear it on unmount — the host\n\t * keeps the entry keyed by view, and only applies it on that view's route.\n\t *\n\t * The header itself is never removed: it owns the window drag region and the\n\t * macOS traffic-light gutter. This is how a view takes it over instead.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewHeader(viewId: string, header: PluginWorkspaceViewHeader | null): void;\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 * Register a keyboard shortcut scope on the host's shared ShortcutScopeStack\n\t * (same path as host UI: modal > overlay > surface > app). Needs\n\t * `ui.shortcuts.register`. Plugins cannot use kind `\"app\"` (reserved for\n\t * host-configurable global actions). Prefer {@link usePluginShortcutScope}\n\t * from React components with a module-captured `registerShortcutScope`.\n\t */\n\tregisterShortcutScope(contribution: PluginShortcutScopeContribution): Disposable;\n\t/**\n\t * Programmatically attach (if needed) and activate one of this plugin's\n\t * own activity tabs in a 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\t * Omit `options.cwd` for the conversation currently displayed by the host.\n\t * Tool handlers and background work should pass their session cwd explicitly.\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 * 会话;工具 handler 与后台任务应通过 `options.cwd` 传入自己的会话 cwd。既没有\n\t * 显式 cwd、也没有活动会话时为 no-op(无处记录)。\n\t */\n\tsetActivityTabVisible(tabId: string, visible: boolean, options?: PluginActivityTabTargetOptions): void;\n\t/**\n\t * 直接设置活动面板宽度:像素值,或 `\"max\"` 表示「跟随窗口拉满」(宿主仍会夹到\n\t * 自己的 min/max 内,必要时自动收起侧边栏)。\n\t *\n\t * `\"max\"` 是一种持续状态而非一次性求值:窗口尺寸变化时面板跟着变宽变窄,直到\n\t * 用户拖动分隔条或有人写入具体像素为止。传数字则是一次性的固定宽度。\n\t *\n\t * 与 `openActivityTab(id, { width })` 的区别:那里的宽度只在标签卡首次 attach\n\t * 时生效(避免 activate 重放覆盖用户手拖的宽度);这个是命令式的,每次调用都\n\t * 生效,供插件在自己的标签卡被激活、进入某种视图时按需调整。用户随后仍可拖动。\n\t */\n\tsetActivityPanelWidth(width: number | \"max\"): void;\n\t/**\n\t * Bind or clear plugin-owned context for outgoing prompts. The host renders\n\t * its label/icon and carries a structured `context` as a versioned snapshot.\n\t * Attachments default to one-shot; `lifecycle: \"sticky\"` remains until the\n\t * plugin or user clears 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 host's global file previewer for any file — the general form of\n\t * {@link PluginUiApi.previewImage}, which only takes image URLs. Accepts a\n\t * local absolute `path` (the shape the host's own file tree uses) as well as\n\t * a `url`; the previewer dispatches by the file's extension, so a file type\n\t * some plugin registered via `registerFilePreview` lands in that renderer.\n\t *\n\t * Pass `group` (e.g. all outputs of one run) to open as a group: images get\n\t * the thumbnail strip + arrows, and the previewer starts at `file`.\n\t *\n\t * Permissions: `fs.read` as soon as any entry carries a `path` (it hands a\n\t * local file to the host to read); `ui.slot.message` for url-only calls,\n\t * same gate as `previewImage`.\n\t */\n\tpreviewFile(file: PluginPreviewFileRef, group?: PluginPreviewFileRef[]): 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 * Copy an image to the system clipboard. Takes a `data:image/...;base64,`\n\t * URL and goes through the native clipboard, so it does not depend on the\n\t * renderer's `ClipboardItem` support. No permission required — the plugin\n\t * can only write what it already rendered.\n\t */\n\tcopyImage(dataUrl: string): Promise<void>;\n\t/**\n\t * Hand a URL to the OS default browser (Electron `shell.openExternal`) —\n\t * NOT the in-app browser panel. Only `http:`/`https:` are accepted; the host\n\t * rejects every other protocol, so this cannot be used to launch arbitrary\n\t * schemes. Needs `shell.openExternal`.\n\t */\n\topenExternal(url: string): Promise<void>;\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"]}
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"","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\";\nimport type { PluginShortcutScopeContribution } from \"./shortcuts.js\";\n\nexport interface PluginGlobalSlotContribution {\n\tid: string;\n\tcomponent: ComponentType;\n}\n\nexport interface PluginAbilityDetailSlotProps {\n\tabilityId: string;\n\tinstalled: boolean;\n\tenabled: boolean;\n}\n\n/** Inline setup/status surface rendered near the top of one ability detail page. */\nexport interface PluginAbilityDetailSlotContribution {\n\tid: string;\n\tabilityId: string;\n\tcomponent: ComponentType<PluginAbilityDetailSlotProps>;\n}\n\n/**\n * Props handed to a workspace-view component. A workspace view owns the whole\n * content area, so unlike panel slots it is addressed by its own route and can\n * be deep-linked; the host passes back its identity so one component can serve\n * several registered views.\n */\nexport interface PluginWorkspaceViewProps {\n\t/** The contribution id as registered (NOT namespaced). */\n\tviewId: string;\n\t/** The owning plugin id. */\n\tpluginId: string;\n}\n\n/**\n * Badge tone. The host maps it to its own theme colors — a plugin cannot pick a\n * raw color, so badges stay consistent with the built-in navigation entries.\n */\nexport type PluginNavBadgeTone = \"accent\" | \"danger\" | \"default\" | \"warning\";\n\n/**\n * A badge on the plugin's sidebar navigation entry.\n *\n * `beta` is the host's own preset — it renders exactly like the built-in\n * 知识库 Beta 标识, wording included (and localized by the host), so plugins do\n * not have to spell \"Beta\" themselves in every locale.\n *\n * `count` renders `99+` past 99 and disappears at 0 — an unread badge showing\n * \"0\" is worse than no badge.\n */\nexport type PluginNavBadge =\n\t| { kind: \"beta\" }\n\t| { kind: \"text\"; text: string; tone?: PluginNavBadgeTone }\n\t| { kind: \"count\"; count: number; tone?: PluginNavBadgeTone }\n\t| { kind: \"dot\"; tone?: PluginNavBadgeTone };\n\n/**\n * A **workspace view**(工作区视图): a full-page surface a plugin contributes to\n * the host's primary navigation. It is the plugin counterpart of a built-in page\n * such as 自动化 / 知识库 — the host gives it its own route\n * (`/workspace/<pluginId>/<viewId>`) and a sidebar entry, and the plugin owns the\n * entire content area while it is open.\n *\n * Use it for standalone workbenches that are NOT bound to one conversation\n * (dashboards, boards, consoles). Conversation-scoped UI belongs in an\n * {@link PluginActivityTabContribution activity tab}; floating UI belongs in a\n * {@link PluginGlobalSlotContribution global slot}.\n */\nexport interface PluginWorkspaceViewContribution {\n\t/** Unique within the plugin; the host namespaces it as `${pluginId}:${id}`. */\n\tid: string;\n\t/** Sidebar entry label. Supports `%catalogKey%` i18n lookup. */\n\tlabel: string;\n\t/**\n\t * Sidebar entry icon as an **iconify class string** (e.g.\n\t * `\"icon-[solar--widget-5-linear]\"`) — NOT a React node, because the host\n\t * renders it inside its own nav button and persists nav layout by key.\n\t *\n\t * Omit it to inherit the plugin's own `plugin.json` icon: a packaged image\n\t * (svg / png / webp …) is masked with the theme's foreground color, so a plugin\n\t * that ships artwork does not have to find a lookalike in an icon set. Set\n\t * {@link PluginWorkspaceViewContribution.iconTint} to `false` to keep its colors.\n\t */\n\ticon?: string;\n\t/**\n\t * Whether an image icon is tinted with the theme's foreground color. Defaults to\n\t * `true`, which keeps the entry consistent with the built-in navigation and legible\n\t * in every theme.\n\t *\n\t * Pass `false` for a full-color logo. Weigh it first: the entry renders at 16px\n\t * beside monochrome built-ins, and a fixed-color image cannot follow the active\n\t * theme — a dark logo can disappear on a dark sidebar. Has no effect on Iconify\n\t * class icons, which are always tinted.\n\t */\n\ticonTint?: boolean;\n\t/** Optional one-line description; shown as the nav entry tooltip. */\n\tdescription?: string;\n\t/**\n\t * Initial badge on the sidebar entry. `{ kind: \"text\" }` supports the same\n\t * `%catalogKey%` i18n lookup as {@link label}. Update it at runtime with\n\t * {@link PluginUiApi.setWorkspaceViewBadge}.\n\t */\n\tbadge?: PluginNavBadge;\n\t/** Zero-props aside from {@link PluginWorkspaceViewProps}. */\n\tcomponent: ComponentType<PluginWorkspaceViewProps>;\n\t/** Sort hint among this plugin's own views (ascending). Defaults to 0. */\n\tnavOrder?: number;\n\t/**\n\t * Whether this view takes a sidebar entry. Defaults to `true`.\n\t *\n\t * Pass `false` for a surface users open occasionally — a setup page, a\n\t * diagnostics console. It then lives only under Settings → More options,\n\t * where the host lists every off-sidebar view and opens it inside the\n\t * settings shell, so switching between such pages stays one click.\n\t *\n\t * The sidebar is a scarce, user-curated space: a plugin that always claims a\n\t * slot pushes the entries someone actually uses into the overflow menu.\n\t */\n\tsidebar?: boolean;\n}\n\n/**\n * What a workspace view puts into the **host page header** — the window's top\n * bar that also carries the drag region, the macOS traffic-light gutter and the\n * sidebar trigger.\n *\n * Without this the header still renders, showing the app name above the\n * plugin's own toolbar — two stacked bars. Set `hideTitle` and move the view's\n * toolbar in here and the surface gets a single, host-consistent header.\n *\n * `left` / `right` are ReactNodes rendered by the host inside that bar (left:\n * right after the sidebar trigger; right: before the window controls). They are\n * rendered in the plugin's i18n + CSS scope, so `useTranslation()` and the\n * plugin's own classes work as usual. Pass fresh nodes whenever the view's\n * state changes — this is a live setter, not a one-time registration.\n */\nexport interface PluginWorkspaceViewHeader {\n\t/** Replaces the host title text. Supports `%catalogKey%` i18n lookup. */\n\ttitle?: string;\n\t/** Drop the host title entirely (use when {@link left} carries its own). */\n\thideTitle?: boolean;\n\t/** Rendered in the header's left cluster, after the sidebar trigger. */\n\tleft?: ReactNode;\n\t/** Rendered in the header's action cluster, before the window controls. */\n\tright?: ReactNode;\n\t/**\n\t * Float the host header OVER the view instead of stacking above it. The view\n\t * then owns the full content height, and its top `~44px` sit under the\n\t * transparent header strip (window drag region / traffic lights / sidebar\n\t * trigger all keep working on top). Use for immersive full-page surfaces\n\t * whose own hero starts at the very top; leave unset for toolbar-style\n\t * headers that need their own opaque row.\n\t */\n\timmersive?: boolean;\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\n/**\n * A file handed to {@link PluginUiApi.previewFile} — the *opening* side of the\n * global previewer, the mirror image of {@link PluginPreviewFile} (which is the\n * *rendering* side). Bytes never cross over: the host reads the source itself.\n *\n * Exactly one of `path` (local absolute path) or `url` (host media / http URL)\n * must be given. `path` is the shape the host's own file tree uses, so the\n * previewer also offers \"在 Finder 中显示\" for it.\n */\nexport interface PluginPreviewFileRef {\n\t/** Local absolute path. Requires the `fs.read` permission. */\n\tpath?: string;\n\t/** Fetchable URL (host media URL or http/https). Requires `ui.slot.message`. */\n\turl?: string;\n\t/**\n\t * Display name **including the extension** — the previewer dispatches to a\n\t * renderer by this extension, not by `mimeType`. Optional for `path`\n\t * sources (the host falls back to the path's basename).\n\t */\n\tname?: string;\n\tmimeType?: string;\n\t/** Byte size, shown in the previewer's download detail when known. */\n\tsize?: number;\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 */\n/** Host residency policy for an activity-panel tab. */\nexport type PluginActivityTabRetention = \"active-only\" | \"warm\" | \"pinned\";\n\nexport interface PluginActivityTabContribution {\n\tid: string;\n\tlabel: string;\n\t/**\n\t * Tab icon as a React node (not an iconify class string).\n\t * Omit to inherit the host-resolved brand icon from `plugin.json#icon`\n\t * (`ctx.plugin.iconUrl`). Prefer omitting for package brand icons so the\n\t * plugin never loads assets via absolute `/…` paths or host protocols.\n\t */\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\t/**\n\t * Component residency while the tab is inactive. Defaults to `\"warm\"`:\n\t * visited tabs stay mounted in the host's bounded LRU cache. Use\n\t * `\"active-only\"` for cheap, stateless content and `\"pinned\"` for runtimes\n\t * that must never be evicted while available.\n\t */\n\tretention?: PluginActivityTabRetention;\n\t/**\n\t * @deprecated Use {@link PluginActivityTabContribution.retention}. `true`\n\t * maps to `\"pinned\"`; `false` maps to `\"active-only\"`.\n\t */\n\tkeepAliveWhenAvailable?: boolean;\n}\n\n/** Explicit conversation scope for an activity-tab command. */\nexport interface PluginActivityTabTargetOptions {\n\t/**\n\t * Absolute cwd whose activity-tab state should be changed. Omit to target\n\t * the conversation currently displayed by the host. Tool handlers and\n\t * background work should pass the triggering session's cwd so a foreground\n\t * navigation change cannot redirect the command to another conversation.\n\t */\n\tcwd?: string;\n}\n\n/** Options for {@link PluginUiApi.openActivityTab}. */\nexport interface PluginOpenActivityTabOptions extends PluginActivityTabTargetOptions {\n\t/**\n\t * Desired panel width as it opens: a pixel number, or `\"max\"` to track the\n\t * widest the window allows — `\"max\"` keeps following window resizes until the\n\t * user drags the divider. The host clamps to its min/max bounds. Omit to keep\n\t * 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\" | \"cancelled\";\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\n/**\n * 新会话上下文区的激活条件。**只能写本插件自己的东西**——填别人的 id 一律不生效。\n *\n * 这条限制是故意的:否则插件 A 可以声明「只要用户选了 B 的智能体我就上屏」,把别人的\n * 使用场景劫持过来。\n *\n * 各字段取并集:任意一条命中即激活。至少要声明一条——全空等于「任何新会话都上屏」,宿主拒掉。\n */\nexport interface PluginNewSessionContextActivation {\n\t/** 本插件在 manifest 里声明的智能体 id(不带 `plugin:` 前缀)。 */\n\tagents?: readonly string[];\n\t/** 本插件在 manifest 里声明的团队 id。省略则任意「含本插件成员的团队」都算命中。 */\n\tteams?: readonly string[];\n\t/** 本插件提供的 skill 名;用户在输入框里提到时命中。 */\n\tskills?: readonly string[];\n\t/** 本插件提供的 MCP server 名。 */\n\tmcpServers?: readonly string[];\n}\n\n/** 用户在新会话页当前选中的对话目标。 */\nexport interface PluginNewSessionTarget {\n\treadonly kind: \"agent\" | \"team\";\n\t/** Agent 档案 id 或团队 id。 */\n\treadonly id: string;\n\t/** 目标若由本插件贡献,这里给出 manifest 里的那个 id。 */\n\treadonly contributedId?: string;\n}\n\n/**\n * 渲染上下文。这是一个**会继续生长的对象**:后续新增字段不会破坏既有插件,所以按需\n * 解构、不要假定它只有这些键。\n */\nexport interface PluginNewSessionContext {\n\treadonly target: PluginNewSessionTarget | null;\n\t/** 输入框里提到的、属于本插件的能力。 */\n\treadonly mentionedAbilities: {\n\t\treadonly skills: readonly string[];\n\t\treadonly mcpServers: readonly string[];\n\t};\n\t/**\n\t * 输入框中尚未发送的文本。需要 `conversation.draft.read` 权限,未授予时恒为空串。\n\t *\n\t * 只在本贡献处于激活状态时提供——插件拿不到「用户随便打点什么」的全程流水。\n\t */\n\treadonly draft: string;\n\t/** 当前工作区目录;未选择项目时为 null。 */\n\treadonly cwd: string | null;\n\t/** 回写输入栏。刻意不提供「直接发送」:越过发送前这道关不属于本区职责。 */\n\treadonly composer: {\n\t\t/** 把资源挂成附件,随下一次发送带走。 */\n\t\tattach(attachment: PluginPromptAttachment): void;\n\t\t/**\n\t\t * 往草稿里插一段文本。始终是插入而非替换,免得抹掉用户已经打的内容。\n\t\t *\n\t\t * `position` 缺省为 `\"end\"`(光标处)。`\"start\"` 插到最前面,适合「先定题、细节\n\t\t * 由用户补」这类写法——用户点完多半光标并不在开头,位置只能由调用方定死。\n\t\t */\n\t\tinsertText(text: string, options?: { position?: \"start\" | \"end\" }): void;\n\t};\n}\n\n/**\n * 新会话页输入框下方的一块内容(`ui.slot.new-session-context`)。\n *\n * 与 input-action 的分工:那是发送前的开关,这是发送前的**上下文**——把用户接下来多半\n * 要用到的素材摆出来。激活与否由宿主按 {@link PluginNewSessionContextActivation} 裁决,\n * 插件只负责在被激活后渲染,因此拿不到用户逐键输入的全程内容。\n *\n * 同时有多个贡献上屏时,宿主会在该区域顶部出 tabbar;只有一个时直接渲染内容。\n */\nexport interface PluginNewSessionContextContribution {\n\tid: string;\n\t/** tabbar 上的标题;只有一个贡献上屏时不展示。 */\n\tlabel: string;\n\t/** tab 图标;省略时用插件自己的图标。 */\n\ticon?: ReactNode;\n\tactivateWhen: PluginNewSessionContextActivation;\n\t/**\n\t * 横向占位。`\"input\"`(默认)与输入框同宽,适合补充说明一类的窄内容;`\"wide\"` 铺满\n\t * 页面可用宽度,留给画廊、素材墙这类「内容本身就是主角」的东西——把它们压在输入框\n\t * 宽度里,每一项都会小到看不清。\n\t */\n\twidth?: \"input\" | \"wide\";\n\trender(context: PluginNewSessionContext): ReactNode;\n}\n\n/**\n * 宿主左侧侧边栏此刻的形态。给插件自适应布局用——尤其是沉浸式工作区视图:\n * 侧边栏收起时宿主页头会长出「展开侧边栏」按钮并占住左上角,视图自己画在那一带的\n * 东西需要让位。\n */\nexport interface PluginSidebarState {\n\t/** 用户手动收起了侧边栏。窄屏下这一位仍然只反映用户意愿,不受窗口宽度影响。 */\n\tcollapsed: boolean;\n\t/** 窗口窄到侧边栏改走悬浮覆盖,不再占据左侧一栏。 */\n\tnarrow: boolean;\n\t/** 侧边栏此刻是否实际占着左边那一栏。等价于 `!collapsed && !narrow`,多数自适应只需要这一位。 */\n\tvisible: boolean;\n}\n\nexport interface PluginUiApi {\n\tregisterGlobalSlot(contribution: PluginGlobalSlotContribution): Disposable;\n\tregisterAbilityDetailSlot(contribution: PluginAbilityDetailSlotContribution): Disposable;\n\t/** Render an opaque setup URL as a host-themed PNG data URL. */\n\tcreateQrCode(text: string): Promise<string>;\n\t/**\n\t * Register a **workspace view**(工作区视图)— a full-page surface with its own\n\t * route and sidebar entry, on par with the host's built-in pages. Needs the\n\t * `ui.slot.workspace-view` permission (missing permission = **warn+noop**).\n\t *\n\t * The entry lands in the sidebar's「更多」收纳 by default; the user can pin it\n\t * to the top region or reorder it, and that layout is remembered.\n\t */\n\tregisterWorkspaceView(contribution: PluginWorkspaceViewContribution): Disposable;\n\t/**\n\t * Register a **new-session context block** — content shown beneath the input\n\t * on the new-session page, surfaced only when the user's current selection or\n\t * draft matches {@link PluginNewSessionContextActivation}. Needs the\n\t * `ui.slot.new-session-context` permission (missing permission = **warn+noop**).\n\t */\n\tregisterNewSessionContext(contribution: PluginNewSessionContextContribution): Disposable;\n\t/**\n\t * Navigate to one of this plugin's own workspace views. `viewId` is the\n\t * contribution id passed to {@link PluginUiApi.registerWorkspaceView}. No-op\n\t * when the view is not registered (e.g. permission missing).\n\t */\n\topenWorkspaceView(viewId: string): void;\n\t/**\n\t * Update (or clear, with `null`) the badge on one of this plugin's workspace\n\t * view entries. Re-registering the view is NOT a way to do this — it would\n\t * remount the whole surface — so live badges (unread counts, status dots)\n\t * must come through here.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewBadge(viewId: string, badge: PluginNavBadge | null): void;\n\t/**\n\t * Fill (or clear, with `null`) the host page header while one of this\n\t * plugin's workspace views is open. Call it from the view component (an\n\t * effect that re-runs on state change) and clear it on unmount — the host\n\t * keeps the entry keyed by view, and only applies it on that view's route.\n\t *\n\t * The header itself is never removed: it owns the window drag region and the\n\t * macOS traffic-light gutter. This is how a view takes it over instead.\n\t *\n\t * No-op when the view is not registered (e.g. permission missing).\n\t */\n\tsetWorkspaceViewHeader(viewId: string, header: PluginWorkspaceViewHeader | null): void;\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 * Register a keyboard shortcut scope on the host's shared ShortcutScopeStack\n\t * (same path as host UI: modal > overlay > surface > app). Needs\n\t * `ui.shortcuts.register`. Plugins cannot use kind `\"app\"` (reserved for\n\t * host-configurable global actions). Prefer {@link usePluginShortcutScope}\n\t * from React components with a module-captured `registerShortcutScope`.\n\t */\n\tregisterShortcutScope(contribution: PluginShortcutScopeContribution): Disposable;\n\t/**\n\t * Programmatically attach (if needed) and activate one of this plugin's\n\t * own activity tabs in a 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\t * Omit `options.cwd` for the conversation currently displayed by the host.\n\t * Tool handlers and background work should pass their session cwd explicitly.\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 * 会话;工具 handler 与后台任务应通过 `options.cwd` 传入自己的会话 cwd。既没有\n\t * 显式 cwd、也没有活动会话时为 no-op(无处记录)。\n\t */\n\tsetActivityTabVisible(tabId: string, visible: boolean, options?: PluginActivityTabTargetOptions): void;\n\t/**\n\t * 直接设置活动面板宽度:像素值,或 `\"max\"` 表示「跟随窗口拉满」(宿主仍会夹到\n\t * 自己的 min/max 内,必要时自动收起侧边栏)。\n\t *\n\t * `\"max\"` 是一种持续状态而非一次性求值:窗口尺寸变化时面板跟着变宽变窄,直到\n\t * 用户拖动分隔条或有人写入具体像素为止。传数字则是一次性的固定宽度。\n\t *\n\t * 与 `openActivityTab(id, { width })` 的区别:那里的宽度只在标签卡首次 attach\n\t * 时生效(避免 activate 重放覆盖用户手拖的宽度);这个是命令式的,每次调用都\n\t * 生效,供插件在自己的标签卡被激活、进入某种视图时按需调整。用户随后仍可拖动。\n\t */\n\tsetActivityPanelWidth(width: number | \"max\"): void;\n\t/**\n\t * Bind or clear plugin-owned context for outgoing prompts. The host renders\n\t * its label/icon and carries a structured `context` as a versioned snapshot.\n\t * Attachments default to one-shot; `lifecycle: \"sticky\"` remains until the\n\t * plugin or user clears 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 host's global file previewer for any file — the general form of\n\t * {@link PluginUiApi.previewImage}, which only takes image URLs. Accepts a\n\t * local absolute `path` (the shape the host's own file tree uses) as well as\n\t * a `url`; the previewer dispatches by the file's extension, so a file type\n\t * some plugin registered via `registerFilePreview` lands in that renderer.\n\t *\n\t * Pass `group` (e.g. all outputs of one run) to open as a group: images get\n\t * the thumbnail strip + arrows, and the previewer starts at `file`.\n\t *\n\t * Permissions: `fs.read` as soon as any entry carries a `path` (it hands a\n\t * local file to the host to read); `ui.slot.message` for url-only calls,\n\t * same gate as `previewImage`.\n\t */\n\tpreviewFile(file: PluginPreviewFileRef, group?: PluginPreviewFileRef[]): 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 * Copy an image to the system clipboard. Takes a `data:image/...;base64,`\n\t * URL and goes through the native clipboard, so it does not depend on the\n\t * renderer's `ClipboardItem` support. No permission required — the plugin\n\t * can only write what it already rendered.\n\t */\n\tcopyImage(dataUrl: string): Promise<void>;\n\t/**\n\t * Hand a URL to the OS default browser (Electron `shell.openExternal`) —\n\t * NOT the in-app browser panel. Only `http:`/`https:` are accepted; the host\n\t * rejects every other protocol, so this cannot be used to launch arbitrary\n\t * schemes. Needs `shell.openExternal`.\n\t */\n\topenExternal(url: string): Promise<void>;\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\t/**\n\t * 读当前侧边栏形态。无需权限——这是纯布局信息,不含任何用户数据。\n\t *\n\t * React 组件请改用 `useSidebarState()`:它会在状态变化时重渲染,不必自己订阅。\n\t * 这一对只为拿不到 hook 的地方准备(`activate()` 内、工具处理器、命令式绘制的画布)。\n\t */\n\tgetSidebarState(): PluginSidebarState;\n\t/**\n\t * 订阅侧边栏形态变化——用户收起/展开侧边栏、或窗口跨过窄屏阈值时触发。\n\t * 返回 Disposable 取消订阅;请在插件失活时释放。\n\t *\n\t * 回调按值去重:拖窗口不会把它打成回调风暴,只有三元组真的变了才通知。\n\t */\n\tonSidebarStateChanged(listener: (state: PluginSidebarState) => void): Disposable;\n}\n"]}
|
package/docs/manifest.md
CHANGED
|
@@ -220,6 +220,8 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
|
|
|
220
220
|
|
|
221
221
|
`agent.agents` / `agent.teams` 让插件把**自己的人设**带进产品:宿主在插件启用时把它们铺进用户的智能体库与团队列表,与用户自建的档案并列出现在智能体中心、新会话选择器和 `@` 提及里。
|
|
222
222
|
|
|
223
|
+
**这些资产由你 1:1 维护**:清单是唯一的真相源,宿主每次同步都按它重铺一遍——你改名、换阵容、改任务书、撤掉一支团队,用户升级后都会如实生效。对应地,用户改不动也删不掉它们(UI 只读展示);想要一份自己调教的版本,用户复制一份自建档案即可。
|
|
224
|
+
|
|
223
225
|
宿主**不再内置任何人设**——装机自带的那几位现在也由 `preset-agent` 这个预置插件提供,所以你写的插件与它们走的是同一条路径、同一套字段。
|
|
224
226
|
|
|
225
227
|
- **不需要权限**:这是清单声明面,不是运行时 API。用户对「装了什么插件」本身知情,因此没有单独的授权开关。
|
|
@@ -327,7 +329,7 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
|
|
|
327
329
|
- 任务书**挂在你的团队上,不碰对方的人设**。同一个设计师在别处照旧,在你的团队里按你交待的来。
|
|
328
330
|
- 与 `responsibility` 分工不同:后者是一句全队可见的职责摘要(进共享名册),前者是只给这名成员看的做事方式。
|
|
329
331
|
- 用 `instructionsPath` 指向 Markdown:任务书值得单独 diff,和人设提示词一个道理。**记得文件要能被打包**——路径会自动登记为插件资源,但源文件得真的在包里,缺了这名成员会让整支团队被跳过并打 warn。
|
|
330
|
-
-
|
|
332
|
+
- 任务书随插件升级整体更新:用户改不动它,下一版写什么用户看到的就是什么。
|
|
331
333
|
|
|
332
334
|
### 被别人引用(roles)
|
|
333
335
|
|
|
@@ -372,16 +374,18 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
|
|
|
372
374
|
|
|
373
375
|
### 生命周期
|
|
374
376
|
|
|
375
|
-
-
|
|
376
|
-
-
|
|
377
|
-
-
|
|
378
|
-
-
|
|
377
|
+
- **启用插件**:宿主把缺失的档案补齐——判据是「用户文档里现在有没有」,不是「历史上铺过没有」。因此旧版本数据缺失、一次异常都会被补回来。
|
|
378
|
+
- **升级插件**:清单里现在写的就是用户拿到的:名称、说明、能力、阵容与任务书按新清单整体重铺(档案里**不落 `systemPrompt`**,人设升级同样自动生效)。资源 id 与成员 id 不变,用户的团队绑定与会话引用因此不受影响。
|
|
379
|
+
- **撤掉资产**:新版本不再声明的智能体与团队会从用户那里消失,并从用户自建的团队里摘掉相应成员。这是「作者收得回自己发出去的东西」的那一条,与升级走的是同一次同步。
|
|
380
|
+
- **禁用插件**:档案**灰着留在原地**,既不隐藏也不从团队里摘掉,并标出「插件已禁用」。禁用不等于撤掉:清单还声明着它,就不会被当成残骸清理。重新启用后一切原样回来。
|
|
381
|
+
- **热重载**:开发态改完 manifest 重载插件,智能体与团队当场更新,不需要重启 App。
|
|
382
|
+
- **供货方后到**:铺团队时解析不到的槽位,会在提供方装上之后**自动补进阵容**——阵容本就按清单重排,不需要额外的补员规则。
|
|
379
383
|
- **跨插件引用的能力面**:别的插件的智能体自带 `pinnedPlugins`,进了你的团队就等于隐式拉起那个插件的能力,用户在能力面板里关不掉。引用之前想清楚这一点。
|
|
380
384
|
- **贡献出错**:单个智能体/团队解析失败(提示词读不到、头像超限、成员引用非法)只跳过它自己并打 warn,不影响同插件的其它贡献。
|
|
381
385
|
|
|
382
386
|
### 接管与升级(legacyIds)
|
|
383
387
|
|
|
384
|
-
`legacyIds` 用于「人设从别处迁进插件」:宿主解析不到这些历史 id
|
|
388
|
+
`legacyIds` 用于「人设从别处迁进插件」:宿主解析不到这些历史 id 时折算到本智能体,铺档案时也据此**认领**用户已有的同角色档案,而不是再铺一份新的。认领只保留**身份**(档案 id 与团队绑定),内容按你的清单重铺。
|
|
385
389
|
|
|
386
390
|
装机自带人设迁进 `preset-agent` 走的正是这条路径(`executor` → `developer` 等)。宿主自己不需要知道是哪个插件接管了哪个老角色。
|
|
387
391
|
|
package/docs/ui-slots.md
CHANGED
|
@@ -196,6 +196,47 @@ useEffect(() => () => ctx.ui.setWorkspaceViewHeader("board", null), []);
|
|
|
196
196
|
从窗口第一像素开始的沉浸式整页;页头里放了 `left`/`right` 工具栏时不要开——工具栏
|
|
197
197
|
会压在内容上
|
|
198
198
|
|
|
199
|
+
### 感知侧边栏 useSidebarState
|
|
200
|
+
|
|
201
|
+
沉浸式页头有个绕不开的副作用:侧边栏收起时,宿主会在页头左上角长出「展开侧边栏」
|
|
202
|
+
按钮,压在视图自己画的那一带上。视图要让位,就得知道侧边栏此刻什么形态。
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { useSidebarState } from "@vetta-org/plugin-sdk";
|
|
206
|
+
|
|
207
|
+
function Hero() {
|
|
208
|
+
const { collapsed, narrow, visible } = useSidebarState();
|
|
209
|
+
// 侧边栏不在位 = 宿主页头有展开按钮占着左上角,标题往右让 36px
|
|
210
|
+
return <h1 style={{ paddingLeft: visible ? 0 : 36 }}>设计画廊</h1>;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- `collapsed`:用户手动收起了侧边栏。窄屏下这一位仍只反映用户意愿
|
|
215
|
+
- `narrow`:窗口窄到侧边栏改走悬浮覆盖,不再占据左侧一栏
|
|
216
|
+
- `visible`:侧边栏此刻是否实际占着左边那一栏,等价于 `!collapsed && !narrow`。
|
|
217
|
+
多数自适应只需要这一位
|
|
218
|
+
|
|
219
|
+
拿不到 hook 的地方(`activate()` 内、工具处理器、命令式绘制的画布)用命令式的一对:
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const state = ctx.ui.getSidebarState();
|
|
223
|
+
const sub = ctx.ui.onSidebarStateChanged((next) => redraw(next.visible));
|
|
224
|
+
// 插件失活时宿主会兜底摘掉监听,但自己持有生命周期的地方仍应显式 sub.dispose()
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
回调按值去重,拖窗口不会把它打成回调风暴——只有三元组真的变了才通知。无需权限:
|
|
228
|
+
这是纯布局信息,不含任何用户数据。
|
|
229
|
+
|
|
230
|
+
**纯视觉自适应优先用 CSS**:宿主把同一份状态挂在整帧根节点上,插件不必订阅、不必
|
|
231
|
+
重渲染:
|
|
232
|
+
|
|
233
|
+
```css
|
|
234
|
+
:root [data-sidebar-visible="false"] .my-hero { padding-left: 36px; }
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
可用属性:`data-sidebar-collapsed` / `data-sidebar-narrow` / `data-sidebar-visible`,
|
|
238
|
+
值恒为 `"true"` / `"false"`。
|
|
239
|
+
|
|
199
240
|
**该用哪个插槽**
|
|
200
241
|
|
|
201
242
|
| 场景 | 用 |
|