@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.10

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 (323) hide show
  1. package/CHANGELOG.md +648 -0
  2. package/MIGRATION-2.0.md +642 -0
  3. package/README.md +28 -28
  4. package/dist/adapters/WorkflowAdapter.d.ts +1 -1
  5. package/dist/adapters/WorkflowAdapter.js +18 -13
  6. package/dist/adapters/agentspec/AgentSpecAdapter.js +10 -10
  7. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  8. package/dist/api/enhanced-client.js +6 -11
  9. package/dist/chat/batchFeedback.d.ts +39 -0
  10. package/dist/chat/batchFeedback.js +51 -0
  11. package/dist/commands/executor.js +66 -27
  12. package/dist/commands/storeIntegration.svelte.d.ts +4 -1
  13. package/dist/commands/storeIntegration.svelte.js +36 -21
  14. package/dist/commands/types.d.ts +2 -0
  15. package/dist/commands/types.js +5 -5
  16. package/dist/components/App.svelte +696 -565
  17. package/dist/components/App.svelte.d.ts +63 -16
  18. package/dist/components/Button.stories.svelte +65 -0
  19. package/dist/components/Button.stories.svelte.d.ts +19 -0
  20. package/dist/components/Button.svelte +62 -0
  21. package/dist/components/Button.svelte.d.ts +24 -0
  22. package/dist/components/CanvasIconButton.svelte +76 -0
  23. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  24. package/dist/components/ConfigForm.svelte +181 -552
  25. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  26. package/dist/components/ConfigModal.svelte +16 -3
  27. package/dist/components/ConfigPanel.svelte +234 -15
  28. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  29. package/dist/components/ConnectionLine.svelte +4 -2
  30. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  31. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  32. package/dist/components/EditorStatusBar.svelte +99 -0
  33. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  34. package/dist/components/IconButton.svelte +80 -0
  35. package/dist/components/IconButton.svelte.d.ts +30 -0
  36. package/dist/components/Input.svelte +74 -0
  37. package/dist/components/Input.svelte.d.ts +17 -0
  38. package/dist/components/LogoWordmark.svelte +113 -0
  39. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  40. package/dist/components/Navbar.svelte +78 -64
  41. package/dist/components/Navbar.svelte.d.ts +3 -0
  42. package/dist/components/NodeSidebar.svelte +48 -171
  43. package/dist/components/NodeStatusOverlay.svelte +94 -6
  44. package/dist/components/NodeSwapPicker.svelte +22 -38
  45. package/dist/components/PipelineStatus.svelte +22 -68
  46. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  47. package/dist/components/PortCoordinateTracker.svelte +5 -6
  48. package/dist/components/PortMappingRow.svelte +0 -2
  49. package/dist/components/SchemaForm.stories.svelte +1 -3
  50. package/dist/components/SchemaForm.svelte +22 -39
  51. package/dist/components/SchemaForm.svelte.d.ts +0 -8
  52. package/dist/components/Select.svelte +53 -0
  53. package/dist/components/Select.svelte.d.ts +15 -0
  54. package/dist/components/SettingsModal.svelte +8 -8
  55. package/dist/components/SettingsPanel.svelte +44 -10
  56. package/dist/components/SwapMappingEditor.svelte +67 -49
  57. package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
  58. package/dist/components/Textarea.svelte +39 -0
  59. package/dist/components/Textarea.svelte.d.ts +12 -0
  60. package/dist/components/ThemeToggle.svelte +15 -94
  61. package/dist/components/UniversalNode.svelte +45 -11
  62. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  63. package/dist/components/WorkflowEditor.svelte +183 -162
  64. package/dist/components/WorkflowEditor.svelte.d.ts +39 -10
  65. package/dist/components/chat/AIChatPanel.svelte +99 -90
  66. package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
  67. package/dist/components/chat/CommandPreview.svelte +2 -1
  68. package/dist/components/console/CommandConsole.svelte +7 -5
  69. package/dist/components/console/ConsoleAutocomplete.svelte +11 -12
  70. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
  71. package/dist/components/console/ConsoleInput.svelte +18 -9
  72. package/dist/components/console/ConsoleOutput.svelte +4 -3
  73. package/dist/components/form/FormArray.svelte +42 -182
  74. package/dist/components/form/FormArray.svelte.d.ts +2 -1
  75. package/dist/components/form/FormAutocomplete.svelte +26 -21
  76. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  77. package/dist/components/form/FormCodeEditor.svelte +9 -7
  78. package/dist/components/form/FormField.svelte +22 -44
  79. package/dist/components/form/FormFieldLight.svelte +56 -50
  80. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  81. package/dist/components/form/FormFieldset.svelte +45 -11
  82. package/dist/components/form/FormMarkdownEditor.svelte +17 -9
  83. package/dist/components/form/FormNumberField.svelte +4 -36
  84. package/dist/components/form/FormPorts.svelte +262 -0
  85. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  86. package/dist/components/form/FormRangeField.svelte +62 -30
  87. package/dist/components/form/FormSelect.svelte +13 -75
  88. package/dist/components/form/FormTemplateEditor.svelte +17 -7
  89. package/dist/components/form/FormTextField.svelte +3 -35
  90. package/dist/components/form/FormTextarea.svelte +4 -39
  91. package/dist/components/form/FormToggle.svelte +5 -16
  92. package/dist/components/form/FormToggle.svelte.d.ts +4 -2
  93. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  94. package/dist/components/form/resolveFieldType.d.ts +24 -0
  95. package/dist/components/form/resolveFieldType.js +55 -0
  96. package/dist/components/form/templateAutocomplete.js +1 -5
  97. package/dist/components/form/types.d.ts +1 -14
  98. package/dist/components/icons/CloseIcon.svelte +6 -0
  99. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  100. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  101. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  102. package/dist/components/icons/MenuIcon.svelte +4 -0
  103. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  104. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  105. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  106. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  107. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  108. package/dist/components/interrupt/FormPrompt.svelte +3 -2
  109. package/dist/components/interrupt/InterruptBubble.svelte +25 -27
  110. package/dist/components/interrupt/ReviewPrompt.svelte +10 -23
  111. package/dist/components/interrupt/TextInputPrompt.svelte +2 -7
  112. package/dist/components/layouts/MainLayout.svelte +24 -18
  113. package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
  114. package/dist/components/nodes/AtomNode.svelte +70 -72
  115. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  116. package/dist/components/nodes/GatewayNode.svelte +134 -172
  117. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  118. package/dist/components/nodes/IdeaNode.svelte +79 -98
  119. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  120. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  121. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  122. package/dist/components/nodes/NotesNode.svelte +76 -85
  123. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  124. package/dist/components/nodes/SimpleNode.svelte +68 -137
  125. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  126. package/dist/components/nodes/SquareNode.svelte +122 -169
  127. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  128. package/dist/components/nodes/TerminalNode.svelte +70 -127
  129. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  130. package/dist/components/nodes/ToolNode.svelte +99 -104
  131. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  132. package/dist/components/nodes/WorkflowNode.svelte +145 -195
  133. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  134. package/dist/components/playground/ChatInput.svelte +11 -15
  135. package/dist/components/playground/ChatPanel.svelte +6 -49
  136. package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
  137. package/dist/components/playground/ControlPanel.svelte +134 -123
  138. package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
  139. package/dist/components/playground/ExecutionLogs.svelte +11 -9
  140. package/dist/components/playground/InputCollector.svelte +22 -57
  141. package/dist/components/playground/MessageStream.svelte +17 -23
  142. package/dist/components/playground/PipelineKanbanView.svelte +69 -8
  143. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  144. package/dist/components/playground/PipelinePanel.svelte +31 -8
  145. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  146. package/dist/components/playground/PipelineTableView.svelte +188 -44
  147. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  148. package/dist/components/playground/Playground.svelte +154 -105
  149. package/dist/components/playground/Playground.svelte.d.ts +5 -0
  150. package/dist/components/playground/PlaygroundApp.svelte +12 -2
  151. package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
  152. package/dist/components/playground/PlaygroundModal.svelte +18 -3
  153. package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
  154. package/dist/components/playground/PlaygroundStudio.svelte +40 -37
  155. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
  156. package/dist/components/playground/SessionManager.svelte +9 -12
  157. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
  158. package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
  159. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  160. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  161. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  162. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  163. package/dist/config/endpoints.d.ts +23 -7
  164. package/dist/config/endpoints.js +30 -10
  165. package/dist/core/index.d.ts +6 -7
  166. package/dist/core/index.js +8 -12
  167. package/dist/display/index.d.ts +6 -3
  168. package/dist/display/index.js +7 -5
  169. package/dist/editor/index.d.ts +20 -21
  170. package/dist/editor/index.js +26 -36
  171. package/dist/form/code.d.ts +25 -15
  172. package/dist/form/code.js +44 -41
  173. package/dist/form/fieldRegistry.d.ts +17 -13
  174. package/dist/form/fieldRegistry.js +32 -12
  175. package/dist/form/full.d.ts +19 -14
  176. package/dist/form/full.js +26 -28
  177. package/dist/form/index.d.ts +3 -4
  178. package/dist/form/index.js +6 -5
  179. package/dist/form/markdown.d.ts +13 -8
  180. package/dist/form/markdown.js +22 -23
  181. package/dist/helpers/proximityConnect.d.ts +3 -2
  182. package/dist/helpers/proximityConnect.js +2 -5
  183. package/dist/helpers/workflowEditorHelper.d.ts +14 -5
  184. package/dist/helpers/workflowEditorHelper.js +32 -30
  185. package/dist/index.d.ts +28 -24
  186. package/dist/index.js +27 -50
  187. package/dist/messages/defaults.d.ts +2 -5
  188. package/dist/messages/defaults.js +3 -6
  189. package/dist/messages/index.d.ts +1 -2
  190. package/dist/messages/index.js +1 -2
  191. package/dist/mocks/app-forms.d.ts +6 -2
  192. package/dist/mocks/app-forms.js +11 -4
  193. package/dist/openapi/v1/openapi.yaml +38 -26
  194. package/dist/playground/index.d.ts +4 -5
  195. package/dist/playground/index.js +4 -32
  196. package/dist/playground/mount.d.ts +34 -5
  197. package/dist/playground/mount.js +58 -24
  198. package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
  199. package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
  200. package/dist/registry/builtinFormats.d.ts +9 -18
  201. package/dist/registry/builtinFormats.js +9 -39
  202. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  203. package/dist/registry/builtinNodeTypes.js +67 -0
  204. package/dist/registry/builtinNodes.d.ts +2 -64
  205. package/dist/registry/builtinNodes.js +7 -103
  206. package/dist/registry/index.d.ts +3 -4
  207. package/dist/registry/index.js +4 -6
  208. package/dist/registry/nodeComponentRegistry.d.ts +184 -16
  209. package/dist/registry/nodeComponentRegistry.js +235 -17
  210. package/dist/registry/workflowFormatRegistry.d.ts +14 -9
  211. package/dist/registry/workflowFormatRegistry.js +24 -8
  212. package/dist/{schema → schemas}/index.d.ts +2 -2
  213. package/dist/{schema → schemas}/index.js +2 -2
  214. package/dist/schemas/v1/workflow.schema.json +19 -17
  215. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  216. package/dist/services/agentSpecExecutionService.js +0 -3
  217. package/dist/services/apiVariableService.d.ts +2 -1
  218. package/dist/services/apiVariableService.js +16 -47
  219. package/dist/services/autoSaveService.d.ts +7 -0
  220. package/dist/services/autoSaveService.js +6 -4
  221. package/dist/services/categoriesApi.js +3 -6
  222. package/dist/services/chatService.d.ts +9 -4
  223. package/dist/services/chatService.js +23 -28
  224. package/dist/services/draftStorage.d.ts +129 -13
  225. package/dist/services/draftStorage.js +185 -37
  226. package/dist/services/dynamicSchemaService.d.ts +33 -5
  227. package/dist/services/dynamicSchemaService.js +67 -55
  228. package/dist/services/globalSave.d.ts +13 -12
  229. package/dist/services/globalSave.js +29 -51
  230. package/dist/services/historyService.d.ts +39 -11
  231. package/dist/services/historyService.js +60 -18
  232. package/dist/services/interruptService.d.ts +15 -9
  233. package/dist/services/interruptService.js +35 -37
  234. package/dist/services/nodeExecutionService.d.ts +18 -3
  235. package/dist/services/nodeExecutionService.js +71 -45
  236. package/dist/services/playgroundService.d.ts +16 -10
  237. package/dist/services/playgroundService.js +42 -43
  238. package/dist/services/portConfigApi.js +3 -6
  239. package/dist/services/settingsService.d.ts +9 -4
  240. package/dist/services/settingsService.js +23 -12
  241. package/dist/services/variableService.d.ts +2 -1
  242. package/dist/services/variableService.js +2 -2
  243. package/dist/services/workflowStorage.js +6 -6
  244. package/dist/skins/drafter.d.ts +30 -0
  245. package/dist/skins/drafter.js +198 -0
  246. package/dist/skins/index.d.ts +2 -1
  247. package/dist/skins/index.js +4 -2
  248. package/dist/stores/apiContext.d.ts +56 -0
  249. package/dist/stores/apiContext.js +80 -0
  250. package/dist/stores/categoriesStore.svelte.d.ts +28 -23
  251. package/dist/stores/categoriesStore.svelte.js +69 -64
  252. package/dist/stores/getInstance.svelte.d.ts +39 -0
  253. package/dist/stores/getInstance.svelte.js +65 -0
  254. package/dist/stores/historyStore.svelte.d.ts +89 -91
  255. package/dist/stores/historyStore.svelte.js +159 -158
  256. package/dist/stores/instanceContainer.svelte.d.ts +111 -0
  257. package/dist/stores/instanceContainer.svelte.js +119 -0
  258. package/dist/stores/interruptStore.svelte.d.ts +112 -82
  259. package/dist/stores/interruptStore.svelte.js +253 -226
  260. package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
  261. package/dist/stores/pipelinePanelStore.svelte.js +61 -14
  262. package/dist/stores/playgroundStore.svelte.d.ts +169 -222
  263. package/dist/stores/playgroundStore.svelte.js +513 -580
  264. package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
  265. package/dist/stores/portCoordinateStore.svelte.js +109 -98
  266. package/dist/stores/settingsStore.svelte.d.ts +17 -1
  267. package/dist/stores/settingsStore.svelte.js +79 -12
  268. package/dist/stores/workflowStore.svelte.d.ts +212 -210
  269. package/dist/stores/workflowStore.svelte.js +527 -502
  270. package/dist/stories/EdgeDecorator.svelte +5 -2
  271. package/dist/stories/NodeDecorator.svelte +5 -3
  272. package/dist/styles/base.css +285 -14
  273. package/dist/styles/tokens.css +60 -2
  274. package/dist/svelte-app.d.ts +78 -11
  275. package/dist/svelte-app.js +210 -141
  276. package/dist/themes/drafter.d.ts +2 -0
  277. package/dist/themes/drafter.js +15 -0
  278. package/dist/themes/index.d.ts +2 -1
  279. package/dist/themes/index.js +8 -2
  280. package/dist/types/auth.d.ts +9 -51
  281. package/dist/types/auth.js +4 -54
  282. package/dist/types/events.d.ts +24 -3
  283. package/dist/types/events.js +2 -1
  284. package/dist/types/index.d.ts +117 -32
  285. package/dist/types/index.js +0 -1
  286. package/dist/types/navbar.d.ts +7 -0
  287. package/dist/types/playground.d.ts +18 -3
  288. package/dist/types/settings.d.ts +30 -1
  289. package/dist/types/settings.js +5 -2
  290. package/dist/types/skin.d.ts +1 -1
  291. package/dist/types/theme.d.ts +16 -2
  292. package/dist/types/uischema.d.ts +5 -0
  293. package/dist/utils/colors.d.ts +74 -21
  294. package/dist/utils/colors.js +92 -68
  295. package/dist/utils/connections.d.ts +9 -15
  296. package/dist/utils/connections.js +33 -88
  297. package/dist/utils/duration.d.ts +13 -0
  298. package/dist/utils/duration.js +45 -0
  299. package/dist/utils/edgeStyling.js +9 -5
  300. package/dist/utils/fetchWithAuth.d.ts +36 -15
  301. package/dist/utils/fetchWithAuth.js +53 -23
  302. package/dist/utils/icons.d.ts +5 -2
  303. package/dist/utils/icons.js +6 -5
  304. package/dist/utils/nodeIds.d.ts +1 -1
  305. package/dist/utils/nodeIds.js +1 -1
  306. package/dist/utils/nodeSwap.d.ts +6 -2
  307. package/dist/utils/nodeSwap.js +62 -129
  308. package/dist/utils/nodeTypes.d.ts +17 -8
  309. package/dist/utils/nodeTypes.js +27 -20
  310. package/dist/utils/performanceUtils.js +7 -0
  311. package/dist/utils/portUtils.d.ts +47 -11
  312. package/dist/utils/portUtils.js +67 -14
  313. package/dist/utils/portal.d.ts +18 -0
  314. package/dist/utils/portal.js +34 -0
  315. package/dist/utils/schemaMerge.d.ts +25 -0
  316. package/dist/utils/schemaMerge.js +61 -0
  317. package/package.json +7 -5
  318. package/dist/messages/deprecation.d.ts +0 -20
  319. package/dist/messages/deprecation.js +0 -33
  320. package/dist/registry/plugin.d.ts +0 -215
  321. package/dist/registry/plugin.js +0 -249
  322. package/dist/services/api.d.ts +0 -129
  323. package/dist/services/api.js +0 -217
@@ -0,0 +1,133 @@
1
+ <!--
2
+ TabbedSurface
3
+ A reusable tabbed container that hosts one or more "surfaces" (config panel,
4
+ console, AI Assistant). Promotes the bottom-panel tab strip so the same
5
+ container can host surfaces in the sidebar, bottom panel, or a modal overlay.
6
+
7
+ All tab bodies stay mounted (toggled via `display`) so surface state — console
8
+ scrollback, chat history, in-progress form edits — survives tab switches. The
9
+ tab bar hides itself when only a single surface is present, so a lone surface
10
+ reads as a plain panel with no redundant chrome.
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import type { Snippet } from 'svelte';
15
+
16
+ /** A single hostable surface. */
17
+ export interface SurfaceTab {
18
+ /** Stable identifier, unique within the host. */
19
+ id: string;
20
+ /** Tab-strip label. */
21
+ label: string;
22
+ /** Body content. Rendered once — a surface has exactly one host. */
23
+ content: Snippet;
24
+ /**
25
+ * `display` value applied while active. Some surfaces (the console) expect
26
+ * to be a direct flex child of the content area and use `contents`; most
27
+ * use `flex`. Defaults to `flex`.
28
+ */
29
+ display?: 'flex' | 'contents';
30
+ }
31
+
32
+ interface Props {
33
+ /** Surfaces to host, in tab order. */
34
+ tabs: SurfaceTab[];
35
+ /** Currently active tab id. */
36
+ activeId: string;
37
+ /** Called when a tab is selected. */
38
+ onSelect: (id: string) => void;
39
+ }
40
+
41
+ const { tabs, activeId, onSelect }: Props = $props();
42
+
43
+ // Fall back to the first tab when `activeId` doesn't match any present tab
44
+ // (e.g. the active surface was just routed to a different host).
45
+ const resolvedActiveId = $derived(
46
+ tabs.some((t) => t.id === activeId) ? activeId : (tabs[0]?.id ?? '')
47
+ );
48
+ </script>
49
+
50
+ <div class="tabbed-surface">
51
+ {#if tabs.length > 1}
52
+ <div class="tabbed-surface__bar" role="tablist">
53
+ {#each tabs as tab (tab.id)}
54
+ <button
55
+ class="tabbed-surface__tab {tab.id === resolvedActiveId
56
+ ? 'tabbed-surface__tab--active'
57
+ : ''}"
58
+ role="tab"
59
+ aria-selected={tab.id === resolvedActiveId}
60
+ onclick={() => onSelect(tab.id)}
61
+ >
62
+ {tab.label}
63
+ </button>
64
+ {/each}
65
+ </div>
66
+ {/if}
67
+
68
+ <div class="tabbed-surface__content">
69
+ {#each tabs as tab (tab.id)}
70
+ <div
71
+ class="tabbed-surface__panel"
72
+ style:display={tab.id === resolvedActiveId ? (tab.display ?? 'flex') : 'none'}
73
+ >
74
+ {@render tab.content()}
75
+ </div>
76
+ {/each}
77
+ </div>
78
+ </div>
79
+
80
+ <style>
81
+ .tabbed-surface {
82
+ display: flex;
83
+ flex-direction: column;
84
+ height: 100%;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .tabbed-surface__bar {
89
+ display: flex;
90
+ gap: 0;
91
+ background: var(--fd-muted);
92
+ border-bottom: 1px solid var(--fd-border);
93
+ flex-shrink: 0;
94
+ }
95
+
96
+ .tabbed-surface__tab {
97
+ padding: 0.375rem 0.75rem;
98
+ font-size: 0.75rem;
99
+ font-weight: 500;
100
+ cursor: pointer;
101
+ border: none;
102
+ border-bottom: 2px solid transparent;
103
+ background: transparent;
104
+ color: var(--fd-muted-foreground);
105
+ transition: all var(--fd-transition-fast);
106
+ }
107
+
108
+ .tabbed-surface__tab:hover {
109
+ color: var(--fd-foreground);
110
+ background: var(--fd-background);
111
+ }
112
+
113
+ .tabbed-surface__tab--active {
114
+ color: var(--fd-foreground);
115
+ border-bottom-color: var(--fd-primary);
116
+ background: var(--fd-background);
117
+ }
118
+
119
+ .tabbed-surface__content {
120
+ flex: 1;
121
+ min-height: 0;
122
+ overflow: hidden;
123
+ display: flex;
124
+ flex-direction: column;
125
+ }
126
+
127
+ .tabbed-surface__panel {
128
+ flex: 1;
129
+ min-height: 0;
130
+ overflow: hidden;
131
+ flex-direction: column;
132
+ }
133
+ </style>
@@ -0,0 +1,27 @@
1
+ import type { Snippet } from 'svelte';
2
+ /** A single hostable surface. */
3
+ export interface SurfaceTab {
4
+ /** Stable identifier, unique within the host. */
5
+ id: string;
6
+ /** Tab-strip label. */
7
+ label: string;
8
+ /** Body content. Rendered once — a surface has exactly one host. */
9
+ content: Snippet;
10
+ /**
11
+ * `display` value applied while active. Some surfaces (the console) expect
12
+ * to be a direct flex child of the content area and use `contents`; most
13
+ * use `flex`. Defaults to `flex`.
14
+ */
15
+ display?: 'flex' | 'contents';
16
+ }
17
+ interface Props {
18
+ /** Surfaces to host, in tab order. */
19
+ tabs: SurfaceTab[];
20
+ /** Currently active tab id. */
21
+ activeId: string;
22
+ /** Called when a tab is selected. */
23
+ onSelect: (id: string) => void;
24
+ }
25
+ declare const TabbedSurface: import("svelte").Component<Props, {}, "">;
26
+ type TabbedSurface = ReturnType<typeof TabbedSurface>;
27
+ export default TabbedSurface;
@@ -3,6 +3,7 @@
3
3
  * Provides configurable endpoints for all API actions
4
4
  */
5
5
  import type { AgentSpecEndpointConfig } from './agentSpecEndpoints.js';
6
+ import type { AuthProvider } from '../types/auth.js';
6
7
  export interface EndpointConfig {
7
8
  /** Base URL for all endpoints */
8
9
  baseUrl: string;
@@ -110,13 +111,6 @@ export interface EndpointConfig {
110
111
  headers?: {
111
112
  [key: string]: Record<string, string>;
112
113
  };
113
- /** Authentication configuration */
114
- auth?: {
115
- type: 'none' | 'bearer' | 'api_key' | 'custom';
116
- token?: string;
117
- apiKey?: string;
118
- headers?: Record<string, string>;
119
- };
120
114
  /** Request timeout in milliseconds */
121
115
  timeout?: number;
122
116
  /** Retry configuration */
@@ -166,3 +160,25 @@ export declare function getEndpointMethod(config: EndpointConfig, endpointKey: s
166
160
  * Get custom headers for an endpoint
167
161
  */
168
162
  export declare function getEndpointHeaders(config: EndpointConfig, endpointKey: string): Record<string, string>;
163
+ /**
164
+ * Build request headers for an endpoint, layering the auth provider's headers
165
+ * over the static endpoint headers.
166
+ *
167
+ * This is the single header-building path shared by the per-instance services
168
+ * (playground, chat, interrupt, settings, port config, categories). Routing all
169
+ * of them through this helper guarantees a configured {@link AuthProvider}
170
+ * authenticates every request consistently — matching the behaviour of
171
+ * {@link EnhancedFlowDropApiClient}, which owns the equivalent merge for the
172
+ * typed workflow/node API.
173
+ *
174
+ * `getAuthHeaders()` is awaited per call so providers can return freshly
175
+ * refreshed tokens. When no provider is supplied the result is identical to
176
+ * {@link getEndpointHeaders} (no auth) — keeping unauthenticated callers
177
+ * working unchanged.
178
+ *
179
+ * @param config - The endpoint configuration
180
+ * @param endpointKey - Key identifying the endpoint (for static header lookup)
181
+ * @param authProvider - Optional auth provider supplying `Authorization` etc.
182
+ * @returns Merged headers: static endpoint headers < auth headers
183
+ */
184
+ export declare function getRequestHeaders(config: EndpointConfig, endpointKey: string, authProvider?: AuthProvider): Promise<Record<string, string>>;
@@ -132,16 +132,8 @@ export function getEndpointHeaders(config, endpointKey) {
132
132
  const baseHeaders = {
133
133
  'Content-Type': 'application/json'
134
134
  };
135
- // Add authentication headers
136
- if (config.auth?.type === 'bearer' && config.auth.token) {
137
- baseHeaders['Authorization'] = `Bearer ${config.auth.token}`;
138
- }
139
- else if (config.auth?.type === 'api_key' && config.auth.apiKey) {
140
- baseHeaders['X-API-Key'] = config.auth.apiKey;
141
- }
142
- else if (config.auth?.type === 'custom' && config.auth.headers) {
143
- Object.assign(baseHeaders, config.auth.headers);
144
- }
135
+ // Authentication is supplied via the AuthProvider passed to the API client /
136
+ // ApiContext — EndpointConfig no longer carries an `auth` block.
145
137
  // Add endpoint-specific headers
146
138
  const endpointHeaders = config.headers?.[endpointKey];
147
139
  if (endpointHeaders) {
@@ -149,3 +141,31 @@ export function getEndpointHeaders(config, endpointKey) {
149
141
  }
150
142
  return baseHeaders;
151
143
  }
144
+ /**
145
+ * Build request headers for an endpoint, layering the auth provider's headers
146
+ * over the static endpoint headers.
147
+ *
148
+ * This is the single header-building path shared by the per-instance services
149
+ * (playground, chat, interrupt, settings, port config, categories). Routing all
150
+ * of them through this helper guarantees a configured {@link AuthProvider}
151
+ * authenticates every request consistently — matching the behaviour of
152
+ * {@link EnhancedFlowDropApiClient}, which owns the equivalent merge for the
153
+ * typed workflow/node API.
154
+ *
155
+ * `getAuthHeaders()` is awaited per call so providers can return freshly
156
+ * refreshed tokens. When no provider is supplied the result is identical to
157
+ * {@link getEndpointHeaders} (no auth) — keeping unauthenticated callers
158
+ * working unchanged.
159
+ *
160
+ * @param config - The endpoint configuration
161
+ * @param endpointKey - Key identifying the endpoint (for static header lookup)
162
+ * @param authProvider - Optional auth provider supplying `Authorization` etc.
163
+ * @returns Merged headers: static endpoint headers < auth headers
164
+ */
165
+ export async function getRequestHeaders(config, endpointKey, authProvider) {
166
+ const headers = getEndpointHeaders(config, endpointKey);
167
+ if (authProvider) {
168
+ Object.assign(headers, await authProvider.getAuthHeaders());
169
+ }
170
+ return headers;
171
+ }
@@ -16,18 +16,18 @@
16
16
  */
17
17
  export type { WorkflowFormat, BuiltinWorkflowFormat } from '../types/index.js';
18
18
  export { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
19
- export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
19
+ export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, PortsConfig, PortConfigEntry, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
20
20
  export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from '../types/index.js';
21
21
  export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig } from '../types/config.js';
22
22
  export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from '../types/auth.js';
23
23
  export type { WorkflowChangeType, FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
24
24
  export type { FieldSchema, FieldType, FieldFormat, FieldOption, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, CodeEditorFieldProps, MarkdownEditorFieldProps, TemplateEditorFieldProps, FormFieldFactoryProps, FormFieldWrapperProps } from '../components/form/types.js';
25
- export { BaseRegistry } from '../registry/BaseRegistry.js';
25
+ export { BaseRegistry } from '../registry/BaseRegistry.svelte.js';
26
26
  export type { NodeComponentProps, NodeTypeInfo, NodeComponentRegistration, NodeComponentCategory, StatusPosition, StatusSize, NodeRegistrationFilter, FlowDropPluginConfig, PluginNodeDefinition, PluginRegistrationResult } from '../registry/index.js';
27
27
  export type { FieldMatcherRegistration } from '../form/fieldRegistry.js';
28
- export { workflowFormatRegistry } from '../registry/workflowFormatRegistry.js';
28
+ export { WorkflowFormatRegistry } from '../registry/workflowFormatRegistry.js';
29
29
  export type { WorkflowFormatAdapter, FormatValidationResult } from '../registry/workflowFormatRegistry.js';
30
- export { registerBuiltinFormats, areBuiltinFormatsRegistered, resetBuiltinFormatRegistration } from '../registry/builtinFormats.js';
30
+ export { getBuiltinFormatAdapters } from '../registry/builtinFormats.js';
31
31
  export type { ToastType, ToastOptions } from '../services/toastService.js';
32
32
  export type { DynamicSchemaResult } from '../services/dynamicSchemaService.js';
33
33
  export type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundMessageRequest, PlaygroundMessagesResult, PlaygroundConfig, PlaygroundMode, PlaygroundSessionStatus, PlaygroundMessageRole, PlaygroundMessageLevel, PlaygroundMessageMetadata, PlaygroundApiResponse, PlaygroundSessionsResponse, PlaygroundSessionResponse, PlaygroundMessageResponse, PlaygroundMessagesApiResponse } from '../types/playground.js';
@@ -68,16 +68,15 @@ export { computeAutoLayout } from '../adapters/agentspec/autoLayout.js';
68
68
  export type { AutoLayoutConfig } from '../adapters/agentspec/autoLayout.js';
69
69
  export type { AgentSpecEndpointConfig } from '../config/agentSpecEndpoints.js';
70
70
  export { defaultAgentSpecEndpoints, createAgentSpecEndpointConfig, buildAgentSpecUrl, getAgentSpecAuthHeaders } from '../config/agentSpecEndpoints.js';
71
- export { AgentSpecExecutionService, agentSpecExecutionService } from '../services/agentSpecExecutionService.js';
71
+ export { AgentSpecExecutionService } from '../services/agentSpecExecutionService.js';
72
72
  export type { AgentSpecExecutionHandle } from '../services/agentSpecExecutionService.js';
73
- export { workflowSchema, WORKFLOW_SCHEMA_VERSION } from '../schema/index.js';
73
+ export { workflowSchema, WORKFLOW_SCHEMA_VERSION } from '../schemas/index.js';
74
74
  export type { FlowDropTheme, FlowDropThemeName, FlowDropThemeConfig } from '../types/theme.js';
75
75
  export { defaultTheme, minimalTheme, resolveTheme } from '../themes/index.js';
76
76
  export type { FlowDropSkin, FlowDropSkinName, FlowDropSkinTokens } from '../types/skin.js';
77
77
  export { slateSkin, defaultSkin } from '../skins/index.js';
78
78
  export type { ThemePreference, ResolvedTheme } from '../stores/settingsStore.svelte.js';
79
79
  export { getTheme as theme, getResolvedTheme as resolvedTheme, setTheme, toggleTheme, cycleTheme, initializeTheme, isThemeInitialized } from '../stores/settingsStore.svelte.js';
80
- export { sanitizeHtml } from '../utils/sanitize.js';
81
80
  export { logger, setLogLevel, getLogLevel } from '../utils/logger.js';
82
81
  export type { LogLevel } from '../utils/logger.js';
83
82
  export { computeSwapPreview, computeSwapPreviewWithOptions, executeSwap, mapConfig, getVersionUpgrade, compareSemver, performSwap, validateSwapResult, SwapValidationError } from '../utils/nodeSwap.js';
@@ -17,11 +17,11 @@
17
17
  export { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
18
18
  export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from '../types/index.js';
19
19
  // Base registry
20
- export { BaseRegistry } from '../registry/BaseRegistry.js';
21
- // Workflow format registry
22
- export { workflowFormatRegistry } from '../registry/workflowFormatRegistry.js';
23
- // Built-in format registration helpers
24
- export { registerBuiltinFormats, areBuiltinFormatsRegistered, resetBuiltinFormatRegistration } from '../registry/builtinFormats.js';
20
+ export { BaseRegistry } from '../registry/BaseRegistry.svelte.js';
21
+ // Workflow format registry (the class — instances live on `fd.formats`)
22
+ export { WorkflowFormatRegistry } from '../registry/workflowFormatRegistry.js';
23
+ // Built-in format adapters (used to seed instance format registries)
24
+ export { getBuiltinFormatAdapters } from '../registry/builtinFormats.js';
25
25
  export { isChatInputNode, CHAT_INPUT_PATTERNS } from '../types/playground.js';
26
26
  // ============================================================================
27
27
  // Authentication Providers (no dependencies)
@@ -80,20 +80,16 @@ export { validateForAgentSpecExport, validateAgentSpecFlow } from '../adapters/a
80
80
  // Agent Spec auto-layout
81
81
  export { computeAutoLayout } from '../adapters/agentspec/autoLayout.js';
82
82
  export { defaultAgentSpecEndpoints, createAgentSpecEndpointConfig, buildAgentSpecUrl, getAgentSpecAuthHeaders } from '../config/agentSpecEndpoints.js';
83
- // Agent Spec execution service
84
- export { AgentSpecExecutionService, agentSpecExecutionService } from '../services/agentSpecExecutionService.js';
83
+ // Agent Spec execution service (instantiate per instance — no global singleton)
84
+ export { AgentSpecExecutionService } from '../services/agentSpecExecutionService.js';
85
85
  // ============================================================================
86
86
  // Workflow JSON Schema
87
87
  // ============================================================================
88
- export { workflowSchema, WORKFLOW_SCHEMA_VERSION } from '../schema/index.js';
88
+ export { workflowSchema, WORKFLOW_SCHEMA_VERSION } from '../schemas/index.js';
89
89
  export { defaultTheme, minimalTheme, resolveTheme } from '../themes/index.js';
90
90
  export { slateSkin, defaultSkin } from '../skins/index.js';
91
91
  export { getTheme as theme, getResolvedTheme as resolvedTheme, setTheme, toggleTheme, cycleTheme, initializeTheme, isThemeInitialized } from '../stores/settingsStore.svelte.js';
92
92
  // ============================================================================
93
- // HTML Sanitization
94
- // ============================================================================
95
- export { sanitizeHtml } from '../utils/sanitize.js';
96
- // ============================================================================
97
93
  // Logger
98
94
  // ============================================================================
99
95
  export { logger, setLogLevel, getLogLevel } from '../utils/logger.js';
@@ -2,13 +2,16 @@
2
2
  * FlowDrop Display Module
3
3
  *
4
4
  * Provides display components for rendering content.
5
- * This module includes the marked library for markdown rendering.
6
5
  *
7
6
  * @module display
8
7
  *
8
+ * This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
9
+ * (DOMPurify). `sanitizeHtml` is exposed here — rather than from
10
+ * `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
11
+ *
9
12
  * @example
10
13
  * ```typescript
11
- * import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
14
+ * import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
12
15
  * ```
13
16
  *
14
17
  * @example In Svelte:
@@ -26,4 +29,4 @@
26
29
  * ```
27
30
  */
28
31
  export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
29
- export { marked } from 'marked';
32
+ export { sanitizeHtml } from '../utils/sanitize.js';
@@ -2,13 +2,16 @@
2
2
  * FlowDrop Display Module
3
3
  *
4
4
  * Provides display components for rendering content.
5
- * This module includes the marked library for markdown rendering.
6
5
  *
7
6
  * @module display
8
7
  *
8
+ * This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
9
+ * (DOMPurify). `sanitizeHtml` is exposed here — rather than from
10
+ * `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
11
+ *
9
12
  * @example
10
13
  * ```typescript
11
- * import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
14
+ * import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
12
15
  * ```
13
16
  *
14
17
  * @example In Svelte:
@@ -30,7 +33,6 @@
30
33
  // ============================================================================
31
34
  export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
32
35
  // ============================================================================
33
- // Re-export marked for advanced usage
36
+ // HTML Sanitization (DOMPurify-backed — lives here, not in core)
34
37
  // ============================================================================
35
- // Users can use marked directly if they need more control
36
- export { marked } from 'marked';
38
+ export { sanitizeHtml } from '../utils/sanitize.js';
@@ -5,9 +5,14 @@
5
5
  * building visual workflow editors. This module includes @xyflow/svelte
6
6
  * and all node components.
7
7
  *
8
- * **Important: Single-instance only.** FlowDrop uses module-level singleton
9
- * stores for state management. Only one FlowDrop editor instance per page
10
- * is supported. This is a known architectural limitation.
8
+ * **Multi-instance support.** Each mount gets its own `FlowDropInstance`
9
+ * state container (workflow, undo/redo, playground, …), so multiple editors
10
+ * can coexist on one page. Pass `instanceId` to the mount options to scope
11
+ * draft/panel storage keys per editor; in Svelte, pass `instance` to <App>
12
+ * or resolve it in components via `getInstance()`. State is addressed through
13
+ * the instance — there is no page-default module-level store API.
14
+ * Page-global by design: theme/settings, port-compatibility config, and API
15
+ * endpoint config.
11
16
  *
12
17
  * @module editor
13
18
  *
@@ -31,7 +36,6 @@
31
36
  * <WorkflowEditor nodes={availableNodes} />
32
37
  * ```
33
38
  */
34
- import '../registry/builtinNodes.js';
35
39
  export { default as WorkflowEditor } from '../components/WorkflowEditor.svelte';
36
40
  export { default as App } from '../components/App.svelte';
37
41
  export { default as WorkflowNodeComponent } from '../components/nodes/WorkflowNode.svelte';
@@ -58,33 +62,28 @@ export { default as PipelineStatus } from '../components/PipelineStatus.svelte';
58
62
  export { default as Navbar } from '../components/Navbar.svelte';
59
63
  export { default as Logo } from '../components/Logo.svelte';
60
64
  export { default as CommandConsole } from '../components/console/CommandConsole.svelte';
61
- export { default as Playground } from '../components/playground/Playground.svelte';
62
- export { default as PlaygroundModal } from '../components/playground/PlaygroundModal.svelte';
63
- export { default as ChatPanel } from '../components/playground/ChatPanel.svelte';
64
- export { default as SessionManager } from '../components/playground/SessionManager.svelte';
65
- export { default as InputCollector } from '../components/playground/InputCollector.svelte';
66
- export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte';
67
- export { default as MessageBubble } from '../components/playground/MessageBubble.svelte';
68
65
  export { mountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from '../svelte-app.js';
69
- export { nodeComponentRegistry, createNamespacedType, parseNamespacedType, BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias, registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from '../registry/index.js';
66
+ export { NodeComponentRegistry, createNamespacedType, parseNamespacedType, BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias, createPlugin, isValidNamespace } from '../registry/index.js';
70
67
  export { EdgeStylingHelper, NodeOperationsHelper, WorkflowOperationsHelper, ConfigurationHelper } from '../helpers/workflowEditorHelper.js';
71
- export { getWorkflowStore, workflowActions, getWorkflowId, getWorkflowName, getWorkflowNodes, getWorkflowEdges, getWorkflowMetadata, getWorkflowFormat, getWorkflowChanged, getWorkflowValidation, getWorkflowMetadataChanged, getConnectedHandles, getIsDirty, isDirty, markAsSaved, getEditVersion, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange, setHistoryEnabled, isHistoryEnabled, setRestoringFromHistory } from '../stores/workflowStore.svelte.js';
72
- export { rebuildAllPortCoordinates, updateNodePortCoordinates, removeNodePortCoordinates, getPortCoordinate, getNodePortCoordinates, getPortCoordinateSnapshot, getPortCoordinates } from '../stores/portCoordinateStore.svelte.js';
73
- export { getHistoryState, getCanUndo, getCanRedo, historyActions, setOnRestoreCallback, cleanupHistorySubscription, historyService, HistoryService } from '../stores/historyStore.svelte.js';
68
+ export { createFlowDropInstance, getDefaultInstance, type FlowDropInstance, type CreateInstanceOptions } from '../stores/instanceContainer.svelte.js';
69
+ export { getInstance, provideInstance, FLOWDROP_INSTANCE_KEY } from '../stores/getInstance.svelte.js';
70
+ export { WorkflowStore, type WorkflowStoreActions } from '../stores/workflowStore.svelte.js';
71
+ export { HistoryStore, type HistoryStoreActions } from '../stores/historyStore.svelte.js';
72
+ export { ApiContext } from '../stores/apiContext.js';
73
+ export { PortCoordinateStore } from '../stores/portCoordinateStore.svelte.js';
74
+ export { HistoryService } from '../services/historyService.js';
74
75
  export type { HistoryEntry, HistoryState, PushOptions } from '../stores/historyStore.svelte.js';
75
- export { setEndpointConfig, getEndpointConfig, nodeApi, workflowApi, api } from '../services/api.js';
76
76
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
77
- export { NodeExecutionService, nodeExecutionService } from '../services/nodeExecutionService.js';
78
- export { PlaygroundService, playgroundService } from '../services/playgroundService.js';
79
- export { getCurrentSession, getSessions, getMessages, getIsExecuting, getCanSendMessage, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollSequenceNumber, getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount, playgroundActions, applyServerResponse, subscribeToSessionStatus, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestSequenceNumber } from '../stores/playgroundStore.svelte.js';
77
+ export { NodeExecutionService } from '../services/nodeExecutionService.js';
80
78
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
81
79
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
82
80
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
83
81
  export { fetchCategories, validateCategories } from '../services/categoriesApi.js';
84
82
  export { fetchDynamicSchema, resolveExternalEditUrl, getEffectiveConfigEditOptions, clearSchemaCache, invalidateSchemaCache, hasConfigEditOptions, shouldShowExternalEdit, shouldUseDynamicSchema } from '../services/dynamicSchemaService.js';
85
- export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, DraftAutoSaveManager } from '../services/draftStorage.js';
83
+ export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
84
+ export type { DraftStorageAdapter, DraftStorageType, DraftStorageOption } from '../services/draftStorage.js';
86
85
  export { EnhancedFlowDropApiClient, ApiError } from '../api/enhanced-client.js';
87
- export { isLoopbackEdge, isValidLoopbackCycle, PortCompatibilityChecker, initializePortCompatibility, getPortCompatibilityChecker, getPossibleConnections, validateConnection, getConnectionSuggestions, hasCycles, hasInvalidCycles, getExecutionOrder } from '../utils/connections.js';
86
+ export { isLoopbackEdge, isValidLoopbackCycle, PortCompatibilityChecker, getPossibleConnections, validateConnection, getConnectionSuggestions, hasCycles, hasInvalidCycles, getExecutionOrder } from '../utils/connections.js';
88
87
  export { fetchRuntimeConfig, getRuntimeConfig, clearRuntimeConfigCache, initRuntimeConfig } from '../config/runtimeConfig.js';
89
88
  export type { RuntimeConfig } from '../config/runtimeConfig.js';
90
89
  export type { Workflow, WorkflowNode, WorkflowEdge, NodeMetadata, NodePort, DynamicPort, Branch, ExecutionStatus, ExecutionResult, FlowDropConfig, PortConfig, ConfigSchema, ConfigProperty, ConfigEditOptions } from '../types/index.js';
@@ -5,9 +5,14 @@
5
5
  * building visual workflow editors. This module includes @xyflow/svelte
6
6
  * and all node components.
7
7
  *
8
- * **Important: Single-instance only.** FlowDrop uses module-level singleton
9
- * stores for state management. Only one FlowDrop editor instance per page
10
- * is supported. This is a known architectural limitation.
8
+ * **Multi-instance support.** Each mount gets its own `FlowDropInstance`
9
+ * state container (workflow, undo/redo, playground, …), so multiple editors
10
+ * can coexist on one page. Pass `instanceId` to the mount options to scope
11
+ * draft/panel storage keys per editor; in Svelte, pass `instance` to <App>
12
+ * or resolve it in components via `getInstance()`. State is addressed through
13
+ * the instance — there is no page-default module-level store API.
14
+ * Page-global by design: theme/settings, port-compatibility config, and API
15
+ * endpoint config.
11
16
  *
12
17
  * @module editor
13
18
  *
@@ -32,12 +37,6 @@
32
37
  * ```
33
38
  */
34
39
  // ============================================================================
35
- // Initialize Built-in Nodes
36
- // This side effect is intentional for the editor module - users importing
37
- // the editor expect all node types to be available.
38
- // ============================================================================
39
- import '../registry/builtinNodes.js';
40
- // ============================================================================
41
40
  // Main Editor Components
42
41
  // ============================================================================
43
42
  export { default as WorkflowEditor } from '../components/WorkflowEditor.svelte';
@@ -73,14 +72,6 @@ export { default as Navbar } from '../components/Navbar.svelte';
73
72
  export { default as Logo } from '../components/Logo.svelte';
74
73
  // Console Components
75
74
  export { default as CommandConsole } from '../components/console/CommandConsole.svelte';
76
- // Playground Components
77
- export { default as Playground } from '../components/playground/Playground.svelte';
78
- export { default as PlaygroundModal } from '../components/playground/PlaygroundModal.svelte';
79
- export { default as ChatPanel } from '../components/playground/ChatPanel.svelte';
80
- export { default as SessionManager } from '../components/playground/SessionManager.svelte';
81
- export { default as InputCollector } from '../components/playground/InputCollector.svelte';
82
- export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte';
83
- export { default as MessageBubble } from '../components/playground/MessageBubble.svelte';
84
75
  // ============================================================================
85
76
  // Mount Functions
86
77
  // ============================================================================
@@ -89,12 +80,12 @@ export { mountWorkflowEditor, mountFlowDropApp, unmountFlowDropApp } from '../sv
89
80
  // Node Component Registry
90
81
  // ============================================================================
91
82
  export {
92
- // Core registry
93
- nodeComponentRegistry, createNamespacedType, parseNamespacedType,
83
+ // Core registry (the class — instances live on `fd.nodes`)
84
+ NodeComponentRegistry, createNamespacedType, parseNamespacedType,
94
85
  // Built-in nodes
95
- BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias,
86
+ BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, isBuiltinType, getBuiltinTypes, resolveBuiltinAlias,
96
87
  // Plugin system
97
- registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from '../registry/index.js';
88
+ createPlugin, isValidNamespace } from '../registry/index.js';
98
89
  // ============================================================================
99
90
  // Editor Helpers
100
91
  // ============================================================================
@@ -102,30 +93,29 @@ export { EdgeStylingHelper, NodeOperationsHelper, WorkflowOperationsHelper, Conf
102
93
  // ============================================================================
103
94
  // Stores
104
95
  // ============================================================================
105
- export { getWorkflowStore, workflowActions, getWorkflowId, getWorkflowName, getWorkflowNodes, getWorkflowEdges, getWorkflowMetadata, getWorkflowFormat, getWorkflowChanged, getWorkflowValidation, getWorkflowMetadataChanged, getConnectedHandles,
106
- // Dirty state tracking & version counter
107
- getIsDirty, isDirty, markAsSaved, getEditVersion, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange,
108
- // History control
109
- setHistoryEnabled, isHistoryEnabled, setRestoringFromHistory } from '../stores/workflowStore.svelte.js';
96
+ // Multi-instance support: per-instance state containers + context helpers.
97
+ // All workflow/history/playground state is addressed through an instance.
98
+ export { createFlowDropInstance, getDefaultInstance } from '../stores/instanceContainer.svelte.js';
99
+ export { getInstance, provideInstance, FLOWDROP_INSTANCE_KEY } from '../stores/getInstance.svelte.js';
100
+ export { WorkflowStore } from '../stores/workflowStore.svelte.js';
101
+ export { HistoryStore } from '../stores/historyStore.svelte.js';
102
+ // Per-instance API context (endpoints + auth provider + lazily-built client).
103
+ export { ApiContext } from '../stores/apiContext.js';
110
104
  // Port Coordinate Store (Svelte 5 runes-based)
111
- export { rebuildAllPortCoordinates, updateNodePortCoordinates, removeNodePortCoordinates, getPortCoordinate, getNodePortCoordinates, getPortCoordinateSnapshot, getPortCoordinates } from '../stores/portCoordinateStore.svelte.js';
112
- // History Store and Service
113
- export { getHistoryState, getCanUndo, getCanRedo, historyActions, setOnRestoreCallback, cleanupHistorySubscription, historyService, HistoryService } from '../stores/historyStore.svelte.js';
105
+ export { PortCoordinateStore } from '../stores/portCoordinateStore.svelte.js';
106
+ // History Service (the undo/redo engine class)
107
+ export { HistoryService } from '../services/historyService.js';
114
108
  // ============================================================================
115
109
  // Services
116
110
  // ============================================================================
117
- export { setEndpointConfig, getEndpointConfig, nodeApi, workflowApi, api } from '../services/api.js';
118
111
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
119
- export { NodeExecutionService, nodeExecutionService } from '../services/nodeExecutionService.js';
120
- // Playground Service and Store
121
- export { PlaygroundService, playgroundService } from '../services/playgroundService.js';
122
- export { getCurrentSession, getSessions, getMessages, getIsExecuting, getCanSendMessage, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollSequenceNumber, getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount, playgroundActions, applyServerResponse, subscribeToSessionStatus, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestSequenceNumber } from '../stores/playgroundStore.svelte.js';
112
+ export { NodeExecutionService } from '../services/nodeExecutionService.js';
123
113
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
124
114
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
125
115
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
126
116
  export { fetchCategories, validateCategories } from '../services/categoriesApi.js';
127
117
  export { fetchDynamicSchema, resolveExternalEditUrl, getEffectiveConfigEditOptions, clearSchemaCache, invalidateSchemaCache, hasConfigEditOptions, shouldShowExternalEdit, shouldUseDynamicSchema } from '../services/dynamicSchemaService.js';
128
- export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, DraftAutoSaveManager } from '../services/draftStorage.js';
118
+ export { getDraftStorageKey, saveDraft, loadDraft, deleteDraft, hasDraft, getDraftMetadata, clearAllDrafts, setDraftStorage, getDraftStorage, resolveDraftStorage, DraftAutoSaveManager } from '../services/draftStorage.js';
129
119
  // ============================================================================
130
120
  // API Clients
131
121
  // ============================================================================
@@ -133,7 +123,7 @@ export { EnhancedFlowDropApiClient, ApiError } from '../api/enhanced-client.js';
133
123
  // ============================================================================
134
124
  // Connection Utilities
135
125
  // ============================================================================
136
- export { isLoopbackEdge, isValidLoopbackCycle, PortCompatibilityChecker, initializePortCompatibility, getPortCompatibilityChecker, getPossibleConnections, validateConnection, getConnectionSuggestions, hasCycles, hasInvalidCycles, getExecutionOrder } from '../utils/connections.js';
126
+ export { isLoopbackEdge, isValidLoopbackCycle, PortCompatibilityChecker, getPossibleConnections, validateConnection, getConnectionSuggestions, hasCycles, hasInvalidCycles, getExecutionOrder } from '../utils/connections.js';
137
127
  // ============================================================================
138
128
  // Runtime Configuration
139
129
  // ============================================================================