@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.11
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/CHANGELOG.md +210 -0
- package/MIGRATION-2.0.md +173 -3
- package/README.md +5 -5
- package/dist/adapters/WorkflowAdapter.js +4 -5
- package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.js +1 -1
- package/dist/chat/commandClassifier.d.ts +11 -0
- package/dist/chat/commandClassifier.js +20 -0
- package/dist/chat/historyBuilder.d.ts +39 -0
- package/dist/chat/historyBuilder.js +82 -0
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +2 -1
- package/dist/chat/responseParser.js +16 -12
- package/dist/commands/executor.js +51 -26
- package/dist/commands/parser.d.ts +12 -0
- package/dist/commands/parser.js +33 -6
- package/dist/commands/storeIntegration.svelte.js +11 -1
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +547 -386
- package/dist/components/App.svelte.d.ts +16 -8
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +194 -565
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +9 -1
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +17 -63
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +21 -126
- package/dist/components/NodeSwapPicker.svelte +12 -30
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.svelte +4 -14
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +0 -5
- package/dist/components/SettingsPanel.svelte +33 -6
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +36 -4
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +71 -54
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +49 -8
- package/dist/components/chat/CommandPreview.svelte +10 -1
- package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
- package/dist/components/console/ConsoleInput.svelte +3 -3
- package/dist/components/console/ConsoleOutput.svelte +2 -2
- package/dist/components/form/FormArray.svelte +37 -173
- package/dist/components/form/FormAutocomplete.svelte +18 -15
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +18 -42
- package/dist/components/form/FormFieldLight.svelte +52 -48
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +8 -5
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +280 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +63 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +6 -4
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +27 -6
- package/dist/components/form/FormToggle.svelte.d.ts +5 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/InterruptBubble.svelte +11 -12
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
- package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
- package/dist/components/layouts/MainLayout.svelte +4 -5
- package/dist/components/nodes/AtomNode.svelte +62 -76
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +117 -164
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +72 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +59 -133
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +110 -164
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +62 -124
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +92 -103
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +132 -191
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +316 -27
- package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
- package/dist/components/playground/ControlPanel.svelte +22 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- package/dist/components/playground/InputCollector.svelte +11 -48
- package/dist/components/playground/PipelineKanbanView.svelte +6 -4
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +20 -3
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +6 -4
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +292 -28
- package/dist/components/playground/Playground.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +5 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +7 -6
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +71 -1
- package/dist/config/endpoints.js +46 -5
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.js +2 -6
- package/dist/display/index.d.ts +6 -1
- package/dist/display/index.js +9 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/form/full.d.ts +2 -1
- package/dist/form/full.js +4 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/form/index.js +3 -2
- package/dist/helpers/workflowEditorHelper.d.ts +4 -2
- package/dist/helpers/workflowEditorHelper.js +8 -8
- package/dist/messages/defaults.d.ts +98 -0
- package/dist/messages/defaults.js +58 -1
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/openapi/v1/openapi.yaml +35 -23
- package/dist/playground/commands/args.d.ts +32 -0
- package/dist/playground/commands/args.js +50 -0
- package/dist/playground/commands/dispatch.d.ts +143 -0
- package/dist/playground/commands/dispatch.js +162 -0
- package/dist/playground/commands/index.d.ts +14 -0
- package/dist/playground/commands/index.js +10 -0
- package/dist/playground/commands/parser.d.ts +38 -0
- package/dist/playground/commands/parser.js +163 -0
- package/dist/playground/commands/registry.d.ts +42 -0
- package/dist/playground/commands/registry.js +122 -0
- package/dist/playground/commands/suggest.d.ts +37 -0
- package/dist/playground/commands/suggest.js +46 -0
- package/dist/playground/commands/types.d.ts +111 -0
- package/dist/playground/commands/types.js +15 -0
- package/dist/playground/index.d.ts +21 -2
- package/dist/playground/index.js +27 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- package/dist/playground/runAction.d.ts +48 -0
- package/dist/playground/runAction.js +31 -0
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -39
- package/dist/registry/builtinNodes.js +6 -53
- package/dist/registry/nodeComponentRegistry.d.ts +2 -1
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -2
- package/dist/services/apiVariableService.js +12 -26
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +4 -3
- package/dist/services/chatService.js +13 -18
- package/dist/services/dynamicSchemaService.d.ts +31 -4
- package/dist/services/dynamicSchemaService.js +62 -33
- package/dist/services/historyService.d.ts +30 -8
- package/dist/services/historyService.js +51 -15
- package/dist/services/interruptService.d.ts +7 -6
- package/dist/services/interruptService.js +19 -21
- package/dist/services/pipelineSignalService.d.ts +97 -0
- package/dist/services/pipelineSignalService.js +94 -0
- package/dist/services/playgroundService.d.ts +21 -8
- package/dist/services/playgroundService.js +45 -25
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/workflowLaunchService.d.ts +74 -0
- package/dist/services/workflowLaunchService.js +74 -0
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +11 -0
- package/dist/stores/apiContext.js +15 -0
- package/dist/stores/categoriesStore.svelte.js +0 -1
- package/dist/stores/historyStore.svelte.d.ts +17 -3
- package/dist/stores/historyStore.svelte.js +30 -3
- package/dist/stores/instanceContainer.svelte.js +5 -0
- package/dist/stores/playgroundStore.svelte.js +1 -3
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/stores/workflowStore.svelte.d.ts +42 -5
- package/dist/stores/workflowStore.svelte.js +109 -32
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +18 -1
- package/dist/svelte-app.js +75 -110
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/chat.d.ts +5 -1
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +84 -29
- package/dist/types/index.js +0 -1
- package/dist/types/settings.d.ts +28 -1
- package/dist/types/settings.js +6 -3
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/canvasSelection.d.ts +25 -0
- package/dist/utils/canvasSelection.js +37 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/connections.js +20 -56
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/nodeFormSchema.d.ts +51 -0
- package/dist/utils/nodeFormSchema.js +87 -0
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.js +3 -6
- package/dist/utils/nodeTypes.js +1 -1
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +2 -1
|
@@ -26,13 +26,15 @@
|
|
|
26
26
|
import CanvasController from './CanvasController.svelte';
|
|
27
27
|
import FlowDropZone from './FlowDropZone.svelte';
|
|
28
28
|
import EdgeRefresher from './EdgeRefresher.svelte';
|
|
29
|
-
import { tick, untrack } from 'svelte';
|
|
29
|
+
import { tick, untrack, onMount } from 'svelte';
|
|
30
30
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
31
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
31
32
|
import ConnectionLine from './ConnectionLine.svelte';
|
|
32
33
|
import FlowDropEdge from './FlowDropEdge.svelte';
|
|
33
34
|
import { m } from '../messages/index.js';
|
|
34
35
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
35
36
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
37
|
+
import type { FlowDropGridVariant } from '../types/theme.js';
|
|
36
38
|
import UniversalNode from './UniversalNode.svelte';
|
|
37
39
|
import {
|
|
38
40
|
EdgeStylingHelper,
|
|
@@ -54,12 +56,16 @@
|
|
|
54
56
|
import PortCoordinateTracker from './PortCoordinateTracker.svelte';
|
|
55
57
|
import { logger } from '../utils/logger.js';
|
|
56
58
|
import { validateWorkflowData } from '../utils/validation.js';
|
|
59
|
+
import { suppressPortDragSelection } from '../utils/canvasSelection.js';
|
|
57
60
|
import { createEditorStateMachine } from '../stores/editorStateMachine.svelte.js';
|
|
58
|
-
import
|
|
61
|
+
import CanvasIconButton from './CanvasIconButton.svelte';
|
|
62
|
+
import CommandLineIcon from './icons/CommandLineIcon.svelte';
|
|
59
63
|
import { DEV } from 'esm-env';
|
|
60
64
|
|
|
61
65
|
interface Props {
|
|
62
66
|
endpointConfig?: EndpointConfig;
|
|
67
|
+
/** Auth provider applied to this instance's API requests. */
|
|
68
|
+
authProvider?: AuthProvider;
|
|
63
69
|
openConfigSidebar?: (node: WorkflowNodeType) => void;
|
|
64
70
|
/**
|
|
65
71
|
* Editor interaction mode. `'edit'` allows node drag/connect/select and
|
|
@@ -82,6 +88,23 @@
|
|
|
82
88
|
onToggleConsole?: () => void;
|
|
83
89
|
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
84
90
|
instance?: FlowDropInstance;
|
|
91
|
+
/**
|
|
92
|
+
* Canvas background grid pattern. Supplied by App from the active theme's
|
|
93
|
+
* `config.canvas.grid` default; any theme can opt into 'lines' / 'cross'.
|
|
94
|
+
* Color is driven separately by the `--fd-grid-pattern-color` token.
|
|
95
|
+
* @default 'dots'
|
|
96
|
+
*/
|
|
97
|
+
gridVariant?: FlowDropGridVariant;
|
|
98
|
+
/**
|
|
99
|
+
* Register the built-in heavy form editors (markdown / code / template)
|
|
100
|
+
* on this instance's field registry. Batteries-included by default — node
|
|
101
|
+
* config fields with `format: 'markdown' | 'code' | 'template'` render real
|
|
102
|
+
* CodeMirror editors. The chunks are code-split (loaded lazily here), so
|
|
103
|
+
* the `/editor` static bundle stays light. Set `false` to keep the textarea
|
|
104
|
+
* fallback or register your own field components. See `features.builtinEditors`.
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
builtinEditors?: boolean;
|
|
85
108
|
}
|
|
86
109
|
|
|
87
110
|
let props: Props = $props();
|
|
@@ -92,10 +115,36 @@
|
|
|
92
115
|
// svelte-ignore state_referenced_locally
|
|
93
116
|
const fd = provideInstance(props.instance);
|
|
94
117
|
|
|
118
|
+
// Batteries-included: register the built-in heavy form editors (markdown /
|
|
119
|
+
// code / template) on this instance's field registry so node config fields
|
|
120
|
+
// render real editors out of the box. Dynamic import is deliberate — the
|
|
121
|
+
// bundle guard only inspects *static* imports, and `form/markdown`/`form/code`
|
|
122
|
+
// statically re-export their CodeMirror components, so a static import here
|
|
123
|
+
// would leak CodeMirror into the light `/editor` entry. Importing lazily on
|
|
124
|
+
// mount keeps the static graph clean while the chunks load on demand.
|
|
125
|
+
// register*Field is idempotent per registry, so re-mounts are safe.
|
|
126
|
+
onMount(() => {
|
|
127
|
+
if (props.builtinEditors === false) return;
|
|
128
|
+
void (async () => {
|
|
129
|
+
const [code, markdown] = await Promise.all([
|
|
130
|
+
import('../form/code.js'),
|
|
131
|
+
import('../form/markdown.js')
|
|
132
|
+
]);
|
|
133
|
+
code.registerCodeEditorField(fd.fields);
|
|
134
|
+
code.registerTemplateEditorField(fd.fields);
|
|
135
|
+
markdown.registerMarkdownEditorField(fd.fields);
|
|
136
|
+
})();
|
|
137
|
+
});
|
|
138
|
+
|
|
95
139
|
// `mode` is the public API; the canvas only needs to know whether editing is
|
|
96
140
|
// enabled. 'readonly' and 'locked' both disable interaction identically.
|
|
97
141
|
const canvasEditable = $derived((props.mode ?? 'edit') === 'edit');
|
|
98
142
|
|
|
143
|
+
// Canvas grid pattern, supplied by the active theme's config.canvas.grid
|
|
144
|
+
// (App passes it down). BackgroundVariant's enum values are the same strings
|
|
145
|
+
// ('dots' | 'lines' | 'cross'), so the theme config maps straight through.
|
|
146
|
+
const gridVariant = $derived((props.gridVariant ?? 'dots') as BackgroundVariant);
|
|
147
|
+
|
|
99
148
|
// ---------------------------------------------------------------------------
|
|
100
149
|
// Editor State Machine
|
|
101
150
|
// Centralizes reactive guards — replaces scattered boolean flags
|
|
@@ -596,7 +645,7 @@
|
|
|
596
645
|
// Configure endpoints when props change
|
|
597
646
|
$effect(() => {
|
|
598
647
|
if (props.endpointConfig) {
|
|
599
|
-
ConfigurationHelper.configureEndpoints(fd.api, props.endpointConfig);
|
|
648
|
+
ConfigurationHelper.configureEndpoints(fd.api, props.endpointConfig, props.authProvider);
|
|
600
649
|
}
|
|
601
650
|
});
|
|
602
651
|
|
|
@@ -839,8 +888,10 @@
|
|
|
839
888
|
<div class="flowdrop-workflow-editor">
|
|
840
889
|
<!-- Main Editor Area -->
|
|
841
890
|
<div class="flowdrop-workflow-editor__main">
|
|
842
|
-
<!-- Flow Canvas
|
|
843
|
-
|
|
891
|
+
<!-- Flow Canvas.
|
|
892
|
+
Capture-phase mousedown so dragging from a port never turns into a
|
|
893
|
+
WebKit text-selection drag — see suppressPortDragSelection. -->
|
|
894
|
+
<div class="flowdrop-canvas" onmousedowncapture={suppressPortDragSelection}>
|
|
844
895
|
<FlowDropZone ondrop={handleNodeDrop} onfiledrop={handleWorkflowFileDrop}>
|
|
845
896
|
{#key svelteFlowKey}
|
|
846
897
|
<SvelteFlow
|
|
@@ -872,23 +923,26 @@
|
|
|
872
923
|
>
|
|
873
924
|
<Controls />
|
|
874
925
|
{#if canvasEditable && props.onToggleConsole}
|
|
875
|
-
<
|
|
926
|
+
<CanvasIconButton
|
|
876
927
|
class="flowdrop-console-toggle"
|
|
877
|
-
|
|
928
|
+
label={m().layout.commandConsole}
|
|
929
|
+
active={props.consoleOpen}
|
|
878
930
|
onclick={props.onToggleConsole}
|
|
879
|
-
aria-label={m().layout.commandConsole}
|
|
880
|
-
title={m().layout.commandConsole}
|
|
881
|
-
type="button"
|
|
882
931
|
>
|
|
883
|
-
|
|
884
|
-
|
|
932
|
+
{#snippet icon()}
|
|
933
|
+
<CommandLineIcon />
|
|
934
|
+
{/snippet}
|
|
935
|
+
</CanvasIconButton>
|
|
885
936
|
{/if}
|
|
886
937
|
<!-- Always render Background for consistent bg color in dark/light mode -->
|
|
887
938
|
<Background
|
|
888
939
|
gap={getEditorSettings().gridSize}
|
|
889
|
-
bgColor="var(--fd-
|
|
890
|
-
variant={
|
|
891
|
-
|
|
940
|
+
bgColor="var(--fd-canvas-bg)"
|
|
941
|
+
variant={gridVariant}
|
|
942
|
+
lineWidth={1}
|
|
943
|
+
patternColor={getEditorSettings().showGrid
|
|
944
|
+
? 'var(--fd-grid-pattern-color)'
|
|
945
|
+
: 'transparent'}
|
|
892
946
|
/>
|
|
893
947
|
{#if getEditorSettings().showMinimap}
|
|
894
948
|
<MiniMap />
|
|
@@ -1003,48 +1057,11 @@
|
|
|
1003
1057
|
justify-content: space-between;
|
|
1004
1058
|
}
|
|
1005
1059
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1060
|
+
/* Console toggle — placement only; visuals live in CanvasIconButton */
|
|
1061
|
+
:global(.flowdrop-console-toggle) {
|
|
1008
1062
|
bottom: 140px;
|
|
1009
1063
|
left: 12px;
|
|
1010
1064
|
z-index: 5;
|
|
1011
|
-
display: flex;
|
|
1012
|
-
align-items: center;
|
|
1013
|
-
justify-content: center;
|
|
1014
|
-
width: 2rem;
|
|
1015
|
-
height: 2rem;
|
|
1016
|
-
border: 1px solid var(--fd-border);
|
|
1017
|
-
border-radius: var(--fd-radius-md);
|
|
1018
|
-
background-color: var(--fd-background);
|
|
1019
|
-
color: var(--fd-muted-foreground);
|
|
1020
|
-
cursor: pointer;
|
|
1021
|
-
box-shadow: var(--fd-shadow-sm);
|
|
1022
|
-
transition:
|
|
1023
|
-
color var(--fd-transition-fast),
|
|
1024
|
-
background-color var(--fd-transition-fast),
|
|
1025
|
-
box-shadow var(--fd-transition-fast);
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
.flowdrop-console-toggle:hover {
|
|
1029
|
-
color: var(--fd-foreground);
|
|
1030
|
-
background-color: var(--fd-subtle);
|
|
1031
|
-
box-shadow: var(--fd-shadow-md);
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
.flowdrop-console-toggle:focus {
|
|
1035
|
-
outline: none;
|
|
1036
|
-
box-shadow: 0 0 0 2px var(--fd-ring);
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
.flowdrop-console-toggle--active {
|
|
1040
|
-
color: var(--fd-primary);
|
|
1041
|
-
background-color: var(--fd-primary-muted);
|
|
1042
|
-
border-color: var(--fd-primary);
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
.flowdrop-console-toggle--active:hover {
|
|
1046
|
-
color: var(--fd-primary);
|
|
1047
|
-
background-color: var(--fd-primary-muted);
|
|
1048
1065
|
}
|
|
1049
1066
|
|
|
1050
1067
|
:global(.flowdrop-workflow-editor .svelte-flow__node:hover) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import '@xyflow/svelte/dist/style.css';
|
|
2
2
|
import type { WorkflowNode as WorkflowNodeType } from '../types/index.js';
|
|
3
3
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
4
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
4
5
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
6
|
+
import type { FlowDropGridVariant } from '../types/theme.js';
|
|
5
7
|
interface Props {
|
|
6
8
|
endpointConfig?: EndpointConfig;
|
|
9
|
+
/** Auth provider applied to this instance's API requests. */
|
|
10
|
+
authProvider?: AuthProvider;
|
|
7
11
|
openConfigSidebar?: (node: WorkflowNodeType) => void;
|
|
8
12
|
/**
|
|
9
13
|
* Editor interaction mode. `'edit'` allows node drag/connect/select and
|
|
@@ -24,6 +28,23 @@ interface Props {
|
|
|
24
28
|
onToggleConsole?: () => void;
|
|
25
29
|
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
26
30
|
instance?: FlowDropInstance;
|
|
31
|
+
/**
|
|
32
|
+
* Canvas background grid pattern. Supplied by App from the active theme's
|
|
33
|
+
* `config.canvas.grid` default; any theme can opt into 'lines' / 'cross'.
|
|
34
|
+
* Color is driven separately by the `--fd-grid-pattern-color` token.
|
|
35
|
+
* @default 'dots'
|
|
36
|
+
*/
|
|
37
|
+
gridVariant?: FlowDropGridVariant;
|
|
38
|
+
/**
|
|
39
|
+
* Register the built-in heavy form editors (markdown / code / template)
|
|
40
|
+
* on this instance's field registry. Batteries-included by default — node
|
|
41
|
+
* config fields with `format: 'markdown' | 'code' | 'template'` render real
|
|
42
|
+
* CodeMirror editors. The chunks are code-split (loaded lazily here), so
|
|
43
|
+
* the `/editor` static bundle stays light. Set `false` to keep the textarea
|
|
44
|
+
* fallback or register your own field components. See `features.builtinEditors`.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
builtinEditors?: boolean;
|
|
27
48
|
}
|
|
28
49
|
declare const WorkflowEditor: import("svelte").Component<Props, {
|
|
29
50
|
updateNodeData: (nodeId: string, dataUpdates: Partial<WorkflowNodeType["data"]>) => void;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
8
8
|
import { getBehaviorSettings } from '../../stores/settingsStore.svelte.js';
|
|
9
9
|
import { extractCommands } from '../../chat/responseParser.js';
|
|
10
|
-
import {
|
|
10
|
+
import { buildApiHistory } from '../../chat/historyBuilder.js';
|
|
11
|
+
import { isMutatingCommand, isLayoutCommand } from '../../chat/commandClassifier.js';
|
|
11
12
|
import { parseCommand } from '../../commands/parser.js';
|
|
12
13
|
import { executeCommand } from '../../commands/index.js';
|
|
13
14
|
import { createStoreCommandContext } from '../../commands/storeIntegration.svelte.js';
|
|
@@ -29,12 +30,20 @@
|
|
|
29
30
|
interface DisplayMessage {
|
|
30
31
|
role: 'user' | 'assistant';
|
|
31
32
|
content: string;
|
|
33
|
+
/**
|
|
34
|
+
* The unmodified LLM response, kept when `content` is the explanation-only
|
|
35
|
+
* display text. Sent as history so the assistant sees the DSL it emitted
|
|
36
|
+
* (issue #35).
|
|
37
|
+
*/
|
|
38
|
+
rawContent?: string;
|
|
32
39
|
/** Set on auto-retry messages — renders as a muted notice, not a user bubble */
|
|
33
40
|
retryAttempt?: number;
|
|
34
41
|
/** Mutating commands awaiting approval */
|
|
35
42
|
commandPreview?: CommandPreviewItem[];
|
|
36
43
|
/** Results from auto-executed read-only commands */
|
|
37
44
|
readOnlyResults?: string[];
|
|
45
|
+
/** Set when the user dismissed this message's command preview */
|
|
46
|
+
commandsDismissed?: boolean;
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
interface Props {
|
|
@@ -93,9 +102,14 @@
|
|
|
93
102
|
// Helpers
|
|
94
103
|
// =========================================================================
|
|
95
104
|
|
|
96
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Build conversation history from display messages for API requests.
|
|
107
|
+
*
|
|
108
|
+
* Read at send time, so each assistant entry reports the *current* status of
|
|
109
|
+
* the commands it emitted — applied, dismissed, failed or still pending.
|
|
110
|
+
*/
|
|
97
111
|
function getHistory(): ChatHistoryMessage[] {
|
|
98
|
-
return displayMessages
|
|
112
|
+
return buildApiHistory(displayMessages);
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
function getWorkflowState(): unknown {
|
|
@@ -169,7 +183,8 @@
|
|
|
169
183
|
|
|
170
184
|
const msg: DisplayMessage = {
|
|
171
185
|
role: 'assistant',
|
|
172
|
-
content: explanation || responseContent
|
|
186
|
+
content: explanation || responseContent,
|
|
187
|
+
rawContent: responseContent
|
|
173
188
|
};
|
|
174
189
|
|
|
175
190
|
if (readOnlyResults.length > 0) {
|
|
@@ -222,6 +237,12 @@
|
|
|
222
237
|
command: import('../../commands/types.js').Command;
|
|
223
238
|
}[] = [];
|
|
224
239
|
|
|
240
|
+
// Layout commands rewrite every node's position, so they wipe a hand-crafted
|
|
241
|
+
// arrangement. Honour the user's opt-out by skipping them instead of running
|
|
242
|
+
// them — a skip is not a failure, so the rest of the batch still applies and
|
|
243
|
+
// no retry feedback is sent (issue #36).
|
|
244
|
+
const allowLayoutChanges = getBehaviorSettings().chatAllowLayoutChanges;
|
|
245
|
+
|
|
225
246
|
for (const item of pendingItems) {
|
|
226
247
|
const parsed = parseCommand(item.raw);
|
|
227
248
|
if (!parsed.ok) {
|
|
@@ -231,11 +252,22 @@
|
|
|
231
252
|
parseErrors.push({ raw: item.raw, error: parsed.error });
|
|
232
253
|
continue;
|
|
233
254
|
}
|
|
255
|
+
if (!allowLayoutChanges && isLayoutCommand(parsed.command.type)) {
|
|
256
|
+
item.status = 'skipped';
|
|
257
|
+
item.result = t.commandPreview.layoutSkipped;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
234
260
|
parsedCommands.push({ item, command: parsed.command });
|
|
235
261
|
}
|
|
236
262
|
|
|
237
263
|
const totalCount = parsedCommands.length;
|
|
238
264
|
|
|
265
|
+
// Everything was intentionally skipped (layout commands with layout changes
|
|
266
|
+
// off) — nothing failed, so there is nothing to report or retry.
|
|
267
|
+
if (totalCount === 0 && parseErrors.length === 0) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
239
271
|
// Nothing parseable to run — feed the parse errors straight back so the
|
|
240
272
|
// assistant can resend a corrected batch.
|
|
241
273
|
if (totalCount === 0) {
|
|
@@ -338,8 +370,12 @@
|
|
|
338
370
|
}
|
|
339
371
|
|
|
340
372
|
/** Dismiss a command preview without executing — CommandPreview shows its own cancelled state */
|
|
341
|
-
function handleCancelCommands(
|
|
342
|
-
//
|
|
373
|
+
function handleCancelCommands(messageIndex: number) {
|
|
374
|
+
// CommandPreview owns the "Dismissed" *display* via its resolvedAction state;
|
|
375
|
+
// the flag here is what tells the assistant, on the next turn, that these
|
|
376
|
+
// commands were rejected rather than still waiting (issue #35).
|
|
377
|
+
const msg = displayMessages[messageIndex];
|
|
378
|
+
if (msg) msg.commandsDismissed = true;
|
|
343
379
|
}
|
|
344
380
|
|
|
345
381
|
/** Append an error message to conversation history so the LLM can self-correct */
|
|
@@ -369,7 +405,12 @@
|
|
|
369
405
|
history: history.slice(0, -1) // all except current message
|
|
370
406
|
};
|
|
371
407
|
|
|
372
|
-
const response = await chatService.sendMessage(
|
|
408
|
+
const response = await chatService.sendMessage(
|
|
409
|
+
fd.api.config,
|
|
410
|
+
workflowId,
|
|
411
|
+
request,
|
|
412
|
+
fd.api.authProvider
|
|
413
|
+
);
|
|
373
414
|
const displayMsg = processResponse(response.content);
|
|
374
415
|
displayMessages.push(displayMsg);
|
|
375
416
|
} catch (err) {
|
|
@@ -547,7 +588,7 @@
|
|
|
547
588
|
|
|
548
589
|
.ai-chat-panel__messages::-webkit-scrollbar-thumb {
|
|
549
590
|
background: var(--fd-scrollbar-thumb);
|
|
550
|
-
border-radius:
|
|
591
|
+
border-radius: var(--fd-scrollbar-radius);
|
|
551
592
|
}
|
|
552
593
|
|
|
553
594
|
.ai-chat-panel__messages::-webkit-scrollbar-thumb:hover {
|
|
@@ -44,10 +44,12 @@
|
|
|
44
44
|
<Icon icon="mdi:check-circle" />
|
|
45
45
|
{:else if command.status === 'error'}
|
|
46
46
|
<Icon icon="mdi:alert-circle" />
|
|
47
|
+
{:else if command.status === 'skipped'}
|
|
48
|
+
<Icon icon="mdi:debug-step-over" />
|
|
47
49
|
{/if}
|
|
48
50
|
</span>
|
|
49
51
|
<pre class="command-preview__command">{command.raw}</pre>
|
|
50
|
-
{#if command.status === 'error' && command.result}
|
|
52
|
+
{#if (command.status === 'error' || command.status === 'skipped') && command.result}
|
|
51
53
|
<span class="command-preview__error">{command.result}</span>
|
|
52
54
|
{/if}
|
|
53
55
|
</div>
|
|
@@ -163,6 +165,13 @@
|
|
|
163
165
|
color: var(--fd-error);
|
|
164
166
|
}
|
|
165
167
|
|
|
168
|
+
/* Skipped isn't a failure — mute it instead of colouring it like an error. */
|
|
169
|
+
.command-preview__item--skipped .command-preview__status,
|
|
170
|
+
.command-preview__item--skipped .command-preview__command,
|
|
171
|
+
.command-preview__item--skipped .command-preview__error {
|
|
172
|
+
color: var(--fd-muted-foreground);
|
|
173
|
+
}
|
|
174
|
+
|
|
166
175
|
.command-preview__error {
|
|
167
176
|
display: block;
|
|
168
177
|
font-size: var(--fd-text-xs);
|
|
@@ -341,10 +341,10 @@
|
|
|
341
341
|
if (nodeTypeContext !== null) {
|
|
342
342
|
const prefix = nodeTypeContext.toLowerCase();
|
|
343
343
|
return nodeTypes
|
|
344
|
-
.filter((nt) => nt.
|
|
344
|
+
.filter((nt) => nt.node_type_id.toLowerCase().startsWith(prefix))
|
|
345
345
|
.map((nt) => ({
|
|
346
|
-
value: nt.
|
|
347
|
-
label: nt.
|
|
346
|
+
value: nt.node_type_id,
|
|
347
|
+
label: nt.node_type_id,
|
|
348
348
|
detail: `${nt.name} (${nt.category})`
|
|
349
349
|
}))
|
|
350
350
|
.slice(0, 50);
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
|
|
69
69
|
.console-output::-webkit-scrollbar-track {
|
|
70
70
|
background: var(--fd-scrollbar-track);
|
|
71
|
-
border-radius:
|
|
71
|
+
border-radius: var(--fd-scrollbar-radius);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.console-output::-webkit-scrollbar-thumb {
|
|
75
75
|
background: var(--fd-scrollbar-thumb);
|
|
76
|
-
border-radius:
|
|
76
|
+
border-radius: var(--fd-scrollbar-radius);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.console-output::-webkit-scrollbar-thumb:hover {
|