@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,797 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ChatHistoryMessage, ChatRequest, CommandPreviewItem } from '../../types/chat.js';
|
|
3
|
+
import type { NodeMetadata } from '../../types/index.js';
|
|
4
|
+
import type { UIAction } from '../../commands/types.js';
|
|
5
|
+
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
6
|
+
import { chatService } from '../../services/chatService.js';
|
|
7
|
+
import { getWorkflowStore } from '../../stores/workflowStore.svelte.js';
|
|
8
|
+
import { getBehaviorSettings } from '../../stores/settingsStore.svelte.js';
|
|
9
|
+
import { extractCommands } from '../../chat/responseParser.js';
|
|
10
|
+
import { isMutatingCommand } from '../../chat/commandClassifier.js';
|
|
11
|
+
import { parseCommand } from '../../commands/parser.js';
|
|
12
|
+
import { executeCommand } from '../../commands/index.js';
|
|
13
|
+
import { createStoreCommandContext } from '../../commands/storeIntegration.svelte.js';
|
|
14
|
+
import CommandPreview from './CommandPreview.svelte';
|
|
15
|
+
import MarkdownDisplay from '../MarkdownDisplay.svelte';
|
|
16
|
+
import { tick } from 'svelte';
|
|
17
|
+
import Icon from '@iconify/svelte';
|
|
18
|
+
|
|
19
|
+
// =========================================================================
|
|
20
|
+
// Internal Display Message Type
|
|
21
|
+
// =========================================================================
|
|
22
|
+
|
|
23
|
+
interface DisplayMessage {
|
|
24
|
+
role: 'user' | 'assistant';
|
|
25
|
+
content: string;
|
|
26
|
+
/** Set on auto-retry messages — renders as a muted notice, not a user bubble */
|
|
27
|
+
retryAttempt?: number;
|
|
28
|
+
/** Mutating commands awaiting approval */
|
|
29
|
+
commandPreview?: CommandPreviewItem[];
|
|
30
|
+
/** Results from auto-executed read-only commands */
|
|
31
|
+
readOnlyResults?: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
nodeTypes: NodeMetadata[];
|
|
36
|
+
workflowId?: string;
|
|
37
|
+
onUIAction?: (action: UIAction) => void;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
endpointConfig?: EndpointConfig | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let { nodeTypes, workflowId, onUIAction, placeholder, endpointConfig }: Props = $props();
|
|
43
|
+
|
|
44
|
+
// =========================================================================
|
|
45
|
+
// State
|
|
46
|
+
// =========================================================================
|
|
47
|
+
|
|
48
|
+
const MAX_AUTO_RETRIES = 3;
|
|
49
|
+
|
|
50
|
+
let displayMessages: DisplayMessage[] = $state([]);
|
|
51
|
+
let inputValue: string = $state('');
|
|
52
|
+
let isLoading: boolean = $state(false);
|
|
53
|
+
let inputElement: HTMLTextAreaElement | undefined = $state();
|
|
54
|
+
let messagesElement: HTMLDivElement | undefined = $state();
|
|
55
|
+
let autoRetryCount = 0;
|
|
56
|
+
|
|
57
|
+
// =========================================================================
|
|
58
|
+
// Derived State
|
|
59
|
+
// =========================================================================
|
|
60
|
+
|
|
61
|
+
const isDisabled = $derived(!workflowId);
|
|
62
|
+
const isChatConfigured = $derived(endpointConfig?.endpoints?.chat !== undefined);
|
|
63
|
+
const canSend = $derived(
|
|
64
|
+
inputValue.trim().length > 0 && !isLoading && !isDisabled && isChatConfigured
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// =========================================================================
|
|
68
|
+
// Auto-scroll
|
|
69
|
+
// =========================================================================
|
|
70
|
+
|
|
71
|
+
$effect(() => {
|
|
72
|
+
displayMessages.length;
|
|
73
|
+
isLoading;
|
|
74
|
+
tick().then(() => {
|
|
75
|
+
if (messagesElement) {
|
|
76
|
+
messagesElement.scrollTop = messagesElement.scrollHeight;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// =========================================================================
|
|
82
|
+
// Helpers
|
|
83
|
+
// =========================================================================
|
|
84
|
+
|
|
85
|
+
/** Build conversation history from display messages for API requests */
|
|
86
|
+
function getHistory(): ChatHistoryMessage[] {
|
|
87
|
+
return displayMessages.map((m) => ({ role: m.role, content: m.content }));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getWorkflowState(): unknown {
|
|
91
|
+
const workflow = getWorkflowStore();
|
|
92
|
+
if (!workflow) return null;
|
|
93
|
+
return {
|
|
94
|
+
nodes: workflow.nodes.map((n) => ({
|
|
95
|
+
id: n.id,
|
|
96
|
+
type: n.type,
|
|
97
|
+
data: n.data,
|
|
98
|
+
position: n.position
|
|
99
|
+
})),
|
|
100
|
+
edges: workflow.edges.map((e) => ({
|
|
101
|
+
id: e.id,
|
|
102
|
+
source: e.source,
|
|
103
|
+
sourceHandle: e.sourceHandle,
|
|
104
|
+
target: e.target,
|
|
105
|
+
targetHandle: e.targetHandle
|
|
106
|
+
}))
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getCommandContext() {
|
|
111
|
+
return createStoreCommandContext(nodeTypes, onUIAction);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// =========================================================================
|
|
115
|
+
// Command Execution
|
|
116
|
+
// =========================================================================
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Process an LLM response: extract commands, auto-execute read-only ones,
|
|
120
|
+
* and queue mutating ones for approval via CommandPreview.
|
|
121
|
+
*/
|
|
122
|
+
function processResponse(responseContent: string): DisplayMessage {
|
|
123
|
+
const { explanation, commands } = extractCommands(responseContent);
|
|
124
|
+
|
|
125
|
+
// No commands — pure chat message
|
|
126
|
+
if (commands.length === 0) {
|
|
127
|
+
return { role: 'assistant', content: explanation || responseContent };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const context = getCommandContext();
|
|
131
|
+
const readOnlyResults: string[] = [];
|
|
132
|
+
const mutatingCommands: CommandPreviewItem[] = [];
|
|
133
|
+
|
|
134
|
+
for (const raw of commands) {
|
|
135
|
+
const parsed = parseCommand(raw);
|
|
136
|
+
if (!parsed.ok) {
|
|
137
|
+
// Treat parse errors as mutating (show in preview as error)
|
|
138
|
+
mutatingCommands.push({ raw, status: 'error', result: parsed.error });
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!isMutatingCommand(parsed.command.type)) {
|
|
143
|
+
// Auto-execute read-only commands
|
|
144
|
+
if (context) {
|
|
145
|
+
const result = executeCommand(parsed.command, context);
|
|
146
|
+
if (result.ok) {
|
|
147
|
+
readOnlyResults.push(`> ${raw}\n${result.message}`);
|
|
148
|
+
} else {
|
|
149
|
+
readOnlyResults.push(`> ${raw}\nError: ${result.error}`);
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
readOnlyResults.push(`> ${raw}\nError: No workflow loaded`);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
mutatingCommands.push({ raw, status: 'pending' });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const msg: DisplayMessage = {
|
|
160
|
+
role: 'assistant',
|
|
161
|
+
content: explanation || responseContent
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
if (readOnlyResults.length > 0) {
|
|
165
|
+
msg.readOnlyResults = readOnlyResults;
|
|
166
|
+
}
|
|
167
|
+
if (mutatingCommands.length > 0) {
|
|
168
|
+
msg.commandPreview = mutatingCommands;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return msg;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Execute all pending mutating commands one by one with progressive UI feedback */
|
|
175
|
+
async function handleApproveCommands(messageIndex: number) {
|
|
176
|
+
const msg = displayMessages[messageIndex];
|
|
177
|
+
if (!msg?.commandPreview) return;
|
|
178
|
+
|
|
179
|
+
const context = getCommandContext();
|
|
180
|
+
if (!context) {
|
|
181
|
+
for (const cmd of msg.commandPreview) {
|
|
182
|
+
if (cmd.status === 'pending') {
|
|
183
|
+
cmd.status = 'error';
|
|
184
|
+
cmd.result = 'No workflow loaded';
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
appendErrorToHistory('Command execution failed: No workflow loaded');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Parse all pending commands first, before touching any status
|
|
192
|
+
const pendingItems = msg.commandPreview.filter((c) => c.status === 'pending');
|
|
193
|
+
const parsedCommands: {
|
|
194
|
+
item: CommandPreviewItem;
|
|
195
|
+
command: import('../../commands/types.js').Command;
|
|
196
|
+
}[] = [];
|
|
197
|
+
|
|
198
|
+
for (const item of pendingItems) {
|
|
199
|
+
const parsed = parseCommand(item.raw);
|
|
200
|
+
if (!parsed.ok) {
|
|
201
|
+
item.status = 'error';
|
|
202
|
+
item.result = parsed.error;
|
|
203
|
+
appendErrorToHistory(`Command parse error for "${item.raw}": ${parsed.error}`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
parsedCommands.push({ item, command: parsed.command });
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Execute commands one by one inside a single transaction.
|
|
210
|
+
// A 100ms pause between commands lets the canvas visibly update at each step.
|
|
211
|
+
const totalCount = parsedCommands.length;
|
|
212
|
+
context.dispatch.startTransaction(
|
|
213
|
+
totalCount === 1 ? 'batch: 1 command' : `batch: ${totalCount} commands`
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
let completedCount = 0;
|
|
217
|
+
let batchError: string | undefined;
|
|
218
|
+
|
|
219
|
+
try {
|
|
220
|
+
for (let i = 0; i < parsedCommands.length; i++) {
|
|
221
|
+
const { item, command } = parsedCommands[i];
|
|
222
|
+
item.status = 'executing';
|
|
223
|
+
|
|
224
|
+
const result = executeCommand(command, context);
|
|
225
|
+
|
|
226
|
+
if (!result.ok) {
|
|
227
|
+
item.status = 'error';
|
|
228
|
+
item.result = result.error;
|
|
229
|
+
batchError = result.error;
|
|
230
|
+
context.dispatch.cancelTransaction();
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
item.status = 'success';
|
|
235
|
+
item.result = result.message;
|
|
236
|
+
completedCount++;
|
|
237
|
+
|
|
238
|
+
// Pause between commands so canvas updates are visibly distinct
|
|
239
|
+
if (i < parsedCommands.length - 1) {
|
|
240
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 100));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
} catch (err) {
|
|
244
|
+
context.dispatch.cancelTransaction();
|
|
245
|
+
for (const { item } of parsedCommands) {
|
|
246
|
+
if (item.status === 'executing') item.status = 'pending';
|
|
247
|
+
}
|
|
248
|
+
appendErrorToHistory(
|
|
249
|
+
`Unexpected execution error: ${err instanceof Error ? err.message : String(err)}`
|
|
250
|
+
);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (!batchError) {
|
|
255
|
+
context.dispatch.commitTransaction();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (getBehaviorSettings().chatAutoRetry && workflowId && autoRetryCount < MAX_AUTO_RETRIES) {
|
|
260
|
+
autoRetryCount++;
|
|
261
|
+
const errorText = buildBatchErrorMessage(
|
|
262
|
+
completedCount,
|
|
263
|
+
totalCount,
|
|
264
|
+
batchError,
|
|
265
|
+
pendingItems
|
|
266
|
+
);
|
|
267
|
+
await sendMessageInternal(errorText, autoRetryCount);
|
|
268
|
+
} else {
|
|
269
|
+
appendErrorToHistory(
|
|
270
|
+
`Command execution failed at command ${completedCount + 1}/${totalCount}: ${batchError}`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Dismiss a command preview without executing — CommandPreview shows its own cancelled state */
|
|
276
|
+
function handleCancelCommands(_messageIndex: number) {
|
|
277
|
+
// Intentionally empty: CommandPreview owns the "Dismissed" display via resolvedAction state
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** Append an error message to conversation history so the LLM can self-correct */
|
|
281
|
+
function appendErrorToHistory(errorMessage: string) {
|
|
282
|
+
displayMessages.push({
|
|
283
|
+
role: 'assistant',
|
|
284
|
+
content: `Error: ${errorMessage}`
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Build a structured error report from a failed batch for the LLM */
|
|
289
|
+
function buildBatchErrorMessage(
|
|
290
|
+
completedCount: number,
|
|
291
|
+
totalCount: number,
|
|
292
|
+
error: string,
|
|
293
|
+
items: CommandPreviewItem[]
|
|
294
|
+
): string {
|
|
295
|
+
const lines: string[] = [
|
|
296
|
+
`Batch execution failed at command ${completedCount + 1}/${totalCount}: ${error}`
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
if (completedCount > 0) {
|
|
300
|
+
lines.push('\nCommands that succeeded (rolled back):');
|
|
301
|
+
for (let i = 0; i < completedCount; i++) {
|
|
302
|
+
lines.push(` ${i + 1}. ${items[i].raw}`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
lines.push('\nFailed command:');
|
|
307
|
+
lines.push(` ${items[completedCount]?.raw ?? '(unknown)'}`);
|
|
308
|
+
|
|
309
|
+
const remaining = totalCount - completedCount - 1;
|
|
310
|
+
if (remaining > 0) {
|
|
311
|
+
lines.push(`\n${remaining} command(s) were skipped.`);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
lines.push('\nPlease provide corrected commands to achieve the same goal.');
|
|
315
|
+
return lines.join('\n');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// =========================================================================
|
|
319
|
+
// Message Handling
|
|
320
|
+
// =========================================================================
|
|
321
|
+
|
|
322
|
+
/** Core send logic — shared by manual sends and auto-retry */
|
|
323
|
+
async function sendMessageInternal(text: string, retryAttempt?: number) {
|
|
324
|
+
if (!text || isLoading || !workflowId) return;
|
|
325
|
+
|
|
326
|
+
displayMessages.push({ role: 'user', content: text, retryAttempt });
|
|
327
|
+
isLoading = true;
|
|
328
|
+
|
|
329
|
+
try {
|
|
330
|
+
const history = getHistory();
|
|
331
|
+
const request: ChatRequest = {
|
|
332
|
+
message: text,
|
|
333
|
+
workflowState: getWorkflowState(),
|
|
334
|
+
history: history.slice(0, -1) // all except current message
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const response = await chatService.sendMessage(workflowId, request);
|
|
338
|
+
const displayMsg = processResponse(response.content);
|
|
339
|
+
displayMessages.push(displayMsg);
|
|
340
|
+
} catch (err) {
|
|
341
|
+
const errorMessage = err instanceof Error ? err.message : 'Failed to send message';
|
|
342
|
+
displayMessages.push({
|
|
343
|
+
role: 'assistant',
|
|
344
|
+
content: `Error: ${errorMessage}`
|
|
345
|
+
});
|
|
346
|
+
} finally {
|
|
347
|
+
isLoading = false;
|
|
348
|
+
tick().then(() => inputElement?.focus());
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async function sendMessage() {
|
|
353
|
+
const text = inputValue.trim();
|
|
354
|
+
if (!text || isLoading || !workflowId) return;
|
|
355
|
+
inputValue = '';
|
|
356
|
+
autoRetryCount = 0;
|
|
357
|
+
await sendMessageInternal(text);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
361
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
362
|
+
event.preventDefault();
|
|
363
|
+
sendMessage();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
</script>
|
|
367
|
+
|
|
368
|
+
<div class="ai-chat-panel" role="region" aria-label="AI Chat">
|
|
369
|
+
{#if !isChatConfigured}
|
|
370
|
+
<!-- No backend configured -->
|
|
371
|
+
<div class="ai-chat-panel__notice">
|
|
372
|
+
<Icon icon="mdi:robot-off-outline" />
|
|
373
|
+
<span>AI Chat requires backend configuration</span>
|
|
374
|
+
</div>
|
|
375
|
+
{:else if isDisabled}
|
|
376
|
+
<!-- No workflow loaded -->
|
|
377
|
+
<div class="ai-chat-panel__notice">
|
|
378
|
+
<Icon icon="mdi:chat-sleep-outline" />
|
|
379
|
+
<span>Load a workflow to start chatting</span>
|
|
380
|
+
</div>
|
|
381
|
+
{:else}
|
|
382
|
+
<!-- Messages area -->
|
|
383
|
+
<div class="ai-chat-panel__messages" bind:this={messagesElement} role="log" aria-live="polite">
|
|
384
|
+
{#if displayMessages.length === 0}
|
|
385
|
+
<div class="ai-chat-panel__empty">
|
|
386
|
+
<Icon icon="mdi:chat-outline" />
|
|
387
|
+
<span>Ask the AI to help build your workflow</span>
|
|
388
|
+
</div>
|
|
389
|
+
{/if}
|
|
390
|
+
{#each displayMessages as message, msgIndex}
|
|
391
|
+
{#if message.retryAttempt !== undefined}
|
|
392
|
+
<div
|
|
393
|
+
class="ai-chat-panel__retry-notice"
|
|
394
|
+
class:ai-chat-panel__retry-notice--active={isLoading &&
|
|
395
|
+
msgIndex === displayMessages.length - 1}
|
|
396
|
+
>
|
|
397
|
+
<Icon icon="mdi:autorenew" />
|
|
398
|
+
<span>Auto-retrying (attempt {message.retryAttempt}/{MAX_AUTO_RETRIES})…</span>
|
|
399
|
+
</div>
|
|
400
|
+
{:else}
|
|
401
|
+
<div class="ai-chat-panel__bubble ai-chat-panel__bubble--{message.role}">
|
|
402
|
+
{#if message.role === 'user'}
|
|
403
|
+
<div class="ai-chat-panel__bubble-content">{message.content}</div>
|
|
404
|
+
{:else}
|
|
405
|
+
<div class="ai-chat-panel__bubble-content">
|
|
406
|
+
<MarkdownDisplay content={message.content} />
|
|
407
|
+
</div>
|
|
408
|
+
{/if}
|
|
409
|
+
{#if message.readOnlyResults && message.readOnlyResults.length > 0}
|
|
410
|
+
<div class="ai-chat-panel__readonly-results">
|
|
411
|
+
{#each message.readOnlyResults as result}
|
|
412
|
+
<pre class="ai-chat-panel__readonly-result">{result}</pre>
|
|
413
|
+
{/each}
|
|
414
|
+
</div>
|
|
415
|
+
{/if}
|
|
416
|
+
{#if message.commandPreview && message.commandPreview.length > 0}
|
|
417
|
+
<div class="ai-chat-panel__command-preview">
|
|
418
|
+
<CommandPreview
|
|
419
|
+
commands={message.commandPreview}
|
|
420
|
+
onApprove={() => handleApproveCommands(msgIndex)}
|
|
421
|
+
onCancel={() => handleCancelCommands(msgIndex)}
|
|
422
|
+
/>
|
|
423
|
+
</div>
|
|
424
|
+
{/if}
|
|
425
|
+
</div>
|
|
426
|
+
{/if}
|
|
427
|
+
{/each}
|
|
428
|
+
{#if isLoading}
|
|
429
|
+
<div class="ai-chat-panel__bubble ai-chat-panel__bubble--assistant">
|
|
430
|
+
<div class="ai-chat-panel__thinking">
|
|
431
|
+
<span class="ai-chat-panel__dot"></span>
|
|
432
|
+
<span class="ai-chat-panel__dot"></span>
|
|
433
|
+
<span class="ai-chat-panel__dot"></span>
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
{/if}
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<!-- Input area -->
|
|
440
|
+
<div class="ai-chat-panel__input-area">
|
|
441
|
+
<textarea
|
|
442
|
+
bind:this={inputElement}
|
|
443
|
+
bind:value={inputValue}
|
|
444
|
+
onkeydown={handleKeydown}
|
|
445
|
+
class="ai-chat-panel__input"
|
|
446
|
+
placeholder={placeholder ?? 'Describe what you want to build...'}
|
|
447
|
+
rows="1"
|
|
448
|
+
disabled={isLoading}
|
|
449
|
+
></textarea>
|
|
450
|
+
<button
|
|
451
|
+
class="ai-chat-panel__send"
|
|
452
|
+
onclick={sendMessage}
|
|
453
|
+
disabled={!canSend}
|
|
454
|
+
aria-label="Send message"
|
|
455
|
+
>
|
|
456
|
+
<Icon icon="mdi:send" />
|
|
457
|
+
</button>
|
|
458
|
+
</div>
|
|
459
|
+
{/if}
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
<style>
|
|
463
|
+
.ai-chat-panel {
|
|
464
|
+
display: flex;
|
|
465
|
+
flex-direction: column;
|
|
466
|
+
height: 100%;
|
|
467
|
+
width: 100%;
|
|
468
|
+
background: var(--fd-background);
|
|
469
|
+
color: var(--fd-foreground);
|
|
470
|
+
overflow: hidden;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* Notice / disabled states */
|
|
474
|
+
.ai-chat-panel__notice {
|
|
475
|
+
display: flex;
|
|
476
|
+
flex-direction: column;
|
|
477
|
+
align-items: center;
|
|
478
|
+
justify-content: center;
|
|
479
|
+
gap: var(--fd-space-sm);
|
|
480
|
+
height: 100%;
|
|
481
|
+
color: var(--fd-muted-foreground);
|
|
482
|
+
font-size: var(--fd-text-sm);
|
|
483
|
+
text-align: center;
|
|
484
|
+
padding: var(--fd-space-md);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.ai-chat-panel__notice :global(svg) {
|
|
488
|
+
font-size: 2rem;
|
|
489
|
+
opacity: 0.5;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/* Messages area */
|
|
493
|
+
.ai-chat-panel__messages {
|
|
494
|
+
flex: 1;
|
|
495
|
+
overflow-y: auto;
|
|
496
|
+
padding: var(--fd-space-sm);
|
|
497
|
+
display: flex;
|
|
498
|
+
flex-direction: column;
|
|
499
|
+
gap: var(--fd-space-xs);
|
|
500
|
+
scrollbar-width: thin;
|
|
501
|
+
scrollbar-color: var(--fd-scrollbar-thumb) var(--fd-scrollbar-track);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.ai-chat-panel__messages::-webkit-scrollbar {
|
|
505
|
+
width: 8px;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.ai-chat-panel__messages::-webkit-scrollbar-track {
|
|
509
|
+
background: var(--fd-scrollbar-track);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.ai-chat-panel__messages::-webkit-scrollbar-thumb {
|
|
513
|
+
background: var(--fd-scrollbar-thumb);
|
|
514
|
+
border-radius: 4px;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.ai-chat-panel__messages::-webkit-scrollbar-thumb:hover {
|
|
518
|
+
background: var(--fd-scrollbar-thumb-hover);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/* Empty state */
|
|
522
|
+
.ai-chat-panel__empty {
|
|
523
|
+
display: flex;
|
|
524
|
+
flex-direction: column;
|
|
525
|
+
align-items: center;
|
|
526
|
+
justify-content: center;
|
|
527
|
+
gap: var(--fd-space-xs);
|
|
528
|
+
height: 100%;
|
|
529
|
+
color: var(--fd-muted-foreground);
|
|
530
|
+
font-size: var(--fd-text-sm);
|
|
531
|
+
opacity: 0.6;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.ai-chat-panel__empty :global(svg) {
|
|
535
|
+
font-size: 1.5rem;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* Auto-retry notice */
|
|
539
|
+
.ai-chat-panel__retry-notice {
|
|
540
|
+
display: flex;
|
|
541
|
+
align-items: center;
|
|
542
|
+
justify-content: center;
|
|
543
|
+
gap: var(--fd-space-xs);
|
|
544
|
+
font-size: var(--fd-text-xs);
|
|
545
|
+
color: var(--fd-muted-foreground);
|
|
546
|
+
opacity: 0.7;
|
|
547
|
+
padding: var(--fd-space-3xs) 0;
|
|
548
|
+
animation: fadeIn 0.15s ease-out;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.ai-chat-panel__retry-notice--active :global(svg) {
|
|
552
|
+
animation: spin 1s linear infinite;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/* Message bubbles */
|
|
556
|
+
.ai-chat-panel__bubble {
|
|
557
|
+
max-width: 80%;
|
|
558
|
+
animation: fadeIn 0.15s ease-out;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.ai-chat-panel__bubble--user {
|
|
562
|
+
align-self: flex-end;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.ai-chat-panel__bubble--assistant {
|
|
566
|
+
align-self: flex-start;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.ai-chat-panel__bubble-content {
|
|
570
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
571
|
+
border-radius: var(--fd-radius-md);
|
|
572
|
+
font-size: var(--fd-text-sm);
|
|
573
|
+
line-height: 1.5;
|
|
574
|
+
word-break: break-word;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.ai-chat-panel__bubble--user .ai-chat-panel__bubble-content {
|
|
578
|
+
background: var(--fd-primary);
|
|
579
|
+
color: var(--fd-primary-foreground);
|
|
580
|
+
border-bottom-right-radius: var(--fd-radius-xs);
|
|
581
|
+
white-space: pre-wrap;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content {
|
|
585
|
+
background: var(--fd-muted);
|
|
586
|
+
color: var(--fd-foreground);
|
|
587
|
+
border-bottom-left-radius: var(--fd-radius-xs);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/* Markdown typography inside assistant bubbles */
|
|
591
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(.markdown-display) {
|
|
592
|
+
font-size: inherit;
|
|
593
|
+
line-height: inherit;
|
|
594
|
+
color: inherit;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(p) {
|
|
598
|
+
margin: 0 0 0.5em;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(p:last-child),
|
|
602
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(ul:last-child),
|
|
603
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(ol:last-child) {
|
|
604
|
+
margin-bottom: 0;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(ul),
|
|
608
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(ol) {
|
|
609
|
+
margin: 0 0 0.5em;
|
|
610
|
+
padding-left: 1.25em;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(li) {
|
|
614
|
+
margin-bottom: 0.2em;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(code) {
|
|
618
|
+
font-family: var(--fd-font-mono);
|
|
619
|
+
font-size: 0.875em;
|
|
620
|
+
background: var(--fd-background);
|
|
621
|
+
padding: 0.1em 0.3em;
|
|
622
|
+
border-radius: var(--fd-radius-xs);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(pre) {
|
|
626
|
+
background: var(--fd-background);
|
|
627
|
+
border: 1px solid var(--fd-border);
|
|
628
|
+
border-radius: var(--fd-radius-sm);
|
|
629
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
630
|
+
overflow-x: auto;
|
|
631
|
+
margin: 0.5em 0;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(pre code) {
|
|
635
|
+
background: none;
|
|
636
|
+
padding: 0;
|
|
637
|
+
font-size: var(--fd-text-xs);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(strong) {
|
|
641
|
+
font-weight: 600;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.ai-chat-panel__bubble--assistant .ai-chat-panel__bubble-content :global(em) {
|
|
645
|
+
font-style: italic;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/* Read-only command results */
|
|
649
|
+
.ai-chat-panel__readonly-results {
|
|
650
|
+
margin-top: var(--fd-space-xs);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.ai-chat-panel__readonly-result {
|
|
654
|
+
margin: 0;
|
|
655
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
656
|
+
background: var(--fd-card);
|
|
657
|
+
border: 1px solid var(--fd-border);
|
|
658
|
+
border-radius: var(--fd-radius-sm);
|
|
659
|
+
font-family: var(--fd-font-mono);
|
|
660
|
+
font-size: var(--fd-text-xs);
|
|
661
|
+
line-height: 1.4;
|
|
662
|
+
white-space: pre-wrap;
|
|
663
|
+
word-break: break-word;
|
|
664
|
+
color: var(--fd-foreground);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.ai-chat-panel__readonly-result + .ai-chat-panel__readonly-result {
|
|
668
|
+
margin-top: var(--fd-space-3xs);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/* Command preview block */
|
|
672
|
+
.ai-chat-panel__command-preview {
|
|
673
|
+
margin-top: var(--fd-space-xs);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
@keyframes fadeIn {
|
|
677
|
+
from {
|
|
678
|
+
opacity: 0;
|
|
679
|
+
transform: translateY(4px);
|
|
680
|
+
}
|
|
681
|
+
to {
|
|
682
|
+
opacity: 1;
|
|
683
|
+
transform: translateY(0);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/* Thinking indicator */
|
|
688
|
+
.ai-chat-panel__thinking {
|
|
689
|
+
display: flex;
|
|
690
|
+
gap: 4px;
|
|
691
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
692
|
+
background: var(--fd-muted);
|
|
693
|
+
border-radius: var(--fd-radius-md);
|
|
694
|
+
border-bottom-left-radius: var(--fd-radius-xs);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.ai-chat-panel__dot {
|
|
698
|
+
width: 6px;
|
|
699
|
+
height: 6px;
|
|
700
|
+
border-radius: 50%;
|
|
701
|
+
background: var(--fd-muted-foreground);
|
|
702
|
+
animation: bounce 1.4s ease-in-out infinite;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.ai-chat-panel__dot:nth-child(2) {
|
|
706
|
+
animation-delay: 0.2s;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.ai-chat-panel__dot:nth-child(3) {
|
|
710
|
+
animation-delay: 0.4s;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
@keyframes spin {
|
|
714
|
+
from {
|
|
715
|
+
transform: rotate(0deg);
|
|
716
|
+
}
|
|
717
|
+
to {
|
|
718
|
+
transform: rotate(360deg);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
@keyframes bounce {
|
|
723
|
+
0%,
|
|
724
|
+
60%,
|
|
725
|
+
100% {
|
|
726
|
+
transform: translateY(0);
|
|
727
|
+
}
|
|
728
|
+
30% {
|
|
729
|
+
transform: translateY(-4px);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/* Input area */
|
|
734
|
+
.ai-chat-panel__input-area {
|
|
735
|
+
display: flex;
|
|
736
|
+
align-items: flex-end;
|
|
737
|
+
gap: var(--fd-space-xs);
|
|
738
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
739
|
+
border-top: 1px solid var(--fd-border);
|
|
740
|
+
background: var(--fd-background);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
.ai-chat-panel__input {
|
|
744
|
+
flex: 1;
|
|
745
|
+
resize: none;
|
|
746
|
+
border: 1px solid var(--fd-border);
|
|
747
|
+
border-radius: var(--fd-radius-md);
|
|
748
|
+
padding: var(--fd-space-xs) var(--fd-space-sm);
|
|
749
|
+
font-family: var(--fd-font-sans, inherit);
|
|
750
|
+
font-size: var(--fd-text-sm);
|
|
751
|
+
line-height: 1.4;
|
|
752
|
+
color: var(--fd-foreground);
|
|
753
|
+
background: var(--fd-card);
|
|
754
|
+
outline: none;
|
|
755
|
+
max-height: 80px;
|
|
756
|
+
overflow-y: auto;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
.ai-chat-panel__input:focus {
|
|
760
|
+
border-color: var(--fd-primary);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.ai-chat-panel__input:disabled {
|
|
764
|
+
opacity: 0.5;
|
|
765
|
+
cursor: not-allowed;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.ai-chat-panel__input::placeholder {
|
|
769
|
+
color: var(--fd-muted-foreground);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.ai-chat-panel__send {
|
|
773
|
+
display: flex;
|
|
774
|
+
align-items: center;
|
|
775
|
+
justify-content: center;
|
|
776
|
+
width: 32px;
|
|
777
|
+
height: 32px;
|
|
778
|
+
border: none;
|
|
779
|
+
border-radius: var(--fd-radius-md);
|
|
780
|
+
background: var(--fd-primary);
|
|
781
|
+
color: var(--fd-primary-foreground);
|
|
782
|
+
cursor: pointer;
|
|
783
|
+
flex-shrink: 0;
|
|
784
|
+
transition:
|
|
785
|
+
background-color var(--fd-transition-fast),
|
|
786
|
+
opacity var(--fd-transition-fast);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.ai-chat-panel__send:hover:not(:disabled) {
|
|
790
|
+
background: var(--fd-primary-hover);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
.ai-chat-panel__send:disabled {
|
|
794
|
+
opacity: 0.4;
|
|
795
|
+
cursor: not-allowed;
|
|
796
|
+
}
|
|
797
|
+
</style>
|