@eworkbase/sdk 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ExecutionLog.dto-ig9GUWhK.d.ts → ExecutionLog.dto-Bq2u5C90.d.ts} +1 -1
- package/dist/index.d.ts +20 -14
- package/dist/index.js +142 -245
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +9 -2
- package/dist/style.css +4 -98
- package/dist/{types-CRYQB_Tb.d.ts → types-CPObI29j.d.ts} +21 -6
- package/dist/{types-2X-_T_W_.d.ts → types-WIMkhmH4.d.ts} +29 -101
- package/dist/ui/components.d.ts +55 -0
- package/dist/ui/components.js +131 -0
- package/dist/ui/execution-log.d.ts +6 -2
- package/dist/ui/execution-log.js +11 -20
- package/dist/ui/index.css +38 -165
- package/dist/ui/index.d.ts +24 -2
- package/dist/ui/index.js +90 -24
- package/dist/ui/markdown-links.d.ts +1 -1
- package/dist/ui/markdown-links.js +44 -34
- package/dist/ui/model.d.ts +1 -2
- package/dist/ui/model.js +1 -8
- package/dist/ui/theme.css +123 -1
- package/package.json +27 -7
package/dist/style.css
CHANGED
|
@@ -2089,111 +2089,17 @@
|
|
|
2089
2089
|
display: none;
|
|
2090
2090
|
}
|
|
2091
2091
|
|
|
2092
|
-
.workbase-markdown-links {
|
|
2093
|
-
flex-direction: column;
|
|
2094
|
-
flex: 1;
|
|
2095
|
-
min-width: 0;
|
|
2096
|
-
min-height: 0;
|
|
2097
|
-
display: flex;
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
|
-
.markdown-document-preview {
|
|
2101
|
-
border: 1px solid var(--color-border);
|
|
2102
|
-
background: var(--color-surface);
|
|
2103
|
-
min-width: 0;
|
|
2104
|
-
color: var(--color-foreground);
|
|
2105
|
-
border-radius: 8px;
|
|
2106
|
-
margin-bottom: 20px;
|
|
2107
|
-
padding: 20px;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
|
-
.markdown-document-heading {
|
|
2111
|
-
justify-content: space-between;
|
|
2112
|
-
align-items: start;
|
|
2113
|
-
gap: 16px;
|
|
2114
|
-
margin-bottom: 20px;
|
|
2115
|
-
display: flex;
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
.markdown-document-heading h2 {
|
|
2119
|
-
margin: 0;
|
|
2120
|
-
font-size: 18px;
|
|
2121
|
-
line-height: 1.5;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
.markdown-document-heading p {
|
|
2125
|
-
color: var(--color-muted);
|
|
2126
|
-
overflow-wrap: anywhere;
|
|
2127
|
-
margin: 8px 0 0;
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
.markdown-document-heading button {
|
|
2131
|
-
border: 1px solid var(--color-border-strong);
|
|
2132
|
-
background: var(--color-surface);
|
|
2133
|
-
color: var(--color-foreground);
|
|
2134
|
-
font: inherit;
|
|
2135
|
-
cursor: pointer;
|
|
2136
|
-
border-radius: 6px;
|
|
2137
|
-
flex-shrink: 0;
|
|
2138
|
-
padding: 6px 10px;
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
.markdown-document-heading button:hover {
|
|
2142
|
-
background: var(--color-surface-muted);
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
.markdown-document-preview:focus-visible, .workbase-markdown-links button:focus-visible {
|
|
2146
|
-
outline: 2px solid var(--color-brand);
|
|
2147
|
-
outline-offset: 2px;
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
.workbase-markdown-links .markdown-document-body {
|
|
2151
|
-
max-width: 75ch;
|
|
2152
|
-
max-height: 65vh;
|
|
2153
|
-
color: var(--color-foreground);
|
|
2154
|
-
overflow-wrap: anywhere;
|
|
2155
|
-
font-family: inherit;
|
|
2156
|
-
font-size: 14px;
|
|
2157
|
-
line-height: 1.85;
|
|
2158
|
-
overflow: auto;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
.markdown-document-body :is(h1, h2, h3, h4, h5, h6) {
|
|
2162
|
-
color: var(--color-foreground);
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
.markdown-document-body a {
|
|
2166
|
-
color: var(--color-accent);
|
|
2167
|
-
text-underline-offset: 3px;
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
.markdown-document-body pre {
|
|
2171
|
-
background: var(--color-surface-muted);
|
|
2172
|
-
overflow: auto;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
.markdown-document-body table {
|
|
2176
|
-
max-width: 100%;
|
|
2177
|
-
display: block;
|
|
2178
|
-
overflow: auto;
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
.markdown-document-body ::selection {
|
|
2182
|
-
background: var(--color-brand-weak);
|
|
2183
|
-
color: var(--color-foreground);
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
2092
|
.workbase-markdown-editor, .workbase-markdown-editor .vditor {
|
|
2187
2093
|
--panel-background-color: var(--color-surface);
|
|
2188
2094
|
--border-color: var(--color-border);
|
|
2189
|
-
--toolbar-background-color: var(--color-
|
|
2095
|
+
--toolbar-background-color: var(--color-surface-raised);
|
|
2190
2096
|
--toolbar-icon-color: var(--color-muted);
|
|
2191
2097
|
--toolbar-icon-hover-color: var(--color-brand);
|
|
2192
2098
|
--toolbar-height: 36px;
|
|
2193
2099
|
--textarea-background-color: var(--color-surface);
|
|
2194
2100
|
--textarea-text-color: var(--color-foreground);
|
|
2195
2101
|
--resize-icon-color: var(--color-muted);
|
|
2196
|
-
--resize-background-color: var(--color-
|
|
2102
|
+
--resize-background-color: var(--color-surface-raised);
|
|
2197
2103
|
--resize-hover-icon-color: var(--color-brand);
|
|
2198
2104
|
--resize-hover-background-color: var(--color-brand-weak);
|
|
2199
2105
|
min-width: 0;
|
|
@@ -2283,11 +2189,11 @@
|
|
|
2283
2189
|
}
|
|
2284
2190
|
|
|
2285
2191
|
.workbase-markdown-editor [contenteditable]:focus-visible {
|
|
2286
|
-
box-shadow: inset 0 0 0 2px var(--color-
|
|
2192
|
+
box-shadow: inset 0 0 0 2px var(--color-accent);
|
|
2287
2193
|
}
|
|
2288
2194
|
|
|
2289
2195
|
.workbase-markdown-editor button:focus-visible {
|
|
2290
|
-
outline: 2px solid var(--color-
|
|
2196
|
+
outline: 2px solid var(--color-accent);
|
|
2291
2197
|
outline-offset: 2px;
|
|
2292
2198
|
}
|
|
2293
2199
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ot as PluginToastLevel, b as PluginExecutionSnapshot, f as PluginCommandExecutionResult } from "./types-WIMkhmH4.js";
|
|
2
2
|
//#region src/ui/types.d.ts
|
|
3
3
|
type PluginUiPromptType = 'confirm' | 'multi-select' | 'select' | 'text';
|
|
4
4
|
type PluginUiFileSelectionScope = 'project' | 'workspace';
|
|
@@ -16,6 +16,10 @@ interface PluginUiInitializationPayload {
|
|
|
16
16
|
/** Changes when the workspace is prepared again; route changes retain the same generation. */
|
|
17
17
|
readonly activationGeneration?: number;
|
|
18
18
|
readonly supportsRepositoryPush?: boolean;
|
|
19
|
+
readonly supportsRepositoryPushAuthorization?: boolean;
|
|
20
|
+
/** Opaque request ID attached when this view was opened via a repository card shortcut. */
|
|
21
|
+
readonly cardActionRequestId?: string;
|
|
22
|
+
readonly layout?: 'content' | 'fill';
|
|
19
23
|
readonly locale: string;
|
|
20
24
|
readonly params: Readonly<Record<string, unknown>>;
|
|
21
25
|
readonly project: PluginUiContextIdentity;
|
|
@@ -33,6 +37,13 @@ interface PluginUiCommandExecuteOptions {
|
|
|
33
37
|
interface PluginUiNavigateOptions {
|
|
34
38
|
readonly replace?: boolean;
|
|
35
39
|
}
|
|
40
|
+
interface PluginUiOpenViewOptions extends PluginUiNavigateOptions {
|
|
41
|
+
readonly pluginId: string;
|
|
42
|
+
readonly viewId: string;
|
|
43
|
+
readonly workspaceId?: string;
|
|
44
|
+
readonly route?: string | null;
|
|
45
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
46
|
+
}
|
|
36
47
|
interface PluginUiToastOptions {
|
|
37
48
|
readonly description: string;
|
|
38
49
|
readonly title: string;
|
|
@@ -132,28 +143,32 @@ interface PluginUiRepositoryPushResult {
|
|
|
132
143
|
readonly results: readonly PluginUiRepositoryPushOutcome[];
|
|
133
144
|
}
|
|
134
145
|
interface WorkbasePluginUi {
|
|
146
|
+
/** Releases window listeners, observers and the Penpal bridge when the view unmounts. */
|
|
147
|
+
readonly dispose: () => void;
|
|
135
148
|
/** Hides a resumable interaction without answering or cancelling it. */
|
|
136
149
|
readonly dismiss: () => Promise<void>;
|
|
137
150
|
/** Answers only the interaction currently hosted in this frame. Null cancels it. */
|
|
138
151
|
readonly respond: (value: unknown | null) => Promise<void>;
|
|
139
|
-
readonly closeOutput: <Result = unknown>(id: string) => Promise<Result>;
|
|
140
152
|
readonly commands: PluginUiCommands;
|
|
141
153
|
/** Available in ordinary plugin pages/tabs, including their detached windows. */
|
|
142
154
|
readonly desktop: {
|
|
143
155
|
readonly open: (options: PluginUiDesktopOpenOptions) => Promise<PluginUiDesktopOpenResult>;
|
|
144
156
|
};
|
|
145
|
-
/** Requests host confirmation and pushes only the confirmed managed repository commits. */
|
|
146
157
|
readonly repositories: {
|
|
147
|
-
|
|
158
|
+
/** Call from the user action that confirms pushing the indicated workspace repositories. */
|
|
159
|
+
readonly authorizePush: (repositoryIds: readonly string[]) => Promise<string>;
|
|
160
|
+
/** Reuse an authorization once, or ask the host for confirmation when none is supplied. */
|
|
161
|
+
readonly push: (targets: readonly PluginUiRepositoryPushTarget[], authorizationId?: string) => Promise<PluginUiRepositoryPushResult>;
|
|
148
162
|
};
|
|
149
163
|
/** Plugin destinations open in a separate window; other app routes use ordinary navigation. */
|
|
150
164
|
readonly navigate: <Result = unknown>(to: string, options?: PluginUiNavigateOptions) => Promise<Result>;
|
|
165
|
+
/** Opens a plugin view using canonical route/parameter encoding without hand-building URLs. */
|
|
166
|
+
readonly openPluginView: (options: PluginUiOpenViewOptions) => Promise<void>;
|
|
151
167
|
readonly openOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
|
|
152
168
|
readonly selectFiles: (options?: PluginUiFileSelectOptions) => Promise<string | readonly string[] | null>;
|
|
153
169
|
readonly showPrompt: <Value = unknown>(options: PluginUiPromptOptions<Value>) => Promise<Value | readonly Value[] | null>;
|
|
154
170
|
readonly showToast: <Result = unknown>(options: PluginUiToastOptions) => Promise<Result>;
|
|
155
171
|
readonly status: PluginUiStatus;
|
|
156
|
-
readonly updateOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
|
|
157
172
|
readonly view: PluginUiView;
|
|
158
173
|
}
|
|
159
174
|
interface PluginUiHostError extends Error {
|
|
@@ -178,4 +193,4 @@ interface PluginUiControllerOptions {
|
|
|
178
193
|
readonly targetWindow: Window & typeof globalThis;
|
|
179
194
|
}
|
|
180
195
|
//#endregion
|
|
181
|
-
export {
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-
|
|
1
|
+
import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-Bq2u5C90.js";
|
|
2
2
|
import { ZodType, z } from "zod";
|
|
3
3
|
//#region src/Tools.dto.d.ts
|
|
4
4
|
declare const roleToolEnvironmentSchema: z.ZodObject<{
|
|
@@ -99,49 +99,13 @@ interface PluginToolsService {
|
|
|
99
99
|
readonly applyRoleTools: (proposalId: string) => Promise<RoleToolsApplied>;
|
|
100
100
|
}
|
|
101
101
|
//#endregion
|
|
102
|
-
//#region src/WorkflowContribution.dto.d.ts
|
|
103
|
-
declare const outputField: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
104
|
-
type: z.ZodLiteral<"boolean">;
|
|
105
|
-
label: z.ZodString;
|
|
106
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
107
|
-
type: z.ZodLiteral<"number">;
|
|
108
|
-
label: z.ZodString;
|
|
109
|
-
unit: z.ZodOptional<z.ZodString>;
|
|
110
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
-
type: z.ZodLiteral<"enum">;
|
|
112
|
-
label: z.ZodString;
|
|
113
|
-
values: z.ZodArray<z.ZodString>;
|
|
114
|
-
}, z.core.$strict>], "type">;
|
|
115
|
-
declare const workflowContributionSchema: z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
|
|
116
|
-
outputs: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
117
|
-
type: z.ZodLiteral<"boolean">;
|
|
118
|
-
label: z.ZodString;
|
|
119
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
120
|
-
type: z.ZodLiteral<"number">;
|
|
121
|
-
label: z.ZodString;
|
|
122
|
-
unit: z.ZodOptional<z.ZodString>;
|
|
123
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
124
|
-
type: z.ZodLiteral<"enum">;
|
|
125
|
-
label: z.ZodString;
|
|
126
|
-
values: z.ZodArray<z.ZodString>;
|
|
127
|
-
}, z.core.$strict>], "type">>;
|
|
128
|
-
}, z.core.$strict>]>;
|
|
129
|
-
type PluginWorkflowContribution = z.infer<typeof workflowContributionSchema>;
|
|
130
|
-
type PluginWorkflowOutput = z.infer<typeof outputField>;
|
|
131
|
-
//#endregion
|
|
132
102
|
//#region src/host-services.d.ts
|
|
133
|
-
interface PluginColoredMessage {
|
|
134
|
-
readonly color?: string;
|
|
135
|
-
readonly text: string;
|
|
136
|
-
}
|
|
137
103
|
interface PluginLogEntry {
|
|
138
|
-
readonly level: "log" | "success" | "warn" | "error" | "debug"
|
|
104
|
+
readonly level: "log" | "success" | "warn" | "error" | "debug";
|
|
139
105
|
readonly message: string;
|
|
140
|
-
readonly segments?: readonly PluginColoredMessage[];
|
|
141
106
|
readonly timestamp: number;
|
|
142
107
|
}
|
|
143
108
|
interface PluginInteractiveLogger extends PluginLogger {
|
|
144
|
-
readonly custom: (segments: readonly PluginColoredMessage[]) => void;
|
|
145
109
|
readonly getEntries: () => readonly PluginLogEntry[];
|
|
146
110
|
readonly log: (message: string) => void;
|
|
147
111
|
readonly success: (message: string) => void;
|
|
@@ -188,16 +152,13 @@ interface PluginToastOptions {
|
|
|
188
152
|
readonly duration?: number;
|
|
189
153
|
}
|
|
190
154
|
interface PluginToastApi {
|
|
191
|
-
readonly dismiss: (id: number) => void;
|
|
192
155
|
readonly show: (message: string, level?: PluginToastLevel, options?: PluginToastOptions) => number;
|
|
193
|
-
readonly update: (id: number, message: string, level?: PluginToastLevel, options?: PluginToastOptions) => number;
|
|
194
156
|
}
|
|
195
157
|
interface PluginStoreApi {
|
|
196
158
|
/** Private workspace/plugin directory, allocated and validated by the host. */
|
|
197
159
|
readonly directory: () => string;
|
|
198
160
|
readonly getState: () => Readonly<Record<string, unknown>>;
|
|
199
161
|
readonly setState: (partial: Readonly<Record<string, unknown>>) => void;
|
|
200
|
-
readonly subscribe: (listener: () => void) => () => void;
|
|
201
162
|
}
|
|
202
163
|
interface PluginConfigApi {
|
|
203
164
|
/** Reads the current project config without changing the initialization snapshot. */
|
|
@@ -206,16 +167,12 @@ interface PluginConfigApi {
|
|
|
206
167
|
readonly replace: (config: Readonly<Record<string, unknown>>) => Promise<Readonly<Record<string, unknown>>>;
|
|
207
168
|
}
|
|
208
169
|
interface PluginCommandCatalogEntry {
|
|
209
|
-
readonly
|
|
170
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
210
171
|
readonly background?: boolean;
|
|
211
172
|
readonly agent?: PluginAgentPolicy;
|
|
212
|
-
readonly arguments?: readonly PluginCommandArgument[];
|
|
213
|
-
readonly category?: PluginCommandCategory;
|
|
214
173
|
readonly description?: string;
|
|
215
|
-
readonly executionMode?: PluginCommandDefinition["executionMode"];
|
|
216
174
|
readonly id: string;
|
|
217
175
|
readonly input?: ZodType;
|
|
218
|
-
readonly options?: readonly PluginCommandOption[];
|
|
219
176
|
readonly pluginId: string;
|
|
220
177
|
readonly title: string;
|
|
221
178
|
readonly transaction: PluginCommandTransaction;
|
|
@@ -245,7 +202,7 @@ interface PluginCapabilityResolveRequest {
|
|
|
245
202
|
readonly pluginId: string;
|
|
246
203
|
}
|
|
247
204
|
interface PluginStatusCatalogEntry {
|
|
248
|
-
readonly
|
|
205
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
249
206
|
readonly description: string;
|
|
250
207
|
readonly id: string;
|
|
251
208
|
readonly input?: ZodType;
|
|
@@ -281,18 +238,15 @@ interface PluginCapabilityService {
|
|
|
281
238
|
readonly resolveStatus: (request: PluginCapabilityResolveRequest) => Promise<unknown>;
|
|
282
239
|
}
|
|
283
240
|
interface PluginSystemContextService {
|
|
284
|
-
/** @deprecated Use services.tools.inspectEnvironment. */
|
|
285
|
-
readonly inspectEnvironment: () => Promise<Readonly<Record<string, unknown>>>;
|
|
286
|
-
/** Requires a foreground ProjectMutation command declaring project.yaml and a reviewed configuration revision. */
|
|
287
|
-
readonly applyRoleTools: (request: {
|
|
288
|
-
readonly roleId: string;
|
|
289
|
-
readonly revision: string;
|
|
290
|
-
readonly toolIds: readonly string[];
|
|
291
|
-
}) => Promise<Readonly<Record<string, unknown>>>;
|
|
292
241
|
/** Finds an installed desktop app by its platform identity without launching it. */
|
|
293
242
|
readonly findApplication: (applicationId: string) => Promise<string | null>;
|
|
294
243
|
readonly getContext: () => Promise<Readonly<Record<string, unknown>>>;
|
|
295
244
|
}
|
|
245
|
+
interface PluginPublicationChanges {
|
|
246
|
+
readonly files: readonly string[];
|
|
247
|
+
readonly working: readonly string[];
|
|
248
|
+
readonly partiallyStaged: boolean;
|
|
249
|
+
}
|
|
296
250
|
interface PluginLogQueryRequest {
|
|
297
251
|
readonly cursor?: string;
|
|
298
252
|
readonly limit?: number;
|
|
@@ -366,6 +320,8 @@ interface PluginHostServices {
|
|
|
366
320
|
}[], refreshCommandId?: string) => () => void;
|
|
367
321
|
/** Notifies the host to refresh one bound repository after local writes, including partial failures. */
|
|
368
322
|
readonly notifyRepositoryChanged: (repositoryId: string) => Promise<void>;
|
|
323
|
+
/** Reads unpublished changes in a plugin-owned directory relative to the host's publication baseline. */
|
|
324
|
+
readonly readPublicationChanges: (directory: string) => Promise<PluginPublicationChanges>;
|
|
369
325
|
/** Checks committed code against the configured collaboration branches without closing the workspace. */
|
|
370
326
|
readonly verifySynchronized: () => Promise<void>;
|
|
371
327
|
};
|
|
@@ -456,17 +412,6 @@ declare enum PluginCommandTransaction {
|
|
|
456
412
|
None = "none",
|
|
457
413
|
ProjectMutation = "projectMutation"
|
|
458
414
|
}
|
|
459
|
-
declare enum PluginCommandCategory {
|
|
460
|
-
Build = "build",
|
|
461
|
-
Publish = "publish",
|
|
462
|
-
Run = "run",
|
|
463
|
-
Settings = "settings"
|
|
464
|
-
}
|
|
465
|
-
declare enum PluginCommandExecutionMode {
|
|
466
|
-
Async = "async",
|
|
467
|
-
Persistent = "persistent",
|
|
468
|
-
Sync = "sync"
|
|
469
|
-
}
|
|
470
415
|
declare enum PluginLifecyclePolicy {
|
|
471
416
|
BestEffort = "bestEffort",
|
|
472
417
|
FailFast = "failFast"
|
|
@@ -599,50 +544,33 @@ interface PluginCommandContext extends PluginInvocationContext {
|
|
|
599
544
|
readonly report: (details: PluginCommandDetails) => void;
|
|
600
545
|
readonly executionId: string;
|
|
601
546
|
}
|
|
602
|
-
interface PluginCommandDefinition {
|
|
603
|
-
|
|
547
|
+
interface PluginCommandDefinition<TInput = unknown> {
|
|
548
|
+
/** Plugin-defined serializable metadata forwarded verbatim in the capability catalog. */
|
|
549
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
604
550
|
/** Explicit host-owned background execution; transaction must be None. */
|
|
605
551
|
readonly background?: boolean;
|
|
606
552
|
/** Required for ProjectMutation; read-only and evaluated before the write lease is used. */
|
|
607
|
-
readonly plan?: (input:
|
|
553
|
+
readonly plan?: (input: TInput) => PluginSharedChanges | Promise<PluginSharedChanges>;
|
|
608
554
|
readonly agent?: PluginAgentPolicy;
|
|
609
|
-
readonly arguments?: readonly PluginCommandArgument[];
|
|
610
|
-
readonly category?: PluginCommandCategory;
|
|
611
555
|
readonly description?: string;
|
|
612
556
|
readonly effect?: PluginCommandEffect;
|
|
613
|
-
readonly executionMode?: PluginCommandExecutionMode | ((input: Readonly<Record<string, unknown>>) => PluginCommandExecutionMode);
|
|
614
557
|
readonly id: string;
|
|
615
|
-
readonly input?: ZodType
|
|
616
|
-
readonly
|
|
617
|
-
readonly run: (input: unknown, context: PluginCommandContext) => unknown | Promise<unknown>;
|
|
558
|
+
readonly input?: ZodType<TInput>;
|
|
559
|
+
readonly run: (input: TInput, context: PluginCommandContext) => unknown | Promise<unknown>;
|
|
618
560
|
readonly title: string;
|
|
619
561
|
readonly transaction?: PluginCommandTransaction;
|
|
620
562
|
}
|
|
621
|
-
interface PluginCommandArgument {
|
|
622
|
-
readonly description: string;
|
|
623
|
-
readonly name: string;
|
|
624
|
-
readonly required?: boolean;
|
|
625
|
-
}
|
|
626
|
-
interface PluginCommandOption {
|
|
627
|
-
readonly default?: unknown;
|
|
628
|
-
readonly description: string;
|
|
629
|
-
readonly flags: string;
|
|
630
|
-
}
|
|
631
563
|
declare enum PluginContextExposure {
|
|
632
564
|
Agent = "agent",
|
|
633
565
|
Internal = "internal"
|
|
634
566
|
}
|
|
635
|
-
interface PluginAgentContextDefinition {
|
|
567
|
+
interface PluginAgentContextDefinition<TInput = unknown> {
|
|
636
568
|
readonly exposure: PluginContextExposure;
|
|
637
569
|
readonly description: string;
|
|
638
570
|
readonly id: string;
|
|
639
|
-
readonly input?: ZodType
|
|
571
|
+
readonly input?: ZodType<TInput>;
|
|
640
572
|
readonly title: string;
|
|
641
|
-
readonly resolve: (input:
|
|
642
|
-
}
|
|
643
|
-
interface PluginViewRequest {
|
|
644
|
-
readonly input: unknown;
|
|
645
|
-
readonly method: string;
|
|
573
|
+
readonly resolve: (input: TInput, context: PluginInvocationContext) => unknown | Promise<unknown>;
|
|
646
574
|
}
|
|
647
575
|
declare enum PluginViewMethod {
|
|
648
576
|
CardActions = "workbase.cardActions",
|
|
@@ -681,17 +609,17 @@ interface PluginViewDefinition {
|
|
|
681
609
|
readonly layout?: PluginViewLayout;
|
|
682
610
|
readonly overviewCard?: PluginOverviewCardDefinition;
|
|
683
611
|
readonly order?: number;
|
|
684
|
-
readonly request?: (request: PluginViewRequest, context: PluginInvocationContext) => unknown | Promise<unknown>;
|
|
685
612
|
readonly slot: string;
|
|
686
613
|
readonly title?: string;
|
|
687
614
|
}
|
|
688
|
-
interface PluginStatusDefinition {
|
|
689
|
-
|
|
615
|
+
interface PluginStatusDefinition<TInput = unknown> {
|
|
616
|
+
/** Plugin-defined serializable metadata forwarded verbatim in the capability catalog. */
|
|
617
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
690
618
|
readonly description: string;
|
|
691
619
|
readonly id: string;
|
|
692
|
-
readonly input?: ZodType
|
|
620
|
+
readonly input?: ZodType<TInput>;
|
|
693
621
|
readonly label: string;
|
|
694
|
-
readonly resolve: (input:
|
|
622
|
+
readonly resolve: (input: TInput, context: PluginInvocationContext) => unknown | Promise<unknown>;
|
|
695
623
|
}
|
|
696
624
|
interface PluginToolContribution {
|
|
697
625
|
readonly id: string;
|
|
@@ -741,9 +669,9 @@ interface PluginSetupHooks {
|
|
|
741
669
|
readonly onWorkspaceDeactivate: PluginLifecycleHook;
|
|
742
670
|
readonly onWorkspaceFinalize: PluginLifecycleHook;
|
|
743
671
|
readonly onWorkspaceProvision: PluginLifecycleHook;
|
|
744
|
-
readonly registerAgentContext: (definition: PluginAgentContextDefinition) => void;
|
|
745
|
-
readonly registerCommand: (definition: PluginCommandDefinition) => void;
|
|
746
|
-
readonly registerStatus: (definition: PluginStatusDefinition) => void;
|
|
672
|
+
readonly registerAgentContext: <TInput = unknown>(definition: PluginAgentContextDefinition<TInput>) => void;
|
|
673
|
+
readonly registerCommand: <TInput = unknown>(definition: PluginCommandDefinition<TInput>) => void;
|
|
674
|
+
readonly registerStatus: <TInput = unknown>(definition: PluginStatusDefinition<TInput>) => void;
|
|
747
675
|
readonly registerView: (definition: PluginViewDefinition) => void;
|
|
748
676
|
}
|
|
749
677
|
interface WorkbasePluginDefinition {
|
|
@@ -792,4 +720,4 @@ interface PluginContributionSnapshot {
|
|
|
792
720
|
readonly views: readonly PluginViewContribution[];
|
|
793
721
|
}
|
|
794
722
|
//#endregion
|
|
795
|
-
export {
|
|
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 };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Component, ErrorInfo, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/ui/Components.dto.d.ts
|
|
3
|
+
export declare enum PluginStatusTone {
|
|
4
|
+
Success = "success",
|
|
5
|
+
Warning = "warning",
|
|
6
|
+
Danger = "danger",
|
|
7
|
+
Info = "info",
|
|
8
|
+
Neutral = "neutral"
|
|
9
|
+
}
|
|
10
|
+
type PluginStatusToneValue = `${PluginStatusTone}`;
|
|
11
|
+
interface PluginStatusPillProps extends HTMLAttributes<HTMLSpanElement> {
|
|
12
|
+
readonly tone: PluginStatusToneValue;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly isLoading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface PluginInlineErrorProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly actionLabel?: string;
|
|
19
|
+
readonly onAction?: () => void;
|
|
20
|
+
readonly isActionDisabled?: boolean;
|
|
21
|
+
readonly onDismiss?: () => void;
|
|
22
|
+
readonly dismissLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
interface PluginEmptyStateProps extends HTMLAttributes<HTMLElement> {
|
|
25
|
+
readonly title: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly icon?: ReactNode;
|
|
28
|
+
readonly action?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
interface PluginErrorBoundaryProps {
|
|
31
|
+
readonly children: ReactNode;
|
|
32
|
+
readonly title?: string;
|
|
33
|
+
readonly scope?: string;
|
|
34
|
+
readonly recovery?: string;
|
|
35
|
+
readonly retryLabel?: string;
|
|
36
|
+
readonly onReset?: () => void;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/ui/components.d.ts
|
|
40
|
+
export declare const PluginStatusPill: import("react").NamedExoticComponent<PluginStatusPillProps>;
|
|
41
|
+
export declare const PluginInlineError: import("react").NamedExoticComponent<PluginInlineErrorProps>;
|
|
42
|
+
export declare const PluginEmptyState: import("react").NamedExoticComponent<PluginEmptyStateProps>;
|
|
43
|
+
interface PluginErrorBoundaryState {
|
|
44
|
+
readonly error: Error | null;
|
|
45
|
+
readonly componentStack: string | null;
|
|
46
|
+
}
|
|
47
|
+
export declare class PluginErrorBoundary extends Component<PluginErrorBoundaryProps, PluginErrorBoundaryState> {
|
|
48
|
+
state: PluginErrorBoundaryState;
|
|
49
|
+
static getDerivedStateFromError(error: unknown): Partial<PluginErrorBoundaryState>;
|
|
50
|
+
componentDidCatch(_error: Error, info: ErrorInfo): void;
|
|
51
|
+
private handleReset;
|
|
52
|
+
render(): ReactNode;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export type { PluginEmptyStateProps, PluginErrorBoundaryProps, PluginInlineErrorProps, PluginStatusPillProps, PluginStatusToneValue };
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
|
131
|
+
export { PluginEmptyState, PluginErrorBoundary, PluginInlineError, PluginStatusPill, PluginStatusTone };
|