@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,515 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playground Store
|
|
3
|
+
*
|
|
4
|
+
* Svelte 5 rune-based state for managing playground state including sessions,
|
|
5
|
+
* messages, and execution status.
|
|
6
|
+
*
|
|
7
|
+
* @module stores/playgroundStore
|
|
8
|
+
*/
|
|
9
|
+
import { isChatInputNode, defaultIsTerminalStatus } from '../types/playground.js';
|
|
10
|
+
import { logger } from '../utils/logger.js';
|
|
11
|
+
// =========================================================================
|
|
12
|
+
// Core State
|
|
13
|
+
// =========================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Currently active playground session
|
|
16
|
+
*/
|
|
17
|
+
let _currentSession = $state(null);
|
|
18
|
+
/**
|
|
19
|
+
* List of all sessions for the current workflow
|
|
20
|
+
*/
|
|
21
|
+
let _sessions = $state([]);
|
|
22
|
+
/**
|
|
23
|
+
* Messages in the current session
|
|
24
|
+
*/
|
|
25
|
+
let _messages = $state([]);
|
|
26
|
+
/**
|
|
27
|
+
* Whether an execution is currently running
|
|
28
|
+
*/
|
|
29
|
+
let _isExecuting = $state(false);
|
|
30
|
+
/**
|
|
31
|
+
* Whether we are currently loading data
|
|
32
|
+
*/
|
|
33
|
+
let _isLoading = $state(false);
|
|
34
|
+
/**
|
|
35
|
+
* Current error message, if any
|
|
36
|
+
*/
|
|
37
|
+
let _error = $state(null);
|
|
38
|
+
/**
|
|
39
|
+
* Current workflow being tested
|
|
40
|
+
*/
|
|
41
|
+
let _currentWorkflow = $state(null);
|
|
42
|
+
/**
|
|
43
|
+
* Last polling timestamp for incremental message fetching
|
|
44
|
+
*/
|
|
45
|
+
let _lastPollTimestamp = $state(null);
|
|
46
|
+
// =========================================================================
|
|
47
|
+
// Getter Functions (for reactive access in components)
|
|
48
|
+
// =========================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Get the current session
|
|
51
|
+
*/
|
|
52
|
+
export function getCurrentSession() {
|
|
53
|
+
return _currentSession;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get all sessions
|
|
57
|
+
*/
|
|
58
|
+
export function getSessions() {
|
|
59
|
+
return _sessions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get all messages
|
|
63
|
+
*/
|
|
64
|
+
export function getMessages() {
|
|
65
|
+
return _messages;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get executing state
|
|
69
|
+
*/
|
|
70
|
+
export function getIsExecuting() {
|
|
71
|
+
return _isExecuting;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get loading state
|
|
75
|
+
*/
|
|
76
|
+
export function getIsLoading() {
|
|
77
|
+
return _isLoading;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get error state
|
|
81
|
+
*/
|
|
82
|
+
export function getError() {
|
|
83
|
+
return _error;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the current workflow
|
|
87
|
+
*/
|
|
88
|
+
export function getCurrentWorkflow() {
|
|
89
|
+
return _currentWorkflow;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the last poll timestamp
|
|
93
|
+
*/
|
|
94
|
+
export function getLastPollTimestamp() {
|
|
95
|
+
return _lastPollTimestamp;
|
|
96
|
+
}
|
|
97
|
+
// =========================================================================
|
|
98
|
+
// Derived Getters
|
|
99
|
+
// =========================================================================
|
|
100
|
+
/**
|
|
101
|
+
* Get current session status
|
|
102
|
+
*/
|
|
103
|
+
export function getSessionStatus() {
|
|
104
|
+
return _currentSession?.status ?? 'idle';
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get message count
|
|
108
|
+
*/
|
|
109
|
+
export function getMessageCount() {
|
|
110
|
+
return _messages.length;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get chat messages (excludes log messages)
|
|
114
|
+
*/
|
|
115
|
+
export function getChatMessages() {
|
|
116
|
+
return _messages.filter((m) => m.role !== 'log');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get log messages only
|
|
120
|
+
*/
|
|
121
|
+
export function getLogMessages() {
|
|
122
|
+
return _messages.filter((m) => m.role === 'log');
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the latest message
|
|
126
|
+
*/
|
|
127
|
+
export function getLatestMessage() {
|
|
128
|
+
return _messages.length > 0 ? _messages[_messages.length - 1] : null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get input fields from workflow input nodes
|
|
132
|
+
*
|
|
133
|
+
* Analyzes the workflow to extract input nodes and their configuration
|
|
134
|
+
* schemas for auto-generating input forms.
|
|
135
|
+
*/
|
|
136
|
+
export function getInputFields() {
|
|
137
|
+
const workflow = _currentWorkflow;
|
|
138
|
+
if (!workflow) {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
const fields = [];
|
|
142
|
+
// Find input nodes in the workflow
|
|
143
|
+
workflow.nodes.forEach((node) => {
|
|
144
|
+
const category = node.data.metadata?.category;
|
|
145
|
+
const nodeTypeId = node.data.metadata?.id ?? node.type;
|
|
146
|
+
// Check if this is an input-type node
|
|
147
|
+
// The category can be "inputs" (standard) or variations like "input"
|
|
148
|
+
const categoryStr = String(category || '');
|
|
149
|
+
const isInputCategory = categoryStr === 'inputs' || categoryStr === 'input';
|
|
150
|
+
if (isInputCategory || isChatInputNode(nodeTypeId)) {
|
|
151
|
+
// Get output ports that provide data
|
|
152
|
+
const outputs = node.data.metadata?.outputs ?? [];
|
|
153
|
+
outputs.forEach((output) => {
|
|
154
|
+
if (output.type === 'output') {
|
|
155
|
+
// Create a field for each output
|
|
156
|
+
const field = {
|
|
157
|
+
nodeId: node.id,
|
|
158
|
+
fieldId: output.id,
|
|
159
|
+
label: node.data.label || output.name || nodeTypeId,
|
|
160
|
+
type: output.dataType || 'string',
|
|
161
|
+
defaultValue: node.data.config?.[output.id],
|
|
162
|
+
required: output.required ?? false
|
|
163
|
+
};
|
|
164
|
+
// Check for schema in configSchema
|
|
165
|
+
const configSchema = node.data.metadata?.configSchema;
|
|
166
|
+
if (configSchema?.properties?.[output.id]) {
|
|
167
|
+
field.schema = configSchema.properties[output.id];
|
|
168
|
+
}
|
|
169
|
+
fields.push(field);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// If no outputs defined, create a default field based on node config
|
|
173
|
+
if (outputs.length === 0) {
|
|
174
|
+
const configSchema = node.data.metadata?.configSchema;
|
|
175
|
+
if (configSchema?.properties) {
|
|
176
|
+
Object.entries(configSchema.properties).forEach(([key, schema]) => {
|
|
177
|
+
const field = {
|
|
178
|
+
nodeId: node.id,
|
|
179
|
+
fieldId: key,
|
|
180
|
+
label: schema.title || key,
|
|
181
|
+
type: schema.type || 'string',
|
|
182
|
+
defaultValue: node.data.config?.[key] ?? schema.default,
|
|
183
|
+
required: configSchema.required?.includes(key) ?? false,
|
|
184
|
+
schema
|
|
185
|
+
};
|
|
186
|
+
fields.push(field);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return fields;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if workflow has a chat input
|
|
196
|
+
*/
|
|
197
|
+
export function getHasChatInput() {
|
|
198
|
+
const fields = getInputFields();
|
|
199
|
+
return fields.some((field) => isChatInputNode(field.nodeId) || field.type === 'string');
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get session count
|
|
203
|
+
*/
|
|
204
|
+
export function getSessionCount() {
|
|
205
|
+
return _sessions.length;
|
|
206
|
+
}
|
|
207
|
+
// =========================================================================
|
|
208
|
+
// Helper Functions
|
|
209
|
+
// =========================================================================
|
|
210
|
+
/**
|
|
211
|
+
* Sort messages chronologically by sequenceNumber
|
|
212
|
+
*
|
|
213
|
+
* All messages (user, assistant, log) have incrementing sequenceNumbers (1, 2, 3, ...).
|
|
214
|
+
* This provides a simple, reliable sort order for displaying messages.
|
|
215
|
+
*
|
|
216
|
+
* Sort order:
|
|
217
|
+
* 1. Primary: sequenceNumber (incrementing for all messages)
|
|
218
|
+
* 2. Secondary: timestamp (fallback for messages without sequenceNumber)
|
|
219
|
+
* 3. Tertiary: id as final tiebreaker
|
|
220
|
+
*
|
|
221
|
+
* @param messageList - Array of messages to sort
|
|
222
|
+
* @returns Sorted array of messages
|
|
223
|
+
*/
|
|
224
|
+
function sortMessagesChronologically(messageList) {
|
|
225
|
+
return [...messageList].sort((a, b) => {
|
|
226
|
+
// Primary: Sort by sequenceNumber
|
|
227
|
+
const seqA = a.sequenceNumber ?? 0;
|
|
228
|
+
const seqB = b.sequenceNumber ?? 0;
|
|
229
|
+
if (seqA !== seqB) {
|
|
230
|
+
return seqA - seqB;
|
|
231
|
+
}
|
|
232
|
+
// Secondary: Sort by timestamp for messages without sequenceNumber
|
|
233
|
+
const timestampCompare = a.timestamp.localeCompare(b.timestamp);
|
|
234
|
+
if (timestampCompare !== 0) {
|
|
235
|
+
return timestampCompare;
|
|
236
|
+
}
|
|
237
|
+
// Tertiary: Sort by ID as final tiebreaker
|
|
238
|
+
return a.id.localeCompare(b.id);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
// =========================================================================
|
|
242
|
+
// Actions
|
|
243
|
+
// =========================================================================
|
|
244
|
+
/**
|
|
245
|
+
* Playground store actions for modifying state
|
|
246
|
+
*/
|
|
247
|
+
export const playgroundActions = {
|
|
248
|
+
/**
|
|
249
|
+
* Set the current workflow
|
|
250
|
+
*
|
|
251
|
+
* @param workflow - The workflow to test
|
|
252
|
+
*/
|
|
253
|
+
setWorkflow: (workflow) => {
|
|
254
|
+
_currentWorkflow = workflow;
|
|
255
|
+
},
|
|
256
|
+
/**
|
|
257
|
+
* Set the current session
|
|
258
|
+
*
|
|
259
|
+
* @param session - The session to set as active
|
|
260
|
+
*/
|
|
261
|
+
setCurrentSession: (session) => {
|
|
262
|
+
_currentSession = session;
|
|
263
|
+
if (session) {
|
|
264
|
+
// Update session in the list
|
|
265
|
+
_sessions = _sessions.map((s) => (s.id === session.id ? session : s));
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
269
|
+
* Update session status
|
|
270
|
+
*
|
|
271
|
+
* @param status - The new status
|
|
272
|
+
*/
|
|
273
|
+
updateSessionStatus: (status) => {
|
|
274
|
+
if (_currentSession) {
|
|
275
|
+
_currentSession = { ..._currentSession, status, updatedAt: new Date().toISOString() };
|
|
276
|
+
}
|
|
277
|
+
// Also update in sessions list
|
|
278
|
+
const session = _currentSession;
|
|
279
|
+
if (session) {
|
|
280
|
+
_sessions = _sessions.map((s) => (s.id === session.id ? { ...s, status } : s));
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
284
|
+
* Set the sessions list
|
|
285
|
+
*
|
|
286
|
+
* @param sessionList - Array of sessions
|
|
287
|
+
*/
|
|
288
|
+
setSessions: (sessionList) => {
|
|
289
|
+
_sessions = sessionList;
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* Add a new session to the list
|
|
293
|
+
*
|
|
294
|
+
* @param session - The session to add
|
|
295
|
+
*/
|
|
296
|
+
addSession: (session) => {
|
|
297
|
+
_sessions = [session, ..._sessions];
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* Remove a session from the list
|
|
301
|
+
*
|
|
302
|
+
* @param sessionId - The session ID to remove
|
|
303
|
+
*/
|
|
304
|
+
removeSession: (sessionId) => {
|
|
305
|
+
_sessions = _sessions.filter((s) => s.id !== sessionId);
|
|
306
|
+
// Clear current session if it was removed
|
|
307
|
+
if (_currentSession?.id === sessionId) {
|
|
308
|
+
_currentSession = null;
|
|
309
|
+
_messages = [];
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
/**
|
|
313
|
+
* Set messages for the current session
|
|
314
|
+
* Messages are automatically sorted chronologically
|
|
315
|
+
*
|
|
316
|
+
* @param messageList - Array of messages
|
|
317
|
+
*/
|
|
318
|
+
setMessages: (messageList) => {
|
|
319
|
+
_messages = sortMessagesChronologically(messageList);
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* Add a message to the current session
|
|
323
|
+
* Messages are automatically sorted chronologically after adding
|
|
324
|
+
*
|
|
325
|
+
* @param message - The message to add
|
|
326
|
+
*/
|
|
327
|
+
addMessage: (message) => {
|
|
328
|
+
_messages = sortMessagesChronologically([..._messages, message]);
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* Add multiple messages to the current session
|
|
332
|
+
* Messages are deduplicated and automatically sorted chronologically
|
|
333
|
+
*
|
|
334
|
+
* @param newMessages - Array of messages to add
|
|
335
|
+
*/
|
|
336
|
+
addMessages: (newMessages) => {
|
|
337
|
+
if (newMessages.length === 0)
|
|
338
|
+
return;
|
|
339
|
+
// Deduplicate by message ID
|
|
340
|
+
const existingIds = new Set(_messages.map((m) => m.id));
|
|
341
|
+
const uniqueNewMessages = newMessages.filter((m) => !existingIds.has(m.id));
|
|
342
|
+
// Sort the combined messages chronologically
|
|
343
|
+
_messages = sortMessagesChronologically([..._messages, ...uniqueNewMessages]);
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* Clear all messages
|
|
347
|
+
*/
|
|
348
|
+
clearMessages: () => {
|
|
349
|
+
_messages = [];
|
|
350
|
+
_lastPollTimestamp = null;
|
|
351
|
+
},
|
|
352
|
+
/**
|
|
353
|
+
* Set the executing state
|
|
354
|
+
*
|
|
355
|
+
* @param executing - Whether execution is in progress
|
|
356
|
+
*/
|
|
357
|
+
setExecuting: (executing) => {
|
|
358
|
+
_isExecuting = executing;
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* Set the loading state
|
|
362
|
+
*
|
|
363
|
+
* @param loading - Whether loading is in progress
|
|
364
|
+
*/
|
|
365
|
+
setLoading: (loading) => {
|
|
366
|
+
_isLoading = loading;
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* Set an error message
|
|
370
|
+
*
|
|
371
|
+
* @param errorMessage - The error message or null to clear
|
|
372
|
+
*/
|
|
373
|
+
setError: (errorMessage) => {
|
|
374
|
+
_error = errorMessage;
|
|
375
|
+
},
|
|
376
|
+
/**
|
|
377
|
+
* Update the last poll timestamp
|
|
378
|
+
*
|
|
379
|
+
* @param timestamp - ISO 8601 timestamp
|
|
380
|
+
*/
|
|
381
|
+
updateLastPollTimestamp: (timestamp) => {
|
|
382
|
+
_lastPollTimestamp = timestamp;
|
|
383
|
+
},
|
|
384
|
+
/**
|
|
385
|
+
* Reset all playground state
|
|
386
|
+
*/
|
|
387
|
+
reset: () => {
|
|
388
|
+
_currentSession = null;
|
|
389
|
+
_sessions = [];
|
|
390
|
+
_messages = [];
|
|
391
|
+
_isExecuting = false;
|
|
392
|
+
_isLoading = false;
|
|
393
|
+
_error = null;
|
|
394
|
+
_currentWorkflow = null;
|
|
395
|
+
_lastPollTimestamp = null;
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* Switch to a different session
|
|
399
|
+
*
|
|
400
|
+
* @param sessionId - The session ID to switch to
|
|
401
|
+
*/
|
|
402
|
+
switchSession: (sessionId) => {
|
|
403
|
+
const session = _sessions.find((s) => s.id === sessionId);
|
|
404
|
+
if (session) {
|
|
405
|
+
_currentSession = session;
|
|
406
|
+
_messages = [];
|
|
407
|
+
_lastPollTimestamp = null;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
// =========================================================================
|
|
412
|
+
// Polling Callback Factory
|
|
413
|
+
// =========================================================================
|
|
414
|
+
/**
|
|
415
|
+
* Create a polling callback that processes poll responses.
|
|
416
|
+
* This is the single source of truth for how poll responses update stores.
|
|
417
|
+
* Used by mount.ts, Playground.svelte, and refreshSessionMessages.
|
|
418
|
+
*
|
|
419
|
+
* @param isTerminalStatus - Function to determine if a status clears isExecuting (default: defaultIsTerminalStatus)
|
|
420
|
+
* @returns A callback suitable for playgroundService.startPolling() or pushMessages()
|
|
421
|
+
*/
|
|
422
|
+
export function createPollingCallback(isTerminalStatus = defaultIsTerminalStatus) {
|
|
423
|
+
return (response) => {
|
|
424
|
+
if (response.data && response.data.length > 0) {
|
|
425
|
+
playgroundActions.addMessages(response.data);
|
|
426
|
+
}
|
|
427
|
+
if (response.sessionStatus) {
|
|
428
|
+
playgroundActions.updateSessionStatus(response.sessionStatus);
|
|
429
|
+
if (isTerminalStatus(response.sessionStatus)) {
|
|
430
|
+
playgroundActions.setExecuting(false);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
// =========================================================================
|
|
436
|
+
// Utilities
|
|
437
|
+
// =========================================================================
|
|
438
|
+
/**
|
|
439
|
+
* Get the current session ID
|
|
440
|
+
*
|
|
441
|
+
* @returns The current session ID or null
|
|
442
|
+
*/
|
|
443
|
+
export function getCurrentSessionId() {
|
|
444
|
+
return _currentSession?.id ?? null;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Check if a specific session is selected
|
|
448
|
+
*
|
|
449
|
+
* @param sessionId - The session ID to check
|
|
450
|
+
* @returns True if the session is currently selected
|
|
451
|
+
*/
|
|
452
|
+
export function isSessionSelected(sessionId) {
|
|
453
|
+
return _currentSession?.id === sessionId;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Get all messages as a snapshot
|
|
457
|
+
*
|
|
458
|
+
* @returns Array of all messages
|
|
459
|
+
*/
|
|
460
|
+
export function getMessagesSnapshot() {
|
|
461
|
+
return _messages;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Get the latest message timestamp for polling
|
|
465
|
+
*
|
|
466
|
+
* @returns ISO 8601 timestamp of the latest message, or null
|
|
467
|
+
*/
|
|
468
|
+
export function getLatestMessageTimestamp() {
|
|
469
|
+
if (_messages.length === 0)
|
|
470
|
+
return null;
|
|
471
|
+
return _messages[_messages.length - 1].timestamp;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Subscribe to session status changes using $effect.root.
|
|
475
|
+
* This is designed for use in non-component contexts (e.g., mount.ts).
|
|
476
|
+
*
|
|
477
|
+
* @param callback - Called when session status changes
|
|
478
|
+
* @returns Cleanup function to stop the subscription
|
|
479
|
+
*/
|
|
480
|
+
export function subscribeToSessionStatus(callback) {
|
|
481
|
+
let previousStatus = getSessionStatus();
|
|
482
|
+
const cleanup = $effect.root(() => {
|
|
483
|
+
$effect(() => {
|
|
484
|
+
const status = getSessionStatus();
|
|
485
|
+
if (status !== previousStatus) {
|
|
486
|
+
callback(status, previousStatus);
|
|
487
|
+
previousStatus = status;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
return cleanup;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Refresh messages for the current session
|
|
495
|
+
*
|
|
496
|
+
* This function is useful after interrupt resolution when polling
|
|
497
|
+
* has stopped but new messages may exist on the server.
|
|
498
|
+
*
|
|
499
|
+
* @param fetchMessages - Async function to fetch messages from the API
|
|
500
|
+
* @param isTerminalStatus - Optional override for terminal status check
|
|
501
|
+
* @returns Promise that resolves when messages are refreshed
|
|
502
|
+
*/
|
|
503
|
+
export async function refreshSessionMessages(fetchMessages, isTerminalStatus) {
|
|
504
|
+
const session = _currentSession;
|
|
505
|
+
if (!session)
|
|
506
|
+
return;
|
|
507
|
+
try {
|
|
508
|
+
const response = await fetchMessages(session.id);
|
|
509
|
+
const callback = createPollingCallback(isTerminalStatus);
|
|
510
|
+
callback(response);
|
|
511
|
+
}
|
|
512
|
+
catch (err) {
|
|
513
|
+
logger.error('[playgroundStore] Failed to refresh messages:', err);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port Coordinate Store (Svelte 5 Runes)
|
|
3
|
+
*
|
|
4
|
+
* General-purpose store that maintains absolute canvas-space coordinates
|
|
5
|
+
* for all port handles in the workflow. Built from SvelteFlow's internal
|
|
6
|
+
* handle bounds data combined with FlowDrop port metadata.
|
|
7
|
+
*
|
|
8
|
+
* Primary consumers:
|
|
9
|
+
* - Proximity connect (port-to-port distance instead of node center distance)
|
|
10
|
+
*
|
|
11
|
+
* Coordinates are derived from SvelteFlow's InternalNode.internals.handleBounds
|
|
12
|
+
* which SvelteFlow already maintains for all node types. This avoids replicating
|
|
13
|
+
* CSS positioning logic and stays automatically accurate.
|
|
14
|
+
*/
|
|
15
|
+
import type { WorkflowNode as WorkflowNodeType, PortCoordinate, PortCoordinateMap } from '../types/index.js';
|
|
16
|
+
import type { InternalNode } from '@xyflow/svelte';
|
|
17
|
+
/**
|
|
18
|
+
* Rebuild coordinates for ALL nodes from SvelteFlow internals.
|
|
19
|
+
* Call on initial workflow load (after render) and after bulk changes.
|
|
20
|
+
*
|
|
21
|
+
* @param nodes - All workflow nodes
|
|
22
|
+
* @param getInternalNode - SvelteFlow's getInternalNode function
|
|
23
|
+
*/
|
|
24
|
+
export declare function rebuildAllPortCoordinates(nodes: WorkflowNodeType[], getInternalNode: (id: string) => InternalNode | undefined): void;
|
|
25
|
+
/**
|
|
26
|
+
* Update coordinates for a single node (efficient for drag updates).
|
|
27
|
+
* Only recomputes ports for the specified node.
|
|
28
|
+
*
|
|
29
|
+
* @param node - The workflow node to update
|
|
30
|
+
* @param getInternalNode - SvelteFlow's getInternalNode function
|
|
31
|
+
*/
|
|
32
|
+
export declare function updateNodePortCoordinates(node: WorkflowNodeType, getInternalNode: (id: string) => InternalNode | undefined): void;
|
|
33
|
+
/**
|
|
34
|
+
* Remove all coordinates for a node (on node delete).
|
|
35
|
+
*
|
|
36
|
+
* @param nodeId - ID of the node to remove
|
|
37
|
+
*/
|
|
38
|
+
export declare function removeNodePortCoordinates(nodeId: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Get coordinates for a specific handle.
|
|
41
|
+
*
|
|
42
|
+
* @param handleId - The handle ID to look up
|
|
43
|
+
* @returns The port coordinate or undefined if not found
|
|
44
|
+
*/
|
|
45
|
+
export declare function getPortCoordinate(handleId: string): PortCoordinate | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get all coordinates for a specific node.
|
|
48
|
+
*
|
|
49
|
+
* @param nodeId - The node ID to look up
|
|
50
|
+
* @returns Array of port coordinates for the node
|
|
51
|
+
*/
|
|
52
|
+
export declare function getNodePortCoordinates(nodeId: string): PortCoordinate[];
|
|
53
|
+
/**
|
|
54
|
+
* Get the current snapshot of all port coordinates.
|
|
55
|
+
* Returns the reactive SvelteMap directly.
|
|
56
|
+
*
|
|
57
|
+
* @returns Current port coordinate map
|
|
58
|
+
*/
|
|
59
|
+
export declare function getPortCoordinateSnapshot(): PortCoordinateMap;
|
|
60
|
+
/**
|
|
61
|
+
* Get the reactive port coordinates state.
|
|
62
|
+
* Useful for components that need to reactively read the coordinates.
|
|
63
|
+
*
|
|
64
|
+
* @returns The reactive port coordinate map
|
|
65
|
+
*/
|
|
66
|
+
export declare function getPortCoordinates(): PortCoordinateMap;
|