@flowdrop/flowdrop 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/adapters/WorkflowAdapter.d.ts +167 -0
- package/dist/adapters/WorkflowAdapter.js +368 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +96 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +626 -0
- package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
- package/dist/adapters/agentspec/agentAdapter.js +91 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
- package/dist/adapters/agentspec/autoLayout.js +127 -0
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +53 -0
- package/dist/adapters/agentspec/defaultNodeTypes.js +561 -0
- package/dist/adapters/agentspec/index.d.ts +37 -0
- package/dist/adapters/agentspec/index.js +39 -0
- package/dist/adapters/agentspec/validator.d.ts +34 -0
- package/dist/adapters/agentspec/validator.js +169 -0
- package/dist/api/enhanced-client.d.ts +183 -0
- package/dist/api/enhanced-client.js +430 -0
- package/dist/components/App.svelte +981 -0
- package/dist/components/App.svelte.d.ts +54 -0
- package/dist/components/CanvasBanner.stories.svelte +29 -0
- package/dist/components/CanvasBanner.stories.svelte.d.ts +27 -0
- package/dist/components/CanvasBanner.svelte +57 -0
- package/dist/components/CanvasBanner.svelte.d.ts +8 -0
- package/dist/components/ConfigForm.svelte +1138 -0
- package/dist/components/ConfigForm.svelte.d.ts +44 -0
- package/dist/components/ConfigModal.svelte +188 -0
- package/dist/components/ConfigModal.svelte.d.ts +13 -0
- package/dist/components/ConfigPanel.stories.svelte +47 -0
- package/dist/components/ConfigPanel.stories.svelte.d.ts +27 -0
- package/dist/components/ConfigPanel.svelte +182 -0
- package/dist/components/ConfigPanel.svelte.d.ts +32 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/EdgeRefresher.svelte +41 -0
- package/dist/components/EdgeRefresher.svelte.d.ts +9 -0
- package/dist/components/FlowDropZone.svelte +83 -0
- package/dist/components/FlowDropZone.svelte.d.ts +13 -0
- package/dist/components/LoadingSpinner.stories.svelte +30 -0
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +27 -0
- package/dist/components/LoadingSpinner.svelte +36 -0
- package/dist/components/LoadingSpinner.svelte.d.ts +8 -0
- package/dist/components/Logo.stories.svelte +22 -0
- package/dist/components/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/Logo.svelte +102 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +563 -0
- package/dist/components/LogsSidebar.svelte.d.ts +17 -0
- package/dist/components/MarkdownDisplay.stories.svelte +36 -0
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +27 -0
- package/dist/components/MarkdownDisplay.svelte +29 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.stories.svelte +53 -0
- package/dist/components/Navbar.stories.svelte.d.ts +27 -0
- package/dist/components/Navbar.svelte +726 -0
- package/dist/components/Navbar.svelte.d.ts +29 -0
- package/dist/components/NodeSidebar.svelte +762 -0
- package/dist/components/NodeSidebar.svelte.d.ts +9 -0
- package/dist/components/NodeStatusOverlay.stories.svelte +85 -0
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +27 -0
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/PipelineStatus.svelte +314 -0
- package/dist/components/PipelineStatus.svelte.d.ts +20 -0
- package/dist/components/PortCoordinateTracker.svelte +58 -0
- package/dist/components/PortCoordinateTracker.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +170 -0
- package/dist/components/ReadOnlyDetails.svelte.d.ts +25 -0
- package/dist/components/SchemaForm.stories.svelte +116 -0
- package/dist/components/SchemaForm.stories.svelte.d.ts +27 -0
- package/dist/components/SchemaForm.svelte +536 -0
- package/dist/components/SchemaForm.svelte.d.ts +83 -0
- package/dist/components/SettingsModal.svelte +279 -0
- package/dist/components/SettingsModal.svelte.d.ts +23 -0
- package/dist/components/SettingsPanel.svelte +638 -0
- package/dist/components/SettingsPanel.svelte.d.ts +21 -0
- package/dist/components/StatusIcon.stories.svelte +60 -0
- package/dist/components/StatusIcon.stories.svelte.d.ts +27 -0
- package/dist/components/StatusIcon.svelte +119 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.stories.svelte +17 -0
- package/dist/components/StatusLabel.stories.svelte.d.ts +27 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.stories.svelte +25 -0
- package/dist/components/ThemeToggle.stories.svelte.d.ts +27 -0
- package/dist/components/ThemeToggle.svelte +185 -0
- package/dist/components/ThemeToggle.svelte.d.ts +14 -0
- package/dist/components/UniversalNode.svelte +155 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +1035 -0
- package/dist/components/WorkflowEditor.svelte.d.ts +23 -0
- package/dist/components/form/FormArray.svelte +1049 -0
- package/dist/components/form/FormArray.svelte.d.ts +22 -0
- package/dist/components/form/FormAutocomplete.svelte +1009 -0
- package/dist/components/form/FormAutocomplete.svelte.d.ts +25 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte +28 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormCheckboxGroup.svelte +155 -0
- package/dist/components/form/FormCheckboxGroup.svelte.d.ts +17 -0
- package/dist/components/form/FormCodeEditor.svelte +458 -0
- package/dist/components/form/FormCodeEditor.svelte.d.ts +25 -0
- package/dist/components/form/FormField.svelte +417 -0
- package/dist/components/form/FormField.svelte.d.ts +29 -0
- package/dist/components/form/FormFieldLight.svelte +425 -0
- package/dist/components/form/FormFieldLight.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte +53 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormFieldWrapper.svelte +125 -0
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldset.svelte +142 -0
- package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
- package/dist/components/form/FormMarkdownEditor.svelte +752 -0
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +33 -0
- package/dist/components/form/FormNumberField.stories.svelte +36 -0
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormNumberField.svelte +112 -0
- package/dist/components/form/FormNumberField.svelte.d.ts +25 -0
- package/dist/components/form/FormRangeField.stories.svelte +31 -0
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormRangeField.svelte +246 -0
- package/dist/components/form/FormRangeField.svelte.d.ts +23 -0
- package/dist/components/form/FormSelect.stories.svelte +50 -0
- package/dist/components/form/FormSelect.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormSelect.svelte +129 -0
- package/dist/components/form/FormSelect.svelte.d.ts +20 -0
- package/dist/components/form/FormTemplateEditor.svelte +825 -0
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +41 -0
- package/dist/components/form/FormTextField.stories.svelte +30 -0
- package/dist/components/form/FormTextField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextField.svelte +91 -0
- package/dist/components/form/FormTextField.svelte.d.ts +19 -0
- package/dist/components/form/FormTextarea.stories.svelte +34 -0
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextarea.svelte +97 -0
- package/dist/components/form/FormTextarea.svelte.d.ts +21 -0
- package/dist/components/form/FormToggle.stories.svelte +30 -0
- package/dist/components/form/FormToggle.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormToggle.svelte +126 -0
- package/dist/components/form/FormToggle.svelte.d.ts +19 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +136 -0
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
- package/dist/components/form/index.d.ts +50 -0
- package/dist/components/form/index.js +54 -0
- package/dist/components/form/templateAutocomplete.d.ts +29 -0
- package/dist/components/form/templateAutocomplete.js +254 -0
- package/dist/components/form/types.d.ts +485 -0
- package/dist/components/form/types.js +73 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +52 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +401 -0
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +71 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte +292 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +25 -0
- package/dist/components/interrupt/FormPrompt.svelte +236 -0
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/InterruptBubble.svelte +601 -0
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +16 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +67 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ReviewPrompt.svelte +861 -0
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +47 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/TextInputPrompt.svelte +346 -0
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/index.d.ts +13 -0
- package/dist/components/interrupt/index.js +15 -0
- package/dist/components/layouts/MainLayout.svelte +718 -0
- package/dist/components/layouts/MainLayout.svelte.d.ts +62 -0
- package/dist/components/nodes/GatewayNode.stories.svelte +108 -0
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +591 -0
- package/dist/components/nodes/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/nodes/IdeaNode.stories.svelte +52 -0
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/IdeaNode.svelte +455 -0
- package/dist/components/nodes/IdeaNode.svelte.d.ts +24 -0
- package/dist/components/nodes/NotesNode.stories.svelte +76 -0
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/NotesNode.svelte +378 -0
- package/dist/components/nodes/NotesNode.svelte.d.ts +24 -0
- package/dist/components/nodes/SimpleNode.stories.svelte +159 -0
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SimpleNode.svelte +451 -0
- package/dist/components/nodes/SimpleNode.svelte.d.ts +25 -0
- package/dist/components/nodes/SquareNode.stories.svelte +82 -0
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SquareNode.svelte +407 -0
- package/dist/components/nodes/SquareNode.svelte.d.ts +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/TerminalNode.svelte +690 -0
- package/dist/components/nodes/TerminalNode.svelte.d.ts +25 -0
- package/dist/components/nodes/ToolNode.stories.svelte +189 -0
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/ToolNode.svelte +471 -0
- package/dist/components/nodes/ToolNode.svelte.d.ts +36 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte +55 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/WorkflowNode.svelte +571 -0
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +15 -0
- package/dist/components/playground/ChatPanel.svelte +905 -0
- package/dist/components/playground/ChatPanel.svelte.d.ts +46 -0
- package/dist/components/playground/ExecutionLogs.svelte +488 -0
- package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
- package/dist/components/playground/InputCollector.svelte +444 -0
- package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
- package/dist/components/playground/MessageBubble.stories.svelte +62 -0
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +27 -0
- package/dist/components/playground/MessageBubble.svelte +633 -0
- package/dist/components/playground/MessageBubble.svelte.d.ts +24 -0
- package/dist/components/playground/Playground.svelte +1075 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/PlaygroundModal.svelte +220 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +25 -0
- package/dist/components/playground/SessionManager.svelte +538 -0
- package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
- package/dist/config/agentSpecEndpoints.d.ts +70 -0
- package/dist/config/agentSpecEndpoints.js +65 -0
- package/dist/config/constants.d.ts +43 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/defaultCategories.d.ts +7 -0
- package/dist/config/defaultCategories.js +126 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +201 -0
- package/dist/config/endpoints.d.ts +160 -0
- package/dist/config/endpoints.js +146 -0
- package/dist/config/runtimeConfig.d.ts +47 -0
- package/dist/config/runtimeConfig.js +80 -0
- package/dist/core/index.d.ts +75 -0
- package/dist/core/index.js +92 -0
- package/dist/display/index.d.ts +29 -0
- package/dist/display/index.js +36 -0
- package/dist/editor/index.d.ts +95 -0
- package/dist/editor/index.js +138 -0
- package/dist/form/code.d.ts +101 -0
- package/dist/form/code.js +168 -0
- package/dist/form/fieldRegistry.d.ts +169 -0
- package/dist/form/fieldRegistry.js +152 -0
- package/dist/form/full.d.ts +56 -0
- package/dist/form/full.js +80 -0
- package/dist/form/index.d.ts +77 -0
- package/dist/form/index.js +91 -0
- package/dist/form/markdown.d.ts +69 -0
- package/dist/form/markdown.js +103 -0
- package/dist/helpers/nodeLayoutHelper.d.ts +14 -0
- package/dist/helpers/nodeLayoutHelper.js +19 -0
- package/dist/helpers/proximityConnect.d.ts +94 -0
- package/dist/helpers/proximityConnect.js +314 -0
- package/dist/helpers/workflowEditorHelper.d.ts +183 -0
- package/dist/helpers/workflowEditorHelper.js +595 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +64 -0
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +22 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +36 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/playground/index.d.ts +131 -0
- package/dist/playground/index.js +172 -0
- package/dist/playground/mount.d.ts +203 -0
- package/dist/playground/mount.js +235 -0
- package/dist/registry/BaseRegistry.d.ts +92 -0
- package/dist/registry/BaseRegistry.js +124 -0
- package/dist/registry/builtinFormats.d.ts +23 -0
- package/dist/registry/builtinFormats.js +70 -0
- package/dist/registry/builtinNodes.d.ts +77 -0
- package/dist/registry/builtinNodes.js +211 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/nodeComponentRegistry.d.ts +276 -0
- package/dist/registry/nodeComponentRegistry.js +262 -0
- package/dist/registry/plugin.d.ts +215 -0
- package/dist/registry/plugin.js +249 -0
- package/dist/registry/workflowFormatRegistry.d.ts +122 -0
- package/dist/registry/workflowFormatRegistry.js +96 -0
- package/dist/schema/index.d.ts +23 -0
- package/dist/schema/index.js +23 -0
- package/dist/schemas/v1/workflow.schema.json +1078 -0
- package/dist/services/agentSpecExecutionService.d.ts +106 -0
- package/dist/services/agentSpecExecutionService.js +334 -0
- package/dist/services/api.d.ts +115 -0
- package/dist/services/api.js +214 -0
- package/dist/services/apiVariableService.d.ts +114 -0
- package/dist/services/apiVariableService.js +338 -0
- package/dist/services/autoSaveService.d.ts +112 -0
- package/dist/services/autoSaveService.js +227 -0
- package/dist/services/categoriesApi.d.ts +14 -0
- package/dist/services/categoriesApi.js +49 -0
- package/dist/services/draftStorage.d.ts +171 -0
- package/dist/services/draftStorage.js +299 -0
- package/dist/services/dynamicSchemaService.d.ts +108 -0
- package/dist/services/dynamicSchemaService.js +444 -0
- package/dist/services/globalSave.d.ts +69 -0
- package/dist/services/globalSave.js +248 -0
- package/dist/services/historyService.d.ts +208 -0
- package/dist/services/historyService.js +321 -0
- package/dist/services/interruptService.d.ts +133 -0
- package/dist/services/interruptService.js +280 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +266 -0
- package/dist/services/playgroundService.d.ts +130 -0
- package/dist/services/playgroundService.js +321 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +54 -0
- package/dist/services/settingsService.d.ts +92 -0
- package/dist/services/settingsService.js +196 -0
- package/dist/services/toastService.d.ts +156 -0
- package/dist/services/toastService.js +265 -0
- package/dist/services/variableService.d.ts +141 -0
- package/dist/services/variableService.js +463 -0
- package/dist/services/workflowStorage.d.ts +37 -0
- package/dist/services/workflowStorage.js +116 -0
- package/dist/settings/index.d.ts +25 -0
- package/dist/settings/index.js +33 -0
- package/dist/stores/categoriesStore.svelte.d.ts +32 -0
- package/dist/stores/categoriesStore.svelte.js +77 -0
- package/dist/stores/editorStateMachine.svelte.d.ts +42 -0
- package/dist/stores/editorStateMachine.svelte.js +132 -0
- package/dist/stores/historyStore.svelte.d.ts +136 -0
- package/dist/stores/historyStore.svelte.js +207 -0
- package/dist/stores/interruptStore.svelte.d.ts +179 -0
- package/dist/stores/interruptStore.svelte.js +346 -0
- package/dist/stores/playgroundStore.svelte.d.ts +230 -0
- package/dist/stores/playgroundStore.svelte.js +515 -0
- package/dist/stores/portCoordinateStore.svelte.d.ts +66 -0
- package/dist/stores/portCoordinateStore.svelte.js +186 -0
- package/dist/stores/settingsStore.svelte.d.ts +158 -0
- package/dist/stores/settingsStore.svelte.js +544 -0
- package/dist/stores/workflowStore.svelte.d.ts +260 -0
- package/dist/stores/workflowStore.svelte.js +649 -0
- package/dist/stories/CanvasDecorator.svelte +49 -0
- package/dist/stories/CanvasDecorator.svelte.d.ts +8 -0
- package/dist/stories/NodeDecorator.svelte +73 -0
- package/dist/stories/NodeDecorator.svelte.d.ts +8 -0
- package/dist/stories/utils.d.ts +93 -0
- package/dist/stories/utils.js +122 -0
- package/dist/styles/base.css +1300 -0
- package/dist/styles/toast.css +35 -0
- package/dist/styles/tokens.css +475 -0
- package/dist/svelte-app.d.ts +150 -0
- package/dist/svelte-app.js +295 -0
- package/dist/types/agentspec.d.ts +318 -0
- package/dist/types/agentspec.js +48 -0
- package/dist/types/auth.d.ts +263 -0
- package/dist/types/auth.js +229 -0
- package/dist/types/config.d.ts +151 -0
- package/dist/types/config.js +7 -0
- package/dist/types/events.d.ts +190 -0
- package/dist/types/events.js +30 -0
- package/dist/types/index.d.ts +1234 -0
- package/dist/types/index.js +27 -0
- package/dist/types/interrupt.d.ts +390 -0
- package/dist/types/interrupt.js +145 -0
- package/dist/types/interruptState.d.ts +211 -0
- package/dist/types/interruptState.js +308 -0
- package/dist/types/playground.d.ts +351 -0
- package/dist/types/playground.js +95 -0
- package/dist/types/settings.d.ts +189 -0
- package/dist/types/settings.js +97 -0
- package/dist/types/uischema.d.ts +144 -0
- package/dist/types/uischema.js +51 -0
- package/dist/utils/colors.d.ts +288 -0
- package/dist/utils/colors.js +548 -0
- package/dist/utils/config.d.ts +37 -0
- package/dist/utils/config.js +226 -0
- package/dist/utils/connections.d.ts +125 -0
- package/dist/utils/connections.js +414 -0
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/fetchWithAuth.d.ts +25 -0
- package/dist/utils/fetchWithAuth.js +34 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/dist/utils/handlePositioning.d.ts +31 -0
- package/dist/utils/handlePositioning.js +35 -0
- package/dist/utils/icons.d.ts +106 -0
- package/dist/utils/icons.js +157 -0
- package/dist/utils/logger.d.ts +47 -0
- package/dist/utils/logger.js +72 -0
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +117 -0
- package/dist/utils/nodeTypes.js +244 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/dist/utils/performanceUtils.d.ts +30 -0
- package/dist/utils/performanceUtils.js +108 -0
- package/dist/utils/sanitize.d.ts +19 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/utils/uischema.d.ts +52 -0
- package/dist/utils/uischema.js +88 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.js +39 -0
- package/package.json +292 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the Workflow Library
|
|
3
|
+
*/
|
|
4
|
+
import { ConnectionLineType } from '@xyflow/svelte';
|
|
5
|
+
/**
|
|
6
|
+
* Default workflow format used when none is specified.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_WORKFLOW_FORMAT = 'flowdrop';
|
|
9
|
+
/**
|
|
10
|
+
* Convert a DynamicPort to a NodePort
|
|
11
|
+
* @param port - The dynamic port configuration
|
|
12
|
+
* @param portType - Whether this is an input or output port
|
|
13
|
+
* @returns A NodePort compatible with the rendering system
|
|
14
|
+
*/
|
|
15
|
+
export function dynamicPortToNodePort(port, portType) {
|
|
16
|
+
return {
|
|
17
|
+
id: port.name,
|
|
18
|
+
name: port.label,
|
|
19
|
+
type: portType,
|
|
20
|
+
dataType: port.dataType,
|
|
21
|
+
required: port.required ?? false,
|
|
22
|
+
description: port.description
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './auth.js';
|
|
26
|
+
export { DEFAULT_SETTINGS, DEFAULT_THEME_SETTINGS, DEFAULT_EDITOR_SETTINGS, DEFAULT_UI_SETTINGS, DEFAULT_BEHAVIOR_SETTINGS, DEFAULT_API_SETTINGS, SETTINGS_CATEGORIES, SETTINGS_CATEGORY_LABELS, SETTINGS_CATEGORY_ICONS, SETTINGS_STORAGE_KEY } from './settings.js';
|
|
27
|
+
export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from './uischema.js';
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interrupt Types for Human-in-the-Loop (HITL) Support
|
|
3
|
+
*
|
|
4
|
+
* TypeScript types for workflow interrupts that pause execution
|
|
5
|
+
* and request user input before continuing.
|
|
6
|
+
*
|
|
7
|
+
* @module types/interrupt
|
|
8
|
+
*/
|
|
9
|
+
import type { ConfigSchema } from './index.js';
|
|
10
|
+
export type { InterruptState, IdleState, SubmittingState, ResolvedState, CancelledState, ErrorState, InterruptAction, SubmitAction, CancelAction, SuccessAction, FailureAction, RetryAction, ResetAction, TransitionResult } from './interruptState.js';
|
|
11
|
+
export { initialState, transition, isTerminalState, isSubmitting, hasError, canSubmit, getErrorMessage, getResolvedValue, toLegacyStatus } from './interruptState.js';
|
|
12
|
+
/**
|
|
13
|
+
* Types of interrupts supported by the system
|
|
14
|
+
*
|
|
15
|
+
* - `confirmation`: Simple Yes/No prompt
|
|
16
|
+
* - `choice`: Single or multiple option selection
|
|
17
|
+
* - `text`: Free-form text input
|
|
18
|
+
* - `form`: JSON Schema-based form
|
|
19
|
+
*/
|
|
20
|
+
export type InterruptType = 'confirmation' | 'choice' | 'text' | 'form' | 'review';
|
|
21
|
+
/**
|
|
22
|
+
* Status of an interrupt request
|
|
23
|
+
*
|
|
24
|
+
* - `pending`: Awaiting user response
|
|
25
|
+
* - `resolved`: User has provided a response
|
|
26
|
+
* - `cancelled`: User or system cancelled the interrupt
|
|
27
|
+
* - `expired`: Interrupt timed out without response
|
|
28
|
+
*/
|
|
29
|
+
export type InterruptStatus = 'pending' | 'resolved' | 'cancelled' | 'expired';
|
|
30
|
+
/**
|
|
31
|
+
* Choice option for choice-type interrupts
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const option: InterruptChoice = {
|
|
36
|
+
* value: "high",
|
|
37
|
+
* label: "High Priority",
|
|
38
|
+
* description: "Process immediately"
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface InterruptChoice {
|
|
43
|
+
/** Unique value identifier for this option */
|
|
44
|
+
value: string;
|
|
45
|
+
/** Display label for the option */
|
|
46
|
+
label: string;
|
|
47
|
+
/** Optional description providing more context */
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for confirmation-type interrupts
|
|
52
|
+
*/
|
|
53
|
+
export interface ConfirmationConfig {
|
|
54
|
+
/** The confirmation message/question to display */
|
|
55
|
+
message: string;
|
|
56
|
+
/** Label for the confirm/yes button */
|
|
57
|
+
confirmLabel?: string;
|
|
58
|
+
/** Label for the cancel/no button */
|
|
59
|
+
cancelLabel?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Configuration for choice-type interrupts
|
|
63
|
+
*/
|
|
64
|
+
export interface ChoiceConfig {
|
|
65
|
+
/** The prompt message to display */
|
|
66
|
+
message: string;
|
|
67
|
+
/** Available options to choose from */
|
|
68
|
+
options: InterruptChoice[];
|
|
69
|
+
/** Whether multiple selections are allowed */
|
|
70
|
+
multiple?: boolean;
|
|
71
|
+
/** Minimum number of selections required (for multiple mode) */
|
|
72
|
+
minSelections?: number;
|
|
73
|
+
/** Maximum number of selections allowed (for multiple mode) */
|
|
74
|
+
maxSelections?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Configuration for text-type interrupts
|
|
78
|
+
*/
|
|
79
|
+
export interface TextConfig {
|
|
80
|
+
/** The prompt message to display */
|
|
81
|
+
message: string;
|
|
82
|
+
/** Placeholder text for the input field */
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
/** Whether to show a multiline text area */
|
|
85
|
+
multiline?: boolean;
|
|
86
|
+
/** Minimum text length required */
|
|
87
|
+
minLength?: number;
|
|
88
|
+
/** Maximum text length allowed */
|
|
89
|
+
maxLength?: number;
|
|
90
|
+
/** Default value to pre-fill */
|
|
91
|
+
defaultValue?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for form-type interrupts
|
|
95
|
+
*/
|
|
96
|
+
export interface FormConfig {
|
|
97
|
+
/** The prompt message to display */
|
|
98
|
+
message: string;
|
|
99
|
+
/** JSON Schema defining the form fields */
|
|
100
|
+
schema: ConfigSchema;
|
|
101
|
+
/** Default values for form fields */
|
|
102
|
+
defaultValues?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A single field change proposed for review
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const change: ReviewChange = {
|
|
110
|
+
* field: "title",
|
|
111
|
+
* label: "Page Title",
|
|
112
|
+
* original: "About Us",
|
|
113
|
+
* proposed: "About Our Company"
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export interface ReviewChange {
|
|
118
|
+
/** Field identifier (machine key) */
|
|
119
|
+
field: string;
|
|
120
|
+
/** Human-readable field label */
|
|
121
|
+
label: string;
|
|
122
|
+
/** Original value before the proposed change */
|
|
123
|
+
original: unknown;
|
|
124
|
+
/** Proposed new value */
|
|
125
|
+
proposed: unknown;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Configuration for review-type interrupts
|
|
129
|
+
*
|
|
130
|
+
* Displays a list of proposed field changes for the user to
|
|
131
|
+
* accept or reject individually before submitting.
|
|
132
|
+
*/
|
|
133
|
+
export interface ReviewConfig {
|
|
134
|
+
/** The prompt message to display */
|
|
135
|
+
message: string;
|
|
136
|
+
/** List of field changes to review */
|
|
137
|
+
changes: ReviewChange[];
|
|
138
|
+
/** Label for the "Accept All" button */
|
|
139
|
+
acceptAllLabel?: string;
|
|
140
|
+
/** Label for the "Reject All" button */
|
|
141
|
+
rejectAllLabel?: string;
|
|
142
|
+
/** Label for the submit button */
|
|
143
|
+
submitLabel?: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Per-field decision in a review resolution
|
|
147
|
+
*/
|
|
148
|
+
export interface ReviewFieldDecision {
|
|
149
|
+
/** Whether the proposed change was accepted */
|
|
150
|
+
accepted: boolean;
|
|
151
|
+
/** The effective value (proposed if accepted, original if rejected) */
|
|
152
|
+
value: unknown;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Resolution value for review-type interrupts
|
|
156
|
+
*
|
|
157
|
+
* Contains individual decisions for each field and a summary count.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const resolution: ReviewResolution = {
|
|
162
|
+
* decisions: {
|
|
163
|
+
* title: { accepted: true, value: "About Our Company" },
|
|
164
|
+
* meta_description: { accepted: false, value: "Learn about us" }
|
|
165
|
+
* },
|
|
166
|
+
* summary: { accepted: 1, rejected: 1, total: 2 }
|
|
167
|
+
* };
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export interface ReviewResolution {
|
|
171
|
+
/** Map of field identifier to the user's decision */
|
|
172
|
+
decisions: Record<string, ReviewFieldDecision>;
|
|
173
|
+
/** Summary counts of accepted/rejected fields */
|
|
174
|
+
summary: {
|
|
175
|
+
accepted: number;
|
|
176
|
+
rejected: number;
|
|
177
|
+
total: number;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Union type for interrupt-specific configuration
|
|
182
|
+
*/
|
|
183
|
+
export type InterruptConfig = ConfirmationConfig | ChoiceConfig | TextConfig | FormConfig | ReviewConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Core interrupt data structure
|
|
186
|
+
*
|
|
187
|
+
* Represents a pending or resolved interrupt request from the workflow.
|
|
188
|
+
* Includes a state machine for tracking the interaction state.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const interrupt: Interrupt = {
|
|
193
|
+
* id: "int-123",
|
|
194
|
+
* type: "confirmation",
|
|
195
|
+
* status: "pending",
|
|
196
|
+
* message: "Send email to John?",
|
|
197
|
+
* nodeId: "node-456",
|
|
198
|
+
* executionId: "exec-789",
|
|
199
|
+
* sessionId: "sess-abc",
|
|
200
|
+
* createdAt: "2024-01-20T10:00:00Z",
|
|
201
|
+
* allowCancel: true,
|
|
202
|
+
* config: {
|
|
203
|
+
* message: "Send email to John?",
|
|
204
|
+
* confirmLabel: "Send",
|
|
205
|
+
* cancelLabel: "Don't Send"
|
|
206
|
+
* },
|
|
207
|
+
* state: { status: "idle" }
|
|
208
|
+
* };
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export interface Interrupt {
|
|
212
|
+
/** Unique identifier for the interrupt */
|
|
213
|
+
id: string;
|
|
214
|
+
/** Type of interrupt (confirmation, choice, text, form) */
|
|
215
|
+
type: InterruptType;
|
|
216
|
+
/** Current status of the interrupt */
|
|
217
|
+
status: InterruptStatus;
|
|
218
|
+
/** Primary message/prompt to display */
|
|
219
|
+
message: string;
|
|
220
|
+
/** ID of the node that triggered the interrupt */
|
|
221
|
+
nodeId?: string;
|
|
222
|
+
/** ID of the workflow execution */
|
|
223
|
+
executionId?: string;
|
|
224
|
+
/** ID of the playground session (if applicable) */
|
|
225
|
+
sessionId?: string;
|
|
226
|
+
/** ID of the pipeline (if applicable) */
|
|
227
|
+
pipelineId?: string;
|
|
228
|
+
/** ID of the associated message in the chat flow */
|
|
229
|
+
messageId?: string;
|
|
230
|
+
/** Timestamp when the interrupt was created (ISO 8601) */
|
|
231
|
+
createdAt: string;
|
|
232
|
+
/** Timestamp when the interrupt was resolved (ISO 8601) */
|
|
233
|
+
resolvedAt?: string;
|
|
234
|
+
/** Timestamp when the interrupt expires (ISO 8601) */
|
|
235
|
+
expiresAt?: string;
|
|
236
|
+
/** Whether the user can cancel/dismiss this interrupt */
|
|
237
|
+
allowCancel: boolean;
|
|
238
|
+
/** Type-specific configuration */
|
|
239
|
+
config: InterruptConfig;
|
|
240
|
+
/** The user's response value (when resolved) */
|
|
241
|
+
responseValue?: unknown;
|
|
242
|
+
/** Additional metadata from the backend */
|
|
243
|
+
metadata?: Record<string, unknown>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Payload for resolving an interrupt
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* // Confirmation response
|
|
251
|
+
* const resolution: InterruptResolution = {
|
|
252
|
+
* value: true // or false
|
|
253
|
+
* };
|
|
254
|
+
*
|
|
255
|
+
* // Choice response (single)
|
|
256
|
+
* const resolution: InterruptResolution = {
|
|
257
|
+
* value: "option_a"
|
|
258
|
+
* };
|
|
259
|
+
*
|
|
260
|
+
* // Choice response (multiple)
|
|
261
|
+
* const resolution: InterruptResolution = {
|
|
262
|
+
* value: ["option_a", "option_b"]
|
|
263
|
+
* };
|
|
264
|
+
*
|
|
265
|
+
* // Text response
|
|
266
|
+
* const resolution: InterruptResolution = {
|
|
267
|
+
* value: "User entered text"
|
|
268
|
+
* };
|
|
269
|
+
*
|
|
270
|
+
* // Form response
|
|
271
|
+
* const resolution: InterruptResolution = {
|
|
272
|
+
* value: { name: "John", email: "john@example.com" }
|
|
273
|
+
* };
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
export interface InterruptResolution {
|
|
277
|
+
/** The user's response value */
|
|
278
|
+
value: unknown;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* API response for interrupt operations
|
|
282
|
+
*/
|
|
283
|
+
export interface InterruptApiResponse<T = Interrupt> {
|
|
284
|
+
/** Whether the request was successful */
|
|
285
|
+
success: boolean;
|
|
286
|
+
/** Response data */
|
|
287
|
+
data?: T;
|
|
288
|
+
/** Error message if unsuccessful */
|
|
289
|
+
error?: string;
|
|
290
|
+
/** Human-readable message */
|
|
291
|
+
message?: string;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Response type for listing interrupts
|
|
295
|
+
*/
|
|
296
|
+
export type InterruptListResponse = InterruptApiResponse<Interrupt[]>;
|
|
297
|
+
/**
|
|
298
|
+
* Response type for single interrupt operations
|
|
299
|
+
*/
|
|
300
|
+
export type InterruptResponse = InterruptApiResponse<Interrupt>;
|
|
301
|
+
/**
|
|
302
|
+
* Message metadata structure for interrupt detection
|
|
303
|
+
*
|
|
304
|
+
* When a message contains this metadata type, it indicates
|
|
305
|
+
* an interrupt request that should be rendered inline.
|
|
306
|
+
*/
|
|
307
|
+
export interface InterruptMessageMetadata {
|
|
308
|
+
/** Indicates this is an interrupt request */
|
|
309
|
+
type: 'interrupt_request';
|
|
310
|
+
/** The interrupt ID */
|
|
311
|
+
interrupt_id: string;
|
|
312
|
+
/** Type of interrupt */
|
|
313
|
+
interrupt_type: InterruptType;
|
|
314
|
+
/** JSON Schema for form-type interrupts */
|
|
315
|
+
schema?: ConfigSchema;
|
|
316
|
+
/** Options for choice-type interrupts */
|
|
317
|
+
options?: InterruptChoice[];
|
|
318
|
+
/** Default value for pre-filling */
|
|
319
|
+
default_value?: unknown;
|
|
320
|
+
/** Response value when interrupt has been resolved */
|
|
321
|
+
response_value?: unknown;
|
|
322
|
+
/** Node ID that triggered the interrupt */
|
|
323
|
+
node_id?: string;
|
|
324
|
+
/** Execution ID */
|
|
325
|
+
execution_id?: string;
|
|
326
|
+
/** Whether cancel is allowed */
|
|
327
|
+
allow_cancel?: boolean;
|
|
328
|
+
/** Labels for confirmation type */
|
|
329
|
+
confirm_label?: string;
|
|
330
|
+
cancel_label?: string;
|
|
331
|
+
/** Text input configuration */
|
|
332
|
+
placeholder?: string;
|
|
333
|
+
multiline?: boolean;
|
|
334
|
+
min_length?: number;
|
|
335
|
+
max_length?: number;
|
|
336
|
+
/** Choice configuration */
|
|
337
|
+
multiple?: boolean;
|
|
338
|
+
min_selections?: number;
|
|
339
|
+
max_selections?: number;
|
|
340
|
+
/** Username of the person who resolved the interrupt */
|
|
341
|
+
resolvedByUserName?: string;
|
|
342
|
+
/** User ID of the person who resolved the interrupt */
|
|
343
|
+
resolvedByUserId?: string;
|
|
344
|
+
/** Review: list of field changes to review */
|
|
345
|
+
changes?: ReviewChange[];
|
|
346
|
+
/** Review: label for the "Accept All" button */
|
|
347
|
+
accept_all_label?: string;
|
|
348
|
+
/** Review: label for the "Reject All" button */
|
|
349
|
+
reject_all_label?: string;
|
|
350
|
+
/** Review: label for the submit button */
|
|
351
|
+
submit_label?: string;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Type guard to check if message metadata indicates an interrupt
|
|
355
|
+
*
|
|
356
|
+
* @param metadata - Message metadata to check
|
|
357
|
+
* @returns True if the metadata indicates an interrupt request
|
|
358
|
+
*/
|
|
359
|
+
export declare function isInterruptMetadata(metadata: Record<string, unknown> | undefined): metadata is Record<string, unknown>;
|
|
360
|
+
/**
|
|
361
|
+
* Safely extract interrupt metadata from a generic record
|
|
362
|
+
*
|
|
363
|
+
* @param metadata - The metadata record to extract from
|
|
364
|
+
* @returns The interrupt metadata if valid, or null
|
|
365
|
+
*/
|
|
366
|
+
export declare function extractInterruptMetadata(metadata: Record<string, unknown> | undefined): InterruptMessageMetadata | null;
|
|
367
|
+
/**
|
|
368
|
+
* Convert interrupt message metadata to a full Interrupt object
|
|
369
|
+
*
|
|
370
|
+
* @param metadata - The interrupt message metadata
|
|
371
|
+
* @param messageId - The ID of the message containing the interrupt
|
|
372
|
+
* @param content - The message content (used as the interrupt message)
|
|
373
|
+
* @returns A fully populated Interrupt object
|
|
374
|
+
*/
|
|
375
|
+
export declare function metadataToInterrupt(metadata: InterruptMessageMetadata, messageId: string, content: string): Interrupt;
|
|
376
|
+
/**
|
|
377
|
+
* Configuration options for interrupt polling
|
|
378
|
+
*/
|
|
379
|
+
export interface InterruptPollingConfig {
|
|
380
|
+
/** Whether to enable dedicated interrupt polling */
|
|
381
|
+
enabled: boolean;
|
|
382
|
+
/** Polling interval in milliseconds */
|
|
383
|
+
interval: number;
|
|
384
|
+
/** Maximum polling backoff interval in milliseconds */
|
|
385
|
+
maxBackoff: number;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Default interrupt polling configuration
|
|
389
|
+
*/
|
|
390
|
+
export declare const defaultInterruptPollingConfig: InterruptPollingConfig;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interrupt Types for Human-in-the-Loop (HITL) Support
|
|
3
|
+
*
|
|
4
|
+
* TypeScript types for workflow interrupts that pause execution
|
|
5
|
+
* and request user input before continuing.
|
|
6
|
+
*
|
|
7
|
+
* @module types/interrupt
|
|
8
|
+
*/
|
|
9
|
+
export { initialState, transition, isTerminalState, isSubmitting, hasError, canSubmit, getErrorMessage, getResolvedValue, toLegacyStatus } from './interruptState.js';
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if message metadata indicates an interrupt
|
|
12
|
+
*
|
|
13
|
+
* @param metadata - Message metadata to check
|
|
14
|
+
* @returns True if the metadata indicates an interrupt request
|
|
15
|
+
*/
|
|
16
|
+
export function isInterruptMetadata(metadata) {
|
|
17
|
+
return (metadata !== undefined &&
|
|
18
|
+
metadata.type === 'interrupt_request' &&
|
|
19
|
+
typeof metadata.interrupt_id === 'string');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Safely extract interrupt metadata from a generic record
|
|
23
|
+
*
|
|
24
|
+
* @param metadata - The metadata record to extract from
|
|
25
|
+
* @returns The interrupt metadata if valid, or null
|
|
26
|
+
*/
|
|
27
|
+
export function extractInterruptMetadata(metadata) {
|
|
28
|
+
if (!isInterruptMetadata(metadata)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// Manually construct the typed object from the validated metadata
|
|
32
|
+
return {
|
|
33
|
+
type: 'interrupt_request',
|
|
34
|
+
interrupt_id: metadata.interrupt_id,
|
|
35
|
+
interrupt_type: metadata.interrupt_type,
|
|
36
|
+
schema: metadata.schema,
|
|
37
|
+
options: metadata.options,
|
|
38
|
+
default_value: metadata.default_value,
|
|
39
|
+
response_value: metadata.response_value,
|
|
40
|
+
node_id: metadata.node_id,
|
|
41
|
+
execution_id: metadata.execution_id,
|
|
42
|
+
allow_cancel: metadata.allow_cancel,
|
|
43
|
+
confirm_label: metadata.confirm_label,
|
|
44
|
+
cancel_label: metadata.cancel_label,
|
|
45
|
+
placeholder: metadata.placeholder,
|
|
46
|
+
multiline: metadata.multiline,
|
|
47
|
+
min_length: metadata.min_length,
|
|
48
|
+
max_length: metadata.max_length,
|
|
49
|
+
multiple: metadata.multiple,
|
|
50
|
+
min_selections: metadata.min_selections,
|
|
51
|
+
max_selections: metadata.max_selections,
|
|
52
|
+
resolvedByUserName: metadata.resolvedByUserName,
|
|
53
|
+
resolvedByUserId: metadata.resolvedByUserId,
|
|
54
|
+
changes: metadata.changes,
|
|
55
|
+
accept_all_label: metadata.accept_all_label,
|
|
56
|
+
reject_all_label: metadata.reject_all_label,
|
|
57
|
+
submit_label: metadata.submit_label
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Convert interrupt message metadata to a full Interrupt object
|
|
62
|
+
*
|
|
63
|
+
* @param metadata - The interrupt message metadata
|
|
64
|
+
* @param messageId - The ID of the message containing the interrupt
|
|
65
|
+
* @param content - The message content (used as the interrupt message)
|
|
66
|
+
* @returns A fully populated Interrupt object
|
|
67
|
+
*/
|
|
68
|
+
export function metadataToInterrupt(metadata, messageId, content) {
|
|
69
|
+
const baseInterrupt = {
|
|
70
|
+
id: metadata.interrupt_id,
|
|
71
|
+
type: metadata.interrupt_type,
|
|
72
|
+
status: 'pending',
|
|
73
|
+
message: content,
|
|
74
|
+
nodeId: metadata.node_id,
|
|
75
|
+
executionId: metadata.execution_id,
|
|
76
|
+
messageId,
|
|
77
|
+
createdAt: new Date().toISOString(),
|
|
78
|
+
allowCancel: metadata.allow_cancel ?? true,
|
|
79
|
+
config: buildInterruptConfig(metadata, content),
|
|
80
|
+
// Include metadata for resolved-by info (passed through from message metadata)
|
|
81
|
+
metadata: {
|
|
82
|
+
resolvedByUserName: metadata.resolvedByUserName,
|
|
83
|
+
resolvedByUserId: metadata.resolvedByUserId
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return baseInterrupt;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build the type-specific config from message metadata
|
|
90
|
+
*
|
|
91
|
+
* @param metadata - The interrupt message metadata
|
|
92
|
+
* @param message - The interrupt message content
|
|
93
|
+
* @returns Type-specific interrupt configuration
|
|
94
|
+
*/
|
|
95
|
+
function buildInterruptConfig(metadata, message) {
|
|
96
|
+
switch (metadata.interrupt_type) {
|
|
97
|
+
case 'confirmation':
|
|
98
|
+
return {
|
|
99
|
+
message,
|
|
100
|
+
confirmLabel: metadata.confirm_label ?? 'Yes',
|
|
101
|
+
cancelLabel: metadata.cancel_label ?? 'No'
|
|
102
|
+
};
|
|
103
|
+
case 'choice':
|
|
104
|
+
return {
|
|
105
|
+
message,
|
|
106
|
+
options: metadata.options ?? [],
|
|
107
|
+
multiple: metadata.multiple ?? false,
|
|
108
|
+
minSelections: metadata.min_selections,
|
|
109
|
+
maxSelections: metadata.max_selections
|
|
110
|
+
};
|
|
111
|
+
case 'text':
|
|
112
|
+
return {
|
|
113
|
+
message,
|
|
114
|
+
placeholder: metadata.placeholder,
|
|
115
|
+
multiline: metadata.multiline ?? false,
|
|
116
|
+
minLength: metadata.min_length,
|
|
117
|
+
maxLength: metadata.max_length,
|
|
118
|
+
defaultValue: metadata.default_value
|
|
119
|
+
};
|
|
120
|
+
case 'form':
|
|
121
|
+
return {
|
|
122
|
+
message,
|
|
123
|
+
schema: metadata.schema ?? { type: 'object', properties: {} },
|
|
124
|
+
defaultValues: metadata.default_value
|
|
125
|
+
};
|
|
126
|
+
case 'review':
|
|
127
|
+
return {
|
|
128
|
+
message,
|
|
129
|
+
changes: metadata.changes ?? [],
|
|
130
|
+
acceptAllLabel: metadata.accept_all_label,
|
|
131
|
+
rejectAllLabel: metadata.reject_all_label,
|
|
132
|
+
submitLabel: metadata.submit_label
|
|
133
|
+
};
|
|
134
|
+
default:
|
|
135
|
+
return { message };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Default interrupt polling configuration
|
|
140
|
+
*/
|
|
141
|
+
export const defaultInterruptPollingConfig = {
|
|
142
|
+
enabled: false,
|
|
143
|
+
interval: 2000,
|
|
144
|
+
maxBackoff: 10000
|
|
145
|
+
};
|