@elevasis/ui 1.7.5 → 1.8.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 (43) hide show
  1. package/dist/api/index.js +2 -3
  2. package/dist/auth/index.js +3 -4
  3. package/dist/charts/index.js +6 -8
  4. package/dist/{chunk-SFF5MJEI.js → chunk-2YBPRE6H.js} +1 -2
  5. package/dist/{chunk-U34YGJQB.js → chunk-3I2LOKQU.js} +1 -1
  6. package/dist/{chunk-PVVQTENF.js → chunk-3PURTICE.js} +1 -1
  7. package/dist/{chunk-2JBWPFHF.js → chunk-6TMW6VQ2.js} +1 -1
  8. package/dist/{chunk-6HZAMY6T.js → chunk-ARZM3OTI.js} +6 -2
  9. package/dist/{chunk-OK3XFSJJ.js → chunk-BWZMI4KP.js} +963 -10
  10. package/dist/{chunk-4KPI7YCY.js → chunk-EHXOR5LA.js} +2 -3
  11. package/dist/{chunk-Y7UY3HI4.js → chunk-ESOQEOOX.js} +2 -2
  12. package/dist/{chunk-L2CM2CUA.js → chunk-GZVH423C.js} +26 -3
  13. package/dist/{chunk-Y6DNK5ZD.js → chunk-JRJW2H57.js} +35 -9
  14. package/dist/{chunk-LBPALY25.js → chunk-JUPCUF77.js} +2 -2
  15. package/dist/chunk-QWYJHM3S.js +1068 -0
  16. package/dist/{chunk-NEK6JKPW.js → chunk-WUQWCUCB.js} +1 -1
  17. package/dist/chunk-Z4TPHMRD.js +231 -0
  18. package/dist/components/index.css +65 -0
  19. package/dist/components/index.d.ts +261 -2
  20. package/dist/components/index.js +1136 -80
  21. package/dist/hooks/index.css +452 -0
  22. package/dist/hooks/index.d.ts +1831 -13
  23. package/dist/hooks/index.js +15 -6
  24. package/dist/hooks/published.css +452 -0
  25. package/dist/hooks/published.d.ts +866 -6
  26. package/dist/hooks/published.js +15 -370
  27. package/dist/index.css +3 -0
  28. package/dist/index.d.ts +1665 -2
  29. package/dist/index.js +14 -17
  30. package/dist/initialization/index.js +3 -4
  31. package/dist/organization/index.js +3 -4
  32. package/dist/profile/index.js +1 -2
  33. package/dist/provider/index.css +3 -0
  34. package/dist/provider/index.js +7 -10
  35. package/dist/provider/published.js +6 -9
  36. package/dist/utils/index.d.ts +92 -1
  37. package/dist/utils/index.js +1 -2
  38. package/package.json +7 -3
  39. package/dist/chunk-4VGWQ5AN.js +0 -91
  40. package/dist/chunk-KA7LO7U5.js +0 -28
  41. package/dist/chunk-LFYO3MDC.js +0 -58
  42. package/dist/chunk-TIRMFDM4.js +0 -33
  43. package/dist/chunk-TYV5NJV2.js +0 -1
@@ -1,9 +1,9 @@
1
- import { useCyberColors, EmptyState, CyberLegendItem, CyberAreaChart, ContextViewer, JsonViewer, StyledMarkdown } from '../chunk-4KPI7YCY.js';
2
- export { APIErrorAlert, CardHeader, CollapsibleSection, ContextViewer, CustomSelector, DetailCardSkeleton, EmptyState, JsonViewer, ListSkeleton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, StyledMarkdown, TabCountBadge, TimeRangeSelector, TrendIndicator, catalogItemToResourceDefinition } from '../chunk-4KPI7YCY.js';
1
+ import { useCyberColors, EmptyState, CyberLegendItem, CyberAreaChart, APIErrorAlert, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, ContextViewer, JsonViewer, StyledMarkdown } from '../chunk-EHXOR5LA.js';
2
+ export { APIErrorAlert, CardHeader, CollapsibleSection, ContextViewer, CustomSelector, DetailCardSkeleton, EmptyState, JsonViewer, ListSkeleton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, StyledMarkdown, TabCountBadge, TimeRangeSelector, TrendIndicator, catalogItemToResourceDefinition } from '../chunk-EHXOR5LA.js';
3
3
  export { ElevasisLoader, NavigationButton } from '../chunk-YGYF6G7W.js';
4
- import '../chunk-TYV5NJV2.js';
5
- import { useResourcesHealth, useMarkAsRead, useMarkAllAsRead, useNotificationCount, useNotifications, useSubmitAction, useDeleteTask } from '../chunk-OK3XFSJJ.js';
6
- import { getTimeRangeDates, formatBucketTime } from '../chunk-6HZAMY6T.js';
4
+ export { showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification } from '../chunk-QWYJHM3S.js';
5
+ import { useResourcesHealth, useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead, useMarkAllAsRead, useNotificationCount, useNotifications, useSubmitAction, useDeleteTask } from '../chunk-BWZMI4KP.js';
6
+ import { getTimeRangeDates, formatBucketTime } from '../chunk-ARZM3OTI.js';
7
7
  import '../chunk-JGJSZ3UE.js';
8
8
  import '../chunk-LHQTTUL2.js';
9
9
  import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, useFitViewTrigger, useGraphHighlighting, calculateGraphHeight, GRAPH_CONSTANTS } from '../chunk-F6RBK7NJ.js';
@@ -11,29 +11,32 @@ export { Graph_module_css_default as graphStyles } from '../chunk-F6RBK7NJ.js';
11
11
  import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from '../chunk-3Q5V2T6L.js';
12
12
  export { CONTAINER_CONSTANTS, SHARED_VIZ_CONSTANTS } from '../chunk-3Q5V2T6L.js';
13
13
  import '../chunk-YZ6GTZXL.js';
14
- import '../chunk-TIRMFDM4.js';
15
- import '../chunk-LFYO3MDC.js';
16
- import { getErrorInfo, formatErrorMessage, getErrorTitle } from '../chunk-4VGWQ5AN.js';
17
- import '../chunk-2JBWPFHF.js';
14
+ import '../chunk-3I2LOKQU.js';
15
+ import '../chunk-RNP5R5I3.js';
16
+ import '../chunk-ESOQEOOX.js';
17
+ import '../chunk-KB5NKPTN.js';
18
+ import '../chunk-JRJW2H57.js';
19
+ import '../chunk-2YBPRE6H.js';
20
+ import '../chunk-JUPCUF77.js';
21
+ import { formatChartAxisDate, PAGE_SIZE_DEFAULT, getErrorInfo, formatErrorMessage } from '../chunk-Z4TPHMRD.js';
22
+ import '../chunk-6TMW6VQ2.js';
18
23
  import '../chunk-FWZJH3TL.js';
19
- import '../chunk-NEK6JKPW.js';
20
- import '../chunk-L2CM2CUA.js';
21
- import '../chunk-KA7LO7U5.js';
24
+ import '../chunk-WUQWCUCB.js';
25
+ import '../chunk-GZVH423C.js';
22
26
  import '../chunk-DD3CCMCZ.js';
23
27
  import '../chunk-7PLEQFHO.js';
24
- import '../chunk-Q7DJKLEN.js';
25
- import { Paper, Stack, Text, Group, Badge, Box, useComputedColorScheme, Modal, Center, Space, Button, Title, TextInput, Table, Textarea, Radio, Checkbox, Select, NumberInput, Tooltip, Card, Loader, UnstyledButton, Divider, ScrollArea, Popover, Indicator, ActionIcon, SegmentedControl, Alert, ThemeIcon, Menu, Accordion, Collapse, SimpleGrid } from '@mantine/core';
28
+ import { useRouterContext } from '../chunk-Q7DJKLEN.js';
29
+ import { Paper, Stack, Text, Group, Badge, Box, useComputedColorScheme, Modal, Center, Space, Button, Title, TextInput, Table, Textarea, Radio, Checkbox, Select, NumberInput, Tooltip, Card, Loader, ActionIcon, SegmentedControl, NumberFormatter, Alert, Switch, Pagination, UnstyledButton, Divider, ScrollArea, Popover, Indicator, ThemeIcon, Menu, Accordion, Collapse, SimpleGrid } from '@mantine/core';
26
30
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
27
- import { memo, useMemo, cloneElement, useEffect, useState, useCallback, Fragment as Fragment$1 } from 'react';
28
- import { IconPlayerPlay, IconPlayerStop, IconArrowsSplit, IconSquare, IconBrain, IconFileText, IconMail, IconSend, IconClock, IconArrowUp, IconMessageCircle, IconRocket, IconEye, IconEdit, IconAlertTriangle, IconRefresh, IconX, IconCheck, IconChevronUp, IconChevronDown, IconSelector, IconTrash, IconChartBar, IconCircle, IconCircleFilled, IconBell, IconFocus2, IconAlertCircle, IconRobot, IconGitBranch, IconDotsVertical, IconExternalLink, IconChevronRight, IconTool, IconSettings, IconCpu, IconClockHour4, IconVersions, IconNetwork, IconSitemap, IconFileOff, IconCircleX, IconCircleCheck } from '@tabler/icons-react';
31
+ import { memo, useMemo, cloneElement, useState, useEffect, useCallback, Fragment as Fragment$1 } from 'react';
32
+ import { IconPlayerPlay, IconPlayerStop, IconArrowsSplit, IconSquare, IconBrain, IconFileText, IconMail, IconSend, IconClock, IconArrowUp, IconMessageCircle, IconRocket, IconEye, IconEdit, IconAlertTriangle, IconRefresh, IconX, IconCheck, IconChevronUp, IconChevronDown, IconSelector, IconTrash, IconChartBar, IconCircleCheck, IconThumbDown, IconThumbUp, IconCircleX, IconSearch, IconFilterOff, IconArrowUpRight, IconAlertCircle, IconExternalLink, IconDownload, IconInfoCircle, IconBug, IconChecks, IconCircle, IconCircleFilled, IconBell, IconFocus2, IconRobot, IconGitBranch, IconDotsVertical, IconChevronRight, IconTool, IconSettings, IconCpu, IconClockHour4, IconVersions, IconNetwork, IconSitemap, IconArrowDown, IconFileOff, IconKey, IconUser } from '@tabler/icons-react';
29
33
  import { AreaChart } from '@mantine/charts';
30
- import { useDisclosure } from '@mantine/hooks';
31
34
  import { formatDistanceToNow } from 'date-fns';
35
+ import { useDisclosure } from '@mantine/hooks';
32
36
  import { Position, Handle, getSmoothStepPath, BaseEdge as BaseEdge$1, EdgeLabelRenderer, Panel, useReactFlow, Controls, ReactFlowProvider, ReactFlow } from '@xyflow/react';
33
37
  import '@xyflow/react/dist/style.css';
34
38
  import { useForm } from '@mantine/form';
35
39
  import dagre from '@dagrejs/dagre';
36
- import { notifications } from '@mantine/notifications';
37
40
 
38
41
  var CustomModal = ({ children, opened, onClose, loading, style, size }) => {
39
42
  const canClose = loading === true ? false : true;
@@ -283,7 +286,7 @@ function ExecutionLogsTable({ executions, isLoading, onRowClick }) {
283
286
  /* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Version" })
284
287
  ] }) }),
285
288
  /* @__PURE__ */ jsx(Table.Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(LoadingState, {}) }) }) : executions.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(EmptyState2, {}) }) }) : executions.map((execution) => {
286
- const statusConfig = getStatusConfig(execution.status);
289
+ const statusConfig3 = getStatusConfig(execution.status);
287
290
  return /* @__PURE__ */ jsxs(
288
291
  Table.Tr,
289
292
  {
@@ -291,7 +294,7 @@ function ExecutionLogsTable({ executions, isLoading, onRowClick }) {
291
294
  onClick: () => handleRowClick(execution),
292
295
  children: [
293
296
  /* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 200 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, title: execution.resourceName, children: execution.resourceName }) }),
294
- /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: statusConfig.color, variant: "light", size: "sm", leftSection: statusConfig.icon, children: statusConfig.label }) }),
297
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: statusConfig3.color, variant: "light", size: "sm", leftSection: statusConfig3.icon, children: statusConfig3.label }) }),
295
298
  /* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: formatStartTime(execution.startTime) }) }),
296
299
  /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: execution.status === "running" ? "dimmed" : void 0, children: formatDuration(execution.duration) }) }),
297
300
  /* @__PURE__ */ jsx(Table.Td, { ta: "center", children: /* @__PURE__ */ jsx(Badge, { color: execution.resourceStatus === "prod" ? "green" : "gray", variant: "light", size: "sm", children: execution.resourceStatus.toUpperCase() }) }),
@@ -408,6 +411,1108 @@ function ResourceHealthPanel({ resourceId, resourceType, timeRange }) {
408
411
  ] })
409
412
  ] });
410
413
  }
414
+ var statusConfig = {
415
+ success: { color: "green", icon: IconCircleCheck },
416
+ failure: { color: "red", icon: IconCircleX },
417
+ pending: { color: "yellow", icon: IconClock },
418
+ approved: { color: "green", icon: IconThumbUp },
419
+ rejected: { color: "red", icon: IconThumbDown },
420
+ completed: { color: "blue", icon: IconCircleCheck }
421
+ };
422
+ var activityTypeLabels = {
423
+ workflow_execution: "Workflow",
424
+ agent_run: "Agent",
425
+ hitl_action: "HITL Action",
426
+ webhook_received: "Webhook In",
427
+ webhook_executed: "Webhook Out",
428
+ webhook_failed: "Webhook Fail",
429
+ credential_change: "Credential",
430
+ api_key_change: "API Key",
431
+ deployment_change: "Deployment",
432
+ membership_change: "Membership"
433
+ };
434
+ function getActorDisplay(actorType) {
435
+ switch (actorType) {
436
+ case "user":
437
+ return { label: "User", color: "blue", icon: IconUser };
438
+ case "api_key":
439
+ return { label: "API Key", color: "violet", icon: IconKey };
440
+ default:
441
+ return { label: "System", color: "gray", icon: IconRobot };
442
+ }
443
+ }
444
+ var COLUMN_COUNT = 6;
445
+ function LoadingState2() {
446
+ return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "md" }) });
447
+ }
448
+ function EmptyState3() {
449
+ return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
450
+ /* @__PURE__ */ jsx(IconFileOff, { size: 48, color: "var(--color-text-subtle)" }),
451
+ /* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, c: "dimmed", children: "No activities found" }),
452
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Activities will appear here as workflows and agents run" })
453
+ ] }) });
454
+ }
455
+ function ActivityTable({ activities, isLoading, onRowClick }) {
456
+ return /* @__PURE__ */ jsxs(Table, { children: [
457
+ /* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
458
+ /* @__PURE__ */ jsx(Table.Th, { children: "Title" }),
459
+ /* @__PURE__ */ jsx(Table.Th, { children: "Type" }),
460
+ /* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
461
+ /* @__PURE__ */ jsx(Table.Th, { children: "Actor" }),
462
+ /* @__PURE__ */ jsx(Table.Th, { children: "Entity" }),
463
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Time" })
464
+ ] }) }),
465
+ /* @__PURE__ */ jsx(Table.Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: COLUMN_COUNT, children: /* @__PURE__ */ jsx(LoadingState2, {}) }) }) : activities.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: COLUMN_COUNT, children: /* @__PURE__ */ jsx(EmptyState3, {}) }) }) : activities.map((activity) => {
466
+ const config = statusConfig[activity.status];
467
+ const StatusIcon = config.icon;
468
+ const actor = getActorDisplay(activity.actorType);
469
+ const ActorIcon = actor.icon;
470
+ return /* @__PURE__ */ jsxs(
471
+ Table.Tr,
472
+ {
473
+ style: { cursor: onRowClick ? "pointer" : void 0 },
474
+ onClick: () => onRowClick?.(activity),
475
+ children: [
476
+ /* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 250 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, title: activity.title, children: activity.title }) }),
477
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { variant: "light", size: "sm", color: "gray", children: activityTypeLabels[activity.activityType] }) }),
478
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: config.color, variant: "light", size: "sm", leftSection: /* @__PURE__ */ jsx(StatusIcon, { size: 14 }), children: activity.status }) }),
479
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: actor.color, variant: "light", size: "sm", leftSection: /* @__PURE__ */ jsx(ActorIcon, { size: 14 }), children: actor.label }) }),
480
+ /* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 200 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", lineClamp: 1, title: activity.entityName || activity.entityId, children: activity.entityName || activity.entityId }) }),
481
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: formatDistanceToNow(activity.occurredAt, { addSuffix: true }) }) })
482
+ ]
483
+ },
484
+ activity.id
485
+ );
486
+ }) })
487
+ ] });
488
+ }
489
+ var activityTypeOptions = [
490
+ { value: "all", label: "All Types" },
491
+ { value: "workflow_execution", label: "Workflow Executions" },
492
+ { value: "agent_run", label: "Agent Runs" },
493
+ { value: "hitl_action", label: "HITL Actions" },
494
+ { value: "webhook_received", label: "Webhook Received" },
495
+ { value: "webhook_executed", label: "Webhook Executed" },
496
+ { value: "webhook_failed", label: "Webhook Failed" },
497
+ { value: "credential_change", label: "Credential Changes" },
498
+ { value: "api_key_change", label: "API Key Changes" },
499
+ { value: "deployment_change", label: "Deployment Changes" },
500
+ { value: "membership_change", label: "Membership Changes" }
501
+ ];
502
+ var statusOptions = [
503
+ { value: "all", label: "All Statuses" },
504
+ { value: "success", label: "Success" },
505
+ { value: "failure", label: "Failure" },
506
+ { value: "pending", label: "Pending" },
507
+ { value: "approved", label: "Approved" },
508
+ { value: "rejected", label: "Rejected" },
509
+ { value: "completed", label: "Completed" }
510
+ ];
511
+ function ActivityFilters({ filters, onFilterChange, onReset }) {
512
+ return /* @__PURE__ */ jsxs(
513
+ FilterBar,
514
+ {
515
+ actions: /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", leftSection: /* @__PURE__ */ jsx(IconFilterOff, { size: 16 }), onClick: onReset, children: "Reset" }),
516
+ children: [
517
+ /* @__PURE__ */ jsx(
518
+ Select,
519
+ {
520
+ placeholder: "Activity Type",
521
+ data: activityTypeOptions,
522
+ value: filters.activityType || "all",
523
+ onChange: (value) => onFilterChange("activityType", value),
524
+ style: { flex: 1, minWidth: 200 }
525
+ }
526
+ ),
527
+ /* @__PURE__ */ jsx(
528
+ Select,
529
+ {
530
+ placeholder: "Status",
531
+ data: statusOptions,
532
+ value: filters.status || "all",
533
+ onChange: (value) => onFilterChange("status", value),
534
+ style: { flex: 1, minWidth: 150 }
535
+ }
536
+ ),
537
+ /* @__PURE__ */ jsx(
538
+ TextInput,
539
+ {
540
+ placeholder: "Search by name...",
541
+ leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 16 }),
542
+ value: filters.search || "",
543
+ onChange: (event) => onFilterChange("search", event.currentTarget.value),
544
+ style: { flex: 1, minWidth: 200 }
545
+ }
546
+ )
547
+ ]
548
+ }
549
+ );
550
+ }
551
+ var statusConfig2 = {
552
+ success: { color: "green", icon: IconCircleCheck },
553
+ failure: { color: "red", icon: IconCircleX },
554
+ pending: { color: "yellow", icon: IconClock },
555
+ approved: { color: "green", icon: IconThumbUp },
556
+ rejected: { color: "red", icon: IconThumbDown },
557
+ completed: { color: "blue", icon: IconCircleCheck }
558
+ };
559
+ function getActorDisplay2(actorType) {
560
+ switch (actorType) {
561
+ case "user":
562
+ return { label: "User", color: "blue", icon: IconUser };
563
+ case "api_key":
564
+ return { label: "API Key", color: "violet", icon: IconKey };
565
+ default:
566
+ return { label: "System", color: "gray", icon: IconRobot };
567
+ }
568
+ }
569
+ function getNavigationPath(activity) {
570
+ switch (activity.activityType) {
571
+ case "workflow_execution":
572
+ return `/operations/resources/workflow/${activity.entityId}`;
573
+ case "agent_run":
574
+ return `/operations/resources/agent/${activity.entityId}`;
575
+ case "hitl_action":
576
+ return "/command-queue";
577
+ case "credential_change":
578
+ return "/settings/credentials";
579
+ case "api_key_change":
580
+ return "/settings/api-keys";
581
+ case "deployment_change":
582
+ return "/settings/deployments";
583
+ case "membership_change":
584
+ return "/settings/organization";
585
+ default:
586
+ return null;
587
+ }
588
+ }
589
+ function ActivityCard({ activity }) {
590
+ const config = statusConfig2[activity.status];
591
+ const StatusIcon = config.icon;
592
+ const { navigate } = useRouterContext();
593
+ const navigationPath = getNavigationPath(activity);
594
+ const isClickable = navigationPath !== null;
595
+ const actor = getActorDisplay2(activity.actorType);
596
+ const ActorIcon = actor.icon;
597
+ const handleClick = () => {
598
+ if (navigationPath) {
599
+ navigate(navigationPath);
600
+ }
601
+ };
602
+ return /* @__PURE__ */ jsx(
603
+ Card,
604
+ {
605
+ withBorder: true,
606
+ style: {
607
+ cursor: isClickable ? "pointer" : "default",
608
+ transition: "box-shadow var(--duration-fast) var(--easing)"
609
+ },
610
+ onClick: handleClick,
611
+ children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
612
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", children: [
613
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", style: { flex: 1, minWidth: 0 }, children: [
614
+ /* @__PURE__ */ jsx(StatusIcon, { size: 16, color: `var(--mantine-color-${config.color}-6)` }),
615
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, style: { flex: 1, fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: activity.title })
616
+ ] }),
617
+ /* @__PURE__ */ jsx(Badge, { size: "sm", color: config.color, variant: "light", children: activity.status })
618
+ ] }),
619
+ activity.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: activity.description }),
620
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: "xs", children: [
621
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", truncate: true, style: { flex: 1 }, children: activity.entityName || activity.entityId }),
622
+ /* @__PURE__ */ jsx(Badge, { size: "xs", color: actor.color, variant: "dot", leftSection: /* @__PURE__ */ jsx(ActorIcon, { size: 10 }), children: actor.label }),
623
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { whiteSpace: "nowrap" }, children: formatDistanceToNow(activity.occurredAt, { addSuffix: true }) })
624
+ ] })
625
+ ] })
626
+ }
627
+ );
628
+ }
629
+ function ErrorAnalysisCard({ data, isLoading, error }) {
630
+ const topFailures = data?.topFailingResources.map((res) => ({
631
+ id: res.resourceId,
632
+ name: res.name,
633
+ errorCount: res.errorCount,
634
+ failureRate: res.failureRate
635
+ })) ?? [];
636
+ if (error) {
637
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load error analysis metrics" });
638
+ }
639
+ if (isLoading) {
640
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
641
+ }
642
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
643
+ /* @__PURE__ */ jsx(
644
+ CardHeader,
645
+ {
646
+ title: "Error Analysis",
647
+ rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
648
+ }
649
+ ),
650
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "sm", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Top Failing Resources" }),
651
+ /* @__PURE__ */ jsxs(Table, { children: [
652
+ /* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
653
+ /* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
654
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Errors" }),
655
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "% Failed" }),
656
+ /* @__PURE__ */ jsx(Table.Th, {})
657
+ ] }) }),
658
+ /* @__PURE__ */ jsx(Table.Tbody, { children: topFailures.map((resource) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
659
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
660
+ /* @__PURE__ */ jsx(IconAlertCircle, { size: 16, color: "var(--color-error)" }),
661
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: resource.name })
662
+ ] }) }),
663
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Badge, { color: "red", variant: "light", children: resource.errorCount }) }),
664
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: resource.failureRate > 10 ? "red" : "dimmed", children: [
665
+ resource.failureRate,
666
+ "%"
667
+ ] }) }),
668
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 }) }) })
669
+ ] }, resource.id)) })
670
+ ] })
671
+ ] });
672
+ }
673
+ function ExecutionBreakdownTable({ data, isLoading, error }) {
674
+ if (error) {
675
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load execution breakdown" });
676
+ }
677
+ if (isLoading) {
678
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
679
+ }
680
+ const totalExecutions = data?.totalExecutions ?? 0;
681
+ const statusCounts = data?.statusCounts ?? { success: 0, failed: 0, pending: 0, warning: 0 };
682
+ const p95Duration = data?.p95Duration ?? 0;
683
+ const statusRows = [
684
+ {
685
+ status: "Completed",
686
+ count: statusCounts.success,
687
+ percentage: totalExecutions > 0 ? statusCounts.success / totalExecutions * 100 : 0,
688
+ avgDuration: p95Duration * 0.85,
689
+ // Estimate avg duration from P95
690
+ color: "green"
691
+ },
692
+ {
693
+ status: "Warning",
694
+ count: statusCounts.warning,
695
+ percentage: totalExecutions > 0 ? statusCounts.warning / totalExecutions * 100 : 0,
696
+ avgDuration: p95Duration * 0.85,
697
+ // Warning executions completed, similar to success
698
+ color: "yellow"
699
+ },
700
+ {
701
+ status: "Failed",
702
+ count: statusCounts.failed,
703
+ percentage: totalExecutions > 0 ? statusCounts.failed / totalExecutions * 100 : 0,
704
+ avgDuration: p95Duration * 0.6,
705
+ // Failed executions typically shorter
706
+ color: "red"
707
+ },
708
+ {
709
+ status: "Running",
710
+ count: 0,
711
+ // No running count in current data structure
712
+ percentage: 0,
713
+ avgDuration: 0,
714
+ color: "blue"
715
+ },
716
+ {
717
+ status: "Pending",
718
+ count: statusCounts.pending,
719
+ percentage: totalExecutions > 0 ? statusCounts.pending / totalExecutions * 100 : 0,
720
+ avgDuration: 0,
721
+ // Pending has no duration
722
+ color: "gray"
723
+ }
724
+ ];
725
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
726
+ /* @__PURE__ */ jsx(CardHeader, { title: "Execution Status Breakdown" }),
727
+ /* @__PURE__ */ jsxs(Table, { children: [
728
+ /* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
729
+ /* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
730
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Count" }),
731
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Percentage" }),
732
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Avg Duration" })
733
+ ] }) }),
734
+ /* @__PURE__ */ jsx(Table.Tbody, { children: statusRows.map((row) => /* @__PURE__ */ jsxs(
735
+ Table.Tr,
736
+ {
737
+ style: { cursor: "pointer" },
738
+ onClick: () => {
739
+ console.log(`Filter to ${row.status} executions`);
740
+ },
741
+ children: [
742
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: row.color, variant: "light", children: row.status }) }),
743
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: row.count.toLocaleString() }) }),
744
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
745
+ row.percentage.toFixed(1),
746
+ "%"
747
+ ] }) }),
748
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: row.avgDuration > 0 ? `${(row.avgDuration / 1e3).toFixed(1)}s` : "-" }) })
749
+ ]
750
+ },
751
+ row.status
752
+ )) })
753
+ ] })
754
+ ] });
755
+ }
756
+ function ExecutionHealthCard({ data, isLoading, error }) {
757
+ const successRate = data?.successRate ?? 0;
758
+ const p95Duration = data?.p95Duration ?? 0;
759
+ const totalExecutions = data?.totalExecutions ?? 0;
760
+ const failedCount = data?.statusCounts.failed ?? 0;
761
+ const warningCount = data?.statusCounts.warning ?? 0;
762
+ const trendData = data?.trendData.map((d) => ({
763
+ hour: formatChartAxisDate(d.time),
764
+ errors: d.errorCount,
765
+ warnings: d.warningCount
766
+ })) ?? [];
767
+ const hasExecutions = totalExecutions > 0;
768
+ const statusColor = hasExecutions ? successRate >= 98 ? "green" : successRate >= 95 ? "yellow" : "red" : "gray";
769
+ const statusLabel = hasExecutions ? successRate >= 98 ? "Healthy" : successRate >= 95 ? "Warning" : "Critical" : "No Data";
770
+ if (error) {
771
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load execution health metrics" });
772
+ }
773
+ if (isLoading) {
774
+ return /* @__PURE__ */ jsx(StatsCardSkeleton, {});
775
+ }
776
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
777
+ /* @__PURE__ */ jsx(
778
+ CardHeader,
779
+ {
780
+ title: "Execution Health",
781
+ rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
785
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
786
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
787
+ /* @__PURE__ */ jsx(
788
+ Text,
789
+ {
790
+ size: "xl",
791
+ fw: 700,
792
+ c: "var(--color-error)",
793
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
794
+ children: failedCount
795
+ }
796
+ ),
797
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "failures" })
798
+ ] }),
799
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
800
+ /* @__PURE__ */ jsx(
801
+ Text,
802
+ {
803
+ size: "xl",
804
+ fw: 700,
805
+ c: warningCount > 0 ? "yellow" : "dimmed",
806
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
807
+ children: warningCount
808
+ }
809
+ ),
810
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "warnings" })
811
+ ] }),
812
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
813
+ /* @__PURE__ */ jsxs(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: [
814
+ (p95Duration / 1e3).toFixed(1),
815
+ "s"
816
+ ] }),
817
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "P95" })
818
+ ] })
819
+ ] }),
820
+ /* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: statusColor, children: statusLabel })
821
+ ] }),
822
+ /* @__PURE__ */ jsx(
823
+ CyberAreaChart,
824
+ {
825
+ data: trendData,
826
+ series: [
827
+ { dataKey: "warnings", color: "yellow", name: "Warnings" },
828
+ { dataKey: "errors", color: "red", name: "Errors" }
829
+ ],
830
+ xDataKey: "hour",
831
+ height: 200,
832
+ yDomain: [0, "auto"]
833
+ }
834
+ ),
835
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "sm", children: [
836
+ totalExecutions.toLocaleString(),
837
+ " total executions"
838
+ ] })
839
+ ] });
840
+ }
841
+ var resourceOptions = [{ value: "", label: "All Resources" }];
842
+ var statusOptions2 = [
843
+ { value: "all", label: "All" },
844
+ { value: "running", label: "Running" },
845
+ { value: "completed", label: "Completed" },
846
+ { value: "warning", label: "Warning" },
847
+ { value: "failed", label: "Failed" }
848
+ ];
849
+ var environmentOptions = [
850
+ { value: "all", label: "All" },
851
+ { value: "dev", label: "Dev" },
852
+ { value: "prod", label: "Prod" }
853
+ ];
854
+ function ExecutionLogsFilters({ filters, onFilterChange, onReset }) {
855
+ const hasActiveFilters = filters.resourceId !== void 0 || filters.status !== "all" || filters.resourceStatus !== "all";
856
+ return /* @__PURE__ */ jsx(Paper, { radius: "sm", children: /* @__PURE__ */ jsxs(Group, { gap: "md", wrap: "wrap", children: [
857
+ /* @__PURE__ */ jsx(
858
+ Select,
859
+ {
860
+ placeholder: "Resource",
861
+ data: resourceOptions,
862
+ value: filters.resourceId ?? "",
863
+ onChange: (value) => onFilterChange("resourceId", value === "" || value === null ? void 0 : value),
864
+ style: { minWidth: 180 }
865
+ }
866
+ ),
867
+ /* @__PURE__ */ jsx(
868
+ SegmentedControl,
869
+ {
870
+ data: statusOptions2,
871
+ value: filters.status,
872
+ onChange: (value) => onFilterChange("status", value)
873
+ }
874
+ ),
875
+ /* @__PURE__ */ jsx(
876
+ SegmentedControl,
877
+ {
878
+ data: environmentOptions,
879
+ value: filters.resourceStatus,
880
+ onChange: (value) => onFilterChange("resourceStatus", value)
881
+ }
882
+ ),
883
+ hasActiveFilters && /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", leftSection: /* @__PURE__ */ jsx(IconFilterOff, { size: 16 }), onClick: onReset, children: "Reset" })
884
+ ] }) });
885
+ }
886
+ function CostByModelTable({ data, isLoading, error }) {
887
+ const [sortField, setSortField] = useState("cost");
888
+ const [sortDirection, setSortDirection] = useState("desc");
889
+ const totalCost = data?.totalCostUsd ?? 0;
890
+ const tableData = data?.models.map((m) => ({
891
+ model: m.model,
892
+ cost: m.totalCostUsd,
893
+ percentage: totalCost > 0 ? m.totalCostUsd / totalCost * 100 : 0,
894
+ calls: m.callCount,
895
+ avgCost: m.avgCostPerCall,
896
+ inputTokens: m.totalInputTokens,
897
+ outputTokens: m.totalOutputTokens
898
+ })) ?? [];
899
+ const sortedData = [...tableData].sort((a, b) => {
900
+ const aValue = a[sortField];
901
+ const bValue = b[sortField];
902
+ if (typeof aValue === "string" && typeof bValue === "string") {
903
+ return sortDirection === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
904
+ }
905
+ return sortDirection === "asc" ? aValue - bValue : bValue - aValue;
906
+ });
907
+ const highestCost = Math.max(...tableData.map((d) => d.cost), 0);
908
+ const handleSort = (field) => {
909
+ if (sortField === field) {
910
+ setSortDirection(sortDirection === "asc" ? "desc" : "asc");
911
+ } else {
912
+ setSortField(field);
913
+ setSortDirection("desc");
914
+ }
915
+ };
916
+ const handleExport = () => {
917
+ if (!data) return;
918
+ const csvContent = [
919
+ ["Model", "Cost ($)", "Percentage (%)", "Calls", "Avg Cost/Call ($)", "Input Tokens", "Output Tokens"],
920
+ ...sortedData.map((d) => [
921
+ d.model,
922
+ d.cost.toFixed(4),
923
+ d.percentage.toFixed(2),
924
+ d.calls,
925
+ d.avgCost.toFixed(6),
926
+ d.inputTokens,
927
+ d.outputTokens
928
+ ]),
929
+ ["Total", totalCost.toFixed(4), "100.00", data.totalCallCount, "", "", ""]
930
+ ].map((row) => row.join(",")).join("\n");
931
+ const blob = new Blob([csvContent], { type: "text/csv" });
932
+ const url = URL.createObjectURL(blob);
933
+ const link = document.createElement("a");
934
+ link.href = url;
935
+ link.download = `cost-by-model-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
936
+ link.click();
937
+ URL.revokeObjectURL(url);
938
+ };
939
+ const SortIcon = ({ field }) => {
940
+ if (sortField !== field) return null;
941
+ return sortDirection === "asc" ? /* @__PURE__ */ jsx(IconArrowUp, { size: 14 }) : /* @__PURE__ */ jsx(IconArrowDown, { size: 14 });
942
+ };
943
+ const formatModelName = (model) => {
944
+ const parts = model.split("/");
945
+ const modelName = parts.length > 1 ? parts[1] : model;
946
+ return modelName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
947
+ };
948
+ if (error) {
949
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load cost by model" });
950
+ }
951
+ if (isLoading) {
952
+ return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
953
+ }
954
+ return /* @__PURE__ */ jsxs(Paper, { children: [
955
+ /* @__PURE__ */ jsx(
956
+ CardHeader,
957
+ {
958
+ title: "Cost by Model",
959
+ rightSection: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "xs", leftSection: /* @__PURE__ */ jsx(IconDownload, { size: 14 }), onClick: handleExport, children: "Export CSV" })
960
+ }
961
+ ),
962
+ /* @__PURE__ */ jsxs(Table, { children: [
963
+ /* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
964
+ /* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("model"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
965
+ "Model",
966
+ /* @__PURE__ */ jsx(SortIcon, { field: "model" })
967
+ ] }) }),
968
+ /* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("cost"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
969
+ "Cost",
970
+ /* @__PURE__ */ jsx(SortIcon, { field: "cost" })
971
+ ] }) }),
972
+ /* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("percentage"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
973
+ "Percentage",
974
+ /* @__PURE__ */ jsx(SortIcon, { field: "percentage" })
975
+ ] }) }),
976
+ /* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("calls"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
977
+ "Calls",
978
+ /* @__PURE__ */ jsx(SortIcon, { field: "calls" })
979
+ ] }) }),
980
+ /* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("avgCost"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
981
+ "Avg Cost/Call",
982
+ /* @__PURE__ */ jsx(SortIcon, { field: "avgCost" })
983
+ ] }) })
984
+ ] }) }),
985
+ /* @__PURE__ */ jsxs(Table.Tbody, { children: [
986
+ sortedData.map((row) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
987
+ /* @__PURE__ */ jsxs(Table.Td, { children: [
988
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: row.cost === highestCost ? 600 : 400, children: formatModelName(row.model) }),
989
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: row.model })
990
+ ] }),
991
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", fw: row.cost === highestCost ? 600 : 400, children: [
992
+ "$",
993
+ row.cost.toFixed(4)
994
+ ] }) }),
995
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Badge, { color: row.percentage > 30 ? "red" : row.percentage > 15 ? "yellow" : "gray", children: [
996
+ row.percentage.toFixed(1),
997
+ "%"
998
+ ] }) }),
999
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: row.calls.toLocaleString() }) }),
1000
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
1001
+ "$",
1002
+ row.avgCost.toFixed(6)
1003
+ ] }) })
1004
+ ] }, row.model)),
1005
+ tableData.length > 0 && /* @__PURE__ */ jsxs(Table.Tr, { children: [
1006
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 700, children: "Total" }) }),
1007
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", fw: 700, children: [
1008
+ "$",
1009
+ totalCost.toFixed(4)
1010
+ ] }) }),
1011
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { children: "100.0%" }) }),
1012
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 700, children: (data?.totalCallCount ?? 0).toLocaleString() }) }),
1013
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "-" }) })
1014
+ ] })
1015
+ ] })
1016
+ ] }),
1017
+ tableData.length === 0 && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "xl", children: "No cost data available for this time period" })
1018
+ ] });
1019
+ }
1020
+ function BusinessImpactCard({
1021
+ impactData,
1022
+ summaryData,
1023
+ trendsData,
1024
+ data,
1025
+ isLoading,
1026
+ error,
1027
+ laborRate = 75
1028
+ }) {
1029
+ const businessData = impactData ?? data;
1030
+ const laborCostSavings = businessData?.totalSavingsUsd ?? 0;
1031
+ const platformCost = businessData?.totalCostUsd ?? 0;
1032
+ const netSavings = businessData?.netSavingsUsd ?? 0;
1033
+ const roi = businessData?.roi ?? 0;
1034
+ const hoursSaved = Math.round(laborCostSavings / laborRate);
1035
+ const previousCost = summaryData?.previous.totalCostUsd ?? platformCost;
1036
+ const previousSavings = laborCostSavings * (previousCost > 0 ? (summaryData?.previous.totalCostUsd ?? platformCost) / platformCost : 0.8);
1037
+ const previousHoursSaved = Math.round(previousSavings / laborRate);
1038
+ const totalTrendCost = trendsData?.totalCostUsd ?? 0;
1039
+ const trendData = (trendsData?.trendData ?? []).map((point) => {
1040
+ const date = new Date(point.time);
1041
+ const timeLabel = trendsData?.granularity === "hour" ? date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
1042
+ const proportion = totalTrendCost > 0 ? point.totalCostUsd / totalTrendCost : 1 / (trendsData?.trendData.length ?? 1);
1043
+ return {
1044
+ time: timeLabel,
1045
+ savings: laborCostSavings * proportion
1046
+ };
1047
+ });
1048
+ if (error) {
1049
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load business impact metrics" });
1050
+ }
1051
+ if (isLoading) {
1052
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
1053
+ }
1054
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
1055
+ /* @__PURE__ */ jsx(
1056
+ CardHeader,
1057
+ {
1058
+ title: "Business Impact",
1059
+ rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
1060
+ }
1061
+ ),
1062
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
1063
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
1064
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1065
+ /* @__PURE__ */ jsx(
1066
+ Text,
1067
+ {
1068
+ size: "xl",
1069
+ fw: 700,
1070
+ c: "var(--color-primary)",
1071
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
1072
+ children: hoursSaved
1073
+ }
1074
+ ),
1075
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "hrs saved" }),
1076
+ /* @__PURE__ */ jsx(TrendIndicator, { current: hoursSaved, previous: previousHoursSaved })
1077
+ ] }),
1078
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1079
+ /* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: laborCostSavings, thousandSeparator: true }) }),
1080
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "labor saved" })
1081
+ ] })
1082
+ ] }),
1083
+ /* @__PURE__ */ jsx(
1084
+ Badge,
1085
+ {
1086
+ size: "lg",
1087
+ variant: roi > 0 ? "dot" : "light",
1088
+ color: roi > 1e3 ? "green" : roi > 500 ? "yellow" : "gray",
1089
+ children: roi > 0 ? `${roi.toFixed(0)}x ROI` : "N/A"
1090
+ }
1091
+ )
1092
+ ] }),
1093
+ /* @__PURE__ */ jsx(
1094
+ CyberAreaChart,
1095
+ {
1096
+ data: trendData,
1097
+ series: [{ dataKey: "savings", color: "blue", name: "Savings" }],
1098
+ xDataKey: "time",
1099
+ height: 200,
1100
+ yTickFormatter: (v) => `$${v.toFixed(2)}`
1101
+ }
1102
+ ),
1103
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
1104
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1105
+ "Platform cost: ",
1106
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: platformCost, decimalScale: 2 })
1107
+ ] }),
1108
+ /* @__PURE__ */ jsxs(Text, { size: "xs", fw: 500, c: netSavings < 0 ? "var(--color-error)" : "var(--color-primary)", children: [
1109
+ "Net savings: ",
1110
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: netSavings, thousandSeparator: true, decimalScale: 2 })
1111
+ ] })
1112
+ ] })
1113
+ ] });
1114
+ }
1115
+ function CostBreakdownCard({
1116
+ breakdownData,
1117
+ summaryData,
1118
+ data,
1119
+ isLoading,
1120
+ error,
1121
+ budget = 1500
1122
+ }) {
1123
+ const resourceData = breakdownData ?? data;
1124
+ const legacyTotalCost = resourceData?.resources.reduce((sum, r) => sum + r.totalCostUsd, 0) ?? 0;
1125
+ const mtdCost = summaryData?.mtd.totalCostUsd ?? legacyTotalCost * 2;
1126
+ const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? mtdCost * 1.05;
1127
+ const workflowCosts = resourceData?.resources.slice(0, 4).map((r) => ({
1128
+ name: r.resourceId,
1129
+ cost: r.totalCostUsd,
1130
+ executions: r.executionCount,
1131
+ avgCost: r.avgCostUsd
1132
+ })) ?? [];
1133
+ if (error) {
1134
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load cost breakdown" });
1135
+ }
1136
+ if (isLoading) {
1137
+ return /* @__PURE__ */ jsx(DetailCardSkeleton, { rows: 3 });
1138
+ }
1139
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
1140
+ /* @__PURE__ */ jsx(
1141
+ CardHeader,
1142
+ {
1143
+ title: "AI Costs Breakdown",
1144
+ rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
1145
+ }
1146
+ ),
1147
+ /* @__PURE__ */ jsxs(Stack, { gap: "xs", mb: "md", children: [
1148
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Top Spenders" }),
1149
+ workflowCosts.length > 0 ? workflowCosts.map((workflow) => /* @__PURE__ */ jsx(
1150
+ Box,
1151
+ {
1152
+ p: "sm",
1153
+ style: {
1154
+ borderLeft: "3px solid var(--color-primary)",
1155
+ backgroundColor: "var(--color-surface)",
1156
+ borderRadius: 4
1157
+ },
1158
+ children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", children: [
1159
+ /* @__PURE__ */ jsxs(Stack, { gap: 0, style: { flex: 1 }, children: [
1160
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: workflow.name }),
1161
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1162
+ workflow.executions,
1163
+ " executions - $",
1164
+ workflow.avgCost.toFixed(4),
1165
+ "/exec"
1166
+ ] })
1167
+ ] }),
1168
+ /* @__PURE__ */ jsx(
1169
+ Text,
1170
+ {
1171
+ size: "sm",
1172
+ fw: 600,
1173
+ c: "var(--color-primary)",
1174
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
1175
+ children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: workflow.cost, decimalScale: 4 })
1176
+ }
1177
+ )
1178
+ ] })
1179
+ },
1180
+ workflow.name
1181
+ )) : /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "md", children: "No resource data available" })
1182
+ ] }),
1183
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
1184
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1185
+ "Projected: ",
1186
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
1187
+ ] }),
1188
+ /* @__PURE__ */ jsxs(
1189
+ Text,
1190
+ {
1191
+ size: "xs",
1192
+ fw: 600,
1193
+ c: projectedMonthlyCost > budget ? "red" : "dimmed",
1194
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
1195
+ children: [
1196
+ "Budget: ",
1197
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
1198
+ ]
1199
+ }
1200
+ )
1201
+ ] })
1202
+ ] });
1203
+ }
1204
+ function CostMetricsCard({
1205
+ summaryData,
1206
+ trendsData,
1207
+ data,
1208
+ isLoading,
1209
+ error,
1210
+ budget = 1500
1211
+ }) {
1212
+ const legacyTotalCost = data?.resources.reduce((sum, r) => sum + r.totalCostUsd, 0) ?? 0;
1213
+ const todayCost = summaryData?.current.totalCostUsd ?? legacyTotalCost;
1214
+ const previousCost = summaryData?.previous.totalCostUsd ?? legacyTotalCost * 0.9;
1215
+ const mtdCost = summaryData?.mtd.totalCostUsd ?? legacyTotalCost * 2;
1216
+ const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? mtdCost * 1.05;
1217
+ const confidence = summaryData?.projection.confidence ?? "low";
1218
+ const budgetStatus = projectedMonthlyCost <= budget ? "green" : projectedMonthlyCost <= budget * 1.1 ? "yellow" : "red";
1219
+ const budgetLabel = projectedMonthlyCost <= budget ? "On Budget" : projectedMonthlyCost <= budget * 1.1 ? "Warning" : "Over Budget";
1220
+ const chartData = trendsData?.trendData.slice(-7).map((point, idx) => {
1221
+ const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
1222
+ return {
1223
+ day: trendsData.granularity === "day" ? new Date(point.time).toLocaleDateString("en-US", { weekday: "short" }) : days[idx % 7],
1224
+ cost: point.totalCostUsd
1225
+ };
1226
+ }) ?? data?.resources.slice(0, 7).map((r, idx) => ({
1227
+ day: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][idx] || `Day ${idx + 1}`,
1228
+ cost: r.totalCostUsd
1229
+ })) ?? [];
1230
+ if (error) {
1231
+ return /* @__PURE__ */ jsx(APIErrorAlert, { error, title: "Failed to load cost metrics" });
1232
+ }
1233
+ if (isLoading) {
1234
+ return /* @__PURE__ */ jsx(StatsCardSkeleton, {});
1235
+ }
1236
+ return /* @__PURE__ */ jsxs(Card, { withBorder: true, children: [
1237
+ /* @__PURE__ */ jsx(
1238
+ CardHeader,
1239
+ {
1240
+ title: "AI Costs",
1241
+ rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
1242
+ }
1243
+ ),
1244
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
1245
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
1246
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1247
+ /* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: todayCost, decimalScale: 2 }) }),
1248
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "period" }),
1249
+ /* @__PURE__ */ jsx(TrendIndicator, { current: todayCost, previous: previousCost, inverse: true })
1250
+ ] }),
1251
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1252
+ /* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: mtdCost, thousandSeparator: true, decimalScale: 2 }) }),
1253
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "MTD" })
1254
+ ] })
1255
+ ] }),
1256
+ /* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: budgetStatus, children: budgetLabel })
1257
+ ] }),
1258
+ chartData.length > 0 ? /* @__PURE__ */ jsx(
1259
+ CyberAreaChart,
1260
+ {
1261
+ data: chartData,
1262
+ series: [{ dataKey: "cost", color: "blue", name: "Cost" }],
1263
+ xDataKey: "day",
1264
+ height: 120,
1265
+ yTickFormatter: (v) => `$${v.toFixed(2)}`
1266
+ }
1267
+ ) : /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "lg", children: "No trend data available" }),
1268
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
1269
+ /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
1270
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1271
+ "Projected monthly:",
1272
+ " ",
1273
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
1274
+ ] }),
1275
+ /* @__PURE__ */ jsx(Tooltip, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
1276
+ ] }),
1277
+ /* @__PURE__ */ jsxs(
1278
+ Text,
1279
+ {
1280
+ size: "xs",
1281
+ fw: 600,
1282
+ c: projectedMonthlyCost > budget ? "red" : "dimmed",
1283
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
1284
+ children: [
1285
+ "Budget: ",
1286
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
1287
+ ]
1288
+ }
1289
+ )
1290
+ ] })
1291
+ ] });
1292
+ }
1293
+ function ErrorBreakdownTable({ startDate, endDate, onErrorClick }) {
1294
+ const [searchQuery, setSearchQuery] = useState("");
1295
+ const [filterType, setFilterType] = useState("all");
1296
+ const [filterSeverity, setFilterSeverity] = useState();
1297
+ const [showResolved, setShowResolved] = useState(false);
1298
+ const resolveError = useResolveError();
1299
+ const resolveAll = useResolveAllErrors();
1300
+ const { page, setPage, totalPages } = usePaginationState(PAGE_SIZE_DEFAULT, [
1301
+ filterType,
1302
+ filterSeverity,
1303
+ searchQuery,
1304
+ showResolved,
1305
+ startDate,
1306
+ endDate
1307
+ ]);
1308
+ const { data, isLoading, isError, error } = useErrorDetails({
1309
+ errorType: filterType === "all" ? void 0 : filterType,
1310
+ severity: filterSeverity,
1311
+ search: searchQuery || void 0,
1312
+ startDate,
1313
+ endDate,
1314
+ page,
1315
+ limit: PAGE_SIZE_DEFAULT,
1316
+ resolved: showResolved ? void 0 : false
1317
+ });
1318
+ if (isLoading) {
1319
+ return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Stack, { align: "center", justify: "center", mih: 200, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
1320
+ }
1321
+ if (isError) {
1322
+ return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconAlertCircle, {}), title: "Error Loading Data", children: error?.message || "Failed to load error details. Please try again." }) });
1323
+ }
1324
+ if (!data || data.errors.length === 0) {
1325
+ return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
1326
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1327
+ /* @__PURE__ */ jsxs("div", { children: [
1328
+ /* @__PURE__ */ jsx(Title, { order: 3, children: "Recent Errors" }),
1329
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "0 errors found" })
1330
+ ] }),
1331
+ /* @__PURE__ */ jsx(
1332
+ Switch,
1333
+ {
1334
+ label: "Show resolved",
1335
+ checked: showResolved,
1336
+ onChange: (e) => setShowResolved(e.currentTarget.checked),
1337
+ size: "sm"
1338
+ }
1339
+ )
1340
+ ] }),
1341
+ /* @__PURE__ */ jsx(
1342
+ EmptyState,
1343
+ {
1344
+ icon: IconBug,
1345
+ title: "No errors found",
1346
+ description: showResolved ? "No errors found for the selected time range" : "All errors have been resolved"
1347
+ }
1348
+ )
1349
+ ] }) });
1350
+ }
1351
+ const filteredErrors = data.errors;
1352
+ const errorTypes = Array.from(new Set(data.errors.map((e) => e.errorType)));
1353
+ const total = data.total;
1354
+ const getSeverityIcon = (severity) => {
1355
+ switch (severity) {
1356
+ case "critical":
1357
+ return /* @__PURE__ */ jsx(IconAlertCircle, { size: 16, color: "var(--color-error)" });
1358
+ case "warning":
1359
+ return /* @__PURE__ */ jsx(IconAlertTriangle, { size: 16, color: "var(--mantine-color-orange-6)" });
1360
+ default:
1361
+ return /* @__PURE__ */ jsx(IconBug, { size: 16, color: "var(--color-primary)" });
1362
+ }
1363
+ };
1364
+ const getSeverityColor = (severity) => {
1365
+ switch (severity) {
1366
+ case "critical":
1367
+ return "red";
1368
+ case "warning":
1369
+ return "orange";
1370
+ default:
1371
+ return "blue";
1372
+ }
1373
+ };
1374
+ return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
1375
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1376
+ /* @__PURE__ */ jsxs("div", { children: [
1377
+ /* @__PURE__ */ jsx(Title, { order: 3, children: "Recent Errors" }),
1378
+ /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
1379
+ filteredErrors.length,
1380
+ " error",
1381
+ filteredErrors.length !== 1 ? "s" : "",
1382
+ " found"
1383
+ ] })
1384
+ ] }),
1385
+ /* @__PURE__ */ jsxs(Group, { children: [
1386
+ /* @__PURE__ */ jsx(
1387
+ Switch,
1388
+ {
1389
+ label: "Show resolved",
1390
+ checked: showResolved,
1391
+ onChange: (e) => setShowResolved(e.currentTarget.checked),
1392
+ size: "sm"
1393
+ }
1394
+ ),
1395
+ !showResolved && filteredErrors.some((e) => !e.resolved) && /* @__PURE__ */ jsx(
1396
+ Button,
1397
+ {
1398
+ leftSection: /* @__PURE__ */ jsx(IconChecks, { size: 16 }),
1399
+ variant: "light",
1400
+ loading: resolveAll.isPending,
1401
+ onClick: () => resolveAll.mutate(),
1402
+ children: "Resolve All"
1403
+ }
1404
+ )
1405
+ ] })
1406
+ ] }),
1407
+ /* @__PURE__ */ jsxs(FilterBar, { children: [
1408
+ /* @__PURE__ */ jsx(
1409
+ TextInput,
1410
+ {
1411
+ placeholder: "Search errors...",
1412
+ leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 16 }),
1413
+ value: searchQuery,
1414
+ onChange: (e) => {
1415
+ setSearchQuery(e.currentTarget.value);
1416
+ },
1417
+ style: { flex: 1 }
1418
+ }
1419
+ ),
1420
+ /* @__PURE__ */ jsx(
1421
+ Select,
1422
+ {
1423
+ placeholder: "Filter by type",
1424
+ value: filterType,
1425
+ onChange: (value) => {
1426
+ setFilterType(value || "all");
1427
+ },
1428
+ data: [{ value: "all", label: "All Types" }, ...errorTypes.map((type) => ({ value: type, label: type }))],
1429
+ style: { width: 200 },
1430
+ clearable: true
1431
+ }
1432
+ ),
1433
+ /* @__PURE__ */ jsx(
1434
+ Select,
1435
+ {
1436
+ placeholder: "Filter by severity",
1437
+ value: filterSeverity,
1438
+ onChange: (value) => {
1439
+ setFilterSeverity(value);
1440
+ },
1441
+ data: [
1442
+ { value: "critical", label: "Critical" },
1443
+ { value: "warning", label: "Warning" },
1444
+ { value: "info", label: "Info" }
1445
+ ],
1446
+ style: { width: 200 },
1447
+ clearable: true
1448
+ }
1449
+ )
1450
+ ] }),
1451
+ /* @__PURE__ */ jsxs(Table, { children: [
1452
+ /* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
1453
+ /* @__PURE__ */ jsx(Table.Th, { children: "Timestamp" }),
1454
+ /* @__PURE__ */ jsx(Table.Th, { children: "Type" }),
1455
+ /* @__PURE__ */ jsx(Table.Th, { children: "Message" }),
1456
+ /* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
1457
+ /* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Severity" }),
1458
+ /* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Actions" })
1459
+ ] }) }),
1460
+ /* @__PURE__ */ jsx(Table.Tbody, { children: filteredErrors.map((error2) => /* @__PURE__ */ jsxs(Table.Tr, { style: { cursor: "pointer" }, onClick: () => onErrorClick?.(error2.executionId), children: [
1461
+ /* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: new Date(error2.timestamp).toLocaleString("en-US", {
1462
+ month: "short",
1463
+ day: "numeric",
1464
+ hour: "2-digit",
1465
+ minute: "2-digit"
1466
+ }) }) }),
1467
+ /* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Badge, { variant: "light", size: "sm", children: error2.errorType }) }),
1468
+ /* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 300 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, children: error2.message }) }),
1469
+ /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: error2.resourceName }) }),
1470
+ /* @__PURE__ */ jsx(Table.Td, { ta: "center", style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(
1471
+ Badge,
1472
+ {
1473
+ color: getSeverityColor(error2.severity),
1474
+ variant: "light",
1475
+ size: "sm",
1476
+ leftSection: getSeverityIcon(error2.severity),
1477
+ children: error2.severity.toUpperCase()
1478
+ }
1479
+ ) }),
1480
+ /* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Group, { gap: 4, justify: "flex-end", wrap: "nowrap", children: [
1481
+ error2.resolved ? /* @__PURE__ */ jsx(Badge, { color: "green", variant: "light", size: "sm", style: { cursor: "default" }, children: "Resolved" }) : /* @__PURE__ */ jsx(
1482
+ Badge,
1483
+ {
1484
+ color: "gray",
1485
+ variant: "light",
1486
+ size: "sm",
1487
+ style: {
1488
+ cursor: resolveError.isPending && resolveError.variables === error2.id ? "wait" : "pointer",
1489
+ opacity: resolveError.isPending && resolveError.variables === error2.id ? 0.5 : 1
1490
+ },
1491
+ onClick: (e) => {
1492
+ e.stopPropagation();
1493
+ resolveError.mutate(error2.id);
1494
+ },
1495
+ children: "Resolve"
1496
+ }
1497
+ ),
1498
+ /* @__PURE__ */ jsx(
1499
+ ActionIcon,
1500
+ {
1501
+ variant: "subtle",
1502
+ size: "sm",
1503
+ onClick: (e) => {
1504
+ e.stopPropagation();
1505
+ onErrorClick?.(error2.executionId);
1506
+ },
1507
+ children: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 })
1508
+ }
1509
+ )
1510
+ ] }) })
1511
+ ] }, error2.id)) })
1512
+ ] }),
1513
+ totalPages(total) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(Pagination, { total: totalPages(total), value: page, onChange: setPage, size: "sm", boundaries: 1 }) })
1514
+ ] }) });
1515
+ }
411
1516
  var categoryColors = {
412
1517
  info: "blue",
413
1518
  queue: "cyan",
@@ -455,18 +1560,18 @@ function NotificationItem({ notification, onClose, onNavigate }) {
455
1560
  }
456
1561
  );
457
1562
  }
458
- function NotificationList({ notifications: notifications2, isLoading, onClose, onNavigate }) {
1563
+ function NotificationList({ notifications, isLoading, onClose, onNavigate }) {
459
1564
  if (isLoading) {
460
1565
  return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) });
461
1566
  }
462
- if (notifications2.length === 0) {
1567
+ if (notifications.length === 0) {
463
1568
  return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No notifications" }) });
464
1569
  }
465
- return /* @__PURE__ */ jsx(Stack, { gap: 0, children: notifications2.map((notification) => /* @__PURE__ */ jsx(NotificationItem, { notification, onClose, onNavigate }, notification.id)) });
1570
+ return /* @__PURE__ */ jsx(Stack, { gap: 0, children: notifications.map((notification) => /* @__PURE__ */ jsx(NotificationItem, { notification, onClose, onNavigate }, notification.id)) });
466
1571
  }
467
- function NotificationPanel({ notifications: notifications2, isLoading, onClose, onNavigate }) {
1572
+ function NotificationPanel({ notifications, isLoading, onClose, onNavigate }) {
468
1573
  const markAllAsRead = useMarkAllAsRead();
469
- const hasUnread = notifications2.some((n) => !n.read);
1574
+ const hasUnread = notifications.some((n) => !n.read);
470
1575
  const handleMarkAllAsRead = async () => {
471
1576
  await markAllAsRead.mutateAsync();
472
1577
  };
@@ -479,7 +1584,7 @@ function NotificationPanel({ notifications: notifications2, isLoading, onClose,
479
1584
  /* @__PURE__ */ jsx(ScrollArea, { h: 400, type: "auto", children: /* @__PURE__ */ jsx(
480
1585
  NotificationList,
481
1586
  {
482
- notifications: notifications2,
1587
+ notifications,
483
1588
  isLoading,
484
1589
  onClose,
485
1590
  onNavigate
@@ -491,14 +1596,14 @@ function NotificationBell({ unreadCount, onNavigate }) {
491
1596
  const [opened, { toggle, close }] = useDisclosure(false);
492
1597
  const { data: apiCount = 0 } = useNotificationCount();
493
1598
  const { data, isLoading } = useNotifications({ limit: 20 });
494
- const notifications2 = data?.notifications ?? [];
1599
+ const notifications = data?.notifications ?? [];
495
1600
  const count = unreadCount ?? apiCount;
496
1601
  return /* @__PURE__ */ jsxs(Popover, { opened, onChange: toggle, position: "bottom-end", width: 400, children: [
497
1602
  /* @__PURE__ */ jsx(Tooltip, { label: "Notifications", disabled: opened, children: /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(Indicator, { label: count > 99 ? "99+" : count, disabled: count === 0, size: 16, offset: 4, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "lg", onClick: toggle, children: /* @__PURE__ */ jsx(IconBell, { size: 20, color: "var(--color-text-subtle)" }) }) }) }) }),
498
1603
  /* @__PURE__ */ jsx(Popover.Dropdown, { p: 0, children: /* @__PURE__ */ jsx(
499
1604
  NotificationPanel,
500
1605
  {
501
- notifications: notifications2,
1606
+ notifications,
502
1607
  isLoading,
503
1608
  onClose: close,
504
1609
  onNavigate
@@ -1710,8 +2815,8 @@ var iconMap = {
1710
2815
  IconEye,
1711
2816
  IconRocket,
1712
2817
  IconMessageCircle,
1713
- IconArrowUp,
1714
- IconClock,
2818
+ IconArrowUp: IconArrowUp,
2819
+ IconClock: IconClock,
1715
2820
  IconFileText,
1716
2821
  IconSend,
1717
2822
  IconMail
@@ -2685,54 +3790,5 @@ function ResourceDefinitionSection({
2685
3790
  }
2686
3791
  return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Unknown resource type" }) });
2687
3792
  }
2688
- var showInfoNotification = (message) => {
2689
- notifications.show({
2690
- title: "Info",
2691
- message,
2692
- autoClose: 5e3,
2693
- color: "blue",
2694
- position: "top-right"
2695
- });
2696
- };
2697
- var showSuccessNotification = (message) => {
2698
- notifications.show({
2699
- title: "Action Successful",
2700
- message,
2701
- autoClose: 5e3,
2702
- color: "green",
2703
- position: "top-right"
2704
- });
2705
- };
2706
- var showErrorNotification = (error) => {
2707
- if (error instanceof Error) {
2708
- error = error.message;
2709
- }
2710
- notifications.show({
2711
- title: "Action Failed",
2712
- message: error,
2713
- autoClose: 5e3,
2714
- color: "red",
2715
- position: "top-right"
2716
- });
2717
- };
2718
- var showWarningNotification = (message) => {
2719
- notifications.show({
2720
- title: "Warning",
2721
- message,
2722
- autoClose: 5e3,
2723
- color: "orange",
2724
- position: "top-right"
2725
- });
2726
- };
2727
- var showApiErrorNotification = (error) => {
2728
- const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
2729
- notifications.show({
2730
- title: getErrorTitle(code),
2731
- message: formatErrorMessage(message, requestId, fields, retryAfter),
2732
- autoClose: retryAfter ? retryAfter * 1e3 : 5e3,
2733
- color: "red",
2734
- position: "top-right"
2735
- });
2736
- };
2737
3793
 
2738
- export { ActionModal, AgentDefinitionDisplay, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, CollapsibleJsonSection, ConfigCard, ConfirmationInputModal, ConfirmationModal, ContentSections, ContractDisplay, CustomModal, EmptyVisualizer, ExecutionLogsTable, ExecutionStats, ExecutionStatusBadge, FilterBar, FormFieldRenderer, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, NotificationBell, NotificationItem, NotificationList, NotificationPanel, ResourceDefinitionSection, ResourceHealthChart, ResourceHealthPanel, SortableHeader, TableSelectionToolbar, TaskCard, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, ToolsListDisplay, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WorkflowDefinitionDisplay, WorkflowExecutionTimeline, getGraphBackgroundStyles, getHealthColor, getIcon, iconMap, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, useGraphBackgroundStyles, useGraphTheme, useNewKnowledgeMapLayout };
3794
+ export { ActionModal, ActivityCard, ActivityFilters as ActivityFiltersBar, ActivityTable, AgentDefinitionDisplay, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, BusinessImpactCard, CollapsibleJsonSection, ConfigCard, ConfirmationInputModal, ConfirmationModal, ContentSections, ContractDisplay, CostBreakdownCard, CostByModelTable, CostMetricsCard, CustomModal, EmptyVisualizer, ErrorAnalysisCard, ErrorBreakdownTable, ExecutionBreakdownTable, ExecutionHealthCard, ExecutionLogsFilters as ExecutionLogsFilterBar, ExecutionLogsTable, ExecutionStats, ExecutionStatusBadge, FilterBar, FormFieldRenderer, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, NotificationBell, NotificationItem, NotificationList, NotificationPanel, ResourceDefinitionSection, ResourceHealthChart, ResourceHealthPanel, SortableHeader, TableSelectionToolbar, TaskCard, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, ToolsListDisplay, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WorkflowDefinitionDisplay, WorkflowExecutionTimeline, getGraphBackgroundStyles, getHealthColor, getIcon, iconMap, useGraphBackgroundStyles, useGraphTheme, useNewKnowledgeMapLayout };