(targetNodeId, nodes, edges)
| 665 | }) |
| 666 | } |
| 667 | function collectAgentFlowV2ParentNodes(targetNodeId, nodes, edges) { |
| 668 | const inputEdges = edges.filter((edg) => edg.target === targetNodeId && edg.targetHandle === targetNodeId) |
| 669 | |
| 670 | // Traverse each edge found |
| 671 | inputEdges.forEach((edge) => { |
| 672 | const parentNode = nodes.find((nd) => nd.id === edge.source) |
| 673 | if (!parentNode) return |
| 674 | |
| 675 | // Recursive call to explore further up the tree |
| 676 | collectAgentFlowV2ParentNodes(parentNode.id, nodes, edges) |
| 677 | |
| 678 | // Check and add the parent node to the list if it does not include specific names |
| 679 | const excludeNodeNames = ['startAgentflow'] |
| 680 | if (!excludeNodeNames.includes(parentNode.data.name) || includesStart) { |
| 681 | parentNodes.push(parentNode) |
| 682 | } |
| 683 | }) |
| 684 | } |
| 685 | |
| 686 | if (isSeqAgent) { |
| 687 | collectParentNodes(target, nodes, edges) |
no outgoing calls
no test coverage detected