@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
@@ -45,6 +45,15 @@ export class PortCompatibilityChecker {
45
45
  this.compatibilityMap = new Map();
46
46
  this.buildCompatibilityMap();
47
47
  }
48
+ /**
49
+ * Replace the port configuration and rebuild the compatibility map in place.
50
+ * Used by mount to apply the backend-fetched port config to an instance's
51
+ * checker without swapping the instance field.
52
+ */
53
+ reinitialize(portConfig) {
54
+ this.portConfig = portConfig;
55
+ this.buildCompatibilityMap();
56
+ }
48
57
  /**
49
58
  * Build the compatibility map from configuration rules
50
59
  */
@@ -106,46 +115,21 @@ export class PortCompatibilityChecker {
106
115
  return this.portConfig.dataTypes.filter((dt) => dt.enabled !== false);
107
116
  }
108
117
  }
109
- // Global instance - will be initialized with configuration
110
- let globalCompatibilityChecker = null;
111
- /**
112
- * Initialize the global port compatibility checker
113
- */
114
- export function initializePortCompatibility(portConfig) {
115
- globalCompatibilityChecker = new PortCompatibilityChecker(portConfig);
116
- }
117
- /**
118
- * Returns true if the port compatibility checker has been initialized.
119
- */
120
- export function isPortCompatibilityInitialized() {
121
- return globalCompatibilityChecker !== null;
122
- }
123
- /**
124
- * Get the global port compatibility checker
125
- */
126
- export function getPortCompatibilityChecker() {
127
- if (!globalCompatibilityChecker) {
128
- throw new Error('Port compatibility checker not initialized. Call initializePortCompatibility() first.');
129
- }
130
- return globalCompatibilityChecker;
131
- }
132
118
  /**
133
119
  * Get all possible connections from a source node to target nodes
134
120
  */
135
- export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
136
- const sourceMetadata = nodeTypes.find((nt) => nt.id === sourceNode.data.metadata.id);
121
+ export function getPossibleConnections(checker, sourceNode, targetNodes, nodeTypes) {
122
+ const sourceMetadata = nodeTypes.find((nt) => nt.node_type_id === sourceNode.data.metadata.node_type_id);
137
123
  if (!sourceMetadata)
138
124
  return [];
139
125
  const possibleConnections = [];
140
126
  // Get all output ports from source node
141
127
  const sourceOutputs = sourceMetadata.outputs;
142
- // Get the compatibility checker instance
143
- const checker = getPortCompatibilityChecker();
144
128
  // Check each target node
145
129
  for (const targetNode of targetNodes) {
146
130
  if (targetNode.id === sourceNode.id)
147
131
  continue; // Skip self-connection
148
- const targetMetadata = nodeTypes.find((nt) => nt.id === targetNode.data.metadata.id);
132
+ const targetMetadata = nodeTypes.find((nt) => nt.node_type_id === targetNode.data.metadata.node_type_id);
149
133
  if (!targetMetadata)
150
134
  continue;
151
135
  // Get all input ports from target node
@@ -171,7 +155,7 @@ export function getPossibleConnections(sourceNode, targetNodes, nodeTypes) {
171
155
  /**
172
156
  * Validate if a specific connection is valid
173
157
  */
174
- export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, targetPortId, nodes, nodeTypes) {
158
+ export function validateConnection(checker, sourceNodeId, sourcePortId, targetNodeId, targetPortId, nodes, nodeTypes) {
175
159
  // Check if nodes exist
176
160
  const sourceNode = nodes.find((n) => n.id === sourceNodeId);
177
161
  const targetNode = nodes.find((n) => n.id === targetNodeId);
@@ -186,8 +170,8 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
186
170
  return { valid: false, error: 'Cannot connect node to itself' };
187
171
  }
188
172
  // Get node metadata
189
- const sourceMetadata = nodeTypes.find((nt) => nt.id === sourceNode.data.metadata.id);
190
- const targetMetadata = nodeTypes.find((nt) => nt.id === targetNode.data.metadata.id);
173
+ const sourceMetadata = nodeTypes.find((nt) => nt.node_type_id === sourceNode.data.metadata.node_type_id);
174
+ const targetMetadata = nodeTypes.find((nt) => nt.node_type_id === targetNode.data.metadata.node_type_id);
191
175
  if (!sourceMetadata || !targetMetadata) {
192
176
  return { valid: false, error: 'Node metadata not found' };
193
177
  }
@@ -200,8 +184,7 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
200
184
  if (!targetPort) {
201
185
  return { valid: false, error: 'Target port not found' };
202
186
  }
203
- // Check data type compatibility using the global checker
204
- const checker = getPortCompatibilityChecker();
187
+ // Check data type compatibility using the instance's checker
205
188
  if (!checker.areDataTypesCompatible(sourcePort.dataType, targetPort.dataType)) {
206
189
  return {
207
190
  valid: false,
@@ -213,20 +196,18 @@ export function validateConnection(sourceNodeId, sourcePortId, targetNodeId, tar
213
196
  /**
214
197
  * Get connection suggestions for a node
215
198
  */
216
- export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
199
+ export function getConnectionSuggestions(checker, nodeId, nodes, nodeTypes) {
217
200
  const node = nodes.find((n) => n.id === nodeId);
218
201
  if (!node)
219
202
  return [];
220
- const metadata = nodeTypes.find((nt) => nt.id === node.data.metadata.id);
203
+ const metadata = nodeTypes.find((nt) => nt.node_type_id === node.data.metadata.node_type_id);
221
204
  if (!metadata)
222
205
  return [];
223
206
  const suggestions = [];
224
207
  // Get all other nodes
225
208
  const otherNodes = nodes.filter((n) => n.id !== nodeId);
226
- // Get the compatibility checker instance
227
- const checker = getPortCompatibilityChecker();
228
209
  for (const otherNode of otherNodes) {
229
- const otherMetadata = nodeTypes.find((nt) => nt.id === otherNode.data.metadata.id);
210
+ const otherMetadata = nodeTypes.find((nt) => nt.node_type_id === otherNode.data.metadata.node_type_id);
230
211
  if (!otherMetadata)
231
212
  continue;
232
213
  // Check outputs from other nodes to inputs of current node
@@ -272,8 +253,17 @@ export function getConnectionSuggestions(nodeId, nodes, nodeTypes) {
272
253
  * @returns True if any cycle exists in the workflow
273
254
  */
274
255
  export function hasCycles(nodes, edges) {
275
- // Build adjacency map once (O(E)) so the DFS inner loop is O(1) per lookup
276
- // instead of scanning all edges on every recursive call (which was O(V*E)).
256
+ return detectCycles(nodes, edges);
257
+ }
258
+ /**
259
+ * Detect whether a directed graph contains a cycle, using DFS over a pre-built
260
+ * adjacency map (O(E) build, O(1) per neighbour lookup — avoids the O(V*E) of
261
+ * re-scanning every edge on each recursive call).
262
+ *
263
+ * Shared by `hasCycles` (all edges) and `hasInvalidCycles` (loopback edges
264
+ * pre-filtered out by the caller).
265
+ */
266
+ function detectCycles(nodes, edges) {
277
267
  const adjacencyMap = new Map();
278
268
  for (const node of nodes) {
279
269
  adjacencyMap.set(node.id, []);
@@ -293,7 +283,6 @@ export function hasCycles(nodes, edges) {
293
283
  return false;
294
284
  visited.add(nodeId);
295
285
  recursionStack.add(nodeId);
296
- // Use pre-built adjacency map instead of filtering all edges each call
297
286
  const neighbors = adjacencyMap.get(nodeId) || [];
298
287
  for (const target of neighbors) {
299
288
  if (hasCycleUtil(target))
@@ -302,7 +291,6 @@ export function hasCycles(nodes, edges) {
302
291
  recursionStack.delete(nodeId);
303
292
  return false;
304
293
  }
305
- // Check each node
306
294
  for (const node of nodes) {
307
295
  if (!visited.has(node.id)) {
308
296
  if (hasCycleUtil(node.id))
@@ -328,53 +316,10 @@ export function hasCycles(nodes, edges) {
328
316
  * ```
329
317
  */
330
318
  export function hasInvalidCycles(nodes, edges) {
331
- // Filter out loopback edges - these create valid cycles for loop iteration
319
+ // Filter out loopback edges - these create valid cycles for loop iteration,
320
+ // then reuse the shared detector over the remaining edges.
332
321
  const nonLoopbackEdges = edges.filter((edge) => !isLoopbackEdge(edge));
333
- // Build adjacency map from non-loopback edges once (O(E)) so the DFS inner
334
- // loop is O(1) per lookup instead of scanning all edges on every recursive
335
- // call (which was O(V*E)).
336
- const adjacencyMap = new Map();
337
- for (const node of nodes) {
338
- adjacencyMap.set(node.id, []);
339
- }
340
- for (const edge of nonLoopbackEdges) {
341
- const neighbors = adjacencyMap.get(edge.source);
342
- if (neighbors) {
343
- neighbors.push(edge.target);
344
- }
345
- }
346
- // Check for cycles using only non-loopback edges
347
- const visited = new Set();
348
- const recursionStack = new Set();
349
- /**
350
- * DFS utility to detect cycles in the graph
351
- * @param nodeId - Current node being visited
352
- * @returns True if a cycle is found from this node
353
- */
354
- function hasCycleUtil(nodeId) {
355
- if (recursionStack.has(nodeId))
356
- return true;
357
- if (visited.has(nodeId))
358
- return false;
359
- visited.add(nodeId);
360
- recursionStack.add(nodeId);
361
- // Use pre-built adjacency map instead of filtering all edges each call
362
- const neighbors = adjacencyMap.get(nodeId) || [];
363
- for (const target of neighbors) {
364
- if (hasCycleUtil(target))
365
- return true;
366
- }
367
- recursionStack.delete(nodeId);
368
- return false;
369
- }
370
- // Check each node for cycles
371
- for (const node of nodes) {
372
- if (!visited.has(node.id)) {
373
- if (hasCycleUtil(node.id))
374
- return true;
375
- }
376
- }
377
- return false;
322
+ return detectCycles(nodes, nonLoopbackEdges);
378
323
  }
379
324
  /**
380
325
  * Get the execution order for a workflow (topological sort)
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Duration formatting helpers.
3
+ *
4
+ * Mirrors the backend `Drupal\flowdrop\Utility\Duration::formatMicroseconds()`
5
+ * tiers so the playground and the Drupal admin pages render identical values.
6
+ */
7
+ /**
8
+ * Formats a duration in human-readable form from microseconds.
9
+ *
10
+ * Examples: `150µs`, `2.5ms`, `25.1ms`, `250ms`, `1.23s`, `45s`,
11
+ * `2m 30s`, `1h 30m`.
12
+ */
13
+ export declare function formatMicroseconds(microseconds: number | null | undefined): string | null;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Duration formatting helpers.
3
+ *
4
+ * Mirrors the backend `Drupal\flowdrop\Utility\Duration::formatMicroseconds()`
5
+ * tiers so the playground and the Drupal admin pages render identical values.
6
+ */
7
+ /**
8
+ * Formats a duration in human-readable form from microseconds.
9
+ *
10
+ * Examples: `150µs`, `2.5ms`, `25.1ms`, `250ms`, `1.23s`, `45s`,
11
+ * `2m 30s`, `1h 30m`.
12
+ */
13
+ export function formatMicroseconds(microseconds) {
14
+ if (microseconds == null || !Number.isFinite(microseconds) || microseconds < 0)
15
+ return null;
16
+ const us = Math.round(microseconds);
17
+ if (us < 1000) {
18
+ return `${us}µs`;
19
+ }
20
+ if (us < 1_000_000) {
21
+ const ms = us / 1000;
22
+ if (us < 100_000) {
23
+ // 2 decimals below 10ms, 1 decimal below 100ms — matches PHP round().
24
+ const decimals = us < 10_000 ? 2 : 1;
25
+ // Drop trailing zeros the way PHP round() renders (2.50 → 2.5, 3.00 → 3).
26
+ return `${parseFloat(ms.toFixed(decimals))}ms`;
27
+ }
28
+ return `${Math.round(ms)}ms`;
29
+ }
30
+ if (us < 10_000_000) {
31
+ return `${parseFloat((us / 1_000_000).toFixed(2))}s`;
32
+ }
33
+ if (us < 60_000_000) {
34
+ return `${Math.floor(us / 1_000_000)}s`;
35
+ }
36
+ const totalSeconds = Math.floor(us / 1_000_000);
37
+ if (us < 3_600_000_000) {
38
+ const minutes = Math.floor(totalSeconds / 60);
39
+ const secs = totalSeconds % 60;
40
+ return secs > 0 ? `${minutes}m ${secs}s` : `${minutes}m`;
41
+ }
42
+ const hours = Math.floor(totalSeconds / 3600);
43
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
44
+ return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
45
+ }
@@ -5,10 +5,14 @@
5
5
  * visual styling to workflow edges based on source port data types.
6
6
  * Used by both the visual editor and the command DSL system.
7
7
  */
8
- import { MarkerType } from '@xyflow/svelte';
9
8
  import { extractPortId } from '../utils/handleIds.js';
10
9
  import { isLoopbackEdge } from '../utils/connections.js';
11
10
  import { EDGE_MARKER_SIZES } from '../config/constants.js';
11
+ // xyflow's `MarkerType.ArrowClosed`, inlined as its literal value. This module
12
+ // is shared with the headless command DSL (reachable from `@flowdrop/flowdrop/core`),
13
+ // so it must NOT carry a runtime import of @xyflow/svelte — a type-only import
14
+ // plus this constant keeps the marker type-safe without the dependency.
15
+ const ARROW_CLOSED_MARKER = 'arrowclosed';
12
16
  /**
13
17
  * Check if a port ID matches a dynamic branch in a Gateway node.
14
18
  * Gateway nodes store branches in config.branches array.
@@ -101,7 +105,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
101
105
  'stroke: var(--fd-edge-loopback); stroke-dasharray: var(--fd-edge-loopback-dasharray); stroke-width: var(--fd-edge-loopback-width); opacity: var(--fd-edge-loopback-opacity);';
102
106
  edge.class = 'flowdrop--edge--loopback';
103
107
  edge.markerEnd = {
104
- type: MarkerType.ArrowClosed,
108
+ type: ARROW_CLOSED_MARKER,
105
109
  ...EDGE_MARKER_SIZES.loopback,
106
110
  color: 'var(--fd-edge-loopback)'
107
111
  };
@@ -110,7 +114,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
110
114
  edge.style = 'stroke: var(--fd-edge-trigger); stroke-width: var(--fd-edge-trigger-width);';
111
115
  edge.class = 'flowdrop--edge--trigger';
112
116
  edge.markerEnd = {
113
- type: MarkerType.ArrowClosed,
117
+ type: ARROW_CLOSED_MARKER,
114
118
  ...EDGE_MARKER_SIZES.trigger,
115
119
  color: 'var(--fd-edge-trigger)'
116
120
  };
@@ -119,7 +123,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
119
123
  edge.style = 'stroke: var(--fd-edge-tool); stroke-dasharray: 5 3;';
120
124
  edge.class = 'flowdrop--edge--tool';
121
125
  edge.markerEnd = {
122
- type: MarkerType.ArrowClosed,
126
+ type: ARROW_CLOSED_MARKER,
123
127
  ...EDGE_MARKER_SIZES.tool,
124
128
  color: 'var(--fd-edge-tool)'
125
129
  };
@@ -129,7 +133,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
129
133
  edge.style = 'stroke: var(--fd-edge-data);';
130
134
  edge.class = 'flowdrop--edge--data';
131
135
  edge.markerEnd = {
132
- type: MarkerType.ArrowClosed,
136
+ type: ARROW_CLOSED_MARKER,
133
137
  ...EDGE_MARKER_SIZES.data,
134
138
  color: 'var(--fd-edge-data)'
135
139
  };
@@ -1,25 +1,46 @@
1
1
  /**
2
- * Fetch authentication utilities
2
+ * Authenticated fetch
3
3
  *
4
- * Shared logic for building HTTP headers with authentication.
5
- * Used by components that make authenticated API requests (e.g., FormAutocomplete).
4
+ * The single fetch path for FlowDrop's per-instance services. It builds request
5
+ * headers (static endpoint headers + the {@link AuthProvider}'s headers + any
6
+ * caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
7
+ * `onUnauthorized()` and — if that reports a successful refresh — retries the
8
+ * request once with freshly fetched headers; on `403` it invokes
9
+ * `onForbidden()`. Callers receive the raw {@link Response} and keep their own
10
+ * status/parse handling.
11
+ *
12
+ * Routing every service through this helper means a configured `AuthProvider`
13
+ * authenticates *and* refreshes consistently — matching the behaviour the typed
14
+ * workflow/node API gets from {@link EnhancedFlowDropApiClient}.
6
15
  *
7
16
  * @module utils/fetchWithAuth
8
17
  */
18
+ import type { EndpointConfig } from '../config/endpoints.js';
9
19
  import type { AuthProvider } from '../types/auth.js';
10
20
  /**
11
- * Build fetch headers with optional authentication
12
- *
13
- * Constructs standard JSON request headers and merges in authentication
14
- * headers from the provided AuthProvider, if available.
21
+ * Options describing how to authenticate and where the base headers come from.
15
22
  *
16
- * @param authProvider - Optional auth provider to get headers from
17
- * @returns Promise resolving to a complete headers object
23
+ * Provide `config` + `endpointKey` to source static endpoint headers (the usual
24
+ * case for endpoint-keyed services), or `baseHeaders` for ad-hoc requests that
25
+ * are not tied to a configured endpoint (e.g. a user-configured autocomplete
26
+ * URL). When neither is given the request carries only JSON defaults plus auth.
27
+ */
28
+ export interface AuthenticatedFetchOptions {
29
+ /** Auth provider supplying `Authorization` etc. and 401/403 lifecycle hooks. */
30
+ authProvider?: AuthProvider;
31
+ /** Endpoint configuration, used with `endpointKey` to look up static headers. */
32
+ config?: EndpointConfig;
33
+ /** Endpoint key identifying which static headers to apply. */
34
+ endpointKey?: string;
35
+ /** Base headers for requests not tied to a configured endpoint. */
36
+ baseHeaders?: Record<string, string>;
37
+ }
38
+ /**
39
+ * Perform an authenticated fetch with consistent 401/403 handling.
18
40
  *
19
- * @example
20
- * ```typescript
21
- * const headers = await buildFetchHeaders(authProvider);
22
- * const response = await fetch(url, { headers });
23
- * ```
41
+ * @param url - The fully-resolved request URL
42
+ * @param init - Standard fetch options (method, body, signal, headers, …)
43
+ * @param opts - Auth provider and header source
44
+ * @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
24
45
  */
25
- export declare function buildFetchHeaders(authProvider?: AuthProvider): Promise<Record<string, string>>;
46
+ export declare function authenticatedFetch(url: string, init?: RequestInit, opts?: AuthenticatedFetchOptions): Promise<Response>;
@@ -1,34 +1,64 @@
1
1
  /**
2
- * Fetch authentication utilities
2
+ * Authenticated fetch
3
3
  *
4
- * Shared logic for building HTTP headers with authentication.
5
- * Used by components that make authenticated API requests (e.g., FormAutocomplete).
4
+ * The single fetch path for FlowDrop's per-instance services. It builds request
5
+ * headers (static endpoint headers + the {@link AuthProvider}'s headers + any
6
+ * caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
7
+ * `onUnauthorized()` and — if that reports a successful refresh — retries the
8
+ * request once with freshly fetched headers; on `403` it invokes
9
+ * `onForbidden()`. Callers receive the raw {@link Response} and keep their own
10
+ * status/parse handling.
11
+ *
12
+ * Routing every service through this helper means a configured `AuthProvider`
13
+ * authenticates *and* refreshes consistently — matching the behaviour the typed
14
+ * workflow/node API gets from {@link EnhancedFlowDropApiClient}.
6
15
  *
7
16
  * @module utils/fetchWithAuth
8
17
  */
18
+ import { getEndpointHeaders } from '../config/endpoints.js';
19
+ const DEFAULT_HEADERS = {
20
+ Accept: 'application/json',
21
+ 'Content-Type': 'application/json'
22
+ };
9
23
  /**
10
- * Build fetch headers with optional authentication
11
- *
12
- * Constructs standard JSON request headers and merges in authentication
13
- * headers from the provided AuthProvider, if available.
14
- *
15
- * @param authProvider - Optional auth provider to get headers from
16
- * @returns Promise resolving to a complete headers object
24
+ * Build the merged header set: base headers < auth headers < per-request headers.
17
25
  *
18
- * @example
19
- * ```typescript
20
- * const headers = await buildFetchHeaders(authProvider);
21
- * const response = await fetch(url, { headers });
22
- * ```
26
+ * Re-invoked for the retry so a refreshed token is picked up.
23
27
  */
24
- export async function buildFetchHeaders(authProvider) {
25
- const headers = {
26
- Accept: 'application/json',
27
- 'Content-Type': 'application/json'
28
- };
29
- if (authProvider) {
30
- const authHeaders = await authProvider.getAuthHeaders();
31
- Object.assign(headers, authHeaders);
28
+ async function buildHeaders(init, opts) {
29
+ const headers = opts.config && opts.endpointKey
30
+ ? getEndpointHeaders(opts.config, opts.endpointKey)
31
+ : { ...DEFAULT_HEADERS, ...opts.baseHeaders };
32
+ if (opts.authProvider) {
33
+ Object.assign(headers, await opts.authProvider.getAuthHeaders());
34
+ }
35
+ if (init.headers) {
36
+ Object.assign(headers, init.headers);
32
37
  }
33
38
  return headers;
34
39
  }
40
+ /**
41
+ * Perform an authenticated fetch with consistent 401/403 handling.
42
+ *
43
+ * @param url - The fully-resolved request URL
44
+ * @param init - Standard fetch options (method, body, signal, headers, …)
45
+ * @param opts - Auth provider and header source
46
+ * @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
47
+ */
48
+ export async function authenticatedFetch(url, init = {}, opts = {}) {
49
+ const headers = await buildHeaders(init, opts);
50
+ let response = await fetch(url, { ...init, headers });
51
+ // 401 → let the provider refresh, then retry once with fresh headers.
52
+ if (response.status === 401 && opts.authProvider?.onUnauthorized) {
53
+ const refreshed = await opts.authProvider.onUnauthorized();
54
+ if (refreshed) {
55
+ const retryHeaders = await buildHeaders(init, opts);
56
+ response = await fetch(url, { ...init, headers: retryHeaders });
57
+ }
58
+ }
59
+ // 403 → notify the provider (e.g. surface a permission error).
60
+ if (response.status === 403 && opts.authProvider?.onForbidden) {
61
+ await opts.authProvider.onForbidden();
62
+ }
63
+ return response;
64
+ }
@@ -3,6 +3,7 @@
3
3
  * Ensures consistent icon usage across all components
4
4
  */
5
5
  import type { NodeCategory } from '../types/index.js';
6
+ import type { CategoriesStore } from '../stores/categoriesStore.svelte.js';
6
7
  /**
7
8
  * Default icons for different contexts
8
9
  */
@@ -72,19 +73,21 @@ export declare const DEFAULT_ICONS: {
72
73
  export declare const CATEGORY_ICONS: Record<string, string>;
73
74
  /**
74
75
  * Get the appropriate icon for a node
76
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
75
77
  * @param nodeIcon - The node's specific icon
76
78
  * @param category - The node's category
77
79
  * @returns The icon to use
78
80
  */
79
- export declare function getNodeIcon(nodeIcon?: string, category?: NodeCategory): string;
81
+ export declare function getNodeIcon(categories: CategoriesStore, nodeIcon?: string, category?: NodeCategory): string;
80
82
  /**
81
83
  * Get the appropriate icon for a category.
82
84
  * Checks the categories store first (which includes API overrides),
83
85
  * then falls back to the static CATEGORY_ICONS map, then to the default.
86
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
84
87
  * @param category - The category
85
88
  * @returns The icon to use
86
89
  */
87
- export declare function getCategoryIcon(category: NodeCategory): string;
90
+ export declare function getCategoryIcon(categories: CategoriesStore, category: NodeCategory): string;
88
91
  /**
89
92
  * Get a default icon by key
90
93
  * @param key - The icon key from DEFAULT_ICONS
@@ -2,7 +2,6 @@
2
2
  * Centralized icon management for FlowDrop
3
3
  * Ensures consistent icon usage across all components
4
4
  */
5
- import { getCategoryIcon as getCategoryIconFromStore } from '../stores/categoriesStore.svelte.js';
6
5
  /**
7
6
  * Default icons for different contexts
8
7
  */
@@ -103,18 +102,19 @@ export const CATEGORY_ICONS = {
103
102
  };
104
103
  /**
105
104
  * Get the appropriate icon for a node
105
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
106
106
  * @param nodeIcon - The node's specific icon
107
107
  * @param category - The node's category
108
108
  * @returns The icon to use
109
109
  */
110
- export function getNodeIcon(nodeIcon, category) {
110
+ export function getNodeIcon(categories, nodeIcon, category) {
111
111
  // If node has a specific icon, use it
112
112
  if (nodeIcon) {
113
113
  return nodeIcon;
114
114
  }
115
115
  // If category is provided, use category icon from store (which includes API overrides)
116
116
  if (category) {
117
- return getCategoryIconFromStore(category);
117
+ return categories.getIcon(category);
118
118
  }
119
119
  // Fallback to default node icon
120
120
  return DEFAULT_ICONS.NODE;
@@ -123,11 +123,12 @@ export function getNodeIcon(nodeIcon, category) {
123
123
  * Get the appropriate icon for a category.
124
124
  * Checks the categories store first (which includes API overrides),
125
125
  * then falls back to the static CATEGORY_ICONS map, then to the default.
126
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
126
127
  * @param category - The category
127
128
  * @returns The icon to use
128
129
  */
129
- export function getCategoryIcon(category) {
130
- return getCategoryIconFromStore(category);
130
+ export function getCategoryIcon(categories, category) {
131
+ return categories.getIcon(category);
131
132
  }
132
133
  /**
133
134
  * Get a default icon by key
@@ -12,7 +12,7 @@ interface NodeWithMetadata {
12
12
  id: string;
13
13
  data?: {
14
14
  metadata?: {
15
- id?: string;
15
+ node_type_id?: string;
16
16
  };
17
17
  };
18
18
  }
@@ -11,7 +11,7 @@
11
11
  export function generateNodeId(nodeTypeId, existingNodes) {
12
12
  // Count how many nodes of this type already exist
13
13
  const existingNodeIds = existingNodes
14
- .filter((node) => node.data?.metadata?.id === nodeTypeId)
14
+ .filter((node) => node.data?.metadata?.node_type_id === nodeTypeId)
15
15
  .map((node) => node.id);
16
16
  // Extract the numbers from existing IDs with the same prefix
17
17
  const existingNumbers = existingNodeIds
@@ -161,6 +161,10 @@ export declare function mapConfig(oldConfig: ConfigValues, newConfigSchema: Conf
161
161
  *
162
162
  * This does NOT mutate anything — it returns a preview that can be displayed
163
163
  * to the user for confirmation before executing the swap.
164
+ *
165
+ * Thin wrapper over {@link computeSwapPreviewWithOptions} — with no strategies
166
+ * or overrides the cascade reduces to the built-in exact matching, so both
167
+ * entry points share one implementation.
164
168
  */
165
169
  export declare function computeSwapPreview(oldNode: WorkflowNode, newMetadata: NodeMetadata, edges: WorkflowEdge[], allNodes: WorkflowNode[], checker?: PortCompatibilityChecker | null): SwapPreview;
166
170
  /**
@@ -183,7 +187,7 @@ export declare function getVersionUpgrade(currentMetadata: NodeMetadata, allNode
183
187
  *
184
188
  * Resolution order:
185
189
  * 1. Check strategies — first canHandle() match wins for mapPorts()/mapConfig()
186
- * 2. Fall through to built-in 3-pass for ports not covered by strategy
190
+ * 2. Fall through to built-in exact matching (ID, then name) for ports not covered by strategy
187
191
  * 3. Apply portOverrides on top (highest priority — user's manual overrides)
188
192
  * 4. Same cascade for config
189
193
  */
@@ -199,7 +203,7 @@ export declare function computeInteractiveState(oldNode: WorkflowNode, newMetada
199
203
  * Convert user-edited InteractiveSwapState back into a SwapPreview
200
204
  * for executeSwap(). Pure function, no side effects.
201
205
  */
202
- export declare function buildSwapPreviewFromState(state: InteractiveSwapState, allEdges: WorkflowEdge[]): SwapPreview;
206
+ export declare function buildSwapPreviewFromState(state: InteractiveSwapState, _allEdges: WorkflowEdge[]): SwapPreview;
203
207
  /**
204
208
  * Headless one-shot swap with full validation.
205
209
  *