@foresthubai/workflow-builder 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (496) hide show
  1. package/LICENSE +661 -0
  2. package/NOTICE +16 -0
  3. package/README.md +93 -0
  4. package/dist/BuilderLayout.d.ts +34 -0
  5. package/dist/BuilderLayout.d.ts.map +1 -0
  6. package/dist/BuilderLayout.js +172 -0
  7. package/dist/BuilderLayout.js.map +1 -0
  8. package/dist/Canvas.d.ts +23 -0
  9. package/dist/Canvas.d.ts.map +1 -0
  10. package/dist/Canvas.js +141 -0
  11. package/dist/Canvas.js.map +1 -0
  12. package/dist/CanvasEditor.d.ts +46 -0
  13. package/dist/CanvasEditor.d.ts.map +1 -0
  14. package/dist/CanvasEditor.js +57 -0
  15. package/dist/CanvasEditor.js.map +1 -0
  16. package/dist/CanvasTabsToolbar.d.ts +11 -0
  17. package/dist/CanvasTabsToolbar.d.ts.map +1 -0
  18. package/dist/CanvasTabsToolbar.js +101 -0
  19. package/dist/CanvasTabsToolbar.js.map +1 -0
  20. package/dist/RightConfigPanel.d.ts +27 -0
  21. package/dist/RightConfigPanel.d.ts.map +1 -0
  22. package/dist/RightConfigPanel.js +102 -0
  23. package/dist/RightConfigPanel.js.map +1 -0
  24. package/dist/WorkflowBuilder.d.ts +62 -0
  25. package/dist/WorkflowBuilder.d.ts.map +1 -0
  26. package/dist/WorkflowBuilder.js +275 -0
  27. package/dist/WorkflowBuilder.js.map +1 -0
  28. package/dist/cn.d.ts +3 -0
  29. package/dist/cn.d.ts.map +1 -0
  30. package/dist/cn.js +6 -0
  31. package/dist/cn.js.map +1 -0
  32. package/dist/components/ui/add-button.d.ts +16 -0
  33. package/dist/components/ui/add-button.d.ts.map +1 -0
  34. package/dist/components/ui/add-button.js +21 -0
  35. package/dist/components/ui/add-button.js.map +1 -0
  36. package/dist/components/ui/alert-dialog.d.ts +21 -0
  37. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  38. package/dist/components/ui/alert-dialog.js +30 -0
  39. package/dist/components/ui/alert-dialog.js.map +1 -0
  40. package/dist/components/ui/alert.d.ts +9 -0
  41. package/dist/components/ui/alert.d.ts.map +1 -0
  42. package/dist/components/ui/alert.js +23 -0
  43. package/dist/components/ui/alert.js.map +1 -0
  44. package/dist/components/ui/badge.d.ts +10 -0
  45. package/dist/components/ui/badge.d.ts.map +1 -0
  46. package/dist/components/ui/badge.js +21 -0
  47. package/dist/components/ui/badge.js.map +1 -0
  48. package/dist/components/ui/button.d.ts +13 -0
  49. package/dist/components/ui/button.d.ts.map +1 -0
  50. package/dist/components/ui/button.js +40 -0
  51. package/dist/components/ui/button.js.map +1 -0
  52. package/dist/components/ui/card.d.ts +9 -0
  53. package/dist/components/ui/card.d.ts.map +1 -0
  54. package/dist/components/ui/card.js +17 -0
  55. package/dist/components/ui/card.js.map +1 -0
  56. package/dist/components/ui/checkbox.d.ts +5 -0
  57. package/dist/components/ui/checkbox.d.ts.map +1 -0
  58. package/dist/components/ui/checkbox.js +9 -0
  59. package/dist/components/ui/checkbox.js.map +1 -0
  60. package/dist/components/ui/collapsible.d.ts +6 -0
  61. package/dist/components/ui/collapsible.d.ts.map +1 -0
  62. package/dist/components/ui/collapsible.js +6 -0
  63. package/dist/components/ui/collapsible.js.map +1 -0
  64. package/dist/components/ui/command.d.ts +82 -0
  65. package/dist/components/ui/command.d.ts.map +1 -0
  66. package/dist/components/ui/command.js +29 -0
  67. package/dist/components/ui/command.js.map +1 -0
  68. package/dist/components/ui/delete-button.d.ts +11 -0
  69. package/dist/components/ui/delete-button.d.ts.map +1 -0
  70. package/dist/components/ui/delete-button.js +14 -0
  71. package/dist/components/ui/delete-button.js.map +1 -0
  72. package/dist/components/ui/dialog.d.ts +22 -0
  73. package/dist/components/ui/dialog.d.ts.map +1 -0
  74. package/dist/components/ui/dialog.js +27 -0
  75. package/dist/components/ui/dialog.js.map +1 -0
  76. package/dist/components/ui/dropdown-menu.d.ts +28 -0
  77. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  78. package/dist/components/ui/dropdown-menu.js +36 -0
  79. package/dist/components/ui/dropdown-menu.js.map +1 -0
  80. package/dist/components/ui/input.d.ts +13 -0
  81. package/dist/components/ui/input.d.ts.map +1 -0
  82. package/dist/components/ui/input.js +34 -0
  83. package/dist/components/ui/input.js.map +1 -0
  84. package/dist/components/ui/label.d.ts +6 -0
  85. package/dist/components/ui/label.d.ts.map +1 -0
  86. package/dist/components/ui/label.js +10 -0
  87. package/dist/components/ui/label.js.map +1 -0
  88. package/dist/components/ui/readonly-banner.d.ts +7 -0
  89. package/dist/components/ui/readonly-banner.d.ts.map +1 -0
  90. package/dist/components/ui/readonly-banner.js +12 -0
  91. package/dist/components/ui/readonly-banner.js.map +1 -0
  92. package/dist/components/ui/resizable.d.ts +24 -0
  93. package/dist/components/ui/resizable.d.ts.map +1 -0
  94. package/dist/components/ui/resizable.js +9 -0
  95. package/dist/components/ui/resizable.js.map +1 -0
  96. package/dist/components/ui/scroll-area.d.ts +45 -0
  97. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  98. package/dist/components/ui/scroll-area.js +27 -0
  99. package/dist/components/ui/scroll-area.js.map +1 -0
  100. package/dist/components/ui/select.d.ts +14 -0
  101. package/dist/components/ui/select.d.ts.map +1 -0
  102. package/dist/components/ui/select.js +30 -0
  103. package/dist/components/ui/select.js.map +1 -0
  104. package/dist/components/ui/separator.d.ts +5 -0
  105. package/dist/components/ui/separator.d.ts.map +1 -0
  106. package/dist/components/ui/separator.js +8 -0
  107. package/dist/components/ui/separator.js.map +1 -0
  108. package/dist/components/ui/switch.d.ts +5 -0
  109. package/dist/components/ui/switch.d.ts.map +1 -0
  110. package/dist/components/ui/switch.js +8 -0
  111. package/dist/components/ui/switch.js.map +1 -0
  112. package/dist/components/ui/textarea.d.ts +12 -0
  113. package/dist/components/ui/textarea.d.ts.map +1 -0
  114. package/dist/components/ui/textarea.js +34 -0
  115. package/dist/components/ui/textarea.js.map +1 -0
  116. package/dist/components/ui/toast.d.ts +16 -0
  117. package/dist/components/ui/toast.d.ts.map +1 -0
  118. package/dist/components/ui/toast.js +34 -0
  119. package/dist/components/ui/toast.js.map +1 -0
  120. package/dist/components/ui/toaster.d.ts +2 -0
  121. package/dist/components/ui/toaster.d.ts.map +1 -0
  122. package/dist/components/ui/toaster.js +10 -0
  123. package/dist/components/ui/toaster.js.map +1 -0
  124. package/dist/components/ui/toggle-group.d.ts +13 -0
  125. package/dist/components/ui/toggle-group.d.ts.map +1 -0
  126. package/dist/components/ui/toggle-group.js +21 -0
  127. package/dist/components/ui/toggle-group.js.map +1 -0
  128. package/dist/components/ui/toggle.d.ts +13 -0
  129. package/dist/components/ui/toggle.d.ts.map +1 -0
  130. package/dist/components/ui/toggle.js +26 -0
  131. package/dist/components/ui/toggle.js.map +1 -0
  132. package/dist/components/ui/tooltip.d.ts +8 -0
  133. package/dist/components/ui/tooltip.d.ts.map +1 -0
  134. package/dist/components/ui/tooltip.js +14 -0
  135. package/dist/components/ui/tooltip.js.map +1 -0
  136. package/dist/dialogs/NodePickerDialog.d.ts +10 -0
  137. package/dist/dialogs/NodePickerDialog.d.ts.map +1 -0
  138. package/dist/dialogs/NodePickerDialog.js +39 -0
  139. package/dist/dialogs/NodePickerDialog.js.map +1 -0
  140. package/dist/dialogs/ValidationDialog.d.ts +17 -0
  141. package/dist/dialogs/ValidationDialog.d.ts.map +1 -0
  142. package/dist/dialogs/ValidationDialog.js +29 -0
  143. package/dist/dialogs/ValidationDialog.js.map +1 -0
  144. package/dist/graph/BaseNode.d.ts +9 -0
  145. package/dist/graph/BaseNode.d.ts.map +1 -0
  146. package/dist/graph/BaseNode.js +318 -0
  147. package/dist/graph/BaseNode.js.map +1 -0
  148. package/dist/graph/CustomEdge.d.ts +14 -0
  149. package/dist/graph/CustomEdge.d.ts.map +1 -0
  150. package/dist/graph/CustomEdge.js +107 -0
  151. package/dist/graph/CustomEdge.js.map +1 -0
  152. package/dist/graph/CustomNode.d.ts +3 -0
  153. package/dist/graph/CustomNode.d.ts.map +1 -0
  154. package/dist/graph/CustomNode.js +15 -0
  155. package/dist/graph/CustomNode.js.map +1 -0
  156. package/dist/graph/FunctionCallNode.d.ts +3 -0
  157. package/dist/graph/FunctionCallNode.d.ts.map +1 -0
  158. package/dist/graph/FunctionCallNode.js +25 -0
  159. package/dist/graph/FunctionCallNode.js.map +1 -0
  160. package/dist/graph/PortHandle.d.ts +21 -0
  161. package/dist/graph/PortHandle.d.ts.map +1 -0
  162. package/dist/graph/PortHandle.js +113 -0
  163. package/dist/graph/PortHandle.js.map +1 -0
  164. package/dist/graph/reactFlowRegistry.d.ts +65 -0
  165. package/dist/graph/reactFlowRegistry.d.ts.map +1 -0
  166. package/dist/graph/reactFlowRegistry.js +24 -0
  167. package/dist/graph/reactFlowRegistry.js.map +1 -0
  168. package/dist/hooks/use-toast.d.ts +47 -0
  169. package/dist/hooks/use-toast.d.ts.map +1 -0
  170. package/dist/hooks/use-toast.js +95 -0
  171. package/dist/hooks/use-toast.js.map +1 -0
  172. package/dist/hooks/useAvailableVariables.d.ts +12 -0
  173. package/dist/hooks/useAvailableVariables.d.ts.map +1 -0
  174. package/dist/hooks/useAvailableVariables.js +16 -0
  175. package/dist/hooks/useAvailableVariables.js.map +1 -0
  176. package/dist/hooks/useCanvasHistory.d.ts +14 -0
  177. package/dist/hooks/useCanvasHistory.d.ts.map +1 -0
  178. package/dist/hooks/useCanvasHistory.js +20 -0
  179. package/dist/hooks/useCanvasHistory.js.map +1 -0
  180. package/dist/hooks/useCanvasTabs.d.ts +23 -0
  181. package/dist/hooks/useCanvasTabs.d.ts.map +1 -0
  182. package/dist/hooks/useCanvasTabs.js +136 -0
  183. package/dist/hooks/useCanvasTabs.js.map +1 -0
  184. package/dist/hooks/useFunctionDiagnosticsSync.d.ts +14 -0
  185. package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -0
  186. package/dist/hooks/useFunctionDiagnosticsSync.js +38 -0
  187. package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -0
  188. package/dist/hooks/useFunctionRegistry.d.ts +15 -0
  189. package/dist/hooks/useFunctionRegistry.d.ts.map +1 -0
  190. package/dist/hooks/useFunctionRegistry.js +22 -0
  191. package/dist/hooks/useFunctionRegistry.js.map +1 -0
  192. package/dist/hooks/useFunctions.d.ts +15 -0
  193. package/dist/hooks/useFunctions.d.ts.map +1 -0
  194. package/dist/hooks/useFunctions.js +34 -0
  195. package/dist/hooks/useFunctions.js.map +1 -0
  196. package/dist/hooks/useGraph.d.ts +40 -0
  197. package/dist/hooks/useGraph.d.ts.map +1 -0
  198. package/dist/hooks/useGraph.js +102 -0
  199. package/dist/hooks/useGraph.js.map +1 -0
  200. package/dist/hooks/useNodeDefinitions.d.ts +17 -0
  201. package/dist/hooks/useNodeDefinitions.d.ts.map +1 -0
  202. package/dist/hooks/useNodeDefinitions.js +65 -0
  203. package/dist/hooks/useNodeDefinitions.js.map +1 -0
  204. package/dist/hooks/useParamErrors.d.ts +12 -0
  205. package/dist/hooks/useParamErrors.d.ts.map +1 -0
  206. package/dist/hooks/useParamErrors.js +28 -0
  207. package/dist/hooks/useParamErrors.js.map +1 -0
  208. package/dist/hooks/useResolvedTheme.d.ts +10 -0
  209. package/dist/hooks/useResolvedTheme.d.ts.map +1 -0
  210. package/dist/hooks/useResolvedTheme.js +29 -0
  211. package/dist/hooks/useResolvedTheme.js.map +1 -0
  212. package/dist/hooks/useResourceDiagnosticsSync.d.ts +40 -0
  213. package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -0
  214. package/dist/hooks/useResourceDiagnosticsSync.js +39 -0
  215. package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -0
  216. package/dist/hooks/useSuppressThemeTransition.d.ts +32 -0
  217. package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -0
  218. package/dist/hooks/useSuppressThemeTransition.js +75 -0
  219. package/dist/hooks/useSuppressThemeTransition.js.map +1 -0
  220. package/dist/hooks/useWorkflowSerialization.d.ts +24 -0
  221. package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -0
  222. package/dist/hooks/useWorkflowSerialization.js +113 -0
  223. package/dist/hooks/useWorkflowSerialization.js.map +1 -0
  224. package/dist/i18n/index.d.ts +4 -0
  225. package/dist/i18n/index.d.ts.map +1 -0
  226. package/dist/i18n/index.js +46 -0
  227. package/dist/i18n/index.js.map +1 -0
  228. package/dist/i18n/locales/de.json +501 -0
  229. package/dist/i18n/locales/en.json +557 -0
  230. package/dist/index.d.ts +9 -0
  231. package/dist/index.d.ts.map +1 -0
  232. package/dist/index.js +12 -0
  233. package/dist/index.js.map +1 -0
  234. package/dist/inputs/ExpressionInput.d.ts +12 -0
  235. package/dist/inputs/ExpressionInput.d.ts.map +1 -0
  236. package/dist/inputs/ExpressionInput.js +203 -0
  237. package/dist/inputs/ExpressionInput.js.map +1 -0
  238. package/dist/inputs/ParameterEditor.d.ts +13 -0
  239. package/dist/inputs/ParameterEditor.d.ts.map +1 -0
  240. package/dist/inputs/ParameterEditor.js +204 -0
  241. package/dist/inputs/ParameterEditor.js.map +1 -0
  242. package/dist/inputs/PortSection.d.ts +31 -0
  243. package/dist/inputs/PortSection.d.ts.map +1 -0
  244. package/dist/inputs/PortSection.js +26 -0
  245. package/dist/inputs/PortSection.js.map +1 -0
  246. package/dist/panels/BuilderSidebar.d.ts +24 -0
  247. package/dist/panels/BuilderSidebar.d.ts.map +1 -0
  248. package/dist/panels/BuilderSidebar.js +202 -0
  249. package/dist/panels/BuilderSidebar.js.map +1 -0
  250. package/dist/panels/ChannelConfigPanel.d.ts +8 -0
  251. package/dist/panels/ChannelConfigPanel.d.ts.map +1 -0
  252. package/dist/panels/ChannelConfigPanel.js +26 -0
  253. package/dist/panels/ChannelConfigPanel.js.map +1 -0
  254. package/dist/panels/ChannelsPanel.d.ts +2 -0
  255. package/dist/panels/ChannelsPanel.d.ts.map +1 -0
  256. package/dist/panels/ChannelsPanel.js +16 -0
  257. package/dist/panels/ChannelsPanel.js.map +1 -0
  258. package/dist/panels/DebugConsolePanel.d.ts +2 -0
  259. package/dist/panels/DebugConsolePanel.d.ts.map +1 -0
  260. package/dist/panels/DebugConsolePanel.js +32 -0
  261. package/dist/panels/DebugConsolePanel.js.map +1 -0
  262. package/dist/panels/DebugContextPanel.d.ts +2 -0
  263. package/dist/panels/DebugContextPanel.d.ts.map +1 -0
  264. package/dist/panels/DebugContextPanel.js +32 -0
  265. package/dist/panels/DebugContextPanel.js.map +1 -0
  266. package/dist/panels/DebugExternalIOPanel.d.ts +9 -0
  267. package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -0
  268. package/dist/panels/DebugExternalIOPanel.js +66 -0
  269. package/dist/panels/DebugExternalIOPanel.js.map +1 -0
  270. package/dist/panels/DiagnosticsPanel.d.ts +8 -0
  271. package/dist/panels/DiagnosticsPanel.d.ts.map +1 -0
  272. package/dist/panels/DiagnosticsPanel.js +86 -0
  273. package/dist/panels/DiagnosticsPanel.js.map +1 -0
  274. package/dist/panels/EdgeConfigPanel.d.ts +14 -0
  275. package/dist/panels/EdgeConfigPanel.d.ts.map +1 -0
  276. package/dist/panels/EdgeConfigPanel.js +34 -0
  277. package/dist/panels/EdgeConfigPanel.js.map +1 -0
  278. package/dist/panels/FunctionConfigPanel.d.ts +16 -0
  279. package/dist/panels/FunctionConfigPanel.d.ts.map +1 -0
  280. package/dist/panels/FunctionConfigPanel.js +62 -0
  281. package/dist/panels/FunctionConfigPanel.js.map +1 -0
  282. package/dist/panels/FunctionListPanel.d.ts +14 -0
  283. package/dist/panels/FunctionListPanel.d.ts.map +1 -0
  284. package/dist/panels/FunctionListPanel.js +25 -0
  285. package/dist/panels/FunctionListPanel.js.map +1 -0
  286. package/dist/panels/MemoryConfigPanel.d.ts +8 -0
  287. package/dist/panels/MemoryConfigPanel.d.ts.map +1 -0
  288. package/dist/panels/MemoryConfigPanel.js +22 -0
  289. package/dist/panels/MemoryConfigPanel.js.map +1 -0
  290. package/dist/panels/MemoryPanel.d.ts +2 -0
  291. package/dist/panels/MemoryPanel.d.ts.map +1 -0
  292. package/dist/panels/MemoryPanel.js +25 -0
  293. package/dist/panels/MemoryPanel.js.map +1 -0
  294. package/dist/panels/ModelConfigPanel.d.ts +8 -0
  295. package/dist/panels/ModelConfigPanel.d.ts.map +1 -0
  296. package/dist/panels/ModelConfigPanel.js +14 -0
  297. package/dist/panels/ModelConfigPanel.js.map +1 -0
  298. package/dist/panels/ModelsPanel.d.ts +8 -0
  299. package/dist/panels/ModelsPanel.d.ts.map +1 -0
  300. package/dist/panels/ModelsPanel.js +24 -0
  301. package/dist/panels/ModelsPanel.js.map +1 -0
  302. package/dist/panels/NodeConfigPanel.d.ts +16 -0
  303. package/dist/panels/NodeConfigPanel.d.ts.map +1 -0
  304. package/dist/panels/NodeConfigPanel.js +248 -0
  305. package/dist/panels/NodeConfigPanel.js.map +1 -0
  306. package/dist/panels/NodeLibrary.d.ts +16 -0
  307. package/dist/panels/NodeLibrary.d.ts.map +1 -0
  308. package/dist/panels/NodeLibrary.js +125 -0
  309. package/dist/panels/NodeLibrary.js.map +1 -0
  310. package/dist/panels/ResourceConfigPanel.d.ts +37 -0
  311. package/dist/panels/ResourceConfigPanel.d.ts.map +1 -0
  312. package/dist/panels/ResourceConfigPanel.js +35 -0
  313. package/dist/panels/ResourceConfigPanel.js.map +1 -0
  314. package/dist/panels/ResourceListPanel.d.ts +35 -0
  315. package/dist/panels/ResourceListPanel.d.ts.map +1 -0
  316. package/dist/panels/ResourceListPanel.js +35 -0
  317. package/dist/panels/ResourceListPanel.js.map +1 -0
  318. package/dist/panels/VariableConfigPanel.d.ts +9 -0
  319. package/dist/panels/VariableConfigPanel.d.ts.map +1 -0
  320. package/dist/panels/VariableConfigPanel.js +50 -0
  321. package/dist/panels/VariableConfigPanel.js.map +1 -0
  322. package/dist/panels/VariablesPanel.d.ts +7 -0
  323. package/dist/panels/VariablesPanel.d.ts.map +1 -0
  324. package/dist/panels/VariablesPanel.js +56 -0
  325. package/dist/panels/VariablesPanel.js.map +1 -0
  326. package/dist/stores/canvasStore.d.ts +41 -0
  327. package/dist/stores/canvasStore.d.ts.map +1 -0
  328. package/dist/stores/canvasStore.js +187 -0
  329. package/dist/stores/canvasStore.js.map +1 -0
  330. package/dist/stores/debugStore.d.ts +42 -0
  331. package/dist/stores/debugStore.d.ts.map +1 -0
  332. package/dist/stores/debugStore.js +22 -0
  333. package/dist/stores/debugStore.js.map +1 -0
  334. package/dist/stores/diagnosticsStore.d.ts +41 -0
  335. package/dist/stores/diagnosticsStore.d.ts.map +1 -0
  336. package/dist/stores/diagnosticsStore.js +67 -0
  337. package/dist/stores/diagnosticsStore.js.map +1 -0
  338. package/dist/stores/editorStore.d.ts +76 -0
  339. package/dist/stores/editorStore.d.ts.map +1 -0
  340. package/dist/stores/editorStore.js +116 -0
  341. package/dist/stores/editorStore.js.map +1 -0
  342. package/dist/utils/categoryConstants.d.ts +4 -0
  343. package/dist/utils/categoryConstants.d.ts.map +1 -0
  344. package/dist/utils/categoryConstants.js +24 -0
  345. package/dist/utils/categoryConstants.js.map +1 -0
  346. package/dist/utils/channelOperations.d.ts +21 -0
  347. package/dist/utils/channelOperations.d.ts.map +1 -0
  348. package/dist/utils/channelOperations.js +84 -0
  349. package/dist/utils/channelOperations.js.map +1 -0
  350. package/dist/utils/connectionRules.d.ts +15 -0
  351. package/dist/utils/connectionRules.d.ts.map +1 -0
  352. package/dist/utils/connectionRules.js +113 -0
  353. package/dist/utils/connectionRules.js.map +1 -0
  354. package/dist/utils/functionOperations.d.ts +27 -0
  355. package/dist/utils/functionOperations.d.ts.map +1 -0
  356. package/dist/utils/functionOperations.js +140 -0
  357. package/dist/utils/functionOperations.js.map +1 -0
  358. package/dist/utils/graphOperations.d.ts +54 -0
  359. package/dist/utils/graphOperations.d.ts.map +1 -0
  360. package/dist/utils/graphOperations.js +461 -0
  361. package/dist/utils/graphOperations.js.map +1 -0
  362. package/dist/utils/history.d.ts +76 -0
  363. package/dist/utils/history.d.ts.map +1 -0
  364. package/dist/utils/history.js +93 -0
  365. package/dist/utils/history.js.map +1 -0
  366. package/dist/utils/memoryOperations.d.ts +14 -0
  367. package/dist/utils/memoryOperations.d.ts.map +1 -0
  368. package/dist/utils/memoryOperations.js +55 -0
  369. package/dist/utils/memoryOperations.js.map +1 -0
  370. package/dist/utils/migrateFunctionNodes.d.ts +9 -0
  371. package/dist/utils/migrateFunctionNodes.d.ts.map +1 -0
  372. package/dist/utils/migrateFunctionNodes.js +89 -0
  373. package/dist/utils/migrateFunctionNodes.js.map +1 -0
  374. package/dist/utils/modelOperations.d.ts +13 -0
  375. package/dist/utils/modelOperations.d.ts.map +1 -0
  376. package/dist/utils/modelOperations.js +53 -0
  377. package/dist/utils/modelOperations.js.map +1 -0
  378. package/dist/utils/paramDisplay.d.ts +12 -0
  379. package/dist/utils/paramDisplay.d.ts.map +1 -0
  380. package/dist/utils/paramDisplay.js +56 -0
  381. package/dist/utils/paramDisplay.js.map +1 -0
  382. package/dist/utils/resourceHelpers.d.ts +17 -0
  383. package/dist/utils/resourceHelpers.d.ts.map +1 -0
  384. package/dist/utils/resourceHelpers.js +32 -0
  385. package/dist/utils/resourceHelpers.js.map +1 -0
  386. package/dist/utils/translation.d.ts +20 -0
  387. package/dist/utils/translation.d.ts.map +1 -0
  388. package/dist/utils/translation.js +23 -0
  389. package/dist/utils/translation.js.map +1 -0
  390. package/dist/utils/variableOperations.d.ts +15 -0
  391. package/dist/utils/variableOperations.d.ts.map +1 -0
  392. package/dist/utils/variableOperations.js +71 -0
  393. package/dist/utils/variableOperations.js.map +1 -0
  394. package/package.json +79 -0
  395. package/src/BuilderLayout.tsx +345 -0
  396. package/src/Canvas.tsx +261 -0
  397. package/src/CanvasEditor.tsx +142 -0
  398. package/src/CanvasTabsToolbar.tsx +176 -0
  399. package/src/RightConfigPanel.tsx +266 -0
  400. package/src/WorkflowBuilder.tsx +412 -0
  401. package/src/cn.ts +6 -0
  402. package/src/components/ui/add-button.tsx +39 -0
  403. package/src/components/ui/alert-dialog.tsx +141 -0
  404. package/src/components/ui/alert.tsx +59 -0
  405. package/src/components/ui/badge.tsx +36 -0
  406. package/src/components/ui/button.tsx +85 -0
  407. package/src/components/ui/card.tsx +79 -0
  408. package/src/components/ui/checkbox.tsx +28 -0
  409. package/src/components/ui/collapsible.tsx +9 -0
  410. package/src/components/ui/command.tsx +153 -0
  411. package/src/components/ui/delete-button.tsx +23 -0
  412. package/src/components/ui/dialog.tsx +125 -0
  413. package/src/components/ui/dropdown-menu.tsx +198 -0
  414. package/src/components/ui/input.tsx +55 -0
  415. package/src/components/ui/label.tsx +24 -0
  416. package/src/components/ui/readonly-banner.tsx +15 -0
  417. package/src/components/ui/resizable.tsx +43 -0
  418. package/src/components/ui/scroll-area.tsx +102 -0
  419. package/src/components/ui/select.tsx +160 -0
  420. package/src/components/ui/separator.tsx +29 -0
  421. package/src/components/ui/switch.tsx +27 -0
  422. package/src/components/ui/textarea.tsx +51 -0
  423. package/src/components/ui/toast.tsx +127 -0
  424. package/src/components/ui/toaster.tsx +33 -0
  425. package/src/components/ui/toggle-group.tsx +59 -0
  426. package/src/components/ui/toggle.tsx +43 -0
  427. package/src/components/ui/tooltip.tsx +32 -0
  428. package/src/dialogs/NodePickerDialog.tsx +84 -0
  429. package/src/dialogs/ValidationDialog.tsx +184 -0
  430. package/src/graph/BaseNode.tsx +557 -0
  431. package/src/graph/CustomEdge.tsx +185 -0
  432. package/src/graph/CustomNode.tsx +16 -0
  433. package/src/graph/FunctionCallNode.tsx +30 -0
  434. package/src/graph/PortHandle.tsx +189 -0
  435. package/src/graph/reactFlowRegistry.ts +26 -0
  436. package/src/hooks/use-toast.ts +125 -0
  437. package/src/hooks/useAvailableVariables.ts +20 -0
  438. package/src/hooks/useCanvasHistory.ts +22 -0
  439. package/src/hooks/useCanvasTabs.ts +168 -0
  440. package/src/hooks/useFunctionDiagnosticsSync.ts +40 -0
  441. package/src/hooks/useFunctionRegistry.ts +26 -0
  442. package/src/hooks/useFunctions.ts +44 -0
  443. package/src/hooks/useGraph.ts +161 -0
  444. package/src/hooks/useNodeDefinitions.ts +82 -0
  445. package/src/hooks/useParamErrors.ts +26 -0
  446. package/src/hooks/useResolvedTheme.ts +30 -0
  447. package/src/hooks/useResourceDiagnosticsSync.ts +58 -0
  448. package/src/hooks/useSuppressThemeTransition.ts +79 -0
  449. package/src/hooks/useWorkflowSerialization.ts +127 -0
  450. package/src/i18n/index.ts +53 -0
  451. package/src/i18n/locales/de.json +501 -0
  452. package/src/i18n/locales/en.json +557 -0
  453. package/src/index.ts +27 -0
  454. package/src/inputs/ExpressionInput.tsx +297 -0
  455. package/src/inputs/ParameterEditor.tsx +515 -0
  456. package/src/inputs/PortSection.tsx +144 -0
  457. package/src/panels/BuilderSidebar.tsx +301 -0
  458. package/src/panels/ChannelConfigPanel.tsx +49 -0
  459. package/src/panels/ChannelsPanel.tsx +28 -0
  460. package/src/panels/DebugConsolePanel.tsx +73 -0
  461. package/src/panels/DebugContextPanel.tsx +77 -0
  462. package/src/panels/DebugExternalIOPanel.tsx +180 -0
  463. package/src/panels/DiagnosticsPanel.tsx +170 -0
  464. package/src/panels/EdgeConfigPanel.tsx +104 -0
  465. package/src/panels/FunctionConfigPanel.tsx +179 -0
  466. package/src/panels/FunctionListPanel.tsx +45 -0
  467. package/src/panels/MemoryConfigPanel.tsx +55 -0
  468. package/src/panels/MemoryPanel.tsx +40 -0
  469. package/src/panels/ModelConfigPanel.tsx +41 -0
  470. package/src/panels/ModelsPanel.tsx +36 -0
  471. package/src/panels/NodeConfigPanel.tsx +630 -0
  472. package/src/panels/NodeLibrary.tsx +288 -0
  473. package/src/panels/ResourceConfigPanel.tsx +132 -0
  474. package/src/panels/ResourceListPanel.tsx +113 -0
  475. package/src/panels/VariableConfigPanel.tsx +161 -0
  476. package/src/panels/VariablesPanel.tsx +145 -0
  477. package/src/stores/canvasStore.test.ts +44 -0
  478. package/src/stores/canvasStore.ts +245 -0
  479. package/src/stores/debugStore.ts +74 -0
  480. package/src/stores/diagnosticsStore.ts +130 -0
  481. package/src/stores/editorStore.ts +202 -0
  482. package/src/styles/index.css +526 -0
  483. package/src/utils/categoryConstants.ts +26 -0
  484. package/src/utils/channelOperations.ts +86 -0
  485. package/src/utils/connectionRules.ts +137 -0
  486. package/src/utils/functionOperations.ts +179 -0
  487. package/src/utils/graphOperations.ts +550 -0
  488. package/src/utils/history.ts +207 -0
  489. package/src/utils/memoryOperations.ts +57 -0
  490. package/src/utils/migrateFunctionNodes.ts +107 -0
  491. package/src/utils/modelOperations.ts +55 -0
  492. package/src/utils/paramDisplay.ts +71 -0
  493. package/src/utils/resourceHelpers.ts +32 -0
  494. package/src/utils/translation.ts +28 -0
  495. package/src/utils/variableOperations.ts +75 -0
  496. package/tailwind-preset.ts +166 -0
@@ -0,0 +1,515 @@
1
+ import { Input } from "../components/ui/input";
2
+ import { Textarea } from "../components/ui/textarea";
3
+ import { Label } from "../components/ui/label";
4
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../components/ui/select";
5
+ import { Switch } from "../components/ui/switch";
6
+ import { Alert, AlertDescription } from "../components/ui/alert";
7
+ import { Button } from "../components/ui/button";
8
+ import { AddButton } from "../components/ui/add-button";
9
+ import { ToggleGroup, ToggleGroupItem } from "../components/ui/toggle-group";
10
+ import { AlertTriangle, Trash2 } from "lucide-react";
11
+ import type { DataType, Expression, Reference } from "@foresthubai/workflow-core";
12
+ import type {
13
+ ExpressionParam,
14
+ ChannelSelectParam,
15
+ MemorySelectParam,
16
+ ModelSelectParam,
17
+ Parameter,
18
+ StringParam,
19
+ } from "@foresthubai/workflow-core/parameter";
20
+ import {
21
+ resolveCapabilities,
22
+ resolveExpressionType,
23
+ resolveChannelTypes,
24
+ resolveMemoryTypes,
25
+ resolveModelTypes,
26
+ } from "@foresthubai/workflow-core/parameter";
27
+ import { useTranslation } from "react-i18next";
28
+ import { useAvailableVariables } from "../hooks/useAvailableVariables";
29
+ import { useEditorStore } from "../stores/editorStore";
30
+ import { varKey, refToLookupKey } from "@foresthubai/workflow-core/variable";
31
+ import type { Channel } from "@foresthubai/workflow-core/channel";
32
+ import type { Memory, MemoryRef } from "@foresthubai/workflow-core/memory";
33
+ import type { ModelCapability } from "@foresthubai/workflow-core/model";
34
+ import ExpressionInput from "./ExpressionInput";
35
+ import { getParamDescription } from "../utils/translation";
36
+
37
+ /** Shared Select component for all reference-select parameter types */
38
+ function ReferenceSelect({
39
+ value,
40
+ options,
41
+ isStale,
42
+ loading,
43
+ placeholder,
44
+ onChange,
45
+ }: {
46
+ value: string | undefined;
47
+ options: { value: string; label: string }[];
48
+ isStale: boolean;
49
+ loading?: boolean;
50
+ placeholder: string;
51
+ onChange: (value: string | undefined) => void;
52
+ }) {
53
+ const NONE = "__none__";
54
+ const selectValue = isStale ? undefined : (value ?? NONE);
55
+
56
+ return (
57
+ <Select value={selectValue} onValueChange={(v) => onChange(v === NONE ? undefined : v)} disabled={loading}>
58
+ <SelectTrigger>
59
+ <SelectValue
60
+ placeholder={
61
+ isStale ? <span className="text-destructive">Deleted reference</span> : loading ? "Loading..." : placeholder
62
+ }
63
+ />
64
+ </SelectTrigger>
65
+ <SelectContent>
66
+ <SelectItem value={NONE}>
67
+ <span className="text-muted-foreground italic pr-0.5">None</span>
68
+ </SelectItem>
69
+ {options.map((opt) => (
70
+ <SelectItem key={opt.value} value={opt.value}>
71
+ {opt.label}
72
+ </SelectItem>
73
+ ))}
74
+ </SelectContent>
75
+ </Select>
76
+ );
77
+ }
78
+
79
+ function getExpressionPlaceholder(dataType: DataType): string {
80
+ switch (dataType) {
81
+ case "int":
82
+ case "float":
83
+ return "${var1} + ${var2}";
84
+ case "bool":
85
+ return "${var1} > ${var2}";
86
+ case "string":
87
+ return "hello ${var1}";
88
+ default:
89
+ return "${var1}";
90
+ }
91
+ }
92
+
93
+ interface ParameterEditorProps {
94
+ canvasId: string;
95
+ parameter: Parameter;
96
+ value: unknown;
97
+ allArguments: Record<string, unknown>;
98
+ onChange: (value: unknown) => void;
99
+ errors?: string[];
100
+ translationPrefix?: string;
101
+ }
102
+
103
+ const ParameterEditor = ({
104
+ canvasId,
105
+ parameter,
106
+ value,
107
+ allArguments,
108
+ onChange,
109
+ errors,
110
+ translationPrefix,
111
+ }: ParameterEditorProps) => {
112
+ const { t } = useTranslation();
113
+ // Do NOT fall back to parameter.default here — each input type handles undefined individually.
114
+ // This preserves the distinction between "user cleared field" and "default value".
115
+ const currentValue = value;
116
+ const { list: variableList, lookup: variables } = useAvailableVariables(canvasId);
117
+ const channels = useEditorStore((s) => s.channels);
118
+ const memory = useEditorStore((s) => s.memory);
119
+ const models = useEditorStore((s) => s.models);
120
+ const availableModels = useEditorStore((s) => s.availableModels);
121
+
122
+ const renderInput = () => {
123
+ switch (parameter.type) {
124
+ case "variableSelect": {
125
+ const ref = currentValue as Reference | undefined;
126
+ const selectedKey = ref?.varId ? refToLookupKey(ref) : undefined;
127
+ const isStale = !!(selectedKey && !variables[selectedKey]);
128
+ const options = variableList.map((v) => ({ value: varKey(v), label: `${v.name} (${v.dataType})` }));
129
+
130
+ return (
131
+ <ReferenceSelect
132
+ value={selectedKey}
133
+ options={options}
134
+ isStale={isStale}
135
+ placeholder="Select variable..."
136
+ onChange={(key) => {
137
+ if (!key) {
138
+ onChange(undefined);
139
+ return;
140
+ }
141
+ const variable = variables[key];
142
+ if (!variable) return;
143
+ const newRef: Reference =
144
+ variable.kind === "node"
145
+ ? { srcId: variable.nodeId, varId: variable.outputId }
146
+ : variable.kind === "declared"
147
+ ? { srcId: "declared", varId: variable.uid }
148
+ : { srcId: "fnarg", varId: variable.uid };
149
+ onChange(newRef);
150
+ }}
151
+ />
152
+ );
153
+ }
154
+
155
+ case "expression": {
156
+ const exprParam = parameter as ExpressionParam;
157
+ // Resolve expressionType — static, args-only lambda, or derived from a referenced variable
158
+ const resolvedType: DataType = resolveExpressionType(exprParam, allArguments, variables);
159
+ // Ensure we have a valid expression object (create empty one if undefined for safety)
160
+ const exprValue: Expression =
161
+ currentValue && typeof currentValue === "object" && "expression" in currentValue
162
+ ? (currentValue as Expression)
163
+ : { expression: "", references: [], dataType: resolvedType };
164
+ return (
165
+ <ExpressionInput
166
+ value={exprValue}
167
+ onChange={onChange}
168
+ expressionType={resolvedType}
169
+ availableVariables={variables}
170
+ placeholder={getExpressionPlaceholder(resolvedType)}
171
+ />
172
+ );
173
+ }
174
+
175
+ case "string":
176
+ if ((parameter as StringParam).multiline) {
177
+ return (
178
+ <Textarea
179
+ value={(currentValue as string) || ""}
180
+ onChange={(e) => onChange(e.target.value)}
181
+ placeholder={String(parameter.default ?? "")}
182
+ rows={4}
183
+ />
184
+ );
185
+ }
186
+ return (
187
+ <Input
188
+ value={(currentValue as string) || ""}
189
+ onChange={(e) => onChange(e.target.value)}
190
+ placeholder={String(parameter.default ?? "")}
191
+ />
192
+ );
193
+
194
+ case "int":
195
+ return (
196
+ <Input
197
+ type="number"
198
+ step={1}
199
+ value={currentValue != null ? (currentValue as number) : ""}
200
+ onChange={(e) => {
201
+ const numValue = parseInt(e.target.value, 10);
202
+ onChange(isNaN(numValue) ? undefined : numValue);
203
+ }}
204
+ placeholder={parameter.default?.toString() || "0"}
205
+ />
206
+ );
207
+
208
+ case "float":
209
+ return (
210
+ <Input
211
+ type="number"
212
+ step="any"
213
+ className="[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [-moz-appearance:textfield]"
214
+ value={currentValue != null ? (currentValue as number) : ""}
215
+ onChange={(e) => {
216
+ const numValue = parseFloat(e.target.value);
217
+ onChange(isNaN(numValue) ? undefined : numValue);
218
+ }}
219
+ placeholder={parameter.default?.toString() || "0"}
220
+ />
221
+ );
222
+
223
+ case "bool": {
224
+ const boolValue = currentValue as boolean;
225
+ return (
226
+ <div className="flex items-center space-x-2">
227
+ <Switch checked={boolValue} onCheckedChange={onChange} />
228
+ <span className="text-sm text-muted-foreground">{boolValue ? "Enabled" : "Disabled"}</span>
229
+ </div>
230
+ );
231
+ }
232
+
233
+ case "selection": {
234
+ const NONE = "__none__";
235
+ const selectValue = (currentValue as string) ?? (parameter.optional ? NONE : "");
236
+ return (
237
+ <Select value={selectValue} onValueChange={(v) => onChange(v === NONE ? undefined : v)}>
238
+ <SelectTrigger>
239
+ <SelectValue placeholder="Select..." />
240
+ </SelectTrigger>
241
+ <SelectContent>
242
+ {parameter.optional && (
243
+ <SelectItem value={NONE}>
244
+ <span className="text-muted-foreground italic pr-0.5">None</span>
245
+ </SelectItem>
246
+ )}
247
+ {parameter.options.map((option) => (
248
+ <SelectItem key={option.value} value={option.value}>
249
+ {option.label}
250
+ </SelectItem>
251
+ ))}
252
+ </SelectContent>
253
+ </Select>
254
+ );
255
+ }
256
+
257
+ case "memorySelect": {
258
+ const memoryParam = parameter as ParameterEditorProps["parameter"] & MemorySelectParam;
259
+ const allowedTypes = resolveMemoryTypes(memoryParam, allArguments);
260
+ const matching = Object.values(memory).filter((m: Memory) => allowedTypes.includes(m.type));
261
+
262
+ const selectedId = currentValue as string | undefined;
263
+ const isStale = !!(selectedId && !matching.some((m) => m.id === selectedId));
264
+ const options = matching.map((m) => ({ value: m.id, label: m.label }));
265
+
266
+ return (
267
+ <ReferenceSelect
268
+ value={selectedId}
269
+ options={options}
270
+ isStale={isStale}
271
+ placeholder={t("selectMemory", "Select memory...")}
272
+ onChange={(v) => onChange(v)}
273
+ />
274
+ );
275
+ }
276
+
277
+ case "modelSelect": {
278
+ const modelParam = parameter as ParameterEditorProps["parameter"] & ModelSelectParam;
279
+ const allowedTypes = resolveModelTypes(modelParam, allArguments);
280
+ const requiredCaps = resolveCapabilities(modelParam, allArguments);
281
+ const hasAllCaps = (caps: ModelCapability[]) =>
282
+ !requiredCaps?.length || requiredCaps.every((c) => caps.includes(c));
283
+
284
+ // Static catalog (props): the always-available models the llmproxy supports.
285
+ const catalogOptions = availableModels
286
+ .filter((m) => hasAllCaps(m.capabilities))
287
+ .map((m) => ({ value: m.id, label: m.label }));
288
+
289
+ // Declared custom models of a compatible type (capabilities default to chat).
290
+ const customOptions = Object.values(models)
291
+ .filter(
292
+ (m) =>
293
+ allowedTypes.includes(m.type) && hasAllCaps((m.arguments.capabilities as ModelCapability[]) ?? ["chat"]),
294
+ )
295
+ .map((m) => ({ value: m.id, label: m.label }));
296
+
297
+ // Catalog first; drop customs shadowed by a catalog id.
298
+ const catalogIds = new Set(catalogOptions.map((o) => o.value));
299
+ const options = [...catalogOptions, ...customOptions.filter((o) => !catalogIds.has(o.value))];
300
+
301
+ const selectedId = currentValue as string | undefined;
302
+ const isStale = !!(selectedId && !options.some((o) => o.value === selectedId));
303
+
304
+ if (options.length === 0) {
305
+ return (
306
+ <Alert variant="destructive">
307
+ <AlertTriangle className="h-4 w-4" />
308
+ <AlertDescription>{t("noModelsAvailable")}</AlertDescription>
309
+ </Alert>
310
+ );
311
+ }
312
+
313
+ return (
314
+ <ReferenceSelect
315
+ value={selectedId}
316
+ options={options}
317
+ isStale={isStale}
318
+ placeholder={t("selectModel", "Select model...")}
319
+ onChange={(v) => onChange(v)}
320
+ />
321
+ );
322
+ }
323
+
324
+ case "time":
325
+ return <Input type="time" value={(currentValue as string) ?? ""} onChange={(e) => onChange(e.target.value)} />;
326
+
327
+ case "weekdays": {
328
+ const DAYS = [
329
+ { code: "mon", label: "Mon" },
330
+ { code: "tue", label: "Tue" },
331
+ { code: "wed", label: "Wed" },
332
+ { code: "thu", label: "Thu" },
333
+ { code: "fri", label: "Fri" },
334
+ { code: "sat", label: "Sat" },
335
+ { code: "sun", label: "Sun" },
336
+ ];
337
+ const selected = (currentValue as string[]) || [];
338
+ const toggle = (code: string) => {
339
+ const next = selected.includes(code) ? selected.filter((d) => d !== code) : [...selected, code];
340
+ onChange(next);
341
+ };
342
+ return (
343
+ <div className="space-y-1.5">
344
+ <div className="flex gap-1">
345
+ {DAYS.map((day) => (
346
+ <button
347
+ key={day.code}
348
+ type="button"
349
+ onClick={() => toggle(day.code)}
350
+ className={`px-2 py-1 text-xs rounded-md border transition-colors ${
351
+ selected.includes(day.code)
352
+ ? "bg-primary text-primary-foreground border-primary"
353
+ : "bg-field text-muted-foreground border-input hover:bg-muted/50"
354
+ }`}
355
+ >
356
+ {day.label}
357
+ </button>
358
+ ))}
359
+ </div>
360
+ </div>
361
+ );
362
+ }
363
+
364
+ case "memory-refs": {
365
+ const refs = (currentValue as MemoryRef[] | undefined) ?? [];
366
+ // memory-refs bind to MemoryFile-type memories only.
367
+ const allFiles = Object.values(memory).filter((m) => m.type === "MemoryFile");
368
+ const allFilesById = new Map(allFiles.map((m) => [m.id, m]));
369
+
370
+ const replace = (index: number, next: MemoryRef) => onChange(refs.map((r, i) => (i === index ? next : r)));
371
+ const remove = (index: number) => onChange(refs.filter((_, i) => i !== index));
372
+ const add = () => {
373
+ // Pre-select the first unused memory file (if any) so adding a row
374
+ // immediately gives the user a valid binding to start tweaking.
375
+ const usedIds = new Set(refs.map((r) => r.id));
376
+ const firstUnused = allFiles.find((m) => !usedIds.has(m.id));
377
+ onChange([...refs, { id: firstUnused?.id ?? "", mode: "r" as const }]);
378
+ };
379
+
380
+ // Always render existing refs (even when there are 0 memory files left)
381
+ // so the user can delete dangling references after the underlying memory
382
+ // file is removed. Mirror of the output-binding pattern in NodeConfigPanel.
383
+ const canAdd = allFiles.length > refs.length;
384
+
385
+ return (
386
+ <div className="space-y-2">
387
+ {refs.length === 0 && allFiles.length === 0 && (
388
+ <p className="text-xs text-muted-foreground italic px-2 py-1">
389
+ {t(
390
+ "noMemoryFilesForAgent",
391
+ "No memory files declared yet. Add one from the Memory tab in the sidebar.",
392
+ )}
393
+ </p>
394
+ )}
395
+ {refs.map((ref, index) => {
396
+ const file = ref.id ? allFilesById.get(ref.id) : undefined;
397
+ const isStale = !!(ref.id && !file);
398
+ const usedByOthers = new Set(refs.filter((_, i) => i !== index).map((r) => r.id));
399
+ const selectableFiles = allFiles.filter((m) => m.id === ref.id || !usedByOthers.has(m.id));
400
+
401
+ return (
402
+ <div key={index} className="rounded-lg bg-card shadow-sm border border-border p-2 space-y-2 transition-all hover:shadow-md">
403
+ <div className="flex items-center gap-2">
404
+ <Select value={ref.id || undefined} onValueChange={(id) => replace(index, { ...ref, id })}>
405
+ <SelectTrigger className="h-7 text-xs flex-1">
406
+ <SelectValue
407
+ placeholder={
408
+ isStale ? (
409
+ <span className="text-destructive">{t("memoryRefStale", "Deleted memory file")}</span>
410
+ ) : (
411
+ t("selectMemoryFile", "Select memory file...")
412
+ )
413
+ }
414
+ />
415
+ </SelectTrigger>
416
+ <SelectContent>
417
+ {selectableFiles.map((m) => (
418
+ <SelectItem key={m.id} value={m.id}>
419
+ {m.label}
420
+ </SelectItem>
421
+ ))}
422
+ </SelectContent>
423
+ </Select>
424
+ <Button
425
+ variant="ghost"
426
+ size="icon"
427
+ className="h-7 w-7 shrink-0"
428
+ onClick={() => remove(index)}
429
+ aria-label={t("removeMemoryRef", "Remove memory ref")}
430
+ >
431
+ <Trash2 className="w-3.5 h-3.5" />
432
+ </Button>
433
+ </div>
434
+ <ToggleGroup
435
+ type="single"
436
+ value={ref.mode}
437
+ onValueChange={(v) => v && replace(index, { ...ref, mode: v as "r" | "rw" })}
438
+ className="gap-0 justify-start"
439
+ >
440
+ <ToggleGroupItem value="r" size="sm" variant="outline" className="h-7 px-3 text-xs rounded-r-none">
441
+ {t("memoryModeRead", "Read")}
442
+ </ToggleGroupItem>
443
+ <ToggleGroupItem
444
+ value="rw"
445
+ size="sm"
446
+ variant="outline"
447
+ className="h-7 px-3 text-xs rounded-l-none -ml-px"
448
+ >
449
+ {t("memoryModeReadWrite", "Read + Write")}
450
+ </ToggleGroupItem>
451
+ </ToggleGroup>
452
+ </div>
453
+ );
454
+ })}
455
+ {canAdd && <AddButton onClick={add}>{t("addMemoryRef", "Add memory ref")}</AddButton>}
456
+ </div>
457
+ );
458
+ }
459
+
460
+ case "channelSelect": {
461
+ const channelParam = parameter as ParameterEditorProps["parameter"] & ChannelSelectParam;
462
+ const allowedTypes = resolveChannelTypes(channelParam, allArguments);
463
+ const matching = Object.values(channels).filter((v: Channel) => allowedTypes.includes(v.type));
464
+
465
+ const selectedId = currentValue as string | undefined;
466
+ const isStale = !!(selectedId && !matching.some((v) => v.id === selectedId));
467
+ const options = matching.map((v) => ({ value: v.id, label: v.label }));
468
+
469
+ return (
470
+ <ReferenceSelect
471
+ value={selectedId}
472
+ options={options}
473
+ isStale={isStale}
474
+ placeholder={t("selectChannel")}
475
+ onChange={(v) => onChange(v)}
476
+ />
477
+ );
478
+ }
479
+
480
+ // Exhaustiveness check - fails if a parameter type is not handled
481
+ default: {
482
+ const _exhaustive: never = parameter;
483
+ return _exhaustive;
484
+ }
485
+ }
486
+ };
487
+
488
+ const hasError = errors && errors.length > 0;
489
+
490
+ return (
491
+ <div className={`space-y-2 ${hasError ? "ring-1 ring-destructive rounded-md p-2" : ""}`}>
492
+ <Label className="text-sm font-medium">
493
+ {parameter.label}
494
+ {parameter.optional !== true && <span className="text-destructive ml-1">*</span>}
495
+ </Label>
496
+ {parameter.description && (
497
+ <p className="text-xs text-muted-foreground">
498
+ {translationPrefix ? getParamDescription(t, translationPrefix, parameter) : parameter.description}
499
+ </p>
500
+ )}
501
+ {renderInput()}
502
+ {hasError && (
503
+ <div className="space-y-0.5">
504
+ {errors.map((msg, i) => (
505
+ <p key={i} className="text-xs text-destructive">
506
+ {msg}
507
+ </p>
508
+ ))}
509
+ </div>
510
+ )}
511
+ </div>
512
+ );
513
+ };
514
+
515
+ export default ParameterEditor;
@@ -0,0 +1,144 @@
1
+ import type { ReactNode } from "react";
2
+ import { Button } from "../components/ui/button";
3
+ import { Input } from "../components/ui/input";
4
+ import { Label } from "../components/ui/label";
5
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../components/ui/select";
6
+ import { AddButton } from "../components/ui/add-button";
7
+ import { Trash2 } from "lucide-react";
8
+ import type { DataType } from "@foresthubai/workflow-core";
9
+
10
+ const DATA_TYPES: DataType[] = ["int", "float", "bool", "string"];
11
+
12
+ /** The editable bits of a function port: a name and a data type, keyed by uid. */
13
+ export interface Port {
14
+ uid: string;
15
+ name: string;
16
+ dataType: DataType;
17
+ }
18
+
19
+ /**
20
+ * One declaration row, styled like the node Outputs rows (a `bg-card` shadow card):
21
+ * a header with name + dataType + remove, plus an optional body (e.g. the return
22
+ * expression editor for outputs).
23
+ */
24
+ function PortRow({
25
+ port,
26
+ onUpdate,
27
+ onRemove,
28
+ errors,
29
+ children,
30
+ }: {
31
+ port: Port;
32
+ onUpdate: (patch: { name?: string; dataType?: DataType }) => void;
33
+ onRemove: () => void;
34
+ errors?: string[];
35
+ children?: ReactNode;
36
+ }) {
37
+ const hasError = !!errors?.length;
38
+ return (
39
+ <div
40
+ className={`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${
41
+ hasError ? "border-destructive ring-1 ring-destructive" : "border-border"
42
+ }`}
43
+ >
44
+ <div className="flex items-center gap-2">
45
+ <Input
46
+ className="h-7 text-xs flex-1"
47
+ value={port.name}
48
+ placeholder={"name"}
49
+ onChange={(e) => onUpdate({ name: e.target.value })}
50
+ />
51
+ <Select value={port.dataType} onValueChange={(dt: DataType) => onUpdate({ dataType: dt })}>
52
+ <SelectTrigger className="h-7 text-xs w-20">
53
+ <SelectValue />
54
+ </SelectTrigger>
55
+ <SelectContent>
56
+ {DATA_TYPES.map((dt) => (
57
+ <SelectItem key={dt} value={dt} className="text-xs">
58
+ {dt}
59
+ </SelectItem>
60
+ ))}
61
+ </SelectContent>
62
+ </Select>
63
+ <Button
64
+ variant="ghost"
65
+ size="icon"
66
+ className="h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive"
67
+ onClick={onRemove}
68
+ >
69
+ <Trash2 className="w-3.5 h-3.5" />
70
+ </Button>
71
+ </div>
72
+ {children}
73
+ {hasError && (
74
+ <div className="space-y-0.5">
75
+ {errors!.map((msg, i) => (
76
+ <p key={i} className="text-xs text-destructive">
77
+ {msg}
78
+ </p>
79
+ ))}
80
+ </div>
81
+ )}
82
+ </div>
83
+ );
84
+ }
85
+
86
+ /**
87
+ * A titled section of function ports — a strong label + description (the shared
88
+ * panel field pattern), a card per port, and an Add button. Used for both inputs
89
+ * and outputs; outputs supply the return-expression editor via `renderExtra`.
90
+ */
91
+ export function PortSection<P extends Port>({
92
+ title,
93
+ description,
94
+ addLabel,
95
+ emptyText,
96
+ ports,
97
+ onAdd,
98
+ onUpdate,
99
+ onRemove,
100
+ errorsFor,
101
+ renderExtra,
102
+ }: {
103
+ title: string;
104
+ description: string;
105
+ addLabel: string;
106
+ emptyText: string;
107
+ ports: readonly P[];
108
+ onAdd: () => void;
109
+ onUpdate: (index: number, patch: { name?: string; dataType?: DataType }) => void;
110
+ onRemove: (index: number) => void;
111
+ /** Per-port error messages — rings the row red and lists them (e.g. a missing or
112
+ * invalid return expression on that output). */
113
+ errorsFor?: (port: P) => string[];
114
+ renderExtra?: (port: P, index: number) => ReactNode;
115
+ }) {
116
+ return (
117
+ <div className="space-y-2">
118
+ <div>
119
+ <Label className="text-sm font-medium">{title}</Label>
120
+ <p className="text-xs text-muted-foreground">{description}</p>
121
+ </div>
122
+
123
+ {ports.length === 0 ? (
124
+ <p className="text-xs text-muted-foreground italic">{emptyText}</p>
125
+ ) : (
126
+ <div className="space-y-2">
127
+ {ports.map((port, index) => (
128
+ <PortRow
129
+ key={port.uid}
130
+ port={port}
131
+ onUpdate={(patch) => onUpdate(index, patch)}
132
+ onRemove={() => onRemove(index)}
133
+ errors={errorsFor?.(port)}
134
+ >
135
+ {renderExtra?.(port, index)}
136
+ </PortRow>
137
+ ))}
138
+ </div>
139
+ )}
140
+
141
+ <AddButton onClick={onAdd}>{addLabel}</AddButton>
142
+ </div>
143
+ );
144
+ }