@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,642 @@
1
+ # Migrating to FlowDrop 2.0
2
+
3
+ 2.0's theme is **the explicit-instance era**: every compatibility shim the 1.x
4
+ multi-instance refactor and the 1.8 message migration carried is gone. If your
5
+ 1.x code ran without deprecation warnings in the console, most of this guide
6
+ does not apply to you.
7
+
8
+ The sections are ordered by the shape of the change, from the deepest
9
+ architectural moves (instances, the API client, registries) outward to module
10
+ layout, data formats, component props, and storage. Each has a 1.x → 2.0 code
11
+ example.
12
+
13
+ ## 1. Module-level store APIs are removed (the big one)
14
+
15
+ All ~95 module-level functions that operated on "the" editor are gone:
16
+ `getWorkflowStore()`, `workflowActions`, `historyService`, `getMessages()`,
17
+ `playgroundActions`, `getCategories()`, `getHistoryState()`, and the rest of
18
+ the get*/set*/actions surface from `@flowdrop/flowdrop/editor` and
19
+ `@flowdrop/flowdrop/playground`.
20
+
21
+ **Replacement:** every mount handle exposes its state container.
22
+
23
+ ```js
24
+ // 1.x
25
+ import { workflowActions, historyService, getMessages } from '@flowdrop/flowdrop/editor';
26
+ const app = await mountFlowDropApp(el, options);
27
+ workflowActions.addNode(node);
28
+ historyService.undo();
29
+ const messages = getMessages();
30
+
31
+ // 2.0
32
+ const app = await mountFlowDropApp(el, options);
33
+ app.instance.workflow.actions.addNode(node);
34
+ app.instance.history.undo();
35
+ const messages = app.instance.playground.messages;
36
+ ```
37
+
38
+ Inside Svelte components rendered under `<App>`/`<WorkflowEditor>`, resolve the
39
+ owning instance with `getInstance()` (unchanged — including the browser
40
+ fallback to the page-default instance for single-editor embeds):
41
+
42
+ ```svelte
43
+ <script>
44
+ import { getInstance } from '@flowdrop/flowdrop/editor';
45
+ const fd = getInstance();
46
+ // fd.workflow, fd.history, fd.playground, fd.interrupts, fd.categories, …
47
+ </script>
48
+ ```
49
+
50
+ For hosts that construct state manually, the store classes are now exported:
51
+ `WorkflowStore`, `HistoryStore`, `HistoryService`, `PlaygroundStore`,
52
+ `InterruptStore`, `PortCoordinateStore`, plus `createFlowDropInstance()`.
53
+
54
+ Settings remain page-global by design — `getSettings()` etc. are unchanged.
55
+
56
+ ## 2. API access is instance-scoped (`fd.api`)
57
+
58
+ The module-level API singleton in `services/api.js` is gone:
59
+ `setEndpointConfig()`, `getEndpointConfig()`, `nodeApi`, `workflowApi`, and the
60
+ `api` aggregate are removed. Each instance now owns an `ApiContext` at
61
+ `fd.api`, which holds the endpoint config + auth provider and lazily builds an
62
+ `EnhancedFlowDropApiClient`.
63
+
64
+ ```js
65
+ // 1.x
66
+ import { setEndpointConfig, workflowApi, nodeApi } from '@flowdrop/flowdrop/editor';
67
+ setEndpointConfig(createEndpointConfig('/api/flowdrop'));
68
+ const nodes = await nodeApi.getNodes();
69
+ const wf = await workflowApi.getWorkflow(id);
70
+
71
+ // 2.0 — mount configures fd.api automatically; inside components resolve it:
72
+ import { getInstance } from '@flowdrop/flowdrop/editor';
73
+ const fd = getInstance();
74
+ const nodes = await fd.api.client.getAvailableNodes();
75
+ const wf = await fd.api.client.loadWorkflow(id);
76
+ ```
77
+
78
+ `mountFlowDropApp` / `mountPlayground` / `<App>` call `fd.api.configure(config,
79
+ authProvider)` for you. Services that previously read the singleton (playground,
80
+ interrupt, chat, node-execution, dynamic-schema, variable) now take the endpoint
81
+ config as their first argument — pass `fd.api.config`.
82
+
83
+ These services also accept the instance's `AuthProvider` as an **optional
84
+ trailing argument** so every request they make is authenticated consistently
85
+ with `fd.api.client` (the typed workflow/node API). The built-in components and
86
+ mount helpers pass `fd.api.authProvider` for you — no action is needed for the
87
+ normal mounted flow. Only direct callers of the service singletons need to
88
+ forward it:
89
+
90
+ ```js
91
+ import { playgroundService } from '@flowdrop/flowdrop/playground';
92
+
93
+ // 2.0 — authenticate playground requests by forwarding the provider
94
+ await playgroundService.listSessions(fd.api.config, workflowId, undefined, fd.api.authProvider);
95
+ await playgroundService.sendMessage(fd.api.config, sessionId, text, undefined, fd.api.authProvider);
96
+ ```
97
+
98
+ The settings-sync entry points gained the same optional provider:
99
+ `setSettingsEndpointConfig(config, authProvider?)` and
100
+ `createSettingsService(config, authProvider?)` — pass an `AuthProvider` if your
101
+ backend's preferences endpoint requires auth.
102
+
103
+ The standalone playground mounts — `mountPlayground`, `mountPlaygroundStudio`,
104
+ and `mountPlaygroundApp` — accept an `authProvider` option that they wire into
105
+ `fd.api` for you (the editor's built-in playground already inherits the
106
+ provider from `mountFlowDropApp`). Pass it so playground requests (sessions,
107
+ messages, polling, interrupts) carry your auth/CSRF headers:
108
+
109
+ ```js
110
+ mountPlayground(el, {
111
+ workflowId,
112
+ endpointConfig: createEndpointConfig('/api/flowdrop'),
113
+ authProvider: new CallbackAuthProvider({ getToken: () => session.getCsrfToken() })
114
+ });
115
+ ```
116
+
117
+ The same plumbing was extended to the editor and pipeline surfaces, which
118
+ previously built unauthenticated API clients from `endpointConfig` alone:
119
+
120
+ - The exported `<WorkflowEditor>` component accepts an `authProvider` prop
121
+ (threaded for you by `mountFlowDropApp` / `mountWorkflowEditor` / `<App>`).
122
+ Pass it when using `<WorkflowEditor>` directly.
123
+ - `<PipelineStatus>` accepts an `authProvider` prop (used when it builds its own
124
+ client from `endpointConfig` / `baseUrl`; ignored when you pass `apiClient`).
125
+ - `PipelineViewProps` — the contract for custom pipeline views registered via
126
+ `pipelineViews` — gained an optional `authProvider`, so custom views can build
127
+ authenticated clients the same way the built-in graph/kanban/table views do.
128
+
129
+ ### `EndpointConfig.auth` is removed — use an `AuthProvider`
130
+
131
+ The `auth` block on `EndpointConfig` (and its header-injection branch) is gone.
132
+ Authentication is supplied exclusively through an `AuthProvider`, passed to the
133
+ mount/`<App>` `authProvider` option (or `fd.api.configure(config, provider)`).
134
+ `StaticAuthProvider` covers the former static-token cases one-to-one:
135
+
136
+ ```js
137
+ // 1.x
138
+ createEndpointConfig('/api/flowdrop', {
139
+ auth: { type: 'bearer', token: TOKEN }
140
+ });
141
+
142
+ // 2.0
143
+ import { StaticAuthProvider } from '@flowdrop/flowdrop';
144
+ mountFlowDropApp(el, {
145
+ endpointConfig: createEndpointConfig('/api/flowdrop'),
146
+ authProvider: new StaticAuthProvider({ type: 'bearer', token: TOKEN })
147
+ });
148
+ ```
149
+
150
+ | 1.x `auth` | 2.0 `AuthProvider` |
151
+ | ----------------------------- | ----------------------------------------------------- |
152
+ | `{ type: 'none' }` | `new NoAuthProvider()` (or omit `authProvider`) |
153
+ | `{ type: 'bearer', token }` | `new StaticAuthProvider({ type: 'bearer', token })` |
154
+ | `{ type: 'api_key', apiKey }` | `new StaticAuthProvider({ type: 'api_key', apiKey })` |
155
+ | `{ type: 'custom', headers }` | `new StaticAuthProvider({ type: 'custom', headers })` |
156
+
157
+ `StaticAuthProvider`'s `api_key` type now accepts an optional `apiKeyHeader` to
158
+ override the header name (defaults to `X-API-Key`):
159
+
160
+ ```js
161
+ new StaticAuthProvider({ type: 'api_key', apiKey: KEY, apiKeyHeader: 'X-Tenant-Key' });
162
+ ```
163
+
164
+ ### `AuthProvider.isAuthenticated()` is removed
165
+
166
+ The `isAuthenticated()` method has been dropped from the `AuthProvider`
167
+ interface and all built-in providers. It was never consulted by the library —
168
+ request authentication is driven entirely by `getAuthHeaders()` and the optional
169
+ `onUnauthorized()` / `onForbidden()` hooks. If you implemented a **custom**
170
+ `AuthProvider`, you can delete the method; no replacement is needed.
171
+
172
+ ```ts
173
+ // 1.x — required
174
+ const provider: AuthProvider = {
175
+ getAuthHeaders: async () => ({ Authorization: `Bearer ${token}` }),
176
+ isAuthenticated: () => Boolean(token) // ← remove this
177
+ };
178
+
179
+ // 2.0
180
+ const provider: AuthProvider = {
181
+ getAuthHeaders: async () => ({ Authorization: `Bearer ${token}` })
182
+ };
183
+ ```
184
+
185
+ ### Auth refresh (`401`) now applies to every request
186
+
187
+ Previously only the typed workflow/node API (`fd.api.client`) refreshed and
188
+ retried on `401`. The per-instance services (playground, chat, interrupt,
189
+ settings, port config, categories) and form autocomplete attached auth headers
190
+ but did **not** invoke `onUnauthorized()`. They now all route through one
191
+ authenticated-fetch path, so a configured `onUnauthorized()` fires — and the
192
+ request retries once with a refreshed token — uniformly across the library.
193
+
194
+ This is not a source change for consumers, but if your `onUnauthorized()` had
195
+ side effects (analytics, redirects) it may now be called from request paths
196
+ where it previously was not. Make it idempotent.
197
+
198
+ ### Swap the auth provider at runtime — `fd.api.setAuthProvider()`
199
+
200
+ The `AuthProvider` is still supplied at mount time, but you no longer have to
201
+ remount to change it (e.g. on login/logout). `ApiContext` gained
202
+ `setAuthProvider()`, which updates the live client and is picked up by services
203
+ on their next request:
204
+
205
+ ```js
206
+ import { getInstance } from '@flowdrop/flowdrop/editor';
207
+ const fd = getInstance();
208
+
209
+ // after the user logs in / refreshes their session
210
+ fd.api.setAuthProvider(new StaticAuthProvider({ type: 'bearer', token: newToken }));
211
+
212
+ // on logout
213
+ fd.api.setAuthProvider(new NoAuthProvider());
214
+ ```
215
+
216
+ ### Instance-scoped port compatibility
217
+
218
+ `initializePortCompatibility()`, `getPortCompatibilityChecker()`, and
219
+ `isPortCompatibilityInitialized()` are removed. Each instance owns a
220
+ `PortCompatibilityChecker` at `fd.portCompatibility`, seeded with
221
+ `DEFAULT_PORT_CONFIG` and re-initialized by mount from the backend's port
222
+ config. The standalone connection helpers (`validateConnection`,
223
+ `getPossibleConnections`, `getConnectionSuggestions`) now take the checker as
224
+ their first argument.
225
+
226
+ ```js
227
+ // 1.x
228
+ import { initializePortCompatibility, validateConnection } from '@flowdrop/flowdrop/editor';
229
+ initializePortCompatibility(portConfig);
230
+ const ok = validateConnection(source, target);
231
+
232
+ // 2.0
233
+ import { getInstance } from '@flowdrop/flowdrop/editor';
234
+ const fd = getInstance();
235
+ const ok = validateConnection(fd.portCompatibility, source, target);
236
+ ```
237
+
238
+ ## 3. Registries are instance-scoped — importing the editor registers nothing
239
+
240
+ In 1.x the node, field, and format registries were module singletons, and the
241
+ editor barrel ran a side-effecting import that registered every builtin node the
242
+ moment you imported it. In 2.0 each registry lives on the instance —
243
+ `fd.nodes`, `fd.fields`, `fd.formats` — seeded in the constructor from read-only
244
+ builtin definitions. There is no longer any import-time registration, and
245
+ `package.json` `sideEffects` is now CSS-only (`["**/*.css"]`).
246
+
247
+ The module-level registration functions and the singleton registry constants are
248
+ removed:
249
+
250
+ - `registerCustomNode()`, `createFlowDropPlugin()` / `registerFlowDropPlugin()`,
251
+ and `plugin.ts` are gone. Registration is now a registry method:
252
+ `fd.nodes.registerCustom(...)`, `fd.nodes.registerPlugin(...)`,
253
+ `fd.nodes.unregisterPlugin(...)`. `createPlugin().register(fd.nodes)` replaces
254
+ the module plugin functions.
255
+ - The exported singleton consts `nodeComponentRegistry`, `fieldComponentRegistry`,
256
+ and `workflowFormatRegistry` are removed. Resolve the instance registry instead.
257
+
258
+ ```js
259
+ // 1.x — module singletons + import-time side effects
260
+ import { registerCustomNode, fieldComponentRegistry } from '@flowdrop/flowdrop/editor';
261
+ registerCustomNode('myapp:color', 'Color Node', ColorNode);
262
+ fieldComponentRegistry.register('color', {
263
+ component: MyColorField,
264
+ matcher: (schema) => schema.format === 'color'
265
+ });
266
+
267
+ // 2.0 — register against the instance after mount
268
+ import { getInstance } from '@flowdrop/flowdrop/editor';
269
+ const fd = getInstance();
270
+ fd.nodes.registerCustom('myapp:color', 'Color Node', ColorNode);
271
+ fd.fields.register('color', {
272
+ component: MyColorField,
273
+ matcher: (schema) => schema.format === 'color'
274
+ });
275
+ ```
276
+
277
+ Because registration is now post-mount by construction, late registrations have
278
+ to invalidate `$derived` reads that already ran. `BaseRegistry` carries a
279
+ `$state` version counter (the `editVersion` pattern) so dependent reads
280
+ re-run when you register after the first paint — no host action required.
281
+
282
+ The heavy form-field installers (`registerCodeEditorField`,
283
+ `registerMarkdownEditorField`, and the template field) now take the **target
284
+ registry explicitly** and re-check registration after their dynamic import
285
+ resolves:
286
+
287
+ ```js
288
+ // 1.x
289
+ import { registerCodeEditorField } from '@flowdrop/flowdrop/form/code';
290
+ registerCodeEditorField();
291
+
292
+ // 2.0
293
+ import { registerCodeEditorField } from '@flowdrop/flowdrop/form/code';
294
+ import { getInstance } from '@flowdrop/flowdrop/editor';
295
+ registerCodeEditorField(getInstance().fields);
296
+ ```
297
+
298
+ **You only need this for the standalone `@flowdrop/flowdrop/form` primitive.**
299
+ The full editor is batteries-included: `<WorkflowEditor>` / `<App>` and the
300
+ playground register the built-in markdown, code, and template editors on their
301
+ own instance's `fields` registry on mount, so node config fields with
302
+ `format: 'markdown' | 'code' | 'template'` render real editors out of the box —
303
+ no host call required. Registration is a dynamic `import()`, so the CodeMirror /
304
+ `marked` chunks stay code-split (the light `/editor` static bundle is
305
+ unaffected) and load lazily on first use. To strip them, pass
306
+ `features: { builtinEditors: false }` to `mountFlowDropApp` (or
307
+ `builtinEditors: false` to `mountWorkflowEditor` / `<WorkflowEditor>`) and either
308
+ accept the textarea fallback or register your own field components via
309
+ `instance.fields.register(...)`.
310
+
311
+ Category color/icon helpers likewise take a `CategoriesStore` as an explicit
312
+ parameter — the last global-instance fallback in `utils` is gone.
313
+
314
+ `fd.fields.register()` warns in dev when it overwrites an existing field type.
315
+ Overwriting still works (replacing a built-in field is legitimate); the warning
316
+ flags accidental duplicates.
317
+
318
+ ## 4. Barrel de-duplication and the slim main entry
319
+
320
+ ### Each export keeps a single canonical home
321
+
322
+ The editor barrel no longer re-exports playground internals, and the display
323
+ barrel no longer re-exports `marked`.
324
+
325
+ - **Playground exports** (`Playground`, `PlaygroundModal`, `ChatPanel`,
326
+ `SessionManager`, `InputCollector`, `ExecutionLogs`, `MessageBubble`,
327
+ `PlaygroundService`, `PlaygroundStore`) are removed from
328
+ `@flowdrop/flowdrop/editor`. Import them from `@flowdrop/flowdrop/playground`
329
+ instead.
330
+
331
+ ```js
332
+ // 1.x
333
+ import { Playground, PlaygroundStore } from '@flowdrop/flowdrop/editor';
334
+
335
+ // 2.0
336
+ import { Playground, PlaygroundStore } from '@flowdrop/flowdrop/playground';
337
+ ```
338
+
339
+ - **`marked`** is no longer re-exported from `@flowdrop/flowdrop/display`. If you
340
+ need `marked` directly, install it as a dependency and import it from the
341
+ package:
342
+
343
+ ```js
344
+ // 1.x
345
+ import { marked } from '@flowdrop/flowdrop/display';
346
+
347
+ // 2.0 — `npm install marked`
348
+ import { marked } from 'marked';
349
+ ```
350
+
351
+ ### The main entry is now a minimal front door
352
+
353
+ `@flowdrop/flowdrop` (the main entry) no longer re-exports the entire library.
354
+ In 1.x it bundled every sub-module via `export *`; in 2.0 it exposes only the
355
+ small surface most apps need to bootstrap:
356
+
357
+ - **Values:** `App`, `mountFlowDropApp`, `unmountFlowDropApp`,
358
+ `createFlowDropInstance`, `getInstance`, `provideInstance`,
359
+ `createEndpointConfig`, `defaultEndpointConfig`, `NoAuthProvider`,
360
+ `StaticAuthProvider`, `CallbackAuthProvider`.
361
+ - **Types:** `Workflow`, `WorkflowNode`, `WorkflowEdge`, `NodeMetadata`,
362
+ `ConfigSchema`, `EndpointConfig`, `AuthProvider`, `FlowDropInstance`,
363
+ `FlowDropMountOptions`, `MountedFlowDropApp`, `FlowDropEventHandlers`,
364
+ `Messages`, `MessagesOverride`.
365
+
366
+ Everything else moves to a sub-module. If you imported a name from
367
+ `@flowdrop/flowdrop` that is not in the list above, switch to the sub-module
368
+ that owns it:
369
+
370
+ | Name (1.x main entry) | 2.0 sub-module |
371
+ | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
372
+ | `WorkflowEditor`, `ConfigForm`, `ConfigModal`, `ConfigPanel`, `Navbar`, `NodeSidebar`, node components | `@flowdrop/flowdrop/editor` |
373
+ | `mountWorkflowEditor`, editor helper classes, `EnhancedFlowDropApiClient`, `ApiContext` | `@flowdrop/flowdrop/editor` |
374
+ | `WorkflowStore`, `HistoryStore`, `HistoryService`, `PortCoordinateStore` | `@flowdrop/flowdrop/editor` |
375
+ | `globalSaveWorkflow`, `globalExportWorkflow`, `saveWorkflow`, `getWorkflow`, draft-storage helpers | `@flowdrop/flowdrop/editor` |
376
+ | `fetchPortConfig`, `fetchCategories`, dynamic-schema helpers | `@flowdrop/flowdrop/editor` |
377
+ | `NodeExecutionService`, connection utilities, `PortCompatibilityChecker` | `@flowdrop/flowdrop/editor` |
378
+ | Toast functions (`showSuccess`, `showError`, `showWarning`, `showInfo`, `showLoading`, `dismissToast`, `showPromise`, `showConfirmation`, …) | `@flowdrop/flowdrop/editor` |
379
+ | `SchemaForm`, `FormField`, `FormSelect`, `FormToggle`, `FormArray`, …, `AutocompleteConfig` | `@flowdrop/flowdrop/form` |
380
+ | `FormAutocomplete` | `@flowdrop/flowdrop/form/autocomplete` |
381
+ | `registerCodeEditorField` | `@flowdrop/flowdrop/form/code` |
382
+ | `registerMarkdownEditorField` | `@flowdrop/flowdrop/form/markdown` |
383
+ | `Playground`, `PlaygroundModal`, `ChatPanel`, `mountPlayground`, `PlaygroundService` | `@flowdrop/flowdrop/playground` |
384
+ | `MarkdownDisplay` | `@flowdrop/flowdrop/display` |
385
+ | `setMessages`, `mergeMessages`, `defaultMessages` | `@flowdrop/flowdrop/core` |
386
+ | Theme/skin exports (`defaultTheme`, `minimalTheme`, `resolveTheme`, `defaultSkin`, `slateSkin`) | `@flowdrop/flowdrop/core` |
387
+ | Color-preference helpers (`theme`, `resolvedTheme`, `setTheme`, `toggleTheme`, …) | `@flowdrop/flowdrop/core` |
388
+ | `WorkflowAdapter`, `AgentSpecAdapter`, command DSL, color/icon utilities, all remaining types | `@flowdrop/flowdrop/core` |
389
+ | Settings stores/services/components | `@flowdrop/flowdrop/settings` |
390
+
391
+ ```js
392
+ // 1.x — everything from the main entry
393
+ import { WorkflowEditor, SchemaForm, showSuccess, defaultTheme } from '@flowdrop/flowdrop';
394
+
395
+ // 2.0 — import from the owning sub-module
396
+ import { WorkflowEditor, showSuccess } from '@flowdrop/flowdrop/editor';
397
+ import { SchemaForm } from '@flowdrop/flowdrop/form';
398
+ import { defaultTheme } from '@flowdrop/flowdrop/core';
399
+ ```
400
+
401
+ This also tightens tree-shaking: importing `App` and a couple of types from the
402
+ main entry no longer pulls the form, display, playground, and settings barrels
403
+ into your bundle.
404
+
405
+ ### Keeping heavy dependencies out of the light entries
406
+
407
+ A few more exports moved so that the lightweight entries (`/core`, the light
408
+ `/form`) never statically pull a heavy dependency (CodeMirror, `marked`,
409
+ DOMPurify, `@xyflow/svelte`). These are enforced by a bundle guard in CI, so
410
+ they cannot silently regress.
411
+
412
+ - **`sanitizeHtml` moved from `@flowdrop/flowdrop/core` to
413
+ `@flowdrop/flowdrop/display`.** It is DOMPurify-backed, and `/core` is the
414
+ "zero heavy dependencies" entry, so it now lives alongside `MarkdownDisplay`.
415
+
416
+ ```js
417
+ // before
418
+ import { sanitizeHtml } from '@flowdrop/flowdrop/core';
419
+ // 2.0
420
+ import { sanitizeHtml } from '@flowdrop/flowdrop/display';
421
+ ```
422
+
423
+ - **`FormFieldFull` moved from `@flowdrop/flowdrop/form` to
424
+ `@flowdrop/flowdrop/form/full`.** `FormFieldFull` statically bundles every
425
+ editor (including CodeMirror); keeping it in the light `/form` entry pulled
426
+ CodeMirror into every `SchemaForm` import. The default `FormField` exported
427
+ from `/form` is the registry-based light field factory — register heavy
428
+ editors via `/form/code` / `/form/markdown` (unchanged). Use `/form/full`
429
+ only if you specifically want every editor statically bundled.
430
+
431
+ ```js
432
+ // before
433
+ import { FormFieldFull } from '@flowdrop/flowdrop/form';
434
+ // 2.0
435
+ import { FormFieldFull } from '@flowdrop/flowdrop/form/full';
436
+ ```
437
+
438
+ - **Service singleton _instances_ are no longer exported.**
439
+ `playgroundService` and `interruptService` (`@flowdrop/flowdrop/playground`),
440
+ `nodeExecutionService` (`@flowdrop/flowdrop/editor`), and
441
+ `agentSpecExecutionService` (`@flowdrop/flowdrop/core`) are removed. They were
442
+ module-level instances constructed at import time, which forced the service
443
+ (and its dependencies) to be built the moment the entry was imported. The
444
+ **classes** remain exported (`PlaygroundService`, `InterruptService`,
445
+ `NodeExecutionService`, `AgentSpecExecutionService`). Most apps never touched
446
+ these directly (use `fd.playground` / `fd.interrupts`); if you did, call
447
+ `getInstance()` to obtain the shared instance:
448
+
449
+ ```js
450
+ // before
451
+ import { playgroundService } from '@flowdrop/flowdrop/playground';
452
+ // 2.0
453
+ import { PlaygroundService } from '@flowdrop/flowdrop/playground';
454
+ const playgroundService = PlaygroundService.getInstance();
455
+ ```
456
+
457
+ ## 5. Workflow `metadata` is required and `version` → `schemaVersion`
458
+
459
+ The workflow document's `metadata` object is now **required** on the `Workflow`
460
+ type, and its `version` field has been renamed to `schemaVersion`. The rename
461
+ disambiguates the document's _format_ version from any per-workflow revision
462
+ number you may track yourself (and from `NodeMetadata.version`, the node-type
463
+ version, which is **unchanged**).
464
+
465
+ ```ts
466
+ // 1.x
467
+ interface Workflow {
468
+ /* … */
469
+ metadata?: {
470
+ version: string; // ambiguous
471
+ createdAt: string;
472
+ updatedAt: string;
473
+ /* … */
474
+ };
475
+ }
476
+
477
+ // 2.0
478
+ interface Workflow {
479
+ /* … */
480
+ metadata: {
481
+ schemaVersion: string; // the workflow schema format version
482
+ createdAt: string;
483
+ updatedAt: string;
484
+ /* … */
485
+ };
486
+ }
487
+ ```
488
+
489
+ ### Load-time healing (automatic)
490
+
491
+ You do **not** need to migrate stored workflow JSON by hand. Every workflow
492
+ entry point — `WorkflowStore.initialize` (which backs `mountFlowDropApp`'s
493
+ `workflow` option, drag-and-drop file import, and draft load) and
494
+ `WorkflowAdapter.importWorkflow` — normalizes metadata on the way in:
495
+
496
+ - **Missing `metadata`** → populated with required defaults (`schemaVersion`
497
+ from `WORKFLOW_SCHEMA_VERSION`, fresh `createdAt`/`updatedAt`).
498
+ - **Legacy `metadata.version`** → copied into `schemaVersion` (when
499
+ `schemaVersion` is absent), then the legacy `version` key is dropped.
500
+
501
+ Healing is idempotent: re-running it on an already-healed workflow is a no-op
502
+ (round-trip stable). This mirrors the localStorage key migration in §8 — the
503
+ runtime heals 1.x data on first read so existing documents keep loading.
504
+
505
+ ### What hosts reading workflow JSON need to know
506
+
507
+ If your application reads or writes FlowDrop workflow JSON directly (outside the
508
+ editor), update your code to read `metadata.schemaVersion` instead of
509
+ `metadata.version`. Documents still on disk with the old `version` key continue
510
+ to load through the editor unchanged, but newly serialized workflows will carry
511
+ `schemaVersion`. The Agent Spec export still uses the namespaced
512
+ `flowdrop:version` key (its source is now `metadata.schemaVersion`); that
513
+ external key name is unchanged.
514
+
515
+ The JSON Schema published at `@flowdrop/flowdrop/schema` reflects the rename —
516
+ `WorkflowMetadata.required` is now `[schemaVersion, createdAt, updatedAt]`.
517
+
518
+ ## 6. Removed component props
519
+
520
+ | Component | Removed | Use instead |
521
+ | ------------------------ | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
522
+ | `SchemaForm` | `saveLabel`, `cancelLabel` | `messages.form.schema.save` / `.cancel` |
523
+ | `AIChatPanel` | `placeholder` | `messages.chat.placeholder` |
524
+ | `ChatPanel` | `showChatInput`, `showRunButton` | `MessageStream` directly, or `ControlPanel` (keeps both flags) |
525
+ | `ChatPanel` | `showLogs` | `fd.playground.setShowLogs(...)` |
526
+ | `WorkflowEditor` | `nodes`, `height`, `width`, `isConfigSidebarOpen`, `selectedNodeForConfig`, `closeConfigSidebar` | These never did anything in 1.x. Size via `App`'s `height`/`width` (working since 1.16); node metadata flows through the instance. |
527
+ | `App` / `WorkflowEditor` | `readOnly`, `lockWorkflow` | A single `mode` prop — see [section 6.2](#62-mode-prop-replaces-readonly--lockworkflow). |
528
+ | `App` | `eventHandlers` (object) | Flat `on*` props — see [section 6.3](#63-app-event-handlers-are-flat-props). |
529
+
530
+ `FormToggle.onLabel`/`offLabel` and `FormArray.addLabel` were _un_-deprecated:
531
+ they express per-instance labels the global messages system cannot, and are
532
+ now documented overrides.
533
+
534
+ Removed message keys (only the removed ChatPanel branches read them):
535
+ `playground.states.viewOnlyTitle`, `.viewOnlyText`, `.readyTitle`, `.readyText`.
536
+
537
+ ### 6.1 `mountWorkflowEditor` option changes
538
+
539
+ - `workflow` now actually loads the workflow (1.x accepted and ignored it).
540
+ - `nodes` is removed (it fed a prop the editor never read). Use
541
+ `mountFlowDropApp` if you need to pre-seed node metadata.
542
+ - `readOnly` / `lockWorkflow` mount options become a single `mode` option
543
+ (`'edit' | 'readonly' | 'locked'`) — see
544
+ [section 6.2](#62-mode-prop-replaces-readonly--lockworkflow). The grouped
545
+ `eventHandlers` mount option is **unchanged** (an options bag is fine in a JS
546
+ mount API); only the `<App>` _component_ prop is flattened.
547
+
548
+ ### 6.2 `mode` prop replaces `readOnly` + `lockWorkflow`
549
+
550
+ `<App>`, `<WorkflowEditor>`, and the `mountFlowDropApp` options bag no longer
551
+ take the `readOnly` and `lockWorkflow` booleans. They are replaced by a single
552
+ `mode` prop/option:
553
+
554
+ ```ts
555
+ mode?: 'edit' | 'readonly' | 'locked'; // default: 'edit'
556
+ ```
557
+
558
+ **Behavior matrix** (what each mode gates):
559
+
560
+ | mode | node drag / connect / select | proximity-connect | node swap | bottom console panel + toggle |
561
+ | ------------ | ---------------------------- | ----------------- | --------- | ----------------------------- |
562
+ | `'edit'` | enabled | enabled | enabled | available |
563
+ | `'readonly'` | disabled | disabled | disabled | hidden |
564
+ | `'locked'` | disabled | disabled | disabled | hidden |
565
+
566
+ In 1.x, `readOnly` and `lockWorkflow` gated the **exact same** interactions and
567
+ were always combined as `!readOnly && !lockWorkflow`. Any combination of the two
568
+ booleans therefore collapsed to either "edit" (both `false`) or "fully disabled"
569
+ (either `true`) — there was no orthogonal behavior to lose. `'readonly'` and
570
+ `'locked'` behave identically today; the two names are preserved as distinct
571
+ intents so a future release can differentiate them without another breaking
572
+ change.
573
+
574
+ **Old → new mapping** (component prop and mount option are identical):
575
+
576
+ | 1.x | 2.0 |
577
+ | ---------------------------------------------------------- | ------------------------------------------------------ |
578
+ | `readOnly` unset / `false`, `lockWorkflow` unset / `false` | `mode="edit"` (or omit) |
579
+ | `readOnly={true}` | `mode="readonly"` |
580
+ | `lockWorkflow={true}` | `mode="locked"` |
581
+ | both `true` | `mode="readonly"` _or_ `mode="locked"` (same behavior) |
582
+
583
+ ```svelte
584
+ <!-- 1.x -->
585
+ <App readOnly={true} />
586
+ <App lockWorkflow={true} />
587
+
588
+ <!-- 2.0 -->
589
+ <App mode="readonly" />
590
+ <App mode="locked" />
591
+ ```
592
+
593
+ ```js
594
+ // 1.x
595
+ mountFlowDropApp(el, { readOnly: true });
596
+ // 2.0
597
+ mountFlowDropApp(el, { mode: 'readonly' });
598
+ ```
599
+
600
+ ### 6.3 `<App>` event handlers are flat props
601
+
602
+ The `<App>` component no longer takes a grouped `eventHandlers={{ … }}` object.
603
+ The handlers `<App>` consumes are now individual `on*` props, consistent with
604
+ every other component:
605
+
606
+ ```svelte
607
+ <!-- 1.x -->
608
+ <App eventHandlers={{ onApiError, onAfterSave, onWorkflowLoad, onBeforeSwap }} />
609
+
610
+ <!-- 2.0 -->
611
+ <App {onApiError} {onAfterSave} {onWorkflowLoad} {onBeforeSwap} />
612
+ ```
613
+
614
+ Available `<App>` callback props: `onBeforeSave`, `onAfterSave`, `onSaveError`,
615
+ `onApiError`, `onWorkflowLoad`, `onBeforeSwap`, `onAfterSwap`.
616
+
617
+ The **`mountFlowDropApp` / `mountPlayground` options bag is unchanged** — keep
618
+ passing the grouped `eventHandlers` object there. The mount functions wire
619
+ `onDirtyStateChange` / `onWorkflowChange` into the instance store, call
620
+ `onBeforeUnmount` on teardown, and forward the remaining handlers to `<App>`'s
621
+ flat props for you. The `FlowDropEventHandlers` type is still exported for use
622
+ with the mount option.
623
+
624
+ ## 7. localStorage keys are instance-scoped
625
+
626
+ The page-default instance no longer writes bare keys:
627
+
628
+ | 1.x | 2.0 |
629
+ | ----------------------------- | ------------------------------------- |
630
+ | `flowdrop:draft:<workflowId>` | `flowdrop:draft:default:<workflowId>` |
631
+ | `fd-pipeline-panel-open` | `fd-pipeline-panel-open:default` |
632
+
633
+ Existing user data migrates automatically on first read (copy to the scoped
634
+ key, remove the legacy key). Only hosts reading these keys directly need to
635
+ update. `clearAllDrafts()` still removes everything under `flowdrop:draft:`.
636
+
637
+ ## 8. Behavioral notes
638
+
639
+ - `fd.fields.register()` warns in dev when overwriting an existing field type.
640
+ Overwriting still works; the warning flags accidents.
641
+ - Internal `DEV` gates use `esm-env` instead of `import.meta.env`, so the
642
+ package no longer assumes a Vite host.