@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
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Follows the same singleton pattern as NodeExecutionService.
|
|
8
8
|
*/
|
|
9
|
-
import { buildAgentSpecUrl, getAgentSpecAuthHeaders
|
|
10
|
-
import { AgentSpecAdapter } from
|
|
11
|
-
import { logger } from
|
|
9
|
+
import { buildAgentSpecUrl, getAgentSpecAuthHeaders } from '../config/agentSpecEndpoints.js';
|
|
10
|
+
import { AgentSpecAdapter } from '../adapters/agentspec/AgentSpecAdapter.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
12
|
/**
|
|
13
13
|
* Service for executing FlowDrop workflows on Agent Spec runtimes.
|
|
14
14
|
*
|
|
@@ -67,7 +67,7 @@ export class AgentSpecExecutionService {
|
|
|
67
67
|
const url = buildAgentSpecUrl(this.config, this.config.endpoints.health);
|
|
68
68
|
const response = await fetch(url, {
|
|
69
69
|
headers: getAgentSpecAuthHeaders(this.config),
|
|
70
|
-
signal: AbortSignal.timeout(5000)
|
|
70
|
+
signal: AbortSignal.timeout(5000)
|
|
71
71
|
});
|
|
72
72
|
return response.ok;
|
|
73
73
|
}
|
|
@@ -90,29 +90,29 @@ export class AgentSpecExecutionService {
|
|
|
90
90
|
// POST to runtime
|
|
91
91
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.execute);
|
|
92
92
|
const response = await fetch(url, {
|
|
93
|
-
method:
|
|
93
|
+
method: 'POST',
|
|
94
94
|
headers: getAgentSpecAuthHeaders(this.getConfig()),
|
|
95
95
|
body: JSON.stringify({
|
|
96
96
|
flow: agentSpecFlow,
|
|
97
|
-
inputs: inputs || {}
|
|
97
|
+
inputs: inputs || {}
|
|
98
98
|
}),
|
|
99
|
-
signal: AbortSignal.timeout(this.getConfig().timeout || 60000)
|
|
99
|
+
signal: AbortSignal.timeout(this.getConfig().timeout || 60000)
|
|
100
100
|
});
|
|
101
101
|
if (!response.ok) {
|
|
102
|
-
const errorText = await response.text().catch(() =>
|
|
102
|
+
const errorText = await response.text().catch(() => 'Unknown error');
|
|
103
103
|
throw new Error(`Agent Spec runtime error (${response.status}): ${errorText}`);
|
|
104
104
|
}
|
|
105
105
|
const result = await response.json();
|
|
106
106
|
const executionId = result.execution_id || result.id;
|
|
107
107
|
if (!executionId) {
|
|
108
|
-
throw new Error(
|
|
108
|
+
throw new Error('Runtime did not return an execution ID');
|
|
109
109
|
}
|
|
110
110
|
// Track execution
|
|
111
111
|
const state = {
|
|
112
112
|
id: executionId,
|
|
113
|
-
status:
|
|
113
|
+
status: 'running',
|
|
114
114
|
startedAt: new Date().toISOString(),
|
|
115
|
-
nodeStatuses: {}
|
|
115
|
+
nodeStatuses: {}
|
|
116
116
|
};
|
|
117
117
|
this.activeExecutions.set(executionId, state);
|
|
118
118
|
// Build node name → FlowDrop node ID mapping for status updates
|
|
@@ -135,10 +135,10 @@ export class AgentSpecExecutionService {
|
|
|
135
135
|
this.ensureConfigured();
|
|
136
136
|
try {
|
|
137
137
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.status, {
|
|
138
|
-
id: executionId
|
|
138
|
+
id: executionId
|
|
139
139
|
});
|
|
140
140
|
const response = await fetch(url, {
|
|
141
|
-
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
141
|
+
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
142
142
|
});
|
|
143
143
|
if (!response.ok)
|
|
144
144
|
return null;
|
|
@@ -156,15 +156,15 @@ export class AgentSpecExecutionService {
|
|
|
156
156
|
this.ensureConfigured();
|
|
157
157
|
this.stopPolling(executionId);
|
|
158
158
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.cancel, {
|
|
159
|
-
id: executionId
|
|
159
|
+
id: executionId
|
|
160
160
|
});
|
|
161
161
|
await fetch(url, {
|
|
162
|
-
method:
|
|
163
|
-
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
162
|
+
method: 'POST',
|
|
163
|
+
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
164
164
|
});
|
|
165
165
|
const state = this.activeExecutions.get(executionId);
|
|
166
166
|
if (state) {
|
|
167
|
-
state.status =
|
|
167
|
+
state.status = 'cancelled';
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -174,10 +174,10 @@ export class AgentSpecExecutionService {
|
|
|
174
174
|
this.ensureConfigured();
|
|
175
175
|
try {
|
|
176
176
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.results, {
|
|
177
|
-
id: executionId
|
|
177
|
+
id: executionId
|
|
178
178
|
});
|
|
179
179
|
const response = await fetch(url, {
|
|
180
|
-
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
180
|
+
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
181
181
|
});
|
|
182
182
|
if (!response.ok)
|
|
183
183
|
return null;
|
|
@@ -195,14 +195,14 @@ export class AgentSpecExecutionService {
|
|
|
195
195
|
const agentSpecFlow = this.adapter.toAgentSpec(workflow);
|
|
196
196
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.validate);
|
|
197
197
|
const response = await fetch(url, {
|
|
198
|
-
method:
|
|
198
|
+
method: 'POST',
|
|
199
199
|
headers: getAgentSpecAuthHeaders(this.getConfig()),
|
|
200
|
-
body: JSON.stringify(agentSpecFlow)
|
|
200
|
+
body: JSON.stringify(agentSpecFlow)
|
|
201
201
|
});
|
|
202
202
|
if (!response.ok) {
|
|
203
203
|
return {
|
|
204
204
|
valid: false,
|
|
205
|
-
errors: [`Runtime validation failed: ${response.status}`]
|
|
205
|
+
errors: [`Runtime validation failed: ${response.status}`]
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
return await response.json();
|
|
@@ -221,7 +221,7 @@ export class AgentSpecExecutionService {
|
|
|
221
221
|
// ========================================================================
|
|
222
222
|
ensureConfigured() {
|
|
223
223
|
if (!this.config) {
|
|
224
|
-
throw new Error(
|
|
224
|
+
throw new Error('AgentSpecExecutionService not configured. Call configure() with runtime endpoint config first.');
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
/** Get the config, throwing if not configured */
|
|
@@ -237,10 +237,10 @@ export class AgentSpecExecutionService {
|
|
|
237
237
|
const poll = async () => {
|
|
238
238
|
try {
|
|
239
239
|
const url = buildAgentSpecUrl(this.getConfig(), this.getConfig().endpoints.status, {
|
|
240
|
-
id: executionId
|
|
240
|
+
id: executionId
|
|
241
241
|
});
|
|
242
242
|
const response = await fetch(url, {
|
|
243
|
-
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
243
|
+
headers: getAgentSpecAuthHeaders(this.getConfig())
|
|
244
244
|
});
|
|
245
245
|
if (!response.ok) {
|
|
246
246
|
throw new Error(`Status check failed: ${response.status}`);
|
|
@@ -256,27 +256,26 @@ export class AgentSpecExecutionService {
|
|
|
256
256
|
onNodeUpdate?.(nodeId, info);
|
|
257
257
|
}
|
|
258
258
|
// Check if execution is done
|
|
259
|
-
if (executionStatus ===
|
|
260
|
-
state.status =
|
|
259
|
+
if (executionStatus === 'completed' || executionStatus === 'success') {
|
|
260
|
+
state.status = 'completed';
|
|
261
261
|
this.stopPolling(executionId);
|
|
262
262
|
const results = await this.getResults(executionId);
|
|
263
263
|
onComplete?.(results || {});
|
|
264
264
|
}
|
|
265
|
-
else if (executionStatus ===
|
|
266
|
-
|
|
267
|
-
state.status = "failed";
|
|
265
|
+
else if (executionStatus === 'failed' || executionStatus === 'error') {
|
|
266
|
+
state.status = 'failed';
|
|
268
267
|
this.stopPolling(executionId);
|
|
269
|
-
const errorMsg = data.error || data.message ||
|
|
268
|
+
const errorMsg = data.error || data.message || 'Execution failed';
|
|
270
269
|
onError?.(new Error(errorMsg));
|
|
271
270
|
}
|
|
272
|
-
else if (executionStatus ===
|
|
273
|
-
state.status =
|
|
271
|
+
else if (executionStatus === 'cancelled') {
|
|
272
|
+
state.status = 'cancelled';
|
|
274
273
|
this.stopPolling(executionId);
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
catch (error) {
|
|
278
277
|
// Don't stop polling on transient errors — let it retry
|
|
279
|
-
logger.error(
|
|
278
|
+
logger.error('[AgentSpecExecution] Polling error:', error);
|
|
280
279
|
}
|
|
281
280
|
};
|
|
282
281
|
// Initial poll immediately, then at interval
|
|
@@ -299,38 +298,38 @@ export class AgentSpecExecutionService {
|
|
|
299
298
|
return result;
|
|
300
299
|
}
|
|
301
300
|
mapSingleNodeStatus(status) {
|
|
302
|
-
const runtimeStatus = (status.status || status.state ||
|
|
301
|
+
const runtimeStatus = (status.status || status.state || 'idle');
|
|
303
302
|
return {
|
|
304
303
|
status: this.mapToFlowDropStatus(runtimeStatus),
|
|
305
304
|
executionCount: status.execution_count || 0,
|
|
306
|
-
isExecuting: runtimeStatus ===
|
|
305
|
+
isExecuting: runtimeStatus === 'running' || runtimeStatus === 'executing',
|
|
307
306
|
lastExecuted: status.started_at,
|
|
308
307
|
lastExecutionDuration: status.duration_ms,
|
|
309
|
-
lastError: status.error
|
|
308
|
+
lastError: status.error
|
|
310
309
|
};
|
|
311
310
|
}
|
|
312
311
|
mapToFlowDropStatus(runtimeStatus) {
|
|
313
312
|
switch (runtimeStatus) {
|
|
314
|
-
case
|
|
315
|
-
case
|
|
316
|
-
return
|
|
317
|
-
case
|
|
318
|
-
case
|
|
319
|
-
case
|
|
320
|
-
return
|
|
321
|
-
case
|
|
322
|
-
case
|
|
323
|
-
return
|
|
324
|
-
case
|
|
325
|
-
case
|
|
326
|
-
return
|
|
327
|
-
case
|
|
328
|
-
case
|
|
329
|
-
return
|
|
330
|
-
case
|
|
331
|
-
return
|
|
313
|
+
case 'running':
|
|
314
|
+
case 'executing':
|
|
315
|
+
return 'running';
|
|
316
|
+
case 'completed':
|
|
317
|
+
case 'success':
|
|
318
|
+
case 'done':
|
|
319
|
+
return 'completed';
|
|
320
|
+
case 'failed':
|
|
321
|
+
case 'error':
|
|
322
|
+
return 'failed';
|
|
323
|
+
case 'cancelled':
|
|
324
|
+
case 'canceled':
|
|
325
|
+
return 'cancelled';
|
|
326
|
+
case 'pending':
|
|
327
|
+
case 'queued':
|
|
328
|
+
return 'pending';
|
|
329
|
+
case 'skipped':
|
|
330
|
+
return 'skipped';
|
|
332
331
|
default:
|
|
333
|
-
return
|
|
332
|
+
return 'idle';
|
|
334
333
|
}
|
|
335
334
|
}
|
|
336
335
|
}
|
package/dist/services/api.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Client-side API service for FlowDrop
|
|
3
3
|
* Provides methods to interact with the backend APIs using configurable endpoints
|
|
4
4
|
*/
|
|
5
|
-
import type { NodeMetadata, Workflow } from
|
|
6
|
-
import type { EndpointConfig } from
|
|
5
|
+
import type { NodeMetadata, Workflow } from '../types/index.js';
|
|
6
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
7
7
|
/**
|
|
8
8
|
* Set the endpoint configuration at runtime
|
|
9
9
|
*/
|
package/dist/services/api.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Client-side API service for FlowDrop
|
|
3
3
|
* Provides methods to interact with the backend APIs using configurable endpoints
|
|
4
4
|
*/
|
|
5
|
-
import { buildEndpointUrl, getEndpointMethod, getEndpointHeaders
|
|
5
|
+
import { buildEndpointUrl, getEndpointMethod, getEndpointHeaders } from '../config/endpoints.js';
|
|
6
6
|
let endpointConfig = null;
|
|
7
7
|
/**
|
|
8
8
|
* Set the endpoint configuration at runtime
|
|
@@ -21,7 +21,7 @@ export function getEndpointConfig() {
|
|
|
21
21
|
*/
|
|
22
22
|
async function apiRequest(endpointKey, endpointPath, params, options = {}) {
|
|
23
23
|
if (!endpointConfig) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error('Endpoint configuration not set. Call setEndpointConfig() first.');
|
|
25
25
|
}
|
|
26
26
|
const url = buildEndpointUrl(endpointConfig, endpointPath, params);
|
|
27
27
|
const method = getEndpointMethod(endpointConfig, endpointKey);
|
|
@@ -29,11 +29,11 @@ async function apiRequest(endpointKey, endpointPath, params, options = {}) {
|
|
|
29
29
|
const response = await fetch(url, {
|
|
30
30
|
method,
|
|
31
31
|
headers,
|
|
32
|
-
...options
|
|
32
|
+
...options
|
|
33
33
|
});
|
|
34
34
|
// Check if response is JSON
|
|
35
|
-
const contentType = response.headers.get(
|
|
36
|
-
const isJson = contentType?.includes(
|
|
35
|
+
const contentType = response.headers.get('content-type');
|
|
36
|
+
const isJson = contentType?.includes('application/json');
|
|
37
37
|
if (!response.ok) {
|
|
38
38
|
// Try to get error details
|
|
39
39
|
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
@@ -73,18 +73,18 @@ export const nodeApi = {
|
|
|
73
73
|
*/
|
|
74
74
|
async getNodes(options) {
|
|
75
75
|
if (!endpointConfig) {
|
|
76
|
-
throw new Error(
|
|
76
|
+
throw new Error('Endpoint configuration not set');
|
|
77
77
|
}
|
|
78
78
|
const params = new URLSearchParams();
|
|
79
79
|
if (options?.category)
|
|
80
|
-
params.append(
|
|
80
|
+
params.append('category', options.category);
|
|
81
81
|
if (options?.search)
|
|
82
|
-
params.append(
|
|
82
|
+
params.append('search', options.search);
|
|
83
83
|
if (options?.limit)
|
|
84
|
-
params.append(
|
|
84
|
+
params.append('limit', options.limit.toString());
|
|
85
85
|
if (options?.offset)
|
|
86
|
-
params.append(
|
|
87
|
-
const response = await apiRequest(
|
|
86
|
+
params.append('offset', options.offset.toString());
|
|
87
|
+
const response = await apiRequest('nodes.list', endpointConfig.endpoints.nodes.list + '?' + params.toString());
|
|
88
88
|
return response.data || [];
|
|
89
89
|
},
|
|
90
90
|
/**
|
|
@@ -92,14 +92,14 @@ export const nodeApi = {
|
|
|
92
92
|
*/
|
|
93
93
|
async getNode(id) {
|
|
94
94
|
if (!endpointConfig) {
|
|
95
|
-
throw new Error(
|
|
95
|
+
throw new Error('Endpoint configuration not set');
|
|
96
96
|
}
|
|
97
|
-
const response = await apiRequest(
|
|
97
|
+
const response = await apiRequest('nodes.get', endpointConfig.endpoints.nodes.get, { id });
|
|
98
98
|
if (!response.data) {
|
|
99
|
-
throw new Error(
|
|
99
|
+
throw new Error('Node not found');
|
|
100
100
|
}
|
|
101
101
|
return response.data;
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
105
105
|
* Workflow API methods
|
|
@@ -110,16 +110,16 @@ export const workflowApi = {
|
|
|
110
110
|
*/
|
|
111
111
|
async getWorkflows(options) {
|
|
112
112
|
if (!endpointConfig) {
|
|
113
|
-
throw new Error(
|
|
113
|
+
throw new Error('Endpoint configuration not set');
|
|
114
114
|
}
|
|
115
115
|
const params = new URLSearchParams();
|
|
116
116
|
if (options?.search)
|
|
117
|
-
params.append(
|
|
117
|
+
params.append('search', options.search);
|
|
118
118
|
if (options?.limit)
|
|
119
|
-
params.append(
|
|
119
|
+
params.append('limit', options.limit.toString());
|
|
120
120
|
if (options?.offset)
|
|
121
|
-
params.append(
|
|
122
|
-
const response = await apiRequest(
|
|
121
|
+
params.append('offset', options.offset.toString());
|
|
122
|
+
const response = await apiRequest('workflows.list', endpointConfig.endpoints.workflows.list + '?' + params.toString());
|
|
123
123
|
return response.data || [];
|
|
124
124
|
},
|
|
125
125
|
/**
|
|
@@ -127,11 +127,11 @@ export const workflowApi = {
|
|
|
127
127
|
*/
|
|
128
128
|
async getWorkflow(id) {
|
|
129
129
|
if (!endpointConfig) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error('Endpoint configuration not set');
|
|
131
131
|
}
|
|
132
|
-
const response = await apiRequest(
|
|
132
|
+
const response = await apiRequest('workflows.get', endpointConfig.endpoints.workflows.get, { id });
|
|
133
133
|
if (!response.data) {
|
|
134
|
-
throw new Error(
|
|
134
|
+
throw new Error('Workflow not found');
|
|
135
135
|
}
|
|
136
136
|
return response.data;
|
|
137
137
|
},
|
|
@@ -140,18 +140,18 @@ export const workflowApi = {
|
|
|
140
140
|
*/
|
|
141
141
|
async createWorkflow(workflow) {
|
|
142
142
|
if (!endpointConfig) {
|
|
143
|
-
throw new Error(
|
|
143
|
+
throw new Error('Endpoint configuration not set');
|
|
144
144
|
}
|
|
145
145
|
// Apply the consumer-provided payload transform (e.g. Drupal's label mapping).
|
|
146
146
|
// The default is the identity function — no CMS-specific logic in the core library.
|
|
147
147
|
const transform = endpointConfig.transformWorkflowPayload ?? ((w) => w);
|
|
148
148
|
const body = transform(workflow);
|
|
149
|
-
const response = await apiRequest(
|
|
150
|
-
method:
|
|
151
|
-
body: JSON.stringify(body)
|
|
149
|
+
const response = await apiRequest('workflows.create', endpointConfig.endpoints.workflows.create, undefined, {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
body: JSON.stringify(body)
|
|
152
152
|
});
|
|
153
153
|
if (!response.data) {
|
|
154
|
-
throw new Error(
|
|
154
|
+
throw new Error('Failed to create workflow');
|
|
155
155
|
}
|
|
156
156
|
return response.data;
|
|
157
157
|
},
|
|
@@ -160,18 +160,18 @@ export const workflowApi = {
|
|
|
160
160
|
*/
|
|
161
161
|
async updateWorkflow(id, workflow) {
|
|
162
162
|
if (!endpointConfig) {
|
|
163
|
-
throw new Error(
|
|
163
|
+
throw new Error('Endpoint configuration not set');
|
|
164
164
|
}
|
|
165
165
|
// Apply the consumer-provided payload transform (e.g. Drupal's label mapping).
|
|
166
166
|
// The default is the identity function — no CMS-specific logic in the core library.
|
|
167
167
|
const transform = endpointConfig.transformWorkflowPayload ?? ((w) => w);
|
|
168
168
|
const body = transform(workflow);
|
|
169
|
-
const response = await apiRequest(
|
|
170
|
-
method:
|
|
171
|
-
body: JSON.stringify(body)
|
|
169
|
+
const response = await apiRequest('workflows.update', endpointConfig.endpoints.workflows.update, { id }, {
|
|
170
|
+
method: 'PUT',
|
|
171
|
+
body: JSON.stringify(body)
|
|
172
172
|
});
|
|
173
173
|
if (!response.data) {
|
|
174
|
-
throw new Error(
|
|
174
|
+
throw new Error('Failed to update workflow');
|
|
175
175
|
}
|
|
176
176
|
return response.data;
|
|
177
177
|
},
|
|
@@ -180,9 +180,9 @@ export const workflowApi = {
|
|
|
180
180
|
*/
|
|
181
181
|
async deleteWorkflow(id) {
|
|
182
182
|
if (!endpointConfig) {
|
|
183
|
-
throw new Error(
|
|
183
|
+
throw new Error('Endpoint configuration not set');
|
|
184
184
|
}
|
|
185
|
-
await apiRequest(
|
|
185
|
+
await apiRequest('workflows.delete', endpointConfig.endpoints.workflows.delete, { id }, { method: 'DELETE' });
|
|
186
186
|
},
|
|
187
187
|
/**
|
|
188
188
|
* Save workflow (create or update).
|
|
@@ -206,12 +206,12 @@ export const workflowApi = {
|
|
|
206
206
|
const { id, ...workflowData } = workflow;
|
|
207
207
|
return this.createWorkflow(workflowData);
|
|
208
208
|
}
|
|
209
|
-
}
|
|
209
|
+
}
|
|
210
210
|
};
|
|
211
211
|
/**
|
|
212
212
|
* Export the API service
|
|
213
213
|
*/
|
|
214
214
|
export const api = {
|
|
215
215
|
nodes: nodeApi,
|
|
216
|
-
workflows: workflowApi
|
|
216
|
+
workflows: workflowApi
|
|
217
217
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/apiVariableService
|
|
7
7
|
*/
|
|
8
|
-
import type { VariableSchema, ApiVariablesConfig, AuthProvider } from
|
|
8
|
+
import type { VariableSchema, ApiVariablesConfig, AuthProvider } from '../types/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Context for variable API requests
|
|
11
11
|
*/
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/apiVariableService
|
|
7
7
|
*/
|
|
8
|
-
import { getEndpointConfig } from
|
|
9
|
-
import { logger } from
|
|
10
|
-
import { DEFAULT_CACHE_TTL_MS } from
|
|
8
|
+
import { getEndpointConfig } from './api.js';
|
|
9
|
+
import { logger } from '../utils/logger.js';
|
|
10
|
+
import { DEFAULT_CACHE_TTL_MS } from '../config/constants.js';
|
|
11
11
|
/**
|
|
12
12
|
* Variable schema cache with TTL support
|
|
13
13
|
* Key format: `variables:{workflowId}:{nodeId}`
|
|
@@ -48,7 +48,7 @@ export function resolveEndpointUrl(template, context) {
|
|
|
48
48
|
* @returns A unique cache key string
|
|
49
49
|
*/
|
|
50
50
|
function generateVariableCacheKey(workflowId, nodeId) {
|
|
51
|
-
return `variables:${workflowId ||
|
|
51
|
+
return `variables:${workflowId || 'unknown'}:${nodeId}`;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Checks if a cached variable schema is still valid (not expired).
|
|
@@ -71,7 +71,7 @@ function isCacheValid(entry, ttl = DEFAULT_VARIABLE_CACHE_TTL) {
|
|
|
71
71
|
function resolveBodyTemplates(body, context) {
|
|
72
72
|
const resolved = {};
|
|
73
73
|
for (const [key, value] of Object.entries(body)) {
|
|
74
|
-
if (typeof value ===
|
|
74
|
+
if (typeof value === 'string') {
|
|
75
75
|
// Resolve template variables in string values
|
|
76
76
|
let resolvedValue = value;
|
|
77
77
|
if (context.workflowId) {
|
|
@@ -80,9 +80,7 @@ function resolveBodyTemplates(body, context) {
|
|
|
80
80
|
resolvedValue = resolvedValue.replace(/\{nodeId\}/g, encodeURIComponent(context.nodeId));
|
|
81
81
|
resolved[key] = resolvedValue;
|
|
82
82
|
}
|
|
83
|
-
else if (typeof value ===
|
|
84
|
-
value !== null &&
|
|
85
|
-
!Array.isArray(value)) {
|
|
83
|
+
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
86
84
|
// Recursively resolve nested objects
|
|
87
85
|
resolved[key] = resolveBodyTemplates(value, context);
|
|
88
86
|
}
|
|
@@ -131,27 +129,27 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
131
129
|
return {
|
|
132
130
|
success: true,
|
|
133
131
|
schema: cached.schema,
|
|
134
|
-
fromCache: true
|
|
132
|
+
fromCache: true
|
|
135
133
|
};
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
136
|
// Resolve the URL with template variables
|
|
139
137
|
let url = resolveEndpointUrl(endpoint.url, context);
|
|
140
138
|
// If URL is relative, prepend base URL from endpoint config
|
|
141
|
-
if (url.startsWith(
|
|
139
|
+
if (url.startsWith('/')) {
|
|
142
140
|
const currentConfig = getEndpointConfig();
|
|
143
141
|
if (currentConfig?.baseUrl) {
|
|
144
|
-
const baseUrl = currentConfig.baseUrl.replace(/\/$/,
|
|
142
|
+
const baseUrl = currentConfig.baseUrl.replace(/\/$/, '');
|
|
145
143
|
url = `${baseUrl}${url}`;
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
// Prepare request options
|
|
149
|
-
const method = endpoint.method ??
|
|
147
|
+
const method = endpoint.method ?? 'GET';
|
|
150
148
|
const timeout = endpoint.timeout ?? 30000;
|
|
151
149
|
const headers = {
|
|
152
|
-
Accept:
|
|
153
|
-
|
|
154
|
-
...endpoint.headers
|
|
150
|
+
Accept: 'application/json',
|
|
151
|
+
'Content-Type': 'application/json',
|
|
152
|
+
...endpoint.headers
|
|
155
153
|
};
|
|
156
154
|
// Add auth headers from AuthProvider if available
|
|
157
155
|
if (authProvider) {
|
|
@@ -160,22 +158,19 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
160
158
|
Object.assign(headers, authHeaders);
|
|
161
159
|
}
|
|
162
160
|
catch (error) {
|
|
163
|
-
logger.warn(
|
|
161
|
+
logger.warn('Failed to get auth headers:', error);
|
|
164
162
|
}
|
|
165
163
|
}
|
|
166
164
|
// Add auth headers from endpoint config as fallback
|
|
167
165
|
const currentConfig = getEndpointConfig();
|
|
168
166
|
if (currentConfig?.auth) {
|
|
169
|
-
if (currentConfig.auth.type ===
|
|
170
|
-
headers[
|
|
171
|
-
headers["Authorization"] ?? `Bearer ${currentConfig.auth.token}`;
|
|
167
|
+
if (currentConfig.auth.type === 'bearer' && currentConfig.auth.token) {
|
|
168
|
+
headers['Authorization'] = headers['Authorization'] ?? `Bearer ${currentConfig.auth.token}`;
|
|
172
169
|
}
|
|
173
|
-
else if (currentConfig.auth.type ===
|
|
174
|
-
currentConfig.auth.apiKey
|
|
175
|
-
headers["X-API-Key"] = headers["X-API-Key"] ?? currentConfig.auth.apiKey;
|
|
170
|
+
else if (currentConfig.auth.type === 'api_key' && currentConfig.auth.apiKey) {
|
|
171
|
+
headers['X-API-Key'] = headers['X-API-Key'] ?? currentConfig.auth.apiKey;
|
|
176
172
|
}
|
|
177
|
-
else if (currentConfig.auth.type ===
|
|
178
|
-
currentConfig.auth.headers) {
|
|
173
|
+
else if (currentConfig.auth.type === 'custom' && currentConfig.auth.headers) {
|
|
179
174
|
Object.assign(headers, currentConfig.auth.headers);
|
|
180
175
|
}
|
|
181
176
|
}
|
|
@@ -183,10 +178,10 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
183
178
|
const fetchOptions = {
|
|
184
179
|
method,
|
|
185
180
|
headers,
|
|
186
|
-
signal: AbortSignal.timeout(timeout)
|
|
181
|
+
signal: AbortSignal.timeout(timeout)
|
|
187
182
|
};
|
|
188
183
|
// Add body for non-GET requests
|
|
189
|
-
if (method !==
|
|
184
|
+
if (method !== 'GET' && endpoint.body) {
|
|
190
185
|
const resolvedBody = resolveBodyTemplates(endpoint.body, context);
|
|
191
186
|
fetchOptions.body = JSON.stringify(resolvedBody);
|
|
192
187
|
}
|
|
@@ -197,7 +192,7 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
197
192
|
return {
|
|
198
193
|
success: true,
|
|
199
194
|
schema: { variables: {} },
|
|
200
|
-
fromCache: false
|
|
195
|
+
fromCache: false
|
|
201
196
|
};
|
|
202
197
|
}
|
|
203
198
|
if (!response.ok) {
|
|
@@ -212,13 +207,13 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
212
207
|
}
|
|
213
208
|
return {
|
|
214
209
|
success: false,
|
|
215
|
-
error:
|
|
210
|
+
error: 'Authentication failed'
|
|
216
211
|
};
|
|
217
212
|
}
|
|
218
213
|
const errorText = await response.text();
|
|
219
214
|
return {
|
|
220
215
|
success: false,
|
|
221
|
-
error: `HTTP ${response.status}: ${errorText || response.statusText}
|
|
216
|
+
error: `HTTP ${response.status}: ${errorText || response.statusText}`
|
|
222
217
|
};
|
|
223
218
|
}
|
|
224
219
|
const data = await response.json();
|
|
@@ -228,17 +223,15 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
228
223
|
// 3. Wrapped in { schema: { variables: {...} } }
|
|
229
224
|
// 4. Wrapped in { success: true, data: { variables: {...} } }
|
|
230
225
|
let schema;
|
|
231
|
-
if (data.variables && typeof data.variables ===
|
|
226
|
+
if (data.variables && typeof data.variables === 'object') {
|
|
232
227
|
// Direct VariableSchema
|
|
233
228
|
schema = data;
|
|
234
229
|
}
|
|
235
|
-
else if (data.data?.variables &&
|
|
236
|
-
typeof data.data.variables === "object") {
|
|
230
|
+
else if (data.data?.variables && typeof data.data.variables === 'object') {
|
|
237
231
|
// Wrapped in { data: ... }
|
|
238
232
|
schema = data.data;
|
|
239
233
|
}
|
|
240
|
-
else if (data.schema?.variables &&
|
|
241
|
-
typeof data.schema.variables === "object") {
|
|
234
|
+
else if (data.schema?.variables && typeof data.schema.variables === 'object') {
|
|
242
235
|
// Wrapped in { schema: ... }
|
|
243
236
|
schema = data.schema;
|
|
244
237
|
}
|
|
@@ -249,7 +242,7 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
249
242
|
if (!schema) {
|
|
250
243
|
return {
|
|
251
244
|
success: false,
|
|
252
|
-
error:
|
|
245
|
+
error: 'Invalid variable schema format received from endpoint'
|
|
253
246
|
};
|
|
254
247
|
}
|
|
255
248
|
// Cache the schema (if caching is enabled)
|
|
@@ -257,32 +250,32 @@ export async function fetchVariableSchema(workflowId, nodeId, config, authProvid
|
|
|
257
250
|
variableCache.set(cacheKey, {
|
|
258
251
|
schema,
|
|
259
252
|
cachedAt: Date.now(),
|
|
260
|
-
cacheKey
|
|
253
|
+
cacheKey
|
|
261
254
|
});
|
|
262
255
|
}
|
|
263
256
|
return {
|
|
264
257
|
success: true,
|
|
265
258
|
schema,
|
|
266
|
-
fromCache: false
|
|
259
|
+
fromCache: false
|
|
267
260
|
};
|
|
268
261
|
}
|
|
269
262
|
catch (error) {
|
|
270
263
|
// Handle specific error types
|
|
271
264
|
if (error instanceof Error) {
|
|
272
|
-
if (error.name ===
|
|
265
|
+
if (error.name === 'AbortError' || error.name === 'TimeoutError') {
|
|
273
266
|
return {
|
|
274
267
|
success: false,
|
|
275
|
-
error: `Request timed out after ${timeout}ms
|
|
268
|
+
error: `Request timed out after ${timeout}ms`
|
|
276
269
|
};
|
|
277
270
|
}
|
|
278
271
|
return {
|
|
279
272
|
success: false,
|
|
280
|
-
error: error.message
|
|
273
|
+
error: error.message
|
|
281
274
|
};
|
|
282
275
|
}
|
|
283
276
|
return {
|
|
284
277
|
success: false,
|
|
285
|
-
error:
|
|
278
|
+
error: 'Unknown error occurred while fetching variable schema'
|
|
286
279
|
};
|
|
287
280
|
}
|
|
288
281
|
}
|