@flowdrop/flowdrop 2.13.0 → 2.15.0

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 (308) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/commands/executor.js +58 -8
  3. package/dist/commands/parser.js +3 -3
  4. package/dist/commands/types.d.ts +8 -2
  5. package/dist/commands/uiActionTarget.d.ts +24 -0
  6. package/dist/commands/uiActionTarget.js +31 -0
  7. package/dist/commands/validate.d.ts +15 -0
  8. package/dist/commands/validate.js +115 -0
  9. package/dist/components/App.svelte +44 -2
  10. package/dist/components/App.svelte.d.ts +3 -1
  11. package/dist/components/Button.svelte +7 -7
  12. package/dist/components/Button.svelte.d.ts +10 -0
  13. package/dist/components/CanvasBanner.svelte +19 -6
  14. package/dist/components/CanvasBanner.svelte.d.ts +15 -3
  15. package/dist/components/CanvasContextMenu.svelte +9 -9
  16. package/dist/components/CanvasContextMenu.svelte.d.ts +10 -0
  17. package/dist/components/CanvasToolbar.svelte +8 -7
  18. package/dist/components/CanvasToolbar.svelte.d.ts +10 -0
  19. package/dist/components/CanvasZoomControls.svelte +10 -9
  20. package/dist/components/CanvasZoomControls.svelte.d.ts +13 -0
  21. package/dist/components/ConfigForm.svelte +51 -18
  22. package/dist/components/ConfigForm.svelte.d.ts +20 -1
  23. package/dist/components/ConfigPanel.svelte +9 -5
  24. package/dist/components/ConfigPanel.svelte.d.ts +10 -0
  25. package/dist/components/EditorStatusBar.svelte +6 -5
  26. package/dist/components/EditorStatusBar.svelte.d.ts +7 -0
  27. package/dist/components/ExternalLinkRow.svelte +16 -1
  28. package/dist/components/ExternalLinkRow.svelte.d.ts +5 -0
  29. package/dist/components/FlowDropEdge.svelte +15 -12
  30. package/dist/components/FlowDropEdge.svelte.d.ts +16 -0
  31. package/dist/components/InterfaceTag.svelte +13 -15
  32. package/dist/components/InterfaceTag.svelte.d.ts +19 -0
  33. package/dist/components/LoadingSpinner.svelte +8 -2
  34. package/dist/components/LoadingSpinner.svelte.d.ts +9 -0
  35. package/dist/components/Logo.svelte +11 -0
  36. package/dist/components/Logo.svelte.d.ts +9 -0
  37. package/dist/components/LogoWordmark.svelte +8 -3
  38. package/dist/components/LogoWordmark.svelte.d.ts +9 -0
  39. package/dist/components/LoopbackLanes.svelte +12 -6
  40. package/dist/components/LoopbackLanes.svelte.d.ts +13 -0
  41. package/dist/components/MarkdownDisplay.svelte +10 -3
  42. package/dist/components/MarkdownDisplay.svelte.d.ts +11 -0
  43. package/dist/components/Navbar.svelte +13 -5
  44. package/dist/components/Navbar.svelte.d.ts +14 -0
  45. package/dist/components/NodeInspector.svelte +7 -8
  46. package/dist/components/NodeInspector.svelte.d.ts +10 -0
  47. package/dist/components/NodeSidebar.svelte +9 -3
  48. package/dist/components/NodeSidebar.svelte.d.ts +10 -0
  49. package/dist/components/NodeStatusOverlay.svelte +30 -19
  50. package/dist/components/NodeStatusOverlay.svelte.d.ts +19 -0
  51. package/dist/components/NodeSwapPicker.svelte +1 -1
  52. package/dist/components/RunBar.svelte +10 -13
  53. package/dist/components/RunBar.svelte.d.ts +15 -0
  54. package/dist/components/RunsMenu.svelte +14 -13
  55. package/dist/components/RunsMenu.svelte.d.ts +15 -0
  56. package/dist/components/SchemaForm.svelte +10 -13
  57. package/dist/components/SchemaForm.svelte.d.ts +51 -0
  58. package/dist/components/SettingsPanel.svelte +5 -5
  59. package/dist/components/StatusIcon.svelte +14 -3
  60. package/dist/components/StatusIcon.svelte.d.ts +15 -0
  61. package/dist/components/StatusLabel.svelte +10 -2
  62. package/dist/components/StatusLabel.svelte.d.ts +11 -0
  63. package/dist/components/ThemeToggle.svelte +8 -5
  64. package/dist/components/ThemeToggle.svelte.d.ts +10 -0
  65. package/dist/components/UniversalNode.svelte +13 -5
  66. package/dist/components/UniversalNode.svelte.d.ts +15 -0
  67. package/dist/components/WorkflowInterfaceEntryCard.svelte +1 -1
  68. package/dist/components/WorkflowInterfaceEntryComposer.svelte +1 -2
  69. package/dist/components/ZoomTier.svelte +13 -10
  70. package/dist/components/ZoomTier.svelte.d.ts +14 -0
  71. package/dist/components/console/CommandConsole.svelte +9 -3
  72. package/dist/components/console/CommandConsole.svelte.d.ts +10 -0
  73. package/dist/components/console/ConsoleAutocomplete.svelte +4 -4
  74. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +5 -0
  75. package/dist/components/console/ConsoleInput.svelte +6 -4
  76. package/dist/components/console/ConsoleInput.svelte.d.ts +7 -0
  77. package/dist/components/console/ConsoleOutput.svelte +5 -3
  78. package/dist/components/console/ConsoleOutput.svelte.d.ts +6 -0
  79. package/dist/components/console/ConsoleStrip.svelte +9 -5
  80. package/dist/components/console/ConsoleStrip.svelte.d.ts +10 -0
  81. package/dist/components/form/FieldFactory.svelte +6 -2
  82. package/dist/components/form/FieldFactory.svelte.d.ts +46 -0
  83. package/dist/components/form/FormArray.svelte +9 -16
  84. package/dist/components/form/FormArray.svelte.d.ts +10 -0
  85. package/dist/components/form/FormArrayRows.svelte +8 -8
  86. package/dist/components/form/FormArrayRows.svelte.d.ts +11 -0
  87. package/dist/components/form/FormAutocomplete.svelte +6 -3
  88. package/dist/components/form/FormAutocomplete.svelte.d.ts +23 -0
  89. package/dist/components/form/FormCheckboxGroup.svelte +5 -5
  90. package/dist/components/form/FormCheckboxGroup.svelte.d.ts +6 -0
  91. package/dist/components/form/FormCodeEditor.svelte +8 -13
  92. package/dist/components/form/FormCodeEditor.svelte.d.ts +9 -0
  93. package/dist/components/form/FormField.svelte +7 -8
  94. package/dist/components/form/FormField.svelte.d.ts +10 -0
  95. package/dist/components/form/FormFieldLight.svelte +6 -5
  96. package/dist/components/form/FormFieldLight.svelte.d.ts +8 -0
  97. package/dist/components/form/FormFieldWrapper.svelte +8 -8
  98. package/dist/components/form/FormFieldWrapper.svelte.d.ts +9 -0
  99. package/dist/components/form/FormFieldset.svelte +6 -12
  100. package/dist/components/form/FormFieldset.svelte.d.ts +7 -0
  101. package/dist/components/form/FormMarkdownEditor.svelte +8 -15
  102. package/dist/components/form/FormMarkdownEditor.svelte.d.ts +9 -0
  103. package/dist/components/form/FormNumberField.svelte +5 -7
  104. package/dist/components/form/FormNumberField.svelte.d.ts +6 -0
  105. package/dist/components/form/FormPorts.svelte +133 -27
  106. package/dist/components/form/FormPorts.svelte.d.ts +19 -0
  107. package/dist/components/form/FormRangeField.svelte +5 -9
  108. package/dist/components/form/FormRangeField.svelte.d.ts +6 -0
  109. package/dist/components/form/FormSelect.svelte +5 -7
  110. package/dist/components/form/FormSelect.svelte.d.ts +6 -0
  111. package/dist/components/form/FormTemplateEditor.svelte +8 -16
  112. package/dist/components/form/FormTemplateEditor.svelte.d.ts +9 -0
  113. package/dist/components/form/FormTextField.svelte +5 -7
  114. package/dist/components/form/FormTextField.svelte.d.ts +6 -0
  115. package/dist/components/form/FormTextarea.svelte +5 -7
  116. package/dist/components/form/FormTextarea.svelte.d.ts +6 -0
  117. package/dist/components/form/FormToggle.svelte +6 -8
  118. package/dist/components/form/FormToggle.svelte.d.ts +7 -0
  119. package/dist/components/form/FormUISchemaRenderer.svelte +5 -9
  120. package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +7 -0
  121. package/dist/components/interrupt/ChoicePrompt.svelte +6 -6
  122. package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +7 -0
  123. package/dist/components/interrupt/ConfirmationPrompt.svelte +6 -5
  124. package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +7 -0
  125. package/dist/components/interrupt/FormPrompt.svelte +6 -6
  126. package/dist/components/interrupt/FormPrompt.svelte.d.ts +7 -0
  127. package/dist/components/interrupt/InterruptBubble.svelte +10 -9
  128. package/dist/components/interrupt/InterruptBubble.svelte.d.ts +11 -0
  129. package/dist/components/interrupt/ReviewPrompt.svelte +5 -6
  130. package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +7 -0
  131. package/dist/components/interrupt/TextInputPrompt.svelte +6 -6
  132. package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +7 -0
  133. package/dist/components/nodes/AtomNode.svelte +31 -6
  134. package/dist/components/nodes/AtomNode.svelte.d.ts +15 -0
  135. package/dist/components/nodes/CaptionNode.svelte +50 -7
  136. package/dist/components/nodes/CaptionNode.svelte.d.ts +13 -0
  137. package/dist/components/nodes/GatewayNode.svelte +18 -11
  138. package/dist/components/nodes/GatewayNode.svelte.d.ts +21 -0
  139. package/dist/components/nodes/IdeaNode.svelte +47 -6
  140. package/dist/components/nodes/IdeaNode.svelte.d.ts +17 -0
  141. package/dist/components/nodes/NodeCard.svelte +26 -18
  142. package/dist/components/nodes/NodeCard.svelte.d.ts +20 -0
  143. package/dist/components/nodes/NodeConfigButton.svelte +15 -2
  144. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +11 -0
  145. package/dist/components/nodes/NodeProblemMark.svelte +15 -10
  146. package/dist/components/nodes/NodeProblemMark.svelte.d.ts +16 -0
  147. package/dist/components/nodes/NodeTip.svelte +10 -7
  148. package/dist/components/nodes/NodeTip.svelte.d.ts +13 -0
  149. package/dist/components/nodes/NotesNode.svelte +30 -0
  150. package/dist/components/nodes/NotesNode.svelte.d.ts +14 -0
  151. package/dist/components/nodes/SimpleNode.svelte +35 -8
  152. package/dist/components/nodes/SimpleNode.svelte.d.ts +17 -0
  153. package/dist/components/nodes/SquareNode.svelte +38 -8
  154. package/dist/components/nodes/SquareNode.svelte.d.ts +17 -0
  155. package/dist/components/nodes/TerminalNode.svelte +24 -10
  156. package/dist/components/nodes/TerminalNode.svelte.d.ts +17 -0
  157. package/dist/components/nodes/ToolNode.svelte +14 -5
  158. package/dist/components/nodes/ToolNode.svelte.d.ts +15 -0
  159. package/dist/components/nodes/WorkflowNode.svelte +18 -15
  160. package/dist/components/nodes/WorkflowNode.svelte.d.ts +21 -0
  161. package/dist/components/playground/ChatBubble.svelte +4 -3
  162. package/dist/components/playground/ChatBubble.svelte.d.ts +5 -0
  163. package/dist/components/playground/ChatInput.svelte +11 -6
  164. package/dist/components/playground/ChatInput.svelte.d.ts +14 -0
  165. package/dist/components/playground/ChatPanel.svelte +15 -7
  166. package/dist/components/playground/ChatPanel.svelte.d.ts +17 -0
  167. package/dist/components/playground/ControlPanel.svelte +26 -9
  168. package/dist/components/playground/ControlPanel.svelte.d.ts +29 -0
  169. package/dist/components/playground/DockedPlayground.svelte +7 -10
  170. package/dist/components/playground/DockedPlayground.svelte.d.ts +10 -0
  171. package/dist/components/playground/ExecutionConsole.svelte +10 -5
  172. package/dist/components/playground/ExecutionConsole.svelte.d.ts +12 -0
  173. package/dist/components/playground/ExecutionList.svelte +13 -0
  174. package/dist/components/playground/ExecutionList.svelte.d.ts +11 -0
  175. package/dist/components/playground/ExecutionLogs.svelte +6 -9
  176. package/dist/components/playground/ExecutionLogs.svelte.d.ts +7 -0
  177. package/dist/components/playground/HeaderMenu.svelte +6 -8
  178. package/dist/components/playground/HeaderMenu.svelte.d.ts +9 -0
  179. package/dist/components/playground/HierarchyTrail.svelte +6 -6
  180. package/dist/components/playground/HierarchyTrail.svelte.d.ts +8 -0
  181. package/dist/components/playground/InputCollector.svelte +6 -5
  182. package/dist/components/playground/InputCollector.svelte.d.ts +7 -0
  183. package/dist/components/playground/InputFields.svelte +8 -12
  184. package/dist/components/playground/InputFields.svelte.d.ts +9 -0
  185. package/dist/components/playground/InterfaceInputForm.svelte +6 -13
  186. package/dist/components/playground/InterfaceInputForm.svelte.d.ts +9 -0
  187. package/dist/components/playground/InterfaceJsonInput.svelte +6 -5
  188. package/dist/components/playground/InterfaceJsonInput.svelte.d.ts +8 -0
  189. package/dist/components/playground/LogRow.svelte +4 -5
  190. package/dist/components/playground/LogRow.svelte.d.ts +6 -0
  191. package/dist/components/playground/MessageBubble.svelte +13 -7
  192. package/dist/components/playground/MessageBubble.svelte.d.ts +15 -0
  193. package/dist/components/playground/MessageCard.svelte +5 -2
  194. package/dist/components/playground/MessageCard.svelte.d.ts +6 -0
  195. package/dist/components/playground/MessageMarkdown.svelte +8 -9
  196. package/dist/components/playground/MessageMarkdown.svelte.d.ts +11 -0
  197. package/dist/components/playground/MessageNotice.svelte +7 -0
  198. package/dist/components/playground/MessageNotice.svelte.d.ts +5 -0
  199. package/dist/components/playground/MessageStream.svelte +8 -6
  200. package/dist/components/playground/MessageStream.svelte.d.ts +11 -0
  201. package/dist/components/playground/MessageTagChip.svelte +7 -7
  202. package/dist/components/playground/MessageTagChip.svelte.d.ts +10 -0
  203. package/dist/components/playground/MessageTagStrip.svelte +6 -3
  204. package/dist/components/playground/MessageTagStrip.svelte.d.ts +8 -0
  205. package/dist/components/playground/OriginBadge.svelte +7 -4
  206. package/dist/components/playground/OriginBadge.svelte.d.ts +8 -0
  207. package/dist/components/playground/PipelineKanbanView.svelte +14 -0
  208. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +12 -0
  209. package/dist/components/playground/PipelinePanel.svelte +14 -0
  210. package/dist/components/playground/PipelinePanel.svelte.d.ts +12 -0
  211. package/dist/components/playground/PipelineTableView.svelte +14 -0
  212. package/dist/components/playground/PipelineTableView.svelte.d.ts +12 -0
  213. package/dist/components/playground/Playground.svelte +17 -11
  214. package/dist/components/playground/Playground.svelte.d.ts +20 -0
  215. package/dist/components/playground/PlaygroundApp.svelte +24 -10
  216. package/dist/components/playground/PlaygroundApp.svelte.d.ts +26 -0
  217. package/dist/components/playground/PlaygroundHeader.svelte +8 -12
  218. package/dist/components/playground/PlaygroundHeader.svelte.d.ts +11 -0
  219. package/dist/components/playground/PlaygroundModal.svelte +6 -8
  220. package/dist/components/playground/PlaygroundModal.svelte.d.ts +7 -0
  221. package/dist/components/playground/PlaygroundStudio.svelte +9 -0
  222. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +7 -0
  223. package/dist/components/playground/PlaygroundSurface.svelte +19 -14
  224. package/dist/components/playground/PlaygroundSurface.svelte.d.ts +20 -0
  225. package/dist/components/playground/SessionManager.svelte +6 -5
  226. package/dist/components/playground/SessionManager.svelte.d.ts +7 -0
  227. package/dist/components/playground/StepsSummary.svelte +8 -9
  228. package/dist/components/playground/StepsSummary.svelte.d.ts +10 -0
  229. package/dist/components/primitives/Button.svelte +15 -7
  230. package/dist/components/primitives/Button.svelte.d.ts +18 -1
  231. package/dist/components/primitives/Card.svelte +8 -6
  232. package/dist/components/primitives/Card.svelte.d.ts +11 -0
  233. package/dist/components/primitives/Checkbox.svelte +8 -5
  234. package/dist/components/primitives/Checkbox.svelte.d.ts +11 -0
  235. package/dist/components/primitives/Chip.svelte +8 -4
  236. package/dist/components/primitives/Chip.svelte.d.ts +11 -0
  237. package/dist/components/primitives/Combobox.svelte +27 -18
  238. package/dist/components/primitives/Combobox.svelte.d.ts +33 -0
  239. package/dist/components/primitives/Composer.svelte +15 -16
  240. package/dist/components/primitives/Composer.svelte.d.ts +20 -0
  241. package/dist/components/primitives/EmptyState.svelte +9 -3
  242. package/dist/components/primitives/EmptyState.svelte.d.ts +11 -0
  243. package/dist/components/primitives/Field.svelte +12 -9
  244. package/dist/components/primitives/Field.svelte.d.ts +16 -0
  245. package/dist/components/primitives/IconButton.svelte +10 -5
  246. package/dist/components/primitives/IconButton.svelte.d.ts +13 -0
  247. package/dist/components/primitives/Menu.svelte +15 -14
  248. package/dist/components/primitives/Menu.svelte.d.ts +20 -0
  249. package/dist/components/primitives/Notice.svelte +11 -8
  250. package/dist/components/primitives/Notice.svelte.d.ts +14 -0
  251. package/dist/components/primitives/PanelHeader.svelte +10 -7
  252. package/dist/components/primitives/PanelHeader.svelte.d.ts +13 -0
  253. package/dist/components/primitives/Segmented.svelte +11 -4
  254. package/dist/components/primitives/Segmented.svelte.d.ts +14 -0
  255. package/dist/components/primitives/Select.svelte +13 -16
  256. package/dist/components/primitives/Select.svelte.d.ts +18 -0
  257. package/dist/components/primitives/StatusPill.svelte +11 -8
  258. package/dist/components/primitives/StatusPill.svelte.d.ts +15 -0
  259. package/dist/components/primitives/Switch.svelte +9 -6
  260. package/dist/components/primitives/Switch.svelte.d.ts +12 -0
  261. package/dist/components/primitives/Tabs.svelte +16 -15
  262. package/dist/components/primitives/Tabs.svelte.d.ts +22 -0
  263. package/dist/components/primitives/Toolbar.svelte +14 -13
  264. package/dist/components/primitives/Toolbar.svelte.d.ts +18 -0
  265. package/dist/components/primitives/ToolbarSeparator.svelte +5 -4
  266. package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +7 -0
  267. package/dist/core/index.d.ts +2 -2
  268. package/dist/core/index.js +1 -1
  269. package/dist/editor/index.d.ts +3 -3
  270. package/dist/index.d.ts +3 -2
  271. package/dist/layout/index.d.ts +1 -1
  272. package/dist/layout/index.js +1 -1
  273. package/dist/layout/toWorkflow.d.ts +8 -7
  274. package/dist/layout/toWorkflow.js +20 -40
  275. package/dist/messages/defaults.d.ts +24 -0
  276. package/dist/messages/defaults.js +15 -0
  277. package/dist/skins/graphite.d.ts +1 -1
  278. package/dist/skins/graphite.js +1 -1
  279. package/dist/stores/settingsStore.svelte.js +3 -0
  280. package/dist/stores/workflowStore.svelte.d.ts +10 -0
  281. package/dist/stores/workflowStore.svelte.js +65 -20
  282. package/dist/styles/base.css +2 -126
  283. package/dist/styles/tokenAliases.js +1 -0
  284. package/dist/styles/tokens.css +9 -5
  285. package/dist/svelte-app.d.ts +63 -2
  286. package/dist/svelte-app.js +144 -1
  287. package/dist/themes/classic.d.ts +9 -0
  288. package/dist/themes/classic.js +16 -0
  289. package/dist/themes/index.d.ts +7 -2
  290. package/dist/themes/index.js +20 -10
  291. package/dist/types/events.d.ts +18 -1
  292. package/dist/types/index.d.ts +10 -0
  293. package/dist/types/settings.d.ts +6 -2
  294. package/dist/types/theme.d.ts +6 -2
  295. package/dist/utils/externalEdit.svelte.d.ts +48 -0
  296. package/dist/utils/externalEdit.svelte.js +62 -0
  297. package/dist/utils/inspectorContext.d.ts +5 -0
  298. package/dist/utils/playgroundChat.d.ts +10 -0
  299. package/dist/utils/playgroundChat.js +25 -0
  300. package/dist/utils/portExposure.d.ts +24 -1
  301. package/dist/utils/portExposure.js +46 -13
  302. package/dist/utils/portUtils.d.ts +5 -1
  303. package/dist/utils/portUtils.js +15 -4
  304. package/package.json +2 -1
  305. package/dist/components/IconButton.svelte +0 -80
  306. package/dist/components/IconButton.svelte.d.ts +0 -30
  307. package/dist/themes/default.d.ts +0 -2
  308. package/dist/themes/default.js +0 -9
@@ -13,7 +13,7 @@
13
13
  import { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
14
14
  import { WORKFLOW_SCHEMA_VERSION } from '../schemas/index.js';
15
15
  import { interfaceBoundHandles, rewriteInterfaceBindings } from '../utils/workflowInterface.js';
16
- import { followInterfaceInputEdit, rewritePlaygroundReplies, withoutInterfaceTurns } from '../utils/playgroundChat.js';
16
+ import { followInterfaceInputEdit, rewritePlaygroundReplies, withoutInterfaceTurns, withoutRepliesOnNodes } from '../utils/playgroundChat.js';
17
17
  /**
18
18
  * Safely build updated workflow metadata, providing defaults for required fields.
19
19
  *
@@ -128,6 +128,8 @@ export class WorkflowStore {
128
128
  #onDirtyStateChange = null;
129
129
  /** Callback for workflow changes — set by the App component. */
130
130
  #onWorkflowChange = null;
131
+ /** While above 0 the two callbacks above are not called (see {@link muteCallbacks}). */
132
+ #muted = 0;
131
133
  /**
132
134
  * Whether we're currently restoring from history (undo/redo).
133
135
  * When true, prevents pushing to history to avoid recursive loops.
@@ -322,9 +324,8 @@ export class WorkflowStore {
322
324
  markAsSaved() {
323
325
  const wasDirty = this.#editVersion !== this.#savedVersion;
324
326
  this.#savedVersion = this.#editVersion;
325
- if (wasDirty && this.#onDirtyStateChange) {
326
- this.#onDirtyStateChange(false);
327
- }
327
+ if (wasDirty)
328
+ this.#emitDirty(false);
328
329
  }
329
330
  /**
330
331
  * Take the server's word on the workflow's revision and permissions after a
@@ -341,6 +342,34 @@ export class WorkflowStore {
341
342
  ...(state.can !== undefined && { can: state.can })
342
343
  };
343
344
  }
345
+ /**
346
+ * Stop calling the dirty-state and workflow-change callbacks until the
347
+ * returned release is called, e.g. while a change is made and then taken as
348
+ * the workflow's new clean state, which the host should not hear about.
349
+ *
350
+ * On release the host hears only what is still true: the dirty state when it
351
+ * differs from the one at muting, and one `'metadata'` change when the
352
+ * workflow is dirty and was replaced meanwhile. Release is idempotent.
353
+ */
354
+ muteCallbacks() {
355
+ const dirtyBefore = this.isDirty;
356
+ const workflowBefore = this.#workflow;
357
+ this.#muted++;
358
+ let released = false;
359
+ return () => {
360
+ if (released)
361
+ return;
362
+ released = true;
363
+ this.#muted--;
364
+ if (this.#muted > 0)
365
+ return;
366
+ const dirty = this.isDirty;
367
+ if (dirty !== dirtyBefore)
368
+ this.#emitDirty(dirty);
369
+ if (dirty && this.#workflow !== workflowBefore)
370
+ this.#notifyWorkflowChange('metadata');
371
+ };
372
+ }
344
373
  /**
345
374
  * Set the restoring from history flag.
346
375
  *
@@ -360,17 +389,20 @@ export class WorkflowStore {
360
389
  this.#editVersion++;
361
390
  // Dirty state just flipped from clean → dirty
362
391
  if (this.#editVersion - 1 === this.#savedVersion) {
363
- if (this.#onDirtyStateChange) {
364
- this.#onDirtyStateChange(true);
365
- }
392
+ this.#emitDirty(true);
366
393
  }
367
394
  }
395
+ /** Tell the host the dirty state changed, unless the callbacks are muted. */
396
+ #emitDirty(isDirty) {
397
+ if (this.#muted === 0)
398
+ this.#onDirtyStateChange?.(isDirty);
399
+ }
368
400
  /**
369
401
  * Notify external listeners of a workflow change.
370
402
  * Does NOT bump the version — callers that mutate must call #bumpVersion() explicitly.
371
403
  */
372
404
  #notifyWorkflowChange(changeType) {
373
- if (this.#workflow && this.#onWorkflowChange) {
405
+ if (this.#workflow && this.#onWorkflowChange && this.#muted === 0) {
374
406
  this.#onWorkflowChange(this.#workflow, changeType);
375
407
  }
376
408
  }
@@ -394,6 +426,22 @@ export class WorkflowStore {
394
426
  this.#history.push(workflowToPush, { description });
395
427
  }
396
428
  }
429
+ /**
430
+ * The workflow with Playground replies on nodes it lost since the current one
431
+ * dropped, so every way of removing a node (canvas, console, clear) keeps the
432
+ * replies pointing at live nodes. Cheap when nothing is stored: node moves
433
+ * call this on every drag.
434
+ */
435
+ #withoutRepliesOnRemovedNodes(next) {
436
+ const previous = this.#workflow;
437
+ if (!previous || previous.nodes === next.nodes)
438
+ return next;
439
+ if (!next.playground?.chat?.replies?.length)
440
+ return next;
441
+ const kept = new Set(next.nodes.map((node) => node.id));
442
+ const removed = new Set(previous.nodes.map((node) => node.id).filter((id) => !kept.has(id)));
443
+ return withoutRepliesOnNodes(next, removed);
444
+ }
397
445
  // -----------------------------------------------------------------------
398
446
  // Mutation actions
399
447
  // -----------------------------------------------------------------------
@@ -409,9 +457,7 @@ export class WorkflowStore {
409
457
  // Reset version counters — workflow is "clean" after initialization
410
458
  this.#editVersion = 0;
411
459
  this.#savedVersion = 0;
412
- if (this.#onDirtyStateChange) {
413
- this.#onDirtyStateChange(false);
414
- }
460
+ this.#emitDirty(false);
415
461
  // Initialize history with the loaded workflow
416
462
  this.#history.initialize(workflow);
417
463
  }
@@ -422,7 +468,7 @@ export class WorkflowStore {
422
468
  * for every small change. History is pushed by specific actions or drag handlers.
423
469
  */
424
470
  updateWorkflow(workflow) {
425
- this.#workflow = workflow;
471
+ this.#workflow = this.#withoutRepliesOnRemovedNodes(workflow);
426
472
  this.#bumpVersion();
427
473
  this.#notifyWorkflowChange('metadata');
428
474
  }
@@ -452,14 +498,14 @@ export class WorkflowStore {
452
498
  }
453
499
  // Generate unique version identifier
454
500
  const versionId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
455
- this.#workflow = {
501
+ this.#workflow = this.#withoutRepliesOnRemovedNodes({
456
502
  ...this.#workflow,
457
503
  nodes,
458
504
  metadata: buildMetadata(this.#workflow.metadata, {
459
505
  versionId,
460
506
  updateNumber: (this.#workflow.metadata?.updateNumber ?? 0) + 1
461
507
  })
462
- };
508
+ });
463
509
  this.#bumpVersion();
464
510
  this.#notifyWorkflowChange('node_move');
465
511
  }
@@ -518,12 +564,12 @@ export class WorkflowStore {
518
564
  removeNode(nodeId) {
519
565
  if (!this.#workflow)
520
566
  return;
521
- this.#workflow = {
567
+ this.#workflow = this.#withoutRepliesOnRemovedNodes({
522
568
  ...this.#workflow,
523
569
  nodes: this.#workflow.nodes.filter((node) => node.id !== nodeId),
524
570
  edges: this.#workflow.edges.filter((edge) => edge.source !== nodeId && edge.target !== nodeId),
525
571
  metadata: buildMetadata(this.#workflow.metadata)
526
- };
572
+ });
527
573
  this.#pushToHistory('Delete node');
528
574
  this.#bumpVersion();
529
575
  this.#notifyWorkflowChange('node_remove');
@@ -651,9 +697,7 @@ export class WorkflowStore {
651
697
  this.#editVersion = 0;
652
698
  this.#savedVersion = 0;
653
699
  this.#history.clear();
654
- if (this.#onDirtyStateChange) {
655
- this.#onDirtyStateChange(false);
656
- }
700
+ this.#emitDirty(false);
657
701
  }
658
702
  /** Update workflow metadata. */
659
703
  updateMetadata(metadata) {
@@ -675,7 +719,7 @@ export class WorkflowStore {
675
719
  batchUpdate(updates) {
676
720
  if (!this.#workflow)
677
721
  return;
678
- this.#workflow = {
722
+ const next = {
679
723
  ...this.#workflow,
680
724
  ...(updates.nodes && { nodes: updates.nodes }),
681
725
  ...(updates.edges && { edges: updates.edges }),
@@ -692,6 +736,7 @@ export class WorkflowStore {
692
736
  ...('playground' in updates && { playground: updates.playground }),
693
737
  metadata: buildMetadata(this.#workflow.metadata, updates.metadata ?? undefined)
694
738
  };
739
+ this.#workflow = updates.nodes ? this.#withoutRepliesOnRemovedNodes(next) : next;
695
740
  this.#pushToHistory('Batch update');
696
741
  this.#bumpVersion();
697
742
  this.#notifyWorkflowChange('metadata');
@@ -399,8 +399,8 @@
399
399
  }
400
400
 
401
401
  .flowdrop-btn--sm {
402
- /* Same height as IconButton's sm (--fd-size-icon-btn), so the two sit on one
403
- line without callers overriding either. */
402
+ /* The 28px control height (--fd-size-icon-btn), so a small button and an
403
+ icon button sit on one line without callers overriding either. */
404
404
  padding: 0 var(--fd-space-md);
405
405
  font-size: var(--fd-text-xs);
406
406
  min-height: var(--fd-size-icon-btn);
@@ -412,130 +412,6 @@
412
412
  min-height: var(--fd-space-6xl);
413
413
  }
414
414
 
415
- /* ───────────────────────────────────────────────────────────────────────────
416
- Icon buttons — square, icon-only. The typed primitive IconButton.svelte
417
- routes here (the same way Button.svelte routes through .flowdrop-btn). It
418
- composes onto .flowdrop-btn, then overrides geometry to a fixed square and
419
- layers a tint variant. Corners follow --fd-control-radius so the Drafter
420
- theme gets crisp icon buttons alongside its form controls.
421
-
422
- Sizes: md (default) is 32px with a 16px glyph — the dominant size across the
423
- library (form-array actions, modal closes, toolbars). sm maps to the
424
- canonical --fd-size-icon-btn token (28px); lg is 36px (canvas-scale). */
425
- .flowdrop-btn--icon {
426
- width: 2rem;
427
- height: 2rem;
428
- min-height: 0;
429
- padding: 0;
430
- border-radius: var(--fd-control-radius);
431
- color: var(--fd-muted-foreground);
432
- }
433
-
434
- .flowdrop-btn--icon svg {
435
- width: 1rem;
436
- height: 1rem;
437
- }
438
-
439
- .flowdrop-btn--icon.flowdrop-btn--sm {
440
- width: var(--fd-size-icon-btn);
441
- height: var(--fd-size-icon-btn);
442
- padding: 0;
443
- }
444
-
445
- .flowdrop-btn--icon.flowdrop-btn--sm svg {
446
- width: 0.875rem;
447
- height: 0.875rem;
448
- }
449
-
450
- .flowdrop-btn--icon.flowdrop-btn--lg {
451
- width: 2.25rem;
452
- height: 2.25rem;
453
- padding: 0;
454
- }
455
-
456
- .flowdrop-btn--icon.flowdrop-btn--lg svg {
457
- width: 1.125rem;
458
- height: 1.125rem;
459
- }
460
-
461
- /* Ghost (default for icon buttons) — transparent until hover. */
462
- .flowdrop-btn--icon.flowdrop-btn--ghost:hover:not(:disabled) {
463
- background-color: var(--fd-button-ghost-hover);
464
- color: var(--fd-foreground);
465
- border-color: transparent;
466
- }
467
-
468
- /* Default — flat --fd-background surface with a resting border. */
469
- .flowdrop-btn--icon-default {
470
- background-color: var(--fd-background);
471
- border-color: var(--fd-border);
472
- }
473
-
474
- .flowdrop-btn--icon-default:hover:not(:disabled) {
475
- background-color: var(--fd-muted);
476
- color: var(--fd-foreground);
477
- }
478
-
479
- /* Tinted semantic variants — muted fill + semantic border/text, solid on press.
480
- Unlike the solid text-button --primary, the icon flavour stays a quiet tint
481
- so a row of action buttons reads as a group, not a wall of colour. */
482
- .flowdrop-btn--icon-primary {
483
- background-color: var(--fd-primary-muted);
484
- border-color: var(--fd-primary);
485
- color: var(--fd-primary-hover);
486
- }
487
-
488
- .flowdrop-btn--icon-primary:hover:not(:disabled) {
489
- border-color: var(--fd-primary-hover);
490
- color: var(--fd-primary-hover);
491
- }
492
-
493
- .flowdrop-btn--icon-primary:active:not(:disabled) {
494
- background-color: var(--fd-primary);
495
- }
496
-
497
- .flowdrop-btn--icon-danger {
498
- background-color: var(--fd-error-muted);
499
- border-color: var(--fd-error);
500
- color: var(--fd-error);
501
- }
502
-
503
- .flowdrop-btn--icon-danger:hover:not(:disabled) {
504
- border-color: var(--fd-error-hover);
505
- color: var(--fd-error-hover);
506
- }
507
-
508
- .flowdrop-btn--icon-danger:active:not(:disabled) {
509
- background-color: var(--fd-error);
510
- }
511
-
512
- .flowdrop-btn--icon-success {
513
- background-color: var(--fd-success-muted);
514
- border-color: var(--fd-success);
515
- color: var(--fd-success);
516
- }
517
-
518
- .flowdrop-btn--icon-success:hover:not(:disabled) {
519
- border-color: var(--fd-success-hover);
520
- color: var(--fd-success-hover);
521
- }
522
-
523
- .flowdrop-btn--icon-success:active:not(:disabled) {
524
- background-color: var(--fd-success);
525
- }
526
-
527
- /* Active / toggled state (e.g. a pressed canvas control) — primary tint. */
528
- .flowdrop-btn--icon.is-active {
529
- color: var(--fd-primary);
530
- background-color: var(--fd-primary-muted);
531
- border-color: var(--fd-primary);
532
- }
533
-
534
- .flowdrop-btn--icon:disabled {
535
- opacity: 0.35;
536
- cursor: not-allowed;
537
- }
538
-
539
415
  /* ───────────────────────────────────────────────────────────────────────────
540
416
  Form controls — THE single source of truth for input/select/textarea look.
541
417
 
@@ -108,6 +108,7 @@ export const LIGHT_ALIASES = {
108
108
  'node-config-btn-hover-bg': 'var(--fd-muted)',
109
109
  'node-config-btn-hover-border': 'var(--fd-border-strong)',
110
110
  'node-config-btn-radius': 'var(--fd-radius-sm)',
111
+ 'node-config-btn-slot': 'calc(var(--fd-space-xs) + var(--fd-node-config-btn-size) + 4px)',
111
112
  'node-desc-rule': 'var(--fd-border-muted)',
112
113
  'node-group-rule': 'var(--fd-border-muted)',
113
114
  'node-header-bg': 'var(--fd-header)',
@@ -355,7 +355,7 @@
355
355
  --fd-scrollbar-size: 10px; /* @internal scrollbar width in the editor */
356
356
 
357
357
  /* ----- FORM CONTROL, BUTTON, MENU, SHEET AND MODAL KNOBS -----
358
- Defaults reproduce the Default theme; Graphite sets its own (skins/graphite.ts). */
358
+ Defaults reproduce the Classic theme; Graphite sets its own (skins/graphite.ts). */
359
359
  --fd-field-height: auto; /* @internal input/select height; auto = padding + line */
360
360
  --fd-field-height-sm: auto; /* @internal small input/select height */
361
361
  --fd-field-padding: 0.625rem 0.875rem; /* @internal input/select padding */
@@ -563,7 +563,7 @@
563
563
  --fd-navbar-height: 48px; /* @internal — controlled programmatically */
564
564
  --fd-toolbar-height: 40px; /* @internal — controlled programmatically */
565
565
 
566
- /* ----- NAVBAR (defaults reproduce the Default look; Graphite sets quiet values) ----- */
566
+ /* ----- NAVBAR (defaults reproduce the Classic look; Graphite sets quiet values) ----- */
567
567
  --fd-navbar-start-width: 240px; /* @internal width of the logo column */
568
568
  --fd-navbar-logo-height: 24px; /* @internal wordmark lockup height */
569
569
  --fd-navbar-rule-display: none; /* @internal 1px x 16px rule between logo and workflow name */
@@ -702,9 +702,9 @@
702
702
  --fd-node-title-weight: 500; /* @internal */
703
703
  --fd-node-title-clamp: 2; /* @internal title lines before an ellipsis */
704
704
 
705
- /* ----- NODE CARD v2 (G8): category wash header, icon tile, half-pill ports -----
705
+ /* ----- NODE CARD (category wash header, icon tile, half-pill ports) -----
706
706
  Geometry (60px header, 20/40px grid, 280/320 width) is fixed in utils/nodeGeometry.ts and is
707
- not a token: only the look is. Defaults are the Default theme's look; Graphite sets its own. */
707
+ not a token: only the look is. Defaults are the Classic theme's look; Graphite sets its own. */
708
708
  --fd-node-header-wash: 8%; /* @internal how much of the category colour the header surface takes */
709
709
  --fd-node-header-pad-x: 16px; /* @internal header and description-band side padding */
710
710
  --fd-node-tile-size: 32px; /* @internal solid icon tile edge */
@@ -748,6 +748,10 @@
748
748
  --fd-node-halo-mix: 28%; /* @internal port colour in the halo, the rest transparent */
749
749
  --fd-node-halo-breath: 1.8s; /* @internal one breath in (or out) of a port ready to receive */
750
750
  --fd-node-drag-dull-opacity: 0.35; /* @internal a port that does not take the dragged type */
751
+ --fd-node-config-btn-size: 24px; /* @internal the gear's width and height */
752
+ --fd-node-config-btn-slot: calc(
753
+ var(--fd-space-xs) + var(--fd-node-config-btn-size) + 4px
754
+ ); /* @internal room a node keeps for the gear at its top-right: offset, gear and a gap */
751
755
  --fd-node-config-btn-bg: var(--fd-backdrop); /* @internal the gear on a hovered card */
752
756
  --fd-node-config-btn-border: var(--fd-border); /* @internal */
753
757
  --fd-node-config-btn-radius: var(--fd-radius-sm); /* @internal */
@@ -914,7 +918,7 @@
914
918
  --fd-node-border: #4a4a52;
915
919
  --fd-node-border-hover: #5a5a62;
916
920
 
917
- /* ----- NODE CARD v2 (dark) ----- */
921
+ /* ----- NODE CARD (dark) ----- */
918
922
  --fd-node-header-wash: 16%;
919
923
  --fd-node-tile-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
920
924
  --fd-node-pin-open: #7d8594;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module svelte-app
8
8
  */
9
- import type { Workflow, NodeMetadata, PortConfig, CategoryDefinition } from './types/index.js';
9
+ import type { Workflow, NodeMetadata, PortConfig, CategoryDefinition, ConfigSchema } from './types/index.js';
10
10
  import type { EndpointConfig } from './config/endpoints.js';
11
11
  import type { AuthProvider } from './types/auth.js';
12
12
  import type { EditorPlaygroundConfig } from './types/playground.js';
@@ -18,6 +18,7 @@ import { type DraftStorageOption } from './services/draftStorage.js';
18
18
  import type { ColorSchemeOption, PartialSettings, SettingsCategory, SurfacePlacement } from './types/settings.js';
19
19
  import type { NavbarAction, NavbarBranding } from './types/navbar.js';
20
20
  import type { HostHooks, WebMCPHandle, WebMCPMountOptions } from './webmcp/types.js';
21
+ import type { Command, CommandResult } from './commands/types.js';
21
22
  export type { NavbarAction, NavbarBranding };
22
23
  import type { ContextMenuOptions } from './editor/contextMenu.js';
23
24
  export type { HostHooks, WebMCPHandle, WebMCPMountOptions };
@@ -154,7 +155,15 @@ export interface FlowDropMountOptions {
154
155
  * is left untouched. Omit to offer every registered format.
155
156
  */
156
157
  workflowFormats?: string[];
157
- /** Visual theme — named built-in ('default' | 'minimal') or custom theme object */
158
+ /**
159
+ * Extra JSON Schema properties for the Workflow Settings panel. Their values
160
+ * are stored in `workflow.config`: loaded from the workflow passed in,
161
+ * returned by `getWorkflow()` and saved with it. The built-in keys (`name`,
162
+ * `description`, `format`, `interface`, `playground`) are reserved: a
163
+ * property using one is ignored with a console warning.
164
+ */
165
+ workflowSettingsSchema?: ConfigSchema;
166
+ /** Visual theme — named built-in ('graphite' | 'classic' | 'minimal' | 'drafter') or custom theme object */
158
167
  theme?: FlowDropTheme | FlowDropThemeName;
159
168
  /** Which settings tabs to show in the modal (defaults to all) */
160
169
  settingsCategories?: SettingsCategory[];
@@ -207,6 +216,15 @@ export interface FlowDropMountOptions {
207
216
  */
208
217
  contextMenu?: ContextMenuOptions;
209
218
  }
219
+ /** Options for {@link MountedFlowDropApp.runCommand}. */
220
+ export interface RunCommandOptions {
221
+ /**
222
+ * Make the command's result the workflow's clean starting point: no undo
223
+ * step and not dirty. Refused with `code: 'DIRTY'` when the workflow already
224
+ * has unsaved changes.
225
+ */
226
+ baseline?: boolean;
227
+ }
210
228
  /**
211
229
  * Return type for mounted FlowDrop app
212
230
  */
@@ -257,6 +275,49 @@ export interface MountedFlowDropApp {
257
275
  * @returns The number of entries removed.
258
276
  */
259
277
  clearAllDrafts: () => number;
278
+ /**
279
+ * Run one Command Console command against this mount's workflow, as if it
280
+ * had been typed into the console: `await app.runCommand('layout auto')`.
281
+ *
282
+ * `command` is a console line (parsed with the editing DSL) or an already
283
+ * parsed `Command` object. An object is checked first: an unknown `type`, or
284
+ * a field that is missing or of the wrong kind, resolves with
285
+ * `code: 'INVALID_ARGUMENT'` and runs nothing. Never rejects: failures (a
286
+ * line that does not parse, an unknown node, ...) resolve to
287
+ * `{ ok: false, error, code }`.
288
+ *
289
+ * - **Waits for the workflow.** The mount resolves before the editor has
290
+ * loaded its workflow, so a call made right after mounting waits for it.
291
+ * If the mount is destroyed first, or was already destroyed, the call
292
+ * resolves with `{ ok: false, code: 'NO_WORKFLOW' }`.
293
+ * - **One undo step per call**, the same as typing the command in the
294
+ * console; the workflow becomes dirty.
295
+ * - **Sizes before first paint.** `layout auto` reads node sizes the canvas
296
+ * has measured and `layout beautify` asks the mounted canvas to measure
297
+ * them. A call made before the canvas has rendered falls back to computed
298
+ * geometry, so the result can differ slightly from the same command run
299
+ * later.
300
+ * - **`options.baseline`** makes the command's result the workflow's clean
301
+ * starting point: `isDirty()` is `false` afterwards and the undo history
302
+ * starts over from it (earlier undo steps are cleared too). Useful to
303
+ * tidy a loaded model before the user sees it. It needs a workflow with no
304
+ * unsaved changes: when the workflow is dirty the command is not run and
305
+ * the call resolves with `{ ok: false, code: 'DIRTY' }`. `undo` and `redo`
306
+ * are refused with `code: 'INVALID_ARGUMENT'`. `onDirtyStateChange` and
307
+ * `onWorkflowChange` are not called for a baseline run; a failed command
308
+ * that still left changes is reported once it returns. A failed command,
309
+ * or one that changes nothing (`info`, `list nodes`), keeps the undo
310
+ * history. A draft saved earlier is not overwritten by the re-baselined
311
+ * workflow.
312
+ * - **Read-only mounts** (`mode: 'readonly' | 'locked'`) accept it too, so a
313
+ * host can lay out a model it only displays.
314
+ * - **UI actions** (select a node, open its config panel, fit/zoom/pan) are
315
+ * applied by `mountFlowDropApp`'s editor shell. `mountWorkflowEditor` has
316
+ * no shell, so they are dropped there.
317
+ * - **Session commands** (`session ...`) belong to the console and are not
318
+ * available: they resolve with `{ ok: false, code: 'SESSION_REFUSED' }`.
319
+ */
320
+ runCommand: (command: string | Command, options?: RunCommandOptions) => Promise<CommandResult>;
260
321
  /**
261
322
  * The WebMCP registration when the `webmcp` mount option was set and the
262
323
  * browser has the API; `undefined` otherwise. The adapter attaches in the