@eworkbase/sdk 0.3.6 → 0.4.1
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/ExecutionLog.dto-CI-HpxZa.d.ts +116 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +85 -1
- package/dist/markdown-link-C-qw7xuN.js +50 -0
- package/dist/markdown.d.ts +18 -0
- package/dist/markdown.js +112 -0
- package/dist/style.css +110 -12
- package/dist/{types-Cl1kerLO.d.ts → types-Bv7aJizu.d.ts} +10 -0
- package/dist/types-C8byxPji.d.ts +154 -0
- package/dist/ui/error-panel.d.ts +15 -0
- package/dist/ui/error-panel.js +44 -0
- package/dist/ui/execution-log.d.ts +42 -0
- package/dist/ui/execution-log.js +443 -0
- package/dist/ui/index.css +16 -6
- package/dist/ui/index.d.ts +2 -151
- package/dist/ui/index.js +1 -0
- package/dist/ui/markdown-editor.d.ts +4 -1
- package/dist/ui/markdown-editor.js +56 -25
- package/dist/ui/markdown-links.d.ts +12 -0
- package/dist/ui/markdown-links.js +246 -0
- package/dist/ui/model.d.ts +2 -0
- package/dist/ui/model.js +5 -1
- package/dist/ui/theme.css +106 -0
- package/package.json +22 -4
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { S as PluginExecutionSnapshot, m as PluginCommandExecutionResult } from "./types-Bv7aJizu.js";
|
|
2
|
+
//#region src/ui/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Browser authoring API and transport contracts for Workbase plugin views.
|
|
5
|
+
*/
|
|
6
|
+
type PluginUiPromptType = 'confirm' | 'multi-select' | 'select' | 'text';
|
|
7
|
+
type PluginUiFileSelectionScope = 'project' | 'workspace';
|
|
8
|
+
type PluginUiFileSelectionItemType = 'any' | 'directory' | 'file';
|
|
9
|
+
interface PluginUiContextIdentity {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
}
|
|
12
|
+
interface PluginUiViewIdentity extends PluginUiContextIdentity {
|
|
13
|
+
readonly pluginId: string;
|
|
14
|
+
readonly title: string;
|
|
15
|
+
}
|
|
16
|
+
interface PluginUiInitializationPayload {
|
|
17
|
+
/** Changes when the workspace is prepared again; route changes retain the same generation. */
|
|
18
|
+
readonly activationGeneration?: number;
|
|
19
|
+
readonly locale: string;
|
|
20
|
+
readonly params: Readonly<Record<string, unknown>>;
|
|
21
|
+
readonly project: PluginUiContextIdentity;
|
|
22
|
+
readonly route: string | null;
|
|
23
|
+
readonly theme: string;
|
|
24
|
+
readonly view: PluginUiViewIdentity;
|
|
25
|
+
readonly workspace: PluginUiContextIdentity;
|
|
26
|
+
}
|
|
27
|
+
interface WorkbasePluginUiDefinition {
|
|
28
|
+
readonly onInit: (payload: PluginUiInitializationPayload) => void | Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
interface PluginUiCommandExecuteOptions {
|
|
31
|
+
readonly executionId?: string;
|
|
32
|
+
}
|
|
33
|
+
interface PluginUiNavigateOptions {
|
|
34
|
+
readonly replace?: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface PluginUiToastOptions {
|
|
37
|
+
readonly description: string;
|
|
38
|
+
readonly title: string;
|
|
39
|
+
}
|
|
40
|
+
interface PluginUiPromptChoice<Value = unknown> {
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly value: Value;
|
|
43
|
+
}
|
|
44
|
+
interface PluginUiPromptOptions<Value = unknown> {
|
|
45
|
+
readonly choices?: readonly PluginUiPromptChoice<Value>[];
|
|
46
|
+
readonly defaultValue?: Value | readonly Value[] | null;
|
|
47
|
+
readonly message: string;
|
|
48
|
+
readonly searchable?: boolean;
|
|
49
|
+
readonly submitLabel?: string;
|
|
50
|
+
readonly title: string;
|
|
51
|
+
readonly type: PluginUiPromptType;
|
|
52
|
+
}
|
|
53
|
+
interface PluginUiFileFilter {
|
|
54
|
+
readonly extensions: readonly string[];
|
|
55
|
+
readonly name: string;
|
|
56
|
+
}
|
|
57
|
+
interface PluginUiFileSelectOptions {
|
|
58
|
+
readonly filters?: readonly PluginUiFileFilter[];
|
|
59
|
+
readonly itemType?: PluginUiFileSelectionItemType;
|
|
60
|
+
readonly multiple?: boolean;
|
|
61
|
+
readonly rootPath?: string | null;
|
|
62
|
+
readonly scope?: PluginUiFileSelectionScope;
|
|
63
|
+
readonly title?: string;
|
|
64
|
+
}
|
|
65
|
+
interface PluginUiOutputOptions {
|
|
66
|
+
readonly content: string;
|
|
67
|
+
readonly description?: string | null;
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly status?: string | null;
|
|
70
|
+
readonly title: string;
|
|
71
|
+
}
|
|
72
|
+
/** A single authoritative execution update; removal retains its identity and revision. */
|
|
73
|
+
interface PluginUiExecutionChange {
|
|
74
|
+
readonly snapshot: PluginExecutionSnapshot;
|
|
75
|
+
readonly removed: boolean;
|
|
76
|
+
}
|
|
77
|
+
interface PluginUiCommands {
|
|
78
|
+
/** Subscribe before querying snapshots. Dispose when the view no longer consumes events. */
|
|
79
|
+
readonly subscribe: (onChange: (change: PluginUiExecutionChange) => void) => Promise<() => Promise<void>>;
|
|
80
|
+
/** Reveal the existing host question; does not create or answer a prompt. */
|
|
81
|
+
readonly reply: (executionId: string) => Promise<void>;
|
|
82
|
+
/** Clear one ended execution, or all when omitted; active runs, logs and Agent sessions are retained. */
|
|
83
|
+
readonly clear: (executionId?: string) => Promise<void>;
|
|
84
|
+
readonly start: (commandId: string, input: unknown, options?: PluginUiCommandExecuteOptions) => Promise<PluginExecutionSnapshot>;
|
|
85
|
+
readonly query: (executionId?: string) => Promise<readonly PluginExecutionSnapshot[]>;
|
|
86
|
+
readonly cancel: <Result = unknown>(executionId: string) => Promise<Result>;
|
|
87
|
+
readonly execute: <Result = unknown>(commandId: string, input: unknown, options?: PluginUiCommandExecuteOptions) => Promise<PluginCommandExecutionResult<Result>>;
|
|
88
|
+
}
|
|
89
|
+
interface PluginUiStatus {
|
|
90
|
+
readonly resolve: <Result = unknown>(statusId: string, input: unknown) => Promise<Result>;
|
|
91
|
+
}
|
|
92
|
+
interface PluginUiView {
|
|
93
|
+
readonly call: <Result = unknown>(method: string, input: unknown) => Promise<Result>;
|
|
94
|
+
}
|
|
95
|
+
declare enum PluginDesktopTarget {
|
|
96
|
+
Editor = "editor",
|
|
97
|
+
Terminal = "terminal",
|
|
98
|
+
Folder = "folder",
|
|
99
|
+
Chatgpt = "chatgpt"
|
|
100
|
+
}
|
|
101
|
+
interface PluginUiDesktopOpenOptions {
|
|
102
|
+
readonly target: PluginDesktopTarget;
|
|
103
|
+
/** Omit to use the current workspace root. */
|
|
104
|
+
readonly repositoryId?: string;
|
|
105
|
+
/** Existing path relative to the selected repository/workspace; defaults to its root. */
|
|
106
|
+
readonly path?: string;
|
|
107
|
+
}
|
|
108
|
+
interface PluginUiDesktopOpenResult {
|
|
109
|
+
readonly path: string;
|
|
110
|
+
readonly targetId: string;
|
|
111
|
+
}
|
|
112
|
+
interface WorkbasePluginUi {
|
|
113
|
+
/** Hides a resumable interaction without answering or cancelling it. */
|
|
114
|
+
readonly dismiss: () => Promise<void>;
|
|
115
|
+
/** Answers only the interaction currently hosted in this frame. Null cancels it. */
|
|
116
|
+
readonly respond: (value: unknown | null) => Promise<void>;
|
|
117
|
+
readonly closeOutput: <Result = unknown>(id: string) => Promise<Result>;
|
|
118
|
+
readonly commands: PluginUiCommands;
|
|
119
|
+
/** Available in ordinary plugin pages/tabs, including their detached windows. */
|
|
120
|
+
readonly desktop: {
|
|
121
|
+
readonly open: (options: PluginUiDesktopOpenOptions) => Promise<PluginUiDesktopOpenResult>;
|
|
122
|
+
};
|
|
123
|
+
/** Plugin destinations open in a separate window; other app routes use ordinary navigation. */
|
|
124
|
+
readonly navigate: <Result = unknown>(to: string, options?: PluginUiNavigateOptions) => Promise<Result>;
|
|
125
|
+
readonly openOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
|
|
126
|
+
readonly selectFiles: (options?: PluginUiFileSelectOptions) => Promise<string | readonly string[] | null>;
|
|
127
|
+
readonly showPrompt: <Value = unknown>(options: PluginUiPromptOptions<Value>) => Promise<Value | readonly Value[] | null>;
|
|
128
|
+
readonly showToast: <Result = unknown>(options: PluginUiToastOptions) => Promise<Result>;
|
|
129
|
+
readonly status: PluginUiStatus;
|
|
130
|
+
readonly updateOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
|
|
131
|
+
readonly view: PluginUiView;
|
|
132
|
+
}
|
|
133
|
+
interface PluginUiHostError extends Error {
|
|
134
|
+
readonly code: string;
|
|
135
|
+
}
|
|
136
|
+
interface PluginUiHostMethods {
|
|
137
|
+
readonly call: (method: string, params: unknown) => Promise<unknown>;
|
|
138
|
+
readonly reportContentHeight: (height: number) => Promise<void>;
|
|
139
|
+
readonly reportFatal: (message: string) => Promise<void>;
|
|
140
|
+
}
|
|
141
|
+
interface PluginUiClientMethods {
|
|
142
|
+
readonly executionChanged: (change: PluginUiExecutionChange) => Promise<void>;
|
|
143
|
+
readonly initialize: (payload: unknown) => Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
interface PluginUiTransportConnection {
|
|
146
|
+
readonly destroy: () => void;
|
|
147
|
+
readonly promise: Promise<PluginUiHostMethods>;
|
|
148
|
+
}
|
|
149
|
+
interface PluginUiControllerOptions {
|
|
150
|
+
readonly connectToHost: (methods: PluginUiClientMethods) => PluginUiTransportConnection;
|
|
151
|
+
readonly targetWindow: Window & typeof globalThis;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { PluginUiToastOptions as C, WorkbasePluginUi as D, PluginUiViewIdentity as E, WorkbasePluginUiDefinition as O, PluginUiStatus as S, PluginUiView as T, PluginUiNavigateOptions as _, PluginUiContextIdentity as a, PluginUiPromptOptions as b, PluginUiDesktopOpenResult as c, PluginUiFileSelectOptions as d, PluginUiFileSelectionItemType as f, PluginUiInitializationPayload as g, PluginUiHostMethods as h, PluginUiCommands as i, 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, PluginUiOutputOptions as v, PluginUiTransportConnection as w, PluginUiPromptType as x, PluginUiPromptChoice as y };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/ui/PluginErrorPanel.dto.d.ts
|
|
3
|
+
interface PluginErrorPanelProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly error: string;
|
|
6
|
+
readonly scope: string;
|
|
7
|
+
readonly recovery: string;
|
|
8
|
+
readonly technicalDetails?: string;
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/ui/PluginErrorPanel.d.ts
|
|
13
|
+
export declare const PluginErrorPanel: import("react").NamedExoticComponent<PluginErrorPanelProps>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export type { PluginErrorPanelProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { errorSummary } from "./model.js";
|
|
2
|
+
import { memo, useId } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/ui/PluginErrorPanel.tsx
|
|
5
|
+
/** 宿主与插件共用的错误展示,保留可见原因并折叠技术详情,不执行业务恢复。 */
|
|
6
|
+
const PluginErrorPanel = memo(function PluginErrorPanel({ title, error, scope, recovery, technicalDetails = error, children, className, ...attributes }) {
|
|
7
|
+
const headingId = useId();
|
|
8
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
9
|
+
tabIndex: 0,
|
|
10
|
+
...attributes,
|
|
11
|
+
role: "alert",
|
|
12
|
+
"aria-labelledby": headingId,
|
|
13
|
+
className: ["workbase-plugin-error", className].filter(Boolean).join(" "),
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx("h3", {
|
|
16
|
+
className: "workbase-error-title",
|
|
17
|
+
id: headingId,
|
|
18
|
+
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
|
+
]
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
export { PluginErrorPanel };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { i as ExecutionLogRecord, n as ExecutionLogEntry, t as ExecutionLogCallRecord } from "../ExecutionLog.dto-CI-HpxZa.js";
|
|
2
|
+
//#region src/ui/ExecutionLogTimeline.dto.d.ts
|
|
3
|
+
export declare enum ExecutionLogDisplay {
|
|
4
|
+
Full = "full",
|
|
5
|
+
Compact = "compact"
|
|
6
|
+
}
|
|
7
|
+
interface ExecutionLogEvidence {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly content: string;
|
|
10
|
+
}
|
|
11
|
+
interface ExecutionLogTimelineItem {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly anchors: readonly string[];
|
|
14
|
+
readonly kind: ExecutionLogEntry["kind"];
|
|
15
|
+
readonly time: string | null;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly content: string;
|
|
18
|
+
readonly status: string;
|
|
19
|
+
readonly metadata: readonly string[];
|
|
20
|
+
readonly evidence: readonly ExecutionLogEvidence[];
|
|
21
|
+
readonly calls: readonly ExecutionLogCallRecord[];
|
|
22
|
+
readonly logId?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ExecutionLogTimelineProps {
|
|
25
|
+
readonly entries?: readonly ExecutionLogEntry[];
|
|
26
|
+
readonly record?: ExecutionLogRecord;
|
|
27
|
+
readonly display?: ExecutionLogDisplay;
|
|
28
|
+
readonly executionId?: string;
|
|
29
|
+
readonly limit?: number;
|
|
30
|
+
readonly isLoading?: boolean;
|
|
31
|
+
readonly error?: string | null;
|
|
32
|
+
readonly onOpenLog?: (logId: string) => void;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/ui/execution-log-model.d.ts
|
|
36
|
+
/** Adapts existing evidence for both complete and compact readers without persisting derived events. */
|
|
37
|
+
export declare function buildExecutionLogItems(record: ExecutionLogRecord): readonly ExecutionLogTimelineItem[];
|
|
38
|
+
export declare function executionLogStatusLabel(status: string): string;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/ui/ExecutionLogTimeline.d.ts
|
|
41
|
+
export declare const ExecutionLogTimeline: import("react").NamedExoticComponent<ExecutionLogTimelineProps>;
|
|
42
|
+
//#endregion
|