@flowdrop/flowdrop 1.4.0 → 1.6.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/README.md +94 -51
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +27 -47
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/AgentSpecAdapter.js +122 -133
- package/dist/adapters/agentspec/agentAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/agentAdapter.js +10 -10
- package/dist/adapters/agentspec/autoLayout.d.ts +52 -6
- package/dist/adapters/agentspec/autoLayout.js +118 -23
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +1 -1
- package/dist/adapters/agentspec/componentTypeDefaults.js +120 -120
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +2 -2
- package/dist/adapters/agentspec/defaultNodeTypes.js +307 -307
- package/dist/adapters/agentspec/index.d.ts +10 -10
- package/dist/adapters/agentspec/index.js +6 -6
- package/dist/adapters/agentspec/validator.d.ts +2 -2
- package/dist/adapters/agentspec/validator.js +20 -22
- package/dist/api/enhanced-client.d.ts +3 -3
- package/dist/api/enhanced-client.js +72 -73
- package/dist/chat/commandClassifier.d.ts +19 -0
- package/dist/chat/commandClassifier.js +30 -0
- package/dist/chat/index.d.ts +27 -0
- package/dist/chat/index.js +32 -0
- package/dist/chat/responseParser.d.ts +21 -0
- package/dist/chat/responseParser.js +91 -0
- package/dist/commands/batch.d.ts +18 -0
- package/dist/commands/batch.js +54 -0
- package/dist/commands/executor.d.ts +37 -0
- package/dist/commands/executor.js +1133 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.js +17 -0
- package/dist/commands/parser.d.ts +16 -0
- package/dist/commands/parser.js +295 -0
- package/dist/commands/positioner.d.ts +19 -0
- package/dist/commands/positioner.js +33 -0
- package/dist/commands/storeIntegration.svelte.d.ts +16 -0
- package/dist/commands/storeIntegration.svelte.js +67 -0
- package/dist/commands/types.d.ts +343 -0
- package/dist/commands/types.js +45 -0
- package/dist/components/App.svelte +522 -237
- package/dist/components/App.svelte.d.ts +11 -8
- package/dist/components/CanvasBanner.stories.svelte +10 -16
- package/dist/components/CanvasBanner.stories.svelte.d.ts +1 -1
- package/dist/components/CanvasBanner.svelte +2 -2
- package/dist/components/CanvasBanner.svelte.d.ts +1 -1
- package/dist/components/CanvasController.svelte +37 -0
- package/dist/components/CanvasController.svelte.d.ts +32 -0
- package/dist/components/ConfigForm.svelte +118 -256
- package/dist/components/ConfigForm.svelte.d.ts +2 -2
- package/dist/components/ConfigMappingRow.svelte +128 -0
- package/dist/components/ConfigMappingRow.svelte.d.ts +8 -0
- package/dist/components/ConfigModal.svelte +3 -3
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.stories.svelte +19 -19
- package/dist/components/ConfigPanel.stories.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.svelte +57 -19
- package/dist/components/ConfigPanel.svelte.d.ts +3 -1
- package/dist/components/ConnectionLine.svelte +4 -4
- package/dist/components/EdgeRefresher.svelte +1 -1
- package/dist/components/FlowDropEdge.stories.svelte +110 -110
- package/dist/components/FlowDropEdge.svelte +11 -19
- package/dist/components/FlowDropEdge.svelte.d.ts +1 -1
- package/dist/components/FlowDropZone.svelte +6 -9
- package/dist/components/FlowDropZone.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.stories.svelte +13 -13
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.svelte +3 -3
- package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
- package/dist/components/Logo.stories.svelte +4 -4
- package/dist/components/Logo.stories.svelte.d.ts +1 -1
- package/dist/components/Logo.svelte +3 -9
- package/dist/components/LogsSidebar.svelte +46 -53
- package/dist/components/LogsSidebar.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.stories.svelte +10 -14
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.svelte +4 -6
- package/dist/components/Navbar.stories.svelte +19 -19
- package/dist/components/Navbar.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.svelte +28 -49
- package/dist/components/Navbar.svelte.d.ts +2 -2
- package/dist/components/NodeSidebar.svelte +55 -135
- package/dist/components/NodeSidebar.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.stories.svelte +19 -31
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.svelte +40 -55
- package/dist/components/NodeStatusOverlay.svelte.d.ts +3 -3
- package/dist/components/NodeSwapPicker.svelte +493 -0
- package/dist/components/NodeSwapPicker.svelte.d.ts +16 -0
- package/dist/components/PipelineStatus.svelte +63 -89
- package/dist/components/PipelineStatus.svelte.d.ts +4 -4
- package/dist/components/PortCoordinateTracker.svelte +5 -7
- package/dist/components/PortCoordinateTracker.svelte.d.ts +1 -1
- package/dist/components/PortMappingRow.svelte +205 -0
- package/dist/components/PortMappingRow.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +1 -1
- package/dist/components/SchemaForm.stories.svelte +53 -53
- package/dist/components/SchemaForm.stories.svelte.d.ts +1 -1
- package/dist/components/SchemaForm.svelte +24 -51
- package/dist/components/SchemaForm.svelte.d.ts +2 -2
- package/dist/components/SettingsModal.svelte +6 -9
- package/dist/components/SettingsModal.svelte.d.ts +1 -1
- package/dist/components/SettingsPanel.svelte +138 -158
- package/dist/components/SettingsPanel.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.stories.svelte +16 -29
- package/dist/components/StatusIcon.stories.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.svelte +19 -19
- package/dist/components/StatusIcon.svelte.d.ts +2 -2
- package/dist/components/StatusLabel.stories.svelte +8 -8
- package/dist/components/StatusLabel.stories.svelte.d.ts +1 -1
- package/dist/components/SwapMappingEditor.svelte +529 -0
- package/dist/components/SwapMappingEditor.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.stories.svelte +10 -10
- package/dist/components/ThemeToggle.stories.svelte.d.ts +1 -1
- package/dist/components/ThemeToggle.svelte +22 -33
- package/dist/components/ThemeToggle.svelte.d.ts +1 -1
- package/dist/components/UniversalNode.svelte +29 -41
- package/dist/components/UniversalNode.svelte.d.ts +3 -3
- package/dist/components/WorkflowEditor.svelte +210 -170
- package/dist/components/WorkflowEditor.svelte.d.ts +12 -4
- package/dist/components/chat/AIChatPanel.svelte +797 -0
- package/dist/components/chat/AIChatPanel.svelte.d.ts +13 -0
- package/dist/components/chat/CommandPreview.svelte +234 -0
- package/dist/components/chat/CommandPreview.svelte.d.ts +9 -0
- package/dist/components/console/CommandConsole.stories.svelte +111 -0
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +27 -0
- package/dist/components/console/CommandConsole.svelte +263 -0
- package/dist/components/console/CommandConsole.svelte.d.ts +11 -0
- package/dist/components/console/ConsoleAutocomplete.svelte +142 -0
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +21 -0
- package/dist/components/console/ConsoleInput.svelte +771 -0
- package/dist/components/console/ConsoleInput.svelte.d.ts +16 -0
- package/dist/components/console/ConsoleOutput.svelte +116 -0
- package/dist/components/console/ConsoleOutput.svelte.d.ts +11 -0
- package/dist/components/console/formatters.d.ts +26 -0
- package/dist/components/console/formatters.js +116 -0
- package/dist/components/form/FormArray.svelte +75 -132
- package/dist/components/form/FormArray.svelte.d.ts +1 -1
- package/dist/components/form/FormAutocomplete.svelte +65 -108
- package/dist/components/form/FormAutocomplete.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.stories.svelte +13 -16
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.svelte +2 -2
- package/dist/components/form/FormCodeEditor.svelte +42 -56
- package/dist/components/form/FormField.svelte +79 -90
- package/dist/components/form/FormField.svelte.d.ts +2 -2
- package/dist/components/form/FormFieldLight.svelte +72 -88
- package/dist/components/form/FormFieldLight.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.stories.svelte +14 -14
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.svelte +2 -9
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldset.svelte +3 -3
- package/dist/components/form/FormFieldset.svelte.d.ts +2 -2
- package/dist/components/form/FormMarkdownEditor.svelte +123 -156
- package/dist/components/form/FormNumberField.stories.svelte +18 -18
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormNumberField.svelte +6 -6
- package/dist/components/form/FormRangeField.stories.svelte +13 -13
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormRangeField.svelte +4 -12
- package/dist/components/form/FormSelect.stories.svelte +21 -21
- package/dist/components/form/FormSelect.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormSelect.svelte +5 -5
- package/dist/components/form/FormSelect.svelte.d.ts +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +126 -175
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.stories.svelte +17 -23
- package/dist/components/form/FormTextField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.svelte +4 -4
- package/dist/components/form/FormTextarea.stories.svelte +18 -21
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextarea.svelte +4 -4
- package/dist/components/form/FormToggle.stories.svelte +13 -16
- package/dist/components/form/FormToggle.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormToggle.svelte +3 -3
- package/dist/components/form/FormUISchemaRenderer.svelte +12 -19
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +3 -3
- package/dist/components/form/index.d.ts +19 -19
- package/dist/components/form/index.js +18 -18
- package/dist/components/form/templateAutocomplete.d.ts +2 -2
- package/dist/components/form/templateAutocomplete.js +55 -64
- package/dist/components/form/types.d.ts +6 -6
- package/dist/components/form/types.js +4 -9
- package/dist/components/icons/AlertCircleIcon.svelte +1 -6
- package/dist/components/icons/CogIcon.svelte +1 -6
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +27 -27
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ChoicePrompt.svelte +17 -41
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +17 -17
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.svelte +10 -16
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/FormPrompt.svelte +10 -15
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/InterruptBubble.svelte +87 -121
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +2 -2
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +37 -37
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.svelte +55 -75
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +16 -17
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.svelte +13 -18
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/index.d.ts +6 -5
- package/dist/components/interrupt/index.js +6 -5
- package/dist/components/layouts/MainLayout.svelte +46 -84
- package/dist/components/layouts/MainLayout.svelte.d.ts +6 -6
- package/dist/components/nodes/GatewayNode.stories.svelte +64 -65
- package/dist/components/nodes/GatewayNode.svelte +37 -70
- package/dist/components/nodes/GatewayNode.svelte.d.ts +3 -3
- package/dist/components/nodes/IdeaNode.stories.svelte +25 -26
- package/dist/components/nodes/IdeaNode.svelte +22 -36
- package/dist/components/nodes/IdeaNode.svelte.d.ts +1 -1
- package/dist/components/nodes/NotesNode.stories.svelte +37 -38
- package/dist/components/nodes/NotesNode.svelte +28 -39
- package/dist/components/nodes/NotesNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SimpleNode.stories.svelte +137 -138
- package/dist/components/nodes/SimpleNode.svelte +44 -74
- package/dist/components/nodes/SimpleNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SquareNode.stories.svelte +75 -75
- package/dist/components/nodes/SquareNode.svelte +42 -68
- package/dist/components/nodes/SquareNode.svelte.d.ts +1 -1
- package/dist/components/nodes/TerminalNode.stories.svelte +10 -10
- package/dist/components/nodes/TerminalNode.svelte +74 -112
- package/dist/components/nodes/TerminalNode.svelte.d.ts +1 -1
- package/dist/components/nodes/ToolNode.stories.svelte +115 -116
- package/dist/components/nodes/ToolNode.svelte +31 -64
- package/dist/components/nodes/ToolNode.svelte.d.ts +1 -1
- package/dist/components/nodes/WorkflowNode.stories.svelte +84 -89
- package/dist/components/nodes/WorkflowNode.svelte +50 -103
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +3 -3
- package/dist/components/playground/ChatPanel.svelte +47 -103
- package/dist/components/playground/ExecutionLogs.svelte +45 -68
- package/dist/components/playground/InputCollector.svelte +32 -51
- package/dist/components/playground/MessageBubble.stories.svelte +25 -25
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +1 -1
- package/dist/components/playground/MessageBubble.svelte +54 -70
- package/dist/components/playground/MessageBubble.svelte.d.ts +1 -1
- package/dist/components/playground/Playground.svelte +60 -91
- package/dist/components/playground/Playground.svelte.d.ts +3 -3
- package/dist/components/playground/PlaygroundModal.svelte +8 -12
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -3
- package/dist/components/playground/SessionManager.svelte +34 -40
- package/dist/components/playground/SessionManager.svelte.d.ts +1 -1
- package/dist/config/agentSpecEndpoints.d.ts +1 -1
- package/dist/config/agentSpecEndpoints.js +20 -20
- package/dist/config/constants.js +2 -2
- package/dist/config/defaultCategories.d.ts +1 -1
- package/dist/config/defaultCategories.js +86 -86
- package/dist/config/defaultPortConfig.d.ts +1 -1
- package/dist/config/defaultPortConfig.js +144 -144
- package/dist/config/endpoints.d.ts +12 -4
- package/dist/config/endpoints.js +70 -65
- package/dist/config/runtimeConfig.d.ts +2 -2
- package/dist/config/runtimeConfig.js +8 -8
- package/dist/core/index.d.ts +68 -63
- package/dist/core/index.js +44 -35
- package/dist/display/index.d.ts +2 -2
- package/dist/display/index.js +2 -2
- package/dist/editor/index.d.ts +64 -62
- package/dist/editor/index.js +57 -55
- package/dist/form/code.d.ts +5 -5
- package/dist/form/code.js +14 -14
- package/dist/form/fieldRegistry.d.ts +3 -3
- package/dist/form/fieldRegistry.js +9 -11
- package/dist/form/full.d.ts +8 -8
- package/dist/form/full.js +9 -9
- package/dist/form/index.d.ts +18 -18
- package/dist/form/index.js +16 -16
- package/dist/form/markdown.d.ts +4 -4
- package/dist/form/markdown.js +8 -8
- package/dist/helpers/proximityConnect.d.ts +3 -3
- package/dist/helpers/proximityConnect.js +40 -35
- package/dist/helpers/workflowEditorHelper.d.ts +8 -58
- package/dist/helpers/workflowEditorHelper.js +73 -292
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/mocks/app-environment.js +2 -2
- package/dist/mocks/app-forms.js +1 -1
- package/dist/mocks/app-navigation.js +2 -2
- package/dist/mocks/app-stores.js +3 -3
- package/dist/playground/index.d.ts +19 -19
- package/dist/playground/index.js +16 -16
- package/dist/playground/mount.d.ts +3 -3
- package/dist/playground/mount.js +24 -24
- package/dist/registry/builtinFormats.js +13 -13
- package/dist/registry/builtinNodes.d.ts +2 -2
- package/dist/registry/builtinNodes.js +77 -77
- package/dist/registry/index.d.ts +4 -4
- package/dist/registry/index.js +4 -4
- package/dist/registry/nodeComponentRegistry.d.ts +8 -8
- package/dist/registry/nodeComponentRegistry.js +9 -11
- package/dist/registry/plugin.d.ts +2 -2
- package/dist/registry/plugin.js +11 -11
- package/dist/registry/workflowFormatRegistry.d.ts +3 -3
- package/dist/registry/workflowFormatRegistry.js +2 -2
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +107 -22
- package/dist/services/agentSpecExecutionService.d.ts +3 -3
- package/dist/services/agentSpecExecutionService.js +55 -56
- package/dist/services/api.d.ts +2 -2
- package/dist/services/api.js +37 -37
- package/dist/services/apiVariableService.d.ts +1 -1
- package/dist/services/apiVariableService.js +34 -41
- package/dist/services/autoSaveService.js +8 -8
- package/dist/services/categoriesApi.d.ts +2 -2
- package/dist/services/categoriesApi.js +8 -8
- package/dist/services/chatService.d.ts +65 -0
- package/dist/services/chatService.js +131 -0
- package/dist/services/draftStorage.d.ts +1 -1
- package/dist/services/draftStorage.js +11 -11
- package/dist/services/dynamicSchemaService.d.ts +1 -1
- package/dist/services/dynamicSchemaService.js +39 -41
- package/dist/services/globalSave.d.ts +2 -2
- package/dist/services/globalSave.js +38 -41
- package/dist/services/historyService.d.ts +7 -5
- package/dist/services/historyService.js +29 -14
- package/dist/services/interruptService.d.ts +1 -1
- package/dist/services/interruptService.js +29 -35
- package/dist/services/nodeExecutionService.d.ts +1 -1
- package/dist/services/nodeExecutionService.js +44 -45
- package/dist/services/playgroundService.d.ts +1 -1
- package/dist/services/playgroundService.js +29 -29
- package/dist/services/portConfigApi.d.ts +2 -2
- package/dist/services/portConfigApi.js +8 -8
- package/dist/services/settingsService.d.ts +2 -2
- package/dist/services/settingsService.js +19 -25
- package/dist/services/toastService.d.ts +4 -4
- package/dist/services/toastService.js +33 -33
- package/dist/services/variableService.d.ts +1 -1
- package/dist/services/variableService.js +36 -36
- package/dist/services/workflowStorage.d.ts +2 -2
- package/dist/services/workflowStorage.js +13 -13
- package/dist/settings/index.d.ts +7 -7
- package/dist/settings/index.js +6 -6
- package/dist/skins/default.d.ts +1 -1
- package/dist/skins/default.js +1 -1
- package/dist/skins/index.d.ts +3 -3
- package/dist/skins/index.js +7 -7
- package/dist/skins/slate.d.ts +1 -1
- package/dist/skins/slate.js +69 -69
- package/dist/stores/categoriesStore.svelte.d.ts +1 -1
- package/dist/stores/categoriesStore.svelte.js +5 -5
- package/dist/stores/editorStateMachine.svelte.d.ts +2 -2
- package/dist/stores/editorStateMachine.svelte.js +34 -34
- package/dist/stores/historyStore.svelte.d.ts +4 -4
- package/dist/stores/historyStore.svelte.js +4 -4
- package/dist/stores/interruptStore.svelte.d.ts +3 -3
- package/dist/stores/interruptStore.svelte.js +27 -22
- package/dist/stores/playgroundStore.svelte.d.ts +3 -3
- package/dist/stores/playgroundStore.svelte.js +29 -23
- package/dist/stores/portCoordinateStore.svelte.d.ts +6 -2
- package/dist/stores/portCoordinateStore.svelte.js +30 -39
- package/dist/stores/settingsStore.svelte.d.ts +2 -2
- package/dist/stores/settingsStore.svelte.js +57 -62
- package/dist/stores/workflowStore.svelte.d.ts +34 -5
- package/dist/stores/workflowStore.svelte.js +127 -108
- package/dist/stories/CanvasDecorator.svelte +7 -10
- package/dist/stories/CanvasDecorator.svelte.d.ts +2 -2
- package/dist/stories/EdgeDecorator.svelte +28 -31
- package/dist/stories/EdgeDecorator.svelte.d.ts +1 -1
- package/dist/stories/NodeDecorator.svelte +14 -20
- package/dist/stories/NodeDecorator.svelte.d.ts +1 -1
- package/dist/stories/utils.d.ts +2 -2
- package/dist/stories/utils.js +89 -93
- package/dist/styles/base.css +16 -50
- package/dist/styles/tokens.css +10 -28
- package/dist/svelte-app.d.ts +10 -10
- package/dist/svelte-app.js +39 -39
- package/dist/themes/default.d.ts +1 -1
- package/dist/themes/default.js +4 -4
- package/dist/themes/index.d.ts +3 -3
- package/dist/themes/index.js +11 -11
- package/dist/themes/minimal.d.ts +1 -1
- package/dist/themes/minimal.js +5 -5
- package/dist/types/agentspec.d.ts +18 -18
- package/dist/types/agentspec.js +2 -2
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/auth.js +6 -6
- package/dist/types/chat.d.ts +63 -0
- package/dist/types/chat.js +9 -0
- package/dist/types/config.d.ts +6 -6
- package/dist/types/events.d.ts +28 -2
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +40 -32
- package/dist/types/index.js +6 -6
- package/dist/types/interrupt.d.ts +6 -6
- package/dist/types/interrupt.js +21 -21
- package/dist/types/interruptState.d.ts +12 -12
- package/dist/types/interruptState.js +66 -66
- package/dist/types/playground.d.ts +7 -7
- package/dist/types/playground.js +14 -14
- package/dist/types/settings.d.ts +12 -4
- package/dist/types/settings.js +21 -23
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +2 -2
- package/dist/types/uischema.d.ts +4 -4
- package/dist/types/uischema.js +3 -3
- package/dist/utils/colors.d.ts +1 -1
- package/dist/utils/colors.js +95 -97
- package/dist/utils/config.d.ts +2 -2
- package/dist/utils/config.js +48 -48
- package/dist/utils/connections.d.ts +2 -2
- package/dist/utils/connections.js +15 -15
- package/dist/utils/edgeStyling.d.ts +42 -0
- package/dist/utils/edgeStyling.js +173 -0
- package/dist/utils/errors.js +3 -3
- package/dist/utils/fetchWithAuth.d.ts +1 -1
- package/dist/utils/fetchWithAuth.js +2 -2
- package/dist/utils/handleIds.d.ts +2 -2
- package/dist/utils/handleIds.js +8 -8
- package/dist/utils/handlePositioning.d.ts +1 -1
- package/dist/utils/handlePositioning.js +2 -2
- package/dist/utils/icons.d.ts +1 -1
- package/dist/utils/icons.js +74 -74
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +7 -7
- package/dist/utils/nodeIds.d.ts +31 -0
- package/dist/utils/nodeIds.js +42 -0
- package/dist/utils/nodeStatus.d.ts +1 -1
- package/dist/utils/nodeStatus.js +48 -48
- package/dist/utils/nodeSwap.d.ts +221 -0
- package/dist/utils/nodeSwap.js +680 -0
- package/dist/utils/nodeTypes.d.ts +1 -1
- package/dist/utils/nodeTypes.js +20 -21
- package/dist/utils/nodeWrapper.d.ts +7 -7
- package/dist/utils/nodeWrapper.js +19 -21
- package/dist/utils/performanceUtils.d.ts +1 -1
- package/dist/utils/performanceUtils.js +1 -2
- package/dist/utils/portUtils.d.ts +2 -2
- package/dist/utils/portUtils.js +1 -1
- package/dist/utils/sanitize.js +1 -1
- package/dist/utils/uischema.d.ts +2 -2
- package/dist/utils/uischema.js +8 -8
- package/dist/utils/validation.js +8 -8
- package/package.json +12 -11
- package/dist/helpers/nodeLayoutHelper.d.ts +0 -14
- package/dist/helpers/nodeLayoutHelper.js +0 -19
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* reimplementing the logic, ensuring "blur active element" flushing and metadata
|
|
8
8
|
* construction happen in exactly one place.
|
|
9
9
|
*/
|
|
10
|
-
import { tick } from
|
|
11
|
-
import { getWorkflowStore, workflowActions, markAsSaved as storeMarkAsSaved
|
|
12
|
-
import { workflowApi, setEndpointConfig } from
|
|
13
|
-
import { createEndpointConfig } from
|
|
14
|
-
import { v4 as uuidv4 } from
|
|
15
|
-
import { DEFAULT_WORKFLOW_FORMAT } from
|
|
16
|
-
import { apiToasts, workflowToasts, dismissToast } from
|
|
17
|
-
import { DEFAULT_FEATURES } from
|
|
10
|
+
import { tick } from 'svelte';
|
|
11
|
+
import { getWorkflowStore, workflowActions, markAsSaved as storeMarkAsSaved } from '../stores/workflowStore.svelte.js';
|
|
12
|
+
import { workflowApi, setEndpointConfig } from './api.js';
|
|
13
|
+
import { createEndpointConfig } from '../config/endpoints.js';
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
15
|
+
import { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
|
|
16
|
+
import { apiToasts, workflowToasts, dismissToast } from './toastService.js';
|
|
17
|
+
import { DEFAULT_FEATURES } from '../types/events.js';
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
19
19
|
// Internal helpers
|
|
20
20
|
// ---------------------------------------------------------------------------
|
|
@@ -25,7 +25,7 @@ import { DEFAULT_FEATURES } from "../types/events.js";
|
|
|
25
25
|
*/
|
|
26
26
|
async function ensureApiConfiguration() {
|
|
27
27
|
try {
|
|
28
|
-
const { getEndpointConfig } = await import(
|
|
28
|
+
const { getEndpointConfig } = await import('./api.js');
|
|
29
29
|
const currentConfig = getEndpointConfig();
|
|
30
30
|
if (currentConfig && currentConfig.baseUrl) {
|
|
31
31
|
return;
|
|
@@ -35,20 +35,20 @@ async function ensureApiConfiguration() {
|
|
|
35
35
|
// Could not check existing API configuration, initializing
|
|
36
36
|
}
|
|
37
37
|
// API configuration is not initialized — derive URL from window.location when available
|
|
38
|
-
const apiBaseUrl = typeof window !==
|
|
38
|
+
const apiBaseUrl = typeof window !== 'undefined'
|
|
39
39
|
? `${window.location.protocol}//${window.location.host}/api/flowdrop`
|
|
40
|
-
:
|
|
40
|
+
: '/api/flowdrop';
|
|
41
41
|
const config = createEndpointConfig(apiBaseUrl, {
|
|
42
42
|
auth: {
|
|
43
|
-
type:
|
|
43
|
+
type: 'none'
|
|
44
44
|
},
|
|
45
45
|
timeout: 10000,
|
|
46
46
|
retry: {
|
|
47
47
|
enabled: true,
|
|
48
48
|
maxAttempts: 2,
|
|
49
49
|
delay: 1000,
|
|
50
|
-
backoff:
|
|
51
|
-
}
|
|
50
|
+
backoff: 'exponential'
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
53
|
setEndpointConfig(config);
|
|
54
54
|
}
|
|
@@ -60,8 +60,7 @@ async function ensureApiConfiguration() {
|
|
|
60
60
|
* Must be called once, in this file only, so the logic lives in exactly one place.
|
|
61
61
|
*/
|
|
62
62
|
async function flushPendingFormChanges() {
|
|
63
|
-
if (typeof document !==
|
|
64
|
-
document.activeElement instanceof HTMLElement) {
|
|
63
|
+
if (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {
|
|
65
64
|
document.activeElement.blur();
|
|
66
65
|
}
|
|
67
66
|
// Wait for any pending DOM / Svelte reactive updates before reading the store
|
|
@@ -94,7 +93,7 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
94
93
|
const currentWorkflow = getWorkflowStore();
|
|
95
94
|
if (!currentWorkflow) {
|
|
96
95
|
if (features.showToasts) {
|
|
97
|
-
apiToasts.error(
|
|
96
|
+
apiToasts.error('Save workflow', 'No workflow to save');
|
|
98
97
|
}
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
@@ -105,9 +104,7 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
|
-
const loadingToast = features.showToasts
|
|
109
|
-
? apiToasts.loading("Saving workflow")
|
|
110
|
-
: null;
|
|
107
|
+
const loadingToast = features.showToasts ? apiToasts.loading('Saving workflow') : null;
|
|
111
108
|
try {
|
|
112
109
|
// Ensure API configuration is initialised (needed when called outside App.svelte)
|
|
113
110
|
await ensureApiConfiguration();
|
|
@@ -121,17 +118,17 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
121
118
|
const workflowId = currentWorkflow.id || uuidv4();
|
|
122
119
|
const finalWorkflow = {
|
|
123
120
|
id: workflowId,
|
|
124
|
-
name: currentWorkflow.name ||
|
|
125
|
-
description: currentWorkflow.description ||
|
|
121
|
+
name: currentWorkflow.name || 'Untitled Workflow',
|
|
122
|
+
description: currentWorkflow.description || '',
|
|
126
123
|
nodes: currentWorkflow.nodes || [],
|
|
127
124
|
edges: currentWorkflow.edges || [],
|
|
128
125
|
metadata: {
|
|
129
126
|
...currentWorkflow.metadata,
|
|
130
|
-
version: currentWorkflow.metadata?.version ||
|
|
127
|
+
version: currentWorkflow.metadata?.version || '1.0.0',
|
|
131
128
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
132
129
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
133
|
-
updatedAt: new Date().toISOString()
|
|
134
|
-
}
|
|
130
|
+
updatedAt: new Date().toISOString()
|
|
131
|
+
}
|
|
135
132
|
};
|
|
136
133
|
// Step 4 — Persist
|
|
137
134
|
let savedWorkflow;
|
|
@@ -161,8 +158,8 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
161
158
|
name: finalWorkflow.name,
|
|
162
159
|
metadata: {
|
|
163
160
|
...finalWorkflow.metadata,
|
|
164
|
-
...savedWorkflow.metadata
|
|
165
|
-
}
|
|
161
|
+
...savedWorkflow.metadata
|
|
162
|
+
}
|
|
166
163
|
});
|
|
167
164
|
}
|
|
168
165
|
// Step 6a — Mark dirty state as clean
|
|
@@ -187,7 +184,7 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
187
184
|
catch (error) {
|
|
188
185
|
if (loadingToast)
|
|
189
186
|
dismissToast(loadingToast);
|
|
190
|
-
const errorObj = error instanceof Error ? error : new Error(
|
|
187
|
+
const errorObj = error instanceof Error ? error : new Error('Unknown error occurred');
|
|
191
188
|
// onSaveError hook
|
|
192
189
|
const currentWorkflowForError = getWorkflowStore();
|
|
193
190
|
if (eventHandlers?.onSaveError && currentWorkflowForError) {
|
|
@@ -196,10 +193,10 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
196
193
|
// onApiError hook — return true suppresses the default toast
|
|
197
194
|
let suppressToast = false;
|
|
198
195
|
if (eventHandlers?.onApiError) {
|
|
199
|
-
suppressToast = eventHandlers.onApiError(errorObj,
|
|
196
|
+
suppressToast = eventHandlers.onApiError(errorObj, 'save') === true;
|
|
200
197
|
}
|
|
201
198
|
if (features.showToasts && !suppressToast) {
|
|
202
|
-
apiToasts.error(
|
|
199
|
+
apiToasts.error('Save workflow', errorObj.message);
|
|
203
200
|
}
|
|
204
201
|
throw error;
|
|
205
202
|
}
|
|
@@ -220,30 +217,30 @@ export async function globalExportWorkflow(options = {}) {
|
|
|
220
217
|
const currentWorkflow = getWorkflowStore();
|
|
221
218
|
if (!currentWorkflow) {
|
|
222
219
|
if (features.showToasts) {
|
|
223
|
-
apiToasts.error(
|
|
220
|
+
apiToasts.error('Export workflow', 'No workflow to export');
|
|
224
221
|
}
|
|
225
222
|
return;
|
|
226
223
|
}
|
|
227
224
|
// Build the canonical export object — preserve all metadata fields
|
|
228
225
|
const finalWorkflow = {
|
|
229
|
-
id: currentWorkflow.id ||
|
|
230
|
-
name: currentWorkflow.name ||
|
|
231
|
-
description: currentWorkflow.description ||
|
|
226
|
+
id: currentWorkflow.id || 'untitled-workflow',
|
|
227
|
+
name: currentWorkflow.name || 'Untitled Workflow',
|
|
228
|
+
description: currentWorkflow.description || '',
|
|
232
229
|
nodes: currentWorkflow.nodes || [],
|
|
233
230
|
edges: currentWorkflow.edges || [],
|
|
234
231
|
metadata: {
|
|
235
232
|
...currentWorkflow.metadata,
|
|
236
|
-
version: currentWorkflow.metadata?.version ||
|
|
233
|
+
version: currentWorkflow.metadata?.version || '1.0.0',
|
|
237
234
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
238
235
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
239
|
-
updatedAt: new Date().toISOString()
|
|
240
|
-
}
|
|
236
|
+
updatedAt: new Date().toISOString()
|
|
237
|
+
}
|
|
241
238
|
};
|
|
242
239
|
// Trigger browser download
|
|
243
240
|
const dataStr = JSON.stringify(finalWorkflow, null, 2);
|
|
244
|
-
const dataBlob = new Blob([dataStr], { type:
|
|
241
|
+
const dataBlob = new Blob([dataStr], { type: 'application/json' });
|
|
245
242
|
const url = URL.createObjectURL(dataBlob);
|
|
246
|
-
const link = document.createElement(
|
|
243
|
+
const link = document.createElement('a');
|
|
247
244
|
link.href = url;
|
|
248
245
|
link.download = `${finalWorkflow.name}.json`;
|
|
249
246
|
link.click();
|
|
@@ -253,7 +250,7 @@ export async function globalExportWorkflow(options = {}) {
|
|
|
253
250
|
}
|
|
254
251
|
}
|
|
255
252
|
catch (error) {
|
|
256
|
-
const errorObj = error instanceof Error ? error : new Error(
|
|
257
|
-
apiToasts.error(
|
|
253
|
+
const errorObj = error instanceof Error ? error : new Error('Unknown error occurred');
|
|
254
|
+
apiToasts.error('Export workflow', errorObj.message);
|
|
258
255
|
}
|
|
259
256
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module services/historyService
|
|
8
8
|
*/
|
|
9
|
-
import type { Workflow } from
|
|
9
|
+
import type { Workflow } from '../types/index.js';
|
|
10
10
|
/**
|
|
11
11
|
* Represents a single entry in the history stack
|
|
12
12
|
*/
|
|
@@ -140,8 +140,10 @@ export declare class HistoryService {
|
|
|
140
140
|
* Cancel the current transaction without committing
|
|
141
141
|
*
|
|
142
142
|
* Discards the transaction without adding to history.
|
|
143
|
+
* Returns the snapshot captured at transaction start so the caller
|
|
144
|
+
* can restore the store to its pre-transaction state.
|
|
143
145
|
*/
|
|
144
|
-
cancelTransaction():
|
|
146
|
+
cancelTransaction(): Workflow | null;
|
|
145
147
|
/**
|
|
146
148
|
* Clear all history
|
|
147
149
|
*
|
|
@@ -189,9 +191,9 @@ export declare class HistoryService {
|
|
|
189
191
|
/**
|
|
190
192
|
* Create a deep clone of a workflow
|
|
191
193
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
194
|
+
* Strips non-serializable values (e.g., onConfigOpen callbacks) before cloning
|
|
195
|
+
* so structuredClone doesn't throw on function references.
|
|
196
|
+
* Falls back to JSON round-trip if structuredClone still fails (e.g., Svelte proxies).
|
|
195
197
|
*/
|
|
196
198
|
private cloneWorkflow;
|
|
197
199
|
/**
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module services/historyService
|
|
8
8
|
*/
|
|
9
|
-
import { DEFAULT_BEHAVIOR_SETTINGS } from
|
|
10
|
-
import { logger } from
|
|
9
|
+
import { DEFAULT_BEHAVIOR_SETTINGS } from '../types/settings.js';
|
|
10
|
+
import { logger } from '../utils/logger.js';
|
|
11
11
|
// =========================================================================
|
|
12
12
|
// History Service Class
|
|
13
13
|
// =========================================================================
|
|
@@ -77,7 +77,7 @@ export class HistoryService {
|
|
|
77
77
|
this.undoStack.push({
|
|
78
78
|
snapshot: this.cloneWorkflow(workflow),
|
|
79
79
|
timestamp: Date.now(),
|
|
80
|
-
description:
|
|
80
|
+
description: 'Initial state'
|
|
81
81
|
});
|
|
82
82
|
this.notifyChange();
|
|
83
83
|
}
|
|
@@ -154,7 +154,7 @@ export class HistoryService {
|
|
|
154
154
|
*/
|
|
155
155
|
startTransaction(workflow, description) {
|
|
156
156
|
if (this.inTransaction) {
|
|
157
|
-
logger.warn(
|
|
157
|
+
logger.warn('HistoryService: Transaction already in progress, ignoring startTransaction');
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
this.inTransaction = true;
|
|
@@ -168,7 +168,7 @@ export class HistoryService {
|
|
|
168
168
|
*/
|
|
169
169
|
commitTransaction() {
|
|
170
170
|
if (!this.inTransaction || !this.transactionSnapshot) {
|
|
171
|
-
logger.warn(
|
|
171
|
+
logger.warn('HistoryService: No transaction in progress, ignoring commitTransaction');
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
// Push the snapshot captured at transaction start
|
|
@@ -182,11 +182,15 @@ export class HistoryService {
|
|
|
182
182
|
* Cancel the current transaction without committing
|
|
183
183
|
*
|
|
184
184
|
* Discards the transaction without adding to history.
|
|
185
|
+
* Returns the snapshot captured at transaction start so the caller
|
|
186
|
+
* can restore the store to its pre-transaction state.
|
|
185
187
|
*/
|
|
186
188
|
cancelTransaction() {
|
|
189
|
+
const snapshot = this.transactionSnapshot;
|
|
187
190
|
this.inTransaction = false;
|
|
188
191
|
this.transactionSnapshot = null;
|
|
189
192
|
this.transactionDescription = null;
|
|
193
|
+
return snapshot;
|
|
190
194
|
}
|
|
191
195
|
/**
|
|
192
196
|
* Clear all history
|
|
@@ -205,7 +209,7 @@ export class HistoryService {
|
|
|
205
209
|
this.undoStack.push({
|
|
206
210
|
snapshot: this.cloneWorkflow(currentWorkflow),
|
|
207
211
|
timestamp: Date.now(),
|
|
208
|
-
description:
|
|
212
|
+
description: 'Initial state'
|
|
209
213
|
});
|
|
210
214
|
}
|
|
211
215
|
this.notifyChange();
|
|
@@ -221,7 +225,7 @@ export class HistoryService {
|
|
|
221
225
|
canRedo: this.redoStack.length > 0,
|
|
222
226
|
currentIndex: this.undoStack.length - 1,
|
|
223
227
|
historyLength: this.undoStack.length + this.redoStack.length,
|
|
224
|
-
isInTransaction: this.inTransaction
|
|
228
|
+
isInTransaction: this.inTransaction
|
|
225
229
|
};
|
|
226
230
|
}
|
|
227
231
|
/**
|
|
@@ -272,7 +276,7 @@ export class HistoryService {
|
|
|
272
276
|
this.undoStack.push({
|
|
273
277
|
snapshot: this.cloneWorkflow(workflow),
|
|
274
278
|
timestamp: Date.now(),
|
|
275
|
-
description
|
|
279
|
+
description
|
|
276
280
|
});
|
|
277
281
|
// Trim history if over limit
|
|
278
282
|
this.trimHistory();
|
|
@@ -292,14 +296,25 @@ export class HistoryService {
|
|
|
292
296
|
/**
|
|
293
297
|
* Create a deep clone of a workflow
|
|
294
298
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
299
|
+
* Strips non-serializable values (e.g., onConfigOpen callbacks) before cloning
|
|
300
|
+
* so structuredClone doesn't throw on function references.
|
|
301
|
+
* Falls back to JSON round-trip if structuredClone still fails (e.g., Svelte proxies).
|
|
298
302
|
*/
|
|
299
303
|
cloneWorkflow(workflow) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
304
|
+
const cleaned = {
|
|
305
|
+
...workflow,
|
|
306
|
+
nodes: workflow.nodes.map((n) => ({
|
|
307
|
+
...n,
|
|
308
|
+
data: { ...n.data, onConfigOpen: undefined }
|
|
309
|
+
}))
|
|
310
|
+
};
|
|
311
|
+
try {
|
|
312
|
+
return structuredClone(cleaned);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
// Fallback for environments where structuredClone can't handle proxied objects
|
|
316
|
+
return JSON.parse(JSON.stringify(cleaned));
|
|
317
|
+
}
|
|
303
318
|
}
|
|
304
319
|
/**
|
|
305
320
|
* Notify all subscribers of state changes
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module services/interruptService
|
|
9
9
|
*/
|
|
10
|
-
import { defaultInterruptPollingConfig } from
|
|
11
|
-
import { buildEndpointUrl, getEndpointHeaders } from
|
|
12
|
-
import { getEndpointConfig } from
|
|
13
|
-
import { logger } from
|
|
10
|
+
import { defaultInterruptPollingConfig } from '../types/interrupt.js';
|
|
11
|
+
import { buildEndpointUrl, getEndpointHeaders } from '../config/endpoints.js';
|
|
12
|
+
import { getEndpointConfig } from './api.js';
|
|
13
|
+
import { logger } from '../utils/logger.js';
|
|
14
14
|
/**
|
|
15
15
|
* Interrupt Service class
|
|
16
16
|
*
|
|
@@ -29,8 +29,7 @@ export class InterruptService {
|
|
|
29
29
|
*/
|
|
30
30
|
constructor() {
|
|
31
31
|
this.pollingConfig = { ...defaultInterruptPollingConfig };
|
|
32
|
-
this.currentBackoff =
|
|
33
|
-
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
32
|
+
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Get the singleton instance of InterruptService
|
|
@@ -50,8 +49,7 @@ export class InterruptService {
|
|
|
50
49
|
*/
|
|
51
50
|
setPollingConfig(config) {
|
|
52
51
|
this.pollingConfig = { ...this.pollingConfig, ...config };
|
|
53
|
-
this.currentBackoff =
|
|
54
|
-
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
52
|
+
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
55
53
|
}
|
|
56
54
|
/**
|
|
57
55
|
* Get the current polling configuration
|
|
@@ -79,10 +77,10 @@ export class InterruptService {
|
|
|
79
77
|
getConfig() {
|
|
80
78
|
const config = getEndpointConfig();
|
|
81
79
|
if (!config) {
|
|
82
|
-
throw new Error(
|
|
80
|
+
throw new Error('Endpoint configuration not set. Call setEndpointConfig() first.');
|
|
83
81
|
}
|
|
84
82
|
if (!config.endpoints.interrupts) {
|
|
85
|
-
throw new Error(
|
|
83
|
+
throw new Error('Interrupt endpoints not configured.');
|
|
86
84
|
}
|
|
87
85
|
return config;
|
|
88
86
|
}
|
|
@@ -95,13 +93,13 @@ export class InterruptService {
|
|
|
95
93
|
*/
|
|
96
94
|
async request(url, options = {}) {
|
|
97
95
|
const config = this.getConfig();
|
|
98
|
-
const headers = getEndpointHeaders(config,
|
|
96
|
+
const headers = getEndpointHeaders(config, 'interrupts');
|
|
99
97
|
const response = await fetch(url, {
|
|
100
98
|
...options,
|
|
101
99
|
headers: {
|
|
102
100
|
...headers,
|
|
103
|
-
...options.headers
|
|
104
|
-
}
|
|
101
|
+
...options.headers
|
|
102
|
+
}
|
|
105
103
|
});
|
|
106
104
|
if (!response.ok) {
|
|
107
105
|
const errorData = await response.json().catch(() => ({}));
|
|
@@ -124,11 +122,11 @@ export class InterruptService {
|
|
|
124
122
|
async getInterrupt(interruptId) {
|
|
125
123
|
const config = this.getConfig();
|
|
126
124
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.get, {
|
|
127
|
-
interruptId
|
|
125
|
+
interruptId
|
|
128
126
|
});
|
|
129
127
|
const response = await this.request(url);
|
|
130
128
|
if (!response.data) {
|
|
131
|
-
throw new Error(
|
|
129
|
+
throw new Error('Interrupt not found');
|
|
132
130
|
}
|
|
133
131
|
return response.data;
|
|
134
132
|
}
|
|
@@ -142,15 +140,15 @@ export class InterruptService {
|
|
|
142
140
|
async resolveInterrupt(interruptId, value) {
|
|
143
141
|
const config = this.getConfig();
|
|
144
142
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.resolve, {
|
|
145
|
-
interruptId
|
|
143
|
+
interruptId
|
|
146
144
|
});
|
|
147
145
|
const resolution = { value };
|
|
148
146
|
const response = await this.request(url, {
|
|
149
|
-
method:
|
|
150
|
-
body: JSON.stringify(resolution)
|
|
147
|
+
method: 'POST',
|
|
148
|
+
body: JSON.stringify(resolution)
|
|
151
149
|
});
|
|
152
150
|
if (!response.data) {
|
|
153
|
-
throw new Error(
|
|
151
|
+
throw new Error('Failed to resolve interrupt: No data returned');
|
|
154
152
|
}
|
|
155
153
|
return response.data;
|
|
156
154
|
}
|
|
@@ -163,13 +161,13 @@ export class InterruptService {
|
|
|
163
161
|
async cancelInterrupt(interruptId) {
|
|
164
162
|
const config = this.getConfig();
|
|
165
163
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.cancel, {
|
|
166
|
-
interruptId
|
|
164
|
+
interruptId
|
|
167
165
|
});
|
|
168
166
|
const response = await this.request(url, {
|
|
169
|
-
method:
|
|
167
|
+
method: 'POST'
|
|
170
168
|
});
|
|
171
169
|
if (!response.data) {
|
|
172
|
-
throw new Error(
|
|
170
|
+
throw new Error('Failed to cancel interrupt: No data returned');
|
|
173
171
|
}
|
|
174
172
|
return response.data;
|
|
175
173
|
}
|
|
@@ -182,7 +180,7 @@ export class InterruptService {
|
|
|
182
180
|
async listSessionInterrupts(sessionId) {
|
|
183
181
|
const config = this.getConfig();
|
|
184
182
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listBySession, {
|
|
185
|
-
sessionId
|
|
183
|
+
sessionId
|
|
186
184
|
});
|
|
187
185
|
const response = await this.request(url);
|
|
188
186
|
return response.data ?? [];
|
|
@@ -196,7 +194,7 @@ export class InterruptService {
|
|
|
196
194
|
async listPipelineInterrupts(pipelineId) {
|
|
197
195
|
const config = this.getConfig();
|
|
198
196
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listByPipeline, {
|
|
199
|
-
pipelineId
|
|
197
|
+
pipelineId
|
|
200
198
|
});
|
|
201
199
|
const response = await this.request(url);
|
|
202
200
|
return response.data ?? [];
|
|
@@ -215,32 +213,29 @@ export class InterruptService {
|
|
|
215
213
|
*/
|
|
216
214
|
startPolling(sessionId, callback) {
|
|
217
215
|
if (!this.pollingConfig.enabled) {
|
|
218
|
-
logger.warn(
|
|
216
|
+
logger.warn('[InterruptService] Polling is disabled. Enable via setPollingConfig().');
|
|
219
217
|
return;
|
|
220
218
|
}
|
|
221
219
|
// Stop any existing polling
|
|
222
220
|
this.stopPolling();
|
|
223
221
|
this.pollingSessionId = sessionId;
|
|
224
|
-
this.currentBackoff =
|
|
225
|
-
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
222
|
+
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
226
223
|
const poll = async () => {
|
|
227
224
|
if (this.pollingSessionId !== sessionId) {
|
|
228
225
|
return;
|
|
229
226
|
}
|
|
230
227
|
try {
|
|
231
228
|
const interrupts = await this.listSessionInterrupts(sessionId);
|
|
232
|
-
const pendingInterrupts = interrupts.filter((i) => i.status ===
|
|
229
|
+
const pendingInterrupts = interrupts.filter((i) => i.status === 'pending');
|
|
233
230
|
// Reset backoff on successful request
|
|
234
|
-
this.currentBackoff =
|
|
235
|
-
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
231
|
+
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
236
232
|
// Call the callback with pending interrupts
|
|
237
233
|
callback(pendingInterrupts);
|
|
238
234
|
}
|
|
239
235
|
catch (error) {
|
|
240
|
-
logger.error(
|
|
236
|
+
logger.error('[InterruptService] Polling error:', error);
|
|
241
237
|
// Exponential backoff on error
|
|
242
|
-
const maxBackoff = this.pollingConfig.maxBackoff ??
|
|
243
|
-
defaultInterruptPollingConfig.maxBackoff;
|
|
238
|
+
const maxBackoff = this.pollingConfig.maxBackoff ?? defaultInterruptPollingConfig.maxBackoff;
|
|
244
239
|
this.currentBackoff = Math.min(this.currentBackoff * 2, maxBackoff);
|
|
245
240
|
}
|
|
246
241
|
// Schedule next poll
|
|
@@ -260,8 +255,7 @@ export class InterruptService {
|
|
|
260
255
|
this.pollingInterval = null;
|
|
261
256
|
}
|
|
262
257
|
this.pollingSessionId = null;
|
|
263
|
-
this.currentBackoff =
|
|
264
|
-
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
258
|
+
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
265
259
|
}
|
|
266
260
|
/**
|
|
267
261
|
* Check if polling is active
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Node Execution Service
|
|
3
3
|
* Handles fetching and managing node execution information from the backend
|
|
4
4
|
*/
|
|
5
|
-
import type { NodeExecutionInfo } from
|
|
5
|
+
import type { NodeExecutionInfo } from '../types/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* Service for managing node execution information
|
|
8
8
|
*/
|