@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,301 +1,305 @@
1
- import { Button } from "../components/ui/button";
2
- import { ScrollArea } from "../components/ui/scroll-area";
3
- import { Tooltip, TooltipContent, TooltipTrigger } from "../components/ui/tooltip";
4
- import { cn } from "../cn";
5
- import { NodeCategory, NodeDefinition } from "@foresthubai/workflow-core/node";
6
- import { useMemo } from "react";
7
- import { Blocks, BrainCircuit, Braces, Bug, Cpu, Database, TriangleAlert, Variable, X } from "lucide-react";
8
- import { useTranslation } from "react-i18next";
9
- import { DiagnosticsPanel } from "./DiagnosticsPanel";
10
- import { FunctionListPanel } from "./FunctionListPanel";
11
- import NodeLibrary from "./NodeLibrary";
12
- import { ChannelsPanel } from "./ChannelsPanel";
13
- import { MemoryPanel } from "./MemoryPanel";
14
- import { ModelsPanel } from "./ModelsPanel";
15
- import { VariablesPanel } from "./VariablesPanel";
16
- import { useDiagnosticsStore } from "../stores/diagnosticsStore";
17
- import { DebugContextPanel } from "./DebugContextPanel";
18
- import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
19
-
20
- export type SidebarTab =
21
- | "nodes"
22
- | "variables"
23
- | "channels"
24
- | "memory"
25
- | "models"
26
- | "functions"
27
- | "diagnostics"
28
- | "debug-context"
29
- | null;
30
-
31
- interface BuilderSidebarProps {
32
- canvasId: string;
33
- activeTab: SidebarTab;
34
- onTabChange: (tab: SidebarTab) => void;
35
- onAddNode: (nodeType: NodeDefinition, position?: { x: number; y: number }) => void;
36
- nodeDefinitions: NodeDefinition[];
37
- getAllCategories: () => NodeCategory[];
38
- onSelectNode: (nodeId: string) => void;
39
- onSelectEdge: (edgeId: string) => void;
40
- isFunctionCanvas: boolean;
41
- // Function management
42
- functions: FunctionDeclaration[];
43
- onOpenFunction: (functionId: string) => void;
44
- onCreateFunction: () => string;
45
- // Debug mode
46
- isDebugMode?: boolean;
47
- }
48
-
49
- export const BuilderSidebar = ({
50
- canvasId,
51
- activeTab,
52
- onTabChange,
53
- onAddNode,
54
- nodeDefinitions,
55
- getAllCategories,
56
- onSelectNode,
57
- onSelectEdge,
58
- isFunctionCanvas,
59
- functions,
60
- onOpenFunction,
61
- onCreateFunction,
62
- isDebugMode,
63
- }: BuilderSidebarProps) => {
64
- const { t } = useTranslation();
65
-
66
- const staticTabs = useMemo(
67
- () => [
68
- { id: "nodes" as const, icon: Blocks, label: t("nodeLibrary") },
69
- { id: "variables" as const, icon: Variable, label: t("variables") },
70
- { id: "channels" as const, icon: Cpu, label: t("channels") },
71
- { id: "memory" as const, icon: Database, label: t("memoryFiles", "Memory") },
72
- { id: "models" as const, icon: BrainCircuit, label: t("models", "AI Models") },
73
- { id: "functions" as const, icon: Braces, label: t("functions") },
74
- { id: "diagnostics" as const, icon: TriangleAlert, label: t("diagnostics") },
75
- ],
76
- [t],
77
- );
78
-
79
- const debugTabs = useMemo(() => [{ id: "debug-context" as const, icon: Bug, label: t("debug.context") }], [t]);
80
-
81
- // Current-canvas diagnostics counts for the diagnostics tab — node + edge only.
82
- const totalErrors = useDiagnosticsStore((s) => {
83
- let count = 0;
84
- for (const diags of Object.values(s.byNodeId)) for (const d of diags) if (d.severity === "error") count++;
85
- for (const diags of Object.values(s.byEdgeId)) for (const d of diags) if (d.severity === "error") count++;
86
- return count;
87
- });
88
- const totalWarnings = useDiagnosticsStore((s) => {
89
- let count = 0;
90
- for (const diags of Object.values(s.byNodeId)) for (const d of diags) if (d.severity === "warning") count++;
91
- for (const diags of Object.values(s.byEdgeId)) for (const d of diags) if (d.severity === "warning") count++;
92
- return count;
93
- });
94
-
95
- // Channels are project-scoped and own their own tab/badge counts here
96
- // drive the "channels" tab icon color + badge (mirrors the diagnostics tab).
97
- const channelErrors = useDiagnosticsStore((s) => {
98
- let count = 0;
99
- for (const diags of Object.values(s.byChannelId)) for (const d of diags) if (d.severity === "error") count++;
100
- return count;
101
- });
102
- const channelWarnings = useDiagnosticsStore((s) => {
103
- let count = 0;
104
- for (const diags of Object.values(s.byChannelId)) for (const d of diags) if (d.severity === "warning") count++;
105
- return count;
106
- });
107
-
108
- // Memory primitives are project-scoped too counts drive the "memory" tab
109
- // icon color + badge (mirrors the channels tab).
110
- const memoryErrors = useDiagnosticsStore((s) => {
111
- let count = 0;
112
- for (const diags of Object.values(s.byMemoryId)) for (const d of diags) if (d.severity === "error") count++;
113
- return count;
114
- });
115
- const memoryWarnings = useDiagnosticsStore((s) => {
116
- let count = 0;
117
- for (const diags of Object.values(s.byMemoryId)) for (const d of diags) if (d.severity === "warning") count++;
118
- return count;
119
- });
120
-
121
- // Declared models are project-scoped too counts drive the "models" tab badge.
122
- const modelErrors = useDiagnosticsStore((s) => {
123
- let count = 0;
124
- for (const diags of Object.values(s.byModelId)) for (const d of diags) if (d.severity === "error") count++;
125
- return count;
126
- });
127
- const modelWarnings = useDiagnosticsStore((s) => {
128
- let count = 0;
129
- for (const diags of Object.values(s.byModelId)) for (const d of diags) if (d.severity === "warning") count++;
130
- return count;
131
- });
132
-
133
- // Functions are project-scoped too counts drive the "functions" tab badge.
134
- const functionErrors = useDiagnosticsStore((s) => {
135
- let count = 0;
136
- for (const diags of Object.values(s.byFunctionId)) for (const d of diags) if (d.severity === "error") count++;
137
- return count;
138
- });
139
- const functionWarnings = useDiagnosticsStore((s) => {
140
- let count = 0;
141
- for (const diags of Object.values(s.byFunctionId)) for (const d of diags) if (d.severity === "warning") count++;
142
- return count;
143
- });
144
-
145
- const tabs = useMemo(() => (isDebugMode ? debugTabs : staticTabs), [isDebugMode, debugTabs, staticTabs]);
146
-
147
- const handleTabClick = (tabId: SidebarTab) => {
148
- onTabChange(activeTab === tabId ? null : tabId);
149
- };
150
-
151
- const renderTabContent = () => {
152
- switch (activeTab) {
153
- case "nodes":
154
- return (
155
- <NodeLibrary
156
- onAddNode={onAddNode}
157
- nodeDefinitions={nodeDefinitions}
158
- getAllCategories={getAllCategories}
159
- functions={functions}
160
- isFunctionCanvas={!!isFunctionCanvas}
161
- />
162
- );
163
- case "variables":
164
- return <VariablesPanel canvasId={canvasId} onSelectNode={onSelectNode} />;
165
- case "channels":
166
- return <ChannelsPanel />;
167
- case "memory":
168
- return <MemoryPanel />;
169
- case "models":
170
- return <ModelsPanel />;
171
- case "functions":
172
- return <FunctionListPanel onOpenFunction={onOpenFunction} onCreateFunction={onCreateFunction} />;
173
- case "diagnostics":
174
- return <DiagnosticsPanel canvasId={canvasId} onSelectNode={onSelectNode} onSelectEdge={onSelectEdge} />;
175
- case "debug-context":
176
- return <DebugContextPanel />;
177
- default:
178
- return null;
179
- }
180
- };
181
-
182
- const getTabLabel = (tabId: SidebarTab) => {
183
- const tab = tabs.find((tab) => tab.id === tabId);
184
- return tab?.label ?? "";
185
- };
186
-
187
- return (
188
- <div className="flex h-full">
189
- {/* Icon Rail - Always visible */}
190
- <div className="w-14 bg-card border-r border-border/50 flex flex-col items-center py-3 gap-1 shrink-0">
191
- {tabs.map((tab) => {
192
- const Icon = tab.icon;
193
- const isActive = activeTab === tab.id;
194
-
195
- // Per-tab error/warning counts for icon coloring + badge.
196
- // Diagnostics tab covers nodes+edges; channels tab covers channels.
197
- let tabErrors = 0;
198
- let tabWarnings = 0;
199
- if (tab.id === "diagnostics") {
200
- tabErrors = totalErrors;
201
- tabWarnings = totalWarnings;
202
- } else if (tab.id === "channels") {
203
- tabErrors = channelErrors;
204
- tabWarnings = channelWarnings;
205
- } else if (tab.id === "memory") {
206
- tabErrors = memoryErrors;
207
- tabWarnings = memoryWarnings;
208
- } else if (tab.id === "models") {
209
- tabErrors = modelErrors;
210
- tabWarnings = modelWarnings;
211
- } else if (tab.id === "functions") {
212
- tabErrors = functionErrors;
213
- tabWarnings = functionWarnings;
214
- }
215
- const tabIssueCount = tabErrors + tabWarnings;
216
- const showBadge = tabIssueCount > 0;
217
-
218
- const iconColorClass =
219
- showBadge && !isActive
220
- ? tabErrors > 0
221
- ? "text-destructive hover:text-destructive hover:bg-destructive/10"
222
- : "text-warning hover:text-warning hover:bg-warning/10"
223
- : undefined;
224
-
225
- return (
226
- <Tooltip key={tab.id} delayDuration={300}>
227
- <TooltipTrigger asChild>
228
- <Button
229
- variant="ghost"
230
- size="icon"
231
- onClick={(e) => {
232
- // Drop focus after a mouse click so a follow-up Enter doesn't
233
- // re-fire (toggle) this tab. Keyboard activation (detail 0) keeps focus.
234
- if (e.detail !== 0) e.currentTarget.blur();
235
- handleTabClick(tab.id);
236
- }}
237
- className={cn(
238
- "w-10 h-10 transition-all duration-200 relative",
239
- isActive
240
- ? "bg-accent text-primary shadow-sm"
241
- : (iconColorClass ?? "text-muted-foreground hover:text-foreground hover:bg-accent/50"),
242
- )}
243
- >
244
- <Icon className="w-5 h-5" />
245
- {showBadge && (
246
- <span
247
- className={cn(
248
- "absolute -top-0.5 -right-0.5 min-w-[16px] h-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1 shadow-sm",
249
- tabErrors > 0
250
- ? "bg-destructive text-destructive-foreground"
251
- : "bg-warning text-warning-foreground",
252
- )}
253
- >
254
- {tabIssueCount}
255
- </span>
256
- )}
257
- </Button>
258
- </TooltipTrigger>
259
- <TooltipContent side="right" sideOffset={8}>
260
- {tab.label}
261
- </TooltipContent>
262
- </Tooltip>
263
- );
264
- })}
265
- </div>
266
-
267
- {/* Content Panel - Slides in/out */}
268
- <div
269
- className={cn(
270
- "bg-card/95 backdrop-blur-xl border-r border-border/50 transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
271
- activeTab ? "w-64 opacity-100" : "w-0 opacity-0",
272
- )}
273
- >
274
- {activeTab && (
275
- <>
276
- {/* Panel Header */}
277
- <div className="flex items-center justify-between p-3 border-b border-border/50 shrink-0">
278
- <h3 className="font-semibold text-sm text-foreground">{getTabLabel(activeTab)}</h3>
279
- <Button
280
- variant="ghost"
281
- size="icon"
282
- onClick={() => onTabChange(null)}
283
- className="w-7 h-7 text-muted-foreground hover:text-foreground"
284
- >
285
- <X className="w-4 h-4" />
286
- </Button>
287
- </div>
288
-
289
- {/* Panel Content — ScrollArea overlays the scrollbar in the panel's
290
- gutter so content width stays constant whether overflow is
291
- present or not. Padding lives on the inner viewport because the
292
- Root must clip cleanly for the absolute-positioned scrollbar. */}
293
- <ScrollArea className="flex-1" viewportClassName="p-3">
294
- {renderTabContent()}
295
- </ScrollArea>
296
- </>
297
- )}
298
- </div>
299
- </div>
300
- );
301
- };
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 { Button } from "../components/ui/button";
6
+ import { ScrollArea } from "../components/ui/scroll-area";
7
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../components/ui/tooltip";
8
+ import { cn } from "../cn";
9
+ import { NodeCategory, NodeDefinition } from "@foresthubai/workflow-core/node";
10
+ import { useMemo } from "react";
11
+ import { Blocks, BrainCircuit, Braces, Bug, Cpu, Database, TriangleAlert, Variable, X } from "lucide-react";
12
+ import { useTranslation } from "react-i18next";
13
+ import { DiagnosticsPanel } from "./DiagnosticsPanel";
14
+ import { FunctionListPanel } from "./FunctionListPanel";
15
+ import NodeLibrary from "./NodeLibrary";
16
+ import { ChannelsPanel } from "./ChannelsPanel";
17
+ import { MemoryPanel } from "./MemoryPanel";
18
+ import { ModelsPanel } from "./ModelsPanel";
19
+ import { VariablesPanel } from "./VariablesPanel";
20
+ import { useDiagnosticsStore } from "../stores/diagnosticsStore";
21
+ import { DebugContextPanel } from "./DebugContextPanel";
22
+ import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
23
+
24
+ export type SidebarTab =
25
+ | "nodes"
26
+ | "variables"
27
+ | "channels"
28
+ | "memory"
29
+ | "models"
30
+ | "functions"
31
+ | "diagnostics"
32
+ | "debug-context"
33
+ | null;
34
+
35
+ interface BuilderSidebarProps {
36
+ canvasId: string;
37
+ activeTab: SidebarTab;
38
+ onTabChange: (tab: SidebarTab) => void;
39
+ onAddNode: (nodeType: NodeDefinition, position?: { x: number; y: number }) => void;
40
+ nodeDefinitions: NodeDefinition[];
41
+ getAllCategories: () => NodeCategory[];
42
+ onSelectNode: (nodeId: string) => void;
43
+ onSelectEdge: (edgeId: string) => void;
44
+ isFunctionCanvas: boolean;
45
+ // Function management
46
+ functions: FunctionDeclaration[];
47
+ onOpenFunction: (functionId: string) => void;
48
+ onCreateFunction: () => string;
49
+ // Debug mode
50
+ isDebugMode?: boolean;
51
+ }
52
+
53
+ export const BuilderSidebar = ({
54
+ canvasId,
55
+ activeTab,
56
+ onTabChange,
57
+ onAddNode,
58
+ nodeDefinitions,
59
+ getAllCategories,
60
+ onSelectNode,
61
+ onSelectEdge,
62
+ isFunctionCanvas,
63
+ functions,
64
+ onOpenFunction,
65
+ onCreateFunction,
66
+ isDebugMode,
67
+ }: BuilderSidebarProps) => {
68
+ const { t } = useTranslation();
69
+
70
+ const staticTabs = useMemo(
71
+ () => [
72
+ { id: "nodes" as const, icon: Blocks, label: t("nodeLibrary") },
73
+ { id: "variables" as const, icon: Variable, label: t("variables") },
74
+ { id: "channels" as const, icon: Cpu, label: t("channels") },
75
+ { id: "memory" as const, icon: Database, label: t("memoryFiles", "Memory") },
76
+ { id: "models" as const, icon: BrainCircuit, label: t("models", "AI Models") },
77
+ { id: "functions" as const, icon: Braces, label: t("functions") },
78
+ { id: "diagnostics" as const, icon: TriangleAlert, label: t("diagnostics") },
79
+ ],
80
+ [t],
81
+ );
82
+
83
+ const debugTabs = useMemo(() => [{ id: "debug-context" as const, icon: Bug, label: t("debug.context") }], [t]);
84
+
85
+ // Current-canvas diagnostics counts for the diagnostics tab node + edge only.
86
+ const totalErrors = useDiagnosticsStore((s) => {
87
+ let count = 0;
88
+ for (const diags of Object.values(s.byNodeId)) for (const d of diags) if (d.severity === "error") count++;
89
+ for (const diags of Object.values(s.byEdgeId)) for (const d of diags) if (d.severity === "error") count++;
90
+ return count;
91
+ });
92
+ const totalWarnings = useDiagnosticsStore((s) => {
93
+ let count = 0;
94
+ for (const diags of Object.values(s.byNodeId)) for (const d of diags) if (d.severity === "warning") count++;
95
+ for (const diags of Object.values(s.byEdgeId)) for (const d of diags) if (d.severity === "warning") count++;
96
+ return count;
97
+ });
98
+
99
+ // Channels are project-scoped and own their own tab/badge counts here
100
+ // drive the "channels" tab icon color + badge (mirrors the diagnostics tab).
101
+ const channelErrors = useDiagnosticsStore((s) => {
102
+ let count = 0;
103
+ for (const diags of Object.values(s.byChannelId)) for (const d of diags) if (d.severity === "error") count++;
104
+ return count;
105
+ });
106
+ const channelWarnings = useDiagnosticsStore((s) => {
107
+ let count = 0;
108
+ for (const diags of Object.values(s.byChannelId)) for (const d of diags) if (d.severity === "warning") count++;
109
+ return count;
110
+ });
111
+
112
+ // Memory primitives are project-scoped too counts drive the "memory" tab
113
+ // icon color + badge (mirrors the channels tab).
114
+ const memoryErrors = useDiagnosticsStore((s) => {
115
+ let count = 0;
116
+ for (const diags of Object.values(s.byMemoryId)) for (const d of diags) if (d.severity === "error") count++;
117
+ return count;
118
+ });
119
+ const memoryWarnings = useDiagnosticsStore((s) => {
120
+ let count = 0;
121
+ for (const diags of Object.values(s.byMemoryId)) for (const d of diags) if (d.severity === "warning") count++;
122
+ return count;
123
+ });
124
+
125
+ // Declared models are project-scoped too — counts drive the "models" tab badge.
126
+ const modelErrors = useDiagnosticsStore((s) => {
127
+ let count = 0;
128
+ for (const diags of Object.values(s.byModelId)) for (const d of diags) if (d.severity === "error") count++;
129
+ return count;
130
+ });
131
+ const modelWarnings = useDiagnosticsStore((s) => {
132
+ let count = 0;
133
+ for (const diags of Object.values(s.byModelId)) for (const d of diags) if (d.severity === "warning") count++;
134
+ return count;
135
+ });
136
+
137
+ // Functions are project-scoped too — counts drive the "functions" tab badge.
138
+ const functionErrors = useDiagnosticsStore((s) => {
139
+ let count = 0;
140
+ for (const diags of Object.values(s.byFunctionId)) for (const d of diags) if (d.severity === "error") count++;
141
+ return count;
142
+ });
143
+ const functionWarnings = useDiagnosticsStore((s) => {
144
+ let count = 0;
145
+ for (const diags of Object.values(s.byFunctionId)) for (const d of diags) if (d.severity === "warning") count++;
146
+ return count;
147
+ });
148
+
149
+ const tabs = useMemo(() => (isDebugMode ? debugTabs : staticTabs), [isDebugMode, debugTabs, staticTabs]);
150
+
151
+ const handleTabClick = (tabId: SidebarTab) => {
152
+ onTabChange(activeTab === tabId ? null : tabId);
153
+ };
154
+
155
+ const renderTabContent = () => {
156
+ switch (activeTab) {
157
+ case "nodes":
158
+ return (
159
+ <NodeLibrary
160
+ onAddNode={onAddNode}
161
+ nodeDefinitions={nodeDefinitions}
162
+ getAllCategories={getAllCategories}
163
+ functions={functions}
164
+ isFunctionCanvas={!!isFunctionCanvas}
165
+ />
166
+ );
167
+ case "variables":
168
+ return <VariablesPanel canvasId={canvasId} onSelectNode={onSelectNode} />;
169
+ case "channels":
170
+ return <ChannelsPanel />;
171
+ case "memory":
172
+ return <MemoryPanel />;
173
+ case "models":
174
+ return <ModelsPanel />;
175
+ case "functions":
176
+ return <FunctionListPanel onOpenFunction={onOpenFunction} onCreateFunction={onCreateFunction} />;
177
+ case "diagnostics":
178
+ return <DiagnosticsPanel canvasId={canvasId} onSelectNode={onSelectNode} onSelectEdge={onSelectEdge} />;
179
+ case "debug-context":
180
+ return <DebugContextPanel />;
181
+ default:
182
+ return null;
183
+ }
184
+ };
185
+
186
+ const getTabLabel = (tabId: SidebarTab) => {
187
+ const tab = tabs.find((tab) => tab.id === tabId);
188
+ return tab?.label ?? "";
189
+ };
190
+
191
+ return (
192
+ <div className="flex h-full">
193
+ {/* Icon Rail - Always visible */}
194
+ <div className="w-14 bg-card border-r border-border/50 flex flex-col items-center py-3 gap-1 shrink-0">
195
+ {tabs.map((tab) => {
196
+ const Icon = tab.icon;
197
+ const isActive = activeTab === tab.id;
198
+
199
+ // Per-tab error/warning counts for icon coloring + badge.
200
+ // Diagnostics tab covers nodes+edges; channels tab covers channels.
201
+ let tabErrors = 0;
202
+ let tabWarnings = 0;
203
+ if (tab.id === "diagnostics") {
204
+ tabErrors = totalErrors;
205
+ tabWarnings = totalWarnings;
206
+ } else if (tab.id === "channels") {
207
+ tabErrors = channelErrors;
208
+ tabWarnings = channelWarnings;
209
+ } else if (tab.id === "memory") {
210
+ tabErrors = memoryErrors;
211
+ tabWarnings = memoryWarnings;
212
+ } else if (tab.id === "models") {
213
+ tabErrors = modelErrors;
214
+ tabWarnings = modelWarnings;
215
+ } else if (tab.id === "functions") {
216
+ tabErrors = functionErrors;
217
+ tabWarnings = functionWarnings;
218
+ }
219
+ const tabIssueCount = tabErrors + tabWarnings;
220
+ const showBadge = tabIssueCount > 0;
221
+
222
+ const iconColorClass =
223
+ showBadge && !isActive
224
+ ? tabErrors > 0
225
+ ? "text-destructive hover:text-destructive hover:bg-destructive/10"
226
+ : "text-warning hover:text-warning hover:bg-warning/10"
227
+ : undefined;
228
+
229
+ return (
230
+ <Tooltip key={tab.id} delayDuration={300}>
231
+ <TooltipTrigger asChild>
232
+ <Button
233
+ variant="ghost"
234
+ size="icon"
235
+ onClick={(e) => {
236
+ // Drop focus after a mouse click so a follow-up Enter doesn't
237
+ // re-fire (toggle) this tab. Keyboard activation (detail 0) keeps focus.
238
+ if (e.detail !== 0) e.currentTarget.blur();
239
+ handleTabClick(tab.id);
240
+ }}
241
+ className={cn(
242
+ "w-10 h-10 transition-all duration-200 relative",
243
+ isActive
244
+ ? "bg-accent text-primary shadow-sm"
245
+ : (iconColorClass ?? "text-muted-foreground hover:text-foreground hover:bg-accent/50"),
246
+ )}
247
+ >
248
+ <Icon className="w-5 h-5" />
249
+ {showBadge && (
250
+ <span
251
+ className={cn(
252
+ "absolute -top-0.5 -right-0.5 min-w-[16px] h-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1 shadow-sm",
253
+ tabErrors > 0
254
+ ? "bg-destructive text-destructive-foreground"
255
+ : "bg-warning text-warning-foreground",
256
+ )}
257
+ >
258
+ {tabIssueCount}
259
+ </span>
260
+ )}
261
+ </Button>
262
+ </TooltipTrigger>
263
+ <TooltipContent side="right" sideOffset={8}>
264
+ {tab.label}
265
+ </TooltipContent>
266
+ </Tooltip>
267
+ );
268
+ })}
269
+ </div>
270
+
271
+ {/* Content Panel - Slides in/out */}
272
+ <div
273
+ className={cn(
274
+ "bg-card/95 backdrop-blur-xl border-r border-border/50 transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
275
+ activeTab ? "w-64 opacity-100" : "w-0 opacity-0",
276
+ )}
277
+ >
278
+ {activeTab && (
279
+ <>
280
+ {/* Panel Header */}
281
+ <div className="flex items-center justify-between p-3 border-b border-border/50 shrink-0">
282
+ <h3 className="font-semibold text-sm text-foreground">{getTabLabel(activeTab)}</h3>
283
+ <Button
284
+ variant="ghost"
285
+ size="icon"
286
+ onClick={() => onTabChange(null)}
287
+ className="w-7 h-7 text-muted-foreground hover:text-foreground"
288
+ >
289
+ <X className="w-4 h-4" />
290
+ </Button>
291
+ </div>
292
+
293
+ {/* Panel Content — ScrollArea overlays the scrollbar in the panel's
294
+ gutter so content width stays constant whether overflow is
295
+ present or not. Padding lives on the inner viewport because the
296
+ Root must clip cleanly for the absolute-positioned scrollbar. */}
297
+ <ScrollArea className="flex-1" viewportClassName="p-3">
298
+ {renderTabContent()}
299
+ </ScrollArea>
300
+ </>
301
+ )}
302
+ </div>
303
+ </div>
304
+ );
305
+ };