@datatechsolutions/ui 2.7.117 → 2.7.119

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 (33) hide show
  1. package/dist/{chunk-OQAZ2BIC.mjs → chunk-55S2KOTZ.mjs} +2 -2
  2. package/dist/{chunk-OQAZ2BIC.mjs.map → chunk-55S2KOTZ.mjs.map} +1 -1
  3. package/dist/{chunk-MGR7H5X2.mjs → chunk-6KYBGBI4.mjs} +18 -3
  4. package/dist/chunk-6KYBGBI4.mjs.map +1 -0
  5. package/dist/{chunk-UZHWA7CM.js → chunk-DOO5ICHD.js} +35 -9
  6. package/dist/chunk-DOO5ICHD.js.map +1 -0
  7. package/dist/{chunk-5YIUJXPD.js → chunk-E42PD4X6.js} +2 -2
  8. package/dist/{chunk-5YIUJXPD.js.map → chunk-E42PD4X6.js.map} +1 -1
  9. package/dist/{chunk-FAAXHLWI.js → chunk-F4FMGGHO.js} +18 -2
  10. package/dist/chunk-F4FMGGHO.js.map +1 -0
  11. package/dist/{chunk-2KZEO34C.mjs → chunk-MAYOV7OM.mjs} +29 -3
  12. package/dist/chunk-MAYOV7OM.mjs.map +1 -0
  13. package/dist/workflow/index.d.mts +3 -3
  14. package/dist/workflow/index.d.ts +3 -3
  15. package/dist/workflow/index.js +133 -123
  16. package/dist/workflow/index.js.map +1 -1
  17. package/dist/workflow/index.mjs +12 -6
  18. package/dist/workflow/index.mjs.map +1 -1
  19. package/dist/workflow/utils.d.mts +13 -1
  20. package/dist/workflow/utils.d.ts +13 -1
  21. package/dist/workflow/utils.js +10 -6
  22. package/dist/workflow/utils.mjs +2 -2
  23. package/dist/workflow/workflow-canvas.d.mts +1 -1
  24. package/dist/workflow/workflow-canvas.d.ts +1 -1
  25. package/dist/workflow/workflow-canvas.js +3 -3
  26. package/dist/workflow/workflow-canvas.mjs +2 -2
  27. package/dist/{workflow-canvas-AmdoIvqQ.d.ts → workflow-canvas-B3k03HVM.d.mts} +2 -1
  28. package/dist/{workflow-canvas-CBA_3y6P.d.mts → workflow-canvas-CVkbfTQu.d.ts} +2 -1
  29. package/package.json +1 -1
  30. package/dist/chunk-2KZEO34C.mjs.map +0 -1
  31. package/dist/chunk-FAAXHLWI.js.map +0 -1
  32. package/dist/chunk-MGR7H5X2.mjs.map +0 -1
  33. package/dist/chunk-UZHWA7CM.js.map +0 -1
@@ -272,5 +272,5 @@ function topologicalSortAgents(graph) {
272
272
  }
273
273
 
274
274
  export { topologicalSortAgents, validateWorkflowGraph };
275
- //# sourceMappingURL=chunk-OQAZ2BIC.mjs.map
276
- //# sourceMappingURL=chunk-OQAZ2BIC.mjs.map
275
+ //# sourceMappingURL=chunk-55S2KOTZ.mjs.map
276
+ //# sourceMappingURL=chunk-55S2KOTZ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/workflow/utils/workflow-validator.ts"],"names":[],"mappings":";AA0CO,SAAS,sBAAsB,KAAA,EAAwC;AAC5E,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAA,MAAM,OAAA,uBAAc,GAAA,EAA0B;AAE9C,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,OAAA,CAAQ,GAAA,CAAI,IAAA,CAAK,EAAA,EAAI,IAAI,CAAA;AAAA,EAC3B;AAGA,EAAA,MAAM,UAAA,GAAa,MAAM,KAAA,CAAM,MAAA,CAAO,CAAC,IAAA,KAAS,IAAA,CAAK,SAAS,OAAO,CAAA;AACrE,EAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,IAAA,MAAA,CAAO,KAAK,qCAAqC,CAAA;AAAA,EACnD;AAGA,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,IAAI,CAAC,OAAA,CAAQ,GAAA,CAAI,IAAA,CAAK,MAAM,CAAA,EAAG;AAC7B,MAAA,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,IAAA,CAAK,EAAE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AM,QAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,CAAC,MAAA,EAAQ,MAAM,CAAA,IAAK,QAAA,EAAU;AACvC,IAAA,IAAI,MAAA,KAAW,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,MAAM,CAAA;AAAA,EACrC;AAEA,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAA,OAAO,KAAA,CAAM,SAAS,CAAA,EAAG;AACvB,IAAA,MAAM,OAAA,GAAU,MAAM,KAAA,EAAM;AAC5B,IAAA,MAAA,CAAO,KAAK,OAAO,CAAA;AAEnB,IAAA,KAAA,MAAW,YAAY,aAAA,CAAc,GAAA,CAAI,OAAO,CAAA,IAAK,EAAC,EAAG;AACvD,MAAA,MAAM,SAAA,GAAA,CAAa,QAAA,CAAS,GAAA,CAAI,QAAQ,KAAK,CAAA,IAAK,CAAA;AAClD,MAAA,QAAA,CAAS,GAAA,CAAI,UAAU,SAAS,CAAA;AAChC,MAAA,IAAI,SAAA,KAAc,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAAA,IAC1C;AAAA,EACF;AAGA,EAAA,MAAM,gBAAA,uBAAuB,GAAA,EAAoB;AACjD,EAAA,KAAA,MAAW,QAAQ,UAAA,EAAY;AAC7B,IAAA,gBAAA,CAAiB,GAAA,CAAI,IAAA,CAAK,EAAA,EAAI,IAAA,CAAK,KAAK,QAAQ,CAAA;AAAA,EAClD;AAEA,EAAA,OAAO,MAAA,CAAO,IAAI,CAAC,MAAA,KAAW,iBAAiB,GAAA,CAAI,MAAM,KAAK,MAAM,CAAA;AACtE","file":"chunk-OQAZ2BIC.mjs","sourcesContent":["/**\n * Workflow Validator\n * =================\n * Validates the workflow graph before publishing.\n * Ensures the graph forms a valid DAG with proper node connections.\n */\n\nimport type {\n WorkflowGraph,\n WorkflowNode,\n WorkflowEdge,\n IfElseNodeConfig,\n CodeNodeConfig,\n HttpRequestNodeConfig,\n TemplateTransformNodeConfig,\n KnowledgeBaseNodeConfig,\n AnswerNodeConfig,\n QuestionClassifierNodeConfig,\n ParameterExtractorNodeConfig,\n VariableAssignerNodeConfig,\n VariableAggregatorNodeConfig,\n DocumentExtractorNodeConfig,\n ListOperatorNodeConfig,\n} from '../contracts'\n\nexport type ValidationResult = {\n valid: boolean\n errors: string[]\n}\n\n/**\n * Validate a workflow graph for publishing.\n * Checks:\n * - At least one agent node exists\n * - All edges have valid source/target nodes\n * - No orphan nodes (every node has at least one connection, except note nodes)\n * - Tool nodes connect to agent nodes only\n * - Agent chain forms a valid DAG (no cycles)\n * - Rule nodes have incoming edges from agents\n * - Logic node constraints (start/end uniqueness, config validation)\n * - New node type validations (answer, question_classifier, parameter_extractor, etc.)\n */\nexport function validateWorkflowGraph(graph: WorkflowGraph): ValidationResult {\n const errors: string[] = []\n const nodeMap = new Map<string, WorkflowNode>()\n\n for (const node of graph.nodes) {\n nodeMap.set(node.id, node)\n }\n\n // 1. At least one agent node\n const agentNodes = graph.nodes.filter((node) => node.type === 'agent')\n if (agentNodes.length === 0) {\n errors.push('At least one agent node is required')\n }\n\n // 2. All edges reference valid nodes\n for (const edge of graph.edges) {\n if (!nodeMap.has(edge.source)) {\n errors.push(`Edge \"${edge.id}\" references non-existent source node \"${edge.source}\"`)\n }\n if (!nodeMap.has(edge.target)) {\n errors.push(`Edge \"${edge.id}\" references non-existent target node \"${edge.target}\"`)\n }\n }\n\n // 3. No orphan nodes (every node should have at least one connection, except note nodes)\n const connectedNodeIds = new Set<string>()\n for (const edge of graph.edges) {\n connectedNodeIds.add(edge.source)\n connectedNodeIds.add(edge.target)\n }\n\n for (const node of graph.nodes) {\n // Note nodes are annotations and not part of execution — skip orphan check\n if (node.type === 'note') continue\n if (!connectedNodeIds.has(node.id)) {\n errors.push(`Node \"${node.data.label}\" (${node.type}) is not connected to any other node`)\n }\n }\n\n // 4. Tool -> Agent only\n for (const edge of graph.edges) {\n const sourceNode = nodeMap.get(edge.source)\n const targetNode = nodeMap.get(edge.target)\n if (!sourceNode || !targetNode) continue\n\n if (sourceNode.type === 'tool' && targetNode.type !== 'agent') {\n errors.push(`Tool \"${sourceNode.data.label}\" can only connect to agent nodes, not ${targetNode.type} nodes`)\n }\n }\n\n // 5. Rule nodes should have incoming edges from agents\n const ruleNodes = graph.nodes.filter((node) => node.type === 'rule')\n for (const ruleNode of ruleNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === ruleNode.id)\n const hasAgentSource = incomingEdges.some((edge) => {\n const sourceNode = nodeMap.get(edge.source)\n return sourceNode?.type === 'agent'\n })\n if (incomingEdges.length === 0 || !hasAgentSource) {\n errors.push(`Rule \"${ruleNode.data.label}\" must have an incoming connection from an agent`)\n }\n }\n\n // 6. No cycles (topological sort of agent nodes)\n if (agentNodes.length > 1) {\n const cycleError = detectCycle(agentNodes, graph.edges, nodeMap)\n if (cycleError) {\n errors.push(cycleError)\n }\n }\n\n // 7. At most 1 start node\n const startNodes = graph.nodes.filter((node) => node.type === 'start')\n if (startNodes.length > 1) {\n errors.push('Only one Start node is allowed')\n }\n\n // 8. At most 1 end node\n const endNodes = graph.nodes.filter((node) => node.type === 'end')\n if (endNodes.length > 1) {\n errors.push('Only one End node is allowed')\n }\n\n // 9. Start node has no incoming edges\n for (const startNode of startNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === startNode.id)\n if (incomingEdges.length > 0) {\n errors.push('Start node cannot have incoming connections')\n }\n }\n\n // 10. End node has no outgoing edges\n for (const endNode of endNodes) {\n const outgoingEdges = graph.edges.filter((edge) => edge.source === endNode.id)\n if (outgoingEdges.length > 0) {\n errors.push('End node cannot have outgoing connections')\n }\n }\n\n // 11. IF/ELSE has at least 1 condition\n const ifElseNodes = graph.nodes.filter((node) => node.type === 'if_else')\n for (const ifElseNode of ifElseNodes) {\n const config = ifElseNode.data.config as IfElseNodeConfig | undefined\n if (!config || config.conditions.length === 0) {\n errors.push('IF/ELSE node must have at least one condition')\n }\n }\n\n // 12. Code node has non-empty code\n const codeNodes = graph.nodes.filter((node) => node.type === 'code')\n for (const codeNode of codeNodes) {\n const config = codeNode.data.config as CodeNodeConfig | undefined\n if (!config || !config.code.trim()) {\n errors.push('Code node must have code content')\n }\n }\n\n // 13. HTTP Request has valid URL\n const httpNodes = graph.nodes.filter((node) => node.type === 'http_request')\n for (const httpNode of httpNodes) {\n const config = httpNode.data.config as HttpRequestNodeConfig | undefined\n if (!config || !config.url.trim()) {\n errors.push('HTTP Request node must have a URL')\n }\n }\n\n // 14. Template has non-empty template\n const templateNodes = graph.nodes.filter((node) => node.type === 'template_transform')\n for (const templateNode of templateNodes) {\n const config = templateNode.data.config as TemplateTransformNodeConfig | undefined\n if (!config || !config.template.trim()) {\n errors.push('Template node must have template content')\n }\n }\n\n // 15. Knowledge Base has source ID\n const knowledgeBaseNodes = graph.nodes.filter((node) => node.type === 'knowledge_base')\n for (const knowledgeBaseNode of knowledgeBaseNodes) {\n const config = knowledgeBaseNode.data.config as KnowledgeBaseNodeConfig | undefined\n if (!config || !config.sourceId.trim()) {\n errors.push('Knowledge Base node must have a source configured')\n }\n }\n\n // 16. Iteration has outgoing edge\n const iterationNodes = graph.nodes.filter((node) => node.type === 'iteration')\n for (const iterationNode of iterationNodes) {\n const outgoingEdges = graph.edges.filter((edge) => edge.source === iterationNode.id)\n if (outgoingEdges.length === 0) {\n errors.push('Iteration node must have at least one outgoing connection')\n }\n }\n\n // ============================================================================\n // New node type validations (9 new node types)\n // ============================================================================\n\n // 17. Answer node: outputTemplate must be non-empty\n const answerNodes = graph.nodes.filter((node) => node.type === 'answer')\n for (const answerNode of answerNodes) {\n const config = answerNode.data.config as AnswerNodeConfig | undefined\n if (!config || !config.outputTemplate.trim()) {\n errors.push('Answer node must have a non-empty output template')\n }\n }\n\n // 18. Question Classifier: must have >= 2 categories with non-empty names\n const questionClassifierNodes = graph.nodes.filter((node) => node.type === 'question_classifier')\n for (const questionClassifierNode of questionClassifierNodes) {\n const config = questionClassifierNode.data.config as QuestionClassifierNodeConfig | undefined\n if (!config || config.categories.length < 2) {\n errors.push('Question Classifier node must have at least 2 categories')\n } else {\n const emptyCategories = config.categories.filter((category) => !category.name.trim())\n if (emptyCategories.length > 0) {\n errors.push('Question Classifier node has categories with empty names')\n }\n }\n }\n\n // 19. Parameter Extractor: must have >= 1 parameter with non-empty name\n const parameterExtractorNodes = graph.nodes.filter((node) => node.type === 'parameter_extractor')\n for (const parameterExtractorNode of parameterExtractorNodes) {\n const config = parameterExtractorNode.data.config as ParameterExtractorNodeConfig | undefined\n if (!config || config.parameters.length === 0) {\n errors.push('Parameter Extractor node must have at least 1 parameter')\n } else {\n const emptyParameters = config.parameters.filter((parameter) => !parameter.name.trim())\n if (emptyParameters.length > 0) {\n errors.push('Parameter Extractor node has parameters with empty names')\n }\n }\n }\n\n // 20. Variable Assigner: must have >= 1 assignment\n const variableAssignerNodes = graph.nodes.filter((node) => node.type === 'variable_assigner')\n for (const variableAssignerNode of variableAssignerNodes) {\n const config = variableAssignerNode.data.config as VariableAssignerNodeConfig | undefined\n if (!config || config.assignments.length === 0) {\n errors.push('Variable Assigner node must have at least 1 assignment')\n }\n }\n\n // 21. Variable Aggregator: must have >= 1 inputVariable and non-empty outputVariable\n const variableAggregatorNodes = graph.nodes.filter((node) => node.type === 'variable_aggregator')\n for (const variableAggregatorNode of variableAggregatorNodes) {\n const config = variableAggregatorNode.data.config as VariableAggregatorNodeConfig | undefined\n if (!config || config.inputVariables.length === 0) {\n errors.push('Variable Aggregator node must have at least 1 input variable')\n }\n if (!config || !config.outputVariable.trim()) {\n errors.push('Variable Aggregator node must have a non-empty output variable')\n }\n }\n\n // 22. Document Extractor: outputVariable must be non-empty\n const documentExtractorNodes = graph.nodes.filter((node) => node.type === 'document_extractor')\n for (const documentExtractorNode of documentExtractorNodes) {\n const config = documentExtractorNode.data.config as DocumentExtractorNodeConfig | undefined\n if (!config || !config.outputVariable.trim()) {\n errors.push('Document Extractor node must have a non-empty output variable')\n }\n }\n\n // 23. List Operator: inputVariable and outputVariable must be non-empty\n const listOperatorNodes = graph.nodes.filter((node) => node.type === 'list_operator')\n for (const listOperatorNode of listOperatorNodes) {\n const config = listOperatorNode.data.config as ListOperatorNodeConfig | undefined\n if (!config || !config.inputVariable.trim()) {\n errors.push('List Operator node must have a non-empty input variable')\n }\n if (!config || !config.outputVariable.trim()) {\n errors.push('List Operator node must have a non-empty output variable')\n }\n }\n\n // 24. Iteration Start: must follow an Iteration node (incoming edge source must be iteration type)\n const iterationStartNodes = graph.nodes.filter((node) => node.type === 'iteration_start')\n for (const iterationStartNode of iterationStartNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === iterationStartNode.id)\n const hasIterationSource = incomingEdges.some((edge) => {\n const sourceNode = nodeMap.get(edge.source)\n return sourceNode?.type === 'iteration'\n })\n if (incomingEdges.length === 0 || !hasIterationSource) {\n errors.push('Iteration Start node must have an incoming connection from an Iteration node')\n }\n }\n\n // Note: Note nodes skip validation — they are annotations, not part of execution.\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Detect cycles in the agent subgraph using DFS.\n */\nfunction detectCycle(\n agentNodes: WorkflowNode[],\n edges: WorkflowEdge[],\n nodeMap: Map<string, WorkflowNode>\n): string | null {\n const agentIds = new Set(agentNodes.map((node) => node.id))\n const adjacencyList = new Map<string, string[]>()\n\n for (const agentId of agentIds) {\n adjacencyList.set(agentId, [])\n }\n\n for (const edge of edges) {\n const sourceNode = nodeMap.get(edge.source)\n const targetNode = nodeMap.get(edge.target)\n if (\n sourceNode?.type === 'agent' &&\n targetNode?.type === 'agent' &&\n agentIds.has(edge.source) &&\n agentIds.has(edge.target)\n ) {\n adjacencyList.get(edge.source)!.push(edge.target)\n }\n }\n\n const visited = new Set<string>()\n const inStack = new Set<string>()\n\n function hasCycleDfs(nodeId: string): boolean {\n visited.add(nodeId)\n inStack.add(nodeId)\n\n const neighbors = adjacencyList.get(nodeId) ?? []\n for (const neighbor of neighbors) {\n if (!visited.has(neighbor)) {\n if (hasCycleDfs(neighbor)) return true\n } else if (inStack.has(neighbor)) {\n return true\n }\n }\n\n inStack.delete(nodeId)\n return false\n }\n\n for (const agentId of agentIds) {\n if (!visited.has(agentId)) {\n if (hasCycleDfs(agentId)) {\n return 'Cycle detected in agent pipeline — agents must form a directed acyclic graph (DAG)'\n }\n }\n }\n\n return null\n}\n\n/**\n * Topologically sort agent nodes from the graph edges.\n * Returns agent entityIds in execution order.\n * Logic nodes are skipped — only agent entityIds are returned.\n */\nexport function topologicalSortAgents(graph: WorkflowGraph): string[] {\n const agentNodes = graph.nodes.filter((node) => node.type === 'agent')\n const agentIdSet = new Set(agentNodes.map((node) => node.id))\n\n // Build adjacency list for agent-to-agent edges\n const inDegree = new Map<string, number>()\n const adjacencyList = new Map<string, string[]>()\n\n for (const node of agentNodes) {\n inDegree.set(node.id, 0)\n adjacencyList.set(node.id, [])\n }\n\n for (const edge of graph.edges) {\n if (agentIdSet.has(edge.source) && agentIdSet.has(edge.target)) {\n adjacencyList.get(edge.source)!.push(edge.target)\n inDegree.set(edge.target, (inDegree.get(edge.target) ?? 0) + 1)\n }\n }\n\n // Kahn's algorithm\n const queue: string[] = []\n for (const [nodeId, degree] of inDegree) {\n if (degree === 0) queue.push(nodeId)\n }\n\n const sorted: string[] = []\n while (queue.length > 0) {\n const current = queue.shift()!\n sorted.push(current)\n\n for (const neighbor of adjacencyList.get(current) ?? []) {\n const newDegree = (inDegree.get(neighbor) ?? 1) - 1\n inDegree.set(neighbor, newDegree)\n if (newDegree === 0) queue.push(neighbor)\n }\n }\n\n // Map node IDs back to entityIds\n const nodeIdToEntityId = new Map<string, string>()\n for (const node of agentNodes) {\n nodeIdToEntityId.set(node.id, node.data.entityId)\n }\n\n return sorted.map((nodeId) => nodeIdToEntityId.get(nodeId) ?? nodeId)\n}\n"]}
1
+ {"version":3,"sources":["../src/workflow/utils/workflow-validator.ts"],"names":[],"mappings":";AA0CO,SAAS,sBAAsB,KAAA,EAAwC;AAC5E,EAAA,MAAM,SAAmB,EAAC;AAC1B,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AAM,IAAA,CAAK,QAAQ,CAAA;AAAA,IAC1C;AAAA,EACF;AAGA,EAAA,MAAM,gBAAA,uBAAuB,GAAA,EAAoB;AACjD,EAAA,KAAA,MAAW,QAAQ,UAAA,EAAY;AAC7B,IAAA,gBAAA,CAAiB,GAAA,CAAI,IAAA,CAAK,EAAA,EAAI,IAAA,CAAK,KAAK,QAAQ,CAAA;AAAA,EAClD;AAEA,EAAA,OAAO,MAAA,CAAO,IAAI,CAAC,MAAA,KAAW,iBAAiB,GAAA,CAAI,MAAM,KAAK,MAAM,CAAA;AACtE","file":"chunk-55S2KOTZ.mjs","sourcesContent":["/**\n * Workflow Validator\n * =================\n * Validates the workflow graph before publishing.\n * Ensures the graph forms a valid DAG with proper node connections.\n */\n\nimport type {\n WorkflowGraph,\n WorkflowNode,\n WorkflowEdge,\n IfElseNodeConfig,\n CodeNodeConfig,\n HttpRequestNodeConfig,\n TemplateTransformNodeConfig,\n KnowledgeBaseNodeConfig,\n AnswerNodeConfig,\n QuestionClassifierNodeConfig,\n ParameterExtractorNodeConfig,\n VariableAssignerNodeConfig,\n VariableAggregatorNodeConfig,\n DocumentExtractorNodeConfig,\n ListOperatorNodeConfig,\n} from '../contracts'\n\nexport type ValidationResult = {\n valid: boolean\n errors: string[]\n}\n\n/**\n * Validate a workflow graph for publishing.\n * Checks:\n * - At least one agent node exists\n * - All edges have valid source/target nodes\n * - No orphan nodes (every node has at least one connection, except note nodes)\n * - Tool nodes connect to agent nodes only\n * - Agent chain forms a valid DAG (no cycles)\n * - Rule nodes have incoming edges from agents\n * - Logic node constraints (start/end uniqueness, config validation)\n * - New node type validations (answer, question_classifier, parameter_extractor, etc.)\n */\nexport function validateWorkflowGraph(graph: WorkflowGraph): ValidationResult {\n const errors: string[] = []\n const nodeMap = new Map<string, WorkflowNode>()\n\n for (const node of graph.nodes) {\n nodeMap.set(node.id, node)\n }\n\n // 1. At least one agent node\n const agentNodes = graph.nodes.filter((node) => node.type === 'agent')\n if (agentNodes.length === 0) {\n errors.push('At least one agent node is required')\n }\n\n // 2. All edges reference valid nodes\n for (const edge of graph.edges) {\n if (!nodeMap.has(edge.source)) {\n errors.push(`Edge \"${edge.id}\" references non-existent source node \"${edge.source}\"`)\n }\n if (!nodeMap.has(edge.target)) {\n errors.push(`Edge \"${edge.id}\" references non-existent target node \"${edge.target}\"`)\n }\n }\n\n // 3. No orphan nodes (every node should have at least one connection, except note nodes)\n const connectedNodeIds = new Set<string>()\n for (const edge of graph.edges) {\n connectedNodeIds.add(edge.source)\n connectedNodeIds.add(edge.target)\n }\n\n for (const node of graph.nodes) {\n // Note nodes are annotations and not part of execution — skip orphan check\n if (node.type === 'note') continue\n if (!connectedNodeIds.has(node.id)) {\n errors.push(`Node \"${node.data.label}\" (${node.type}) is not connected to any other node`)\n }\n }\n\n // 4. Tool -> Agent only\n for (const edge of graph.edges) {\n const sourceNode = nodeMap.get(edge.source)\n const targetNode = nodeMap.get(edge.target)\n if (!sourceNode || !targetNode) continue\n\n if (sourceNode.type === 'tool' && targetNode.type !== 'agent') {\n errors.push(`Tool \"${sourceNode.data.label}\" can only connect to agent nodes, not ${targetNode.type} nodes`)\n }\n }\n\n // 5. Rule nodes should have incoming edges from agents\n const ruleNodes = graph.nodes.filter((node) => node.type === 'rule')\n for (const ruleNode of ruleNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === ruleNode.id)\n const hasAgentSource = incomingEdges.some((edge) => {\n const sourceNode = nodeMap.get(edge.source)\n return sourceNode?.type === 'agent'\n })\n if (incomingEdges.length === 0 || !hasAgentSource) {\n errors.push(`Rule \"${ruleNode.data.label}\" must have an incoming connection from an agent`)\n }\n }\n\n // 6. No cycles (topological sort of agent nodes)\n if (agentNodes.length > 1) {\n const cycleError = detectCycle(agentNodes, graph.edges, nodeMap)\n if (cycleError) {\n errors.push(cycleError)\n }\n }\n\n // 7. At most 1 start node\n const startNodes = graph.nodes.filter((node) => node.type === 'start')\n if (startNodes.length > 1) {\n errors.push('Only one Start node is allowed')\n }\n\n // 8. At most 1 end node\n const endNodes = graph.nodes.filter((node) => node.type === 'end')\n if (endNodes.length > 1) {\n errors.push('Only one End node is allowed')\n }\n\n // 9. Start node has no incoming edges\n for (const startNode of startNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === startNode.id)\n if (incomingEdges.length > 0) {\n errors.push('Start node cannot have incoming connections')\n }\n }\n\n // 10. End node has no outgoing edges\n for (const endNode of endNodes) {\n const outgoingEdges = graph.edges.filter((edge) => edge.source === endNode.id)\n if (outgoingEdges.length > 0) {\n errors.push('End node cannot have outgoing connections')\n }\n }\n\n // 11. IF/ELSE has at least 1 condition\n const ifElseNodes = graph.nodes.filter((node) => node.type === 'if_else')\n for (const ifElseNode of ifElseNodes) {\n const config = ifElseNode.data.config as IfElseNodeConfig | undefined\n if (!config || config.conditions.length === 0) {\n errors.push('IF/ELSE node must have at least one condition')\n }\n }\n\n // 12. Code node has non-empty code\n const codeNodes = graph.nodes.filter((node) => node.type === 'code')\n for (const codeNode of codeNodes) {\n const config = codeNode.data.config as CodeNodeConfig | undefined\n if (!config || !config.code.trim()) {\n errors.push('Code node must have code content')\n }\n }\n\n // 13. HTTP Request has valid URL\n const httpNodes = graph.nodes.filter((node) => node.type === 'http_request')\n for (const httpNode of httpNodes) {\n const config = httpNode.data.config as HttpRequestNodeConfig | undefined\n if (!config || !config.url.trim()) {\n errors.push('HTTP Request node must have a URL')\n }\n }\n\n // 14. Template has non-empty template\n const templateNodes = graph.nodes.filter((node) => node.type === 'template_transform')\n for (const templateNode of templateNodes) {\n const config = templateNode.data.config as TemplateTransformNodeConfig | undefined\n if (!config || !config.template.trim()) {\n errors.push('Template node must have template content')\n }\n }\n\n // 15. Knowledge Base has source ID\n const knowledgeBaseNodes = graph.nodes.filter((node) => node.type === 'knowledge_base')\n for (const knowledgeBaseNode of knowledgeBaseNodes) {\n const config = knowledgeBaseNode.data.config as KnowledgeBaseNodeConfig | undefined\n if (!config || !config.sourceId.trim()) {\n errors.push('Knowledge Base node must have a source configured')\n }\n }\n\n // 16. Iteration has outgoing edge\n const iterationNodes = graph.nodes.filter((node) => node.type === 'iteration')\n for (const iterationNode of iterationNodes) {\n const outgoingEdges = graph.edges.filter((edge) => edge.source === iterationNode.id)\n if (outgoingEdges.length === 0) {\n errors.push('Iteration node must have at least one outgoing connection')\n }\n }\n\n // ============================================================================\n // New node type validations (9 new node types)\n // ============================================================================\n\n // 17. Answer node: outputTemplate must be non-empty\n const answerNodes = graph.nodes.filter((node) => node.type === 'answer')\n for (const answerNode of answerNodes) {\n const config = answerNode.data.config as AnswerNodeConfig | undefined\n if (!config || !config.outputTemplate.trim()) {\n errors.push('Answer node must have a non-empty output template')\n }\n }\n\n // 18. Question Classifier: must have >= 2 categories with non-empty names\n const questionClassifierNodes = graph.nodes.filter((node) => node.type === 'question_classifier')\n for (const questionClassifierNode of questionClassifierNodes) {\n const config = questionClassifierNode.data.config as QuestionClassifierNodeConfig | undefined\n if (!config || config.categories.length < 2) {\n errors.push('Question Classifier node must have at least 2 categories')\n } else {\n const emptyCategories = config.categories.filter((category) => !category.name.trim())\n if (emptyCategories.length > 0) {\n errors.push('Question Classifier node has categories with empty names')\n }\n }\n }\n\n // 19. Parameter Extractor: must have >= 1 parameter with non-empty name\n const parameterExtractorNodes = graph.nodes.filter((node) => node.type === 'parameter_extractor')\n for (const parameterExtractorNode of parameterExtractorNodes) {\n const config = parameterExtractorNode.data.config as ParameterExtractorNodeConfig | undefined\n if (!config || config.parameters.length === 0) {\n errors.push('Parameter Extractor node must have at least 1 parameter')\n } else {\n const emptyParameters = config.parameters.filter((parameter) => !parameter.name.trim())\n if (emptyParameters.length > 0) {\n errors.push('Parameter Extractor node has parameters with empty names')\n }\n }\n }\n\n // 20. Variable Assigner: must have >= 1 assignment\n const variableAssignerNodes = graph.nodes.filter((node) => node.type === 'variable_assigner')\n for (const variableAssignerNode of variableAssignerNodes) {\n const config = variableAssignerNode.data.config as VariableAssignerNodeConfig | undefined\n if (!config || config.assignments.length === 0) {\n errors.push('Variable Assigner node must have at least 1 assignment')\n }\n }\n\n // 21. Variable Aggregator: must have >= 1 inputVariable and non-empty outputVariable\n const variableAggregatorNodes = graph.nodes.filter((node) => node.type === 'variable_aggregator')\n for (const variableAggregatorNode of variableAggregatorNodes) {\n const config = variableAggregatorNode.data.config as VariableAggregatorNodeConfig | undefined\n if (!config || config.inputVariables.length === 0) {\n errors.push('Variable Aggregator node must have at least 1 input variable')\n }\n if (!config || !config.outputVariable.trim()) {\n errors.push('Variable Aggregator node must have a non-empty output variable')\n }\n }\n\n // 22. Document Extractor: outputVariable must be non-empty\n const documentExtractorNodes = graph.nodes.filter((node) => node.type === 'document_extractor')\n for (const documentExtractorNode of documentExtractorNodes) {\n const config = documentExtractorNode.data.config as DocumentExtractorNodeConfig | undefined\n if (!config || !config.outputVariable.trim()) {\n errors.push('Document Extractor node must have a non-empty output variable')\n }\n }\n\n // 23. List Operator: inputVariable and outputVariable must be non-empty\n const listOperatorNodes = graph.nodes.filter((node) => node.type === 'list_operator')\n for (const listOperatorNode of listOperatorNodes) {\n const config = listOperatorNode.data.config as ListOperatorNodeConfig | undefined\n if (!config || !config.inputVariable.trim()) {\n errors.push('List Operator node must have a non-empty input variable')\n }\n if (!config || !config.outputVariable.trim()) {\n errors.push('List Operator node must have a non-empty output variable')\n }\n }\n\n // 24. Iteration Start: must follow an Iteration node (incoming edge source must be iteration type)\n const iterationStartNodes = graph.nodes.filter((node) => node.type === 'iteration_start')\n for (const iterationStartNode of iterationStartNodes) {\n const incomingEdges = graph.edges.filter((edge) => edge.target === iterationStartNode.id)\n const hasIterationSource = incomingEdges.some((edge) => {\n const sourceNode = nodeMap.get(edge.source)\n return sourceNode?.type === 'iteration'\n })\n if (incomingEdges.length === 0 || !hasIterationSource) {\n errors.push('Iteration Start node must have an incoming connection from an Iteration node')\n }\n }\n\n // Note: Note nodes skip validation — they are annotations, not part of execution.\n\n return {\n valid: errors.length === 0,\n errors,\n }\n}\n\n/**\n * Detect cycles in the agent subgraph using DFS.\n */\nfunction detectCycle(\n agentNodes: WorkflowNode[],\n edges: WorkflowEdge[],\n nodeMap: Map<string, WorkflowNode>\n): string | null {\n const agentIds = new Set(agentNodes.map((node) => node.id))\n const adjacencyList = new Map<string, string[]>()\n\n for (const agentId of agentIds) {\n adjacencyList.set(agentId, [])\n }\n\n for (const edge of edges) {\n const sourceNode = nodeMap.get(edge.source)\n const targetNode = nodeMap.get(edge.target)\n if (\n sourceNode?.type === 'agent' &&\n targetNode?.type === 'agent' &&\n agentIds.has(edge.source) &&\n agentIds.has(edge.target)\n ) {\n adjacencyList.get(edge.source)!.push(edge.target)\n }\n }\n\n const visited = new Set<string>()\n const inStack = new Set<string>()\n\n function hasCycleDfs(nodeId: string): boolean {\n visited.add(nodeId)\n inStack.add(nodeId)\n\n const neighbors = adjacencyList.get(nodeId) ?? []\n for (const neighbor of neighbors) {\n if (!visited.has(neighbor)) {\n if (hasCycleDfs(neighbor)) return true\n } else if (inStack.has(neighbor)) {\n return true\n }\n }\n\n inStack.delete(nodeId)\n return false\n }\n\n for (const agentId of agentIds) {\n if (!visited.has(agentId)) {\n if (hasCycleDfs(agentId)) {\n return 'Cycle detected in agent pipeline — agents must form a directed acyclic graph (DAG)'\n }\n }\n }\n\n return null\n}\n\n/**\n * Topologically sort agent nodes from the graph edges.\n * Returns agent entityIds in execution order.\n * Logic nodes are skipped — only agent entityIds are returned.\n */\nexport function topologicalSortAgents(graph: WorkflowGraph): string[] {\n const agentNodes = graph.nodes.filter((node) => node.type === 'agent')\n const agentIdSet = new Set(agentNodes.map((node) => node.id))\n\n // Build adjacency list for agent-to-agent edges\n const inDegree = new Map<string, number>()\n const adjacencyList = new Map<string, string[]>()\n\n for (const node of agentNodes) {\n inDegree.set(node.id, 0)\n adjacencyList.set(node.id, [])\n }\n\n for (const edge of graph.edges) {\n if (agentIdSet.has(edge.source) && agentIdSet.has(edge.target)) {\n adjacencyList.get(edge.source)!.push(edge.target)\n inDegree.set(edge.target, (inDegree.get(edge.target) ?? 0) + 1)\n }\n }\n\n // Kahn's algorithm\n const queue: string[] = []\n for (const [nodeId, degree] of inDegree) {\n if (degree === 0) queue.push(nodeId)\n }\n\n const sorted: string[] = []\n while (queue.length > 0) {\n const current = queue.shift()!\n sorted.push(current)\n\n for (const neighbor of adjacencyList.get(current) ?? []) {\n const newDegree = (inDegree.get(neighbor) ?? 1) - 1\n inDegree.set(neighbor, newDegree)\n if (newDegree === 0) queue.push(neighbor)\n }\n }\n\n // Map node IDs back to entityIds\n const nodeIdToEntityId = new Map<string, string>()\n for (const node of agentNodes) {\n nodeIdToEntityId.set(node.id, node.data.entityId)\n }\n\n return sorted.map((nodeId) => nodeIdToEntityId.get(nodeId) ?? nodeId)\n}\n"]}
@@ -158,6 +158,21 @@ function applyDagreLayout(nodes, edges, direction) {
158
158
  });
159
159
  }
160
160
 
161
- export { applyDagreLayout, createDefaultLogicNodeConfig };
162
- //# sourceMappingURL=chunk-MGR7H5X2.mjs.map
163
- //# sourceMappingURL=chunk-MGR7H5X2.mjs.map
161
+ // src/workflow/utils/agent-tier.ts
162
+ var TIERS = [
163
+ { maxElo: 1200, tier: { key: "beginner", pillColor: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400" } },
164
+ { maxElo: 1600, tier: { key: "intermediate", pillColor: "bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400" } },
165
+ { maxElo: 2e3, tier: { key: "advanced", pillColor: "bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" } },
166
+ { maxElo: Infinity, tier: { key: "expert", pillColor: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400" } }
167
+ ];
168
+ function getAgentTier(elo) {
169
+ const eloValue = elo ?? 0;
170
+ for (const { maxElo, tier } of TIERS) {
171
+ if (eloValue < maxElo) return tier;
172
+ }
173
+ return TIERS[TIERS.length - 1].tier;
174
+ }
175
+
176
+ export { applyDagreLayout, createDefaultLogicNodeConfig, getAgentTier };
177
+ //# sourceMappingURL=chunk-6KYBGBI4.mjs.map
178
+ //# sourceMappingURL=chunk-6KYBGBI4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/workflow/utils/logic-node-defaults.ts","../src/workflow/utils/layout-engine.ts","../src/workflow/utils/agent-tier.ts"],"names":[],"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,EAA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A,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-6KYBGBI4.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 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 drawer.\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"]}
@@ -3,7 +3,7 @@
3
3
 
4
4
  var chunkYRY7HFKG_js = require('./chunk-YRY7HFKG.js');
5
5
  var chunkNJ6PBGQM_js = require('./chunk-NJ6PBGQM.js');
6
- var chunkFAAXHLWI_js = require('./chunk-FAAXHLWI.js');
6
+ var chunkF4FMGGHO_js = require('./chunk-F4FMGGHO.js');
7
7
  var react = require('react');
8
8
  var nextIntl = require('next-intl');
9
9
  var dynamic = require('next/dynamic.js');
@@ -1366,6 +1366,10 @@ var AgentFlowNode = react.memo(function AgentFlowNode2({ id, data, selected }) {
1366
1366
  ] }),
1367
1367
  /* @__PURE__ */ jsxRuntime.jsx(NodeCardMeta, { compact: isCompact, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
1368
1368
  /* @__PURE__ */ jsxRuntime.jsx(NodeCardBadge, { className: "rounded-full bg-indigo-100 px-2 py-0.5 text-[10px] font-semibold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300", children: "Agent" }),
1369
+ (() => {
1370
+ const tier = chunkF4FMGGHO_js.getAgentTier(Number(data.agent.elo ?? 0));
1371
+ return /* @__PURE__ */ jsxRuntime.jsx(NodeCardBadge, { className: `rounded-full px-2 py-0.5 text-[10px] font-bold ${tier.pillColor}`, children: tier.key });
1372
+ })(),
1369
1373
  /* @__PURE__ */ jsxRuntime.jsxs(NodeCardBadge, { className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${frameworkMeta.badgeColor}`, children: [
1370
1374
  /* @__PURE__ */ jsxRuntime.jsx(frameworkMeta.IconComponent, { className: "h-3 w-3" }),
1371
1375
  frameworkMeta.label
@@ -5026,6 +5030,7 @@ function WorkflowCanvasInner({
5026
5030
  agents,
5027
5031
  models,
5028
5032
  tools,
5033
+ agentTools = [],
5029
5034
  rules,
5030
5035
  entities = [],
5031
5036
  initialGraph,
@@ -5119,6 +5124,13 @@ function WorkflowCanvasInner({
5119
5124
  }
5120
5125
  return map;
5121
5126
  }, [allTools]);
5127
+ const agentToolMap = react.useMemo(() => {
5128
+ const map = /* @__PURE__ */ new Map();
5129
+ for (const at of agentTools) {
5130
+ map.set(at.agentToolId, at);
5131
+ }
5132
+ return map;
5133
+ }, [agentTools]);
5122
5134
  const ruleMap = react.useMemo(() => {
5123
5135
  const map = /* @__PURE__ */ new Map();
5124
5136
  for (const rule of allRules) {
@@ -5299,7 +5311,7 @@ function WorkflowCanvasInner({
5299
5311
  };
5300
5312
  }
5301
5313
  if (isLogicNodeType(savedNode.type)) {
5302
- const config = savedNode.data.config ?? chunkFAAXHLWI_js.createDefaultLogicNodeConfig(savedNode.type);
5314
+ const config = savedNode.data.config ?? chunkF4FMGGHO_js.createDefaultLogicNodeConfig(savedNode.type);
5303
5315
  if (config) {
5304
5316
  const baseNode = {
5305
5317
  id: savedNode.id,
@@ -5468,7 +5480,7 @@ function WorkflowCanvasInner({
5468
5480
  }
5469
5481
  storeTakeSnapshot();
5470
5482
  const isTB = direction === "TB";
5471
- const repositionedNodes = chunkFAAXHLWI_js.applyDagreLayout(nodes, edges, direction).map((node) => ({
5483
+ const repositionedNodes = chunkF4FMGGHO_js.applyDagreLayout(nodes, edges, direction).map((node) => ({
5472
5484
  ...node,
5473
5485
  sourcePosition: isTB ? react$1.Position.Bottom : react$1.Position.Right,
5474
5486
  targetPosition: isTB ? react$1.Position.Top : react$1.Position.Left
@@ -5597,7 +5609,7 @@ function WorkflowCanvasInner({
5597
5609
  }, [storePaste]);
5598
5610
  const contextMenuAddNote = react.useCallback((flowPosition) => {
5599
5611
  storeTakeSnapshot();
5600
- const noteConfig = chunkFAAXHLWI_js.createDefaultLogicNodeConfig("note");
5612
+ const noteConfig = chunkF4FMGGHO_js.createDefaultLogicNodeConfig("note");
5601
5613
  const noteNode = {
5602
5614
  id: crypto.randomUUID(),
5603
5615
  type: "note",
@@ -6052,6 +6064,20 @@ function WorkflowCanvasInner({
6052
6064
  }
6053
6065
  };
6054
6066
  setNodes((currentNodes) => [...currentNodes, newNode]);
6067
+ } else if (nodeType === "agent_tool") {
6068
+ const agentTool = agentToolMap.get(entityId);
6069
+ if (!agentTool) return;
6070
+ const newNode = {
6071
+ id: newNodeId,
6072
+ type: "agent_tool",
6073
+ position,
6074
+ data: {
6075
+ agentTool,
6076
+ order: 0,
6077
+ onRemoveFromCanvas: handleRemoveNodeFromCanvas
6078
+ }
6079
+ };
6080
+ setNodes((currentNodes) => [...currentNodes, newNode]);
6055
6081
  } else if (nodeType === "rule") {
6056
6082
  const rule = ruleMap.get(entityId);
6057
6083
  if (!rule) return;
@@ -6086,7 +6112,7 @@ function WorkflowCanvasInner({
6086
6112
  };
6087
6113
  setNodes((currentNodes) => [...currentNodes, newNode]);
6088
6114
  } else if (nodeType === "group") {
6089
- const groupConfig = configRaw ? JSON.parse(configRaw) : chunkFAAXHLWI_js.createDefaultLogicNodeConfig("group");
6115
+ const groupConfig = configRaw ? JSON.parse(configRaw) : chunkF4FMGGHO_js.createDefaultLogicNodeConfig("group");
6090
6116
  if (!groupConfig) return;
6091
6117
  const newNode = {
6092
6118
  id: newNodeId,
@@ -6103,7 +6129,7 @@ function WorkflowCanvasInner({
6103
6129
  };
6104
6130
  setNodes((currentNodes) => [...currentNodes, newNode]);
6105
6131
  } else if (isLogicNodeType(nodeType)) {
6106
- const config = configRaw ? JSON.parse(configRaw) : chunkFAAXHLWI_js.createDefaultLogicNodeConfig(nodeType);
6132
+ const config = configRaw ? JSON.parse(configRaw) : chunkF4FMGGHO_js.createDefaultLogicNodeConfig(nodeType);
6107
6133
  if (!config) return;
6108
6134
  const newNode = {
6109
6135
  id: newNodeId,
@@ -6220,7 +6246,7 @@ function WorkflowCanvasInner({
6220
6246
  (edgeId, nodeType, position) => {
6221
6247
  if (!isLogicNodeType(nodeType)) return;
6222
6248
  storeTakeSnapshot();
6223
- const config = chunkFAAXHLWI_js.createDefaultLogicNodeConfig(nodeType);
6249
+ const config = chunkF4FMGGHO_js.createDefaultLogicNodeConfig(nodeType);
6224
6250
  if (!config) return;
6225
6251
  const newNodeId = crypto.randomUUID();
6226
6252
  const newNode = {
@@ -6710,5 +6736,5 @@ exports.useDrawerStore = useDrawerStore;
6710
6736
  exports.useWorkflowBuilderClient = useWorkflowBuilderClient;
6711
6737
  exports.useWorkflowBuilderClientOptional = useWorkflowBuilderClientOptional;
6712
6738
  exports.useWorkflowStore = useWorkflowStore;
6713
- //# sourceMappingURL=chunk-UZHWA7CM.js.map
6714
- //# sourceMappingURL=chunk-UZHWA7CM.js.map
6739
+ //# sourceMappingURL=chunk-DOO5ICHD.js.map
6740
+ //# sourceMappingURL=chunk-DOO5ICHD.js.map