@elevasis/ui 1.3.1 → 1.3.2
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 +6 -6
- 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 +190 -0
- package/dist/provider/types.d.ts.map +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/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +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-strike.d.ts +9 -0
- package/dist/theme/presets/cyber-strike.d.ts.map +1 -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-volt.d.ts +8 -0
- package/dist/theme/presets/cyber-volt.d.ts.map +1 -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/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/rose-gold.d.ts +8 -0
- package/dist/theme/presets/rose-gold.d.ts.map +1 -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/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 +67 -51
- 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
package/dist/chunk-RJCA5672.js
DELETED
|
@@ -1,1664 +0,0 @@
|
|
|
1
|
-
import { formatDuration } from './chunk-6BJOYF6E.js';
|
|
2
|
-
import { BaseNode, useGraphTheme, BaseEdge, Graph_default, useDirectedChainHighlighting, useNodeSelection, GraphBackground, GraphLegend, GraphFitViewButton, GraphFitViewHandler, useFitViewTrigger } from './chunk-HUWJXLLF.js';
|
|
3
|
-
import { isStepStartedContext, isConditionalRouteContext, isStepCompletedContext, isStepFailedContext, isLifecycleEvent, isIterationEvent, isToolCallEvent, toWorkflowLogMessage } from './chunk-YZ6GTZXL.js';
|
|
4
|
-
import { memo, useMemo, useState, useEffect, useCallback, Fragment as Fragment$1 } from 'react';
|
|
5
|
-
import dagre from '@dagrejs/dagre';
|
|
6
|
-
import { Stack, Text, Group, Badge, Box, Loader, SegmentedControl } from '@mantine/core';
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { Position, ReactFlowProvider, ReactFlow, Panel } from '@xyflow/react';
|
|
9
|
-
import '@xyflow/react/dist/style.css';
|
|
10
|
-
import { IconPlayerPlay, IconPlayerStop, IconArrowsSplit, IconSquare, IconCircleDot, IconLoader, IconAlertTriangle, IconX, IconCheck } from '@tabler/icons-react';
|
|
11
|
-
|
|
12
|
-
function useMergedExecution(fetchedExecution, streamingLogs) {
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
if (!fetchedExecution) return void 0;
|
|
15
|
-
if (!streamingLogs || streamingLogs.length === 0) return fetchedExecution;
|
|
16
|
-
const existingKeys = new Set(fetchedExecution.executionLogs.map((log) => `${log.timestamp}:${log.message}`));
|
|
17
|
-
const newLogs = streamingLogs.filter((log) => !existingKeys.has(`${log.timestamp}:${log.message}`));
|
|
18
|
-
if (newLogs.length === 0) return fetchedExecution;
|
|
19
|
-
return {
|
|
20
|
-
...fetchedExecution,
|
|
21
|
-
executionLogs: [...fetchedExecution.executionLogs, ...newLogs].sort((a, b) => a.timestamp - b.timestamp)
|
|
22
|
-
};
|
|
23
|
-
}, [fetchedExecution, streamingLogs]);
|
|
24
|
-
}
|
|
25
|
-
function useExecutionPath(executionLogs, workflowDefinition) {
|
|
26
|
-
return useMemo(() => {
|
|
27
|
-
if (!executionLogs || executionLogs.length === 0) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
if (!workflowDefinition) {
|
|
31
|
-
return void 0;
|
|
32
|
-
}
|
|
33
|
-
const executedSteps = /* @__PURE__ */ new Set();
|
|
34
|
-
const executedStepsOrdered = [];
|
|
35
|
-
const takenEdges = /* @__PURE__ */ new Set();
|
|
36
|
-
const stepStatusMap = /* @__PURE__ */ new Map();
|
|
37
|
-
const stepDataMap = /* @__PURE__ */ new Map();
|
|
38
|
-
let currentStepId;
|
|
39
|
-
for (const log of executionLogs) {
|
|
40
|
-
const context = log.context;
|
|
41
|
-
if (!context || context.type !== "workflow") continue;
|
|
42
|
-
if (isStepStartedContext(context)) {
|
|
43
|
-
executedSteps.add(context.stepId);
|
|
44
|
-
executedStepsOrdered.push(context.stepId);
|
|
45
|
-
currentStepId = context.stepId;
|
|
46
|
-
stepStatusMap.set(context.stepId, "running");
|
|
47
|
-
stepDataMap.set(context.stepId, {
|
|
48
|
-
status: "running",
|
|
49
|
-
input: context.input
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (isConditionalRouteContext(context)) {
|
|
53
|
-
const edgeId = `edge-${context.stepId}-${context.target}`;
|
|
54
|
-
takenEdges.add(edgeId);
|
|
55
|
-
}
|
|
56
|
-
if (isStepCompletedContext(context)) {
|
|
57
|
-
stepStatusMap.set(context.stepId, "completed");
|
|
58
|
-
const existingData = stepDataMap.get(context.stepId);
|
|
59
|
-
stepDataMap.set(context.stepId, {
|
|
60
|
-
...existingData,
|
|
61
|
-
status: "completed",
|
|
62
|
-
duration: context.duration,
|
|
63
|
-
output: context.output
|
|
64
|
-
});
|
|
65
|
-
if (context.stepId === currentStepId) {
|
|
66
|
-
currentStepId = void 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (isStepFailedContext(context)) {
|
|
70
|
-
stepStatusMap.set(context.stepId, "failed");
|
|
71
|
-
const existingData = stepDataMap.get(context.stepId);
|
|
72
|
-
stepDataMap.set(context.stepId, {
|
|
73
|
-
...existingData,
|
|
74
|
-
status: "failed",
|
|
75
|
-
duration: context.duration,
|
|
76
|
-
error: context.error
|
|
77
|
-
});
|
|
78
|
-
if (context.stepId === currentStepId) {
|
|
79
|
-
currentStepId = void 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
for (let i = 0; i < executedStepsOrdered.length - 1; i++) {
|
|
84
|
-
const sourceId = executedStepsOrdered[i];
|
|
85
|
-
const targetId = executedStepsOrdered[i + 1];
|
|
86
|
-
const step = workflowDefinition.steps.find((s) => s.id === sourceId);
|
|
87
|
-
if (step?.next?.type === "linear") {
|
|
88
|
-
const edgeId = `edge-${sourceId}-${targetId}`;
|
|
89
|
-
takenEdges.add(edgeId);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
executedSteps,
|
|
94
|
-
executedStepsOrdered,
|
|
95
|
-
takenEdges,
|
|
96
|
-
currentStepId,
|
|
97
|
-
stepStatusMap,
|
|
98
|
-
stepDataMap
|
|
99
|
-
};
|
|
100
|
-
}, [executionLogs, workflowDefinition]);
|
|
101
|
-
}
|
|
102
|
-
function useTimelineData(execution, resourceDefinition) {
|
|
103
|
-
return useMemo(() => {
|
|
104
|
-
const workflowSteps = resourceDefinition.steps;
|
|
105
|
-
if (!execution || !resourceDefinition) {
|
|
106
|
-
return void 0;
|
|
107
|
-
}
|
|
108
|
-
const stepMap = /* @__PURE__ */ new Map();
|
|
109
|
-
const stepNameLookup = /* @__PURE__ */ new Map();
|
|
110
|
-
workflowSteps.forEach((step) => {
|
|
111
|
-
stepNameLookup.set(step.id, step.name);
|
|
112
|
-
});
|
|
113
|
-
let workflowStartTime;
|
|
114
|
-
let workflowEndTime;
|
|
115
|
-
let activeStepId = null;
|
|
116
|
-
execution.executionLogs.forEach((log) => {
|
|
117
|
-
const context = log.context;
|
|
118
|
-
const ensureStepAndAddLog = (stepId) => {
|
|
119
|
-
if (!stepMap.has(stepId)) {
|
|
120
|
-
const stepName = stepNameLookup.get(stepId) || stepId;
|
|
121
|
-
stepMap.set(stepId, {
|
|
122
|
-
stepId,
|
|
123
|
-
stepName,
|
|
124
|
-
status: "pending",
|
|
125
|
-
logs: []
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
const step = stepMap.get(stepId);
|
|
129
|
-
const workflowLog = toWorkflowLogMessage(log);
|
|
130
|
-
if (workflowLog) {
|
|
131
|
-
step.logs.push(workflowLog);
|
|
132
|
-
}
|
|
133
|
-
return step;
|
|
134
|
-
};
|
|
135
|
-
if (!context || context.type !== "workflow") {
|
|
136
|
-
if (activeStepId) {
|
|
137
|
-
ensureStepAndAddLog(activeStepId);
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (isStepStartedContext(context)) {
|
|
142
|
-
activeStepId = context.stepId;
|
|
143
|
-
const step = ensureStepAndAddLog(context.stepId);
|
|
144
|
-
step.status = "running";
|
|
145
|
-
step.startTime = context.startTime;
|
|
146
|
-
step.input = context.input;
|
|
147
|
-
if (!workflowStartTime) workflowStartTime = context.startTime;
|
|
148
|
-
} else if (isStepCompletedContext(context)) {
|
|
149
|
-
const step = ensureStepAndAddLog(context.stepId);
|
|
150
|
-
step.status = "completed";
|
|
151
|
-
step.startTime = context.startTime;
|
|
152
|
-
step.endTime = context.endTime;
|
|
153
|
-
step.duration = context.duration;
|
|
154
|
-
step.output = context.output;
|
|
155
|
-
workflowEndTime = context.endTime;
|
|
156
|
-
activeStepId = null;
|
|
157
|
-
} else if (isStepFailedContext(context)) {
|
|
158
|
-
const step = ensureStepAndAddLog(context.stepId);
|
|
159
|
-
step.status = "failed";
|
|
160
|
-
step.startTime = context.startTime;
|
|
161
|
-
step.endTime = context.endTime;
|
|
162
|
-
step.duration = context.duration;
|
|
163
|
-
step.error = context.error;
|
|
164
|
-
workflowEndTime = context.endTime;
|
|
165
|
-
activeStepId = null;
|
|
166
|
-
} else if (isConditionalRouteContext(context)) {
|
|
167
|
-
ensureStepAndAddLog(context.stepId);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
const steps = Array.from(stepMap.values());
|
|
171
|
-
const isRunning = execution.status === "running";
|
|
172
|
-
const totalDuration = workflowStartTime && workflowEndTime ? workflowEndTime - workflowStartTime : 0;
|
|
173
|
-
return {
|
|
174
|
-
steps,
|
|
175
|
-
totalDuration,
|
|
176
|
-
isRunning
|
|
177
|
-
};
|
|
178
|
-
}, [execution, resourceDefinition]);
|
|
179
|
-
}
|
|
180
|
-
function useAgentIterationData(execution, resourceDefinition) {
|
|
181
|
-
return useMemo(() => {
|
|
182
|
-
if (!execution || !execution.executionLogs) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
const iterations = /* @__PURE__ */ new Map();
|
|
186
|
-
let currentIteration = null;
|
|
187
|
-
let totalDuration;
|
|
188
|
-
let status = execution.status;
|
|
189
|
-
const initialization = {
|
|
190
|
-
type: "initialization",
|
|
191
|
-
status: "pending"
|
|
192
|
-
};
|
|
193
|
-
const completion = {
|
|
194
|
-
type: "completion",
|
|
195
|
-
status: "pending"
|
|
196
|
-
};
|
|
197
|
-
for (const log of execution.executionLogs) {
|
|
198
|
-
const context = log.context;
|
|
199
|
-
if (context?.type !== "agent" || !("lifecycle" in context)) continue;
|
|
200
|
-
if (isLifecycleEvent(context)) {
|
|
201
|
-
const { lifecycle, stage } = context;
|
|
202
|
-
if (lifecycle === "initialization") {
|
|
203
|
-
initialization.timestamp = log.timestamp;
|
|
204
|
-
if (stage === "started") {
|
|
205
|
-
initialization.status = "running";
|
|
206
|
-
initialization.startTime = context.startTime;
|
|
207
|
-
} else if (stage === "completed") {
|
|
208
|
-
initialization.status = "completed";
|
|
209
|
-
initialization.endTime = context.endTime;
|
|
210
|
-
initialization.duration = context.duration;
|
|
211
|
-
} else if (stage === "failed") {
|
|
212
|
-
initialization.status = "failed";
|
|
213
|
-
initialization.endTime = context.endTime;
|
|
214
|
-
initialization.duration = context.duration;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (lifecycle === "iteration" && "iteration" in context) {
|
|
218
|
-
const iterationNum = context.iteration;
|
|
219
|
-
if (stage === "started") {
|
|
220
|
-
if (!iterations.has(iterationNum)) {
|
|
221
|
-
iterations.set(iterationNum, {
|
|
222
|
-
iterationNumber: iterationNum,
|
|
223
|
-
status: "running",
|
|
224
|
-
iterationEvents: [],
|
|
225
|
-
subActivities: [],
|
|
226
|
-
timestamp: context.startTime,
|
|
227
|
-
startTime: context.startTime
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
currentIteration = iterationNum;
|
|
231
|
-
} else if (stage === "completed") {
|
|
232
|
-
const iteration = iterations.get(iterationNum);
|
|
233
|
-
if (iteration) {
|
|
234
|
-
iteration.status = "completed";
|
|
235
|
-
iteration.endTime = context.endTime;
|
|
236
|
-
iteration.duration = context.duration;
|
|
237
|
-
}
|
|
238
|
-
} else if (stage === "failed") {
|
|
239
|
-
const iteration = iterations.get(iterationNum);
|
|
240
|
-
if (iteration) {
|
|
241
|
-
iteration.status = "failed";
|
|
242
|
-
iteration.endTime = context.endTime;
|
|
243
|
-
if (context.duration) {
|
|
244
|
-
iteration.duration = context.duration;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (lifecycle === "completion") {
|
|
250
|
-
completion.timestamp = log.timestamp;
|
|
251
|
-
if (stage === "started") {
|
|
252
|
-
completion.status = "running";
|
|
253
|
-
completion.startTime = context.startTime;
|
|
254
|
-
} else if (stage === "completed") {
|
|
255
|
-
completion.status = "completed";
|
|
256
|
-
completion.endTime = context.endTime;
|
|
257
|
-
completion.duration = context.duration;
|
|
258
|
-
} else if (stage === "failed") {
|
|
259
|
-
completion.status = "failed";
|
|
260
|
-
completion.endTime = context.endTime;
|
|
261
|
-
completion.duration = context.duration;
|
|
262
|
-
status = "failed";
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
if (isIterationEvent(context)) {
|
|
267
|
-
const iterationNum = context.iteration;
|
|
268
|
-
if (iterationNum === 0) {
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
const iteration = iterations.get(iterationNum);
|
|
272
|
-
if (iteration) {
|
|
273
|
-
iteration.iterationEvents.push(context);
|
|
274
|
-
if ("startTime" in context && "endTime" in context && "duration" in context) {
|
|
275
|
-
iteration.subActivities.push({
|
|
276
|
-
type: context.eventType,
|
|
277
|
-
startTime: context.startTime,
|
|
278
|
-
endTime: context.endTime,
|
|
279
|
-
duration: context.duration,
|
|
280
|
-
details: context
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if (isToolCallEvent(context)) {
|
|
286
|
-
const iterationNum = context.iteration;
|
|
287
|
-
if (iterationNum === 0) {
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
const iteration = iterations.get(iterationNum);
|
|
291
|
-
if (iteration) {
|
|
292
|
-
iteration.subActivities.push({
|
|
293
|
-
type: "tool-call",
|
|
294
|
-
startTime: context.startTime,
|
|
295
|
-
endTime: context.endTime,
|
|
296
|
-
duration: context.duration,
|
|
297
|
-
details: context
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
const iterationArray = Array.from(iterations.values()).sort((a, b) => a.iterationNumber - b.iterationNumber).map((iteration) => ({
|
|
303
|
-
...iteration,
|
|
304
|
-
subActivities: iteration.subActivities.sort((a, b) => a.startTime - b.startTime)
|
|
305
|
-
}));
|
|
306
|
-
if (initialization.duration && completion.duration) {
|
|
307
|
-
const iterationsDuration = iterationArray.reduce((sum, iter) => sum + (iter.duration || 0), 0);
|
|
308
|
-
totalDuration = initialization.duration + iterationsDuration + completion.duration;
|
|
309
|
-
}
|
|
310
|
-
return {
|
|
311
|
-
initialization,
|
|
312
|
-
iterations: iterationArray,
|
|
313
|
-
completion,
|
|
314
|
-
currentIteration: status === "running" ? currentIteration : null,
|
|
315
|
-
totalIterations: iterationArray.length,
|
|
316
|
-
totalDuration,
|
|
317
|
-
status
|
|
318
|
-
};
|
|
319
|
-
}, [execution, resourceDefinition]);
|
|
320
|
-
}
|
|
321
|
-
var NODE_WIDTH = 220;
|
|
322
|
-
var NODE_HEIGHT = 140;
|
|
323
|
-
var RANK_SEP = 100;
|
|
324
|
-
var NODE_SEP = 40;
|
|
325
|
-
function buildEdges(steps) {
|
|
326
|
-
const edges = [];
|
|
327
|
-
for (const step of steps) {
|
|
328
|
-
if (step.next === null) continue;
|
|
329
|
-
if (step.next.type === "linear" && step.next.target) {
|
|
330
|
-
edges.push({
|
|
331
|
-
id: `edge-${step.id}-${step.next.target}`,
|
|
332
|
-
source: step.id,
|
|
333
|
-
target: step.next.target,
|
|
334
|
-
type: "workflowStep",
|
|
335
|
-
data: {
|
|
336
|
-
edgeType: "linear",
|
|
337
|
-
label: "next"
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
} else if (step.next.type === "conditional") {
|
|
341
|
-
const routes = step.next.routes || [];
|
|
342
|
-
const defaultTarget = step.next.default;
|
|
343
|
-
for (const route of routes) {
|
|
344
|
-
edges.push({
|
|
345
|
-
id: `edge-${step.id}-${route.target}`,
|
|
346
|
-
source: step.id,
|
|
347
|
-
target: route.target,
|
|
348
|
-
type: "workflowStep",
|
|
349
|
-
data: {
|
|
350
|
-
edgeType: "conditional",
|
|
351
|
-
label: "route"
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
if (defaultTarget) {
|
|
356
|
-
edges.push({
|
|
357
|
-
id: `edge-${step.id}-${defaultTarget}-default`,
|
|
358
|
-
source: step.id,
|
|
359
|
-
target: defaultTarget,
|
|
360
|
-
type: "workflowStep",
|
|
361
|
-
data: {
|
|
362
|
-
edgeType: "default",
|
|
363
|
-
label: "default"
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return edges;
|
|
370
|
-
}
|
|
371
|
-
var MIN_GRAPH_HEIGHT = 400;
|
|
372
|
-
var MAX_GRAPH_HEIGHT = 600;
|
|
373
|
-
var GRAPH_PADDING = 80;
|
|
374
|
-
function useWorkflowStepsLayout(workflow) {
|
|
375
|
-
return useMemo(() => {
|
|
376
|
-
if (!workflow || workflow.steps.length === 0) {
|
|
377
|
-
return { nodes: [], edges: [], graphHeight: MIN_GRAPH_HEIGHT };
|
|
378
|
-
}
|
|
379
|
-
const edges = buildEdges(workflow.steps);
|
|
380
|
-
const hasOutgoing = /* @__PURE__ */ new Set();
|
|
381
|
-
for (const edge of edges) {
|
|
382
|
-
hasOutgoing.add(edge.source);
|
|
383
|
-
}
|
|
384
|
-
const dagreGraph = new dagre.graphlib.Graph();
|
|
385
|
-
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
|
386
|
-
dagreGraph.setGraph({
|
|
387
|
-
rankdir: "LR",
|
|
388
|
-
ranksep: RANK_SEP,
|
|
389
|
-
nodesep: NODE_SEP,
|
|
390
|
-
marginx: 50,
|
|
391
|
-
marginy: 50
|
|
392
|
-
});
|
|
393
|
-
workflow.steps.forEach((step) => {
|
|
394
|
-
dagreGraph.setNode(step.id, {
|
|
395
|
-
width: NODE_WIDTH,
|
|
396
|
-
height: NODE_HEIGHT
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
edges.forEach((edge) => {
|
|
400
|
-
dagreGraph.setEdge(edge.source, edge.target);
|
|
401
|
-
});
|
|
402
|
-
dagre.layout(dagreGraph);
|
|
403
|
-
const nodes = workflow.steps.map((step) => {
|
|
404
|
-
const dagreNode = dagreGraph.node(step.id);
|
|
405
|
-
const isConditional = step.next?.type === "conditional";
|
|
406
|
-
const routeCount = isConditional ? (step.next?.routes?.length || 0) + (step.next?.default ? 1 : 0) : 0;
|
|
407
|
-
return {
|
|
408
|
-
id: step.id,
|
|
409
|
-
type: "workflowStep",
|
|
410
|
-
position: {
|
|
411
|
-
x: dagreNode.x - NODE_WIDTH / 2,
|
|
412
|
-
y: dagreNode.y - NODE_HEIGHT / 2
|
|
413
|
-
},
|
|
414
|
-
data: {
|
|
415
|
-
id: step.id,
|
|
416
|
-
name: step.name,
|
|
417
|
-
description: step.description,
|
|
418
|
-
isEntryPoint: step.id === workflow.entryPoint,
|
|
419
|
-
isEndNode: !hasOutgoing.has(step.id),
|
|
420
|
-
isConditional,
|
|
421
|
-
routeCount
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
});
|
|
425
|
-
let minY = Infinity;
|
|
426
|
-
let maxY = -Infinity;
|
|
427
|
-
for (const node of nodes) {
|
|
428
|
-
minY = Math.min(minY, node.position.y);
|
|
429
|
-
maxY = Math.max(maxY, node.position.y + NODE_HEIGHT);
|
|
430
|
-
}
|
|
431
|
-
const rawHeight = maxY - minY + GRAPH_PADDING;
|
|
432
|
-
const graphHeight = Math.max(MIN_GRAPH_HEIGHT, Math.min(MAX_GRAPH_HEIGHT, rawHeight));
|
|
433
|
-
return { nodes, edges, graphHeight };
|
|
434
|
-
}, [workflow]);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// src/execution/utils/statusColors.ts
|
|
438
|
-
var STATUS_COLORS = {
|
|
439
|
-
completed: {
|
|
440
|
-
color: "var(--color-success)",
|
|
441
|
-
badge: "green"
|
|
442
|
-
},
|
|
443
|
-
failed: {
|
|
444
|
-
color: "var(--color-error)",
|
|
445
|
-
badge: "red"
|
|
446
|
-
},
|
|
447
|
-
running: {
|
|
448
|
-
color: "var(--color-primary)",
|
|
449
|
-
badge: "blue"
|
|
450
|
-
},
|
|
451
|
-
pending: {
|
|
452
|
-
color: "var(--color-text-dimmed)",
|
|
453
|
-
badge: "gray"
|
|
454
|
-
},
|
|
455
|
-
warning: {
|
|
456
|
-
color: "var(--color-warning)",
|
|
457
|
-
badge: "yellow"
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
function getStatusColors(status) {
|
|
461
|
-
return STATUS_COLORS[status];
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// src/execution/utils/edgeUtils.ts
|
|
465
|
-
function getEdgeColor({ selected, sourceStatus }) {
|
|
466
|
-
if (selected) {
|
|
467
|
-
return "var(--color-primary)";
|
|
468
|
-
}
|
|
469
|
-
return STATUS_COLORS[sourceStatus].color;
|
|
470
|
-
}
|
|
471
|
-
function getEdgeOpacity({ sourceStatus }) {
|
|
472
|
-
switch (sourceStatus) {
|
|
473
|
-
case "completed":
|
|
474
|
-
return 0.8;
|
|
475
|
-
case "warning":
|
|
476
|
-
return 0.8;
|
|
477
|
-
case "running":
|
|
478
|
-
return 1;
|
|
479
|
-
case "failed":
|
|
480
|
-
return 0.6;
|
|
481
|
-
case "pending":
|
|
482
|
-
default:
|
|
483
|
-
return 0.3;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function shouldAnimateEdge(sourceStatus, targetStatus) {
|
|
487
|
-
return sourceStatus === "running" || targetStatus === "running";
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// src/execution/hooks/useUnifiedWorkflowLayout.ts
|
|
491
|
-
function getStepStatus(stepId, executionPath) {
|
|
492
|
-
if (!executionPath) return void 0;
|
|
493
|
-
if (executionPath.currentStepId === stepId) {
|
|
494
|
-
return "running";
|
|
495
|
-
}
|
|
496
|
-
if (executionPath.executedSteps.has(stepId)) {
|
|
497
|
-
const status = executionPath.stepStatusMap?.get(stepId);
|
|
498
|
-
return status || "completed";
|
|
499
|
-
}
|
|
500
|
-
return "pending";
|
|
501
|
-
}
|
|
502
|
-
function calculateDimState(stepId, executionPath, entryPointId, hasExecutionData, mode) {
|
|
503
|
-
if (mode === "definition") {
|
|
504
|
-
return false;
|
|
505
|
-
}
|
|
506
|
-
if (!hasExecutionData) {
|
|
507
|
-
return stepId !== entryPointId;
|
|
508
|
-
}
|
|
509
|
-
return !executionPath?.executedSteps.has(stepId);
|
|
510
|
-
}
|
|
511
|
-
function useUnifiedWorkflowLayout(workflow, executionPath, selectedStepId, mode = "execution") {
|
|
512
|
-
const { nodes: baseNodes, edges: baseEdges, graphHeight } = useWorkflowStepsLayout(workflow);
|
|
513
|
-
return useMemo(() => {
|
|
514
|
-
if (!workflow || baseNodes.length === 0) {
|
|
515
|
-
return { nodes: [], edges: [], graphHeight };
|
|
516
|
-
}
|
|
517
|
-
const entryPointId = workflow.entryPoint;
|
|
518
|
-
const hasExecutionData = !!executionPath && executionPath.executedSteps.size > 0;
|
|
519
|
-
const nodes = baseNodes.map((node) => {
|
|
520
|
-
const stepId = node.data.id;
|
|
521
|
-
const executionStatus = getStepStatus(stepId, executionPath);
|
|
522
|
-
const isExecuted = executionPath?.executedSteps.has(stepId) ?? false;
|
|
523
|
-
const isDimmed = calculateDimState(stepId, executionPath, entryPointId, hasExecutionData, mode);
|
|
524
|
-
const isSelected = selectedStepId === stepId;
|
|
525
|
-
const stepData = executionPath?.stepDataMap?.get(stepId);
|
|
526
|
-
return {
|
|
527
|
-
...node,
|
|
528
|
-
type: "unifiedWorkflowNode",
|
|
529
|
-
data: {
|
|
530
|
-
// Structure data
|
|
531
|
-
id: node.data.id,
|
|
532
|
-
name: node.data.name,
|
|
533
|
-
description: node.data.description,
|
|
534
|
-
isEntryPoint: node.data.isEntryPoint,
|
|
535
|
-
isEndNode: node.data.isEndNode,
|
|
536
|
-
isConditional: node.data.isConditional,
|
|
537
|
-
routeCount: node.data.routeCount,
|
|
538
|
-
// Execution state
|
|
539
|
-
executionStatus,
|
|
540
|
-
duration: stepData?.duration,
|
|
541
|
-
input: stepData?.input,
|
|
542
|
-
output: stepData?.output,
|
|
543
|
-
error: stepData?.error,
|
|
544
|
-
logs: stepData?.logs,
|
|
545
|
-
// Computed UI state
|
|
546
|
-
isExecuted,
|
|
547
|
-
isDimmed,
|
|
548
|
-
isSelected
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
|
-
});
|
|
552
|
-
const edges = baseEdges.map((edge) => {
|
|
553
|
-
const wasTaken = executionPath?.takenEdges.has(edge.id) ?? false;
|
|
554
|
-
const sourceStatus = getStepStatus(edge.source, executionPath);
|
|
555
|
-
const targetStatus = getStepStatus(edge.target, executionPath);
|
|
556
|
-
const isDimmed = mode === "execution" && hasExecutionData && !wasTaken;
|
|
557
|
-
const isAnimated = wasTaken && sourceStatus && targetStatus ? shouldAnimateEdge(sourceStatus, targetStatus) : false;
|
|
558
|
-
return {
|
|
559
|
-
...edge,
|
|
560
|
-
type: "unifiedWorkflowEdge",
|
|
561
|
-
data: {
|
|
562
|
-
// Structure data
|
|
563
|
-
edgeType: edge.data?.edgeType ?? "linear",
|
|
564
|
-
label: edge.data?.label,
|
|
565
|
-
// Execution state
|
|
566
|
-
wasTaken,
|
|
567
|
-
sourceStatus,
|
|
568
|
-
targetStatus,
|
|
569
|
-
// Computed UI state
|
|
570
|
-
isDimmed,
|
|
571
|
-
isAnimated
|
|
572
|
-
},
|
|
573
|
-
animated: isAnimated
|
|
574
|
-
};
|
|
575
|
-
});
|
|
576
|
-
return { nodes, edges, graphHeight };
|
|
577
|
-
}, [baseNodes, baseEdges, workflow, executionPath, selectedStepId, graphHeight, mode]);
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// src/execution/components/constants.ts
|
|
581
|
-
var TIMELINE_CONSTANTS = {
|
|
582
|
-
// Bar dimensions
|
|
583
|
-
BAR_HEIGHT: 24,
|
|
584
|
-
ROW_GAP: 8,
|
|
585
|
-
MIN_BAR_WIDTH_PERCENT: 0.5,
|
|
586
|
-
// Minimum bar width as percentage (0.5% = ~8px on typical screen)
|
|
587
|
-
// Label column
|
|
588
|
-
LABEL_WIDTH: 200,
|
|
589
|
-
// Indentation for nested rows
|
|
590
|
-
INDENT_SIZE: 16,
|
|
591
|
-
// Container padding
|
|
592
|
-
CONTAINER_PADDING: 16,
|
|
593
|
-
CONTAINER_BORDER_RADIUS: 8
|
|
594
|
-
};
|
|
595
|
-
var SHARED_VIZ_CONSTANTS = {
|
|
596
|
-
// Node dimensions
|
|
597
|
-
NODE_WIDTH: 160,
|
|
598
|
-
NODE_SPACING: 220,
|
|
599
|
-
HANDLE_SIZE: 8,
|
|
600
|
-
// Zoom settings
|
|
601
|
-
MIN_ZOOM: 0.5,
|
|
602
|
-
MAX_ZOOM: 2
|
|
603
|
-
};
|
|
604
|
-
var CONTAINER_CONSTANTS = {
|
|
605
|
-
CONTAINER_HEIGHT: 400
|
|
606
|
-
};
|
|
607
|
-
var AGENT_CONSTANTS = {
|
|
608
|
-
// Inherited from shared constants
|
|
609
|
-
...SHARED_VIZ_CONSTANTS,
|
|
610
|
-
// Agent-specific layout
|
|
611
|
-
NODE_HEIGHT: 140,
|
|
612
|
-
CONTAINER_HEIGHT: 430,
|
|
613
|
-
FIT_VIEW_PADDING: 0.2,
|
|
614
|
-
// Icon and circle sizes
|
|
615
|
-
ICON_SIZE: 16,
|
|
616
|
-
STATUS_ICON_SIZE: 16,
|
|
617
|
-
CIRCLE_SIZE: 40,
|
|
618
|
-
// Animation
|
|
619
|
-
PULSE_DURATION: "2s",
|
|
620
|
-
TRANSITION_DURATION: "0.2s"
|
|
621
|
-
};
|
|
622
|
-
var WORKFLOW_CONSTANTS = {
|
|
623
|
-
// Inherited from shared constants
|
|
624
|
-
...SHARED_VIZ_CONSTANTS,
|
|
625
|
-
// Workflow-specific layout
|
|
626
|
-
FIT_VIEW_PADDING: 0.4,
|
|
627
|
-
// Workflow-specific dimensions
|
|
628
|
-
ICON_SIZE: 20,
|
|
629
|
-
CIRCLE_SIZE: 40,
|
|
630
|
-
// Animation
|
|
631
|
-
SPIN_DURATION: "1s"
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
// src/execution/hooks/useReactFlowAgent.ts
|
|
635
|
-
function useReactFlowAgent(iterationData, _resourceDefinition, selectedIterationId, liveExecutions, selectedExecutionId) {
|
|
636
|
-
return useMemo(() => {
|
|
637
|
-
if (!iterationData) {
|
|
638
|
-
return { nodes: [], edges: [] };
|
|
639
|
-
}
|
|
640
|
-
const isLive = selectedExecutionId ? liveExecutions.has(selectedExecutionId) : false;
|
|
641
|
-
const nodes = [];
|
|
642
|
-
const edges = [];
|
|
643
|
-
let xPosition = 0;
|
|
644
|
-
const yPosition = AGENT_CONSTANTS.CONTAINER_HEIGHT / 2;
|
|
645
|
-
nodes.push({
|
|
646
|
-
id: "initialization",
|
|
647
|
-
type: "agentIteration",
|
|
648
|
-
position: { x: xPosition, y: yPosition },
|
|
649
|
-
data: {
|
|
650
|
-
label: "Initialization",
|
|
651
|
-
nodeType: "initialization",
|
|
652
|
-
status: iterationData.initialization.status,
|
|
653
|
-
duration: iterationData.initialization.duration,
|
|
654
|
-
isLive: isLive && iterationData.initialization.status === "running"
|
|
655
|
-
},
|
|
656
|
-
selected: selectedIterationId === "initialization",
|
|
657
|
-
origin: [0.5, 0.5]
|
|
658
|
-
});
|
|
659
|
-
xPosition += AGENT_CONSTANTS.NODE_SPACING;
|
|
660
|
-
for (let i = 0; i < iterationData.iterations.length; i++) {
|
|
661
|
-
const iteration = iterationData.iterations[i];
|
|
662
|
-
const isSelected = selectedIterationId === iteration.iterationNumber;
|
|
663
|
-
const isCurrentIteration = iterationData.currentIteration === iteration.iterationNumber;
|
|
664
|
-
nodes.push({
|
|
665
|
-
id: `iteration-${iteration.iterationNumber}`,
|
|
666
|
-
type: "agentIteration",
|
|
667
|
-
position: { x: xPosition, y: yPosition },
|
|
668
|
-
data: {
|
|
669
|
-
iterationNumber: iteration.iterationNumber,
|
|
670
|
-
nodeType: "iteration",
|
|
671
|
-
status: iteration.status,
|
|
672
|
-
reasoningCount: iteration.iterationEvents.filter((e) => e.eventType === "reasoning").length,
|
|
673
|
-
actionCount: iteration.iterationEvents.filter((e) => e.eventType === "action").length,
|
|
674
|
-
duration: iteration.duration,
|
|
675
|
-
isLive: isLive && isCurrentIteration
|
|
676
|
-
},
|
|
677
|
-
selected: isSelected,
|
|
678
|
-
origin: [0.5, 0.5]
|
|
679
|
-
});
|
|
680
|
-
xPosition += AGENT_CONSTANTS.NODE_SPACING;
|
|
681
|
-
}
|
|
682
|
-
const completionStarted = iterationData.completion.status !== "pending";
|
|
683
|
-
if (completionStarted) {
|
|
684
|
-
nodes.push({
|
|
685
|
-
id: "completion",
|
|
686
|
-
type: "agentIteration",
|
|
687
|
-
position: { x: xPosition, y: yPosition },
|
|
688
|
-
data: {
|
|
689
|
-
label: "Completion",
|
|
690
|
-
nodeType: "completion",
|
|
691
|
-
status: iterationData.completion.status,
|
|
692
|
-
duration: iterationData.completion.duration,
|
|
693
|
-
isLive: isLive && iterationData.completion.status === "running"
|
|
694
|
-
},
|
|
695
|
-
selected: selectedIterationId === "completion",
|
|
696
|
-
origin: [0.5, 0.5]
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
if (iterationData.iterations.length > 0 && iterationData.initialization.status !== "failed") {
|
|
700
|
-
edges.push({
|
|
701
|
-
id: "edge-init-iter1",
|
|
702
|
-
source: "initialization",
|
|
703
|
-
target: `iteration-${iterationData.iterations[0].iterationNumber}`,
|
|
704
|
-
type: "agentIteration",
|
|
705
|
-
data: {
|
|
706
|
-
sourceStatus: iterationData.initialization.status,
|
|
707
|
-
targetStatus: iterationData.iterations[0].status
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
} else if (iterationData.iterations.length === 0 && completionStarted) {
|
|
711
|
-
edges.push({
|
|
712
|
-
id: "edge-init-completion",
|
|
713
|
-
source: "initialization",
|
|
714
|
-
target: "completion",
|
|
715
|
-
type: "agentIteration",
|
|
716
|
-
data: {
|
|
717
|
-
sourceStatus: iterationData.initialization.status,
|
|
718
|
-
targetStatus: iterationData.completion.status
|
|
719
|
-
}
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
for (let i = 0; i < iterationData.iterations.length - 1; i++) {
|
|
723
|
-
const sourceIteration = iterationData.iterations[i];
|
|
724
|
-
const targetIteration = iterationData.iterations[i + 1];
|
|
725
|
-
edges.push({
|
|
726
|
-
id: `edge-${sourceIteration.iterationNumber}-${targetIteration.iterationNumber}`,
|
|
727
|
-
source: `iteration-${sourceIteration.iterationNumber}`,
|
|
728
|
-
target: `iteration-${targetIteration.iterationNumber}`,
|
|
729
|
-
type: "agentIteration",
|
|
730
|
-
data: {
|
|
731
|
-
sourceStatus: sourceIteration.status,
|
|
732
|
-
targetStatus: targetIteration.status
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
if (iterationData.iterations.length > 0 && completionStarted) {
|
|
737
|
-
const lastIteration = iterationData.iterations[iterationData.iterations.length - 1];
|
|
738
|
-
edges.push({
|
|
739
|
-
id: "edge-last-completion",
|
|
740
|
-
source: `iteration-${lastIteration.iterationNumber}`,
|
|
741
|
-
target: "completion",
|
|
742
|
-
type: "agentIteration",
|
|
743
|
-
data: {
|
|
744
|
-
sourceStatus: lastIteration.status,
|
|
745
|
-
targetStatus: iterationData.completion.status
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
return { nodes, edges };
|
|
750
|
-
}, [iterationData, selectedIterationId, liveExecutions, selectedExecutionId]);
|
|
751
|
-
}
|
|
752
|
-
function ExecutionStatusBadge({
|
|
753
|
-
status,
|
|
754
|
-
size = "sm",
|
|
755
|
-
variant = "light",
|
|
756
|
-
showLoader = true
|
|
757
|
-
}) {
|
|
758
|
-
const statusColors = STATUS_COLORS[status];
|
|
759
|
-
const isRunning = status === "running" && showLoader;
|
|
760
|
-
return /* @__PURE__ */ jsx(
|
|
761
|
-
Badge,
|
|
762
|
-
{
|
|
763
|
-
color: statusColors.badge,
|
|
764
|
-
size,
|
|
765
|
-
variant,
|
|
766
|
-
leftSection: isRunning ? /* @__PURE__ */ jsx(Loader, { size: 10, color: statusColors.badge }) : void 0,
|
|
767
|
-
children: status.charAt(0).toUpperCase() + status.slice(1)
|
|
768
|
-
}
|
|
769
|
-
);
|
|
770
|
-
}
|
|
771
|
-
function getRateColor(rate) {
|
|
772
|
-
if (rate >= 95) return "var(--color-success)";
|
|
773
|
-
if (rate >= 80) return "var(--color-warning)";
|
|
774
|
-
return "var(--color-error)";
|
|
775
|
-
}
|
|
776
|
-
function getMantineRateColor(rate) {
|
|
777
|
-
if (rate >= 95) return "green";
|
|
778
|
-
if (rate >= 80) return "yellow";
|
|
779
|
-
return "red";
|
|
780
|
-
}
|
|
781
|
-
function ExecutionStats({
|
|
782
|
-
totalExecutions,
|
|
783
|
-
successCount,
|
|
784
|
-
failureCount,
|
|
785
|
-
warningCount,
|
|
786
|
-
successRate,
|
|
787
|
-
align = "flex-end",
|
|
788
|
-
compact = false
|
|
789
|
-
}) {
|
|
790
|
-
if (totalExecutions === 0 && !compact) {
|
|
791
|
-
return null;
|
|
792
|
-
}
|
|
793
|
-
if (compact && totalExecutions === 0) {
|
|
794
|
-
return /* @__PURE__ */ jsxs(Group, { gap: 10, wrap: "nowrap", style: { width: "100%" }, children: [
|
|
795
|
-
/* @__PURE__ */ jsx(Text, { size: "md", fw: 700, ff: "monospace", c: "dimmed", style: { minWidth: 42 }, children: "\u2014" }),
|
|
796
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: "No recent executions" })
|
|
797
|
-
] });
|
|
798
|
-
}
|
|
799
|
-
if (compact) {
|
|
800
|
-
return /* @__PURE__ */ jsxs(Group, { gap: 10, wrap: "nowrap", style: { width: "100%" }, children: [
|
|
801
|
-
/* @__PURE__ */ jsxs(Group, { gap: 8, wrap: "nowrap", children: [
|
|
802
|
-
/* @__PURE__ */ jsxs(Text, { size: "md", fw: 700, ff: "monospace", style: { color: getRateColor(successRate), minWidth: 42 }, children: [
|
|
803
|
-
successRate,
|
|
804
|
-
"%"
|
|
805
|
-
] }),
|
|
806
|
-
/* @__PURE__ */ jsxs(Group, { gap: 5, wrap: "nowrap", children: [
|
|
807
|
-
/* @__PURE__ */ jsx("div", { style: { width: 7, height: 7, borderRadius: "50%", background: "var(--color-success)" } }),
|
|
808
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, c: "green", children: successCount })
|
|
809
|
-
] }),
|
|
810
|
-
failureCount > 0 && /* @__PURE__ */ jsxs(Group, { gap: 5, wrap: "nowrap", children: [
|
|
811
|
-
/* @__PURE__ */ jsx("div", { style: { width: 7, height: 7, borderRadius: "50%", background: "var(--color-error)" } }),
|
|
812
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, c: "red", children: failureCount })
|
|
813
|
-
] })
|
|
814
|
-
] }),
|
|
815
|
-
/* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: [
|
|
816
|
-
totalExecutions,
|
|
817
|
-
" ",
|
|
818
|
-
totalExecutions === 1 ? "run" : "runs"
|
|
819
|
-
] })
|
|
820
|
-
] });
|
|
821
|
-
}
|
|
822
|
-
return /* @__PURE__ */ jsxs(Stack, { gap: 2, align, style: { whiteSpace: "nowrap" }, children: [
|
|
823
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "blue", children: [
|
|
824
|
-
totalExecutions,
|
|
825
|
-
" ",
|
|
826
|
-
totalExecutions === 1 ? "execution" : "executions"
|
|
827
|
-
] }),
|
|
828
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "green", children: [
|
|
829
|
-
successCount,
|
|
830
|
-
" success"
|
|
831
|
-
] }),
|
|
832
|
-
warningCount != null && warningCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "yellow", children: [
|
|
833
|
-
warningCount,
|
|
834
|
-
" warning"
|
|
835
|
-
] }),
|
|
836
|
-
failureCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "red", children: [
|
|
837
|
-
failureCount,
|
|
838
|
-
" failed"
|
|
839
|
-
] }),
|
|
840
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", fw: 600, c: getMantineRateColor(successRate), children: [
|
|
841
|
-
successRate,
|
|
842
|
-
"% Success Rate"
|
|
843
|
-
] })
|
|
844
|
-
] });
|
|
845
|
-
}
|
|
846
|
-
function TimelineAxis({ totalDuration }) {
|
|
847
|
-
const markers = [
|
|
848
|
-
{ position: 0, time: 0 },
|
|
849
|
-
{ position: 25, time: totalDuration * 0.25 },
|
|
850
|
-
{ position: 50, time: totalDuration * 0.5 },
|
|
851
|
-
{ position: 75, time: totalDuration * 0.75 },
|
|
852
|
-
{ position: 100, time: totalDuration }
|
|
853
|
-
];
|
|
854
|
-
return /* @__PURE__ */ jsx(
|
|
855
|
-
Box,
|
|
856
|
-
{
|
|
857
|
-
style: {
|
|
858
|
-
position: "relative",
|
|
859
|
-
height: 20
|
|
860
|
-
},
|
|
861
|
-
children: markers.map((marker, idx) => /* @__PURE__ */ jsx(
|
|
862
|
-
Box,
|
|
863
|
-
{
|
|
864
|
-
style: {
|
|
865
|
-
position: "absolute",
|
|
866
|
-
left: `${marker.position}%`,
|
|
867
|
-
transform: marker.position === 100 ? "translateX(-100%)" : marker.position === 0 ? "none" : "translateX(-50%)",
|
|
868
|
-
top: 4
|
|
869
|
-
},
|
|
870
|
-
children: /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(marker.time) })
|
|
871
|
-
},
|
|
872
|
-
idx
|
|
873
|
-
))
|
|
874
|
-
}
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
function TimelineContainer({ executionStart, executionEnd, children }) {
|
|
878
|
-
const totalDuration = executionEnd - executionStart;
|
|
879
|
-
return /* @__PURE__ */ jsxs(
|
|
880
|
-
Box,
|
|
881
|
-
{
|
|
882
|
-
style: {
|
|
883
|
-
borderBottom: "1px solid var(--color-border)",
|
|
884
|
-
borderRadius: "var(--mantine-radius-default)",
|
|
885
|
-
backgroundColor: "var(--color-background)",
|
|
886
|
-
padding: "var(--mantine-spacing-xs)"
|
|
887
|
-
},
|
|
888
|
-
children: [
|
|
889
|
-
/* @__PURE__ */ jsx(
|
|
890
|
-
Box,
|
|
891
|
-
{
|
|
892
|
-
style: {
|
|
893
|
-
position: "relative"
|
|
894
|
-
},
|
|
895
|
-
children: /* @__PURE__ */ jsx(Box, { style: { position: "relative", zIndex: 1 }, children })
|
|
896
|
-
}
|
|
897
|
-
),
|
|
898
|
-
/* @__PURE__ */ jsx(Box, { style: { paddingLeft: TIMELINE_CONSTANTS.LABEL_WIDTH + 12, paddingRight: 16 }, children: /* @__PURE__ */ jsx(TimelineAxis, { totalDuration }) })
|
|
899
|
-
]
|
|
900
|
-
}
|
|
901
|
-
);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// src/execution/utils/calculateBarPosition.ts
|
|
905
|
-
function calculateBarPosition(startTime, endTime, executionStart, executionEnd) {
|
|
906
|
-
const totalDuration = executionEnd - executionStart;
|
|
907
|
-
if (totalDuration <= 0) {
|
|
908
|
-
return { left: 0, width: 100 };
|
|
909
|
-
}
|
|
910
|
-
const relativeStart = startTime - executionStart;
|
|
911
|
-
const duration = endTime - startTime;
|
|
912
|
-
if (relativeStart < 0) {
|
|
913
|
-
console.warn("Activity start time is before execution start time");
|
|
914
|
-
const calculatedWidth = Math.max(0, duration / totalDuration * 100);
|
|
915
|
-
return { left: 0, width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, calculatedWidth) };
|
|
916
|
-
}
|
|
917
|
-
if (startTime + duration > executionEnd) {
|
|
918
|
-
console.warn("Activity end time exceeds execution end time");
|
|
919
|
-
const cappedDuration = Math.max(0, executionEnd - startTime);
|
|
920
|
-
const calculatedWidth = cappedDuration / totalDuration * 100;
|
|
921
|
-
return {
|
|
922
|
-
left: relativeStart / totalDuration * 100,
|
|
923
|
-
width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, calculatedWidth)
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
const left = relativeStart / totalDuration * 100;
|
|
927
|
-
const width = duration / totalDuration * 100;
|
|
928
|
-
return {
|
|
929
|
-
left: Math.max(0, Math.min(100, left)),
|
|
930
|
-
width: Math.max(TIMELINE_CONSTANTS.MIN_BAR_WIDTH_PERCENT, Math.min(100, width))
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
function TimelineBar({
|
|
934
|
-
startTime,
|
|
935
|
-
endTime,
|
|
936
|
-
executionStart,
|
|
937
|
-
executionEnd,
|
|
938
|
-
status,
|
|
939
|
-
label,
|
|
940
|
-
onClick,
|
|
941
|
-
isSelected = false,
|
|
942
|
-
hasSelection = false
|
|
943
|
-
}) {
|
|
944
|
-
const colors = getStatusColors(status);
|
|
945
|
-
const { left, width } = calculateBarPosition(startTime, endTime, executionStart, executionEnd);
|
|
946
|
-
const opacity = hasSelection && !isSelected ? 0.5 : 1;
|
|
947
|
-
return /* @__PURE__ */ jsx(
|
|
948
|
-
Box,
|
|
949
|
-
{
|
|
950
|
-
style: {
|
|
951
|
-
position: "absolute",
|
|
952
|
-
left: `${left}%`,
|
|
953
|
-
width: `${width}%`,
|
|
954
|
-
top: 4,
|
|
955
|
-
height: TIMELINE_CONSTANTS.BAR_HEIGHT / 2,
|
|
956
|
-
backgroundColor: colors.color,
|
|
957
|
-
opacity,
|
|
958
|
-
borderRadius: 4,
|
|
959
|
-
cursor: onClick ? "pointer" : "default",
|
|
960
|
-
display: "flex",
|
|
961
|
-
alignItems: "center",
|
|
962
|
-
justifyContent: "center",
|
|
963
|
-
overflow: "hidden"
|
|
964
|
-
},
|
|
965
|
-
onClick,
|
|
966
|
-
children: label && /* @__PURE__ */ jsx(Text, { size: "xs", c: "white", style: { whiteSpace: "nowrap" }, children: label })
|
|
967
|
-
}
|
|
968
|
-
);
|
|
969
|
-
}
|
|
970
|
-
function TimelineRow({ label, bars, executionStart, executionEnd, indent = 0, selectedNodeId }) {
|
|
971
|
-
const labelMatch = label.match(/^(.+?)\s*\((.+?)\)$/);
|
|
972
|
-
const labelName = labelMatch ? labelMatch[1] : label;
|
|
973
|
-
const labelDuration = labelMatch ? labelMatch[2] : null;
|
|
974
|
-
const statusColor = bars.length > 0 ? getStatusColors(bars[0].status).color : "var(--color-text-dimmed)";
|
|
975
|
-
const hasSelection = selectedNodeId !== null && selectedNodeId !== void 0;
|
|
976
|
-
return /* @__PURE__ */ jsxs(
|
|
977
|
-
Box,
|
|
978
|
-
{
|
|
979
|
-
style: {
|
|
980
|
-
display: "flex",
|
|
981
|
-
gap: 0,
|
|
982
|
-
height: TIMELINE_CONSTANTS.BAR_HEIGHT
|
|
983
|
-
// paddingLeft: indent * TIMELINE_CONSTANTS.INDENT_SIZE
|
|
984
|
-
},
|
|
985
|
-
children: [
|
|
986
|
-
/* @__PURE__ */ jsxs(
|
|
987
|
-
Box,
|
|
988
|
-
{
|
|
989
|
-
style: {
|
|
990
|
-
height: TIMELINE_CONSTANTS.BAR_HEIGHT,
|
|
991
|
-
width: TIMELINE_CONSTANTS.LABEL_WIDTH,
|
|
992
|
-
flexShrink: 0,
|
|
993
|
-
display: "flex",
|
|
994
|
-
alignItems: "center",
|
|
995
|
-
gap: 6,
|
|
996
|
-
paddingRight: 12,
|
|
997
|
-
paddingLeft: 8 + indent * TIMELINE_CONSTANTS.INDENT_SIZE,
|
|
998
|
-
// Indent only the label, not the timeline bars
|
|
999
|
-
overflow: "hidden"
|
|
1000
|
-
},
|
|
1001
|
-
children: [
|
|
1002
|
-
/* @__PURE__ */ jsx(
|
|
1003
|
-
Box,
|
|
1004
|
-
{
|
|
1005
|
-
style: {
|
|
1006
|
-
width: 6,
|
|
1007
|
-
height: 6,
|
|
1008
|
-
borderRadius: "50%",
|
|
1009
|
-
backgroundColor: statusColor,
|
|
1010
|
-
flexShrink: 0
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
),
|
|
1014
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", truncate: true, style: { flexShrink: 1, minWidth: 0 }, children: labelName }),
|
|
1015
|
-
labelDuration && /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", ff: "monospace", style: { flexShrink: 0 }, children: [
|
|
1016
|
-
"(",
|
|
1017
|
-
labelDuration,
|
|
1018
|
-
")"
|
|
1019
|
-
] })
|
|
1020
|
-
]
|
|
1021
|
-
}
|
|
1022
|
-
),
|
|
1023
|
-
/* @__PURE__ */ jsx(
|
|
1024
|
-
Box,
|
|
1025
|
-
{
|
|
1026
|
-
style: {
|
|
1027
|
-
position: "relative",
|
|
1028
|
-
flex: 1,
|
|
1029
|
-
height: TIMELINE_CONSTANTS.BAR_HEIGHT,
|
|
1030
|
-
marginLeft: 12,
|
|
1031
|
-
marginRight: 16
|
|
1032
|
-
// Right margin to match grid padding
|
|
1033
|
-
},
|
|
1034
|
-
children: bars.map((bar, idx) => {
|
|
1035
|
-
const isSelected = bar.nodeId !== void 0 && bar.nodeId === selectedNodeId;
|
|
1036
|
-
return /* @__PURE__ */ jsx(
|
|
1037
|
-
TimelineBar,
|
|
1038
|
-
{
|
|
1039
|
-
...bar,
|
|
1040
|
-
executionStart,
|
|
1041
|
-
executionEnd,
|
|
1042
|
-
isSelected,
|
|
1043
|
-
hasSelection
|
|
1044
|
-
},
|
|
1045
|
-
idx
|
|
1046
|
-
);
|
|
1047
|
-
})
|
|
1048
|
-
}
|
|
1049
|
-
)
|
|
1050
|
-
]
|
|
1051
|
-
}
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
var VisualizerContainer = ({ children, handleContainerClick, height }) => {
|
|
1055
|
-
const containerHeight = height ?? CONTAINER_CONSTANTS.CONTAINER_HEIGHT;
|
|
1056
|
-
return /* @__PURE__ */ jsx(
|
|
1057
|
-
Box,
|
|
1058
|
-
{
|
|
1059
|
-
bg: "var(--color-background)",
|
|
1060
|
-
onClick: handleContainerClick,
|
|
1061
|
-
style: {
|
|
1062
|
-
borderBottom: "1px solid var(--color-border)",
|
|
1063
|
-
borderRadius: "var(--mantine-radius-default)"
|
|
1064
|
-
},
|
|
1065
|
-
children: /* @__PURE__ */ jsx(
|
|
1066
|
-
"div",
|
|
1067
|
-
{
|
|
1068
|
-
style: {
|
|
1069
|
-
width: "100%",
|
|
1070
|
-
height: `${containerHeight}px`,
|
|
1071
|
-
overflow: "hidden"
|
|
1072
|
-
},
|
|
1073
|
-
children
|
|
1074
|
-
}
|
|
1075
|
-
)
|
|
1076
|
-
}
|
|
1077
|
-
);
|
|
1078
|
-
};
|
|
1079
|
-
var EmptyVisualizer = ({ message = "Select an execution to view timeline" }) => {
|
|
1080
|
-
return /* @__PURE__ */ jsx(
|
|
1081
|
-
Box,
|
|
1082
|
-
{
|
|
1083
|
-
h: CONTAINER_CONSTANTS.CONTAINER_HEIGHT,
|
|
1084
|
-
bg: "var(--color-background)",
|
|
1085
|
-
style: {
|
|
1086
|
-
borderBottom: "1px solid var(--color-border)",
|
|
1087
|
-
borderRadius: "var(--mantine-radius-default)",
|
|
1088
|
-
display: "flex",
|
|
1089
|
-
alignItems: "center",
|
|
1090
|
-
justifyContent: "center"
|
|
1091
|
-
},
|
|
1092
|
-
children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: message })
|
|
1093
|
-
}
|
|
1094
|
-
);
|
|
1095
|
-
};
|
|
1096
|
-
var SPIN_ANIMATION = `
|
|
1097
|
-
@keyframes spin {
|
|
1098
|
-
from { transform: rotate(0deg); }
|
|
1099
|
-
to { transform: rotate(360deg); }
|
|
1100
|
-
}
|
|
1101
|
-
`;
|
|
1102
|
-
function getStatusIcon({ status, colors, iconSize, spinDuration = "1s" }) {
|
|
1103
|
-
switch (status) {
|
|
1104
|
-
case "completed":
|
|
1105
|
-
return /* @__PURE__ */ jsx(IconCheck, { size: iconSize, color: colors.icon });
|
|
1106
|
-
case "failed":
|
|
1107
|
-
return /* @__PURE__ */ jsx(IconX, { size: iconSize, color: colors.icon });
|
|
1108
|
-
case "warning":
|
|
1109
|
-
return /* @__PURE__ */ jsx(IconAlertTriangle, { size: iconSize, color: colors.icon });
|
|
1110
|
-
case "running":
|
|
1111
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1112
|
-
/* @__PURE__ */ jsx("style", { children: SPIN_ANIMATION }),
|
|
1113
|
-
/* @__PURE__ */ jsx(
|
|
1114
|
-
IconLoader,
|
|
1115
|
-
{
|
|
1116
|
-
size: iconSize,
|
|
1117
|
-
color: colors.icon,
|
|
1118
|
-
style: { animation: `spin ${spinDuration} linear infinite` }
|
|
1119
|
-
}
|
|
1120
|
-
)
|
|
1121
|
-
] });
|
|
1122
|
-
case "pending":
|
|
1123
|
-
default:
|
|
1124
|
-
return /* @__PURE__ */ jsx(IconCircleDot, { size: iconSize, color: colors.icon });
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
var UnifiedWorkflowNode = memo(function UnifiedWorkflowNode2({ data }) {
|
|
1128
|
-
const selected = data.isSelected ?? false;
|
|
1129
|
-
const primaryColor = data.isEntryPoint ? "teal" : data.isEndNode ? "violet" : data.isConditional ? "orange" : "blue";
|
|
1130
|
-
const statusColors = data.executionStatus ? STATUS_COLORS[data.executionStatus] : void 0;
|
|
1131
|
-
const showExecutionStatus = data.isExecuted && data.executionStatus;
|
|
1132
|
-
return /* @__PURE__ */ jsx(
|
|
1133
|
-
BaseNode,
|
|
1134
|
-
{
|
|
1135
|
-
color: primaryColor,
|
|
1136
|
-
selected,
|
|
1137
|
-
highlighted: Boolean(data.highlighted),
|
|
1138
|
-
width: 220,
|
|
1139
|
-
className: data.isDimmed ? "dimmed-node" : "",
|
|
1140
|
-
showSourceHandle: !data.isEndNode,
|
|
1141
|
-
children: /* @__PURE__ */ jsx("div", { style: { opacity: data.isDimmed ? 0.3 : 1 }, children: /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
|
|
1142
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, lineClamp: 1, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: data.name }),
|
|
1143
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
1144
|
-
data.isEntryPoint && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "teal", leftSection: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 10 }), children: "Entry" }),
|
|
1145
|
-
data.isEndNode && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "violet", leftSection: /* @__PURE__ */ jsx(IconPlayerStop, { size: 10 }), children: "End" }),
|
|
1146
|
-
data.isConditional && /* @__PURE__ */ jsxs(Badge, { size: "xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ jsx(IconArrowsSplit, { size: 10 }), children: [
|
|
1147
|
-
data.routeCount,
|
|
1148
|
-
" routes"
|
|
1149
|
-
] }),
|
|
1150
|
-
!data.isEntryPoint && !data.isEndNode && !data.isConditional && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ jsx(IconSquare, { size: 10 }), children: "Step" }),
|
|
1151
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", ff: "monospace", c: "dimmed", truncate: true, children: data.id })
|
|
1152
|
-
] }),
|
|
1153
|
-
!data.isDimmed && data.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: data.description }),
|
|
1154
|
-
showExecutionStatus && statusColors && /* @__PURE__ */ jsx(Box, { mt: 4, children: /* @__PURE__ */ jsxs(Group, { gap: 8, align: "center", children: [
|
|
1155
|
-
/* @__PURE__ */ jsx(Box, { children: getStatusIcon({
|
|
1156
|
-
status: data.executionStatus,
|
|
1157
|
-
colors: { icon: statusColors.color },
|
|
1158
|
-
iconSize: 16,
|
|
1159
|
-
spinDuration: "1s"
|
|
1160
|
-
}) }),
|
|
1161
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: statusColors.badge, children: data.executionStatus }),
|
|
1162
|
-
data.duration !== void 0 && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(data.duration) })
|
|
1163
|
-
] }) })
|
|
1164
|
-
] }) })
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
});
|
|
1168
|
-
var UnifiedWorkflowEdge = memo(function UnifiedWorkflowEdge2({
|
|
1169
|
-
id,
|
|
1170
|
-
sourceX,
|
|
1171
|
-
sourceY,
|
|
1172
|
-
targetX,
|
|
1173
|
-
targetY,
|
|
1174
|
-
selected,
|
|
1175
|
-
data
|
|
1176
|
-
}) {
|
|
1177
|
-
const colors = useGraphTheme();
|
|
1178
|
-
const edgeType = data?.edgeType || "linear";
|
|
1179
|
-
const isDimmed = data?.isDimmed ?? false;
|
|
1180
|
-
const isAnimated = data?.isAnimated ?? false;
|
|
1181
|
-
let edgeColor;
|
|
1182
|
-
let glowColor;
|
|
1183
|
-
let label;
|
|
1184
|
-
switch (edgeType) {
|
|
1185
|
-
case "conditional":
|
|
1186
|
-
edgeColor = colors.trigger;
|
|
1187
|
-
glowColor = colors.triggerGlow;
|
|
1188
|
-
label = data?.label || "route";
|
|
1189
|
-
break;
|
|
1190
|
-
case "default":
|
|
1191
|
-
edgeColor = colors.integration;
|
|
1192
|
-
glowColor = colors.integrationGlow;
|
|
1193
|
-
label = data?.label || "default";
|
|
1194
|
-
break;
|
|
1195
|
-
case "linear":
|
|
1196
|
-
default:
|
|
1197
|
-
edgeColor = colors.workflow;
|
|
1198
|
-
glowColor = colors.workflowGlow;
|
|
1199
|
-
label = void 0;
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
return /* @__PURE__ */ jsx(
|
|
1203
|
-
BaseEdge,
|
|
1204
|
-
{
|
|
1205
|
-
id,
|
|
1206
|
-
sourceX,
|
|
1207
|
-
sourceY,
|
|
1208
|
-
targetX,
|
|
1209
|
-
targetY,
|
|
1210
|
-
sourcePosition: Position.Right,
|
|
1211
|
-
targetPosition: Position.Left,
|
|
1212
|
-
color: edgeColor,
|
|
1213
|
-
glowColor,
|
|
1214
|
-
label,
|
|
1215
|
-
selected,
|
|
1216
|
-
animated: isAnimated,
|
|
1217
|
-
dimmed: isDimmed
|
|
1218
|
-
}
|
|
1219
|
-
);
|
|
1220
|
-
});
|
|
1221
|
-
var nodeTypes = {
|
|
1222
|
-
unifiedWorkflowNode: UnifiedWorkflowNode
|
|
1223
|
-
};
|
|
1224
|
-
var edgeTypes = {
|
|
1225
|
-
unifiedWorkflowEdge: UnifiedWorkflowEdge
|
|
1226
|
-
};
|
|
1227
|
-
var NODE_LEGEND_ITEMS = [
|
|
1228
|
-
{ color: "teal", label: "Entry" },
|
|
1229
|
-
{ color: "blue", label: "Step" },
|
|
1230
|
-
{ color: "orange", label: "Conditional" },
|
|
1231
|
-
{ color: "violet", label: "End" }
|
|
1232
|
-
];
|
|
1233
|
-
var EDGE_LEGEND_ITEMS = [
|
|
1234
|
-
{ color: "blue", label: "Next", type: "line" },
|
|
1235
|
-
{ color: "orange", label: "Route", type: "line" },
|
|
1236
|
-
{ color: "teal", label: "Default", type: "line" }
|
|
1237
|
-
];
|
|
1238
|
-
function UnifiedWorkflowGraph({
|
|
1239
|
-
resourceDefinition,
|
|
1240
|
-
executionLogs,
|
|
1241
|
-
selectedStepId,
|
|
1242
|
-
onStepSelect,
|
|
1243
|
-
fitViewTrigger: externalFitViewTrigger
|
|
1244
|
-
}) {
|
|
1245
|
-
const hasExecutionData = executionLogs && executionLogs.length > 0;
|
|
1246
|
-
const [mode, setMode] = useState(hasExecutionData ? "execution" : "definition");
|
|
1247
|
-
useEffect(() => {
|
|
1248
|
-
setMode(hasExecutionData ? "execution" : "definition");
|
|
1249
|
-
}, [hasExecutionData]);
|
|
1250
|
-
const isDefinitionMode = mode === "definition";
|
|
1251
|
-
const executionPath = useExecutionPath(
|
|
1252
|
-
isDefinitionMode ? void 0 : executionLogs,
|
|
1253
|
-
isDefinitionMode ? void 0 : resourceDefinition
|
|
1254
|
-
);
|
|
1255
|
-
const workflowInput = useMemo(
|
|
1256
|
-
() => resourceDefinition ? { entryPoint: resourceDefinition.entryPoint, steps: resourceDefinition.steps } : void 0,
|
|
1257
|
-
[resourceDefinition]
|
|
1258
|
-
);
|
|
1259
|
-
const { nodes: layoutNodes, edges: layoutEdges, graphHeight } = useUnifiedWorkflowLayout(
|
|
1260
|
-
workflowInput,
|
|
1261
|
-
executionPath,
|
|
1262
|
-
isDefinitionMode ? null : selectedStepId,
|
|
1263
|
-
mode
|
|
1264
|
-
);
|
|
1265
|
-
const {
|
|
1266
|
-
nodes: highlightedNodes,
|
|
1267
|
-
edges: highlightedEdges,
|
|
1268
|
-
handleNodeMouseEnter,
|
|
1269
|
-
handleNodeMouseLeave
|
|
1270
|
-
} = useDirectedChainHighlighting(layoutNodes, layoutEdges);
|
|
1271
|
-
const nodes = isDefinitionMode ? highlightedNodes : layoutNodes;
|
|
1272
|
-
const edges = isDefinitionMode ? highlightedEdges : layoutEdges;
|
|
1273
|
-
const [internalFitViewTrigger, setInternalFitViewTrigger] = useState(0);
|
|
1274
|
-
const executedStepsCount = executionPath?.executedSteps.size ?? 0;
|
|
1275
|
-
const nodesCount = nodes.length;
|
|
1276
|
-
useEffect(() => {
|
|
1277
|
-
if (nodesCount > 0) {
|
|
1278
|
-
setInternalFitViewTrigger((prev) => prev + 1);
|
|
1279
|
-
}
|
|
1280
|
-
}, [nodesCount, executedStepsCount]);
|
|
1281
|
-
const fitViewTrigger = (externalFitViewTrigger ?? 0) + internalFitViewTrigger;
|
|
1282
|
-
const { handleNodeClick, handlePaneClick, handleContainerClick } = useNodeSelection(
|
|
1283
|
-
selectedStepId || null,
|
|
1284
|
-
onStepSelect || (() => {
|
|
1285
|
-
})
|
|
1286
|
-
);
|
|
1287
|
-
if (!resourceDefinition || !resourceDefinition.steps.length) {
|
|
1288
|
-
return /* @__PURE__ */ jsx(EmptyVisualizer, {});
|
|
1289
|
-
}
|
|
1290
|
-
return /* @__PURE__ */ jsx(
|
|
1291
|
-
VisualizerContainer,
|
|
1292
|
-
{
|
|
1293
|
-
handleContainerClick: isDefinitionMode ? void 0 : handleContainerClick,
|
|
1294
|
-
height: graphHeight,
|
|
1295
|
-
children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsxs(
|
|
1296
|
-
ReactFlow,
|
|
1297
|
-
{
|
|
1298
|
-
nodes,
|
|
1299
|
-
edges,
|
|
1300
|
-
nodeTypes,
|
|
1301
|
-
edgeTypes,
|
|
1302
|
-
onNodeClick: isDefinitionMode ? void 0 : handleNodeClick,
|
|
1303
|
-
onPaneClick: isDefinitionMode ? void 0 : handlePaneClick,
|
|
1304
|
-
onNodeMouseEnter: isDefinitionMode ? handleNodeMouseEnter : void 0,
|
|
1305
|
-
onNodeMouseLeave: isDefinitionMode ? handleNodeMouseLeave : void 0,
|
|
1306
|
-
fitView: true,
|
|
1307
|
-
fitViewOptions: {
|
|
1308
|
-
padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING
|
|
1309
|
-
},
|
|
1310
|
-
proOptions: { hideAttribution: true },
|
|
1311
|
-
minZoom: WORKFLOW_CONSTANTS.MIN_ZOOM,
|
|
1312
|
-
maxZoom: WORKFLOW_CONSTANTS.MAX_ZOOM,
|
|
1313
|
-
defaultViewport: { x: 0, y: 0, zoom: 1 },
|
|
1314
|
-
nodesDraggable: false,
|
|
1315
|
-
nodesConnectable: false,
|
|
1316
|
-
elementsSelectable: !isDefinitionMode,
|
|
1317
|
-
selectNodesOnDrag: false,
|
|
1318
|
-
zoomOnScroll: true,
|
|
1319
|
-
panOnDrag: true,
|
|
1320
|
-
className: Graph_default.graphContainer,
|
|
1321
|
-
children: [
|
|
1322
|
-
/* @__PURE__ */ jsx(GraphBackground, {}),
|
|
1323
|
-
/* @__PURE__ */ jsx(Panel, { position: "top-right", style: { marginTop: 12, marginRight: 12 }, children: /* @__PURE__ */ jsx(
|
|
1324
|
-
SegmentedControl,
|
|
1325
|
-
{
|
|
1326
|
-
size: "xs",
|
|
1327
|
-
value: mode,
|
|
1328
|
-
onChange: (value) => setMode(value),
|
|
1329
|
-
data: [
|
|
1330
|
-
{ label: "Definition", value: "definition" },
|
|
1331
|
-
{ label: "Execution", value: "execution" }
|
|
1332
|
-
],
|
|
1333
|
-
styles: {
|
|
1334
|
-
root: {
|
|
1335
|
-
backgroundColor: "var(--color-surface)",
|
|
1336
|
-
border: "1px solid var(--color-border)"
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
) }),
|
|
1341
|
-
/* @__PURE__ */ jsx(GraphLegend, { title: "Legend", items: NODE_LEGEND_ITEMS, position: "bottom-right" }),
|
|
1342
|
-
/* @__PURE__ */ jsx(GraphLegend, { title: "Flow", items: EDGE_LEGEND_ITEMS, position: "bottom-left" }),
|
|
1343
|
-
/* @__PURE__ */ jsx(GraphFitViewButton, { padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING, variant: "mantine" }),
|
|
1344
|
-
/* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger, padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING })
|
|
1345
|
-
]
|
|
1346
|
-
}
|
|
1347
|
-
) })
|
|
1348
|
-
}
|
|
1349
|
-
);
|
|
1350
|
-
}
|
|
1351
|
-
function WorkflowExecutionTimeline({ timelineData, selectedStepId }) {
|
|
1352
|
-
const { steps } = timelineData;
|
|
1353
|
-
const executionStart = steps[0]?.startTime || 0;
|
|
1354
|
-
const executionEnd = steps[steps.length - 1]?.endTime || executionStart;
|
|
1355
|
-
return /* @__PURE__ */ jsx(TimelineContainer, { executionStart, executionEnd, children: steps.map(
|
|
1356
|
-
(step) => step.startTime && step.endTime && /* @__PURE__ */ jsx(
|
|
1357
|
-
TimelineRow,
|
|
1358
|
-
{
|
|
1359
|
-
label: step.stepName,
|
|
1360
|
-
bars: [
|
|
1361
|
-
{
|
|
1362
|
-
startTime: step.startTime,
|
|
1363
|
-
endTime: step.endTime,
|
|
1364
|
-
status: step.status,
|
|
1365
|
-
nodeId: step.stepId
|
|
1366
|
-
}
|
|
1367
|
-
],
|
|
1368
|
-
executionStart,
|
|
1369
|
-
executionEnd,
|
|
1370
|
-
selectedNodeId: selectedStepId
|
|
1371
|
-
},
|
|
1372
|
-
step.stepId
|
|
1373
|
-
)
|
|
1374
|
-
) });
|
|
1375
|
-
}
|
|
1376
|
-
var statusColorMap = {
|
|
1377
|
-
running: "blue",
|
|
1378
|
-
completed: "teal",
|
|
1379
|
-
failed: "orange",
|
|
1380
|
-
pending: "violet",
|
|
1381
|
-
warning: "yellow"
|
|
1382
|
-
};
|
|
1383
|
-
var AgentIterationNode = memo(function AgentIterationNode2({ data, selected }) {
|
|
1384
|
-
const { nodeType, label, iterationNumber, status, reasoningCount, actionCount, duration, isLive } = data;
|
|
1385
|
-
const colors = getStatusColors(status);
|
|
1386
|
-
const nodeColor = statusColorMap[status];
|
|
1387
|
-
return /* @__PURE__ */ jsxs(BaseNode, { color: nodeColor, selected, width: AGENT_CONSTANTS.NODE_WIDTH, children: [
|
|
1388
|
-
/* @__PURE__ */ jsxs(Box, { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
|
|
1389
|
-
/* @__PURE__ */ jsx(
|
|
1390
|
-
Box,
|
|
1391
|
-
{
|
|
1392
|
-
style: {
|
|
1393
|
-
width: AGENT_CONSTANTS.CIRCLE_SIZE,
|
|
1394
|
-
height: AGENT_CONSTANTS.CIRCLE_SIZE,
|
|
1395
|
-
borderRadius: "50%",
|
|
1396
|
-
backgroundColor: "var(--color-surface)",
|
|
1397
|
-
border: `2px solid ${colors.color}`,
|
|
1398
|
-
display: "flex",
|
|
1399
|
-
alignItems: "center",
|
|
1400
|
-
justifyContent: "center"
|
|
1401
|
-
},
|
|
1402
|
-
children: getStatusIcon({
|
|
1403
|
-
status,
|
|
1404
|
-
colors: { icon: colors.color },
|
|
1405
|
-
iconSize: AGENT_CONSTANTS.STATUS_ICON_SIZE,
|
|
1406
|
-
spinDuration: "1s"
|
|
1407
|
-
})
|
|
1408
|
-
}
|
|
1409
|
-
),
|
|
1410
|
-
/* @__PURE__ */ jsx(
|
|
1411
|
-
Text,
|
|
1412
|
-
{
|
|
1413
|
-
size: "sm",
|
|
1414
|
-
fw: status === "running" ? 500 : 400,
|
|
1415
|
-
ta: "center",
|
|
1416
|
-
mt: 4,
|
|
1417
|
-
style: { maxWidth: 150, fontFamily: "var(--mantine-font-family-headings)" },
|
|
1418
|
-
children: nodeType === "iteration" ? `Iteration ${iterationNumber}` : label
|
|
1419
|
-
}
|
|
1420
|
-
),
|
|
1421
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: colors.badge, mt: 4, children: status.toUpperCase() }),
|
|
1422
|
-
/* @__PURE__ */ jsxs(Stack, { gap: 2, mt: 2, align: "center", children: [
|
|
1423
|
-
nodeType === "iteration" && reasoningCount !== void 0 && reasoningCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
1424
|
-
reasoningCount,
|
|
1425
|
-
" reasoning"
|
|
1426
|
-
] }),
|
|
1427
|
-
nodeType === "iteration" && actionCount !== void 0 && actionCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
1428
|
-
actionCount,
|
|
1429
|
-
" ",
|
|
1430
|
-
actionCount === 1 ? "action" : "actions"
|
|
1431
|
-
] }),
|
|
1432
|
-
duration !== void 0 && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(duration) })
|
|
1433
|
-
] })
|
|
1434
|
-
] }),
|
|
1435
|
-
isLive && /* @__PURE__ */ jsx(
|
|
1436
|
-
Badge,
|
|
1437
|
-
{
|
|
1438
|
-
size: "xs",
|
|
1439
|
-
variant: "filled",
|
|
1440
|
-
style: {
|
|
1441
|
-
position: "absolute",
|
|
1442
|
-
top: 4,
|
|
1443
|
-
right: 4
|
|
1444
|
-
},
|
|
1445
|
-
children: /* @__PURE__ */ jsx("span", { className: Graph_default.livePulse, children: "LIVE" })
|
|
1446
|
-
}
|
|
1447
|
-
)
|
|
1448
|
-
] });
|
|
1449
|
-
});
|
|
1450
|
-
var statusEdgeColors = {
|
|
1451
|
-
running: {
|
|
1452
|
-
color: "var(--mantine-color-blue-5)",
|
|
1453
|
-
glow: "rgba(59, 130, 246, 0.5)"
|
|
1454
|
-
},
|
|
1455
|
-
completed: {
|
|
1456
|
-
color: "var(--mantine-color-teal-5)",
|
|
1457
|
-
glow: "rgba(20, 184, 166, 0.5)"
|
|
1458
|
-
},
|
|
1459
|
-
failed: {
|
|
1460
|
-
color: "var(--mantine-color-orange-5)",
|
|
1461
|
-
glow: "rgba(249, 115, 22, 0.5)"
|
|
1462
|
-
},
|
|
1463
|
-
pending: {
|
|
1464
|
-
color: "var(--mantine-color-gray-5)",
|
|
1465
|
-
glow: "rgba(156, 163, 175, 0.3)"
|
|
1466
|
-
},
|
|
1467
|
-
warning: {
|
|
1468
|
-
color: "var(--mantine-color-yellow-5)",
|
|
1469
|
-
glow: "rgba(234, 179, 8, 0.5)"
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
var AgentIterationEdge = memo(function AgentIterationEdge2({
|
|
1473
|
-
id,
|
|
1474
|
-
sourceX,
|
|
1475
|
-
sourceY,
|
|
1476
|
-
targetX,
|
|
1477
|
-
targetY,
|
|
1478
|
-
data,
|
|
1479
|
-
selected
|
|
1480
|
-
}) {
|
|
1481
|
-
const edgeData = data;
|
|
1482
|
-
const sourceStatus = edgeData?.sourceStatus || "pending";
|
|
1483
|
-
const targetStatus = edgeData?.targetStatus || "pending";
|
|
1484
|
-
const edgeColors = statusEdgeColors[sourceStatus];
|
|
1485
|
-
const isAnimated = shouldAnimateEdge(sourceStatus, targetStatus);
|
|
1486
|
-
return /* @__PURE__ */ jsx(
|
|
1487
|
-
BaseEdge,
|
|
1488
|
-
{
|
|
1489
|
-
id,
|
|
1490
|
-
sourceX,
|
|
1491
|
-
sourceY,
|
|
1492
|
-
targetX,
|
|
1493
|
-
targetY,
|
|
1494
|
-
sourcePosition: Position.Right,
|
|
1495
|
-
targetPosition: Position.Left,
|
|
1496
|
-
color: edgeColors.color,
|
|
1497
|
-
glowColor: edgeColors.glow,
|
|
1498
|
-
animated: isAnimated,
|
|
1499
|
-
selected
|
|
1500
|
-
}
|
|
1501
|
-
);
|
|
1502
|
-
});
|
|
1503
|
-
var nodeTypes2 = {
|
|
1504
|
-
agentIteration: AgentIterationNode
|
|
1505
|
-
};
|
|
1506
|
-
var edgeTypes2 = {
|
|
1507
|
-
agentIteration: AgentIterationEdge
|
|
1508
|
-
};
|
|
1509
|
-
function AgentExecutionVisualizer({
|
|
1510
|
-
resourceDefinition,
|
|
1511
|
-
iterationData,
|
|
1512
|
-
selectedExecutionId,
|
|
1513
|
-
liveExecutions,
|
|
1514
|
-
selectedIterationId,
|
|
1515
|
-
onIterationSelect
|
|
1516
|
-
}) {
|
|
1517
|
-
const { nodes, edges } = useReactFlowAgent(
|
|
1518
|
-
iterationData,
|
|
1519
|
-
resourceDefinition,
|
|
1520
|
-
selectedIterationId,
|
|
1521
|
-
liveExecutions,
|
|
1522
|
-
selectedExecutionId
|
|
1523
|
-
);
|
|
1524
|
-
const fitViewTrigger = useFitViewTrigger(iterationData, nodes);
|
|
1525
|
-
const handleIterationSelect = useCallback(
|
|
1526
|
-
(id) => {
|
|
1527
|
-
onIterationSelect(id);
|
|
1528
|
-
},
|
|
1529
|
-
[onIterationSelect]
|
|
1530
|
-
);
|
|
1531
|
-
const { handlePaneClick, handleContainerClick } = useNodeSelection(selectedIterationId, handleIterationSelect);
|
|
1532
|
-
const handleNodeClick = useCallback(
|
|
1533
|
-
(_event, node) => {
|
|
1534
|
-
if (node.id === "initialization" || node.id === "completion") {
|
|
1535
|
-
handleIterationSelect(selectedIterationId === node.id ? null : node.id);
|
|
1536
|
-
return;
|
|
1537
|
-
}
|
|
1538
|
-
const iterationNumber = Number.parseInt(node.id.replace("iteration-", ""), 10);
|
|
1539
|
-
if (!Number.isNaN(iterationNumber)) {
|
|
1540
|
-
handleIterationSelect(iterationNumber === selectedIterationId ? null : iterationNumber);
|
|
1541
|
-
}
|
|
1542
|
-
},
|
|
1543
|
-
[selectedIterationId, handleIterationSelect]
|
|
1544
|
-
);
|
|
1545
|
-
if (!iterationData || nodes.length === 0) {
|
|
1546
|
-
return /* @__PURE__ */ jsx(EmptyVisualizer, {});
|
|
1547
|
-
}
|
|
1548
|
-
return /* @__PURE__ */ jsx(VisualizerContainer, { handleContainerClick, children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsxs(
|
|
1549
|
-
ReactFlow,
|
|
1550
|
-
{
|
|
1551
|
-
nodes,
|
|
1552
|
-
edges,
|
|
1553
|
-
nodeTypes: nodeTypes2,
|
|
1554
|
-
edgeTypes: edgeTypes2,
|
|
1555
|
-
onNodeClick: handleNodeClick,
|
|
1556
|
-
onPaneClick: handlePaneClick,
|
|
1557
|
-
fitView: true,
|
|
1558
|
-
fitViewOptions: {
|
|
1559
|
-
padding: AGENT_CONSTANTS.FIT_VIEW_PADDING
|
|
1560
|
-
},
|
|
1561
|
-
proOptions: { hideAttribution: true },
|
|
1562
|
-
minZoom: AGENT_CONSTANTS.MIN_ZOOM,
|
|
1563
|
-
maxZoom: AGENT_CONSTANTS.MAX_ZOOM,
|
|
1564
|
-
nodesDraggable: false,
|
|
1565
|
-
nodesConnectable: false,
|
|
1566
|
-
elementsSelectable: true,
|
|
1567
|
-
selectNodesOnDrag: false,
|
|
1568
|
-
zoomOnScroll: false,
|
|
1569
|
-
panOnDrag: false,
|
|
1570
|
-
className: Graph_default.graphContainer,
|
|
1571
|
-
children: [
|
|
1572
|
-
/* @__PURE__ */ jsx(GraphBackground, {}),
|
|
1573
|
-
/* @__PURE__ */ jsx(GraphFitViewButton, { padding: AGENT_CONSTANTS.FIT_VIEW_PADDING, variant: "mantine", duration: 300 }),
|
|
1574
|
-
/* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger, padding: AGENT_CONSTANTS.FIT_VIEW_PADDING })
|
|
1575
|
-
]
|
|
1576
|
-
}
|
|
1577
|
-
) }) });
|
|
1578
|
-
}
|
|
1579
|
-
function AgentExecutionTimeline({ iterationData, selectedIterationId }) {
|
|
1580
|
-
const { initialization, iterations, completion } = iterationData;
|
|
1581
|
-
const executionStart = initialization.startTime;
|
|
1582
|
-
const executionEnd = completion.endTime;
|
|
1583
|
-
return /* @__PURE__ */ jsxs(TimelineContainer, { executionStart, executionEnd, children: [
|
|
1584
|
-
initialization.startTime && initialization.endTime && /* @__PURE__ */ jsx(
|
|
1585
|
-
TimelineRow,
|
|
1586
|
-
{
|
|
1587
|
-
label: `Initialization (${formatDuration(initialization.duration || 0)})`,
|
|
1588
|
-
bars: [
|
|
1589
|
-
{
|
|
1590
|
-
startTime: initialization.startTime,
|
|
1591
|
-
endTime: initialization.endTime,
|
|
1592
|
-
status: initialization.status,
|
|
1593
|
-
nodeId: "initialization"
|
|
1594
|
-
}
|
|
1595
|
-
],
|
|
1596
|
-
executionStart,
|
|
1597
|
-
executionEnd,
|
|
1598
|
-
selectedNodeId: selectedIterationId
|
|
1599
|
-
}
|
|
1600
|
-
),
|
|
1601
|
-
iterations.map((iteration) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1602
|
-
iteration.startTime && iteration.endTime && /* @__PURE__ */ jsx(
|
|
1603
|
-
TimelineRow,
|
|
1604
|
-
{
|
|
1605
|
-
label: `Iteration ${iteration.iterationNumber} (${formatDuration(iteration.duration || 0)})`,
|
|
1606
|
-
bars: [
|
|
1607
|
-
{
|
|
1608
|
-
startTime: iteration.startTime,
|
|
1609
|
-
endTime: iteration.endTime,
|
|
1610
|
-
status: iteration.status,
|
|
1611
|
-
nodeId: iteration.iterationNumber
|
|
1612
|
-
}
|
|
1613
|
-
],
|
|
1614
|
-
executionStart,
|
|
1615
|
-
executionEnd,
|
|
1616
|
-
selectedNodeId: selectedIterationId
|
|
1617
|
-
}
|
|
1618
|
-
),
|
|
1619
|
-
iteration.subActivities.map((activity, activityIndex) => /* @__PURE__ */ jsx(
|
|
1620
|
-
TimelineRow,
|
|
1621
|
-
{
|
|
1622
|
-
label: `${activity.type} (${formatDuration(activity.duration)})`,
|
|
1623
|
-
bars: [
|
|
1624
|
-
{
|
|
1625
|
-
startTime: activity.startTime,
|
|
1626
|
-
endTime: activity.endTime,
|
|
1627
|
-
status: "completed",
|
|
1628
|
-
nodeId: iteration.iterationNumber
|
|
1629
|
-
}
|
|
1630
|
-
],
|
|
1631
|
-
executionStart,
|
|
1632
|
-
executionEnd,
|
|
1633
|
-
indent: 1,
|
|
1634
|
-
selectedNodeId: selectedIterationId
|
|
1635
|
-
},
|
|
1636
|
-
`${iteration.iterationNumber}-${activity.type}-${activity.startTime}-${activityIndex}`
|
|
1637
|
-
))
|
|
1638
|
-
] }, iteration.iterationNumber)),
|
|
1639
|
-
completion.startTime && completion.endTime && /* @__PURE__ */ jsx(
|
|
1640
|
-
TimelineRow,
|
|
1641
|
-
{
|
|
1642
|
-
label: `Completion (${formatDuration(completion.duration || 0)})`,
|
|
1643
|
-
bars: [
|
|
1644
|
-
{
|
|
1645
|
-
startTime: completion.startTime,
|
|
1646
|
-
endTime: completion.endTime,
|
|
1647
|
-
status: completion.status,
|
|
1648
|
-
nodeId: "completion"
|
|
1649
|
-
}
|
|
1650
|
-
],
|
|
1651
|
-
executionStart,
|
|
1652
|
-
executionEnd,
|
|
1653
|
-
selectedNodeId: selectedIterationId
|
|
1654
|
-
}
|
|
1655
|
-
)
|
|
1656
|
-
] });
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
// src/execution/utils/getResourceStatusColor.ts
|
|
1660
|
-
function getResourceStatusColor(resourceStatus) {
|
|
1661
|
-
return resourceStatus === "dev" ? "var(--color-primary)" : "var(--color-success)";
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
export { AGENT_CONSTANTS, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, CONTAINER_CONSTANTS, EmptyVisualizer, ExecutionStats, ExecutionStatusBadge, SHARED_VIZ_CONSTANTS, STATUS_COLORS, TIMELINE_CONSTANTS, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WORKFLOW_CONSTANTS, WorkflowExecutionTimeline, calculateBarPosition, getEdgeColor, getEdgeOpacity, getResourceStatusColor, getStatusColors, getStatusIcon, shouldAnimateEdge, useAgentIterationData, useExecutionPath, useMergedExecution, useReactFlowAgent, useTimelineData, useUnifiedWorkflowLayout, useWorkflowStepsLayout };
|