@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.1

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 (215) hide show
  1. package/CHANGELOG.md +475 -0
  2. package/MIGRATION-2.0.md +472 -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/chat/batchFeedback.d.ts +39 -0
  8. package/dist/chat/batchFeedback.js +51 -0
  9. package/dist/commands/executor.js +15 -1
  10. package/dist/commands/storeIntegration.svelte.d.ts +4 -1
  11. package/dist/commands/storeIntegration.svelte.js +26 -21
  12. package/dist/commands/types.d.ts +2 -0
  13. package/dist/components/App.svelte +162 -192
  14. package/dist/components/App.svelte.d.ts +47 -8
  15. package/dist/components/ConfigForm.svelte +71 -47
  16. package/dist/components/ConfigModal.svelte +7 -2
  17. package/dist/components/ConnectionLine.svelte +4 -2
  18. package/dist/components/Navbar.svelte +61 -1
  19. package/dist/components/NodeSidebar.svelte +27 -45
  20. package/dist/components/NodeStatusOverlay.svelte +94 -6
  21. package/dist/components/NodeSwapPicker.svelte +10 -8
  22. package/dist/components/PipelineStatus.svelte +16 -67
  23. package/dist/components/PortCoordinateTracker.svelte +5 -6
  24. package/dist/components/SchemaForm.stories.svelte +1 -3
  25. package/dist/components/SchemaForm.svelte +18 -25
  26. package/dist/components/SchemaForm.svelte.d.ts +0 -8
  27. package/dist/components/SettingsModal.svelte +8 -3
  28. package/dist/components/SettingsPanel.svelte +20 -4
  29. package/dist/components/SwapMappingEditor.svelte +67 -49
  30. package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
  31. package/dist/components/UniversalNode.svelte +9 -7
  32. package/dist/components/WorkflowEditor.svelte +118 -111
  33. package/dist/components/WorkflowEditor.svelte.d.ts +18 -10
  34. package/dist/components/chat/AIChatPanel.svelte +93 -89
  35. package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
  36. package/dist/components/chat/CommandPreview.svelte +2 -1
  37. package/dist/components/console/CommandConsole.svelte +7 -5
  38. package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
  39. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
  40. package/dist/components/console/ConsoleInput.svelte +15 -6
  41. package/dist/components/console/ConsoleOutput.svelte +2 -1
  42. package/dist/components/form/FormArray.svelte +5 -9
  43. package/dist/components/form/FormArray.svelte.d.ts +2 -1
  44. package/dist/components/form/FormAutocomplete.svelte +8 -6
  45. package/dist/components/form/FormField.svelte +4 -2
  46. package/dist/components/form/FormFieldLight.svelte +4 -2
  47. package/dist/components/form/FormMarkdownEditor.svelte +9 -4
  48. package/dist/components/form/FormRangeField.svelte +1 -0
  49. package/dist/components/form/FormTemplateEditor.svelte +11 -3
  50. package/dist/components/form/FormToggle.svelte +5 -12
  51. package/dist/components/form/FormToggle.svelte.d.ts +4 -2
  52. package/dist/components/form/templateAutocomplete.js +1 -5
  53. package/dist/components/form/types.d.ts +1 -14
  54. package/dist/components/interrupt/FormPrompt.svelte +3 -2
  55. package/dist/components/interrupt/InterruptBubble.svelte +16 -17
  56. package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
  57. package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
  58. package/dist/components/layouts/MainLayout.svelte +20 -13
  59. package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
  60. package/dist/components/nodes/AtomNode.svelte +17 -5
  61. package/dist/components/nodes/GatewayNode.svelte +19 -10
  62. package/dist/components/nodes/IdeaNode.svelte +7 -0
  63. package/dist/components/nodes/SimpleNode.svelte +11 -6
  64. package/dist/components/nodes/SquareNode.svelte +15 -8
  65. package/dist/components/nodes/TerminalNode.svelte +9 -4
  66. package/dist/components/nodes/ToolNode.svelte +7 -1
  67. package/dist/components/nodes/WorkflowNode.svelte +16 -7
  68. package/dist/components/playground/ChatInput.svelte +11 -14
  69. package/dist/components/playground/ChatPanel.svelte +6 -49
  70. package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
  71. package/dist/components/playground/ControlPanel.svelte +134 -123
  72. package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
  73. package/dist/components/playground/ExecutionLogs.svelte +11 -9
  74. package/dist/components/playground/InputCollector.svelte +11 -9
  75. package/dist/components/playground/MessageStream.svelte +17 -23
  76. package/dist/components/playground/PipelineKanbanView.svelte +65 -6
  77. package/dist/components/playground/PipelinePanel.svelte +11 -5
  78. package/dist/components/playground/PipelineTableView.svelte +186 -44
  79. package/dist/components/playground/Playground.svelte +90 -92
  80. package/dist/components/playground/Playground.svelte.d.ts +2 -0
  81. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  82. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  83. package/dist/components/playground/PlaygroundModal.svelte +13 -3
  84. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  85. package/dist/components/playground/PlaygroundStudio.svelte +34 -32
  86. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  87. package/dist/components/playground/SessionManager.svelte +9 -12
  88. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +28 -0
  89. package/dist/components/playground/pipelineViewUtils.svelte.js +38 -1
  90. package/dist/config/endpoints.d.ts +0 -7
  91. package/dist/config/endpoints.js +2 -10
  92. package/dist/core/index.d.ts +4 -4
  93. package/dist/core/index.js +6 -6
  94. package/dist/display/index.d.ts +0 -2
  95. package/dist/display/index.js +0 -6
  96. package/dist/editor/index.d.ts +19 -20
  97. package/dist/editor/index.js +25 -35
  98. package/dist/form/code.d.ts +25 -15
  99. package/dist/form/code.js +44 -41
  100. package/dist/form/fieldRegistry.d.ts +17 -13
  101. package/dist/form/fieldRegistry.js +32 -12
  102. package/dist/form/full.d.ts +17 -13
  103. package/dist/form/full.js +22 -27
  104. package/dist/form/index.d.ts +3 -3
  105. package/dist/form/index.js +3 -3
  106. package/dist/form/markdown.d.ts +13 -8
  107. package/dist/form/markdown.js +22 -23
  108. package/dist/helpers/proximityConnect.d.ts +3 -2
  109. package/dist/helpers/proximityConnect.js +2 -5
  110. package/dist/helpers/workflowEditorHelper.d.ts +12 -5
  111. package/dist/helpers/workflowEditorHelper.js +27 -25
  112. package/dist/index.d.ts +28 -24
  113. package/dist/index.js +27 -50
  114. package/dist/messages/defaults.d.ts +2 -5
  115. package/dist/messages/defaults.js +3 -6
  116. package/dist/messages/index.d.ts +0 -1
  117. package/dist/messages/index.js +0 -1
  118. package/dist/mocks/app-forms.d.ts +6 -2
  119. package/dist/mocks/app-forms.js +11 -4
  120. package/dist/openapi/v1/openapi.yaml +3 -3
  121. package/dist/playground/index.d.ts +2 -3
  122. package/dist/playground/index.js +2 -30
  123. package/dist/playground/mount.d.ts +15 -0
  124. package/dist/playground/mount.js +46 -20
  125. package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
  126. package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
  127. package/dist/registry/builtinFormats.d.ts +9 -18
  128. package/dist/registry/builtinFormats.js +9 -39
  129. package/dist/registry/builtinNodes.d.ts +0 -25
  130. package/dist/registry/builtinNodes.js +1 -50
  131. package/dist/registry/index.d.ts +3 -4
  132. package/dist/registry/index.js +4 -6
  133. package/dist/registry/nodeComponentRegistry.d.ts +182 -15
  134. package/dist/registry/nodeComponentRegistry.js +235 -17
  135. package/dist/registry/workflowFormatRegistry.d.ts +14 -9
  136. package/dist/registry/workflowFormatRegistry.js +24 -8
  137. package/dist/{schema → schemas}/index.d.ts +2 -2
  138. package/dist/{schema → schemas}/index.js +2 -2
  139. package/dist/schemas/v1/workflow.schema.json +3 -3
  140. package/dist/services/agentSpecExecutionService.js +0 -1
  141. package/dist/services/apiVariableService.d.ts +2 -1
  142. package/dist/services/apiVariableService.js +5 -22
  143. package/dist/services/autoSaveService.d.ts +7 -0
  144. package/dist/services/autoSaveService.js +6 -4
  145. package/dist/services/chatService.d.ts +8 -4
  146. package/dist/services/chatService.js +15 -15
  147. package/dist/services/draftStorage.d.ts +129 -13
  148. package/dist/services/draftStorage.js +185 -37
  149. package/dist/services/dynamicSchemaService.d.ts +2 -1
  150. package/dist/services/dynamicSchemaService.js +5 -22
  151. package/dist/services/globalSave.d.ts +13 -12
  152. package/dist/services/globalSave.js +29 -51
  153. package/dist/services/historyService.d.ts +9 -3
  154. package/dist/services/historyService.js +9 -3
  155. package/dist/services/interruptService.d.ts +14 -9
  156. package/dist/services/interruptService.js +27 -27
  157. package/dist/services/nodeExecutionService.d.ts +18 -3
  158. package/dist/services/nodeExecutionService.js +71 -45
  159. package/dist/services/playgroundService.d.ts +14 -9
  160. package/dist/services/playgroundService.js +31 -30
  161. package/dist/services/variableService.d.ts +2 -1
  162. package/dist/services/variableService.js +2 -2
  163. package/dist/services/workflowStorage.js +6 -6
  164. package/dist/stores/apiContext.d.ts +45 -0
  165. package/dist/stores/apiContext.js +65 -0
  166. package/dist/stores/categoriesStore.svelte.d.ts +28 -23
  167. package/dist/stores/categoriesStore.svelte.js +70 -64
  168. package/dist/stores/getInstance.svelte.d.ts +39 -0
  169. package/dist/stores/getInstance.svelte.js +65 -0
  170. package/dist/stores/historyStore.svelte.d.ts +77 -93
  171. package/dist/stores/historyStore.svelte.js +134 -160
  172. package/dist/stores/instanceContainer.svelte.d.ts +111 -0
  173. package/dist/stores/instanceContainer.svelte.js +114 -0
  174. package/dist/stores/interruptStore.svelte.d.ts +112 -82
  175. package/dist/stores/interruptStore.svelte.js +253 -226
  176. package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
  177. package/dist/stores/pipelinePanelStore.svelte.js +61 -14
  178. package/dist/stores/playgroundStore.svelte.d.ts +169 -222
  179. package/dist/stores/playgroundStore.svelte.js +515 -580
  180. package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
  181. package/dist/stores/portCoordinateStore.svelte.js +109 -98
  182. package/dist/stores/settingsStore.svelte.d.ts +4 -1
  183. package/dist/stores/settingsStore.svelte.js +47 -12
  184. package/dist/stores/workflowStore.svelte.d.ts +178 -213
  185. package/dist/stores/workflowStore.svelte.js +449 -501
  186. package/dist/stories/EdgeDecorator.svelte +5 -2
  187. package/dist/stories/NodeDecorator.svelte +5 -3
  188. package/dist/svelte-app.d.ts +60 -10
  189. package/dist/svelte-app.js +157 -53
  190. package/dist/types/events.d.ts +6 -3
  191. package/dist/types/index.d.ts +33 -3
  192. package/dist/types/navbar.d.ts +7 -0
  193. package/dist/types/playground.d.ts +18 -3
  194. package/dist/types/settings.d.ts +13 -0
  195. package/dist/types/settings.js +1 -0
  196. package/dist/utils/colors.d.ts +47 -21
  197. package/dist/utils/colors.js +69 -68
  198. package/dist/utils/connections.d.ts +9 -15
  199. package/dist/utils/connections.js +13 -32
  200. package/dist/utils/duration.d.ts +13 -0
  201. package/dist/utils/duration.js +45 -0
  202. package/dist/utils/icons.d.ts +5 -2
  203. package/dist/utils/icons.js +6 -5
  204. package/dist/utils/nodeSwap.d.ts +6 -2
  205. package/dist/utils/nodeSwap.js +62 -126
  206. package/dist/utils/nodeTypes.d.ts +17 -8
  207. package/dist/utils/nodeTypes.js +26 -19
  208. package/dist/utils/performanceUtils.js +7 -0
  209. package/package.json +6 -5
  210. package/dist/messages/deprecation.d.ts +0 -20
  211. package/dist/messages/deprecation.js +0 -33
  212. package/dist/registry/plugin.d.ts +0 -215
  213. package/dist/registry/plugin.js +0 -249
  214. package/dist/services/api.d.ts +0 -129
  215. package/dist/services/api.js +0 -217
package/dist/index.js CHANGED
@@ -1,64 +1,41 @@
1
1
  /**
2
2
  * FlowDrop - Visual Workflow Editor Library
3
3
  *
4
- * A Svelte 5 component library built on @xyflow/svelte for creating node-based workflow editors.
4
+ * A Svelte 5 component library built on @xyflow/svelte for creating node-based
5
+ * workflow editors.
5
6
  *
6
- * ## Module Structure (Tree-Shakable)
7
+ * ## The main entry is a minimal front door
7
8
  *
8
- * For optimal bundle size, import from specific sub-modules:
9
+ * This entry point intentionally exposes only the small surface most apps need
10
+ * to get started: the `App` component, the `mountFlowDropApp` / `unmountFlowDropApp`
11
+ * mount helpers, instance plumbing (`createFlowDropInstance` / `getInstance` /
12
+ * `provideInstance`), endpoint + auth helpers, and the core public types. It does
13
+ * NOT re-export the entire library.
9
14
  *
10
- * - `@flowdrop/flowdrop/core` - Types and utilities only (no heavy deps)
11
- * - `@flowdrop/flowdrop/editor` - WorkflowEditor with @xyflow/svelte
15
+ * Everything else lives in focused sub-modules import from the one you need:
16
+ *
17
+ * - `@flowdrop/flowdrop/core` - Types, utilities, theme/skin, messages helpers (no heavy deps)
18
+ * - `@flowdrop/flowdrop/editor` - WorkflowEditor, registries, stores, services (adds @xyflow/svelte)
12
19
  * - `@flowdrop/flowdrop/form` - SchemaForm with basic fields
13
- * - `@flowdrop/flowdrop/form/code` - Code editor support (adds CodeMirror)
14
- * - `@flowdrop/flowdrop/form/markdown` - Markdown editor support (CodeMirror 6)
20
+ * - `@flowdrop/flowdrop/form/code` - Code editor field (adds CodeMirror)
21
+ * - `@flowdrop/flowdrop/form/markdown` - Markdown editor field (CodeMirror 6)
15
22
  * - `@flowdrop/flowdrop/display` - MarkdownDisplay (adds marked)
16
23
  * - `@flowdrop/flowdrop/playground` - Playground for interactive workflow testing
24
+ * - `@flowdrop/flowdrop/settings` - Settings stores, services, components
17
25
  * - `@flowdrop/flowdrop/styles` - CSS styles
18
26
  *
19
- * ## Legacy Import (Full Bundle)
20
- *
21
- * Importing from the main entry point includes everything:
22
- *
23
- * ```typescript
24
- * import { WorkflowEditor, SchemaForm } from "@flowdrop/flowdrop";
25
- * ```
26
- *
27
- * **Note**: This will bundle ALL dependencies including @xyflow/svelte,
28
- * CodeMirror and marked. For smaller bundles, use sub-modules.
29
- *
30
27
  * @module flowdrop
31
28
  */
32
29
  // ============================================================================
33
- // IMPORTANT: This module re-exports from sub-modules for backward compatibility.
34
- // New code should import directly from sub-modules for better tree-shaking.
35
- //
36
- // The wildcard re-exports below are intentional: each sub-module barrel uses
37
- // explicit named exports, so the public API surface is fully controlled there.
38
- // ============================================================================
39
- // ============================================================================
40
- // Core Exports (Types & Utilities - No Heavy Dependencies)
41
- // ============================================================================
42
- export * from './core/index.js';
43
- // ============================================================================
44
- // Form Exports
45
- // ============================================================================
46
- export * from './form/index.js';
47
- // Note: Heavy form fields (code, markdown) are NOT auto-registered.
48
- // Users must import from form/code or form/markdown and register explicitly.
49
- // ============================================================================
50
- // Display Exports
51
- // ============================================================================
52
- export * from './display/index.js';
53
- // ============================================================================
54
- // Playground Exports
55
- // ============================================================================
56
- export * from './playground/index.js';
57
- // ============================================================================
58
- // Editor Exports (includes @xyflow/svelte and auto-registers builtin nodes)
59
- // ============================================================================
60
- export * from './editor/index.js';
61
- // ============================================================================
62
- // Settings Exports (stores, services, components, types)
63
- // ============================================================================
64
- export * from './settings/index.js';
30
+ // Values
31
+ // ============================================================================
32
+ // App component + vanilla-JS mount lifecycle.
33
+ export { default as App } from './components/App.svelte';
34
+ export { mountFlowDropApp, unmountFlowDropApp } from './svelte-app.js';
35
+ // Instance plumbing — per-instance state container + Svelte context helpers.
36
+ export { createFlowDropInstance } from './stores/instanceContainer.svelte.js';
37
+ export { getInstance, provideInstance } from './stores/getInstance.svelte.js';
38
+ // Endpoint configuration helpers.
39
+ export { createEndpointConfig, defaultEndpointConfig } from './config/endpoints.js';
40
+ // Authentication providers.
41
+ export { NoAuthProvider, StaticAuthProvider, CallbackAuthProvider } from './types/auth.js';
@@ -279,12 +279,8 @@ export declare const defaultMessages: {
279
279
  readonly predefinedRun: "Run workflow";
280
280
  };
281
281
  readonly states: {
282
- readonly viewOnlyTitle: "View only";
283
- readonly viewOnlyText: "This playground is in view-only mode. No inputs are available.";
284
282
  readonly newSessionTitle: "New session";
285
283
  readonly newSessionText: "Test your flow with a prompt";
286
- readonly readyTitle: "Ready to run";
287
- readonly readyText: "Click Run to execute your workflow";
288
284
  readonly processing: "Processing...";
289
285
  readonly viewOnlyHelp: "View-only mode. Workflow execution is controlled externally.";
290
286
  };
@@ -342,7 +338,7 @@ export declare const defaultMessages: {
342
338
  readonly newSession: "New session";
343
339
  };
344
340
  readonly controlPanel: {
345
- readonly sessionsLabel: "Sessions";
341
+ readonly sessionsLabel: "Session";
346
342
  readonly noSession: "No session";
347
343
  readonly switchSession: "Switch session";
348
344
  readonly newSession: "New session";
@@ -420,6 +416,7 @@ export declare const defaultMessages: {
420
416
  readonly lastRunLabel: "Last Run:";
421
417
  readonly durationLabel: "Duration:";
422
418
  readonly errorLabel: "Error:";
419
+ readonly historyLabel: "Runs:";
423
420
  };
424
421
  };
425
422
  };
@@ -258,12 +258,8 @@ export const defaultMessages = {
258
258
  predefinedRun: 'Run workflow'
259
259
  },
260
260
  states: {
261
- viewOnlyTitle: 'View only',
262
- viewOnlyText: 'This playground is in view-only mode. No inputs are available.',
263
261
  newSessionTitle: 'New session',
264
262
  newSessionText: 'Test your flow with a prompt',
265
- readyTitle: 'Ready to run',
266
- readyText: 'Click Run to execute your workflow',
267
263
  processing: 'Processing...',
268
264
  viewOnlyHelp: 'View-only mode. Workflow execution is controlled externally.'
269
265
  },
@@ -316,7 +312,7 @@ export const defaultMessages = {
316
312
  newSession: 'New session'
317
313
  },
318
314
  controlPanel: {
319
- sessionsLabel: 'Sessions',
315
+ sessionsLabel: 'Session',
320
316
  noSession: 'No session',
321
317
  switchSession: 'Switch session',
322
318
  newSession: 'New session',
@@ -380,7 +376,8 @@ export const defaultMessages = {
380
376
  executionsLabel: 'Executions:',
381
377
  lastRunLabel: 'Last Run:',
382
378
  durationLabel: 'Duration:',
383
- errorLabel: 'Error:'
379
+ errorLabel: 'Error:',
380
+ historyLabel: 'Runs:'
384
381
  }
385
382
  }
386
383
  };
@@ -7,5 +7,4 @@
7
7
  export { defaultMessages } from './defaults.js';
8
8
  export { mergeMessages } from './merge.js';
9
9
  export { setMessages, getMessages, m } from './context.js';
10
- export { warnDeprecatedProp, __resetDeprecationWarningsForTests } from './deprecation.js';
11
10
  export type { Messages, MessagesOverride, DeepPartial } from './types.js';
@@ -7,4 +7,3 @@
7
7
  export { defaultMessages } from './defaults.js';
8
8
  export { mergeMessages } from './merge.js';
9
9
  export { setMessages, getMessages, m } from './context.js';
10
- export { warnDeprecatedProp, __resetDeprecationWarningsForTests } from './deprecation.js';
@@ -1,2 +1,6 @@
1
- export function enhance(form: any, options?: {}): (event: any) => void;
2
- export function applyAction(action: any): any;
1
+ export function enhance(_form: HTMLFormElement, options?: {
2
+ onResult?: (result: {
3
+ type: string;
4
+ }) => void;
5
+ }): (event: SubmitEvent) => void;
6
+ export function applyAction(action: unknown): unknown;
@@ -1,11 +1,15 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Mock for $app/forms
4
3
  * Provides minimal implementations for SvelteKit forms in library context
5
4
  */
6
5
 
7
- // Mock enhance function
8
- export const enhance = (form, options = {}) => {
6
+ /**
7
+ * Mock enhance function
8
+ * @param {HTMLFormElement} _form
9
+ * @param {{ onResult?: (result: { type: string }) => void }} [options]
10
+ */
11
+ export const enhance = (_form, options = {}) => {
12
+ /** @param {SubmitEvent} event */
9
13
  return (event) => {
10
14
  event.preventDefault();
11
15
  // Basic form handling for library context
@@ -15,7 +19,10 @@ export const enhance = (form, options = {}) => {
15
19
  };
16
20
  };
17
21
 
18
- // Mock applyAction function
22
+ /**
23
+ * Mock applyAction function
24
+ * @param {unknown} action
25
+ */
19
26
  export const applyAction = (action) => {
20
27
  // No-op for library context
21
28
  return action;
@@ -3923,9 +3923,9 @@ components:
3923
3923
  WorkflowMetadata:
3924
3924
  type: object
3925
3925
  properties:
3926
- version:
3926
+ schemaVersion:
3927
3927
  type: string
3928
- description: Workflow version
3928
+ description: Workflow schema format version — identifies the document format, not the workflow's own revision.
3929
3929
  example: 1.0.0
3930
3930
  createdAt:
3931
3931
  type: string
@@ -3963,7 +3963,7 @@ components:
3963
3963
  example: flowdrop
3964
3964
  default: flowdrop
3965
3965
  required:
3966
- - version
3966
+ - schemaVersion
3967
3967
  - createdAt
3968
3968
  - updatedAt
3969
3969
  Workflow:
@@ -128,13 +128,12 @@ export { default as MessageBubble } from '../components/playground/MessageBubble
128
128
  export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, ReviewPrompt } from '../components/interrupt/index.js';
129
129
  export { PlaygroundService, playgroundService } from '../services/playgroundService.js';
130
130
  export { InterruptService, interruptService } from '../services/interruptService.js';
131
- export { getCurrentSession, getSessions, getMessages, getIsExecuting, getCanSendMessage, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollSequenceNumber, getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount, getActiveExecutionId, getPinnedExecutionId, getLatestExecutionId, getShowLogs, playgroundActions, applyServerResponse, subscribeToSessionStatus, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestSequenceNumber } from '../stores/playgroundStore.svelte.js';
132
- export { getPipelinePanelOpen, pipelinePanelActions } from '../stores/pipelinePanelStore.svelte.js';
131
+ export { PlaygroundStore } from '../stores/playgroundStore.svelte.js';
133
132
  export type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundMessageRequest, PlaygroundMessagesResult, PlaygroundConfig, PlaygroundMode, PlaygroundSessionStatus, PlaygroundMessageRole, PlaygroundMessageLevel, PlaygroundMessageMetadata, PlaygroundApiResponse, PlaygroundSessionsResponse, PlaygroundSessionResponse, PlaygroundMessageResponse, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js';
134
133
  export { isChatInputNode, CHAT_INPUT_PATTERNS, defaultShouldStopPolling, defaultIsTerminalStatus, DEFAULT_STOP_POLLING_STATUSES, DEFAULT_TERMINAL_STATUSES } from '../types/playground.js';
135
134
  export type { InterruptType, InterruptStatus, Interrupt, InterruptChoice, InterruptConfig, ConfirmationConfig, ChoiceConfig, TextConfig, FormConfig, ReviewConfig, ReviewChange, ReviewFieldDecision, ReviewResolution, InterruptResolution, InterruptApiResponse, InterruptListResponse, InterruptResponse, InterruptMessageMetadata, InterruptPollingConfig } from '../types/interrupt.js';
136
135
  export { isInterruptMetadata, extractInterruptMetadata, metadataToInterrupt, defaultInterruptPollingConfig } from '../types/interrupt.js';
137
- export { getInterruptsMap, getPendingInterruptIds, getPendingInterrupts, getPendingInterruptCount, getResolvedInterrupts, getIsAnySubmitting, interruptActions, getInterrupt, isInterruptPending, isInterruptSubmitting, getInterruptError, getInterruptByMessageId, interruptHasError } from '../stores/interruptStore.svelte.js';
136
+ export { InterruptStore } from '../stores/interruptStore.svelte.js';
138
137
  export type { InterruptWithState } from '../stores/interruptStore.svelte.js';
139
138
  export { mountPlayground, unmountPlayground, mountPlaygroundStudio, mountPlaygroundApp, type PlaygroundMountOptions, type PlaygroundStudioMountOptions, type PlaygroundAppMountOptions, type MountedPlayground } from './mount.js';
140
139
  export type { PipelineViewDef, PipelineViewProps } from '../types/index.js';
@@ -143,41 +143,13 @@ export { InterruptService, interruptService } from '../services/interruptService
143
143
  // ============================================================================
144
144
  // Playground Store
145
145
  // ============================================================================
146
- export {
147
- // Core state getters
148
- getCurrentSession, getSessions, getMessages, getIsExecuting, getCanSendMessage, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollSequenceNumber,
149
- // Derived getters
150
- getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount,
151
- // Execution getters (used with PipelinePanel / PlaygroundSplit)
152
- getActiveExecutionId, getPinnedExecutionId, getLatestExecutionId,
153
- // UI state
154
- getShowLogs,
155
- // Actions
156
- playgroundActions,
157
- // Server response application (single update path)
158
- applyServerResponse,
159
- // Subscription utility
160
- subscribeToSessionStatus,
161
- // Utilities
162
- getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestSequenceNumber } from '../stores/playgroundStore.svelte.js';
163
- // ============================================================================
164
- // Pipeline Panel Store (open/close state, persisted to localStorage)
165
- // ============================================================================
166
- export { getPipelinePanelOpen, pipelinePanelActions } from '../stores/pipelinePanelStore.svelte.js';
146
+ export { PlaygroundStore } from '../stores/playgroundStore.svelte.js';
167
147
  export { isChatInputNode, CHAT_INPUT_PATTERNS, defaultShouldStopPolling, defaultIsTerminalStatus, DEFAULT_STOP_POLLING_STATUSES, DEFAULT_TERMINAL_STATUSES } from '../types/playground.js';
168
148
  export { isInterruptMetadata, extractInterruptMetadata, metadataToInterrupt, defaultInterruptPollingConfig } from '../types/interrupt.js';
169
149
  // ============================================================================
170
150
  // Interrupt Store (Human-in-the-Loop)
171
151
  // ============================================================================
172
- export {
173
- // Core state accessor
174
- getInterruptsMap,
175
- // Getter functions (replace derived stores)
176
- getPendingInterruptIds, getPendingInterrupts, getPendingInterruptCount, getResolvedInterrupts, getIsAnySubmitting,
177
- // Actions
178
- interruptActions,
179
- // Utilities
180
- getInterrupt, isInterruptPending, isInterruptSubmitting, getInterruptError, getInterruptByMessageId, interruptHasError } from '../stores/interruptStore.svelte.js';
152
+ export { InterruptStore } from '../stores/interruptStore.svelte.js';
181
153
  // ============================================================================
182
154
  // Playground Mount Functions (for vanilla JS / Drupal / IIFE integration)
183
155
  // ============================================================================
@@ -114,6 +114,21 @@ export interface PlaygroundMountOptions {
114
114
  * `settings` option.
115
115
  */
116
116
  settings?: PartialSettings;
117
+ /**
118
+ * Identifier for this playground's FlowDrop instance.
119
+ *
120
+ * When omitted, the playground uses the page-default instance — matching
121
+ * the legacy behavior where all playground mounts (and the editor's
122
+ * built-in playground) shared one session/message store. Pass an explicit
123
+ * id to isolate this playground's session/message *state* from other
124
+ * FlowDrop instances on the page.
125
+ *
126
+ * Note: live polling is NOT isolated — `playgroundService` keeps one
127
+ * page-global polling timer, so only one playground can actively poll at
128
+ * a time regardless of instance. Use `pushMessages()` with your own
129
+ * transport if two playgrounds need concurrent live updates.
130
+ */
131
+ instanceId?: string;
117
132
  }
118
133
  /**
119
134
  * Return type for mounted Playground instance
@@ -49,9 +49,8 @@ import PlaygroundModal from '../components/playground/PlaygroundModal.svelte';
49
49
  import PlaygroundStudio from '../components/playground/PlaygroundStudio.svelte';
50
50
  import PlaygroundApp from '../components/playground/PlaygroundApp.svelte';
51
51
  import { initializeSettings } from '../stores/settingsStore.svelte.js';
52
- import { setEndpointConfig } from '../services/api.js';
53
52
  import { playgroundService } from '../services/playgroundService.js';
54
- import { getCurrentSession, getSessions, getMessages, getIsExecuting, playgroundActions, applyServerResponse, subscribeToSessionStatus } from '../stores/playgroundStore.svelte.js';
53
+ import { createFlowDropInstance, getDefaultInstance } from '../stores/instanceContainer.svelte.js';
55
54
  async function resolveEndpointConfig(endpointConfig) {
56
55
  if (!endpointConfig)
57
56
  return undefined;
@@ -61,7 +60,8 @@ async function resolveEndpointConfig(endpointConfig) {
61
60
  ...endpointConfig,
62
61
  endpoints: { ...defaultEndpointConfig.endpoints, ...endpointConfig.endpoints }
63
62
  };
64
- setEndpointConfig(resolved);
63
+ // The resolved config is passed to the Playground component, which configures
64
+ // its instance's ApiContext (fd.api) — no module-level state to set here.
65
65
  return resolved;
66
66
  }
67
67
  /**
@@ -86,33 +86,52 @@ function sizeContainer(container, height, width) {
86
86
  if (width !== undefined)
87
87
  container.style.width = width;
88
88
  }
89
- function buildMountedPlayground(svelteApp, workflowId, config, onSessionStatusChange) {
89
+ /**
90
+ * Resolve the FlowDrop instance for a playground mount. No `instanceId` →
91
+ * the page-default instance (legacy shared-store behavior); an explicit id →
92
+ * a fresh isolated instance owned (and destroyed) by this mount.
93
+ */
94
+ function acquirePlaygroundInstance(instanceId) {
95
+ if (instanceId) {
96
+ return { fd: createFlowDropInstance({ id: instanceId }), ownsInstance: true };
97
+ }
98
+ return { fd: getDefaultInstance(), ownsInstance: false };
99
+ }
100
+ function buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance, onSessionStatusChange) {
90
101
  const pollingInterval = config.pollingInterval ?? 1500;
91
102
  const unsubscribeStatus = onSessionStatusChange
92
- ? subscribeToSessionStatus(onSessionStatusChange)
103
+ ? fd.playground.subscribeToSessionStatus(onSessionStatusChange)
93
104
  : undefined;
94
105
  return {
95
106
  destroy: () => {
96
107
  unsubscribeStatus?.();
108
+ // Caution (shared default instance): stopPolling is page-global and
109
+ // reset() clears state other default-mounted playgrounds rely on —
110
+ // pass `instanceId` to isolate. Preserved legacy behavior.
97
111
  playgroundService.stopPolling();
98
- playgroundActions.reset();
112
+ fd.playground.reset();
113
+ // Fully dispose instances created for this mount; the shared default
114
+ // instance only gets the reset above (legacy behavior).
115
+ if (ownsInstance) {
116
+ fd.destroy();
117
+ }
99
118
  unmount(svelteApp);
100
119
  },
101
- getCurrentSession: () => getCurrentSession(),
102
- getSessions: () => getSessions(),
103
- getMessageCount: () => getMessages().length,
104
- isExecuting: () => getIsExecuting(),
120
+ getCurrentSession: () => fd.playground.currentSession,
121
+ getSessions: () => fd.playground.sessions,
122
+ getMessageCount: () => fd.playground.messageCount,
123
+ isExecuting: () => fd.playground.isExecuting,
105
124
  stopPolling: () => playgroundService.stopPolling(),
106
125
  startPolling: () => {
107
- const session = getCurrentSession();
126
+ const session = fd.playground.currentSession;
108
127
  if (session) {
109
- playgroundService.startPolling(session.id, (response) => applyServerResponse(response, session.id), pollingInterval, config.shouldStopPolling, playgroundService.getLastSequenceNumber());
128
+ playgroundService.startPolling(fd.api.config, session.id, (response) => fd.playground.applyServerResponse(response, session.id), pollingInterval, config.shouldStopPolling, playgroundService.getLastSequenceNumber());
110
129
  }
111
130
  },
112
- pushMessages: (response) => applyServerResponse(response, null),
131
+ pushMessages: (response) => fd.playground.applyServerResponse(response, null),
113
132
  reset: () => {
114
133
  playgroundService.stopPolling();
115
- playgroundActions.reset();
134
+ fd.playground.reset();
116
135
  }
117
136
  };
118
137
  }
@@ -146,7 +165,7 @@ function buildMountedPlayground(svelteApp, workflowId, config, onSessionStatusCh
146
165
  * ```
147
166
  */
148
167
  export async function mountPlayground(container, options) {
149
- const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, settings: initialSettings, onClose, onSessionStatusChange } = options;
168
+ const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, settings: initialSettings, onClose, onSessionStatusChange, instanceId } = options;
150
169
  // Validate required parameters
151
170
  if (!workflowId) {
152
171
  throw new Error('workflowId is required for mountPlayground()');
@@ -162,6 +181,7 @@ export async function mountPlayground(container, options) {
162
181
  endpointConfig,
163
182
  settings: initialSettings
164
183
  });
184
+ const { fd, ownsInstance } = acquirePlaygroundInstance(instanceId);
165
185
  let targetContainer = container;
166
186
  if (mode === 'modal') {
167
187
  targetContainer = document.body;
@@ -175,6 +195,7 @@ export async function mountPlayground(container, options) {
175
195
  target: targetContainer,
176
196
  props: {
177
197
  isOpen: true,
198
+ instance: fd,
178
199
  workflowId,
179
200
  workflow,
180
201
  initialSessionId,
@@ -192,6 +213,7 @@ export async function mountPlayground(container, options) {
192
213
  svelteApp = mount(Playground, {
193
214
  target: targetContainer,
194
215
  props: {
216
+ instance: fd,
195
217
  workflowId,
196
218
  workflow,
197
219
  mode,
@@ -202,7 +224,7 @@ export async function mountPlayground(container, options) {
202
224
  }
203
225
  });
204
226
  }
205
- return buildMountedPlayground(svelteApp, workflowId, config, onSessionStatusChange);
227
+ return buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance, onSessionStatusChange);
206
228
  }
207
229
  /**
208
230
  * Unmount a Playground instance
@@ -225,7 +247,7 @@ export function unmountPlayground(app) {
225
247
  }
226
248
  }
227
249
  export async function mountPlaygroundStudio(container, options) {
228
- const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, pipelineViews } = options;
250
+ const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, pipelineViews, instanceId } = options;
229
251
  if (!workflowId) {
230
252
  throw new Error('workflowId is required for mountPlaygroundStudio()');
231
253
  }
@@ -239,10 +261,12 @@ export async function mountPlaygroundStudio(container, options) {
239
261
  endpointConfig,
240
262
  settings: initialSettings
241
263
  });
264
+ const { fd, ownsInstance } = acquirePlaygroundInstance(instanceId);
242
265
  sizeContainer(container, height, width);
243
266
  const svelteApp = mount(PlaygroundStudio, {
244
267
  target: container,
245
268
  props: {
269
+ instance: fd,
246
270
  workflowId,
247
271
  workflow,
248
272
  mode,
@@ -257,7 +281,7 @@ export async function mountPlaygroundStudio(container, options) {
257
281
  extraPipelineViews: pipelineViews
258
282
  }
259
283
  });
260
- return buildMountedPlayground(svelteApp, workflowId, config, onSessionStatusChange);
284
+ return buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance, onSessionStatusChange);
261
285
  }
262
286
  /**
263
287
  * Mount the full-page PlaygroundApp (Navbar + PlaygroundStudio) into a container.
@@ -280,7 +304,7 @@ export async function mountPlaygroundStudio(container, options) {
280
304
  * ```
281
305
  */
282
306
  export async function mountPlaygroundApp(container, options) {
283
- const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, showNavbar = true, navbarTitle, primaryActions, showSettings = true, settingsCategories, showSettingsSyncButton, showSettingsResetButton, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange } = options;
307
+ const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, showNavbar = true, navbarTitle, primaryActions, showSettings = true, settingsCategories, showSettingsSyncButton, showSettingsResetButton, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, instanceId } = options;
284
308
  if (!workflowId) {
285
309
  throw new Error('workflowId is required for mountPlaygroundApp()');
286
310
  }
@@ -297,10 +321,12 @@ export async function mountPlaygroundApp(container, options) {
297
321
  endpointConfig,
298
322
  settings: initialSettings
299
323
  });
324
+ const { fd, ownsInstance } = acquirePlaygroundInstance(instanceId);
300
325
  sizeContainer(container, height, width);
301
326
  const svelteApp = mount(PlaygroundApp, {
302
327
  target: container,
303
328
  props: {
329
+ instance: fd,
304
330
  workflowId,
305
331
  workflow,
306
332
  mode,
@@ -321,5 +347,5 @@ export async function mountPlaygroundApp(container, options) {
321
347
  onSessionNavigate
322
348
  }
323
349
  });
324
- return buildMountedPlayground(svelteApp, workflowId, config, onSessionStatusChange);
350
+ return buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance, onSessionStatusChange);
325
351
  }
@@ -5,7 +5,15 @@
5
5
  * mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
6
6
  *
7
7
  * Subclasses define their own `register()` method with domain-appropriate
8
- * signatures, using `this.items` and `this.notifyListeners()` directly.
8
+ * signatures, using `this.items`, `this.touch()`, and `this.notifyListeners()`.
9
+ *
10
+ * Reactivity: a `.svelte.ts` module so it can hold a `$state` version counter
11
+ * (`#version`). Every mutating path bumps it via `touch()`; every read method
12
+ * components derive from reads it once at the top. This makes the plain `Map`
13
+ * backing store observable to `$derived`/`$effect`, so registrations made
14
+ * AFTER a component mounts (e.g. `fd.nodes.registerCustom(...)`) invalidate the
15
+ * derived and trigger a re-render. Mirrors WorkflowStore's `#editVersion`
16
+ * monotonic-counter precedent (workflowStore.svelte.ts).
9
17
  *
10
18
  * @example
11
19
  * ```typescript
@@ -15,18 +23,31 @@
15
23
  * throw new Error(`Already registered: ${item.id}`);
16
24
  * }
17
25
  * this.items.set(item.id, item);
26
+ * this.touch();
18
27
  * this.notifyListeners();
19
28
  * }
20
29
  * }
21
30
  * ```
22
31
  */
23
32
  export declare class BaseRegistry<K, V> {
33
+ #private;
24
34
  /** Internal storage map */
25
35
  protected items: Map<K, V>;
26
36
  /** Change listeners */
27
37
  private listeners;
28
38
  /** Callbacks invoked when the registry is cleared (for resetting flags) */
29
39
  private clearCallbacks;
40
+ /**
41
+ * Bump the reactive version counter. Subclasses MUST call this after any
42
+ * mutation of `this.items` so derived reads invalidate.
43
+ */
44
+ protected touch(): void;
45
+ /**
46
+ * Read the reactive version counter. Subclasses that read `this.items`
47
+ * directly (instead of via `get`/`getAll`/etc.) MUST call this so the access
48
+ * is tracked as a reactive dependency.
49
+ */
50
+ protected trackVersion(): void;
30
51
  /**
31
52
  * Unregister an item by key.
32
53
  *