@flowdrop/flowdrop 1.0.0 → 1.1.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 +50 -50
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +25 -25
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/AgentSpecAdapter.js +133 -122
- package/dist/adapters/agentspec/agentAdapter.d.ts +2 -2
- package/dist/adapters/agentspec/agentAdapter.js +10 -10
- package/dist/adapters/agentspec/autoLayout.d.ts +1 -1
- package/dist/adapters/agentspec/autoLayout.js +2 -2
- 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 +22 -20
- package/dist/api/enhanced-client.d.ts +3 -3
- package/dist/api/enhanced-client.js +73 -72
- package/dist/components/App.svelte +1081 -961
- package/dist/components/App.svelte.d.ts +9 -6
- package/dist/components/CanvasBanner.stories.svelte +23 -20
- package/dist/components/CanvasBanner.stories.svelte.d.ts +1 -1
- package/dist/components/CanvasBanner.svelte +46 -46
- package/dist/components/ConfigForm.svelte +1164 -1065
- package/dist/components/ConfigForm.svelte.d.ts +2 -2
- package/dist/components/ConfigModal.svelte +180 -180
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.stories.svelte +35 -35
- package/dist/components/ConfigPanel.stories.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.svelte +178 -167
- package/dist/components/ConfigPanel.svelte.d.ts +1 -1
- package/dist/components/ConnectionLine.svelte +25 -25
- package/dist/components/EdgeRefresher.svelte +26 -26
- package/dist/components/FlowDropEdge.stories.svelte +197 -0
- package/dist/components/FlowDropEdge.stories.svelte.d.ts +26 -0
- package/dist/components/FlowDropEdge.svelte +168 -0
- package/dist/components/FlowDropEdge.svelte.d.ts +4 -0
- package/dist/components/FlowDropZone.svelte +63 -60
- package/dist/components/FlowDropZone.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.stories.svelte +19 -19
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +1 -1
- package/dist/components/LoadingSpinner.svelte +21 -21
- package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
- package/dist/components/Logo.stories.svelte +13 -13
- package/dist/components/Logo.stories.svelte.d.ts +1 -1
- package/dist/components/Logo.svelte +101 -95
- package/dist/components/LogsSidebar.svelte +553 -546
- package/dist/components/LogsSidebar.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.stories.svelte +29 -23
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +1 -1
- package/dist/components/MarkdownDisplay.svelte +16 -14
- package/dist/components/Navbar.stories.svelte +43 -38
- package/dist/components/Navbar.stories.svelte.d.ts +1 -1
- package/dist/components/Navbar.svelte +760 -706
- package/dist/components/Navbar.svelte.d.ts +1 -1
- package/dist/components/NodeSidebar.svelte +900 -746
- package/dist/components/NodeSidebar.svelte.d.ts +3 -1
- package/dist/components/NodeStatusOverlay.stories.svelte +82 -70
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +1 -1
- package/dist/components/NodeStatusOverlay.svelte +295 -280
- package/dist/components/NodeStatusOverlay.svelte.d.ts +3 -3
- package/dist/components/PipelineStatus.svelte +326 -300
- package/dist/components/PipelineStatus.svelte.d.ts +4 -4
- package/dist/components/PortCoordinateTracker.svelte +49 -47
- package/dist/components/PortCoordinateTracker.svelte.d.ts +1 -1
- package/dist/components/ReadOnlyDetails.svelte +156 -156
- package/dist/components/SchemaForm.stories.svelte +106 -98
- package/dist/components/SchemaForm.stories.svelte.d.ts +1 -1
- package/dist/components/SchemaForm.svelte +490 -463
- package/dist/components/SchemaForm.svelte.d.ts +2 -2
- package/dist/components/SettingsModal.svelte +226 -223
- package/dist/components/SettingsModal.svelte.d.ts +1 -1
- package/dist/components/SettingsPanel.svelte +637 -601
- package/dist/components/SettingsPanel.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.stories.svelte +62 -49
- package/dist/components/StatusIcon.stories.svelte.d.ts +1 -1
- package/dist/components/StatusIcon.svelte +87 -87
- package/dist/components/StatusIcon.svelte.d.ts +2 -2
- package/dist/components/StatusLabel.stories.svelte +12 -12
- package/dist/components/StatusLabel.stories.svelte.d.ts +1 -1
- package/dist/components/StatusLabel.svelte +19 -19
- package/dist/components/ThemeToggle.stories.svelte +16 -16
- package/dist/components/ThemeToggle.stories.svelte.d.ts +1 -1
- package/dist/components/ThemeToggle.svelte +180 -169
- package/dist/components/ThemeToggle.svelte.d.ts +1 -1
- package/dist/components/UniversalNode.svelte +150 -138
- package/dist/components/UniversalNode.svelte.d.ts +3 -3
- package/dist/components/WorkflowEditor.svelte +1069 -1007
- package/dist/components/WorkflowEditor.svelte.d.ts +4 -4
- package/dist/components/form/FormArray.svelte +1034 -973
- package/dist/components/form/FormArray.svelte.d.ts +1 -1
- package/dist/components/form/FormAutocomplete.svelte +1021 -978
- package/dist/components/form/FormAutocomplete.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.stories.svelte +23 -20
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormCheckboxGroup.svelte +136 -136
- package/dist/components/form/FormCodeEditor.svelte +452 -434
- package/dist/components/form/FormField.svelte +366 -355
- package/dist/components/form/FormField.svelte.d.ts +2 -2
- package/dist/components/form/FormFieldLight.svelte +400 -384
- package/dist/components/form/FormFieldLight.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.stories.svelte +42 -42
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldWrapper.svelte +100 -93
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldset.svelte +108 -108
- package/dist/components/form/FormFieldset.svelte.d.ts +2 -2
- package/dist/components/form/FormMarkdownEditor.svelte +758 -725
- package/dist/components/form/FormNumberField.stories.svelte +25 -25
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormNumberField.svelte +88 -88
- package/dist/components/form/FormRangeField.stories.svelte +20 -20
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormRangeField.svelte +234 -226
- package/dist/components/form/FormSelect.stories.svelte +38 -38
- package/dist/components/form/FormSelect.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormSelect.svelte +101 -101
- package/dist/components/form/FormSelect.svelte.d.ts +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +847 -798
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.stories.svelte +29 -23
- package/dist/components/form/FormTextField.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextField.svelte +68 -68
- package/dist/components/form/FormTextarea.stories.svelte +28 -25
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormTextarea.svelte +74 -74
- package/dist/components/form/FormToggle.stories.svelte +23 -20
- package/dist/components/form/FormToggle.stories.svelte.d.ts +1 -1
- package/dist/components/form/FormToggle.svelte +98 -98
- package/dist/components/form/FormUISchemaRenderer.svelte +120 -113
- 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 +64 -55
- package/dist/components/form/types.d.ts +6 -6
- package/dist/components/form/types.js +9 -4
- package/dist/components/icons/AlertCircleIcon.svelte +11 -0
- package/dist/components/icons/AlertCircleIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CogIcon.svelte +11 -0
- package/dist/components/icons/CogIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +54 -38
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ChoicePrompt.svelte +407 -383
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +48 -48
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ConfirmationPrompt.svelte +280 -274
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/FormPrompt.svelte +223 -218
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/InterruptBubble.svelte +617 -583
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +2 -2
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +66 -56
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/ReviewPrompt.svelte +861 -841
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +38 -33
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +1 -1
- package/dist/components/interrupt/TextInputPrompt.svelte +333 -328
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +1 -1
- package/dist/components/interrupt/index.d.ts +5 -5
- package/dist/components/interrupt/index.js +5 -5
- package/dist/components/layouts/MainLayout.svelte +724 -691
- package/dist/components/layouts/MainLayout.svelte.d.ts +6 -6
- package/dist/components/nodes/GatewayNode.stories.svelte +100 -99
- package/dist/components/nodes/GatewayNode.svelte +605 -571
- package/dist/components/nodes/GatewayNode.svelte.d.ts +3 -3
- package/dist/components/nodes/IdeaNode.stories.svelte +44 -43
- package/dist/components/nodes/IdeaNode.svelte +451 -437
- package/dist/components/nodes/IdeaNode.svelte.d.ts +1 -1
- package/dist/components/nodes/NotesNode.stories.svelte +65 -64
- package/dist/components/nodes/NotesNode.svelte +380 -369
- package/dist/components/nodes/NotesNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SimpleNode.stories.svelte +145 -144
- package/dist/components/nodes/SimpleNode.svelte +486 -424
- package/dist/components/nodes/SimpleNode.svelte.d.ts +1 -1
- package/dist/components/nodes/SquareNode.stories.svelte +73 -73
- package/dist/components/nodes/SquareNode.svelte +439 -380
- package/dist/components/nodes/SquareNode.svelte.d.ts +1 -1
- package/dist/components/nodes/TerminalNode.stories.svelte +13 -13
- package/dist/components/nodes/TerminalNode.svelte +709 -670
- package/dist/components/nodes/TerminalNode.svelte.d.ts +1 -1
- package/dist/components/nodes/ToolNode.stories.svelte +181 -180
- package/dist/components/nodes/ToolNode.svelte +505 -447
- package/dist/components/nodes/ToolNode.svelte.d.ts +1 -1
- package/dist/components/nodes/WorkflowNode.stories.svelte +70 -46
- package/dist/components/nodes/WorkflowNode.svelte +621 -551
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +3 -3
- package/dist/components/playground/ChatPanel.svelte +945 -889
- package/dist/components/playground/ExecutionLogs.svelte +495 -472
- package/dist/components/playground/InputCollector.svelte +449 -428
- package/dist/components/playground/MessageBubble.stories.svelte +47 -47
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +1 -1
- package/dist/components/playground/MessageBubble.svelte +626 -610
- package/dist/components/playground/MessageBubble.svelte.d.ts +1 -1
- package/dist/components/playground/Playground.svelte +1088 -1057
- package/dist/components/playground/Playground.svelte.d.ts +3 -3
- package/dist/components/playground/PlaygroundModal.svelte +208 -204
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -3
- package/dist/components/playground/SessionManager.svelte +527 -521
- 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.d.ts +8 -0
- package/dist/config/constants.js +10 -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 +4 -4
- package/dist/config/endpoints.js +65 -65
- package/dist/config/runtimeConfig.d.ts +2 -2
- package/dist/config/runtimeConfig.js +8 -8
- package/dist/core/index.d.ts +63 -59
- package/dist/core/index.js +35 -33
- package/dist/display/index.d.ts +2 -2
- package/dist/display/index.js +2 -2
- package/dist/editor/index.d.ts +62 -62
- package/dist/editor/index.js +53 -53
- 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 +11 -9
- 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 +34 -32
- package/dist/helpers/workflowEditorHelper.d.ts +5 -5
- package/dist/helpers/workflowEditorHelper.js +108 -96
- 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 +9 -9
- package/dist/mocks/app-navigation.js +11 -11
- package/dist/mocks/app-stores.js +8 -8
- 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 +11 -9
- 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 +22 -107
- package/dist/services/agentSpecExecutionService.d.ts +3 -3
- package/dist/services/agentSpecExecutionService.js +59 -55
- package/dist/services/api.d.ts +18 -4
- package/dist/services/api.js +46 -43
- package/dist/services/apiVariableService.d.ts +1 -1
- package/dist/services/apiVariableService.js +41 -34
- 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/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 +41 -39
- package/dist/services/globalSave.d.ts +2 -2
- package/dist/services/globalSave.js +53 -42
- package/dist/services/historyService.d.ts +1 -1
- package/dist/services/historyService.js +8 -8
- package/dist/services/interruptService.d.ts +1 -1
- package/dist/services/interruptService.js +35 -29
- package/dist/services/nodeExecutionService.d.ts +1 -1
- package/dist/services/nodeExecutionService.js +45 -44
- 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 +25 -19
- 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 +2 -0
- package/dist/skins/default.js +1 -0
- package/dist/skins/index.d.ts +13 -0
- package/dist/skins/index.js +30 -0
- package/dist/skins/slate.d.ts +2 -0
- package/dist/skins/slate.js +78 -0
- 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 +65 -33
- 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 +21 -21
- package/dist/stores/playgroundStore.svelte.d.ts +2 -2
- package/dist/stores/playgroundStore.svelte.js +25 -18
- package/dist/stores/portCoordinateStore.svelte.d.ts +2 -2
- package/dist/stores/portCoordinateStore.svelte.js +15 -8
- package/dist/stores/settingsStore.svelte.d.ts +2 -2
- package/dist/stores/settingsStore.svelte.js +62 -57
- package/dist/stores/workflowStore.svelte.d.ts +3 -3
- package/dist/stores/workflowStore.svelte.js +50 -47
- package/dist/stories/CanvasDecorator.svelte +35 -32
- package/dist/stories/CanvasDecorator.svelte.d.ts +2 -2
- package/dist/stories/EdgeDecorator.svelte +125 -0
- package/dist/stories/EdgeDecorator.svelte.d.ts +17 -0
- package/dist/stories/NodeDecorator.svelte +59 -53
- package/dist/stories/NodeDecorator.svelte.d.ts +1 -1
- package/dist/stories/utils.d.ts +2 -2
- package/dist/stories/utils.js +105 -67
- package/dist/styles/base.css +599 -595
- package/dist/styles/toast.css +14 -14
- package/dist/styles/tokens.css +409 -378
- package/dist/svelte-app.d.ts +9 -9
- package/dist/svelte-app.js +39 -39
- package/dist/themes/default.d.ts +2 -0
- package/dist/themes/default.js +9 -0
- package/dist/themes/index.d.ts +13 -0
- package/dist/themes/index.js +44 -0
- package/dist/themes/minimal.d.ts +2 -0
- package/dist/themes/minimal.js +11 -0
- 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/config.d.ts +6 -6
- package/dist/types/events.d.ts +2 -2
- package/dist/types/events.js +2 -2
- package/dist/types/index.d.ts +32 -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 +5 -3
- package/dist/types/settings.js +25 -18
- package/dist/types/skin.d.ts +31 -0
- package/dist/types/skin.js +1 -0
- package/dist/types/theme.d.ts +35 -0
- package/dist/types/theme.js +1 -0
- 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 +97 -95
- 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/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/nodeStatus.d.ts +1 -1
- package/dist/utils/nodeStatus.js +48 -48
- package/dist/utils/nodeTypes.d.ts +1 -1
- package/dist/utils/nodeTypes.js +21 -20
- package/dist/utils/nodeWrapper.d.ts +7 -7
- package/dist/utils/nodeWrapper.js +21 -19
- package/dist/utils/performanceUtils.d.ts +1 -1
- package/dist/utils/performanceUtils.js +2 -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 +20 -8
- package/package.json +296 -291
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* reimplementing the logic, ensuring "blur active element" flushing and metadata
|
|
8
8
|
* construction happen in exactly one place.
|
|
9
9
|
*/
|
|
10
|
-
import type { Workflow } from
|
|
11
|
-
import type { FlowDropEventHandlers, FlowDropFeatures } from
|
|
10
|
+
import type { Workflow } from "../types/index.js";
|
|
11
|
+
import type { FlowDropEventHandlers, FlowDropFeatures } from "../types/events.js";
|
|
12
12
|
/**
|
|
13
13
|
* Minimal interface for the enhanced API client used when an authProvider is present.
|
|
14
14
|
* Matches the surface of EnhancedFlowDropApiClient that save needs.
|
|
@@ -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 } from
|
|
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,7 +60,8 @@ 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 !==
|
|
63
|
+
if (typeof document !== "undefined" &&
|
|
64
|
+
document.activeElement instanceof HTMLElement) {
|
|
64
65
|
document.activeElement.blur();
|
|
65
66
|
}
|
|
66
67
|
// Wait for any pending DOM / Svelte reactive updates before reading the store
|
|
@@ -93,7 +94,7 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
93
94
|
const currentWorkflow = getWorkflowStore();
|
|
94
95
|
if (!currentWorkflow) {
|
|
95
96
|
if (features.showToasts) {
|
|
96
|
-
apiToasts.error(
|
|
97
|
+
apiToasts.error("Save workflow", "No workflow to save");
|
|
97
98
|
}
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
@@ -104,33 +105,37 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
|
-
const loadingToast = features.showToasts
|
|
108
|
+
const loadingToast = features.showToasts
|
|
109
|
+
? apiToasts.loading("Saving workflow")
|
|
110
|
+
: null;
|
|
108
111
|
try {
|
|
109
112
|
// Ensure API configuration is initialised (needed when called outside App.svelte)
|
|
110
113
|
await ensureApiConfiguration();
|
|
111
114
|
// Step 3 — Build the canonical workflow object.
|
|
112
115
|
// Preserve all existing metadata fields (format, tags, etc.) so nothing is dropped.
|
|
116
|
+
//
|
|
117
|
+
// Determine new vs existing BEFORE the uuidv4() fallback: if the store already
|
|
118
|
+
// has an id (any format — integer, UUID, slug), the workflow came from a backend
|
|
119
|
+
// and must be updated. Only a missing id means "truly new".
|
|
120
|
+
const isExistingWorkflow = !!currentWorkflow.id;
|
|
113
121
|
const workflowId = currentWorkflow.id || uuidv4();
|
|
114
122
|
const finalWorkflow = {
|
|
115
123
|
id: workflowId,
|
|
116
|
-
name: currentWorkflow.name ||
|
|
117
|
-
description: currentWorkflow.description ||
|
|
124
|
+
name: currentWorkflow.name || "Untitled Workflow",
|
|
125
|
+
description: currentWorkflow.description || "",
|
|
118
126
|
nodes: currentWorkflow.nodes || [],
|
|
119
127
|
edges: currentWorkflow.edges || [],
|
|
120
128
|
metadata: {
|
|
121
129
|
...currentWorkflow.metadata,
|
|
122
|
-
version: currentWorkflow.metadata?.version ||
|
|
130
|
+
version: currentWorkflow.metadata?.version || "1.0.0",
|
|
123
131
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
124
132
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
125
|
-
updatedAt: new Date().toISOString()
|
|
126
|
-
}
|
|
133
|
+
updatedAt: new Date().toISOString(),
|
|
134
|
+
},
|
|
127
135
|
};
|
|
128
136
|
// Step 4 — Persist
|
|
129
137
|
let savedWorkflow;
|
|
130
138
|
if (apiClient) {
|
|
131
|
-
// Enhanced client path — detects existing workflows by non-UUID ID
|
|
132
|
-
const isExistingWorkflow = finalWorkflow.id.length > 0 &&
|
|
133
|
-
!finalWorkflow.id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
|
134
139
|
if (isExistingWorkflow) {
|
|
135
140
|
savedWorkflow = await apiClient.updateWorkflow(finalWorkflow.id, finalWorkflow);
|
|
136
141
|
}
|
|
@@ -140,7 +145,13 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
140
145
|
}
|
|
141
146
|
else {
|
|
142
147
|
// Legacy path
|
|
143
|
-
|
|
148
|
+
if (isExistingWorkflow) {
|
|
149
|
+
savedWorkflow = await workflowApi.updateWorkflow(finalWorkflow.id, finalWorkflow);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const { id: _id, ...workflowData } = finalWorkflow;
|
|
153
|
+
savedWorkflow = await workflowApi.createWorkflow(workflowData);
|
|
154
|
+
}
|
|
144
155
|
}
|
|
145
156
|
// Step 5 — If the server assigned a new ID, sync the store
|
|
146
157
|
if (savedWorkflow.id && savedWorkflow.id !== finalWorkflow.id) {
|
|
@@ -150,8 +161,8 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
150
161
|
name: finalWorkflow.name,
|
|
151
162
|
metadata: {
|
|
152
163
|
...finalWorkflow.metadata,
|
|
153
|
-
...savedWorkflow.metadata
|
|
154
|
-
}
|
|
164
|
+
...savedWorkflow.metadata,
|
|
165
|
+
},
|
|
155
166
|
});
|
|
156
167
|
}
|
|
157
168
|
// Step 6a — Mark dirty state as clean
|
|
@@ -176,7 +187,7 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
176
187
|
catch (error) {
|
|
177
188
|
if (loadingToast)
|
|
178
189
|
dismissToast(loadingToast);
|
|
179
|
-
const errorObj = error instanceof Error ? error : new Error(
|
|
190
|
+
const errorObj = error instanceof Error ? error : new Error("Unknown error occurred");
|
|
180
191
|
// onSaveError hook
|
|
181
192
|
const currentWorkflowForError = getWorkflowStore();
|
|
182
193
|
if (eventHandlers?.onSaveError && currentWorkflowForError) {
|
|
@@ -185,10 +196,10 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
185
196
|
// onApiError hook — return true suppresses the default toast
|
|
186
197
|
let suppressToast = false;
|
|
187
198
|
if (eventHandlers?.onApiError) {
|
|
188
|
-
suppressToast = eventHandlers.onApiError(errorObj,
|
|
199
|
+
suppressToast = eventHandlers.onApiError(errorObj, "save") === true;
|
|
189
200
|
}
|
|
190
201
|
if (features.showToasts && !suppressToast) {
|
|
191
|
-
apiToasts.error(
|
|
202
|
+
apiToasts.error("Save workflow", errorObj.message);
|
|
192
203
|
}
|
|
193
204
|
throw error;
|
|
194
205
|
}
|
|
@@ -209,30 +220,30 @@ export async function globalExportWorkflow(options = {}) {
|
|
|
209
220
|
const currentWorkflow = getWorkflowStore();
|
|
210
221
|
if (!currentWorkflow) {
|
|
211
222
|
if (features.showToasts) {
|
|
212
|
-
apiToasts.error(
|
|
223
|
+
apiToasts.error("Export workflow", "No workflow to export");
|
|
213
224
|
}
|
|
214
225
|
return;
|
|
215
226
|
}
|
|
216
227
|
// Build the canonical export object — preserve all metadata fields
|
|
217
228
|
const finalWorkflow = {
|
|
218
|
-
id: currentWorkflow.id ||
|
|
219
|
-
name: currentWorkflow.name ||
|
|
220
|
-
description: currentWorkflow.description ||
|
|
229
|
+
id: currentWorkflow.id || "untitled-workflow",
|
|
230
|
+
name: currentWorkflow.name || "Untitled Workflow",
|
|
231
|
+
description: currentWorkflow.description || "",
|
|
221
232
|
nodes: currentWorkflow.nodes || [],
|
|
222
233
|
edges: currentWorkflow.edges || [],
|
|
223
234
|
metadata: {
|
|
224
235
|
...currentWorkflow.metadata,
|
|
225
|
-
version: currentWorkflow.metadata?.version ||
|
|
236
|
+
version: currentWorkflow.metadata?.version || "1.0.0",
|
|
226
237
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
227
238
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
228
|
-
updatedAt: new Date().toISOString()
|
|
229
|
-
}
|
|
239
|
+
updatedAt: new Date().toISOString(),
|
|
240
|
+
},
|
|
230
241
|
};
|
|
231
242
|
// Trigger browser download
|
|
232
243
|
const dataStr = JSON.stringify(finalWorkflow, null, 2);
|
|
233
|
-
const dataBlob = new Blob([dataStr], { type:
|
|
244
|
+
const dataBlob = new Blob([dataStr], { type: "application/json" });
|
|
234
245
|
const url = URL.createObjectURL(dataBlob);
|
|
235
|
-
const link = document.createElement(
|
|
246
|
+
const link = document.createElement("a");
|
|
236
247
|
link.href = url;
|
|
237
248
|
link.download = `${finalWorkflow.name}.json`;
|
|
238
249
|
link.click();
|
|
@@ -242,7 +253,7 @@ export async function globalExportWorkflow(options = {}) {
|
|
|
242
253
|
}
|
|
243
254
|
}
|
|
244
255
|
catch (error) {
|
|
245
|
-
const errorObj = error instanceof Error ? error : new Error(
|
|
246
|
-
apiToasts.error(
|
|
256
|
+
const errorObj = error instanceof Error ? error : new Error("Unknown error occurred");
|
|
257
|
+
apiToasts.error("Export workflow", errorObj.message);
|
|
247
258
|
}
|
|
248
259
|
}
|
|
@@ -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
|
|
@@ -205,7 +205,7 @@ export class HistoryService {
|
|
|
205
205
|
this.undoStack.push({
|
|
206
206
|
snapshot: this.cloneWorkflow(currentWorkflow),
|
|
207
207
|
timestamp: Date.now(),
|
|
208
|
-
description:
|
|
208
|
+
description: "Initial state",
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
this.notifyChange();
|
|
@@ -221,7 +221,7 @@ export class HistoryService {
|
|
|
221
221
|
canRedo: this.redoStack.length > 0,
|
|
222
222
|
currentIndex: this.undoStack.length - 1,
|
|
223
223
|
historyLength: this.undoStack.length + this.redoStack.length,
|
|
224
|
-
isInTransaction: this.inTransaction
|
|
224
|
+
isInTransaction: this.inTransaction,
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
@@ -272,7 +272,7 @@ export class HistoryService {
|
|
|
272
272
|
this.undoStack.push({
|
|
273
273
|
snapshot: this.cloneWorkflow(workflow),
|
|
274
274
|
timestamp: Date.now(),
|
|
275
|
-
description
|
|
275
|
+
description,
|
|
276
276
|
});
|
|
277
277
|
// Trim history if over limit
|
|
278
278
|
this.trimHistory();
|
|
@@ -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,7 +29,8 @@ export class InterruptService {
|
|
|
29
29
|
*/
|
|
30
30
|
constructor() {
|
|
31
31
|
this.pollingConfig = { ...defaultInterruptPollingConfig };
|
|
32
|
-
this.currentBackoff =
|
|
32
|
+
this.currentBackoff =
|
|
33
|
+
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Get the singleton instance of InterruptService
|
|
@@ -49,7 +50,8 @@ export class InterruptService {
|
|
|
49
50
|
*/
|
|
50
51
|
setPollingConfig(config) {
|
|
51
52
|
this.pollingConfig = { ...this.pollingConfig, ...config };
|
|
52
|
-
this.currentBackoff =
|
|
53
|
+
this.currentBackoff =
|
|
54
|
+
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Get the current polling configuration
|
|
@@ -77,10 +79,10 @@ export class InterruptService {
|
|
|
77
79
|
getConfig() {
|
|
78
80
|
const config = getEndpointConfig();
|
|
79
81
|
if (!config) {
|
|
80
|
-
throw new Error(
|
|
82
|
+
throw new Error("Endpoint configuration not set. Call setEndpointConfig() first.");
|
|
81
83
|
}
|
|
82
84
|
if (!config.endpoints.interrupts) {
|
|
83
|
-
throw new Error(
|
|
85
|
+
throw new Error("Interrupt endpoints not configured.");
|
|
84
86
|
}
|
|
85
87
|
return config;
|
|
86
88
|
}
|
|
@@ -93,13 +95,13 @@ export class InterruptService {
|
|
|
93
95
|
*/
|
|
94
96
|
async request(url, options = {}) {
|
|
95
97
|
const config = this.getConfig();
|
|
96
|
-
const headers = getEndpointHeaders(config,
|
|
98
|
+
const headers = getEndpointHeaders(config, "interrupts");
|
|
97
99
|
const response = await fetch(url, {
|
|
98
100
|
...options,
|
|
99
101
|
headers: {
|
|
100
102
|
...headers,
|
|
101
|
-
...options.headers
|
|
102
|
-
}
|
|
103
|
+
...options.headers,
|
|
104
|
+
},
|
|
103
105
|
});
|
|
104
106
|
if (!response.ok) {
|
|
105
107
|
const errorData = await response.json().catch(() => ({}));
|
|
@@ -122,11 +124,11 @@ export class InterruptService {
|
|
|
122
124
|
async getInterrupt(interruptId) {
|
|
123
125
|
const config = this.getConfig();
|
|
124
126
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.get, {
|
|
125
|
-
interruptId
|
|
127
|
+
interruptId,
|
|
126
128
|
});
|
|
127
129
|
const response = await this.request(url);
|
|
128
130
|
if (!response.data) {
|
|
129
|
-
throw new Error(
|
|
131
|
+
throw new Error("Interrupt not found");
|
|
130
132
|
}
|
|
131
133
|
return response.data;
|
|
132
134
|
}
|
|
@@ -140,15 +142,15 @@ export class InterruptService {
|
|
|
140
142
|
async resolveInterrupt(interruptId, value) {
|
|
141
143
|
const config = this.getConfig();
|
|
142
144
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.resolve, {
|
|
143
|
-
interruptId
|
|
145
|
+
interruptId,
|
|
144
146
|
});
|
|
145
147
|
const resolution = { value };
|
|
146
148
|
const response = await this.request(url, {
|
|
147
|
-
method:
|
|
148
|
-
body: JSON.stringify(resolution)
|
|
149
|
+
method: "POST",
|
|
150
|
+
body: JSON.stringify(resolution),
|
|
149
151
|
});
|
|
150
152
|
if (!response.data) {
|
|
151
|
-
throw new Error(
|
|
153
|
+
throw new Error("Failed to resolve interrupt: No data returned");
|
|
152
154
|
}
|
|
153
155
|
return response.data;
|
|
154
156
|
}
|
|
@@ -161,13 +163,13 @@ export class InterruptService {
|
|
|
161
163
|
async cancelInterrupt(interruptId) {
|
|
162
164
|
const config = this.getConfig();
|
|
163
165
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.cancel, {
|
|
164
|
-
interruptId
|
|
166
|
+
interruptId,
|
|
165
167
|
});
|
|
166
168
|
const response = await this.request(url, {
|
|
167
|
-
method:
|
|
169
|
+
method: "POST",
|
|
168
170
|
});
|
|
169
171
|
if (!response.data) {
|
|
170
|
-
throw new Error(
|
|
172
|
+
throw new Error("Failed to cancel interrupt: No data returned");
|
|
171
173
|
}
|
|
172
174
|
return response.data;
|
|
173
175
|
}
|
|
@@ -180,7 +182,7 @@ export class InterruptService {
|
|
|
180
182
|
async listSessionInterrupts(sessionId) {
|
|
181
183
|
const config = this.getConfig();
|
|
182
184
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listBySession, {
|
|
183
|
-
sessionId
|
|
185
|
+
sessionId,
|
|
184
186
|
});
|
|
185
187
|
const response = await this.request(url);
|
|
186
188
|
return response.data ?? [];
|
|
@@ -194,7 +196,7 @@ export class InterruptService {
|
|
|
194
196
|
async listPipelineInterrupts(pipelineId) {
|
|
195
197
|
const config = this.getConfig();
|
|
196
198
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listByPipeline, {
|
|
197
|
-
pipelineId
|
|
199
|
+
pipelineId,
|
|
198
200
|
});
|
|
199
201
|
const response = await this.request(url);
|
|
200
202
|
return response.data ?? [];
|
|
@@ -213,29 +215,32 @@ export class InterruptService {
|
|
|
213
215
|
*/
|
|
214
216
|
startPolling(sessionId, callback) {
|
|
215
217
|
if (!this.pollingConfig.enabled) {
|
|
216
|
-
logger.warn(
|
|
218
|
+
logger.warn("[InterruptService] Polling is disabled. Enable via setPollingConfig().");
|
|
217
219
|
return;
|
|
218
220
|
}
|
|
219
221
|
// Stop any existing polling
|
|
220
222
|
this.stopPolling();
|
|
221
223
|
this.pollingSessionId = sessionId;
|
|
222
|
-
this.currentBackoff =
|
|
224
|
+
this.currentBackoff =
|
|
225
|
+
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
223
226
|
const poll = async () => {
|
|
224
227
|
if (this.pollingSessionId !== sessionId) {
|
|
225
228
|
return;
|
|
226
229
|
}
|
|
227
230
|
try {
|
|
228
231
|
const interrupts = await this.listSessionInterrupts(sessionId);
|
|
229
|
-
const pendingInterrupts = interrupts.filter((i) => i.status ===
|
|
232
|
+
const pendingInterrupts = interrupts.filter((i) => i.status === "pending");
|
|
230
233
|
// Reset backoff on successful request
|
|
231
|
-
this.currentBackoff =
|
|
234
|
+
this.currentBackoff =
|
|
235
|
+
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
232
236
|
// Call the callback with pending interrupts
|
|
233
237
|
callback(pendingInterrupts);
|
|
234
238
|
}
|
|
235
239
|
catch (error) {
|
|
236
|
-
logger.error(
|
|
240
|
+
logger.error("[InterruptService] Polling error:", error);
|
|
237
241
|
// Exponential backoff on error
|
|
238
|
-
const maxBackoff = this.pollingConfig.maxBackoff ??
|
|
242
|
+
const maxBackoff = this.pollingConfig.maxBackoff ??
|
|
243
|
+
defaultInterruptPollingConfig.maxBackoff;
|
|
239
244
|
this.currentBackoff = Math.min(this.currentBackoff * 2, maxBackoff);
|
|
240
245
|
}
|
|
241
246
|
// Schedule next poll
|
|
@@ -255,7 +260,8 @@ export class InterruptService {
|
|
|
255
260
|
this.pollingInterval = null;
|
|
256
261
|
}
|
|
257
262
|
this.pollingSessionId = null;
|
|
258
|
-
this.currentBackoff =
|
|
263
|
+
this.currentBackoff =
|
|
264
|
+
this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
259
265
|
}
|
|
260
266
|
/**
|
|
261
267
|
* 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
|
*/
|