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