@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
@@ -2,7 +2,9 @@
2
2
  * Authentication Provider Types for FlowDrop
3
3
  *
4
4
  * Provides interfaces and implementations for authentication in FlowDrop.
5
- * AuthProvider is passed at mount time and cannot be changed without remounting.
5
+ * An AuthProvider is supplied at mount time (or via `fd.api.configure`) and can
6
+ * be swapped at runtime with `fd.api.setAuthProvider(...)` — e.g. on login or
7
+ * logout — without remounting.
6
8
  *
7
9
  * @module types/auth
8
10
  */
@@ -55,7 +57,7 @@ export class StaticAuthProvider {
55
57
  break;
56
58
  case 'api_key':
57
59
  if (config.apiKey) {
58
- this.headers['X-API-Key'] = config.apiKey;
60
+ this.headers[config.apiKeyHeader ?? 'X-API-Key'] = config.apiKey;
59
61
  }
60
62
  break;
61
63
  case 'custom':
@@ -79,35 +81,6 @@ export class StaticAuthProvider {
79
81
  async getAuthHeaders() {
80
82
  return this.headers;
81
83
  }
82
- /**
83
- * Check if authenticated
84
- *
85
- * Returns true if any auth headers are configured.
86
- *
87
- * @returns true if headers are configured
88
- */
89
- isAuthenticated() {
90
- return Object.keys(this.headers).length > 0;
91
- }
92
- /**
93
- * Handle unauthorized response
94
- *
95
- * Static provider cannot refresh tokens, so always returns false.
96
- *
97
- * @returns Promise resolving to false (cannot refresh)
98
- */
99
- async onUnauthorized() {
100
- // Static provider cannot refresh tokens
101
- return false;
102
- }
103
- /**
104
- * Handle forbidden response
105
- *
106
- * Static provider has no special handling for 403.
107
- */
108
- async onForbidden() {
109
- // No special handling for static provider
110
- }
111
84
  }
112
85
  /**
113
86
  * Callback-based authentication provider
@@ -162,19 +135,6 @@ export class CallbackAuthProvider {
162
135
  }
163
136
  return {};
164
137
  }
165
- /**
166
- * Check if authenticated
167
- *
168
- * For callback-based auth, we assume authenticated if getToken exists.
169
- * The actual token validity is checked when making requests.
170
- *
171
- * @returns true (assumes authenticated, actual check happens on request)
172
- */
173
- isAuthenticated() {
174
- // For callback-based auth, we assume authenticated if getToken exists
175
- // The actual token validity is checked when making requests
176
- return true;
177
- }
178
138
  /**
179
139
  * Handle unauthorized response
180
140
  *
@@ -216,14 +176,4 @@ export class NoAuthProvider {
216
176
  async getAuthHeaders() {
217
177
  return {};
218
178
  }
219
- /**
220
- * Check if authenticated
221
- *
222
- * Always returns false (no auth configured).
223
- *
224
- * @returns false
225
- */
226
- isAuthenticated() {
227
- return false;
228
- }
229
179
  }
@@ -166,10 +166,13 @@ export interface FlowDropEventHandlers {
166
166
  */
167
167
  export interface FlowDropFeatures {
168
168
  /**
169
- * Save drafts to localStorage automatically
169
+ * Save drafts to browser storage automatically
170
170
  *
171
171
  * When enabled, FlowDrop will periodically save the current workflow
172
- * to localStorage as a draft. This helps prevent data loss.
172
+ * to draft storage (localStorage by default, configurable via the
173
+ * `draftStorage` mount option). This helps prevent data loss. End users
174
+ * can additionally opt out at runtime via the "Store Drafts in Browser"
175
+ * behavior setting.
173
176
  *
174
177
  * @default true
175
178
  */
@@ -177,7 +180,7 @@ export interface FlowDropFeatures {
177
180
  /**
178
181
  * Auto-save interval in milliseconds
179
182
  *
180
- * How often to save drafts to localStorage when autoSaveDraft is enabled.
183
+ * How often to save drafts to storage when autoSaveDraft is enabled.
181
184
  *
182
185
  * @default 30000 (30 seconds)
183
186
  */
@@ -200,6 +203,24 @@ export interface FlowDropFeatures {
200
203
  * @default true
201
204
  */
202
205
  enableNodeSwap?: boolean;
206
+ /**
207
+ * Register the built-in heavy form editors (markdown / code / template).
208
+ *
209
+ * The full editor is batteries-included: node config fields with
210
+ * `format: 'markdown'` / `'code'` / `'template'` render real CodeMirror
211
+ * editors out of the box. Their chunks are code-split and load lazily, so
212
+ * an editor that never opens such a field never downloads CodeMirror/marked.
213
+ *
214
+ * Set to `false` only if you want to strip those editors (e.g. to shave the
215
+ * lazy chunks) and either live with the textarea fallback or register your
216
+ * own field components via `instance.fields.register(...)`.
217
+ *
218
+ * This does not affect the standalone `@flowdrop/flowdrop/form` primitive,
219
+ * which stays opt-in regardless.
220
+ *
221
+ * @default true
222
+ */
223
+ builtinEditors?: boolean;
203
224
  }
204
225
  /**
205
226
  * Default feature values
@@ -15,7 +15,8 @@ export const DEFAULT_FEATURES = {
15
15
  autoSaveDraft: true,
16
16
  autoSaveDraftInterval: 30000,
17
17
  showToasts: true,
18
- enableNodeSwap: true
18
+ enableNodeSwap: true,
19
+ builtinEditors: true
19
20
  };
20
21
  /**
21
22
  * Merge user-provided features with defaults
@@ -2,9 +2,9 @@
2
2
  * Core types for the Workflow Library
3
3
  */
4
4
  import type { Component } from 'svelte';
5
- import type { Node, Edge, XYPosition } from '@xyflow/svelte';
6
- import { ConnectionLineType } from '@xyflow/svelte';
5
+ import type { Node, Edge, XYPosition, ConnectionLineType } from '@xyflow/svelte';
7
6
  import type { EndpointConfig } from '../config/endpoints.js';
7
+ import type { AuthProvider } from './auth.js';
8
8
  /**
9
9
  * Built-in node categories that ship with FlowDrop.
10
10
  * These categories have predefined icons, colors, and display names.
@@ -117,12 +117,57 @@ export interface NodePort {
117
117
  required?: boolean;
118
118
  description?: string;
119
119
  defaultValue?: unknown;
120
+ /**
121
+ * Whether this port is exposed when the instance sets no explicit exposure
122
+ * for it. Defaults to `true` (a missing flag reads as exposed). Reserved ports
123
+ * that ship hidden until an author opts in (e.g. the `error` output) carry
124
+ * `false`. The instance's `ports` config can override it per port. See
125
+ * `.claude/plans/exposed-ports.md`.
126
+ */
127
+ exposedByDefault?: boolean;
128
+ /**
129
+ * Default sort weight for the port's render position, ascending; ties break
130
+ * on declaration order. Author-declared ports default to `0`. Reserved ports
131
+ * (the `error` output and `trigger`/`tool` control ports) need no value — the
132
+ * library sinks them to the bottom automatically (see
133
+ * `RESERVED_PORT_DISPLAY_ORDER`); set this only to override that. Cosmetic
134
+ * only. The instance's `ports` config order overrides it.
135
+ */
136
+ displayOrder?: number;
120
137
  /**
121
138
  * Optional JSON Schema describing the structure of data on this port.
122
139
  * Used for template variable autocomplete to drill into nested properties.
123
140
  */
124
141
  schema?: OutputSchema | InputSchema;
125
142
  }
143
+ /**
144
+ * One entry in a {@link PortsConfig} direction list: a port id, with display
145
+ * order encoded by its position and an optional exposure override.
146
+ */
147
+ export interface PortConfigEntry {
148
+ id: string;
149
+ /**
150
+ * Explicit exposure for this port. Stored only when it diverges from the
151
+ * port's metadata `exposedByDefault`. In v2 exposure is semantic: a
152
+ * not-exposed port is hidden on the canvas, not wireable, and not
153
+ * runtime-overridable.
154
+ */
155
+ exposed?: boolean;
156
+ }
157
+ /**
158
+ * Per-instance port order + exposure, stored in `data.config.ports`.
159
+ *
160
+ * A per-direction ordered list of the node's ports: array index encodes display
161
+ * order relative to the metadata default, and the optional `exposed` flag
162
+ * overrides the port's `exposedByDefault`. A port the author never touched is
163
+ * absent from the list; an untouched node stores no `ports` key at all. Order
164
+ * is cosmetic (the engine ignores it); exposure is semantic. See
165
+ * `.claude/plans/exposed-ports.md`.
166
+ */
167
+ export interface PortsConfig {
168
+ inputs?: PortConfigEntry[];
169
+ outputs?: PortConfigEntry[];
170
+ }
126
171
  /**
127
172
  * Absolute position of a port handle in canvas space.
128
173
  * Used by proximity connect and other features that need port positions.
@@ -208,7 +253,7 @@ export type BuiltinNodeType = 'note' | 'simple' | 'square' | 'atom' | 'tool' | '
208
253
  * Includes built-in types and allows custom registered types.
209
254
  *
210
255
  * Built-in types: note, simple, square, tool, gateway, terminal, default
211
- * Custom types: Any string registered via nodeComponentRegistry
256
+ * Custom types: Any string registered via fd.nodes
212
257
  *
213
258
  * @example
214
259
  * ```typescript
@@ -327,7 +372,7 @@ export interface AutocompleteConfig {
327
372
  * method: "GET",
328
373
  * headers: { "X-Custom-Header": "value" },
329
374
  * parameterMapping: {
330
- * nodeTypeId: "metadata.id",
375
+ * nodeTypeId: "metadata.node_type_id",
331
376
  * instanceId: "id"
332
377
  * }
333
378
  * };
@@ -352,7 +397,7 @@ export interface DynamicSchemaEndpoint {
352
397
  /**
353
398
  * Maps template variables to their source paths.
354
399
  * Keys are variable names used in the URL, values are dot-notation paths
355
- * to resolve from the node context (e.g., "metadata.id", "config.apiKey", "id")
400
+ * to resolve from the node context (e.g., "metadata.node_type_id", "config.apiKey", "id")
356
401
  */
357
402
  parameterMapping?: Record<string, string>;
358
403
  /**
@@ -370,6 +415,35 @@ export interface DynamicSchemaEndpoint {
370
415
  * @default true
371
416
  */
372
417
  cacheSchema?: boolean;
418
+ /**
419
+ * How the fetched schema combines with the node's static schema
420
+ * (the direct `schema` prop or `metadata.configSchema`).
421
+ *
422
+ * - `"replace"` (default): the fetched schema is used as-is and the static
423
+ * schema is ignored. This is the historical behaviour.
424
+ * - `"merge"`: the fetched schema is layered onto the static schema —
425
+ * properties are merged (fetched wins per key) and `required` is unioned —
426
+ * so the endpoint only has to return the fields it actually drives.
427
+ *
428
+ * When there is no static schema to combine with, both strategies behave
429
+ * identically: the fetched schema is the form.
430
+ *
431
+ * @default "replace"
432
+ */
433
+ mergeStrategy?: 'replace' | 'merge';
434
+ /**
435
+ * Restricts the fetched schema to a region of the static schema instead of
436
+ * the whole form. A dot-path of property keys descending through nested
437
+ * object `properties` (e.g. `"advanced"` or `"advanced.retry"`); the fetched
438
+ * schema is spliced in at that location and every other field stays static.
439
+ *
440
+ * Use this to make just one section (or one field) server-driven while
441
+ * authoring the rest of the form locally. `mergeStrategy` then decides whether
442
+ * the fetched schema replaces or merges into the property at that path.
443
+ *
444
+ * When omitted, the fetch applies at the form root (per `mergeStrategy`).
445
+ */
446
+ target?: string;
373
447
  }
374
448
  /**
375
449
  * External edit link configuration
@@ -381,7 +455,7 @@ export interface DynamicSchemaEndpoint {
381
455
  * url: "https://admin.example.com/nodes/{nodeTypeId}/edit/{instanceId}",
382
456
  * label: "Configure in Admin Panel",
383
457
  * parameterMapping: {
384
- * nodeTypeId: "metadata.id",
458
+ * nodeTypeId: "metadata.node_type_id",
385
459
  * instanceId: "id"
386
460
  * },
387
461
  * openInNewTab: true
@@ -408,7 +482,7 @@ export interface ExternalEditLink {
408
482
  /**
409
483
  * Maps template variables to their source paths.
410
484
  * Keys are variable names used in the URL, values are dot-notation paths
411
- * to resolve from the node context (e.g., "metadata.id", "config.apiKey", "id")
485
+ * to resolve from the node context (e.g., "metadata.node_type_id", "config.apiKey", "id")
412
486
  */
413
487
  parameterMapping?: Record<string, string>;
414
488
  /**
@@ -529,27 +603,8 @@ export interface AtomUIConfig {
529
603
  maxWidth?: number;
530
604
  }
531
605
  export interface NodeUIExtensions {
532
- /** Show/hide unconnected handles (ports) to reduce visual noise */
533
- hideUnconnectedHandles?: boolean;
534
606
  /** Display/behavior config for minimalist atom nodes (Constant, Cast, …) */
535
607
  atom?: AtomUIConfig;
536
- /**
537
- * Visual-only port display order (no effect on execution).
538
- * Arrays of port IDs in the desired render order.
539
- * Ports not listed appear at the end in metadata order.
540
- */
541
- portOrder?: {
542
- inputs?: string[];
543
- outputs?: string[];
544
- };
545
- /**
546
- * Manually hidden ports (visual only, no effect on execution).
547
- * Required ports cannot be added here — enforced in the UI.
548
- */
549
- hiddenPorts?: {
550
- inputs?: string[];
551
- outputs?: string[];
552
- };
553
608
  /** Custom styles or theme overrides */
554
609
  style?: Record<string, unknown>;
555
610
  /** Any other UI-specific settings */
@@ -563,7 +618,6 @@ export interface NodeUIExtensions {
563
618
  * ```typescript
564
619
  * const extensions: NodeExtensions = {
565
620
  * ui: {
566
- * hideUnconnectedHandles: true,
567
621
  * style: { opacity: 0.8 }
568
622
  * },
569
623
  * "myapp:analytics": {
@@ -602,7 +656,8 @@ export interface NodeExtensions {
602
656
  * Node configuration metadata
603
657
  */
604
658
  export interface NodeMetadata {
605
- id: string;
659
+ /** The node type entity id — the runtime's resolution anchor. */
660
+ node_type_id: string;
606
661
  name: string;
607
662
  type?: NodeType;
608
663
  /**
@@ -1132,8 +1187,6 @@ export interface WorkflowNode extends Node {
1132
1187
  isProcessing?: boolean;
1133
1188
  /** Error message if the node execution failed */
1134
1189
  error?: string;
1135
- /** Alternative node identifier */
1136
- nodeId?: string;
1137
1190
  /** Node execution tracking information */
1138
1191
  executionInfo?: NodeExecutionInfo;
1139
1192
  /**
@@ -1188,8 +1241,9 @@ export interface Workflow {
1188
1241
  description?: string;
1189
1242
  nodes: WorkflowNode[];
1190
1243
  edges: WorkflowEdge[];
1191
- metadata?: {
1192
- version: string;
1244
+ metadata: {
1245
+ /** Workflow schema format version — identifies the document format, not the workflow's own revision. */
1246
+ schemaVersion: string;
1193
1247
  createdAt: string;
1194
1248
  updatedAt: string;
1195
1249
  author?: string;
@@ -1230,6 +1284,8 @@ export interface PipelineViewProps {
1230
1284
  pipelineId: string | null;
1231
1285
  workflow: Workflow;
1232
1286
  endpointConfig: EndpointConfig;
1287
+ /** Auth provider for building authenticated API clients in custom views. */
1288
+ authProvider?: AuthProvider;
1233
1289
  refreshTrigger?: number;
1234
1290
  }
1235
1291
  /** A custom view injected into the PipelinePanel view switcher. */
@@ -1243,6 +1299,31 @@ export interface PipelineViewDef {
1243
1299
  /** Svelte component that receives PipelineViewProps */
1244
1300
  component: Component<PipelineViewProps>;
1245
1301
  }
1302
+ /**
1303
+ * One job execution of a node within a pipeline run.
1304
+ *
1305
+ * Loop-orchestrated workflows create one job per iteration for the same
1306
+ * node (labels carry an iteration suffix, e.g. "Invoke tool #2"), so a node
1307
+ * can have several of these per run.
1308
+ */
1309
+ export interface NodeJobExecution {
1310
+ /** Job entity ID */
1311
+ id?: string;
1312
+ /** Job label, carries the iteration suffix (e.g. "Invoke tool #2") */
1313
+ label?: string;
1314
+ /** Job status */
1315
+ status: NodeExecutionStatus;
1316
+ /** ISO timestamp the job started, if it ran */
1317
+ started?: string;
1318
+ /** ISO timestamp the job completed, if it finished */
1319
+ completed?: string;
1320
+ /** Execution duration in milliseconds, if the job ran to completion */
1321
+ executionTime?: number;
1322
+ /** Precise execution duration in microseconds, when the backend provides it */
1323
+ executionTimeUs?: number;
1324
+ /** Error message if the job failed */
1325
+ error?: string;
1326
+ }
1246
1327
  /**
1247
1328
  * Node execution tracking information
1248
1329
  */
@@ -1255,12 +1336,16 @@ export interface NodeExecutionInfo {
1255
1336
  lastExecuted?: string;
1256
1337
  /** Last execution duration in milliseconds */
1257
1338
  lastExecutionDuration?: number;
1339
+ /** Precise last execution duration in microseconds, when the backend provides it */
1340
+ lastExecutionDurationUs?: number;
1258
1341
  /** Last error message if execution failed */
1259
1342
  lastError?: string;
1260
1343
  /** Whether the node is currently being executed */
1261
1344
  isExecuting: boolean;
1262
1345
  /** Execution output data (e.g., active branches for gateway nodes) */
1263
1346
  output?: Record<string, unknown>;
1347
+ /** Per-job execution history (loop iterations), in pipeline order */
1348
+ jobs?: NodeJobExecution[];
1264
1349
  }
1265
1350
  /**
1266
1351
  * Workflow execution status
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Core types for the Workflow Library
3
3
  */
4
- import { ConnectionLineType } from '@xyflow/svelte';
5
4
  /**
6
5
  * Default workflow format used when none is specified.
7
6
  */
@@ -11,4 +11,11 @@ export interface NavbarAction {
11
11
  onclick?: (event: Event) => void;
12
12
  /** If true, opens link in new tab with `rel="noopener noreferrer"`. */
13
13
  external?: boolean;
14
+ /**
15
+ * Optional group label. Items sharing the same `group` cluster together
16
+ * under a header inside the flyout dropdown. Ungrouped items render first.
17
+ * Group order follows first occurrence in the array. Ignored when the
18
+ * navbar is in split mode (the inline row of buttons).
19
+ */
20
+ group?: string;
14
21
  }
@@ -376,11 +376,26 @@ export interface PlaygroundConfig {
376
376
  */
377
377
  showSidebar?: boolean;
378
378
  /**
379
- * Whether to show the session header bar (default: true)
380
- * When false, the header with session name and close button is hidden.
381
- * Typically used together with showSidebar: false for minimal UI.
379
+ * Whether to show the ControlPanel header bar (default: true)
380
+ * When false, hides the entire header row: session label, session chip
381
+ * (with its New Session / session list popover) and the toolbar actions
382
+ * (Pipeline / Refresh / Logs). Use for a minimal, locked-down playground.
382
383
  */
383
384
  showSessionHeader?: boolean;
385
+ /**
386
+ * Whether to show the "New Session" entry in the session chip popover
387
+ * (default: true). When false, users cannot create additional sessions
388
+ * from the UI — useful for single-session playground embeds.
389
+ * No effect when showSessionHeader is false.
390
+ */
391
+ showNewSessionButton?: boolean;
392
+ /**
393
+ * Whether to show the session chip selector and its session list (default:
394
+ * true). When false, the chip dropdown is hidden entirely — users cannot
395
+ * switch sessions or see other sessions. Useful for locking a playground
396
+ * embed to a single session. No effect when showSessionHeader is false.
397
+ */
398
+ showSessionList?: boolean;
384
399
  /**
385
400
  * Determines if polling should stop for a given session status.
386
401
  * Override to customize which statuses pause polling.
@@ -45,6 +45,18 @@ export interface EditorSettings {
45
45
  /** Distance threshold in pixels for proximity connect */
46
46
  proximityConnectDistance: number;
47
47
  }
48
+ /**
49
+ * Where an auxiliary surface (config panel, console/chat) is hosted.
50
+ *
51
+ * - `sidebar` — the right rail.
52
+ * - `modal` — a centered overlay floating above the canvas.
53
+ * - `below` — the bottom panel.
54
+ *
55
+ * Surfaces routed to the same host coexist as tabs. Modelled as one enum per
56
+ * surface (rather than a boolean per host) so invalid combinations — two hosts
57
+ * at once, or none — are unrepresentable.
58
+ */
59
+ export type SurfacePlacement = 'sidebar' | 'modal' | 'below';
48
60
  /**
49
61
  * UI layout and display settings
50
62
  */
@@ -56,13 +68,17 @@ export interface UISettings {
56
68
  /** Enable compact mode for denser UI */
57
69
  compactMode: boolean;
58
70
  /** Active theme name — overridden by the theme prop when explicitly provided */
59
- theme: 'default' | 'minimal';
71
+ theme: 'default' | 'minimal' | 'drafter';
60
72
  /** Whether the command console panel is open */
61
73
  consoleOpen: boolean;
62
74
  /** Height of the command console panel in pixels */
63
75
  consoleHeight: number;
64
76
  /** Active tab in the bottom panel */
65
77
  bottomPanelTab: 'console' | 'chat';
78
+ /** Where the node/workflow configuration panel is hosted. Default `sidebar`. */
79
+ configPlacement: SurfacePlacement;
80
+ /** Where the console / AI Assistant group is hosted. Default `below`. */
81
+ consolePlacement: SurfacePlacement;
66
82
  }
67
83
  /**
68
84
  * Application behavior and automation settings
@@ -72,6 +88,19 @@ export interface BehaviorSettings {
72
88
  autoSave: boolean;
73
89
  /** Auto-save interval in milliseconds */
74
90
  autoSaveInterval: number;
91
+ /**
92
+ * Persist workflow drafts in browser storage.
93
+ *
94
+ * When enabled (default), unsaved changes are written to browser storage
95
+ * so they survive page reloads. On the default `localStorage` backend,
96
+ * drafts remain stored on the device even after the tab or browser is
97
+ * closed, until they are saved or cleared. Turning this off stops draft
98
+ * writes and removes the current draft.
99
+ *
100
+ * Caveat: the toggle applies per tab. Other tabs that are already open
101
+ * read settings at load time and keep writing drafts until reloaded.
102
+ */
103
+ storeDraftsInBrowser: boolean;
75
104
  /** Maximum number of undo history entries */
76
105
  undoHistoryLimit: number;
77
106
  /** Show confirmation dialog before deleting nodes */
@@ -37,7 +37,7 @@ export const SETTINGS_CATEGORY_ICONS = {
37
37
  * Default theme settings
38
38
  */
39
39
  export const DEFAULT_THEME_SETTINGS = {
40
- preference: 'dark'
40
+ preference: 'light'
41
41
  };
42
42
  /**
43
43
  * Default editor settings
@@ -62,7 +62,9 @@ export const DEFAULT_UI_SETTINGS = {
62
62
  theme: 'default',
63
63
  consoleOpen: false,
64
64
  consoleHeight: 300,
65
- bottomPanelTab: 'console'
65
+ bottomPanelTab: 'console',
66
+ configPlacement: 'sidebar',
67
+ consolePlacement: 'below'
66
68
  };
67
69
  /**
68
70
  * Default behavior settings
@@ -70,6 +72,7 @@ export const DEFAULT_UI_SETTINGS = {
70
72
  export const DEFAULT_BEHAVIOR_SETTINGS = {
71
73
  autoSave: false,
72
74
  autoSaveInterval: 30000,
75
+ storeDraftsInBrowser: true,
73
76
  undoHistoryLimit: 50,
74
77
  confirmDelete: false,
75
78
  chatAutoRetry: true
@@ -28,4 +28,4 @@ export interface FlowDropSkin {
28
28
  /** CSS token overrides injected as [data-theme='dark'] rules — active in dark mode only */
29
29
  darkTokens?: FlowDropSkinTokens;
30
30
  }
31
- export type FlowDropSkinName = 'default' | 'slate';
31
+ export type FlowDropSkinName = 'default' | 'slate' | 'drafter';
@@ -1,4 +1,14 @@
1
1
  import type { FlowDropSkin } from './skin.js';
2
+ /**
3
+ * Canvas background grid pattern. Mirrors xyflow's BackgroundVariant values:
4
+ * 'dots' — a square grid of dots (the default)
5
+ * 'lines' — a square grid of solid lines (a "blueprint" / drafter look)
6
+ * 'cross' — small plus-marks at each grid intersection
7
+ *
8
+ * The grid's color is driven separately by the `--fd-grid-pattern-color` token,
9
+ * so any skin can recolor whichever variant a theme chooses.
10
+ */
11
+ export type FlowDropGridVariant = 'dots' | 'lines' | 'cross';
2
12
  /**
3
13
  * Behavioral configuration bundled with a theme.
4
14
  * These are initial-state flags, not CSS — they control runtime defaults.
@@ -10,11 +20,15 @@ export interface FlowDropThemeConfig {
10
20
  /** Whether category <details> accordion sections start open in card mode. Defaults to false. */
11
21
  categoriesDefaultOpen?: boolean;
12
22
  };
23
+ canvas?: {
24
+ /** Background grid pattern applied when this theme is selected. Defaults to 'dots'. */
25
+ grid?: FlowDropGridVariant;
26
+ };
13
27
  }
14
28
  /**
15
29
  * A FlowDrop theme bundles a visual skin (CSS tokens) with UI config (behavioral defaults).
16
30
  *
17
- * Built-in themes: 'default' | 'minimal'
31
+ * Built-in themes: 'default' | 'minimal' | 'drafter'
18
32
  *
19
33
  * @example
20
34
  * // Use a built-in theme by name
@@ -32,4 +46,4 @@ export interface FlowDropTheme {
32
46
  /** Behavioral configuration defaults */
33
47
  config?: FlowDropThemeConfig;
34
48
  }
35
- export type FlowDropThemeName = 'default' | 'minimal';
49
+ export type FlowDropThemeName = 'default' | 'minimal' | 'drafter';
@@ -124,6 +124,11 @@ export interface UISchemaGroup extends UISchemaElementBase {
124
124
  * @default true
125
125
  */
126
126
  defaultOpen?: boolean;
127
+ /**
128
+ * Optional Iconify icon name shown in the group's header bar.
129
+ * Falls back to a neutral default when omitted.
130
+ */
131
+ icon?: string;
127
132
  }
128
133
  /**
129
134
  * Union type of all supported UISchema elements.