@eworkbase/sdk 0.4.1 → 0.4.3
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 → ExecutionLog.dto-ig9GUWhK.d.ts} +1 -18
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/{types-C8byxPji.d.ts → types-BYBaqYve.d.ts} +1 -1
- package/dist/{types-Bv7aJizu.d.ts → types-npalCBRO.d.ts} +21 -3
- package/dist/ui/execution-log.d.ts +11 -4
- package/dist/ui/execution-log.js +205 -220
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/markdown-links.d.ts +1 -1
- package/dist/ui/theme.css +38 -54
- package/package.json +1 -1
|
@@ -15,22 +15,6 @@ declare const executionLogEntrySchema: z.ZodObject<{
|
|
|
15
15
|
details: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
16
|
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
17
|
}, z.core.$strict>;
|
|
18
|
-
declare const logCallSchema: z.ZodObject<{
|
|
19
|
-
id: z.ZodString;
|
|
20
|
-
title: z.ZodString;
|
|
21
|
-
status: z.ZodString;
|
|
22
|
-
createdAt: z.ZodString;
|
|
23
|
-
operationKind: z.ZodString;
|
|
24
|
-
hasWarnings: z.ZodBoolean;
|
|
25
|
-
context: z.ZodObject<{
|
|
26
|
-
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
hasChildErrors: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
-
execution: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
30
|
-
pluginId: z.ZodString;
|
|
31
|
-
commandId: z.ZodString;
|
|
32
|
-
}, z.core.$strip>>>;
|
|
33
|
-
}, z.core.$strip>;
|
|
34
18
|
/** Existing operation evidence is returned alongside entries; it is never copied into another store. */
|
|
35
19
|
declare const executionLogRecordSchema: z.ZodObject<{
|
|
36
20
|
id: z.ZodString;
|
|
@@ -108,9 +92,8 @@ declare const executionLogRecordSchema: z.ZodObject<{
|
|
|
108
92
|
type ExecutionLogEntry = Omit<z.infer<typeof executionLogEntrySchema>, "kind"> & {
|
|
109
93
|
readonly kind: `${ExecutionLogEntryKind}`;
|
|
110
94
|
};
|
|
111
|
-
type ExecutionLogCallRecord = z.infer<typeof logCallSchema>;
|
|
112
95
|
type ExecutionLogRecord = Readonly<Omit<z.infer<typeof executionLogRecordSchema>, "entries">> & {
|
|
113
96
|
readonly entries: readonly ExecutionLogEntry[];
|
|
114
97
|
};
|
|
115
98
|
//#endregion
|
|
116
|
-
export {
|
|
99
|
+
export { executionLogRecordSchema as a, executionLogEntrySchema as i, ExecutionLogEntryKind as n, ExecutionLogRecord as r, ExecutionLogEntry as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { $ as
|
|
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 PluginWorkspace, A as PluginLifecycleHook, At as PluginToastOptions, B as PluginRepository, C as PluginExecutionSnapshot, Ct as PluginStoreApi, D as PluginHookResult, Dt as PluginTaskService, E as PluginHookId, Et as PluginTaskResult, F as PluginProcessApi, Ft as RoleToolsProposal, G as PluginStatusContribution, H as PluginSetupHooks, I as PluginProcessOutputMode, It as roleToolEnvironmentSchema, J as PluginViewContribution, K as PluginStatusDefinition, L as PluginProcessResult, Lt as roleToolsAppliedSchema, M as PluginLifecyclePolicy, Mt as PluginToolsService, N as PluginLifecycleStatus, Nt as RoleToolEnvironment, O as PluginInvocationContext, Ot as PluginToastApi, P as PluginLogger, Pt as RoleToolsApplied, Q as PluginViewRequest, R as PluginProcessRunOptions, Rt as roleToolsProposalSchema, S as PluginExecutionEvidence, St as PluginStatusCatalogEntry, T as PluginFileChange, Tt as PluginTaskDescriptor, U as PluginSharedChangeKind, V as PluginRepositoryStatus, W as PluginSharedChanges, X as PluginViewLayout, Y as PluginViewDefinition, Z as PluginViewMethod, _ as PluginCommandTransaction, _t as PluginPromptApi, a as PluginCapabilityReference, at as PluginCapabilityResolveRequest, b as PluginContributionSnapshot, bt as PluginPromptType, c as PluginCommandCategory, ct as PluginCommandCatalogEntry, d as PluginCommandDefinition, dt as PluginHostServices, et as WorkbasePluginDefinition, f as PluginCommandDetails, ft as PluginInteractiveLogger, g as PluginCommandOption, gt as PluginLogService, h as PluginCommandExecutionResult, ht as PluginLogQueryResult, i as PluginCapabilityKind, it as PluginCapabilityCommandRequest, j as PluginLifecycleOutcome, jt as PluginViewCatalogEntry, k as PluginLifecycleDispatchResult, kt as PluginToastLevel, l as PluginCommandContext, lt as PluginConfigApi, m as PluginCommandExecutionMode, mt as PluginLogQueryRequest, n as PluginAgentContextDefinition, nt as PluginAgentPolicy, o as PluginCardAction, ot as PluginCapabilityService, p as PluginCommandEffect, pt as PluginLogEntry, q as PluginToolContribution, r as PluginAgentScope, rt as PluginCapabilityCatalog, s as PluginCommandArgument, st as PluginColoredMessage, t as PluginAgentContextContribution, tt as PluginAgentContextCatalogEntry, u as PluginCommandContribution, ut as PluginExecutionService, v as PluginContext, vt as PluginPromptChoice, w as PluginExecutionStatus, wt as PluginSystemContextService, x as PluginDisposable, xt as PluginPromptViewRequest, y as PluginContextExposure, yt as PluginPromptQuestion, z as PluginProject } from "./types-npalCBRO.js";
|
|
3
3
|
export * from "zod";
|
|
4
4
|
//#region src/definition.d.ts
|
|
5
5
|
export declare const PLUGIN_API_VERSION = 2;
|
|
@@ -7,4 +7,4 @@ type DefinedWorkbasePlugin = Readonly<WorkbasePluginDefinition>;
|
|
|
7
7
|
export declare function definePlugin(definition: WorkbasePluginDefinition): DefinedWorkbasePlugin;
|
|
8
8
|
export declare function isDefinedPlugin(value: unknown): value is DefinedWorkbasePlugin;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { type DefinedWorkbasePlugin, type ExecutionLogEntry, ExecutionLogEntryKind, type ExecutionLogRecord, type PluginAgentContextCatalogEntry, type PluginAgentContextContribution, type PluginAgentContextDefinition, type PluginAgentPolicy, PluginAgentScope, type PluginCapabilityCatalog, type PluginCapabilityCommandRequest, PluginCapabilityKind, type PluginCapabilityReference, type PluginCapabilityResolveRequest, type PluginCapabilityService, type PluginColoredMessage, type PluginCommandArgument, type PluginCommandCatalogEntry, PluginCommandCategory, type PluginCommandContext, type PluginCommandContribution, type PluginCommandDefinition, type PluginCommandDetails, PluginCommandEffect, PluginCommandExecutionMode, type PluginCommandExecutionResult, type PluginCommandOption, PluginCommandTransaction, type PluginConfigApi, type PluginContext, PluginContextExposure, type PluginContributionSnapshot, type PluginDisposable, type PluginExecutionEvidence, type PluginExecutionService, type PluginExecutionSnapshot, PluginExecutionStatus, type PluginFileChange, PluginHookId, type PluginHookResult, type PluginHostServices, type PluginInteractiveLogger, type PluginInvocationContext, type PluginLifecycleDispatchResult, type PluginLifecycleHook, type PluginLifecycleOutcome, PluginLifecyclePolicy, PluginLifecycleStatus, type PluginLogEntry, type PluginLogQueryRequest, type PluginLogQueryResult, type PluginLogService, type PluginLogger, type PluginProcessApi, PluginProcessOutputMode, type PluginProcessResult, type PluginProcessRunOptions, type PluginProject, type PluginPromptApi, type PluginPromptChoice, type PluginPromptQuestion, type PluginPromptType, type PluginPromptViewRequest, type PluginRepository, PluginRepositoryStatus, type PluginSetupHooks, PluginSharedChangeKind, type PluginSharedChanges, type PluginStatusCatalogEntry, type PluginStatusContribution, type PluginStatusDefinition, type PluginStoreApi, type PluginSystemContextService, type PluginTaskDescriptor, type PluginTaskResult, type PluginTaskService, type PluginToastApi, type PluginToastLevel, type PluginToastOptions, type PluginToolContribution, PluginToolsService, type PluginViewCatalogEntry, type PluginViewContribution, type PluginViewDefinition, PluginViewLayout, type PluginViewRequest, type PluginWorkspace, RoleToolEnvironment, RoleToolsApplied, RoleToolsProposal, type WorkbasePluginDefinition, executionLogEntrySchema, executionLogRecordSchema, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema };
|
|
10
|
+
export { type DefinedWorkbasePlugin, type ExecutionLogEntry, ExecutionLogEntryKind, type ExecutionLogRecord, type PluginAgentContextCatalogEntry, type PluginAgentContextContribution, type PluginAgentContextDefinition, type PluginAgentPolicy, PluginAgentScope, type PluginCapabilityCatalog, type PluginCapabilityCommandRequest, PluginCapabilityKind, type PluginCapabilityReference, type PluginCapabilityResolveRequest, type PluginCapabilityService, type PluginCardAction, type PluginColoredMessage, type PluginCommandArgument, type PluginCommandCatalogEntry, PluginCommandCategory, type PluginCommandContext, type PluginCommandContribution, type PluginCommandDefinition, type PluginCommandDetails, PluginCommandEffect, PluginCommandExecutionMode, type PluginCommandExecutionResult, type PluginCommandOption, PluginCommandTransaction, type PluginConfigApi, type PluginContext, PluginContextExposure, type PluginContributionSnapshot, type PluginDisposable, type PluginExecutionEvidence, type PluginExecutionService, type PluginExecutionSnapshot, PluginExecutionStatus, type PluginFileChange, PluginHookId, type PluginHookResult, type PluginHostServices, type PluginInteractiveLogger, type PluginInvocationContext, type PluginLifecycleDispatchResult, type PluginLifecycleHook, type PluginLifecycleOutcome, PluginLifecyclePolicy, PluginLifecycleStatus, type PluginLogEntry, type PluginLogQueryRequest, type PluginLogQueryResult, type PluginLogService, type PluginLogger, type PluginProcessApi, PluginProcessOutputMode, type PluginProcessResult, type PluginProcessRunOptions, type PluginProject, type PluginPromptApi, type PluginPromptChoice, type PluginPromptQuestion, type PluginPromptType, type PluginPromptViewRequest, type PluginRepository, PluginRepositoryStatus, type PluginSetupHooks, PluginSharedChangeKind, type PluginSharedChanges, type PluginStatusCatalogEntry, type PluginStatusContribution, type PluginStatusDefinition, type PluginStoreApi, type PluginSystemContextService, type PluginTaskDescriptor, type PluginTaskResult, type PluginTaskService, type PluginToastApi, type PluginToastLevel, type PluginToastOptions, type PluginToolContribution, PluginToolsService, type PluginViewCatalogEntry, type PluginViewContribution, type PluginViewDefinition, PluginViewLayout, PluginViewMethod, type PluginViewRequest, type PluginWorkspace, RoleToolEnvironment, RoleToolsApplied, RoleToolsProposal, type WorkbasePluginDefinition, executionLogEntrySchema, executionLogRecordSchema, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema };
|
package/dist/index.js
CHANGED
|
@@ -123,6 +123,10 @@ let PluginContextExposure = /* @__PURE__ */ function(PluginContextExposure) {
|
|
|
123
123
|
PluginContextExposure["Internal"] = "internal";
|
|
124
124
|
return PluginContextExposure;
|
|
125
125
|
}({});
|
|
126
|
+
let PluginViewMethod = /* @__PURE__ */ function(PluginViewMethod) {
|
|
127
|
+
PluginViewMethod["CardActions"] = "workbase.cardActions";
|
|
128
|
+
return PluginViewMethod;
|
|
129
|
+
}({});
|
|
126
130
|
//#endregion
|
|
127
131
|
//#region src/Tools.dto.ts
|
|
128
132
|
/** Typed tool-domain contracts shared by the SDK and host bridge. */
|
|
@@ -289,4 +293,4 @@ const executionLogRecordSchema = z.object({
|
|
|
289
293
|
context: executionContextSchema.optional()
|
|
290
294
|
});
|
|
291
295
|
//#endregion
|
|
292
|
-
export { ExecutionLogEntryKind, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandCategory, PluginCommandEffect, PluginCommandExecutionMode, PluginCommandTransaction, PluginContextExposure, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema };
|
|
296
|
+
export { ExecutionLogEntryKind, PLUGIN_API_VERSION, PluginAgentScope, PluginCapabilityKind, PluginCommandCategory, PluginCommandEffect, PluginCommandExecutionMode, PluginCommandTransaction, PluginContextExposure, PluginExecutionStatus, PluginHookId, PluginLifecyclePolicy, PluginLifecycleStatus, PluginProcessOutputMode, PluginRepositoryStatus, PluginSharedChangeKind, PluginViewLayout, PluginViewMethod, definePlugin, executionLogEntrySchema, executionLogRecordSchema, isDefinedPlugin, roleToolEnvironmentSchema, roleToolsAppliedSchema, roleToolsProposalSchema };
|
package/dist/markdown.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as PluginExecutionSnapshot, h as PluginCommandExecutionResult } from "./types-npalCBRO.js";
|
|
2
2
|
//#region src/ui/types.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Browser authoring API and transport contracts for Workbase plugin views.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "./ExecutionLog.dto-ig9GUWhK.js";
|
|
2
2
|
import { ZodType, z } from "zod";
|
|
3
3
|
//#region src/Tools.dto.d.ts
|
|
4
4
|
declare const roleToolEnvironmentSchema: z.ZodObject<{
|
|
@@ -322,8 +322,10 @@ interface PluginHostServices {
|
|
|
322
322
|
readonly toast: PluginToastApi;
|
|
323
323
|
readonly tasks: PluginTaskService;
|
|
324
324
|
readonly tools: PluginToolsService;
|
|
325
|
-
/** Checks committed code against the configured collaboration branches without closing the workspace. */
|
|
326
325
|
readonly workspace: {
|
|
326
|
+
/** Notifies the host to refresh one bound repository after local writes, including partial failures. */
|
|
327
|
+
readonly notifyRepositoryChanged: (repositoryId: string) => Promise<void>;
|
|
328
|
+
/** Checks committed code against the configured collaboration branches without closing the workspace. */
|
|
327
329
|
readonly verifySynchronized: () => Promise<void>;
|
|
328
330
|
};
|
|
329
331
|
}
|
|
@@ -472,6 +474,8 @@ declare enum PluginProcessOutputMode {
|
|
|
472
474
|
interface PluginProcessRunOptions {
|
|
473
475
|
/** Content preserves final characters and fails on bounded output overflow. */
|
|
474
476
|
readonly outputMode?: PluginProcessOutputMode;
|
|
477
|
+
/** Maximum retained bytes per output stream; defaults to 1 MiB, capped at 16 MiB. */
|
|
478
|
+
readonly maximumOutputBytes?: number;
|
|
475
479
|
readonly program: string;
|
|
476
480
|
readonly arguments?: readonly string[];
|
|
477
481
|
readonly currentDirectory?: string;
|
|
@@ -591,7 +595,20 @@ interface PluginViewRequest {
|
|
|
591
595
|
readonly input: unknown;
|
|
592
596
|
readonly method: string;
|
|
593
597
|
}
|
|
598
|
+
declare enum PluginViewMethod {
|
|
599
|
+
CardActions = "workbase.cardActions"
|
|
600
|
+
}
|
|
601
|
+
/** Repository-card shortcuts; visibility, tooltip and view input belong to the plugin. */
|
|
602
|
+
interface PluginCardAction {
|
|
603
|
+
readonly id: string;
|
|
604
|
+
/** Lucide icon name in kebab-case. */
|
|
605
|
+
readonly icon: string;
|
|
606
|
+
readonly tooltip: string;
|
|
607
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
608
|
+
}
|
|
594
609
|
interface PluginViewDefinition {
|
|
610
|
+
/** Read-only; return an empty array when this repository has no available shortcut. */
|
|
611
|
+
readonly cardActions?: (repositoryId: string, context: PluginInvocationContext) => readonly PluginCardAction[] | Promise<readonly PluginCardAction[]>;
|
|
595
612
|
readonly description?: string;
|
|
596
613
|
readonly entry: string;
|
|
597
614
|
readonly handlers?: Readonly<Record<string, (input: unknown, context: PluginInvocationContext) => unknown | Promise<unknown>>>;
|
|
@@ -684,6 +701,7 @@ interface PluginAgentContextContribution {
|
|
|
684
701
|
readonly pluginId: string;
|
|
685
702
|
}
|
|
686
703
|
interface PluginViewContribution {
|
|
704
|
+
readonly hasCardActions: boolean;
|
|
687
705
|
readonly entry: string;
|
|
688
706
|
readonly id: string;
|
|
689
707
|
readonly layout: PluginViewLayout;
|
|
@@ -705,4 +723,4 @@ interface PluginContributionSnapshot {
|
|
|
705
723
|
readonly views: readonly PluginViewContribution[];
|
|
706
724
|
}
|
|
707
725
|
//#endregion
|
|
708
|
-
export {
|
|
726
|
+
export { PluginWorkspace as $, PluginLifecycleHook as A, PluginToastOptions as At, PluginRepository as B, PluginExecutionSnapshot as C, PluginStoreApi as Ct, PluginHookResult as D, PluginTaskService as Dt, PluginHookId as E, PluginTaskResult as Et, PluginProcessApi as F, RoleToolsProposal as Ft, PluginStatusContribution as G, PluginSetupHooks as H, PluginProcessOutputMode as I, roleToolEnvironmentSchema as It, PluginViewContribution as J, PluginStatusDefinition as K, PluginProcessResult as L, roleToolsAppliedSchema as Lt, PluginLifecyclePolicy as M, PluginToolsService as Mt, PluginLifecycleStatus as N, RoleToolEnvironment as Nt, PluginInvocationContext as O, PluginToastApi as Ot, PluginLogger as P, RoleToolsApplied as Pt, PluginViewRequest as Q, PluginProcessRunOptions as R, roleToolsProposalSchema as Rt, PluginExecutionEvidence as S, PluginStatusCatalogEntry as St, PluginFileChange as T, PluginTaskDescriptor as Tt, PluginSharedChangeKind as U, PluginRepositoryStatus as V, PluginSharedChanges as W, PluginViewLayout as X, PluginViewDefinition as Y, PluginViewMethod as Z, PluginCommandTransaction as _, PluginPromptApi as _t, PluginCapabilityReference as a, PluginCapabilityResolveRequest as at, PluginContributionSnapshot as b, PluginPromptType as bt, PluginCommandCategory as c, PluginCommandCatalogEntry as ct, PluginCommandDefinition as d, PluginHostServices as dt, WorkbasePluginDefinition as et, PluginCommandDetails as f, PluginInteractiveLogger as ft, PluginCommandOption as g, PluginLogService as gt, PluginCommandExecutionResult as h, PluginLogQueryResult as ht, PluginCapabilityKind as i, PluginCapabilityCommandRequest as it, PluginLifecycleOutcome as j, PluginViewCatalogEntry as jt, PluginLifecycleDispatchResult as k, PluginToastLevel as kt, PluginCommandContext as l, PluginConfigApi as lt, PluginCommandExecutionMode as m, PluginLogQueryRequest as mt, PluginAgentContextDefinition as n, PluginAgentPolicy as nt, PluginCardAction as o, PluginCapabilityService as ot, PluginCommandEffect as p, PluginLogEntry as pt, PluginToolContribution as q, PluginAgentScope as r, PluginCapabilityCatalog as rt, PluginCommandArgument as s, PluginColoredMessage as st, PluginAgentContextContribution as t, PluginAgentContextCatalogEntry as tt, PluginCommandContribution as u, PluginExecutionService as ut, PluginContext as v, PluginPromptChoice as vt, PluginExecutionStatus as w, PluginSystemContextService as wt, PluginDisposable as x, PluginPromptViewRequest as xt, PluginContextExposure as y, PluginPromptQuestion as yt, PluginProject as z };
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as ExecutionLogRecord, t as ExecutionLogEntry } from "../ExecutionLog.dto-ig9GUWhK.js";
|
|
2
2
|
//#region src/ui/ExecutionLogTimeline.dto.d.ts
|
|
3
3
|
export declare enum ExecutionLogDisplay {
|
|
4
4
|
Full = "full",
|
|
5
5
|
Compact = "compact"
|
|
6
6
|
}
|
|
7
|
+
declare enum ExecutionLogEvidenceKind {
|
|
8
|
+
Command = "command",
|
|
9
|
+
Output = "output",
|
|
10
|
+
Error = "error",
|
|
11
|
+
Details = "details"
|
|
12
|
+
}
|
|
7
13
|
interface ExecutionLogEvidence {
|
|
14
|
+
readonly kind: ExecutionLogEvidenceKind;
|
|
8
15
|
readonly label: string;
|
|
9
16
|
readonly content: string;
|
|
10
17
|
}
|
|
@@ -18,12 +25,12 @@ interface ExecutionLogTimelineItem {
|
|
|
18
25
|
readonly status: string;
|
|
19
26
|
readonly metadata: readonly string[];
|
|
20
27
|
readonly evidence: readonly ExecutionLogEvidence[];
|
|
21
|
-
readonly calls: readonly ExecutionLogCallRecord[];
|
|
22
28
|
readonly logId?: string;
|
|
23
29
|
}
|
|
24
30
|
interface ExecutionLogTimelineProps {
|
|
25
31
|
readonly entries?: readonly ExecutionLogEntry[];
|
|
26
32
|
readonly record?: ExecutionLogRecord;
|
|
33
|
+
readonly relatedRecords?: readonly ExecutionLogRecord[];
|
|
27
34
|
readonly display?: ExecutionLogDisplay;
|
|
28
35
|
readonly executionId?: string;
|
|
29
36
|
readonly limit?: number;
|
|
@@ -33,8 +40,8 @@ interface ExecutionLogTimelineProps {
|
|
|
33
40
|
}
|
|
34
41
|
//#endregion
|
|
35
42
|
//#region src/ui/execution-log-model.d.ts
|
|
36
|
-
/**
|
|
37
|
-
export declare function buildExecutionLogItems(record: ExecutionLogRecord): readonly ExecutionLogTimelineItem[];
|
|
43
|
+
/** 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[];
|
|
38
45
|
export declare function executionLogStatusLabel(status: string): string;
|
|
39
46
|
//#endregion
|
|
40
47
|
//#region src/ui/ExecutionLogTimeline.d.ts
|
package/dist/ui/execution-log.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Markdown from "react-markdown";
|
|
4
4
|
import remarkGfm from "remark-gfm";
|
|
5
5
|
//#region src/ui/ExecutionLogTimeline.dto.ts
|
|
@@ -10,8 +10,6 @@ let ExecutionLogDisplay = /* @__PURE__ */ function(ExecutionLogDisplay) {
|
|
|
10
10
|
}({});
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/ui/execution-log-model.ts
|
|
13
|
-
const LOG_TITLE_LIMIT = 96;
|
|
14
|
-
const SLOW_CALL_MILLISECONDS = 3e4;
|
|
15
13
|
const LOG_STATUS_LABELS = /* @__PURE__ */ new Map([
|
|
16
14
|
["pending", "等待中"],
|
|
17
15
|
["in_progress", "进行中"],
|
|
@@ -23,204 +21,187 @@ const LOG_STATUS_LABELS = /* @__PURE__ */ new Map([
|
|
|
23
21
|
["warning", "有警告"],
|
|
24
22
|
["unknown", "未记录"]
|
|
25
23
|
]);
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const LOG_PHASE_LABELS = /* @__PURE__ */ new Map([
|
|
25
|
+
["preflight", "访问检查"],
|
|
26
|
+
["tools", "工具准备"],
|
|
27
|
+
["repositories", "仓库处理"],
|
|
28
|
+
["environment", "项目环境"],
|
|
29
|
+
["plugins", "插件"],
|
|
30
|
+
["verification", "结果检查"],
|
|
31
|
+
["configuration", "项目配置"],
|
|
32
|
+
["publication", "配置发布"],
|
|
33
|
+
["execution", "执行任务"]
|
|
34
|
+
]);
|
|
35
|
+
/** Merge loaded related records into the same reader; unresolved calls retain their navigation. */
|
|
36
|
+
function buildExecutionLogItems(record, relatedRecords = []) {
|
|
37
|
+
const records = [...new Map([record, ...relatedRecords].map((source) => [source.id, source])).values()];
|
|
38
|
+
const loadedIds = new Set(records.map(({ id }) => id));
|
|
39
|
+
return records.flatMap((source) => recordItems(source).map((item) => {
|
|
40
|
+
const logId = item.logId && !loadedIds.has(item.logId) ? item.logId : void 0;
|
|
41
|
+
return source.id === record.id ? {
|
|
42
|
+
...item,
|
|
43
|
+
logId
|
|
44
|
+
} : {
|
|
45
|
+
...item,
|
|
46
|
+
logId,
|
|
47
|
+
id: source.id + ":" + item.id,
|
|
48
|
+
anchors: [],
|
|
49
|
+
metadata: [source.title, ...item.metadata]
|
|
50
|
+
};
|
|
51
|
+
})).sort((first, second) => {
|
|
52
|
+
if (first.time && second.time) return Date.parse(first.time) - Date.parse(second.time);
|
|
53
|
+
if (first.time === second.time) return 0;
|
|
54
|
+
return first.time ? -1 : 1;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function executionLogStatusLabel(status) {
|
|
58
|
+
return LOG_STATUS_LABELS.get(normalizeLogStatus(status)) ?? status;
|
|
59
|
+
}
|
|
60
|
+
function normalizeLogStatus(status) {
|
|
61
|
+
if (!status) return "";
|
|
62
|
+
if ([
|
|
63
|
+
"ready",
|
|
64
|
+
"prepared",
|
|
65
|
+
"succeeded",
|
|
66
|
+
"completed"
|
|
67
|
+
].includes(status)) return "completed";
|
|
68
|
+
if (["running", "in_progress"].includes(status)) return "in_progress";
|
|
69
|
+
if (["queued", "pending"].includes(status)) return "pending";
|
|
70
|
+
if ([
|
|
71
|
+
"invalid",
|
|
72
|
+
"missing",
|
|
73
|
+
"needs-action",
|
|
74
|
+
"manual-action-required",
|
|
75
|
+
"unsupported-platform"
|
|
76
|
+
].includes(status)) return "needs_action";
|
|
77
|
+
return status;
|
|
78
|
+
}
|
|
79
|
+
function recordItems(record) {
|
|
28
80
|
const entries = (record.entries ?? []).map(logEntryItem);
|
|
29
81
|
const calls = [...new Map((record.children ?? []).map((call) => [call.id, call])).values()];
|
|
30
|
-
const routine = calls.filter(isRoutineCall);
|
|
31
82
|
const steps = record.steps ?? [];
|
|
32
83
|
const wrapper = Boolean(record.execution && entries.length && steps.length === 1 && steps[0].target?.kind === "plugin" && steps[0].target.id === record.execution.pluginId);
|
|
33
84
|
const items = [
|
|
34
85
|
...entries,
|
|
35
86
|
...wrapper ? [] : steps.map(logStepItem),
|
|
36
|
-
...calls.
|
|
87
|
+
...calls.map(logCallItem)
|
|
37
88
|
];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
evidence: wrapperItem?.evidence ?? [],
|
|
49
|
-
calls: routine
|
|
50
|
-
});
|
|
89
|
+
if (wrapper) {
|
|
90
|
+
const result = logStepItem(steps[0]);
|
|
91
|
+
items.push({
|
|
92
|
+
...result,
|
|
93
|
+
id: "execution-evidence",
|
|
94
|
+
anchors: [.../* @__PURE__ */ new Set([steps[0].id, ...result.anchors])],
|
|
95
|
+
time: validLogTime(record.context?.finishedAt),
|
|
96
|
+
title: "执行结果"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
51
99
|
if (record.warnings?.length) items.push({
|
|
52
100
|
id: "warnings",
|
|
53
101
|
anchors: [],
|
|
54
102
|
kind: "activity",
|
|
55
103
|
time: null,
|
|
56
104
|
title: "执行警告",
|
|
57
|
-
content:
|
|
105
|
+
content: "",
|
|
58
106
|
status: "warning",
|
|
59
107
|
metadata: [],
|
|
60
108
|
evidence: [{
|
|
109
|
+
kind: "details",
|
|
61
110
|
label: "警告",
|
|
62
111
|
content: record.warnings.join("\n")
|
|
63
|
-
}]
|
|
64
|
-
calls: []
|
|
112
|
+
}]
|
|
65
113
|
});
|
|
66
114
|
for (const message of record.messages ?? []) items.push({
|
|
67
115
|
id: "message-" + message.id,
|
|
68
116
|
anchors: [],
|
|
69
117
|
kind: "activity",
|
|
70
118
|
time: validLogTime(message.createdAt),
|
|
71
|
-
title:
|
|
119
|
+
title: "运行诊断",
|
|
72
120
|
content: "",
|
|
73
121
|
status: message.level === "error" ? "failed" : message.level === "warn" ? "warning" : "",
|
|
74
|
-
metadata: [],
|
|
122
|
+
metadata: [message.level],
|
|
75
123
|
evidence: [{
|
|
76
|
-
|
|
124
|
+
kind: "details",
|
|
125
|
+
label: "诊断输出",
|
|
77
126
|
content: message.message
|
|
78
|
-
}]
|
|
79
|
-
calls: []
|
|
80
|
-
});
|
|
81
|
-
return items.sort((first, second) => {
|
|
82
|
-
if (first.time && second.time) return Date.parse(first.time) - Date.parse(second.time);
|
|
83
|
-
if (first.time === second.time) return 0;
|
|
84
|
-
return first.time ? -1 : 1;
|
|
127
|
+
}]
|
|
85
128
|
});
|
|
86
|
-
|
|
87
|
-
function executionLogStatusLabel(status) {
|
|
88
|
-
return LOG_STATUS_LABELS.get(normalizeLogStatus(status)) ?? status;
|
|
89
|
-
}
|
|
90
|
-
function normalizeLogStatus(status) {
|
|
91
|
-
if (!status) return "";
|
|
92
|
-
if ([
|
|
93
|
-
"ready",
|
|
94
|
-
"prepared",
|
|
95
|
-
"succeeded",
|
|
96
|
-
"completed"
|
|
97
|
-
].includes(status)) return "completed";
|
|
98
|
-
if (["running", "in_progress"].includes(status)) return "in_progress";
|
|
99
|
-
if (["queued", "pending"].includes(status)) return "pending";
|
|
100
|
-
if ([
|
|
101
|
-
"invalid",
|
|
102
|
-
"missing",
|
|
103
|
-
"needs-action",
|
|
104
|
-
"manual-action-required",
|
|
105
|
-
"unsupported-platform"
|
|
106
|
-
].includes(status)) return "needs_action";
|
|
107
|
-
return status;
|
|
108
|
-
}
|
|
109
|
-
function shortenLogTitle(title) {
|
|
110
|
-
const text = title.trim();
|
|
111
|
-
const file = /^(?:Read file|List files in) ['"](.+)['"]$/i.exec(text);
|
|
112
|
-
if (file) return (/^Read/i.test(text) ? "读取文件:" : "列出文件:") + file[1].split(/[\\/]/).filter(Boolean).at(-1);
|
|
113
|
-
if (/^Search for ['"]/i.test(text)) return "搜索内容";
|
|
114
|
-
if (/^(?:python\d*|node|bash|sh|zsh)\s/i.test(text)) return "执行命令:" + text.split(/\s/, 1)[0];
|
|
115
|
-
const firstLine = text.split(/\r?\n/, 1)[0];
|
|
116
|
-
return firstLine.length > LOG_TITLE_LIMIT ? firstLine.slice(0, LOG_TITLE_LIMIT) + "…" : firstLine || "执行记录";
|
|
129
|
+
return items;
|
|
117
130
|
}
|
|
118
131
|
function logEntryItem(entry) {
|
|
119
|
-
const title = entry.kind === "message" && entry.content.trim() ? shortenLogTitle(entry.content) : shortenLogTitle(entry.title);
|
|
120
|
-
const evidence = entry.details ? [{
|
|
121
|
-
label: "参数与原始输出",
|
|
122
|
-
content: entry.details
|
|
123
|
-
}] : [];
|
|
124
|
-
if (entry.kind === "activity" && title !== entry.title) evidence.unshift({
|
|
125
|
-
label: "原始操作",
|
|
126
|
-
content: entry.title
|
|
127
|
-
});
|
|
128
132
|
return {
|
|
129
133
|
id: "entry-" + entry.id,
|
|
130
134
|
anchors: [],
|
|
131
135
|
kind: entry.kind,
|
|
132
136
|
time: validLogTime(entry.time),
|
|
133
|
-
title,
|
|
137
|
+
title: entry.title,
|
|
134
138
|
content: entry.content.trim() === entry.title.trim() && entry.kind === "activity" ? "" : entry.content,
|
|
135
139
|
status: normalizeLogStatus(entry.status),
|
|
136
140
|
metadata: [],
|
|
137
|
-
evidence
|
|
138
|
-
|
|
141
|
+
evidence: entry.details ? [{
|
|
142
|
+
kind: "details",
|
|
143
|
+
label: "调用记录",
|
|
144
|
+
content: entry.details
|
|
145
|
+
}] : []
|
|
139
146
|
};
|
|
140
147
|
}
|
|
141
148
|
function logStepItem(step) {
|
|
142
149
|
const evidence = [
|
|
143
150
|
{
|
|
151
|
+
kind: "command",
|
|
144
152
|
label: "命令",
|
|
145
153
|
content: step.command
|
|
146
154
|
},
|
|
147
155
|
{
|
|
156
|
+
kind: "output",
|
|
148
157
|
label: "标准输出",
|
|
149
158
|
content: step.stdout
|
|
150
159
|
},
|
|
151
160
|
{
|
|
161
|
+
kind: "error",
|
|
152
162
|
label: "标准错误",
|
|
153
163
|
content: step.stderr
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
label: "处理说明",
|
|
157
|
-
content: step.manualActionMessage
|
|
158
164
|
}
|
|
159
165
|
].filter((block) => Boolean(block.content));
|
|
160
|
-
const
|
|
161
|
-
["preflight", "访问检查"],
|
|
162
|
-
["tools", "工具准备"],
|
|
163
|
-
["repositories", "仓库处理"],
|
|
164
|
-
["environment", "项目环境"],
|
|
165
|
-
["plugins", "插件"],
|
|
166
|
-
["verification", "结果检查"],
|
|
167
|
-
["configuration", "项目配置"],
|
|
168
|
-
["publication", "配置发布"],
|
|
169
|
-
["execution", "执行任务"]
|
|
170
|
-
]);
|
|
171
|
-
const context = [
|
|
166
|
+
const context = [...new Set([
|
|
172
167
|
step.target?.label,
|
|
173
|
-
|
|
168
|
+
LOG_PHASE_LABELS.get(step.phase ?? "") ?? step.phase,
|
|
174
169
|
step.provider
|
|
175
|
-
].filter(
|
|
170
|
+
].filter((label) => Boolean(label)))];
|
|
176
171
|
const timing = step.timing;
|
|
177
|
-
const dates = timing ? [
|
|
178
|
-
timing.queuedAt ? "排队:" + timing.queuedAt : "",
|
|
179
|
-
"开始:" + (timing.startedAt ?? "未记录"),
|
|
180
|
-
"结束:" + (timing.finishedAt ?? "未记录")
|
|
181
|
-
].filter(Boolean).join("\n") : "";
|
|
182
|
-
if (context || dates) evidence.unshift({
|
|
183
|
-
label: "执行信息",
|
|
184
|
-
content: [context, dates].filter(Boolean).join("\n")
|
|
185
|
-
});
|
|
186
172
|
const queued = timing?.queuedAt && timing?.startedAt ? (Date.parse(timing.startedAt) - Date.parse(timing.queuedAt)) / 1e3 : null;
|
|
187
|
-
|
|
188
|
-
label: "等待时间",
|
|
189
|
-
content: queued.toFixed(1) + " 秒"
|
|
190
|
-
});
|
|
173
|
+
const waiting = queued !== null && Number.isFinite(queued) && queued > 0 ? ["等待 " + queued.toFixed(1) + " 秒"] : [];
|
|
191
174
|
return {
|
|
192
175
|
id: step.id,
|
|
193
176
|
anchors: step.legacyId && step.legacyId !== step.id ? [step.legacyId] : [],
|
|
194
177
|
kind: "activity",
|
|
195
178
|
time: validLogTime(timing?.startedAt ?? timing?.queuedAt),
|
|
196
|
-
title:
|
|
197
|
-
content: [step.detail, step.manualActionMessage].filter(Boolean).join("\n\n"),
|
|
179
|
+
title: step.label,
|
|
180
|
+
content: [...new Set([step.detail, step.manualActionMessage].filter(Boolean))].join("\n\n"),
|
|
198
181
|
status: normalizeLogStatus(step.executionState ?? step.status),
|
|
199
|
-
metadata:
|
|
200
|
-
|
|
201
|
-
|
|
182
|
+
metadata: [
|
|
183
|
+
...context.filter((label) => label !== step.label),
|
|
184
|
+
...logDurationMetadata(timing?.startedAt, timing?.finishedAt),
|
|
185
|
+
...waiting
|
|
186
|
+
],
|
|
187
|
+
evidence
|
|
202
188
|
};
|
|
203
189
|
}
|
|
204
190
|
function logCallItem(call) {
|
|
191
|
+
const status = normalizeLogStatus(call.status);
|
|
205
192
|
return {
|
|
206
193
|
id: "call-" + call.id,
|
|
207
194
|
anchors: [],
|
|
208
195
|
kind: "activity",
|
|
209
196
|
time: validLogTime(call.createdAt),
|
|
210
|
-
title:
|
|
197
|
+
title: call.title,
|
|
211
198
|
content: "",
|
|
212
|
-
status:
|
|
199
|
+
status: status === "completed" && (call.hasWarnings || call.hasChildErrors) ? "warning" : status,
|
|
213
200
|
metadata: logDurationMetadata(call.createdAt, call.context.finishedAt),
|
|
214
201
|
evidence: [],
|
|
215
|
-
calls: [],
|
|
216
202
|
logId: call.id
|
|
217
203
|
};
|
|
218
204
|
}
|
|
219
|
-
function isRoutineCall(call) {
|
|
220
|
-
const isProjectTask = ["project-task", "plugin-task"].includes(call.operationKind);
|
|
221
|
-
const isSlow = Boolean(call.context.finishedAt && Date.parse(call.context.finishedAt) - Date.parse(call.createdAt) >= SLOW_CALL_MILLISECONDS);
|
|
222
|
-
return normalizeLogStatus(call.status) === "completed" && !call.hasWarnings && !call.hasChildErrors && !isProjectTask && !isSlow;
|
|
223
|
-
}
|
|
224
205
|
function logDurationMetadata(start, end) {
|
|
225
206
|
if (!start || !end) return [];
|
|
226
207
|
const seconds = (Date.parse(end) - Date.parse(start)) / 1e3;
|
|
@@ -231,7 +212,7 @@ function validLogTime(time) {
|
|
|
231
212
|
}
|
|
232
213
|
//#endregion
|
|
233
214
|
//#region src/ui/ExecutionLogTimeline.tsx
|
|
234
|
-
/**
|
|
215
|
+
/** 连续展示命令、输出与消息;完整日志和工作区预览共用阅读与复制交互。 */
|
|
235
216
|
const MARKDOWN_PLUGINS = [remarkGfm];
|
|
236
217
|
const DISALLOWED_ELEMENTS = ["img"];
|
|
237
218
|
const CLOCK = new Intl.DateTimeFormat("zh-CN", {
|
|
@@ -242,7 +223,8 @@ const CLOCK = new Intl.DateTimeFormat("zh-CN", {
|
|
|
242
223
|
});
|
|
243
224
|
const RECENT_ENTRY_LIMIT = 20;
|
|
244
225
|
const LATEST_SCROLL_THRESHOLD = 24;
|
|
245
|
-
const
|
|
226
|
+
const LOG_KIND_LABELS = /* @__PURE__ */ new Map([["question", "提问"], ["answer", "回答"]]);
|
|
227
|
+
const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, record, relatedRecords, display = "full", executionId, limit = RECENT_ENTRY_LIMIT, isLoading, error, onOpenLog }) {
|
|
246
228
|
const viewport = useRef(null);
|
|
247
229
|
const following = useRef(true);
|
|
248
230
|
const [isFollowing, setIsFollowing] = useState(true);
|
|
@@ -251,7 +233,11 @@ const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, recor
|
|
|
251
233
|
id: "",
|
|
252
234
|
title: "",
|
|
253
235
|
entries: [...entries ?? []]
|
|
254
|
-
}), [
|
|
236
|
+
}, relatedRecords), [
|
|
237
|
+
entries,
|
|
238
|
+
record,
|
|
239
|
+
relatedRecords
|
|
240
|
+
]);
|
|
255
241
|
const recent = isCompact ? items.slice(-limit) : items;
|
|
256
242
|
const handleLatest = useCallback(() => {
|
|
257
243
|
following.current = true;
|
|
@@ -271,7 +257,7 @@ const ExecutionLogTimeline = memo(function ExecutionLogTimeline({ entries, recor
|
|
|
271
257
|
return /* @__PURE__ */ jsxs("section", {
|
|
272
258
|
className: "workbase-execution-log",
|
|
273
259
|
"data-display": display,
|
|
274
|
-
"aria-label": isCompact ? "最近执行动态" : "
|
|
260
|
+
"aria-label": isCompact ? "最近执行动态" : "执行日志",
|
|
275
261
|
children: [
|
|
276
262
|
error ? /* @__PURE__ */ jsx("p", {
|
|
277
263
|
className: "workbase-log-error",
|
|
@@ -320,123 +306,122 @@ const LogItem = memo(function LogItem({ item, isCompact, onOpenLog }) {
|
|
|
320
306
|
const handleOpen = useCallback(() => {
|
|
321
307
|
if (item.logId) onOpenLog?.(item.logId);
|
|
322
308
|
}, [item.logId, onOpenLog]);
|
|
323
|
-
const handleCall = useCallback((event) => {
|
|
324
|
-
const logId = event.currentTarget.dataset.logId;
|
|
325
|
-
if (logId && item.calls.some((call) => call.id === logId)) onOpenLog?.(logId);
|
|
326
|
-
}, [item.calls, onOpenLog]);
|
|
327
309
|
const hasBody = Boolean(item.content.trim()) && (item.kind === "message" || item.content.trim() !== item.title.trim());
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
"failed",
|
|
331
|
-
"needs_action",
|
|
332
|
-
"warning",
|
|
333
|
-
"interrupted"
|
|
334
|
-
].includes(item.status);
|
|
335
|
-
const heading = /* @__PURE__ */ jsxs("span", {
|
|
336
|
-
className: "workbase-log-heading",
|
|
337
|
-
children: [
|
|
338
|
-
/* @__PURE__ */ jsx("strong", {
|
|
339
|
-
title: isCompact ? item.title : void 0,
|
|
340
|
-
children: !isCompact && item.kind === "message" ? "进展" : item.title
|
|
341
|
-
}),
|
|
342
|
-
!isCompact && item.metadata.length ? /* @__PURE__ */ jsx("span", {
|
|
343
|
-
className: "workbase-log-note",
|
|
344
|
-
children: item.metadata.join(" · ")
|
|
345
|
-
}) : null,
|
|
346
|
-
item.status ? /* @__PURE__ */ jsx("span", {
|
|
347
|
-
className: "workbase-log-status",
|
|
348
|
-
"data-status": item.status,
|
|
349
|
-
children: executionLogStatusLabel(item.status)
|
|
350
|
-
}) : null
|
|
351
|
-
]
|
|
352
|
-
});
|
|
353
|
-
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
354
|
-
hasBody ? /* @__PURE__ */ jsx("div", {
|
|
355
|
-
className: "workbase-log-content",
|
|
356
|
-
"data-markdown-source": "",
|
|
357
|
-
children: /* @__PURE__ */ jsx(Markdown, {
|
|
358
|
-
remarkPlugins: MARKDOWN_PLUGINS,
|
|
359
|
-
skipHtml: true,
|
|
360
|
-
disallowedElements: DISALLOWED_ELEMENTS,
|
|
361
|
-
children: item.content
|
|
362
|
-
})
|
|
363
|
-
}) : null,
|
|
364
|
-
item.logId && onOpenLog ? /* @__PURE__ */ jsx("button", {
|
|
365
|
-
type: "button",
|
|
366
|
-
className: "workbase-log-link",
|
|
367
|
-
onClick: handleOpen,
|
|
368
|
-
children: "查看执行记录"
|
|
369
|
-
}) : null,
|
|
370
|
-
item.calls.length ? /* @__PURE__ */ jsx("ul", {
|
|
371
|
-
className: "workbase-log-calls",
|
|
372
|
-
children: item.calls.map((call) => /* @__PURE__ */ jsxs("li", { children: [
|
|
373
|
-
/* @__PURE__ */ jsx("span", { children: call.title }),
|
|
374
|
-
/* @__PURE__ */ jsx("span", {
|
|
375
|
-
className: "workbase-log-note",
|
|
376
|
-
children: executionLogStatusLabel(call.status)
|
|
377
|
-
}),
|
|
378
|
-
onOpenLog ? /* @__PURE__ */ jsx("button", {
|
|
379
|
-
type: "button",
|
|
380
|
-
className: "workbase-log-link",
|
|
381
|
-
"data-log-id": call.id,
|
|
382
|
-
onClick: handleCall,
|
|
383
|
-
children: "查看记录"
|
|
384
|
-
}) : null
|
|
385
|
-
] }, call.id))
|
|
386
|
-
}) : null,
|
|
387
|
-
item.evidence.map((evidence) => /* @__PURE__ */ jsx(LogEvidence, { evidence }, evidence.label))
|
|
388
|
-
] });
|
|
310
|
+
const kindLabel = LOG_KIND_LABELS.get(item.kind);
|
|
311
|
+
const heading = item.kind === "message" ? "进展" : item.title;
|
|
389
312
|
const clock = item.time ? CLOCK.format(new Date(item.time)) : "时间未记录";
|
|
390
|
-
return /* @__PURE__ */
|
|
313
|
+
return /* @__PURE__ */ jsx("li", {
|
|
391
314
|
id: isCompact ? void 0 : item.id,
|
|
392
315
|
tabIndex: isCompact ? void 0 : -1,
|
|
393
316
|
className: "workbase-log-entry",
|
|
394
317
|
"data-kind": item.kind,
|
|
395
318
|
"data-status": item.status,
|
|
396
|
-
children:
|
|
397
|
-
className: "workbase-log-time",
|
|
398
|
-
dateTime: item.time ?? void 0,
|
|
399
|
-
children: clock
|
|
400
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
319
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
401
320
|
className: "workbase-log-body",
|
|
402
|
-
children: [
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
321
|
+
children: [
|
|
322
|
+
!isCompact ? item.anchors.map((anchor) => /* @__PURE__ */ jsx("span", {
|
|
323
|
+
id: anchor,
|
|
324
|
+
className: "workbase-log-anchor"
|
|
325
|
+
}, anchor)) : null,
|
|
326
|
+
/* @__PURE__ */ jsxs("div", {
|
|
327
|
+
className: "workbase-log-heading",
|
|
328
|
+
children: [
|
|
329
|
+
kindLabel ? /* @__PURE__ */ jsx("span", {
|
|
330
|
+
className: "workbase-log-kind",
|
|
331
|
+
children: kindLabel
|
|
332
|
+
}) : null,
|
|
333
|
+
/* @__PURE__ */ jsx("strong", { children: heading }),
|
|
334
|
+
item.status ? /* @__PURE__ */ jsx("span", {
|
|
335
|
+
className: "workbase-log-status",
|
|
336
|
+
"data-status": item.status,
|
|
337
|
+
children: executionLogStatusLabel(item.status)
|
|
338
|
+
}) : null,
|
|
339
|
+
item.metadata.length ? /* @__PURE__ */ jsx("span", {
|
|
340
|
+
className: "workbase-log-note",
|
|
341
|
+
children: item.metadata.join(" · ")
|
|
342
|
+
}) : null,
|
|
343
|
+
/* @__PURE__ */ jsx("time", {
|
|
344
|
+
className: "workbase-log-time",
|
|
345
|
+
dateTime: item.time ?? void 0,
|
|
346
|
+
children: clock
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
}),
|
|
350
|
+
hasBody ? /* @__PURE__ */ jsx("div", {
|
|
351
|
+
className: "workbase-log-content",
|
|
352
|
+
"data-markdown-source": "",
|
|
353
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
354
|
+
remarkPlugins: MARKDOWN_PLUGINS,
|
|
355
|
+
skipHtml: true,
|
|
356
|
+
disallowedElements: DISALLOWED_ELEMENTS,
|
|
357
|
+
children: item.content
|
|
358
|
+
})
|
|
359
|
+
}) : null,
|
|
360
|
+
item.evidence.length ? /* @__PURE__ */ jsx(LogEvidence, { evidence: item.evidence }) : null,
|
|
361
|
+
item.logId && onOpenLog ? /* @__PURE__ */ jsx("button", {
|
|
362
|
+
type: "button",
|
|
363
|
+
className: "workbase-log-link",
|
|
364
|
+
onClick: handleOpen,
|
|
365
|
+
children: "打开关联记录"
|
|
366
|
+
}) : null
|
|
367
|
+
]
|
|
368
|
+
})
|
|
411
369
|
});
|
|
412
370
|
});
|
|
413
371
|
const LogEvidence = memo(function LogEvidence({ evidence }) {
|
|
414
372
|
const [copyState, setCopyState] = useState("");
|
|
373
|
+
const command = evidence.find(({ kind }) => kind === "command");
|
|
374
|
+
const output = evidence.filter(({ kind }) => kind !== "command");
|
|
375
|
+
const label = command ? "命令与输出" : "输出";
|
|
415
376
|
const handleCopy = useCallback(async () => {
|
|
416
377
|
try {
|
|
417
|
-
await navigator.clipboard.writeText(evidence.content);
|
|
378
|
+
await navigator.clipboard.writeText(evidence.map(({ content }) => content).join("\n\n"));
|
|
418
379
|
setCopyState("已复制");
|
|
419
380
|
} catch {
|
|
420
381
|
setCopyState("复制失败,请选择文本复制");
|
|
421
382
|
}
|
|
422
|
-
}, [evidence
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
383
|
+
}, [evidence]);
|
|
384
|
+
useEffect(() => {
|
|
385
|
+
setCopyState("");
|
|
386
|
+
}, [evidence]);
|
|
387
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
388
|
+
className: "workbase-log-terminal",
|
|
389
|
+
role: "group",
|
|
390
|
+
"aria-label": label,
|
|
391
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
392
|
+
className: "workbase-log-toolbar",
|
|
393
|
+
children: [
|
|
394
|
+
command ? /* @__PURE__ */ jsxs("pre", {
|
|
395
|
+
"aria-label": command.label,
|
|
396
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
397
|
+
className: "workbase-log-prompt",
|
|
398
|
+
"aria-hidden": "true",
|
|
399
|
+
children: "$ "
|
|
400
|
+
}), /* @__PURE__ */ jsx("code", { children: command.content })]
|
|
401
|
+
}) : /* @__PURE__ */ jsx("span", { children: label }),
|
|
402
|
+
/* @__PURE__ */ jsx("span", {
|
|
403
|
+
className: "workbase-log-copy",
|
|
404
|
+
role: "status",
|
|
405
|
+
children: copyState
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsx("button", {
|
|
430
408
|
type: "button",
|
|
431
409
|
onClick: handleCopy,
|
|
410
|
+
"aria-label": "复制" + label,
|
|
432
411
|
children: "复制"
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
/* @__PURE__ */ jsx("
|
|
439
|
-
|
|
412
|
+
})
|
|
413
|
+
]
|
|
414
|
+
}), output.map((block) => /* @__PURE__ */ jsxs("div", {
|
|
415
|
+
className: "workbase-log-stream",
|
|
416
|
+
"data-stream": block.kind,
|
|
417
|
+
children: [block.kind === "error" ? /* @__PURE__ */ jsx("span", {
|
|
418
|
+
className: "workbase-log-stream-label",
|
|
419
|
+
children: block.label
|
|
420
|
+
}) : null, /* @__PURE__ */ jsx("pre", {
|
|
421
|
+
"aria-label": block.label,
|
|
422
|
+
children: /* @__PURE__ */ jsx("code", { children: block.content })
|
|
423
|
+
})]
|
|
424
|
+
}, block.kind + block.label))]
|
|
440
425
|
});
|
|
441
426
|
});
|
|
442
427
|
//#endregion
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -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-
|
|
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-BYBaqYve.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/theme.css
CHANGED
|
@@ -229,80 +229,64 @@
|
|
|
229
229
|
|
|
230
230
|
@layer components {
|
|
231
231
|
.workbase-execution-log { min-width: 0; font-size: 14px; line-height: 1.7; }
|
|
232
|
-
.workbase-execution-log[data-display="full"] { max-width: calc(75ch + 100px); }
|
|
233
232
|
.workbase-log-entries { list-style: none; margin: 0; padding: 0; }
|
|
234
|
-
.workbase-log-entry {
|
|
233
|
+
.workbase-log-entry { min-width: 0; padding: 20px 0; scroll-margin-top: 20px; }
|
|
234
|
+
.workbase-log-entry + .workbase-log-entry { border-top: 1px solid var(--color-border); }
|
|
235
|
+
.workbase-log-entry:first-child { padding-top: 0; }
|
|
235
236
|
.workbase-log-entry:last-child { padding-bottom: 0; }
|
|
236
|
-
.workbase-log-entry::before { content: ""; position: absolute; left: 84px; top: 9px; width: 7px; height: 7px; border: 1px solid var(--color-border-strong); border-radius: 50%; background: var(--color-surface); }
|
|
237
|
-
.workbase-log-entry:not(:last-child)::after { content: ""; position: absolute; left: 87px; top: 20px; bottom: 2px; width: 1px; background: var(--color-border); }
|
|
238
|
-
.workbase-log-entry[data-status="failed"]::before { border-color: var(--color-danger); background: var(--color-danger); }
|
|
239
|
-
.workbase-log-entry[data-status="pending"]::before { border-color: var(--color-warning); background: var(--color-brand-weak); }
|
|
240
237
|
.workbase-log-entry:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
|
|
241
|
-
.workbase-log-
|
|
242
|
-
.workbase-log-
|
|
243
|
-
.workbase-log-heading {
|
|
244
|
-
.workbase-log-
|
|
245
|
-
.workbase-log-
|
|
246
|
-
.workbase-log-status {
|
|
247
|
-
.workbase-execution-log[data-display="full"] .workbase-log-heading strong { flex: 0 1 auto; }
|
|
248
|
-
.workbase-execution-log[data-display="full"] .workbase-log-status { margin-left: 0; }
|
|
238
|
+
.workbase-log-body { position: relative; min-width: 0; }
|
|
239
|
+
.workbase-log-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
|
|
240
|
+
.workbase-log-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
|
|
241
|
+
.workbase-log-kind, .workbase-log-status, .workbase-log-note, .workbase-log-time { color: var(--color-muted); font-size: 12px; }
|
|
242
|
+
.workbase-log-time { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
243
|
+
.workbase-log-status { white-space: nowrap; }
|
|
249
244
|
.workbase-log-status[data-status="failed"], .workbase-log-error { color: var(--color-danger); }
|
|
250
245
|
.workbase-log-status[data-status="completed"] { color: var(--color-success); }
|
|
251
|
-
.workbase-log-status
|
|
252
|
-
.workbase-log-status:is([data-status="
|
|
246
|
+
.workbase-log-status[data-status="in_progress"] { color: var(--color-accent); }
|
|
247
|
+
.workbase-log-status:is([data-status="needs_action"], [data-status="warning"], [data-status="pending"]) { color: var(--color-warning); }
|
|
253
248
|
.workbase-log-content { max-width: 75ch; overflow-wrap: anywhere; }
|
|
254
249
|
.workbase-log-content > :first-child { margin-top: 0; }
|
|
255
250
|
.workbase-log-content > :last-child { margin-bottom: 0; }
|
|
256
|
-
.workbase-log-content :is(h1, h2, h3, h4) { margin-block: 20px 8px; font-size: 1em; line-height: 1.5; }
|
|
251
|
+
.workbase-log-content :is(h1, h2, h3, h4) { margin-block: 20px 8px; font-size: 1em; font-weight: 600; line-height: 1.5; }
|
|
257
252
|
.workbase-log-content :is(p, ul, ol, pre, blockquote, table) { margin-block: 8px 12px; }
|
|
258
253
|
.workbase-log-content :is(ul, ol) { padding-left: 22px; }
|
|
259
254
|
.workbase-log-content ul { list-style: disc; }
|
|
260
255
|
.workbase-log-content ol { list-style: decimal; }
|
|
261
256
|
.workbase-log-content a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }
|
|
262
|
-
.workbase-log-content pre, .workbase-log-
|
|
257
|
+
.workbase-log-content pre, .workbase-log-stream pre, .workbase-log-toolbar pre { margin: 0; max-width: 100%; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; tab-size: 2; }
|
|
258
|
+
.workbase-log-content pre { margin-block: 12px; background: var(--color-surface-muted); }
|
|
263
259
|
.workbase-log-content table { display: block; overflow-x: auto; }
|
|
264
260
|
.workbase-log-content :is(th, td) { padding: 6px 10px; border-bottom: 1px solid var(--color-border); text-align: left; }
|
|
265
|
-
.workbase-log-
|
|
266
|
-
.workbase-log-
|
|
267
|
-
.workbase-log-
|
|
268
|
-
.workbase-log-
|
|
269
|
-
.workbase-log-
|
|
270
|
-
.workbase-log-
|
|
271
|
-
.workbase-
|
|
261
|
+
.workbase-log-entry:is([data-kind="question"], [data-kind="answer"]) .workbase-log-body { padding: 12px 16px; background: var(--color-surface-muted); }
|
|
262
|
+
.workbase-log-kind { color: var(--color-brand); font-weight: 600; }
|
|
263
|
+
.workbase-log-terminal { min-width: 0; margin-top: 12px; background: var(--color-surface-muted); }
|
|
264
|
+
.workbase-log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 36px; padding: 2px 16px; border-bottom: 1px solid var(--color-border); color: var(--color-muted); font-size: 12px; }
|
|
265
|
+
.workbase-log-toolbar pre { flex: 1; min-width: 0; padding: 8px 0; color: var(--color-foreground); font-weight: 600; }
|
|
266
|
+
.workbase-log-copy { margin-left: auto; }
|
|
267
|
+
.workbase-log-toolbar button { min-height: 32px; border: 0; padding: 4px 0; background: transparent; color: var(--color-brand); font: inherit; cursor: pointer; }
|
|
268
|
+
.workbase-log-toolbar button:hover, .workbase-log-link:hover { color: var(--color-brand-deep); text-decoration: underline; text-underline-offset: 3px; }
|
|
269
|
+
.workbase-log-stream[data-stream="error"] { color: var(--color-danger); }
|
|
270
|
+
.workbase-log-stream-label { display: block; padding: 10px 16px 0; font-size: 12px; font-weight: 600; }
|
|
271
|
+
.workbase-log-stream-label + pre { padding-top: 4px; }
|
|
272
|
+
.workbase-log-prompt { color: var(--color-muted); user-select: none; }
|
|
272
273
|
.workbase-execution-log ::selection { background: var(--color-brand-weak); color: var(--color-foreground); }
|
|
273
274
|
.workbase-log-anchor { position: absolute; top: 0; }
|
|
274
|
-
.workbase-log-
|
|
275
|
-
.workbase-log-calls > li { display: grid; grid-template-columns: minmax(0, 1fr) max-content max-content; align-items: center; gap: 4px 16px; padding-block: 8px; font-size: 13px; }
|
|
276
|
-
.workbase-log-calls > li + li { border-top: 1px solid var(--color-border); }
|
|
277
|
-
.workbase-log-calls > li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|
|
278
|
-
.workbase-log-calls .workbase-log-note { white-space: nowrap; }
|
|
279
|
-
.workbase-log-link, .workbase-log-copy button { border: 0; min-height: 32px; padding: 4px 0; background: transparent; color: var(--color-brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
|
|
280
|
-
.workbase-log-calls .workbase-log-link { justify-self: end; white-space: nowrap; }
|
|
281
|
-
.workbase-log-copy { display: flex; align-items: center; gap: 12px; color: var(--color-muted); font-size: 12px; }
|
|
275
|
+
.workbase-log-link { border: 0; min-height: 32px; padding: 4px 0; background: transparent; color: var(--color-brand); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
|
|
282
276
|
.workbase-log-follow { display: flex; justify-content: center; padding-top: 8px; }
|
|
283
|
-
.workbase-log-latest { min-height:
|
|
277
|
+
.workbase-log-latest { min-height: 32px; border: 1px solid var(--color-border-strong); border-radius: 6px; padding: 3px 10px; background: var(--color-surface); color: var(--color-foreground); font: inherit; font-size: 12px; cursor: pointer; }
|
|
278
|
+
.workbase-log-latest:hover { background: var(--color-surface-muted); }
|
|
284
279
|
.workbase-log-latest[data-following="true"] { visibility: hidden; }
|
|
285
280
|
.workbase-execution-log button:focus-visible, .workbase-log-viewport:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
|
|
286
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-viewport { max-height:
|
|
287
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-entry {
|
|
288
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-entry
|
|
289
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-entry::after { left: 5px; top: 18px; }
|
|
290
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-entry[data-status="completed"]::before { background: var(--color-success); border-color: var(--color-success); }
|
|
291
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-time { grid-column: 2; grid-row: 1; padding: 0; line-height: 20px; }
|
|
292
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-body { grid-column: 1; grid-row: 1; padding: 0; }
|
|
293
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-heading { margin: 0; min-height: 20px; }
|
|
294
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-heading strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 20px; font-weight: 500; }
|
|
295
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-status { flex-shrink: 0; font-size: 12px; white-space: nowrap; }
|
|
296
|
-
.workbase-execution-log[data-display="compact"] .workbase-log-status:not([data-status="failed"], [data-status="needs_action"], [data-status="warning"], [data-status="interrupted"]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
|
|
281
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-viewport { max-height: 400px; overflow: auto; padding: 2px 12px 2px 2px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
|
|
282
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry { padding-block: 16px; }
|
|
283
|
+
.workbase-execution-log[data-display="compact"] .workbase-log-entry:first-child { padding-top: 0; }
|
|
297
284
|
@media (max-width: 600px) {
|
|
298
|
-
.workbase-
|
|
299
|
-
.workbase-
|
|
300
|
-
.workbase-
|
|
301
|
-
.workbase-
|
|
302
|
-
.workbase-
|
|
303
|
-
.workbase-log-
|
|
304
|
-
.workbase-log-calls > li > span:first-child { grid-column: 1 / -1; }
|
|
305
|
-
.workbase-log-calls .workbase-log-link { grid-column: 2; }
|
|
306
|
-
.workbase-log-kind { margin-left: 0; }
|
|
285
|
+
.workbase-log-heading { gap: 4px 8px; }
|
|
286
|
+
.workbase-log-heading strong { flex: 1; }
|
|
287
|
+
.workbase-log-heading .workbase-log-note { flex-basis: 100%; order: 1; }
|
|
288
|
+
.workbase-log-content pre, .workbase-log-stream pre { padding-inline: 12px; }
|
|
289
|
+
.workbase-log-toolbar { padding-inline: 12px; }
|
|
290
|
+
.workbase-log-stream-label { padding-left: 12px; }
|
|
307
291
|
}
|
|
308
292
|
}
|