@datatechsolutions/ui 2.11.1 → 2.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/astrlabe/contracts.d.mts +293 -0
  2. package/dist/astrlabe/contracts.d.ts +293 -0
  3. package/dist/astrlabe/contracts.js +5 -0
  4. package/dist/astrlabe/contracts.js.map +1 -0
  5. package/dist/astrlabe/contracts.mjs +4 -0
  6. package/dist/astrlabe/contracts.mjs.map +1 -0
  7. package/dist/astrlabe/graph-node.d.mts +28 -0
  8. package/dist/astrlabe/graph-node.d.ts +28 -0
  9. package/dist/astrlabe/graph-node.js +26 -0
  10. package/dist/astrlabe/graph-node.js.map +1 -0
  11. package/dist/astrlabe/graph-node.mjs +5 -0
  12. package/dist/astrlabe/graph-node.mjs.map +1 -0
  13. package/dist/astrlabe/index.d.mts +707 -0
  14. package/dist/astrlabe/index.d.ts +707 -0
  15. package/dist/astrlabe/index.js +3247 -0
  16. package/dist/astrlabe/index.js.map +1 -0
  17. package/dist/astrlabe/index.mjs +2956 -0
  18. package/dist/astrlabe/index.mjs.map +1 -0
  19. package/dist/astrlabe/utils.d.mts +71 -0
  20. package/dist/astrlabe/utils.d.ts +71 -0
  21. package/dist/astrlabe/utils.js +30 -0
  22. package/dist/astrlabe/utils.js.map +1 -0
  23. package/dist/astrlabe/utils.mjs +5 -0
  24. package/dist/astrlabe/utils.mjs.map +1 -0
  25. package/dist/astrlabe/workflow-canvas.d.mts +5 -0
  26. package/dist/astrlabe/workflow-canvas.d.ts +5 -0
  27. package/dist/astrlabe/workflow-canvas.js +19 -0
  28. package/dist/astrlabe/workflow-canvas.js.map +1 -0
  29. package/dist/astrlabe/workflow-canvas.mjs +10 -0
  30. package/dist/astrlabe/workflow-canvas.mjs.map +1 -0
  31. package/dist/astrlabe/workflow-preview-canvas.d.mts +10 -0
  32. package/dist/astrlabe/workflow-preview-canvas.d.ts +10 -0
  33. package/dist/astrlabe/workflow-preview-canvas.js +28 -0
  34. package/dist/astrlabe/workflow-preview-canvas.js.map +1 -0
  35. package/dist/astrlabe/workflow-preview-canvas.mjs +26 -0
  36. package/dist/astrlabe/workflow-preview-canvas.mjs.map +1 -0
  37. package/dist/chunk-3GE3MBUZ.js +279 -0
  38. package/dist/chunk-3GE3MBUZ.js.map +1 -0
  39. package/dist/chunk-55H6WZQP.js +5 -0
  40. package/dist/chunk-55H6WZQP.js.map +1 -0
  41. package/dist/chunk-7VJ7CMMT.mjs +96 -0
  42. package/dist/chunk-7VJ7CMMT.mjs.map +1 -0
  43. package/dist/chunk-BLNXRUC4.mjs +276 -0
  44. package/dist/chunk-BLNXRUC4.mjs.map +1 -0
  45. package/dist/chunk-D2JF6C3E.mjs +46 -0
  46. package/dist/chunk-D2JF6C3E.mjs.map +1 -0
  47. package/dist/chunk-JB6RNAD2.mjs +4 -0
  48. package/dist/chunk-JB6RNAD2.mjs.map +1 -0
  49. package/dist/chunk-LJSJMBLO.mjs +7177 -0
  50. package/dist/chunk-LJSJMBLO.mjs.map +1 -0
  51. package/dist/chunk-OZNTQROP.mjs +39 -0
  52. package/dist/chunk-OZNTQROP.mjs.map +1 -0
  53. package/dist/chunk-P4YYEM4B.js +44 -0
  54. package/dist/chunk-P4YYEM4B.js.map +1 -0
  55. package/dist/chunk-PBKTXX4Y.js +20756 -0
  56. package/dist/chunk-PBKTXX4Y.js.map +1 -0
  57. package/dist/chunk-PWBWP5FJ.js +197 -0
  58. package/dist/chunk-PWBWP5FJ.js.map +1 -0
  59. package/dist/chunk-QWG2FMUN.mjs +60 -0
  60. package/dist/chunk-QWG2FMUN.mjs.map +1 -0
  61. package/dist/chunk-S7KHTUHA.js +65 -0
  62. package/dist/chunk-S7KHTUHA.js.map +1 -0
  63. package/dist/chunk-TLPPVL3W.mjs +189 -0
  64. package/dist/chunk-TLPPVL3W.mjs.map +1 -0
  65. package/dist/chunk-UZ3CMNUJ.js +49 -0
  66. package/dist/chunk-UZ3CMNUJ.js.map +1 -0
  67. package/dist/chunk-XAQME7DD.js +7238 -0
  68. package/dist/chunk-XAQME7DD.js.map +1 -0
  69. package/dist/chunk-XO7IYJSF.mjs +20022 -0
  70. package/dist/chunk-XO7IYJSF.mjs.map +1 -0
  71. package/dist/chunk-YXN2K77G.js +102 -0
  72. package/dist/chunk-YXN2K77G.js.map +1 -0
  73. package/dist/dynamic-island-confirm-Cbxh-sta.d.mts +52 -0
  74. package/dist/dynamic-island-confirm-Cbxh-sta.d.ts +52 -0
  75. package/dist/index.d.mts +4771 -0
  76. package/dist/index.d.ts +4771 -0
  77. package/dist/index.js +2892 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/index.mjs +7 -0
  80. package/dist/index.mjs.map +1 -0
  81. package/dist/lib/i18n-context.d.mts +36 -0
  82. package/dist/lib/i18n-context.d.ts +36 -0
  83. package/dist/lib/i18n-context.js +29 -0
  84. package/dist/lib/i18n-context.js.map +1 -0
  85. package/dist/lib/i18n-context.mjs +4 -0
  86. package/dist/lib/i18n-context.mjs.map +1 -0
  87. package/dist/lib/router-context.d.mts +35 -0
  88. package/dist/lib/router-context.d.ts +35 -0
  89. package/dist/lib/router-context.js +25 -0
  90. package/dist/lib/router-context.js.map +1 -0
  91. package/dist/lib/router-context.mjs +4 -0
  92. package/dist/lib/router-context.mjs.map +1 -0
  93. package/dist/use-haptic-RDQNJYBE.js +17 -0
  94. package/dist/use-haptic-RDQNJYBE.js.map +1 -0
  95. package/dist/use-haptic-TCMOLPGA.mjs +4 -0
  96. package/dist/use-haptic-TCMOLPGA.mjs.map +1 -0
  97. package/dist/workflow-canvas-CJwGehdk.d.mts +241 -0
  98. package/dist/workflow-canvas-DSm0iyof.d.ts +241 -0
  99. package/package.json +2 -1
@@ -0,0 +1,197 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var Dagre = require('@dagrejs/dagre');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var Dagre__default = /*#__PURE__*/_interopDefault(Dagre);
9
+
10
+ // src/astrlabe/utils/logic-node-defaults.ts
11
+ function createDefaultLogicNodeConfig(nodeType) {
12
+ switch (nodeType) {
13
+ case "start":
14
+ return { type: "start", inputVariables: [] };
15
+ case "end":
16
+ return { type: "end", outputVariables: [] };
17
+ case "if_else":
18
+ return {
19
+ type: "if_else",
20
+ conditions: [{ variable: "", operator: "equals", value: "" }],
21
+ logicalOperator: "and"
22
+ };
23
+ case "code":
24
+ return { type: "code", language: "javascript", code: "" };
25
+ case "http_request":
26
+ return {
27
+ type: "http_request",
28
+ method: "GET",
29
+ url: "",
30
+ headers: {},
31
+ body: "",
32
+ timeoutMs: 1e4
33
+ };
34
+ case "template_transform":
35
+ return { type: "template_transform", template: "", outputVariable: "" };
36
+ case "iteration":
37
+ return { type: "iteration", iteratorVariable: "", maxIterations: 100 };
38
+ case "knowledge_base":
39
+ return { type: "knowledge_base", sourceId: "", topK: 5, similarityThreshold: 0.7 };
40
+ case "answer":
41
+ return { type: "answer", outputTemplate: "", outputVariables: [] };
42
+ case "question_classifier":
43
+ return {
44
+ type: "question_classifier",
45
+ modelId: "",
46
+ instructions: "",
47
+ categories: [
48
+ { id: crypto.randomUUID(), name: "", description: "" },
49
+ { id: crypto.randomUUID(), name: "", description: "" }
50
+ ]
51
+ };
52
+ case "parameter_extractor":
53
+ return {
54
+ type: "parameter_extractor",
55
+ modelId: "",
56
+ parameters: [{ name: "", type: "string", description: "", required: true }]
57
+ };
58
+ case "variable_assigner":
59
+ return {
60
+ type: "variable_assigner",
61
+ assignments: [{ target: "", source: "" }]
62
+ };
63
+ case "variable_aggregator":
64
+ return {
65
+ type: "variable_aggregator",
66
+ inputVariables: [],
67
+ outputVariable: "",
68
+ aggregationMode: "array"
69
+ };
70
+ case "document_extractor":
71
+ return {
72
+ type: "document_extractor",
73
+ extractionMode: "text",
74
+ outputVariable: ""
75
+ };
76
+ case "list_operator":
77
+ return {
78
+ type: "list_operator",
79
+ operation: "filter",
80
+ inputVariable: "",
81
+ outputVariable: "",
82
+ condition: ""
83
+ };
84
+ case "iteration_start":
85
+ return {
86
+ type: "iteration_start",
87
+ iteratorVariable: "",
88
+ itemVariable: "item",
89
+ indexVariable: "index"
90
+ };
91
+ case "note":
92
+ return {
93
+ type: "note",
94
+ text: "",
95
+ color: "yellow",
96
+ width: 200,
97
+ height: 150
98
+ };
99
+ case "group":
100
+ return {
101
+ type: "group",
102
+ label: "Group",
103
+ color: "slate",
104
+ isExpanded: true,
105
+ width: 400,
106
+ height: 300,
107
+ collapsedWidth: 260,
108
+ collapsedHeight: 60
109
+ };
110
+ case "datasource":
111
+ return {
112
+ type: "datasource",
113
+ datasourceId: "",
114
+ dialect: "",
115
+ table: "",
116
+ selectedColumns: [],
117
+ filterVariables: {},
118
+ outputVariable: "datasourceResult",
119
+ limit: 100
120
+ };
121
+ default:
122
+ return null;
123
+ }
124
+ }
125
+ var DEFAULT_NODE_WIDTH = 260;
126
+ var DEFAULT_NODE_HEIGHT = 70;
127
+ function getNodeSize(node) {
128
+ const measured = node.measured;
129
+ return {
130
+ width: measured?.width ?? DEFAULT_NODE_WIDTH,
131
+ height: measured?.height ?? DEFAULT_NODE_HEIGHT
132
+ };
133
+ }
134
+ function applyDagreLayout(nodes, edges, direction) {
135
+ const nodeSpacingHorizontal = 80;
136
+ const nodeSpacingVertical = 50;
137
+ const layoutNodes = nodes.filter(
138
+ (node) => !node.parentId && node.type !== "note"
139
+ );
140
+ const dagreGraph = new Dagre__default.default.graphlib.Graph({ directed: true });
141
+ dagreGraph.setDefaultEdgeLabel(() => ({}));
142
+ const isHorizontal = direction === "LR";
143
+ dagreGraph.setGraph({
144
+ rankdir: direction,
145
+ nodesep: isHorizontal ? nodeSpacingVertical : nodeSpacingHorizontal,
146
+ ranksep: isHorizontal ? nodeSpacingHorizontal : nodeSpacingVertical,
147
+ marginx: 40,
148
+ marginy: 40
149
+ });
150
+ const layoutNodeIds = new Set(layoutNodes.map((node) => node.id));
151
+ for (const node of layoutNodes) {
152
+ const { width, height } = getNodeSize(node);
153
+ dagreGraph.setNode(node.id, { width, height });
154
+ }
155
+ for (const edge of edges) {
156
+ if (layoutNodeIds.has(edge.source) && layoutNodeIds.has(edge.target)) {
157
+ dagreGraph.setEdge(edge.source, edge.target);
158
+ }
159
+ }
160
+ Dagre__default.default.layout(dagreGraph);
161
+ const positionMap = /* @__PURE__ */ new Map();
162
+ for (const node of layoutNodes) {
163
+ const dagreNode = dagreGraph.node(node.id);
164
+ if (!dagreNode) continue;
165
+ const { width, height } = getNodeSize(node);
166
+ positionMap.set(node.id, {
167
+ x: dagreNode.x - width / 2,
168
+ y: dagreNode.y - height / 2
169
+ });
170
+ }
171
+ return nodes.map((node) => {
172
+ const newPosition = positionMap.get(node.id);
173
+ if (!newPosition) return node;
174
+ return { ...node, position: newPosition };
175
+ });
176
+ }
177
+
178
+ // src/astrlabe/utils/agent-tier.ts
179
+ var TIERS = [
180
+ { maxElo: 1200, tier: { key: "beginner", pillColor: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400" } },
181
+ { maxElo: 1600, tier: { key: "intermediate", pillColor: "bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400" } },
182
+ { maxElo: 2e3, tier: { key: "advanced", pillColor: "bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" } },
183
+ { maxElo: Infinity, tier: { key: "expert", pillColor: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400" } }
184
+ ];
185
+ function getAgentTier(elo) {
186
+ const eloValue = elo ?? 0;
187
+ for (const { maxElo, tier } of TIERS) {
188
+ if (eloValue < maxElo) return tier;
189
+ }
190
+ return TIERS[TIERS.length - 1].tier;
191
+ }
192
+
193
+ exports.applyDagreLayout = applyDagreLayout;
194
+ exports.createDefaultLogicNodeConfig = createDefaultLogicNodeConfig;
195
+ exports.getAgentTier = getAgentTier;
196
+ //# sourceMappingURL=chunk-PWBWP5FJ.js.map
197
+ //# sourceMappingURL=chunk-PWBWP5FJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/astrlabe/utils/logic-node-defaults.ts","../src/astrlabe/utils/layout-engine.ts","../src/astrlabe/utils/agent-tier.ts"],"names":["Dagre"],"mappings":";;;;;;;;;AAQO,SAAS,6BAA6B,QAAA,EAAoD;AAC/F,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,OAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,cAAA,EAAgB,EAAC,EAAE;AAAA,IAC7C,KAAK,KAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,eAAA,EAAiB,EAAC,EAAE;AAAA,IAC5C,KAAK,SAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,SAAA;AAAA,QACN,UAAA,EAAY,CAAC,EAAE,QAAA,EAAU,IAAI,QAAA,EAAU,QAAA,EAAU,KAAA,EAAO,EAAA,EAAI,CAAA;AAAA,QAC5D,eAAA,EAAiB;AAAA,OACnB;AAAA,IACF,KAAK,MAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,QAAA,EAAU,YAAA,EAAc,MAAM,EAAA,EAAG;AAAA,IAC1D,KAAK,cAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,cAAA;AAAA,QACN,MAAA,EAAQ,KAAA;AAAA,QACR,GAAA,EAAK,EAAA;AAAA,QACL,SAAS,EAAC;AAAA,QACV,IAAA,EAAM,EAAA;AAAA,QACN,SAAA,EAAW;AAAA,OACb;AAAA,IACF,KAAK,oBAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,oBAAA,EAAsB,QAAA,EAAU,EAAA,EAAI,gBAAgB,EAAA,EAAG;AAAA,IACxE,KAAK,WAAA;AACH,MAAA,OAAO,EAAE,IAAA,EAAM,WAAA,EAAa,gBAAA,EAAkB,EAAA,EAAI,eAAe,GAAA,EAAI;AAAA,IACvE,KAAK,gB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Y,SAAA,EAAW,kEAAA,EAAmE,EAAE;AAAA,EACzH,EAAE,QAAQ,IAAA,EAAM,IAAA,EAAM,EAAE,GAAA,EAAK,cAAA,EAAgB,SAAA,EAAW,kEAAA,EAAmE,EAAE;AAAA,EAC7H,EAAE,QAAQ,GAAA,EAAM,IAAA,EAAM,EAAE,GAAA,EAAK,UAAA,EAAY,SAAA,EAAW,sEAAA,EAAuE,EAAE;AAAA,EAC7H,EAAE,QAAQ,QAAA,EAAU,IAAA,EAAM,EAAE,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,8EAAA,EAA+E;AACvI,CAAA;AAEO,SAAS,aAAa,GAAA,EAAoC;AAC/D,EAAA,MAAM,WAAW,GAAA,IAAO,CAAA;AACxB,EAAA,KAAA,MAAW,EAAE,MAAA,EAAQ,IAAA,EAAK,IAAK,KAAA,EAAO;AACpC,IAAA,IAAI,QAAA,GAAW,QAAQ,OAAO,IAAA;AAAA,EAChC;AACA,EAAA,OAAO,KAAA,CAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,CAAE,IAAA;AACjC","file":"chunk-PWBWP5FJ.js","sourcesContent":["/**\n * Logic Node Default Configs\n * ==========================\n * Factory function to create default configs for each logic node type.\n */\n\nimport type { WorkflowNodeType, LogicNodeConfig } from '../contracts'\n\nexport function createDefaultLogicNodeConfig(nodeType: WorkflowNodeType): LogicNodeConfig | null {\n switch (nodeType) {\n case 'start':\n return { type: 'start', inputVariables: [] }\n case 'end':\n return { type: 'end', outputVariables: [] }\n case 'if_else':\n return {\n type: 'if_else',\n conditions: [{ variable: '', operator: 'equals', value: '' }],\n logicalOperator: 'and',\n }\n case 'code':\n return { type: 'code', language: 'javascript', code: '' }\n case 'http_request':\n return {\n type: 'http_request',\n method: 'GET',\n url: '',\n headers: {},\n body: '',\n timeoutMs: 10000,\n }\n case 'template_transform':\n return { type: 'template_transform', template: '', outputVariable: '' }\n case 'iteration':\n return { type: 'iteration', iteratorVariable: '', maxIterations: 100 }\n case 'knowledge_base':\n return { type: 'knowledge_base', sourceId: '', topK: 5, similarityThreshold: 0.7 }\n case 'answer':\n return { type: 'answer', outputTemplate: '', outputVariables: [] }\n case 'question_classifier':\n return {\n type: 'question_classifier',\n modelId: '',\n instructions: '',\n categories: [\n { id: crypto.randomUUID(), name: '', description: '' },\n { id: crypto.randomUUID(), name: '', description: '' },\n ],\n }\n case 'parameter_extractor':\n return {\n type: 'parameter_extractor',\n modelId: '',\n parameters: [{ name: '', type: 'string', description: '', required: true }],\n }\n case 'variable_assigner':\n return {\n type: 'variable_assigner',\n assignments: [{ target: '', source: '' }],\n }\n case 'variable_aggregator':\n return {\n type: 'variable_aggregator',\n inputVariables: [],\n outputVariable: '',\n aggregationMode: 'array',\n }\n case 'document_extractor':\n return {\n type: 'document_extractor',\n extractionMode: 'text',\n outputVariable: '',\n }\n case 'list_operator':\n return {\n type: 'list_operator',\n operation: 'filter',\n inputVariable: '',\n outputVariable: '',\n condition: '',\n }\n case 'iteration_start':\n return {\n type: 'iteration_start',\n iteratorVariable: '',\n itemVariable: 'item',\n indexVariable: 'index',\n }\n case 'note':\n return {\n type: 'note',\n text: '',\n color: 'yellow',\n width: 200,\n height: 150,\n }\n case 'group':\n return {\n type: 'group',\n label: 'Group',\n color: 'slate',\n isExpanded: true,\n width: 400,\n height: 300,\n collapsedWidth: 260,\n collapsedHeight: 60,\n }\n case 'datasource':\n return {\n type: 'datasource',\n datasourceId: '',\n dialect: '',\n table: '',\n selectedColumns: [],\n filterVariables: {},\n outputVariable: 'datasourceResult',\n limit: 100,\n }\n default:\n return null\n }\n}\n","/**\n * Layout Engine\n * =============\n * Auto-layout for workflow graphs using @dagrejs/dagre.\n * Pure utility — no React dependencies.\n */\n\nimport Dagre from '@dagrejs/dagre'\nimport type { Node, Edge } from '@xyflow/react'\n\n/** Layout direction: free means no auto-layout is applied. */\nexport type LayoutDirection = 'free' | 'LR' | 'TB'\n\nconst DEFAULT_NODE_WIDTH = 260\nconst DEFAULT_NODE_HEIGHT = 70\n\nfunction getNodeSize(node: Node): { width: number; height: number } {\n const measured = node.measured as { width?: number; height?: number } | undefined\n return {\n width: measured?.width ?? DEFAULT_NODE_WIDTH,\n height: measured?.height ?? DEFAULT_NODE_HEIGHT,\n }\n}\n\n/**\n * Apply dagre layout to the given nodes and edges.\n * Returns a new array of nodes with updated positions.\n * Group child nodes (parentId set) and note nodes are excluded from layout.\n */\nexport function applyDagreLayout(\n nodes: Node[],\n edges: Edge[],\n direction: Exclude<LayoutDirection, 'free'>,\n): Node[] {\n const nodeSpacingHorizontal = 80\n const nodeSpacingVertical = 50\n\n // Separate layoutable nodes from excluded ones\n const layoutNodes = nodes.filter(\n (node) => !node.parentId && node.type !== 'note',\n )\n\n // Build dagre graph\n const dagreGraph = new Dagre.graphlib.Graph({ directed: true })\n dagreGraph.setDefaultEdgeLabel(() => ({}))\n\n const isHorizontal = direction === 'LR'\n dagreGraph.setGraph({\n rankdir: direction,\n nodesep: isHorizontal ? nodeSpacingVertical : nodeSpacingHorizontal,\n ranksep: isHorizontal ? nodeSpacingHorizontal : nodeSpacingVertical,\n marginx: 40,\n marginy: 40,\n })\n\n const layoutNodeIds = new Set(layoutNodes.map((node) => node.id))\n\n for (const node of layoutNodes) {\n const { width, height } = getNodeSize(node)\n dagreGraph.setNode(node.id, { width, height })\n }\n\n for (const edge of edges) {\n if (layoutNodeIds.has(edge.source) && layoutNodeIds.has(edge.target)) {\n dagreGraph.setEdge(edge.source, edge.target)\n }\n }\n\n Dagre.layout(dagreGraph)\n\n // Build position map — dagre returns center coords, React Flow uses top-left\n const positionMap = new Map<string, { x: number; y: number }>()\n for (const node of layoutNodes) {\n const dagreNode = dagreGraph.node(node.id)\n if (!dagreNode) continue\n const { width, height } = getNodeSize(node)\n positionMap.set(node.id, {\n x: dagreNode.x - width / 2,\n y: dagreNode.y - height / 2,\n })\n }\n\n // Return all nodes with updated positions for layout-participating nodes\n return nodes.map((node) => {\n const newPosition = positionMap.get(node.id)\n if (!newPosition) return node\n return { ...node, position: newPosition }\n })\n}\n","/**\n * Agent ELO Tier\n * ==============\n * Derives difficulty tier from agent ELO rating.\n * Used in node palette, agent flow node, and agent modal.\n */\n\nexport type AgentTier = {\n key: 'beginner' | 'intermediate' | 'advanced' | 'expert'\n pillColor: string\n}\n\nconst TIERS: Array<{ maxElo: number; tier: AgentTier }> = [\n { maxElo: 1200, tier: { key: 'beginner', pillColor: 'bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400' } },\n { maxElo: 1600, tier: { key: 'intermediate', pillColor: 'bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400' } },\n { maxElo: 2000, tier: { key: 'advanced', pillColor: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400' } },\n { maxElo: Infinity, tier: { key: 'expert', pillColor: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400' } },\n]\n\nexport function getAgentTier(elo: number | undefined): AgentTier {\n const eloValue = elo ?? 0\n for (const { maxElo, tier } of TIERS) {\n if (eloValue < maxElo) return tier\n }\n return TIERS[TIERS.length - 1].tier\n}\n"]}
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { createContext, useContext, forwardRef } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/lib/router-context.tsx
6
+ var RouterContext = createContext(null);
7
+ function RouterProvider({ children, value }) {
8
+ return /* @__PURE__ */ jsx(RouterContext.Provider, { value, children });
9
+ }
10
+ function useRouter() {
11
+ const context = useContext(RouterContext);
12
+ if (!context) {
13
+ return {
14
+ push: (href) => {
15
+ window.location.href = href;
16
+ },
17
+ replace: (href) => {
18
+ window.location.replace(href);
19
+ },
20
+ back: () => {
21
+ window.history.back();
22
+ },
23
+ forward: () => {
24
+ window.history.forward();
25
+ },
26
+ refresh: () => {
27
+ window.location.reload();
28
+ },
29
+ prefetch: () => {
30
+ }
31
+ };
32
+ }
33
+ return {
34
+ push: context.navigate,
35
+ replace: context.replace,
36
+ back: context.back,
37
+ forward: context.forward,
38
+ refresh: () => {
39
+ window.location.reload();
40
+ },
41
+ prefetch: context.prefetch
42
+ };
43
+ }
44
+ function usePathname() {
45
+ const context = useContext(RouterContext);
46
+ return context?.pathname ?? (typeof window !== "undefined" ? window.location.pathname : "/");
47
+ }
48
+ function useLink() {
49
+ const context = useContext(RouterContext);
50
+ if (!context) {
51
+ return forwardRef(function FallbackLink({ href, children, ...props }, ref) {
52
+ return /* @__PURE__ */ jsx("a", { href, ref, ...props, children });
53
+ });
54
+ }
55
+ return context.Link;
56
+ }
57
+
58
+ export { RouterProvider, useLink, usePathname, useRouter };
59
+ //# sourceMappingURL=chunk-QWG2FMUN.mjs.map
60
+ //# sourceMappingURL=chunk-QWG2FMUN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/router-context.tsx"],"names":[],"mappings":";;;;AAgBA,IAAM,aAAA,GAAgB,cAAyC,IAAI,CAAA;AAO5D,SAAS,cAAA,CAAe,EAAE,QAAA,EAAU,KAAA,EAAM,EAAwB;AACvE,EAAA,uBAAO,GAAA,CAAC,aAAA,CAAc,QAAA,EAAd,EAAuB,OAAe,QAAA,EAAS,CAAA;AACzD;AAEO,SAAS,SAAA,GAAY;AAC1B,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAC,IAAA,KAAiB;AAAE,QAAA,MAAA,CAAO,SAAS,IAAA,GAAO,IAAA;AAAA,MAAK,CAAA;AAAA,MACtD,OAAA,EAAS,CAAC,IAAA,KAAiB;AAAE,QAAA,MAAA,CAAO,QAAA,CAAS,QAAQ,IAAI,CAAA;AAAA,MAAE,CAAA;AAAA,MAC3D,MAAM,MAAM;AAAE,QAAA,MAAA,CAAO,QAAQ,IAAA,EAAK;AAAA,MAAE,CAAA;AAAA,MACpC,SAAS,MAAM;AAAE,QAAA,MAAA,CAAO,QAAQ,OAAA,EAAQ;AAAA,MAAE,CAAA;AAAA,MAC1C,SAAS,MAAM;AAAE,QAAA,MAAA,CAAO,SAAS,MAAA,EAAO;AAAA,MAAE,CAAA;AAAA,MAC1C,UAAU,MAAM;AAAA,MAAC;AAAA,KACnB;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,MAAM,OAAA,CAAQ,QAAA;AAAA,IACd,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,SAAS,MAAM;AAAE,MAAA,MAAA,CAAO,SAAS,MAAA,EAAO;AAAA,IAAE,CAAA;AAAA,IAC1C,UAAU,OAAA,CAAQ;AAAA,GACpB;AACF;AAEO,SAAS,WAAA,GAAsB;AACpC,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,OAAO,SAAS,QAAA,KAAa,OAAO,WAAW,WAAA,GAAc,MAAA,CAAO,SAAS,QAAA,GAAW,GAAA,CAAA;AAC1F;AAEO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,UAAA,CAAyC,SAAS,YAAA,CAAa,EAAE,MAAM,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,EAAK;AACvG,MAAA,2BAAQ,GAAA,EAAA,EAAE,IAAA,EAAY,GAAA,EAAW,GAAG,OAAQ,QAAA,EAAS,CAAA;AAAA,IACvD,CAAC,CAAA;AAAA,EACH;AACA,EAAA,OAAO,OAAA,CAAQ,IAAA;AACjB","file":"chunk-QWG2FMUN.mjs","sourcesContent":["import { createContext, useContext, forwardRef, type ReactNode, type AnchorHTMLAttributes, type Ref } from 'react'\n\nexport type LinkProps = { href: string; children?: ReactNode; ref?: Ref<HTMLAnchorElement> } & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>\n\nexport type LinkComponent = React.FC<LinkProps>\n\nexport interface RouterContextValue {\n pathname: string\n navigate: (href: string) => void\n replace: (href: string) => void\n back: () => void\n forward: () => void\n prefetch: (href: string) => void\n Link: LinkComponent\n}\n\nconst RouterContext = createContext<RouterContextValue | null>(null)\n\nexport type RouterProviderProps = {\n children: ReactNode\n value: RouterContextValue\n}\n\nexport function RouterProvider({ children, value }: RouterProviderProps) {\n return <RouterContext.Provider value={value}>{children}</RouterContext.Provider>\n}\n\nexport function useRouter() {\n const context = useContext(RouterContext)\n if (!context) {\n return {\n push: (href: string) => { window.location.href = href },\n replace: (href: string) => { window.location.replace(href) },\n back: () => { window.history.back() },\n forward: () => { window.history.forward() },\n refresh: () => { window.location.reload() },\n prefetch: () => {},\n }\n }\n return {\n push: context.navigate,\n replace: context.replace,\n back: context.back,\n forward: context.forward,\n refresh: () => { window.location.reload() },\n prefetch: context.prefetch,\n }\n}\n\nexport function usePathname(): string {\n const context = useContext(RouterContext)\n return context?.pathname ?? (typeof window !== 'undefined' ? window.location.pathname : '/')\n}\n\nexport function useLink(): LinkComponent {\n const context = useContext(RouterContext)\n if (!context) {\n return forwardRef<HTMLAnchorElement, LinkProps>(function FallbackLink({ href, children, ...props }, ref) {\n return <a href={href} ref={ref} {...props}>{children}</a>\n }) as unknown as LinkComponent\n }\n return context.Link\n}\n"]}
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ // src/lib/router-context.tsx
8
+ var RouterContext = react.createContext(null);
9
+ function RouterProvider({ children, value }) {
10
+ return /* @__PURE__ */ jsxRuntime.jsx(RouterContext.Provider, { value, children });
11
+ }
12
+ function useRouter() {
13
+ const context = react.useContext(RouterContext);
14
+ if (!context) {
15
+ return {
16
+ push: (href) => {
17
+ window.location.href = href;
18
+ },
19
+ replace: (href) => {
20
+ window.location.replace(href);
21
+ },
22
+ back: () => {
23
+ window.history.back();
24
+ },
25
+ forward: () => {
26
+ window.history.forward();
27
+ },
28
+ refresh: () => {
29
+ window.location.reload();
30
+ },
31
+ prefetch: () => {
32
+ }
33
+ };
34
+ }
35
+ return {
36
+ push: context.navigate,
37
+ replace: context.replace,
38
+ back: context.back,
39
+ forward: context.forward,
40
+ refresh: () => {
41
+ window.location.reload();
42
+ },
43
+ prefetch: context.prefetch
44
+ };
45
+ }
46
+ function usePathname() {
47
+ const context = react.useContext(RouterContext);
48
+ return context?.pathname ?? (typeof window !== "undefined" ? window.location.pathname : "/");
49
+ }
50
+ function useLink() {
51
+ const context = react.useContext(RouterContext);
52
+ if (!context) {
53
+ return react.forwardRef(function FallbackLink({ href, children, ...props }, ref) {
54
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, ref, ...props, children });
55
+ });
56
+ }
57
+ return context.Link;
58
+ }
59
+
60
+ exports.RouterProvider = RouterProvider;
61
+ exports.useLink = useLink;
62
+ exports.usePathname = usePathname;
63
+ exports.useRouter = useRouter;
64
+ //# sourceMappingURL=chunk-S7KHTUHA.js.map
65
+ //# sourceMappingURL=chunk-S7KHTUHA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/router-context.tsx"],"names":["createContext","jsx","useContext","forwardRef"],"mappings":";;;;;;AAgBA,IAAM,aAAA,GAAgBA,oBAAyC,IAAI,CAAA;AAO5D,SAAS,cAAA,CAAe,EAAE,QAAA,EAAU,KAAA,EAAM,EAAwB;AACvE,EAAA,uBAAOC,cAAA,CAAC,aAAA,CAAc,QAAA,EAAd,EAAuB,OAAe,QAAA,EAAS,CAAA;AACzD;AAEO,SAAS,SAAA,GAAY;AAC1B,EAAA,MAAM,OAAA,GAAUC,iBAAW,aAAa,CAAA;AACxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAC,IAAA,KAAiB;AAAE,QAAA,MAAA,CAAO,SAAS,IAAA,GAAO,IAAA;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,QAAA,EAAS,CAAA;AAAA,IACvD,CAAC,CAAA;AAAA,EACH;AACA,EAAA,OAAO,OAAA,CAAQ,IAAA;AACjB","file":"chunk-S7KHTUHA.js","sourcesContent":["import { createContext, useContext, forwardRef, type ReactNode, type AnchorHTMLAttributes, type Ref } from 'react'\n\nexport type LinkProps = { href: string; children?: ReactNode; ref?: Ref<HTMLAnchorElement> } & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>\n\nexport type LinkComponent = React.FC<LinkProps>\n\nexport interface RouterContextValue {\n pathname: string\n navigate: (href: string) => void\n replace: (href: string) => void\n back: () => void\n forward: () => void\n prefetch: (href: string) => void\n Link: LinkComponent\n}\n\nconst RouterContext = createContext<RouterContextValue | null>(null)\n\nexport type RouterProviderProps = {\n children: ReactNode\n value: RouterContextValue\n}\n\nexport function RouterProvider({ children, value }: RouterProviderProps) {\n return <RouterContext.Provider value={value}>{children}</RouterContext.Provider>\n}\n\nexport function useRouter() {\n const context = useContext(RouterContext)\n if (!context) {\n return {\n push: (href: string) => { window.location.href = href },\n replace: (href: string) => { window.location.replace(href) },\n back: () => { window.history.back() },\n forward: () => { window.history.forward() },\n refresh: () => { window.location.reload() },\n prefetch: () => {},\n }\n }\n return {\n push: context.navigate,\n replace: context.replace,\n back: context.back,\n forward: context.forward,\n refresh: () => { window.location.reload() },\n prefetch: context.prefetch,\n }\n}\n\nexport function usePathname(): string {\n const context = useContext(RouterContext)\n return context?.pathname ?? (typeof window !== 'undefined' ? window.location.pathname : '/')\n}\n\nexport function useLink(): LinkComponent {\n const context = useContext(RouterContext)\n if (!context) {\n return forwardRef<HTMLAnchorElement, LinkProps>(function FallbackLink({ href, children, ...props }, ref) {\n return <a href={href} ref={ref} {...props}>{children}</a>\n }) as unknown as LinkComponent\n }\n return context.Link\n}\n"]}
@@ -0,0 +1,189 @@
1
+ "use client";
2
+ import Dagre from '@dagrejs/dagre';
3
+
4
+ // src/astrlabe/utils/logic-node-defaults.ts
5
+ function createDefaultLogicNodeConfig(nodeType) {
6
+ switch (nodeType) {
7
+ case "start":
8
+ return { type: "start", inputVariables: [] };
9
+ case "end":
10
+ return { type: "end", outputVariables: [] };
11
+ case "if_else":
12
+ return {
13
+ type: "if_else",
14
+ conditions: [{ variable: "", operator: "equals", value: "" }],
15
+ logicalOperator: "and"
16
+ };
17
+ case "code":
18
+ return { type: "code", language: "javascript", code: "" };
19
+ case "http_request":
20
+ return {
21
+ type: "http_request",
22
+ method: "GET",
23
+ url: "",
24
+ headers: {},
25
+ body: "",
26
+ timeoutMs: 1e4
27
+ };
28
+ case "template_transform":
29
+ return { type: "template_transform", template: "", outputVariable: "" };
30
+ case "iteration":
31
+ return { type: "iteration", iteratorVariable: "", maxIterations: 100 };
32
+ case "knowledge_base":
33
+ return { type: "knowledge_base", sourceId: "", topK: 5, similarityThreshold: 0.7 };
34
+ case "answer":
35
+ return { type: "answer", outputTemplate: "", outputVariables: [] };
36
+ case "question_classifier":
37
+ return {
38
+ type: "question_classifier",
39
+ modelId: "",
40
+ instructions: "",
41
+ categories: [
42
+ { id: crypto.randomUUID(), name: "", description: "" },
43
+ { id: crypto.randomUUID(), name: "", description: "" }
44
+ ]
45
+ };
46
+ case "parameter_extractor":
47
+ return {
48
+ type: "parameter_extractor",
49
+ modelId: "",
50
+ parameters: [{ name: "", type: "string", description: "", required: true }]
51
+ };
52
+ case "variable_assigner":
53
+ return {
54
+ type: "variable_assigner",
55
+ assignments: [{ target: "", source: "" }]
56
+ };
57
+ case "variable_aggregator":
58
+ return {
59
+ type: "variable_aggregator",
60
+ inputVariables: [],
61
+ outputVariable: "",
62
+ aggregationMode: "array"
63
+ };
64
+ case "document_extractor":
65
+ return {
66
+ type: "document_extractor",
67
+ extractionMode: "text",
68
+ outputVariable: ""
69
+ };
70
+ case "list_operator":
71
+ return {
72
+ type: "list_operator",
73
+ operation: "filter",
74
+ inputVariable: "",
75
+ outputVariable: "",
76
+ condition: ""
77
+ };
78
+ case "iteration_start":
79
+ return {
80
+ type: "iteration_start",
81
+ iteratorVariable: "",
82
+ itemVariable: "item",
83
+ indexVariable: "index"
84
+ };
85
+ case "note":
86
+ return {
87
+ type: "note",
88
+ text: "",
89
+ color: "yellow",
90
+ width: 200,
91
+ height: 150
92
+ };
93
+ case "group":
94
+ return {
95
+ type: "group",
96
+ label: "Group",
97
+ color: "slate",
98
+ isExpanded: true,
99
+ width: 400,
100
+ height: 300,
101
+ collapsedWidth: 260,
102
+ collapsedHeight: 60
103
+ };
104
+ case "datasource":
105
+ return {
106
+ type: "datasource",
107
+ datasourceId: "",
108
+ dialect: "",
109
+ table: "",
110
+ selectedColumns: [],
111
+ filterVariables: {},
112
+ outputVariable: "datasourceResult",
113
+ limit: 100
114
+ };
115
+ default:
116
+ return null;
117
+ }
118
+ }
119
+ var DEFAULT_NODE_WIDTH = 260;
120
+ var DEFAULT_NODE_HEIGHT = 70;
121
+ function getNodeSize(node) {
122
+ const measured = node.measured;
123
+ return {
124
+ width: measured?.width ?? DEFAULT_NODE_WIDTH,
125
+ height: measured?.height ?? DEFAULT_NODE_HEIGHT
126
+ };
127
+ }
128
+ function applyDagreLayout(nodes, edges, direction) {
129
+ const nodeSpacingHorizontal = 80;
130
+ const nodeSpacingVertical = 50;
131
+ const layoutNodes = nodes.filter(
132
+ (node) => !node.parentId && node.type !== "note"
133
+ );
134
+ const dagreGraph = new Dagre.graphlib.Graph({ directed: true });
135
+ dagreGraph.setDefaultEdgeLabel(() => ({}));
136
+ const isHorizontal = direction === "LR";
137
+ dagreGraph.setGraph({
138
+ rankdir: direction,
139
+ nodesep: isHorizontal ? nodeSpacingVertical : nodeSpacingHorizontal,
140
+ ranksep: isHorizontal ? nodeSpacingHorizontal : nodeSpacingVertical,
141
+ marginx: 40,
142
+ marginy: 40
143
+ });
144
+ const layoutNodeIds = new Set(layoutNodes.map((node) => node.id));
145
+ for (const node of layoutNodes) {
146
+ const { width, height } = getNodeSize(node);
147
+ dagreGraph.setNode(node.id, { width, height });
148
+ }
149
+ for (const edge of edges) {
150
+ if (layoutNodeIds.has(edge.source) && layoutNodeIds.has(edge.target)) {
151
+ dagreGraph.setEdge(edge.source, edge.target);
152
+ }
153
+ }
154
+ Dagre.layout(dagreGraph);
155
+ const positionMap = /* @__PURE__ */ new Map();
156
+ for (const node of layoutNodes) {
157
+ const dagreNode = dagreGraph.node(node.id);
158
+ if (!dagreNode) continue;
159
+ const { width, height } = getNodeSize(node);
160
+ positionMap.set(node.id, {
161
+ x: dagreNode.x - width / 2,
162
+ y: dagreNode.y - height / 2
163
+ });
164
+ }
165
+ return nodes.map((node) => {
166
+ const newPosition = positionMap.get(node.id);
167
+ if (!newPosition) return node;
168
+ return { ...node, position: newPosition };
169
+ });
170
+ }
171
+
172
+ // src/astrlabe/utils/agent-tier.ts
173
+ var TIERS = [
174
+ { maxElo: 1200, tier: { key: "beginner", pillColor: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400" } },
175
+ { maxElo: 1600, tier: { key: "intermediate", pillColor: "bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400" } },
176
+ { maxElo: 2e3, tier: { key: "advanced", pillColor: "bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" } },
177
+ { maxElo: Infinity, tier: { key: "expert", pillColor: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400" } }
178
+ ];
179
+ function getAgentTier(elo) {
180
+ const eloValue = elo ?? 0;
181
+ for (const { maxElo, tier } of TIERS) {
182
+ if (eloValue < maxElo) return tier;
183
+ }
184
+ return TIERS[TIERS.length - 1].tier;
185
+ }
186
+
187
+ export { applyDagreLayout, createDefaultLogicNodeConfig, getAgentTier };
188
+ //# sourceMappingURL=chunk-TLPPVL3W.mjs.map
189
+ //# sourceMappingURL=chunk-TLPPVL3W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/astrlabe/utils/logic-node-defaults.ts","../src/astrlabe/utils/layout-engine.ts","../src/astrlabe/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,EAC7H,EAAE,QAAQ,GAAA,EAAM,IAAA,EAAM,EAAE,GAAA,EAAK,UAAA,EAAY,SAAA,EAAW,sEAAA,EAAuE,EAAE;AAAA,EAC7H,EAAE,QAAQ,QAAA,EAAU,IAAA,EAAM,EAAE,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,8EAAA,EAA+E;AACvI,CAAA;AAEO,SAAS,aAAa,GAAA,EAAoC;AAC/D,EAAA,MAAM,WAAW,GAAA,IAAO,CAAA;AACxB,EAAA,KAAA,MAAW,EAAE,MAAA,EAAQ,IAAA,EAAK,IAAK,KAAA,EAAO;AACpC,IAAA,IAAI,QAAA,GAAW,QAAQ,OAAO,IAAA;AAAA,EAChC;AACA,EAAA,OAAO,KAAA,CAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,CAAE,IAAA;AACjC","file":"chunk-TLPPVL3W.mjs","sourcesContent":["/**\n * Logic Node Default Configs\n * ==========================\n * Factory function to create default configs for each logic node type.\n */\n\nimport type { WorkflowNodeType, LogicNodeConfig } from '../contracts'\n\nexport function createDefaultLogicNodeConfig(nodeType: WorkflowNodeType): LogicNodeConfig | null {\n switch (nodeType) {\n case 'start':\n return { type: 'start', inputVariables: [] }\n case 'end':\n return { type: 'end', outputVariables: [] }\n case 'if_else':\n return {\n type: 'if_else',\n conditions: [{ variable: '', operator: 'equals', value: '' }],\n logicalOperator: 'and',\n }\n case 'code':\n return { type: 'code', language: 'javascript', code: '' }\n case 'http_request':\n return {\n type: 'http_request',\n method: 'GET',\n url: '',\n headers: {},\n body: '',\n timeoutMs: 10000,\n }\n case 'template_transform':\n return { type: 'template_transform', template: '', outputVariable: '' }\n case 'iteration':\n return { type: 'iteration', iteratorVariable: '', maxIterations: 100 }\n case 'knowledge_base':\n return { type: 'knowledge_base', sourceId: '', topK: 5, similarityThreshold: 0.7 }\n case 'answer':\n return { type: 'answer', outputTemplate: '', outputVariables: [] }\n case 'question_classifier':\n return {\n type: 'question_classifier',\n modelId: '',\n instructions: '',\n categories: [\n { id: crypto.randomUUID(), name: '', description: '' },\n { id: crypto.randomUUID(), name: '', description: '' },\n ],\n }\n case 'parameter_extractor':\n return {\n type: 'parameter_extractor',\n modelId: '',\n parameters: [{ name: '', type: 'string', description: '', required: true }],\n }\n case 'variable_assigner':\n return {\n type: 'variable_assigner',\n assignments: [{ target: '', source: '' }],\n }\n case 'variable_aggregator':\n return {\n type: 'variable_aggregator',\n inputVariables: [],\n outputVariable: '',\n aggregationMode: 'array',\n }\n case 'document_extractor':\n return {\n type: 'document_extractor',\n extractionMode: 'text',\n outputVariable: '',\n }\n case 'list_operator':\n return {\n type: 'list_operator',\n operation: 'filter',\n inputVariable: '',\n outputVariable: '',\n condition: '',\n }\n case 'iteration_start':\n return {\n type: 'iteration_start',\n iteratorVariable: '',\n itemVariable: 'item',\n indexVariable: 'index',\n }\n case 'note':\n return {\n type: 'note',\n text: '',\n color: 'yellow',\n width: 200,\n height: 150,\n }\n case 'group':\n return {\n type: 'group',\n label: 'Group',\n color: 'slate',\n isExpanded: true,\n width: 400,\n height: 300,\n collapsedWidth: 260,\n collapsedHeight: 60,\n }\n case 'datasource':\n return {\n type: 'datasource',\n datasourceId: '',\n dialect: '',\n table: '',\n selectedColumns: [],\n filterVariables: {},\n outputVariable: 'datasourceResult',\n limit: 100,\n }\n default:\n return null\n }\n}\n","/**\n * Layout Engine\n * =============\n * Auto-layout for workflow graphs using @dagrejs/dagre.\n * Pure utility — no React dependencies.\n */\n\nimport Dagre from '@dagrejs/dagre'\nimport type { Node, Edge } from '@xyflow/react'\n\n/** Layout direction: free means no auto-layout is applied. */\nexport type LayoutDirection = 'free' | 'LR' | 'TB'\n\nconst DEFAULT_NODE_WIDTH = 260\nconst DEFAULT_NODE_HEIGHT = 70\n\nfunction getNodeSize(node: Node): { width: number; height: number } {\n const measured = node.measured as { width?: number; height?: number } | undefined\n return {\n width: measured?.width ?? DEFAULT_NODE_WIDTH,\n height: measured?.height ?? DEFAULT_NODE_HEIGHT,\n }\n}\n\n/**\n * Apply dagre layout to the given nodes and edges.\n * Returns a new array of nodes with updated positions.\n * Group child nodes (parentId set) and note nodes are excluded from layout.\n */\nexport function applyDagreLayout(\n nodes: Node[],\n edges: Edge[],\n direction: Exclude<LayoutDirection, 'free'>,\n): Node[] {\n const nodeSpacingHorizontal = 80\n const nodeSpacingVertical = 50\n\n // Separate layoutable nodes from excluded ones\n const layoutNodes = nodes.filter(\n (node) => !node.parentId && node.type !== 'note',\n )\n\n // Build dagre graph\n const dagreGraph = new Dagre.graphlib.Graph({ directed: true })\n dagreGraph.setDefaultEdgeLabel(() => ({}))\n\n const isHorizontal = direction === 'LR'\n dagreGraph.setGraph({\n rankdir: direction,\n nodesep: isHorizontal ? nodeSpacingVertical : nodeSpacingHorizontal,\n ranksep: isHorizontal ? nodeSpacingHorizontal : nodeSpacingVertical,\n marginx: 40,\n marginy: 40,\n })\n\n const layoutNodeIds = new Set(layoutNodes.map((node) => node.id))\n\n for (const node of layoutNodes) {\n const { width, height } = getNodeSize(node)\n dagreGraph.setNode(node.id, { width, height })\n }\n\n for (const edge of edges) {\n if (layoutNodeIds.has(edge.source) && layoutNodeIds.has(edge.target)) {\n dagreGraph.setEdge(edge.source, edge.target)\n }\n }\n\n Dagre.layout(dagreGraph)\n\n // Build position map — dagre returns center coords, React Flow uses top-left\n const positionMap = new Map<string, { x: number; y: number }>()\n for (const node of layoutNodes) {\n const dagreNode = dagreGraph.node(node.id)\n if (!dagreNode) continue\n const { width, height } = getNodeSize(node)\n positionMap.set(node.id, {\n x: dagreNode.x - width / 2,\n y: dagreNode.y - height / 2,\n })\n }\n\n // Return all nodes with updated positions for layout-participating nodes\n return nodes.map((node) => {\n const newPosition = positionMap.get(node.id)\n if (!newPosition) return node\n return { ...node, position: newPosition }\n })\n}\n","/**\n * Agent ELO Tier\n * ==============\n * Derives difficulty tier from agent ELO rating.\n * Used in node palette, agent flow node, and agent modal.\n */\n\nexport type AgentTier = {\n key: 'beginner' | 'intermediate' | 'advanced' | 'expert'\n pillColor: string\n}\n\nconst TIERS: Array<{ maxElo: number; tier: AgentTier }> = [\n { maxElo: 1200, tier: { key: 'beginner', pillColor: 'bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400' } },\n { maxElo: 1600, tier: { key: 'intermediate', pillColor: 'bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400' } },\n { maxElo: 2000, tier: { key: 'advanced', pillColor: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400' } },\n { maxElo: Infinity, tier: { key: 'expert', pillColor: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400' } },\n]\n\nexport function getAgentTier(elo: number | undefined): AgentTier {\n const eloValue = elo ?? 0\n for (const { maxElo, tier } of TIERS) {\n if (eloValue < maxElo) return tier\n }\n return TIERS[TIERS.length - 1].tier\n}\n"]}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ // src/hooks/use-haptic.ts
5
+ var patterns = {
6
+ light: 10,
7
+ medium: 25,
8
+ heavy: 50,
9
+ success: [10, 50, 10],
10
+ warning: [25, 50, 25],
11
+ error: [50, 100, 50],
12
+ selection: 5
13
+ };
14
+ function useHaptic() {
15
+ const isSupported = typeof navigator !== "undefined" && "vibrate" in navigator;
16
+ const trigger = (pattern = "light") => {
17
+ if (!isSupported) return false;
18
+ try {
19
+ const vibrationPattern = patterns[pattern];
20
+ navigator.vibrate(vibrationPattern);
21
+ return true;
22
+ } catch {
23
+ return false;
24
+ }
25
+ };
26
+ const cancel = () => {
27
+ if (!isSupported) return;
28
+ navigator.vibrate(0);
29
+ };
30
+ return {
31
+ trigger,
32
+ cancel,
33
+ isSupported
34
+ };
35
+ }
36
+ function triggerHaptic(pattern = "light") {
37
+ if (typeof navigator === "undefined" || !("vibrate" in navigator)) return false;
38
+ try {
39
+ navigator.vibrate(patterns[pattern]);
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ exports.triggerHaptic = triggerHaptic;
47
+ exports.useHaptic = useHaptic;
48
+ //# sourceMappingURL=chunk-UZ3CMNUJ.js.map
49
+ //# sourceMappingURL=chunk-UZ3CMNUJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-haptic.ts"],"names":[],"mappings":";;;AAQA,IAAM,QAAA,GAAqD;AAAA,EACzD,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,KAAA,EAAO,EAAA;AAAA,EACP,OAAA,EAAS,CAAC,EAAA,EAAI,EAAA,EAAI,EAAE,CAAA;AAAA,EACpB,OAAA,EAAS,CAAC,EAAA,EAAI,EAAA,EAAI,EAAE,CAAA;AAAA,EACpB,KAAA,EAAO,CAAC,EAAA,EAAI,GAAA,EAAK,EAAE,CAAA;AAAA,EACnB,SAAA,EAAW;AACb,CAAA;AAEO,SAAS,SAAA,GAAY;AAC1B,EAAA,MAAM,WAAA,GAAc,OAAO,SAAA,KAAc,WAAA,IAAe,SAAA,IAAa,SAAA;AAErE,EAAA,MAAM,OAAA,GAAU,CAAC,OAAA,GAAyB,OAAA,KAAY;AACpD,IAAA,IAAI,CAAC,aAAa,OAAO,KAAA;AAEzB,IAAA,IAAI;AACF,MAAA,MAAM,gBAAA,GAAmB,SAAS,OAAO,CAAA;AACzC,MAAA,SAAA,CAAU,QAAQ,gBAAgB,CAAA;AAClC,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,SAAS,MAAM;AACnB,IAAA,IAAI,CAAC,WAAA,EAAa;AAClB,IAAA,SAAA,CAAU,QAAQ,CAAC,CAAA;AAAA,EACrB,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF;AAKO,SAAS,aAAA,CAAc,UAAyB,OAAA,EAAS;AAC9D,EAAA,IAAI,OAAO,SAAA,KAAc,WAAA,IAAe,EAAE,SAAA,IAAa,YAAY,OAAO,KAAA;AAE1E,EAAA,IAAI;AACF,IAAA,SAAA,CAAU,OAAA,CAAQ,QAAA,CAAS,OAAO,CAAC,CAAA;AACnC,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF","file":"chunk-UZ3CMNUJ.js","sourcesContent":["/**\n * iOS-style haptic feedback hook\n * Provides tactile feedback for touch interactions\n */\n\ntype HapticPattern = 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error' | 'selection'\n\n// Vibration patterns in milliseconds\nconst patterns: Record<HapticPattern, number | number[]> = {\n light: 10,\n medium: 25,\n heavy: 50,\n success: [10, 50, 10],\n warning: [25, 50, 25],\n error: [50, 100, 50],\n selection: 5,\n}\n\nexport function useHaptic() {\n const isSupported = typeof navigator !== 'undefined' && 'vibrate' in navigator\n\n const trigger = (pattern: HapticPattern = 'light') => {\n if (!isSupported) return false\n\n try {\n const vibrationPattern = patterns[pattern]\n navigator.vibrate(vibrationPattern)\n return true\n } catch {\n return false\n }\n }\n\n const cancel = () => {\n if (!isSupported) return\n navigator.vibrate(0)\n }\n\n return {\n trigger,\n cancel,\n isSupported,\n }\n}\n\n/**\n * Standalone haptic trigger for use outside React components\n */\nexport function triggerHaptic(pattern: HapticPattern = 'light') {\n if (typeof navigator === 'undefined' || !('vibrate' in navigator)) return false\n\n try {\n navigator.vibrate(patterns[pattern])\n return true\n } catch {\n return false\n }\n}\n"]}