@elevasis/ui 1.26.1 → 1.27.0

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.
Files changed (53) hide show
  1. package/dist/charts/index.js +2 -2
  2. package/dist/{chunk-AWT255UH.js → chunk-2IJCM3VQ.js} +37 -37
  3. package/dist/chunk-5COLSYBE.js +199 -0
  4. package/dist/{chunk-RMPXGBNI.js → chunk-5JSR6TL5.js} +2 -2
  5. package/dist/chunk-BAGYETKM.js +635 -0
  6. package/dist/{chunk-L3GVDMCA.js → chunk-C27LLJM6.js} +3 -195
  7. package/dist/{chunk-O4UB5DQQ.js → chunk-F2J7675J.js} +1 -1
  8. package/dist/chunk-ITCEULI5.js +238 -0
  9. package/dist/{chunk-4WKWLFBZ.js → chunk-P5EWG45B.js} +1 -1
  10. package/dist/{chunk-BS4J2LAW.js → chunk-QTD5HPKD.js} +1 -1
  11. package/dist/{chunk-ZVJKIJFG.js → chunk-RCQPWA5X.js} +13 -42
  12. package/dist/chunk-TLAIQC7B.js +6382 -0
  13. package/dist/{chunk-FEZZ3IDU.js → chunk-TXPUIHX2.js} +10 -10
  14. package/dist/{chunk-L4XXM55J.js → chunk-W4VYXIN7.js} +142 -3
  15. package/dist/chunk-WJ7W7JU4.js +2115 -0
  16. package/dist/{chunk-YNGQ7U5H.js → chunk-WLNEJ6JJ.js} +2 -2
  17. package/dist/{chunk-4INR75ZS.js → chunk-Y2SYGFRF.js} +589 -65
  18. package/dist/components/index.d.ts +333 -73
  19. package/dist/components/index.js +838 -686
  20. package/dist/features/auth/index.d.ts +125 -0
  21. package/dist/features/auth/index.js +2 -2
  22. package/dist/features/dashboard/index.d.ts +28 -2
  23. package/dist/features/dashboard/index.js +21 -635
  24. package/dist/features/monitoring/index.d.ts +28 -1
  25. package/dist/features/monitoring/index.js +19 -529
  26. package/dist/features/operations/index.d.ts +51 -8
  27. package/dist/features/operations/index.js +25 -3760
  28. package/dist/features/settings/index.d.ts +153 -1
  29. package/dist/features/settings/index.js +19 -1438
  30. package/dist/hooks/index.d.ts +262 -25
  31. package/dist/hooks/index.js +12 -8
  32. package/dist/hooks/published.d.ts +137 -25
  33. package/dist/hooks/published.js +11 -7
  34. package/dist/index.d.ts +310 -28
  35. package/dist/index.js +12 -11
  36. package/dist/initialization/index.d.ts +125 -0
  37. package/dist/layout/index.d.ts +2 -0
  38. package/dist/layout/index.js +6 -5
  39. package/dist/organization/index.js +1 -2
  40. package/dist/profile/index.d.ts +125 -0
  41. package/dist/provider/index.d.ts +48 -3
  42. package/dist/provider/index.js +10 -4
  43. package/dist/provider/published.d.ts +48 -3
  44. package/dist/provider/published.js +8 -2
  45. package/dist/supabase/index.d.ts +242 -0
  46. package/dist/theme/index.js +2 -2
  47. package/dist/types/index.d.ts +126 -1
  48. package/package.json +3 -3
  49. package/dist/chunk-LR4WVA7W.js +0 -682
  50. package/dist/chunk-R7WLWGPO.js +0 -126
  51. package/dist/chunk-TCKIAHDC.js +0 -2626
  52. package/dist/chunk-V7XHGJQZ.js +0 -145
  53. package/dist/{chunk-WWEMNIHW.js → chunk-YYBM5LNJ.js} +1 -1
@@ -1,2626 +0,0 @@
1
- import { SubshellSidebarSection } from './chunk-AWT255UH.js';
2
- import { CustomModal, ConfirmationModal } from './chunk-GBMNCNHX.js';
3
- import { BaseNode, useGraphTheme, BaseEdge, GraphBackground, GraphLegend, GraphFitViewButton, GraphFitViewHandler } from './chunk-O4UB5DQQ.js';
4
- import { useCyberColors, CyberDonut } from './chunk-JHVKGZ2P.js';
5
- import { JsonViewer, CardHeader, PageTitleCaption, CollapsibleSection } from './chunk-MCA6LOGM.js';
6
- import { StyledMarkdown } from './chunk-3KMDHCAR.js';
7
- import { useCommandViewLayout, useErrorDetail, useExecution, useArchivedLogs, useDeleteExecution, useRetryExecution, useCancelExecution, useCommandQueueTotals, showApiErrorNotification, showSuccessNotification } from './chunk-ZVJKIJFG.js';
8
- import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, GRAPH_CONSTANTS, useGraphHighlighting, calculateGraphHeight } from './chunk-F6RBK7NJ.js';
9
- import { getResourceStatusColor } from './chunk-XA34RETF.js';
10
- import { ResourceStatusColors, toWorkflowLogMessages } from './chunk-ELJIFLCB.js';
11
- import { useAppearance } from './chunk-QJ2KCHKX.js';
12
- import { getResourceIcon, getResourceColor, getErrorInfo, formatErrorMessage } from './chunk-IOKL7BKE.js';
13
- import { useOrganization } from './chunk-DD3CCMCZ.js';
14
- import { Stack, Group, Text, Badge, ThemeIcon, Box, TextInput, Textarea, Radio, Checkbox, Select, NumberInput, Title, Alert, Button, ActionIcon, Collapse, Card, SimpleGrid, Divider, Paper, Space, CopyButton, Center, Tooltip, Code, Menu, useMantineTheme, UnstyledButton, RangeSlider, Loader, Progress, ScrollArea } from '@mantine/core';
15
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
- import { IconBrain, IconFileText, IconDatabase, IconMessage, IconAlertCircle, IconCircleX, IconCircleCheck, IconBolt, IconHandClick, IconClock, IconWebhook, IconExternalLink, IconMail, IconSend, IconArrowUp, IconMessageCircle, IconRocket, IconEye, IconEdit, IconAlertTriangle, IconRefresh, IconX, IconCheck, IconChevronRight, IconTool, IconSettings, IconCpu, IconClockHour4, IconVersions, IconPlayerPlay, IconNetwork, IconSitemap, IconCopy, IconPlayerStop, IconReload, IconTrash, IconTerminal2, IconBug, IconChevronDown, IconArrowLeft, IconRobot, IconGitBranch, IconDotsVertical, IconFilter, IconCategory, IconArchive, IconDownload } from '@tabler/icons-react';
17
- import { useForm } from '@mantine/form';
18
- import { memo, forwardRef, useMemo, useImperativeHandle, useState, useRef, useCallback, useEffect } from 'react';
19
- import { useReactFlow, ReactFlow, ReactFlowProvider } from '@xyflow/react';
20
- import dagre from '@dagrejs/dagre';
21
- import '@xyflow/react/dist/style.css';
22
- import { useClipboard } from '@mantine/hooks';
23
- import { notifications } from '@mantine/notifications';
24
- import { useNavigate } from '@tanstack/react-router';
25
-
26
- function FormFieldRenderer({ field, form, richTextRenderer }) {
27
- const commonProps = {
28
- label: field.label,
29
- description: field.description,
30
- placeholder: field.placeholder,
31
- required: field.required,
32
- ...form.getInputProps(field.name)
33
- };
34
- switch (field.type) {
35
- case "text":
36
- return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
37
- case "textarea":
38
- return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 3, autosize: true });
39
- case "number":
40
- return /* @__PURE__ */ jsx(NumberInput, { ...commonProps, min: field.min, max: field.max });
41
- case "select":
42
- return /* @__PURE__ */ jsx(
43
- Select,
44
- {
45
- ...commonProps,
46
- data: field.options?.map((opt) => ({
47
- label: opt.label,
48
- value: String(opt.value)
49
- })) || []
50
- }
51
- );
52
- case "checkbox":
53
- return /* @__PURE__ */ jsx(Checkbox, { ...commonProps, ...form.getInputProps(field.name, { type: "checkbox" }) });
54
- case "radio":
55
- return /* @__PURE__ */ jsx(Radio.Group, { ...commonProps, children: /* @__PURE__ */ jsx(Stack, { gap: "xs", children: field.options?.map((opt) => /* @__PURE__ */ jsx(Radio, { value: String(opt.value), label: opt.label }, opt.value)) }) });
56
- case "richtext": {
57
- const inputProps = form.getInputProps(field.name);
58
- if (richTextRenderer) {
59
- return richTextRenderer({
60
- content: inputProps.value || "",
61
- onChange: (content) => form.setFieldValue(field.name, content),
62
- placeholder: field.placeholder
63
- });
64
- }
65
- return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 5, autosize: true });
66
- }
67
- default:
68
- return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
69
- }
70
- }
71
- var iconMap = {
72
- IconCheck,
73
- IconX,
74
- IconRefresh,
75
- IconAlertTriangle,
76
- IconEdit,
77
- IconEye,
78
- IconRocket,
79
- IconMessageCircle,
80
- IconArrowUp,
81
- IconClock,
82
- IconFileText,
83
- IconSend,
84
- IconMail
85
- };
86
- function getIcon(iconName) {
87
- if (!iconName) return null;
88
- const icon = iconMap[iconName];
89
- if (!icon && process.env.NODE_ENV !== "production") {
90
- console.warn(`[iconMap] Unknown icon "${iconName}". Allowed: ${Object.keys(iconMap).join(", ")}`);
91
- }
92
- return icon || null;
93
- }
94
- function resolveDefaultValue(context, path) {
95
- if (!context || typeof context !== "object") return void 0;
96
- return path.split(".").reduce((obj, key) => {
97
- if (obj && typeof obj === "object" && key in obj) {
98
- return obj[key];
99
- }
100
- return void 0;
101
- }, context);
102
- }
103
- function ActionModal({
104
- action,
105
- task,
106
- opened,
107
- onClose,
108
- onSubmit,
109
- richTextRenderer,
110
- error,
111
- isPending
112
- }) {
113
- const getInitialValuesFromContext = () => {
114
- if (!action.form?.fields) return {};
115
- return action.form.fields.reduce(
116
- (acc, field) => {
117
- if (field.defaultValueFromContext && task?.context) {
118
- const value = resolveDefaultValue(task.context, field.defaultValueFromContext);
119
- if (value !== void 0) {
120
- acc[field.name] = value;
121
- }
122
- }
123
- return acc;
124
- },
125
- {}
126
- );
127
- };
128
- const form = useForm({
129
- initialValues: {
130
- ...getInitialValuesFromContext(),
131
- ...action.payloadTemplate || {},
132
- notes: ""
133
- }
134
- });
135
- const handleSubmit = form.onSubmit((values) => {
136
- const { notes, ...payload } = values;
137
- onSubmit(payload, notes || void 0);
138
- });
139
- const Icon = getIcon(action.icon);
140
- const errorMessage = error ? (() => {
141
- const { message, fields, requestId } = getErrorInfo(error);
142
- return formatErrorMessage(message, requestId, fields);
143
- })() : null;
144
- if (!action.form) {
145
- return null;
146
- }
147
- return /* @__PURE__ */ jsx(CustomModal, { opened, onClose, size: "xl", children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs(Stack, { children: [
148
- /* @__PURE__ */ jsx(Title, { order: 3, children: action.form.title || action.label }),
149
- action.form.description && /* @__PURE__ */ jsx(Text, { c: "dimmed", children: action.form.description }),
150
- action.form.fields.map((field) => /* @__PURE__ */ jsx(FormFieldRenderer, { field, form, richTextRenderer }, field.name)),
151
- /* @__PURE__ */ jsx(
152
- Textarea,
153
- {
154
- label: "Notes (optional)",
155
- placeholder: "Add any notes or reasoning...",
156
- ...form.getInputProps("notes")
157
- }
158
- ),
159
- errorMessage && /* @__PURE__ */ jsx(Alert, { color: "red", variant: "light", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), title: "Submission failed", children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { whiteSpace: "pre-line" }, children: errorMessage }) }),
160
- /* @__PURE__ */ jsxs(Group, { mt: "md", justify: "space-between", children: [
161
- /* @__PURE__ */ jsx(Button, { variant: "light", onClick: onClose, children: "Cancel" }),
162
- /* @__PURE__ */ jsx(
163
- Button,
164
- {
165
- type: "submit",
166
- color: action.color || "blue",
167
- leftSection: Icon ? /* @__PURE__ */ jsx(Icon, { size: 16 }) : null,
168
- loading: isPending,
169
- children: action.label
170
- }
171
- )
172
- ] })
173
- ] }) }) });
174
- }
175
- function ContentSections({ context, sections, titles }) {
176
- const sectionKeys = sections || Object.keys(context).filter((key) => key !== "contentDisplay" && typeof context[key] === "string");
177
- const formatTitle = (key) => key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
178
- return /* @__PURE__ */ jsx(Stack, { gap: "lg", children: sectionKeys.map((key) => {
179
- const content = context[key];
180
- if (typeof content !== "string") return null;
181
- const title = titles?.[key] || formatTitle(key);
182
- return /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
183
- /* @__PURE__ */ jsx(Title, { order: 4, children: title }),
184
- /* @__PURE__ */ jsx(StyledMarkdown, { children: content })
185
- ] }, key);
186
- }) });
187
- }
188
- function CollapsibleJsonSection({ title, data, defaultExpanded = false }) {
189
- const [isExpanded, setIsExpanded] = useState(defaultExpanded);
190
- const [isHovered, setIsHovered] = useState(false);
191
- return /* @__PURE__ */ jsxs(
192
- "div",
193
- {
194
- style: {
195
- borderRadius: "var(--mantine-radius-default)",
196
- backgroundColor: isHovered ? "var(--color-surface-hover, rgba(0,0,0,0.02))" : "transparent",
197
- transition: "background-color var(--duration-fast) var(--easing)"
198
- },
199
- children: [
200
- /* @__PURE__ */ jsxs(
201
- Group,
202
- {
203
- gap: 4,
204
- onClick: () => setIsExpanded(!isExpanded),
205
- onMouseEnter: () => setIsHovered(true),
206
- onMouseLeave: () => setIsHovered(false),
207
- style: {
208
- cursor: "pointer",
209
- padding: "0.375rem 0.5rem",
210
- userSelect: "none"
211
- },
212
- wrap: "nowrap",
213
- children: [
214
- /* @__PURE__ */ jsx(
215
- ActionIcon,
216
- {
217
- variant: "transparent",
218
- size: "xs",
219
- style: {
220
- transition: "transform var(--duration-fast) var(--easing)",
221
- transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
222
- },
223
- children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
224
- }
225
- ),
226
- title
227
- ]
228
- }
229
- ),
230
- /* @__PURE__ */ jsx(Collapse, { in: isExpanded, children: /* @__PURE__ */ jsx(JsonViewer, { data }) })
231
- ]
232
- }
233
- );
234
- }
235
- function ContractDisplay({ contract, defaultExpanded = false }) {
236
- return /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
237
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Contract" }),
238
- /* @__PURE__ */ jsx(
239
- CollapsibleJsonSection,
240
- {
241
- title: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Input Schema" }),
242
- data: contract.inputSchema,
243
- defaultExpanded
244
- }
245
- ),
246
- contract.outputSchema != null && /* @__PURE__ */ jsx(
247
- CollapsibleJsonSection,
248
- {
249
- title: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Output Schema" }),
250
- data: contract.outputSchema,
251
- defaultExpanded
252
- }
253
- )
254
- ] });
255
- }
256
- function ConfigCard({ icon, title, badge, items, color = "blue" }) {
257
- const visibleItems = items.filter((item) => item.value !== void 0 && item.value !== null);
258
- if (visibleItems.length === 0) return null;
259
- return /* @__PURE__ */ jsx(Card, { padding: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
260
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
261
- /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "light", color, radius: "sm", children: icon }),
262
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { flex: 1, fontFamily: "var(--elevasis-font-family-subtitle)" }, children: title }),
263
- badge && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color, children: badge })
264
- ] }),
265
- /* @__PURE__ */ jsx(Stack, { gap: 4, children: visibleItems.map((item, index) => /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
266
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { minWidth: "fit-content" }, children: item.label }),
267
- typeof item.value === "string" || typeof item.value === "number" ? /* @__PURE__ */ jsx(Text, { size: "xs", ff: item.mono ? "monospace" : void 0, truncate: true, style: { flex: 1 }, children: item.value }) : item.value
268
- ] }, index)) })
269
- ] }) });
270
- }
271
- function ToolsListDisplay({ tools, compact = false, maxVisible = 0 }) {
272
- if (tools.length === 0) {
273
- return /* @__PURE__ */ jsxs("div", { children: [
274
- !compact && /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Tools" }),
275
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No tools configured" })
276
- ] });
277
- }
278
- const normalizedTools = tools.map((tool) => typeof tool === "string" ? { name: tool } : tool);
279
- const visibleTools = maxVisible > 0 ? normalizedTools.slice(0, maxVisible) : normalizedTools;
280
- const hiddenCount = maxVisible > 0 ? Math.max(0, normalizedTools.length - maxVisible) : 0;
281
- return /* @__PURE__ */ jsxs("div", { children: [
282
- !compact && /* @__PURE__ */ jsxs(Group, { gap: "xs", mb: "xs", children: [
283
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Tools" }),
284
- /* @__PURE__ */ jsx(Badge, { variant: "light", size: "xs", children: tools.length })
285
- ] }),
286
- /* @__PURE__ */ jsx(SimpleGrid, { cols: 2, spacing: "xs", children: visibleTools.map((tool, index) => /* @__PURE__ */ jsxs(Card, { withBorder: true, p: "sm", children: [
287
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", mb: tool.description ? "xs" : 0, children: [
288
- /* @__PURE__ */ jsx(IconTool, { size: 16, style: { color: "var(--color-text-subtle)", flexShrink: 0 } }),
289
- /* @__PURE__ */ jsx(Text, { size: "sm", ff: "monospace", fw: 500, children: tool.name })
290
- ] }),
291
- tool.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: tool.description })
292
- ] }, `${tool.name}-${index}`)) }),
293
- hiddenCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", fs: "italic", mt: "xs", children: [
294
- "+",
295
- hiddenCount,
296
- " more tools"
297
- ] })
298
- ] });
299
- }
300
- var NODE_WIDTH = 200;
301
- var NODE_HEIGHT = 100;
302
- var RANK_SEP = 80;
303
- var NODE_SEP = 30;
304
- function useNewKnowledgeMapLayout(knowledgeMap, agentName) {
305
- return useMemo(() => {
306
- if (!knowledgeMap || knowledgeMap.nodes.length === 0) {
307
- return { nodes: [], edges: [] };
308
- }
309
- const agentNodeId = "__agent__";
310
- const edges = knowledgeMap.nodes.map((node) => ({
311
- id: `edge-${agentNodeId}-${node.id}`,
312
- source: agentNodeId,
313
- target: node.id,
314
- type: "knowledgeMap",
315
- data: {}
316
- }));
317
- const dagreGraph = new dagre.graphlib.Graph();
318
- dagreGraph.setDefaultEdgeLabel(() => ({}));
319
- dagreGraph.setGraph({
320
- rankdir: "TB",
321
- ranksep: RANK_SEP,
322
- nodesep: NODE_SEP,
323
- marginx: 40,
324
- marginy: 40
325
- });
326
- dagreGraph.setNode(agentNodeId, { width: NODE_WIDTH, height: NODE_HEIGHT });
327
- knowledgeMap.nodes.forEach((node) => {
328
- dagreGraph.setNode(node.id, { width: NODE_WIDTH, height: NODE_HEIGHT });
329
- });
330
- edges.forEach((edge) => {
331
- dagreGraph.setEdge(edge.source, edge.target);
332
- });
333
- dagre.layout(dagreGraph);
334
- const agentDagreNode = dagreGraph.node(agentNodeId);
335
- const agentNode = {
336
- id: agentNodeId,
337
- type: "knowledgeMap",
338
- position: {
339
- x: agentDagreNode.x - NODE_WIDTH / 2,
340
- y: agentDagreNode.y - NODE_HEIGHT / 2
341
- },
342
- data: {
343
- id: agentNodeId,
344
- name: agentName,
345
- description: "Agent with lazy-loading knowledge",
346
- loaded: true,
347
- hasPrompt: false,
348
- isAgentNode: true
349
- }
350
- };
351
- const knowledgeNodes = knowledgeMap.nodes.map((node) => {
352
- const dagreNode = dagreGraph.node(node.id);
353
- return {
354
- id: node.id,
355
- type: "knowledgeMap",
356
- position: {
357
- x: dagreNode.x - NODE_WIDTH / 2,
358
- y: dagreNode.y - NODE_HEIGHT / 2
359
- },
360
- data: {
361
- id: node.id,
362
- name: node.id,
363
- description: node.description,
364
- loaded: node.loaded,
365
- hasPrompt: node.hasPrompt,
366
- isAgentNode: false
367
- }
368
- };
369
- });
370
- return { nodes: [agentNode, ...knowledgeNodes], edges };
371
- }, [knowledgeMap, agentName]);
372
- }
373
- var NewKnowledgeMapNode = memo(function NewKnowledgeMapNode2({ data, selected }) {
374
- const nodeColor = data.isAgentNode ? "violet" : data.loaded ? "teal" : "blue";
375
- return /* @__PURE__ */ jsx(BaseNode, { color: nodeColor, selected, width: 200, handleDirection: "vertical", children: /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
376
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
377
- data.isAgentNode ? /* @__PURE__ */ jsx(IconBrain, { size: 16, style: { flexShrink: 0 } }) : data.loaded ? /* @__PURE__ */ jsx(IconBrain, { size: 16, style: { flexShrink: 0 } }) : /* @__PURE__ */ jsx(IconBrain, { size: 16, style: { flexShrink: 0, opacity: 0.4 } }),
378
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, truncate: true, style: { flex: 1, fontFamily: "var(--mantine-font-family-headings)" }, children: data.name })
379
- ] }),
380
- data.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: data.description }),
381
- /* @__PURE__ */ jsx(Group, { gap: 4, children: data.isAgentNode ? /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: "Root" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
382
- /* @__PURE__ */ jsx(
383
- Badge,
384
- {
385
- size: "xs",
386
- variant: "light",
387
- color: data.loaded ? "teal" : "gray",
388
- leftSection: /* @__PURE__ */ jsx(IconBrain, { size: 10 }),
389
- children: data.loaded ? "Loaded" : "Available"
390
- }
391
- ),
392
- data.hasPrompt && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ jsx(IconFileText, { size: 10 }), children: "Prompt" })
393
- ] }) })
394
- ] }) });
395
- });
396
- var NewKnowledgeMapEdge = memo(function NewKnowledgeMapEdge2({
397
- id,
398
- sourceX,
399
- sourceY,
400
- targetX,
401
- targetY,
402
- sourcePosition,
403
- targetPosition,
404
- selected,
405
- data
406
- }) {
407
- const colors = useGraphTheme();
408
- return /* @__PURE__ */ jsx(
409
- BaseEdge,
410
- {
411
- id,
412
- sourceX,
413
- sourceY,
414
- targetX,
415
- targetY,
416
- sourcePosition,
417
- targetPosition,
418
- color: colors.primary,
419
- glowColor: colors.primaryGlow,
420
- animated: false,
421
- selected,
422
- dimmed: data?.dimmed
423
- }
424
- );
425
- });
426
- var nodeTypes = {
427
- knowledgeMap: NewKnowledgeMapNode
428
- };
429
- var edgeTypes = {
430
- knowledgeMap: NewKnowledgeMapEdge
431
- };
432
- function NewKnowledgeMapGraphInner({ knowledgeMap, agentName, compact, fitViewTrigger }) {
433
- const { nodes: layoutNodes, edges: layoutEdges } = useNewKnowledgeMapLayout(knowledgeMap, agentName);
434
- const { nodes, edges, handleNodeMouseEnter, handleNodeMouseLeave } = useGraphHighlighting(layoutNodes, layoutEdges);
435
- if (!knowledgeMap || knowledgeMap.nodes.length === 0) {
436
- return /* @__PURE__ */ jsxs("div", { children: [
437
- !compact && /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Knowledge Map" }),
438
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No knowledge nodes configured" })
439
- ] });
440
- }
441
- const containerHeight = calculateGraphHeight({
442
- itemCount: knowledgeMap.nodeCount,
443
- minHeight: 250,
444
- maxHeight: 450,
445
- heightPerItem: 60
446
- });
447
- return /* @__PURE__ */ jsxs("div", { children: [
448
- !compact && /* @__PURE__ */ jsxs(Group, { gap: "xs", mb: "xs", children: [
449
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Knowledge Map" }),
450
- /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "xs", children: [
451
- knowledgeMap.nodeCount,
452
- " ",
453
- knowledgeMap.nodeCount === 1 ? "node" : "nodes"
454
- ] })
455
- ] }),
456
- /* @__PURE__ */ jsx(
457
- Box,
458
- {
459
- className: Graph_module_css_default.graphContainer,
460
- style: {
461
- width: "100%",
462
- height: containerHeight,
463
- border: "1px solid var(--color-border)",
464
- borderRadius: "var(--mantine-radius-md)",
465
- overflow: "hidden"
466
- },
467
- children: /* @__PURE__ */ jsxs(
468
- ReactFlow,
469
- {
470
- nodes,
471
- edges,
472
- nodeTypes,
473
- edgeTypes,
474
- onNodeMouseEnter: handleNodeMouseEnter,
475
- onNodeMouseLeave: handleNodeMouseLeave,
476
- fitView: true,
477
- fitViewOptions: { padding: 0.15 },
478
- proOptions: { hideAttribution: true },
479
- minZoom: GRAPH_CONSTANTS.MIN_ZOOM,
480
- maxZoom: GRAPH_CONSTANTS.MAX_ZOOM,
481
- nodesDraggable: false,
482
- nodesConnectable: false,
483
- elementsSelectable: true,
484
- selectNodesOnDrag: false,
485
- panOnDrag: true,
486
- zoomOnScroll: true,
487
- zoomOnPinch: true,
488
- panOnScroll: false,
489
- children: [
490
- /* @__PURE__ */ jsx(GraphBackground, {}),
491
- /* @__PURE__ */ jsx(GraphFitViewButton, { padding: 0.15, variant: "mantine", duration: 300 }),
492
- /* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger })
493
- ]
494
- }
495
- )
496
- }
497
- )
498
- ] });
499
- }
500
- function NewKnowledgeMapGraph(props) {
501
- return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(NewKnowledgeMapGraphInner, { ...props }) });
502
- }
503
- function DefinitionSectionHeader({ expanded, onToggle, icon, title, count }) {
504
- return /* @__PURE__ */ jsxs(Group, { gap: 4, onClick: onToggle, style: { cursor: "pointer", userSelect: "none" }, wrap: "nowrap", children: [
505
- /* @__PURE__ */ jsx(
506
- ActionIcon,
507
- {
508
- variant: "transparent",
509
- size: "xs",
510
- style: {
511
- transition: "transform var(--duration-fast) var(--easing)",
512
- transform: expanded ? "rotate(90deg)" : "rotate(0deg)"
513
- },
514
- children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
515
- }
516
- ),
517
- icon,
518
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title }),
519
- count && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
520
- "(",
521
- count,
522
- ")"
523
- ] })
524
- ] });
525
- }
526
- function AgentDefinitionDisplay({ agent, defaultExpanded = false }) {
527
- const [systemPromptExpanded, setSystemPromptExpanded] = useState(defaultExpanded);
528
- const [configExpanded, setConfigExpanded] = useState(defaultExpanded);
529
- const [knowledgeMapExpanded, setKnowledgeMapExpanded] = useState(defaultExpanded);
530
- const [knowledgeMapFitTrigger, setKnowledgeMapFitTrigger] = useState(0);
531
- const [toolsExpanded, setToolsExpanded] = useState(defaultExpanded);
532
- const [memoryPrefsExpanded, setMemoryPrefsExpanded] = useState(defaultExpanded);
533
- const hasConstraints = agent.config.constraints && Object.keys(agent.config.constraints).length > 0;
534
- const hasMemoryPreferences = !!agent.config.memoryPreferences;
535
- return /* @__PURE__ */ jsxs(Stack, { children: [
536
- /* @__PURE__ */ jsxs("div", { children: [
537
- /* @__PURE__ */ jsx(
538
- DefinitionSectionHeader,
539
- {
540
- expanded: configExpanded,
541
- onToggle: () => setConfigExpanded(!configExpanded),
542
- icon: /* @__PURE__ */ jsx(IconSettings, { size: 16, color: "var(--color-text-subtle)" }),
543
- title: "Configuration"
544
- }
545
- ),
546
- /* @__PURE__ */ jsxs(Collapse, { in: configExpanded, children: [
547
- /* @__PURE__ */ jsxs(SimpleGrid, { cols: 2, spacing: "sm", mt: "xs", pl: "xl", children: [
548
- /* @__PURE__ */ jsx(
549
- ConfigCard,
550
- {
551
- icon: /* @__PURE__ */ jsx(IconCpu, { size: 14 }),
552
- title: "Model",
553
- badge: agent.modelConfig.provider,
554
- items: [
555
- {
556
- label: "Model",
557
- value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: agent.modelConfig.model })
558
- },
559
- { label: "Temperature", value: agent.modelConfig.temperature, mono: true },
560
- { label: "Max Tokens", value: agent.modelConfig.maxOutputTokens?.toLocaleString(), mono: true },
561
- { label: "Top P", value: agent.modelConfig.topP, mono: true },
562
- {
563
- label: "Reasoning",
564
- value: agent.modelConfig.modelOptions && "reasoning_effort" in agent.modelConfig.modelOptions ? String(agent.modelConfig.modelOptions.reasoning_effort) : void 0,
565
- mono: true
566
- },
567
- {
568
- label: "Verbosity",
569
- value: agent.modelConfig.modelOptions && "verbosity" in agent.modelConfig.modelOptions ? String(agent.modelConfig.modelOptions.verbosity) : void 0,
570
- mono: true
571
- }
572
- ]
573
- }
574
- ),
575
- hasConstraints && /* @__PURE__ */ jsx(
576
- ConfigCard,
577
- {
578
- icon: /* @__PURE__ */ jsx(IconClockHour4, { size: 14 }),
579
- title: "Constraints",
580
- color: "orange",
581
- items: [
582
- { label: "Max Iterations", value: agent.config.constraints?.maxIterations, mono: true },
583
- {
584
- label: "Timeout",
585
- value: agent.config.constraints?.timeout ? `${(agent.config.constraints.timeout / 1e3).toFixed(0)}s` : void 0,
586
- mono: true
587
- },
588
- { label: "Max Memory Keys", value: agent.config.constraints?.maxSessionMemoryKeys, mono: true },
589
- {
590
- label: "Max Memory Tokens",
591
- value: agent.config.constraints?.maxMemoryTokens?.toLocaleString(),
592
- mono: true
593
- }
594
- ]
595
- }
596
- ),
597
- /* @__PURE__ */ jsx(
598
- ConfigCard,
599
- {
600
- icon: /* @__PURE__ */ jsx(IconVersions, { size: 14 }),
601
- title: "Version",
602
- color: "grape",
603
- items: [
604
- {
605
- label: "Version",
606
- value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: agent.config.version })
607
- }
608
- ]
609
- }
610
- ),
611
- /* @__PURE__ */ jsx(
612
- ConfigCard,
613
- {
614
- icon: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 14 }),
615
- title: "Execution Interface",
616
- color: "teal",
617
- items: [
618
- {
619
- label: "Has Interface",
620
- value: agent.interface ? /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "green", children: "Yes" }) : /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "gray", children: "No" })
621
- }
622
- ]
623
- }
624
- )
625
- ] }),
626
- /* @__PURE__ */ jsx("div", { style: { paddingLeft: "var(--mantine-spacing-xl)", marginTop: "var(--mantine-spacing-sm)" }, children: /* @__PURE__ */ jsx(ContractDisplay, { contract: agent.contract, defaultExpanded }) })
627
- ] })
628
- ] }),
629
- /* @__PURE__ */ jsx(Divider, {}),
630
- /* @__PURE__ */ jsxs("div", { children: [
631
- /* @__PURE__ */ jsx(
632
- DefinitionSectionHeader,
633
- {
634
- expanded: systemPromptExpanded,
635
- onToggle: () => setSystemPromptExpanded(!systemPromptExpanded),
636
- icon: /* @__PURE__ */ jsx(IconBrain, { size: 16, color: "var(--color-text-subtle)" }),
637
- title: "System Prompt"
638
- }
639
- ),
640
- /* @__PURE__ */ jsx(Collapse, { in: systemPromptExpanded, children: /* @__PURE__ */ jsx(Paper, { p: "sm", mt: "xs", children: /* @__PURE__ */ jsx(StyledMarkdown, { children: agent.config.systemPrompt }) }) })
641
- ] }),
642
- agent.knowledgeMap && agent.knowledgeMap.nodeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
643
- /* @__PURE__ */ jsx(Divider, {}),
644
- /* @__PURE__ */ jsxs("div", { children: [
645
- /* @__PURE__ */ jsx(
646
- DefinitionSectionHeader,
647
- {
648
- expanded: knowledgeMapExpanded,
649
- onToggle: () => {
650
- const willExpand = !knowledgeMapExpanded;
651
- setKnowledgeMapExpanded(willExpand);
652
- if (willExpand) {
653
- setKnowledgeMapFitTrigger((prev) => prev + 1);
654
- }
655
- },
656
- icon: /* @__PURE__ */ jsx(IconNetwork, { size: 16, color: "var(--color-text-subtle)" }),
657
- title: "Knowledge Map",
658
- count: `${agent.knowledgeMap.nodeCount} ${agent.knowledgeMap.nodeCount === 1 ? "node" : "nodes"}`
659
- }
660
- ),
661
- /* @__PURE__ */ jsx(Collapse, { in: knowledgeMapExpanded, children: /* @__PURE__ */ jsx("div", { style: { marginTop: "var(--mantine-spacing-xs)" }, children: /* @__PURE__ */ jsx(
662
- NewKnowledgeMapGraph,
663
- {
664
- knowledgeMap: agent.knowledgeMap,
665
- agentName: agent.config.name,
666
- compact: true,
667
- fitViewTrigger: knowledgeMapFitTrigger
668
- }
669
- ) }) })
670
- ] })
671
- ] }),
672
- /* @__PURE__ */ jsx(Divider, {}),
673
- /* @__PURE__ */ jsxs("div", { children: [
674
- /* @__PURE__ */ jsx(
675
- DefinitionSectionHeader,
676
- {
677
- expanded: toolsExpanded,
678
- onToggle: () => setToolsExpanded(!toolsExpanded),
679
- icon: /* @__PURE__ */ jsx(IconTool, { size: 16, color: "var(--color-text-subtle)" }),
680
- title: "Tools",
681
- count: String(agent.tools.length)
682
- }
683
- ),
684
- /* @__PURE__ */ jsx(Collapse, { in: toolsExpanded, children: /* @__PURE__ */ jsx("div", { style: { marginTop: "var(--mantine-spacing-xs)" }, children: /* @__PURE__ */ jsx(ToolsListDisplay, { tools: agent.tools, compact: true }) }) })
685
- ] }),
686
- hasMemoryPreferences && /* @__PURE__ */ jsxs(Fragment, { children: [
687
- /* @__PURE__ */ jsx(Divider, {}),
688
- /* @__PURE__ */ jsxs("div", { children: [
689
- /* @__PURE__ */ jsx(
690
- DefinitionSectionHeader,
691
- {
692
- expanded: memoryPrefsExpanded,
693
- onToggle: () => setMemoryPrefsExpanded(!memoryPrefsExpanded),
694
- title: "Memory Preferences"
695
- }
696
- ),
697
- /* @__PURE__ */ jsx(Collapse, { in: memoryPrefsExpanded, children: /* @__PURE__ */ jsx(
698
- Paper,
699
- {
700
- p: "sm",
701
- mt: "xs",
702
- style: {
703
- backgroundColor: "var(--color-background)",
704
- border: "1px solid var(--color-border)"
705
- },
706
- children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { whiteSpace: "pre-wrap" }, children: agent.config.memoryPreferences })
707
- }
708
- ) })
709
- ] })
710
- ] })
711
- ] });
712
- }
713
- function WorkflowDefinitionDisplay({ workflow, defaultExpanded = false }) {
714
- const [configExpanded, setConfigExpanded] = useState(defaultExpanded);
715
- return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsxs("div", { children: [
716
- /* @__PURE__ */ jsxs(
717
- Group,
718
- {
719
- gap: 4,
720
- onClick: () => setConfigExpanded(!configExpanded),
721
- style: { cursor: "pointer", userSelect: "none" },
722
- wrap: "nowrap",
723
- children: [
724
- /* @__PURE__ */ jsx(
725
- ActionIcon,
726
- {
727
- variant: "transparent",
728
- size: "xs",
729
- style: {
730
- transition: "transform var(--duration-fast) var(--easing)",
731
- transform: configExpanded ? "rotate(90deg)" : "rotate(0deg)"
732
- },
733
- children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
734
- }
735
- ),
736
- /* @__PURE__ */ jsx(IconSettings, { size: 16, color: "var(--color-text-subtle)" }),
737
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Configuration" })
738
- ]
739
- }
740
- ),
741
- /* @__PURE__ */ jsxs(Collapse, { in: configExpanded, children: [
742
- /* @__PURE__ */ jsxs(SimpleGrid, { cols: 2, spacing: "sm", mt: "xs", pl: "xl", children: [
743
- /* @__PURE__ */ jsx(
744
- ConfigCard,
745
- {
746
- icon: /* @__PURE__ */ jsx(IconVersions, { size: 14 }),
747
- title: "Version",
748
- color: "grape",
749
- items: [
750
- {
751
- label: "Version",
752
- value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: workflow.config.version })
753
- }
754
- ]
755
- }
756
- ),
757
- /* @__PURE__ */ jsx(
758
- ConfigCard,
759
- {
760
- icon: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 14 }),
761
- title: "Execution Interface",
762
- color: "teal",
763
- items: [
764
- {
765
- label: "Has Interface",
766
- value: workflow.interface ? /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "green", children: "Yes" }) : /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "gray", children: "No" })
767
- }
768
- ]
769
- }
770
- )
771
- ] }),
772
- /* @__PURE__ */ jsx("div", { style: { paddingLeft: "var(--mantine-spacing-xl)", marginTop: "var(--mantine-spacing-sm)" }, children: /* @__PURE__ */ jsx(ContractDisplay, { contract: workflow.contract, defaultExpanded }) })
773
- ] })
774
- ] }) });
775
- }
776
- function isAgentDefinition(structure) {
777
- return structure.config.type === "agent" && "modelConfig" in structure;
778
- }
779
- function isWorkflowDefinition(structure) {
780
- return structure.config.type === "workflow" && "steps" in structure;
781
- }
782
- function ResourceDefinitionSection({
783
- resourceDefinition,
784
- defaultExpanded = false
785
- }) {
786
- const isAgent = isAgentDefinition(resourceDefinition);
787
- const isWorkflow = isWorkflowDefinition(resourceDefinition);
788
- if (isAgent) {
789
- return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
790
- /* @__PURE__ */ jsx(CardHeader, { icon: /* @__PURE__ */ jsx(IconBrain, { size: 18 }), title: "Agent Definition" }),
791
- /* @__PURE__ */ jsx(Space, { h: 0 }),
792
- /* @__PURE__ */ jsx(AgentDefinitionDisplay, { agent: resourceDefinition, defaultExpanded })
793
- ] }) });
794
- }
795
- if (isWorkflow) {
796
- return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
797
- /* @__PURE__ */ jsx(CardHeader, { icon: /* @__PURE__ */ jsx(IconSitemap, { size: 18 }), title: "Workflow Definition" }),
798
- /* @__PURE__ */ jsx(WorkflowDefinitionDisplay, { workflow: resourceDefinition, defaultExpanded })
799
- ] }) });
800
- }
801
- return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Unknown resource type" }) });
802
- }
803
-
804
- // src/components/operations/executions/logConstants.ts
805
- var LOG_LEVEL_CONFIG = {
806
- debug: {
807
- label: "DEBUG",
808
- color: "gray",
809
- textColor: "var(--color-text-subtle)",
810
- icon: "\u{1F50D}"
811
- },
812
- info: {
813
- label: "INFO",
814
- color: "blue",
815
- textColor: "var(--color-text-dimmed)",
816
- icon: "\u2139\uFE0F"
817
- },
818
- warn: {
819
- label: "WARN",
820
- color: "yellow",
821
- textColor: "var(--color-warning)",
822
- icon: "\u26A0\uFE0F"
823
- },
824
- error: {
825
- label: "ERROR",
826
- color: "red",
827
- textColor: "var(--color-error)",
828
- icon: "\u274C"
829
- }
830
- };
831
- var EXECUTION_STATUS_CONFIG = {
832
- pending: {
833
- label: "Pending",
834
- color: "gray",
835
- textColor: "var(--color-text-dimmed)"
836
- },
837
- running: {
838
- label: "Running",
839
- color: "blue",
840
- textColor: "var(--color-primary)"
841
- },
842
- completed: {
843
- label: "Completed",
844
- color: "green",
845
- textColor: "var(--color-success)"
846
- },
847
- failed: {
848
- label: "Failed",
849
- color: "red",
850
- textColor: "var(--color-error)"
851
- },
852
- warning: {
853
- label: "Warning",
854
- color: "yellow",
855
- textColor: "var(--color-warning)"
856
- }
857
- };
858
- function getLogLevelConfig(level) {
859
- const normalizedLevel = level.toLowerCase();
860
- return LOG_LEVEL_CONFIG[normalizedLevel] || LOG_LEVEL_CONFIG.info;
861
- }
862
- function getExecutionStatusConfig(status) {
863
- const normalizedStatus = status.toLowerCase();
864
- return EXECUTION_STATUS_CONFIG[normalizedStatus] || EXECUTION_STATUS_CONFIG.pending;
865
- }
866
- function BaseExecutionLogsHeader({
867
- execution,
868
- resourceId,
869
- onDeleteClick,
870
- onRetryClick,
871
- onCancelClick,
872
- renderMetrics
873
- }) {
874
- const { currentMembership } = useOrganization();
875
- const organizationName = currentMembership?.organization?.name;
876
- const resourceTag = organizationName ? `${organizationName}/${resourceId}` : resourceId;
877
- return /* @__PURE__ */ jsxs(Stack, { children: [
878
- /* @__PURE__ */ jsx(
879
- CardHeader,
880
- {
881
- icon: /* @__PURE__ */ jsx(IconTerminal2, { size: 18 }),
882
- title: "Execution Logs",
883
- rightSection: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
884
- /* @__PURE__ */ jsx(Badge, { color: getExecutionStatusConfig(execution.status).color, size: "sm", children: getExecutionStatusConfig(execution.status).label.toUpperCase() }),
885
- /* @__PURE__ */ jsx(Badge, { color: getResourceStatusColor(execution.resourceStatus), size: "sm", variant: "outline", children: execution.resourceStatus.toUpperCase() }),
886
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-subtle)", ff: "monospace", children: execution.id }),
887
- /* @__PURE__ */ jsx(CopyButton, { value: `${resourceTag} ${execution.id}`, children: ({ copied, copy }) => /* @__PURE__ */ jsx(ActionIcon, { onClick: copy, variant: "subtle", color: copied ? "green" : "var(--color-text-subtle)", children: copied ? /* @__PURE__ */ jsx(IconCheck, { size: 16 }) : /* @__PURE__ */ jsx(IconCopy, { size: 16 }) }) }),
888
- onCancelClick && /* @__PURE__ */ jsx(ActionIcon, { onClick: onCancelClick, variant: "subtle", color: "orange", children: /* @__PURE__ */ jsx(IconPlayerStop, { size: 16 }) }),
889
- onRetryClick && /* @__PURE__ */ jsx(ActionIcon, { onClick: onRetryClick, variant: "subtle", children: /* @__PURE__ */ jsx(IconReload, { size: 16 }) }),
890
- /* @__PURE__ */ jsx(ActionIcon, { onClick: onDeleteClick, variant: "subtle", color: "var(--color-error)", children: /* @__PURE__ */ jsx(IconTrash, { size: 16 }) })
891
- ] })
892
- }
893
- ),
894
- renderMetrics ? renderMetrics(execution) : /* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
895
- /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
896
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "Started:" }),
897
- " ",
898
- new Date(execution.startTime).toLocaleString()
899
- ] }),
900
- execution.endTime && /* @__PURE__ */ jsxs(Fragment, { children: [
901
- /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
902
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "Ended:" }),
903
- " ",
904
- new Date(execution.endTime).toLocaleString()
905
- ] }),
906
- /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
907
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "Duration:" }),
908
- " ",
909
- ((execution.endTime - execution.startTime) / 1e3).toFixed(2),
910
- "s"
911
- ] })
912
- ] }),
913
- execution.apiVersion && /* @__PURE__ */ jsxs(Text, { size: "sm", component: "span", children: [
914
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "API:" }),
915
- " ",
916
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
917
- "v",
918
- execution.apiVersion
919
- ] })
920
- ] }),
921
- execution.resourceVersion && /* @__PURE__ */ jsxs(Text, { size: "sm", component: "span", children: [
922
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "Resource:" }),
923
- " ",
924
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
925
- "v",
926
- execution.resourceVersion
927
- ] })
928
- ] }),
929
- execution.sdkVersion && /* @__PURE__ */ jsxs(Text, { size: "sm", component: "span", children: [
930
- /* @__PURE__ */ jsx(Text, { span: true, fw: 500, children: "SDK:" }),
931
- " ",
932
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
933
- "v",
934
- execution.sdkVersion
935
- ] })
936
- ] })
937
- ] })
938
- ] });
939
- }
940
- function BaseExecutionLogsStates({ executionId, isLoading, execution }) {
941
- const { loader } = useAppearance();
942
- if (!executionId) {
943
- return /* @__PURE__ */ jsx(Center, { h: "100%", children: /* @__PURE__ */ jsx(Text, { c: "dimmed", children: "Select an execution to view details" }) });
944
- }
945
- if (isLoading) {
946
- return /* @__PURE__ */ jsx(Center, { h: "100%", children: loader });
947
- }
948
- if (!execution) {
949
- return /* @__PURE__ */ jsx(Center, { h: "100%", children: /* @__PURE__ */ jsx(Text, { c: "dimmed", children: "Execution not found" }) });
950
- }
951
- return null;
952
- }
953
- function ExecutionErrorSection({ executionId, fallbackError }) {
954
- const { data: errors, isLoading, isError } = useErrorDetail(executionId);
955
- const [showStack, setShowStack] = useState(false);
956
- const [showErrorContext, setShowErrorContext] = useState(false);
957
- const primaryError = errors?.[0];
958
- if (isLoading || isError || !primaryError) {
959
- return /* @__PURE__ */ jsxs(
960
- Paper,
961
- {
962
- withBorder: true,
963
- p: "sm",
964
- bg: "color-mix(in srgb, var(--color-error) 10%, transparent)",
965
- style: { borderColor: "var(--color-error)" },
966
- children: [
967
- /* @__PURE__ */ jsx(Text, { fw: 500, c: "var(--color-error)", mb: "xs", children: "Error" }),
968
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-error)", ff: "monospace", style: { whiteSpace: "pre-wrap" }, children: fallbackError })
969
- ]
970
- }
971
- );
972
- }
973
- const severityColor = primaryError.severity === "critical" ? "red" : primaryError.severity === "warning" ? "orange" : "blue";
974
- return /* @__PURE__ */ jsx(
975
- Paper,
976
- {
977
- withBorder: true,
978
- p: "sm",
979
- bg: "color-mix(in srgb, var(--color-error) 10%, transparent)",
980
- style: { borderColor: "var(--color-error)" },
981
- children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
982
- /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
983
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
984
- /* @__PURE__ */ jsx(
985
- Text,
986
- {
987
- fw: 600,
988
- size: "sm",
989
- c: "var(--color-error)",
990
- style: { fontFamily: "var(--mantine-font-family-headings)" },
991
- children: primaryError.errorType
992
- }
993
- ),
994
- /* @__PURE__ */ jsx(Badge, { variant: "light", size: "sm", children: primaryError.category })
995
- ] }),
996
- /* @__PURE__ */ jsx(Badge, { color: severityColor, variant: "light", size: "sm", children: primaryError.severity })
997
- ] }),
998
- /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconBug, { size: 16 }), children: primaryError.message }),
999
- errors && errors.length > 1 && /* @__PURE__ */ jsxs(Alert, { color: "yellow", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), children: [
1000
- "This execution has ",
1001
- errors.length,
1002
- " errors (including retries). Showing most recent."
1003
- ] }),
1004
- primaryError.stackTrace && /* @__PURE__ */ jsxs("div", { children: [
1005
- /* @__PURE__ */ jsxs(
1006
- Group,
1007
- {
1008
- justify: "space-between",
1009
- mb: "xs",
1010
- onClick: () => setShowStack(!showStack),
1011
- style: { cursor: "pointer" },
1012
- children: [
1013
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: "Stack Trace" }),
1014
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1015
- /* @__PURE__ */ jsx(CopyButton, { value: primaryError.stackTrace, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy stack trace", children: /* @__PURE__ */ jsx(
1016
- ActionIcon,
1017
- {
1018
- variant: "subtle",
1019
- size: "sm",
1020
- onClick: (e) => {
1021
- e.stopPropagation();
1022
- copy();
1023
- },
1024
- children: copied ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : /* @__PURE__ */ jsx(IconCopy, { size: 14 })
1025
- }
1026
- ) }) }),
1027
- /* @__PURE__ */ jsx(
1028
- IconChevronDown,
1029
- {
1030
- size: 14,
1031
- style: {
1032
- transform: showStack ? "rotate(180deg)" : "rotate(0)",
1033
- transition: "transform var(--duration-fast)"
1034
- }
1035
- }
1036
- )
1037
- ] })
1038
- ]
1039
- }
1040
- ),
1041
- /* @__PURE__ */ jsx(Collapse, { in: showStack, children: /* @__PURE__ */ jsx(Code, { block: true, style: { maxHeight: 300, overflow: "auto", fontSize: "12px", lineHeight: "1.5" }, children: primaryError.stackTrace }) })
1042
- ] }),
1043
- primaryError.errorContext && Object.keys(primaryError.errorContext).length > 0 && /* @__PURE__ */ jsxs("div", { children: [
1044
- /* @__PURE__ */ jsxs(
1045
- Group,
1046
- {
1047
- justify: "space-between",
1048
- mb: "xs",
1049
- onClick: () => setShowErrorContext(!showErrorContext),
1050
- style: { cursor: "pointer" },
1051
- children: [
1052
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: "Error Context" }),
1053
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1054
- /* @__PURE__ */ jsx(CopyButton, { value: JSON.stringify(primaryError.errorContext, null, 2), children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy error context", children: /* @__PURE__ */ jsx(
1055
- ActionIcon,
1056
- {
1057
- variant: "subtle",
1058
- size: "sm",
1059
- onClick: (e) => {
1060
- e.stopPropagation();
1061
- copy();
1062
- },
1063
- children: copied ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : /* @__PURE__ */ jsx(IconCopy, { size: 14 })
1064
- }
1065
- ) }) }),
1066
- /* @__PURE__ */ jsx(
1067
- IconChevronDown,
1068
- {
1069
- size: 14,
1070
- style: {
1071
- transform: showErrorContext ? "rotate(180deg)" : "rotate(0)",
1072
- transition: "transform var(--duration-fast)"
1073
- }
1074
- }
1075
- )
1076
- ] })
1077
- ]
1078
- }
1079
- ),
1080
- /* @__PURE__ */ jsx(Collapse, { in: showErrorContext, children: /* @__PURE__ */ jsx(JsonViewer, { data: primaryError.errorContext, maxHeight: 200, fontSize: "12px" }) })
1081
- ] })
1082
- ] })
1083
- }
1084
- );
1085
- }
1086
- function ArchivedLogsNotice({ logCount, isLoading, error, onLoad }) {
1087
- return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "md", radius: "md", bg: "color-mix(in srgb, var(--color-primary) 5%, transparent)", children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
1088
- /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
1089
- /* @__PURE__ */ jsx(IconArchive, { size: 18, style: { color: "var(--color-text-dimmed)" } }),
1090
- /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
1091
- "Logs archived (",
1092
- logCount.toLocaleString(),
1093
- " entries)"
1094
- ] })
1095
- ] }),
1096
- error && /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-error)", children: error }),
1097
- /* @__PURE__ */ jsx(
1098
- Button,
1099
- {
1100
- variant: "light",
1101
- size: "xs",
1102
- leftSection: isLoading ? /* @__PURE__ */ jsx(Loader, { size: 14 }) : /* @__PURE__ */ jsx(IconDownload, { size: 14 }),
1103
- onClick: onLoad,
1104
- disabled: isLoading,
1105
- w: "fit-content",
1106
- children: isLoading ? "Loading archived logs..." : "Load archived logs"
1107
- }
1108
- )
1109
- ] }) });
1110
- }
1111
- function BaseExecutionLogs({
1112
- resourceId,
1113
- resourceType,
1114
- executionId,
1115
- execution: externalExecution,
1116
- onExecutionDeleted,
1117
- renderLogsSection,
1118
- renderMetrics,
1119
- hideInput = false,
1120
- hideResult = false,
1121
- hideError = false
1122
- }) {
1123
- const { data: fetchedExecution, isLoading } = useExecution(resourceId, executionId || "");
1124
- const baseExecution = externalExecution ?? fetchedExecution;
1125
- const archivedLogs = useArchivedLogs(baseExecution?.isArchived ? executionId : void 0);
1126
- const typedExecution = useMemo(() => {
1127
- if (!baseExecution) return void 0;
1128
- if (archivedLogs.logs) {
1129
- return { ...baseExecution, executionLogs: archivedLogs.logs, isArchived: false };
1130
- }
1131
- return baseExecution;
1132
- }, [baseExecution, archivedLogs.logs]);
1133
- const [deleteModalOpened, setDeleteModalOpened] = useState(false);
1134
- const [retryModalOpened, setRetryModalOpened] = useState(false);
1135
- const [cancelModalOpened, setCancelModalOpened] = useState(false);
1136
- const [retryError, setRetryError] = useState(null);
1137
- const deleteExecutionMutation = useDeleteExecution();
1138
- const retryExecutionMutation = useRetryExecution();
1139
- const cancelExecutionMutation = useCancelExecution();
1140
- const handleDelete = async () => {
1141
- if (!executionId) return;
1142
- try {
1143
- await deleteExecutionMutation.mutateAsync({
1144
- resourceId,
1145
- executionId
1146
- });
1147
- setDeleteModalOpened(false);
1148
- onExecutionDeleted?.();
1149
- } catch (error) {
1150
- console.error("Failed to delete execution:", error);
1151
- showApiErrorNotification(error);
1152
- }
1153
- };
1154
- const handleCancel = async () => {
1155
- if (!executionId) return;
1156
- try {
1157
- await cancelExecutionMutation.mutateAsync({
1158
- resourceId,
1159
- executionId
1160
- });
1161
- setCancelModalOpened(false);
1162
- } catch (error) {
1163
- console.error("Failed to cancel execution:", error);
1164
- showApiErrorNotification(error);
1165
- }
1166
- };
1167
- const handleRetry = async () => {
1168
- if (!typedExecution || !resourceType) return;
1169
- setRetryError(null);
1170
- try {
1171
- await retryExecutionMutation.mutateAsync({
1172
- resourceId,
1173
- resourceType,
1174
- input: typedExecution.input
1175
- });
1176
- setRetryModalOpened(false);
1177
- showSuccessNotification("Resource re-executed with the same inputs.");
1178
- } catch (error) {
1179
- const message = error instanceof Error ? error.message : "Failed to re-execute resource";
1180
- setRetryError(message);
1181
- }
1182
- };
1183
- if (!executionId || isLoading || !typedExecution) {
1184
- return /* @__PURE__ */ jsx(BaseExecutionLogsStates, { executionId, isLoading, execution: typedExecution });
1185
- }
1186
- return /* @__PURE__ */ jsxs(Stack, { h: "100%", children: [
1187
- /* @__PURE__ */ jsx(
1188
- BaseExecutionLogsHeader,
1189
- {
1190
- execution: typedExecution,
1191
- resourceId,
1192
- onDeleteClick: () => setDeleteModalOpened(true),
1193
- onCancelClick: typedExecution.status === "running" ? () => setCancelModalOpened(true) : void 0,
1194
- onRetryClick: resourceType ? () => {
1195
- setRetryError(null);
1196
- setRetryModalOpened(true);
1197
- } : void 0,
1198
- renderMetrics
1199
- }
1200
- ),
1201
- !hideInput && typedExecution.input != null && /* @__PURE__ */ jsx(Paper, { withBorder: true, bg: "none", children: /* @__PURE__ */ jsx(CollapsibleJsonSection, { title: /* @__PURE__ */ jsx(Text, { fw: 500, children: "Input" }), data: typedExecution.input }) }),
1202
- typedExecution.isArchived && /* @__PURE__ */ jsx(
1203
- ArchivedLogsNotice,
1204
- {
1205
- logCount: typedExecution.archivedLogCount ?? 0,
1206
- isLoading: archivedLogs.isLoading,
1207
- error: archivedLogs.error,
1208
- onLoad: archivedLogs.fetch
1209
- }
1210
- ),
1211
- !typedExecution.isArchived && renderLogsSection && /* @__PURE__ */ jsx(Paper, { withBorder: true, bg: "none", p: "sm", style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: renderLogsSection(typedExecution) }),
1212
- !hideResult && typedExecution.result != null && /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(
1213
- CollapsibleJsonSection,
1214
- {
1215
- title: /* @__PURE__ */ jsx(Text, { fw: 500, c: "var(--color-success)", children: "Result" }),
1216
- data: typedExecution.result
1217
- }
1218
- ) }),
1219
- !hideError && typedExecution.error && /* @__PURE__ */ jsx(ExecutionErrorSection, { executionId: typedExecution.id, fallbackError: typedExecution.error }),
1220
- /* @__PURE__ */ jsx(
1221
- ConfirmationModal,
1222
- {
1223
- opened: deleteModalOpened,
1224
- onClose: () => setDeleteModalOpened(false),
1225
- icon: /* @__PURE__ */ jsx(IconTrash, { color: "red" }),
1226
- title: "Delete Execution Log",
1227
- text: "Are you sure you want to delete this execution log? This action cannot be undone.",
1228
- buttonText: "Delete",
1229
- buttonColor: "red",
1230
- confirmationHandler: handleDelete,
1231
- loading: deleteExecutionMutation.isPending
1232
- }
1233
- ),
1234
- /* @__PURE__ */ jsx(
1235
- ConfirmationModal,
1236
- {
1237
- opened: cancelModalOpened,
1238
- onClose: () => setCancelModalOpened(false),
1239
- icon: /* @__PURE__ */ jsx(IconPlayerStop, {}),
1240
- title: "Stop Execution",
1241
- text: "Are you sure you want to stop this running execution? This action cannot be undone.",
1242
- buttonText: "Stop",
1243
- buttonColor: "orange",
1244
- confirmationHandler: handleCancel,
1245
- loading: cancelExecutionMutation.isPending
1246
- }
1247
- ),
1248
- /* @__PURE__ */ jsx(
1249
- CustomModal,
1250
- {
1251
- opened: retryModalOpened,
1252
- onClose: () => setRetryModalOpened(false),
1253
- size: "sm",
1254
- loading: retryExecutionMutation.isPending,
1255
- children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
1256
- /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
1257
- /* @__PURE__ */ jsx(IconReload, { size: 24, color: "var(--color-primary)" }),
1258
- /* @__PURE__ */ jsx(Title, { order: 4, children: "Re-execute Resource" })
1259
- ] }),
1260
- /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
1261
- "This will re-execute",
1262
- " ",
1263
- /* @__PURE__ */ jsx(Text, { span: true, fw: 600, children: resourceId }),
1264
- " ",
1265
- "with the exact same inputs from this execution."
1266
- ] }),
1267
- typedExecution?.input != null && /* @__PURE__ */ jsx(Paper, { withBorder: true, bg: "none", style: { maxHeight: 150, overflow: "auto" }, children: /* @__PURE__ */ jsx(Text, { size: "xs", ff: "monospace", style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(typedExecution.input, null, 2) }) }),
1268
- retryError && /* @__PURE__ */ jsx(
1269
- Paper,
1270
- {
1271
- withBorder: true,
1272
- p: "xs",
1273
- bg: "color-mix(in srgb, var(--color-error) 10%, transparent)",
1274
- style: { borderColor: "var(--color-error)" },
1275
- children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-error)", children: retryError })
1276
- }
1277
- ),
1278
- /* @__PURE__ */ jsxs(Group, { justify: "flex-end", mt: "md", children: [
1279
- /* @__PURE__ */ jsx(
1280
- Button,
1281
- {
1282
- variant: "light",
1283
- onClick: () => setRetryModalOpened(false),
1284
- disabled: retryExecutionMutation.isPending,
1285
- children: "Cancel"
1286
- }
1287
- ),
1288
- /* @__PURE__ */ jsx(Button, { onClick: handleRetry, loading: retryExecutionMutation.isPending, children: "Re-execute" })
1289
- ] })
1290
- ] })
1291
- }
1292
- )
1293
- ] });
1294
- }
1295
- function LogEntry({ log, index }) {
1296
- const hasContext = log.context && Object.keys(log.context).length > 0;
1297
- const logConfig = getLogLevelConfig(log.level);
1298
- const logTitle = /* @__PURE__ */ jsxs(Group, { gap: "xs", style: { flex: 1 }, wrap: "nowrap", children: [
1299
- /* @__PURE__ */ jsx(
1300
- Badge,
1301
- {
1302
- size: "sm",
1303
- variant: "light",
1304
- color: logConfig.color,
1305
- style: { minWidth: "60px", fontFamily: "var(--mantine-font-family-monospace)" },
1306
- children: logConfig.label
1307
- }
1308
- ),
1309
- /* @__PURE__ */ jsx(Text, { span: true, c: "dimmed", size: "xs", style: { fontFamily: "var(--mantine-font-family-monospace)" }, children: new Date(log.timestamp).toLocaleTimeString("en-US", {
1310
- hour12: false,
1311
- hour: "2-digit",
1312
- minute: "2-digit",
1313
- second: "2-digit",
1314
- fractionalSecondDigits: 3
1315
- }) }),
1316
- /* @__PURE__ */ jsx(Text, { size: "sm", span: true, style: { fontFamily: "var(--mantine-font-family-monospace)" }, children: log.message })
1317
- ] });
1318
- if (!hasContext) {
1319
- return /* @__PURE__ */ jsx(
1320
- "div",
1321
- {
1322
- style: {
1323
- padding: "0.375rem 0.5rem",
1324
- borderRadius: "var(--mantine-radius-default)"
1325
- },
1326
- children: logTitle
1327
- },
1328
- index
1329
- );
1330
- }
1331
- return /* @__PURE__ */ jsx(CollapsibleJsonSection, { title: logTitle, data: log.context }, index);
1332
- }
1333
- function LogGroup({ title, logs, statusBadge }) {
1334
- return /* @__PURE__ */ jsxs(
1335
- "div",
1336
- {
1337
- style: {
1338
- borderRadius: "8px",
1339
- padding: "12px",
1340
- border: "1px solid var(--color-border)"
1341
- },
1342
- children: [
1343
- /* @__PURE__ */ jsxs(Group, { gap: "xs", mb: "xs", children: [
1344
- /* @__PURE__ */ jsx(Text, { fw: 600, size: "sm", c: "var(--color-text)", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: title }),
1345
- statusBadge && /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", color: statusBadge.color, children: statusBadge.label }),
1346
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
1347
- logs.length,
1348
- " ",
1349
- logs.length === 1 ? "log" : "logs"
1350
- ] })
1351
- ] }),
1352
- /* @__PURE__ */ jsx(Stack, { gap: 4, children: logs.map((log, logIndex) => /* @__PURE__ */ jsx(LogEntry, { log, index: logIndex }, logIndex)) })
1353
- ]
1354
- }
1355
- );
1356
- }
1357
- var ResourceFilter = ({ value, onChange, fullWidth }) => {
1358
- const buttonStyles = fullWidth ? { padding: "2px 8px", height: "28px", fontSize: "12px", flex: 1 } : { padding: "2px 8px", height: "24px", fontSize: "12px" };
1359
- return /* @__PURE__ */ jsxs(Button.Group, { style: fullWidth ? { width: "100%" } : void 0, children: [
1360
- /* @__PURE__ */ jsx(
1361
- Button,
1362
- {
1363
- variant: value === "all" ? "filled" : "default",
1364
- size: "xs",
1365
- onClick: () => onChange("all"),
1366
- bg: value === "all" ? void 0 : "var(--color-background)",
1367
- styles: { root: buttonStyles },
1368
- children: "All"
1369
- }
1370
- ),
1371
- /* @__PURE__ */ jsx(
1372
- Button,
1373
- {
1374
- variant: value === "dev" ? "filled" : "default",
1375
- size: "xs",
1376
- onClick: () => onChange("dev"),
1377
- bg: value === "dev" ? void 0 : "var(--color-background)",
1378
- styles: { root: buttonStyles },
1379
- children: "Dev"
1380
- }
1381
- ),
1382
- /* @__PURE__ */ jsx(
1383
- Button,
1384
- {
1385
- variant: value === "prod" ? "filled" : "default",
1386
- size: "xs",
1387
- onClick: () => onChange("prod"),
1388
- bg: value === "prod" ? void 0 : "var(--color-background)",
1389
- styles: { root: buttonStyles },
1390
- children: "Prod"
1391
- }
1392
- )
1393
- ] });
1394
- };
1395
- function ResourceHeader({ resource, type, connected, runningCount, sessionCapable }) {
1396
- const { currentMembership } = useOrganization();
1397
- const organizationName = currentMembership?.organization?.name;
1398
- const navigate = useNavigate();
1399
- const Icon = getResourceIcon(type);
1400
- const clipboard = useClipboard({ timeout: 2e3 });
1401
- const handleCopyId = () => {
1402
- clipboard.copy(`"${organizationName}/${resource.resourceId}"`);
1403
- notifications.show({
1404
- message: "Resource ID copied to clipboard",
1405
- color: "teal"
1406
- });
1407
- };
1408
- const handleGoToSessions = () => {
1409
- navigate({
1410
- to: "/operations/sessions",
1411
- search: { agent: resource.resourceId }
1412
- });
1413
- };
1414
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1415
- /* @__PURE__ */ jsx(
1416
- PageTitleCaption,
1417
- {
1418
- title: resource.name,
1419
- caption: resource.description || `${type.charAt(0).toUpperCase()}${type.slice(1)} details`
1420
- }
1421
- ),
1422
- /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1423
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1424
- /* @__PURE__ */ jsx(Icon, { size: 20, color: "var(--color-primary)" }),
1425
- /* @__PURE__ */ jsxs(Badge, { color: "blue", variant: "light", children: [
1426
- type.charAt(0).toUpperCase(),
1427
- type.slice(1)
1428
- ] }),
1429
- /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "outline", size: "sm", children: resource.status.toUpperCase() }),
1430
- resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "outline", size: "sm", children: [
1431
- "v",
1432
- resource.version
1433
- ] }),
1434
- /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
1435
- /* @__PURE__ */ jsxs(Text, { size: "sm", ff: "monospace", c: "dimmed", children: [
1436
- organizationName,
1437
- "/",
1438
- resource.resourceId
1439
- ] }),
1440
- /* @__PURE__ */ jsx(Tooltip, { label: clipboard.copied ? "Copied!" : "Copy ID", children: /* @__PURE__ */ jsx(ActionIcon, { size: "sm", variant: "subtle", onClick: handleCopyId, color: clipboard.copied ? "teal" : "gray", children: /* @__PURE__ */ jsx(IconCopy, { size: 14, color: clipboard.copied ? "teal" : "gray" }) }) })
1441
- ] })
1442
- ] }),
1443
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1444
- connected && /* @__PURE__ */ jsx(Badge, { color: "green", variant: "dot", children: "CONNECTED" }),
1445
- runningCount && runningCount > 0 && /* @__PURE__ */ jsxs(Badge, { color: "blue", variant: "filled", children: [
1446
- runningCount,
1447
- " running"
1448
- ] }),
1449
- type === "agent" && sessionCapable && /* @__PURE__ */ jsx(Button, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ jsx(IconMessage, { size: 16 }), onClick: handleGoToSessions, children: "Go to Sessions" }),
1450
- /* @__PURE__ */ jsx(
1451
- Button,
1452
- {
1453
- size: "sm",
1454
- variant: "light",
1455
- leftSection: /* @__PURE__ */ jsx(IconArrowLeft, { size: 16 }),
1456
- onClick: () => navigate({ to: "/operations/resources" }),
1457
- children: "Resources"
1458
- }
1459
- )
1460
- ] })
1461
- ] })
1462
- ] });
1463
- }
1464
- function ResourceErrorState({ error }) {
1465
- return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Stack, { align: "center", children: [
1466
- /* @__PURE__ */ jsx(Text, { c: "red", children: "Failed to load resource" }),
1467
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: error.message })
1468
- ] }) }) });
1469
- }
1470
- function ResourceNotFoundState({ type, resourceId }) {
1471
- const navigate = useNavigate();
1472
- const { currentMembership } = useOrganization();
1473
- const orgName = currentMembership?.organization?.name || "current organization";
1474
- return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Stack, { align: "center", children: [
1475
- /* @__PURE__ */ jsx(Text, { size: "lg", c: "dimmed", fw: 500, children: "Resource not found" }),
1476
- /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", ta: "center", children: [
1477
- "The ",
1478
- type,
1479
- ' "',
1480
- resourceId,
1481
- '" could not be found in ',
1482
- orgName,
1483
- "."
1484
- ] }),
1485
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", ta: "center", children: "This resource may exist in a different organization. Try switching organizations or returning to the overview." }),
1486
- /* @__PURE__ */ jsx(
1487
- Button,
1488
- {
1489
- variant: "light",
1490
- leftSection: /* @__PURE__ */ jsx(IconArrowLeft, { size: 16 }),
1491
- onClick: () => navigate({ to: "/operations", search: { type: void 0 } }),
1492
- children: "Back to Operations"
1493
- }
1494
- )
1495
- ] }) }) });
1496
- }
1497
- function AgentExecutionLogs({
1498
- resourceId,
1499
- executionId,
1500
- execution: externalExecution,
1501
- selectedIterationId,
1502
- iterationData,
1503
- onExecutionDeleted
1504
- }) {
1505
- const isIterationSelected = selectedIterationId !== null;
1506
- const logGroups = useMemo(() => {
1507
- if (!iterationData) {
1508
- return [];
1509
- }
1510
- if (selectedIterationId !== null) {
1511
- if (selectedIterationId === "initialization") {
1512
- return [
1513
- {
1514
- title: "Initialization",
1515
- groupKey: "initialization",
1516
- logs: [],
1517
- // Will be filled in renderLogsSection
1518
- status: iterationData.initialization.status
1519
- }
1520
- ];
1521
- }
1522
- if (selectedIterationId === "completion") {
1523
- return [
1524
- {
1525
- title: "Completion",
1526
- groupKey: "completion",
1527
- logs: [],
1528
- // Will be filled in renderLogsSection
1529
- status: iterationData.completion.status
1530
- }
1531
- ];
1532
- }
1533
- const selectedIteration = iterationData.iterations.find((iter) => iter.iterationNumber === selectedIterationId);
1534
- if (!selectedIteration) {
1535
- return [];
1536
- }
1537
- return [
1538
- {
1539
- title: `Iteration ${selectedIteration.iterationNumber}`,
1540
- groupKey: selectedIteration.iterationNumber,
1541
- logs: [],
1542
- // Will be filled in renderLogsSection
1543
- status: selectedIteration.status
1544
- }
1545
- ];
1546
- }
1547
- const groups = [];
1548
- groups.push({
1549
- title: "Initialization",
1550
- groupKey: "initialization",
1551
- logs: [],
1552
- status: iterationData.initialization.status
1553
- });
1554
- for (const iteration of iterationData.iterations) {
1555
- groups.push({
1556
- title: `Iteration ${iteration.iterationNumber}`,
1557
- groupKey: iteration.iterationNumber,
1558
- logs: [],
1559
- status: iteration.status
1560
- });
1561
- }
1562
- groups.push({
1563
- title: "Completion",
1564
- groupKey: "completion",
1565
- logs: [],
1566
- status: iterationData.completion.status
1567
- });
1568
- return groups;
1569
- }, [selectedIterationId, iterationData]);
1570
- const getSelectedNodeTitle = () => {
1571
- if (selectedIterationId === null) return null;
1572
- if (selectedIterationId === "initialization") return "Initialization";
1573
- if (selectedIterationId === "completion") return "Completion";
1574
- return `Iteration ${selectedIterationId}`;
1575
- };
1576
- const selectedNodeTitle = getSelectedNodeTitle();
1577
- const getIterationStatusBadge = (_groupKey, status) => {
1578
- if (status) {
1579
- const statusConfig = getExecutionStatusConfig(status);
1580
- return {
1581
- label: statusConfig.label,
1582
- color: statusConfig.color
1583
- };
1584
- }
1585
- return null;
1586
- };
1587
- const renderLogsSection = (execution) => {
1588
- if (!execution.executionLogs || execution.executionLogs.length === 0) {
1589
- return /* @__PURE__ */ jsx(Text, { c: "dimmed", ta: "center", mt: "md", children: "No logs available" });
1590
- }
1591
- const logsByGroup = /* @__PURE__ */ new Map();
1592
- for (const log of execution.executionLogs) {
1593
- const context = log.context;
1594
- let groupKey;
1595
- if (context?.type === "agent" && "lifecycle" in context) {
1596
- const lifecycle = context.lifecycle;
1597
- if (lifecycle === "initialization") {
1598
- groupKey = "initialization";
1599
- } else if (lifecycle === "iteration" && "iteration" in context) {
1600
- groupKey = context.iteration;
1601
- } else if (lifecycle === "completion") {
1602
- groupKey = "completion";
1603
- } else {
1604
- groupKey = "completion";
1605
- }
1606
- } else {
1607
- groupKey = "completion";
1608
- }
1609
- if (!logsByGroup.has(groupKey)) {
1610
- logsByGroup.set(groupKey, []);
1611
- }
1612
- logsByGroup.get(groupKey).push(log);
1613
- }
1614
- const populatedGroups = logGroups.map((group) => ({
1615
- ...group,
1616
- logs: logsByGroup.get(group.groupKey) || []
1617
- })).filter((group) => group.logs.length > 0);
1618
- const totalLogsCount = populatedGroups.reduce((total, group) => total + group.logs.length, 0);
1619
- return /* @__PURE__ */ jsxs(Stack, { gap: "xs", style: { flex: 1, minHeight: 0 }, children: [
1620
- /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1621
- /* @__PURE__ */ jsx(Text, { fw: 500, children: selectedNodeTitle ? `Logs for ${selectedNodeTitle} (${totalLogsCount})` : `Logs (${totalLogsCount})` }),
1622
- iterationData && /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1623
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1624
- "Iterations: ",
1625
- iterationData.iterations.filter((i) => i.status === "completed").length,
1626
- "/",
1627
- iterationData.totalIterations
1628
- ] }),
1629
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1630
- "Events: ",
1631
- iterationData.iterations.reduce((sum, iter) => sum + iter.iterationEvents.length, 0)
1632
- ] })
1633
- ] })
1634
- ] }),
1635
- /* @__PURE__ */ jsx(ScrollArea, { style: { flex: 1 }, scrollbarSize: 8, children: /* @__PURE__ */ jsxs(Stack, { children: [
1636
- populatedGroups.map((group) => {
1637
- const statusBadge = getIterationStatusBadge(group.groupKey, group.status);
1638
- return /* @__PURE__ */ jsx(
1639
- LogGroup,
1640
- {
1641
- title: group.title,
1642
- logs: group.logs,
1643
- statusBadge: statusBadge || void 0
1644
- },
1645
- group.groupKey
1646
- );
1647
- }),
1648
- populatedGroups.length === 0 && /* @__PURE__ */ jsx(Text, { c: "dimmed", ta: "center", mt: "md", children: selectedNodeTitle ? `No logs for ${selectedNodeTitle}` : "No logs available" })
1649
- ] }) })
1650
- ] });
1651
- };
1652
- return /* @__PURE__ */ jsx(
1653
- BaseExecutionLogs,
1654
- {
1655
- resourceId,
1656
- resourceType: "agent",
1657
- executionId,
1658
- execution: externalExecution,
1659
- onExecutionDeleted,
1660
- renderLogsSection,
1661
- hideInput: isIterationSelected,
1662
- hideResult: isIterationSelected,
1663
- hideError: isIterationSelected
1664
- }
1665
- );
1666
- }
1667
- function WorkflowExecutionLogs({
1668
- resourceId,
1669
- executionId,
1670
- execution: externalExecution,
1671
- selectedStepId,
1672
- timelineData,
1673
- onExecutionDeleted
1674
- }) {
1675
- const { data: fetchedExecution } = useExecution(resourceId, executionId || "");
1676
- const typedExecution = externalExecution ?? fetchedExecution;
1677
- const isStepSelected = !!selectedStepId;
1678
- const logGroups = useMemo(() => {
1679
- if (selectedStepId && timelineData) {
1680
- const selectedStep2 = timelineData.steps.find((s) => s.stepId === selectedStepId);
1681
- return selectedStep2 ? [{ stepName: selectedStep2.stepName, stepId: selectedStep2.stepId, logs: selectedStep2.logs }] : [];
1682
- }
1683
- if (!timelineData || !typedExecution) {
1684
- return [];
1685
- }
1686
- const groups = [];
1687
- for (const step of timelineData.steps) {
1688
- if (step.logs.length > 0) {
1689
- groups.push({
1690
- stepName: step.stepName,
1691
- stepId: step.stepId,
1692
- logs: step.logs
1693
- });
1694
- }
1695
- }
1696
- const stepLogTimestamps = new Set(timelineData.steps.flatMap((s) => s.logs.map((l) => l.timestamp)));
1697
- const generalExecutionLogs = typedExecution.executionLogs.filter((log) => !stepLogTimestamps.has(log.timestamp));
1698
- const generalWorkflowLogs = toWorkflowLogMessages(generalExecutionLogs);
1699
- if (generalWorkflowLogs.length > 0) {
1700
- groups.unshift({
1701
- stepName: "General",
1702
- stepId: "general",
1703
- logs: generalWorkflowLogs
1704
- });
1705
- }
1706
- return groups;
1707
- }, [selectedStepId, timelineData, typedExecution]);
1708
- const selectedStep = selectedStepId && timelineData ? timelineData.steps.find((s) => s.stepId === selectedStepId) : null;
1709
- const totalLogsCount = logGroups.reduce((total, group) => total + group.logs.length, 0);
1710
- const scrollViewportRef = useRef(null);
1711
- const isNearBottomRef = useRef(true);
1712
- const handleScroll = useCallback(() => {
1713
- const viewport = scrollViewportRef.current;
1714
- if (!viewport) return;
1715
- isNearBottomRef.current = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight < 50;
1716
- }, []);
1717
- useEffect(() => {
1718
- if (!isNearBottomRef.current) return;
1719
- const viewport = scrollViewportRef.current;
1720
- if (!viewport) return;
1721
- viewport.scrollTop = viewport.scrollHeight;
1722
- }, [totalLogsCount]);
1723
- const getStepStatusBadge = (stepId) => {
1724
- if (stepId === "general") {
1725
- return { label: "General", color: "blue" };
1726
- }
1727
- if (!timelineData) {
1728
- return null;
1729
- }
1730
- const step = timelineData.steps.find((s) => s.stepId === stepId);
1731
- if (!step) {
1732
- return null;
1733
- }
1734
- const statusConfig = getExecutionStatusConfig(step.status);
1735
- return {
1736
- label: statusConfig.label,
1737
- color: statusConfig.color
1738
- };
1739
- };
1740
- const renderLogsSection = () => {
1741
- return /* @__PURE__ */ jsxs(Stack, { gap: "xs", style: { flex: 1, minHeight: 0 }, children: [
1742
- /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1743
- /* @__PURE__ */ jsx(Text, { fw: 500, children: selectedStep ? `Logs for ${selectedStep.stepName} (${totalLogsCount})` : `Logs (${totalLogsCount})` }),
1744
- timelineData && /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1745
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1746
- "Steps: ",
1747
- timelineData.steps.filter((s) => s.status === "completed").length,
1748
- "/",
1749
- timelineData.steps.length
1750
- ] }),
1751
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1752
- "Duration:",
1753
- " ",
1754
- timelineData.totalDuration < 1e3 ? `${timelineData.totalDuration}ms` : `${(timelineData.totalDuration / 1e3).toFixed(2)}s`
1755
- ] })
1756
- ] })
1757
- ] }),
1758
- /* @__PURE__ */ jsx(
1759
- ScrollArea,
1760
- {
1761
- style: { flex: 1 },
1762
- scrollbarSize: 8,
1763
- viewportRef: scrollViewportRef,
1764
- onScrollPositionChange: handleScroll,
1765
- children: /* @__PURE__ */ jsxs(Stack, { children: [
1766
- logGroups.map((group) => {
1767
- const statusBadge = getStepStatusBadge(group.stepId);
1768
- return /* @__PURE__ */ jsx(
1769
- LogGroup,
1770
- {
1771
- title: group.stepName,
1772
- logs: group.logs,
1773
- statusBadge: statusBadge || void 0
1774
- },
1775
- group.stepId
1776
- );
1777
- }),
1778
- logGroups.length === 0 && /* @__PURE__ */ jsx(Text, { c: "dimmed", ta: "center", mt: "md", children: selectedStep ? `No logs for ${selectedStep.stepName}` : "No logs available" })
1779
- ] })
1780
- }
1781
- )
1782
- ] });
1783
- };
1784
- return /* @__PURE__ */ jsx(
1785
- BaseExecutionLogs,
1786
- {
1787
- resourceId,
1788
- resourceType: "workflow",
1789
- executionId,
1790
- onExecutionDeleted,
1791
- renderLogsSection,
1792
- hideInput: isStepSelected,
1793
- hideResult: isStepSelected,
1794
- hideError: isStepSelected
1795
- }
1796
- );
1797
- }
1798
- function getPriorityColor(priority) {
1799
- if (priority >= 8) return "red";
1800
- if (priority >= 5) return "yellow";
1801
- return "gray";
1802
- }
1803
- function getPriorityLabel(priority) {
1804
- if (priority >= 8) return "Critical";
1805
- if (priority >= 5) return "High";
1806
- if (priority >= 3) return "Medium";
1807
- return "Low";
1808
- }
1809
- function getStatusColor(status) {
1810
- switch (status) {
1811
- case "pending":
1812
- return "blue";
1813
- case "processing":
1814
- return "blue";
1815
- case "completed":
1816
- return "green";
1817
- case "failed":
1818
- return "red";
1819
- case "expired":
1820
- return "orange";
1821
- default:
1822
- return "gray";
1823
- }
1824
- }
1825
- function getPriorityDotColor(priority) {
1826
- if (priority >= 8) return "var(--mantine-color-red-6)";
1827
- if (priority >= 5) return "var(--mantine-color-yellow-6)";
1828
- if (priority >= 3) return "var(--mantine-color-blue-6)";
1829
- return "var(--color-text-subtle)";
1830
- }
1831
- function formatRelativeTime(date) {
1832
- const now = /* @__PURE__ */ new Date();
1833
- const diffMs = now.getTime() - date.getTime();
1834
- const diffMins = Math.floor(diffMs / 6e4);
1835
- const diffHours = Math.floor(diffMins / 60);
1836
- const diffDays = Math.floor(diffHours / 24);
1837
- if (diffMins < 60) return `${diffMins}m ago`;
1838
- if (diffHours < 24) return `${diffHours}h ago`;
1839
- return `${diffDays}d ago`;
1840
- }
1841
- function CommandQueueTaskRow({ task, onClick, onDelete }) {
1842
- const [hovered, setHovered] = useState(false);
1843
- const OriginIcon = task.originResourceType === "agent" ? IconRobot : IconGitBranch;
1844
- return /* @__PURE__ */ jsx(
1845
- Card,
1846
- {
1847
- padding: 0,
1848
- style: {
1849
- cursor: "pointer",
1850
- border: "1px solid var(--color-border)",
1851
- transition: "background var(--duration-fast) var(--easing)",
1852
- background: hovered ? "var(--active-background)" : "var(--color-surface)"
1853
- },
1854
- onClick: (e) => {
1855
- if (e.target.closest("[data-menu-dropdown]") || e.target.closest("button")) {
1856
- return;
1857
- }
1858
- onClick();
1859
- },
1860
- onMouseEnter: () => setHovered(true),
1861
- onMouseLeave: () => setHovered(false),
1862
- children: /* @__PURE__ */ jsxs(
1863
- "div",
1864
- {
1865
- style: {
1866
- display: "grid",
1867
- gridTemplateColumns: "10px 80px 1fr 1fr 90px 90px 32px",
1868
- alignItems: "center",
1869
- gap: "var(--mantine-spacing-sm)"
1870
- },
1871
- children: [
1872
- /* @__PURE__ */ jsx(Tooltip, { label: `P${task.priority} \u2014 ${getPriorityLabel(task.priority)}`, children: /* @__PURE__ */ jsx(
1873
- "div",
1874
- {
1875
- style: {
1876
- width: 10,
1877
- height: 10,
1878
- borderRadius: "50%",
1879
- flexShrink: 0,
1880
- backgroundColor: getPriorityDotColor(task.priority)
1881
- }
1882
- }
1883
- ) }),
1884
- /* @__PURE__ */ jsx(Text, { size: "xs", fw: 600, c: getPriorityColor(task.priority), children: getPriorityLabel(task.priority).toUpperCase() }),
1885
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, truncate: true, title: task.description || "Task approval required", children: task.description || "Task approval required" }),
1886
- /* @__PURE__ */ jsxs(Group, { gap: 5, wrap: "nowrap", style: { minWidth: 0 }, children: [
1887
- /* @__PURE__ */ jsx(OriginIcon, { size: 13, color: "var(--color-text-subtle)", style: { flexShrink: 0 } }),
1888
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", truncate: true, ff: "monospace", style: { minWidth: 0 }, children: task.originResourceId })
1889
- ] }),
1890
- /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", color: getStatusColor(task.status), radius: "sm", children: task.status.charAt(0).toUpperCase() + task.status.slice(1) }),
1891
- /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
1892
- /* @__PURE__ */ jsx(IconClock, { size: 11, color: "var(--color-text-subtle)", style: { flexShrink: 0 } }),
1893
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { whiteSpace: "nowrap" }, children: formatRelativeTime(task.createdAt) })
1894
- ] }),
1895
- /* @__PURE__ */ jsxs(Menu, { position: "bottom-end", withinPortal: true, children: [
1896
- /* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", color: "gray", children: /* @__PURE__ */ jsx(IconDotsVertical, { size: 16 }) }) }),
1897
- /* @__PURE__ */ jsx(Menu.Dropdown, { children: /* @__PURE__ */ jsx(Menu.Item, { leftSection: /* @__PURE__ */ jsx(IconTrash, { size: 14 }), color: "red", onClick: () => onDelete(task.id), children: "Delete" }) })
1898
- ] })
1899
- ]
1900
- }
1901
- )
1902
- }
1903
- );
1904
- }
1905
- function CheckpointGroup({ name, count, isActive, onClick }) {
1906
- const theme = useMantineTheme();
1907
- const activeColor = theme.colors[theme.primaryColor][6];
1908
- const defaultTextColor = "var(--color-text)";
1909
- const textColor = isActive ? activeColor : defaultTextColor;
1910
- const fontWeight = isActive ? 600 : 500;
1911
- const activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
1912
- return /* @__PURE__ */ jsx(
1913
- UnstyledButton,
1914
- {
1915
- onClick,
1916
- style: {
1917
- display: "flex",
1918
- alignItems: "center",
1919
- width: "100%",
1920
- padding: theme.spacing.xs,
1921
- borderRadius: theme.radius.sm,
1922
- backgroundColor: isActive ? activeBg : "transparent",
1923
- transition: `all var(--duration-fast) var(--easing)`,
1924
- cursor: "pointer"
1925
- },
1926
- onMouseEnter: (e) => {
1927
- if (!isActive) {
1928
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
1929
- }
1930
- },
1931
- onMouseLeave: (e) => {
1932
- if (!isActive) {
1933
- e.currentTarget.style.backgroundColor = "transparent";
1934
- }
1935
- },
1936
- children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", style: { width: "100%" }, children: [
1937
- /* @__PURE__ */ jsx(
1938
- Text,
1939
- {
1940
- size: "sm",
1941
- fw: fontWeight,
1942
- style: {
1943
- color: textColor,
1944
- fontFamily: "var(--elevasis-font-family-subtitle)",
1945
- transition: `color var(--duration-fast) var(--easing)`
1946
- },
1947
- children: name
1948
- }
1949
- ),
1950
- /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: count })
1951
- ] })
1952
- }
1953
- );
1954
- }
1955
- var CommandQueueSidebarTop = ({
1956
- status,
1957
- onStatusChange,
1958
- priorityRange,
1959
- onPriorityRangeChange
1960
- }) => {
1961
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1962
- /* @__PURE__ */ jsx(SubshellSidebarSection, { icon: IconFilter, label: "Filters" }),
1963
- /* @__PURE__ */ jsxs(Stack, { gap: "xs", p: "sm", children: [
1964
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Status" }),
1965
- /* @__PURE__ */ jsx(
1966
- Select,
1967
- {
1968
- size: "sm",
1969
- value: status,
1970
- onChange: (value) => value && onStatusChange(value),
1971
- data: [
1972
- { value: "all", label: "All" },
1973
- { value: "pending", label: "Pending" },
1974
- { value: "completed", label: "Completed" },
1975
- { value: "expired", label: "Expired" }
1976
- ],
1977
- leftSection: /* @__PURE__ */ jsx(IconCircleCheck, { size: 14 })
1978
- }
1979
- ),
1980
- /* @__PURE__ */ jsx(Group, { justify: "space-between", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Priority" }) }),
1981
- /* @__PURE__ */ jsx(
1982
- RangeSlider,
1983
- {
1984
- size: "sm",
1985
- min: 1,
1986
- max: 10,
1987
- step: 1,
1988
- minRange: 0,
1989
- defaultValue: priorityRange,
1990
- onChangeEnd: onPriorityRangeChange,
1991
- marks: [
1992
- { value: 1, label: "1" },
1993
- { value: 5, label: "5" },
1994
- { value: 10, label: "10" }
1995
- ],
1996
- styles: { markLabel: { fontSize: 10 } }
1997
- },
1998
- `${priorityRange[0]}-${priorityRange[1]}`
1999
- ),
2000
- /* @__PURE__ */ jsx(Space, { h: 8 })
2001
- ] })
2002
- ] });
2003
- };
2004
- function CommandQueueSidebarMiddle({
2005
- selectedCheckpoint,
2006
- onSelectCheckpoint,
2007
- priorityRange,
2008
- status,
2009
- timeRange
2010
- }) {
2011
- const { data, isLoading } = useCommandQueueTotals({
2012
- timeRange,
2013
- priorityMin: priorityRange[0],
2014
- priorityMax: priorityRange[1],
2015
- status: status === "all" ? void 0 : status
2016
- });
2017
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2018
- /* @__PURE__ */ jsx(SubshellSidebarSection, { icon: IconCategory, label: "Checkpoint Groups", withTopBorder: true }),
2019
- /* @__PURE__ */ jsx(Stack, { gap: "xs", p: "sm", style: { flex: 1, overflowY: "auto" }, children: isLoading ? /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2020
- /* @__PURE__ */ jsx(
2021
- CheckpointGroup,
2022
- {
2023
- id: void 0,
2024
- name: "All Tasks",
2025
- count: data?.total ?? 0,
2026
- isActive: selectedCheckpoint === void 0,
2027
- onClick: () => onSelectCheckpoint(void 0)
2028
- }
2029
- ),
2030
- data?.checkpoints.map((checkpoint) => /* @__PURE__ */ jsx(
2031
- CheckpointGroup,
2032
- {
2033
- id: checkpoint.id,
2034
- name: checkpoint.name,
2035
- count: checkpoint.count,
2036
- isActive: selectedCheckpoint === checkpoint.id,
2037
- onClick: () => onSelectCheckpoint(checkpoint.id)
2038
- },
2039
- checkpoint.id
2040
- ))
2041
- ] }) })
2042
- ] });
2043
- }
2044
- var CommandQueueSidebar = ({
2045
- selectedCheckpoint,
2046
- onSelectCheckpoint,
2047
- status,
2048
- onStatusChange,
2049
- priorityRange,
2050
- onPriorityRangeChange,
2051
- timeRange
2052
- }) => {
2053
- const colors = useCyberColors();
2054
- const statusFilter = status === "all" ? void 0 : status;
2055
- const { data: checkpointData, isLoading: isDonutLoading } = useCommandQueueTotals({
2056
- timeRange,
2057
- priorityMin: priorityRange[0],
2058
- priorityMax: priorityRange[1],
2059
- status: statusFilter
2060
- });
2061
- const {
2062
- pending: pendingCount,
2063
- completed: completedCount,
2064
- expired: expiredCount
2065
- } = checkpointData?.statusCounts ?? { pending: 0, completed: 0, expired: 0 };
2066
- const {
2067
- critical: criticalCount,
2068
- high: highCount,
2069
- medium: mediumCount,
2070
- low: lowCount
2071
- } = checkpointData?.priorityCounts ?? { critical: 0, high: 0, medium: 0, low: 0 };
2072
- const totalTasks = checkpointData?.total ?? 0;
2073
- const statusSegments = [
2074
- { name: "Pending", value: pendingCount, color: colors.cyan },
2075
- { name: "Completed", value: completedCount, color: colors.green },
2076
- { name: "Expired", value: expiredCount, color: colors.red }
2077
- ];
2078
- const prioritySegments = [
2079
- { name: "Critical", value: criticalCount, color: colors.red },
2080
- { name: "High", value: highCount, color: colors.yellow },
2081
- { name: "Medium", value: mediumCount, color: colors.blue },
2082
- { name: "Low", value: lowCount, color: colors.cyanDim }
2083
- ];
2084
- return /* @__PURE__ */ jsxs(Stack, { gap: 0, style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
2085
- /* @__PURE__ */ jsx(Box, { p: "sm", style: { borderBottom: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
2086
- status === "all" && /* @__PURE__ */ jsx(
2087
- CyberDonut,
2088
- {
2089
- title: "Status",
2090
- segments: statusSegments,
2091
- centerValue: totalTasks,
2092
- centerLabel: "total",
2093
- glowId: "sbStatusGlow",
2094
- colors,
2095
- isLoading: isDonutLoading
2096
- }
2097
- ),
2098
- /* @__PURE__ */ jsx(
2099
- CyberDonut,
2100
- {
2101
- title: "Priority",
2102
- segments: prioritySegments,
2103
- centerValue: criticalCount + highCount + mediumCount + lowCount,
2104
- centerLabel: status === "all" ? "total" : status,
2105
- glowId: "sbPrioGlow",
2106
- colors,
2107
- isLoading: isDonutLoading
2108
- }
2109
- )
2110
- ] }) }),
2111
- /* @__PURE__ */ jsx(
2112
- CommandQueueSidebarTop,
2113
- {
2114
- status,
2115
- onStatusChange,
2116
- priorityRange,
2117
- onPriorityRangeChange
2118
- }
2119
- ),
2120
- /* @__PURE__ */ jsx(
2121
- CommandQueueSidebarMiddle,
2122
- {
2123
- selectedCheckpoint,
2124
- onSelectCheckpoint,
2125
- priorityRange,
2126
- status,
2127
- timeRange
2128
- }
2129
- )
2130
- ] });
2131
- };
2132
- function ContextUsageBadge({ currentTokens, maxTokens }) {
2133
- const percentage = currentTokens / maxTokens * 100;
2134
- const color = percentage > 90 ? "red" : percentage > 70 ? "yellow" : "green";
2135
- return /* @__PURE__ */ jsx(
2136
- Tooltip,
2137
- {
2138
- label: `${currentTokens.toLocaleString()} of ${maxTokens.toLocaleString()} tokens used (${percentage.toFixed(1)}%)`,
2139
- position: "bottom",
2140
- children: /* @__PURE__ */ jsxs(Group, { gap: 6, style: { cursor: "help" }, children: [
2141
- /* @__PURE__ */ jsx(IconBrain, { size: 16, color: `var(--mantine-color-${color}-6)` }),
2142
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: color, fw: 500, children: [
2143
- currentTokens.toLocaleString(),
2144
- " / ",
2145
- maxTokens.toLocaleString()
2146
- ] }),
2147
- /* @__PURE__ */ jsx(Progress, { value: percentage, color, size: "sm", w: 80, radius: "xl" })
2148
- ] })
2149
- }
2150
- );
2151
- }
2152
- function parseMemoryContent(memory) {
2153
- const parsedSessionMemory = {};
2154
- for (const [key, entry] of Object.entries(memory.sessionMemory || {})) {
2155
- try {
2156
- if (typeof entry.content === "string") {
2157
- parsedSessionMemory[key] = {
2158
- ...entry,
2159
- content: JSON.parse(entry.content)
2160
- };
2161
- } else {
2162
- parsedSessionMemory[key] = entry;
2163
- }
2164
- } catch {
2165
- parsedSessionMemory[key] = entry;
2166
- }
2167
- }
2168
- const parsedHistory = (memory.history || []).map((entry) => {
2169
- try {
2170
- if (typeof entry.content === "string") {
2171
- return {
2172
- ...entry,
2173
- content: JSON.parse(entry.content)
2174
- };
2175
- }
2176
- return entry;
2177
- } catch {
2178
- return entry;
2179
- }
2180
- });
2181
- return {
2182
- sessionMemory: parsedSessionMemory,
2183
- history: parsedHistory
2184
- };
2185
- }
2186
- function SessionMemory({ memory }) {
2187
- if (!memory) {
2188
- return /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
2189
- /* @__PURE__ */ jsx(IconDatabase, { size: 18 }),
2190
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No memory data available" })
2191
- ] });
2192
- }
2193
- const sessionMemoryKeys = Object.keys(memory.sessionMemory || {});
2194
- const historyCount = memory.history?.length || 0;
2195
- const parsedMemory = parseMemoryContent(memory);
2196
- return /* @__PURE__ */ jsxs(Stack, { children: [
2197
- /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
2198
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
2199
- /* @__PURE__ */ jsx(IconDatabase, { size: 20 }),
2200
- /* @__PURE__ */ jsx(Text, { fw: 600, size: "sm", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Session Memory" })
2201
- ] }),
2202
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
2203
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", children: [
2204
- sessionMemoryKeys.length,
2205
- " keys"
2206
- ] }),
2207
- /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", children: [
2208
- historyCount,
2209
- " history items"
2210
- ] })
2211
- ] })
2212
- ] }),
2213
- /* @__PURE__ */ jsxs(Stack, { children: [
2214
- /* @__PURE__ */ jsx(
2215
- CollapsibleSection,
2216
- {
2217
- title: "Session Memory",
2218
- count: sessionMemoryKeys.length,
2219
- countLabel: "keys",
2220
- emptyMessage: "No session memory stored",
2221
- defaultExpanded: false,
2222
- children: /* @__PURE__ */ jsx(JsonViewer, { data: parsedMemory.sessionMemory, maxHeight: 300 })
2223
- }
2224
- ),
2225
- /* @__PURE__ */ jsx(
2226
- CollapsibleSection,
2227
- {
2228
- title: "Conversation History",
2229
- count: historyCount,
2230
- countLabel: "items",
2231
- emptyMessage: "No history available",
2232
- defaultExpanded: false,
2233
- children: /* @__PURE__ */ jsx(JsonViewer, { data: parsedMemory.history, maxHeight: 300 })
2234
- }
2235
- )
2236
- ] })
2237
- ] });
2238
- }
2239
- var triggerTypeIcons = {
2240
- webhook: IconWebhook,
2241
- schedule: IconClock,
2242
- manual: IconHandClick,
2243
- event: IconBolt
2244
- };
2245
- var connectionStatusIcons = {
2246
- connected: IconCircleCheck,
2247
- disconnected: IconCircleX,
2248
- error: IconAlertCircle
2249
- };
2250
- var statBubbleBase = {
2251
- minWidth: 20,
2252
- height: 20,
2253
- borderRadius: 10,
2254
- display: "flex",
2255
- alignItems: "center",
2256
- justifyContent: "center",
2257
- fontSize: 11,
2258
- fontWeight: 600,
2259
- padding: "0 6px",
2260
- color: "white",
2261
- boxShadow: "0 2px 4px rgba(0,0,0,0.2)"
2262
- };
2263
- var CommandViewNode = memo(function CommandViewNode2({ data, selected }) {
2264
- const Icon = getResourceIcon(data.type);
2265
- const color = getResourceColor(data.type);
2266
- const successCount = (data.type === "agent" || data.type === "workflow") && data.stats ? data.stats.successCount : 0;
2267
- const failureCount = (data.type === "agent" || data.type === "workflow") && data.stats ? data.stats.failureCount : 0;
2268
- const warningCount = (data.type === "agent" || data.type === "workflow") && data.stats ? data.stats.warningCount : 0;
2269
- const pendingCount = data.type === "human" && data.stats ? data.stats.pendingCount : 0;
2270
- const showBubbles = successCount > 0 || failureCount > 0 || warningCount > 0 || pendingCount > 0;
2271
- return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
2272
- showBubbles && /* @__PURE__ */ jsxs(
2273
- "div",
2274
- {
2275
- style: {
2276
- position: "absolute",
2277
- top: -8,
2278
- right: -8,
2279
- display: "flex",
2280
- gap: 4,
2281
- zIndex: 10
2282
- },
2283
- children: [
2284
- successCount > 0 && /* @__PURE__ */ jsx(
2285
- "div",
2286
- {
2287
- style: {
2288
- ...statBubbleBase,
2289
- background: "linear-gradient(135deg, var(--mantine-color-green-5), var(--mantine-color-green-7))"
2290
- },
2291
- children: successCount
2292
- }
2293
- ),
2294
- warningCount > 0 && /* @__PURE__ */ jsx(
2295
- "div",
2296
- {
2297
- style: {
2298
- ...statBubbleBase,
2299
- background: "linear-gradient(135deg, var(--mantine-color-yellow-5), var(--mantine-color-yellow-7))"
2300
- },
2301
- children: warningCount
2302
- }
2303
- ),
2304
- failureCount > 0 && /* @__PURE__ */ jsx(
2305
- "div",
2306
- {
2307
- style: {
2308
- ...statBubbleBase,
2309
- background: "linear-gradient(135deg, var(--mantine-color-red-5), var(--mantine-color-red-7))"
2310
- },
2311
- children: failureCount
2312
- }
2313
- ),
2314
- pendingCount > 0 && /* @__PURE__ */ jsx(
2315
- "div",
2316
- {
2317
- style: {
2318
- ...statBubbleBase,
2319
- background: "linear-gradient(135deg, var(--mantine-color-orange-5), var(--mantine-color-orange-7))"
2320
- },
2321
- children: pendingCount
2322
- }
2323
- )
2324
- ]
2325
- }
2326
- ),
2327
- /* @__PURE__ */ jsx(BaseNode, { color, selected, highlighted: Boolean(data.highlighted), children: /* @__PURE__ */ jsxs(Stack, { gap: 8, children: [
2328
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
2329
- /* @__PURE__ */ jsx(
2330
- ThemeIcon,
2331
- {
2332
- size: "md",
2333
- variant: "gradient",
2334
- gradient: { from: `${color}.4`, to: `${color}.6`, deg: 135 },
2335
- className: Graph_module_css_default.nodeIcon,
2336
- children: /* @__PURE__ */ jsx(Icon, { size: 16 })
2337
- }
2338
- ),
2339
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, truncate: true, style: { flex: 1, fontFamily: "var(--elevasis-font-family-subtitle)" }, children: data.name })
2340
- ] }),
2341
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: data.description }),
2342
- /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "wrap", children: [
2343
- /* @__PURE__ */ jsx(
2344
- Badge,
2345
- {
2346
- size: "xs",
2347
- variant: "gradient",
2348
- gradient: data.status === "prod" ? { from: "green.5", to: "green.7", deg: 135 } : { from: "blue.5", to: "blue.7", deg: 135 },
2349
- className: data.status === "prod" ? Graph_module_css_default.badgeProd : "",
2350
- style: {
2351
- textTransform: "uppercase",
2352
- letterSpacing: "0.5px"
2353
- },
2354
- children: data.status
2355
- }
2356
- ),
2357
- data.type === "agent" && /* @__PURE__ */ jsxs(Fragment, { children: [
2358
- /* @__PURE__ */ jsxs(
2359
- Badge,
2360
- {
2361
- size: "xs",
2362
- variant: "outline",
2363
- color: "gray",
2364
- className: Graph_module_css_default.badge,
2365
- style: { backdropFilter: "blur(4px)" },
2366
- children: [
2367
- data.toolCount,
2368
- " tools"
2369
- ]
2370
- }
2371
- ),
2372
- data.hasKnowledgeMap && /* @__PURE__ */ jsx(
2373
- Badge,
2374
- {
2375
- size: "xs",
2376
- variant: "gradient",
2377
- gradient: { from: "grape.5", to: "grape.7", deg: 135 },
2378
- leftSection: /* @__PURE__ */ jsx(IconBrain, { size: 10 }),
2379
- className: Graph_module_css_default.badge,
2380
- children: "KM"
2381
- }
2382
- ),
2383
- data.hasMemory && /* @__PURE__ */ jsx(
2384
- Badge,
2385
- {
2386
- size: "xs",
2387
- variant: "gradient",
2388
- gradient: { from: "cyan.5", to: "cyan.7", deg: 135 },
2389
- leftSection: /* @__PURE__ */ jsx(IconDatabase, { size: 10 }),
2390
- className: Graph_module_css_default.badge,
2391
- children: "Mem"
2392
- }
2393
- ),
2394
- data.sessionCapable && /* @__PURE__ */ jsx(
2395
- Badge,
2396
- {
2397
- size: "xs",
2398
- variant: "gradient",
2399
- gradient: { from: "blue.5", to: "blue.7", deg: 135 },
2400
- leftSection: /* @__PURE__ */ jsx(IconMessage, { size: 10 }),
2401
- className: Graph_module_css_default.badge,
2402
- children: "Session"
2403
- }
2404
- )
2405
- ] }),
2406
- data.type === "workflow" && /* @__PURE__ */ jsxs(
2407
- Badge,
2408
- {
2409
- size: "xs",
2410
- variant: "outline",
2411
- color: "gray",
2412
- className: Graph_module_css_default.badge,
2413
- style: { backdropFilter: "blur(4px)" },
2414
- children: [
2415
- data.stepCount,
2416
- " steps"
2417
- ]
2418
- }
2419
- ),
2420
- data.type === "integration" && /* @__PURE__ */ jsx(
2421
- Badge,
2422
- {
2423
- size: "xs",
2424
- variant: "gradient",
2425
- gradient: data.connectionStatus === "connected" ? { from: "green.5", to: "green.7", deg: 135 } : data.connectionStatus === "error" ? { from: "red.5", to: "red.7", deg: 135 } : { from: "gray.5", to: "gray.7", deg: 135 },
2426
- leftSection: (() => {
2427
- const StatusIcon = connectionStatusIcons[data.connectionStatus];
2428
- return /* @__PURE__ */ jsx(StatusIcon, { size: 10 });
2429
- })(),
2430
- className: Graph_module_css_default.badge,
2431
- children: data.connectionStatus
2432
- }
2433
- ),
2434
- data.type === "trigger" && /* @__PURE__ */ jsx(
2435
- Badge,
2436
- {
2437
- size: "xs",
2438
- variant: "outline",
2439
- color: "gray",
2440
- leftSection: (() => {
2441
- const TriggerIcon = triggerTypeIcons[data.triggerType] || IconBolt;
2442
- return /* @__PURE__ */ jsx(TriggerIcon, { size: 10 });
2443
- })(),
2444
- className: Graph_module_css_default.badge,
2445
- style: { backdropFilter: "blur(4px)" },
2446
- children: data.triggerType
2447
- }
2448
- ),
2449
- data.type === "external" && /* @__PURE__ */ jsx(
2450
- Badge,
2451
- {
2452
- size: "xs",
2453
- variant: "outline",
2454
- color: "gray",
2455
- leftSection: /* @__PURE__ */ jsx(IconExternalLink, { size: 10 }),
2456
- className: Graph_module_css_default.badge,
2457
- style: { backdropFilter: "blur(4px)" },
2458
- children: data.platform
2459
- }
2460
- ),
2461
- data.type === "human" && /* @__PURE__ */ jsx(
2462
- Badge,
2463
- {
2464
- size: "xs",
2465
- variant: "gradient",
2466
- gradient: { from: "yellow.5", to: "orange.6", deg: 135 },
2467
- leftSection: /* @__PURE__ */ jsx(IconHandClick, { size: 10 }),
2468
- className: Graph_module_css_default.badge,
2469
- children: "Approval Required"
2470
- }
2471
- )
2472
- ] })
2473
- ] }) })
2474
- ] });
2475
- });
2476
- var relationshipColorMap = {
2477
- triggers: { color: "edgeTriggers", glow: "edgeTriggersGlow" },
2478
- uses: { color: "edgeUses", glow: "edgeUsesGlow" },
2479
- approval: { color: "edgeApproval", glow: "edgeApprovalGlow" }
2480
- };
2481
- function getEdgeColors(relationship, colors) {
2482
- const mapping = relationshipColorMap[relationship] ?? relationshipColorMap.approval;
2483
- return {
2484
- edgeColor: colors[mapping.color],
2485
- glowColor: colors[mapping.glow]
2486
- };
2487
- }
2488
- var CommandViewEdge = memo(function CommandViewEdge2({
2489
- id,
2490
- sourceX,
2491
- sourceY,
2492
- targetX,
2493
- targetY,
2494
- sourcePosition,
2495
- targetPosition,
2496
- data,
2497
- selected
2498
- }) {
2499
- const colors = useGraphTheme();
2500
- const relationship = data?.relationship || "uses";
2501
- const { edgeColor, glowColor } = getEdgeColors(relationship, colors);
2502
- return /* @__PURE__ */ jsx(
2503
- BaseEdge,
2504
- {
2505
- id,
2506
- sourceX,
2507
- sourceY,
2508
- targetX,
2509
- targetY,
2510
- sourcePosition,
2511
- targetPosition,
2512
- color: edgeColor,
2513
- glowColor,
2514
- label: data?.label || relationship,
2515
- animated: data?.animated ?? false,
2516
- selected,
2517
- dimmed: data?.dimmed,
2518
- edgeIndex: data?.edgeIndex,
2519
- totalEdges: data?.totalEdges
2520
- }
2521
- );
2522
- });
2523
- var nodeTypes2 = {
2524
- commandView: CommandViewNode
2525
- };
2526
- var edgeTypes2 = {
2527
- commandView: CommandViewEdge
2528
- };
2529
- var CommandViewGraphInner = forwardRef(function CommandViewGraphInner2({ graph, height, selectedNodeId, onNodeSelect }, ref) {
2530
- const { fitView } = useReactFlow();
2531
- const { nodes: layoutNodes, edges: layoutEdges } = useCommandViewLayout(graph);
2532
- const { nodes, edges, handleNodeMouseEnter, handleNodeMouseLeave } = useDirectedChainHighlighting(
2533
- layoutNodes,
2534
- layoutEdges,
2535
- { selectedNodeId }
2536
- );
2537
- const { handleNodeClick, handlePaneClick } = useNodeSelection(selectedNodeId ?? null, onNodeSelect ?? (() => {
2538
- }));
2539
- const nodesWithSelection = useMemo(
2540
- () => nodes.map((node) => ({
2541
- ...node,
2542
- selected: node.id === selectedNodeId
2543
- })),
2544
- [nodes, selectedNodeId]
2545
- );
2546
- useImperativeHandle(ref, () => ({
2547
- fitView: () => fitView({ padding: 0.15, duration: 300 })
2548
- }));
2549
- return /* @__PURE__ */ jsx(
2550
- Box,
2551
- {
2552
- className: Graph_module_css_default.graphContainer,
2553
- style: {
2554
- width: "100%",
2555
- height,
2556
- border: "1px solid var(--color-border)",
2557
- borderRadius: "var(--mantine-radius-default)",
2558
- overflow: "hidden"
2559
- },
2560
- children: /* @__PURE__ */ jsxs(
2561
- ReactFlow,
2562
- {
2563
- nodes: nodesWithSelection,
2564
- edges,
2565
- nodeTypes: nodeTypes2,
2566
- edgeTypes: edgeTypes2,
2567
- onNodeMouseEnter: handleNodeMouseEnter,
2568
- onNodeMouseLeave: handleNodeMouseLeave,
2569
- onNodeClick: onNodeSelect ? handleNodeClick : void 0,
2570
- onPaneClick: onNodeSelect ? handlePaneClick : void 0,
2571
- fitView: true,
2572
- fitViewOptions: { padding: 0.15 },
2573
- proOptions: { hideAttribution: true },
2574
- minZoom: GRAPH_CONSTANTS.MIN_ZOOM,
2575
- maxZoom: GRAPH_CONSTANTS.MAX_ZOOM,
2576
- nodesDraggable: false,
2577
- nodesConnectable: false,
2578
- elementsSelectable: !!onNodeSelect,
2579
- selectNodesOnDrag: false,
2580
- panOnDrag: true,
2581
- zoomOnScroll: true,
2582
- zoomOnPinch: true,
2583
- panOnScroll: false,
2584
- children: [
2585
- /* @__PURE__ */ jsx(GraphBackground, {}),
2586
- /* @__PURE__ */ jsx(
2587
- GraphLegend,
2588
- {
2589
- title: "",
2590
- position: "bottom-right",
2591
- items: [
2592
- { color: "orange", label: "Triggers" },
2593
- { color: "violet", label: "Agents" },
2594
- { color: "blue", label: "Workflows" },
2595
- { color: "teal", label: "Integrations" },
2596
- { color: "yellow", label: "Human" },
2597
- { color: "gray", label: "External" }
2598
- ]
2599
- }
2600
- ),
2601
- /* @__PURE__ */ jsx(
2602
- GraphLegend,
2603
- {
2604
- title: "",
2605
- position: "bottom-left",
2606
- items: [
2607
- { color: "blue", label: "Triggers", type: "line" },
2608
- { color: "teal", label: "Uses", type: "line" },
2609
- { color: "yellow", label: "Requires Approval", type: "line" }
2610
- ]
2611
- }
2612
- ),
2613
- /* @__PURE__ */ jsx(GraphFitViewButton, { padding: 0.15, variant: "mantine", duration: 300 })
2614
- ]
2615
- }
2616
- )
2617
- }
2618
- );
2619
- });
2620
- var CommandViewGraph = forwardRef(
2621
- function CommandViewGraph2(props, ref) {
2622
- return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(CommandViewGraphInner, { ref, ...props }) });
2623
- }
2624
- );
2625
-
2626
- export { ActionModal, AgentDefinitionDisplay, AgentExecutionLogs, BaseExecutionLogs, BaseExecutionLogsHeader, BaseExecutionLogsStates, CheckpointGroup, CollapsibleJsonSection, CommandQueueSidebar, CommandQueueSidebarMiddle, CommandQueueSidebarTop, CommandQueueTaskRow, CommandViewEdge, CommandViewGraph, CommandViewNode, ConfigCard, ContentSections, ContextUsageBadge, ContractDisplay, ExecutionErrorSection, FormFieldRenderer, LogEntry, LogGroup, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, ResourceDefinitionSection, ResourceErrorState, ResourceFilter, ResourceHeader, ResourceNotFoundState, SessionMemory, ToolsListDisplay, WorkflowDefinitionDisplay, WorkflowExecutionLogs, getExecutionStatusConfig, getIcon, getLogLevelConfig, iconMap, useNewKnowledgeMapLayout };