@eworkbase/sdk 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-ig9GUWhK.js";
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" | "custom";
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 workflow?: PluginWorkflowContribution;
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 workflow?: Exclude<PluginWorkflowContribution, true>;
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;
@@ -344,6 +298,15 @@ interface PluginExecutionService {
344
298
  readonly input: unknown;
345
299
  }) => Promise<unknown>;
346
300
  }
301
+ declare const DEFAULT_VIEW_STATE_TOPIC = "default";
302
+ declare const MAXIMUM_VIEW_STATE_BYTES: number;
303
+ interface PluginViewStatePublishOptions {
304
+ readonly topic?: string;
305
+ }
306
+ interface PluginViewStateService {
307
+ /** Pushes a bounded, JSON-serializable state snapshot to active views of this plugin. */
308
+ readonly publishState: (state: unknown, options?: PluginViewStatePublishOptions) => void;
309
+ }
347
310
  interface PluginHostServices {
348
311
  readonly executions: PluginExecutionService;
349
312
  readonly capabilities: PluginCapabilityService;
@@ -356,6 +319,7 @@ interface PluginHostServices {
356
319
  readonly toast: PluginToastApi;
357
320
  readonly tasks: PluginTaskService;
358
321
  readonly tools: PluginToolsService;
322
+ readonly views?: PluginViewStateService;
359
323
  readonly workspace: {
360
324
  /** Observe plugin-owned inputs during activation. The optional plugin command runs through the host transaction before notifying views. */
361
325
  readonly watchFiles?: (targets: readonly {
@@ -366,6 +330,8 @@ interface PluginHostServices {
366
330
  }[], refreshCommandId?: string) => () => void;
367
331
  /** Notifies the host to refresh one bound repository after local writes, including partial failures. */
368
332
  readonly notifyRepositoryChanged: (repositoryId: string) => Promise<void>;
333
+ /** Reads unpublished changes in a plugin-owned directory relative to the host's publication baseline. */
334
+ readonly readPublicationChanges: (directory: string) => Promise<PluginPublicationChanges>;
369
335
  /** Checks committed code against the configured collaboration branches without closing the workspace. */
370
336
  readonly verifySynchronized: () => Promise<void>;
371
337
  };
@@ -456,17 +422,6 @@ declare enum PluginCommandTransaction {
456
422
  None = "none",
457
423
  ProjectMutation = "projectMutation"
458
424
  }
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
425
  declare enum PluginLifecyclePolicy {
471
426
  BestEffort = "bestEffort",
472
427
  FailFast = "failFast"
@@ -599,50 +554,33 @@ interface PluginCommandContext extends PluginInvocationContext {
599
554
  readonly report: (details: PluginCommandDetails) => void;
600
555
  readonly executionId: string;
601
556
  }
602
- interface PluginCommandDefinition {
603
- readonly workflow?: PluginWorkflowContribution;
557
+ interface PluginCommandDefinition<TInput = unknown> {
558
+ /** Plugin-defined serializable metadata forwarded verbatim in the capability catalog. */
559
+ readonly annotations?: Readonly<Record<string, unknown>>;
604
560
  /** Explicit host-owned background execution; transaction must be None. */
605
561
  readonly background?: boolean;
606
562
  /** Required for ProjectMutation; read-only and evaluated before the write lease is used. */
607
- readonly plan?: (input: unknown) => PluginSharedChanges | Promise<PluginSharedChanges>;
563
+ readonly plan?: (input: TInput) => PluginSharedChanges | Promise<PluginSharedChanges>;
608
564
  readonly agent?: PluginAgentPolicy;
609
- readonly arguments?: readonly PluginCommandArgument[];
610
- readonly category?: PluginCommandCategory;
611
565
  readonly description?: string;
612
566
  readonly effect?: PluginCommandEffect;
613
- readonly executionMode?: PluginCommandExecutionMode | ((input: Readonly<Record<string, unknown>>) => PluginCommandExecutionMode);
614
567
  readonly id: string;
615
- readonly input?: ZodType;
616
- readonly options?: readonly PluginCommandOption[];
617
- readonly run: (input: unknown, context: PluginCommandContext) => unknown | Promise<unknown>;
568
+ readonly input?: ZodType<TInput>;
569
+ readonly run: (input: TInput, context: PluginCommandContext) => unknown | Promise<unknown>;
618
570
  readonly title: string;
619
571
  readonly transaction?: PluginCommandTransaction;
620
572
  }
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
573
  declare enum PluginContextExposure {
632
574
  Agent = "agent",
633
575
  Internal = "internal"
634
576
  }
635
- interface PluginAgentContextDefinition {
577
+ interface PluginAgentContextDefinition<TInput = unknown> {
636
578
  readonly exposure: PluginContextExposure;
637
579
  readonly description: string;
638
580
  readonly id: string;
639
- readonly input?: ZodType;
581
+ readonly input?: ZodType<TInput>;
640
582
  readonly title: string;
641
- readonly resolve: (input: unknown, context: PluginInvocationContext) => unknown | Promise<unknown>;
642
- }
643
- interface PluginViewRequest {
644
- readonly input: unknown;
645
- readonly method: string;
583
+ readonly resolve: (input: TInput, context: PluginInvocationContext) => unknown | Promise<unknown>;
646
584
  }
647
585
  declare enum PluginViewMethod {
648
586
  CardActions = "workbase.cardActions",
@@ -681,17 +619,17 @@ interface PluginViewDefinition {
681
619
  readonly layout?: PluginViewLayout;
682
620
  readonly overviewCard?: PluginOverviewCardDefinition;
683
621
  readonly order?: number;
684
- readonly request?: (request: PluginViewRequest, context: PluginInvocationContext) => unknown | Promise<unknown>;
685
622
  readonly slot: string;
686
623
  readonly title?: string;
687
624
  }
688
- interface PluginStatusDefinition {
689
- readonly workflow?: Exclude<PluginWorkflowContribution, true>;
625
+ interface PluginStatusDefinition<TInput = unknown> {
626
+ /** Plugin-defined serializable metadata forwarded verbatim in the capability catalog. */
627
+ readonly annotations?: Readonly<Record<string, unknown>>;
690
628
  readonly description: string;
691
629
  readonly id: string;
692
- readonly input?: ZodType;
630
+ readonly input?: ZodType<TInput>;
693
631
  readonly label: string;
694
- readonly resolve: (input: unknown, context: PluginInvocationContext) => unknown | Promise<unknown>;
632
+ readonly resolve: (input: TInput, context: PluginInvocationContext) => unknown | Promise<unknown>;
695
633
  }
696
634
  interface PluginToolContribution {
697
635
  readonly id: string;
@@ -741,9 +679,9 @@ interface PluginSetupHooks {
741
679
  readonly onWorkspaceDeactivate: PluginLifecycleHook;
742
680
  readonly onWorkspaceFinalize: PluginLifecycleHook;
743
681
  readonly onWorkspaceProvision: PluginLifecycleHook;
744
- readonly registerAgentContext: (definition: PluginAgentContextDefinition) => void;
745
- readonly registerCommand: (definition: PluginCommandDefinition) => void;
746
- readonly registerStatus: (definition: PluginStatusDefinition) => void;
682
+ readonly registerAgentContext: <TInput = unknown>(definition: PluginAgentContextDefinition<TInput>) => void;
683
+ readonly registerCommand: <TInput = unknown>(definition: PluginCommandDefinition<TInput>) => void;
684
+ readonly registerStatus: <TInput = unknown>(definition: PluginStatusDefinition<TInput>) => void;
747
685
  readonly registerView: (definition: PluginViewDefinition) => void;
748
686
  }
749
687
  interface WorkbasePluginDefinition {
@@ -792,4 +730,4 @@ interface PluginContributionSnapshot {
792
730
  readonly views: readonly PluginViewContribution[];
793
731
  }
794
732
  //#endregion
795
- export { PluginViewDefinition as $, PluginLifecycleDispatchResult as A, PluginTaskResult as At, PluginProcessOutputMode as B, RoleToolEnvironment as Bt, PluginExecutionEvidence as C, PluginPromptQuestion as Ct, PluginHookId as D, PluginStoreApi as Dt, PluginFileChange as E, PluginStatusCatalogEntry as Et, PluginLogger as F, PluginViewCatalogEntry as Ft, PluginRepositoryStatus as G, roleToolsProposalSchema as Gt, PluginProcessRunOptions as H, RoleToolsProposal as Ht, PluginOverviewCardData as I, PluginWorkflowContribution as It, PluginSharedChanges as J, PluginSetupHooks as K, PluginOverviewCardDefinition as L, PluginWorkflowOutput as Lt, PluginLifecycleOutcome as M, PluginToastApi as Mt, PluginLifecyclePolicy as N, PluginToastLevel as Nt, PluginHookResult as O, PluginSystemContextService as Ot, PluginLifecycleStatus as P, PluginToastOptions as Pt, PluginViewContribution as Q, PluginOverviewCardStatus as R, workflowContributionSchema as Rt, PluginDisposable as S, PluginPromptChoice as St, PluginExecutionStatus as T, PluginPromptViewRequest as Tt, PluginProject as U, roleToolEnvironmentSchema as Ut, PluginProcessResult as V, RoleToolsApplied as Vt, PluginRepository as W, roleToolsAppliedSchema as Wt, PluginStatusDefinition as X, PluginStatusContribution as Y, PluginToolContribution as Z, PluginCommandOption as _, PluginLogEntry as _t, PluginCapabilityReference as a, PluginAgentContextCatalogEntry as at, PluginContextExposure as b, PluginLogService as bt, PluginCommandCategory as c, PluginCapabilityCommandRequest as ct, PluginCommandDefinition as d, PluginColoredMessage as dt, PluginViewLayout as et, PluginCommandDetails as f, PluginCommandCatalogEntry as ft, PluginCommandLogPolicy as g, PluginInteractiveLogger as gt, PluginCommandExecutionResult as h, PluginHostServices as ht, PluginCapabilityKind as i, WorkbasePluginDefinition as it, PluginLifecycleHook as j, PluginTaskService as jt, PluginInvocationContext as k, PluginTaskDescriptor as kt, PluginCommandContext as l, PluginCapabilityResolveRequest as lt, PluginCommandExecutionMode as m, PluginExecutionService as mt, PluginAgentContextDefinition as n, PluginViewRequest as nt, PluginCardAction as o, PluginAgentPolicy as ot, PluginCommandEffect as p, PluginConfigApi as pt, PluginSharedChangeKind as q, PluginAgentScope as r, PluginWorkspace as rt, PluginCommandArgument as s, PluginCapabilityCatalog as st, PluginAgentContextContribution as t, PluginViewMethod as tt, PluginCommandContribution as u, PluginCapabilityService as ut, PluginCommandTransaction as v, PluginLogQueryRequest as vt, PluginExecutionSnapshot as w, PluginPromptType as wt, PluginContributionSnapshot as x, PluginPromptApi as xt, PluginContext as y, PluginLogQueryResult as yt, PluginProcessApi as z, PluginToolsService as zt };
733
+ export { WorkbasePluginDefinition as $, PluginLifecycleStatus as A, PluginToastLevel as At, PluginRepository as B, roleToolsAppliedSchema as Bt, PluginHookId as C, PluginStatusCatalogEntry as Ct, PluginLifecycleHook as D, PluginTaskResult as Dt, PluginLifecycleDispatchResult as E, PluginTaskDescriptor as Et, PluginProcessApi as F, PluginToolsService as Ft, PluginStatusContribution as G, PluginSetupHooks as H, PluginProcessOutputMode as I, RoleToolEnvironment as It, PluginViewContribution as J, PluginStatusDefinition as K, PluginProcessResult as L, RoleToolsApplied as Lt, PluginOverviewCardData as M, PluginViewCatalogEntry as Mt, PluginOverviewCardDefinition as N, PluginViewStatePublishOptions as Nt, PluginLifecycleOutcome as O, PluginTaskService as Ot, PluginOverviewCardStatus as P, PluginViewStateService as Pt, PluginWorkspace as Q, PluginProcessRunOptions as R, RoleToolsProposal as Rt, PluginFileChange as S, PluginPublicationChanges as St, PluginInvocationContext as T, PluginSystemContextService as Tt, PluginSharedChangeKind as U, PluginRepositoryStatus as V, roleToolsProposalSchema as Vt, PluginSharedChanges as W, PluginViewLayout as X, PluginViewDefinition as Y, PluginViewMethod as Z, PluginContributionSnapshot as _, PluginPromptApi as _t, PluginCapabilityReference as a, PluginCapabilityCommandRequest as at, PluginExecutionSnapshot as b, PluginPromptType as bt, PluginCommandContribution as c, PluginCommandCatalogEntry as ct, PluginCommandEffect as d, PluginHostServices as dt, DEFAULT_VIEW_STATE_TOPIC as et, PluginCommandExecutionResult as f, PluginInteractiveLogger as ft, PluginContextExposure as g, PluginLogService as gt, PluginContext as h, PluginLogQueryResult as ht, PluginCapabilityKind as i, PluginCapabilityCatalog as it, PluginLogger as j, PluginToastOptions as jt, PluginLifecyclePolicy as k, PluginToastApi as kt, PluginCommandDefinition as l, PluginConfigApi as lt, PluginCommandTransaction as m, PluginLogQueryRequest as mt, PluginAgentContextDefinition as n, PluginAgentContextCatalogEntry as nt, PluginCardAction as o, PluginCapabilityResolveRequest as ot, PluginCommandLogPolicy as p, PluginLogEntry as pt, PluginToolContribution as q, PluginAgentScope as r, PluginAgentPolicy as rt, PluginCommandContext as s, PluginCapabilityService as st, PluginAgentContextContribution as t, MAXIMUM_VIEW_STATE_BYTES as tt, PluginCommandDetails as u, PluginExecutionService as ut, PluginDisposable as v, PluginPromptChoice as vt, PluginHookResult as w, PluginStoreApi as wt, PluginExecutionStatus as x, PluginPromptViewRequest as xt, PluginExecutionEvidence as y, PluginPromptQuestion as yt, PluginProject as z, roleToolEnvironmentSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Nt as PluginToastLevel, h as PluginCommandExecutionResult, w as PluginExecutionSnapshot } from "./types-2X-_T_W_.js";
1
+ import { At as PluginToastLevel, b as PluginExecutionSnapshot, f as PluginCommandExecutionResult } from "./types-DDEHTBRv.js";
2
2
  //#region src/ui/types.d.ts
3
3
  type PluginUiPromptType = 'confirm' | 'multi-select' | 'select' | 'text';
4
4
  type PluginUiFileSelectionScope = 'project' | 'workspace';
@@ -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;
@@ -90,11 +101,18 @@ interface PluginUiCommands {
90
101
  interface PluginUiStatus {
91
102
  readonly resolve: <Result = unknown>(statusId: string, input: unknown) => Promise<Result>;
92
103
  }
104
+ /** A single authoritative state snapshot pushed by the plugin backend. */
105
+ interface PluginUiStateChange<State = unknown> {
106
+ readonly topic: string;
107
+ readonly state: State;
108
+ }
93
109
  interface PluginUiView {
94
110
  /** Report in-memory edits to the navigation for this view instance. */
95
111
  readonly setModified: (modified: boolean) => Promise<void>;
96
112
  /** Refresh retained data when this plugin's declared files change. */
97
113
  readonly onFilesChanged: (refresh: () => void | Promise<unknown>) => () => void;
114
+ /** Subscribe to backend-pushed state snapshots for a topic (defaults to "default"). */
115
+ readonly onStateChanged: <State = unknown>(listener: (state: State) => void, topic?: string) => () => void;
98
116
  readonly call: <Result = unknown>(method: string, input: unknown) => Promise<Result>;
99
117
  }
100
118
  declare enum PluginDesktopTarget {
@@ -132,28 +150,32 @@ interface PluginUiRepositoryPushResult {
132
150
  readonly results: readonly PluginUiRepositoryPushOutcome[];
133
151
  }
134
152
  interface WorkbasePluginUi {
153
+ /** Releases window listeners, observers and the Penpal bridge when the view unmounts. */
154
+ readonly dispose: () => void;
135
155
  /** Hides a resumable interaction without answering or cancelling it. */
136
156
  readonly dismiss: () => Promise<void>;
137
157
  /** Answers only the interaction currently hosted in this frame. Null cancels it. */
138
158
  readonly respond: (value: unknown | null) => Promise<void>;
139
- readonly closeOutput: <Result = unknown>(id: string) => Promise<Result>;
140
159
  readonly commands: PluginUiCommands;
141
160
  /** Available in ordinary plugin pages/tabs, including their detached windows. */
142
161
  readonly desktop: {
143
162
  readonly open: (options: PluginUiDesktopOpenOptions) => Promise<PluginUiDesktopOpenResult>;
144
163
  };
145
- /** Requests host confirmation and pushes only the confirmed managed repository commits. */
146
164
  readonly repositories: {
147
- readonly push: (targets: readonly PluginUiRepositoryPushTarget[]) => Promise<PluginUiRepositoryPushResult>;
165
+ /** Call from the user action that confirms pushing the indicated workspace repositories. */
166
+ readonly authorizePush: (repositoryIds: readonly string[]) => Promise<string>;
167
+ /** Reuse an authorization once, or ask the host for confirmation when none is supplied. */
168
+ readonly push: (targets: readonly PluginUiRepositoryPushTarget[], authorizationId?: string) => Promise<PluginUiRepositoryPushResult>;
148
169
  };
149
170
  /** Plugin destinations open in a separate window; other app routes use ordinary navigation. */
150
171
  readonly navigate: <Result = unknown>(to: string, options?: PluginUiNavigateOptions) => Promise<Result>;
172
+ /** Opens a plugin view using canonical route/parameter encoding without hand-building URLs. */
173
+ readonly openPluginView: (options: PluginUiOpenViewOptions) => Promise<void>;
151
174
  readonly openOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
152
175
  readonly selectFiles: (options?: PluginUiFileSelectOptions) => Promise<string | readonly string[] | null>;
153
176
  readonly showPrompt: <Value = unknown>(options: PluginUiPromptOptions<Value>) => Promise<Value | readonly Value[] | null>;
154
177
  readonly showToast: <Result = unknown>(options: PluginUiToastOptions) => Promise<Result>;
155
178
  readonly status: PluginUiStatus;
156
- readonly updateOutput: <Result = unknown>(options: PluginUiOutputOptions) => Promise<Result>;
157
179
  readonly view: PluginUiView;
158
180
  }
159
181
  interface PluginUiHostError extends Error {
@@ -167,6 +189,7 @@ interface PluginUiHostMethods {
167
189
  interface PluginUiClientMethods {
168
190
  readonly filesChanged: () => Promise<void>;
169
191
  readonly executionChanged: (change: PluginUiExecutionChange) => Promise<void>;
192
+ readonly stateChanged: (change: PluginUiStateChange) => Promise<void>;
170
193
  readonly initialize: (payload: unknown) => Promise<void>;
171
194
  }
172
195
  interface PluginUiTransportConnection {
@@ -178,4 +201,4 @@ interface PluginUiControllerOptions {
178
201
  readonly targetWindow: Window & typeof globalThis;
179
202
  }
180
203
  //#endregion
181
- export { WorkbasePluginUi as A, PluginUiRepositoryPushResult as C, PluginUiTransportConnection as D, PluginUiToastOptions as E, PluginUiView as O, PluginUiRepositoryPushOutcome as S, PluginUiStatus 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, WorkbasePluginUiDefinition as j, PluginUiViewIdentity 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, PluginUiOutputOptions as v, PluginUiRepositoryPushTarget as w, PluginUiPromptType as x, PluginUiPromptChoice as y };
204
+ export { PluginUiView as A, PluginUiRepositoryPushOutcome as C, PluginUiStatus as D, PluginUiStateChange as E, WorkbasePluginUi as M, WorkbasePluginUiDefinition as N, PluginUiToastOptions as O, PluginUiPromptType as S, PluginUiRepositoryPushTarget as T, PluginUiNavigateOptions as _, PluginUiContextIdentity as a, PluginUiPromptChoice as b, PluginUiDesktopOpenResult as c, PluginUiFileSelectOptions as d, PluginUiFileSelectionItemType as f, PluginUiInitializationPayload as g, PluginUiHostMethods as h, PluginUiCommands as i, PluginUiViewIdentity as j, PluginUiTransportConnection as k, PluginUiExecutionChange as l, PluginUiHostError as m, PluginUiClientMethods as n, PluginUiControllerOptions as o, PluginUiFileSelectionScope as p, PluginUiCommandExecuteOptions as r, PluginUiDesktopOpenOptions as s, PluginDesktopTarget as t, PluginUiFileFilter as u, PluginUiOpenViewOptions as v, PluginUiRepositoryPushResult as w, PluginUiPromptOptions as x, PluginUiOutputOptions as y };
@@ -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,2 @@
1
+ import { a as PluginStatusTone, i as PluginStatusPill, n as PluginErrorBoundary, r as PluginInlineError, t as PluginEmptyState } from "../components-DxL-99bM.js";
2
+ export { PluginEmptyState, PluginErrorBoundary, PluginInlineError, PluginStatusPill, PluginStatusTone };
@@ -1,4 +1,4 @@
1
- import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "../ExecutionLog.dto-ig9GUWhK.js";
1
+ import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "../ExecutionLog.dto-Bq2u5C90.js";
2
2
  //#region src/ui/ExecutionLogTimeline.dto.d.ts
3
3
  export declare enum ExecutionLogDisplay {
4
4
  Full = "full",
@@ -36,12 +36,16 @@ interface ExecutionLogTimelineProps {
36
36
  readonly limit?: number;
37
37
  readonly isLoading?: boolean;
38
38
  readonly error?: string | null;
39
+ readonly phaseLabels?: Readonly<Record<string, string>>;
39
40
  readonly onOpenLog?: (logId: string) => void;
40
41
  }
41
42
  //#endregion
42
43
  //#region src/ui/execution-log-model.d.ts
44
+ interface BuildExecutionLogItemsOptions {
45
+ readonly phaseLabels?: Readonly<Record<string, string>>;
46
+ }
43
47
  /** Merge loaded related records into the same reader; unresolved calls retain their navigation. */
44
- export declare function buildExecutionLogItems(record: ExecutionLogRecord, relatedRecords?: readonly ExecutionLogRecord[]): readonly ExecutionLogTimelineItem[];
48
+ export declare function buildExecutionLogItems(record: ExecutionLogRecord, relatedRecords?: readonly ExecutionLogRecord[], options?: BuildExecutionLogItemsOptions): readonly ExecutionLogTimelineItem[];
45
49
  export declare function executionLogStatusLabel(status: string): string;
46
50
  //#endregion
47
51
  //#region src/ui/ExecutionLogTimeline.d.ts
@@ -22,22 +22,11 @@ const LOG_STATUS_LABELS = /* @__PURE__ */ new Map([
22
22
  ["warning", "有警告"],
23
23
  ["unknown", "未记录"]
24
24
  ]);
25
- const LOG_PHASE_LABELS = /* @__PURE__ */ new Map([
26
- ["preflight", "访问检查"],
27
- ["tools", "工具准备"],
28
- ["repositories", "仓库处理"],
29
- ["environment", "项目环境"],
30
- ["plugins", "插件"],
31
- ["verification", "结果检查"],
32
- ["configuration", "项目配置"],
33
- ["publication", "配置发布"],
34
- ["execution", "执行任务"]
35
- ]);
36
25
  /** Merge loaded related records into the same reader; unresolved calls retain their navigation. */
37
- function buildExecutionLogItems(record, relatedRecords = []) {
26
+ function buildExecutionLogItems(record, relatedRecords = [], options = {}) {
38
27
  const records = [...new Map([record, ...relatedRecords].map((source) => [source.id, source])).values()];
39
28
  const loadedIds = new Set(records.map(({ id }) => id));
40
- return records.flatMap((source) => recordItems(source).map((item) => {
29
+ return records.flatMap((source) => recordItems(source, options.phaseLabels).map((item) => {
41
30
  const logId = item.logId && !loadedIds.has(item.logId) ? item.logId : void 0;
42
31
  return source.id === record.id ? {
43
32
  ...item,
@@ -77,18 +66,18 @@ function normalizeLogStatus(status) {
77
66
  ].includes(status)) return "needs_action";
78
67
  return status;
79
68
  }
80
- function recordItems(record) {
69
+ function recordItems(record, phaseLabels) {
81
70
  const entries = (record.entries ?? []).map(logEntryItem);
82
71
  const calls = [...new Map((record.children ?? []).map((call) => [call.id, call])).values()];
83
72
  const steps = record.steps ?? [];
84
73
  const wrapper = Boolean(record.execution && entries.length && steps.length === 1 && steps[0].target?.kind === "plugin" && steps[0].target.id === record.execution.pluginId);
85
74
  const items = [
86
75
  ...entries,
87
- ...wrapper ? [] : steps.map(logStepItem),
76
+ ...wrapper ? [] : steps.map((step) => logStepItem(step, phaseLabels)),
88
77
  ...calls.map(logCallItem)
89
78
  ];
90
79
  if (wrapper) {
91
- const result = logStepItem(steps[0]);
80
+ const result = logStepItem(steps[0], phaseLabels);
92
81
  items.push({
93
82
  ...result,
94
83
  id: "execution-evidence",
@@ -146,7 +135,7 @@ function logEntryItem(entry) {
146
135
  }] : []
147
136
  };
148
137
  }
149
- function logStepItem(step) {
138
+ function logStepItem(step, phaseLabels) {
150
139
  const evidence = [
151
140
  {
152
141
  kind: "command",
@@ -164,9 +153,10 @@ function logStepItem(step) {
164
153
  content: step.stderr
165
154
  }
166
155
  ].filter((block) => Boolean(block.content));
156
+ const phaseLabel = step.phase ? phaseLabels?.[step.phase] ?? step.phase : void 0;
167
157
  const context = [...new Set([
168
158
  step.target?.label,
169
- LOG_PHASE_LABELS.get(step.phase ?? "") ?? step.phase,
159
+ phaseLabel,
170
160
  step.provider
171
161
  ].filter((label) => Boolean(label)))];
172
162
  const timing = step.timing;
@@ -227,7 +217,7 @@ const COPY_SUCCESS_MESSAGE = "已复制";
227
217
  const COPY_CONFIRMATION_MS = 2e3;
228
218
  const LATEST_SCROLL_THRESHOLD = 24;
229
219
  const LOG_KIND_LABELS = /* @__PURE__ */ new Map([["question", "提问"], ["answer", "回答"]]);
230
- const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, record, relatedRecords, display = "full", executionId, limit = RECENT_ENTRY_LIMIT, isLoading, error, onOpenLog }) {
220
+ const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, record, relatedRecords, display = "full", executionId, limit = RECENT_ENTRY_LIMIT, isLoading, error, phaseLabels, onOpenLog }) {
231
221
  const viewport = useRef(null);
232
222
  const following = useRef(true);
233
223
  const [isFollowing, setIsFollowing] = useState(true);
@@ -236,8 +226,9 @@ const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, recor
236
226
  id: "",
237
227
  title: "",
238
228
  entries: [...entries ?? []]
239
- }, relatedRecords), [
229
+ }, relatedRecords, { phaseLabels }), [
240
230
  entries,
231
+ phaseLabels,
241
232
  record,
242
233
  relatedRecords
243
234
  ]);
@@ -0,0 +1,70 @@
1
+ import { M as WorkbasePluginUi, g as PluginUiInitializationPayload } from "../types-b6G-gae3.js";
2
+ import { ReactNode, RefObject } from "react";
3
+ //#region src/ui/hooks.d.ts
4
+ export interface ReactRootLike {
5
+ readonly render: (children: ReactNode) => void;
6
+ }
7
+ export interface MountedPluginViewContext {
8
+ readonly host: WorkbasePluginUi;
9
+ readonly initialization: PluginUiInitializationPayload;
10
+ readonly contextKey: string;
11
+ }
12
+ export interface MountPluginViewOptions {
13
+ readonly createRoot: (container: Element) => ReactRootLike;
14
+ readonly elementId?: string;
15
+ readonly errorTitle: string;
16
+ readonly errorScope: string;
17
+ readonly errorRecovery?: string;
18
+ readonly keyFor?: (initialization: PluginUiInitializationPayload) => string;
19
+ readonly wrap?: (children: ReactNode) => ReactNode;
20
+ readonly render: (context: MountedPluginViewContext) => ReactNode;
21
+ }
22
+ export interface UsePluginViewStateOptions<State> {
23
+ readonly host: WorkbasePluginUi;
24
+ readonly load: (emit: (partial: State) => void) => Promise<State>;
25
+ readonly initialState?: State | null;
26
+ readonly stateTopic?: string | null;
27
+ readonly onState?: (next: State, previous: State | null) => void;
28
+ readonly pollIntervalMs?: number | ((state: State | null, error: string | null) => number | null);
29
+ readonly refreshOnFocus?: boolean;
30
+ readonly refreshOnFilesChanged?: boolean;
31
+ readonly observeVisibility?: boolean;
32
+ readonly focusCooldownMs?: number;
33
+ readonly fallbackError?: string;
34
+ readonly isBlocked?: () => boolean;
35
+ readonly loadOnMount?: boolean;
36
+ }
37
+ export interface PluginViewStateResult<State> {
38
+ readonly data: State | null;
39
+ readonly error: string | null;
40
+ readonly isRefreshing: boolean;
41
+ readonly isVisible: boolean;
42
+ readonly viewRef: (node: HTMLElement | null) => void;
43
+ readonly setError: (message: string | null) => void;
44
+ readonly clearError: () => void;
45
+ readonly refresh: () => Promise<State | null>;
46
+ readonly acceptData: (next: State) => void;
47
+ readonly invalidatePending: () => void;
48
+ }
49
+ export interface UsePluginActionOptions {
50
+ readonly onError?: (message: string) => void;
51
+ readonly fallbackError?: string;
52
+ }
53
+ export interface PluginActionResult<ActionId> {
54
+ readonly busyAction: ActionId | null;
55
+ readonly isBusy: boolean;
56
+ readonly isBusyRef: RefObject<boolean>;
57
+ readonly isMountedRef: RefObject<boolean>;
58
+ readonly run: <Value>(actionId: ActionId, task: () => Promise<Value>) => Promise<Value | undefined>;
59
+ }
60
+ /** Mounts a Workbase plugin view with shared style nonce, error boundary and workspace key isolation. */
61
+ export declare function mountPluginView(options: MountPluginViewOptions): WorkbasePluginUi;
62
+ /**
63
+ * Manages cached view state, stale-response protection, in-flight deduplication,
64
+ * backend State Sync pushes, file-change notifications and visibility-aware polling.
65
+ */
66
+ export declare function usePluginViewState<State>(options: UsePluginViewStateOptions<State>): PluginViewStateResult<State>;
67
+ /** Serializes mutating plugin actions so concurrent clicks never overlap or leak stale errors. */
68
+ export declare function usePluginAction<ActionId>(options?: UsePluginActionOptions): PluginActionResult<ActionId>;
69
+ export declare function buildViewContextKey(payload: PluginUiInitializationPayload): string;
70
+ //#endregion