@eworkbase/sdk 0.8.0 → 0.8.2

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/index.d.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  import { a as executionLogRecordSchema, i as executionLogEntrySchema, n as ExecutionLogEntryKind, r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-ig9GUWhK.js";
2
- import { $ as PluginViewDefinition, A as PluginLifecycleDispatchResult, At as PluginTaskResult, B as PluginProcessOutputMode, Bt as RoleToolEnvironment, C as PluginExecutionEvidence, Ct as PluginPromptQuestion, D as PluginHookId, Dt as PluginStoreApi, E as PluginFileChange, Et as PluginStatusCatalogEntry, F as PluginLogger, Ft as PluginViewCatalogEntry, G as PluginRepositoryStatus, Gt as roleToolsProposalSchema, H as PluginProcessRunOptions, Ht as RoleToolsProposal, I as PluginOverviewCardData, It as PluginWorkflowContribution, J as PluginSharedChanges, K as PluginSetupHooks, L as PluginOverviewCardDefinition, Lt as PluginWorkflowOutput, M as PluginLifecycleOutcome, Mt as PluginToastApi, N as PluginLifecyclePolicy, Nt as PluginToastLevel, O as PluginHookResult, Ot as PluginSystemContextService, P as PluginLifecycleStatus, Pt as PluginToastOptions, Q as PluginViewContribution, R as PluginOverviewCardStatus, Rt as workflowContributionSchema, S as PluginDisposable, St as PluginPromptChoice, T as PluginExecutionStatus, Tt as PluginPromptViewRequest, U as PluginProject, Ut as roleToolEnvironmentSchema, V as PluginProcessResult, Vt as RoleToolsApplied, W as PluginRepository, Wt as roleToolsAppliedSchema, X as PluginStatusDefinition, Y as PluginStatusContribution, Z as PluginToolContribution, _ as PluginCommandOption, _t as PluginLogEntry, a as PluginCapabilityReference, at as PluginAgentContextCatalogEntry, b as PluginContextExposure, bt as PluginLogService, c as PluginCommandCategory, ct as PluginCapabilityCommandRequest, d as PluginCommandDefinition, dt as PluginColoredMessage, et as PluginViewLayout, f as PluginCommandDetails, ft as PluginCommandCatalogEntry, g as PluginCommandLogPolicy, gt as PluginInteractiveLogger, h as PluginCommandExecutionResult, ht as PluginHostServices, i as PluginCapabilityKind, it as WorkbasePluginDefinition, j as PluginLifecycleHook, jt as PluginTaskService, k as PluginInvocationContext, kt as PluginTaskDescriptor, l as PluginCommandContext, lt as PluginCapabilityResolveRequest, m as PluginCommandExecutionMode, mt as PluginExecutionService, n as PluginAgentContextDefinition, nt as PluginViewRequest, o as PluginCardAction, ot as PluginAgentPolicy, p as PluginCommandEffect, pt as PluginConfigApi, q as PluginSharedChangeKind, r as PluginAgentScope, rt as PluginWorkspace, s as PluginCommandArgument, st as PluginCapabilityCatalog, t as PluginAgentContextContribution, tt as PluginViewMethod, u as PluginCommandContribution, ut as PluginCapabilityService, v as PluginCommandTransaction, vt as PluginLogQueryRequest, w as PluginExecutionSnapshot, wt as PluginPromptType, x as PluginContributionSnapshot, xt as PluginPromptApi, y as PluginContext, yt as PluginLogQueryResult, z as PluginProcessApi, zt as PluginToolsService } from "./types-DoDWh0mS.js";
2
+ import { $ as PluginViewDefinition, A as PluginLifecycleDispatchResult, At as PluginTaskResult, B as PluginProcessOutputMode, Bt as RoleToolEnvironment, C as PluginExecutionEvidence, Ct as PluginPromptQuestion, D as PluginHookId, Dt as PluginStoreApi, E as PluginFileChange, Et as PluginStatusCatalogEntry, F as PluginLogger, Ft as PluginViewCatalogEntry, G as PluginRepositoryStatus, Gt as roleToolsProposalSchema, H as PluginProcessRunOptions, Ht as RoleToolsProposal, I as PluginOverviewCardData, It as PluginWorkflowContribution, J as PluginSharedChanges, K as PluginSetupHooks, L as PluginOverviewCardDefinition, Lt as PluginWorkflowOutput, M as PluginLifecycleOutcome, Mt as PluginToastApi, N as PluginLifecyclePolicy, Nt as PluginToastLevel, O as PluginHookResult, Ot as PluginSystemContextService, P as PluginLifecycleStatus, Pt as PluginToastOptions, Q as PluginViewContribution, R as PluginOverviewCardStatus, Rt as workflowContributionSchema, S as PluginDisposable, St as PluginPromptChoice, T as PluginExecutionStatus, Tt as PluginPromptViewRequest, U as PluginProject, Ut as roleToolEnvironmentSchema, V as PluginProcessResult, Vt as RoleToolsApplied, W as PluginRepository, Wt as roleToolsAppliedSchema, X as PluginStatusDefinition, Y as PluginStatusContribution, Z as PluginToolContribution, _ as PluginCommandOption, _t as PluginLogEntry, a as PluginCapabilityReference, at as PluginAgentContextCatalogEntry, b as PluginContextExposure, bt as PluginLogService, c as PluginCommandCategory, ct as PluginCapabilityCommandRequest, d as PluginCommandDefinition, dt as PluginColoredMessage, et as PluginViewLayout, f as PluginCommandDetails, ft as PluginCommandCatalogEntry, g as PluginCommandLogPolicy, gt as PluginInteractiveLogger, h as PluginCommandExecutionResult, ht as PluginHostServices, i as PluginCapabilityKind, it as WorkbasePluginDefinition, j as PluginLifecycleHook, jt as PluginTaskService, k as PluginInvocationContext, kt as PluginTaskDescriptor, l as PluginCommandContext, lt as PluginCapabilityResolveRequest, m as PluginCommandExecutionMode, mt as PluginExecutionService, n as PluginAgentContextDefinition, nt as PluginViewRequest, o as PluginCardAction, ot as PluginAgentPolicy, p as PluginCommandEffect, pt as PluginConfigApi, q as PluginSharedChangeKind, r as PluginAgentScope, rt as PluginWorkspace, s as PluginCommandArgument, st as PluginCapabilityCatalog, t as PluginAgentContextContribution, tt as PluginViewMethod, u as PluginCommandContribution, ut as PluginCapabilityService, v as PluginCommandTransaction, vt as PluginLogQueryRequest, w as PluginExecutionSnapshot, wt as PluginPromptType, x as PluginContributionSnapshot, xt as PluginPromptApi, y as PluginContext, yt as PluginLogQueryResult, z as PluginProcessApi, zt as PluginToolsService } from "./types-2X-_T_W_.js";
3
3
  export * from "zod";
4
+ //#region src/publication.d.ts
5
+ interface PublicationContext {
6
+ readonly project: PluginProject;
7
+ readonly process: PluginProcessApi;
8
+ readonly signal?: AbortSignal;
9
+ }
10
+ export declare function readPublicationChanges({ project, process, signal }: PublicationContext, directory: string): Promise<{
11
+ files: string[];
12
+ working: Set<string>;
13
+ partiallyStaged: boolean;
14
+ }>;
15
+ //#endregion
4
16
  //#region src/definition.d.ts
5
17
  export declare const PLUGIN_API_VERSION = 2;
6
18
  type DefinedWorkbasePlugin = Readonly<WorkbasePluginDefinition>;
package/dist/index.js CHANGED
@@ -1,35 +1,5 @@
1
1
  import { z } from "zod";
2
2
  export * from "zod";
3
- //#region src/definition.ts
4
- const PLUGIN_API_VERSION = 2;
5
- const PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
6
- function definePlugin(definition) {
7
- validateDefinition(definition);
8
- return Object.freeze({
9
- ...definition,
10
- dependencies: Object.freeze([...definition.dependencies ?? []])
11
- });
12
- }
13
- function isDefinedPlugin(value) {
14
- try {
15
- validateDefinition(value);
16
- return true;
17
- } catch {
18
- return false;
19
- }
20
- }
21
- function validateDefinition(definition) {
22
- if (!isRecord(definition)) throw new TypeError("definePlugin requires a plugin definition object.");
23
- if (typeof definition.id !== "string" || !PLUGIN_ID_PATTERN.test(definition.id)) throw new TypeError("Plugin id must use lowercase kebab-case.");
24
- if (typeof definition.setup !== "function") throw new TypeError("Plugin setup must be a function.");
25
- if (typeof definition.title !== "string" || definition.title.trim() === "") throw new TypeError("Plugin title must be a non-empty string.");
26
- const dependencies = definition.dependencies ?? [];
27
- if (!Array.isArray(dependencies) || dependencies.some((id) => typeof id !== "string" || !PLUGIN_ID_PATTERN.test(id) || id === definition.id) || new Set(dependencies).size !== dependencies.length) throw new TypeError("Plugin dependencies must be unique plugin ids and cannot include itself.");
28
- }
29
- function isRecord(value) {
30
- return value !== null && typeof value === "object" && !Array.isArray(value);
31
- }
32
- //#endregion
33
3
  //#region src/types.ts
34
4
  let PluginHookId = /* @__PURE__ */ function(PluginHookId) {
35
5
  PluginHookId["ProjectReconcile"] = "project.reconcile";
@@ -121,6 +91,7 @@ let PluginProcessOutputMode = /* @__PURE__ */ function(PluginProcessOutputMode)
121
91
  let PluginSharedChangeKind = /* @__PURE__ */ function(PluginSharedChangeKind) {
122
92
  PluginSharedChangeKind["None"] = "none";
123
93
  PluginSharedChangeKind["Files"] = "files";
94
+ PluginSharedChangeKind["Artifacts"] = "artifacts";
124
95
  return PluginSharedChangeKind;
125
96
  }({});
126
97
  let PluginContextExposure = /* @__PURE__ */ function(PluginContextExposure) {
@@ -134,6 +105,116 @@ let PluginViewMethod = /* @__PURE__ */ function(PluginViewMethod) {
134
105
  return PluginViewMethod;
135
106
  }({});
136
107
  //#endregion
108
+ //#region src/publication.ts
109
+ async function readPublicationChanges({ project, process, signal }, directory) {
110
+ const working = /* @__PURE__ */ new Set();
111
+ if (!project.publicationBranch) return {
112
+ files: [],
113
+ working,
114
+ partiallyStaged: false
115
+ };
116
+ const read = async (args, allowMissingAncestor = false) => {
117
+ const result = await process.run({
118
+ program: "git",
119
+ arguments: args,
120
+ currentDirectory: project.root,
121
+ outputMode: "content",
122
+ environment: {
123
+ GIT_OPTIONAL_LOCKS: "0",
124
+ GIT_LITERAL_PATHSPECS: "1",
125
+ GIT_TERMINAL_PROMPT: "0"
126
+ }
127
+ }, signal);
128
+ if (allowMissingAncestor && result.exitCode === 1 && !result.standardError && !result.timedOut && !result.wasCancelled) return "";
129
+ if (result.failed || result.timedOut || result.wasCancelled || result.standardOutputTruncated !== false) throw new Error("无法完整读取文件的发布状态。");
130
+ return result.standardOutput;
131
+ };
132
+ const names = async (args) => (await read([
133
+ ...args,
134
+ "--",
135
+ directory
136
+ ])).split("\0").filter((file) => file && !file.endsWith("/"));
137
+ const remote = "refs/remotes/origin/" + project.publicationBranch;
138
+ const common = (await read([
139
+ "merge-base",
140
+ "HEAD",
141
+ remote
142
+ ], true)).trim();
143
+ const baseline = (await read([
144
+ "for-each-ref",
145
+ "--format=%(objectname)",
146
+ `refs/workbase/publications/${project.publicationBranch}/${common || "unrelated"}`
147
+ ])).trim() || common;
148
+ if (!baseline) throw new Error("远端分支历史已更换,请先确认团队配置版本。");
149
+ const diff = [
150
+ "diff",
151
+ "--relative",
152
+ "--ignore-submodules=all",
153
+ "--no-renames",
154
+ "--name-only",
155
+ "-z"
156
+ ];
157
+ const [unstaged, staged, committed, unequal, untracked] = await Promise.all([
158
+ names(diff),
159
+ names([...diff, "--cached"]),
160
+ names([
161
+ ...diff,
162
+ baseline,
163
+ "HEAD"
164
+ ]),
165
+ names([
166
+ ...diff,
167
+ remote,
168
+ "HEAD"
169
+ ]),
170
+ names([
171
+ "ls-files",
172
+ "--others",
173
+ "--exclude-standard",
174
+ "-z"
175
+ ])
176
+ ]);
177
+ [...unstaged, ...untracked].forEach((file) => working.add(file));
178
+ const partiallyStaged = staged.some((file) => working.has(file));
179
+ staged.forEach((file) => working.add(file));
180
+ const unpublished = new Set(unequal);
181
+ return {
182
+ files: [.../* @__PURE__ */ new Set([...working, ...committed.filter((file) => unpublished.has(file))])].sort(),
183
+ working,
184
+ partiallyStaged
185
+ };
186
+ }
187
+ //#endregion
188
+ //#region src/definition.ts
189
+ const PLUGIN_API_VERSION = 2;
190
+ const PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
191
+ function definePlugin(definition) {
192
+ validateDefinition(definition);
193
+ return Object.freeze({
194
+ ...definition,
195
+ dependencies: Object.freeze([...definition.dependencies ?? []])
196
+ });
197
+ }
198
+ function isDefinedPlugin(value) {
199
+ try {
200
+ validateDefinition(value);
201
+ return true;
202
+ } catch {
203
+ return false;
204
+ }
205
+ }
206
+ function validateDefinition(definition) {
207
+ if (!isRecord(definition)) throw new TypeError("definePlugin requires a plugin definition object.");
208
+ if (typeof definition.id !== "string" || !PLUGIN_ID_PATTERN.test(definition.id)) throw new TypeError("Plugin id must use lowercase kebab-case.");
209
+ if (typeof definition.setup !== "function") throw new TypeError("Plugin setup must be a function.");
210
+ if (typeof definition.title !== "string" || definition.title.trim() === "") throw new TypeError("Plugin title must be a non-empty string.");
211
+ const dependencies = definition.dependencies ?? [];
212
+ if (!Array.isArray(dependencies) || dependencies.some((id) => typeof id !== "string" || !PLUGIN_ID_PATTERN.test(id) || id === definition.id) || new Set(dependencies).size !== dependencies.length) throw new TypeError("Plugin dependencies must be unique plugin ids and cannot include itself.");
213
+ }
214
+ function isRecord(value) {
215
+ return value !== null && typeof value === "object" && !Array.isArray(value);
216
+ }
217
+ //#endregion
137
218
  //#region src/Tools.dto.ts
138
219
  /** Typed tool-domain contracts shared by the SDK and host bridge. */
139
220
  const identifier = z.string().min(1);
@@ -325,4 +406,4 @@ const outputField = z.discriminatedUnion("type", [
325
406
  ]);
326
407
  const workflowContributionSchema = z.union([z.literal(true), z.object({ outputs: z.record(fieldKey, outputField).refine((fields) => Object.keys(fields).length <= 32) }).strict()]);
327
408
  //#endregion
328
- export { ExecutionLogEntryKind, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandCategory, PluginCommandEffect, PluginCommandExecutionMode, PluginCommandLogPolicy, PluginCommandTransaction, PluginContextExposure, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, PluginViewMethod, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, workflowContributionSchema };
409
+ export { ExecutionLogEntryKind, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandCategory, PluginCommandEffect, PluginCommandExecutionMode, PluginCommandLogPolicy, PluginCommandTransaction, PluginContextExposure, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, PluginViewMethod, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, readPublicationChanges, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema, workflowContributionSchema };
@@ -1,4 +1,4 @@
1
- import { k as PluginInvocationContext } from "./types-DoDWh0mS.js";
1
+ import { k as PluginInvocationContext } from "./types-2X-_T_W_.js";
2
2
  //#region src/Markdown.dto.d.ts
3
3
  interface MarkdownDocument {
4
4
  readonly path: string;
package/dist/style.css CHANGED
@@ -2127,7 +2127,7 @@
2127
2127
  margin: 8px 0 0;
2128
2128
  }
2129
2129
 
2130
- .markdown-document-heading button, .markdown-link-error button {
2130
+ .markdown-document-heading button {
2131
2131
  border: 1px solid var(--color-border-strong);
2132
2132
  background: var(--color-surface);
2133
2133
  color: var(--color-foreground);
@@ -2138,7 +2138,7 @@
2138
2138
  padding: 6px 10px;
2139
2139
  }
2140
2140
 
2141
- .markdown-document-heading button:hover, .markdown-link-error button:hover {
2141
+ .markdown-document-heading button:hover {
2142
2142
  background: var(--color-surface-muted);
2143
2143
  }
2144
2144
 
@@ -2147,16 +2147,6 @@
2147
2147
  outline-offset: 2px;
2148
2148
  }
2149
2149
 
2150
- .markdown-link-error {
2151
- color: var(--color-danger);
2152
- overflow-wrap: anywhere;
2153
- line-height: 1.6;
2154
- }
2155
-
2156
- .markdown-link-error button {
2157
- margin-inline-start: 8px;
2158
- }
2159
-
2160
2150
  .workbase-markdown-links .markdown-document-body {
2161
2151
  max-width: 75ch;
2162
2152
  max-height: 65vh;
@@ -357,6 +357,13 @@ interface PluginHostServices {
357
357
  readonly tasks: PluginTaskService;
358
358
  readonly tools: PluginToolsService;
359
359
  readonly workspace: {
360
+ /** Observe plugin-owned inputs during activation. The optional plugin command runs through the host transaction before notifying views. */
361
+ readonly watchFiles?: (targets: readonly {
362
+ directory: string;
363
+ pattern?: string;
364
+ recursive?: boolean;
365
+ gitMetadata?: boolean;
366
+ }[], refreshCommandId?: string) => () => void;
360
367
  /** Notifies the host to refresh one bound repository after local writes, including partial failures. */
361
368
  readonly notifyRepositoryChanged: (repositoryId: string) => Promise<void>;
362
369
  /** Checks committed code against the configured collaboration branches without closing the workspace. */
@@ -480,6 +487,8 @@ interface PluginDisposable {
480
487
  readonly dispose: () => void;
481
488
  }
482
489
  interface PluginProject {
490
+ /** Configured team publication branch. Local projects have no publication destination. */
491
+ readonly publicationBranch?: string | null;
483
492
  readonly id: string;
484
493
  readonly root: string;
485
494
  readonly workbaseRoot: string;
@@ -553,13 +562,14 @@ interface PluginInvocationContext {
553
562
  }
554
563
  declare enum PluginSharedChangeKind {
555
564
  None = "none",
556
- Files = "files"
565
+ Files = "files",
566
+ Artifacts = "artifacts"
557
567
  }
558
568
  /** Finite files relative to project.workbaseRoot; workspace files are local. */
559
569
  type PluginSharedChanges = {
560
570
  readonly kind: PluginSharedChangeKind.None;
561
571
  } | {
562
- readonly kind: PluginSharedChangeKind.Files;
572
+ readonly kind: PluginSharedChangeKind.Files | PluginSharedChangeKind.Artifacts;
563
573
  readonly paths: readonly string[];
564
574
  };
565
575
  /** Explicit, sanitized business details for the command execution record. */
@@ -1,8 +1,5 @@
1
- import { h as PluginCommandExecutionResult, w as PluginExecutionSnapshot } from "./types-DoDWh0mS.js";
1
+ import { Nt as PluginToastLevel, h as PluginCommandExecutionResult, w as PluginExecutionSnapshot } from "./types-2X-_T_W_.js";
2
2
  //#region src/ui/types.d.ts
3
- /**
4
- * Browser authoring API and transport contracts for Workbase plugin views.
5
- */
6
3
  type PluginUiPromptType = 'confirm' | 'multi-select' | 'select' | 'text';
7
4
  type PluginUiFileSelectionScope = 'project' | 'workspace';
8
5
  type PluginUiFileSelectionItemType = 'any' | 'directory' | 'file';
@@ -38,6 +35,7 @@ interface PluginUiNavigateOptions {
38
35
  interface PluginUiToastOptions {
39
36
  readonly description: string;
40
37
  readonly title: string;
38
+ readonly level?: PluginToastLevel;
41
39
  }
42
40
  interface PluginUiPromptChoice<Value = unknown> {
43
41
  readonly label: string;
@@ -92,6 +90,10 @@ interface PluginUiStatus {
92
90
  readonly resolve: <Result = unknown>(statusId: string, input: unknown) => Promise<Result>;
93
91
  }
94
92
  interface PluginUiView {
93
+ /** Report in-memory edits to the navigation for this view instance. */
94
+ readonly setModified: (modified: boolean) => Promise<void>;
95
+ /** Refresh retained data when this plugin's declared files change. */
96
+ readonly onFilesChanged: (refresh: () => void | Promise<unknown>) => () => void;
95
97
  readonly call: <Result = unknown>(method: string, input: unknown) => Promise<Result>;
96
98
  }
97
99
  declare enum PluginDesktopTarget {
@@ -141,6 +143,7 @@ interface PluginUiHostMethods {
141
143
  readonly reportFatal: (message: string) => Promise<void>;
142
144
  }
143
145
  interface PluginUiClientMethods {
146
+ readonly filesChanged: () => Promise<void>;
144
147
  readonly executionChanged: (change: PluginUiExecutionChange) => Promise<void>;
145
148
  readonly initialize: (payload: unknown) => Promise<void>;
146
149
  }
@@ -6,6 +6,7 @@ interface PluginErrorPanelProps extends HTMLAttributes<HTMLElement> {
6
6
  readonly scope: string;
7
7
  readonly recovery: string;
8
8
  readonly technicalDetails?: string;
9
+ readonly isDismissible?: boolean;
9
10
  readonly children?: ReactNode;
10
11
  }
11
12
  //#endregion
@@ -1,44 +1,88 @@
1
1
  import { errorSummary } from "./model.js";
2
- import { memo, useId } from "react";
2
+ import { memo, useId, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/ui/PluginErrorPanel.tsx
5
- /** 宿主与插件共用的错误展示,保留可见原因并折叠技术详情,不执行业务恢复。 */
6
- const PluginErrorPanel = memo(function PluginErrorPanel({ title, error, scope, recovery, technicalDetails = error, children, className, ...attributes }) {
5
+ /** 宿主与插件共用的就地错误提示,优先展示原因和恢复操作。 */
6
+ const PluginErrorPanel = memo(function PluginErrorPanel(props) {
7
+ return /* @__PURE__ */ jsx(ErrorDetails, { ...props }, JSON.stringify([
8
+ props.title,
9
+ props.error,
10
+ props.technicalDetails
11
+ ]));
12
+ });
13
+ function ErrorDetails({ title, error, scope, recovery, technicalDetails = error, isDismissible = false, children, className, ...attributes }) {
7
14
  const headingId = useId();
15
+ const detailsId = useId();
16
+ const [closed, setClosed] = useState(false);
17
+ const [showDetails, setShowDetails] = useState(false);
18
+ function handleClose() {
19
+ setShowDetails(false);
20
+ setClosed(!closed);
21
+ }
22
+ if (closed && isDismissible) return null;
8
23
  return /* @__PURE__ */ jsxs("section", {
9
24
  tabIndex: 0,
10
25
  ...attributes,
11
- role: "alert",
26
+ role: closed ? void 0 : "alert",
12
27
  "aria-labelledby": headingId,
13
28
  className: ["workbase-plugin-error", className].filter(Boolean).join(" "),
14
- children: [
15
- /* @__PURE__ */ jsx("h3", {
29
+ children: [/* @__PURE__ */ jsxs("header", {
30
+ className: "workbase-error-header",
31
+ children: [/* @__PURE__ */ jsx("h3", {
16
32
  className: "workbase-error-title",
17
33
  id: headingId,
18
34
  children: title
19
- }),
20
- /* @__PURE__ */ jsx("p", {
21
- className: "workbase-error-cause",
22
- children: errorSummary(error)
23
- }),
24
- /* @__PURE__ */ jsxs("p", {
25
- className: "workbase-error-context",
26
- children: [/* @__PURE__ */ jsx("strong", { children: "影响范围" }), scope]
27
- }),
28
- /* @__PURE__ */ jsxs("p", {
29
- className: "workbase-error-context",
30
- children: [/* @__PURE__ */ jsx("strong", { children: "处理建议" }), recovery]
31
- }),
32
- /* @__PURE__ */ jsxs("details", {
33
- className: "workbase-error-details",
34
- children: [/* @__PURE__ */ jsx("summary", { children: "技术详情" }), /* @__PURE__ */ jsx("pre", { children: technicalDetails })]
35
- }),
36
- children ? /* @__PURE__ */ jsx("div", {
37
- className: "workbase-error-actions",
38
- children
39
- }) : null
40
- ]
35
+ }), /* @__PURE__ */ jsx("button", {
36
+ type: "button",
37
+ className: closed ? "workbase-error-toggle" : "workbase-error-toggle workbase-error-close",
38
+ "aria-label": closed ? "查看错误详情" : "关闭错误提示",
39
+ title: closed ? void 0 : "关闭错误提示",
40
+ "aria-expanded": isDismissible ? void 0 : !closed,
41
+ onClick: handleClose,
42
+ children: closed ? "查看错误详情" : null
43
+ })]
44
+ }), !closed && /* @__PURE__ */ jsxs("div", {
45
+ className: "workbase-error-body",
46
+ children: [
47
+ /* @__PURE__ */ jsx("p", {
48
+ className: "workbase-error-cause",
49
+ children: errorSummary(error)
50
+ }),
51
+ /* @__PURE__ */ jsxs("div", {
52
+ className: "workbase-error-actions",
53
+ children: [children, /* @__PURE__ */ jsxs("button", {
54
+ type: "button",
55
+ className: "workbase-error-disclosure",
56
+ "aria-expanded": showDetails,
57
+ "aria-controls": detailsId,
58
+ onClick: () => setShowDetails(!showDetails),
59
+ children: [showDetails ? "收起详情" : "查看详情", /* @__PURE__ */ jsx("svg", {
60
+ "aria-hidden": "true",
61
+ width: "14",
62
+ height: "14",
63
+ viewBox: "0 0 24 24",
64
+ fill: "none",
65
+ stroke: "currentColor",
66
+ strokeWidth: "1.8",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
70
+ })]
71
+ })]
72
+ }),
73
+ /* @__PURE__ */ jsxs("dl", {
74
+ className: "workbase-error-details",
75
+ id: detailsId,
76
+ hidden: !showDetails,
77
+ children: [
78
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "影响范围" }), /* @__PURE__ */ jsx("dd", { children: scope })] }),
79
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "处理建议" }), /* @__PURE__ */ jsx("dd", { children: recovery })] }),
80
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "技术详情" }), /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx("pre", { children: technicalDetails }) })] })
81
+ ]
82
+ })
83
+ ]
84
+ })]
41
85
  });
42
- });
86
+ }
43
87
  //#endregion
44
88
  export { PluginErrorPanel };
@@ -1,3 +1,4 @@
1
+ import { PluginErrorPanel } from "./error-panel.js";
1
2
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  import Markdown from "react-markdown";
@@ -222,6 +223,8 @@ const CLOCK = new Intl.DateTimeFormat("zh-CN", {
222
223
  hour12: false
223
224
  });
224
225
  const RECENT_ENTRY_LIMIT = 20;
226
+ const COPY_SUCCESS_MESSAGE = "已复制";
227
+ const COPY_CONFIRMATION_MS = 2e3;
225
228
  const LATEST_SCROLL_THRESHOLD = 24;
226
229
  const LOG_KIND_LABELS = /* @__PURE__ */ new Map([["question", "提问"], ["answer", "回答"]]);
227
230
  const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, record, relatedRecords, display = "full", executionId, limit = RECENT_ENTRY_LIMIT, isLoading, error, onOpenLog }) {
@@ -259,11 +262,12 @@ const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, recor
259
262
  "data-display": display,
260
263
  "aria-label": isCompact ? "最近执行动态" : "执行日志",
261
264
  children: [
262
- error ? /* @__PURE__ */ jsx("p", {
263
- className: "workbase-log-error",
264
- role: "alert",
265
- children: error
266
- }) : null,
265
+ error ? /* @__PURE__ */ jsx(PluginErrorPanel, {
266
+ title: "执行日志读取失败",
267
+ error,
268
+ scope: "当前执行的日志。",
269
+ recovery: "可重新打开日志查看。"
270
+ }, executionId) : null,
267
271
  isLoading && !items.length ? /* @__PURE__ */ jsx("p", {
268
272
  className: "workbase-log-note",
269
273
  role: "status",
@@ -376,7 +380,7 @@ const LogEvidence = memo(function LogEvidence({ evidence }) {
376
380
  const handleCopy = useCallback(async () => {
377
381
  try {
378
382
  await navigator.clipboard.writeText(evidence.map(({ content }) => content).join("\n\n"));
379
- setCopyState("已复制");
383
+ setCopyState(COPY_SUCCESS_MESSAGE);
380
384
  } catch {
381
385
  setCopyState("复制失败,请选择文本复制");
382
386
  }
@@ -384,6 +388,11 @@ const LogEvidence = memo(function LogEvidence({ evidence }) {
384
388
  useEffect(() => {
385
389
  setCopyState("");
386
390
  }, [evidence]);
391
+ useEffect(() => {
392
+ if (copyState !== COPY_SUCCESS_MESSAGE) return;
393
+ const timeout = window.setTimeout(() => setCopyState(""), COPY_CONFIRMATION_MS);
394
+ return () => window.clearTimeout(timeout);
395
+ }, [copyState]);
387
396
  return /* @__PURE__ */ jsxs("div", {
388
397
  className: "workbase-log-terminal",
389
398
  role: "group",
@@ -404,6 +413,12 @@ const LogEvidence = memo(function LogEvidence({ evidence }) {
404
413
  role: "status",
405
414
  children: copyState
406
415
  }),
416
+ copyState && /* @__PURE__ */ jsx("button", {
417
+ type: "button",
418
+ "aria-label": "关闭复制提示",
419
+ onClick: () => setCopyState(""),
420
+ children: "关闭"
421
+ }),
407
422
  /* @__PURE__ */ jsx("button", {
408
423
  type: "button",
409
424
  onClick: handleCopy,
@@ -1,4 +1,4 @@
1
- import { C as PluginUiToastOptions, D as WorkbasePluginUi, E as PluginUiViewIdentity, O as WorkbasePluginUiDefinition, S as PluginUiStatus, T as PluginUiView, _ as PluginUiNavigateOptions, a as PluginUiContextIdentity, b as PluginUiPromptOptions, c as PluginUiDesktopOpenResult, d as PluginUiFileSelectOptions, f as PluginUiFileSelectionItemType, g as PluginUiInitializationPayload, h as PluginUiHostMethods, i as PluginUiCommands, l as PluginUiExecutionChange, m as PluginUiHostError, n as PluginUiClientMethods, o as PluginUiControllerOptions, p as PluginUiFileSelectionScope, r as PluginUiCommandExecuteOptions, s as PluginUiDesktopOpenOptions, t as PluginDesktopTarget, u as PluginUiFileFilter, v as PluginUiOutputOptions, w as PluginUiTransportConnection, x as PluginUiPromptType, y as PluginUiPromptChoice } from "../types-DjPBTfWP.js";
1
+ import { C as PluginUiToastOptions, D as WorkbasePluginUi, E as PluginUiViewIdentity, O as WorkbasePluginUiDefinition, S as PluginUiStatus, T as PluginUiView, _ as PluginUiNavigateOptions, a as PluginUiContextIdentity, b as PluginUiPromptOptions, c as PluginUiDesktopOpenResult, d as PluginUiFileSelectOptions, f as PluginUiFileSelectionItemType, g as PluginUiInitializationPayload, h as PluginUiHostMethods, i as PluginUiCommands, l as PluginUiExecutionChange, m as PluginUiHostError, n as PluginUiClientMethods, o as PluginUiControllerOptions, p as PluginUiFileSelectionScope, r as PluginUiCommandExecuteOptions, s as PluginUiDesktopOpenOptions, t as PluginDesktopTarget, u as PluginUiFileFilter, v as PluginUiOutputOptions, w as PluginUiTransportConnection, x as PluginUiPromptType, y as PluginUiPromptChoice } from "../types-DXhRV5dI.js";
2
2
  //#region src/ui/controller.d.ts
3
3
  export declare function createPluginUiController(definition: WorkbasePluginUiDefinition, options: PluginUiControllerOptions): WorkbasePluginUi;
4
4
  //#endregion
package/dist/ui/index.js CHANGED
@@ -16,21 +16,45 @@ function createPluginUiController(definition, options) {
16
16
  recoverableHostErrors: /* @__PURE__ */ new WeakSet()
17
17
  };
18
18
  const executionListeners = /* @__PURE__ */ new Set();
19
- const connection = connectToHost({
19
+ const fileListeners = /* @__PURE__ */ new Set();
20
+ let initialization = 0;
21
+ let refreshing = false;
22
+ let pending = false;
23
+ const clientMethods = {
24
+ filesChanged: async () => {
25
+ pending = true;
26
+ if (refreshing || initialization || !state.isInitialized) return;
27
+ refreshing = true;
28
+ try {
29
+ while (pending) {
30
+ pending = false;
31
+ await Promise.all([...fileListeners].map((refresh) => refresh()));
32
+ }
33
+ } finally {
34
+ refreshing = false;
35
+ }
36
+ },
20
37
  executionChanged: async (change) => {
21
38
  if (state.isInitialized) [...executionListeners].forEach((listener) => listener(change));
22
39
  },
23
40
  initialize: async (payload) => {
24
41
  assertInitializationPayload(payload);
25
42
  state.isInitialized = true;
26
- await onInit(payload);
43
+ initialization++;
44
+ try {
45
+ await onInit(payload);
46
+ } finally {
47
+ initialization--;
48
+ }
49
+ if (pending) await clientMethods.filesChanged();
27
50
  await waitForPluginUiPaint(targetWindow);
28
51
  await reportContentHeight(hostPromise, {
29
52
  targetWindow,
30
53
  state
31
54
  });
32
55
  }
33
- });
56
+ };
57
+ const connection = connectToHost(clientMethods);
34
58
  const hostPromise = connection.promise;
35
59
  const request = createHostRequest(hostPromise, state);
36
60
  bindPluginUiLifecycle({
@@ -52,9 +76,16 @@ function createPluginUiController(definition, options) {
52
76
  await request("command.subscribe", { enabled: false });
53
77
  };
54
78
  };
79
+ const onFilesChanged = (refresh) => {
80
+ fileListeners.add(refresh);
81
+ return () => {
82
+ fileListeners.delete(refresh);
83
+ };
84
+ };
55
85
  return createPluginUiApi(request, {
56
86
  targetWindow,
57
- subscribe
87
+ subscribe,
88
+ onFilesChanged
58
89
  });
59
90
  }
60
91
  function createHostRequest(hostPromise, state) {
@@ -73,7 +104,7 @@ function createHostError(response) {
73
104
  const code = typeof responseError?.code === "string" ? responseError.code : "host_error";
74
105
  return Object.assign(new Error(message), { code });
75
106
  }
76
- function createPluginUiApi(request, { targetWindow, subscribe }) {
107
+ function createPluginUiApi(request, { targetWindow, subscribe, onFilesChanged }) {
77
108
  const commands = Object.freeze({
78
109
  subscribe,
79
110
  reply: (executionId) => request("command.reply", { executionId }),
@@ -97,10 +128,14 @@ function createPluginUiApi(request, { targetWindow, subscribe }) {
97
128
  input,
98
129
  statusId
99
130
  }) });
100
- const view = Object.freeze({ call: (method, input) => request("view.call", {
101
- input,
102
- method
103
- }) });
131
+ const view = Object.freeze({
132
+ onFilesChanged,
133
+ setModified: (modified) => request("view.modified", modified),
134
+ call: (method, input) => request("view.call", {
135
+ input,
136
+ method
137
+ })
138
+ });
104
139
  return Object.freeze({
105
140
  dismiss: () => request("interaction.dismiss", {}),
106
141
  respond: (value) => request("interaction.respond", { value }),
@@ -1,3 +1,4 @@
1
+ import { PluginErrorPanel } from "./error-panel.js";
1
2
  import { memo, useCallback, useEffect, useId, useRef, useState } from "react";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  //#region src/ui/MarkdownEditor.tsx
@@ -238,14 +239,16 @@ const MarkdownEditor = memo(function MarkdownEditor({ value, onChange, label, na
238
239
  id: labelId,
239
240
  children: label
240
241
  }),
241
- error ? /* @__PURE__ */ jsxs("p", {
242
- role: "alert",
243
- className: "markdown-editor-error",
244
- children: ["编辑器加载失败,可继续编辑源码。", /* @__PURE__ */ jsx("button", {
242
+ error ? /* @__PURE__ */ jsx(PluginErrorPanel, {
243
+ title: "编辑器加载失败",
244
+ error,
245
+ scope: "当前文档的富文本编辑。",
246
+ recovery: "可继续编辑源码,或重新加载编辑器。",
247
+ children: /* @__PURE__ */ jsx("button", {
245
248
  type: "button",
246
249
  onClick: handleRetry,
247
250
  children: "重试"
248
- })]
251
+ })
249
252
  }) : null,
250
253
  validationError ? /* @__PURE__ */ jsx("p", {
251
254
  role: "alert",
@@ -1,4 +1,4 @@
1
- import { D as WorkbasePluginUi } from "../types-DjPBTfWP.js";
1
+ import { D as WorkbasePluginUi } from "../types-DXhRV5dI.js";
2
2
  import { ReactNode } from "react";
3
3
  //#region src/ui/MarkdownLinks.dto.d.ts
4
4
  interface MarkdownLinksProps {
@@ -130,16 +130,25 @@ function MarkdownLinkBoundary({ host, children }) {
130
130
  }, [hasPreview]);
131
131
  return /* @__PURE__ */ jsxs("div", {
132
132
  ref: container,
133
- className: "workbase-markdown-links",
133
+ className: "workbase-markdown-links workbase-feedback-page",
134
134
  children: [
135
- error ? /* @__PURE__ */ jsxs("p", {
135
+ error ? /* @__PURE__ */ jsxs("div", {
136
136
  role: "alert",
137
- className: "markdown-link-error",
138
- children: [error, request ? /* @__PURE__ */ jsx("button", {
139
- type: "button",
140
- onClick: handleRetry,
141
- children: "重试打开"
142
- }) : null]
137
+ className: "workbase-inline-error",
138
+ children: [
139
+ /* @__PURE__ */ jsx("span", { children: error }),
140
+ request ? /* @__PURE__ */ jsx("button", {
141
+ type: "button",
142
+ onClick: handleRetry,
143
+ children: "重试打开"
144
+ }) : null,
145
+ /* @__PURE__ */ jsx("button", {
146
+ type: "button",
147
+ className: "workbase-error-close",
148
+ "aria-label": "关闭错误提示",
149
+ onClick: () => setError("")
150
+ })
151
+ ]
143
152
  }) : null,
144
153
  isOpeningWebsite ? /* @__PURE__ */ jsx("p", {
145
154
  role: "status",
@@ -1,7 +1,7 @@
1
+ import { C as PluginUiToastOptions, D as WorkbasePluginUi } from "../types-DXhRV5dI.js";
1
2
  //#region src/ui/model.d.ts
2
- /**
3
- * Formats command results and recent Host log entries for built-in plugin views.
4
- */
3
+ /** A notification transport failure must not turn a completed operation into a failed one. */
4
+ export declare function showOperationToast(host: Pick<WorkbasePluginUi, "showToast">, options: PluginUiToastOptions): void;
5
5
  export interface PluginActionOutput {
6
6
  readonly content: string;
7
7
  readonly status: "completed" | "failed";
package/dist/ui/model.js CHANGED
@@ -1,4 +1,8 @@
1
1
  //#region src/ui/model.ts
2
+ /** A notification transport failure must not turn a completed operation into a failed one. */
3
+ function showOperationToast(host, options) {
4
+ host.showToast(options).catch((error) => console.warn("无法显示插件通知。", error));
5
+ }
2
6
  let ConfigurationMode = /* @__PURE__ */ function(ConfigurationMode) {
3
7
  ConfigurationMode["View"] = "view";
4
8
  ConfigurationMode["Edit"] = "edit";
@@ -50,4 +54,4 @@ function isRecord(value) {
50
54
  return value !== null && typeof value === "object" && !Array.isArray(value);
51
55
  }
52
56
  //#endregion
53
- export { ConfigurationMode, TEAM_CONFIGURATION_NOTICE, configurationSavedMessage, errorSummary, formatActionError, formatActionOutput, readableError };
57
+ export { ConfigurationMode, TEAM_CONFIGURATION_NOTICE, configurationSavedMessage, errorSummary, formatActionError, formatActionOutput, readableError, showOperationToast };
package/dist/ui/theme.css CHANGED
@@ -225,32 +225,68 @@
225
225
 
226
226
  .mantine-Alert-root { padding: 12px; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
227
227
  .mantine-Alert-message { color: inherit; font-size: 14px; line-height: 1.5; }
228
- .workbase-plugin-error {
228
+ .workbase-plugin-error, .workbase-inline-error, .workbase-error-alert {
229
+ --workbase-notice-accent: var(--color-danger);
230
+ --workbase-error-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5m0 3h.01'/%3E%3C/svg%3E");
229
231
  min-width: 0;
230
- max-height: 100%;
231
232
  flex-shrink: 0;
232
- overflow-y: auto;
233
- padding: 16px 20px;
234
- border: 1px solid color-mix(in srgb, var(--color-danger) 24%, var(--color-border));
235
- border-radius: 8px;
233
+ padding: 12px 16px;
234
+ border: 1px solid color-mix(in srgb, var(--workbase-notice-accent) 16%, var(--color-border));
235
+ border-radius: var(--workbase-panel-radius);
236
236
  color: var(--color-foreground);
237
- background: color-mix(in srgb, var(--color-danger) 5%, var(--color-surface));
238
- text-align: left;
237
+ background: color-mix(in srgb, var(--workbase-notice-accent) 2%, var(--color-surface));
238
+ text-align: start;
239
239
  overflow-wrap: anywhere;
240
- scrollbar-color: var(--color-border-strong) transparent;
241
- scrollbar-width: thin;
242
240
  }
241
+ .workbase-feedback-page > :is(.workbase-plugin-error, .workbase-inline-error, .mantine-Alert-root, .workbase-error-reopen, .workbase-page-notice) {
242
+ margin: 0 var(--workbase-page-inset) var(--workbase-panel-gap);
243
+ }
244
+ .workbase-feedback-page > :is(.workbase-plugin-error, .workbase-inline-error, .mantine-Alert-root, .workbase-error-reopen, .workbase-page-notice):first-child {
245
+ margin-block-start: var(--workbase-panel-gap);
246
+ }
247
+ .workbase-error-header::before, .workbase-inline-error::before, .workbase-error-alert > .mantine-Alert-wrapper:not(:has(> .mantine-Alert-icon))::before {
248
+ content: "";
249
+ flex: 0 0 18px;
250
+ height: 18px;
251
+ background: var(--workbase-notice-accent);
252
+ mask: var(--workbase-error-icon) center / contain no-repeat;
253
+ }
254
+ .workbase-plugin-error { max-height: 100%; overflow: auto; scrollbar-color: var(--color-border-strong) transparent; scrollbar-width: thin; }
243
255
  .workbase-plugin-error:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
244
- .workbase-plugin-error .workbase-error-title { margin: 0 0 8px; color: var(--color-danger); font-size: 14px; font-weight: 600; line-height: 1.5; }
245
- .workbase-plugin-error .workbase-error-cause { margin: 0; color: var(--color-foreground); font-size: 14px; font-weight: 500; line-height: 1.65; white-space: pre-wrap; }
246
- .workbase-plugin-error .workbase-error-context { margin: 8px 0 0; color: var(--color-foreground); font-size: 12px; font-weight: 400; line-height: 1.65; }
247
- .workbase-error-context strong { margin-right: 8px; font-weight: 600; }
248
- .workbase-error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
249
- .workbase-error-details { margin-top: 12px; color: var(--color-foreground); font-size: 12px; font-weight: 400; }
250
- .workbase-error-details summary { width: fit-content; cursor: pointer; text-underline-offset: 3px; }
251
- .workbase-error-details summary:hover { text-decoration: underline; }
252
- .workbase-error-details summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }
253
- .workbase-error-details pre { max-width: 100%; max-height: 240px; margin: 8px 0 0; padding: 12px; overflow: auto; border-radius: 4px; color: var(--color-foreground); background: var(--color-surface); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: var(--color-border-strong) transparent; scrollbar-width: thin; }
256
+ .workbase-error-header { display: flex; align-items: center; gap: 10px; }
257
+ .workbase-plugin-error .workbase-error-title { flex: 1; min-width: 0; margin: 0; color: var(--color-foreground); font-size: var(--workbase-type-body); font-weight: 650; line-height: 1.45; }
258
+ .workbase-error-body { margin-inline-start: 28px; }
259
+ .workbase-plugin-error .workbase-error-cause { max-width: 75ch; margin: 0; color: var(--color-foreground); font-size: var(--workbase-type-body); font-weight: 400; line-height: 1.55; white-space: pre-wrap; }
260
+ .workbase-error-actions, .workbase-inline-error { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
261
+ .workbase-error-actions { margin-block-start: 10px; }
262
+ .workbase-error-toggle, .workbase-error-disclosure, .workbase-inline-error > button {
263
+ display: inline-flex; justify-content: center; align-items: center; gap: 5px; min-height: 28px;
264
+ padding: 3px 7px; border: 0; border-radius: 6px; background: transparent; color: var(--color-muted); font: inherit; font-size: var(--workbase-type-meta); line-height: 1.4; cursor: pointer;
265
+ }
266
+ .workbase-error-toggle { flex: none; min-width: 28px; }
267
+ .workbase-error-close { min-width: 28px; }
268
+ .workbase-error-close::before {
269
+ content: ""; width: 16px; height: 16px; background: currentColor;
270
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 6 12 12M6 18 18 6'/%3E%3C/svg%3E") center / contain no-repeat;
271
+ }
272
+ .workbase-inline-error > button:not(.workbase-error-close) { border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-foreground); }
273
+ .workbase-error-disclosure:only-child { margin-inline-start: -7px; }
274
+ .workbase-error-disclosure[aria-expanded="true"] svg { transform: rotate(180deg); }
275
+ :is(.workbase-error-toggle, .workbase-error-disclosure, .workbase-inline-error > button, .mantine-Alert-closeButton):hover { background: var(--color-surface-muted); color: var(--color-foreground); }
276
+ :is(.workbase-error-toggle, .workbase-error-disclosure, .workbase-inline-error > button, .mantine-Alert-closeButton):focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
277
+ .workbase-error-details:not([hidden]) { display: grid; gap: 8px; }
278
+ .workbase-error-details { margin: 12px 0 0; padding-block-start: 12px; border-top: 1px solid var(--color-border); font-size: var(--workbase-type-body); line-height: 1.6; }
279
+ .workbase-error-details > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; }
280
+ .workbase-error-details dt { color: var(--color-muted); font-weight: 500; }
281
+ .workbase-error-details dd { min-width: 0; margin: 0; }
282
+ .workbase-error-details pre { max-height: 15rem; margin: 0; padding: 8px 10px; overflow: auto; border-radius: 6px; background: var(--color-surface-muted); color: var(--color-foreground); font-size: var(--workbase-type-meta); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
283
+ .workbase-inline-error > span { flex: 1 1 12ch; min-width: 0; white-space: pre-wrap; }
284
+ .workbase-inline-error { font-size: var(--workbase-type-body); line-height: 1.55; }
285
+ .workbase-error-alert .mantine-Alert-wrapper { align-items: flex-start; gap: 10px; }
286
+ .workbase-error-alert .mantine-Alert-wrapper::before { margin-block-start: 2px; }
287
+ .workbase-error-alert .mantine-Alert-body { min-width: 0; }
288
+ .workbase-error-alert .mantine-Alert-message { color: var(--color-foreground); }
289
+ .workbase-error-alert .mantine-Alert-closeButton { min-width: 28px; min-height: 28px; margin: -3px -3px -3px 0; color: var(--color-muted); }
254
290
  .mantine-Notification-root { border: 1px solid var(--color-border); }
255
291
  .mantine-Notification-title { color: var(--color-brand-deep); font-weight: 600; }
256
292
  .mantine-Notification-description { color: var(--color-muted); }
@@ -44,6 +44,9 @@ export declare const workbaseUiTheme: {
44
44
  readonly autoCapitalize: "none";
45
45
  };
46
46
  };
47
+ readonly Alert: {
48
+ readonly classNames: typeof alertClassNames;
49
+ };
47
50
  readonly Badge: {
48
51
  readonly defaultProps: {
49
52
  readonly radius: "sm";
@@ -80,6 +83,11 @@ declare function brandClassNames(_theme: unknown, { color }: {
80
83
  }): {
81
84
  root: string | undefined;
82
85
  };
86
+ declare function alertClassNames(_theme: unknown, { color }: {
87
+ readonly color?: string;
88
+ }): {
89
+ root: string | undefined;
90
+ };
83
91
  declare function badgeClassNames(theme: unknown, props: {
84
92
  readonly color?: string;
85
93
  readonly variant?: string;
package/dist/ui/theme.js CHANGED
@@ -107,6 +107,7 @@ const workbaseUiTheme = {
107
107
  components: {
108
108
  Input: { defaultProps: { autoCapitalize: "none" } },
109
109
  Textarea: { defaultProps: { autoCapitalize: "none" } },
110
+ Alert: { classNames: alertClassNames },
110
111
  Badge: {
111
112
  defaultProps: { radius: "sm" },
112
113
  classNames: badgeClassNames
@@ -125,6 +126,9 @@ const workbaseUiTheme = {
125
126
  function brandClassNames(_theme, { color }) {
126
127
  return { root: !color || color === "workbase" ? "workbase-brand-control" : void 0 };
127
128
  }
129
+ function alertClassNames(_theme, { color }) {
130
+ return { root: color === "red" ? "workbase-error-alert" : void 0 };
131
+ }
128
132
  function badgeClassNames(theme, props) {
129
133
  const { color, variant } = props;
130
134
  if (variant === "light" && color && [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eworkbase/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./markdown": {