@foresthubai/workflow-builder 0.4.3 → 0.4.5

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 (414) hide show
  1. package/LICENSE +661 -661
  2. package/NOTICE +16 -16
  3. package/README.md +110 -110
  4. package/dist/BuilderLayout.d.ts.map +1 -1
  5. package/dist/BuilderLayout.js +52 -61
  6. package/dist/BuilderLayout.js.map +1 -1
  7. package/dist/Canvas.d.ts.map +1 -1
  8. package/dist/Canvas.js +10 -3
  9. package/dist/Canvas.js.map +1 -1
  10. package/dist/CanvasEditor.d.ts.map +1 -1
  11. package/dist/CanvasEditor.js.map +1 -1
  12. package/dist/CanvasTabsToolbar.d.ts.map +1 -1
  13. package/dist/CanvasTabsToolbar.js +3 -0
  14. package/dist/CanvasTabsToolbar.js.map +1 -1
  15. package/dist/RightConfigPanel.d.ts.map +1 -1
  16. package/dist/RightConfigPanel.js +3 -0
  17. package/dist/RightConfigPanel.js.map +1 -1
  18. package/dist/WorkflowBuilder.d.ts +7 -13
  19. package/dist/WorkflowBuilder.d.ts.map +1 -1
  20. package/dist/WorkflowBuilder.js +25 -13
  21. package/dist/WorkflowBuilder.js.map +1 -1
  22. package/dist/cn.d.ts.map +1 -1
  23. package/dist/cn.js +3 -0
  24. package/dist/cn.js.map +1 -1
  25. package/dist/components/ui/add-button.d.ts.map +1 -1
  26. package/dist/components/ui/add-button.js +3 -0
  27. package/dist/components/ui/add-button.js.map +1 -1
  28. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  29. package/dist/components/ui/alert-dialog.js +3 -0
  30. package/dist/components/ui/alert-dialog.js.map +1 -1
  31. package/dist/components/ui/alert.d.ts.map +1 -1
  32. package/dist/components/ui/alert.js +3 -0
  33. package/dist/components/ui/alert.js.map +1 -1
  34. package/dist/components/ui/badge.d.ts.map +1 -1
  35. package/dist/components/ui/badge.js.map +1 -1
  36. package/dist/components/ui/button.d.ts.map +1 -1
  37. package/dist/components/ui/button.js +3 -0
  38. package/dist/components/ui/button.js.map +1 -1
  39. package/dist/components/ui/card.d.ts.map +1 -1
  40. package/dist/components/ui/card.js +3 -0
  41. package/dist/components/ui/card.js.map +1 -1
  42. package/dist/components/ui/checkbox.d.ts.map +1 -1
  43. package/dist/components/ui/checkbox.js +3 -0
  44. package/dist/components/ui/checkbox.js.map +1 -1
  45. package/dist/components/ui/collapsible.d.ts.map +1 -1
  46. package/dist/components/ui/collapsible.js +3 -0
  47. package/dist/components/ui/collapsible.js.map +1 -1
  48. package/dist/components/ui/command.d.ts +2 -2
  49. package/dist/components/ui/command.d.ts.map +1 -1
  50. package/dist/components/ui/command.js +3 -0
  51. package/dist/components/ui/command.js.map +1 -1
  52. package/dist/components/ui/delete-button.d.ts.map +1 -1
  53. package/dist/components/ui/delete-button.js +3 -0
  54. package/dist/components/ui/delete-button.js.map +1 -1
  55. package/dist/components/ui/dialog.d.ts.map +1 -1
  56. package/dist/components/ui/dialog.js +3 -0
  57. package/dist/components/ui/dialog.js.map +1 -1
  58. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  59. package/dist/components/ui/dropdown-menu.js +3 -0
  60. package/dist/components/ui/dropdown-menu.js.map +1 -1
  61. package/dist/components/ui/input.d.ts +1 -1
  62. package/dist/components/ui/input.d.ts.map +1 -1
  63. package/dist/components/ui/input.js +3 -0
  64. package/dist/components/ui/input.js.map +1 -1
  65. package/dist/components/ui/label.d.ts.map +1 -1
  66. package/dist/components/ui/label.js +3 -0
  67. package/dist/components/ui/label.js.map +1 -1
  68. package/dist/components/ui/readonly-banner.d.ts.map +1 -1
  69. package/dist/components/ui/readonly-banner.js +3 -0
  70. package/dist/components/ui/readonly-banner.js.map +1 -1
  71. package/dist/components/ui/resizable.d.ts +1 -1
  72. package/dist/components/ui/resizable.d.ts.map +1 -1
  73. package/dist/components/ui/resizable.js +3 -0
  74. package/dist/components/ui/resizable.js.map +1 -1
  75. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  76. package/dist/components/ui/scroll-area.js +3 -0
  77. package/dist/components/ui/scroll-area.js.map +1 -1
  78. package/dist/components/ui/select.d.ts.map +1 -1
  79. package/dist/components/ui/select.js +3 -0
  80. package/dist/components/ui/select.js.map +1 -1
  81. package/dist/components/ui/separator.d.ts.map +1 -1
  82. package/dist/components/ui/separator.js +3 -0
  83. package/dist/components/ui/separator.js.map +1 -1
  84. package/dist/components/ui/switch.d.ts.map +1 -1
  85. package/dist/components/ui/switch.js +3 -0
  86. package/dist/components/ui/switch.js.map +1 -1
  87. package/dist/components/ui/textarea.d.ts +1 -1
  88. package/dist/components/ui/textarea.d.ts.map +1 -1
  89. package/dist/components/ui/textarea.js +3 -0
  90. package/dist/components/ui/textarea.js.map +1 -1
  91. package/dist/components/ui/toast.d.ts.map +1 -1
  92. package/dist/components/ui/toast.js +3 -0
  93. package/dist/components/ui/toast.js.map +1 -1
  94. package/dist/components/ui/toaster.d.ts.map +1 -1
  95. package/dist/components/ui/toaster.js +3 -0
  96. package/dist/components/ui/toaster.js.map +1 -1
  97. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  98. package/dist/components/ui/toggle-group.js +3 -0
  99. package/dist/components/ui/toggle-group.js.map +1 -1
  100. package/dist/components/ui/toggle.d.ts.map +1 -1
  101. package/dist/components/ui/toggle.js +3 -0
  102. package/dist/components/ui/toggle.js.map +1 -1
  103. package/dist/components/ui/tooltip.d.ts.map +1 -1
  104. package/dist/components/ui/tooltip.js +3 -0
  105. package/dist/components/ui/tooltip.js.map +1 -1
  106. package/dist/dialogs/NodePickerDialog.d.ts.map +1 -1
  107. package/dist/dialogs/NodePickerDialog.js +3 -0
  108. package/dist/dialogs/NodePickerDialog.js.map +1 -1
  109. package/dist/dialogs/ValidationDialog.d.ts.map +1 -1
  110. package/dist/dialogs/ValidationDialog.js +3 -0
  111. package/dist/dialogs/ValidationDialog.js.map +1 -1
  112. package/dist/graph/BaseNode.d.ts.map +1 -1
  113. package/dist/graph/BaseNode.js +21 -16
  114. package/dist/graph/BaseNode.js.map +1 -1
  115. package/dist/graph/CustomEdge.d.ts.map +1 -1
  116. package/dist/graph/CustomEdge.js +4 -1
  117. package/dist/graph/CustomEdge.js.map +1 -1
  118. package/dist/graph/CustomNode.d.ts.map +1 -1
  119. package/dist/graph/CustomNode.js +3 -0
  120. package/dist/graph/CustomNode.js.map +1 -1
  121. package/dist/graph/FunctionCallNode.d.ts.map +1 -1
  122. package/dist/graph/FunctionCallNode.js.map +1 -1
  123. package/dist/graph/PortHandle.d.ts.map +1 -1
  124. package/dist/graph/PortHandle.js.map +1 -1
  125. package/dist/graph/reactFlowRegistry.d.ts.map +1 -1
  126. package/dist/graph/reactFlowRegistry.js +3 -0
  127. package/dist/graph/reactFlowRegistry.js.map +1 -1
  128. package/dist/hooks/use-toast.d.ts.map +1 -1
  129. package/dist/hooks/use-toast.js +3 -0
  130. package/dist/hooks/use-toast.js.map +1 -1
  131. package/dist/hooks/useAvailableVariables.d.ts.map +1 -1
  132. package/dist/hooks/useAvailableVariables.js +3 -0
  133. package/dist/hooks/useAvailableVariables.js.map +1 -1
  134. package/dist/hooks/useCanvasHistory.d.ts.map +1 -1
  135. package/dist/hooks/useCanvasHistory.js +3 -0
  136. package/dist/hooks/useCanvasHistory.js.map +1 -1
  137. package/dist/hooks/useCanvasTabs.d.ts.map +1 -1
  138. package/dist/hooks/useCanvasTabs.js +3 -0
  139. package/dist/hooks/useCanvasTabs.js.map +1 -1
  140. package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -1
  141. package/dist/hooks/useFunctionDiagnosticsSync.js +3 -0
  142. package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -1
  143. package/dist/hooks/useFunctionRegistry.d.ts.map +1 -1
  144. package/dist/hooks/useFunctionRegistry.js +3 -0
  145. package/dist/hooks/useFunctionRegistry.js.map +1 -1
  146. package/dist/hooks/useFunctions.d.ts.map +1 -1
  147. package/dist/hooks/useFunctions.js +3 -0
  148. package/dist/hooks/useFunctions.js.map +1 -1
  149. package/dist/hooks/useGraph.d.ts.map +1 -1
  150. package/dist/hooks/useGraph.js +3 -0
  151. package/dist/hooks/useGraph.js.map +1 -1
  152. package/dist/hooks/useNodeDefinitions.d.ts.map +1 -1
  153. package/dist/hooks/useNodeDefinitions.js +3 -0
  154. package/dist/hooks/useNodeDefinitions.js.map +1 -1
  155. package/dist/hooks/useParamErrors.d.ts.map +1 -1
  156. package/dist/hooks/useParamErrors.js +3 -0
  157. package/dist/hooks/useParamErrors.js.map +1 -1
  158. package/dist/hooks/useResolvedTheme.d.ts.map +1 -1
  159. package/dist/hooks/useResolvedTheme.js +3 -0
  160. package/dist/hooks/useResolvedTheme.js.map +1 -1
  161. package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -1
  162. package/dist/hooks/useResourceDiagnosticsSync.js +3 -0
  163. package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -1
  164. package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -1
  165. package/dist/hooks/useSuppressThemeTransition.js +3 -0
  166. package/dist/hooks/useSuppressThemeTransition.js.map +1 -1
  167. package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -1
  168. package/dist/hooks/useWorkflowSerialization.js +3 -0
  169. package/dist/hooks/useWorkflowSerialization.js.map +1 -1
  170. package/dist/i18n/index.d.ts.map +1 -1
  171. package/dist/i18n/index.js +3 -0
  172. package/dist/i18n/index.js.map +1 -1
  173. package/dist/index.d.ts +1 -1
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +3 -0
  176. package/dist/index.js.map +1 -1
  177. package/dist/inputs/ExpressionInput.d.ts.map +1 -1
  178. package/dist/inputs/ExpressionInput.js +3 -0
  179. package/dist/inputs/ExpressionInput.js.map +1 -1
  180. package/dist/inputs/ParameterEditor.d.ts.map +1 -1
  181. package/dist/inputs/ParameterEditor.js +3 -0
  182. package/dist/inputs/ParameterEditor.js.map +1 -1
  183. package/dist/inputs/PortSection.d.ts.map +1 -1
  184. package/dist/inputs/PortSection.js.map +1 -1
  185. package/dist/mode.d.ts +11 -0
  186. package/dist/mode.d.ts.map +1 -0
  187. package/dist/mode.js +8 -0
  188. package/dist/mode.js.map +1 -0
  189. package/dist/panels/BuilderSidebar.d.ts.map +1 -1
  190. package/dist/panels/BuilderSidebar.js +3 -0
  191. package/dist/panels/BuilderSidebar.js.map +1 -1
  192. package/dist/panels/ChannelConfigPanel.d.ts.map +1 -1
  193. package/dist/panels/ChannelConfigPanel.js +3 -0
  194. package/dist/panels/ChannelConfigPanel.js.map +1 -1
  195. package/dist/panels/ChannelsPanel.d.ts.map +1 -1
  196. package/dist/panels/ChannelsPanel.js +3 -0
  197. package/dist/panels/ChannelsPanel.js.map +1 -1
  198. package/dist/panels/DebugConsolePanel.d.ts.map +1 -1
  199. package/dist/panels/DebugConsolePanel.js +3 -0
  200. package/dist/panels/DebugConsolePanel.js.map +1 -1
  201. package/dist/panels/DebugContextPanel.d.ts.map +1 -1
  202. package/dist/panels/DebugContextPanel.js +3 -0
  203. package/dist/panels/DebugContextPanel.js.map +1 -1
  204. package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -1
  205. package/dist/panels/DebugExternalIOPanel.js +3 -0
  206. package/dist/panels/DebugExternalIOPanel.js.map +1 -1
  207. package/dist/panels/DiagnosticsPanel.d.ts.map +1 -1
  208. package/dist/panels/DiagnosticsPanel.js +3 -0
  209. package/dist/panels/DiagnosticsPanel.js.map +1 -1
  210. package/dist/panels/EdgeConfigPanel.d.ts.map +1 -1
  211. package/dist/panels/EdgeConfigPanel.js +4 -1
  212. package/dist/panels/EdgeConfigPanel.js.map +1 -1
  213. package/dist/panels/FunctionConfigPanel.d.ts.map +1 -1
  214. package/dist/panels/FunctionConfigPanel.js +4 -1
  215. package/dist/panels/FunctionConfigPanel.js.map +1 -1
  216. package/dist/panels/FunctionListPanel.d.ts.map +1 -1
  217. package/dist/panels/FunctionListPanel.js +3 -0
  218. package/dist/panels/FunctionListPanel.js.map +1 -1
  219. package/dist/panels/MemoryConfigPanel.d.ts.map +1 -1
  220. package/dist/panels/MemoryConfigPanel.js +3 -0
  221. package/dist/panels/MemoryConfigPanel.js.map +1 -1
  222. package/dist/panels/MemoryPanel.d.ts.map +1 -1
  223. package/dist/panels/MemoryPanel.js +3 -0
  224. package/dist/panels/MemoryPanel.js.map +1 -1
  225. package/dist/panels/ModelConfigPanel.d.ts.map +1 -1
  226. package/dist/panels/ModelConfigPanel.js +3 -0
  227. package/dist/panels/ModelConfigPanel.js.map +1 -1
  228. package/dist/panels/ModelsPanel.d.ts.map +1 -1
  229. package/dist/panels/ModelsPanel.js +3 -0
  230. package/dist/panels/ModelsPanel.js.map +1 -1
  231. package/dist/panels/NodeConfigPanel.d.ts.map +1 -1
  232. package/dist/panels/NodeConfigPanel.js +4 -1
  233. package/dist/panels/NodeConfigPanel.js.map +1 -1
  234. package/dist/panels/NodeLibrary.d.ts.map +1 -1
  235. package/dist/panels/NodeLibrary.js +4 -1
  236. package/dist/panels/NodeLibrary.js.map +1 -1
  237. package/dist/panels/ResourceConfigPanel.d.ts.map +1 -1
  238. package/dist/panels/ResourceConfigPanel.js +4 -1
  239. package/dist/panels/ResourceConfigPanel.js.map +1 -1
  240. package/dist/panels/ResourceListPanel.d.ts.map +1 -1
  241. package/dist/panels/ResourceListPanel.js +4 -1
  242. package/dist/panels/ResourceListPanel.js.map +1 -1
  243. package/dist/panels/VariableConfigPanel.d.ts.map +1 -1
  244. package/dist/panels/VariableConfigPanel.js +4 -1
  245. package/dist/panels/VariableConfigPanel.js.map +1 -1
  246. package/dist/panels/VariablesPanel.d.ts.map +1 -1
  247. package/dist/panels/VariablesPanel.js +4 -1
  248. package/dist/panels/VariablesPanel.js.map +1 -1
  249. package/dist/stores/canvasStore.d.ts.map +1 -1
  250. package/dist/stores/canvasStore.js +3 -0
  251. package/dist/stores/canvasStore.js.map +1 -1
  252. package/dist/stores/debugStore.d.ts.map +1 -1
  253. package/dist/stores/debugStore.js +3 -0
  254. package/dist/stores/debugStore.js.map +1 -1
  255. package/dist/stores/diagnosticsStore.d.ts.map +1 -1
  256. package/dist/stores/diagnosticsStore.js +3 -0
  257. package/dist/stores/diagnosticsStore.js.map +1 -1
  258. package/dist/stores/editorStore.d.ts +1 -1
  259. package/dist/stores/editorStore.d.ts.map +1 -1
  260. package/dist/stores/editorStore.js +3 -0
  261. package/dist/stores/editorStore.js.map +1 -1
  262. package/dist/utils/categoryConstants.d.ts.map +1 -1
  263. package/dist/utils/categoryConstants.js +3 -0
  264. package/dist/utils/categoryConstants.js.map +1 -1
  265. package/dist/utils/channelOperations.d.ts.map +1 -1
  266. package/dist/utils/channelOperations.js +3 -0
  267. package/dist/utils/channelOperations.js.map +1 -1
  268. package/dist/utils/connectionRules.d.ts +3 -1
  269. package/dist/utils/connectionRules.d.ts.map +1 -1
  270. package/dist/utils/connectionRules.js +11 -16
  271. package/dist/utils/connectionRules.js.map +1 -1
  272. package/dist/utils/functionOperations.d.ts.map +1 -1
  273. package/dist/utils/functionOperations.js +3 -0
  274. package/dist/utils/functionOperations.js.map +1 -1
  275. package/dist/utils/graphOperations.d.ts.map +1 -1
  276. package/dist/utils/graphOperations.js +3 -0
  277. package/dist/utils/graphOperations.js.map +1 -1
  278. package/dist/utils/history.d.ts.map +1 -1
  279. package/dist/utils/history.js +4 -1
  280. package/dist/utils/history.js.map +1 -1
  281. package/dist/utils/memoryOperations.d.ts.map +1 -1
  282. package/dist/utils/memoryOperations.js +3 -0
  283. package/dist/utils/memoryOperations.js.map +1 -1
  284. package/dist/utils/migrateFunctionNodes.d.ts.map +1 -1
  285. package/dist/utils/migrateFunctionNodes.js +3 -0
  286. package/dist/utils/migrateFunctionNodes.js.map +1 -1
  287. package/dist/utils/modelOperations.d.ts.map +1 -1
  288. package/dist/utils/modelOperations.js +3 -0
  289. package/dist/utils/modelOperations.js.map +1 -1
  290. package/dist/utils/paramDisplay.d.ts.map +1 -1
  291. package/dist/utils/paramDisplay.js +3 -0
  292. package/dist/utils/paramDisplay.js.map +1 -1
  293. package/dist/utils/resourceHelpers.d.ts.map +1 -1
  294. package/dist/utils/resourceHelpers.js +3 -0
  295. package/dist/utils/resourceHelpers.js.map +1 -1
  296. package/dist/utils/translation.d.ts.map +1 -1
  297. package/dist/utils/translation.js +3 -0
  298. package/dist/utils/translation.js.map +1 -1
  299. package/dist/utils/variableOperations.d.ts.map +1 -1
  300. package/dist/utils/variableOperations.js +3 -0
  301. package/dist/utils/variableOperations.js.map +1 -1
  302. package/package.json +2 -2
  303. package/src/BuilderLayout.tsx +338 -345
  304. package/src/Canvas.tsx +270 -261
  305. package/src/CanvasEditor.tsx +146 -142
  306. package/src/CanvasTabsToolbar.tsx +180 -176
  307. package/src/RightConfigPanel.tsx +270 -266
  308. package/src/WorkflowBuilder.tsx +423 -408
  309. package/src/cn.ts +10 -6
  310. package/src/components/ui/add-button.tsx +43 -39
  311. package/src/components/ui/alert-dialog.tsx +145 -141
  312. package/src/components/ui/alert.tsx +63 -59
  313. package/src/components/ui/badge.tsx +40 -36
  314. package/src/components/ui/button.tsx +89 -85
  315. package/src/components/ui/card.tsx +83 -79
  316. package/src/components/ui/checkbox.tsx +32 -28
  317. package/src/components/ui/collapsible.tsx +13 -9
  318. package/src/components/ui/command.tsx +157 -153
  319. package/src/components/ui/delete-button.tsx +27 -23
  320. package/src/components/ui/dialog.tsx +129 -125
  321. package/src/components/ui/dropdown-menu.tsx +202 -198
  322. package/src/components/ui/input.tsx +59 -55
  323. package/src/components/ui/label.tsx +28 -24
  324. package/src/components/ui/readonly-banner.tsx +19 -15
  325. package/src/components/ui/resizable.tsx +47 -43
  326. package/src/components/ui/scroll-area.tsx +106 -102
  327. package/src/components/ui/select.tsx +164 -160
  328. package/src/components/ui/separator.tsx +33 -29
  329. package/src/components/ui/switch.tsx +31 -27
  330. package/src/components/ui/textarea.tsx +55 -51
  331. package/src/components/ui/toast.tsx +131 -127
  332. package/src/components/ui/toaster.tsx +37 -33
  333. package/src/components/ui/toggle-group.tsx +63 -59
  334. package/src/components/ui/toggle.tsx +47 -43
  335. package/src/components/ui/tooltip.tsx +36 -32
  336. package/src/dialogs/NodePickerDialog.tsx +88 -84
  337. package/src/dialogs/ValidationDialog.tsx +188 -184
  338. package/src/graph/BaseNode.tsx +563 -557
  339. package/src/graph/CustomEdge.tsx +189 -185
  340. package/src/graph/CustomNode.tsx +20 -16
  341. package/src/graph/FunctionCallNode.tsx +34 -30
  342. package/src/graph/PortHandle.tsx +193 -189
  343. package/src/graph/reactFlowRegistry.ts +30 -26
  344. package/src/hooks/use-toast.ts +129 -125
  345. package/src/hooks/useAvailableVariables.ts +24 -20
  346. package/src/hooks/useCanvasHistory.ts +26 -22
  347. package/src/hooks/useCanvasTabs.ts +172 -168
  348. package/src/hooks/useFunctionDiagnosticsSync.ts +44 -40
  349. package/src/hooks/useFunctionRegistry.ts +30 -26
  350. package/src/hooks/useFunctions.ts +48 -44
  351. package/src/hooks/useGraph.ts +165 -161
  352. package/src/hooks/useNodeDefinitions.ts +86 -82
  353. package/src/hooks/useParamErrors.ts +30 -26
  354. package/src/hooks/useResolvedTheme.ts +34 -30
  355. package/src/hooks/useResourceDiagnosticsSync.ts +62 -58
  356. package/src/hooks/useSuppressThemeTransition.ts +83 -79
  357. package/src/hooks/useWorkflowSerialization.ts +145 -141
  358. package/src/i18n/index.ts +57 -53
  359. package/src/i18n/locales/de.json +501 -501
  360. package/src/i18n/locales/en.json +557 -557
  361. package/src/index.ts +31 -27
  362. package/src/inputs/ExpressionInput.tsx +301 -297
  363. package/src/inputs/ParameterEditor.tsx +519 -515
  364. package/src/inputs/PortSection.tsx +148 -144
  365. package/src/mode.ts +15 -0
  366. package/src/panels/BuilderSidebar.tsx +305 -301
  367. package/src/panels/ChannelConfigPanel.tsx +53 -49
  368. package/src/panels/ChannelsPanel.tsx +32 -28
  369. package/src/panels/DebugConsolePanel.tsx +77 -73
  370. package/src/panels/DebugContextPanel.tsx +81 -77
  371. package/src/panels/DebugExternalIOPanel.tsx +184 -180
  372. package/src/panels/DiagnosticsPanel.tsx +174 -170
  373. package/src/panels/EdgeConfigPanel.tsx +108 -104
  374. package/src/panels/FunctionConfigPanel.tsx +183 -179
  375. package/src/panels/FunctionListPanel.tsx +49 -45
  376. package/src/panels/MemoryConfigPanel.tsx +59 -55
  377. package/src/panels/MemoryPanel.tsx +44 -40
  378. package/src/panels/ModelConfigPanel.tsx +45 -41
  379. package/src/panels/ModelsPanel.tsx +40 -36
  380. package/src/panels/NodeConfigPanel.tsx +634 -630
  381. package/src/panels/NodeLibrary.tsx +292 -288
  382. package/src/panels/ResourceConfigPanel.tsx +136 -132
  383. package/src/panels/ResourceListPanel.tsx +117 -113
  384. package/src/panels/VariableConfigPanel.tsx +165 -161
  385. package/src/panels/VariablesPanel.tsx +149 -145
  386. package/src/stores/canvasStore.test.ts +48 -44
  387. package/src/stores/canvasStore.ts +249 -245
  388. package/src/stores/debugStore.ts +78 -74
  389. package/src/stores/diagnosticsStore.ts +134 -130
  390. package/src/stores/editorStore.ts +194 -190
  391. package/src/styles/index.css +526 -526
  392. package/src/utils/categoryConstants.ts +30 -26
  393. package/src/utils/channelOperations.ts +90 -86
  394. package/src/utils/connectionRules.ts +140 -137
  395. package/src/utils/functionOperations.ts +183 -179
  396. package/src/utils/graphOperations.ts +554 -550
  397. package/src/utils/history.test.ts +92 -0
  398. package/src/utils/history.ts +211 -207
  399. package/src/utils/memoryOperations.ts +61 -57
  400. package/src/utils/migrateFunctionNodes.ts +111 -107
  401. package/src/utils/modelOperations.ts +59 -55
  402. package/src/utils/paramDisplay.ts +75 -71
  403. package/src/utils/resourceHelpers.ts +36 -32
  404. package/src/utils/translation.ts +32 -28
  405. package/src/utils/variableOperations.ts +79 -75
  406. package/tailwind-preset.ts +170 -166
  407. package/dist/lib/utils.d.ts +0 -3
  408. package/dist/lib/utils.d.ts.map +0 -1
  409. package/dist/lib/utils.js +0 -6
  410. package/dist/lib/utils.js.map +0 -1
  411. package/dist/toolbars/CanvasTabsToolbar.d.ts +0 -11
  412. package/dist/toolbars/CanvasTabsToolbar.d.ts.map +0 -1
  413. package/dist/toolbars/CanvasTabsToolbar.js +0 -101
  414. package/dist/toolbars/CanvasTabsToolbar.js.map +0 -1
@@ -1,26 +1,30 @@
1
- // Shared category icons and colors for node categories in the workflow builder.
2
-
3
- import { NodeCategory } from "@foresthubai/workflow-core/node";
4
- import { Bot, Box, Brain, Inbox, Send, Variable, Wrench, Zap, type LucideIcon } from "lucide-react";
5
-
6
- export const categoryIcons: Record<string, LucideIcon> = {
7
- [NodeCategory.Input]: Inbox,
8
- [NodeCategory.Logic]: Brain,
9
- [NodeCategory.Data]: Variable,
10
- [NodeCategory.Output]: Send,
11
- [NodeCategory.AI]: Bot,
12
- [NodeCategory.Trigger]: Zap,
13
- [NodeCategory.Tool]: Wrench,
14
- [NodeCategory.Function]: Box,
15
- };
16
-
17
- export const categoryColors: Record<string, string> = {
18
- [NodeCategory.Input]: "bg-node-input/10 text-node-input border-node-input/20",
19
- [NodeCategory.Logic]: "bg-node-logic/10 text-node-logic border-node-logic/20",
20
- [NodeCategory.Data]: "bg-node-data/10 text-node-data border-node-data/20",
21
- [NodeCategory.Output]: "bg-node-output/10 text-node-output border-node-output/20",
22
- [NodeCategory.AI]: "bg-node-agent/10 text-node-agent border-node-agent/20",
23
- [NodeCategory.Trigger]: "bg-node-trigger/10 text-node-trigger border-node-trigger/20",
24
- [NodeCategory.Tool]: "bg-node-tool/10 text-node-tool border-node-tool/20",
25
- [NodeCategory.Function]: "bg-node-function/10 text-node-function border-node-function/20",
26
- };
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 ForestHub. All rights reserved.
3
+ // For commercial licensing, contact root@foresthub.ai
4
+
5
+ // Shared category icons and colors for node categories in the workflow builder.
6
+
7
+ import { NodeCategory } from "@foresthubai/workflow-core/node";
8
+ import { Bot, Box, Brain, Inbox, Send, Variable, Wrench, Zap, type LucideIcon } from "lucide-react";
9
+
10
+ export const categoryIcons: Record<string, LucideIcon> = {
11
+ [NodeCategory.Input]: Inbox,
12
+ [NodeCategory.Logic]: Brain,
13
+ [NodeCategory.Data]: Variable,
14
+ [NodeCategory.Output]: Send,
15
+ [NodeCategory.AI]: Bot,
16
+ [NodeCategory.Trigger]: Zap,
17
+ [NodeCategory.Tool]: Wrench,
18
+ [NodeCategory.Function]: Box,
19
+ };
20
+
21
+ export const categoryColors: Record<string, string> = {
22
+ [NodeCategory.Input]: "bg-node-input/10 text-node-input border-node-input/20",
23
+ [NodeCategory.Logic]: "bg-node-logic/10 text-node-logic border-node-logic/20",
24
+ [NodeCategory.Data]: "bg-node-data/10 text-node-data border-node-data/20",
25
+ [NodeCategory.Output]: "bg-node-output/10 text-node-output border-node-output/20",
26
+ [NodeCategory.AI]: "bg-node-agent/10 text-node-agent border-node-agent/20",
27
+ [NodeCategory.Trigger]: "bg-node-trigger/10 text-node-trigger border-node-trigger/20",
28
+ [NodeCategory.Tool]: "bg-node-tool/10 text-node-tool border-node-tool/20",
29
+ [NodeCategory.Function]: "bg-node-function/10 text-node-function border-node-function/20",
30
+ };
@@ -1,86 +1,90 @@
1
- import { CHANNEL_DEFINITION, type ChannelType, type Channel } from "@foresthubai/workflow-core/channel";
2
- import { isParameterActive } from "@foresthubai/workflow-core/parameter";
3
- import { useEditorStore } from "../stores/editorStore";
4
- import { generateId } from "@foresthubai/workflow-core/id";
5
- import { uniqueName } from "./resourceHelpers";
6
-
7
- /**
8
- * Build the initial `arguments` record for a new channel: each parameter
9
- * that's active for the chosen `type` and has a `default` gets seeded.
10
- */
11
- function defaultArguments(type: ChannelType): Record<string, unknown> {
12
- const seed: Record<string, unknown> = { type };
13
- const args: Record<string, unknown> = {};
14
- for (const param of CHANNEL_DEFINITION.parameters) {
15
- if (param.id === "type") continue;
16
- if (param.activationRules?.length && !isParameterActive(param, seed, false)) continue;
17
- if ("default" in param && param.default !== undefined) {
18
- args[param.id] = param.default;
19
- }
20
- }
21
- return args;
22
- }
23
-
24
- /**
25
- * Create a new channel in the editor store. Returns the new instance.
26
- */
27
- export function addChannel(type: ChannelType = "GPIOIN"): Channel {
28
- const id = generateId();
29
- const existing = Object.values(useEditorStore.getState().channels).map((v) => v.label);
30
- const instance: Channel = {
31
- id,
32
- label: uniqueName("channel", existing),
33
- type,
34
- arguments: defaultArguments(type),
35
- };
36
- useEditorStore.getState().setChannels((vars) => ({ ...vars, [id]: instance }));
37
- return instance;
38
- }
39
-
40
- /**
41
- * Apply a partial patch to a channel. Inactive arguments are intentionally
42
- * retained in the store: the domain store is the superset and stripping happens
43
- * only at the api boundary (`serialize`), so switching `type` away and back
44
- * restores previously-entered values rather than resetting them. On a type
45
- * change we still seed defaults for params that are newly active and unset, so
46
- * the config panel shows sensible initial values. Top-level fields (label/type)
47
- * are merged separately from arguments.
48
- */
49
- export function updateChannel(id: string, patch: { label?: string; type?: ChannelType; arguments?: Record<string, unknown> }): void {
50
- const key = id;
51
- useEditorStore.getState().setChannels((vars) => {
52
- const existing = vars[key];
53
- if (!existing) return vars;
54
-
55
- const nextType = patch.type ?? existing.type;
56
- const mergedArgs = { ...existing.arguments, ...(patch.arguments ?? {}) };
57
-
58
- if (patch.type && patch.type !== existing.type) {
59
- for (const [k, v] of Object.entries(defaultArguments(nextType))) {
60
- if (mergedArgs[k] === undefined) mergedArgs[k] = v;
61
- }
62
- }
63
-
64
- return {
65
- ...vars,
66
- [key]: {
67
- ...existing,
68
- ...(patch.label !== undefined ? { label: patch.label } : {}),
69
- type: nextType,
70
- arguments: mergedArgs,
71
- },
72
- };
73
- });
74
- }
75
-
76
- export function deleteChannel(id: string): void {
77
- const key = id;
78
- useEditorStore.getState().setChannels((vars) => {
79
- const { [key]: _drop, ...rest } = vars;
80
- return rest;
81
- });
82
- const sel = useEditorStore.getState().selection;
83
- if (sel.kind === "channel" && sel.id === id) {
84
- useEditorStore.getState().clearSelection();
85
- }
86
- }
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 ForestHub. All rights reserved.
3
+ // For commercial licensing, contact root@foresthub.ai
4
+
5
+ import { CHANNEL_DEFINITION, type ChannelType, type Channel } from "@foresthubai/workflow-core/channel";
6
+ import { isParameterActive } from "@foresthubai/workflow-core/parameter";
7
+ import { useEditorStore } from "../stores/editorStore";
8
+ import { generateId } from "@foresthubai/workflow-core/id";
9
+ import { uniqueName } from "./resourceHelpers";
10
+
11
+ /**
12
+ * Build the initial `arguments` record for a new channel: each parameter
13
+ * that's active for the chosen `type` and has a `default` gets seeded.
14
+ */
15
+ function defaultArguments(type: ChannelType): Record<string, unknown> {
16
+ const seed: Record<string, unknown> = { type };
17
+ const args: Record<string, unknown> = {};
18
+ for (const param of CHANNEL_DEFINITION.parameters) {
19
+ if (param.id === "type") continue;
20
+ if (param.activationRules?.length && !isParameterActive(param, seed, false)) continue;
21
+ if ("default" in param && param.default !== undefined) {
22
+ args[param.id] = param.default;
23
+ }
24
+ }
25
+ return args;
26
+ }
27
+
28
+ /**
29
+ * Create a new channel in the editor store. Returns the new instance.
30
+ */
31
+ export function addChannel(type: ChannelType = "GPIOIN"): Channel {
32
+ const id = generateId();
33
+ const existing = Object.values(useEditorStore.getState().channels).map((v) => v.label);
34
+ const instance: Channel = {
35
+ id,
36
+ label: uniqueName("channel", existing),
37
+ type,
38
+ arguments: defaultArguments(type),
39
+ };
40
+ useEditorStore.getState().setChannels((vars) => ({ ...vars, [id]: instance }));
41
+ return instance;
42
+ }
43
+
44
+ /**
45
+ * Apply a partial patch to a channel. Inactive arguments are intentionally
46
+ * retained in the store: the domain store is the superset and stripping happens
47
+ * only at the api boundary (`serialize`), so switching `type` away and back
48
+ * restores previously-entered values rather than resetting them. On a type
49
+ * change we still seed defaults for params that are newly active and unset, so
50
+ * the config panel shows sensible initial values. Top-level fields (label/type)
51
+ * are merged separately from arguments.
52
+ */
53
+ export function updateChannel(id: string, patch: { label?: string; type?: ChannelType; arguments?: Record<string, unknown> }): void {
54
+ const key = id;
55
+ useEditorStore.getState().setChannels((vars) => {
56
+ const existing = vars[key];
57
+ if (!existing) return vars;
58
+
59
+ const nextType = patch.type ?? existing.type;
60
+ const mergedArgs = { ...existing.arguments, ...(patch.arguments ?? {}) };
61
+
62
+ if (patch.type && patch.type !== existing.type) {
63
+ for (const [k, v] of Object.entries(defaultArguments(nextType))) {
64
+ if (mergedArgs[k] === undefined) mergedArgs[k] = v;
65
+ }
66
+ }
67
+
68
+ return {
69
+ ...vars,
70
+ [key]: {
71
+ ...existing,
72
+ ...(patch.label !== undefined ? { label: patch.label } : {}),
73
+ type: nextType,
74
+ arguments: mergedArgs,
75
+ },
76
+ };
77
+ });
78
+ }
79
+
80
+ export function deleteChannel(id: string): void {
81
+ const key = id;
82
+ useEditorStore.getState().setChannels((vars) => {
83
+ const { [key]: _drop, ...rest } = vars;
84
+ return rest;
85
+ });
86
+ const sel = useEditorStore.getState().selection;
87
+ if (sel.kind === "channel" && sel.id === id) {
88
+ useEditorStore.getState().clearSelection();
89
+ }
90
+ }
@@ -1,137 +1,140 @@
1
- // Editor connection rules — which ports may connect, which node types are
2
- // offered from a port, and whether a node can take another outgoing edge.
3
- //
4
- // These operate on React Flow `Node`/`Edge` and drive canvas interactions, so
5
- // they live here in the editor rather than in the headless @foresthubai/workflow-core.
6
- // Core exposes the pure primitive (`getPorts`); the React Flow coupling stays
7
- // on this side of the boundary.
8
-
9
- import { Edge, Node } from "@xyflow/react";
10
- import { getPorts, NodeRegistry, type NodeData, type NodeDefinition } from "@foresthubai/workflow-core/node";
11
- import { type EdgeType } from "@foresthubai/workflow-core/edge";
12
-
13
- /** Check whether a node already has tool-input edges (for mutual exclusion). */
14
- function hasToolInputEdge(nodeId: string, nodeData: NodeData, edges: Edge[]): boolean {
15
- const ports = getPorts(nodeData);
16
- return edges.some((e) => e.target === nodeId && ports.input.some((p) => p.type === "tool" && p.id === e.targetHandle));
17
- }
18
-
19
- /** Check whether a node already has control-flow edges (for mutual exclusion). */
20
- function hasControlFlowEdge(nodeId: string, nodeData: NodeData, edges: Edge[]): boolean {
21
- const ports = getPorts(nodeData);
22
- return edges.some((e) => {
23
- if (e.target === nodeId) {
24
- return ports.input.some((p) => p.type === "control" && p.id === e.targetHandle);
25
- }
26
- if (e.source === nodeId) {
27
- return ports.output.some((p) => p.type === "control" && p.id === e.sourceHandle);
28
- }
29
- return false;
30
- });
31
- }
32
-
33
- /**
34
- * Check whether an output port can accept at least one more outgoing edge.
35
- * Used by the contextual "+" button on output ports.
36
- */
37
- export function canPortAcceptEdge(nodeId: string, handleId: string, nodes: Node<NodeData>[], edges: Edge[]): boolean {
38
- const node = nodes.find((n) => n.id === nodeId);
39
- if (!node) return false;
40
-
41
- const ports = getPorts(node.data);
42
- const port = ports.output.find((p) => p.id === handleId);
43
- if (!port) return false;
44
-
45
- // Tool output ports always accept multiple edges (an agent wires up many tools).
46
- // A control output port accepts a single edge unless the node can branch.
47
- if (port.type === "control" && !NodeRegistry.getByType(node.data.type)?.canBranch) {
48
- if (edges.some((e) => e.source === nodeId && e.sourceHandle === handleId)) return false;
49
- }
50
-
51
- // Mutual exclusion: control output blocked when node has tool-input edges
52
- // (Tool output is exempt — never blocked)
53
- if (port.type === "control" && hasToolInputEdge(nodeId, node.data, edges)) return false;
54
-
55
- return true;
56
- }
57
-
58
- /**
59
- * Filter node definitions to those that can connect to a given output port.
60
- * Returns definitions whose nodes have an input port matching the origin's port type.
61
- */
62
- export function getCompatibleNodeDefs(
63
- originNodeId: string,
64
- originHandleId: string,
65
- nodes: Node<NodeData>[],
66
- edges: Edge[],
67
- allNodeDefs: NodeDefinition[],
68
- isFunctionCanvas: boolean,
69
- ): NodeDefinition[] {
70
- const originNode = nodes.find((n) => n.id === originNodeId);
71
- if (!originNode) return [];
72
-
73
- const originPorts = getPorts(originNode.data);
74
- const originPort = originPorts.output.find((p) => p.id === originHandleId);
75
- if (!originPort) return [];
76
-
77
- const originPortType = originPort.type; // "control" | "tool"
78
-
79
- return allNodeDefs.filter((def) => {
80
- if (def.isUnremovable) return false;
81
-
82
- if (def.isSingleton && nodes.some((n) => n.data.type === def.type)) return false;
83
-
84
- // Triggers have no inputs — skip on function canvas and when looking for input ports
85
- if (isFunctionCanvas && def.category === "Trigger") return false;
86
-
87
- // Check candidate has a matching input port
88
- const candidatePorts = getPorts({ type: def.type } as NodeData);
89
- return candidatePorts.input.some((p) => p.type === originPortType);
90
- });
91
- }
92
-
93
- export const isValidConnection = (
94
- sourceId: string | null,
95
- targetId: string | null,
96
- sourceHandleId: string | null | undefined,
97
- targetHandleId: string | null | undefined,
98
- nodes: Node<NodeData>[],
99
- edges: Edge[],
100
- ): false | EdgeType => {
101
- // All handles must be present
102
- if (sourceHandleId == null || targetHandleId == null || sourceId == null || targetId == null) return false;
103
-
104
- // Find source and target nodes
105
- const srcNode = nodes.find((n) => n.id === sourceId);
106
- const tgtNode = nodes.find((n) => n.id === targetId);
107
- if (!srcNode || !tgtNode) return false;
108
-
109
- // Source-side checks via canPortAcceptEdge (multiple-outgoing + mutual exclusion)
110
- if (!canPortAcceptEdge(sourceId, sourceHandleId, nodes, edges)) return false;
111
-
112
- // Get ports using centralized dispatcher
113
- const sourcePorts = getPorts(srcNode.data);
114
- const targetPorts = getPorts(tgtNode.data);
115
-
116
- const sourcePort = sourcePorts.output.find((p) => p.id === sourceHandleId);
117
- const targetPort = targetPorts.input.find((p) => p.id === targetHandleId);
118
- if (!sourcePort || !targetPort) return false;
119
-
120
- // Only allow connections between same port types
121
- if (sourcePort.type !== targetPort.type) return false;
122
-
123
- // Target-side mutual exclusion checks
124
- const portType = sourcePort.type as EdgeType;
125
-
126
- if (portType === "tool") {
127
- // Connecting a tool input on the target — reject if target already has control connections
128
- if (hasControlFlowEdge(tgtNode.id, tgtNode.data, edges)) return false;
129
- }
130
-
131
- if (portType === "control") {
132
- // Connecting a control port — reject if target already has tool INPUT connections
133
- if (hasToolInputEdge(tgtNode.id, tgtNode.data, edges)) return false;
134
- }
135
-
136
- return portType;
137
- };
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 ForestHub. All rights reserved.
3
+ // For commercial licensing, contact root@foresthub.ai
4
+
5
+ // Editor connection rules which ports may connect, which node types are
6
+ // offered from a port, and whether a node can take another outgoing edge.
7
+ //
8
+ // These operate on React Flow `Node`/`Edge` and drive canvas interactions, so
9
+ // they live here in the editor rather than in the headless @foresthubai/workflow-core.
10
+ // Core exposes the pure primitive (`getPorts`); the React Flow coupling stays
11
+ // on this side of the boundary.
12
+
13
+ import { Edge, Node } from "@xyflow/react";
14
+ import { getPorts, NodeRegistry, type NodeData, type NodeDefinition } from "@foresthubai/workflow-core/node";
15
+ import { type EdgeType } from "@foresthubai/workflow-core/edge";
16
+
17
+ /** Check whether a node already has tool-input edges (for mutual exclusion). */
18
+ function hasToolInputEdge(nodeId: string, nodeData: NodeData, edges: Edge[]): boolean {
19
+ const ports = getPorts(nodeData);
20
+ return edges.some((e) => e.target === nodeId && ports.input.some((p) => p.type === "tool" && p.id === e.targetHandle));
21
+ }
22
+
23
+ /** Check whether a node already has control-flow edges (for mutual exclusion). */
24
+ function hasControlFlowEdge(nodeId: string, nodeData: NodeData, edges: Edge[]): boolean {
25
+ const ports = getPorts(nodeData);
26
+ return edges.some((e) => {
27
+ if (e.target === nodeId) {
28
+ return ports.input.some((p) => p.type === "control" && p.id === e.targetHandle);
29
+ }
30
+ if (e.source === nodeId) {
31
+ return ports.output.some((p) => p.type === "control" && p.id === e.sourceHandle);
32
+ }
33
+ return false;
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Check whether an output port can accept at least one more outgoing edge.
39
+ * Used by the contextual "+" button on output ports.
40
+ * Takes the node's own data rather than the nodes array so per-node components
41
+ * (BaseNode) can call it without subscribing to all nodes.
42
+ */
43
+ export function canPortAcceptEdge(nodeData: NodeData, handleId: string, edges: Edge[]): boolean {
44
+ const ports = getPorts(nodeData);
45
+ const port = ports.output.find((p) => p.id === handleId);
46
+ if (!port) return false;
47
+
48
+ // Tool output ports always accept multiple edges (an agent wires up many tools).
49
+ // A control output port accepts a single edge unless the node can branch.
50
+ if (port.type === "control" && !NodeRegistry.getByType(nodeData.type)?.canBranch) {
51
+ if (edges.some((e) => e.source === nodeData.id && e.sourceHandle === handleId)) return false;
52
+ }
53
+
54
+ // Mutual exclusion: control output blocked when node has tool-input edges
55
+ // (Tool output is exempt — never blocked)
56
+ if (port.type === "control" && hasToolInputEdge(nodeData.id, nodeData, edges)) return false;
57
+
58
+ return true;
59
+ }
60
+
61
+ /**
62
+ * Filter node definitions to those that can connect to a given output port.
63
+ * Returns definitions whose nodes have an input port matching the origin's port type.
64
+ */
65
+ export function getCompatibleNodeDefs(
66
+ originNodeId: string,
67
+ originHandleId: string,
68
+ nodes: Node<NodeData>[],
69
+ edges: Edge[],
70
+ allNodeDefs: NodeDefinition[],
71
+ isFunctionCanvas: boolean,
72
+ ): NodeDefinition[] {
73
+ const originNode = nodes.find((n) => n.id === originNodeId);
74
+ if (!originNode) return [];
75
+
76
+ const originPorts = getPorts(originNode.data);
77
+ const originPort = originPorts.output.find((p) => p.id === originHandleId);
78
+ if (!originPort) return [];
79
+
80
+ const originPortType = originPort.type; // "control" | "tool"
81
+
82
+ return allNodeDefs.filter((def) => {
83
+ if (def.isUnremovable) return false;
84
+
85
+ if (def.isSingleton && nodes.some((n) => n.data.type === def.type)) return false;
86
+
87
+ // Triggers have no inputs skip on function canvas and when looking for input ports
88
+ if (isFunctionCanvas && def.category === "Trigger") return false;
89
+
90
+ // Check candidate has a matching input port
91
+ const candidatePorts = getPorts({ type: def.type } as NodeData);
92
+ return candidatePorts.input.some((p) => p.type === originPortType);
93
+ });
94
+ }
95
+
96
+ export const isValidConnection = (
97
+ sourceId: string | null,
98
+ targetId: string | null,
99
+ sourceHandleId: string | null | undefined,
100
+ targetHandleId: string | null | undefined,
101
+ nodes: Node<NodeData>[],
102
+ edges: Edge[],
103
+ ): false | EdgeType => {
104
+ // All handles must be present
105
+ if (sourceHandleId == null || targetHandleId == null || sourceId == null || targetId == null) return false;
106
+
107
+ // Find source and target nodes
108
+ const srcNode = nodes.find((n) => n.id === sourceId);
109
+ const tgtNode = nodes.find((n) => n.id === targetId);
110
+ if (!srcNode || !tgtNode) return false;
111
+
112
+ // Source-side checks via canPortAcceptEdge (multiple-outgoing + mutual exclusion)
113
+ if (!canPortAcceptEdge(srcNode.data, sourceHandleId, edges)) return false;
114
+
115
+ // Get ports using centralized dispatcher
116
+ const sourcePorts = getPorts(srcNode.data);
117
+ const targetPorts = getPorts(tgtNode.data);
118
+
119
+ const sourcePort = sourcePorts.output.find((p) => p.id === sourceHandleId);
120
+ const targetPort = targetPorts.input.find((p) => p.id === targetHandleId);
121
+ if (!sourcePort || !targetPort) return false;
122
+
123
+ // Only allow connections between same port types
124
+ if (sourcePort.type !== targetPort.type) return false;
125
+
126
+ // Target-side mutual exclusion checks
127
+ const portType = sourcePort.type as EdgeType;
128
+
129
+ if (portType === "tool") {
130
+ // Connecting a tool input on the target — reject if target already has control connections
131
+ if (hasControlFlowEdge(tgtNode.id, tgtNode.data, edges)) return false;
132
+ }
133
+
134
+ if (portType === "control") {
135
+ // Connecting a control port — reject if target already has tool INPUT connections
136
+ if (hasToolInputEdge(tgtNode.id, tgtNode.data, edges)) return false;
137
+ }
138
+
139
+ return portType;
140
+ };