@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.
- package/LICENSE +661 -661
- package/NOTICE +16 -16
- package/README.md +110 -110
- package/dist/BuilderLayout.d.ts.map +1 -1
- package/dist/BuilderLayout.js +52 -61
- package/dist/BuilderLayout.js.map +1 -1
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/Canvas.js +10 -3
- package/dist/Canvas.js.map +1 -1
- package/dist/CanvasEditor.d.ts.map +1 -1
- package/dist/CanvasEditor.js.map +1 -1
- package/dist/CanvasTabsToolbar.d.ts.map +1 -1
- package/dist/CanvasTabsToolbar.js +3 -0
- package/dist/CanvasTabsToolbar.js.map +1 -1
- package/dist/RightConfigPanel.d.ts.map +1 -1
- package/dist/RightConfigPanel.js +3 -0
- package/dist/RightConfigPanel.js.map +1 -1
- package/dist/WorkflowBuilder.d.ts +7 -13
- package/dist/WorkflowBuilder.d.ts.map +1 -1
- package/dist/WorkflowBuilder.js +25 -13
- package/dist/WorkflowBuilder.js.map +1 -1
- package/dist/cn.d.ts.map +1 -1
- package/dist/cn.js +3 -0
- package/dist/cn.js.map +1 -1
- package/dist/components/ui/add-button.d.ts.map +1 -1
- package/dist/components/ui/add-button.js +3 -0
- package/dist/components/ui/add-button.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +3 -0
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +3 -0
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +3 -0
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +3 -0
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +3 -0
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +3 -0
- package/dist/components/ui/collapsible.js.map +1 -1
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +3 -0
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/delete-button.d.ts.map +1 -1
- package/dist/components/ui/delete-button.js +3 -0
- package/dist/components/ui/delete-button.js.map +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +3 -0
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +3 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +3 -0
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +3 -0
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/readonly-banner.d.ts.map +1 -1
- package/dist/components/ui/readonly-banner.js +3 -0
- package/dist/components/ui/readonly-banner.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +3 -0
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +3 -0
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +3 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +3 -0
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +3 -0
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +3 -0
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toast.d.ts.map +1 -1
- package/dist/components/ui/toast.js +3 -0
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/toaster.d.ts.map +1 -1
- package/dist/components/ui/toaster.js +3 -0
- package/dist/components/ui/toaster.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +3 -0
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +3 -0
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +3 -0
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/dialogs/NodePickerDialog.d.ts.map +1 -1
- package/dist/dialogs/NodePickerDialog.js +3 -0
- package/dist/dialogs/NodePickerDialog.js.map +1 -1
- package/dist/dialogs/ValidationDialog.d.ts.map +1 -1
- package/dist/dialogs/ValidationDialog.js +3 -0
- package/dist/dialogs/ValidationDialog.js.map +1 -1
- package/dist/graph/BaseNode.d.ts.map +1 -1
- package/dist/graph/BaseNode.js +21 -16
- package/dist/graph/BaseNode.js.map +1 -1
- package/dist/graph/CustomEdge.d.ts.map +1 -1
- package/dist/graph/CustomEdge.js +4 -1
- package/dist/graph/CustomEdge.js.map +1 -1
- package/dist/graph/CustomNode.d.ts.map +1 -1
- package/dist/graph/CustomNode.js +3 -0
- package/dist/graph/CustomNode.js.map +1 -1
- package/dist/graph/FunctionCallNode.d.ts.map +1 -1
- package/dist/graph/FunctionCallNode.js.map +1 -1
- package/dist/graph/PortHandle.d.ts.map +1 -1
- package/dist/graph/PortHandle.js.map +1 -1
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -1
- package/dist/graph/reactFlowRegistry.js +3 -0
- package/dist/graph/reactFlowRegistry.js.map +1 -1
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +3 -0
- package/dist/hooks/use-toast.js.map +1 -1
- package/dist/hooks/useAvailableVariables.d.ts.map +1 -1
- package/dist/hooks/useAvailableVariables.js +3 -0
- package/dist/hooks/useAvailableVariables.js.map +1 -1
- package/dist/hooks/useCanvasHistory.d.ts.map +1 -1
- package/dist/hooks/useCanvasHistory.js +3 -0
- package/dist/hooks/useCanvasHistory.js.map +1 -1
- package/dist/hooks/useCanvasTabs.d.ts.map +1 -1
- package/dist/hooks/useCanvasTabs.js +3 -0
- package/dist/hooks/useCanvasTabs.js.map +1 -1
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -1
- package/dist/hooks/useFunctionDiagnosticsSync.js +3 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -1
- package/dist/hooks/useFunctionRegistry.d.ts.map +1 -1
- package/dist/hooks/useFunctionRegistry.js +3 -0
- package/dist/hooks/useFunctionRegistry.js.map +1 -1
- package/dist/hooks/useFunctions.d.ts.map +1 -1
- package/dist/hooks/useFunctions.js +3 -0
- package/dist/hooks/useFunctions.js.map +1 -1
- package/dist/hooks/useGraph.d.ts.map +1 -1
- package/dist/hooks/useGraph.js +3 -0
- package/dist/hooks/useGraph.js.map +1 -1
- package/dist/hooks/useNodeDefinitions.d.ts.map +1 -1
- package/dist/hooks/useNodeDefinitions.js +3 -0
- package/dist/hooks/useNodeDefinitions.js.map +1 -1
- package/dist/hooks/useParamErrors.d.ts.map +1 -1
- package/dist/hooks/useParamErrors.js +3 -0
- package/dist/hooks/useParamErrors.js.map +1 -1
- package/dist/hooks/useResolvedTheme.d.ts.map +1 -1
- package/dist/hooks/useResolvedTheme.js +3 -0
- package/dist/hooks/useResolvedTheme.js.map +1 -1
- package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -1
- package/dist/hooks/useResourceDiagnosticsSync.js +3 -0
- package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -1
- package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -1
- package/dist/hooks/useSuppressThemeTransition.js +3 -0
- package/dist/hooks/useSuppressThemeTransition.js.map +1 -1
- package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -1
- package/dist/hooks/useWorkflowSerialization.js +3 -0
- package/dist/hooks/useWorkflowSerialization.js.map +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/inputs/ExpressionInput.d.ts.map +1 -1
- package/dist/inputs/ExpressionInput.js +3 -0
- package/dist/inputs/ExpressionInput.js.map +1 -1
- package/dist/inputs/ParameterEditor.d.ts.map +1 -1
- package/dist/inputs/ParameterEditor.js +3 -0
- package/dist/inputs/ParameterEditor.js.map +1 -1
- package/dist/inputs/PortSection.d.ts.map +1 -1
- package/dist/inputs/PortSection.js.map +1 -1
- package/dist/mode.d.ts +11 -0
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +8 -0
- package/dist/mode.js.map +1 -0
- package/dist/panels/BuilderSidebar.d.ts.map +1 -1
- package/dist/panels/BuilderSidebar.js +3 -0
- package/dist/panels/BuilderSidebar.js.map +1 -1
- package/dist/panels/ChannelConfigPanel.d.ts.map +1 -1
- package/dist/panels/ChannelConfigPanel.js +3 -0
- package/dist/panels/ChannelConfigPanel.js.map +1 -1
- package/dist/panels/ChannelsPanel.d.ts.map +1 -1
- package/dist/panels/ChannelsPanel.js +3 -0
- package/dist/panels/ChannelsPanel.js.map +1 -1
- package/dist/panels/DebugConsolePanel.d.ts.map +1 -1
- package/dist/panels/DebugConsolePanel.js +3 -0
- package/dist/panels/DebugConsolePanel.js.map +1 -1
- package/dist/panels/DebugContextPanel.d.ts.map +1 -1
- package/dist/panels/DebugContextPanel.js +3 -0
- package/dist/panels/DebugContextPanel.js.map +1 -1
- package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -1
- package/dist/panels/DebugExternalIOPanel.js +3 -0
- package/dist/panels/DebugExternalIOPanel.js.map +1 -1
- package/dist/panels/DiagnosticsPanel.d.ts.map +1 -1
- package/dist/panels/DiagnosticsPanel.js +3 -0
- package/dist/panels/DiagnosticsPanel.js.map +1 -1
- package/dist/panels/EdgeConfigPanel.d.ts.map +1 -1
- package/dist/panels/EdgeConfigPanel.js +4 -1
- package/dist/panels/EdgeConfigPanel.js.map +1 -1
- package/dist/panels/FunctionConfigPanel.d.ts.map +1 -1
- package/dist/panels/FunctionConfigPanel.js +4 -1
- package/dist/panels/FunctionConfigPanel.js.map +1 -1
- package/dist/panels/FunctionListPanel.d.ts.map +1 -1
- package/dist/panels/FunctionListPanel.js +3 -0
- package/dist/panels/FunctionListPanel.js.map +1 -1
- package/dist/panels/MemoryConfigPanel.d.ts.map +1 -1
- package/dist/panels/MemoryConfigPanel.js +3 -0
- package/dist/panels/MemoryConfigPanel.js.map +1 -1
- package/dist/panels/MemoryPanel.d.ts.map +1 -1
- package/dist/panels/MemoryPanel.js +3 -0
- package/dist/panels/MemoryPanel.js.map +1 -1
- package/dist/panels/ModelConfigPanel.d.ts.map +1 -1
- package/dist/panels/ModelConfigPanel.js +3 -0
- package/dist/panels/ModelConfigPanel.js.map +1 -1
- package/dist/panels/ModelsPanel.d.ts.map +1 -1
- package/dist/panels/ModelsPanel.js +3 -0
- package/dist/panels/ModelsPanel.js.map +1 -1
- package/dist/panels/NodeConfigPanel.d.ts.map +1 -1
- package/dist/panels/NodeConfigPanel.js +4 -1
- package/dist/panels/NodeConfigPanel.js.map +1 -1
- package/dist/panels/NodeLibrary.d.ts.map +1 -1
- package/dist/panels/NodeLibrary.js +4 -1
- package/dist/panels/NodeLibrary.js.map +1 -1
- package/dist/panels/ResourceConfigPanel.d.ts.map +1 -1
- package/dist/panels/ResourceConfigPanel.js +4 -1
- package/dist/panels/ResourceConfigPanel.js.map +1 -1
- package/dist/panels/ResourceListPanel.d.ts.map +1 -1
- package/dist/panels/ResourceListPanel.js +4 -1
- package/dist/panels/ResourceListPanel.js.map +1 -1
- package/dist/panels/VariableConfigPanel.d.ts.map +1 -1
- package/dist/panels/VariableConfigPanel.js +4 -1
- package/dist/panels/VariableConfigPanel.js.map +1 -1
- package/dist/panels/VariablesPanel.d.ts.map +1 -1
- package/dist/panels/VariablesPanel.js +4 -1
- package/dist/panels/VariablesPanel.js.map +1 -1
- package/dist/stores/canvasStore.d.ts.map +1 -1
- package/dist/stores/canvasStore.js +3 -0
- package/dist/stores/canvasStore.js.map +1 -1
- package/dist/stores/debugStore.d.ts.map +1 -1
- package/dist/stores/debugStore.js +3 -0
- package/dist/stores/debugStore.js.map +1 -1
- package/dist/stores/diagnosticsStore.d.ts.map +1 -1
- package/dist/stores/diagnosticsStore.js +3 -0
- package/dist/stores/diagnosticsStore.js.map +1 -1
- package/dist/stores/editorStore.d.ts +1 -1
- package/dist/stores/editorStore.d.ts.map +1 -1
- package/dist/stores/editorStore.js +3 -0
- package/dist/stores/editorStore.js.map +1 -1
- package/dist/utils/categoryConstants.d.ts.map +1 -1
- package/dist/utils/categoryConstants.js +3 -0
- package/dist/utils/categoryConstants.js.map +1 -1
- package/dist/utils/channelOperations.d.ts.map +1 -1
- package/dist/utils/channelOperations.js +3 -0
- package/dist/utils/channelOperations.js.map +1 -1
- package/dist/utils/connectionRules.d.ts +3 -1
- package/dist/utils/connectionRules.d.ts.map +1 -1
- package/dist/utils/connectionRules.js +11 -16
- package/dist/utils/connectionRules.js.map +1 -1
- package/dist/utils/functionOperations.d.ts.map +1 -1
- package/dist/utils/functionOperations.js +3 -0
- package/dist/utils/functionOperations.js.map +1 -1
- package/dist/utils/graphOperations.d.ts.map +1 -1
- package/dist/utils/graphOperations.js +3 -0
- package/dist/utils/graphOperations.js.map +1 -1
- package/dist/utils/history.d.ts.map +1 -1
- package/dist/utils/history.js +4 -1
- package/dist/utils/history.js.map +1 -1
- package/dist/utils/memoryOperations.d.ts.map +1 -1
- package/dist/utils/memoryOperations.js +3 -0
- package/dist/utils/memoryOperations.js.map +1 -1
- package/dist/utils/migrateFunctionNodes.d.ts.map +1 -1
- package/dist/utils/migrateFunctionNodes.js +3 -0
- package/dist/utils/migrateFunctionNodes.js.map +1 -1
- package/dist/utils/modelOperations.d.ts.map +1 -1
- package/dist/utils/modelOperations.js +3 -0
- package/dist/utils/modelOperations.js.map +1 -1
- package/dist/utils/paramDisplay.d.ts.map +1 -1
- package/dist/utils/paramDisplay.js +3 -0
- package/dist/utils/paramDisplay.js.map +1 -1
- package/dist/utils/resourceHelpers.d.ts.map +1 -1
- package/dist/utils/resourceHelpers.js +3 -0
- package/dist/utils/resourceHelpers.js.map +1 -1
- package/dist/utils/translation.d.ts.map +1 -1
- package/dist/utils/translation.js +3 -0
- package/dist/utils/translation.js.map +1 -1
- package/dist/utils/variableOperations.d.ts.map +1 -1
- package/dist/utils/variableOperations.js +3 -0
- package/dist/utils/variableOperations.js.map +1 -1
- package/package.json +2 -2
- package/src/BuilderLayout.tsx +338 -345
- package/src/Canvas.tsx +270 -261
- package/src/CanvasEditor.tsx +146 -142
- package/src/CanvasTabsToolbar.tsx +180 -176
- package/src/RightConfigPanel.tsx +270 -266
- package/src/WorkflowBuilder.tsx +423 -408
- package/src/cn.ts +10 -6
- package/src/components/ui/add-button.tsx +43 -39
- package/src/components/ui/alert-dialog.tsx +145 -141
- package/src/components/ui/alert.tsx +63 -59
- package/src/components/ui/badge.tsx +40 -36
- package/src/components/ui/button.tsx +89 -85
- package/src/components/ui/card.tsx +83 -79
- package/src/components/ui/checkbox.tsx +32 -28
- package/src/components/ui/collapsible.tsx +13 -9
- package/src/components/ui/command.tsx +157 -153
- package/src/components/ui/delete-button.tsx +27 -23
- package/src/components/ui/dialog.tsx +129 -125
- package/src/components/ui/dropdown-menu.tsx +202 -198
- package/src/components/ui/input.tsx +59 -55
- package/src/components/ui/label.tsx +28 -24
- package/src/components/ui/readonly-banner.tsx +19 -15
- package/src/components/ui/resizable.tsx +47 -43
- package/src/components/ui/scroll-area.tsx +106 -102
- package/src/components/ui/select.tsx +164 -160
- package/src/components/ui/separator.tsx +33 -29
- package/src/components/ui/switch.tsx +31 -27
- package/src/components/ui/textarea.tsx +55 -51
- package/src/components/ui/toast.tsx +131 -127
- package/src/components/ui/toaster.tsx +37 -33
- package/src/components/ui/toggle-group.tsx +63 -59
- package/src/components/ui/toggle.tsx +47 -43
- package/src/components/ui/tooltip.tsx +36 -32
- package/src/dialogs/NodePickerDialog.tsx +88 -84
- package/src/dialogs/ValidationDialog.tsx +188 -184
- package/src/graph/BaseNode.tsx +563 -557
- package/src/graph/CustomEdge.tsx +189 -185
- package/src/graph/CustomNode.tsx +20 -16
- package/src/graph/FunctionCallNode.tsx +34 -30
- package/src/graph/PortHandle.tsx +193 -189
- package/src/graph/reactFlowRegistry.ts +30 -26
- package/src/hooks/use-toast.ts +129 -125
- package/src/hooks/useAvailableVariables.ts +24 -20
- package/src/hooks/useCanvasHistory.ts +26 -22
- package/src/hooks/useCanvasTabs.ts +172 -168
- package/src/hooks/useFunctionDiagnosticsSync.ts +44 -40
- package/src/hooks/useFunctionRegistry.ts +30 -26
- package/src/hooks/useFunctions.ts +48 -44
- package/src/hooks/useGraph.ts +165 -161
- package/src/hooks/useNodeDefinitions.ts +86 -82
- package/src/hooks/useParamErrors.ts +30 -26
- package/src/hooks/useResolvedTheme.ts +34 -30
- package/src/hooks/useResourceDiagnosticsSync.ts +62 -58
- package/src/hooks/useSuppressThemeTransition.ts +83 -79
- package/src/hooks/useWorkflowSerialization.ts +145 -141
- package/src/i18n/index.ts +57 -53
- package/src/i18n/locales/de.json +501 -501
- package/src/i18n/locales/en.json +557 -557
- package/src/index.ts +31 -27
- package/src/inputs/ExpressionInput.tsx +301 -297
- package/src/inputs/ParameterEditor.tsx +519 -515
- package/src/inputs/PortSection.tsx +148 -144
- package/src/mode.ts +15 -0
- package/src/panels/BuilderSidebar.tsx +305 -301
- package/src/panels/ChannelConfigPanel.tsx +53 -49
- package/src/panels/ChannelsPanel.tsx +32 -28
- package/src/panels/DebugConsolePanel.tsx +77 -73
- package/src/panels/DebugContextPanel.tsx +81 -77
- package/src/panels/DebugExternalIOPanel.tsx +184 -180
- package/src/panels/DiagnosticsPanel.tsx +174 -170
- package/src/panels/EdgeConfigPanel.tsx +108 -104
- package/src/panels/FunctionConfigPanel.tsx +183 -179
- package/src/panels/FunctionListPanel.tsx +49 -45
- package/src/panels/MemoryConfigPanel.tsx +59 -55
- package/src/panels/MemoryPanel.tsx +44 -40
- package/src/panels/ModelConfigPanel.tsx +45 -41
- package/src/panels/ModelsPanel.tsx +40 -36
- package/src/panels/NodeConfigPanel.tsx +634 -630
- package/src/panels/NodeLibrary.tsx +292 -288
- package/src/panels/ResourceConfigPanel.tsx +136 -132
- package/src/panels/ResourceListPanel.tsx +117 -113
- package/src/panels/VariableConfigPanel.tsx +165 -161
- package/src/panels/VariablesPanel.tsx +149 -145
- package/src/stores/canvasStore.test.ts +48 -44
- package/src/stores/canvasStore.ts +249 -245
- package/src/stores/debugStore.ts +78 -74
- package/src/stores/diagnosticsStore.ts +134 -130
- package/src/stores/editorStore.ts +194 -190
- package/src/styles/index.css +526 -526
- package/src/utils/categoryConstants.ts +30 -26
- package/src/utils/channelOperations.ts +90 -86
- package/src/utils/connectionRules.ts +140 -137
- package/src/utils/functionOperations.ts +183 -179
- package/src/utils/graphOperations.ts +554 -550
- package/src/utils/history.test.ts +92 -0
- package/src/utils/history.ts +211 -207
- package/src/utils/memoryOperations.ts +61 -57
- package/src/utils/migrateFunctionNodes.ts +111 -107
- package/src/utils/modelOperations.ts +59 -55
- package/src/utils/paramDisplay.ts +75 -71
- package/src/utils/resourceHelpers.ts +36 -32
- package/src/utils/translation.ts +32 -28
- package/src/utils/variableOperations.ts +79 -75
- package/tailwind-preset.ts +170 -166
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -6
- package/dist/lib/utils.js.map +0 -1
- package/dist/toolbars/CanvasTabsToolbar.d.ts +0 -11
- package/dist/toolbars/CanvasTabsToolbar.d.ts.map +0 -1
- package/dist/toolbars/CanvasTabsToolbar.js +0 -101
- package/dist/toolbars/CanvasTabsToolbar.js.map +0 -1
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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 { useEffect } from "react";
|
|
6
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
7
|
+
import { useDiagnosticsStore } from "../stores/diagnosticsStore";
|
|
8
|
+
import type { Diagnostic } from "@foresthubai/workflow-core/diagnostics";
|
|
9
|
+
|
|
10
|
+
type EditorState = ReturnType<typeof useEditorStore.getState>;
|
|
11
|
+
type DiagnosticsState = ReturnType<typeof useDiagnosticsStore.getState>;
|
|
12
|
+
|
|
13
|
+
interface ResourceDiagnosticsSyncConfig<I extends { id: string }> {
|
|
14
|
+
/** Pick the resource map (e.g. `s.channels`) off the editor store. */
|
|
15
|
+
selectItems: (s: EditorState) => Record<string, I>;
|
|
16
|
+
/** Validate one instance into its diagnostics. */
|
|
17
|
+
validate: (item: I) => Diagnostic[];
|
|
18
|
+
/** Read the matching diagnostics slot (e.g. `d.byChannelId`). */
|
|
19
|
+
getStored: (d: DiagnosticsState) => Record<string, Diagnostic[]>;
|
|
20
|
+
/** Write one instance's diagnostics. */
|
|
21
|
+
set: (d: DiagnosticsState, id: string, diags: Diagnostic[]) => void;
|
|
22
|
+
/** Drop one instance's diagnostics. */
|
|
23
|
+
clear: (d: DiagnosticsState, id: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Keeps a project-scoped diagnostics slot (`byChannelId` / `byMemoryId` /
|
|
28
|
+
* `byModelId`) in sync with the editor's resource map.
|
|
29
|
+
*
|
|
30
|
+
* These resources are project-scoped, not canvas-scoped, and are only rendered
|
|
31
|
+
* visually when their sidebar tab is open. Tying diagnostic writes to card
|
|
32
|
+
* lifecycles would mean errors vanish the moment that tab closes, so this hook
|
|
33
|
+
* is mounted once at the workflow-builder root and reactively rewrites the store
|
|
34
|
+
* whenever the resource map changes.
|
|
35
|
+
*
|
|
36
|
+
* Lifecycle handled implicitly by the effect:
|
|
37
|
+
* - Load → setItems fires → effect re-runs → diagnostics written
|
|
38
|
+
* - Edit → store mutates → effect re-runs → entry replaced
|
|
39
|
+
* - Delete → item leaves → orphan branch → entry cleared
|
|
40
|
+
* - Unmount → store goes down with the app (no cleanup needed)
|
|
41
|
+
*/
|
|
42
|
+
export function useResourceDiagnosticsSync<I extends { id: string }>(config: ResourceDiagnosticsSyncConfig<I>): void {
|
|
43
|
+
const items = useEditorStore(config.selectItems);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const ds = useDiagnosticsStore.getState();
|
|
47
|
+
|
|
48
|
+
const seen = new Set<string>();
|
|
49
|
+
for (const item of Object.values(items)) {
|
|
50
|
+
seen.add(item.id);
|
|
51
|
+
config.set(ds, item.id, config.validate(item));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Drop entries for items that have been deleted.
|
|
55
|
+
for (const id of Object.keys(config.getStored(ds))) {
|
|
56
|
+
if (!seen.has(id)) config.clear(ds, id);
|
|
57
|
+
}
|
|
58
|
+
// `config` is recreated each render but only `items` drives a resync; the
|
|
59
|
+
// effect reads the latest closure on every run.
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, [items]);
|
|
62
|
+
}
|
|
@@ -1,79 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
root.classList.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
root.classList.
|
|
78
|
-
|
|
79
|
-
|
|
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 { useEffect, useLayoutEffect } from "react";
|
|
6
|
+
|
|
7
|
+
import { useResolvedTheme } from "./useResolvedTheme";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Makes color-mode switches snap instead of fade.
|
|
11
|
+
*
|
|
12
|
+
* The embedder toggles the `light` class on `<html>`. Two different mechanisms
|
|
13
|
+
* recolor the UI when it does, and both would otherwise animate to the new
|
|
14
|
+
* tokens over their transition duration:
|
|
15
|
+
*
|
|
16
|
+
* 1. CSS-variable cascade — components with `transition-all` (canvas tabs, the
|
|
17
|
+
* builder sidebar). These recolor the instant the class flips.
|
|
18
|
+
* 2. React re-render — ReactFlow's controls and node chrome recolor only once
|
|
19
|
+
* `useResolvedTheme` re-renders and ReactFlow re-applies its `colorMode`
|
|
20
|
+
* class, which commits a tick or two *after* the class flip.
|
|
21
|
+
*
|
|
22
|
+
* So a fixed one-frame suppression window catches (1) but misses (2). Instead:
|
|
23
|
+
*
|
|
24
|
+
* - A MutationObserver adds `theme-changing` (CSS kills all transitions under
|
|
25
|
+
* it) the moment the class flips — a microtask, before any paint — and forces
|
|
26
|
+
* a reflow so the cascade-driven colors commit with no transition.
|
|
27
|
+
* - A layout effect keyed on the resolved theme removes it. Parent layout
|
|
28
|
+
* effects run after children's, so this fires after ReactFlow has committed
|
|
29
|
+
* its `colorMode` change; a reflow first flushes those colors while
|
|
30
|
+
* transitions are still suppressed, then we restore them. Tying removal to
|
|
31
|
+
* the React commit (not a timer) makes it deterministic regardless of how
|
|
32
|
+
* late the re-render lands.
|
|
33
|
+
*
|
|
34
|
+
* A short fallback timer removes the class even if no re-render follows, so a
|
|
35
|
+
* theme-only-affects-CSS flip can never leave transitions permanently off.
|
|
36
|
+
*
|
|
37
|
+
* Mount once at the builder root.
|
|
38
|
+
*/
|
|
39
|
+
export function useSuppressThemeTransition(): void {
|
|
40
|
+
// Re-renders on every color-mode flip; drives the layout effect below.
|
|
41
|
+
const theme = useResolvedTheme();
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (typeof document === "undefined") return;
|
|
45
|
+
const root = document.documentElement;
|
|
46
|
+
|
|
47
|
+
let wasLight = root.classList.contains("light");
|
|
48
|
+
let fallback = 0;
|
|
49
|
+
|
|
50
|
+
const observer = new MutationObserver(() => {
|
|
51
|
+
const isLight = root.classList.contains("light");
|
|
52
|
+
if (isLight === wasLight) return; // class changed for some other reason
|
|
53
|
+
wasLight = isLight;
|
|
54
|
+
|
|
55
|
+
root.classList.add("theme-changing");
|
|
56
|
+
// Force a synchronous reflow so cascade-driven colors commit while
|
|
57
|
+
// transitions are disabled, before the browser's next paint.
|
|
58
|
+
void root.offsetHeight;
|
|
59
|
+
|
|
60
|
+
// Safety net: if no React re-render follows (theme flip touched only CSS),
|
|
61
|
+
// the layout effect won't run — drop the class anyway after a beat.
|
|
62
|
+
clearTimeout(fallback);
|
|
63
|
+
fallback = window.setTimeout(() => root.classList.remove("theme-changing"), 120);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
observer.observe(root, { attributes: true, attributeFilter: ["class"] });
|
|
67
|
+
return () => {
|
|
68
|
+
observer.disconnect();
|
|
69
|
+
clearTimeout(fallback);
|
|
70
|
+
root.classList.remove("theme-changing");
|
|
71
|
+
};
|
|
72
|
+
}, []);
|
|
73
|
+
|
|
74
|
+
useLayoutEffect(() => {
|
|
75
|
+
if (typeof document === "undefined") return;
|
|
76
|
+
const root = document.documentElement;
|
|
77
|
+
if (!root.classList.contains("theme-changing")) return; // initial mount, no flip
|
|
78
|
+
// ReactFlow has committed its colorMode change by now (child layout effects
|
|
79
|
+
// run first). Flush those colors under suppression, then restore transitions.
|
|
80
|
+
void root.offsetHeight;
|
|
81
|
+
root.classList.remove("theme-changing");
|
|
82
|
+
}, [theme]);
|
|
83
|
+
}
|
|
@@ -1,141 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import type
|
|
7
|
-
import
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, []);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
editor.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
editor.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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 { useCallback } from "react";
|
|
6
|
+
import { serialize, deserialize, type ApiWorkflow, type Workflow, type Canvas } from "@foresthubai/workflow-core/workflow";
|
|
7
|
+
import { migrate } from "@foresthubai/workflow-core/migration";
|
|
8
|
+
import type { NodeData } from "@foresthubai/workflow-core/node";
|
|
9
|
+
import type { EdgeData } from "@foresthubai/workflow-core/edge";
|
|
10
|
+
import type { Channel } from "@foresthubai/workflow-core/channel";
|
|
11
|
+
import type { Memory } from "@foresthubai/workflow-core/memory";
|
|
12
|
+
import type { Model } from "@foresthubai/workflow-core/model";
|
|
13
|
+
import { Edge, Node } from "@xyflow/react";
|
|
14
|
+
import { clearAllCanvasStores, getOrCreateCanvasStore, getAllCanvasStores, notifyCanvasRegistryChange, MAIN_CANVAS_ID } from "../stores/canvasStore";
|
|
15
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
16
|
+
import { getReactFlowType } from "../utils/graphOperations";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Store-bound wrapper around the headless `serialize`/`deserialize` in
|
|
20
|
+
* `@foresthubai/workflow-core/workflow`. All conversion logic lives in core;
|
|
21
|
+
* this hook only mediates Zustand I/O.
|
|
22
|
+
*
|
|
23
|
+
* Core sets each node's outer `type` to the domain node type (e.g.
|
|
24
|
+
* "Agent"); React Flow needs the *display* type — `getReactFlowType`
|
|
25
|
+
* handles that on import.
|
|
26
|
+
*/
|
|
27
|
+
export function useWorkflowSerialization() {
|
|
28
|
+
const importProject = useCallback((workflow: ApiWorkflow): void => {
|
|
29
|
+
// Migrate at the load boundary so an older saved document is brought current
|
|
30
|
+
// before deserialize ever sees it. A no-op on an already-current document.
|
|
31
|
+
const state = deserialize(migrate(workflow));
|
|
32
|
+
|
|
33
|
+
clearAllCanvasStores();
|
|
34
|
+
|
|
35
|
+
// Bodies → canvas stores. The function declarations are already in domain shape
|
|
36
|
+
// (FunctionDeclaration) on state.functions; the body is the canvas at the same id.
|
|
37
|
+
for (const [canvasId, canvas] of Object.entries(state.canvases)) {
|
|
38
|
+
const store = getOrCreateCanvasStore(canvasId);
|
|
39
|
+
const rfNodes: Node<NodeData>[] = canvas.nodes.map((n) => ({
|
|
40
|
+
id: n.id,
|
|
41
|
+
type: getReactFlowType(n.type),
|
|
42
|
+
position: n.position,
|
|
43
|
+
data: n,
|
|
44
|
+
}));
|
|
45
|
+
const rfEdges: Edge<EdgeData>[] = canvas.edges.map((e) => ({
|
|
46
|
+
id: e.id,
|
|
47
|
+
type: e.type,
|
|
48
|
+
source: e.source,
|
|
49
|
+
sourceHandle: e.sourceHandle,
|
|
50
|
+
target: e.target,
|
|
51
|
+
targetHandle: e.targetHandle,
|
|
52
|
+
...(e.data ? { data: e.data } : {}),
|
|
53
|
+
}));
|
|
54
|
+
store.getState().initialize(rfNodes, rfEdges);
|
|
55
|
+
// `initialize` rebuilds node-output vars from the nodes. Replace with the
|
|
56
|
+
// fully merged set core already computed (includes declared + fnarg).
|
|
57
|
+
store.getState().setVariables(() => canvas.variables);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Reconcile project-scoped resources to exactly what this workflow declares.
|
|
61
|
+
// The editor stores are module-level and outlive the previously loaded project,
|
|
62
|
+
// so a workflow that declares none of a given kind must still reset it —
|
|
63
|
+
// otherwise the prior project's channels/memory/models bleed in (the canvas
|
|
64
|
+
// stores get this for free via clearAllCanvasStores above, as does setFunctions).
|
|
65
|
+
const { channels, memory, models } = state;
|
|
66
|
+
useEditorStore.getState().setChannels(() => channels);
|
|
67
|
+
useEditorStore.getState().setMemory(() => memory);
|
|
68
|
+
useEditorStore.getState().setModels(() => models);
|
|
69
|
+
useEditorStore.getState().setFunctions(() => state.functions);
|
|
70
|
+
|
|
71
|
+
// The function canvas stores were created after clearAllCanvasStores' notify,
|
|
72
|
+
// so tell WorkflowBuilder to re-subscribe to the new set.
|
|
73
|
+
notifyCanvasRegistryChange();
|
|
74
|
+
}, []);
|
|
75
|
+
|
|
76
|
+
const exportProject = useCallback((): ApiWorkflow => {
|
|
77
|
+
return serialize(readStateFromStores());
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
// Inverse of importProject: reset every (module-level) store to empty so a fresh
|
|
81
|
+
// builder never inherits the previously mounted project. Used by the clear() handle
|
|
82
|
+
// and on mount when no initialWorkflow is supplied.
|
|
83
|
+
const clearProject = useCallback((): void => {
|
|
84
|
+
clearAllCanvasStores(); // drops all canvas stores, re-seeds an empty main, notifies
|
|
85
|
+
const editor = useEditorStore.getState();
|
|
86
|
+
// A stale non-main activeCanvasId would lazily resurrect a phantom function body.
|
|
87
|
+
editor.setActiveCanvas(MAIN_CANVAS_ID);
|
|
88
|
+
// Project-scoped resources aren't touched by clearAllCanvasStores. Empty only when
|
|
89
|
+
// non-empty so an already-clean store doesn't bump mutationCount (as importProject).
|
|
90
|
+
editor.setChannels((c) => (Object.keys(c).length ? {} : c));
|
|
91
|
+
editor.setMemory((m) => (Object.keys(m).length ? {} : m));
|
|
92
|
+
editor.setModels((m) => (Object.keys(m).length ? {} : m));
|
|
93
|
+
editor.setFunctions((f) => (Object.keys(f).length ? {} : f));
|
|
94
|
+
editor.clearSelection();
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
return { exportProject, importProject, clearProject };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Read the editor's live Zustand state into a {@link Workflow} literal.
|
|
102
|
+
* Peels the React Flow wrapper without recomputing anything; channels and
|
|
103
|
+
* memory files are unprefixed for the core shape.
|
|
104
|
+
*
|
|
105
|
+
* Exported so the imperative handle can pass live state to
|
|
106
|
+
* `validateWorkflowState` without a serialize/deserialize round-trip.
|
|
107
|
+
*/
|
|
108
|
+
export function readStateFromStores(): Workflow {
|
|
109
|
+
const canvases: Record<string, Canvas> = {};
|
|
110
|
+
for (const [id, store] of Object.entries(getAllCanvasStores())) {
|
|
111
|
+
const s = store.getState();
|
|
112
|
+
canvases[id] = {
|
|
113
|
+
nodes: s.nodes.map((n) => ({ ...n.data, position: n.position })),
|
|
114
|
+
edges: s.edges.map((e) => ({
|
|
115
|
+
id: e.id,
|
|
116
|
+
type: e.type,
|
|
117
|
+
source: e.source,
|
|
118
|
+
sourceHandle: e.sourceHandle,
|
|
119
|
+
target: e.target,
|
|
120
|
+
targetHandle: e.targetHandle,
|
|
121
|
+
...(e.data ? { data: e.data } : {}),
|
|
122
|
+
})),
|
|
123
|
+
variables: s.variables,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const channels: Record<string, Channel> = {};
|
|
128
|
+
for (const ch of Object.values(useEditorStore.getState().channels)) channels[ch.id] = ch;
|
|
129
|
+
|
|
130
|
+
const memory: Record<string, Memory> = {};
|
|
131
|
+
for (const m of Object.values(useEditorStore.getState().memory)) memory[m.id] = m;
|
|
132
|
+
|
|
133
|
+
const models: Record<string, Model> = {};
|
|
134
|
+
for (const m of Object.values(useEditorStore.getState().models)) models[m.id] = m;
|
|
135
|
+
|
|
136
|
+
// Function declarations are project-scoped and already in domain shape; the body
|
|
137
|
+
// for each is the canvas at the same id (above).
|
|
138
|
+
return {
|
|
139
|
+
canvases,
|
|
140
|
+
functions: useEditorStore.getState().functions,
|
|
141
|
+
channels,
|
|
142
|
+
memory,
|
|
143
|
+
models,
|
|
144
|
+
};
|
|
145
|
+
}
|