@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.
- package/LICENSE +661 -0
- package/NOTICE +16 -0
- package/README.md +93 -0
- package/dist/BuilderLayout.d.ts +34 -0
- package/dist/BuilderLayout.d.ts.map +1 -0
- package/dist/BuilderLayout.js +172 -0
- package/dist/BuilderLayout.js.map +1 -0
- package/dist/Canvas.d.ts +23 -0
- package/dist/Canvas.d.ts.map +1 -0
- package/dist/Canvas.js +141 -0
- package/dist/Canvas.js.map +1 -0
- package/dist/CanvasEditor.d.ts +46 -0
- package/dist/CanvasEditor.d.ts.map +1 -0
- package/dist/CanvasEditor.js +57 -0
- package/dist/CanvasEditor.js.map +1 -0
- package/dist/CanvasTabsToolbar.d.ts +11 -0
- package/dist/CanvasTabsToolbar.d.ts.map +1 -0
- package/dist/CanvasTabsToolbar.js +101 -0
- package/dist/CanvasTabsToolbar.js.map +1 -0
- package/dist/RightConfigPanel.d.ts +27 -0
- package/dist/RightConfigPanel.d.ts.map +1 -0
- package/dist/RightConfigPanel.js +102 -0
- package/dist/RightConfigPanel.js.map +1 -0
- package/dist/WorkflowBuilder.d.ts +62 -0
- package/dist/WorkflowBuilder.d.ts.map +1 -0
- package/dist/WorkflowBuilder.js +275 -0
- package/dist/WorkflowBuilder.js.map +1 -0
- package/dist/cn.d.ts +3 -0
- package/dist/cn.d.ts.map +1 -0
- package/dist/cn.js +6 -0
- package/dist/cn.js.map +1 -0
- package/dist/components/ui/add-button.d.ts +16 -0
- package/dist/components/ui/add-button.d.ts.map +1 -0
- package/dist/components/ui/add-button.js +21 -0
- package/dist/components/ui/add-button.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +30 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +23 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +21 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +40 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +6 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +82 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +29 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/delete-button.d.ts +11 -0
- package/dist/components/ui/delete-button.d.ts.map +1 -0
- package/dist/components/ui/delete-button.js +14 -0
- package/dist/components/ui/delete-button.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +22 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +27 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +36 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +13 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +34 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +10 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/readonly-banner.d.ts +7 -0
- package/dist/components/ui/readonly-banner.d.ts.map +1 -0
- package/dist/components/ui/readonly-banner.js +12 -0
- package/dist/components/ui/readonly-banner.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +24 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +9 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +45 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +27 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +30 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +12 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +34 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +34 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toaster.d.ts +2 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +10 -0
- package/dist/components/ui/toaster.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +21 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +14 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/dialogs/NodePickerDialog.d.ts +10 -0
- package/dist/dialogs/NodePickerDialog.d.ts.map +1 -0
- package/dist/dialogs/NodePickerDialog.js +39 -0
- package/dist/dialogs/NodePickerDialog.js.map +1 -0
- package/dist/dialogs/ValidationDialog.d.ts +17 -0
- package/dist/dialogs/ValidationDialog.d.ts.map +1 -0
- package/dist/dialogs/ValidationDialog.js +29 -0
- package/dist/dialogs/ValidationDialog.js.map +1 -0
- package/dist/graph/BaseNode.d.ts +9 -0
- package/dist/graph/BaseNode.d.ts.map +1 -0
- package/dist/graph/BaseNode.js +318 -0
- package/dist/graph/BaseNode.js.map +1 -0
- package/dist/graph/CustomEdge.d.ts +14 -0
- package/dist/graph/CustomEdge.d.ts.map +1 -0
- package/dist/graph/CustomEdge.js +107 -0
- package/dist/graph/CustomEdge.js.map +1 -0
- package/dist/graph/CustomNode.d.ts +3 -0
- package/dist/graph/CustomNode.d.ts.map +1 -0
- package/dist/graph/CustomNode.js +15 -0
- package/dist/graph/CustomNode.js.map +1 -0
- package/dist/graph/FunctionCallNode.d.ts +3 -0
- package/dist/graph/FunctionCallNode.d.ts.map +1 -0
- package/dist/graph/FunctionCallNode.js +25 -0
- package/dist/graph/FunctionCallNode.js.map +1 -0
- package/dist/graph/PortHandle.d.ts +21 -0
- package/dist/graph/PortHandle.d.ts.map +1 -0
- package/dist/graph/PortHandle.js +113 -0
- package/dist/graph/PortHandle.js.map +1 -0
- package/dist/graph/reactFlowRegistry.d.ts +65 -0
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -0
- package/dist/graph/reactFlowRegistry.js +24 -0
- package/dist/graph/reactFlowRegistry.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +47 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +95 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/hooks/useAvailableVariables.d.ts +12 -0
- package/dist/hooks/useAvailableVariables.d.ts.map +1 -0
- package/dist/hooks/useAvailableVariables.js +16 -0
- package/dist/hooks/useAvailableVariables.js.map +1 -0
- package/dist/hooks/useCanvasHistory.d.ts +14 -0
- package/dist/hooks/useCanvasHistory.d.ts.map +1 -0
- package/dist/hooks/useCanvasHistory.js +20 -0
- package/dist/hooks/useCanvasHistory.js.map +1 -0
- package/dist/hooks/useCanvasTabs.d.ts +23 -0
- package/dist/hooks/useCanvasTabs.d.ts.map +1 -0
- package/dist/hooks/useCanvasTabs.js +136 -0
- package/dist/hooks/useCanvasTabs.js.map +1 -0
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts +14 -0
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js +38 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -0
- package/dist/hooks/useFunctionRegistry.d.ts +15 -0
- package/dist/hooks/useFunctionRegistry.d.ts.map +1 -0
- package/dist/hooks/useFunctionRegistry.js +22 -0
- package/dist/hooks/useFunctionRegistry.js.map +1 -0
- package/dist/hooks/useFunctions.d.ts +15 -0
- package/dist/hooks/useFunctions.d.ts.map +1 -0
- package/dist/hooks/useFunctions.js +34 -0
- package/dist/hooks/useFunctions.js.map +1 -0
- package/dist/hooks/useGraph.d.ts +40 -0
- package/dist/hooks/useGraph.d.ts.map +1 -0
- package/dist/hooks/useGraph.js +102 -0
- package/dist/hooks/useGraph.js.map +1 -0
- package/dist/hooks/useNodeDefinitions.d.ts +17 -0
- package/dist/hooks/useNodeDefinitions.d.ts.map +1 -0
- package/dist/hooks/useNodeDefinitions.js +65 -0
- package/dist/hooks/useNodeDefinitions.js.map +1 -0
- package/dist/hooks/useParamErrors.d.ts +12 -0
- package/dist/hooks/useParamErrors.d.ts.map +1 -0
- package/dist/hooks/useParamErrors.js +28 -0
- package/dist/hooks/useParamErrors.js.map +1 -0
- package/dist/hooks/useResolvedTheme.d.ts +10 -0
- package/dist/hooks/useResolvedTheme.d.ts.map +1 -0
- package/dist/hooks/useResolvedTheme.js +29 -0
- package/dist/hooks/useResolvedTheme.js.map +1 -0
- package/dist/hooks/useResourceDiagnosticsSync.d.ts +40 -0
- package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -0
- package/dist/hooks/useResourceDiagnosticsSync.js +39 -0
- package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -0
- package/dist/hooks/useSuppressThemeTransition.d.ts +32 -0
- package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -0
- package/dist/hooks/useSuppressThemeTransition.js +75 -0
- package/dist/hooks/useSuppressThemeTransition.js.map +1 -0
- package/dist/hooks/useWorkflowSerialization.d.ts +24 -0
- package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -0
- package/dist/hooks/useWorkflowSerialization.js +113 -0
- package/dist/hooks/useWorkflowSerialization.js.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +46 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/locales/de.json +501 -0
- package/dist/i18n/locales/en.json +557 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/ExpressionInput.d.ts +12 -0
- package/dist/inputs/ExpressionInput.d.ts.map +1 -0
- package/dist/inputs/ExpressionInput.js +203 -0
- package/dist/inputs/ExpressionInput.js.map +1 -0
- package/dist/inputs/ParameterEditor.d.ts +13 -0
- package/dist/inputs/ParameterEditor.d.ts.map +1 -0
- package/dist/inputs/ParameterEditor.js +204 -0
- package/dist/inputs/ParameterEditor.js.map +1 -0
- package/dist/inputs/PortSection.d.ts +31 -0
- package/dist/inputs/PortSection.d.ts.map +1 -0
- package/dist/inputs/PortSection.js +26 -0
- package/dist/inputs/PortSection.js.map +1 -0
- package/dist/panels/BuilderSidebar.d.ts +24 -0
- package/dist/panels/BuilderSidebar.d.ts.map +1 -0
- package/dist/panels/BuilderSidebar.js +202 -0
- package/dist/panels/BuilderSidebar.js.map +1 -0
- package/dist/panels/ChannelConfigPanel.d.ts +8 -0
- package/dist/panels/ChannelConfigPanel.d.ts.map +1 -0
- package/dist/panels/ChannelConfigPanel.js +26 -0
- package/dist/panels/ChannelConfigPanel.js.map +1 -0
- package/dist/panels/ChannelsPanel.d.ts +2 -0
- package/dist/panels/ChannelsPanel.d.ts.map +1 -0
- package/dist/panels/ChannelsPanel.js +16 -0
- package/dist/panels/ChannelsPanel.js.map +1 -0
- package/dist/panels/DebugConsolePanel.d.ts +2 -0
- package/dist/panels/DebugConsolePanel.d.ts.map +1 -0
- package/dist/panels/DebugConsolePanel.js +32 -0
- package/dist/panels/DebugConsolePanel.js.map +1 -0
- package/dist/panels/DebugContextPanel.d.ts +2 -0
- package/dist/panels/DebugContextPanel.d.ts.map +1 -0
- package/dist/panels/DebugContextPanel.js +32 -0
- package/dist/panels/DebugContextPanel.js.map +1 -0
- package/dist/panels/DebugExternalIOPanel.d.ts +9 -0
- package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -0
- package/dist/panels/DebugExternalIOPanel.js +66 -0
- package/dist/panels/DebugExternalIOPanel.js.map +1 -0
- package/dist/panels/DiagnosticsPanel.d.ts +8 -0
- package/dist/panels/DiagnosticsPanel.d.ts.map +1 -0
- package/dist/panels/DiagnosticsPanel.js +86 -0
- package/dist/panels/DiagnosticsPanel.js.map +1 -0
- package/dist/panels/EdgeConfigPanel.d.ts +14 -0
- package/dist/panels/EdgeConfigPanel.d.ts.map +1 -0
- package/dist/panels/EdgeConfigPanel.js +34 -0
- package/dist/panels/EdgeConfigPanel.js.map +1 -0
- package/dist/panels/FunctionConfigPanel.d.ts +16 -0
- package/dist/panels/FunctionConfigPanel.d.ts.map +1 -0
- package/dist/panels/FunctionConfigPanel.js +62 -0
- package/dist/panels/FunctionConfigPanel.js.map +1 -0
- package/dist/panels/FunctionListPanel.d.ts +14 -0
- package/dist/panels/FunctionListPanel.d.ts.map +1 -0
- package/dist/panels/FunctionListPanel.js +25 -0
- package/dist/panels/FunctionListPanel.js.map +1 -0
- package/dist/panels/MemoryConfigPanel.d.ts +8 -0
- package/dist/panels/MemoryConfigPanel.d.ts.map +1 -0
- package/dist/panels/MemoryConfigPanel.js +22 -0
- package/dist/panels/MemoryConfigPanel.js.map +1 -0
- package/dist/panels/MemoryPanel.d.ts +2 -0
- package/dist/panels/MemoryPanel.d.ts.map +1 -0
- package/dist/panels/MemoryPanel.js +25 -0
- package/dist/panels/MemoryPanel.js.map +1 -0
- package/dist/panels/ModelConfigPanel.d.ts +8 -0
- package/dist/panels/ModelConfigPanel.d.ts.map +1 -0
- package/dist/panels/ModelConfigPanel.js +14 -0
- package/dist/panels/ModelConfigPanel.js.map +1 -0
- package/dist/panels/ModelsPanel.d.ts +8 -0
- package/dist/panels/ModelsPanel.d.ts.map +1 -0
- package/dist/panels/ModelsPanel.js +24 -0
- package/dist/panels/ModelsPanel.js.map +1 -0
- package/dist/panels/NodeConfigPanel.d.ts +16 -0
- package/dist/panels/NodeConfigPanel.d.ts.map +1 -0
- package/dist/panels/NodeConfigPanel.js +248 -0
- package/dist/panels/NodeConfigPanel.js.map +1 -0
- package/dist/panels/NodeLibrary.d.ts +16 -0
- package/dist/panels/NodeLibrary.d.ts.map +1 -0
- package/dist/panels/NodeLibrary.js +125 -0
- package/dist/panels/NodeLibrary.js.map +1 -0
- package/dist/panels/ResourceConfigPanel.d.ts +37 -0
- package/dist/panels/ResourceConfigPanel.d.ts.map +1 -0
- package/dist/panels/ResourceConfigPanel.js +35 -0
- package/dist/panels/ResourceConfigPanel.js.map +1 -0
- package/dist/panels/ResourceListPanel.d.ts +35 -0
- package/dist/panels/ResourceListPanel.d.ts.map +1 -0
- package/dist/panels/ResourceListPanel.js +35 -0
- package/dist/panels/ResourceListPanel.js.map +1 -0
- package/dist/panels/VariableConfigPanel.d.ts +9 -0
- package/dist/panels/VariableConfigPanel.d.ts.map +1 -0
- package/dist/panels/VariableConfigPanel.js +50 -0
- package/dist/panels/VariableConfigPanel.js.map +1 -0
- package/dist/panels/VariablesPanel.d.ts +7 -0
- package/dist/panels/VariablesPanel.d.ts.map +1 -0
- package/dist/panels/VariablesPanel.js +56 -0
- package/dist/panels/VariablesPanel.js.map +1 -0
- package/dist/stores/canvasStore.d.ts +41 -0
- package/dist/stores/canvasStore.d.ts.map +1 -0
- package/dist/stores/canvasStore.js +187 -0
- package/dist/stores/canvasStore.js.map +1 -0
- package/dist/stores/debugStore.d.ts +42 -0
- package/dist/stores/debugStore.d.ts.map +1 -0
- package/dist/stores/debugStore.js +22 -0
- package/dist/stores/debugStore.js.map +1 -0
- package/dist/stores/diagnosticsStore.d.ts +41 -0
- package/dist/stores/diagnosticsStore.d.ts.map +1 -0
- package/dist/stores/diagnosticsStore.js +67 -0
- package/dist/stores/diagnosticsStore.js.map +1 -0
- package/dist/stores/editorStore.d.ts +76 -0
- package/dist/stores/editorStore.d.ts.map +1 -0
- package/dist/stores/editorStore.js +116 -0
- package/dist/stores/editorStore.js.map +1 -0
- package/dist/utils/categoryConstants.d.ts +4 -0
- package/dist/utils/categoryConstants.d.ts.map +1 -0
- package/dist/utils/categoryConstants.js +24 -0
- package/dist/utils/categoryConstants.js.map +1 -0
- package/dist/utils/channelOperations.d.ts +21 -0
- package/dist/utils/channelOperations.d.ts.map +1 -0
- package/dist/utils/channelOperations.js +84 -0
- package/dist/utils/channelOperations.js.map +1 -0
- package/dist/utils/connectionRules.d.ts +15 -0
- package/dist/utils/connectionRules.d.ts.map +1 -0
- package/dist/utils/connectionRules.js +113 -0
- package/dist/utils/connectionRules.js.map +1 -0
- package/dist/utils/functionOperations.d.ts +27 -0
- package/dist/utils/functionOperations.d.ts.map +1 -0
- package/dist/utils/functionOperations.js +140 -0
- package/dist/utils/functionOperations.js.map +1 -0
- package/dist/utils/graphOperations.d.ts +54 -0
- package/dist/utils/graphOperations.d.ts.map +1 -0
- package/dist/utils/graphOperations.js +461 -0
- package/dist/utils/graphOperations.js.map +1 -0
- package/dist/utils/history.d.ts +76 -0
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/history.js +93 -0
- package/dist/utils/history.js.map +1 -0
- package/dist/utils/memoryOperations.d.ts +14 -0
- package/dist/utils/memoryOperations.d.ts.map +1 -0
- package/dist/utils/memoryOperations.js +55 -0
- package/dist/utils/memoryOperations.js.map +1 -0
- package/dist/utils/migrateFunctionNodes.d.ts +9 -0
- package/dist/utils/migrateFunctionNodes.d.ts.map +1 -0
- package/dist/utils/migrateFunctionNodes.js +89 -0
- package/dist/utils/migrateFunctionNodes.js.map +1 -0
- package/dist/utils/modelOperations.d.ts +13 -0
- package/dist/utils/modelOperations.d.ts.map +1 -0
- package/dist/utils/modelOperations.js +53 -0
- package/dist/utils/modelOperations.js.map +1 -0
- package/dist/utils/paramDisplay.d.ts +12 -0
- package/dist/utils/paramDisplay.d.ts.map +1 -0
- package/dist/utils/paramDisplay.js +56 -0
- package/dist/utils/paramDisplay.js.map +1 -0
- package/dist/utils/resourceHelpers.d.ts +17 -0
- package/dist/utils/resourceHelpers.d.ts.map +1 -0
- package/dist/utils/resourceHelpers.js +32 -0
- package/dist/utils/resourceHelpers.js.map +1 -0
- package/dist/utils/translation.d.ts +20 -0
- package/dist/utils/translation.d.ts.map +1 -0
- package/dist/utils/translation.js +23 -0
- package/dist/utils/translation.js.map +1 -0
- package/dist/utils/variableOperations.d.ts +15 -0
- package/dist/utils/variableOperations.d.ts.map +1 -0
- package/dist/utils/variableOperations.js +71 -0
- package/dist/utils/variableOperations.js.map +1 -0
- package/package.json +79 -0
- package/src/BuilderLayout.tsx +345 -0
- package/src/Canvas.tsx +261 -0
- package/src/CanvasEditor.tsx +142 -0
- package/src/CanvasTabsToolbar.tsx +176 -0
- package/src/RightConfigPanel.tsx +266 -0
- package/src/WorkflowBuilder.tsx +412 -0
- package/src/cn.ts +6 -0
- package/src/components/ui/add-button.tsx +39 -0
- package/src/components/ui/alert-dialog.tsx +141 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/button.tsx +85 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/command.tsx +153 -0
- package/src/components/ui/delete-button.tsx +23 -0
- package/src/components/ui/dialog.tsx +125 -0
- package/src/components/ui/dropdown-menu.tsx +198 -0
- package/src/components/ui/input.tsx +55 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/readonly-banner.tsx +15 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +102 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/textarea.tsx +51 -0
- package/src/components/ui/toast.tsx +127 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +32 -0
- package/src/dialogs/NodePickerDialog.tsx +84 -0
- package/src/dialogs/ValidationDialog.tsx +184 -0
- package/src/graph/BaseNode.tsx +557 -0
- package/src/graph/CustomEdge.tsx +185 -0
- package/src/graph/CustomNode.tsx +16 -0
- package/src/graph/FunctionCallNode.tsx +30 -0
- package/src/graph/PortHandle.tsx +189 -0
- package/src/graph/reactFlowRegistry.ts +26 -0
- package/src/hooks/use-toast.ts +125 -0
- package/src/hooks/useAvailableVariables.ts +20 -0
- package/src/hooks/useCanvasHistory.ts +22 -0
- package/src/hooks/useCanvasTabs.ts +168 -0
- package/src/hooks/useFunctionDiagnosticsSync.ts +40 -0
- package/src/hooks/useFunctionRegistry.ts +26 -0
- package/src/hooks/useFunctions.ts +44 -0
- package/src/hooks/useGraph.ts +161 -0
- package/src/hooks/useNodeDefinitions.ts +82 -0
- package/src/hooks/useParamErrors.ts +26 -0
- package/src/hooks/useResolvedTheme.ts +30 -0
- package/src/hooks/useResourceDiagnosticsSync.ts +58 -0
- package/src/hooks/useSuppressThemeTransition.ts +79 -0
- package/src/hooks/useWorkflowSerialization.ts +127 -0
- package/src/i18n/index.ts +53 -0
- package/src/i18n/locales/de.json +501 -0
- package/src/i18n/locales/en.json +557 -0
- package/src/index.ts +27 -0
- package/src/inputs/ExpressionInput.tsx +297 -0
- package/src/inputs/ParameterEditor.tsx +515 -0
- package/src/inputs/PortSection.tsx +144 -0
- package/src/panels/BuilderSidebar.tsx +301 -0
- package/src/panels/ChannelConfigPanel.tsx +49 -0
- package/src/panels/ChannelsPanel.tsx +28 -0
- package/src/panels/DebugConsolePanel.tsx +73 -0
- package/src/panels/DebugContextPanel.tsx +77 -0
- package/src/panels/DebugExternalIOPanel.tsx +180 -0
- package/src/panels/DiagnosticsPanel.tsx +170 -0
- package/src/panels/EdgeConfigPanel.tsx +104 -0
- package/src/panels/FunctionConfigPanel.tsx +179 -0
- package/src/panels/FunctionListPanel.tsx +45 -0
- package/src/panels/MemoryConfigPanel.tsx +55 -0
- package/src/panels/MemoryPanel.tsx +40 -0
- package/src/panels/ModelConfigPanel.tsx +41 -0
- package/src/panels/ModelsPanel.tsx +36 -0
- package/src/panels/NodeConfigPanel.tsx +630 -0
- package/src/panels/NodeLibrary.tsx +288 -0
- package/src/panels/ResourceConfigPanel.tsx +132 -0
- package/src/panels/ResourceListPanel.tsx +113 -0
- package/src/panels/VariableConfigPanel.tsx +161 -0
- package/src/panels/VariablesPanel.tsx +145 -0
- package/src/stores/canvasStore.test.ts +44 -0
- package/src/stores/canvasStore.ts +245 -0
- package/src/stores/debugStore.ts +74 -0
- package/src/stores/diagnosticsStore.ts +130 -0
- package/src/stores/editorStore.ts +202 -0
- package/src/styles/index.css +526 -0
- package/src/utils/categoryConstants.ts +26 -0
- package/src/utils/channelOperations.ts +86 -0
- package/src/utils/connectionRules.ts +137 -0
- package/src/utils/functionOperations.ts +179 -0
- package/src/utils/graphOperations.ts +550 -0
- package/src/utils/history.ts +207 -0
- package/src/utils/memoryOperations.ts +57 -0
- package/src/utils/migrateFunctionNodes.ts +107 -0
- package/src/utils/modelOperations.ts +55 -0
- package/src/utils/paramDisplay.ts +71 -0
- package/src/utils/resourceHelpers.ts +32 -0
- package/src/utils/translation.ts +28 -0
- package/src/utils/variableOperations.ts +75 -0
- package/tailwind-preset.ts +166 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diagnosticsStore.ts
|
|
3
|
+
*
|
|
4
|
+
* This Zustand store manages diagnostics (errors and warnings) for the currently active canvas
|
|
5
|
+
* in the workflow builder. It holds diagnostics for nodes and edges, keyed by their IDs.
|
|
6
|
+
*
|
|
7
|
+
* Key design points:
|
|
8
|
+
* - Only diagnostics for the active canvas are stored (flat, not per-canvas).
|
|
9
|
+
* - Diagnostics are written by node/edge components via useEffect, and cleared on unmount.
|
|
10
|
+
* - On canvas switch, the store is cleared and repopulated for the new canvas.
|
|
11
|
+
* - Used for real-time UI feedback (badges, warnings) in the workflow builder.
|
|
12
|
+
* - For full-project validation (e.g., before code generation), use validateAllCanvases() in utils/diagnostics.ts.
|
|
13
|
+
*
|
|
14
|
+
* See docs/diagnostics.md for full architecture and lifecycle details.
|
|
15
|
+
*/
|
|
16
|
+
import { create } from "zustand";
|
|
17
|
+
export const useDiagnosticsStore = create((set) => ({
|
|
18
|
+
byNodeId: {},
|
|
19
|
+
byEdgeId: {},
|
|
20
|
+
byChannelId: {},
|
|
21
|
+
byMemoryId: {},
|
|
22
|
+
byModelId: {},
|
|
23
|
+
byFunctionId: {},
|
|
24
|
+
setNodeDiagnostics: (nodeId, diags) => set((state) => ({
|
|
25
|
+
byNodeId: { ...state.byNodeId, [nodeId]: diags },
|
|
26
|
+
})),
|
|
27
|
+
clearNodeDiagnostics: (nodeId) => set((state) => {
|
|
28
|
+
const { [nodeId]: _, ...rest } = state.byNodeId;
|
|
29
|
+
return { byNodeId: rest };
|
|
30
|
+
}),
|
|
31
|
+
setEdgeDiagnostics: (edgeId, diags) => set((state) => ({
|
|
32
|
+
byEdgeId: { ...state.byEdgeId, [edgeId]: diags },
|
|
33
|
+
})),
|
|
34
|
+
clearEdgeDiagnostics: (edgeId) => set((state) => {
|
|
35
|
+
const { [edgeId]: _, ...rest } = state.byEdgeId;
|
|
36
|
+
return { byEdgeId: rest };
|
|
37
|
+
}),
|
|
38
|
+
setChannelDiagnostics: (channelId, diags) => set((state) => ({
|
|
39
|
+
byChannelId: { ...state.byChannelId, [channelId]: diags },
|
|
40
|
+
})),
|
|
41
|
+
clearChannelDiagnostics: (channelId) => set((state) => {
|
|
42
|
+
const { [channelId]: _, ...rest } = state.byChannelId;
|
|
43
|
+
return { byChannelId: rest };
|
|
44
|
+
}),
|
|
45
|
+
setMemoryDiagnostics: (memoryId, diags) => set((state) => ({
|
|
46
|
+
byMemoryId: { ...state.byMemoryId, [memoryId]: diags },
|
|
47
|
+
})),
|
|
48
|
+
clearMemoryDiagnostics: (memoryId) => set((state) => {
|
|
49
|
+
const { [memoryId]: _, ...rest } = state.byMemoryId;
|
|
50
|
+
return { byMemoryId: rest };
|
|
51
|
+
}),
|
|
52
|
+
setModelDiagnostics: (modelId, diags) => set((state) => ({
|
|
53
|
+
byModelId: { ...state.byModelId, [modelId]: diags },
|
|
54
|
+
})),
|
|
55
|
+
clearModelDiagnostics: (modelId) => set((state) => {
|
|
56
|
+
const { [modelId]: _, ...rest } = state.byModelId;
|
|
57
|
+
return { byModelId: rest };
|
|
58
|
+
}),
|
|
59
|
+
setFunctionDiagnostics: (functionId, diags) => set((state) => ({
|
|
60
|
+
byFunctionId: { ...state.byFunctionId, [functionId]: diags },
|
|
61
|
+
})),
|
|
62
|
+
clearFunctionDiagnostics: (functionId) => set((state) => {
|
|
63
|
+
const { [functionId]: _, ...rest } = state.byFunctionId;
|
|
64
|
+
return { byFunctionId: rest };
|
|
65
|
+
}),
|
|
66
|
+
}));
|
|
67
|
+
//# sourceMappingURL=diagnosticsStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticsStore.js","sourceRoot":"","sources":["../../src/stores/diagnosticsStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAyCjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAmB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpE,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,EAAE;IAEhB,kBAAkB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACpC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE;KACjD,CAAC,CAAC;IAEL,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACZ,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC,CAAC;IAEJ,kBAAkB,EAAE,CAAC,MAAM,EAAE,KAAK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@foresthubai/workflow-core/memory";
|
|
3
|
+
import type { Model, ModelInfo } from "@foresthubai/workflow-core/model";
|
|
4
|
+
import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
|
|
5
|
+
export declare function createDefaultChannels(): Record<string, Channel>;
|
|
6
|
+
import type { BuilderMode } from "../WorkflowBuilder";
|
|
7
|
+
import type { SidebarTab } from "../panels/BuilderSidebar";
|
|
8
|
+
/**
|
|
9
|
+
* What the editor is focused on, driving right-side config-panel visibility.
|
|
10
|
+
* A discriminated union so exclusivity is structural: at most one primitive is
|
|
11
|
+
* ever selected, except nodes+edges which coexist under `graph` (box-select can
|
|
12
|
+
* grab both). The only way to mutate it is the select* / clearSelection actions,
|
|
13
|
+
* each of which replaces the whole value — no field can drift out of sync.
|
|
14
|
+
*/
|
|
15
|
+
export type Selection = {
|
|
16
|
+
kind: "none";
|
|
17
|
+
} | {
|
|
18
|
+
kind: "graph";
|
|
19
|
+
nodeIds: string[];
|
|
20
|
+
edgeIds: string[];
|
|
21
|
+
} | {
|
|
22
|
+
kind: "channel";
|
|
23
|
+
id: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "memory";
|
|
26
|
+
id: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "model";
|
|
29
|
+
id: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "function";
|
|
32
|
+
id: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "variable";
|
|
35
|
+
uid: string;
|
|
36
|
+
};
|
|
37
|
+
interface EditorState {
|
|
38
|
+
activeCanvasId: string;
|
|
39
|
+
activeSidebarTab: SidebarTab;
|
|
40
|
+
builderMode: BuilderMode;
|
|
41
|
+
selection: Selection;
|
|
42
|
+
channels: Record<string, Channel>;
|
|
43
|
+
memory: Record<string, Memory>;
|
|
44
|
+
models: Record<string, Model>;
|
|
45
|
+
functions: Record<string, FunctionDeclaration>;
|
|
46
|
+
availableModels: ModelInfo[];
|
|
47
|
+
/**
|
|
48
|
+
* Monotonic counter bumped on project-scoped domain mutations
|
|
49
|
+
* (channels/memory/models). Mirrors canvasStores' history mutationCount so the
|
|
50
|
+
* builder can fire a single onChange event from either source.
|
|
51
|
+
*/
|
|
52
|
+
mutationCount: number;
|
|
53
|
+
setActiveCanvas: (canvasId: string) => void;
|
|
54
|
+
setBuilderMode: (mode: BuilderMode) => void;
|
|
55
|
+
/** Programmatic graph selection (change selection and pushes into ReactFlow). */
|
|
56
|
+
selectGraph: (nodeIds: string[], edgeIds: string[]) => void;
|
|
57
|
+
/** ReactFlow-origin graph selection fires onSelectionChange which needs to update the editor state without pushing back to ReactFlow. */
|
|
58
|
+
syncSelectionFromRF: (nodeIds: string[], edgeIds: string[]) => void;
|
|
59
|
+
selectChannel: (id: string) => void;
|
|
60
|
+
selectMemory: (id: string) => void;
|
|
61
|
+
selectModel: (id: string) => void;
|
|
62
|
+
/** Select a function AND switch the active canvas to its body (id === canvasId), so
|
|
63
|
+
* the config panel's return-expression editors resolve against the body's scope. */
|
|
64
|
+
selectFunction: (id: string) => void;
|
|
65
|
+
selectVariable: (uid: string) => void;
|
|
66
|
+
clearSelection: () => void;
|
|
67
|
+
setActiveSidebarTab: (tab: SidebarTab) => void;
|
|
68
|
+
setChannels: (updater: (vars: Record<string, Channel>) => Record<string, Channel>) => void;
|
|
69
|
+
setMemory: (updater: (mem: Record<string, Memory>) => Record<string, Memory>) => void;
|
|
70
|
+
setModels: (updater: (models: Record<string, Model>) => Record<string, Model>) => void;
|
|
71
|
+
setFunctions: (updater: (funcs: Record<string, FunctionDeclaration>) => Record<string, FunctionDeclaration>) => void;
|
|
72
|
+
setAvailableModels: (models: ModelInfo[]) => void;
|
|
73
|
+
}
|
|
74
|
+
export declare const useEditorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<EditorState>>;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=editorStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorStore.d.ts","sourceRoot":"","sources":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AG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACtF,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;IACvF,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACrH,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,cAAc,0EAgGxB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { getCanvasStore, getOrCreateCanvasStore, MAIN_CANVAS_ID } from "./canvasStore";
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Default Channels — every workflow starts pre-initialized with a UART
|
|
5
|
+
// port so nodes that need a serial port (SerialRead/Write, OnSerialReceive)
|
|
6
|
+
// have something to bind to out of the box. Domain shape only — the driver
|
|
7
|
+
// binding is supplied at deploy time via the DeploymentMapping, not here.
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
export function createDefaultChannels() {
|
|
10
|
+
const uart = { id: "uart0", label: "Serial", type: "UART", arguments: {} };
|
|
11
|
+
return { [uart.id]: uart };
|
|
12
|
+
}
|
|
13
|
+
const NO_SELECTION = { kind: "none" };
|
|
14
|
+
// Drop ReactFlow's visual selection on a canvas so previously-glowing nodes/edges
|
|
15
|
+
// stop glowing. Peek (never create) — clearing selection must not resurrect a
|
|
16
|
+
// canvas store that was just dropped (e.g. after clearAllCanvasStores).
|
|
17
|
+
function clearRFselect(canvasId) {
|
|
18
|
+
getCanvasStore(canvasId)?.getState().setRFselect([], []);
|
|
19
|
+
}
|
|
20
|
+
export const useEditorStore = create((set, get) => ({
|
|
21
|
+
activeCanvasId: MAIN_CANVAS_ID,
|
|
22
|
+
builderMode: { type: "edit" },
|
|
23
|
+
selection: NO_SELECTION,
|
|
24
|
+
activeSidebarTab: "nodes",
|
|
25
|
+
channels: createDefaultChannels(),
|
|
26
|
+
memory: {},
|
|
27
|
+
models: {},
|
|
28
|
+
functions: {},
|
|
29
|
+
availableModels: [],
|
|
30
|
+
mutationCount: 0,
|
|
31
|
+
// A `variable` selection is canvas-local; its uid would resolve to nothing (or,
|
|
32
|
+
// worse, a collision) on the new canvas, so drop it. A `function` selection is
|
|
33
|
+
// tied to being on that function's body canvas (selectFunction switches to it),
|
|
34
|
+
// so leaving that canvas drops it too — switching INTO a function tab instead
|
|
35
|
+
// routes through selectFunction (see useCanvasTabs.setActiveTabId), not here.
|
|
36
|
+
// Project-scoped channel/memory/model selections survive the switch.
|
|
37
|
+
setActiveCanvas: (canvasId) => set((state) => ({
|
|
38
|
+
activeCanvasId: canvasId,
|
|
39
|
+
selection: state.selection.kind === "variable" || state.selection.kind === "function" ? NO_SELECTION : state.selection,
|
|
40
|
+
})),
|
|
41
|
+
setBuilderMode: (mode) => set({ builderMode: mode }),
|
|
42
|
+
selectGraph: (nodeIds, edgeIds) => {
|
|
43
|
+
set({ selection: nodeIds.length || edgeIds.length ? { kind: "graph", nodeIds, edgeIds } : NO_SELECTION });
|
|
44
|
+
// Programmatic pick — mirror it into ReactFlow so the canvas reflects it.
|
|
45
|
+
getOrCreateCanvasStore(get().activeCanvasId).getState().setRFselect(nodeIds, edgeIds);
|
|
46
|
+
},
|
|
47
|
+
syncSelectionFromRF: (nodeIds, edgeIds) => {
|
|
48
|
+
if (nodeIds.length || edgeIds.length) {
|
|
49
|
+
// A selection made on the canvas (click, box-drag) is hoisted into the editor state.
|
|
50
|
+
// A programmatic selectGraph also round-trips here via onSelectionChange; that just re-sets an
|
|
51
|
+
// equal value (one benign re-render), so it needs no special-casing.
|
|
52
|
+
set({ selection: { kind: "graph", nodeIds, edgeIds } });
|
|
53
|
+
}
|
|
54
|
+
else if (get().selection.kind === "graph") {
|
|
55
|
+
// Empty while a graph selection was active = user deselected on the canvas.
|
|
56
|
+
set({ selection: NO_SELECTION });
|
|
57
|
+
}
|
|
58
|
+
// Empty + non-graph kind = echo of the canvas-clear we triggered when picking
|
|
59
|
+
// a channel/memory/etc; ignore it, or it would wipe that pick.
|
|
60
|
+
},
|
|
61
|
+
selectChannel: (id) => {
|
|
62
|
+
set({ selection: { kind: "channel", id } });
|
|
63
|
+
clearRFselect(get().activeCanvasId);
|
|
64
|
+
},
|
|
65
|
+
selectMemory: (id) => {
|
|
66
|
+
set({ selection: { kind: "memory", id } });
|
|
67
|
+
clearRFselect(get().activeCanvasId);
|
|
68
|
+
},
|
|
69
|
+
selectModel: (id) => {
|
|
70
|
+
set({ selection: { kind: "model", id } });
|
|
71
|
+
clearRFselect(get().activeCanvasId);
|
|
72
|
+
},
|
|
73
|
+
selectFunction: (id) => {
|
|
74
|
+
// Drop the outgoing canvas's RF selection, then focus the function: select it
|
|
75
|
+
// AND make its body the active canvas so the config panel's expression editors
|
|
76
|
+
// resolve against the function's local variable scope.
|
|
77
|
+
clearRFselect(get().activeCanvasId);
|
|
78
|
+
set({ selection: { kind: "function", id }, activeCanvasId: id });
|
|
79
|
+
},
|
|
80
|
+
selectVariable: (uid) => {
|
|
81
|
+
set({ selection: { kind: "variable", uid } });
|
|
82
|
+
clearRFselect(get().activeCanvasId);
|
|
83
|
+
},
|
|
84
|
+
clearSelection: () => {
|
|
85
|
+
set({ selection: NO_SELECTION });
|
|
86
|
+
clearRFselect(get().activeCanvasId);
|
|
87
|
+
},
|
|
88
|
+
setActiveSidebarTab: (tab) => set({ activeSidebarTab: tab }),
|
|
89
|
+
setChannels: (updater) => set((state) => {
|
|
90
|
+
const next = updater(state.channels);
|
|
91
|
+
if (next === state.channels)
|
|
92
|
+
return state;
|
|
93
|
+
return { channels: next, mutationCount: state.mutationCount + 1 };
|
|
94
|
+
}),
|
|
95
|
+
setMemory: (updater) => set((state) => {
|
|
96
|
+
const next = updater(state.memory);
|
|
97
|
+
if (next === state.memory)
|
|
98
|
+
return state;
|
|
99
|
+
return { memory: next, mutationCount: state.mutationCount + 1 };
|
|
100
|
+
}),
|
|
101
|
+
setModels: (updater) => set((state) => {
|
|
102
|
+
const next = updater(state.models);
|
|
103
|
+
if (next === state.models)
|
|
104
|
+
return state;
|
|
105
|
+
return { models: next, mutationCount: state.mutationCount + 1 };
|
|
106
|
+
}),
|
|
107
|
+
setFunctions: (updater) => set((state) => {
|
|
108
|
+
const next = updater(state.functions);
|
|
109
|
+
if (next === state.functions)
|
|
110
|
+
return state;
|
|
111
|
+
return { functions: next, mutationCount: state.mutationCount + 1 };
|
|
112
|
+
}),
|
|
113
|
+
// Catalog is config (from props), not workflow content — never bumps mutationCount.
|
|
114
|
+
setAvailableModels: (models) => set({ availableModels: models }),
|
|
115
|
+
}));
|
|
116
|
+
//# sourceMappingURL=editorStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorStore.js","sourceRoot":"","sources":["../../src/stores/editorStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMvF,8EAA8E;AAC9E,uEAAuE;AACvE,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,8EAA8E;AAE9E,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAY,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACpF,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAA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ants.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuD,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpG,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CASpD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASjD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Shared category icons and colors for node categories in the workflow builder.
|
|
2
|
+
import { NodeCategory } from "@foresthubai/workflow-core/node";
|
|
3
|
+
import { Bot, Box, Brain, Inbox, Send, Variable, Wrench, Zap } from "lucide-react";
|
|
4
|
+
export const categoryIcons = {
|
|
5
|
+
[NodeCategory.Input]: Inbox,
|
|
6
|
+
[NodeCategory.Logic]: Brain,
|
|
7
|
+
[NodeCategory.Data]: Variable,
|
|
8
|
+
[NodeCategory.Output]: Send,
|
|
9
|
+
[NodeCategory.AI]: Bot,
|
|
10
|
+
[NodeCategory.Trigger]: Zap,
|
|
11
|
+
[NodeCategory.Tool]: Wrench,
|
|
12
|
+
[NodeCategory.Function]: Box,
|
|
13
|
+
};
|
|
14
|
+
export const categoryColors = {
|
|
15
|
+
[NodeCategory.Input]: "bg-node-input/10 text-node-input border-node-input/20",
|
|
16
|
+
[NodeCategory.Logic]: "bg-node-logic/10 text-node-logic border-node-logic/20",
|
|
17
|
+
[NodeCategory.Data]: "bg-node-data/10 text-node-data border-node-data/20",
|
|
18
|
+
[NodeCategory.Output]: "bg-node-output/10 text-node-output border-node-output/20",
|
|
19
|
+
[NodeCategory.AI]: "bg-node-agent/10 text-node-agent border-node-agent/20",
|
|
20
|
+
[NodeCategory.Trigger]: "bg-node-trigger/10 text-node-trigger border-node-trigger/20",
|
|
21
|
+
[NodeCategory.Tool]: "bg-node-tool/10 text-node-tool border-node-tool/20",
|
|
22
|
+
[NodeCategory.Function]: "bg-node-function/10 text-node-function border-node-function/20",
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ChannelType, type Channel } from "@foresthubai/workflow-core/channel";
|
|
2
|
+
/**
|
|
3
|
+
* Create a new channel in the editor store. Returns the new instance.
|
|
4
|
+
*/
|
|
5
|
+
export declare function addChannel(type?: ChannelType): Channel;
|
|
6
|
+
/**
|
|
7
|
+
* Apply a partial patch to a channel. Inactive arguments are intentionally
|
|
8
|
+
* retained in the store: the domain store is the superset and stripping happens
|
|
9
|
+
* only at the api boundary (`serialize`), so switching `type` away and back
|
|
10
|
+
* restores previously-entered values rather than resetting them. On a type
|
|
11
|
+
* change we still seed defaults for params that are newly active and unset, so
|
|
12
|
+
* the config panel shows sensible initial values. Top-level fields (label/type)
|
|
13
|
+
* are merged separately from arguments.
|
|
14
|
+
*/
|
|
15
|
+
export declare function updateChannel(id: string, patch: {
|
|
16
|
+
label?: string;
|
|
17
|
+
type?: ChannelType;
|
|
18
|
+
arguments?: Record<string, unknown>;
|
|
19
|
+
}): void;
|
|
20
|
+
export declare function deleteChannel(id: string): void;
|
|
21
|
+
//# sourceMappingURL=channelOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelOperations.d.ts","sourceRoot":"","sources":["../../src/utils/channelOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAuBxG;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,WAAsB,GAAG,OAAO,CAWhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAyBlI;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAU9C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CHANNEL_DEFINITION } from "@foresthubai/workflow-core/channel";
|
|
2
|
+
import { isParameterActive } from "@foresthubai/workflow-core/parameter";
|
|
3
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
4
|
+
import { generateId } from "@foresthubai/workflow-core/id";
|
|
5
|
+
import { uniqueName } from "./resourceHelpers";
|
|
6
|
+
/**
|
|
7
|
+
* Build the initial `arguments` record for a new channel: each parameter
|
|
8
|
+
* that's active for the chosen `type` and has a `default` gets seeded.
|
|
9
|
+
*/
|
|
10
|
+
function defaultArguments(type) {
|
|
11
|
+
const seed = { type };
|
|
12
|
+
const args = {};
|
|
13
|
+
for (const param of CHANNEL_DEFINITION.parameters) {
|
|
14
|
+
if (param.id === "type")
|
|
15
|
+
continue;
|
|
16
|
+
if (param.activationRules?.length && !isParameterActive(param, seed, false))
|
|
17
|
+
continue;
|
|
18
|
+
if ("default" in param && param.default !== undefined) {
|
|
19
|
+
args[param.id] = param.default;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return args;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a new channel in the editor store. Returns the new instance.
|
|
26
|
+
*/
|
|
27
|
+
export function addChannel(type = "GPIOIN") {
|
|
28
|
+
const id = generateId();
|
|
29
|
+
const existing = Object.values(useEditorStore.getState().channels).map((v) => v.label);
|
|
30
|
+
const instance = {
|
|
31
|
+
id,
|
|
32
|
+
label: uniqueName("channel", existing),
|
|
33
|
+
type,
|
|
34
|
+
arguments: defaultArguments(type),
|
|
35
|
+
};
|
|
36
|
+
useEditorStore.getState().setChannels((vars) => ({ ...vars, [id]: instance }));
|
|
37
|
+
return instance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Apply a partial patch to a channel. Inactive arguments are intentionally
|
|
41
|
+
* retained in the store: the domain store is the superset and stripping happens
|
|
42
|
+
* only at the api boundary (`serialize`), so switching `type` away and back
|
|
43
|
+
* restores previously-entered values rather than resetting them. On a type
|
|
44
|
+
* change we still seed defaults for params that are newly active and unset, so
|
|
45
|
+
* the config panel shows sensible initial values. Top-level fields (label/type)
|
|
46
|
+
* are merged separately from arguments.
|
|
47
|
+
*/
|
|
48
|
+
export function updateChannel(id, patch) {
|
|
49
|
+
const key = id;
|
|
50
|
+
useEditorStore.getState().setChannels((vars) => {
|
|
51
|
+
const existing = vars[key];
|
|
52
|
+
if (!existing)
|
|
53
|
+
return vars;
|
|
54
|
+
const nextType = patch.type ?? existing.type;
|
|
55
|
+
const mergedArgs = { ...existing.arguments, ...(patch.arguments ?? {}) };
|
|
56
|
+
if (patch.type && patch.type !== existing.type) {
|
|
57
|
+
for (const [k, v] of Object.entries(defaultArguments(nextType))) {
|
|
58
|
+
if (mergedArgs[k] === undefined)
|
|
59
|
+
mergedArgs[k] = v;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...vars,
|
|
64
|
+
[key]: {
|
|
65
|
+
...existing,
|
|
66
|
+
...(patch.label !== undefined ? { label: patch.label } : {}),
|
|
67
|
+
type: nextType,
|
|
68
|
+
arguments: mergedArgs,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export function deleteChannel(id) {
|
|
74
|
+
const key = id;
|
|
75
|
+
useEditorStore.getState().setChannels((vars) => {
|
|
76
|
+
const { [key]: _drop, ...rest } = vars;
|
|
77
|
+
return rest;
|
|
78
|
+
});
|
|
79
|
+
const sel = useEditorStore.getState().selection;
|
|
80
|
+
if (sel.kind === "channel" && sel.id === id) {
|
|
81
|
+
useEditorStore.getState().clearSelection();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=channelOperations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelOperations.js","sourceRoot":"","sources":["../../src/utils/channelOperations.ts"],"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AK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5D,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,UAAU;aACtB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,cAAc,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,cAAc,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Edge, Node } from "@xyflow/react";
|
|
2
|
+
import { type NodeData, type NodeDefinition } from "@foresthubai/workflow-core/node";
|
|
3
|
+
import { type EdgeType } from "@foresthubai/workflow-core/edge";
|
|
4
|
+
/**
|
|
5
|
+
* Check whether an output port can accept at least one more outgoing edge.
|
|
6
|
+
* Used by the contextual "+" button on output ports.
|
|
7
|
+
*/
|
|
8
|
+
export declare function canPortAcceptEdge(nodeId: string, handleId: string, nodes: Node<NodeData>[], edges: Edge[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Filter node definitions to those that can connect to a given output port.
|
|
11
|
+
* Returns definitions whose nodes have an input port matching the origin's port type.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getCompatibleNodeDefs(originNodeId: string, originHandleId: string, nodes: Node<NodeData>[], edges: Edge[], allNodeDefs: NodeDefinition[], isFunctionCanvas: boolean): NodeDefinition[];
|
|
14
|
+
export declare const isValidConnection: (sourceId: string | null, targetId: string | null, sourceHandleId: string | null | undefined, targetHandleId: string | null | undefined, nodes: Node<NodeData>[], edges: Edge[]) => false | EdgeType;
|
|
15
|
+
//# sourceMappingURL=connectionRules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionRules.d.ts","sourceRoot":"","sources":["../../src/utils/connectionRules.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAA0B,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAsBhE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAmBnH;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EACvB,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,cAAc,EAAE,EAC7B,gBAAgB,EAAE,OAAO,GACxB,cAAc,EAAE,CAsBlB;AAED,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,GAAG,IAAI,EACvB,UAAU,MAAM,GAAG,IAAI,EACvB,gBAAgB,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,gBAAgB,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,EACvB,OAAO,IAAI,EAAE,KACZ,KAAK,GAAG,QAqCV,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Editor connection rules — which ports may connect, which node types are
|
|
2
|
+
// offered from a port, and whether a node can take another outgoing edge.
|
|
3
|
+
//
|
|
4
|
+
// These operate on React Flow `Node`/`Edge` and drive canvas interactions, so
|
|
5
|
+
// they live here in the editor rather than in the headless @foresthubai/workflow-core.
|
|
6
|
+
// Core exposes the pure primitive (`getPorts`); the React Flow coupling stays
|
|
7
|
+
// on this side of the boundary.
|
|
8
|
+
import { getPorts, NodeRegistry } from "@foresthubai/workflow-core/node";
|
|
9
|
+
/** Check whether a node already has tool-input edges (for mutual exclusion). */
|
|
10
|
+
function hasToolInputEdge(nodeId, nodeData, edges) {
|
|
11
|
+
const ports = getPorts(nodeData);
|
|
12
|
+
return edges.some((e) => e.target === nodeId && ports.input.some((p) => p.type === "tool" && p.id === e.targetHandle));
|
|
13
|
+
}
|
|
14
|
+
/** Check whether a node already has control-flow edges (for mutual exclusion). */
|
|
15
|
+
function hasControlFlowEdge(nodeId, nodeData, edges) {
|
|
16
|
+
const ports = getPorts(nodeData);
|
|
17
|
+
return edges.some((e) => {
|
|
18
|
+
if (e.target === nodeId) {
|
|
19
|
+
return ports.input.some((p) => p.type === "control" && p.id === e.targetHandle);
|
|
20
|
+
}
|
|
21
|
+
if (e.source === nodeId) {
|
|
22
|
+
return ports.output.some((p) => p.type === "control" && p.id === e.sourceHandle);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check whether an output port can accept at least one more outgoing edge.
|
|
29
|
+
* Used by the contextual "+" button on output ports.
|
|
30
|
+
*/
|
|
31
|
+
export function canPortAcceptEdge(nodeId, handleId, nodes, edges) {
|
|
32
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
33
|
+
if (!node)
|
|
34
|
+
return false;
|
|
35
|
+
const ports = getPorts(node.data);
|
|
36
|
+
const port = ports.output.find((p) => p.id === handleId);
|
|
37
|
+
if (!port)
|
|
38
|
+
return false;
|
|
39
|
+
// Tool output ports always accept multiple edges (an agent wires up many tools).
|
|
40
|
+
// A control output port accepts a single edge unless the node can branch.
|
|
41
|
+
if (port.type === "control" && !NodeRegistry.getByType(node.data.type)?.canBranch) {
|
|
42
|
+
if (edges.some((e) => e.source === nodeId && e.sourceHandle === handleId))
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// Mutual exclusion: control output blocked when node has tool-input edges
|
|
46
|
+
// (Tool output is exempt — never blocked)
|
|
47
|
+
if (port.type === "control" && hasToolInputEdge(nodeId, node.data, edges))
|
|
48
|
+
return false;
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Filter node definitions to those that can connect to a given output port.
|
|
53
|
+
* Returns definitions whose nodes have an input port matching the origin's port type.
|
|
54
|
+
*/
|
|
55
|
+
export function getCompatibleNodeDefs(originNodeId, originHandleId, nodes, edges, allNodeDefs, isFunctionCanvas) {
|
|
56
|
+
const originNode = nodes.find((n) => n.id === originNodeId);
|
|
57
|
+
if (!originNode)
|
|
58
|
+
return [];
|
|
59
|
+
const originPorts = getPorts(originNode.data);
|
|
60
|
+
const originPort = originPorts.output.find((p) => p.id === originHandleId);
|
|
61
|
+
if (!originPort)
|
|
62
|
+
return [];
|
|
63
|
+
const originPortType = originPort.type; // "control" | "tool"
|
|
64
|
+
return allNodeDefs.filter((def) => {
|
|
65
|
+
if (def.isUnremovable)
|
|
66
|
+
return false;
|
|
67
|
+
if (def.isSingleton && nodes.some((n) => n.data.type === def.type))
|
|
68
|
+
return false;
|
|
69
|
+
// Triggers have no inputs — skip on function canvas and when looking for input ports
|
|
70
|
+
if (isFunctionCanvas && def.category === "Trigger")
|
|
71
|
+
return false;
|
|
72
|
+
// Check candidate has a matching input port
|
|
73
|
+
const candidatePorts = getPorts({ type: def.type });
|
|
74
|
+
return candidatePorts.input.some((p) => p.type === originPortType);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export const isValidConnection = (sourceId, targetId, sourceHandleId, targetHandleId, nodes, edges) => {
|
|
78
|
+
// All handles must be present
|
|
79
|
+
if (sourceHandleId == null || targetHandleId == null || sourceId == null || targetId == null)
|
|
80
|
+
return false;
|
|
81
|
+
// Find source and target nodes
|
|
82
|
+
const srcNode = nodes.find((n) => n.id === sourceId);
|
|
83
|
+
const tgtNode = nodes.find((n) => n.id === targetId);
|
|
84
|
+
if (!srcNode || !tgtNode)
|
|
85
|
+
return false;
|
|
86
|
+
// Source-side checks via canPortAcceptEdge (multiple-outgoing + mutual exclusion)
|
|
87
|
+
if (!canPortAcceptEdge(sourceId, sourceHandleId, nodes, edges))
|
|
88
|
+
return false;
|
|
89
|
+
// Get ports using centralized dispatcher
|
|
90
|
+
const sourcePorts = getPorts(srcNode.data);
|
|
91
|
+
const targetPorts = getPorts(tgtNode.data);
|
|
92
|
+
const sourcePort = sourcePorts.output.find((p) => p.id === sourceHandleId);
|
|
93
|
+
const targetPort = targetPorts.input.find((p) => p.id === targetHandleId);
|
|
94
|
+
if (!sourcePort || !targetPort)
|
|
95
|
+
return false;
|
|
96
|
+
// Only allow connections between same port types
|
|
97
|
+
if (sourcePort.type !== targetPort.type)
|
|
98
|
+
return false;
|
|
99
|
+
// Target-side mutual exclusion checks
|
|
100
|
+
const portType = sourcePort.type;
|
|
101
|
+
if (portType === "tool") {
|
|
102
|
+
// Connecting a tool input on the target — reject if target already has control connections
|
|
103
|
+
if (hasControlFlowEdge(tgtNode.id, tgtNode.data, edges))
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (portType === "control") {
|
|
107
|
+
// Connecting a control port — reject if target already has tool INPUT connections
|
|
108
|
+
if (hasToolInputEdge(tgtNode.id, tgtNode.data, edges))
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return portType;
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=connectionRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionRules.js","source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,KAAK,CAAC;IAEtD,sCAAsC;IACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAgB,CAAC;IAE7C,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,2FAA2F;QAC3F,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACxE,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,kFAAkF;QAClF,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Expression } from "@foresthubai/workflow-core";
|
|
2
|
+
import type { DataType } from "@foresthubai/workflow-core/parameter";
|
|
3
|
+
import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
|
|
4
|
+
import { type ApiVariable } from "@foresthubai/workflow-core/variable";
|
|
5
|
+
/** Create a new (empty) function + its body canvas. Returns the new definition. */
|
|
6
|
+
export declare function addFunction(): FunctionDeclaration;
|
|
7
|
+
/** Delete a function: its declaration, its body canvas, and any selection of it. */
|
|
8
|
+
export declare function deleteFunction(id: string): void;
|
|
9
|
+
/** Rename a function. Call-site migration detects this via the name comparison, so
|
|
10
|
+
* it needs no version bump. */
|
|
11
|
+
export declare function renameFunction(id: string, name: string): void;
|
|
12
|
+
export declare function addArgument(id: string): void;
|
|
13
|
+
export declare function updateArgument(id: string, index: number, patch: Partial<ApiVariable>): void;
|
|
14
|
+
export declare function removeArgument(id: string, index: number): void;
|
|
15
|
+
export declare function addOutput(id: string): void;
|
|
16
|
+
/** Update an output's declaration (name/dataType). A dataType change retags the
|
|
17
|
+
* bundled expression's dataType but keeps the entered text. */
|
|
18
|
+
export declare function updateOutput(id: string, index: number, patch: {
|
|
19
|
+
name?: string;
|
|
20
|
+
dataType?: DataType;
|
|
21
|
+
}): void;
|
|
22
|
+
export declare function removeOutput(id: string, index: number): void;
|
|
23
|
+
/** Set one output's return-value expression. Not a signature change → no version bump. */
|
|
24
|
+
export declare function setOutputExpression(id: string, index: number, expression: Expression): void;
|
|
25
|
+
/** Read a function declaration without subscribing (for non-component callers). */
|
|
26
|
+
export declare function getFunction(id: string): FunctionDeclaration | undefined;
|
|
27
|
+
//# sourceMappingURL=functionOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functionOperations.d.ts","sourceRoot":"","sources":["../../src/utils/functionOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AA8ClF,mFAAmF;AACnF,wBAAgB,WAAW,IAAI,mBAAmB,CAejD;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAU/C;AAED;gCACgC;AAChC,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE7D;AAID,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAS5C;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAY3F;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE9D;AAID,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IA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