@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,185 @@
|
|
|
1
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../components/ui/tooltip";
|
|
2
|
+
import { BaseEdge, EdgeLabelRenderer, getBezierPath, Position, useEdges } from "@xyflow/react";
|
|
3
|
+
import { AlertTriangle } from "lucide-react";
|
|
4
|
+
import { EdgeData, isControlFlow, isToolFlow, type EdgeType } from "@foresthubai/workflow-core/edge";
|
|
5
|
+
import { useEffect, useMemo } from "react";
|
|
6
|
+
import { useAvailableVariables } from "../hooks/useAvailableVariables";
|
|
7
|
+
import { useDiagnosticsStore } from "../stores/diagnosticsStore";
|
|
8
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
9
|
+
import { isReadOnly } from "../WorkflowBuilder";
|
|
10
|
+
import { computeEdgeDiagnostics } from "@foresthubai/workflow-core/diagnostics";
|
|
11
|
+
|
|
12
|
+
const EDGE_BASE_COLOR = "hsl(var(--edge-default))";
|
|
13
|
+
const AGENT_COLOR = "hsl(var(--node-agent))";
|
|
14
|
+
const ERROR_COLOR = "hsl(var(--destructive))";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Source/target stroke colors per edge type. Plain control and tool edges use
|
|
18
|
+
* the neutral edge base on both ends. Edges that touch an Agent pick up the
|
|
19
|
+
* agent color on that side, so the SVG gradient makes the edge visually
|
|
20
|
+
* announce its agent endpoint (e.g. agentTask fades base → agent toward the
|
|
21
|
+
* target Agent).
|
|
22
|
+
*/
|
|
23
|
+
function endColors(type: EdgeType): { source: string; target: string } {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case "control":
|
|
26
|
+
case "tool":
|
|
27
|
+
return { source: EDGE_BASE_COLOR, target: EDGE_BASE_COLOR };
|
|
28
|
+
case "agentTask":
|
|
29
|
+
return { source: EDGE_BASE_COLOR, target: AGENT_COLOR };
|
|
30
|
+
case "agentChoice":
|
|
31
|
+
return { source: AGENT_COLOR, target: EDGE_BASE_COLOR };
|
|
32
|
+
case "agentDelegate":
|
|
33
|
+
return { source: AGENT_COLOR, target: AGENT_COLOR };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const CustomEdge = ({
|
|
38
|
+
id,
|
|
39
|
+
source,
|
|
40
|
+
type,
|
|
41
|
+
sourceX,
|
|
42
|
+
sourceY,
|
|
43
|
+
targetX,
|
|
44
|
+
targetY,
|
|
45
|
+
data,
|
|
46
|
+
selected,
|
|
47
|
+
}: {
|
|
48
|
+
id: string;
|
|
49
|
+
source: string;
|
|
50
|
+
type: string;
|
|
51
|
+
sourceX: number;
|
|
52
|
+
sourceY: number;
|
|
53
|
+
targetX: number;
|
|
54
|
+
targetY: number;
|
|
55
|
+
data?: EdgeData;
|
|
56
|
+
selected?: boolean;
|
|
57
|
+
}) => {
|
|
58
|
+
const isHighlighted = selected ?? false;
|
|
59
|
+
const isPreview = useEditorStore((s) => isReadOnly(s.builderMode));
|
|
60
|
+
const edgeType = (type ?? "control") as EdgeType;
|
|
61
|
+
const edges = useEdges();
|
|
62
|
+
const activeCanvasId = useEditorStore.getState().activeCanvasId;
|
|
63
|
+
const { lookup: availableVariables } = useAvailableVariables(activeCanvasId);
|
|
64
|
+
|
|
65
|
+
const sourceControlEdgeCount = edges.filter((e) => e.source === source && isControlFlow(e.type as EdgeType)).length;
|
|
66
|
+
|
|
67
|
+
// Compute edge diagnostics via extracted pure function
|
|
68
|
+
const diagnostics = useMemo(
|
|
69
|
+
() =>
|
|
70
|
+
computeEdgeDiagnostics({
|
|
71
|
+
canvasId: activeCanvasId,
|
|
72
|
+
edgeId: id,
|
|
73
|
+
edgeType,
|
|
74
|
+
edgeData: data,
|
|
75
|
+
availableVariables,
|
|
76
|
+
sourceControlEdgeCount,
|
|
77
|
+
}),
|
|
78
|
+
[edgeType, sourceControlEdgeCount, data, availableVariables, activeCanvasId, id],
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const hasErrors = diagnostics.length > 0;
|
|
82
|
+
|
|
83
|
+
// Write diagnostics to store (cleanup on unmount; validateAllCanvases handles full-project)
|
|
84
|
+
const setEdgeDiagnostics = useDiagnosticsStore((s) => s.setEdgeDiagnostics);
|
|
85
|
+
const clearEdgeDiagnostics = useDiagnosticsStore((s) => s.clearEdgeDiagnostics);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (isPreview) return;
|
|
88
|
+
setEdgeDiagnostics(id, diagnostics);
|
|
89
|
+
return () => clearEdgeDiagnostics(id);
|
|
90
|
+
}, [id, diagnostics, setEdgeDiagnostics, clearEdgeDiagnostics, isPreview]);
|
|
91
|
+
|
|
92
|
+
const getEdgePath = () => {
|
|
93
|
+
if (isToolFlow(edgeType)) {
|
|
94
|
+
// Tool ports are diamonds, and React Flow anchors the wire at the handle
|
|
95
|
+
// box's edge midpoint — i.e. the diamond's pointed tip — so a wire meeting
|
|
96
|
+
// it looks pinched/detached. Pull each end into its node (tool output sits
|
|
97
|
+
// on a node's bottom, tool input on the next node's top) so the wire
|
|
98
|
+
// overlaps the diamond body (hidden under the z-20 port) and reads solid.
|
|
99
|
+
const OVERLAP = 3;
|
|
100
|
+
return getBezierPath({
|
|
101
|
+
sourceX,
|
|
102
|
+
sourceY: sourceY - OVERLAP,
|
|
103
|
+
targetX,
|
|
104
|
+
targetY: targetY + OVERLAP,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Control flow: ends have horizontal slope
|
|
108
|
+
const OVERLAP = 2;
|
|
109
|
+
return getBezierPath({
|
|
110
|
+
sourceX: sourceX - OVERLAP,
|
|
111
|
+
sourceY,
|
|
112
|
+
sourcePosition: Position.Right,
|
|
113
|
+
targetX: targetX + OVERLAP,
|
|
114
|
+
targetY,
|
|
115
|
+
targetPosition: Position.Left,
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const [edgePath, labelX, labelY] = getEdgePath();
|
|
120
|
+
const colors = hasErrors ? { source: ERROR_COLOR, target: ERROR_COLOR } : endColors(edgeType);
|
|
121
|
+
const strokeWidth = 3;
|
|
122
|
+
const gradientId = `edge-gradient-${id}`;
|
|
123
|
+
|
|
124
|
+
// Glow effect for highlighted edges — uniform high-contrast color (or
|
|
125
|
+
// destructive when the edge itself is errored).
|
|
126
|
+
const glowColor = hasErrors ? ERROR_COLOR : "hsl(var(--selection-glow))";
|
|
127
|
+
const glowFilter = isHighlighted ? `drop-shadow(0 0 8px ${glowColor}) drop-shadow(0 0 16px ${glowColor})` : undefined;
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<>
|
|
131
|
+
<g style={{ filter: glowFilter }}>
|
|
132
|
+
<defs>
|
|
133
|
+
{/* gradientUnits=userSpaceOnUse anchors the stops to the edge's actual
|
|
134
|
+
source/target coordinates, so the fade follows the wire regardless
|
|
135
|
+
of its bounding box (which is what objectBoundingBox would use). */}
|
|
136
|
+
<linearGradient
|
|
137
|
+
id={gradientId}
|
|
138
|
+
gradientUnits="userSpaceOnUse"
|
|
139
|
+
x1={sourceX}
|
|
140
|
+
y1={sourceY}
|
|
141
|
+
x2={targetX}
|
|
142
|
+
y2={targetY}
|
|
143
|
+
>
|
|
144
|
+
<stop offset="0%" stopColor={colors.source} />
|
|
145
|
+
<stop offset="100%" stopColor={colors.target} />
|
|
146
|
+
</linearGradient>
|
|
147
|
+
</defs>
|
|
148
|
+
<BaseEdge
|
|
149
|
+
id={id}
|
|
150
|
+
path={edgePath}
|
|
151
|
+
style={{
|
|
152
|
+
stroke: `url(#${gradientId})`,
|
|
153
|
+
strokeWidth,
|
|
154
|
+
strokeDasharray: "none",
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
</g>
|
|
158
|
+
<EdgeLabelRenderer>
|
|
159
|
+
<div
|
|
160
|
+
style={{
|
|
161
|
+
position: "absolute",
|
|
162
|
+
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
|
163
|
+
pointerEvents: "all",
|
|
164
|
+
}}
|
|
165
|
+
className="flex flex-col items-center gap-0.5"
|
|
166
|
+
>
|
|
167
|
+
{hasErrors && (
|
|
168
|
+
<Tooltip delayDuration={300}>
|
|
169
|
+
<TooltipTrigger asChild>
|
|
170
|
+
<div className="cursor-help">
|
|
171
|
+
<AlertTriangle className="h-5 w-5 text-destructive fill-background" />
|
|
172
|
+
</div>
|
|
173
|
+
</TooltipTrigger>
|
|
174
|
+
<TooltipContent side="top" className="bg-destructive text-destructive-foreground text-xs px-2 py-1">
|
|
175
|
+
{diagnostics[0]?.message ?? "This edge has errors"}
|
|
176
|
+
</TooltipContent>
|
|
177
|
+
</Tooltip>
|
|
178
|
+
)}
|
|
179
|
+
</div>
|
|
180
|
+
</EdgeLabelRenderer>
|
|
181
|
+
</>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default CustomEdge;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NodeData, NodeRegistry } from "@foresthubai/workflow-core/node";
|
|
2
|
+
import { NodeProps } from "@xyflow/react";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { BaseNode } from "./BaseNode";
|
|
5
|
+
|
|
6
|
+
// Standard node component for all non-FunctionCall nodes
|
|
7
|
+
// Simply resolves the node definition from the registry and delegates to BaseNode
|
|
8
|
+
export const CustomNode = memo((props: NodeProps) => {
|
|
9
|
+
const nodeData = props.data as NodeData;
|
|
10
|
+
|
|
11
|
+
// Get node definition from static registry
|
|
12
|
+
const nodeDefinition = useMemo(() => {
|
|
13
|
+
return NodeRegistry.getByType(nodeData.type);
|
|
14
|
+
}, [nodeData.type]);
|
|
15
|
+
return <BaseNode {...props} nodeDefinition={nodeDefinition} />;
|
|
16
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FunctionCallNode as DomainFunctionCallNode } from "@foresthubai/workflow-core/node";
|
|
2
|
+
import { NodeProps } from "@xyflow/react";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { buildFunctionNodeDef } from "../hooks/useNodeDefinitions";
|
|
5
|
+
import { useFunctionRegistry } from "../hooks/useFunctionRegistry";
|
|
6
|
+
import { BaseNode } from "./BaseNode";
|
|
7
|
+
|
|
8
|
+
// Specialized node component for FunctionCall nodes
|
|
9
|
+
// Renders from node's stored data (usually up-to-date via auto-migration,
|
|
10
|
+
// but may be stale after undo)
|
|
11
|
+
export const FunctionCallNode = memo((props: NodeProps) => {
|
|
12
|
+
const nodeData = props.data as DomainFunctionCallNode;
|
|
13
|
+
|
|
14
|
+
// Get function info for staleness check and live label
|
|
15
|
+
const { getFunction } = useFunctionRegistry();
|
|
16
|
+
const registryFunctionInfo = getFunction(nodeData.functionInfo.id);
|
|
17
|
+
|
|
18
|
+
const isDeleted = !registryFunctionInfo;
|
|
19
|
+
const isStale = registryFunctionInfo
|
|
20
|
+
? nodeData.functionInfo.version !== registryFunctionInfo.version
|
|
21
|
+
: false;
|
|
22
|
+
|
|
23
|
+
// Build node definition from node's stored functionInfo, using registry name for label
|
|
24
|
+
const nodeDefinition = useMemo(() => {
|
|
25
|
+
const name = registryFunctionInfo?.name ?? nodeData.functionInfo.name;
|
|
26
|
+
return buildFunctionNodeDef({ ...nodeData.functionInfo, name });
|
|
27
|
+
}, [nodeData.functionInfo, registryFunctionInfo?.name]);
|
|
28
|
+
|
|
29
|
+
return <BaseNode {...props} nodeDefinition={nodeDefinition} isStale={isStale} isDeleted={isDeleted} />;
|
|
30
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Handle, Position } from "@xyflow/react";
|
|
3
|
+
import { Plus } from "lucide-react";
|
|
4
|
+
import type { EdgeType } from "@foresthubai/workflow-core/edge";
|
|
5
|
+
|
|
6
|
+
export interface PortActionDetail {
|
|
7
|
+
nodeId: string;
|
|
8
|
+
handleId: string;
|
|
9
|
+
portType: EdgeType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface PortHandleProps {
|
|
13
|
+
id: string;
|
|
14
|
+
nodeId?: string;
|
|
15
|
+
type: "source" | "target";
|
|
16
|
+
position: Position;
|
|
17
|
+
portType: EdgeType;
|
|
18
|
+
label?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
showPlus?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const PortHandle = ({
|
|
25
|
+
id,
|
|
26
|
+
nodeId,
|
|
27
|
+
type,
|
|
28
|
+
position,
|
|
29
|
+
portType,
|
|
30
|
+
label,
|
|
31
|
+
style,
|
|
32
|
+
disabled,
|
|
33
|
+
showPlus,
|
|
34
|
+
}: PortHandleProps) => {
|
|
35
|
+
const getHandleStyle = () => {
|
|
36
|
+
const baseStyle: React.CSSProperties = {
|
|
37
|
+
width: "12px",
|
|
38
|
+
height: "12px",
|
|
39
|
+
// Outline matches the canonical graph-line color (same as edges + node borders).
|
|
40
|
+
border: "2px solid hsl(var(--edge-default))",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (disabled) {
|
|
44
|
+
return {
|
|
45
|
+
...baseStyle,
|
|
46
|
+
backgroundColor: "hsl(var(--muted-foreground) / 0.3)",
|
|
47
|
+
border: "2px solid hsl(var(--muted-foreground) / 0.4)",
|
|
48
|
+
borderRadius: portType === "control" ? "2px" : portType === "tool" ? "2px" : "50%",
|
|
49
|
+
opacity: 0.8,
|
|
50
|
+
cursor: "not-allowed",
|
|
51
|
+
...(portType === "tool" ? { clipPath: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)" } : {}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
switch (portType) {
|
|
56
|
+
case "control":
|
|
57
|
+
// Square shape for execution/control ports. Fill matches the node body
|
|
58
|
+
// (--card) so the port reads as a recessed hole outlined in the graph color.
|
|
59
|
+
return {
|
|
60
|
+
...baseStyle,
|
|
61
|
+
backgroundColor: "hsl(var(--card))",
|
|
62
|
+
borderRadius: "2px",
|
|
63
|
+
};
|
|
64
|
+
case "tool":
|
|
65
|
+
// Diamond via clip-path so the handle stays anchored on the node edge
|
|
66
|
+
// (rotating it would override React Flow's centering transform). A
|
|
67
|
+
// clip-path can't show a border, so the handle background is the outline
|
|
68
|
+
// color and an inset inner diamond (rendered as a child below) paints the
|
|
69
|
+
// canonical tool fill (--node-tool), leaving a 2px edge-default outline.
|
|
70
|
+
return {
|
|
71
|
+
...baseStyle,
|
|
72
|
+
backgroundColor: "hsl(var(--edge-default))",
|
|
73
|
+
border: "none",
|
|
74
|
+
borderRadius: "0",
|
|
75
|
+
clipPath: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)",
|
|
76
|
+
};
|
|
77
|
+
default:
|
|
78
|
+
// Circle shape as fallback
|
|
79
|
+
return {
|
|
80
|
+
...baseStyle,
|
|
81
|
+
backgroundColor: "white",
|
|
82
|
+
borderRadius: "50%",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const getLabelPositionClass = () => {
|
|
88
|
+
switch (position) {
|
|
89
|
+
case Position.Left:
|
|
90
|
+
return "right-full mr-3 text-right";
|
|
91
|
+
case Position.Right:
|
|
92
|
+
return "left-full ml-3 text-left";
|
|
93
|
+
case Position.Top:
|
|
94
|
+
return "bottom-full mb-2 text-center left-1/2 -translate-x-1/2";
|
|
95
|
+
case Position.Bottom:
|
|
96
|
+
return "top-full mt-2 text-center left-1/2 -translate-x-1/2";
|
|
97
|
+
default:
|
|
98
|
+
return "left-full ml-3 text-left";
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const getLabelStyle = (): React.CSSProperties => {
|
|
103
|
+
if (position === Position.Left || position === Position.Right) {
|
|
104
|
+
return {
|
|
105
|
+
top: "50%",
|
|
106
|
+
transform: "translateY(calc(-50% + 12px))",
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const getPlusPositionClass = () => {
|
|
113
|
+
// Center with a negative margin (button is w-4 h-4 = 16px, so -8px = -2),
|
|
114
|
+
// NOT a translate. The hover effect uses `transform: scale()`, and reusing
|
|
115
|
+
// transform for centering too makes the translate drop out mid-animation,
|
|
116
|
+
// which both off-centers the plus and makes it jump on hover.
|
|
117
|
+
switch (position) {
|
|
118
|
+
case Position.Bottom:
|
|
119
|
+
return "top-[15px] left-1/2 -ml-2";
|
|
120
|
+
default:
|
|
121
|
+
return "left-[15px] top-1/2 -mt-2";
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Nudge the *visible* dot 1px toward the node interior so it sits on the
|
|
126
|
+
// outline centerline (the SVG border is strokeW=2). The offset is on a child,
|
|
127
|
+
// NOT the Handle — React Flow anchors edges to the Handle's measured box, so
|
|
128
|
+
// keeping that on the node edge means edges still connect flush instead of
|
|
129
|
+
// stopping 1px short.
|
|
130
|
+
const dotOffset =
|
|
131
|
+
position === Position.Top
|
|
132
|
+
? "translateY(1px)"
|
|
133
|
+
: position === Position.Bottom
|
|
134
|
+
? "translateY(-1px)"
|
|
135
|
+
: position === Position.Left
|
|
136
|
+
? "translateX(1px)"
|
|
137
|
+
: "translateX(-1px)";
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<div className="absolute z-20" style={style}>
|
|
141
|
+
<Handle
|
|
142
|
+
id={id}
|
|
143
|
+
type={type}
|
|
144
|
+
position={position}
|
|
145
|
+
isConnectable={!disabled}
|
|
146
|
+
style={{ width: "12px", height: "12px", background: "transparent", border: "none", minWidth: 0, minHeight: 0 }}
|
|
147
|
+
>
|
|
148
|
+
<div
|
|
149
|
+
style={{ ...getHandleStyle(), position: "absolute", inset: 0, transform: dotOffset, pointerEvents: "none" }}
|
|
150
|
+
>
|
|
151
|
+
{portType === "tool" && !disabled && (
|
|
152
|
+
<div
|
|
153
|
+
style={{
|
|
154
|
+
position: "absolute",
|
|
155
|
+
inset: "2px",
|
|
156
|
+
backgroundColor: "hsl(var(--node-tool))",
|
|
157
|
+
clipPath: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)",
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
162
|
+
</Handle>
|
|
163
|
+
{label && !disabled && (
|
|
164
|
+
<div
|
|
165
|
+
className={`absolute text-xs text-muted-foreground pointer-events-none select-none whitespace-nowrap ${getLabelPositionClass()}`}
|
|
166
|
+
style={getLabelStyle()}
|
|
167
|
+
>
|
|
168
|
+
{label}
|
|
169
|
+
</div>
|
|
170
|
+
)}
|
|
171
|
+
{showPlus && !disabled && nodeId && (
|
|
172
|
+
<button
|
|
173
|
+
type="button"
|
|
174
|
+
title="Add port"
|
|
175
|
+
className={`nodrag absolute flex items-center justify-center w-4 h-4 rounded-full bg-muted-foreground/60 text-card hover:bg-primary hover:scale-110 transition-all cursor-pointer ${getPlusPositionClass()}`}
|
|
176
|
+
onClick={(e) => {
|
|
177
|
+
e.stopPropagation();
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
const detail: PortActionDetail = { nodeId, handleId: id, portType };
|
|
180
|
+
e.currentTarget.dispatchEvent(new CustomEvent("port-plus-click", { detail, bubbles: true }));
|
|
181
|
+
}}
|
|
182
|
+
onPointerDown={(e) => e.stopPropagation()}
|
|
183
|
+
>
|
|
184
|
+
<Plus className="w-2.5 h-2.5" strokeWidth={3} />
|
|
185
|
+
</button>
|
|
186
|
+
)}
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// ReactFlow node/edge type registries
|
|
2
|
+
// Maps ReactFlow type strings to the React components that render them.
|
|
3
|
+
// Shared between CanvasArea (editor) and VersionPreviewCanvas (read-only preview).
|
|
4
|
+
// Lives in graph/ because it references sibling components, but is only consumed
|
|
5
|
+
// by higher-level composing components — no graph/ component imports this file.
|
|
6
|
+
|
|
7
|
+
import { NodeCategory } from "@foresthubai/workflow-core/node";
|
|
8
|
+
import { CustomNode } from "./CustomNode";
|
|
9
|
+
import { FunctionCallNode } from "./FunctionCallNode";
|
|
10
|
+
import CustomEdge from "./CustomEdge";
|
|
11
|
+
|
|
12
|
+
export const nodeTypes = {
|
|
13
|
+
Standard: CustomNode,
|
|
14
|
+
FunctionCall: FunctionCallNode,
|
|
15
|
+
[NodeCategory.Trigger]: CustomNode,
|
|
16
|
+
[NodeCategory.Tool]: CustomNode,
|
|
17
|
+
[NodeCategory.AI]: CustomNode,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const edgeTypes = {
|
|
21
|
+
control: CustomEdge,
|
|
22
|
+
tool: CustomEdge,
|
|
23
|
+
agentTask: CustomEdge,
|
|
24
|
+
agentChoice: CustomEdge,
|
|
25
|
+
agentDelegate: CustomEdge,
|
|
26
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Standard shadcn toast hook + dispatcher
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import type { ToastActionElement, ToastProps } from "../components/ui/toast";
|
|
5
|
+
|
|
6
|
+
const TOAST_LIMIT = 1;
|
|
7
|
+
const TOAST_REMOVE_DELAY = 1_000_000;
|
|
8
|
+
|
|
9
|
+
type ToasterToast = ToastProps & {
|
|
10
|
+
id: string;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
action?: ToastActionElement;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const actionTypes = {
|
|
17
|
+
ADD_TOAST: "ADD_TOAST",
|
|
18
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
19
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
20
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
let count = 0;
|
|
24
|
+
function genId(): string {
|
|
25
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
26
|
+
return count.toString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ActionType = typeof actionTypes;
|
|
30
|
+
|
|
31
|
+
type Action =
|
|
32
|
+
| { type: ActionType["ADD_TOAST"]; toast: ToasterToast }
|
|
33
|
+
| { type: ActionType["UPDATE_TOAST"]; toast: Partial<ToasterToast> & { id: string } }
|
|
34
|
+
| { type: ActionType["DISMISS_TOAST"]; toastId?: ToasterToast["id"] }
|
|
35
|
+
| { type: ActionType["REMOVE_TOAST"]; toastId?: ToasterToast["id"] };
|
|
36
|
+
|
|
37
|
+
interface State {
|
|
38
|
+
toasts: ToasterToast[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
|
|
42
|
+
|
|
43
|
+
function addToRemoveQueue(toastId: string) {
|
|
44
|
+
if (toastTimeouts.has(toastId)) return;
|
|
45
|
+
const timeout = setTimeout(() => {
|
|
46
|
+
toastTimeouts.delete(toastId);
|
|
47
|
+
dispatch({ type: "REMOVE_TOAST", toastId });
|
|
48
|
+
}, TOAST_REMOVE_DELAY);
|
|
49
|
+
toastTimeouts.set(toastId, timeout);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const reducer = (state: State, action: Action): State => {
|
|
53
|
+
switch (action.type) {
|
|
54
|
+
case "ADD_TOAST":
|
|
55
|
+
return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) };
|
|
56
|
+
case "UPDATE_TOAST":
|
|
57
|
+
return {
|
|
58
|
+
...state,
|
|
59
|
+
toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)),
|
|
60
|
+
};
|
|
61
|
+
case "DISMISS_TOAST": {
|
|
62
|
+
const { toastId } = action;
|
|
63
|
+
if (toastId) {
|
|
64
|
+
addToRemoveQueue(toastId);
|
|
65
|
+
} else {
|
|
66
|
+
state.toasts.forEach((t) => addToRemoveQueue(t.id));
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
toasts: state.toasts.map((t) => (t.id === toastId || toastId === undefined ? { ...t, open: false } : t)),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
case "REMOVE_TOAST":
|
|
74
|
+
if (action.toastId === undefined) return { ...state, toasts: [] };
|
|
75
|
+
return { ...state, toasts: state.toasts.filter((t) => t.id !== action.toastId) };
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const listeners: Array<(state: State) => void> = [];
|
|
80
|
+
let memoryState: State = { toasts: [] };
|
|
81
|
+
|
|
82
|
+
function dispatch(action: Action) {
|
|
83
|
+
memoryState = reducer(memoryState, action);
|
|
84
|
+
listeners.forEach((listener) => listener(memoryState));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type Toast = Omit<ToasterToast, "id">;
|
|
88
|
+
|
|
89
|
+
function toast({ ...props }: Toast) {
|
|
90
|
+
const id = genId();
|
|
91
|
+
const update = (next: ToasterToast) => dispatch({ type: "UPDATE_TOAST", toast: { ...next, id } });
|
|
92
|
+
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
93
|
+
|
|
94
|
+
dispatch({
|
|
95
|
+
type: "ADD_TOAST",
|
|
96
|
+
toast: {
|
|
97
|
+
...props,
|
|
98
|
+
id,
|
|
99
|
+
open: true,
|
|
100
|
+
onOpenChange: (open) => {
|
|
101
|
+
if (!open) dismiss();
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
return { id, dismiss, update };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function useToast() {
|
|
109
|
+
const [state, setState] = React.useState<State>(memoryState);
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
listeners.push(setState);
|
|
112
|
+
return () => {
|
|
113
|
+
const index = listeners.indexOf(setState);
|
|
114
|
+
if (index > -1) listeners.splice(index, 1);
|
|
115
|
+
};
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
...state,
|
|
120
|
+
toast,
|
|
121
|
+
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { useToast, toast };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { getOrCreateCanvasStore, MAIN_CANVAS_ID } from "../stores/canvasStore";
|
|
3
|
+
import { computeAvailableVariables } from "@foresthubai/workflow-core/variable";
|
|
4
|
+
|
|
5
|
+
// Re-export types for consumers
|
|
6
|
+
export type { Variable as AvailableVariable } from "@foresthubai/workflow-core/variable";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Hook that provides access to all available variables for a specific canvas.
|
|
10
|
+
* Each canvas is self-contained — main and function canvases do not share scope.
|
|
11
|
+
*
|
|
12
|
+
* Returns both an array (for iteration/UI) and a record (for O(1) lookup).
|
|
13
|
+
*/
|
|
14
|
+
export const useAvailableVariables = (canvasId: string = MAIN_CANVAS_ID) => {
|
|
15
|
+
const store = getOrCreateCanvasStore(canvasId);
|
|
16
|
+
const variables = store((s) => s.variables);
|
|
17
|
+
const edges = store((s) => s.edges);
|
|
18
|
+
|
|
19
|
+
return useMemo(() => computeAvailableVariables(variables, edges), [variables, edges]);
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getOrCreateCanvasStore, MAIN_CANVAS_ID } from "../stores/canvasStore";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that exposes all history functions from a canvas store.
|
|
5
|
+
* Each canvas has its own independent undo/redo history.
|
|
6
|
+
*/
|
|
7
|
+
export const useCanvasHistory = (canvasId: string = MAIN_CANVAS_ID) => {
|
|
8
|
+
const canvasStore = getOrCreateCanvasStore(canvasId);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
// History actions
|
|
12
|
+
undo: canvasStore.undo,
|
|
13
|
+
redo: canvasStore.redo,
|
|
14
|
+
takeCheckpoint: canvasStore.takeCheckpoint,
|
|
15
|
+
withCheckpoint: canvasStore.withCheckpoint,
|
|
16
|
+
clearHistory: canvasStore.clearHistory,
|
|
17
|
+
|
|
18
|
+
// History state checks
|
|
19
|
+
canUndo: canvasStore.canUndo,
|
|
20
|
+
canRedo: canvasStore.canRedo,
|
|
21
|
+
};
|
|
22
|
+
};
|