@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.
Files changed (235) hide show
  1. package/CHANGELOG.md +508 -0
  2. package/MIGRATION-2.0.md +629 -0
  3. package/README.md +23 -23
  4. package/dist/adapters/WorkflowAdapter.d.ts +1 -1
  5. package/dist/adapters/WorkflowAdapter.js +14 -8
  6. package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
  7. package/dist/api/enhanced-client.js +6 -11
  8. package/dist/chat/batchFeedback.d.ts +39 -0
  9. package/dist/chat/batchFeedback.js +51 -0
  10. package/dist/commands/executor.js +15 -1
  11. package/dist/commands/storeIntegration.svelte.d.ts +4 -1
  12. package/dist/commands/storeIntegration.svelte.js +26 -21
  13. package/dist/commands/types.d.ts +2 -0
  14. package/dist/components/App.svelte +163 -192
  15. package/dist/components/App.svelte.d.ts +47 -8
  16. package/dist/components/ConfigForm.svelte +77 -49
  17. package/dist/components/ConfigModal.svelte +7 -2
  18. package/dist/components/ConnectionLine.svelte +4 -2
  19. package/dist/components/Navbar.svelte +61 -1
  20. package/dist/components/NodeSidebar.svelte +27 -45
  21. package/dist/components/NodeStatusOverlay.svelte +94 -6
  22. package/dist/components/NodeSwapPicker.svelte +10 -8
  23. package/dist/components/PipelineStatus.svelte +22 -68
  24. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  25. package/dist/components/PortCoordinateTracker.svelte +5 -6
  26. package/dist/components/SchemaForm.stories.svelte +1 -3
  27. package/dist/components/SchemaForm.svelte +22 -27
  28. package/dist/components/SchemaForm.svelte.d.ts +0 -8
  29. package/dist/components/SettingsModal.svelte +8 -3
  30. package/dist/components/SettingsPanel.svelte +20 -4
  31. package/dist/components/SwapMappingEditor.svelte +67 -49
  32. package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
  33. package/dist/components/UniversalNode.svelte +9 -7
  34. package/dist/components/WorkflowEditor.svelte +121 -111
  35. package/dist/components/WorkflowEditor.svelte.d.ts +21 -10
  36. package/dist/components/chat/AIChatPanel.svelte +98 -89
  37. package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
  38. package/dist/components/chat/CommandPreview.svelte +2 -1
  39. package/dist/components/console/CommandConsole.svelte +7 -5
  40. package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
  41. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
  42. package/dist/components/console/ConsoleInput.svelte +15 -6
  43. package/dist/components/console/ConsoleOutput.svelte +2 -1
  44. package/dist/components/form/FormArray.svelte +5 -9
  45. package/dist/components/form/FormArray.svelte.d.ts +2 -1
  46. package/dist/components/form/FormAutocomplete.svelte +16 -15
  47. package/dist/components/form/FormField.svelte +4 -2
  48. package/dist/components/form/FormFieldLight.svelte +34 -3
  49. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  50. package/dist/components/form/FormMarkdownEditor.svelte +9 -4
  51. package/dist/components/form/FormRangeField.svelte +1 -0
  52. package/dist/components/form/FormTemplateEditor.svelte +11 -3
  53. package/dist/components/form/FormToggle.svelte +5 -12
  54. package/dist/components/form/FormToggle.svelte.d.ts +4 -2
  55. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  56. package/dist/components/form/templateAutocomplete.js +1 -5
  57. package/dist/components/form/types.d.ts +1 -14
  58. package/dist/components/interrupt/FormPrompt.svelte +3 -2
  59. package/dist/components/interrupt/InterruptBubble.svelte +25 -17
  60. package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
  61. package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
  62. package/dist/components/layouts/MainLayout.svelte +20 -13
  63. package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
  64. package/dist/components/nodes/AtomNode.svelte +17 -5
  65. package/dist/components/nodes/GatewayNode.svelte +19 -10
  66. package/dist/components/nodes/IdeaNode.svelte +7 -0
  67. package/dist/components/nodes/SimpleNode.svelte +11 -6
  68. package/dist/components/nodes/SquareNode.svelte +15 -8
  69. package/dist/components/nodes/TerminalNode.svelte +9 -4
  70. package/dist/components/nodes/ToolNode.svelte +7 -1
  71. package/dist/components/nodes/WorkflowNode.svelte +16 -7
  72. package/dist/components/playground/ChatInput.svelte +11 -14
  73. package/dist/components/playground/ChatPanel.svelte +6 -49
  74. package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
  75. package/dist/components/playground/ControlPanel.svelte +134 -123
  76. package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
  77. package/dist/components/playground/ExecutionLogs.svelte +11 -9
  78. package/dist/components/playground/InputCollector.svelte +11 -9
  79. package/dist/components/playground/MessageStream.svelte +17 -23
  80. package/dist/components/playground/PipelineKanbanView.svelte +69 -8
  81. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  82. package/dist/components/playground/PipelinePanel.svelte +31 -8
  83. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  84. package/dist/components/playground/PipelineTableView.svelte +188 -44
  85. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  86. package/dist/components/playground/Playground.svelte +154 -105
  87. package/dist/components/playground/Playground.svelte.d.ts +5 -0
  88. package/dist/components/playground/PlaygroundApp.svelte +11 -1
  89. package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
  90. package/dist/components/playground/PlaygroundModal.svelte +18 -3
  91. package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
  92. package/dist/components/playground/PlaygroundStudio.svelte +40 -32
  93. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
  94. package/dist/components/playground/SessionManager.svelte +9 -12
  95. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
  96. package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
  97. package/dist/config/endpoints.d.ts +23 -7
  98. package/dist/config/endpoints.js +30 -10
  99. package/dist/core/index.d.ts +5 -6
  100. package/dist/core/index.js +8 -12
  101. package/dist/display/index.d.ts +6 -3
  102. package/dist/display/index.js +7 -5
  103. package/dist/editor/index.d.ts +20 -21
  104. package/dist/editor/index.js +26 -36
  105. package/dist/form/code.d.ts +25 -15
  106. package/dist/form/code.js +44 -41
  107. package/dist/form/fieldRegistry.d.ts +17 -13
  108. package/dist/form/fieldRegistry.js +32 -12
  109. package/dist/form/full.d.ts +19 -14
  110. package/dist/form/full.js +26 -28
  111. package/dist/form/index.d.ts +3 -4
  112. package/dist/form/index.js +6 -5
  113. package/dist/form/markdown.d.ts +13 -8
  114. package/dist/form/markdown.js +22 -23
  115. package/dist/helpers/proximityConnect.d.ts +3 -2
  116. package/dist/helpers/proximityConnect.js +2 -5
  117. package/dist/helpers/workflowEditorHelper.d.ts +14 -5
  118. package/dist/helpers/workflowEditorHelper.js +28 -25
  119. package/dist/index.d.ts +28 -24
  120. package/dist/index.js +27 -50
  121. package/dist/messages/defaults.d.ts +2 -5
  122. package/dist/messages/defaults.js +3 -6
  123. package/dist/messages/index.d.ts +0 -1
  124. package/dist/messages/index.js +0 -1
  125. package/dist/mocks/app-forms.d.ts +6 -2
  126. package/dist/mocks/app-forms.js +11 -4
  127. package/dist/openapi/v1/openapi.yaml +3 -3
  128. package/dist/playground/index.d.ts +4 -5
  129. package/dist/playground/index.js +4 -32
  130. package/dist/playground/mount.d.ts +25 -0
  131. package/dist/playground/mount.js +50 -20
  132. package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
  133. package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
  134. package/dist/registry/builtinFormats.d.ts +9 -18
  135. package/dist/registry/builtinFormats.js +9 -39
  136. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  137. package/dist/registry/builtinNodeTypes.js +67 -0
  138. package/dist/registry/builtinNodes.d.ts +2 -64
  139. package/dist/registry/builtinNodes.js +7 -103
  140. package/dist/registry/index.d.ts +3 -4
  141. package/dist/registry/index.js +4 -6
  142. package/dist/registry/nodeComponentRegistry.d.ts +182 -15
  143. package/dist/registry/nodeComponentRegistry.js +235 -17
  144. package/dist/registry/workflowFormatRegistry.d.ts +14 -9
  145. package/dist/registry/workflowFormatRegistry.js +24 -8
  146. package/dist/{schema → schemas}/index.d.ts +2 -2
  147. package/dist/{schema → schemas}/index.js +2 -2
  148. package/dist/schemas/v1/workflow.schema.json +3 -3
  149. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  150. package/dist/services/agentSpecExecutionService.js +0 -3
  151. package/dist/services/apiVariableService.d.ts +2 -1
  152. package/dist/services/apiVariableService.js +16 -47
  153. package/dist/services/autoSaveService.d.ts +7 -0
  154. package/dist/services/autoSaveService.js +6 -4
  155. package/dist/services/categoriesApi.js +3 -6
  156. package/dist/services/chatService.d.ts +9 -4
  157. package/dist/services/chatService.js +23 -28
  158. package/dist/services/draftStorage.d.ts +129 -13
  159. package/dist/services/draftStorage.js +185 -37
  160. package/dist/services/dynamicSchemaService.d.ts +2 -1
  161. package/dist/services/dynamicSchemaService.js +5 -22
  162. package/dist/services/globalSave.d.ts +13 -12
  163. package/dist/services/globalSave.js +29 -51
  164. package/dist/services/historyService.d.ts +9 -3
  165. package/dist/services/historyService.js +9 -3
  166. package/dist/services/interruptService.d.ts +15 -9
  167. package/dist/services/interruptService.js +35 -37
  168. package/dist/services/nodeExecutionService.d.ts +18 -3
  169. package/dist/services/nodeExecutionService.js +71 -45
  170. package/dist/services/playgroundService.d.ts +16 -10
  171. package/dist/services/playgroundService.js +42 -43
  172. package/dist/services/portConfigApi.js +3 -6
  173. package/dist/services/settingsService.d.ts +9 -4
  174. package/dist/services/settingsService.js +23 -12
  175. package/dist/services/variableService.d.ts +2 -1
  176. package/dist/services/variableService.js +2 -2
  177. package/dist/services/workflowStorage.js +6 -6
  178. package/dist/stores/apiContext.d.ts +56 -0
  179. package/dist/stores/apiContext.js +80 -0
  180. package/dist/stores/categoriesStore.svelte.d.ts +28 -23
  181. package/dist/stores/categoriesStore.svelte.js +69 -64
  182. package/dist/stores/getInstance.svelte.d.ts +39 -0
  183. package/dist/stores/getInstance.svelte.js +65 -0
  184. package/dist/stores/historyStore.svelte.d.ts +77 -93
  185. package/dist/stores/historyStore.svelte.js +134 -160
  186. package/dist/stores/instanceContainer.svelte.d.ts +111 -0
  187. package/dist/stores/instanceContainer.svelte.js +114 -0
  188. package/dist/stores/interruptStore.svelte.d.ts +112 -82
  189. package/dist/stores/interruptStore.svelte.js +253 -226
  190. package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
  191. package/dist/stores/pipelinePanelStore.svelte.js +61 -14
  192. package/dist/stores/playgroundStore.svelte.d.ts +169 -222
  193. package/dist/stores/playgroundStore.svelte.js +513 -580
  194. package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
  195. package/dist/stores/portCoordinateStore.svelte.js +109 -98
  196. package/dist/stores/settingsStore.svelte.d.ts +4 -1
  197. package/dist/stores/settingsStore.svelte.js +47 -12
  198. package/dist/stores/workflowStore.svelte.d.ts +178 -213
  199. package/dist/stores/workflowStore.svelte.js +449 -501
  200. package/dist/stories/EdgeDecorator.svelte +5 -2
  201. package/dist/stories/NodeDecorator.svelte +5 -3
  202. package/dist/svelte-app.d.ts +60 -10
  203. package/dist/svelte-app.js +159 -54
  204. package/dist/types/auth.d.ts +9 -51
  205. package/dist/types/auth.js +4 -54
  206. package/dist/types/events.d.ts +6 -3
  207. package/dist/types/index.d.ts +37 -5
  208. package/dist/types/index.js +0 -1
  209. package/dist/types/navbar.d.ts +7 -0
  210. package/dist/types/playground.d.ts +18 -3
  211. package/dist/types/settings.d.ts +13 -0
  212. package/dist/types/settings.js +1 -0
  213. package/dist/utils/colors.d.ts +47 -21
  214. package/dist/utils/colors.js +69 -68
  215. package/dist/utils/connections.d.ts +9 -15
  216. package/dist/utils/connections.js +13 -32
  217. package/dist/utils/duration.d.ts +13 -0
  218. package/dist/utils/duration.js +45 -0
  219. package/dist/utils/edgeStyling.js +9 -5
  220. package/dist/utils/fetchWithAuth.d.ts +36 -15
  221. package/dist/utils/fetchWithAuth.js +53 -23
  222. package/dist/utils/icons.d.ts +5 -2
  223. package/dist/utils/icons.js +6 -5
  224. package/dist/utils/nodeSwap.d.ts +6 -2
  225. package/dist/utils/nodeSwap.js +62 -126
  226. package/dist/utils/nodeTypes.d.ts +17 -8
  227. package/dist/utils/nodeTypes.js +27 -20
  228. package/dist/utils/performanceUtils.js +7 -0
  229. package/package.json +7 -5
  230. package/dist/messages/deprecation.d.ts +0 -20
  231. package/dist/messages/deprecation.js +0 -33
  232. package/dist/registry/plugin.d.ts +0 -215
  233. package/dist/registry/plugin.js +0 -249
  234. package/dist/services/api.d.ts +0 -129
  235. 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
- let _isOpen = $state(false);
3
- export function getPipelinePanelOpen() {
4
- return _isOpen;
5
- }
6
- export const pipelinePanelActions = {
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 !== 'undefined') {
9
- _isOpen = localStorage.getItem(STORAGE_KEY) === 'true';
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
- _isOpen = !_isOpen;
59
+ this.#isOpen = !this.#isOpen;
14
60
  if (typeof localStorage !== 'undefined') {
15
- localStorage.setItem(STORAGE_KEY, String(_isOpen));
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
- _isOpen = value;
66
+ this.#isOpen = value;
20
67
  if (typeof localStorage !== 'undefined') {
21
- localStorage.setItem(STORAGE_KEY, String(value));
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
- * Get the current session
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
- * Analyzes the workflow to extract input nodes and their configuration
72
- * schemas for auto-generating input forms.
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 declare function getPipelineRefreshTrigger(): number;
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
- * Set the current session
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
- setCurrentSession: (session: PlaygroundSession | null) => void;
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
- * Update session status
82
+ * Input fields from workflow input nodes.
119
83
  *
120
- * @param status - The new status
84
+ * Analyzes the workflow to extract input nodes and their configuration
85
+ * schemas for auto-generating input forms.
121
86
  */
122
- updateSessionStatus: (status: PlaygroundSessionStatus) => void;
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
- * Set the sessions list
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
- setSessions: (sessionList: PlaygroundSession[]) => void;
102
+ get selectableExecutions(): PlaygroundExecution[];
129
103
  /**
130
- * Add a new session to the list
131
- *
132
- * @param session - The session to add
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
- addSession: (session: PlaygroundSession) => void;
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
- * Remove a session from the list
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
- removeSession: (sessionId: string) => void;
118
+ get latestSequenceNumber(): number | null;
141
119
  /**
142
- * Set messages for the current session
143
- * Messages are automatically sorted chronologically
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
- setMessages: (messageList: PlaygroundMessage[]) => void;
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
- * Add a message to the current session
150
- * Uses binary search insertion for O(log n) instead of full sort.
151
- *
152
- * @param message - The message to add
137
+ * Set messages for the current session.
138
+ * Messages are automatically sorted chronologically.
153
139
  */
154
- addMessage: (message: PlaygroundMessage) => void;
140
+ setMessages(messageList: PlaygroundMessage[]): void;
155
141
  /**
156
- * Add multiple messages to the current session
157
- * Messages are deduplicated and automatically sorted chronologically
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
- addMessages: (newMessages: PlaygroundMessage[]) => void;
145
+ addMessage(message: PlaygroundMessage): void;
162
146
  /**
163
- * Clear all messages
147
+ * Add multiple messages to the current session.
148
+ * Messages are deduplicated and automatically sorted chronologically.
164
149
  */
165
- clearMessages: () => void;
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
- * Set the loading state
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
- * @param loading - Whether loading is in progress
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
- setLoading: (loading: boolean) => void;
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 an error message
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
- setError: (errorMessage: string | null) => void;
187
+ setHasOlder(hasOlder: boolean): void;
178
188
  /**
179
- * Update the last poll timestamp
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 timestamp - ISO 8601 timestamp
196
+ * @param callback - Called when session status changes
197
+ * @returns Cleanup function to stop the subscription
182
198
  */
183
- updateLastPollSequenceNumber: (seq: number) => void;
199
+ subscribeToSessionStatus(callback: (status: PlaygroundSessionStatus, previousStatus: PlaygroundSessionStatus) => void): () => void;
184
200
  /**
185
- * Reset all playground state
201
+ * Dispose all active session-status effect roots.
202
+ * Called by the owning instance's destroy(); safe to call repeatedly.
186
203
  */
187
- reset: () => void;
204
+ dispose(): void;
188
205
  /**
189
- * Switch to a different session
206
+ * Refresh messages for the current session.
190
207
  *
191
- * @param sessionId - The session ID to switch to
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
- switchSession: (sessionId: string) => void;
194
- pinExecution(executionId: string | null): void;
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
+ }