@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
@@ -5,7 +5,15 @@
5
5
  * mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
6
6
  *
7
7
  * Subclasses define their own `register()` method with domain-appropriate
8
- * signatures, using `this.items` and `this.notifyListeners()` directly.
8
+ * signatures, using `this.items`, `this.touch()`, and `this.notifyListeners()`.
9
+ *
10
+ * Reactivity: a `.svelte.ts` module so it can hold a `$state` version counter
11
+ * (`#version`). Every mutating path bumps it via `touch()`; every read method
12
+ * components derive from reads it once at the top. This makes the plain `Map`
13
+ * backing store observable to `$derived`/`$effect`, so registrations made
14
+ * AFTER a component mounts (e.g. `fd.nodes.registerCustom(...)`) invalidate the
15
+ * derived and trigger a re-render. Mirrors WorkflowStore's `#editVersion`
16
+ * monotonic-counter precedent (workflowStore.svelte.ts).
9
17
  *
10
18
  * @example
11
19
  * ```typescript
@@ -15,18 +23,31 @@
15
23
  * throw new Error(`Already registered: ${item.id}`);
16
24
  * }
17
25
  * this.items.set(item.id, item);
26
+ * this.touch();
18
27
  * this.notifyListeners();
19
28
  * }
20
29
  * }
21
30
  * ```
22
31
  */
23
32
  export declare class BaseRegistry<K, V> {
33
+ #private;
24
34
  /** Internal storage map */
25
35
  protected items: Map<K, V>;
26
36
  /** Change listeners */
27
37
  private listeners;
28
38
  /** Callbacks invoked when the registry is cleared (for resetting flags) */
29
39
  private clearCallbacks;
40
+ /**
41
+ * Bump the reactive version counter. Subclasses MUST call this after any
42
+ * mutation of `this.items` so derived reads invalidate.
43
+ */
44
+ protected touch(): void;
45
+ /**
46
+ * Read the reactive version counter. Subclasses that read `this.items`
47
+ * directly (instead of via `get`/`getAll`/etc.) MUST call this so the access
48
+ * is tracked as a reactive dependency.
49
+ */
50
+ protected trackVersion(): void;
30
51
  /**
31
52
  * Unregister an item by key.
32
53
  *
@@ -5,7 +5,15 @@
5
5
  * mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
6
6
  *
7
7
  * Subclasses define their own `register()` method with domain-appropriate
8
- * signatures, using `this.items` and `this.notifyListeners()` directly.
8
+ * signatures, using `this.items`, `this.touch()`, and `this.notifyListeners()`.
9
+ *
10
+ * Reactivity: a `.svelte.ts` module so it can hold a `$state` version counter
11
+ * (`#version`). Every mutating path bumps it via `touch()`; every read method
12
+ * components derive from reads it once at the top. This makes the plain `Map`
13
+ * backing store observable to `$derived`/`$effect`, so registrations made
14
+ * AFTER a component mounts (e.g. `fd.nodes.registerCustom(...)`) invalidate the
15
+ * derived and trigger a re-render. Mirrors WorkflowStore's `#editVersion`
16
+ * monotonic-counter precedent (workflowStore.svelte.ts).
9
17
  *
10
18
  * @example
11
19
  * ```typescript
@@ -15,6 +23,7 @@
15
23
  * throw new Error(`Already registered: ${item.id}`);
16
24
  * }
17
25
  * this.items.set(item.id, item);
26
+ * this.touch();
18
27
  * this.notifyListeners();
19
28
  * }
20
29
  * }
@@ -23,10 +32,30 @@
23
32
  export class BaseRegistry {
24
33
  /** Internal storage map */
25
34
  items = new Map();
35
+ /**
36
+ * Reactive version counter. Bumped by `touch()` on every mutation; read by
37
+ * every observable read method so Svelte tracks the plain Map as a dependency.
38
+ */
39
+ #version = $state(0);
26
40
  /** Change listeners */
27
41
  listeners = new Set();
28
42
  /** Callbacks invoked when the registry is cleared (for resetting flags) */
29
43
  clearCallbacks = new Set();
44
+ /**
45
+ * Bump the reactive version counter. Subclasses MUST call this after any
46
+ * mutation of `this.items` so derived reads invalidate.
47
+ */
48
+ touch() {
49
+ this.#version++;
50
+ }
51
+ /**
52
+ * Read the reactive version counter. Subclasses that read `this.items`
53
+ * directly (instead of via `get`/`getAll`/etc.) MUST call this so the access
54
+ * is tracked as a reactive dependency.
55
+ */
56
+ trackVersion() {
57
+ void this.#version; // reactive dependency
58
+ }
30
59
  /**
31
60
  * Unregister an item by key.
32
61
  *
@@ -36,6 +65,7 @@ export class BaseRegistry {
36
65
  unregister(key) {
37
66
  const result = this.items.delete(key);
38
67
  if (result) {
68
+ this.touch();
39
69
  this.notifyListeners();
40
70
  }
41
71
  return result;
@@ -47,6 +77,7 @@ export class BaseRegistry {
47
77
  * @returns The item if found, undefined otherwise
48
78
  */
49
79
  get(key) {
80
+ this.trackVersion(); // reactive dependency
50
81
  return this.items.get(key);
51
82
  }
52
83
  /**
@@ -56,6 +87,7 @@ export class BaseRegistry {
56
87
  * @returns true if the key is registered
57
88
  */
58
89
  has(key) {
90
+ this.trackVersion(); // reactive dependency
59
91
  return this.items.has(key);
60
92
  }
61
93
  /**
@@ -64,6 +96,7 @@ export class BaseRegistry {
64
96
  * @returns Array of registered keys
65
97
  */
66
98
  getKeys() {
99
+ this.trackVersion(); // reactive dependency
67
100
  return Array.from(this.items.keys());
68
101
  }
69
102
  /**
@@ -72,6 +105,7 @@ export class BaseRegistry {
72
105
  * @returns Array of all registered items
73
106
  */
74
107
  getAll() {
108
+ this.trackVersion(); // reactive dependency
75
109
  return Array.from(this.items.values());
76
110
  }
77
111
  /**
@@ -102,6 +136,7 @@ export class BaseRegistry {
102
136
  */
103
137
  clear() {
104
138
  this.items.clear();
139
+ this.touch();
105
140
  for (const cb of this.clearCallbacks) {
106
141
  cb();
107
142
  }
@@ -111,6 +146,7 @@ export class BaseRegistry {
111
146
  * Get the count of registered items.
112
147
  */
113
148
  get size() {
149
+ this.trackVersion(); // reactive dependency
114
150
  return this.items.size;
115
151
  }
116
152
  /**
@@ -1,23 +1,14 @@
1
1
  /**
2
- * Built-in Workflow Format Registration
2
+ * Built-in Workflow Format Adapters
3
3
  *
4
- * Registers the default FlowDrop and Agent Spec format adapters
5
- * with the workflow format registry.
6
- *
7
- * This module is automatically loaded when imported,
8
- * ensuring built-in formats are available without user action.
9
- */
10
- /**
11
- * Register all built-in workflow format adapters.
12
- * Safe to call multiple times — will only register once.
4
+ * Provides the default FlowDrop and Agent Spec format adapters. These are used
5
+ * to seed each instance's `WorkflowFormatRegistry` (see `instanceContainer`).
13
6
  */
14
- export declare function registerBuiltinFormats(): void;
7
+ import type { WorkflowFormatAdapter } from './workflowFormatRegistry.js';
15
8
  /**
16
- * Check if built-in formats have been registered.
17
- */
18
- export declare function areBuiltinFormatsRegistered(): boolean;
19
- /**
20
- * Reset the registration state.
21
- * Primarily useful for testing.
9
+ * Build the built-in workflow format adapters (FlowDrop native + Agent Spec).
10
+ *
11
+ * Returns a fresh array on each call so every instance owns independent
12
+ * adapter objects (the Agent Spec adapter holds per-conversion state).
22
13
  */
23
- export declare function resetBuiltinFormatRegistration(): void;
14
+ export declare function getBuiltinFormatAdapters(): WorkflowFormatAdapter[];
@@ -1,27 +1,18 @@
1
1
  /**
2
- * Built-in Workflow Format Registration
2
+ * Built-in Workflow Format Adapters
3
3
  *
4
- * Registers the default FlowDrop and Agent Spec format adapters
5
- * with the workflow format registry.
6
- *
7
- * This module is automatically loaded when imported,
8
- * ensuring built-in formats are available without user action.
4
+ * Provides the default FlowDrop and Agent Spec format adapters. These are used
5
+ * to seed each instance's `WorkflowFormatRegistry` (see `instanceContainer`).
9
6
  */
10
- import { workflowFormatRegistry } from './workflowFormatRegistry.js';
11
7
  import { AgentSpecAdapter } from '../adapters/agentspec/AgentSpecAdapter.js';
12
8
  import { validateForAgentSpecExport } from '../adapters/agentspec/validator.js';
13
9
  /**
14
- * Track whether built-in formats have been registered.
15
- * Prevents duplicate registration on hot reload.
16
- */
17
- let registered = false;
18
- /**
19
- * Register all built-in workflow format adapters.
20
- * Safe to call multiple times — will only register once.
10
+ * Build the built-in workflow format adapters (FlowDrop native + Agent Spec).
11
+ *
12
+ * Returns a fresh array on each call so every instance owns independent
13
+ * adapter objects (the Agent Spec adapter holds per-conversion state).
21
14
  */
22
- export function registerBuiltinFormats() {
23
- if (registered)
24
- return;
15
+ export function getBuiltinFormatAdapters() {
25
16
  // FlowDrop native — passthrough (StandardWorkflow ↔ JSON)
26
17
  const flowdropAdapter = {
27
18
  id: 'flowdrop',
@@ -32,7 +23,6 @@ export function registerBuiltinFormats() {
32
23
  export: (workflow) => JSON.stringify(workflow, null, 2),
33
24
  import: (data) => JSON.parse(data)
34
25
  };
35
- workflowFormatRegistry.register(flowdropAdapter);
36
26
  // Agent Spec — wraps existing AgentSpecAdapter
37
27
  // No bundled nodes — Agent Spec node types are user-provided via
38
28
  // getDefaultAgentSpecNodeTypes() or custom definitions passed to mountFlowDropApp()
@@ -46,25 +36,5 @@ export function registerBuiltinFormats() {
46
36
  import: (data) => agentSpecAdapter.importJSON(data),
47
37
  validate: (workflow) => validateForAgentSpecExport(workflow)
48
38
  };
49
- workflowFormatRegistry.register(agentSpecFormatAdapter);
50
- registered = true;
51
- }
52
- /**
53
- * Check if built-in formats have been registered.
54
- */
55
- export function areBuiltinFormatsRegistered() {
56
- return registered;
57
- }
58
- /**
59
- * Reset the registration state.
60
- * Primarily useful for testing.
61
- */
62
- export function resetBuiltinFormatRegistration() {
63
- registered = false;
39
+ return [flowdropAdapter, agentSpecFormatAdapter];
64
40
  }
65
- // Sync registration flag with registry.clear() for test isolation
66
- workflowFormatRegistry.onClear(() => {
67
- registered = false;
68
- });
69
- // Auto-register built-in formats when this module is imported
70
- registerBuiltinFormats();
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Built-in Node Type Metadata (pure — no component imports)
3
+ *
4
+ * The type identifiers, aliases, and resolution helpers for FlowDrop's built-in
5
+ * node types, with ZERO dependency on the Svelte node components. Utilities that
6
+ * only need to reason about type strings (e.g. `utils/nodeTypes.ts`, reachable
7
+ * from `@flowdrop/flowdrop/core`) import from here, so the lightweight `core`
8
+ * entry never statically pulls in node components, marked, or DOMPurify.
9
+ *
10
+ * The component registrations themselves live in `./builtinNodes.ts`, which
11
+ * re-exports everything here for backward compatibility.
12
+ *
13
+ * @module registry/builtinNodeTypes
14
+ */
15
+ /**
16
+ * Source identifier for built-in FlowDrop components.
17
+ */
18
+ export declare const FLOWDROP_SOURCE = "flowdrop";
19
+ /**
20
+ * Type for built-in node types.
21
+ * Use this when you specifically need a built-in type.
22
+ */
23
+ export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'atom' | 'tool' | 'gateway' | 'note' | 'terminal' | 'idea';
24
+ /**
25
+ * Array of built-in type strings for runtime validation.
26
+ */
27
+ export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];
28
+ /**
29
+ * Alias mapping for type resolution.
30
+ * Maps alternative type names to their canonical registration.
31
+ */
32
+ export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
33
+ /**
34
+ * Get the canonical type for a given type string.
35
+ * Handles aliases like "default" -> "workflowNode".
36
+ *
37
+ * @param type - The type string to resolve
38
+ * @returns The canonical type string
39
+ */
40
+ export declare function resolveBuiltinAlias(type: string): string;
41
+ /**
42
+ * Check if a type is a built-in FlowDrop type.
43
+ *
44
+ * @param type - The type to check
45
+ * @returns true if this is a built-in type
46
+ */
47
+ export declare function isBuiltinType(type: string): boolean;
48
+ /**
49
+ * Get all built-in type identifiers.
50
+ *
51
+ * @returns Array of built-in type strings
52
+ */
53
+ export declare function getBuiltinTypes(): string[];
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Built-in Node Type Metadata (pure — no component imports)
3
+ *
4
+ * The type identifiers, aliases, and resolution helpers for FlowDrop's built-in
5
+ * node types, with ZERO dependency on the Svelte node components. Utilities that
6
+ * only need to reason about type strings (e.g. `utils/nodeTypes.ts`, reachable
7
+ * from `@flowdrop/flowdrop/core`) import from here, so the lightweight `core`
8
+ * entry never statically pulls in node components, marked, or DOMPurify.
9
+ *
10
+ * The component registrations themselves live in `./builtinNodes.ts`, which
11
+ * re-exports everything here for backward compatibility.
12
+ *
13
+ * @module registry/builtinNodeTypes
14
+ */
15
+ /**
16
+ * Source identifier for built-in FlowDrop components.
17
+ */
18
+ export const FLOWDROP_SOURCE = 'flowdrop';
19
+ /**
20
+ * Array of built-in type strings for runtime validation.
21
+ */
22
+ export const BUILTIN_NODE_TYPES = [
23
+ 'workflowNode',
24
+ 'simple',
25
+ 'square',
26
+ 'atom',
27
+ 'tool',
28
+ 'gateway',
29
+ 'note',
30
+ 'terminal',
31
+ 'idea'
32
+ ];
33
+ /**
34
+ * Alias mapping for type resolution.
35
+ * Maps alternative type names to their canonical registration.
36
+ */
37
+ export const BUILTIN_TYPE_ALIASES = {
38
+ default: 'workflowNode'
39
+ };
40
+ /**
41
+ * Get the canonical type for a given type string.
42
+ * Handles aliases like "default" -> "workflowNode".
43
+ *
44
+ * @param type - The type string to resolve
45
+ * @returns The canonical type string
46
+ */
47
+ export function resolveBuiltinAlias(type) {
48
+ return BUILTIN_TYPE_ALIASES[type] ?? type;
49
+ }
50
+ /**
51
+ * Check if a type is a built-in FlowDrop type.
52
+ *
53
+ * @param type - The type to check
54
+ * @returns true if this is a built-in type
55
+ */
56
+ export function isBuiltinType(type) {
57
+ const canonicalType = resolveBuiltinAlias(type);
58
+ return BUILTIN_NODE_TYPES.includes(canonicalType);
59
+ }
60
+ /**
61
+ * Get all built-in type identifiers.
62
+ *
63
+ * @returns Array of built-in type strings
64
+ */
65
+ export function getBuiltinTypes() {
66
+ return [...BUILTIN_NODE_TYPES];
67
+ }
@@ -6,72 +6,10 @@
6
6
  * ensuring all built-in node types are available without user action.
7
7
  */
8
8
  import { type NodeComponentRegistration } from './nodeComponentRegistry.js';
9
- /**
10
- * Source identifier for built-in FlowDrop components
11
- */
12
- export declare const FLOWDROP_SOURCE = "flowdrop";
9
+ export { FLOWDROP_SOURCE, BUILTIN_TYPE_ALIASES, BUILTIN_NODE_TYPES, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodeTypes.js';
10
+ export type { BuiltinNodeType } from './builtinNodeTypes.js';
13
11
  /**
14
12
  * Built-in FlowDrop node component registrations.
15
13
  * These are the default node types that ship with FlowDrop.
16
14
  */
17
15
  export declare const BUILTIN_NODE_COMPONENTS: NodeComponentRegistration[];
18
- /**
19
- * Alias mapping for type resolution.
20
- * Maps alternative type names to their canonical registration.
21
- */
22
- export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
23
- /**
24
- * Initialize the registry with built-in components.
25
- * This is called automatically when the library loads.
26
- *
27
- * Safe to call multiple times - will only register once.
28
- *
29
- * @example
30
- * ```typescript
31
- * // Usually not needed - called automatically
32
- * // But can be called manually if needed
33
- * registerBuiltinNodes();
34
- * ```
35
- */
36
- export declare function registerBuiltinNodes(): void;
37
- /**
38
- * Check if built-in nodes have been registered.
39
- *
40
- * @returns true if registerBuiltinNodes() has been called
41
- */
42
- export declare function areBuiltinsRegistered(): boolean;
43
- /**
44
- * Reset the registration state.
45
- * Primarily useful for testing.
46
- */
47
- export declare function resetBuiltinRegistration(): void;
48
- /**
49
- * Get the canonical type for a given type string.
50
- * Handles aliases like "default" -> "workflowNode".
51
- *
52
- * @param type - The type string to resolve
53
- * @returns The canonical type string
54
- */
55
- export declare function resolveBuiltinAlias(type: string): string;
56
- /**
57
- * Check if a type is a built-in FlowDrop type.
58
- *
59
- * @param type - The type to check
60
- * @returns true if this is a built-in type
61
- */
62
- export declare function isBuiltinType(type: string): boolean;
63
- /**
64
- * Get all built-in type identifiers.
65
- *
66
- * @returns Array of built-in type strings
67
- */
68
- export declare function getBuiltinTypes(): string[];
69
- /**
70
- * Type for built-in node types.
71
- * Use this when you specifically need a built-in type.
72
- */
73
- export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'atom' | 'tool' | 'gateway' | 'note' | 'terminal' | 'idea';
74
- /**
75
- * Array of built-in type strings for runtime validation.
76
- */
77
- export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];
@@ -5,7 +5,8 @@
5
5
  * This module is automatically loaded when the library initializes,
6
6
  * ensuring all built-in node types are available without user action.
7
7
  */
8
- import { nodeComponentRegistry } from './nodeComponentRegistry.js';
8
+ import {} from './nodeComponentRegistry.js';
9
+ import { FLOWDROP_SOURCE } from './builtinNodeTypes.js';
9
10
  import WorkflowNode from '../components/nodes/WorkflowNode.svelte';
10
11
  import SimpleNode from '../components/nodes/SimpleNode.svelte';
11
12
  import SquareNode from '../components/nodes/SquareNode.svelte';
@@ -15,10 +16,11 @@ import GatewayNode from '../components/nodes/GatewayNode.svelte';
15
16
  import NotesNode from '../components/nodes/NotesNode.svelte';
16
17
  import TerminalNode from '../components/nodes/TerminalNode.svelte';
17
18
  import IdeaNode from '../components/nodes/IdeaNode.svelte';
18
- /**
19
- * Source identifier for built-in FlowDrop components
20
- */
21
- export const FLOWDROP_SOURCE = 'flowdrop';
19
+ // Pure type metadata + resolution helpers are re-exported for backward
20
+ // compatibility — they now live in a component-free module so that
21
+ // type-only consumers (e.g. utils/nodeTypes.ts, reachable from `core`) do
22
+ // not statically pull in the node components below.
23
+ export { FLOWDROP_SOURCE, BUILTIN_TYPE_ALIASES, BUILTIN_NODE_TYPES, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodeTypes.js';
22
24
  /**
23
25
  * Built-in FlowDrop node component registrations.
24
26
  * These are the default node types that ship with FlowDrop.
@@ -124,101 +126,3 @@ export const BUILTIN_NODE_COMPONENTS = [
124
126
  statusSize: 'sm'
125
127
  }
126
128
  ];
127
- /**
128
- * Alias mapping for type resolution.
129
- * Maps alternative type names to their canonical registration.
130
- */
131
- export const BUILTIN_TYPE_ALIASES = {
132
- default: 'workflowNode'
133
- };
134
- /**
135
- * Track whether built-in nodes have been registered.
136
- * Prevents duplicate registration on hot reload.
137
- */
138
- let builtinsRegistered = false;
139
- /**
140
- * Initialize the registry with built-in components.
141
- * This is called automatically when the library loads.
142
- *
143
- * Safe to call multiple times - will only register once.
144
- *
145
- * @example
146
- * ```typescript
147
- * // Usually not needed - called automatically
148
- * // But can be called manually if needed
149
- * registerBuiltinNodes();
150
- * ```
151
- */
152
- export function registerBuiltinNodes() {
153
- if (builtinsRegistered) {
154
- return;
155
- }
156
- // Register all built-in components
157
- nodeComponentRegistry.registerAll(BUILTIN_NODE_COMPONENTS, true);
158
- // Set the default type
159
- nodeComponentRegistry.setDefaultType('workflowNode');
160
- builtinsRegistered = true;
161
- }
162
- /**
163
- * Check if built-in nodes have been registered.
164
- *
165
- * @returns true if registerBuiltinNodes() has been called
166
- */
167
- export function areBuiltinsRegistered() {
168
- return builtinsRegistered;
169
- }
170
- /**
171
- * Reset the registration state.
172
- * Primarily useful for testing.
173
- */
174
- export function resetBuiltinRegistration() {
175
- builtinsRegistered = false;
176
- }
177
- /**
178
- * Get the canonical type for a given type string.
179
- * Handles aliases like "default" -> "workflowNode".
180
- *
181
- * @param type - The type string to resolve
182
- * @returns The canonical type string
183
- */
184
- export function resolveBuiltinAlias(type) {
185
- return BUILTIN_TYPE_ALIASES[type] ?? type;
186
- }
187
- /**
188
- * Check if a type is a built-in FlowDrop type.
189
- *
190
- * @param type - The type to check
191
- * @returns true if this is a built-in type
192
- */
193
- export function isBuiltinType(type) {
194
- const canonicalType = resolveBuiltinAlias(type);
195
- return BUILTIN_NODE_COMPONENTS.some((reg) => reg.type === canonicalType);
196
- }
197
- /**
198
- * Get all built-in type identifiers.
199
- *
200
- * @returns Array of built-in type strings
201
- */
202
- export function getBuiltinTypes() {
203
- return BUILTIN_NODE_COMPONENTS.map((reg) => reg.type);
204
- }
205
- /**
206
- * Array of built-in type strings for runtime validation.
207
- */
208
- export const BUILTIN_NODE_TYPES = [
209
- 'workflowNode',
210
- 'simple',
211
- 'square',
212
- 'atom',
213
- 'tool',
214
- 'gateway',
215
- 'note',
216
- 'terminal',
217
- 'idea'
218
- ];
219
- // Sync registration flag with registry.clear() for test isolation
220
- nodeComponentRegistry.onClear(() => {
221
- builtinsRegistered = false;
222
- });
223
- // Auto-register built-ins when this module is imported
224
- registerBuiltinNodes();
@@ -2,7 +2,6 @@
2
2
  * Node Component Registry Module
3
3
  * Exports all registry-related functionality.
4
4
  */
5
- export { BaseRegistry } from './BaseRegistry.js';
6
- export { nodeComponentRegistry, createNamespacedType, parseNamespacedType, type NodeComponentProps, type NodeTypeInfo, type NodeComponentRegistration, type NodeComponentCategory, type StatusPosition, type StatusSize, type NodeRegistrationFilter } from './nodeComponentRegistry.js';
7
- export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, resetBuiltinRegistration, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes, type BuiltinNodeType } from './builtinNodes.js';
8
- export { registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount, type FlowDropPluginConfig, type PluginNodeDefinition, type PluginRegistrationResult } from './plugin.js';
5
+ export { BaseRegistry } from './BaseRegistry.svelte.js';
6
+ export { NodeComponentRegistry, createNamespacedType, parseNamespacedType, createPlugin, isValidNamespace, type NodeComponentProps, type NodeTypeInfo, type NodeComponentRegistration, type NodeComponentCategory, type StatusPosition, type StatusSize, type NodeRegistrationFilter, type FlowDropPluginConfig, type PluginNodeDefinition, type PluginRegistrationResult } from './nodeComponentRegistry.js';
7
+ export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes, type BuiltinNodeType } from './builtinNodes.js';
@@ -3,10 +3,8 @@
3
3
  * Exports all registry-related functionality.
4
4
  */
5
5
  // Base registry
6
- export { BaseRegistry } from './BaseRegistry.js';
7
- // Core registry
8
- export { nodeComponentRegistry, createNamespacedType, parseNamespacedType } from './nodeComponentRegistry.js';
6
+ export { BaseRegistry } from './BaseRegistry.svelte.js';
7
+ // Core registry (the class — instances live on `fd.nodes`)
8
+ export { NodeComponentRegistry, createNamespacedType, parseNamespacedType, createPlugin, isValidNamespace } from './nodeComponentRegistry.js';
9
9
  // Built-in nodes
10
- export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, registerBuiltinNodes, areBuiltinsRegistered, resetBuiltinRegistration, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodes.js';
11
- // Plugin system
12
- export { registerFlowDropPlugin, unregisterFlowDropPlugin, registerCustomNode, createPlugin, isValidNamespace, getRegisteredPlugins, getPluginNodeCount } from './plugin.js';
10
+ export { BUILTIN_NODE_COMPONENTS, BUILTIN_NODE_TYPES, FLOWDROP_SOURCE, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodes.js';