@elevasis/ui 1.0.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 (97) hide show
  1. package/dist/api/index.d.ts +87 -0
  2. package/dist/api/index.js +3 -0
  3. package/dist/auth/context.d.ts +19 -0
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.d.ts +85 -0
  6. package/dist/auth/index.js +3 -0
  7. package/dist/chunk-3KMDHCAR.js +52 -0
  8. package/dist/chunk-5UWFGBFM.js +129 -0
  9. package/dist/chunk-6BJOYF6E.js +8 -0
  10. package/dist/chunk-6M6OLGQY.js +36 -0
  11. package/dist/chunk-7AI5ZYJ4.js +202 -0
  12. package/dist/chunk-7PLEQFHO.js +18 -0
  13. package/dist/chunk-GDV44UWF.js +138 -0
  14. package/dist/chunk-GEFB5YIR.js +338 -0
  15. package/dist/chunk-HBRMWW6V.js +43 -0
  16. package/dist/chunk-HUWJXLLF.js +681 -0
  17. package/dist/chunk-J3FALDQE.js +176 -0
  18. package/dist/chunk-JKERRYVS.js +109 -0
  19. package/dist/chunk-KA7LO7U5.js +28 -0
  20. package/dist/chunk-LHQTTUL2.js +27 -0
  21. package/dist/chunk-MAAS6CGR.js +1299 -0
  22. package/dist/chunk-NE36BUGQ.js +146 -0
  23. package/dist/chunk-NGXCFBCS.js +398 -0
  24. package/dist/chunk-OEYU5O27.js +235 -0
  25. package/dist/chunk-OUHGHTE7.js +748 -0
  26. package/dist/chunk-OXVOHOP3.js +661 -0
  27. package/dist/chunk-PSLKGOBZ.js +58 -0
  28. package/dist/chunk-PYL4XW6H.js +107 -0
  29. package/dist/chunk-Q47SPRY7.js +1 -0
  30. package/dist/chunk-Q7DJKLEN.js +18 -0
  31. package/dist/chunk-RJCA5672.js +1664 -0
  32. package/dist/chunk-S66I2PYB.js +748 -0
  33. package/dist/chunk-W7ZBF5AA.js +1 -0
  34. package/dist/chunk-WNWKOCGJ.js +1067 -0
  35. package/dist/chunk-XCYKC6OZ.js +1 -0
  36. package/dist/chunk-YULUKCS6.js +56 -0
  37. package/dist/chunk-YZ6GTZXL.js +48 -0
  38. package/dist/chunk-ZGHDPDTF.js +379 -0
  39. package/dist/components/command-queue/index.css +53 -0
  40. package/dist/components/command-queue/index.d.ts +204 -0
  41. package/dist/components/command-queue/index.js +10 -0
  42. package/dist/components/forms/index.d.ts +56 -0
  43. package/dist/components/forms/index.js +2 -0
  44. package/dist/components/index.css +443 -0
  45. package/dist/components/index.d.ts +1354 -0
  46. package/dist/components/index.js +18 -0
  47. package/dist/components/monitoring/index.d.ts +66 -0
  48. package/dist/components/monitoring/index.js +2 -0
  49. package/dist/components/navigation/index.d.ts +54 -0
  50. package/dist/components/navigation/index.js +91 -0
  51. package/dist/components/notifications/index.d.ts +52 -0
  52. package/dist/components/notifications/index.js +4 -0
  53. package/dist/components/resource-definition/index.css +388 -0
  54. package/dist/components/resource-definition/index.d.ts +301 -0
  55. package/dist/components/resource-definition/index.js +3 -0
  56. package/dist/display/index.css +53 -0
  57. package/dist/display/index.d.ts +606 -0
  58. package/dist/display/index.js +6 -0
  59. package/dist/execution/index.css +388 -0
  60. package/dist/execution/index.d.ts +1090 -0
  61. package/dist/execution/index.js +4 -0
  62. package/dist/graph/index.css +388 -0
  63. package/dist/graph/index.d.ts +429 -0
  64. package/dist/graph/index.js +1 -0
  65. package/dist/hooks/index.d.ts +1927 -0
  66. package/dist/hooks/index.js +6 -0
  67. package/dist/hooks/published.d.ts +1653 -0
  68. package/dist/hooks/published.js +4 -0
  69. package/dist/index.css +505 -0
  70. package/dist/index.d.ts +7284 -0
  71. package/dist/index.js +31 -0
  72. package/dist/initialization/index.d.ts +2325 -0
  73. package/dist/initialization/index.js +4 -0
  74. package/dist/organization/index.d.ts +225 -0
  75. package/dist/organization/index.js +4 -0
  76. package/dist/profile/index.d.ts +2265 -0
  77. package/dist/profile/index.js +3 -0
  78. package/dist/provider/index.css +61 -0
  79. package/dist/provider/index.d.ts +291 -0
  80. package/dist/provider/index.js +7 -0
  81. package/dist/provider/published.d.ts +198 -0
  82. package/dist/provider/published.js +6 -0
  83. package/dist/router/context.d.ts +19 -0
  84. package/dist/router/context.js +1 -0
  85. package/dist/router/index.d.ts +31 -0
  86. package/dist/router/index.js +2 -0
  87. package/dist/sse/index.d.ts +83 -0
  88. package/dist/sse/index.js +185 -0
  89. package/dist/supabase/index.d.ts +4289 -0
  90. package/dist/supabase/index.js +47 -0
  91. package/dist/typeform/index.d.ts +458 -0
  92. package/dist/typeform/index.js +1976 -0
  93. package/dist/typeform/schemas.d.ts +67 -0
  94. package/dist/typeform/schemas.js +1 -0
  95. package/dist/utils/index.d.ts +177 -0
  96. package/dist/utils/index.js +1 -0
  97. package/package.json +88 -0
@@ -0,0 +1,661 @@
1
+ import { BaseNode, useGraphTheme, BaseEdge, useGraphHighlighting, calculateGraphHeight, Graph_default, GRAPH_CONSTANTS, GraphBackground, GraphFitViewButton, GraphFitViewHandler } from './chunk-HUWJXLLF.js';
2
+ import { StyledMarkdown } from './chunk-3KMDHCAR.js';
3
+ import { Stack, Group, Text, Badge, ActionIcon, Collapse, Card, ThemeIcon, SimpleGrid, Divider, Paper, Title, Space, Box } from '@mantine/core';
4
+ import { IconBrain, IconFileText, IconChevronRight, IconTool, IconSettings, IconCpu, IconClockHour4, IconVersions, IconPlayerPlay, IconNetwork, IconSitemap } from '@tabler/icons-react';
5
+ import { memo, useState, useMemo } from 'react';
6
+ import JSONPretty from 'react-json-pretty';
7
+ import 'react-json-pretty/themes/monikai.css';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+ import { ReactFlowProvider, ReactFlow } from '@xyflow/react';
10
+ import dagre from '@dagrejs/dagre';
11
+ import '@xyflow/react/dist/style.css';
12
+
13
+ function CollapsibleJsonSection({ title, data, defaultExpanded = false }) {
14
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
15
+ const [isHovered, setIsHovered] = useState(false);
16
+ return /* @__PURE__ */ jsxs(
17
+ "div",
18
+ {
19
+ style: {
20
+ borderRadius: "var(--mantine-radius-default)",
21
+ backgroundColor: isHovered ? "var(--color-surface-hover, rgba(0,0,0,0.02))" : "transparent",
22
+ transition: "background-color var(--duration-fast) var(--easing)"
23
+ },
24
+ children: [
25
+ /* @__PURE__ */ jsxs(
26
+ Group,
27
+ {
28
+ gap: 4,
29
+ onClick: () => setIsExpanded(!isExpanded),
30
+ onMouseEnter: () => setIsHovered(true),
31
+ onMouseLeave: () => setIsHovered(false),
32
+ style: {
33
+ cursor: "pointer",
34
+ padding: "0.375rem 0.5rem",
35
+ userSelect: "none"
36
+ },
37
+ wrap: "nowrap",
38
+ children: [
39
+ /* @__PURE__ */ jsx(
40
+ ActionIcon,
41
+ {
42
+ variant: "transparent",
43
+ size: "xs",
44
+ style: {
45
+ transition: "transform var(--duration-fast) var(--easing)",
46
+ transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
47
+ },
48
+ children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
49
+ }
50
+ ),
51
+ title
52
+ ]
53
+ }
54
+ ),
55
+ /* @__PURE__ */ jsx(Collapse, { in: isExpanded, children: /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ style: {
59
+ fontSize: "0.75rem",
60
+ fontFamily: "var(--mantine-font-family-monospace)",
61
+ padding: "0.5rem",
62
+ overflow: "auto",
63
+ background: "var(--color-background)"
64
+ },
65
+ children: /* @__PURE__ */ jsx(
66
+ JSONPretty,
67
+ {
68
+ data,
69
+ theme: {
70
+ main: "line-height:1.3;color:var(--color-text);background:transparent;overflow:auto;",
71
+ error: "line-height:1.3;color:var(--color-error);background:transparent;overflow:auto;",
72
+ key: "color:var(--color-text-dimmed);",
73
+ string: "color:var(--color-success);",
74
+ value: "color:var(--color-warning);",
75
+ boolean: "color:var(--color-text-dimmed);"
76
+ }
77
+ }
78
+ )
79
+ }
80
+ ) })
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ function ContractDisplay({ contract, defaultExpanded = false }) {
86
+ return /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
87
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Contract" }),
88
+ /* @__PURE__ */ jsx(
89
+ CollapsibleJsonSection,
90
+ {
91
+ title: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Input Schema" }),
92
+ data: contract.inputSchema,
93
+ defaultExpanded
94
+ }
95
+ ),
96
+ contract.outputSchema != null && /* @__PURE__ */ jsx(
97
+ CollapsibleJsonSection,
98
+ {
99
+ title: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Output Schema" }),
100
+ data: contract.outputSchema,
101
+ defaultExpanded
102
+ }
103
+ )
104
+ ] });
105
+ }
106
+ function ConfigCard({ icon, title, badge, items, color = "blue" }) {
107
+ const visibleItems = items.filter((item) => item.value !== void 0 && item.value !== null);
108
+ if (visibleItems.length === 0) return null;
109
+ return /* @__PURE__ */ jsx(Card, { padding: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
110
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
111
+ /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "light", color, radius: "sm", children: icon }),
112
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { flex: 1, fontFamily: "var(--elevasis-font-family-subtitle)" }, children: title }),
113
+ badge && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color, children: badge })
114
+ ] }),
115
+ /* @__PURE__ */ jsx(Stack, { gap: 4, children: visibleItems.map((item, index) => /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
116
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { minWidth: "fit-content" }, children: item.label }),
117
+ 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
118
+ ] }, index)) })
119
+ ] }) });
120
+ }
121
+ function ToolsListDisplay({ tools, compact = false, maxVisible = 0 }) {
122
+ if (tools.length === 0) {
123
+ return /* @__PURE__ */ jsxs("div", { children: [
124
+ !compact && /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Tools" }),
125
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No tools configured" })
126
+ ] });
127
+ }
128
+ const normalizedTools = tools.map((tool) => typeof tool === "string" ? { name: tool } : tool);
129
+ const visibleTools = maxVisible > 0 ? normalizedTools.slice(0, maxVisible) : normalizedTools;
130
+ const hiddenCount = maxVisible > 0 ? Math.max(0, normalizedTools.length - maxVisible) : 0;
131
+ return /* @__PURE__ */ jsxs("div", { children: [
132
+ !compact && /* @__PURE__ */ jsxs(Group, { gap: "xs", mb: "xs", children: [
133
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Tools" }),
134
+ /* @__PURE__ */ jsx(Badge, { variant: "light", size: "xs", children: tools.length })
135
+ ] }),
136
+ /* @__PURE__ */ jsx(SimpleGrid, { cols: 2, spacing: "xs", children: visibleTools.map((tool, index) => /* @__PURE__ */ jsxs(Card, { withBorder: true, p: "sm", children: [
137
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", mb: tool.description ? "xs" : 0, children: [
138
+ /* @__PURE__ */ jsx(IconTool, { size: 16, style: { color: "var(--color-text-subtle)", flexShrink: 0 } }),
139
+ /* @__PURE__ */ jsx(Text, { size: "sm", ff: "monospace", fw: 500, children: tool.name })
140
+ ] }),
141
+ tool.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: tool.description })
142
+ ] }, `${tool.name}-${index}`)) }),
143
+ hiddenCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", fs: "italic", mt: "xs", children: [
144
+ "+",
145
+ hiddenCount,
146
+ " more tools"
147
+ ] })
148
+ ] });
149
+ }
150
+ var NODE_WIDTH = 200;
151
+ var NODE_HEIGHT = 100;
152
+ var RANK_SEP = 80;
153
+ var NODE_SEP = 30;
154
+ function useNewKnowledgeMapLayout(knowledgeMap, agentName) {
155
+ return useMemo(() => {
156
+ if (!knowledgeMap || knowledgeMap.nodes.length === 0) {
157
+ return { nodes: [], edges: [] };
158
+ }
159
+ const agentNodeId = "__agent__";
160
+ const edges = knowledgeMap.nodes.map((node) => ({
161
+ id: `edge-${agentNodeId}-${node.id}`,
162
+ source: agentNodeId,
163
+ target: node.id,
164
+ type: "knowledgeMap",
165
+ data: {}
166
+ }));
167
+ const dagreGraph = new dagre.graphlib.Graph();
168
+ dagreGraph.setDefaultEdgeLabel(() => ({}));
169
+ dagreGraph.setGraph({
170
+ rankdir: "TB",
171
+ ranksep: RANK_SEP,
172
+ nodesep: NODE_SEP,
173
+ marginx: 40,
174
+ marginy: 40
175
+ });
176
+ dagreGraph.setNode(agentNodeId, { width: NODE_WIDTH, height: NODE_HEIGHT });
177
+ knowledgeMap.nodes.forEach((node) => {
178
+ dagreGraph.setNode(node.id, { width: NODE_WIDTH, height: NODE_HEIGHT });
179
+ });
180
+ edges.forEach((edge) => {
181
+ dagreGraph.setEdge(edge.source, edge.target);
182
+ });
183
+ dagre.layout(dagreGraph);
184
+ const agentDagreNode = dagreGraph.node(agentNodeId);
185
+ const agentNode = {
186
+ id: agentNodeId,
187
+ type: "knowledgeMap",
188
+ position: {
189
+ x: agentDagreNode.x - NODE_WIDTH / 2,
190
+ y: agentDagreNode.y - NODE_HEIGHT / 2
191
+ },
192
+ data: {
193
+ id: agentNodeId,
194
+ name: agentName,
195
+ description: "Agent with lazy-loading knowledge",
196
+ loaded: true,
197
+ hasPrompt: false,
198
+ isAgentNode: true
199
+ }
200
+ };
201
+ const knowledgeNodes = knowledgeMap.nodes.map((node) => {
202
+ const dagreNode = dagreGraph.node(node.id);
203
+ return {
204
+ id: node.id,
205
+ type: "knowledgeMap",
206
+ position: {
207
+ x: dagreNode.x - NODE_WIDTH / 2,
208
+ y: dagreNode.y - NODE_HEIGHT / 2
209
+ },
210
+ data: {
211
+ id: node.id,
212
+ name: node.id,
213
+ description: node.description,
214
+ loaded: node.loaded,
215
+ hasPrompt: node.hasPrompt,
216
+ isAgentNode: false
217
+ }
218
+ };
219
+ });
220
+ return { nodes: [agentNode, ...knowledgeNodes], edges };
221
+ }, [knowledgeMap, agentName]);
222
+ }
223
+ var NewKnowledgeMapNode = memo(function NewKnowledgeMapNode2({ data, selected }) {
224
+ const nodeColor = data.isAgentNode ? "violet" : data.loaded ? "teal" : "blue";
225
+ return /* @__PURE__ */ jsx(BaseNode, { color: nodeColor, selected, width: 200, handleDirection: "vertical", children: /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
226
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
227
+ 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 } }),
228
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, truncate: true, style: { flex: 1, fontFamily: "var(--mantine-font-family-headings)" }, children: data.name })
229
+ ] }),
230
+ data.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: data.description }),
231
+ /* @__PURE__ */ jsx(Group, { gap: 4, children: data.isAgentNode ? /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: "Root" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
232
+ /* @__PURE__ */ jsx(
233
+ Badge,
234
+ {
235
+ size: "xs",
236
+ variant: "light",
237
+ color: data.loaded ? "teal" : "gray",
238
+ leftSection: /* @__PURE__ */ jsx(IconBrain, { size: 10 }),
239
+ children: data.loaded ? "Loaded" : "Available"
240
+ }
241
+ ),
242
+ data.hasPrompt && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ jsx(IconFileText, { size: 10 }), children: "Prompt" })
243
+ ] }) })
244
+ ] }) });
245
+ });
246
+ var NewKnowledgeMapEdge = memo(function NewKnowledgeMapEdge2({
247
+ id,
248
+ sourceX,
249
+ sourceY,
250
+ targetX,
251
+ targetY,
252
+ sourcePosition,
253
+ targetPosition,
254
+ selected,
255
+ data
256
+ }) {
257
+ const colors = useGraphTheme();
258
+ return /* @__PURE__ */ jsx(
259
+ BaseEdge,
260
+ {
261
+ id,
262
+ sourceX,
263
+ sourceY,
264
+ targetX,
265
+ targetY,
266
+ sourcePosition,
267
+ targetPosition,
268
+ color: colors.primary,
269
+ glowColor: colors.primaryGlow,
270
+ animated: false,
271
+ selected,
272
+ dimmed: data?.dimmed
273
+ }
274
+ );
275
+ });
276
+ var nodeTypes = {
277
+ knowledgeMap: NewKnowledgeMapNode
278
+ };
279
+ var edgeTypes = {
280
+ knowledgeMap: NewKnowledgeMapEdge
281
+ };
282
+ function NewKnowledgeMapGraphInner({ knowledgeMap, agentName, compact, fitViewTrigger }) {
283
+ const { nodes: layoutNodes, edges: layoutEdges } = useNewKnowledgeMapLayout(knowledgeMap, agentName);
284
+ const { nodes, edges, handleNodeMouseEnter, handleNodeMouseLeave } = useGraphHighlighting(layoutNodes, layoutEdges);
285
+ if (!knowledgeMap || knowledgeMap.nodes.length === 0) {
286
+ return /* @__PURE__ */ jsxs("div", { children: [
287
+ !compact && /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Knowledge Map" }),
288
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No knowledge nodes configured" })
289
+ ] });
290
+ }
291
+ const containerHeight = calculateGraphHeight({
292
+ itemCount: knowledgeMap.nodeCount,
293
+ minHeight: 250,
294
+ maxHeight: 450,
295
+ heightPerItem: 60
296
+ });
297
+ return /* @__PURE__ */ jsxs("div", { children: [
298
+ !compact && /* @__PURE__ */ jsxs(Group, { gap: "xs", mb: "xs", children: [
299
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Knowledge Map" }),
300
+ /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "xs", children: [
301
+ knowledgeMap.nodeCount,
302
+ " ",
303
+ knowledgeMap.nodeCount === 1 ? "node" : "nodes"
304
+ ] })
305
+ ] }),
306
+ /* @__PURE__ */ jsx(
307
+ Box,
308
+ {
309
+ className: Graph_default.graphContainer,
310
+ style: {
311
+ width: "100%",
312
+ height: containerHeight,
313
+ border: "1px solid var(--color-border)",
314
+ borderRadius: "var(--mantine-radius-md)",
315
+ overflow: "hidden"
316
+ },
317
+ children: /* @__PURE__ */ jsxs(
318
+ ReactFlow,
319
+ {
320
+ nodes,
321
+ edges,
322
+ nodeTypes,
323
+ edgeTypes,
324
+ onNodeMouseEnter: handleNodeMouseEnter,
325
+ onNodeMouseLeave: handleNodeMouseLeave,
326
+ fitView: true,
327
+ fitViewOptions: { padding: 0.15 },
328
+ proOptions: { hideAttribution: true },
329
+ minZoom: GRAPH_CONSTANTS.MIN_ZOOM,
330
+ maxZoom: GRAPH_CONSTANTS.MAX_ZOOM,
331
+ nodesDraggable: false,
332
+ nodesConnectable: false,
333
+ elementsSelectable: true,
334
+ selectNodesOnDrag: false,
335
+ panOnDrag: true,
336
+ zoomOnScroll: true,
337
+ zoomOnPinch: true,
338
+ panOnScroll: false,
339
+ children: [
340
+ /* @__PURE__ */ jsx(GraphBackground, {}),
341
+ /* @__PURE__ */ jsx(GraphFitViewButton, { padding: 0.15, variant: "mantine", duration: 300 }),
342
+ /* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger })
343
+ ]
344
+ }
345
+ )
346
+ }
347
+ )
348
+ ] });
349
+ }
350
+ function NewKnowledgeMapGraph(props) {
351
+ return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(NewKnowledgeMapGraphInner, { ...props }) });
352
+ }
353
+ function DefinitionSectionHeader({ expanded, onToggle, icon, title, count }) {
354
+ return /* @__PURE__ */ jsxs(Group, { gap: 4, onClick: onToggle, style: { cursor: "pointer", userSelect: "none" }, wrap: "nowrap", children: [
355
+ /* @__PURE__ */ jsx(
356
+ ActionIcon,
357
+ {
358
+ variant: "transparent",
359
+ size: "xs",
360
+ style: {
361
+ transition: "transform var(--duration-fast) var(--easing)",
362
+ transform: expanded ? "rotate(90deg)" : "rotate(0deg)"
363
+ },
364
+ children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
365
+ }
366
+ ),
367
+ icon,
368
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title }),
369
+ count && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
370
+ "(",
371
+ count,
372
+ ")"
373
+ ] })
374
+ ] });
375
+ }
376
+ function AgentDefinitionDisplay({ agent, defaultExpanded = false }) {
377
+ const [systemPromptExpanded, setSystemPromptExpanded] = useState(defaultExpanded);
378
+ const [configExpanded, setConfigExpanded] = useState(defaultExpanded);
379
+ const [knowledgeMapExpanded, setKnowledgeMapExpanded] = useState(defaultExpanded);
380
+ const [knowledgeMapFitTrigger, setKnowledgeMapFitTrigger] = useState(0);
381
+ const [toolsExpanded, setToolsExpanded] = useState(defaultExpanded);
382
+ const [memoryPrefsExpanded, setMemoryPrefsExpanded] = useState(defaultExpanded);
383
+ const hasConstraints = agent.config.constraints && Object.keys(agent.config.constraints).length > 0;
384
+ const hasMemoryPreferences = !!agent.config.memoryPreferences;
385
+ return /* @__PURE__ */ jsxs(Stack, { children: [
386
+ /* @__PURE__ */ jsxs("div", { children: [
387
+ /* @__PURE__ */ jsx(
388
+ DefinitionSectionHeader,
389
+ {
390
+ expanded: configExpanded,
391
+ onToggle: () => setConfigExpanded(!configExpanded),
392
+ icon: /* @__PURE__ */ jsx(IconSettings, { size: 16, color: "var(--color-text-subtle)" }),
393
+ title: "Configuration"
394
+ }
395
+ ),
396
+ /* @__PURE__ */ jsxs(Collapse, { in: configExpanded, children: [
397
+ /* @__PURE__ */ jsxs(SimpleGrid, { cols: 2, spacing: "sm", mt: "xs", pl: "xl", children: [
398
+ /* @__PURE__ */ jsx(
399
+ ConfigCard,
400
+ {
401
+ icon: /* @__PURE__ */ jsx(IconCpu, { size: 14 }),
402
+ title: "Model",
403
+ badge: agent.modelConfig.provider,
404
+ items: [
405
+ {
406
+ label: "Model",
407
+ value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: agent.modelConfig.model })
408
+ },
409
+ { label: "Temperature", value: agent.modelConfig.temperature, mono: true },
410
+ { label: "Max Tokens", value: agent.modelConfig.maxOutputTokens?.toLocaleString(), mono: true },
411
+ { label: "Top P", value: agent.modelConfig.topP, mono: true },
412
+ {
413
+ label: "Reasoning",
414
+ value: agent.modelConfig.modelOptions && "reasoning_effort" in agent.modelConfig.modelOptions ? String(agent.modelConfig.modelOptions.reasoning_effort) : void 0,
415
+ mono: true
416
+ },
417
+ {
418
+ label: "Verbosity",
419
+ value: agent.modelConfig.modelOptions && "verbosity" in agent.modelConfig.modelOptions ? String(agent.modelConfig.modelOptions.verbosity) : void 0,
420
+ mono: true
421
+ }
422
+ ]
423
+ }
424
+ ),
425
+ hasConstraints && /* @__PURE__ */ jsx(
426
+ ConfigCard,
427
+ {
428
+ icon: /* @__PURE__ */ jsx(IconClockHour4, { size: 14 }),
429
+ title: "Constraints",
430
+ color: "orange",
431
+ items: [
432
+ { label: "Max Iterations", value: agent.config.constraints?.maxIterations, mono: true },
433
+ {
434
+ label: "Timeout",
435
+ value: agent.config.constraints?.timeout ? `${(agent.config.constraints.timeout / 1e3).toFixed(0)}s` : void 0,
436
+ mono: true
437
+ },
438
+ { label: "Max Memory Keys", value: agent.config.constraints?.maxSessionMemoryKeys, mono: true },
439
+ {
440
+ label: "Max Memory Tokens",
441
+ value: agent.config.constraints?.maxMemoryTokens?.toLocaleString(),
442
+ mono: true
443
+ }
444
+ ]
445
+ }
446
+ ),
447
+ /* @__PURE__ */ jsx(
448
+ ConfigCard,
449
+ {
450
+ icon: /* @__PURE__ */ jsx(IconVersions, { size: 14 }),
451
+ title: "Version",
452
+ color: "grape",
453
+ items: [
454
+ {
455
+ label: "Version",
456
+ value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: agent.config.version })
457
+ }
458
+ ]
459
+ }
460
+ ),
461
+ /* @__PURE__ */ jsx(
462
+ ConfigCard,
463
+ {
464
+ icon: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 14 }),
465
+ title: "Execution Interface",
466
+ color: "teal",
467
+ items: [
468
+ {
469
+ label: "Has Interface",
470
+ 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" })
471
+ }
472
+ ]
473
+ }
474
+ )
475
+ ] }),
476
+ /* @__PURE__ */ jsx("div", { style: { paddingLeft: "var(--mantine-spacing-xl)", marginTop: "var(--mantine-spacing-sm)" }, children: /* @__PURE__ */ jsx(ContractDisplay, { contract: agent.contract, defaultExpanded }) })
477
+ ] })
478
+ ] }),
479
+ /* @__PURE__ */ jsx(Divider, {}),
480
+ /* @__PURE__ */ jsxs("div", { children: [
481
+ /* @__PURE__ */ jsx(
482
+ DefinitionSectionHeader,
483
+ {
484
+ expanded: systemPromptExpanded,
485
+ onToggle: () => setSystemPromptExpanded(!systemPromptExpanded),
486
+ icon: /* @__PURE__ */ jsx(IconBrain, { size: 16, color: "var(--color-text-subtle)" }),
487
+ title: "System Prompt"
488
+ }
489
+ ),
490
+ /* @__PURE__ */ jsx(Collapse, { in: systemPromptExpanded, children: /* @__PURE__ */ jsx(Paper, { p: "sm", mt: "xs", children: /* @__PURE__ */ jsx(StyledMarkdown, { children: agent.config.systemPrompt }) }) })
491
+ ] }),
492
+ agent.knowledgeMap && agent.knowledgeMap.nodeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
493
+ /* @__PURE__ */ jsx(Divider, {}),
494
+ /* @__PURE__ */ jsxs("div", { children: [
495
+ /* @__PURE__ */ jsx(
496
+ DefinitionSectionHeader,
497
+ {
498
+ expanded: knowledgeMapExpanded,
499
+ onToggle: () => {
500
+ const willExpand = !knowledgeMapExpanded;
501
+ setKnowledgeMapExpanded(willExpand);
502
+ if (willExpand) {
503
+ setKnowledgeMapFitTrigger((prev) => prev + 1);
504
+ }
505
+ },
506
+ icon: /* @__PURE__ */ jsx(IconNetwork, { size: 16, color: "var(--color-text-subtle)" }),
507
+ title: "Knowledge Map",
508
+ count: `${agent.knowledgeMap.nodeCount} ${agent.knowledgeMap.nodeCount === 1 ? "node" : "nodes"}`
509
+ }
510
+ ),
511
+ /* @__PURE__ */ jsx(Collapse, { in: knowledgeMapExpanded, children: /* @__PURE__ */ jsx("div", { style: { marginTop: "var(--mantine-spacing-xs)" }, children: /* @__PURE__ */ jsx(
512
+ NewKnowledgeMapGraph,
513
+ {
514
+ knowledgeMap: agent.knowledgeMap,
515
+ agentName: agent.config.name,
516
+ compact: true,
517
+ fitViewTrigger: knowledgeMapFitTrigger
518
+ }
519
+ ) }) })
520
+ ] })
521
+ ] }),
522
+ /* @__PURE__ */ jsx(Divider, {}),
523
+ /* @__PURE__ */ jsxs("div", { children: [
524
+ /* @__PURE__ */ jsx(
525
+ DefinitionSectionHeader,
526
+ {
527
+ expanded: toolsExpanded,
528
+ onToggle: () => setToolsExpanded(!toolsExpanded),
529
+ icon: /* @__PURE__ */ jsx(IconTool, { size: 16, color: "var(--color-text-subtle)" }),
530
+ title: "Tools",
531
+ count: String(agent.tools.length)
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsx(Collapse, { in: toolsExpanded, children: /* @__PURE__ */ jsx("div", { style: { marginTop: "var(--mantine-spacing-xs)" }, children: /* @__PURE__ */ jsx(ToolsListDisplay, { tools: agent.tools, compact: true }) }) })
535
+ ] }),
536
+ hasMemoryPreferences && /* @__PURE__ */ jsxs(Fragment, { children: [
537
+ /* @__PURE__ */ jsx(Divider, {}),
538
+ /* @__PURE__ */ jsxs("div", { children: [
539
+ /* @__PURE__ */ jsx(
540
+ DefinitionSectionHeader,
541
+ {
542
+ expanded: memoryPrefsExpanded,
543
+ onToggle: () => setMemoryPrefsExpanded(!memoryPrefsExpanded),
544
+ title: "Memory Preferences"
545
+ }
546
+ ),
547
+ /* @__PURE__ */ jsx(Collapse, { in: memoryPrefsExpanded, children: /* @__PURE__ */ jsx(
548
+ Paper,
549
+ {
550
+ p: "sm",
551
+ mt: "xs",
552
+ style: {
553
+ backgroundColor: "var(--color-background)",
554
+ border: "1px solid var(--color-border)"
555
+ },
556
+ children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { whiteSpace: "pre-wrap" }, children: agent.config.memoryPreferences })
557
+ }
558
+ ) })
559
+ ] })
560
+ ] })
561
+ ] });
562
+ }
563
+ function WorkflowDefinitionDisplay({ workflow, defaultExpanded = false }) {
564
+ const [configExpanded, setConfigExpanded] = useState(defaultExpanded);
565
+ return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsxs("div", { children: [
566
+ /* @__PURE__ */ jsxs(
567
+ Group,
568
+ {
569
+ gap: 4,
570
+ onClick: () => setConfigExpanded(!configExpanded),
571
+ style: { cursor: "pointer", userSelect: "none" },
572
+ wrap: "nowrap",
573
+ children: [
574
+ /* @__PURE__ */ jsx(
575
+ ActionIcon,
576
+ {
577
+ variant: "transparent",
578
+ size: "xs",
579
+ style: {
580
+ transition: "transform var(--duration-fast) var(--easing)",
581
+ transform: configExpanded ? "rotate(90deg)" : "rotate(0deg)"
582
+ },
583
+ children: /* @__PURE__ */ jsx(IconChevronRight, { size: 14 })
584
+ }
585
+ ),
586
+ /* @__PURE__ */ jsx(IconSettings, { size: 16, color: "var(--color-text-subtle)" }),
587
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Configuration" })
588
+ ]
589
+ }
590
+ ),
591
+ /* @__PURE__ */ jsxs(Collapse, { in: configExpanded, children: [
592
+ /* @__PURE__ */ jsxs(SimpleGrid, { cols: 2, spacing: "sm", mt: "xs", pl: "xl", children: [
593
+ /* @__PURE__ */ jsx(
594
+ ConfigCard,
595
+ {
596
+ icon: /* @__PURE__ */ jsx(IconVersions, { size: 14 }),
597
+ title: "Version",
598
+ color: "grape",
599
+ items: [
600
+ {
601
+ label: "Version",
602
+ value: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: workflow.config.version })
603
+ }
604
+ ]
605
+ }
606
+ ),
607
+ /* @__PURE__ */ jsx(
608
+ ConfigCard,
609
+ {
610
+ icon: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 14 }),
611
+ title: "Execution Interface",
612
+ color: "teal",
613
+ items: [
614
+ {
615
+ label: "Has Interface",
616
+ 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" })
617
+ }
618
+ ]
619
+ }
620
+ )
621
+ ] }),
622
+ /* @__PURE__ */ jsx("div", { style: { paddingLeft: "var(--mantine-spacing-xl)", marginTop: "var(--mantine-spacing-sm)" }, children: /* @__PURE__ */ jsx(ContractDisplay, { contract: workflow.contract, defaultExpanded }) })
623
+ ] })
624
+ ] }) });
625
+ }
626
+ function isAgentDefinition(structure) {
627
+ return structure.config.type === "agent" && "modelConfig" in structure;
628
+ }
629
+ function isWorkflowDefinition(structure) {
630
+ return structure.config.type === "workflow" && "steps" in structure;
631
+ }
632
+ function ResourceDefinitionSection({
633
+ resourceDefinition,
634
+ defaultExpanded = false
635
+ }) {
636
+ const isAgent = isAgentDefinition(resourceDefinition);
637
+ const isWorkflow = isWorkflowDefinition(resourceDefinition);
638
+ if (isAgent) {
639
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
640
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
641
+ /* @__PURE__ */ jsx(IconBrain, { size: 20 }),
642
+ /* @__PURE__ */ jsx(Title, { order: 3, children: "Agent Definition" })
643
+ ] }),
644
+ /* @__PURE__ */ jsx(Space, { h: 0 }),
645
+ /* @__PURE__ */ jsx(AgentDefinitionDisplay, { agent: resourceDefinition, defaultExpanded })
646
+ ] }) });
647
+ }
648
+ if (isWorkflow) {
649
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
650
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
651
+ /* @__PURE__ */ jsx(IconSitemap, { size: 20 }),
652
+ /* @__PURE__ */ jsx(Title, { order: 3, children: "Workflow Definition" })
653
+ ] }),
654
+ /* @__PURE__ */ jsx(Space, { h: 0 }),
655
+ /* @__PURE__ */ jsx(WorkflowDefinitionDisplay, { workflow: resourceDefinition, defaultExpanded })
656
+ ] }) });
657
+ }
658
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, p: "sm", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Unknown resource type" }) });
659
+ }
660
+
661
+ export { AgentDefinitionDisplay, CollapsibleJsonSection, ConfigCard, ContractDisplay, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, ResourceDefinitionSection, ToolsListDisplay, WorkflowDefinitionDisplay, useNewKnowledgeMapLayout };