@eworkbase/sdk 0.8.5 → 0.8.6

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.
@@ -0,0 +1,54 @@
1
+ //#region src/build.d.ts
2
+ /**
3
+ * Shared tsdown build factory for Workbase plugins.
4
+ * Generates the Node backend bundle, browser React bundle and canonical dist/ui/index.html.
5
+ */
6
+ export interface PluginBuildCopyEntry {
7
+ readonly from: string | readonly string[];
8
+ readonly to?: string;
9
+ }
10
+ export interface PluginBuildEntryConfig {
11
+ readonly entry: Readonly<Record<string, string>>;
12
+ readonly outDir?: string;
13
+ readonly platform: "node" | "browser" | "neutral";
14
+ readonly target: string;
15
+ readonly minify?: boolean;
16
+ readonly shims?: boolean;
17
+ readonly dts?: boolean;
18
+ readonly env?: Readonly<Record<string, string>>;
19
+ readonly inputOptions?: Readonly<Record<string, unknown>>;
20
+ readonly deps?: {
21
+ readonly alwaysBundle?: readonly (string | RegExp)[];
22
+ readonly neverBundle?: readonly (string | RegExp)[];
23
+ };
24
+ readonly plugins?: readonly unknown[];
25
+ readonly copy?: readonly PluginBuildCopyEntry[];
26
+ }
27
+ export interface PluginBackendBuildOverrides {
28
+ readonly entry?: string;
29
+ readonly alwaysBundle?: readonly (string | RegExp)[];
30
+ readonly neverBundle?: readonly (string | RegExp)[];
31
+ readonly inputOptions?: Readonly<Record<string, unknown>>;
32
+ readonly copy?: readonly PluginBuildCopyEntry[];
33
+ }
34
+ export interface PluginUiBuildOverrides {
35
+ readonly entry?: string;
36
+ readonly plugins?: readonly unknown[];
37
+ readonly copy?: readonly PluginBuildCopyEntry[];
38
+ }
39
+ export interface DefinePluginBuildOptions {
40
+ /** Page <title> emitted into dist/ui/index.html. Omit only for backend-only plugins (ui: false). */
41
+ readonly title?: string;
42
+ /** Copies shared Vditor / markdown editor static assets into dist/ui. */
43
+ readonly markdownEditorAssets?: boolean;
44
+ readonly backend?: PluginBackendBuildOverrides;
45
+ /** Pass false for backend-only plugins without a browser view. */
46
+ readonly ui?: false | PluginUiBuildOverrides;
47
+ /** Additional standalone build targets (for example a stdio bridge helper). */
48
+ readonly extraEntries?: readonly PluginBuildEntryConfig[];
49
+ }
50
+ /** Creates the canonical tsdown config array for a Workbase plugin package. */
51
+ export declare function definePluginBuild(options: DefinePluginBuildOptions): PluginBuildEntryConfig[];
52
+ /** Renders the canonical Workbase plugin iframe HTML document with CSP style nonce placeholder. */
53
+ export declare function renderPluginHtml(title: string): string;
54
+ //#endregion
package/dist/build.js ADDED
@@ -0,0 +1,78 @@
1
+ import { fileURLToPath } from "node:url";
2
+ //#region src/build.ts
3
+ /**
4
+ * Shared tsdown build factory for Workbase plugins.
5
+ * Generates the Node backend bundle, browser React bundle and canonical dist/ui/index.html.
6
+ */
7
+ const DEFAULT_SDK_EXTERNAL = /^@eworkbase\/sdk(?:\/.*)?$/;
8
+ /** Creates the canonical tsdown config array for a Workbase plugin package. */
9
+ function definePluginBuild(options) {
10
+ const { backend = {}, extraEntries = [], markdownEditorAssets = false, title = "Workbase Plugin", ui } = options;
11
+ const entries = [{
12
+ entry: { plugin: backend.entry ?? "src/plugin.ts" },
13
+ platform: "node",
14
+ target: "node22",
15
+ minify: true,
16
+ shims: true,
17
+ dts: false,
18
+ ...backend.inputOptions ? { inputOptions: backend.inputOptions } : {},
19
+ deps: {
20
+ alwaysBundle: backend.alwaysBundle ?? [/.*/],
21
+ neverBundle: [DEFAULT_SDK_EXTERNAL, ...backend.neverBundle ?? []]
22
+ },
23
+ ...backend.copy?.length ? { copy: backend.copy } : {}
24
+ }, ...extraEntries];
25
+ if (ui === false) return entries;
26
+ const uiCopy = [...ui?.copy ?? []];
27
+ if (markdownEditorAssets) uiCopy.push({
28
+ from: fileURLToPath(new URL("./ui/markdown-editor-assets", import.meta.url)),
29
+ to: "dist/ui"
30
+ });
31
+ entries.push({
32
+ entry: { main: ui?.entry ?? "src/ui/main.tsx" },
33
+ outDir: "dist/ui",
34
+ platform: "browser",
35
+ target: "es2022",
36
+ minify: true,
37
+ dts: false,
38
+ env: { NODE_ENV: "production" },
39
+ deps: { alwaysBundle: [/.*/] },
40
+ plugins: [emitPluginHtml(title), ...ui?.plugins ?? []],
41
+ ...uiCopy.length ? { copy: uiCopy } : {}
42
+ });
43
+ return entries;
44
+ }
45
+ /** Renders the canonical Workbase plugin iframe HTML document with CSP style nonce placeholder. */
46
+ function renderPluginHtml(title) {
47
+ return [
48
+ "<!doctype html>",
49
+ "<html lang=\"zh-CN\">",
50
+ " <head>",
51
+ " <meta name=\"workbase-style-nonce\" content=\"__WORKBASE_STYLE_NONCE__\" />",
52
+ " <meta charset=\"UTF-8\" />",
53
+ " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />",
54
+ " <link rel=\"stylesheet\" href=\"./style.css\" />",
55
+ ` <title>${title.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")}</title>`,
56
+ " </head>",
57
+ " <body>",
58
+ " <div id=\"root\"></div>",
59
+ " <script type=\"module\" src=\"./main.js\"><\/script>",
60
+ " </body>",
61
+ "</html>",
62
+ ""
63
+ ].join("\n");
64
+ }
65
+ function emitPluginHtml(title) {
66
+ return {
67
+ name: "workbase-plugin-html",
68
+ generateBundle() {
69
+ this.emitFile({
70
+ type: "asset",
71
+ fileName: "index.html",
72
+ source: renderPluginHtml(title)
73
+ });
74
+ }
75
+ };
76
+ }
77
+ //#endregion
78
+ export { definePluginBuild, renderPluginHtml };
@@ -0,0 +1,131 @@
1
+ import { PluginErrorPanel } from "./ui/error-panel.js";
2
+ import { Component, memo } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/ui/Components.dto.ts
5
+ let PluginStatusTone = /* @__PURE__ */ function(PluginStatusTone) {
6
+ PluginStatusTone["Success"] = "success";
7
+ PluginStatusTone["Warning"] = "warning";
8
+ PluginStatusTone["Danger"] = "danger";
9
+ PluginStatusTone["Info"] = "info";
10
+ PluginStatusTone["Neutral"] = "neutral";
11
+ return PluginStatusTone;
12
+ }({});
13
+ //#endregion
14
+ //#region src/ui/components.tsx
15
+ /**
16
+ * Shared React primitives for Workbase plugins (status pill, inline error, empty state, error boundary).
17
+ * Implemented with semantic HTML and SDK CSS tokens to stay zero-dependency beyond React.
18
+ */
19
+ const DEFAULT_ERROR_BOUNDARY_TITLE = "界面渲染异常";
20
+ const DEFAULT_ERROR_BOUNDARY_SCOPE = "当前插件视图。";
21
+ const DEFAULT_ERROR_BOUNDARY_RECOVERY = "可重试渲染当前视图;若反复出现,请刷新工作区或查看执行日志。";
22
+ const DEFAULT_RETRY_LABEL = "重试渲染";
23
+ const DEFAULT_DISMISS_LABEL = "关闭错误提示";
24
+ const PluginStatusPill = memo(function PluginStatusPill({ tone, label, isLoading = false, className, ...attributes }) {
25
+ return /* @__PURE__ */ jsxs("span", {
26
+ ...attributes,
27
+ "data-tone": tone,
28
+ "data-loading": isLoading || void 0,
29
+ className: joinClassNames("workbase-pill", className),
30
+ children: [isLoading ? /* @__PURE__ */ jsx("span", {
31
+ "aria-hidden": "true",
32
+ className: "workbase-pill-spinner"
33
+ }) : /* @__PURE__ */ jsx("span", {
34
+ "aria-hidden": "true",
35
+ className: "workbase-pill-dot"
36
+ }), /* @__PURE__ */ jsx("span", { children: label })]
37
+ });
38
+ });
39
+ const PluginInlineError = memo(function PluginInlineError({ message, actionLabel, onAction, isActionDisabled = false, onDismiss, dismissLabel = DEFAULT_DISMISS_LABEL, className, ...attributes }) {
40
+ return /* @__PURE__ */ jsxs("div", {
41
+ role: "alert",
42
+ ...attributes,
43
+ className: joinClassNames("workbase-inline-error", className),
44
+ children: [
45
+ /* @__PURE__ */ jsx("span", { children: message }),
46
+ actionLabel && onAction ? /* @__PURE__ */ jsx("button", {
47
+ type: "button",
48
+ disabled: isActionDisabled,
49
+ onClick: onAction,
50
+ children: actionLabel
51
+ }) : null,
52
+ onDismiss ? /* @__PURE__ */ jsx("button", {
53
+ type: "button",
54
+ className: "workbase-error-close",
55
+ "aria-label": dismissLabel,
56
+ title: dismissLabel,
57
+ onClick: onDismiss
58
+ }) : null
59
+ ]
60
+ });
61
+ });
62
+ const PluginEmptyState = memo(function PluginEmptyState({ title, description, icon, action, className, ...attributes }) {
63
+ return /* @__PURE__ */ jsxs("section", {
64
+ ...attributes,
65
+ className: joinClassNames("workbase-empty-state", className),
66
+ children: [
67
+ icon ? /* @__PURE__ */ jsx("span", {
68
+ "aria-hidden": "true",
69
+ className: "workbase-empty-icon",
70
+ children: icon
71
+ }) : null,
72
+ /* @__PURE__ */ jsx("h2", {
73
+ className: "workbase-empty-title",
74
+ children: title
75
+ }),
76
+ description ? /* @__PURE__ */ jsx("p", {
77
+ className: "workbase-empty-description",
78
+ children: description
79
+ }) : null,
80
+ action ? /* @__PURE__ */ jsx("div", {
81
+ className: "workbase-empty-action",
82
+ children: action
83
+ }) : null
84
+ ]
85
+ });
86
+ });
87
+ var PluginErrorBoundary = class extends Component {
88
+ state = {
89
+ error: null,
90
+ componentStack: null
91
+ };
92
+ static getDerivedStateFromError(error) {
93
+ return { error: error instanceof Error ? error : new Error(String(error ?? "未知渲染异常")) };
94
+ }
95
+ componentDidCatch(_error, info) {
96
+ this.setState({ componentStack: info.componentStack?.trim() || null });
97
+ }
98
+ handleReset = () => {
99
+ this.setState({
100
+ error: null,
101
+ componentStack: null
102
+ });
103
+ this.props.onReset?.();
104
+ };
105
+ render() {
106
+ const { error, componentStack } = this.state;
107
+ if (!error) return this.props.children;
108
+ const details = [error.stack || error.message, componentStack].filter(Boolean).join("\n\n");
109
+ return /* @__PURE__ */ jsx("div", {
110
+ className: "workbase-feedback-page workbase-error-boundary",
111
+ children: /* @__PURE__ */ jsx(PluginErrorPanel, {
112
+ title: this.props.title ?? DEFAULT_ERROR_BOUNDARY_TITLE,
113
+ error: error.message,
114
+ scope: this.props.scope ?? DEFAULT_ERROR_BOUNDARY_SCOPE,
115
+ recovery: this.props.recovery ?? DEFAULT_ERROR_BOUNDARY_RECOVERY,
116
+ technicalDetails: details,
117
+ children: /* @__PURE__ */ jsx("button", {
118
+ type: "button",
119
+ className: "workbase-error-retry",
120
+ onClick: this.handleReset,
121
+ children: this.props.retryLabel ?? DEFAULT_RETRY_LABEL
122
+ })
123
+ })
124
+ });
125
+ }
126
+ };
127
+ function joinClassNames(...values) {
128
+ return values.filter(Boolean).join(" ");
129
+ }
130
+ //#endregion
131
+ export { PluginStatusTone as a, PluginStatusPill as i, PluginErrorBoundary as n, PluginInlineError as r, PluginEmptyState as t };
@@ -0,0 +1,5 @@
1
+ //#region src/host-services.ts
2
+ const DEFAULT_VIEW_STATE_TOPIC = "default";
3
+ const MAXIMUM_VIEW_STATE_BYTES = 1048576;
4
+ //#endregion
5
+ export { MAXIMUM_VIEW_STATE_BYTES as n, DEFAULT_VIEW_STATE_TOPIC as t };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as executionLogRecordSchema, i as executionLogEntrySchema, n as ExecutionLogEntryKind, r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-Bq2u5C90.js";
2
- import { $ as WorkbasePluginDefinition, A as PluginLifecycleStatus, At as PluginViewCatalogEntry, B as PluginRepository, C as PluginHookId, Ct as PluginSystemContextService, D as PluginLifecycleHook, Dt as PluginToastApi, E as PluginLifecycleDispatchResult, Et as PluginTaskService, F as PluginProcessApi, Ft as roleToolEnvironmentSchema, G as PluginStatusContribution, H as PluginSetupHooks, I as PluginProcessOutputMode, It as roleToolsAppliedSchema, J as PluginViewContribution, K as PluginStatusDefinition, L as PluginProcessResult, Lt as roleToolsProposalSchema, M as PluginOverviewCardData, Mt as RoleToolEnvironment, N as PluginOverviewCardDefinition, Nt as RoleToolsApplied, O as PluginLifecycleOutcome, Ot as PluginToastLevel, P as PluginOverviewCardStatus, Pt as RoleToolsProposal, Q as PluginWorkspace, R as PluginProcessRunOptions, S as PluginFileChange, St as PluginStoreApi, T as PluginInvocationContext, Tt as PluginTaskResult, U as PluginSharedChangeKind, V as PluginRepositoryStatus, W as PluginSharedChanges, X as PluginViewLayout, Y as PluginViewDefinition, Z as PluginViewMethod, _ as PluginContributionSnapshot, _t as PluginPromptQuestion, a as PluginCapabilityReference, at as PluginCapabilityService, b as PluginExecutionSnapshot, bt as PluginPublicationChanges, c as PluginCommandContribution, ct as PluginExecutionService, d as PluginCommandEffect, dt as PluginLogEntry, et as PluginAgentContextCatalogEntry, f as PluginCommandExecutionResult, ft as PluginLogQueryRequest, g as PluginContextExposure, gt as PluginPromptChoice, h as PluginContext, ht as PluginPromptApi, i as PluginCapabilityKind, it as PluginCapabilityResolveRequest, j as PluginLogger, jt as PluginToolsService, k as PluginLifecyclePolicy, kt as PluginToastOptions, l as PluginCommandDefinition, lt as PluginHostServices, m as PluginCommandTransaction, mt as PluginLogService, n as PluginAgentContextDefinition, nt as PluginCapabilityCatalog, o as PluginCardAction, ot as PluginCommandCatalogEntry, p as PluginCommandLogPolicy, pt as PluginLogQueryResult, q as PluginToolContribution, r as PluginAgentScope, rt as PluginCapabilityCommandRequest, s as PluginCommandContext, st as PluginConfigApi, t as PluginAgentContextContribution, tt as PluginAgentPolicy, u as PluginCommandDetails, ut as PluginInteractiveLogger, v as PluginDisposable, vt as PluginPromptType, w as PluginHookResult, wt as PluginTaskDescriptor, x as PluginExecutionStatus, xt as PluginStatusCatalogEntry, y as PluginExecutionEvidence, yt as PluginPromptViewRequest, z as PluginProject } from "./types-WIMkhmH4.js";
2
+ import { $ as WorkbasePluginDefinition, A as PluginLifecycleStatus, At as PluginToastLevel, B as PluginRepository, Bt as roleToolsAppliedSchema, C as PluginHookId, Ct as PluginStatusCatalogEntry, D as PluginLifecycleHook, Dt as PluginTaskResult, E as PluginLifecycleDispatchResult, Et as PluginTaskDescriptor, F as PluginProcessApi, Ft as PluginToolsService, G as PluginStatusContribution, H as PluginSetupHooks, I as PluginProcessOutputMode, It as RoleToolEnvironment, J as PluginViewContribution, K as PluginStatusDefinition, L as PluginProcessResult, Lt as RoleToolsApplied, M as PluginOverviewCardData, Mt as PluginViewCatalogEntry, N as PluginOverviewCardDefinition, Nt as PluginViewStatePublishOptions, O as PluginLifecycleOutcome, Ot as PluginTaskService, P as PluginOverviewCardStatus, Pt as PluginViewStateService, Q as PluginWorkspace, R as PluginProcessRunOptions, Rt as RoleToolsProposal, S as PluginFileChange, St as PluginPublicationChanges, T as PluginInvocationContext, Tt as PluginSystemContextService, U as PluginSharedChangeKind, V as PluginRepositoryStatus, Vt as roleToolsProposalSchema, W as PluginSharedChanges, X as PluginViewLayout, Y as PluginViewDefinition, Z as PluginViewMethod, _ as PluginContributionSnapshot, _t as PluginPromptApi, a as PluginCapabilityReference, at as PluginCapabilityCommandRequest, b as PluginExecutionSnapshot, bt as PluginPromptType, c as PluginCommandContribution, ct as PluginCommandCatalogEntry, d as PluginCommandEffect, dt as PluginHostServices, et as DEFAULT_VIEW_STATE_TOPIC, f as PluginCommandExecutionResult, ft as PluginInteractiveLogger, g as PluginContextExposure, gt as PluginLogService, h as PluginContext, ht as PluginLogQueryResult, i as PluginCapabilityKind, it as PluginCapabilityCatalog, j as PluginLogger, jt as PluginToastOptions, k as PluginLifecyclePolicy, kt as PluginToastApi, l as PluginCommandDefinition, lt as PluginConfigApi, m as PluginCommandTransaction, mt as PluginLogQueryRequest, n as PluginAgentContextDefinition, nt as PluginAgentContextCatalogEntry, o as PluginCardAction, ot as PluginCapabilityResolveRequest, p as PluginCommandLogPolicy, pt as PluginLogEntry, q as PluginToolContribution, r as PluginAgentScope, rt as PluginAgentPolicy, s as PluginCommandContext, st as PluginCapabilityService, t as PluginAgentContextContribution, tt as MAXIMUM_VIEW_STATE_BYTES, u as PluginCommandDetails, ut as PluginExecutionService, v as PluginDisposable, vt as PluginPromptChoice, w as PluginHookResult, wt as PluginStoreApi, x as PluginExecutionStatus, xt as PluginPromptViewRequest, y as PluginExecutionEvidence, yt as PluginPromptQuestion, z as PluginProject, zt as roleToolEnvironmentSchema } from "./types-DDEHTBRv.js";
3
3
  import { ZodError, ZodType, z } from "zod";
4
4
  //#region src/error.d.ts
5
5
  /**
@@ -25,4 +25,4 @@ type DefinedWorkbasePlugin = Readonly<WorkbasePluginDefinition>;
25
25
  export declare function definePlugin(definition: WorkbasePluginDefinition): DefinedWorkbasePlugin;
26
26
  export declare function isDefinedPlugin(value: unknown): value is DefinedWorkbasePlugin;
27
27
  //#endregion
28
- export { type DefinedWorkbasePlugin, type ExecutionLogEntry, ExecutionLogEntryKind, type ExecutionLogRecord, type PluginAgentContextCatalogEntry, type PluginAgentContextContribution, type PluginAgentContextDefinition, type PluginAgentPolicy, PluginAgentScope, type PluginCapabilityCatalog, type PluginCapabilityCommandRequest, PluginCapabilityKind, type PluginCapabilityReference, type PluginCapabilityResolveRequest, type PluginCapabilityService, type PluginCardAction, type PluginCommandCatalogEntry, type PluginCommandContext, type PluginCommandContribution, type PluginCommandDefinition, type PluginCommandDetails, PluginCommandEffect, type PluginCommandExecutionResult, PluginCommandLogPolicy, PluginCommandTransaction, type PluginConfigApi, type PluginContext, PluginContextExposure, type PluginContributionSnapshot, type PluginDisposable, type PluginErrorOptions, type PluginExecutionEvidence, type PluginExecutionService, type PluginExecutionSnapshot, PluginExecutionStatus, type PluginFileChange, PluginHookId, type PluginHookResult, type PluginHostServices, type PluginInteractiveLogger, type PluginInvocationContext, type PluginLifecycleDispatchResult, type PluginLifecycleHook, type PluginLifecycleOutcome, PluginLifecyclePolicy, PluginLifecycleStatus, type PluginLogEntry, type PluginLogQueryRequest, type PluginLogQueryResult, type PluginLogService, type PluginLogger, type PluginOverviewCardData, type PluginOverviewCardDefinition, type PluginOverviewCardStatus, type PluginProcessApi, PluginProcessOutputMode, type PluginProcessResult, type PluginProcessRunOptions, type PluginProject, type PluginPromptApi, type PluginPromptChoice, type PluginPromptQuestion, type PluginPromptType, type PluginPromptViewRequest, type PluginPublicationChanges, type PluginRepository, PluginRepositoryStatus, type PluginSetupHooks, PluginSharedChangeKind, type PluginSharedChanges, type PluginStatusCatalogEntry, type PluginStatusContribution, type PluginStatusDefinition, type PluginStoreApi, type PluginSystemContextService, type PluginTaskDescriptor, type PluginTaskResult, type PluginTaskService, type PluginToastApi, type PluginToastLevel, type PluginToastOptions, type PluginToolContribution, PluginToolsService, type PluginViewCatalogEntry, type PluginViewContribution, type PluginViewDefinition, PluginViewLayout, PluginViewMethod, type PluginWorkspace, RoleToolEnvironment, RoleToolsApplied, RoleToolsProposal, type WorkbasePluginDefinition, ZodError, type ZodType, executionLogEntrySchema, executionLogRecordSchema, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, z };
28
+ export { DEFAULT_VIEW_STATE_TOPIC, type DefinedWorkbasePlugin, type ExecutionLogEntry, ExecutionLogEntryKind, type ExecutionLogRecord, MAXIMUM_VIEW_STATE_BYTES, type PluginAgentContextCatalogEntry, type PluginAgentContextContribution, type PluginAgentContextDefinition, type PluginAgentPolicy, PluginAgentScope, type PluginCapabilityCatalog, type PluginCapabilityCommandRequest, PluginCapabilityKind, type PluginCapabilityReference, type PluginCapabilityResolveRequest, type PluginCapabilityService, type PluginCardAction, type PluginCommandCatalogEntry, type PluginCommandContext, type PluginCommandContribution, type PluginCommandDefinition, type PluginCommandDetails, PluginCommandEffect, type PluginCommandExecutionResult, PluginCommandLogPolicy, PluginCommandTransaction, type PluginConfigApi, type PluginContext, PluginContextExposure, type PluginContributionSnapshot, type PluginDisposable, type PluginErrorOptions, type PluginExecutionEvidence, type PluginExecutionService, type PluginExecutionSnapshot, PluginExecutionStatus, type PluginFileChange, PluginHookId, type PluginHookResult, type PluginHostServices, type PluginInteractiveLogger, type PluginInvocationContext, type PluginLifecycleDispatchResult, type PluginLifecycleHook, type PluginLifecycleOutcome, PluginLifecyclePolicy, PluginLifecycleStatus, type PluginLogEntry, type PluginLogQueryRequest, type PluginLogQueryResult, type PluginLogService, type PluginLogger, type PluginOverviewCardData, type PluginOverviewCardDefinition, type PluginOverviewCardStatus, type PluginProcessApi, PluginProcessOutputMode, type PluginProcessResult, type PluginProcessRunOptions, type PluginProject, type PluginPromptApi, type PluginPromptChoice, type PluginPromptQuestion, type PluginPromptType, type PluginPromptViewRequest, type PluginPublicationChanges, type PluginRepository, PluginRepositoryStatus, type PluginSetupHooks, PluginSharedChangeKind, type PluginSharedChanges, type PluginStatusCatalogEntry, type PluginStatusContribution, type PluginStatusDefinition, type PluginStoreApi, type PluginSystemContextService, type PluginTaskDescriptor, type PluginTaskResult, type PluginTaskService, type PluginToastApi, type PluginToastLevel, type PluginToastOptions, type PluginToolContribution, PluginToolsService, type PluginViewCatalogEntry, type PluginViewContribution, type PluginViewDefinition, PluginViewLayout, PluginViewMethod, type PluginViewStatePublishOptions, type PluginViewStateService, type PluginWorkspace, RoleToolEnvironment, RoleToolsApplied, RoleToolsProposal, type WorkbasePluginDefinition, ZodError, type ZodType, executionLogEntrySchema, executionLogRecordSchema, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, z };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { n as MAXIMUM_VIEW_STATE_BYTES, t as DEFAULT_VIEW_STATE_TOPIC } from "./host-services-cIH3aYQD.js";
1
2
  import { ZodError, z, z as z$1 } from "zod";
2
3
  //#region src/error.ts
3
4
  var PluginError = class extends Error {
@@ -303,4 +304,4 @@ const executionLogRecordSchema = z$1.object({
303
304
  context: executionContextSchema.optional()
304
305
  });
305
306
  //#endregion
306
- export { ExecutionLogEntryKind, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandEffect, PluginCommandLogPolicy, PluginCommandTransaction, PluginContextExposure, PluginError, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, PluginViewMethod, ZodError, createPluginError, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, z };
307
+ export { DEFAULT_VIEW_STATE_TOPIC, ExecutionLogEntryKind, MAXIMUM_VIEW_STATE_BYTES, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandEffect, PluginCommandLogPolicy, PluginCommandTransaction, PluginContextExposure, PluginError, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, PluginViewMethod, ZodError, createPluginError, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, z };
@@ -1,4 +1,4 @@
1
- import { T as PluginInvocationContext } from "./types-WIMkhmH4.js";
1
+ import { T as PluginInvocationContext } from "./types-DDEHTBRv.js";
2
2
  //#region src/Markdown.dto.d.ts
3
3
  interface MarkdownDocument {
4
4
  readonly path: string;
@@ -298,6 +298,15 @@ interface PluginExecutionService {
298
298
  readonly input: unknown;
299
299
  }) => Promise<unknown>;
300
300
  }
301
+ declare const DEFAULT_VIEW_STATE_TOPIC = "default";
302
+ declare const MAXIMUM_VIEW_STATE_BYTES: number;
303
+ interface PluginViewStatePublishOptions {
304
+ readonly topic?: string;
305
+ }
306
+ interface PluginViewStateService {
307
+ /** Pushes a bounded, JSON-serializable state snapshot to active views of this plugin. */
308
+ readonly publishState: (state: unknown, options?: PluginViewStatePublishOptions) => void;
309
+ }
301
310
  interface PluginHostServices {
302
311
  readonly executions: PluginExecutionService;
303
312
  readonly capabilities: PluginCapabilityService;
@@ -310,6 +319,7 @@ interface PluginHostServices {
310
319
  readonly toast: PluginToastApi;
311
320
  readonly tasks: PluginTaskService;
312
321
  readonly tools: PluginToolsService;
322
+ readonly views?: PluginViewStateService;
313
323
  readonly workspace: {
314
324
  /** Observe plugin-owned inputs during activation. The optional plugin command runs through the host transaction before notifying views. */
315
325
  readonly watchFiles?: (targets: readonly {
@@ -720,4 +730,4 @@ interface PluginContributionSnapshot {
720
730
  readonly views: readonly PluginViewContribution[];
721
731
  }
722
732
  //#endregion
723
- export { WorkbasePluginDefinition as $, PluginLifecycleStatus as A, PluginViewCatalogEntry as At, PluginRepository as B, PluginHookId as C, PluginSystemContextService as Ct, PluginLifecycleHook as D, PluginToastApi as Dt, PluginLifecycleDispatchResult as E, PluginTaskService as Et, PluginProcessApi as F, roleToolEnvironmentSchema as Ft, PluginStatusContribution as G, PluginSetupHooks as H, PluginProcessOutputMode as I, roleToolsAppliedSchema as It, PluginViewContribution as J, PluginStatusDefinition as K, PluginProcessResult as L, roleToolsProposalSchema as Lt, PluginOverviewCardData as M, RoleToolEnvironment as Mt, PluginOverviewCardDefinition as N, RoleToolsApplied as Nt, PluginLifecycleOutcome as O, PluginToastLevel as Ot, PluginOverviewCardStatus as P, RoleToolsProposal as Pt, PluginWorkspace as Q, PluginProcessRunOptions as R, PluginFileChange as S, PluginStoreApi as St, PluginInvocationContext as T, PluginTaskResult as Tt, PluginSharedChangeKind as U, PluginRepositoryStatus as V, PluginSharedChanges as W, PluginViewLayout as X, PluginViewDefinition as Y, PluginViewMethod as Z, PluginContributionSnapshot as _, PluginPromptQuestion as _t, PluginCapabilityReference as a, PluginCapabilityService as at, PluginExecutionSnapshot as b, PluginPublicationChanges as bt, PluginCommandContribution as c, PluginExecutionService as ct, PluginCommandEffect as d, PluginLogEntry as dt, PluginAgentContextCatalogEntry as et, PluginCommandExecutionResult as f, PluginLogQueryRequest as ft, PluginContextExposure as g, PluginPromptChoice as gt, PluginContext as h, PluginPromptApi as ht, PluginCapabilityKind as i, PluginCapabilityResolveRequest as it, PluginLogger as j, PluginToolsService as jt, PluginLifecyclePolicy as k, PluginToastOptions as kt, PluginCommandDefinition as l, PluginHostServices as lt, PluginCommandTransaction as m, PluginLogService as mt, PluginAgentContextDefinition as n, PluginCapabilityCatalog as nt, PluginCardAction as o, PluginCommandCatalogEntry as ot, PluginCommandLogPolicy as p, PluginLogQueryResult as pt, PluginToolContribution as q, PluginAgentScope as r, PluginCapabilityCommandRequest as rt, PluginCommandContext as s, PluginConfigApi as st, PluginAgentContextContribution as t, PluginAgentPolicy as tt, PluginCommandDetails as u, PluginInteractiveLogger as ut, PluginDisposable as v, PluginPromptType as vt, PluginHookResult as w, PluginTaskDescriptor as wt, PluginExecutionStatus as x, PluginStatusCatalogEntry as xt, PluginExecutionEvidence as y, PluginPromptViewRequest as yt, PluginProject as z };
733
+ export { WorkbasePluginDefinition as $, PluginLifecycleStatus as A, PluginToastLevel as At, PluginRepository as B, roleToolsAppliedSchema as Bt, PluginHookId as C, PluginStatusCatalogEntry as Ct, PluginLifecycleHook as D, PluginTaskResult as Dt, PluginLifecycleDispatchResult as E, PluginTaskDescriptor as Et, PluginProcessApi as F, PluginToolsService as Ft, PluginStatusContribution as G, PluginSetupHooks as H, PluginProcessOutputMode as I, RoleToolEnvironment as It, PluginViewContribution as J, PluginStatusDefinition as K, PluginProcessResult as L, RoleToolsApplied as Lt, PluginOverviewCardData as M, PluginViewCatalogEntry as Mt, PluginOverviewCardDefinition as N, PluginViewStatePublishOptions as Nt, PluginLifecycleOutcome as O, PluginTaskService as Ot, PluginOverviewCardStatus as P, PluginViewStateService as Pt, PluginWorkspace as Q, PluginProcessRunOptions as R, RoleToolsProposal as Rt, PluginFileChange as S, PluginPublicationChanges as St, PluginInvocationContext as T, PluginSystemContextService as Tt, PluginSharedChangeKind as U, PluginRepositoryStatus as V, roleToolsProposalSchema as Vt, PluginSharedChanges as W, PluginViewLayout as X, PluginViewDefinition as Y, PluginViewMethod as Z, PluginContributionSnapshot as _, PluginPromptApi as _t, PluginCapabilityReference as a, PluginCapabilityCommandRequest as at, PluginExecutionSnapshot as b, PluginPromptType as bt, PluginCommandContribution as c, PluginCommandCatalogEntry as ct, PluginCommandEffect as d, PluginHostServices as dt, DEFAULT_VIEW_STATE_TOPIC as et, PluginCommandExecutionResult as f, PluginInteractiveLogger as ft, PluginContextExposure as g, PluginLogService as gt, PluginContext as h, PluginLogQueryResult as ht, PluginCapabilityKind as i, PluginCapabilityCatalog as it, PluginLogger as j, PluginToastOptions as jt, PluginLifecyclePolicy as k, PluginToastApi as kt, PluginCommandDefinition as l, PluginConfigApi as lt, PluginCommandTransaction as m, PluginLogQueryRequest as mt, PluginAgentContextDefinition as n, PluginAgentContextCatalogEntry as nt, PluginCardAction as o, PluginCapabilityResolveRequest as ot, PluginCommandLogPolicy as p, PluginLogEntry as pt, PluginToolContribution as q, PluginAgentScope as r, PluginAgentPolicy as rt, PluginCommandContext as s, PluginCapabilityService as st, PluginAgentContextContribution as t, MAXIMUM_VIEW_STATE_BYTES as tt, PluginCommandDetails as u, PluginExecutionService as ut, PluginDisposable as v, PluginPromptChoice as vt, PluginHookResult as w, PluginStoreApi as wt, PluginExecutionStatus as x, PluginPromptViewRequest as xt, PluginExecutionEvidence as y, PluginPromptQuestion as yt, PluginProject as z, roleToolEnvironmentSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Ot as PluginToastLevel, b as PluginExecutionSnapshot, f as PluginCommandExecutionResult } from "./types-WIMkhmH4.js";
1
+ import { At as PluginToastLevel, b as PluginExecutionSnapshot, f as PluginCommandExecutionResult } from "./types-DDEHTBRv.js";
2
2
  //#region src/ui/types.d.ts
3
3
  type PluginUiPromptType = 'confirm' | 'multi-select' | 'select' | 'text';
4
4
  type PluginUiFileSelectionScope = 'project' | 'workspace';
@@ -101,11 +101,18 @@ interface PluginUiCommands {
101
101
  interface PluginUiStatus {
102
102
  readonly resolve: <Result = unknown>(statusId: string, input: unknown) => Promise<Result>;
103
103
  }
104
+ /** A single authoritative state snapshot pushed by the plugin backend. */
105
+ interface PluginUiStateChange<State = unknown> {
106
+ readonly topic: string;
107
+ readonly state: State;
108
+ }
104
109
  interface PluginUiView {
105
110
  /** Report in-memory edits to the navigation for this view instance. */
106
111
  readonly setModified: (modified: boolean) => Promise<void>;
107
112
  /** Refresh retained data when this plugin's declared files change. */
108
113
  readonly onFilesChanged: (refresh: () => void | Promise<unknown>) => () => void;
114
+ /** Subscribe to backend-pushed state snapshots for a topic (defaults to "default"). */
115
+ readonly onStateChanged: <State = unknown>(listener: (state: State) => void, topic?: string) => () => void;
109
116
  readonly call: <Result = unknown>(method: string, input: unknown) => Promise<Result>;
110
117
  }
111
118
  declare enum PluginDesktopTarget {
@@ -182,6 +189,7 @@ interface PluginUiHostMethods {
182
189
  interface PluginUiClientMethods {
183
190
  readonly filesChanged: () => Promise<void>;
184
191
  readonly executionChanged: (change: PluginUiExecutionChange) => Promise<void>;
192
+ readonly stateChanged: (change: PluginUiStateChange) => Promise<void>;
185
193
  readonly initialize: (payload: unknown) => Promise<void>;
186
194
  }
187
195
  interface PluginUiTransportConnection {
@@ -193,4 +201,4 @@ interface PluginUiControllerOptions {
193
201
  readonly targetWindow: Window & typeof globalThis;
194
202
  }
195
203
  //#endregion
196
- export { PluginUiViewIdentity as A, PluginUiRepositoryPushOutcome as C, PluginUiToastOptions as D, PluginUiStatus as E, WorkbasePluginUiDefinition as M, PluginUiTransportConnection as O, PluginUiPromptType as S, PluginUiRepositoryPushTarget as T, PluginUiNavigateOptions as _, PluginUiContextIdentity as a, PluginUiPromptChoice as b, PluginUiDesktopOpenResult as c, PluginUiFileSelectOptions as d, PluginUiFileSelectionItemType as f, PluginUiInitializationPayload as g, PluginUiHostMethods as h, PluginUiCommands as i, WorkbasePluginUi as j, PluginUiView as k, PluginUiExecutionChange as l, PluginUiHostError as m, PluginUiClientMethods as n, PluginUiControllerOptions as o, PluginUiFileSelectionScope as p, PluginUiCommandExecuteOptions as r, PluginUiDesktopOpenOptions as s, PluginDesktopTarget as t, PluginUiFileFilter as u, PluginUiOpenViewOptions as v, PluginUiRepositoryPushResult as w, PluginUiPromptOptions as x, PluginUiOutputOptions as y };
204
+ export { PluginUiView as A, PluginUiRepositoryPushOutcome as C, PluginUiStatus as D, PluginUiStateChange as E, WorkbasePluginUi as M, WorkbasePluginUiDefinition as N, PluginUiToastOptions as O, PluginUiPromptType as S, PluginUiRepositoryPushTarget as T, PluginUiNavigateOptions as _, PluginUiContextIdentity as a, PluginUiPromptChoice as b, PluginUiDesktopOpenResult as c, PluginUiFileSelectOptions as d, PluginUiFileSelectionItemType as f, PluginUiInitializationPayload as g, PluginUiHostMethods as h, PluginUiCommands as i, PluginUiViewIdentity as j, PluginUiTransportConnection as k, PluginUiExecutionChange as l, PluginUiHostError as m, PluginUiClientMethods as n, PluginUiControllerOptions as o, PluginUiFileSelectionScope as p, PluginUiCommandExecuteOptions as r, PluginUiDesktopOpenOptions as s, PluginDesktopTarget as t, PluginUiFileFilter as u, PluginUiOpenViewOptions as v, PluginUiRepositoryPushResult as w, PluginUiPromptOptions as x, PluginUiOutputOptions as y };
@@ -1,131 +1,2 @@
1
- import { PluginErrorPanel } from "./error-panel.js";
2
- import { Component, memo } from "react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/ui/Components.dto.ts
5
- let PluginStatusTone = /* @__PURE__ */ function(PluginStatusTone) {
6
- PluginStatusTone["Success"] = "success";
7
- PluginStatusTone["Warning"] = "warning";
8
- PluginStatusTone["Danger"] = "danger";
9
- PluginStatusTone["Info"] = "info";
10
- PluginStatusTone["Neutral"] = "neutral";
11
- return PluginStatusTone;
12
- }({});
13
- //#endregion
14
- //#region src/ui/components.tsx
15
- /**
16
- * Shared React primitives for Workbase plugins (status pill, inline error, empty state, error boundary).
17
- * Implemented with semantic HTML and SDK CSS tokens to stay zero-dependency beyond React.
18
- */
19
- const DEFAULT_ERROR_BOUNDARY_TITLE = "界面渲染异常";
20
- const DEFAULT_ERROR_BOUNDARY_SCOPE = "当前插件视图。";
21
- const DEFAULT_ERROR_BOUNDARY_RECOVERY = "可重试渲染当前视图;若反复出现,请刷新工作区或查看执行日志。";
22
- const DEFAULT_RETRY_LABEL = "重试渲染";
23
- const DEFAULT_DISMISS_LABEL = "关闭错误提示";
24
- const PluginStatusPill = memo(function PluginStatusPill({ tone, label, isLoading = false, className, ...attributes }) {
25
- return /* @__PURE__ */ jsxs("span", {
26
- ...attributes,
27
- "data-tone": tone,
28
- "data-loading": isLoading || void 0,
29
- className: joinClassNames("workbase-pill", className),
30
- children: [isLoading ? /* @__PURE__ */ jsx("span", {
31
- "aria-hidden": "true",
32
- className: "workbase-pill-spinner"
33
- }) : /* @__PURE__ */ jsx("span", {
34
- "aria-hidden": "true",
35
- className: "workbase-pill-dot"
36
- }), /* @__PURE__ */ jsx("span", { children: label })]
37
- });
38
- });
39
- const PluginInlineError = memo(function PluginInlineError({ message, actionLabel, onAction, isActionDisabled = false, onDismiss, dismissLabel = DEFAULT_DISMISS_LABEL, className, ...attributes }) {
40
- return /* @__PURE__ */ jsxs("div", {
41
- role: "alert",
42
- ...attributes,
43
- className: joinClassNames("workbase-inline-error", className),
44
- children: [
45
- /* @__PURE__ */ jsx("span", { children: message }),
46
- actionLabel && onAction ? /* @__PURE__ */ jsx("button", {
47
- type: "button",
48
- disabled: isActionDisabled,
49
- onClick: onAction,
50
- children: actionLabel
51
- }) : null,
52
- onDismiss ? /* @__PURE__ */ jsx("button", {
53
- type: "button",
54
- className: "workbase-error-close",
55
- "aria-label": dismissLabel,
56
- title: dismissLabel,
57
- onClick: onDismiss
58
- }) : null
59
- ]
60
- });
61
- });
62
- const PluginEmptyState = memo(function PluginEmptyState({ title, description, icon, action, className, ...attributes }) {
63
- return /* @__PURE__ */ jsxs("section", {
64
- ...attributes,
65
- className: joinClassNames("workbase-empty-state", className),
66
- children: [
67
- icon ? /* @__PURE__ */ jsx("span", {
68
- "aria-hidden": "true",
69
- className: "workbase-empty-icon",
70
- children: icon
71
- }) : null,
72
- /* @__PURE__ */ jsx("h2", {
73
- className: "workbase-empty-title",
74
- children: title
75
- }),
76
- description ? /* @__PURE__ */ jsx("p", {
77
- className: "workbase-empty-description",
78
- children: description
79
- }) : null,
80
- action ? /* @__PURE__ */ jsx("div", {
81
- className: "workbase-empty-action",
82
- children: action
83
- }) : null
84
- ]
85
- });
86
- });
87
- var PluginErrorBoundary = class extends Component {
88
- state = {
89
- error: null,
90
- componentStack: null
91
- };
92
- static getDerivedStateFromError(error) {
93
- return { error: error instanceof Error ? error : new Error(String(error ?? "未知渲染异常")) };
94
- }
95
- componentDidCatch(_error, info) {
96
- this.setState({ componentStack: info.componentStack?.trim() || null });
97
- }
98
- handleReset = () => {
99
- this.setState({
100
- error: null,
101
- componentStack: null
102
- });
103
- this.props.onReset?.();
104
- };
105
- render() {
106
- const { error, componentStack } = this.state;
107
- if (!error) return this.props.children;
108
- const details = [error.stack || error.message, componentStack].filter(Boolean).join("\n\n");
109
- return /* @__PURE__ */ jsx("div", {
110
- className: "workbase-feedback-page workbase-error-boundary",
111
- children: /* @__PURE__ */ jsx(PluginErrorPanel, {
112
- title: this.props.title ?? DEFAULT_ERROR_BOUNDARY_TITLE,
113
- error: error.message,
114
- scope: this.props.scope ?? DEFAULT_ERROR_BOUNDARY_SCOPE,
115
- recovery: this.props.recovery ?? DEFAULT_ERROR_BOUNDARY_RECOVERY,
116
- technicalDetails: details,
117
- children: /* @__PURE__ */ jsx("button", {
118
- type: "button",
119
- className: "workbase-error-retry",
120
- onClick: this.handleReset,
121
- children: this.props.retryLabel ?? DEFAULT_RETRY_LABEL
122
- })
123
- })
124
- });
125
- }
126
- };
127
- function joinClassNames(...values) {
128
- return values.filter(Boolean).join(" ");
129
- }
130
- //#endregion
1
+ import { a as PluginStatusTone, i as PluginStatusPill, n as PluginErrorBoundary, r as PluginInlineError, t as PluginEmptyState } from "../components-DxL-99bM.js";
131
2
  export { PluginEmptyState, PluginErrorBoundary, PluginInlineError, PluginStatusPill, PluginStatusTone };
@@ -0,0 +1,70 @@
1
+ import { M as WorkbasePluginUi, g as PluginUiInitializationPayload } from "../types-b6G-gae3.js";
2
+ import { ReactNode, RefObject } from "react";
3
+ //#region src/ui/hooks.d.ts
4
+ export interface ReactRootLike {
5
+ readonly render: (children: ReactNode) => void;
6
+ }
7
+ export interface MountedPluginViewContext {
8
+ readonly host: WorkbasePluginUi;
9
+ readonly initialization: PluginUiInitializationPayload;
10
+ readonly contextKey: string;
11
+ }
12
+ export interface MountPluginViewOptions {
13
+ readonly createRoot: (container: Element) => ReactRootLike;
14
+ readonly elementId?: string;
15
+ readonly errorTitle: string;
16
+ readonly errorScope: string;
17
+ readonly errorRecovery?: string;
18
+ readonly keyFor?: (initialization: PluginUiInitializationPayload) => string;
19
+ readonly wrap?: (children: ReactNode) => ReactNode;
20
+ readonly render: (context: MountedPluginViewContext) => ReactNode;
21
+ }
22
+ export interface UsePluginViewStateOptions<State> {
23
+ readonly host: WorkbasePluginUi;
24
+ readonly load: (emit: (partial: State) => void) => Promise<State>;
25
+ readonly initialState?: State | null;
26
+ readonly stateTopic?: string | null;
27
+ readonly onState?: (next: State, previous: State | null) => void;
28
+ readonly pollIntervalMs?: number | ((state: State | null, error: string | null) => number | null);
29
+ readonly refreshOnFocus?: boolean;
30
+ readonly refreshOnFilesChanged?: boolean;
31
+ readonly observeVisibility?: boolean;
32
+ readonly focusCooldownMs?: number;
33
+ readonly fallbackError?: string;
34
+ readonly isBlocked?: () => boolean;
35
+ readonly loadOnMount?: boolean;
36
+ }
37
+ export interface PluginViewStateResult<State> {
38
+ readonly data: State | null;
39
+ readonly error: string | null;
40
+ readonly isRefreshing: boolean;
41
+ readonly isVisible: boolean;
42
+ readonly viewRef: (node: HTMLElement | null) => void;
43
+ readonly setError: (message: string | null) => void;
44
+ readonly clearError: () => void;
45
+ readonly refresh: () => Promise<State | null>;
46
+ readonly acceptData: (next: State) => void;
47
+ readonly invalidatePending: () => void;
48
+ }
49
+ export interface UsePluginActionOptions {
50
+ readonly onError?: (message: string) => void;
51
+ readonly fallbackError?: string;
52
+ }
53
+ export interface PluginActionResult<ActionId> {
54
+ readonly busyAction: ActionId | null;
55
+ readonly isBusy: boolean;
56
+ readonly isBusyRef: RefObject<boolean>;
57
+ readonly isMountedRef: RefObject<boolean>;
58
+ readonly run: <Value>(actionId: ActionId, task: () => Promise<Value>) => Promise<Value | undefined>;
59
+ }
60
+ /** Mounts a Workbase plugin view with shared style nonce, error boundary and workspace key isolation. */
61
+ export declare function mountPluginView(options: MountPluginViewOptions): WorkbasePluginUi;
62
+ /**
63
+ * Manages cached view state, stale-response protection, in-flight deduplication,
64
+ * backend State Sync pushes, file-change notifications and visibility-aware polling.
65
+ */
66
+ export declare function usePluginViewState<State>(options: UsePluginViewStateOptions<State>): PluginViewStateResult<State>;
67
+ /** Serializes mutating plugin actions so concurrent clicks never overlap or leak stale errors. */
68
+ export declare function usePluginAction<ActionId>(options?: UsePluginActionOptions): PluginActionResult<ActionId>;
69
+ export declare function buildViewContextKey(payload: PluginUiInitializationPayload): string;
70
+ //#endregion