@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
|
@@ -46,19 +46,21 @@
|
|
|
46
46
|
import type { NodeStatus } from './pipelineViewUtils.svelte.js';
|
|
47
47
|
import type { Workflow, WorkflowNode } from '../../types/index.js';
|
|
48
48
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
49
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
49
50
|
|
|
50
51
|
interface Props {
|
|
51
52
|
pipelineId: string;
|
|
52
53
|
workflow: Workflow;
|
|
53
54
|
endpointConfig: EndpointConfig;
|
|
55
|
+
authProvider?: AuthProvider;
|
|
54
56
|
refreshTrigger?: number;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
let { pipelineId, workflow, endpointConfig, refreshTrigger = 0 }: Props = $props();
|
|
59
|
+
let { pipelineId, workflow, endpointConfig, authProvider, refreshTrigger = 0 }: Props = $props();
|
|
58
60
|
|
|
59
61
|
// endpointConfig is consumed once to build the API client; it must be stable
|
|
60
62
|
// svelte-ignore state_referenced_locally
|
|
61
|
-
const fetcher = createPipelineDataFetcher(() => pipelineId, endpointConfig);
|
|
63
|
+
const fetcher = createPipelineDataFetcher(() => pipelineId, endpointConfig, authProvider);
|
|
62
64
|
|
|
63
65
|
$effect(() => {
|
|
64
66
|
if (refreshTrigger <= 0) return;
|
|
@@ -106,7 +108,7 @@
|
|
|
106
108
|
nodesByColumn.get(colKey)?.push({
|
|
107
109
|
key: job.id,
|
|
108
110
|
label: job.label || node.data.label,
|
|
109
|
-
typeId: node.data.metadata.
|
|
111
|
+
typeId: node.data.metadata.node_type_id,
|
|
110
112
|
status,
|
|
111
113
|
durationUs: job.executionTimeUs
|
|
112
114
|
});
|
|
@@ -120,7 +122,7 @@
|
|
|
120
122
|
nodesByColumn.get(colKey)?.push({
|
|
121
123
|
key: node.id,
|
|
122
124
|
label: node.data.label,
|
|
123
|
-
typeId: node.data.metadata.
|
|
125
|
+
typeId: node.data.metadata.node_type_id,
|
|
124
126
|
status
|
|
125
127
|
});
|
|
126
128
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Workflow } from '../../types/index.js';
|
|
2
2
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
3
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
4
|
interface Props {
|
|
4
5
|
pipelineId: string;
|
|
5
6
|
workflow: Workflow;
|
|
6
7
|
endpointConfig: EndpointConfig;
|
|
8
|
+
authProvider?: AuthProvider;
|
|
7
9
|
refreshTrigger?: number;
|
|
8
10
|
}
|
|
9
11
|
declare const PipelineKanbanView: import("svelte").Component<Props, {}, "">;
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
import { logger } from '../../utils/logger.js';
|
|
17
17
|
import type { Workflow, PipelineViewDef } from '../../types/index.js';
|
|
18
18
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
19
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
19
20
|
import type { PlaygroundExecution } from '../../types/playground.js';
|
|
20
21
|
|
|
21
22
|
interface Props {
|
|
22
23
|
pipelineId: string | null;
|
|
23
24
|
workflow: Workflow;
|
|
24
25
|
endpointConfig: EndpointConfig;
|
|
26
|
+
authProvider?: AuthProvider;
|
|
25
27
|
isPinned: boolean;
|
|
26
28
|
/** All executions for the current session, oldest-first */
|
|
27
29
|
executions?: PlaygroundExecution[];
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
pipelineId,
|
|
40
42
|
workflow,
|
|
41
43
|
endpointConfig,
|
|
44
|
+
authProvider,
|
|
42
45
|
isPinned,
|
|
43
46
|
executions = [],
|
|
44
47
|
latestExecutionId = null,
|
|
@@ -248,14 +251,27 @@
|
|
|
248
251
|
{#if pipelineId}
|
|
249
252
|
{#key pipelineId}
|
|
250
253
|
{#if viewMode === 'kanban'}
|
|
251
|
-
<PipelineKanbanView
|
|
254
|
+
<PipelineKanbanView
|
|
255
|
+
{pipelineId}
|
|
256
|
+
{workflow}
|
|
257
|
+
{endpointConfig}
|
|
258
|
+
{authProvider}
|
|
259
|
+
{refreshTrigger}
|
|
260
|
+
/>
|
|
252
261
|
{:else if viewMode === 'table'}
|
|
253
|
-
<PipelineTableView
|
|
262
|
+
<PipelineTableView
|
|
263
|
+
{pipelineId}
|
|
264
|
+
{workflow}
|
|
265
|
+
{endpointConfig}
|
|
266
|
+
{authProvider}
|
|
267
|
+
{refreshTrigger}
|
|
268
|
+
/>
|
|
254
269
|
{:else if viewMode === 'graph'}
|
|
255
270
|
<PipelineStatus
|
|
256
271
|
{pipelineId}
|
|
257
272
|
{workflow}
|
|
258
273
|
{endpointConfig}
|
|
274
|
+
{authProvider}
|
|
259
275
|
runLabel={pipelineId}
|
|
260
276
|
{refreshTrigger}
|
|
261
277
|
isEmbedded={true}
|
|
@@ -264,7 +280,7 @@
|
|
|
264
280
|
{@const activeView = extraViews.find((v) => v.key === viewMode)}
|
|
265
281
|
{#if activeView}
|
|
266
282
|
{@const View = activeView.component}
|
|
267
|
-
<View {pipelineId} {workflow} {endpointConfig} {refreshTrigger} />
|
|
283
|
+
<View {pipelineId} {workflow} {endpointConfig} {authProvider} {refreshTrigger} />
|
|
268
284
|
{/if}
|
|
269
285
|
{/if}
|
|
270
286
|
{/key}
|
|
@@ -277,6 +293,7 @@
|
|
|
277
293
|
disableSidebar={true}
|
|
278
294
|
mode="locked"
|
|
279
295
|
{endpointConfig}
|
|
296
|
+
{authProvider}
|
|
280
297
|
/>
|
|
281
298
|
{/if}
|
|
282
299
|
</div>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Workflow, PipelineViewDef } from '../../types/index.js';
|
|
2
2
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
3
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
4
|
import type { PlaygroundExecution } from '../../types/playground.js';
|
|
4
5
|
interface Props {
|
|
5
6
|
pipelineId: string | null;
|
|
6
7
|
workflow: Workflow;
|
|
7
8
|
endpointConfig: EndpointConfig;
|
|
9
|
+
authProvider?: AuthProvider;
|
|
8
10
|
isPinned: boolean;
|
|
9
11
|
/** All executions for the current session, oldest-first */
|
|
10
12
|
executions?: PlaygroundExecution[];
|
|
@@ -55,15 +55,17 @@
|
|
|
55
55
|
import { formatMicroseconds } from '../../utils/duration.js';
|
|
56
56
|
import type { Workflow, WorkflowNode } from '../../types/index.js';
|
|
57
57
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
58
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
58
59
|
|
|
59
60
|
interface Props {
|
|
60
61
|
pipelineId: string;
|
|
61
62
|
workflow: Workflow;
|
|
62
63
|
endpointConfig: EndpointConfig;
|
|
64
|
+
authProvider?: AuthProvider;
|
|
63
65
|
refreshTrigger?: number;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
let { pipelineId, workflow, endpointConfig, refreshTrigger = 0 }: Props = $props();
|
|
68
|
+
let { pipelineId, workflow, endpointConfig, authProvider, refreshTrigger = 0 }: Props = $props();
|
|
67
69
|
|
|
68
70
|
interface JobRow {
|
|
69
71
|
/** Stable key: job id, or node id for nodes without a job yet */
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
|
|
86
88
|
// endpointConfig is consumed once to build the API client; it must be stable
|
|
87
89
|
// svelte-ignore state_referenced_locally
|
|
88
|
-
const fetcher = createPipelineDataFetcher(() => pipelineId, endpointConfig);
|
|
90
|
+
const fetcher = createPipelineDataFetcher(() => pipelineId, endpointConfig, authProvider);
|
|
89
91
|
|
|
90
92
|
$effect(() => {
|
|
91
93
|
if (refreshTrigger <= 0) return;
|
|
@@ -109,7 +111,7 @@
|
|
|
109
111
|
jobRows.push({
|
|
110
112
|
key: job.id,
|
|
111
113
|
label: job.label || node.data.label,
|
|
112
|
-
typeId: node.data.metadata.
|
|
114
|
+
typeId: node.data.metadata.node_type_id,
|
|
113
115
|
nodeId: job.nodeId,
|
|
114
116
|
status: resolveStatus({ status: job.status }),
|
|
115
117
|
started: job.started,
|
|
@@ -135,7 +137,7 @@
|
|
|
135
137
|
return {
|
|
136
138
|
key: node.id,
|
|
137
139
|
label: node.data.label,
|
|
138
|
-
typeId: node.data.metadata.
|
|
140
|
+
typeId: node.data.metadata.node_type_id,
|
|
139
141
|
nodeId: node.id,
|
|
140
142
|
status: resolveStatus(statusData),
|
|
141
143
|
started: statusData?.last_executed,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Workflow } from '../../types/index.js';
|
|
2
2
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
3
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
4
|
interface Props {
|
|
4
5
|
pipelineId: string;
|
|
5
6
|
workflow: Workflow;
|
|
6
7
|
endpointConfig: EndpointConfig;
|
|
8
|
+
authProvider?: AuthProvider;
|
|
7
9
|
refreshTrigger?: number;
|
|
8
10
|
}
|
|
9
11
|
declare const PipelineTableView: import("svelte").Component<Props, {}, "">;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import ControlPanel from './ControlPanel.svelte';
|
|
18
18
|
import type { Workflow } from '../../types/index.js';
|
|
19
19
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
20
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
20
21
|
import type {
|
|
21
22
|
PlaygroundMode,
|
|
22
23
|
PlaygroundConfig,
|
|
@@ -24,10 +25,20 @@
|
|
|
24
25
|
} from '../../types/playground.js';
|
|
25
26
|
import { playgroundService } from '../../services/playgroundService.js';
|
|
26
27
|
import { interruptService } from '../../services/interruptService.js';
|
|
28
|
+
import { pipelineSignalService } from '../../services/pipelineSignalService.js';
|
|
29
|
+
import { workflowLaunchService } from '../../services/workflowLaunchService.js';
|
|
27
30
|
import { provideInstance } from '../../stores/getInstance.svelte.js';
|
|
28
31
|
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
29
32
|
import type { PlaygroundMessagesApiResponse } from '../../types/playground.js';
|
|
30
33
|
import { logger } from '../../utils/logger.js';
|
|
34
|
+
import { m } from '../../messages/index.js';
|
|
35
|
+
import {
|
|
36
|
+
parseSlashCommand,
|
|
37
|
+
dispatchCommand,
|
|
38
|
+
describeLaunchResult,
|
|
39
|
+
type CommandOutcome
|
|
40
|
+
} from '../../playground/commands/index.js';
|
|
41
|
+
import { resolveRunAction } from '../../playground/runAction.js';
|
|
31
42
|
|
|
32
43
|
interface Props {
|
|
33
44
|
workflowId: string;
|
|
@@ -35,6 +46,8 @@
|
|
|
35
46
|
mode?: PlaygroundMode;
|
|
36
47
|
initialSessionId?: string;
|
|
37
48
|
endpointConfig?: EndpointConfig;
|
|
49
|
+
/** Auth provider applied to this instance's API requests. */
|
|
50
|
+
authProvider?: AuthProvider;
|
|
38
51
|
config?: PlaygroundConfig;
|
|
39
52
|
onClose?: () => void;
|
|
40
53
|
onTogglePanel?: () => void;
|
|
@@ -49,6 +62,7 @@
|
|
|
49
62
|
mode = 'standalone',
|
|
50
63
|
initialSessionId,
|
|
51
64
|
endpointConfig,
|
|
65
|
+
authProvider,
|
|
52
66
|
config = {},
|
|
53
67
|
onClose,
|
|
54
68
|
onTogglePanel,
|
|
@@ -64,6 +78,20 @@
|
|
|
64
78
|
let loadedInitialSessionId = $state<string | undefined>(undefined);
|
|
65
79
|
let autoRunTriggered = $state(false);
|
|
66
80
|
let isRefreshing = $state(false);
|
|
81
|
+
/**
|
|
82
|
+
* Transient result of the last slash command. Deliberately component state,
|
|
83
|
+
* not a session message — see runCommand.
|
|
84
|
+
*/
|
|
85
|
+
let commandFeedback = $state<CommandOutcome | null>(null);
|
|
86
|
+
/**
|
|
87
|
+
* A signal accepted but not yet observed as effective.
|
|
88
|
+
*
|
|
89
|
+
* Backends refuse a second signal on the same pipeline, so we hold this to
|
|
90
|
+
* disable rather than fire a request guaranteed to be rejected. Cleared when
|
|
91
|
+
* the session status changes — that transition is the signal taking effect
|
|
92
|
+
* (or the run ending on its own).
|
|
93
|
+
*/
|
|
94
|
+
let pendingSignal = $state<{ pipelineId: string; signal: string } | null>(null);
|
|
67
95
|
// Monotonic token so a slow session load can't overwrite a newer one when the
|
|
68
96
|
// user switches sessions faster than the network responds (last-load wins).
|
|
69
97
|
let loadToken = 0;
|
|
@@ -126,7 +154,7 @@
|
|
|
126
154
|
}
|
|
127
155
|
|
|
128
156
|
onMount(() => {
|
|
129
|
-
if (endpointConfig) fd.api.configure(endpointConfig);
|
|
157
|
+
if (endpointConfig) fd.api.configure(endpointConfig, authProvider);
|
|
130
158
|
if (workflow) fd.playground.setWorkflow(workflow);
|
|
131
159
|
|
|
132
160
|
const handleVisibility = () => {
|
|
@@ -134,9 +162,14 @@
|
|
|
134
162
|
const sessionId = fd.playground.currentSession?.id;
|
|
135
163
|
if (sessionId) {
|
|
136
164
|
void playgroundService
|
|
137
|
-
.getMessages(
|
|
138
|
-
|
|
139
|
-
|
|
165
|
+
.getMessages(
|
|
166
|
+
fd.api.config,
|
|
167
|
+
sessionId,
|
|
168
|
+
{
|
|
169
|
+
since: playgroundService.getLastSequenceNumber() ?? undefined
|
|
170
|
+
},
|
|
171
|
+
fd.api.authProvider
|
|
172
|
+
)
|
|
140
173
|
.then((response) => fd.playground.applyServerResponse(response, sessionId))
|
|
141
174
|
.catch((err) => logger.error('[Playground] Visibility catchup failed:', err));
|
|
142
175
|
}
|
|
@@ -178,9 +211,8 @@
|
|
|
178
211
|
|
|
179
212
|
if (config.autoRun && !autoRunTriggered) {
|
|
180
213
|
autoRunTriggered = true;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
await handleSendMessage(predefinedMessage);
|
|
214
|
+
logger.debug('[Playground] Auto-run triggered');
|
|
215
|
+
await startRun();
|
|
184
216
|
}
|
|
185
217
|
} catch (err) {
|
|
186
218
|
logger.error('[Playground] Initialization error:', err);
|
|
@@ -220,7 +252,12 @@
|
|
|
220
252
|
fd.playground.setError(null);
|
|
221
253
|
|
|
222
254
|
try {
|
|
223
|
-
const sessionList = await playgroundService.listSessions(
|
|
255
|
+
const sessionList = await playgroundService.listSessions(
|
|
256
|
+
fd.api.config,
|
|
257
|
+
workflowId,
|
|
258
|
+
undefined,
|
|
259
|
+
fd.api.authProvider
|
|
260
|
+
);
|
|
224
261
|
fd.playground.setSessions(sessionList);
|
|
225
262
|
} catch (err) {
|
|
226
263
|
const errorMessage = err instanceof Error ? err.message : 'Failed to load sessions';
|
|
@@ -237,7 +274,11 @@
|
|
|
237
274
|
const token = ++loadToken;
|
|
238
275
|
|
|
239
276
|
try {
|
|
240
|
-
const session = await playgroundService.getSession(
|
|
277
|
+
const session = await playgroundService.getSession(
|
|
278
|
+
fd.api.config,
|
|
279
|
+
sessionId,
|
|
280
|
+
fd.api.authProvider
|
|
281
|
+
);
|
|
241
282
|
if (token !== loadToken) return; // a newer session load superseded us
|
|
242
283
|
fd.playground.setCurrentSession(session);
|
|
243
284
|
|
|
@@ -245,10 +286,15 @@
|
|
|
245
286
|
// user scrolls up (loadOlderMessages). Clear right before applying the
|
|
246
287
|
// fresh page — not before the await — so switching sessions doesn't blank
|
|
247
288
|
// the view for the duration of the fetch.
|
|
248
|
-
const response = await playgroundService.getMessages(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
289
|
+
const response = await playgroundService.getMessages(
|
|
290
|
+
fd.api.config,
|
|
291
|
+
sessionId,
|
|
292
|
+
{
|
|
293
|
+
latest: true,
|
|
294
|
+
limit: messagePageSize
|
|
295
|
+
},
|
|
296
|
+
fd.api.authProvider
|
|
297
|
+
);
|
|
252
298
|
if (token !== loadToken) return;
|
|
253
299
|
fd.playground.clearMessages();
|
|
254
300
|
fd.playground.applyServerResponse(response, sessionId);
|
|
@@ -281,10 +327,15 @@
|
|
|
281
327
|
if (!sessionId || before === null) return;
|
|
282
328
|
|
|
283
329
|
try {
|
|
284
|
-
const response = await playgroundService.getMessages(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
330
|
+
const response = await playgroundService.getMessages(
|
|
331
|
+
fd.api.config,
|
|
332
|
+
sessionId,
|
|
333
|
+
{
|
|
334
|
+
before,
|
|
335
|
+
limit: messagePageSize
|
|
336
|
+
},
|
|
337
|
+
fd.api.authProvider
|
|
338
|
+
);
|
|
288
339
|
// The session may have changed while the fetch was in flight — don't
|
|
289
340
|
// splice an old session's page into the new session's store.
|
|
290
341
|
if (fd.playground.currentSession?.id !== sessionId) return;
|
|
@@ -313,7 +364,13 @@
|
|
|
313
364
|
|
|
314
365
|
try {
|
|
315
366
|
const sessionName = `Session ${fd.playground.sessions.length + 1}`;
|
|
316
|
-
const session = await playgroundService.createSession(
|
|
367
|
+
const session = await playgroundService.createSession(
|
|
368
|
+
fd.api.config,
|
|
369
|
+
workflowId,
|
|
370
|
+
sessionName,
|
|
371
|
+
undefined,
|
|
372
|
+
fd.api.authProvider
|
|
373
|
+
);
|
|
317
374
|
|
|
318
375
|
// Stop polling the previous (possibly running) session before switching,
|
|
319
376
|
// mirroring handleSelectSession. Otherwise its next poll keeps the old
|
|
@@ -349,7 +406,7 @@
|
|
|
349
406
|
|
|
350
407
|
async function handleDeleteSession(sessionId: string): Promise<void> {
|
|
351
408
|
try {
|
|
352
|
-
await playgroundService.deleteSession(fd.api.config, sessionId);
|
|
409
|
+
await playgroundService.deleteSession(fd.api.config, sessionId, fd.api.authProvider);
|
|
353
410
|
fd.playground.removeSession(sessionId);
|
|
354
411
|
|
|
355
412
|
if (fd.playground.currentSession?.id === sessionId) {
|
|
@@ -362,9 +419,195 @@
|
|
|
362
419
|
}
|
|
363
420
|
}
|
|
364
421
|
|
|
422
|
+
/**
|
|
423
|
+
* Reset a stuck session to idle.
|
|
424
|
+
*
|
|
425
|
+
* Mirrors handleStopExecution: tear down polling and force the local status
|
|
426
|
+
* back to idle even on failure, since the point of reset is to escape a state
|
|
427
|
+
* the client and server disagree about.
|
|
428
|
+
*/
|
|
429
|
+
async function handleResetSession(): Promise<void> {
|
|
430
|
+
const sessionId = fd.playground.currentSession?.id;
|
|
431
|
+
if (!sessionId) return;
|
|
432
|
+
|
|
433
|
+
try {
|
|
434
|
+
await playgroundService.resetSession(fd.api.config, sessionId, fd.api.authProvider);
|
|
435
|
+
playgroundService.stopPolling();
|
|
436
|
+
fd.playground.updateSessionStatus('idle');
|
|
437
|
+
fd.playground.setError(null);
|
|
438
|
+
} catch (err) {
|
|
439
|
+
playgroundService.stopPolling();
|
|
440
|
+
fd.playground.updateSessionStatus('idle');
|
|
441
|
+
logger.error('Failed to reset session:', err);
|
|
442
|
+
throw err;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Launch a run with named inputs and no chat message.
|
|
448
|
+
*
|
|
449
|
+
* Creates a session first when there is none, so the run has a conversation
|
|
450
|
+
* to report into — the launch endpoint accepts a session id precisely so its
|
|
451
|
+
* messages land somewhere the user is looking.
|
|
452
|
+
*/
|
|
453
|
+
async function handleLaunchWorkflow(inputs: Record<string, string>) {
|
|
454
|
+
if (!fd.playground.currentSession) {
|
|
455
|
+
await handleCreateSession();
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const sessionId = fd.playground.currentSession?.id;
|
|
459
|
+
|
|
460
|
+
const result = await workflowLaunchService.launch(
|
|
461
|
+
fd.api.config,
|
|
462
|
+
workflowId,
|
|
463
|
+
{ inputs, sessionId },
|
|
464
|
+
fd.api.authProvider
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
if (result.status === 'launched' && sessionId) {
|
|
468
|
+
// Mirror handleSendMessage: reflect the run optimistically and tail it.
|
|
469
|
+
fd.playground.updateSessionStatus('running');
|
|
470
|
+
fd.playground.pinExecution(null);
|
|
471
|
+
fd.playground.setError(null);
|
|
472
|
+
if (!playgroundService.isPolling()) {
|
|
473
|
+
startPolling(sessionId, true);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Start a run from a button or auto-run, without posting a chat message.
|
|
482
|
+
*
|
|
483
|
+
* Falls back to sending `predefinedMessage` only where the backend has no
|
|
484
|
+
* launch verb — there a message is genuinely the only way to start a run, so
|
|
485
|
+
* the fabricated turn is the lesser evil. Everywhere else this is what stops
|
|
486
|
+
* "Run workflow" appearing in the conversation as though a user typed it.
|
|
487
|
+
*/
|
|
488
|
+
async function startRun(): Promise<void> {
|
|
489
|
+
const action = resolveRunAction({
|
|
490
|
+
canLaunch: workflowLaunchService.isSupported(fd.api.config),
|
|
491
|
+
predefinedMessage: config.predefinedMessage,
|
|
492
|
+
defaultMessage: m().playground.chat.predefinedRun
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
if (action.kind === 'message') {
|
|
496
|
+
logger.debug('[Playground] Starting run by message:', action.content);
|
|
497
|
+
await handleSendMessage(action.content);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const result = await handleLaunchWorkflow({});
|
|
502
|
+
|
|
503
|
+
// Only failures need reporting: a successful launch is evident from the run
|
|
504
|
+
// itself appearing in the console.
|
|
505
|
+
if (result.status !== 'launched') {
|
|
506
|
+
commandFeedback = describeLaunchResult(result, m().playground.commands);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Send an operator signal to a specific pipeline.
|
|
512
|
+
*
|
|
513
|
+
* Records the signal as pending on acceptance so a second one is refused
|
|
514
|
+
* client-side rather than by the backend.
|
|
515
|
+
*/
|
|
516
|
+
async function handleSendSignal(
|
|
517
|
+
signal: 'pause' | 'resume' | 'cancel',
|
|
518
|
+
pipelineId: string,
|
|
519
|
+
reason?: string
|
|
520
|
+
) {
|
|
521
|
+
const result = await pipelineSignalService[signal](
|
|
522
|
+
fd.api.config,
|
|
523
|
+
pipelineId,
|
|
524
|
+
{ reason },
|
|
525
|
+
fd.api.authProvider
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
if (result.status === 'accepted') {
|
|
529
|
+
pendingSignal = { pipelineId, signal };
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Clear a pending signal once the session status moves.
|
|
537
|
+
*
|
|
538
|
+
* The status transition is the observable consequence of the signal landing
|
|
539
|
+
* — or of the run ending by itself, which equally means the signal is moot.
|
|
540
|
+
*/
|
|
541
|
+
$effect(() => {
|
|
542
|
+
// Track the status so this re-runs on every change.
|
|
543
|
+
void fd.playground.currentSession?.status;
|
|
544
|
+
untrack(() => {
|
|
545
|
+
if (pendingSignal) pendingSignal = null;
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Run a slash command and surface its outcome as transient composer feedback.
|
|
551
|
+
*
|
|
552
|
+
* Commands are never posted as session messages — control traffic must not
|
|
553
|
+
* enter conversation history, or it returns as the next turn's chat input.
|
|
554
|
+
*/
|
|
555
|
+
async function runCommand(input: string): Promise<void> {
|
|
556
|
+
const parsed = parseSlashCommand(input);
|
|
557
|
+
const msgs = m().playground.commands;
|
|
558
|
+
|
|
559
|
+
if (parsed.kind === 'unknown') {
|
|
560
|
+
commandFeedback = {
|
|
561
|
+
status: 'error',
|
|
562
|
+
message: parsed.suggestions.length
|
|
563
|
+
? msgs.unknownWithSuggestions({
|
|
564
|
+
name: parsed.name,
|
|
565
|
+
suggestions: parsed.suggestions.map((s) => `/${s}`).join(', ')
|
|
566
|
+
})
|
|
567
|
+
: msgs.unknown({ name: parsed.name })
|
|
568
|
+
};
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (parsed.kind !== 'command') return;
|
|
573
|
+
|
|
574
|
+
commandFeedback = await dispatchCommand(parsed.command, {
|
|
575
|
+
config: fd.api.config,
|
|
576
|
+
sessionId: fd.playground.currentSession?.id ?? null,
|
|
577
|
+
// The active run: pinned if the user pinned one, else the latest main
|
|
578
|
+
// run. Sub-flows are excluded upstream, so `/pause` targets the run the
|
|
579
|
+
// user means rather than whichever inner iteration is on screen.
|
|
580
|
+
pipelineId: fd.playground.activeExecutionId,
|
|
581
|
+
pendingSignal,
|
|
582
|
+
handlers: {
|
|
583
|
+
createSession: handleCreateSession,
|
|
584
|
+
deleteSession: handleDeleteSession,
|
|
585
|
+
stopExecution: handleStopExecution,
|
|
586
|
+
resetSession: handleResetSession,
|
|
587
|
+
sendSignal: handleSendSignal,
|
|
588
|
+
launchWorkflow: handleLaunchWorkflow
|
|
589
|
+
},
|
|
590
|
+
messages: msgs
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
365
594
|
async function handleSendMessage(content: string): Promise<void> {
|
|
595
|
+
// Commands are intercepted *before* the executing guard: /stop is only
|
|
596
|
+
// useful while a run is in flight, which is exactly when plain text is
|
|
597
|
+
// refused.
|
|
598
|
+
const parsed = parseSlashCommand(content);
|
|
599
|
+
if (parsed.kind === 'command' || parsed.kind === 'unknown') {
|
|
600
|
+
await runCommand(content);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
commandFeedback = null;
|
|
605
|
+
|
|
366
606
|
if (fd.playground.isExecuting) return;
|
|
367
607
|
|
|
608
|
+
// An escaped message (`//foo`) is sent as its literal text (`/foo`).
|
|
609
|
+
const messageContent = parsed.kind === 'message' ? parsed.content : content;
|
|
610
|
+
|
|
368
611
|
if (!fd.playground.currentSession) {
|
|
369
612
|
await handleCreateSession();
|
|
370
613
|
if (!fd.playground.currentSession) return;
|
|
@@ -377,7 +620,13 @@
|
|
|
377
620
|
fd.playground.setError(null);
|
|
378
621
|
|
|
379
622
|
try {
|
|
380
|
-
const message = await playgroundService.sendMessage(
|
|
623
|
+
const message = await playgroundService.sendMessage(
|
|
624
|
+
fd.api.config,
|
|
625
|
+
sessionId,
|
|
626
|
+
messageContent,
|
|
627
|
+
{},
|
|
628
|
+
fd.api.authProvider
|
|
629
|
+
);
|
|
381
630
|
fd.playground.addMessage(message);
|
|
382
631
|
// Only start polling if not already active — avoids resetting the cursor
|
|
383
632
|
// mid-session and re-fetching messages that are already in the store.
|
|
@@ -399,7 +648,7 @@
|
|
|
399
648
|
if (!sessionId) return;
|
|
400
649
|
|
|
401
650
|
try {
|
|
402
|
-
await playgroundService.stopExecution(fd.api.config, sessionId);
|
|
651
|
+
await playgroundService.stopExecution(fd.api.config, sessionId, fd.api.authProvider);
|
|
403
652
|
playgroundService.stopPolling();
|
|
404
653
|
fd.playground.updateSessionStatus('idle');
|
|
405
654
|
} catch (err) {
|
|
@@ -425,7 +674,8 @@
|
|
|
425
674
|
(response) => fd.playground.applyServerResponse(response, sessionId),
|
|
426
675
|
pollingInterval,
|
|
427
676
|
overrideShouldStopPolling ?? config.shouldStopPolling,
|
|
428
|
-
initialSequenceNumber
|
|
677
|
+
initialSequenceNumber,
|
|
678
|
+
fd.api.authProvider
|
|
429
679
|
);
|
|
430
680
|
}
|
|
431
681
|
|
|
@@ -434,9 +684,14 @@
|
|
|
434
684
|
if (!sessionId || isRefreshing) return;
|
|
435
685
|
isRefreshing = true;
|
|
436
686
|
try {
|
|
437
|
-
const response = await playgroundService.getMessages(
|
|
438
|
-
|
|
439
|
-
|
|
687
|
+
const response = await playgroundService.getMessages(
|
|
688
|
+
fd.api.config,
|
|
689
|
+
sessionId,
|
|
690
|
+
{
|
|
691
|
+
since: playgroundService.getLastSequenceNumber() ?? undefined
|
|
692
|
+
},
|
|
693
|
+
fd.api.authProvider
|
|
694
|
+
);
|
|
440
695
|
fd.playground.applyServerResponse(response, sessionId);
|
|
441
696
|
if (response.sessionStatus === 'running' && !playgroundService.isPolling()) {
|
|
442
697
|
startPolling(sessionId, true);
|
|
@@ -455,9 +710,14 @@
|
|
|
455
710
|
try {
|
|
456
711
|
// Catch up immediately rather than waiting for the next poll interval.
|
|
457
712
|
// Use the service's sequence cursor so we only fetch new messages.
|
|
458
|
-
const response = await playgroundService.getMessages(
|
|
459
|
-
|
|
460
|
-
|
|
713
|
+
const response = await playgroundService.getMessages(
|
|
714
|
+
fd.api.config,
|
|
715
|
+
sessionId,
|
|
716
|
+
{
|
|
717
|
+
since: playgroundService.getLastSequenceNumber() ?? undefined
|
|
718
|
+
},
|
|
719
|
+
fd.api.authProvider
|
|
720
|
+
);
|
|
461
721
|
fd.playground.applyServerResponse(response, sessionId);
|
|
462
722
|
} catch (err) {
|
|
463
723
|
logger.error('[Playground] Failed to refresh after interrupt:', err);
|
|
@@ -541,7 +801,11 @@
|
|
|
541
801
|
onDeleteSession={handleDeleteSession}
|
|
542
802
|
onSendMessage={handleSendMessage}
|
|
543
803
|
onStopExecution={handleStopExecution}
|
|
804
|
+
onRunWorkflow={startRun}
|
|
544
805
|
onRefresh={refreshFromServer}
|
|
806
|
+
enableCommands
|
|
807
|
+
{commandFeedback}
|
|
808
|
+
onDismissCommandFeedback={() => (commandFeedback = null)}
|
|
545
809
|
showChatInput={config.showChatInput ?? true}
|
|
546
810
|
showRunButton={config.showRunButton ?? true}
|
|
547
811
|
predefinedMessage={config.predefinedMessage}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Workflow } from '../../types/index.js';
|
|
2
2
|
import type { EndpointConfig } from '../../config/endpoints.js';
|
|
3
|
+
import type { AuthProvider } from '../../types/auth.js';
|
|
3
4
|
import type { PlaygroundMode, PlaygroundConfig } from '../../types/playground.js';
|
|
4
5
|
import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
|
|
5
6
|
interface Props {
|
|
@@ -8,6 +9,8 @@ interface Props {
|
|
|
8
9
|
mode?: PlaygroundMode;
|
|
9
10
|
initialSessionId?: string;
|
|
10
11
|
endpointConfig?: EndpointConfig;
|
|
12
|
+
/** Auth provider applied to this instance's API requests. */
|
|
13
|
+
authProvider?: AuthProvider;
|
|
11
14
|
config?: PlaygroundConfig;
|
|
12
15
|
onClose?: () => void;
|
|
13
16
|
onTogglePanel?: () => void;
|