@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.2
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 +508 -0
- package/MIGRATION-2.0.md +629 -0
- package/README.md +23 -23
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +14 -8
- package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +15 -1
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +26 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/App.svelte +163 -192
- package/dist/components/App.svelte.d.ts +47 -8
- package/dist/components/ConfigForm.svelte +77 -49
- package/dist/components/ConfigModal.svelte +7 -2
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/Navbar.svelte +61 -1
- package/dist/components/NodeSidebar.svelte +27 -45
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +10 -8
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -27
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/SettingsModal.svelte +8 -3
- package/dist/components/SettingsPanel.svelte +20 -4
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/UniversalNode.svelte +9 -7
- package/dist/components/WorkflowEditor.svelte +121 -111
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -10
- package/dist/components/chat/AIChatPanel.svelte +98 -89
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +15 -6
- package/dist/components/console/ConsoleOutput.svelte +2 -1
- package/dist/components/form/FormArray.svelte +5 -9
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +16 -15
- package/dist/components/form/FormField.svelte +4 -2
- package/dist/components/form/FormFieldLight.svelte +34 -3
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormMarkdownEditor.svelte +9 -4
- package/dist/components/form/FormRangeField.svelte +1 -0
- package/dist/components/form/FormTemplateEditor.svelte +11 -3
- package/dist/components/form/FormToggle.svelte +5 -12
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -17
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
- package/dist/components/layouts/MainLayout.svelte +20 -13
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +17 -5
- package/dist/components/nodes/GatewayNode.svelte +19 -10
- package/dist/components/nodes/IdeaNode.svelte +7 -0
- package/dist/components/nodes/SimpleNode.svelte +11 -6
- package/dist/components/nodes/SquareNode.svelte +15 -8
- package/dist/components/nodes/TerminalNode.svelte +9 -4
- package/dist/components/nodes/ToolNode.svelte +7 -1
- package/dist/components/nodes/WorkflowNode.svelte +16 -7
- package/dist/components/playground/ChatInput.svelte +11 -14
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +11 -9
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +11 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -32
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +5 -6
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +28 -25
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +0 -1
- package/dist/messages/index.js +0 -1
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +3 -3
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +25 -0
- package/dist/playground/mount.js +50 -20
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +182 -15
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +3 -3
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +2 -1
- package/dist/services/dynamicSchemaService.js +5 -22
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +9 -3
- package/dist/services/historyService.js +9 -3
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- 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/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +77 -93
- package/dist/stores/historyStore.svelte.js +134 -160
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +114 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +4 -1
- package/dist/stores/settingsStore.svelte.js +47 -12
- package/dist/stores/workflowStore.svelte.d.ts +178 -213
- package/dist/stores/workflowStore.svelte.js +449 -501
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/svelte-app.d.ts +60 -10
- package/dist/svelte-app.js +159 -54
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +6 -3
- package/dist/types/index.d.ts +37 -5
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.js +1 -0
- package/dist/utils/colors.d.ts +47 -21
- package/dist/utils/colors.js +69 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +13 -32
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- 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/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -126
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -1,24 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline Panel Store for FlowDrop (Svelte 5 Runes)
|
|
3
|
+
*
|
|
4
|
+
* Tracks whether the pipeline panel is open, persisting the choice to
|
|
5
|
+
* localStorage so it survives reloads.
|
|
6
|
+
*
|
|
7
|
+
* The reactive state lives in the {@link PipelinePanelStore} class — one per
|
|
8
|
+
* FlowDrop instance, resolved in components via `getInstance().pipelinePanel`.
|
|
9
|
+
*
|
|
10
|
+
* @module stores/pipelinePanelStore
|
|
11
|
+
*/
|
|
12
|
+
/** Base localStorage key for the panel open state. */
|
|
1
13
|
const STORAGE_KEY = 'fd-pipeline-panel-open';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
// =========================================================================
|
|
15
|
+
// PipelinePanelStore (per-instance reactive state)
|
|
16
|
+
// =========================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Per-instance pipeline panel open state.
|
|
19
|
+
*
|
|
20
|
+
* Reads go through the {@link isOpen} getter backed by `$state`, so they track
|
|
21
|
+
* reactively in templates and `$derived`.
|
|
22
|
+
*/
|
|
23
|
+
export class PipelinePanelStore {
|
|
24
|
+
/** Whether the pipeline panel is currently open. */
|
|
25
|
+
#isOpen = $state(false);
|
|
26
|
+
/**
|
|
27
|
+
* The localStorage key for this instance — always instance-scoped
|
|
28
|
+
* (`fd-pipeline-panel-open:<instanceId>`) so multiple editors on one page
|
|
29
|
+
* don't clobber each other.
|
|
30
|
+
*/
|
|
31
|
+
#storageKey;
|
|
32
|
+
/** @param instanceId - Instance id used to scope the localStorage key. */
|
|
33
|
+
constructor(instanceId) {
|
|
34
|
+
this.#storageKey = `${STORAGE_KEY}:${instanceId}`;
|
|
35
|
+
}
|
|
36
|
+
/** Whether the pipeline panel is currently open (reactive). */
|
|
37
|
+
get isOpen() {
|
|
38
|
+
return this.#isOpen;
|
|
39
|
+
}
|
|
40
|
+
/** Initialize open state from localStorage. */
|
|
7
41
|
init() {
|
|
8
|
-
if (typeof localStorage
|
|
9
|
-
|
|
42
|
+
if (typeof localStorage === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
let stored = localStorage.getItem(this.#storageKey);
|
|
45
|
+
// One-time migration: in 1.x the page-default instance stored its state
|
|
46
|
+
// under the bare key. Adopt it on first read, then remove it.
|
|
47
|
+
if (stored === null && this.#storageKey === `${STORAGE_KEY}:default`) {
|
|
48
|
+
const legacy = localStorage.getItem(STORAGE_KEY);
|
|
49
|
+
if (legacy !== null) {
|
|
50
|
+
localStorage.setItem(this.#storageKey, legacy);
|
|
51
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
52
|
+
stored = legacy;
|
|
53
|
+
}
|
|
10
54
|
}
|
|
11
|
-
|
|
55
|
+
this.#isOpen = stored === 'true';
|
|
56
|
+
}
|
|
57
|
+
/** Toggle the panel open/closed, persisting the new state. */
|
|
12
58
|
toggle() {
|
|
13
|
-
|
|
59
|
+
this.#isOpen = !this.#isOpen;
|
|
14
60
|
if (typeof localStorage !== 'undefined') {
|
|
15
|
-
localStorage.setItem(
|
|
61
|
+
localStorage.setItem(this.#storageKey, String(this.#isOpen));
|
|
16
62
|
}
|
|
17
|
-
}
|
|
63
|
+
}
|
|
64
|
+
/** Set the panel open state explicitly, persisting it. */
|
|
18
65
|
setOpen(value) {
|
|
19
|
-
|
|
66
|
+
this.#isOpen = value;
|
|
20
67
|
if (typeof localStorage !== 'undefined') {
|
|
21
|
-
localStorage.setItem(
|
|
68
|
+
localStorage.setItem(this.#storageKey, String(value));
|
|
22
69
|
}
|
|
23
70
|
}
|
|
24
|
-
}
|
|
71
|
+
}
|
|
@@ -4,265 +4,212 @@
|
|
|
4
4
|
* Svelte 5 rune-based state for managing playground state including sessions,
|
|
5
5
|
* messages, and execution status.
|
|
6
6
|
*
|
|
7
|
+
* The reactive state lives in the {@link PlaygroundStore} class — one per
|
|
8
|
+
* FlowDrop instance, created by `createFlowDropInstance()` and resolved in
|
|
9
|
+
* components via `getInstance().playground`.
|
|
10
|
+
*
|
|
7
11
|
* @module stores/playgroundStore
|
|
8
12
|
*/
|
|
9
13
|
import type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundSessionStatus, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js';
|
|
10
14
|
import type { Workflow } from '../types/index.js';
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
export declare function getCurrentSession(): PlaygroundSession | null;
|
|
15
|
-
/**
|
|
16
|
-
* Get all sessions
|
|
17
|
-
*/
|
|
18
|
-
export declare function getSessions(): PlaygroundSession[];
|
|
19
|
-
/**
|
|
20
|
-
* Get all messages
|
|
21
|
-
*/
|
|
22
|
-
export declare function getMessages(): PlaygroundMessage[];
|
|
23
|
-
/**
|
|
24
|
-
* Get executing state
|
|
25
|
-
*/
|
|
26
|
-
export declare function getIsExecuting(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Get loading state
|
|
29
|
-
*/
|
|
30
|
-
export declare function getIsLoading(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Get error state
|
|
33
|
-
*/
|
|
34
|
-
export declare function getError(): string | null;
|
|
35
|
-
/**
|
|
36
|
-
* Get the current workflow
|
|
37
|
-
*/
|
|
38
|
-
export declare function getCurrentWorkflow(): Workflow | null;
|
|
39
|
-
/**
|
|
40
|
-
* Get the last poll sequence number cursor
|
|
41
|
-
*/
|
|
42
|
-
export declare function getLastPollSequenceNumber(): number | null;
|
|
43
|
-
/**
|
|
44
|
-
* Get current session status
|
|
45
|
-
*/
|
|
46
|
-
export declare function getSessionStatus(): PlaygroundSessionStatus;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the user can currently send a message.
|
|
49
|
-
* False when executing, when awaiting input, or when no session exists.
|
|
50
|
-
*/
|
|
51
|
-
export declare function getCanSendMessage(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get message count
|
|
54
|
-
*/
|
|
55
|
-
export declare function getMessageCount(): number;
|
|
56
|
-
/**
|
|
57
|
-
* Get chat messages (excludes log messages)
|
|
58
|
-
*/
|
|
59
|
-
export declare function getChatMessages(): PlaygroundMessage[];
|
|
60
|
-
/**
|
|
61
|
-
* Get log messages only
|
|
62
|
-
*/
|
|
63
|
-
export declare function getLogMessages(): PlaygroundMessage[];
|
|
64
|
-
/**
|
|
65
|
-
* Get the latest message
|
|
66
|
-
*/
|
|
67
|
-
export declare function getLatestMessage(): PlaygroundMessage | null;
|
|
68
|
-
/**
|
|
69
|
-
* Get input fields from workflow input nodes
|
|
16
|
+
* Playground mutation actions for a {@link PlaygroundStore}.
|
|
70
17
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
export declare function getInputFields(): PlaygroundInputField[];
|
|
75
|
-
/**
|
|
76
|
-
* Check if workflow has a chat input
|
|
77
|
-
*/
|
|
78
|
-
export declare function getHasChatInput(): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Get session count
|
|
81
|
-
*/
|
|
82
|
-
export declare function getSessionCount(): number;
|
|
83
|
-
export declare function getPinnedExecutionId(): string | null;
|
|
84
|
-
export declare function getLatestExecutionId(): string | null;
|
|
85
|
-
export declare function getActiveExecutionId(): string | null;
|
|
86
|
-
/**
|
|
87
|
-
* Main pipeline runs for the run-switcher. Excludes sub-flow runs, which can't
|
|
88
|
-
* render their own graph and so aren't user-selectable.
|
|
89
|
-
*/
|
|
90
|
-
export declare function getSelectableExecutions(): PlaygroundExecution[];
|
|
91
|
-
/**
|
|
92
|
-
* Counter that increments whenever new messages arrive and the pipeline display
|
|
93
|
-
* should re-fetch — i.e. when following latest or pinned to the latest execution.
|
|
94
|
-
* Pass to PipelinePanel's refreshTrigger prop.
|
|
18
|
+
* Bound facade — safe to detach (`onclick={fd.playground.actions.toggleShowLogs}`)
|
|
19
|
+
* because every entry is bound to its store in the constructor.
|
|
95
20
|
*/
|
|
96
|
-
export
|
|
97
|
-
/**
|
|
98
|
-
* Whether log messages should be shown in the execution console
|
|
99
|
-
*/
|
|
100
|
-
export declare function getShowLogs(): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Playground store actions for modifying state
|
|
103
|
-
*/
|
|
104
|
-
export declare const playgroundActions: {
|
|
105
|
-
/**
|
|
106
|
-
* Set the current workflow
|
|
107
|
-
*
|
|
108
|
-
* @param workflow - The workflow to test
|
|
109
|
-
*/
|
|
21
|
+
export interface PlaygroundStoreActions {
|
|
110
22
|
setWorkflow: (workflow: Workflow | null) => void;
|
|
23
|
+
setCurrentSession: (session: PlaygroundSession | null) => void;
|
|
24
|
+
updateSessionStatus: (status: PlaygroundSessionStatus) => void;
|
|
25
|
+
setSessions: (sessionList: PlaygroundSession[]) => void;
|
|
26
|
+
addSession: (session: PlaygroundSession) => void;
|
|
27
|
+
removeSession: (sessionId: string) => void;
|
|
28
|
+
setMessages: (messageList: PlaygroundMessage[]) => void;
|
|
29
|
+
addMessage: (message: PlaygroundMessage) => void;
|
|
30
|
+
addMessages: (newMessages: PlaygroundMessage[]) => void;
|
|
31
|
+
clearMessages: () => void;
|
|
32
|
+
setLoading: (loading: boolean) => void;
|
|
33
|
+
setError: (errorMessage: string | null) => void;
|
|
34
|
+
updateLastPollSequenceNumber: (seq: number) => void;
|
|
35
|
+
reset: () => void;
|
|
36
|
+
switchSession: (sessionId: string) => void;
|
|
37
|
+
pinExecution: (executionId: string | null) => void;
|
|
38
|
+
setShowLogs: (value: boolean) => void;
|
|
39
|
+
toggleShowLogs: () => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Per-instance playground state: sessions, messages, executions, and the
|
|
43
|
+
* polling/refresh machinery around them.
|
|
44
|
+
*/
|
|
45
|
+
export declare class PlaygroundStore {
|
|
46
|
+
#private;
|
|
47
|
+
/** Bound mutation facade — see {@link PlaygroundStoreActions}. */
|
|
48
|
+
readonly actions: PlaygroundStoreActions;
|
|
49
|
+
constructor();
|
|
50
|
+
/** The current session. */
|
|
51
|
+
get currentSession(): PlaygroundSession | null;
|
|
52
|
+
/** All sessions. */
|
|
53
|
+
get sessions(): PlaygroundSession[];
|
|
54
|
+
/** All messages (chronological). */
|
|
55
|
+
get messages(): PlaygroundMessage[];
|
|
56
|
+
/** Executing state (derived from server status). */
|
|
57
|
+
get isExecuting(): boolean;
|
|
58
|
+
/** Loading state. */
|
|
59
|
+
get isLoading(): boolean;
|
|
60
|
+
/** Error state. */
|
|
61
|
+
get error(): string | null;
|
|
62
|
+
/** The current workflow. */
|
|
63
|
+
get currentWorkflow(): Workflow | null;
|
|
64
|
+
/** The last poll sequence number cursor. */
|
|
65
|
+
get lastPollSequenceNumber(): number | null;
|
|
66
|
+
/** Current session status. */
|
|
67
|
+
get sessionStatus(): PlaygroundSessionStatus;
|
|
111
68
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* @param session - The session to set as active
|
|
69
|
+
* Whether the user can currently send a message.
|
|
70
|
+
* False when executing, when awaiting input, or when no session exists.
|
|
115
71
|
*/
|
|
116
|
-
|
|
72
|
+
get canSendMessage(): boolean;
|
|
73
|
+
/** Message count. */
|
|
74
|
+
get messageCount(): number;
|
|
75
|
+
/** Chat messages (excludes log messages). */
|
|
76
|
+
get chatMessages(): PlaygroundMessage[];
|
|
77
|
+
/** Log messages only. */
|
|
78
|
+
get logMessages(): PlaygroundMessage[];
|
|
79
|
+
/** The latest message, or null. */
|
|
80
|
+
get latestMessage(): PlaygroundMessage | null;
|
|
117
81
|
/**
|
|
118
|
-
*
|
|
82
|
+
* Input fields from workflow input nodes.
|
|
119
83
|
*
|
|
120
|
-
*
|
|
84
|
+
* Analyzes the workflow to extract input nodes and their configuration
|
|
85
|
+
* schemas for auto-generating input forms.
|
|
121
86
|
*/
|
|
122
|
-
|
|
87
|
+
get inputFields(): PlaygroundInputField[];
|
|
88
|
+
/** Whether the workflow has a chat input. */
|
|
89
|
+
get hasChatInput(): boolean;
|
|
90
|
+
/** Session count. */
|
|
91
|
+
get sessionCount(): number;
|
|
92
|
+
/** Execution ID explicitly pinned by the user (null = follow latest). */
|
|
93
|
+
get pinnedExecutionId(): string | null;
|
|
94
|
+
/** Latest main-run execution ID. */
|
|
95
|
+
get latestExecutionId(): string | null;
|
|
96
|
+
/** Active execution: pinned if set, otherwise latest. */
|
|
97
|
+
get activeExecutionId(): string | null;
|
|
123
98
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* @param sessionList - Array of sessions
|
|
99
|
+
* Main pipeline runs for the run-switcher. Excludes sub-flow runs, which can't
|
|
100
|
+
* render their own graph and so aren't user-selectable.
|
|
127
101
|
*/
|
|
128
|
-
|
|
102
|
+
get selectableExecutions(): PlaygroundExecution[];
|
|
129
103
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
104
|
+
* Counter that increments whenever new messages arrive and the pipeline display
|
|
105
|
+
* should re-fetch — i.e. when following latest or pinned to the latest execution.
|
|
106
|
+
* Pass to PipelinePanel's refreshTrigger prop.
|
|
133
107
|
*/
|
|
134
|
-
|
|
108
|
+
get pipelineRefreshTrigger(): number;
|
|
109
|
+
/** Whether log messages should be shown in the execution console. */
|
|
110
|
+
get showLogs(): boolean;
|
|
111
|
+
/** The current session ID, or null. */
|
|
112
|
+
get currentSessionId(): string | null;
|
|
113
|
+
/** Whether older messages exist before the oldest one currently loaded. */
|
|
114
|
+
get hasOlder(): boolean;
|
|
135
115
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* @param sessionId - The session ID to remove
|
|
116
|
+
* The sequence number of the latest message, used to seed incremental polling.
|
|
139
117
|
*/
|
|
140
|
-
|
|
118
|
+
get latestSequenceNumber(): number | null;
|
|
141
119
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @param messageList - Array of messages
|
|
120
|
+
* The sequence number of the oldest loaded message, used as the cursor
|
|
121
|
+
* for backward "load older" pagination.
|
|
146
122
|
*/
|
|
147
|
-
|
|
123
|
+
get oldestSequenceNumber(): number | null;
|
|
124
|
+
/** Set the current workflow. */
|
|
125
|
+
setWorkflow(workflow: Workflow | null): void;
|
|
126
|
+
/** Set the current session. */
|
|
127
|
+
setCurrentSession(session: PlaygroundSession | null): void;
|
|
128
|
+
/** Update session status. */
|
|
129
|
+
updateSessionStatus(status: PlaygroundSessionStatus): void;
|
|
130
|
+
/** Set the sessions list. */
|
|
131
|
+
setSessions(sessionList: PlaygroundSession[]): void;
|
|
132
|
+
/** Add a new session to the list. */
|
|
133
|
+
addSession(session: PlaygroundSession): void;
|
|
134
|
+
/** Remove a session from the list. */
|
|
135
|
+
removeSession(sessionId: string): void;
|
|
148
136
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* @param message - The message to add
|
|
137
|
+
* Set messages for the current session.
|
|
138
|
+
* Messages are automatically sorted chronologically.
|
|
153
139
|
*/
|
|
154
|
-
|
|
140
|
+
setMessages(messageList: PlaygroundMessage[]): void;
|
|
155
141
|
/**
|
|
156
|
-
* Add
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* @param newMessages - Array of messages to add
|
|
142
|
+
* Add a message to the current session.
|
|
143
|
+
* Uses binary search insertion for O(log n) instead of full sort.
|
|
160
144
|
*/
|
|
161
|
-
|
|
145
|
+
addMessage(message: PlaygroundMessage): void;
|
|
162
146
|
/**
|
|
163
|
-
*
|
|
147
|
+
* Add multiple messages to the current session.
|
|
148
|
+
* Messages are deduplicated and automatically sorted chronologically.
|
|
164
149
|
*/
|
|
165
|
-
|
|
150
|
+
addMessages(newMessages: PlaygroundMessage[]): void;
|
|
151
|
+
/** Clear all messages. */
|
|
152
|
+
clearMessages(): void;
|
|
153
|
+
/** Set the loading state. */
|
|
154
|
+
setLoading(loading: boolean): void;
|
|
155
|
+
/** Set an error message (or null to clear). */
|
|
156
|
+
setError(errorMessage: string | null): void;
|
|
157
|
+
/** Update the last poll cursor. */
|
|
158
|
+
updateLastPollSequenceNumber(seq: number): void;
|
|
159
|
+
/** Reset all playground state. */
|
|
160
|
+
reset(): void;
|
|
161
|
+
/** Switch to a different session. */
|
|
162
|
+
switchSession(sessionId: string): void;
|
|
163
|
+
/** Pin an execution (null = follow latest). */
|
|
164
|
+
pinExecution(executionId: string | null): void;
|
|
165
|
+
/** Set log message visibility. */
|
|
166
|
+
setShowLogs(value: boolean): void;
|
|
167
|
+
/** Toggle log message visibility. */
|
|
168
|
+
toggleShowLogs(): void;
|
|
166
169
|
/**
|
|
167
|
-
*
|
|
170
|
+
* Apply a server response to the store. All message and status updates from
|
|
171
|
+
* the server flow through here — polling callback, manual fetches, interrupt
|
|
172
|
+
* resolution. Nothing updates messages or session status except this function.
|
|
168
173
|
*
|
|
169
|
-
*
|
|
174
|
+
* Pass `sessionId` (the session the response was fetched for) so a response
|
|
175
|
+
* that resolves after the user switched sessions is dropped instead of writing
|
|
176
|
+
* the old session's status/messages onto the new current session. Pass `null`
|
|
177
|
+
* to deliberately opt out of the guard (non-session-scoped callers only) — the
|
|
178
|
+
* argument is required so every new caller has to make that choice explicitly.
|
|
170
179
|
*/
|
|
171
|
-
|
|
180
|
+
applyServerResponse(response: PlaygroundMessagesApiResponse, sessionId: string | null): void;
|
|
181
|
+
/** Check if a specific session is selected. */
|
|
182
|
+
isSessionSelected(sessionId: string): boolean;
|
|
172
183
|
/**
|
|
173
|
-
* Set
|
|
174
|
-
*
|
|
175
|
-
* @param errorMessage - The error message or null to clear
|
|
184
|
+
* Set whether older messages remain to be loaded, derived from a
|
|
185
|
+
* backward-pagination response.
|
|
176
186
|
*/
|
|
177
|
-
|
|
187
|
+
setHasOlder(hasOlder: boolean): void;
|
|
178
188
|
/**
|
|
179
|
-
*
|
|
189
|
+
* Subscribe to session status changes using $effect.root.
|
|
190
|
+
* This is designed for use in non-component contexts (e.g., mount.ts).
|
|
191
|
+
*
|
|
192
|
+
* The effect root is tracked by the store and also disposed by
|
|
193
|
+
* {@link dispose} (via the owning instance's `destroy()`), so a forgotten
|
|
194
|
+
* unsubscribe can't outlive the instance.
|
|
180
195
|
*
|
|
181
|
-
* @param
|
|
196
|
+
* @param callback - Called when session status changes
|
|
197
|
+
* @returns Cleanup function to stop the subscription
|
|
182
198
|
*/
|
|
183
|
-
|
|
199
|
+
subscribeToSessionStatus(callback: (status: PlaygroundSessionStatus, previousStatus: PlaygroundSessionStatus) => void): () => void;
|
|
184
200
|
/**
|
|
185
|
-
*
|
|
201
|
+
* Dispose all active session-status effect roots.
|
|
202
|
+
* Called by the owning instance's destroy(); safe to call repeatedly.
|
|
186
203
|
*/
|
|
187
|
-
|
|
204
|
+
dispose(): void;
|
|
188
205
|
/**
|
|
189
|
-
*
|
|
206
|
+
* Refresh messages for the current session.
|
|
190
207
|
*
|
|
191
|
-
*
|
|
208
|
+
* This function is useful after interrupt resolution when polling
|
|
209
|
+
* has stopped but new messages may exist on the server.
|
|
210
|
+
*
|
|
211
|
+
* @param fetchMessages - Async function to fetch messages from the API
|
|
212
|
+
* @returns Promise that resolves when messages are refreshed
|
|
192
213
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
setShowLogs(value: boolean): void;
|
|
196
|
-
toggleShowLogs(): void;
|
|
197
|
-
};
|
|
198
|
-
/**
|
|
199
|
-
* Apply a server response to the store. All message and status updates from
|
|
200
|
-
* the server flow through here — polling callback, manual fetches, interrupt
|
|
201
|
-
* resolution. Nothing updates messages or session status except this function.
|
|
202
|
-
*
|
|
203
|
-
* Pass `sessionId` (the session the response was fetched for) so a response
|
|
204
|
-
* that resolves after the user switched sessions is dropped instead of writing
|
|
205
|
-
* the old session's status/messages onto the new current session. Pass `null`
|
|
206
|
-
* to deliberately opt out of the guard (non-session-scoped callers only) — the
|
|
207
|
-
* argument is required so every new caller has to make that choice explicitly.
|
|
208
|
-
*/
|
|
209
|
-
export declare function applyServerResponse(response: PlaygroundMessagesApiResponse, sessionId: string | null): void;
|
|
210
|
-
/**
|
|
211
|
-
* Get the current session ID
|
|
212
|
-
*
|
|
213
|
-
* @returns The current session ID or null
|
|
214
|
-
*/
|
|
215
|
-
export declare function getCurrentSessionId(): string | null;
|
|
216
|
-
/**
|
|
217
|
-
* Check if a specific session is selected
|
|
218
|
-
*
|
|
219
|
-
* @param sessionId - The session ID to check
|
|
220
|
-
* @returns True if the session is currently selected
|
|
221
|
-
*/
|
|
222
|
-
export declare function isSessionSelected(sessionId: string): boolean;
|
|
223
|
-
/**
|
|
224
|
-
* Get all messages as a snapshot
|
|
225
|
-
*
|
|
226
|
-
* @returns Array of all messages
|
|
227
|
-
*/
|
|
228
|
-
export declare function getMessagesSnapshot(): PlaygroundMessage[];
|
|
229
|
-
/**
|
|
230
|
-
* Get the sequence number of the latest message, used to seed incremental polling.
|
|
231
|
-
*
|
|
232
|
-
* @returns Sequence number of the last message, or null
|
|
233
|
-
*/
|
|
234
|
-
export declare function getLatestSequenceNumber(): number | null;
|
|
235
|
-
/**
|
|
236
|
-
* Get the sequence number of the oldest loaded message, used as the cursor
|
|
237
|
-
* for backward "load older" pagination.
|
|
238
|
-
*
|
|
239
|
-
* @returns Sequence number of the first message, or null
|
|
240
|
-
*/
|
|
241
|
-
export declare function getOldestSequenceNumber(): number | null;
|
|
242
|
-
/**
|
|
243
|
-
* Whether older messages exist before the oldest one currently loaded.
|
|
244
|
-
*/
|
|
245
|
-
export declare function getHasOlder(): boolean;
|
|
246
|
-
/**
|
|
247
|
-
* Set whether older messages remain to be loaded, derived from a
|
|
248
|
-
* backward-pagination response.
|
|
249
|
-
*/
|
|
250
|
-
export declare function setHasOlder(hasOlder: boolean): void;
|
|
251
|
-
/**
|
|
252
|
-
* Subscribe to session status changes using $effect.root.
|
|
253
|
-
* This is designed for use in non-component contexts (e.g., mount.ts).
|
|
254
|
-
*
|
|
255
|
-
* @param callback - Called when session status changes
|
|
256
|
-
* @returns Cleanup function to stop the subscription
|
|
257
|
-
*/
|
|
258
|
-
export declare function subscribeToSessionStatus(callback: (status: PlaygroundSessionStatus, previousStatus: PlaygroundSessionStatus) => void): () => void;
|
|
259
|
-
/**
|
|
260
|
-
* Refresh messages for the current session
|
|
261
|
-
*
|
|
262
|
-
* This function is useful after interrupt resolution when polling
|
|
263
|
-
* has stopped but new messages may exist on the server.
|
|
264
|
-
*
|
|
265
|
-
* @param fetchMessages - Async function to fetch messages from the API
|
|
266
|
-
* @returns Promise that resolves when messages are refreshed
|
|
267
|
-
*/
|
|
268
|
-
export declare function refreshSessionMessages(fetchMessages: (sessionId: string) => Promise<PlaygroundMessagesApiResponse>): Promise<void>;
|
|
214
|
+
refreshSessionMessages(fetchMessages: (sessionId: string) => Promise<PlaygroundMessagesApiResponse>): Promise<void>;
|
|
215
|
+
}
|