@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.11

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 (270) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/MIGRATION-2.0.md +173 -3
  3. package/README.md +5 -5
  4. package/dist/adapters/WorkflowAdapter.js +4 -5
  5. package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
  6. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  7. package/dist/api/enhanced-client.js +6 -11
  8. package/dist/chat/batchFeedback.js +1 -1
  9. package/dist/chat/commandClassifier.d.ts +11 -0
  10. package/dist/chat/commandClassifier.js +20 -0
  11. package/dist/chat/historyBuilder.d.ts +39 -0
  12. package/dist/chat/historyBuilder.js +82 -0
  13. package/dist/chat/index.d.ts +2 -1
  14. package/dist/chat/index.js +2 -1
  15. package/dist/chat/responseParser.js +16 -12
  16. package/dist/commands/executor.js +51 -26
  17. package/dist/commands/parser.d.ts +12 -0
  18. package/dist/commands/parser.js +33 -6
  19. package/dist/commands/storeIntegration.svelte.js +11 -1
  20. package/dist/commands/types.js +5 -5
  21. package/dist/components/App.svelte +547 -386
  22. package/dist/components/App.svelte.d.ts +16 -8
  23. package/dist/components/Button.stories.svelte +65 -0
  24. package/dist/components/Button.stories.svelte.d.ts +19 -0
  25. package/dist/components/Button.svelte +62 -0
  26. package/dist/components/Button.svelte.d.ts +24 -0
  27. package/dist/components/CanvasIconButton.svelte +76 -0
  28. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  29. package/dist/components/ConfigForm.svelte +194 -565
  30. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  31. package/dist/components/ConfigModal.svelte +9 -1
  32. package/dist/components/ConfigPanel.svelte +234 -15
  33. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  34. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  35. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  36. package/dist/components/EditorStatusBar.svelte +99 -0
  37. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  38. package/dist/components/IconButton.svelte +80 -0
  39. package/dist/components/IconButton.svelte.d.ts +30 -0
  40. package/dist/components/Input.svelte +74 -0
  41. package/dist/components/Input.svelte.d.ts +17 -0
  42. package/dist/components/LogoWordmark.svelte +113 -0
  43. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  44. package/dist/components/Navbar.svelte +17 -63
  45. package/dist/components/Navbar.svelte.d.ts +3 -0
  46. package/dist/components/NodeSidebar.svelte +21 -126
  47. package/dist/components/NodeSwapPicker.svelte +12 -30
  48. package/dist/components/PipelineStatus.svelte +6 -1
  49. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  50. package/dist/components/PortMappingRow.svelte +0 -2
  51. package/dist/components/SchemaForm.svelte +4 -14
  52. package/dist/components/Select.svelte +53 -0
  53. package/dist/components/Select.svelte.d.ts +15 -0
  54. package/dist/components/SettingsModal.svelte +0 -5
  55. package/dist/components/SettingsPanel.svelte +33 -6
  56. package/dist/components/Textarea.svelte +39 -0
  57. package/dist/components/Textarea.svelte.d.ts +12 -0
  58. package/dist/components/ThemeToggle.svelte +15 -94
  59. package/dist/components/UniversalNode.svelte +36 -4
  60. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  61. package/dist/components/WorkflowEditor.svelte +71 -54
  62. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  63. package/dist/components/chat/AIChatPanel.svelte +49 -8
  64. package/dist/components/chat/CommandPreview.svelte +10 -1
  65. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  66. package/dist/components/console/ConsoleInput.svelte +3 -3
  67. package/dist/components/console/ConsoleOutput.svelte +2 -2
  68. package/dist/components/form/FormArray.svelte +37 -173
  69. package/dist/components/form/FormAutocomplete.svelte +18 -15
  70. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  71. package/dist/components/form/FormCodeEditor.svelte +9 -7
  72. package/dist/components/form/FormField.svelte +18 -42
  73. package/dist/components/form/FormFieldLight.svelte +52 -48
  74. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  75. package/dist/components/form/FormFieldset.svelte +45 -11
  76. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  77. package/dist/components/form/FormNumberField.svelte +4 -36
  78. package/dist/components/form/FormPorts.svelte +280 -0
  79. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  80. package/dist/components/form/FormRangeField.svelte +63 -30
  81. package/dist/components/form/FormSelect.svelte +13 -75
  82. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  83. package/dist/components/form/FormTextField.svelte +3 -35
  84. package/dist/components/form/FormTextarea.svelte +4 -39
  85. package/dist/components/form/FormToggle.svelte +27 -6
  86. package/dist/components/form/FormToggle.svelte.d.ts +5 -0
  87. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  88. package/dist/components/form/resolveFieldType.d.ts +24 -0
  89. package/dist/components/form/resolveFieldType.js +55 -0
  90. package/dist/components/icons/CloseIcon.svelte +6 -0
  91. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  92. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  93. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  94. package/dist/components/icons/MenuIcon.svelte +4 -0
  95. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  96. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  97. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  98. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  99. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  100. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  101. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  102. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  103. package/dist/components/layouts/MainLayout.svelte +4 -5
  104. package/dist/components/nodes/AtomNode.svelte +62 -76
  105. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  106. package/dist/components/nodes/GatewayNode.svelte +117 -164
  107. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  108. package/dist/components/nodes/IdeaNode.svelte +72 -98
  109. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  110. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  111. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  112. package/dist/components/nodes/NotesNode.svelte +76 -85
  113. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  114. package/dist/components/nodes/SimpleNode.svelte +59 -133
  115. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  116. package/dist/components/nodes/SquareNode.svelte +110 -164
  117. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  118. package/dist/components/nodes/TerminalNode.svelte +62 -124
  119. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  120. package/dist/components/nodes/ToolNode.svelte +92 -103
  121. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  122. package/dist/components/nodes/WorkflowNode.svelte +132 -191
  123. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  124. package/dist/components/playground/ChatInput.svelte +316 -27
  125. package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
  126. package/dist/components/playground/ControlPanel.svelte +22 -0
  127. package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
  128. package/dist/components/playground/InputCollector.svelte +11 -48
  129. package/dist/components/playground/PipelineKanbanView.svelte +6 -4
  130. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  131. package/dist/components/playground/PipelinePanel.svelte +20 -3
  132. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  133. package/dist/components/playground/PipelineTableView.svelte +6 -4
  134. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  135. package/dist/components/playground/Playground.svelte +292 -28
  136. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  137. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  138. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  139. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  140. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  141. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  142. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  143. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  144. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  145. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  146. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  147. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  148. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  149. package/dist/config/endpoints.d.ts +71 -1
  150. package/dist/config/endpoints.js +46 -5
  151. package/dist/core/index.d.ts +2 -3
  152. package/dist/core/index.js +2 -6
  153. package/dist/display/index.d.ts +6 -1
  154. package/dist/display/index.js +9 -1
  155. package/dist/editor/index.d.ts +1 -1
  156. package/dist/editor/index.js +1 -1
  157. package/dist/form/full.d.ts +2 -1
  158. package/dist/form/full.js +4 -1
  159. package/dist/form/index.d.ts +0 -1
  160. package/dist/form/index.js +3 -2
  161. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  162. package/dist/helpers/workflowEditorHelper.js +8 -8
  163. package/dist/messages/defaults.d.ts +98 -0
  164. package/dist/messages/defaults.js +58 -1
  165. package/dist/messages/index.d.ts +1 -1
  166. package/dist/messages/index.js +1 -1
  167. package/dist/openapi/v1/openapi.yaml +35 -23
  168. package/dist/playground/commands/args.d.ts +32 -0
  169. package/dist/playground/commands/args.js +50 -0
  170. package/dist/playground/commands/dispatch.d.ts +143 -0
  171. package/dist/playground/commands/dispatch.js +162 -0
  172. package/dist/playground/commands/index.d.ts +14 -0
  173. package/dist/playground/commands/index.js +10 -0
  174. package/dist/playground/commands/parser.d.ts +38 -0
  175. package/dist/playground/commands/parser.js +163 -0
  176. package/dist/playground/commands/registry.d.ts +42 -0
  177. package/dist/playground/commands/registry.js +122 -0
  178. package/dist/playground/commands/suggest.d.ts +37 -0
  179. package/dist/playground/commands/suggest.js +46 -0
  180. package/dist/playground/commands/types.d.ts +111 -0
  181. package/dist/playground/commands/types.js +15 -0
  182. package/dist/playground/index.d.ts +21 -2
  183. package/dist/playground/index.js +27 -2
  184. package/dist/playground/mount.d.ts +19 -5
  185. package/dist/playground/mount.js +16 -8
  186. package/dist/playground/runAction.d.ts +48 -0
  187. package/dist/playground/runAction.js +31 -0
  188. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  189. package/dist/registry/builtinNodeTypes.js +67 -0
  190. package/dist/registry/builtinNodes.d.ts +2 -39
  191. package/dist/registry/builtinNodes.js +6 -53
  192. package/dist/registry/nodeComponentRegistry.d.ts +2 -1
  193. package/dist/schemas/v1/workflow.schema.json +16 -14
  194. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  195. package/dist/services/agentSpecExecutionService.js +0 -2
  196. package/dist/services/apiVariableService.js +12 -26
  197. package/dist/services/categoriesApi.js +3 -6
  198. package/dist/services/chatService.d.ts +4 -3
  199. package/dist/services/chatService.js +13 -18
  200. package/dist/services/dynamicSchemaService.d.ts +31 -4
  201. package/dist/services/dynamicSchemaService.js +62 -33
  202. package/dist/services/historyService.d.ts +30 -8
  203. package/dist/services/historyService.js +51 -15
  204. package/dist/services/interruptService.d.ts +7 -6
  205. package/dist/services/interruptService.js +19 -21
  206. package/dist/services/pipelineSignalService.d.ts +97 -0
  207. package/dist/services/pipelineSignalService.js +94 -0
  208. package/dist/services/playgroundService.d.ts +21 -8
  209. package/dist/services/playgroundService.js +45 -25
  210. package/dist/services/portConfigApi.js +3 -6
  211. package/dist/services/settingsService.d.ts +9 -4
  212. package/dist/services/settingsService.js +23 -12
  213. package/dist/services/workflowLaunchService.d.ts +74 -0
  214. package/dist/services/workflowLaunchService.js +74 -0
  215. package/dist/skins/drafter.d.ts +30 -0
  216. package/dist/skins/drafter.js +198 -0
  217. package/dist/skins/index.d.ts +2 -1
  218. package/dist/skins/index.js +4 -2
  219. package/dist/stores/apiContext.d.ts +11 -0
  220. package/dist/stores/apiContext.js +15 -0
  221. package/dist/stores/categoriesStore.svelte.js +0 -1
  222. package/dist/stores/historyStore.svelte.d.ts +17 -3
  223. package/dist/stores/historyStore.svelte.js +30 -3
  224. package/dist/stores/instanceContainer.svelte.js +5 -0
  225. package/dist/stores/playgroundStore.svelte.js +1 -3
  226. package/dist/stores/settingsStore.svelte.d.ts +13 -0
  227. package/dist/stores/settingsStore.svelte.js +32 -0
  228. package/dist/stores/workflowStore.svelte.d.ts +42 -5
  229. package/dist/stores/workflowStore.svelte.js +109 -32
  230. package/dist/styles/base.css +285 -14
  231. package/dist/styles/tokens.css +60 -2
  232. package/dist/svelte-app.d.ts +18 -1
  233. package/dist/svelte-app.js +75 -110
  234. package/dist/themes/drafter.d.ts +2 -0
  235. package/dist/themes/drafter.js +15 -0
  236. package/dist/themes/index.d.ts +2 -1
  237. package/dist/themes/index.js +8 -2
  238. package/dist/types/auth.d.ts +9 -51
  239. package/dist/types/auth.js +4 -54
  240. package/dist/types/chat.d.ts +5 -1
  241. package/dist/types/events.d.ts +18 -0
  242. package/dist/types/events.js +2 -1
  243. package/dist/types/index.d.ts +84 -29
  244. package/dist/types/index.js +0 -1
  245. package/dist/types/settings.d.ts +28 -1
  246. package/dist/types/settings.js +6 -3
  247. package/dist/types/skin.d.ts +1 -1
  248. package/dist/types/theme.d.ts +16 -2
  249. package/dist/types/uischema.d.ts +5 -0
  250. package/dist/utils/canvasSelection.d.ts +25 -0
  251. package/dist/utils/canvasSelection.js +37 -0
  252. package/dist/utils/colors.d.ts +27 -0
  253. package/dist/utils/colors.js +23 -0
  254. package/dist/utils/connections.js +20 -56
  255. package/dist/utils/edgeStyling.js +9 -5
  256. package/dist/utils/fetchWithAuth.d.ts +36 -15
  257. package/dist/utils/fetchWithAuth.js +53 -23
  258. package/dist/utils/nodeFormSchema.d.ts +51 -0
  259. package/dist/utils/nodeFormSchema.js +87 -0
  260. package/dist/utils/nodeIds.d.ts +1 -1
  261. package/dist/utils/nodeIds.js +1 -1
  262. package/dist/utils/nodeSwap.js +3 -6
  263. package/dist/utils/nodeTypes.js +1 -1
  264. package/dist/utils/portUtils.d.ts +47 -11
  265. package/dist/utils/portUtils.js +67 -14
  266. package/dist/utils/portal.d.ts +18 -0
  267. package/dist/utils/portal.js +34 -0
  268. package/dist/utils/schemaMerge.d.ts +25 -0
  269. package/dist/utils/schemaMerge.js +61 -0
  270. package/package.json +2 -1
@@ -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.
@@ -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
  /**
@@ -1231,6 +1284,8 @@ export interface PipelineViewProps {
1231
1284
  pipelineId: string | null;
1232
1285
  workflow: Workflow;
1233
1286
  endpointConfig: EndpointConfig;
1287
+ /** Auth provider for building authenticated API clients in custom views. */
1288
+ authProvider?: AuthProvider;
1234
1289
  refreshTrigger?: number;
1235
1290
  }
1236
1291
  /** A custom view injected into the PipelinePanel view switcher. */
@@ -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
  */
@@ -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
@@ -91,6 +107,17 @@ export interface BehaviorSettings {
91
107
  confirmDelete: boolean;
92
108
  /** Automatically re-submit batch failures to the AI for self-correction */
93
109
  chatAutoRetry: boolean;
110
+ /**
111
+ * Allow the AI assistant's commands to reposition nodes
112
+ * (`layout auto`, `layout beautify`).
113
+ *
114
+ * Turn off to protect a hand-crafted layout: those commands are then skipped
115
+ * (not failed) when a batch is applied, so the rest of the change set still
116
+ * lands. Positioning nodes explicitly via `add ... at <x>,<y>` and viewport
117
+ * commands (`canvas fitview`) are unaffected — they don't overwrite the
118
+ * arrangement of existing nodes.
119
+ */
120
+ chatAllowLayoutChanges: boolean;
94
121
  }
95
122
  /**
96
123
  * API connection and request settings
@@ -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
@@ -73,7 +75,8 @@ export const DEFAULT_BEHAVIOR_SETTINGS = {
73
75
  storeDraftsInBrowser: true,
74
76
  undoHistoryLimit: 50,
75
77
  confirmDelete: false,
76
- chatAutoRetry: true
78
+ chatAutoRetry: true,
79
+ chatAllowLayoutChanges: true
77
80
  };
78
81
  /**
79
82
  * Default API settings
@@ -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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Canvas Selection Utilities
3
+ *
4
+ * Keeps canvas pointer gestures from turning into browser text-selection drags.
5
+ */
6
+ /**
7
+ * Suppress the text-selection drag a port handle mousedown would otherwise start.
8
+ *
9
+ * All canvas chrome is `user-select: none` (xyflow sets it on the node, pane and
10
+ * viewport), but WebKit still begins a selection drag from a mousedown on
11
+ * unselectable content: it anchors at the nearest selectable text *outside* the
12
+ * canvas — sidebar, toolbar, status bar or the surrounding host page — and
13
+ * extends it as the pointer moves, so drawing a connection paints a selection
14
+ * across the app (#37). Chromium and Firefox never start the gesture.
15
+ *
16
+ * Only handles need this: xyflow already suppresses the default for node drags
17
+ * (d3-drag) and pane drags. Handles are the one canvas drag started from a plain
18
+ * mousedown handler, so we suppress the default here — nothing in the connect
19
+ * flow depends on it, since xyflow tracks the drag on its own pointer listeners.
20
+ * The default action also moves focus, so re-apply it to keep the focus ring
21
+ * (`.svelte-flow__handle:focus` in base.css) behaving as before.
22
+ *
23
+ * Bind in the capture phase so xyflow's handle handler still receives the event.
24
+ */
25
+ export declare function suppressPortDragSelection(event: MouseEvent): void;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Canvas Selection Utilities
3
+ *
4
+ * Keeps canvas pointer gestures from turning into browser text-selection drags.
5
+ */
6
+ /**
7
+ * Suppress the text-selection drag a port handle mousedown would otherwise start.
8
+ *
9
+ * All canvas chrome is `user-select: none` (xyflow sets it on the node, pane and
10
+ * viewport), but WebKit still begins a selection drag from a mousedown on
11
+ * unselectable content: it anchors at the nearest selectable text *outside* the
12
+ * canvas — sidebar, toolbar, status bar or the surrounding host page — and
13
+ * extends it as the pointer moves, so drawing a connection paints a selection
14
+ * across the app (#37). Chromium and Firefox never start the gesture.
15
+ *
16
+ * Only handles need this: xyflow already suppresses the default for node drags
17
+ * (d3-drag) and pane drags. Handles are the one canvas drag started from a plain
18
+ * mousedown handler, so we suppress the default here — nothing in the connect
19
+ * flow depends on it, since xyflow tracks the drag on its own pointer listeners.
20
+ * The default action also moves focus, so re-apply it to keep the focus ring
21
+ * (`.svelte-flow__handle:focus` in base.css) behaving as before.
22
+ *
23
+ * Bind in the capture phase so xyflow's handle handler still receives the event.
24
+ */
25
+ export function suppressPortDragSelection(event) {
26
+ // Primary button only — other buttons never start a selection.
27
+ if (event.button !== 0)
28
+ return;
29
+ const target = event.target;
30
+ if (typeof target?.closest !== 'function')
31
+ return;
32
+ const handle = target.closest('.svelte-flow__handle');
33
+ if (!handle)
34
+ return;
35
+ event.preventDefault();
36
+ handle.focus();
37
+ }
@@ -241,6 +241,33 @@ export declare function getPortBackgroundColor(checker: PortCompatibilityChecker
241
241
  * @returns CSS color value for the port border
242
242
  */
243
243
  export declare function getPortBorderColor(checker: PortCompatibilityChecker, dataType: string): string;
244
+ /**
245
+ * Whether a port is the reserved `error` output port.
246
+ *
247
+ * The reserved error output carries an arbitrary data type (json) but should
248
+ * read as an error affordance (red) wherever it surfaces. See
249
+ * `.claude/plans/exposed-ports.md`.
250
+ */
251
+ export declare function isErrorPort(port: {
252
+ id: string;
253
+ type?: string;
254
+ }): boolean;
255
+ /**
256
+ * Port colour token: red for the reserved error output, else its data type.
257
+ */
258
+ export declare function getPortColorToken(checker: PortCompatibilityChecker, port: {
259
+ id: string;
260
+ type?: string;
261
+ dataType: string;
262
+ }): string;
263
+ /**
264
+ * Port background tint, honouring the reserved error port's red affordance.
265
+ */
266
+ export declare function getPortBackgroundColorForPort(checker: PortCompatibilityChecker, port: {
267
+ id: string;
268
+ type?: string;
269
+ dataType: string;
270
+ }, opacity?: number): string;
244
271
  /**
245
272
  * Convert RGB components to hex color string
246
273
  * @param r - Red component (0-255)
@@ -429,6 +429,29 @@ export function getPortBackgroundColor(checker, dataType, opacity = 25) {
429
429
  export function getPortBorderColor(checker, dataType) {
430
430
  return getDataTypeColorToken(checker, dataType);
431
431
  }
432
+ /**
433
+ * Whether a port is the reserved `error` output port.
434
+ *
435
+ * The reserved error output carries an arbitrary data type (json) but should
436
+ * read as an error affordance (red) wherever it surfaces. See
437
+ * `.claude/plans/exposed-ports.md`.
438
+ */
439
+ export function isErrorPort(port) {
440
+ return port.id === 'error' && port.type !== 'input';
441
+ }
442
+ /**
443
+ * Port colour token: red for the reserved error output, else its data type.
444
+ */
445
+ export function getPortColorToken(checker, port) {
446
+ return isErrorPort(port) ? 'var(--fd-node-red)' : getDataTypeColorToken(checker, port.dataType);
447
+ }
448
+ /**
449
+ * Port background tint, honouring the reserved error port's red affordance.
450
+ */
451
+ export function getPortBackgroundColorForPort(checker, port, opacity = 25) {
452
+ const colorToken = getPortColorToken(checker, port);
453
+ return `color-mix(in srgb, ${colorToken} ${opacity}%, transparent)`;
454
+ }
432
455
  /**
433
456
  * Convert RGB components to hex color string
434
457
  * @param r - Red component (0-255)
@@ -119,7 +119,7 @@ export class PortCompatibilityChecker {
119
119
  * Get all possible connections from a source node to target nodes
120
120
  */
121
121
  export function getPossibleConnections(checker, sourceNode, targetNodes, nodeTypes) {
122
- const sourceMetadata = nodeTypes.find((nt) => nt.id === sourceNode.data.metadata.id);
122
+ const sourceMetadata = nodeTypes.find((nt) => nt.node_type_id === sourceNode.data.metadata.node_type_id);
123
123
  if (!sourceMetadata)
124
124
  return [];
125
125
  const possibleConnections = [];
@@ -129,7 +129,7 @@ export function getPossibleConnections(checker, sourceNode, targetNodes, nodeTyp
129
129
  for (const targetNode of targetNodes) {
130
130
  if (targetNode.id === sourceNode.id)
131
131
  continue; // Skip self-connection
132
- 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);
133
133
  if (!targetMetadata)
134
134
  continue;
135
135
  // Get all input ports from target node
@@ -170,8 +170,8 @@ export function validateConnection(checker, sourceNodeId, sourcePortId, targetNo
170
170
  return { valid: false, error: 'Cannot connect node to itself' };
171
171
  }
172
172
  // Get node metadata
173
- const sourceMetadata = nodeTypes.find((nt) => nt.id === sourceNode.data.metadata.id);
174
- 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);
175
175
  if (!sourceMetadata || !targetMetadata) {
176
176
  return { valid: false, error: 'Node metadata not found' };
177
177
  }
@@ -200,14 +200,14 @@ export function getConnectionSuggestions(checker, nodeId, nodes, nodeTypes) {
200
200
  const node = nodes.find((n) => n.id === nodeId);
201
201
  if (!node)
202
202
  return [];
203
- 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);
204
204
  if (!metadata)
205
205
  return [];
206
206
  const suggestions = [];
207
207
  // Get all other nodes
208
208
  const otherNodes = nodes.filter((n) => n.id !== nodeId);
209
209
  for (const otherNode of otherNodes) {
210
- 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);
211
211
  if (!otherMetadata)
212
212
  continue;
213
213
  // Check outputs from other nodes to inputs of current node
@@ -253,8 +253,17 @@ export function getConnectionSuggestions(checker, nodeId, nodes, nodeTypes) {
253
253
  * @returns True if any cycle exists in the workflow
254
254
  */
255
255
  export function hasCycles(nodes, edges) {
256
- // Build adjacency map once (O(E)) so the DFS inner loop is O(1) per lookup
257
- // 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) {
258
267
  const adjacencyMap = new Map();
259
268
  for (const node of nodes) {
260
269
  adjacencyMap.set(node.id, []);
@@ -274,7 +283,6 @@ export function hasCycles(nodes, edges) {
274
283
  return false;
275
284
  visited.add(nodeId);
276
285
  recursionStack.add(nodeId);
277
- // Use pre-built adjacency map instead of filtering all edges each call
278
286
  const neighbors = adjacencyMap.get(nodeId) || [];
279
287
  for (const target of neighbors) {
280
288
  if (hasCycleUtil(target))
@@ -283,7 +291,6 @@ export function hasCycles(nodes, edges) {
283
291
  recursionStack.delete(nodeId);
284
292
  return false;
285
293
  }
286
- // Check each node
287
294
  for (const node of nodes) {
288
295
  if (!visited.has(node.id)) {
289
296
  if (hasCycleUtil(node.id))
@@ -309,53 +316,10 @@ export function hasCycles(nodes, edges) {
309
316
  * ```
310
317
  */
311
318
  export function hasInvalidCycles(nodes, edges) {
312
- // 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.
313
321
  const nonLoopbackEdges = edges.filter((edge) => !isLoopbackEdge(edge));
314
- // Build adjacency map from non-loopback edges once (O(E)) so the DFS inner
315
- // loop is O(1) per lookup instead of scanning all edges on every recursive
316
- // call (which was O(V*E)).
317
- const adjacencyMap = new Map();
318
- for (const node of nodes) {
319
- adjacencyMap.set(node.id, []);
320
- }
321
- for (const edge of nonLoopbackEdges) {
322
- const neighbors = adjacencyMap.get(edge.source);
323
- if (neighbors) {
324
- neighbors.push(edge.target);
325
- }
326
- }
327
- // Check for cycles using only non-loopback edges
328
- const visited = new Set();
329
- const recursionStack = new Set();
330
- /**
331
- * DFS utility to detect cycles in the graph
332
- * @param nodeId - Current node being visited
333
- * @returns True if a cycle is found from this node
334
- */
335
- function hasCycleUtil(nodeId) {
336
- if (recursionStack.has(nodeId))
337
- return true;
338
- if (visited.has(nodeId))
339
- return false;
340
- visited.add(nodeId);
341
- recursionStack.add(nodeId);
342
- // Use pre-built adjacency map instead of filtering all edges each call
343
- const neighbors = adjacencyMap.get(nodeId) || [];
344
- for (const target of neighbors) {
345
- if (hasCycleUtil(target))
346
- return true;
347
- }
348
- recursionStack.delete(nodeId);
349
- return false;
350
- }
351
- // Check each node for cycles
352
- for (const node of nodes) {
353
- if (!visited.has(node.id)) {
354
- if (hasCycleUtil(node.id))
355
- return true;
356
- }
357
- }
358
- return false;
322
+ return detectCycles(nodes, nonLoopbackEdges);
359
323
  }
360
324
  /**
361
325
  * Get the execution order for a workflow (topological sort)