@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NodeMetadata } from '../../types/index.js';
|
|
2
|
+
import type { UIAction } from '../../commands/types.js';
|
|
3
|
+
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
4
|
+
interface Props {
|
|
5
|
+
nodeTypes: NodeMetadata[];
|
|
6
|
+
workflowId?: string;
|
|
7
|
+
onUIAction?: (action: UIAction) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
endpointConfig?: EndpointConfig | null;
|
|
10
|
+
}
|
|
11
|
+
declare const AIChatPanel: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type AIChatPanel = ReturnType<typeof AIChatPanel>;
|
|
13
|
+
export default AIChatPanel;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CommandPreviewItem } from '../../types/chat.js';
|
|
3
|
+
import Icon from '@iconify/svelte';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
commands: CommandPreviewItem[];
|
|
7
|
+
onApprove: () => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { commands, onApprove, onCancel }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const hasPending = $derived(commands.some((c) => c.status === 'pending'));
|
|
14
|
+
const isExecuting = $derived(commands.some((c) => c.status === 'executing'));
|
|
15
|
+
|
|
16
|
+
let resolvedAction: 'applied' | 'cancelled' | null = $state(null);
|
|
17
|
+
|
|
18
|
+
function handleApprove() {
|
|
19
|
+
resolvedAction = 'applied';
|
|
20
|
+
onApprove();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function handleCancel() {
|
|
24
|
+
resolvedAction = 'cancelled';
|
|
25
|
+
onCancel();
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div class="command-preview" role="region" aria-label="Command preview">
|
|
30
|
+
<div class="command-preview__list">
|
|
31
|
+
{#each commands as command, i}
|
|
32
|
+
<div class="command-preview__item command-preview__item--{command.status}">
|
|
33
|
+
<span class="command-preview__status">
|
|
34
|
+
{#if command.status === 'pending'}
|
|
35
|
+
<Icon icon="mdi:chevron-right" />
|
|
36
|
+
{:else if command.status === 'executing'}
|
|
37
|
+
<Icon icon="mdi:loading" />
|
|
38
|
+
{:else if command.status === 'success'}
|
|
39
|
+
<Icon icon="mdi:check-circle" />
|
|
40
|
+
{:else if command.status === 'error'}
|
|
41
|
+
<Icon icon="mdi:alert-circle" />
|
|
42
|
+
{/if}
|
|
43
|
+
</span>
|
|
44
|
+
<pre class="command-preview__command">{command.raw}</pre>
|
|
45
|
+
{#if command.status === 'error' && command.result}
|
|
46
|
+
<span class="command-preview__error">{command.result}</span>
|
|
47
|
+
{/if}
|
|
48
|
+
</div>
|
|
49
|
+
{/each}
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="command-preview__actions">
|
|
53
|
+
{#if resolvedAction === 'applied'}
|
|
54
|
+
<span class="command-preview__resolved command-preview__resolved--applied">
|
|
55
|
+
{#if isExecuting}
|
|
56
|
+
<Icon icon="mdi:loading" />
|
|
57
|
+
Applying…
|
|
58
|
+
{:else}
|
|
59
|
+
<Icon icon="mdi:check-all" />
|
|
60
|
+
Applied
|
|
61
|
+
{/if}
|
|
62
|
+
</span>
|
|
63
|
+
{:else if resolvedAction === 'cancelled'}
|
|
64
|
+
<span class="command-preview__resolved command-preview__resolved--cancelled">
|
|
65
|
+
<Icon icon="mdi:close" />
|
|
66
|
+
Dismissed
|
|
67
|
+
</span>
|
|
68
|
+
{:else}
|
|
69
|
+
<button
|
|
70
|
+
class="command-preview__btn command-preview__btn--approve"
|
|
71
|
+
onclick={handleApprove}
|
|
72
|
+
disabled={!hasPending || isExecuting}
|
|
73
|
+
>
|
|
74
|
+
<Icon icon="mdi:check-all" />
|
|
75
|
+
Apply All
|
|
76
|
+
</button>
|
|
77
|
+
<button
|
|
78
|
+
class="command-preview__btn command-preview__btn--cancel"
|
|
79
|
+
onclick={handleCancel}
|
|
80
|
+
disabled={isExecuting}
|
|
81
|
+
>
|
|
82
|
+
Cancel
|
|
83
|
+
</button>
|
|
84
|
+
{/if}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<style>
|
|
89
|
+
.command-preview {
|
|
90
|
+
border: 1px solid var(--fd-border);
|
|
91
|
+
border-radius: var(--fd-radius-md);
|
|
92
|
+
background: var(--fd-card);
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.command-preview__list {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
padding: var(--fd-space-xs);
|
|
100
|
+
gap: var(--fd-space-3xs);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.command-preview__item {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: flex-start;
|
|
106
|
+
gap: var(--fd-space-2xs);
|
|
107
|
+
padding: var(--fd-space-3xs) var(--fd-space-xs);
|
|
108
|
+
border-radius: var(--fd-radius-sm);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.command-preview__status {
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
font-size: var(--fd-text-xs);
|
|
116
|
+
/* align icon with the first line of the pre block */
|
|
117
|
+
margin-top: 1px;
|
|
118
|
+
line-height: 1.5;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.command-preview__item--pending .command-preview__status {
|
|
122
|
+
color: var(--fd-muted-foreground);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.command-preview__item--executing .command-preview__status {
|
|
126
|
+
color: var(--fd-info);
|
|
127
|
+
animation: spin 1s linear infinite;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.command-preview__item--success .command-preview__status {
|
|
131
|
+
color: var(--fd-success);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.command-preview__item--error .command-preview__status {
|
|
135
|
+
color: var(--fd-error);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes spin {
|
|
139
|
+
from {
|
|
140
|
+
transform: rotate(0deg);
|
|
141
|
+
}
|
|
142
|
+
to {
|
|
143
|
+
transform: rotate(360deg);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.command-preview__command {
|
|
148
|
+
font-family: var(--fd-font-mono);
|
|
149
|
+
font-size: var(--fd-text-xs);
|
|
150
|
+
line-height: 1.5;
|
|
151
|
+
color: var(--fd-foreground);
|
|
152
|
+
white-space: pre-wrap;
|
|
153
|
+
word-break: break-word;
|
|
154
|
+
margin: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.command-preview__item--error .command-preview__command {
|
|
158
|
+
color: var(--fd-error);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.command-preview__error {
|
|
162
|
+
display: block;
|
|
163
|
+
font-size: var(--fd-text-xs);
|
|
164
|
+
color: var(--fd-error);
|
|
165
|
+
margin-top: var(--fd-space-3xs);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.command-preview__actions {
|
|
169
|
+
display: flex;
|
|
170
|
+
gap: var(--fd-space-xs);
|
|
171
|
+
padding: var(--fd-space-xs);
|
|
172
|
+
border-top: 1px solid var(--fd-border);
|
|
173
|
+
background: var(--fd-muted);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.command-preview__btn {
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: var(--fd-space-3xs);
|
|
180
|
+
padding: var(--fd-space-3xs) var(--fd-space-sm);
|
|
181
|
+
border: none;
|
|
182
|
+
border-radius: var(--fd-radius-sm);
|
|
183
|
+
font-size: var(--fd-text-xs);
|
|
184
|
+
font-weight: 600;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
transition:
|
|
187
|
+
background-color var(--fd-transition-fast),
|
|
188
|
+
color var(--fd-transition-fast);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.command-preview__btn:disabled {
|
|
192
|
+
opacity: 0.5;
|
|
193
|
+
cursor: not-allowed;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.command-preview__btn--approve {
|
|
197
|
+
background: var(--fd-primary);
|
|
198
|
+
color: var(--fd-primary-foreground);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.command-preview__btn--approve:hover:not(:disabled) {
|
|
202
|
+
background: var(--fd-primary-hover);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.command-preview__btn--cancel {
|
|
206
|
+
background: var(--fd-secondary);
|
|
207
|
+
color: var(--fd-secondary-foreground);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.command-preview__btn--cancel:hover:not(:disabled) {
|
|
211
|
+
background: var(--fd-secondary-hover);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.command-preview__resolved {
|
|
215
|
+
display: inline-flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: var(--fd-space-3xs);
|
|
218
|
+
font-size: var(--fd-text-xs);
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
padding: var(--fd-space-3xs) var(--fd-space-xs);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.command-preview__resolved--applied {
|
|
224
|
+
color: var(--fd-success);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.command-preview__resolved--applied :global(svg.iconify[data-icon='mdi:loading']) {
|
|
228
|
+
animation: spin 1s linear infinite;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.command-preview__resolved--cancelled {
|
|
232
|
+
color: var(--fd-muted-foreground);
|
|
233
|
+
}
|
|
234
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandPreviewItem } from '../../types/chat.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
commands: CommandPreviewItem[];
|
|
4
|
+
onApprove: () => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const CommandPreview: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CommandPreview = ReturnType<typeof CommandPreview>;
|
|
9
|
+
export default CommandPreview;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import CommandConsole from './CommandConsole.svelte';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
|
|
6
|
+
const mockNodeTypes = [
|
|
7
|
+
{
|
|
8
|
+
id: 'llm_chat',
|
|
9
|
+
name: 'LLM Chat',
|
|
10
|
+
description: 'Chat completion using an LLM provider',
|
|
11
|
+
category: 'AI',
|
|
12
|
+
version: '1.0.0',
|
|
13
|
+
inputs: [
|
|
14
|
+
{ id: 'prompt', name: 'Prompt', type: 'input', dataType: 'string' },
|
|
15
|
+
{ id: 'context', name: 'Context', type: 'input', dataType: 'string' }
|
|
16
|
+
],
|
|
17
|
+
outputs: [
|
|
18
|
+
{
|
|
19
|
+
id: 'response',
|
|
20
|
+
name: 'Response',
|
|
21
|
+
type: 'output',
|
|
22
|
+
dataType: 'string'
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
configSchema: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
model: { type: 'string', default: 'gpt-4' },
|
|
29
|
+
temperature: { type: 'number', default: 0.7 },
|
|
30
|
+
maxTokens: { type: 'number', default: 1024 }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'http_request',
|
|
36
|
+
name: 'HTTP Request',
|
|
37
|
+
description: 'Send HTTP requests to external APIs',
|
|
38
|
+
category: 'Integration',
|
|
39
|
+
version: '1.0.0',
|
|
40
|
+
inputs: [
|
|
41
|
+
{ id: 'url', name: 'URL', type: 'input', dataType: 'string' },
|
|
42
|
+
{ id: 'body', name: 'Body', type: 'input', dataType: 'object' }
|
|
43
|
+
],
|
|
44
|
+
outputs: [
|
|
45
|
+
{
|
|
46
|
+
id: 'response',
|
|
47
|
+
name: 'Response',
|
|
48
|
+
type: 'output',
|
|
49
|
+
dataType: 'object'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'status',
|
|
53
|
+
name: 'Status Code',
|
|
54
|
+
type: 'output',
|
|
55
|
+
dataType: 'number'
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
configSchema: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
method: { type: 'string', default: 'GET' },
|
|
62
|
+
headers: { type: 'object', default: {} },
|
|
63
|
+
timeout: { type: 'number', default: 30000 }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'text_template',
|
|
69
|
+
name: 'Text Template',
|
|
70
|
+
description: 'Render text templates with variable substitution',
|
|
71
|
+
category: 'Transform',
|
|
72
|
+
version: '1.0.0',
|
|
73
|
+
inputs: [
|
|
74
|
+
{
|
|
75
|
+
id: 'variables',
|
|
76
|
+
name: 'Variables',
|
|
77
|
+
type: 'input',
|
|
78
|
+
dataType: 'object'
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
outputs: [{ id: 'text', name: 'Text', type: 'output', dataType: 'string' }],
|
|
82
|
+
configSchema: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
template: { type: 'string', default: '' },
|
|
86
|
+
delimiter: { type: 'string', default: '{{' }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
const { Story } = defineMeta({
|
|
93
|
+
title: 'Editor/CommandConsole',
|
|
94
|
+
component: CommandConsole,
|
|
95
|
+
tags: ['autodocs'],
|
|
96
|
+
parameters: {
|
|
97
|
+
layout: 'padded'
|
|
98
|
+
},
|
|
99
|
+
args: {
|
|
100
|
+
nodeTypes: mockNodeTypes,
|
|
101
|
+
onUIAction: fn()
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<Story
|
|
107
|
+
name="Default"
|
|
108
|
+
args={{
|
|
109
|
+
nodeTypes: mockNodeTypes
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default CommandConsole;
|
|
2
|
+
type CommandConsole = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const CommandConsole: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import CommandConsole from './CommandConsole.svelte';
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
CommandConsole Component
|
|
3
|
+
Bottom-panel REPL shell for the FlowDrop Command DSL
|
|
4
|
+
Styled with BEM syntax matching ConfigPanel pattern
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import type { NodeMetadata } from '../../types/index.js';
|
|
9
|
+
import {
|
|
10
|
+
parseCommand,
|
|
11
|
+
executeCommand,
|
|
12
|
+
executeBatch,
|
|
13
|
+
type UIAction,
|
|
14
|
+
type CommandContext,
|
|
15
|
+
type CommandResultOk,
|
|
16
|
+
type ListNodesResultData,
|
|
17
|
+
type ListEdgesResultData,
|
|
18
|
+
type ListTypesResultData,
|
|
19
|
+
type InfoResultData,
|
|
20
|
+
type HelpResultData
|
|
21
|
+
} from '../../commands/index.js';
|
|
22
|
+
import { createStoreCommandContext } from '../../commands/storeIntegration.svelte.js';
|
|
23
|
+
import { updateSettings, getUiSettings } from '../../stores/settingsStore.svelte.js';
|
|
24
|
+
import ConsoleInput from './ConsoleInput.svelte';
|
|
25
|
+
import ConsoleOutput, { type ConsoleEntry } from './ConsoleOutput.svelte';
|
|
26
|
+
import {
|
|
27
|
+
formatListNodes,
|
|
28
|
+
formatListEdges,
|
|
29
|
+
formatListTypes,
|
|
30
|
+
formatInfo,
|
|
31
|
+
formatHelp
|
|
32
|
+
} from './formatters.js';
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
/** Available node types for command execution */
|
|
36
|
+
nodeTypes: NodeMetadata[];
|
|
37
|
+
/** Callback for UI actions (open config, select node) */
|
|
38
|
+
onUIAction?: (action: UIAction) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let { nodeTypes, onUIAction }: Props = $props();
|
|
42
|
+
|
|
43
|
+
let outputEntries: ConsoleEntry[] = $state([]);
|
|
44
|
+
let commandContext: CommandContext | null = $state(null);
|
|
45
|
+
|
|
46
|
+
// Recreate context when nodeTypes changes
|
|
47
|
+
$effect(() => {
|
|
48
|
+
commandContext = createStoreCommandContext(nodeTypes, onUIAction);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Attempts to format CommandResult data into a rich display string.
|
|
53
|
+
* Returns null if the result has no formattable data.
|
|
54
|
+
*/
|
|
55
|
+
function formatResultData(commandType: string, result: CommandResultOk): string | null {
|
|
56
|
+
if (!result.data) return null;
|
|
57
|
+
|
|
58
|
+
switch (commandType) {
|
|
59
|
+
case 'list_nodes':
|
|
60
|
+
return formatListNodes(result.data as ListNodesResultData);
|
|
61
|
+
case 'list_edges':
|
|
62
|
+
return formatListEdges(result.data as ListEdgesResultData);
|
|
63
|
+
case 'list_types':
|
|
64
|
+
return formatListTypes(result.data as ListTypesResultData);
|
|
65
|
+
case 'info':
|
|
66
|
+
return formatInfo(result.data as InfoResultData);
|
|
67
|
+
case 'help':
|
|
68
|
+
return formatHelp(result.data as HelpResultData);
|
|
69
|
+
default:
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function closeConsole() {
|
|
75
|
+
updateSettings({ ui: { consoleOpen: false } });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function handleCommandSubmit(value: string) {
|
|
79
|
+
const trimmed = value.trim();
|
|
80
|
+
if (!trimmed) return;
|
|
81
|
+
|
|
82
|
+
// Add the input entry to the output
|
|
83
|
+
outputEntries.push({ type: 'input', text: trimmed });
|
|
84
|
+
|
|
85
|
+
// Handle cls command (clear console output; use 'clear' to clear the canvas)
|
|
86
|
+
if (trimmed.toLowerCase() === 'cls') {
|
|
87
|
+
outputEntries = [];
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Parse the command
|
|
92
|
+
const parseResult = parseCommand(trimmed);
|
|
93
|
+
if (!parseResult.ok) {
|
|
94
|
+
outputEntries.push({ type: 'error', text: parseResult.error });
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Ensure we have a command context
|
|
99
|
+
if (!commandContext) {
|
|
100
|
+
outputEntries.push({ type: 'error', text: 'No workflow loaded' });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Execute the command
|
|
105
|
+
const result = executeCommand(parseResult.command, commandContext);
|
|
106
|
+
if (result.ok) {
|
|
107
|
+
const formatted = formatResultData(parseResult.command.type, result);
|
|
108
|
+
if (formatted) {
|
|
109
|
+
outputEntries.push({ type: 'formatted', text: formatted });
|
|
110
|
+
} else {
|
|
111
|
+
outputEntries.push({ type: 'success', text: result.message });
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
outputEntries.push({ type: 'error', text: result.error });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function handleBatchSubmit(lines: string[]) {
|
|
119
|
+
if (!commandContext) {
|
|
120
|
+
outputEntries.push({ type: 'error', text: 'No workflow loaded' });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const totalCount = lines.length;
|
|
125
|
+
|
|
126
|
+
// Parse all commands first
|
|
127
|
+
const parsed: {
|
|
128
|
+
line: string;
|
|
129
|
+
command?: import('../../commands/index.js').Command;
|
|
130
|
+
error?: string;
|
|
131
|
+
}[] = [];
|
|
132
|
+
for (const line of lines) {
|
|
133
|
+
outputEntries.push({ type: 'input', text: line });
|
|
134
|
+
|
|
135
|
+
if (line.toLowerCase() === 'cls') {
|
|
136
|
+
outputEntries = [];
|
|
137
|
+
parsed.length = 0;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const parseResult = parseCommand(line);
|
|
142
|
+
if (!parseResult.ok) {
|
|
143
|
+
outputEntries.push({ type: 'error', text: parseResult.error });
|
|
144
|
+
const succeeded = parsed.length;
|
|
145
|
+
outputEntries.push({
|
|
146
|
+
type: 'error',
|
|
147
|
+
text: `Batch failed at command ${succeeded + 1}/${totalCount}: parse error`
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
parsed.push({ line, command: parseResult.command });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (parsed.length === 0) return;
|
|
155
|
+
|
|
156
|
+
const commands = parsed.map((p) => p.command!);
|
|
157
|
+
const batchResult = executeBatch(commands, commandContext);
|
|
158
|
+
|
|
159
|
+
// Show individual results
|
|
160
|
+
for (let i = 0; i < batchResult.results.length; i++) {
|
|
161
|
+
const result = batchResult.results[i];
|
|
162
|
+
if (result.ok) {
|
|
163
|
+
const formatted = formatResultData(commands[i].type, result);
|
|
164
|
+
if (formatted) {
|
|
165
|
+
outputEntries.push({ type: 'formatted', text: formatted });
|
|
166
|
+
} else {
|
|
167
|
+
outputEntries.push({ type: 'success', text: result.message });
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
outputEntries.push({ type: 'error', text: result.error });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Show summary
|
|
175
|
+
if (batchResult.ok) {
|
|
176
|
+
outputEntries.push({
|
|
177
|
+
type: 'success',
|
|
178
|
+
text: `Batch: ${batchResult.completedCount}/${batchResult.totalCount} commands succeeded`
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
outputEntries.push({
|
|
182
|
+
type: 'error',
|
|
183
|
+
text: `Batch failed at command ${batchResult.completedCount + 1}/${batchResult.totalCount}: ${batchResult.error}`
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<div class="command-console" role="region" aria-label="Command Console">
|
|
190
|
+
<div class="command-console__header">
|
|
191
|
+
<h2 class="command-console__title">Console</h2>
|
|
192
|
+
<button
|
|
193
|
+
class="command-console__close"
|
|
194
|
+
onclick={closeConsole}
|
|
195
|
+
aria-label="Close console"
|
|
196
|
+
type="button"
|
|
197
|
+
>
|
|
198
|
+
×
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
<div class="command-console__content">
|
|
202
|
+
<ConsoleOutput entries={outputEntries} />
|
|
203
|
+
</div>
|
|
204
|
+
<ConsoleInput
|
|
205
|
+
open={getUiSettings().consoleOpen}
|
|
206
|
+
{nodeTypes}
|
|
207
|
+
onSubmit={handleCommandSubmit}
|
|
208
|
+
onBatchSubmit={handleBatchSubmit}
|
|
209
|
+
onClose={closeConsole}
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
<style>
|
|
214
|
+
.command-console {
|
|
215
|
+
height: 100%;
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
background-color: var(--fd-background);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.command-console__header {
|
|
222
|
+
display: flex;
|
|
223
|
+
justify-content: space-between;
|
|
224
|
+
align-items: center;
|
|
225
|
+
padding: 0.5rem 1rem;
|
|
226
|
+
border-bottom: 1px solid var(--fd-border);
|
|
227
|
+
background-color: var(--fd-muted);
|
|
228
|
+
flex-shrink: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.command-console__title {
|
|
232
|
+
margin: 0;
|
|
233
|
+
font-size: 0.875rem;
|
|
234
|
+
font-weight: 600;
|
|
235
|
+
color: var(--fd-foreground);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.command-console__close {
|
|
239
|
+
background: none;
|
|
240
|
+
border: none;
|
|
241
|
+
font-size: 1.25rem;
|
|
242
|
+
line-height: 1;
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
color: var(--fd-muted-foreground);
|
|
245
|
+
padding: 0.25rem;
|
|
246
|
+
border-radius: var(--fd-radius-sm);
|
|
247
|
+
transition:
|
|
248
|
+
color var(--fd-transition-fast),
|
|
249
|
+
background-color var(--fd-transition-fast);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.command-console__close:hover {
|
|
253
|
+
color: var(--fd-foreground);
|
|
254
|
+
background-color: var(--fd-subtle);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.command-console__content {
|
|
258
|
+
flex: 1;
|
|
259
|
+
overflow: hidden;
|
|
260
|
+
display: flex;
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
}
|
|
263
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodeMetadata } from '../../types/index.js';
|
|
2
|
+
import { type UIAction } from '../../commands/index.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Available node types for command execution */
|
|
5
|
+
nodeTypes: NodeMetadata[];
|
|
6
|
+
/** Callback for UI actions (open config, select node) */
|
|
7
|
+
onUIAction?: (action: UIAction) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const CommandConsole: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type CommandConsole = ReturnType<typeof CommandConsole>;
|
|
11
|
+
export default CommandConsole;
|