@elevasis/ui 1.3.1 → 1.3.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/api/index.js +1 -1
- package/dist/auth/guards/AdminGuard.d.ts +32 -0
- package/dist/auth/guards/AdminGuard.d.ts.map +1 -0
- package/dist/auth/guards/ProtectedRoute.d.ts +60 -0
- package/dist/auth/guards/ProtectedRoute.d.ts.map +1 -0
- package/dist/auth/guards/__tests__/AdminGuard.test.d.ts +12 -0
- package/dist/auth/guards/__tests__/AdminGuard.test.d.ts.map +1 -0
- package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts +14 -0
- package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts.map +1 -0
- package/dist/auth/index.d.ts +14 -174
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-A3MCANC6.js → chunk-6IX5JZEH.js} +110 -50
- package/dist/chunk-GIFAF5ZS.js +313 -0
- package/dist/chunk-JQLT6HBI.js +850 -0
- package/dist/chunk-LFYO3MDC.js +58 -0
- package/dist/{chunk-72HOBFMP.js → chunk-LTQAAIGE.js} +3 -3
- package/dist/{chunk-JBFFCZI4.js → chunk-U34YGJQB.js} +1 -93
- package/dist/components/index.d.ts +1 -1353
- package/dist/components/index.js +1 -20
- package/dist/components/navigation/index.d.ts +2 -32
- package/dist/components/navigation/index.js +1 -29
- package/dist/execution/index.d.ts +63 -231
- package/dist/execution/index.js +1 -4
- package/dist/graph/index.css +0 -1
- package/dist/graph/index.d.ts +4 -203
- package/dist/graph/index.js +1 -1
- package/dist/hooks/command-queue/index.d.ts +7 -0
- package/dist/hooks/command-queue/index.d.ts.map +1 -0
- package/dist/hooks/command-queue/useCommandQueue.d.ts +33 -0
- package/dist/hooks/command-queue/useCommandQueue.d.ts.map +1 -0
- package/dist/hooks/command-queue/useCommandQueueTotals.d.ts +17 -0
- package/dist/hooks/command-queue/useCommandQueueTotals.d.ts.map +1 -0
- package/dist/hooks/command-queue/useDeleteTask.d.ts +5 -0
- package/dist/hooks/command-queue/useDeleteTask.d.ts.map +1 -0
- package/dist/hooks/command-queue/usePatchTask.d.ts +6 -0
- package/dist/hooks/command-queue/usePatchTask.d.ts.map +1 -0
- package/dist/hooks/command-queue/useSubmitAction.d.ts +29 -0
- package/dist/hooks/command-queue/useSubmitAction.d.ts.map +1 -0
- package/dist/hooks/executions/index.d.ts +16 -0
- package/dist/hooks/executions/index.d.ts.map +1 -0
- package/dist/hooks/executions/useBulkDeleteExecutions.d.ts +15 -0
- package/dist/hooks/executions/useBulkDeleteExecutions.d.ts.map +1 -0
- package/dist/hooks/executions/useCancelExecution.d.ts +20 -0
- package/dist/hooks/executions/useCancelExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useDeleteExecution.d.ts +13 -0
- package/dist/hooks/executions/useDeleteExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useExecuteAsync.d.ts +21 -0
- package/dist/hooks/executions/useExecuteAsync.d.ts.map +1 -0
- package/dist/hooks/executions/useExecution.d.ts +10 -0
- package/dist/hooks/executions/useExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useExecutions.d.ts +16 -0
- package/dist/hooks/executions/useExecutions.d.ts.map +1 -0
- package/dist/hooks/executions/useResourceDefinition.d.ts +9 -0
- package/dist/hooks/executions/useResourceDefinition.d.ts.map +1 -0
- package/dist/hooks/executions/useResources.d.ts +15 -0
- package/dist/hooks/executions/useResources.d.ts.map +1 -0
- package/dist/hooks/executions/useRetryExecution.d.ts +16 -0
- package/dist/hooks/executions/useRetryExecution.d.ts.map +1 -0
- package/dist/hooks/feature-access/createUseFeatureAccess.d.ts +44 -0
- package/dist/hooks/feature-access/createUseFeatureAccess.d.ts.map +1 -0
- package/dist/hooks/feature-access/index.d.ts +2 -0
- package/dist/hooks/feature-access/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +11 -4554
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -4
- package/dist/hooks/monitoring/index.d.ts +9 -0
- package/dist/hooks/monitoring/index.d.ts.map +1 -0
- package/dist/hooks/monitoring/useActivities.d.ts +52 -0
- package/dist/hooks/monitoring/useActivities.d.ts.map +1 -0
- package/dist/hooks/monitoring/useCostSummary.d.ts +7 -0
- package/dist/hooks/monitoring/useCostSummary.d.ts.map +1 -0
- package/dist/hooks/monitoring/useExecutionHealth.d.ts +10 -0
- package/dist/hooks/monitoring/useExecutionHealth.d.ts.map +1 -0
- package/dist/hooks/monitoring/useExecutionLogs.d.ts +56 -0
- package/dist/hooks/monitoring/useExecutionLogs.d.ts.map +1 -0
- package/dist/hooks/monitoring/useNotifications.d.ts +11 -0
- package/dist/hooks/monitoring/useNotifications.d.ts.map +1 -0
- package/dist/hooks/notifications/index.d.ts +8 -0
- package/dist/hooks/notifications/index.d.ts.map +1 -0
- package/dist/hooks/notifications/useMarkAllAsRead.d.ts +2 -0
- package/dist/hooks/notifications/useMarkAllAsRead.d.ts.map +1 -0
- package/dist/hooks/notifications/useMarkAsRead.d.ts +2 -0
- package/dist/hooks/notifications/useMarkAsRead.d.ts.map +1 -0
- package/dist/hooks/notifications/useNotificationCount.d.ts +8 -0
- package/dist/hooks/notifications/useNotificationCount.d.ts.map +1 -0
- package/dist/hooks/observability/index.d.ts +19 -0
- package/dist/hooks/observability/index.d.ts.map +1 -0
- package/dist/hooks/observability/useBusinessImpact.d.ts +9 -0
- package/dist/hooks/observability/useBusinessImpact.d.ts.map +1 -0
- package/dist/hooks/observability/useCostBreakdown.d.ts +10 -0
- package/dist/hooks/observability/useCostBreakdown.d.ts.map +1 -0
- package/dist/hooks/observability/useCostByModel.d.ts +3 -0
- package/dist/hooks/observability/useCostByModel.d.ts.map +1 -0
- package/dist/hooks/observability/useCostTrends.d.ts +3 -0
- package/dist/hooks/observability/useCostTrends.d.ts.map +1 -0
- package/dist/hooks/observability/useDashboardMetrics.d.ts +3 -0
- package/dist/hooks/observability/useDashboardMetrics.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorAnalysis.d.ts +7 -0
- package/dist/hooks/observability/useErrorAnalysis.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorDetails.d.ts +20 -0
- package/dist/hooks/observability/useErrorDetails.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorDistribution.d.ts +12 -0
- package/dist/hooks/observability/useErrorDistribution.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorTrends.d.ts +12 -0
- package/dist/hooks/observability/useErrorTrends.d.ts.map +1 -0
- package/dist/hooks/observability/useResolveError.d.ts +17 -0
- package/dist/hooks/observability/useResolveError.d.ts.map +1 -0
- package/dist/hooks/observability/useTopFailingResources.d.ts +13 -0
- package/dist/hooks/observability/useTopFailingResources.d.ts.map +1 -0
- package/dist/hooks/published.d.ts +19 -4279
- package/dist/hooks/published.d.ts.map +1 -0
- package/dist/hooks/published.js +367 -4
- package/dist/hooks/scheduling/index.d.ts +5 -0
- package/dist/hooks/scheduling/index.d.ts.map +1 -0
- package/dist/hooks/scheduling/useSchedules.d.ts +185 -0
- package/dist/hooks/scheduling/useSchedules.d.ts.map +1 -0
- package/dist/hooks/sessions/index.d.ts +8 -0
- package/dist/hooks/sessions/index.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessionExecutions.d.ts +13 -0
- package/dist/hooks/sessions/useSessionExecutions.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessionMessages.d.ts +7 -0
- package/dist/hooks/sessions/useSessionMessages.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessions.d.ts +26 -0
- package/dist/hooks/sessions/useSessions.d.ts.map +1 -0
- package/dist/index.css +0 -118
- package/dist/index.d.ts +15 -7889
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1119 -24
- package/dist/initialization/InitializationProvider.d.ts +48 -0
- package/dist/initialization/InitializationProvider.d.ts.map +1 -0
- package/dist/initialization/hooks/useAppInitialization.d.ts +32 -0
- package/dist/initialization/hooks/useAppInitialization.d.ts.map +1 -0
- package/dist/initialization/index.d.ts +22 -2361
- package/dist/initialization/index.d.ts.map +1 -0
- package/dist/initialization/index.js +1 -1
- package/dist/organization/context/OrganizationProvider.d.ts +20 -0
- package/dist/organization/context/OrganizationProvider.d.ts.map +1 -0
- package/dist/organization/hooks/useOrgInitialization.d.ts +56 -0
- package/dist/organization/hooks/useOrgInitialization.d.ts.map +1 -0
- package/dist/organization/index.d.ts +21 -283
- package/dist/organization/index.d.ts.map +1 -0
- package/dist/organization/index.js +3 -3
- package/dist/profile/context/ProfileProvider.d.ts +27 -0
- package/dist/profile/context/ProfileProvider.d.ts.map +1 -0
- package/dist/profile/hooks/useUserProfile.d.ts +31 -0
- package/dist/profile/hooks/useUserProfile.d.ts.map +1 -0
- package/dist/profile/index.d.ts +14 -2290
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/provider/CoreAuthKitInner.d.ts +12 -0
- package/dist/provider/CoreAuthKitInner.d.ts.map +1 -0
- package/dist/provider/ElevasisCoreProvider.d.ts +39 -0
- package/dist/provider/ElevasisCoreProvider.d.ts.map +1 -0
- package/dist/provider/ElevasisServiceContext.d.ts +31 -0
- package/dist/provider/ElevasisServiceContext.d.ts.map +1 -0
- package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts +2 -0
- package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts.map +1 -0
- package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts +2 -0
- package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts.map +1 -0
- package/dist/provider/index.d.ts +7 -372
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +3 -12
- package/dist/provider/published.d.ts +9 -263
- package/dist/provider/published.d.ts.map +1 -0
- package/dist/provider/published.js +5 -5
- package/dist/provider/types.d.ts +143 -0
- package/dist/provider/types.d.ts.map +1 -0
- package/dist/provider/types.js +1 -0
- package/dist/sdk-barrel.d.ts +20 -0
- package/dist/sdk-barrel.d.ts.map +1 -0
- package/dist/supabase/index.d.ts +0 -255
- package/dist/theme/cssVariables.d.ts +12 -0
- package/dist/theme/cssVariables.d.ts.map +1 -0
- package/dist/theme/cssVariables.js +93 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/presets/__tests__/getPreset.test.d.ts +2 -0
- package/dist/theme/presets/__tests__/getPreset.test.d.ts.map +1 -0
- package/dist/theme/presets/abyss.d.ts +3 -0
- package/dist/theme/presets/abyss.d.ts.map +1 -0
- package/dist/theme/presets/abyss.js +54 -0
- package/dist/theme/presets/aurora.d.ts +8 -0
- package/dist/theme/presets/aurora.d.ts.map +1 -0
- package/dist/theme/presets/aurora.js +59 -0
- package/dist/theme/presets/canopy.d.ts +3 -0
- package/dist/theme/presets/canopy.d.ts.map +1 -0
- package/dist/theme/presets/canopy.js +58 -0
- package/dist/theme/presets/cyber-flux.d.ts +8 -0
- package/dist/theme/presets/cyber-flux.d.ts.map +1 -0
- package/dist/theme/presets/cyber-flux.js +66 -0
- package/dist/theme/presets/cyber-strike.d.ts +9 -0
- package/dist/theme/presets/cyber-strike.d.ts.map +1 -0
- package/dist/theme/presets/cyber-strike.js +62 -0
- package/dist/theme/presets/cyber-void.d.ts +8 -0
- package/dist/theme/presets/cyber-void.d.ts.map +1 -0
- package/dist/theme/presets/cyber-void.js +62 -0
- package/dist/theme/presets/cyber-volt.d.ts +8 -0
- package/dist/theme/presets/cyber-volt.d.ts.map +1 -0
- package/dist/theme/presets/cyber-volt.js +66 -0
- package/dist/theme/presets/default.d.ts +4 -0
- package/dist/theme/presets/default.d.ts.map +1 -0
- package/dist/theme/presets/ember.d.ts +8 -0
- package/dist/theme/presets/ember.d.ts.map +1 -0
- package/dist/theme/presets/ember.js +63 -0
- package/dist/theme/presets/honey.d.ts +3 -0
- package/dist/theme/presets/honey.d.ts.map +1 -0
- package/dist/theme/presets/honey.js +62 -0
- package/dist/theme/presets/index.d.ts +6 -0
- package/dist/theme/presets/index.d.ts.map +1 -0
- package/dist/theme/presets/index.js +39 -0
- package/dist/theme/presets/midnight.d.ts +8 -0
- package/dist/theme/presets/midnight.d.ts.map +1 -0
- package/dist/theme/presets/midnight.js +68 -0
- package/dist/theme/presets/obsidian.d.ts +3 -0
- package/dist/theme/presets/obsidian.d.ts.map +1 -0
- package/dist/theme/presets/obsidian.js +56 -0
- package/dist/theme/presets/regal.d.ts +8 -0
- package/dist/theme/presets/regal.d.ts.map +1 -0
- package/dist/theme/presets/regal.js +63 -0
- package/dist/theme/presets/rose-gold.d.ts +8 -0
- package/dist/theme/presets/rose-gold.d.ts.map +1 -0
- package/dist/theme/presets/rose-gold.js +63 -0
- package/dist/theme/presets/slate.d.ts +3 -0
- package/dist/theme/presets/slate.d.ts.map +1 -0
- package/dist/theme/presets/slate.js +56 -0
- package/dist/theme/presets/tactical.d.ts +8 -0
- package/dist/theme/presets/tactical.d.ts.map +1 -0
- package/dist/theme/presets/tactical.js +57 -0
- package/dist/theme/presets/types.d.ts +26 -0
- package/dist/theme/presets/types.d.ts.map +1 -0
- package/dist/theme/presets/types.js +1 -0
- package/dist/utils/index.d.ts +1 -22
- package/dist/utils/index.js +1 -1
- package/package.json +4 -52
- package/dist/chunk-3KMDHCAR.js +0 -52
- package/dist/chunk-6BJOYF6E.js +0 -8
- package/dist/chunk-BLO4SISK.js +0 -113
- package/dist/chunk-HUWJXLLF.js +0 -681
- package/dist/chunk-JVAZHVNV.js +0 -110
- package/dist/chunk-JYSYHVLU.js +0 -379
- package/dist/chunk-NE36BUGQ.js +0 -146
- package/dist/chunk-O3PY6B6E.js +0 -749
- package/dist/chunk-OXVOHOP3.js +0 -661
- package/dist/chunk-PSLKGOBZ.js +0 -58
- package/dist/chunk-RJCA5672.js +0 -1664
- package/dist/chunk-TMFCNFLW.js +0 -107
- package/dist/chunk-TN3PU2WK.js +0 -748
- package/dist/chunk-TZPAA4RC.js +0 -1461
- package/dist/chunk-W7ZBF5AA.js +0 -1
- package/dist/chunk-YZ6GTZXL.js +0 -48
- package/dist/components/command-queue/index.css +0 -53
- package/dist/components/command-queue/index.d.ts +0 -204
- package/dist/components/command-queue/index.js +0 -12
- package/dist/components/forms/index.d.ts +0 -56
- package/dist/components/forms/index.js +0 -2
- package/dist/components/index.css +0 -443
- package/dist/components/monitoring/index.d.ts +0 -66
- package/dist/components/monitoring/index.js +0 -2
- package/dist/components/notifications/index.d.ts +0 -52
- package/dist/components/notifications/index.js +0 -5
- package/dist/components/resource-definition/index.css +0 -388
- package/dist/components/resource-definition/index.d.ts +0 -301
- package/dist/components/resource-definition/index.js +0 -3
- package/dist/display/index.css +0 -53
- package/dist/display/index.d.ts +0 -606
- package/dist/display/index.js +0 -7
- package/dist/execution/index.css +0 -388
- package/dist/provider/index.css +0 -61
- package/dist/{chunk-TYV5NJV2.js → chunk-BUZONXAW.js} +0 -0
- package/dist/{chunk-UMXDDEAG.js → chunk-SFF5MJEI.js} +1 -1
- /package/dist/{chunk-NXHL23JW.js → chunk-XXDDMASA.js} +0 -0
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import dagre from '@dagrejs/dagre';
|
|
3
|
+
import { IconCircleDot, IconLoader, IconAlertTriangle, IconX, IconCheck } from '@tabler/icons-react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/execution/hooks/useMergedExecution.ts
|
|
7
|
+
function useMergedExecution(fetchedExecution, streamingLogs) {
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
if (!fetchedExecution) return void 0;
|
|
10
|
+
if (!streamingLogs || streamingLogs.length === 0) return fetchedExecution;
|
|
11
|
+
const existingKeys = new Set(fetchedExecution.executionLogs.map((log) => `${log.timestamp}:${log.message}`));
|
|
12
|
+
const newLogs = streamingLogs.filter((log) => !existingKeys.has(`${log.timestamp}:${log.message}`));
|
|
13
|
+
if (newLogs.length === 0) return fetchedExecution;
|
|
14
|
+
return {
|
|
15
|
+
...fetchedExecution,
|
|
16
|
+
executionLogs: [...fetchedExecution.executionLogs, ...newLogs].sort((a, b) => a.timestamp - b.timestamp)
|
|
17
|
+
};
|
|
18
|
+
}, [fetchedExecution, streamingLogs]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ../core/src/execution/engine/workflow/logging.ts
|
|
22
|
+
function isStepStartedContext(ctx) {
|
|
23
|
+
return ctx.contextType === "step-started" || "stepStatus" in ctx && ctx.stepStatus === "started";
|
|
24
|
+
}
|
|
25
|
+
function isStepCompletedContext(ctx) {
|
|
26
|
+
return ctx.contextType === "step-completed" || "stepStatus" in ctx && ctx.stepStatus === "completed";
|
|
27
|
+
}
|
|
28
|
+
function isStepFailedContext(ctx) {
|
|
29
|
+
return ctx.contextType === "step-failed" || "stepStatus" in ctx && ctx.stepStatus === "failed";
|
|
30
|
+
}
|
|
31
|
+
function isConditionalRouteContext(ctx) {
|
|
32
|
+
return ctx.contextType === "conditional-route" || "target" in ctx && "stepId" in ctx && !("stepStatus" in ctx);
|
|
33
|
+
}
|
|
34
|
+
function toWorkflowLogMessage(log) {
|
|
35
|
+
if (log.context?.type === "workflow") {
|
|
36
|
+
return {
|
|
37
|
+
level: log.level,
|
|
38
|
+
message: log.message,
|
|
39
|
+
timestamp: log.timestamp,
|
|
40
|
+
context: log.context
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
level: log.level,
|
|
45
|
+
message: log.message,
|
|
46
|
+
timestamp: log.timestamp,
|
|
47
|
+
context: log.context
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ../core/src/execution/engine/agent/observability/logging.ts
|
|
52
|
+
function isLifecycleEvent(ctx) {
|
|
53
|
+
return "stage" in ctx && ctx.stage !== void 0;
|
|
54
|
+
}
|
|
55
|
+
function isIterationEvent(ctx) {
|
|
56
|
+
return "eventType" in ctx && ctx.eventType !== void 0;
|
|
57
|
+
}
|
|
58
|
+
function isToolCallEvent(ctx) {
|
|
59
|
+
return "eventType" in ctx && ctx.eventType === "tool-call";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/execution/hooks/useExecutionPath.ts
|
|
63
|
+
function useExecutionPath(executionLogs, workflowDefinition) {
|
|
64
|
+
return useMemo(() => {
|
|
65
|
+
if (!executionLogs || executionLogs.length === 0) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
if (!workflowDefinition) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
const executedSteps = /* @__PURE__ */ new Set();
|
|
72
|
+
const executedStepsOrdered = [];
|
|
73
|
+
const takenEdges = /* @__PURE__ */ new Set();
|
|
74
|
+
const stepStatusMap = /* @__PURE__ */ new Map();
|
|
75
|
+
const stepDataMap = /* @__PURE__ */ new Map();
|
|
76
|
+
let currentStepId;
|
|
77
|
+
for (const log of executionLogs) {
|
|
78
|
+
const context = log.context;
|
|
79
|
+
if (!context || context.type !== "workflow") continue;
|
|
80
|
+
if (isStepStartedContext(context)) {
|
|
81
|
+
executedSteps.add(context.stepId);
|
|
82
|
+
executedStepsOrdered.push(context.stepId);
|
|
83
|
+
currentStepId = context.stepId;
|
|
84
|
+
stepStatusMap.set(context.stepId, "running");
|
|
85
|
+
stepDataMap.set(context.stepId, {
|
|
86
|
+
status: "running",
|
|
87
|
+
input: context.input
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (isConditionalRouteContext(context)) {
|
|
91
|
+
const edgeId = `edge-${context.stepId}-${context.target}`;
|
|
92
|
+
takenEdges.add(edgeId);
|
|
93
|
+
}
|
|
94
|
+
if (isStepCompletedContext(context)) {
|
|
95
|
+
stepStatusMap.set(context.stepId, "completed");
|
|
96
|
+
const existingData = stepDataMap.get(context.stepId);
|
|
97
|
+
stepDataMap.set(context.stepId, {
|
|
98
|
+
...existingData,
|
|
99
|
+
status: "completed",
|
|
100
|
+
duration: context.duration,
|
|
101
|
+
output: context.output
|
|
102
|
+
});
|
|
103
|
+
if (context.stepId === currentStepId) {
|
|
104
|
+
currentStepId = void 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (isStepFailedContext(context)) {
|
|
108
|
+
stepStatusMap.set(context.stepId, "failed");
|
|
109
|
+
const existingData = stepDataMap.get(context.stepId);
|
|
110
|
+
stepDataMap.set(context.stepId, {
|
|
111
|
+
...existingData,
|
|
112
|
+
status: "failed",
|
|
113
|
+
duration: context.duration,
|
|
114
|
+
error: context.error
|
|
115
|
+
});
|
|
116
|
+
if (context.stepId === currentStepId) {
|
|
117
|
+
currentStepId = void 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (let i = 0; i < executedStepsOrdered.length - 1; i++) {
|
|
122
|
+
const sourceId = executedStepsOrdered[i];
|
|
123
|
+
const targetId = executedStepsOrdered[i + 1];
|
|
124
|
+
const step = workflowDefinition.steps.find((s) => s.id === sourceId);
|
|
125
|
+
if (step?.next?.type === "linear") {
|
|
126
|
+
const edgeId = `edge-${sourceId}-${targetId}`;
|
|
127
|
+
takenEdges.add(edgeId);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
executedSteps,
|
|
132
|
+
executedStepsOrdered,
|
|
133
|
+
takenEdges,
|
|
134
|
+
currentStepId,
|
|
135
|
+
stepStatusMap,
|
|
136
|
+
stepDataMap
|
|
137
|
+
};
|
|
138
|
+
}, [executionLogs, workflowDefinition]);
|
|
139
|
+
}
|
|
140
|
+
function useTimelineData(execution, resourceDefinition) {
|
|
141
|
+
return useMemo(() => {
|
|
142
|
+
const workflowSteps = resourceDefinition.steps;
|
|
143
|
+
if (!execution || !resourceDefinition) {
|
|
144
|
+
return void 0;
|
|
145
|
+
}
|
|
146
|
+
const stepMap = /* @__PURE__ */ new Map();
|
|
147
|
+
const stepNameLookup = /* @__PURE__ */ new Map();
|
|
148
|
+
workflowSteps.forEach((step) => {
|
|
149
|
+
stepNameLookup.set(step.id, step.name);
|
|
150
|
+
});
|
|
151
|
+
let workflowStartTime;
|
|
152
|
+
let workflowEndTime;
|
|
153
|
+
let activeStepId = null;
|
|
154
|
+
execution.executionLogs.forEach((log) => {
|
|
155
|
+
const context = log.context;
|
|
156
|
+
const ensureStepAndAddLog = (stepId) => {
|
|
157
|
+
if (!stepMap.has(stepId)) {
|
|
158
|
+
const stepName = stepNameLookup.get(stepId) || stepId;
|
|
159
|
+
stepMap.set(stepId, {
|
|
160
|
+
stepId,
|
|
161
|
+
stepName,
|
|
162
|
+
status: "pending",
|
|
163
|
+
logs: []
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const step = stepMap.get(stepId);
|
|
167
|
+
const workflowLog = toWorkflowLogMessage(log);
|
|
168
|
+
if (workflowLog) {
|
|
169
|
+
step.logs.push(workflowLog);
|
|
170
|
+
}
|
|
171
|
+
return step;
|
|
172
|
+
};
|
|
173
|
+
if (!context || context.type !== "workflow") {
|
|
174
|
+
if (activeStepId) {
|
|
175
|
+
ensureStepAndAddLog(activeStepId);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (isStepStartedContext(context)) {
|
|
180
|
+
activeStepId = context.stepId;
|
|
181
|
+
const step = ensureStepAndAddLog(context.stepId);
|
|
182
|
+
step.status = "running";
|
|
183
|
+
step.startTime = context.startTime;
|
|
184
|
+
step.input = context.input;
|
|
185
|
+
if (!workflowStartTime) workflowStartTime = context.startTime;
|
|
186
|
+
} else if (isStepCompletedContext(context)) {
|
|
187
|
+
const step = ensureStepAndAddLog(context.stepId);
|
|
188
|
+
step.status = "completed";
|
|
189
|
+
step.startTime = context.startTime;
|
|
190
|
+
step.endTime = context.endTime;
|
|
191
|
+
step.duration = context.duration;
|
|
192
|
+
step.output = context.output;
|
|
193
|
+
workflowEndTime = context.endTime;
|
|
194
|
+
activeStepId = null;
|
|
195
|
+
} else if (isStepFailedContext(context)) {
|
|
196
|
+
const step = ensureStepAndAddLog(context.stepId);
|
|
197
|
+
step.status = "failed";
|
|
198
|
+
step.startTime = context.startTime;
|
|
199
|
+
step.endTime = context.endTime;
|
|
200
|
+
step.duration = context.duration;
|
|
201
|
+
step.error = context.error;
|
|
202
|
+
workflowEndTime = context.endTime;
|
|
203
|
+
activeStepId = null;
|
|
204
|
+
} else if (isConditionalRouteContext(context)) {
|
|
205
|
+
ensureStepAndAddLog(context.stepId);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const steps = Array.from(stepMap.values());
|
|
209
|
+
const isRunning = execution.status === "running";
|
|
210
|
+
const totalDuration = workflowStartTime && workflowEndTime ? workflowEndTime - workflowStartTime : 0;
|
|
211
|
+
return {
|
|
212
|
+
steps,
|
|
213
|
+
totalDuration,
|
|
214
|
+
isRunning
|
|
215
|
+
};
|
|
216
|
+
}, [execution, resourceDefinition]);
|
|
217
|
+
}
|
|
218
|
+
function useAgentIterationData(execution, resourceDefinition) {
|
|
219
|
+
return useMemo(() => {
|
|
220
|
+
if (!execution || !execution.executionLogs) {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
const iterations = /* @__PURE__ */ new Map();
|
|
224
|
+
let currentIteration = null;
|
|
225
|
+
let totalDuration;
|
|
226
|
+
let status = execution.status;
|
|
227
|
+
const initialization = {
|
|
228
|
+
type: "initialization",
|
|
229
|
+
status: "pending"
|
|
230
|
+
};
|
|
231
|
+
const completion = {
|
|
232
|
+
type: "completion",
|
|
233
|
+
status: "pending"
|
|
234
|
+
};
|
|
235
|
+
for (const log of execution.executionLogs) {
|
|
236
|
+
const context = log.context;
|
|
237
|
+
if (context?.type !== "agent" || !("lifecycle" in context)) continue;
|
|
238
|
+
if (isLifecycleEvent(context)) {
|
|
239
|
+
const { lifecycle, stage } = context;
|
|
240
|
+
if (lifecycle === "initialization") {
|
|
241
|
+
initialization.timestamp = log.timestamp;
|
|
242
|
+
if (stage === "started") {
|
|
243
|
+
initialization.status = "running";
|
|
244
|
+
initialization.startTime = context.startTime;
|
|
245
|
+
} else if (stage === "completed") {
|
|
246
|
+
initialization.status = "completed";
|
|
247
|
+
initialization.endTime = context.endTime;
|
|
248
|
+
initialization.duration = context.duration;
|
|
249
|
+
} else if (stage === "failed") {
|
|
250
|
+
initialization.status = "failed";
|
|
251
|
+
initialization.endTime = context.endTime;
|
|
252
|
+
initialization.duration = context.duration;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (lifecycle === "iteration" && "iteration" in context) {
|
|
256
|
+
const iterationNum = context.iteration;
|
|
257
|
+
if (stage === "started") {
|
|
258
|
+
if (!iterations.has(iterationNum)) {
|
|
259
|
+
iterations.set(iterationNum, {
|
|
260
|
+
iterationNumber: iterationNum,
|
|
261
|
+
status: "running",
|
|
262
|
+
iterationEvents: [],
|
|
263
|
+
subActivities: [],
|
|
264
|
+
timestamp: context.startTime,
|
|
265
|
+
startTime: context.startTime
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
currentIteration = iterationNum;
|
|
269
|
+
} else if (stage === "completed") {
|
|
270
|
+
const iteration = iterations.get(iterationNum);
|
|
271
|
+
if (iteration) {
|
|
272
|
+
iteration.status = "completed";
|
|
273
|
+
iteration.endTime = context.endTime;
|
|
274
|
+
iteration.duration = context.duration;
|
|
275
|
+
}
|
|
276
|
+
} else if (stage === "failed") {
|
|
277
|
+
const iteration = iterations.get(iterationNum);
|
|
278
|
+
if (iteration) {
|
|
279
|
+
iteration.status = "failed";
|
|
280
|
+
iteration.endTime = context.endTime;
|
|
281
|
+
if (context.duration) {
|
|
282
|
+
iteration.duration = context.duration;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (lifecycle === "completion") {
|
|
288
|
+
completion.timestamp = log.timestamp;
|
|
289
|
+
if (stage === "started") {
|
|
290
|
+
completion.status = "running";
|
|
291
|
+
completion.startTime = context.startTime;
|
|
292
|
+
} else if (stage === "completed") {
|
|
293
|
+
completion.status = "completed";
|
|
294
|
+
completion.endTime = context.endTime;
|
|
295
|
+
completion.duration = context.duration;
|
|
296
|
+
} else if (stage === "failed") {
|
|
297
|
+
completion.status = "failed";
|
|
298
|
+
completion.endTime = context.endTime;
|
|
299
|
+
completion.duration = context.duration;
|
|
300
|
+
status = "failed";
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (isIterationEvent(context)) {
|
|
305
|
+
const iterationNum = context.iteration;
|
|
306
|
+
if (iterationNum === 0) {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const iteration = iterations.get(iterationNum);
|
|
310
|
+
if (iteration) {
|
|
311
|
+
iteration.iterationEvents.push(context);
|
|
312
|
+
if ("startTime" in context && "endTime" in context && "duration" in context) {
|
|
313
|
+
iteration.subActivities.push({
|
|
314
|
+
type: context.eventType,
|
|
315
|
+
startTime: context.startTime,
|
|
316
|
+
endTime: context.endTime,
|
|
317
|
+
duration: context.duration,
|
|
318
|
+
details: context
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (isToolCallEvent(context)) {
|
|
324
|
+
const iterationNum = context.iteration;
|
|
325
|
+
if (iterationNum === 0) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const iteration = iterations.get(iterationNum);
|
|
329
|
+
if (iteration) {
|
|
330
|
+
iteration.subActivities.push({
|
|
331
|
+
type: "tool-call",
|
|
332
|
+
startTime: context.startTime,
|
|
333
|
+
endTime: context.endTime,
|
|
334
|
+
duration: context.duration,
|
|
335
|
+
details: context
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const iterationArray = Array.from(iterations.values()).sort((a, b) => a.iterationNumber - b.iterationNumber).map((iteration) => ({
|
|
341
|
+
...iteration,
|
|
342
|
+
subActivities: iteration.subActivities.sort((a, b) => a.startTime - b.startTime)
|
|
343
|
+
}));
|
|
344
|
+
if (initialization.duration && completion.duration) {
|
|
345
|
+
const iterationsDuration = iterationArray.reduce((sum, iter) => sum + (iter.duration || 0), 0);
|
|
346
|
+
totalDuration = initialization.duration + iterationsDuration + completion.duration;
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
initialization,
|
|
350
|
+
iterations: iterationArray,
|
|
351
|
+
completion,
|
|
352
|
+
currentIteration: status === "running" ? currentIteration : null,
|
|
353
|
+
totalIterations: iterationArray.length,
|
|
354
|
+
totalDuration,
|
|
355
|
+
status
|
|
356
|
+
};
|
|
357
|
+
}, [execution, resourceDefinition]);
|
|
358
|
+
}
|
|
359
|
+
var NODE_WIDTH = 220;
|
|
360
|
+
var NODE_HEIGHT = 140;
|
|
361
|
+
var RANK_SEP = 100;
|
|
362
|
+
var NODE_SEP = 40;
|
|
363
|
+
function buildEdges(steps) {
|
|
364
|
+
const edges = [];
|
|
365
|
+
for (const step of steps) {
|
|
366
|
+
if (step.next === null) continue;
|
|
367
|
+
if (step.next.type === "linear" && step.next.target) {
|
|
368
|
+
edges.push({
|
|
369
|
+
id: `edge-${step.id}-${step.next.target}`,
|
|
370
|
+
source: step.id,
|
|
371
|
+
target: step.next.target,
|
|
372
|
+
type: "workflowStep",
|
|
373
|
+
data: {
|
|
374
|
+
edgeType: "linear",
|
|
375
|
+
label: "next"
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
} else if (step.next.type === "conditional") {
|
|
379
|
+
const routes = step.next.routes || [];
|
|
380
|
+
const defaultTarget = step.next.default;
|
|
381
|
+
for (const route of routes) {
|
|
382
|
+
edges.push({
|
|
383
|
+
id: `edge-${step.id}-${route.target}`,
|
|
384
|
+
source: step.id,
|
|
385
|
+
target: route.target,
|
|
386
|
+
type: "workflowStep",
|
|
387
|
+
data: {
|
|
388
|
+
edgeType: "conditional",
|
|
389
|
+
label: "route"
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (defaultTarget) {
|
|
394
|
+
edges.push({
|
|
395
|
+
id: `edge-${step.id}-${defaultTarget}-default`,
|
|
396
|
+
source: step.id,
|
|
397
|
+
target: defaultTarget,
|
|
398
|
+
type: "workflowStep",
|
|
399
|
+
data: {
|
|
400
|
+
edgeType: "default",
|
|
401
|
+
label: "default"
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return edges;
|
|
408
|
+
}
|
|
409
|
+
var MIN_GRAPH_HEIGHT = 400;
|
|
410
|
+
var MAX_GRAPH_HEIGHT = 600;
|
|
411
|
+
var GRAPH_PADDING = 80;
|
|
412
|
+
function useWorkflowStepsLayout(workflow) {
|
|
413
|
+
return useMemo(() => {
|
|
414
|
+
if (!workflow || workflow.steps.length === 0) {
|
|
415
|
+
return { nodes: [], edges: [], graphHeight: MIN_GRAPH_HEIGHT };
|
|
416
|
+
}
|
|
417
|
+
const edges = buildEdges(workflow.steps);
|
|
418
|
+
const hasOutgoing = /* @__PURE__ */ new Set();
|
|
419
|
+
for (const edge of edges) {
|
|
420
|
+
hasOutgoing.add(edge.source);
|
|
421
|
+
}
|
|
422
|
+
const dagreGraph = new dagre.graphlib.Graph();
|
|
423
|
+
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
|
424
|
+
dagreGraph.setGraph({
|
|
425
|
+
rankdir: "LR",
|
|
426
|
+
ranksep: RANK_SEP,
|
|
427
|
+
nodesep: NODE_SEP,
|
|
428
|
+
marginx: 50,
|
|
429
|
+
marginy: 50
|
|
430
|
+
});
|
|
431
|
+
workflow.steps.forEach((step) => {
|
|
432
|
+
dagreGraph.setNode(step.id, {
|
|
433
|
+
width: NODE_WIDTH,
|
|
434
|
+
height: NODE_HEIGHT
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
edges.forEach((edge) => {
|
|
438
|
+
dagreGraph.setEdge(edge.source, edge.target);
|
|
439
|
+
});
|
|
440
|
+
dagre.layout(dagreGraph);
|
|
441
|
+
const nodes = workflow.steps.map((step) => {
|
|
442
|
+
const dagreNode = dagreGraph.node(step.id);
|
|
443
|
+
const isConditional = step.next?.type === "conditional";
|
|
444
|
+
const routeCount = isConditional ? (step.next?.routes?.length || 0) + (step.next?.default ? 1 : 0) : 0;
|
|
445
|
+
return {
|
|
446
|
+
id: step.id,
|
|
447
|
+
type: "workflowStep",
|
|
448
|
+
position: {
|
|
449
|
+
x: dagreNode.x - NODE_WIDTH / 2,
|
|
450
|
+
y: dagreNode.y - NODE_HEIGHT / 2
|
|
451
|
+
},
|
|
452
|
+
data: {
|
|
453
|
+
id: step.id,
|
|
454
|
+
name: step.name,
|
|
455
|
+
description: step.description,
|
|
456
|
+
isEntryPoint: step.id === workflow.entryPoint,
|
|
457
|
+
isEndNode: !hasOutgoing.has(step.id),
|
|
458
|
+
isConditional,
|
|
459
|
+
routeCount
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
});
|
|
463
|
+
let minY = Infinity;
|
|
464
|
+
let maxY = -Infinity;
|
|
465
|
+
for (const node of nodes) {
|
|
466
|
+
minY = Math.min(minY, node.position.y);
|
|
467
|
+
maxY = Math.max(maxY, node.position.y + NODE_HEIGHT);
|
|
468
|
+
}
|
|
469
|
+
const rawHeight = maxY - minY + GRAPH_PADDING;
|
|
470
|
+
const graphHeight = Math.max(MIN_GRAPH_HEIGHT, Math.min(MAX_GRAPH_HEIGHT, rawHeight));
|
|
471
|
+
return { nodes, edges, graphHeight };
|
|
472
|
+
}, [workflow]);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/execution/utils/statusColors.ts
|
|
476
|
+
var STATUS_COLORS = {
|
|
477
|
+
completed: {
|
|
478
|
+
color: "var(--color-success)",
|
|
479
|
+
badge: "green"
|
|
480
|
+
},
|
|
481
|
+
failed: {
|
|
482
|
+
color: "var(--color-error)",
|
|
483
|
+
badge: "red"
|
|
484
|
+
},
|
|
485
|
+
running: {
|
|
486
|
+
color: "var(--color-primary)",
|
|
487
|
+
badge: "blue"
|
|
488
|
+
},
|
|
489
|
+
pending: {
|
|
490
|
+
color: "var(--color-text-dimmed)",
|
|
491
|
+
badge: "gray"
|
|
492
|
+
},
|
|
493
|
+
warning: {
|
|
494
|
+
color: "var(--color-warning)",
|
|
495
|
+
badge: "yellow"
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
function getStatusColors(status) {
|
|
499
|
+
return STATUS_COLORS[status];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/execution/utils/edgeUtils.ts
|
|
503
|
+
function getEdgeColor({ selected, sourceStatus }) {
|
|
504
|
+
if (selected) {
|
|
505
|
+
return "var(--color-primary)";
|
|
506
|
+
}
|
|
507
|
+
return STATUS_COLORS[sourceStatus].color;
|
|
508
|
+
}
|
|
509
|
+
function getEdgeOpacity({ sourceStatus }) {
|
|
510
|
+
switch (sourceStatus) {
|
|
511
|
+
case "completed":
|
|
512
|
+
return 0.8;
|
|
513
|
+
case "warning":
|
|
514
|
+
return 0.8;
|
|
515
|
+
case "running":
|
|
516
|
+
return 1;
|
|
517
|
+
case "failed":
|
|
518
|
+
return 0.6;
|
|
519
|
+
case "pending":
|
|
520
|
+
default:
|
|
521
|
+
return 0.3;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function shouldAnimateEdge(sourceStatus, targetStatus) {
|
|
525
|
+
return sourceStatus === "running" || targetStatus === "running";
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// src/execution/hooks/useUnifiedWorkflowLayout.ts
|
|
529
|
+
function getStepStatus(stepId, executionPath) {
|
|
530
|
+
if (!executionPath) return void 0;
|
|
531
|
+
if (executionPath.currentStepId === stepId) {
|
|
532
|
+
return "running";
|
|
533
|
+
}
|
|
534
|
+
if (executionPath.executedSteps.has(stepId)) {
|
|
535
|
+
const status = executionPath.stepStatusMap?.get(stepId);
|
|
536
|
+
return status || "completed";
|
|
537
|
+
}
|
|
538
|
+
return "pending";
|
|
539
|
+
}
|
|
540
|
+
function calculateDimState(stepId, executionPath, entryPointId, hasExecutionData, mode) {
|
|
541
|
+
if (mode === "definition") {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
if (!hasExecutionData) {
|
|
545
|
+
return stepId !== entryPointId;
|
|
546
|
+
}
|
|
547
|
+
return !executionPath?.executedSteps.has(stepId);
|
|
548
|
+
}
|
|
549
|
+
function useUnifiedWorkflowLayout(workflow, executionPath, selectedStepId, mode = "execution") {
|
|
550
|
+
const { nodes: baseNodes, edges: baseEdges, graphHeight } = useWorkflowStepsLayout(workflow);
|
|
551
|
+
return useMemo(() => {
|
|
552
|
+
if (!workflow || baseNodes.length === 0) {
|
|
553
|
+
return { nodes: [], edges: [], graphHeight };
|
|
554
|
+
}
|
|
555
|
+
const entryPointId = workflow.entryPoint;
|
|
556
|
+
const hasExecutionData = !!executionPath && executionPath.executedSteps.size > 0;
|
|
557
|
+
const nodes = baseNodes.map((node) => {
|
|
558
|
+
const stepId = node.data.id;
|
|
559
|
+
const executionStatus = getStepStatus(stepId, executionPath);
|
|
560
|
+
const isExecuted = executionPath?.executedSteps.has(stepId) ?? false;
|
|
561
|
+
const isDimmed = calculateDimState(stepId, executionPath, entryPointId, hasExecutionData, mode);
|
|
562
|
+
const isSelected = selectedStepId === stepId;
|
|
563
|
+
const stepData = executionPath?.stepDataMap?.get(stepId);
|
|
564
|
+
return {
|
|
565
|
+
...node,
|
|
566
|
+
type: "unifiedWorkflowNode",
|
|
567
|
+
data: {
|
|
568
|
+
// Structure data
|
|
569
|
+
id: node.data.id,
|
|
570
|
+
name: node.data.name,
|
|
571
|
+
description: node.data.description,
|
|
572
|
+
isEntryPoint: node.data.isEntryPoint,
|
|
573
|
+
isEndNode: node.data.isEndNode,
|
|
574
|
+
isConditional: node.data.isConditional,
|
|
575
|
+
routeCount: node.data.routeCount,
|
|
576
|
+
// Execution state
|
|
577
|
+
executionStatus,
|
|
578
|
+
duration: stepData?.duration,
|
|
579
|
+
input: stepData?.input,
|
|
580
|
+
output: stepData?.output,
|
|
581
|
+
error: stepData?.error,
|
|
582
|
+
logs: stepData?.logs,
|
|
583
|
+
// Computed UI state
|
|
584
|
+
isExecuted,
|
|
585
|
+
isDimmed,
|
|
586
|
+
isSelected
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
});
|
|
590
|
+
const edges = baseEdges.map((edge) => {
|
|
591
|
+
const wasTaken = executionPath?.takenEdges.has(edge.id) ?? false;
|
|
592
|
+
const sourceStatus = getStepStatus(edge.source, executionPath);
|
|
593
|
+
const targetStatus = getStepStatus(edge.target, executionPath);
|
|
594
|
+
const isDimmed = mode === "execution" && hasExecutionData && !wasTaken;
|
|
595
|
+
const isAnimated = wasTaken && sourceStatus && targetStatus ? shouldAnimateEdge(sourceStatus, targetStatus) : false;
|
|
596
|
+
return {
|
|
597
|
+
...edge,
|
|
598
|
+
type: "unifiedWorkflowEdge",
|
|
599
|
+
data: {
|
|
600
|
+
// Structure data
|
|
601
|
+
edgeType: edge.data?.edgeType ?? "linear",
|
|
602
|
+
label: edge.data?.label,
|
|
603
|
+
// Execution state
|
|
604
|
+
wasTaken,
|
|
605
|
+
sourceStatus,
|
|
606
|
+
targetStatus,
|
|
607
|
+
// Computed UI state
|
|
608
|
+
isDimmed,
|
|
609
|
+
isAnimated
|
|
610
|
+
},
|
|
611
|
+
animated: isAnimated
|
|
612
|
+
};
|
|
613
|
+
});
|
|
614
|
+
return { nodes, edges, graphHeight };
|
|
615
|
+
}, [baseNodes, baseEdges, workflow, executionPath, selectedStepId, graphHeight, mode]);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// src/execution/constants.ts
|
|
619
|
+
var TIMELINE_CONSTANTS = {
|
|
620
|
+
// Bar dimensions
|
|
621
|
+
BAR_HEIGHT: 24,
|
|
622
|
+
ROW_GAP: 8,
|
|
623
|
+
MIN_BAR_WIDTH_PERCENT: 0.5,
|
|
624
|
+
// Label column
|
|
625
|
+
LABEL_WIDTH: 200,
|
|
626
|
+
// Indentation for nested rows
|
|
627
|
+
INDENT_SIZE: 16,
|
|
628
|
+
// Container padding
|
|
629
|
+
CONTAINER_PADDING: 16,
|
|
630
|
+
CONTAINER_BORDER_RADIUS: 8
|
|
631
|
+
};
|
|
632
|
+
var SHARED_VIZ_CONSTANTS = {
|
|
633
|
+
NODE_WIDTH: 160,
|
|
634
|
+
NODE_SPACING: 220,
|
|
635
|
+
HANDLE_SIZE: 8,
|
|
636
|
+
MIN_ZOOM: 0.5,
|
|
637
|
+
MAX_ZOOM: 2
|
|
638
|
+
};
|
|
639
|
+
var AGENT_CONSTANTS = {
|
|
640
|
+
...SHARED_VIZ_CONSTANTS,
|
|
641
|
+
NODE_HEIGHT: 140,
|
|
642
|
+
CONTAINER_HEIGHT: 430,
|
|
643
|
+
FIT_VIEW_PADDING: 0.2,
|
|
644
|
+
ICON_SIZE: 16,
|
|
645
|
+
STATUS_ICON_SIZE: 16,
|
|
646
|
+
CIRCLE_SIZE: 40,
|
|
647
|
+
PULSE_DURATION: "2s",
|
|
648
|
+
TRANSITION_DURATION: "0.2s"
|
|
649
|
+
};
|
|
650
|
+
var WORKFLOW_CONSTANTS = {
|
|
651
|
+
...SHARED_VIZ_CONSTANTS,
|
|
652
|
+
FIT_VIEW_PADDING: 0.4,
|
|
653
|
+
ICON_SIZE: 20,
|
|
654
|
+
CIRCLE_SIZE: 40,
|
|
655
|
+
SPIN_DURATION: "1s"
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
// src/execution/hooks/useReactFlowAgent.ts
|
|
659
|
+
function useReactFlowAgent(iterationData, _resourceDefinition, selectedIterationId, liveExecutions, selectedExecutionId) {
|
|
660
|
+
return useMemo(() => {
|
|
661
|
+
if (!iterationData) {
|
|
662
|
+
return { nodes: [], edges: [] };
|
|
663
|
+
}
|
|
664
|
+
const isLive = selectedExecutionId ? liveExecutions.has(selectedExecutionId) : false;
|
|
665
|
+
const nodes = [];
|
|
666
|
+
const edges = [];
|
|
667
|
+
let xPosition = 0;
|
|
668
|
+
const yPosition = AGENT_CONSTANTS.CONTAINER_HEIGHT / 2;
|
|
669
|
+
nodes.push({
|
|
670
|
+
id: "initialization",
|
|
671
|
+
type: "agentIteration",
|
|
672
|
+
position: { x: xPosition, y: yPosition },
|
|
673
|
+
data: {
|
|
674
|
+
label: "Initialization",
|
|
675
|
+
nodeType: "initialization",
|
|
676
|
+
status: iterationData.initialization.status,
|
|
677
|
+
duration: iterationData.initialization.duration,
|
|
678
|
+
isLive: isLive && iterationData.initialization.status === "running"
|
|
679
|
+
},
|
|
680
|
+
selected: selectedIterationId === "initialization",
|
|
681
|
+
origin: [0.5, 0.5]
|
|
682
|
+
});
|
|
683
|
+
xPosition += AGENT_CONSTANTS.NODE_SPACING;
|
|
684
|
+
for (let i = 0; i < iterationData.iterations.length; i++) {
|
|
685
|
+
const iteration = iterationData.iterations[i];
|
|
686
|
+
const isSelected = selectedIterationId === iteration.iterationNumber;
|
|
687
|
+
const isCurrentIteration = iterationData.currentIteration === iteration.iterationNumber;
|
|
688
|
+
nodes.push({
|
|
689
|
+
id: `iteration-${iteration.iterationNumber}`,
|
|
690
|
+
type: "agentIteration",
|
|
691
|
+
position: { x: xPosition, y: yPosition },
|
|
692
|
+
data: {
|
|
693
|
+
iterationNumber: iteration.iterationNumber,
|
|
694
|
+
nodeType: "iteration",
|
|
695
|
+
status: iteration.status,
|
|
696
|
+
reasoningCount: iteration.iterationEvents.filter((e) => e.eventType === "reasoning").length,
|
|
697
|
+
actionCount: iteration.iterationEvents.filter((e) => e.eventType === "action").length,
|
|
698
|
+
duration: iteration.duration,
|
|
699
|
+
isLive: isLive && isCurrentIteration
|
|
700
|
+
},
|
|
701
|
+
selected: isSelected,
|
|
702
|
+
origin: [0.5, 0.5]
|
|
703
|
+
});
|
|
704
|
+
xPosition += AGENT_CONSTANTS.NODE_SPACING;
|
|
705
|
+
}
|
|
706
|
+
const completionStarted = iterationData.completion.status !== "pending";
|
|
707
|
+
if (completionStarted) {
|
|
708
|
+
nodes.push({
|
|
709
|
+
id: "completion",
|
|
710
|
+
type: "agentIteration",
|
|
711
|
+
position: { x: xPosition, y: yPosition },
|
|
712
|
+
data: {
|
|
713
|
+
label: "Completion",
|
|
714
|
+
nodeType: "completion",
|
|
715
|
+
status: iterationData.completion.status,
|
|
716
|
+
duration: iterationData.completion.duration,
|
|
717
|
+
isLive: isLive && iterationData.completion.status === "running"
|
|
718
|
+
},
|
|
719
|
+
selected: selectedIterationId === "completion",
|
|
720
|
+
origin: [0.5, 0.5]
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
if (iterationData.iterations.length > 0 && iterationData.initialization.status !== "failed") {
|
|
724
|
+
edges.push({
|
|
725
|
+
id: "edge-init-iter1",
|
|
726
|
+
source: "initialization",
|
|
727
|
+
target: `iteration-${iterationData.iterations[0].iterationNumber}`,
|
|
728
|
+
type: "agentIteration",
|
|
729
|
+
data: {
|
|
730
|
+
sourceStatus: iterationData.initialization.status,
|
|
731
|
+
targetStatus: iterationData.iterations[0].status
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
} else if (iterationData.iterations.length === 0 && completionStarted) {
|
|
735
|
+
edges.push({
|
|
736
|
+
id: "edge-init-completion",
|
|
737
|
+
source: "initialization",
|
|
738
|
+
target: "completion",
|
|
739
|
+
type: "agentIteration",
|
|
740
|
+
data: {
|
|
741
|
+
sourceStatus: iterationData.initialization.status,
|
|
742
|
+
targetStatus: iterationData.completion.status
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
for (let i = 0; i < iterationData.iterations.length - 1; i++) {
|
|
747
|
+
const sourceIteration = iterationData.iterations[i];
|
|
748
|
+
const targetIteration = iterationData.iterations[i + 1];
|
|
749
|
+
edges.push({
|
|
750
|
+
id: `edge-${sourceIteration.iterationNumber}-${targetIteration.iterationNumber}`,
|
|
751
|
+
source: `iteration-${sourceIteration.iterationNumber}`,
|
|
752
|
+
target: `iteration-${targetIteration.iterationNumber}`,
|
|
753
|
+
type: "agentIteration",
|
|
754
|
+
data: {
|
|
755
|
+
sourceStatus: sourceIteration.status,
|
|
756
|
+
targetStatus: targetIteration.status
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
if (iterationData.iterations.length > 0 && completionStarted) {
|
|
761
|
+
const lastIteration = iterationData.iterations[iterationData.iterations.length - 1];
|
|
762
|
+
edges.push({
|
|
763
|
+
id: "edge-last-completion",
|
|
764
|
+
source: `iteration-${lastIteration.iterationNumber}`,
|
|
765
|
+
target: "completion",
|
|
766
|
+
type: "agentIteration",
|
|
767
|
+
data: {
|
|
768
|
+
sourceStatus: lastIteration.status,
|
|
769
|
+
targetStatus: iterationData.completion.status
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
return { nodes, edges };
|
|
774
|
+
}, [iterationData, selectedIterationId, liveExecutions, selectedExecutionId]);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/execution/utils/formatDuration.ts
|
|
778
|
+
function formatDuration(ms) {
|
|
779
|
+
if (!ms) return "0ms";
|
|
780
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
781
|
+
return `${(ms / 1e3).toFixed(2)}s`;
|
|
782
|
+
}
|
|
783
|
+
var SPIN_ANIMATION = `
|
|
784
|
+
@keyframes spin {
|
|
785
|
+
from { transform: rotate(0deg); }
|
|
786
|
+
to { transform: rotate(360deg); }
|
|
787
|
+
}
|
|
788
|
+
`;
|
|
789
|
+
function getStatusIcon({ status, colors, iconSize, spinDuration = "1s" }) {
|
|
790
|
+
switch (status) {
|
|
791
|
+
case "completed":
|
|
792
|
+
return /* @__PURE__ */ jsx(IconCheck, { size: iconSize, color: colors.icon });
|
|
793
|
+
case "failed":
|
|
794
|
+
return /* @__PURE__ */ jsx(IconX, { size: iconSize, color: colors.icon });
|
|
795
|
+
case "warning":
|
|
796
|
+
return /* @__PURE__ */ jsx(IconAlertTriangle, { size: iconSize, color: colors.icon });
|
|
797
|
+
case "running":
|
|
798
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ jsx("style", { children: SPIN_ANIMATION }),
|
|
800
|
+
/* @__PURE__ */ jsx(
|
|
801
|
+
IconLoader,
|
|
802
|
+
{
|
|
803
|
+
size: iconSize,
|
|
804
|
+
color: colors.icon,
|
|
805
|
+
style: { animation: `spin ${spinDuration} linear infinite` }
|
|
806
|
+
}
|
|
807
|
+
)
|
|
808
|
+
] });
|
|
809
|
+
case "pending":
|
|
810
|
+
default:
|
|
811
|
+
return /* @__PURE__ */ jsx(IconCircleDot, { size: iconSize, color: colors.icon });
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// src/execution/utils/getResourceStatusColor.ts
|
|
816
|
+
function getResourceStatusColor(resourceStatus) {
|
|
817
|
+
return resourceStatus === "dev" ? "var(--color-primary)" : "var(--color-success)";
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// src/execution/utils/calculateBarPosition.ts
|
|
821
|
+
function calculateBarPosition(startTime, endTime, executionStart, executionEnd) {
|
|
822
|
+
const totalDuration = executionEnd - executionStart;
|
|
823
|
+
if (totalDuration <= 0) {
|
|
824
|
+
return { left: 0, width: 100 };
|
|
825
|
+
}
|
|
826
|
+
const relativeStart = startTime - executionStart;
|
|
827
|
+
const duration = endTime - startTime;
|
|
828
|
+
if (relativeStart < 0) {
|
|
829
|
+
console.warn("Activity start time is before execution start time");
|
|
830
|
+
const calculatedWidth = Math.max(0, duration / totalDuration * 100);
|
|
831
|
+
return { left: 0, width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, calculatedWidth) };
|
|
832
|
+
}
|
|
833
|
+
if (startTime + duration > executionEnd) {
|
|
834
|
+
console.warn("Activity end time exceeds execution end time");
|
|
835
|
+
const cappedDuration = Math.max(0, executionEnd - startTime);
|
|
836
|
+
const calculatedWidth = cappedDuration / totalDuration * 100;
|
|
837
|
+
return {
|
|
838
|
+
left: relativeStart / totalDuration * 100,
|
|
839
|
+
width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, calculatedWidth)
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
const left = relativeStart / totalDuration * 100;
|
|
843
|
+
const width = duration / totalDuration * 100;
|
|
844
|
+
return {
|
|
845
|
+
left: Math.max(0, Math.min(100, left)),
|
|
846
|
+
width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, Math.min(100, width))
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export { AGENT_CONSTANTS, SHARED_VIZ_CONSTANTS, STATUS_COLORS, TIMELINE_CONSTANTS, WORKFLOW_CONSTANTS, calculateBarPosition, formatDuration, getEdgeColor, getEdgeOpacity, getResourceStatusColor, getStatusColors, getStatusIcon, shouldAnimateEdge, useAgentIterationData, useExecutionPath, useMergedExecution, useReactFlowAgent, useTimelineData, useUnifiedWorkflowLayout, useWorkflowStepsLayout };
|