@flowdrop/flowdrop 2.11.0 → 2.13.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 (455) hide show
  1. package/CHANGELOG.md +233 -0
  2. package/dist/adapters/agentspec/autoLayout.d.ts +18 -36
  3. package/dist/adapters/agentspec/autoLayout.js +75 -93
  4. package/dist/chat/activity.d.ts +49 -0
  5. package/dist/chat/activity.js +65 -0
  6. package/dist/chat/commandClassifier.js +2 -1
  7. package/dist/commands/executor.js +186 -27
  8. package/dist/commands/index.d.ts +2 -1
  9. package/dist/commands/index.js +2 -0
  10. package/dist/commands/parser.js +43 -3
  11. package/dist/commands/session.d.ts +60 -0
  12. package/dist/commands/session.js +332 -0
  13. package/dist/commands/storeIntegration.svelte.js +18 -1
  14. package/dist/commands/types.d.ts +77 -4
  15. package/dist/components/App.svelte +976 -226
  16. package/dist/components/App.svelte.d.ts +34 -2
  17. package/dist/components/BindablePortListbox.svelte +68 -369
  18. package/dist/components/Button.svelte +17 -14
  19. package/dist/components/Button.svelte.d.ts +2 -2
  20. package/dist/components/CanvasContextMenu.svelte +31 -10
  21. package/dist/components/CanvasController.svelte +146 -3
  22. package/dist/components/CanvasController.svelte.d.ts +25 -33
  23. package/dist/components/CanvasIconButton.svelte +6 -6
  24. package/dist/components/CanvasToolbar.svelte +103 -0
  25. package/dist/components/CanvasToolbar.svelte.d.ts +23 -0
  26. package/dist/components/CanvasZoomControls.svelte +122 -0
  27. package/dist/components/CanvasZoomControls.svelte.d.ts +15 -0
  28. package/dist/components/ConfigForm.svelte +159 -121
  29. package/dist/components/ConfigModal.svelte +11 -54
  30. package/dist/components/ConfigPanel.svelte +98 -228
  31. package/dist/components/ConfigPanel.svelte.d.ts +2 -2
  32. package/dist/components/ConnectPortPicker.svelte +153 -0
  33. package/dist/components/ConnectPortPicker.svelte.d.ts +22 -0
  34. package/dist/components/DoctorMenu.svelte +422 -0
  35. package/dist/components/DoctorMenu.svelte.d.ts +7 -0
  36. package/dist/components/ExternalLinkRow.svelte +82 -0
  37. package/dist/components/ExternalLinkRow.svelte.d.ts +14 -0
  38. package/dist/components/FlowDropEdge.svelte +52 -2
  39. package/dist/components/FlowDropEdge.svelte.d.ts +5 -1
  40. package/dist/components/InterfaceNameInput.svelte +103 -0
  41. package/dist/components/InterfaceNameInput.svelte.d.ts +13 -0
  42. package/dist/components/InterfaceTag.svelte +215 -0
  43. package/dist/components/InterfaceTag.svelte.d.ts +20 -0
  44. package/dist/components/InterfaceTagAnchor.svelte +103 -0
  45. package/dist/components/InterfaceTagAnchor.svelte.d.ts +12 -0
  46. package/dist/components/InterfaceTagLayer.svelte +314 -0
  47. package/dist/components/InterfaceTagLayer.svelte.d.ts +28 -0
  48. package/dist/components/LogsSidebar.svelte +43 -43
  49. package/dist/components/LoopbackLanes.svelte +54 -0
  50. package/dist/components/LoopbackLanes.svelte.d.ts +8 -0
  51. package/dist/components/Navbar.svelte +539 -169
  52. package/dist/components/Navbar.svelte.d.ts +20 -1
  53. package/dist/components/NodeInspector.svelte +153 -0
  54. package/dist/components/NodeInspector.svelte.d.ts +19 -0
  55. package/dist/components/NodeLastRun.svelte +212 -0
  56. package/dist/components/NodeLastRun.svelte.d.ts +13 -0
  57. package/dist/components/NodeSidebar.svelte +279 -23
  58. package/dist/components/NodeSidebar.svelte.d.ts +11 -0
  59. package/dist/components/NodeStatusOverlay.svelte +144 -353
  60. package/dist/components/NodeStatusOverlay.svelte.d.ts +4 -1
  61. package/dist/components/PortMappingRow.svelte +28 -44
  62. package/dist/components/PortPickerListbox.svelte +475 -0
  63. package/dist/components/PortPickerListbox.svelte.d.ts +73 -0
  64. package/dist/components/ReadOnlyDetails.svelte +52 -89
  65. package/dist/components/RunBar.svelte +222 -0
  66. package/dist/components/RunBar.svelte.d.ts +20 -0
  67. package/dist/components/RunsMenu.svelte +649 -0
  68. package/dist/components/RunsMenu.svelte.d.ts +14 -0
  69. package/dist/components/SettingsModal.svelte +27 -59
  70. package/dist/components/SettingsPanel.svelte +515 -241
  71. package/dist/components/StraightGuides.svelte +46 -0
  72. package/dist/components/StraightGuides.svelte.d.ts +7 -0
  73. package/dist/components/ThemeToggle.svelte +14 -4
  74. package/dist/components/UniversalNode.svelte +152 -51
  75. package/dist/components/WebMCPBridgeMenu.svelte +336 -0
  76. package/dist/components/WebMCPBridgeMenu.svelte.d.ts +3 -0
  77. package/dist/components/WorkflowEditor.svelte +789 -136
  78. package/dist/components/WorkflowEditor.svelte.d.ts +43 -1
  79. package/dist/components/WorkflowInterfaceEditor.svelte +63 -92
  80. package/dist/components/WorkflowInterfaceEntryCard.svelte +478 -549
  81. package/dist/components/WorkflowInterfaceEntryComposer.svelte +23 -67
  82. package/dist/components/WorkflowPlaygroundSettings.svelte +48 -85
  83. package/dist/components/WorkflowSettingsPanel.svelte +311 -0
  84. package/dist/components/WorkflowSettingsPanel.svelte.d.ts +20 -0
  85. package/dist/components/ZoomTier.svelte +56 -0
  86. package/dist/components/ZoomTier.svelte.d.ts +4 -0
  87. package/dist/components/chat/AIChatPanel.svelte +463 -312
  88. package/dist/components/chat/ActivityList.svelte +130 -0
  89. package/dist/components/chat/ActivityList.svelte.d.ts +11 -0
  90. package/dist/components/chat/ActivityRow.svelte +179 -0
  91. package/dist/components/chat/ActivityRow.svelte.d.ts +16 -0
  92. package/dist/components/chat/CommandPreview.svelte +42 -64
  93. package/dist/components/console/CommandConsole.svelte +106 -41
  94. package/dist/components/console/CommandConsole.svelte.d.ts +2 -0
  95. package/dist/components/console/ConsoleAutocomplete.svelte +14 -13
  96. package/dist/components/console/ConsoleInput.svelte +60 -27
  97. package/dist/components/console/ConsoleOutput.svelte +86 -24
  98. package/dist/components/console/ConsoleStrip.svelte +80 -0
  99. package/dist/components/console/ConsoleStrip.svelte.d.ts +13 -0
  100. package/dist/components/form/FieldFactory.svelte +30 -4
  101. package/dist/components/form/FormArray.svelte +306 -339
  102. package/dist/components/form/FormArray.svelte.d.ts +10 -0
  103. package/dist/components/form/FormArrayRows.svelte +443 -0
  104. package/dist/components/form/FormArrayRows.svelte.d.ts +18 -0
  105. package/dist/components/form/FormAutocomplete.svelte +2 -2
  106. package/dist/components/form/FormCheckboxGroup.svelte +10 -85
  107. package/dist/components/form/FormCodeEditor.svelte +3 -3
  108. package/dist/components/form/FormFieldWrapper.svelte +98 -18
  109. package/dist/components/form/FormFieldWrapper.svelte.d.ts +10 -0
  110. package/dist/components/form/FormFieldset.svelte +44 -28
  111. package/dist/components/form/FormMarkdownEditor.svelte +6 -6
  112. package/dist/components/form/FormPorts.svelte +437 -141
  113. package/dist/components/form/FormSelect.svelte +1 -1
  114. package/dist/components/form/FormTemplateEditor.svelte +22 -26
  115. package/dist/components/form/FormToggle.svelte +15 -106
  116. package/dist/components/form/FormToggle.svelte.d.ts +3 -2
  117. package/dist/components/form/FormUISchemaRenderer.svelte +38 -3
  118. package/dist/components/form/humanizeKey.d.ts +7 -0
  119. package/dist/components/form/humanizeKey.js +21 -0
  120. package/dist/components/form/types.d.ts +6 -0
  121. package/dist/components/icons/MenuOpenIcon.svelte +8 -1
  122. package/dist/components/interrupt/ChoicePrompt.svelte +51 -152
  123. package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +0 -2
  124. package/dist/components/interrupt/ConfirmationPrompt.svelte +18 -201
  125. package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +0 -4
  126. package/dist/components/interrupt/FormPrompt.svelte +22 -147
  127. package/dist/components/interrupt/FormPrompt.svelte.d.ts +0 -4
  128. package/dist/components/interrupt/InterruptBubble.svelte +198 -355
  129. package/dist/components/interrupt/InterruptBubble.svelte.d.ts +0 -2
  130. package/dist/components/interrupt/ReviewPrompt.svelte +0 -10
  131. package/dist/components/interrupt/TextInputPrompt.svelte +23 -120
  132. package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +0 -2
  133. package/dist/components/layouts/MainLayout.svelte +110 -75
  134. package/dist/components/layouts/MainLayout.svelte.d.ts +17 -0
  135. package/dist/components/nodes/CaptionNode.svelte +7 -0
  136. package/dist/components/nodes/GatewayNode.svelte +66 -431
  137. package/dist/components/nodes/IdeaNode.svelte +6 -5
  138. package/dist/components/nodes/NodeCard.svelte +1051 -0
  139. package/dist/components/nodes/NodeCard.svelte.d.ts +30 -0
  140. package/dist/components/nodes/NodeConfigButton.svelte +28 -9
  141. package/dist/components/nodes/NodeProblemMark.svelte +113 -0
  142. package/dist/components/nodes/NodeProblemMark.svelte.d.ts +8 -0
  143. package/dist/components/nodes/NodeTip.svelte +104 -0
  144. package/dist/components/nodes/NodeTip.svelte.d.ts +15 -0
  145. package/dist/components/nodes/NotesNode.svelte +183 -150
  146. package/dist/components/nodes/SimpleNode.svelte +176 -44
  147. package/dist/components/nodes/SquareNode.svelte +127 -34
  148. package/dist/components/nodes/TerminalNode.svelte +232 -88
  149. package/dist/components/nodes/ToolNode.svelte +49 -381
  150. package/dist/components/nodes/WorkflowNode.svelte +40 -399
  151. package/dist/components/playground/ChatBubble.svelte +248 -62
  152. package/dist/components/playground/ChatInput.svelte +134 -297
  153. package/dist/components/playground/ChatInput.svelte.d.ts +17 -0
  154. package/dist/components/playground/ControlPanel.svelte +290 -190
  155. package/dist/components/playground/ControlPanel.svelte.d.ts +10 -2
  156. package/dist/components/playground/DockedPlayground.svelte +82 -0
  157. package/dist/components/playground/DockedPlayground.svelte.d.ts +30 -0
  158. package/dist/components/playground/ExecutionConsole.svelte +54 -36
  159. package/dist/components/playground/ExecutionConsole.svelte.d.ts +12 -0
  160. package/dist/components/playground/ExecutionLogs.svelte +4 -0
  161. package/dist/components/playground/HeaderMenu.svelte +170 -0
  162. package/dist/components/playground/HeaderMenu.svelte.d.ts +22 -0
  163. package/dist/components/playground/InputCollector.svelte +8 -32
  164. package/dist/components/playground/InputFields.svelte +246 -0
  165. package/dist/components/playground/InputFields.svelte.d.ts +16 -0
  166. package/dist/components/playground/InterfaceInputForm.svelte +285 -30
  167. package/dist/components/playground/InterfaceInputForm.svelte.d.ts +20 -0
  168. package/dist/components/playground/InterfaceJsonInput.svelte +92 -0
  169. package/dist/components/playground/InterfaceJsonInput.svelte.d.ts +10 -0
  170. package/dist/components/playground/LogRow.svelte +12 -12
  171. package/dist/components/playground/MessageMarkdown.svelte +11 -11
  172. package/dist/components/playground/MessageStream.svelte +154 -182
  173. package/dist/components/playground/Playground.svelte +17 -1139
  174. package/dist/components/playground/PlaygroundApp.svelte +12 -2
  175. package/dist/components/playground/PlaygroundApp.svelte.d.ts +2 -1
  176. package/dist/components/playground/PlaygroundHeader.svelte +309 -0
  177. package/dist/components/playground/PlaygroundHeader.svelte.d.ts +22 -0
  178. package/dist/components/playground/PlaygroundModal.svelte +6 -0
  179. package/dist/components/playground/PlaygroundStudio.svelte +30 -32
  180. package/dist/components/playground/PlaygroundSurface.svelte +648 -0
  181. package/dist/components/playground/PlaygroundSurface.svelte.d.ts +79 -0
  182. package/dist/components/playground/StepsSummary.svelte +312 -0
  183. package/dist/components/playground/StepsSummary.svelte.d.ts +11 -0
  184. package/dist/components/playground/messageDisplay.d.ts +9 -0
  185. package/dist/components/playground/messageDisplay.js +24 -2
  186. package/dist/components/playground/stepSummary.d.ts +71 -0
  187. package/dist/components/playground/stepSummary.js +152 -0
  188. package/dist/components/ports/PortTypeBadge.svelte +13 -1
  189. package/dist/components/primitives/Button.svelte +226 -0
  190. package/dist/components/primitives/Button.svelte.d.ts +31 -0
  191. package/dist/components/primitives/Card.svelte +110 -0
  192. package/dist/components/primitives/Card.svelte.d.ts +20 -0
  193. package/dist/components/primitives/Checkbox.svelte +126 -0
  194. package/dist/components/primitives/Checkbox.svelte.d.ts +15 -0
  195. package/dist/components/primitives/Chip.svelte +143 -0
  196. package/dist/components/primitives/Chip.svelte.d.ts +22 -0
  197. package/dist/components/primitives/Combobox.svelte +444 -0
  198. package/dist/components/primitives/Combobox.svelte.d.ts +22 -0
  199. package/dist/components/primitives/Composer.svelte +293 -0
  200. package/dist/components/primitives/Composer.svelte.d.ts +47 -0
  201. package/dist/components/primitives/EmptyState.svelte +113 -0
  202. package/dist/components/primitives/EmptyState.svelte.d.ts +18 -0
  203. package/dist/components/primitives/Field.svelte +178 -0
  204. package/dist/components/primitives/Field.svelte.d.ts +30 -0
  205. package/dist/components/primitives/IconButton.svelte +156 -0
  206. package/dist/components/primitives/IconButton.svelte.d.ts +27 -0
  207. package/dist/components/primitives/Menu.svelte +435 -0
  208. package/dist/components/primitives/Menu.svelte.d.ts +61 -0
  209. package/dist/components/primitives/Notice.svelte +161 -0
  210. package/dist/components/primitives/Notice.svelte.d.ts +22 -0
  211. package/dist/components/primitives/PanelHeader.svelte +134 -0
  212. package/dist/components/primitives/PanelHeader.svelte.d.ts +23 -0
  213. package/dist/components/primitives/Segmented.svelte +198 -0
  214. package/dist/components/primitives/Segmented.svelte.d.ts +32 -0
  215. package/dist/components/primitives/Select.svelte +130 -0
  216. package/dist/components/primitives/Select.svelte.d.ts +26 -0
  217. package/dist/components/primitives/StatusPill.svelte +218 -0
  218. package/dist/components/primitives/StatusPill.svelte.d.ts +24 -0
  219. package/dist/components/primitives/Switch.svelte +113 -0
  220. package/dist/components/primitives/Switch.svelte.d.ts +14 -0
  221. package/dist/components/primitives/Tabs.svelte +209 -0
  222. package/dist/components/primitives/Tabs.svelte.d.ts +32 -0
  223. package/dist/components/primitives/Toolbar.svelte +94 -0
  224. package/dist/components/primitives/Toolbar.svelte.d.ts +14 -0
  225. package/dist/components/primitives/ToolbarSeparator.svelte +40 -0
  226. package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +7 -0
  227. package/dist/components/surfaces/SurfaceOverlay.svelte +10 -40
  228. package/dist/components/surfaces/TabbedSurface.svelte +49 -39
  229. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +8 -0
  230. package/dist/components/toast/DismissibleToast.svelte +94 -32
  231. package/dist/components/toast/DismissibleToast.svelte.d.ts +17 -7
  232. package/dist/config/endpoints.d.ts +43 -1
  233. package/dist/config/endpoints.js +21 -3
  234. package/dist/core/index.d.ts +8 -5
  235. package/dist/core/index.js +1 -1
  236. package/dist/editor/connectCandidates.d.ts +56 -0
  237. package/dist/editor/connectCandidates.js +131 -0
  238. package/dist/editor/contextMenu.d.ts +31 -2
  239. package/dist/editor/contextMenu.js +96 -9
  240. package/dist/editor/index.d.ts +4 -1
  241. package/dist/editor/index.js +1 -0
  242. package/dist/editor/interfaceMenu.d.ts +35 -0
  243. package/dist/editor/interfaceMenu.js +47 -0
  244. package/dist/editor/portMenu.d.ts +23 -0
  245. package/dist/editor/portMenu.js +34 -0
  246. package/dist/editor/tidy.d.ts +30 -0
  247. package/dist/editor/tidy.js +66 -0
  248. package/dist/helpers/workflowEditorHelper.d.ts +3 -0
  249. package/dist/helpers/workflowEditorHelper.js +8 -3
  250. package/dist/layout/fromWorkflow.d.ts +42 -0
  251. package/dist/layout/fromWorkflow.js +135 -0
  252. package/dist/layout/geometry.d.ts +102 -0
  253. package/dist/layout/geometry.js +317 -0
  254. package/dist/layout/index.d.ts +21 -0
  255. package/dist/layout/index.js +14 -0
  256. package/dist/layout/inspect.d.ts +18 -0
  257. package/dist/layout/inspect.js +81 -0
  258. package/dist/layout/lanePath.d.ts +23 -0
  259. package/dist/layout/lanePath.js +47 -0
  260. package/dist/layout/measure.d.ts +141 -0
  261. package/dist/layout/measure.js +477 -0
  262. package/dist/layout/primitives.d.ts +124 -0
  263. package/dist/layout/primitives.js +461 -0
  264. package/dist/layout/sweep.d.ts +59 -0
  265. package/dist/layout/sweep.js +257 -0
  266. package/dist/layout/toWorkflow.d.ts +43 -0
  267. package/dist/layout/toWorkflow.js +131 -0
  268. package/dist/layout/types.d.ts +93 -0
  269. package/dist/layout/types.js +35 -0
  270. package/dist/messages/defaults.d.ts +641 -26
  271. package/dist/messages/defaults.js +578 -25
  272. package/dist/messages/types.d.ts +21 -1
  273. package/dist/openapi/v1/openapi.yaml +109 -0
  274. package/dist/playground/index.d.ts +28 -1
  275. package/dist/playground/index.js +29 -0
  276. package/dist/playground/mount.d.ts +28 -2
  277. package/dist/playground/mount.js +41 -15
  278. package/dist/playground/runAction.d.ts +29 -0
  279. package/dist/playground/runAction.js +38 -0
  280. package/dist/services/doctorService.d.ts +52 -0
  281. package/dist/services/doctorService.js +113 -0
  282. package/dist/services/globalSave.js +12 -29
  283. package/dist/services/nodeExecutionService.d.ts +12 -1
  284. package/dist/services/nodeExecutionService.js +58 -58
  285. package/dist/services/playgroundService.d.ts +17 -2
  286. package/dist/services/playgroundService.js +48 -5
  287. package/dist/services/runsService.d.ts +42 -0
  288. package/dist/services/runsService.js +87 -0
  289. package/dist/services/toastQueue.d.ts +33 -0
  290. package/dist/services/toastQueue.js +38 -0
  291. package/dist/services/toastService.d.ts +30 -9
  292. package/dist/services/toastService.js +81 -46
  293. package/dist/settings/index.d.ts +1 -0
  294. package/dist/skins/graphite.d.ts +26 -0
  295. package/dist/skins/graphite.js +473 -0
  296. package/dist/skins/index.d.ts +2 -1
  297. package/dist/skins/index.js +4 -2
  298. package/dist/skins/slate.js +4 -4
  299. package/dist/stores/attachedRunStore.svelte.d.ts +35 -0
  300. package/dist/stores/attachedRunStore.svelte.js +47 -0
  301. package/dist/stores/connectDragStore.svelte.d.ts +39 -0
  302. package/dist/stores/connectDragStore.svelte.js +42 -0
  303. package/dist/stores/doctorStore.svelte.d.ts +79 -0
  304. package/dist/stores/doctorStore.svelte.js +244 -0
  305. package/dist/stores/editedNodesStore.svelte.d.ts +42 -0
  306. package/dist/stores/editedNodesStore.svelte.js +84 -0
  307. package/dist/stores/editorModeStore.svelte.d.ts +34 -0
  308. package/dist/stores/editorModeStore.svelte.js +55 -0
  309. package/dist/stores/instanceContainer.svelte.d.ts +53 -0
  310. package/dist/stores/instanceContainer.svelte.js +38 -1
  311. package/dist/stores/loopbackLanesStore.svelte.d.ts +18 -0
  312. package/dist/stores/loopbackLanesStore.svelte.js +25 -0
  313. package/dist/stores/nodeHighlightStore.svelte.d.ts +34 -0
  314. package/dist/stores/nodeHighlightStore.svelte.js +56 -0
  315. package/dist/stores/playgroundStore.svelte.d.ts +66 -2
  316. package/dist/stores/playgroundStore.svelte.js +164 -2
  317. package/dist/stores/runController.svelte.d.ts +382 -0
  318. package/dist/stores/runController.svelte.js +1217 -0
  319. package/dist/stores/settingsStore.svelte.d.ts +80 -18
  320. package/dist/stores/settingsStore.svelte.js +180 -62
  321. package/dist/stores/workflowStore.svelte.d.ts +14 -0
  322. package/dist/stores/workflowStore.svelte.js +22 -1
  323. package/dist/styles/base.css +286 -25
  324. package/dist/styles/fonts/Inter-LICENSE.txt +93 -0
  325. package/dist/styles/fonts/inter-latin-wght-normal.woff2 +0 -0
  326. package/dist/styles/fonts/inter.css +19 -0
  327. package/dist/styles/toast.css +100 -20
  328. package/dist/styles/tokenAliases.js +118 -1
  329. package/dist/styles/tokens.css +586 -14
  330. package/dist/svelte-app.d.ts +47 -5
  331. package/dist/svelte-app.js +15 -3
  332. package/dist/themes/graphite.d.ts +2 -0
  333. package/dist/themes/graphite.js +15 -0
  334. package/dist/themes/index.d.ts +2 -1
  335. package/dist/themes/index.js +22 -3
  336. package/dist/themes/minimal.js +10 -0
  337. package/dist/themes/scopedSkinCss.d.ts +22 -5
  338. package/dist/themes/scopedSkinCss.js +136 -11
  339. package/dist/types/chat.d.ts +6 -0
  340. package/dist/types/doctor.d.ts +82 -0
  341. package/dist/types/doctor.js +11 -0
  342. package/dist/types/events.d.ts +35 -0
  343. package/dist/types/events.js +4 -1
  344. package/dist/types/index.d.ts +17 -2
  345. package/dist/types/navbar.d.ts +36 -0
  346. package/dist/types/playground.d.ts +75 -0
  347. package/dist/types/settings.d.ts +120 -7
  348. package/dist/types/settings.js +35 -3
  349. package/dist/types/skin.d.ts +21 -8
  350. package/dist/types/theme.d.ts +40 -2
  351. package/dist/utils/appearance.d.ts +19 -0
  352. package/dist/utils/appearance.js +13 -0
  353. package/dist/utils/canvasFit.d.ts +41 -0
  354. package/dist/utils/canvasFit.js +44 -0
  355. package/dist/utils/chipTitles.d.ts +9 -0
  356. package/dist/utils/chipTitles.js +19 -0
  357. package/dist/utils/connections.js +8 -0
  358. package/dist/utils/consoleHighlight.d.ts +28 -0
  359. package/dist/utils/consoleHighlight.js +269 -0
  360. package/dist/utils/deprecation.d.ts +17 -0
  361. package/dist/utils/deprecation.js +29 -0
  362. package/dist/utils/doctorOperations.d.ts +40 -0
  363. package/dist/utils/doctorOperations.js +237 -0
  364. package/dist/utils/duration.d.ts +13 -0
  365. package/dist/utils/duration.js +40 -0
  366. package/dist/utils/inspectorContext.d.ts +19 -0
  367. package/dist/utils/inspectorContext.js +12 -0
  368. package/dist/utils/inspectorSections.d.ts +20 -0
  369. package/dist/utils/inspectorSections.js +44 -0
  370. package/dist/utils/inspectorSurface.d.ts +46 -0
  371. package/dist/utils/inspectorSurface.js +51 -0
  372. package/dist/utils/interfaceTags.d.ts +102 -0
  373. package/dist/utils/interfaceTags.js +211 -0
  374. package/dist/utils/itemRef.d.ts +86 -0
  375. package/dist/utils/itemRef.js +106 -0
  376. package/dist/utils/lastRun.d.ts +35 -0
  377. package/dist/utils/lastRun.js +73 -0
  378. package/dist/utils/messageNodeLink.d.ts +17 -0
  379. package/dist/utils/messageNodeLink.js +16 -0
  380. package/dist/utils/minimapVisibility.d.ts +28 -0
  381. package/dist/utils/minimapVisibility.js +34 -0
  382. package/dist/utils/nodeAriaLabel.d.ts +12 -0
  383. package/dist/utils/nodeAriaLabel.js +17 -0
  384. package/dist/utils/nodeFingerprint.d.ts +27 -0
  385. package/dist/utils/nodeFingerprint.js +66 -0
  386. package/dist/utils/nodeFormSchema.d.ts +10 -0
  387. package/dist/utils/nodeFormSchema.js +2 -2
  388. package/dist/utils/nodeGeometry.d.ts +168 -0
  389. package/dist/utils/nodeGeometry.js +204 -0
  390. package/dist/utils/nodeProblem.d.ts +19 -0
  391. package/dist/utils/nodeProblem.js +9 -0
  392. package/dist/utils/nodeStatus.d.ts +38 -3
  393. package/dist/utils/nodeStatus.js +67 -39
  394. package/dist/utils/nodeSwap.js +9 -1
  395. package/dist/utils/nodeWrapper.d.ts +1 -0
  396. package/dist/utils/playgroundHistory.d.ts +48 -0
  397. package/dist/utils/playgroundHistory.js +38 -0
  398. package/dist/utils/playgroundInputRuns.d.ts +26 -0
  399. package/dist/utils/playgroundInputRuns.js +50 -0
  400. package/dist/utils/portExposure.d.ts +49 -0
  401. package/dist/utils/portExposure.js +122 -0
  402. package/dist/utils/portUtils.d.ts +16 -0
  403. package/dist/utils/portUtils.js +37 -0
  404. package/dist/utils/portal.d.ts +0 -19
  405. package/dist/utils/portal.js +8 -1
  406. package/dist/utils/reservedPorts.d.ts +59 -0
  407. package/dist/utils/reservedPorts.js +60 -0
  408. package/dist/utils/runEdges.d.ts +24 -0
  409. package/dist/utils/runEdges.js +35 -0
  410. package/dist/utils/runsList.d.ts +69 -0
  411. package/dist/utils/runsList.js +134 -0
  412. package/dist/utils/selectOptions.d.ts +62 -0
  413. package/dist/utils/selectOptions.js +137 -0
  414. package/dist/utils/sessionRuns.d.ts +62 -0
  415. package/dist/utils/sessionRuns.js +123 -0
  416. package/dist/utils/sheetWidths.d.ts +29 -0
  417. package/dist/utils/sheetWidths.js +41 -0
  418. package/dist/utils/sidebarWidths.d.ts +34 -0
  419. package/dist/utils/sidebarWidths.js +47 -0
  420. package/dist/utils/straightWires.d.ts +73 -0
  421. package/dist/utils/straightWires.js +99 -0
  422. package/dist/utils/themeScope.svelte.d.ts +10 -0
  423. package/dist/utils/themeScope.svelte.js +80 -0
  424. package/dist/utils/wiredHandles.d.ts +10 -0
  425. package/dist/utils/wiredHandles.js +14 -0
  426. package/dist/utils/workflowDraft.d.ts +9 -0
  427. package/dist/utils/workflowDraft.js +39 -0
  428. package/dist/utils/workflowInterface.d.ts +40 -7
  429. package/dist/utils/workflowInterface.js +66 -16
  430. package/dist/utils/zoomTier.d.ts +43 -0
  431. package/dist/utils/zoomTier.js +107 -0
  432. package/dist/utils/zoomTierRows.d.ts +41 -0
  433. package/dist/utils/zoomTierRows.js +103 -0
  434. package/dist/webmcp/WebMCPConfirm.svelte +1 -1
  435. package/dist/webmcp/bridge.d.ts +5 -0
  436. package/dist/webmcp/bridge.js +8 -0
  437. package/dist/webmcp/bridgeController.svelte.d.ts +84 -0
  438. package/dist/webmcp/bridgeController.svelte.js +224 -0
  439. package/dist/webmcp/descriptors.d.ts +1 -1
  440. package/dist/webmcp/descriptors.js +66 -5
  441. package/dist/webmcp/fakeWidget.d.ts +34 -0
  442. package/dist/webmcp/fakeWidget.js +75 -0
  443. package/dist/webmcp/gate.js +4 -0
  444. package/dist/webmcp/index.d.ts +2 -0
  445. package/dist/webmcp/index.js +1 -0
  446. package/dist/webmcp/runtime.js +4 -1
  447. package/dist/webmcp/types.d.ts +2 -0
  448. package/dist/webmcp/validate.js +5 -1
  449. package/package.json +8 -2
  450. package/dist/components/Select.svelte +0 -53
  451. package/dist/components/Select.svelte.d.ts +0 -15
  452. package/dist/components/icons/CommandLineIcon.svelte +0 -15
  453. package/dist/components/icons/CommandLineIcon.svelte.d.ts +0 -26
  454. package/dist/components/toast/WarningIcon.svelte +0 -28
  455. package/dist/components/toast/WarningIcon.svelte.d.ts +0 -26
@@ -18,10 +18,18 @@ import { WorkflowStore } from './workflowStore.svelte.js';
18
18
  import { HistoryStore } from './historyStore.svelte.js';
19
19
  import { PlaygroundStore } from './playgroundStore.svelte.js';
20
20
  import { InterruptStore } from './interruptStore.svelte.js';
21
+ import { RunController } from './runController.svelte.js';
21
22
  import { CategoriesStore } from './categoriesStore.svelte.js';
22
23
  import { PortCoordinateStore } from './portCoordinateStore.svelte.js';
23
24
  import { PipelinePanelStore } from './pipelinePanelStore.svelte.js';
24
25
  import { InlineEditStore } from './inlineEditStore.svelte.js';
26
+ import { EditorModeStore } from './editorModeStore.svelte.js';
27
+ import { AttachedRunStore } from './attachedRunStore.svelte.js';
28
+ import { NodeHighlightStore } from './nodeHighlightStore.svelte.js';
29
+ import { ConnectDragStore } from './connectDragStore.svelte.js';
30
+ import { LoopbackLanesStore } from './loopbackLanesStore.svelte.js';
31
+ import { EditedNodesStore } from './editedNodesStore.svelte.js';
32
+ import { DoctorStore } from './doctorStore.svelte.js';
25
33
  import { PlaygroundService, playgroundService } from '../services/playgroundService.js';
26
34
  import { ApiContext } from './apiContext.js';
27
35
  import { PortCompatibilityChecker } from '../utils/connections.js';
@@ -106,13 +114,28 @@ export function createFlowDropInstance(options = {}) {
106
114
  historyBindings.setBeforeNavigateCallback(() => workflow.finalizeNodeConfig());
107
115
  const playground = new PlaygroundStore();
108
116
  const instancePlaygroundService = isDefault ? playgroundService : new PlaygroundService();
117
+ const api = new ApiContext();
118
+ const doctor = new DoctorStore(workflow, api);
119
+ const runs = new RunController({
120
+ playground,
121
+ service: instancePlaygroundService,
122
+ api,
123
+ workflow
124
+ });
125
+ // Reactive, so the loopback lanes recompute once the canvas registers its measurement.
126
+ let measureNodeFn = $state.raw(null);
109
127
  const cleanups = [
110
128
  () => historyBindings.cleanup(),
111
129
  () => historyBindings.setOnRestoreCallback(null),
112
130
  () => historyBindings.setBeforeNavigateCallback(null),
131
+ () => doctor.dispose(),
113
132
  () => workflow.setOnDirtyStateChange(null),
114
133
  () => workflow.setOnWorkflowChange(null),
115
134
  () => playground.dispose(),
135
+ // Drop the surface's options (callbacks into a mounted component).
136
+ () => runs.configure({}),
137
+ // Its host-run poll and session-status subscription.
138
+ () => runs.dispose(),
116
139
  // An owned service stops with its instance. The default one is the shared
117
140
  // singleton and keeps the legacy behavior (outlives its mounts).
118
141
  () => {
@@ -129,8 +152,9 @@ export function createFlowDropInstance(options = {}) {
129
152
  historyBindings,
130
153
  playground,
131
154
  playgroundService: instancePlaygroundService,
155
+ runs,
132
156
  interrupts: new InterruptStore(),
133
- api: new ApiContext(),
157
+ api,
134
158
  nodes: new NodeComponentRegistry({
135
159
  registrations: BUILTIN_NODE_COMPONENTS,
136
160
  defaultType: 'workflowNode'
@@ -143,10 +167,23 @@ export function createFlowDropInstance(options = {}) {
143
167
  // The default instance keeps the legacy bare localStorage key.
144
168
  pipelinePanel: new PipelinePanelStore(id),
145
169
  inlineEdit: new InlineEditStore(),
170
+ editorMode: new EditorModeStore(),
171
+ attachedRun: new AttachedRunStore(),
172
+ highlight: new NodeHighlightStore(),
173
+ connectDrag: new ConnectDragStore(),
174
+ loopbackLanes: new LoopbackLanesStore(),
175
+ editedNodes: new EditedNodesStore(() => workflow.current),
176
+ doctor,
146
177
  nodeTypes: new NodeTypesStore(),
147
178
  host: new HostHooksStore(),
148
179
  approvalGate: null,
149
180
  skinScope: null,
181
+ get measureNode() {
182
+ return measureNodeFn;
183
+ },
184
+ set measureNode(fn) {
185
+ measureNodeFn = fn;
186
+ },
150
187
  onDestroy(fn) {
151
188
  cleanups.push(fn);
152
189
  return () => {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The return lanes of the loopbacks on the canvas, one store per editor.
3
+ *
4
+ * Track assignment needs the whole graph, so the LoopbackLanes component derives every
5
+ * lane once per change (nodes, edges, measured sizes) and the edges only look theirs
6
+ * up by id. Empty until the canvas is measured, and
7
+ * for a loopback whose cards are not measured yet: that edge stays a bezier.
8
+ *
9
+ * @module stores/loopbackLanesStore
10
+ */
11
+ import type { LoopbackLane } from '../layout/geometry.js';
12
+ export declare class LoopbackLanesStore {
13
+ #private;
14
+ /** The lane of an edge, or undefined when it is drawn as a bezier. */
15
+ get(edgeId: string): LoopbackLane | undefined;
16
+ /** Read the lanes through `source` (a derived in the component). Returns the disconnect. */
17
+ connect(source: () => ReadonlyMap<string, LoopbackLane>): () => void;
18
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The return lanes of the loopbacks on the canvas, one store per editor.
3
+ *
4
+ * Track assignment needs the whole graph, so the LoopbackLanes component derives every
5
+ * lane once per change (nodes, edges, measured sizes) and the edges only look theirs
6
+ * up by id. Empty until the canvas is measured, and
7
+ * for a loopback whose cards are not measured yet: that edge stays a bezier.
8
+ *
9
+ * @module stores/loopbackLanesStore
10
+ */
11
+ export class LoopbackLanesStore {
12
+ #source = $state.raw(null);
13
+ /** The lane of an edge, or undefined when it is drawn as a bezier. */
14
+ get(edgeId) {
15
+ return this.#source?.().get(edgeId);
16
+ }
17
+ /** Read the lanes through `source` (a derived in the component). Returns the disconnect. */
18
+ connect(source) {
19
+ this.#source = source;
20
+ return () => {
21
+ if (this.#source === source)
22
+ this.#source = null;
23
+ };
24
+ }
25
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The link between Playground messages and canvas nodes, one store per editor.
3
+ *
4
+ * Hovering a message's node link lights that node on the canvas; hovering or
5
+ * selecting a node lights the messages that came from it. The store holds only
6
+ * what is hovered or selected right now. It never moves the view: a click on a
7
+ * link asks `reveal`, and whoever registered the handler (`App`) decides what
8
+ * that means.
9
+ *
10
+ * @module stores/nodeHighlightStore
11
+ */
12
+ export type RevealHandler = (nodeId: string) => boolean;
13
+ export declare class NodeHighlightStore {
14
+ #private;
15
+ /** The node to light on the canvas: the one whose message link is hovered. */
16
+ get canvasNodeId(): string | null;
17
+ /** The node whose messages to light: the hovered node, else the selected one. */
18
+ get messageNodeId(): string | null;
19
+ /** Whether message links can do anything (an editor registered a handler). */
20
+ get canReveal(): boolean;
21
+ /** A message link is hovered (`null` when the pointer leaves it). */
22
+ hoverLink(nodeId: string | null): void;
23
+ /** A canvas node is hovered (`null` when the pointer leaves it). */
24
+ hoverNode(nodeId: string | null): void;
25
+ /** The node open in the inspector (`null` when none). */
26
+ setSelected(nodeId: string | null): void;
27
+ /**
28
+ * Show a node's last run: select it, open Last run, bring it into view.
29
+ * Returns whether the editor did so (false: no editor, or no such node).
30
+ */
31
+ reveal(nodeId: string): boolean;
32
+ /** Register the editor's reveal handler. Returns the unregister function. */
33
+ setRevealHandler(handler: RevealHandler): () => void;
34
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The link between Playground messages and canvas nodes, one store per editor.
3
+ *
4
+ * Hovering a message's node link lights that node on the canvas; hovering or
5
+ * selecting a node lights the messages that came from it. The store holds only
6
+ * what is hovered or selected right now. It never moves the view: a click on a
7
+ * link asks `reveal`, and whoever registered the handler (`App`) decides what
8
+ * that means.
9
+ *
10
+ * @module stores/nodeHighlightStore
11
+ */
12
+ export class NodeHighlightStore {
13
+ #linkHover = $state(null);
14
+ #nodeHover = $state(null);
15
+ #selected = $state(null);
16
+ #reveal = null;
17
+ /** The node to light on the canvas: the one whose message link is hovered. */
18
+ get canvasNodeId() {
19
+ return this.#linkHover;
20
+ }
21
+ /** The node whose messages to light: the hovered node, else the selected one. */
22
+ get messageNodeId() {
23
+ return this.#nodeHover ?? this.#selected;
24
+ }
25
+ /** Whether message links can do anything (an editor registered a handler). */
26
+ get canReveal() {
27
+ return this.#reveal !== null;
28
+ }
29
+ /** A message link is hovered (`null` when the pointer leaves it). */
30
+ hoverLink(nodeId) {
31
+ this.#linkHover = nodeId;
32
+ }
33
+ /** A canvas node is hovered (`null` when the pointer leaves it). */
34
+ hoverNode(nodeId) {
35
+ this.#nodeHover = nodeId;
36
+ }
37
+ /** The node open in the inspector (`null` when none). */
38
+ setSelected(nodeId) {
39
+ this.#selected = nodeId;
40
+ }
41
+ /**
42
+ * Show a node's last run: select it, open Last run, bring it into view.
43
+ * Returns whether the editor did so (false: no editor, or no such node).
44
+ */
45
+ reveal(nodeId) {
46
+ return this.#reveal?.(nodeId) ?? false;
47
+ }
48
+ /** Register the editor's reveal handler. Returns the unregister function. */
49
+ setRevealHandler(handler) {
50
+ this.#reveal = handler;
51
+ return () => {
52
+ if (this.#reveal === handler)
53
+ this.#reveal = null;
54
+ };
55
+ }
56
+ }
@@ -10,10 +10,15 @@
10
10
  *
11
11
  * @module stores/playgroundStore
12
12
  */
13
- import type { PlaygroundSession, PlaygroundTurnResult, PlaygroundMessage, PlaygroundInputField, PlaygroundSessionStatus, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js';
14
- import type { Workflow, WorkflowInterfaceEntry } from '../types/index.js';
13
+ import type { PlaygroundSession, PlaygroundTurnResult, PlaygroundMessage, PlaygroundInputField, PlaygroundSessionStatus, PlaygroundMessagesApiResponse, PlaygroundExecution, SessionRunsResult, VersionDivider } from '../types/playground.js';
14
+ import type { NodeExecutionInfo, Workflow, WorkflowInterfaceEntry } from '../types/index.js';
15
15
  import { type InterfaceInputsResult, type PlaygroundInputMode } from '../utils/workflowInterface.js';
16
16
  import { type ResolvedPlaygroundChat } from '../utils/playgroundChat.js';
17
+ /** Which workflow and run a set of node statuses was loaded for. */
18
+ export interface NodeStatusScope {
19
+ workflowId: string;
20
+ pipelineId: string;
21
+ }
17
22
  /**
18
23
  * Playground mutation actions for a {@link PlaygroundStore}.
19
24
  *
@@ -31,14 +36,20 @@ export interface PlaygroundStoreActions {
31
36
  addMessage: (message: PlaygroundMessage) => void;
32
37
  addMessages: (newMessages: PlaygroundMessage[]) => void;
33
38
  clearMessages: () => void;
39
+ setSessionRuns: (sessionId: string, result: SessionRunsResult | null) => void;
40
+ setVersionDividers: (sessionId: string, items: VersionDivider[]) => void;
41
+ addVersionDivider: (sessionId: string, divider: VersionDivider) => void;
34
42
  setLoading: (loading: boolean) => void;
35
43
  setError: (errorMessage: string | null) => void;
44
+ setLaunchError: (errorMessage: string | null) => void;
36
45
  updateLastPollSequenceNumber: (seq: number) => void;
37
46
  reset: () => void;
38
47
  switchSession: (sessionId: string) => void;
39
48
  pinExecution: (executionId: string | null) => void;
40
49
  setShowLogs: (value: boolean) => void;
41
50
  toggleShowLogs: () => void;
51
+ setExpandSteps: (value: boolean) => void;
52
+ toggleExpandSteps: () => void;
42
53
  setTurnPending: (value: boolean) => void;
43
54
  lockRunUntilEnabled: () => void;
44
55
  releaseRunLock: () => void;
@@ -77,6 +88,8 @@ export declare class PlaygroundStore {
77
88
  get isLoading(): boolean;
78
89
  /** Error state. */
79
90
  get error(): string | null;
91
+ /** The refusal of the last Run click, for the message under Run. */
92
+ get launchError(): string | null;
80
93
  /** The current workflow. */
81
94
  get currentWorkflow(): Workflow | null;
82
95
  /** The last poll sequence number cursor. */
@@ -157,10 +170,44 @@ export declare class PlaygroundStore {
157
170
  * Pass to PipelinePanel's refreshTrigger prop.
158
171
  */
159
172
  get pipelineRefreshTrigger(): number;
173
+ /**
174
+ * Per-node run status for the workflow on the canvas, keyed by node id.
175
+ *
176
+ * This is the single source the node status overlay draws from. It is kept
177
+ * here, off the node data, so an edit to the graph can neither wipe it nor
178
+ * carry it into the saved workflow.
179
+ */
180
+ get nodeStatuses(): Readonly<Record<string, NodeExecutionInfo>>;
181
+ /** The workflow and run the statuses belong to, or null when there are none. */
182
+ get nodeStatusScope(): NodeStatusScope | null;
183
+ /** One node's run status, or undefined when the shown run has none for it. */
184
+ nodeStatusFor(nodeId: string): NodeExecutionInfo | undefined;
185
+ /** Replace all node statuses with those of one run. */
186
+ setNodeStatuses(statuses: Record<string, NodeExecutionInfo>, scope: NodeStatusScope): void;
187
+ /** Forget the node statuses (a different workflow or run is shown, or none). */
188
+ clearNodeStatuses(): void;
160
189
  /** Whether log messages should be shown in the execution console. */
161
190
  get showLogs(): boolean;
191
+ /** Whether each turn's steps start expanded in the conversation. */
192
+ get expandSteps(): boolean;
162
193
  /** The current session ID, or null. */
163
194
  get currentSessionId(): string | null;
195
+ /**
196
+ * The current session's runs from the runs endpoint (oldest first, each
197
+ * stamped with the workflow version it ran), or `null` before the first load
198
+ * and on a server without the endpoint. The one place the list of a
199
+ * session's runs lives: the dividers are derived from it, and "attach a
200
+ * run" lists it.
201
+ */
202
+ get sessionRuns(): SessionRunsResult | null;
203
+ /** The "Saved, new version" dividers of the current session's feed. */
204
+ get versionDividers(): VersionDivider[];
205
+ /** Keep the runs of a session (`null` forgets them). */
206
+ setSessionRuns(sessionId: string, result: SessionRunsResult | null): void;
207
+ /** Replace a session's dividers. */
208
+ setVersionDividers(sessionId: string, items: VersionDivider[]): void;
209
+ /** Add a divider to a session's feed; one with the same id is not added twice. */
210
+ addVersionDivider(sessionId: string, divider: VersionDivider): void;
164
211
  /** Whether older messages exist before the oldest one currently loaded. */
165
212
  get hasOlder(): boolean;
166
213
  /**
@@ -205,6 +252,8 @@ export declare class PlaygroundStore {
205
252
  setLoading(loading: boolean): void;
206
253
  /** Set an error message (or null to clear). */
207
254
  setError(errorMessage: string | null): void;
255
+ /** Set the Run click's refusal (or null to clear). */
256
+ setLaunchError(errorMessage: string | null): void;
208
257
  /** Update the last poll cursor. */
209
258
  updateLastPollSequenceNumber(seq: number): void;
210
259
  /** Reset all playground state. */
@@ -217,6 +266,10 @@ export declare class PlaygroundStore {
217
266
  setShowLogs(value: boolean): void;
218
267
  /** Toggle log message visibility. */
219
268
  toggleShowLogs(): void;
269
+ /** Set whether turns' steps start expanded. */
270
+ setExpandSteps(value: boolean): void;
271
+ /** Toggle whether turns' steps start expanded. */
272
+ toggleExpandSteps(): void;
220
273
  /** Mark a turn request as in flight (or finished). */
221
274
  setTurnPending(value: boolean): void;
222
275
  /**
@@ -250,6 +303,17 @@ export declare class PlaygroundStore {
250
303
  * backward-pagination response.
251
304
  */
252
305
  setHasOlder(hasOlder: boolean): void;
306
+ /**
307
+ * Listen for session status changes, synchronously.
308
+ *
309
+ * Unlike {@link subscribeToSessionStatus}, which rides an effect and so
310
+ * batches (two changes inside one flush read as one, or as none), the
311
+ * listener runs inside the write that changed the status: once per real
312
+ * change, in order, at the moment it happened. Cleared by {@link dispose}.
313
+ *
314
+ * @returns Function that removes the listener
315
+ */
316
+ onSessionStatusChange(listener: (status: PlaygroundSessionStatus, previous: PlaygroundSessionStatus) => void): () => void;
253
317
  /**
254
318
  * Subscribe to session status changes using $effect.root.
255
319
  * This is designed for use in non-component contexts (e.g., mount.ts).
@@ -66,7 +66,31 @@ function isSubflowMessage(msg) {
66
66
  */
67
67
  export class PlaygroundStore {
68
68
  /** Currently active playground session */
69
- #currentSession = $state(null);
69
+ #sessionState = $state(null);
70
+ /** The current session. Every write goes through the setter below. */
71
+ get #currentSession() {
72
+ return this.#sessionState;
73
+ }
74
+ /**
75
+ * Every write to the current session lands here, so the synchronous
76
+ * status listeners hear each real change of `sessionStatus`, once, at the
77
+ * moment it happens.
78
+ */
79
+ set #currentSession(session) {
80
+ const previous = this.sessionStatus;
81
+ this.#sessionState = session;
82
+ const status = this.sessionStatus;
83
+ if (status === previous)
84
+ return;
85
+ for (const listener of [...this.#statusListeners]) {
86
+ try {
87
+ listener(status, previous);
88
+ }
89
+ catch (err) {
90
+ logger.error('[Playground] Session status listener failed:', err);
91
+ }
92
+ }
93
+ }
70
94
  /** List of all sessions for the current workflow */
71
95
  #sessions = $state([]);
72
96
  /** Messages in the current session */
@@ -77,10 +101,24 @@ export class PlaygroundStore {
77
101
  * set is replaced (session switch / clear).
78
102
  */
79
103
  #hasOlder = $state(false);
104
+ /**
105
+ * The runs of one session as the runs endpoint last reported them, with the
106
+ * session they belong to. Read through {@link sessionRuns}, which answers
107
+ * only for the current session.
108
+ */
109
+ #runsOf = $state.raw(null);
110
+ /** The version dividers of one session — see {@link versionDividers}. */
111
+ #dividersOf = $state.raw(null);
80
112
  /** Whether we are currently loading data */
81
113
  #isLoading = $state(false);
82
114
  /** Current error message, if any */
83
115
  #error = $state(null);
116
+ /**
117
+ * Why the last Run click did not start a run — shown under the Run button,
118
+ * where the click happened, not in the banner. Cleared when a run starts or
119
+ * the inputs change.
120
+ */
121
+ #launchError = $state(null);
84
122
  /** Current workflow being tested */
85
123
  #currentWorkflow = $state(null);
86
124
  /** The chat binding in effect — see {@link chatBinding}. Resolved once, read by the two below. */
@@ -103,8 +141,18 @@ export class PlaygroundStore {
103
141
  #pinnedExecutionId = $state(null);
104
142
  /** Incremented on every message batch that should trigger a pipeline re-fetch */
105
143
  #pipelineRefreshTrigger = $state(0);
144
+ /**
145
+ * Run status of the nodes of the workflow on the canvas, keyed by node id.
146
+ * `$state.raw`: replaced as a whole on each load, never mutated, so the
147
+ * canvas nodes (which read single entries) are not deep-proxied.
148
+ */
149
+ #nodeStatuses = $state.raw({});
150
+ /** Which workflow and run {@link #nodeStatuses} belongs to; null when empty. */
151
+ #nodeStatusScope = $state.raw(null);
106
152
  /** Whether log messages are visible in the execution console */
107
153
  #showLogs = $state(true);
154
+ /** Whether each turn's steps start expanded (default: folded to one row). */
155
+ #expandSteps = $state(false);
108
156
  /**
109
157
  * The main pipeline runs — the single source of truth for "what's selectable".
110
158
  * Sub-flow runs are tracked for classification but excluded here: selecting one
@@ -143,6 +191,8 @@ export class PlaygroundStore {
143
191
  #runLocked = $derived(this.#runLockedAt !== null && this.#enableRunCount <= this.#runLockedAt);
144
192
  /** Cleanups for active subscribeToSessionStatus effect roots. */
145
193
  #statusSubscriptions = new Set();
194
+ /** Synchronous listeners, see {@link onSessionStatusChange}. */
195
+ #statusListeners = new Set();
146
196
  /** Bound mutation facade — see {@link PlaygroundStoreActions}. */
147
197
  actions;
148
198
  constructor() {
@@ -157,6 +207,9 @@ export class PlaygroundStore {
157
207
  addMessage: this.addMessage.bind(this),
158
208
  addMessages: this.addMessages.bind(this),
159
209
  clearMessages: this.clearMessages.bind(this),
210
+ setSessionRuns: this.setSessionRuns.bind(this),
211
+ setVersionDividers: this.setVersionDividers.bind(this),
212
+ addVersionDivider: this.addVersionDivider.bind(this),
160
213
  setLoading: this.setLoading.bind(this),
161
214
  setError: this.setError.bind(this),
162
215
  updateLastPollSequenceNumber: this.updateLastPollSequenceNumber.bind(this),
@@ -165,9 +218,12 @@ export class PlaygroundStore {
165
218
  pinExecution: this.pinExecution.bind(this),
166
219
  setShowLogs: this.setShowLogs.bind(this),
167
220
  toggleShowLogs: this.toggleShowLogs.bind(this),
221
+ setExpandSteps: this.setExpandSteps.bind(this),
222
+ toggleExpandSteps: this.toggleExpandSteps.bind(this),
168
223
  setTurnPending: this.setTurnPending.bind(this),
169
224
  lockRunUntilEnabled: this.lockRunUntilEnabled.bind(this),
170
225
  releaseRunLock: this.releaseRunLock.bind(this),
226
+ setLaunchError: this.setLaunchError.bind(this),
171
227
  setFormValues: this.setFormValues.bind(this),
172
228
  setLastTurn: this.setLastTurn.bind(this)
173
229
  });
@@ -216,6 +272,10 @@ export class PlaygroundStore {
216
272
  get error() {
217
273
  return this.#error;
218
274
  }
275
+ /** The refusal of the last Run click, for the message under Run. */
276
+ get launchError() {
277
+ return this.#launchError;
278
+ }
219
279
  /** The current workflow. */
220
280
  get currentWorkflow() {
221
281
  return this.#currentWorkflow;
@@ -397,14 +457,80 @@ export class PlaygroundStore {
397
457
  get pipelineRefreshTrigger() {
398
458
  return this.#pipelineRefreshTrigger;
399
459
  }
460
+ /**
461
+ * Per-node run status for the workflow on the canvas, keyed by node id.
462
+ *
463
+ * This is the single source the node status overlay draws from. It is kept
464
+ * here, off the node data, so an edit to the graph can neither wipe it nor
465
+ * carry it into the saved workflow.
466
+ */
467
+ get nodeStatuses() {
468
+ return this.#nodeStatuses;
469
+ }
470
+ /** The workflow and run the statuses belong to, or null when there are none. */
471
+ get nodeStatusScope() {
472
+ return this.#nodeStatusScope;
473
+ }
474
+ /** One node's run status, or undefined when the shown run has none for it. */
475
+ nodeStatusFor(nodeId) {
476
+ return this.#nodeStatuses[nodeId];
477
+ }
478
+ /** Replace all node statuses with those of one run. */
479
+ setNodeStatuses(statuses, scope) {
480
+ this.#nodeStatuses = statuses;
481
+ this.#nodeStatusScope = scope;
482
+ }
483
+ /** Forget the node statuses (a different workflow or run is shown, or none). */
484
+ clearNodeStatuses() {
485
+ if (this.#nodeStatusScope === null && Object.keys(this.#nodeStatuses).length === 0)
486
+ return;
487
+ this.#nodeStatuses = {};
488
+ this.#nodeStatusScope = null;
489
+ }
400
490
  /** Whether log messages should be shown in the execution console. */
401
491
  get showLogs() {
402
492
  return this.#showLogs;
403
493
  }
494
+ /** Whether each turn's steps start expanded in the conversation. */
495
+ get expandSteps() {
496
+ return this.#expandSteps;
497
+ }
404
498
  /** The current session ID, or null. */
405
499
  get currentSessionId() {
406
500
  return this.#currentSession?.id ?? null;
407
501
  }
502
+ /**
503
+ * The current session's runs from the runs endpoint (oldest first, each
504
+ * stamped with the workflow version it ran), or `null` before the first load
505
+ * and on a server without the endpoint. The one place the list of a
506
+ * session's runs lives: the dividers are derived from it, and "attach a
507
+ * run" lists it.
508
+ */
509
+ get sessionRuns() {
510
+ const held = this.#runsOf;
511
+ return held && held.sessionId === this.#currentSession?.id ? held.result : null;
512
+ }
513
+ /** The "Saved, new version" dividers of the current session's feed. */
514
+ get versionDividers() {
515
+ const held = this.#dividersOf;
516
+ return held && held.sessionId === this.#currentSession?.id ? held.items : [];
517
+ }
518
+ /** Keep the runs of a session (`null` forgets them). */
519
+ setSessionRuns(sessionId, result) {
520
+ this.#runsOf = result ? { sessionId, result } : null;
521
+ }
522
+ /** Replace a session's dividers. */
523
+ setVersionDividers(sessionId, items) {
524
+ this.#dividersOf = { sessionId, items };
525
+ }
526
+ /** Add a divider to a session's feed; one with the same id is not added twice. */
527
+ addVersionDivider(sessionId, divider) {
528
+ const held = this.#dividersOf;
529
+ const items = held && held.sessionId === sessionId ? held.items : [];
530
+ if (items.some((d) => d.id === divider.id))
531
+ return;
532
+ this.#dividersOf = { sessionId, items: [...items, divider] };
533
+ }
408
534
  /** Whether older messages exist before the oldest one currently loaded. */
409
535
  get hasOlder() {
410
536
  return this.#hasOlder;
@@ -484,8 +610,10 @@ export class PlaygroundStore {
484
610
  /** Set the current workflow. */
485
611
  setWorkflow(workflow) {
486
612
  // Values typed for one workflow's inputs mean nothing for another's.
487
- if (workflow?.id !== this.#currentWorkflow?.id)
613
+ if (workflow?.id !== this.#currentWorkflow?.id) {
488
614
  this.#formValues = {};
615
+ this.#launchError = null;
616
+ }
489
617
  this.#currentWorkflow = workflow;
490
618
  }
491
619
  /** Set the current session. */
@@ -614,6 +742,10 @@ export class PlaygroundStore {
614
742
  setError(errorMessage) {
615
743
  this.#error = errorMessage;
616
744
  }
745
+ /** Set the Run click's refusal (or null to clear). */
746
+ setLaunchError(errorMessage) {
747
+ this.#launchError = errorMessage;
748
+ }
617
749
  /** Update the last poll cursor. */
618
750
  updateLastPollSequenceNumber(seq) {
619
751
  this.#lastPollSequenceNumber = seq;
@@ -623,11 +755,15 @@ export class PlaygroundStore {
623
755
  this.#currentSession = null;
624
756
  this.#sessions = [];
625
757
  this.#messages = [];
758
+ this.#runsOf = null;
759
+ this.#dividersOf = null;
626
760
  this.#isLoading = false;
627
761
  this.#error = null;
762
+ this.#launchError = null;
628
763
  this.#currentWorkflow = null;
629
764
  this.#lastPollSequenceNumber = null;
630
765
  this.#pipelineRefreshTrigger = 0;
766
+ this.clearNodeStatuses();
631
767
  this.#turnPending = false;
632
768
  this.#runLockedAt = null;
633
769
  this.#formValues = {};
@@ -659,6 +795,14 @@ export class PlaygroundStore {
659
795
  toggleShowLogs() {
660
796
  this.#showLogs = !this.#showLogs;
661
797
  }
798
+ /** Set whether turns' steps start expanded. */
799
+ setExpandSteps(value) {
800
+ this.#expandSteps = value;
801
+ }
802
+ /** Toggle whether turns' steps start expanded. */
803
+ toggleExpandSteps() {
804
+ this.#expandSteps = !this.#expandSteps;
805
+ }
662
806
  /** Mark a turn request as in flight (or finished). */
663
807
  setTurnPending(value) {
664
808
  this.#turnPending = value;
@@ -674,6 +818,7 @@ export class PlaygroundStore {
674
818
  /** Replace the interface input form's values. */
675
819
  setFormValues(values) {
676
820
  this.#formValues = values;
821
+ this.#launchError = null;
677
822
  }
678
823
  /** Record the sessions door's answer for the turn just taken (`null` clears it). */
679
824
  setLastTurn(result) {
@@ -723,6 +868,22 @@ export class PlaygroundStore {
723
868
  setHasOlder(hasOlder) {
724
869
  this.#hasOlder = hasOlder;
725
870
  }
871
+ /**
872
+ * Listen for session status changes, synchronously.
873
+ *
874
+ * Unlike {@link subscribeToSessionStatus}, which rides an effect and so
875
+ * batches (two changes inside one flush read as one, or as none), the
876
+ * listener runs inside the write that changed the status: once per real
877
+ * change, in order, at the moment it happened. Cleared by {@link dispose}.
878
+ *
879
+ * @returns Function that removes the listener
880
+ */
881
+ onSessionStatusChange(listener) {
882
+ this.#statusListeners.add(listener);
883
+ return () => {
884
+ this.#statusListeners.delete(listener);
885
+ };
886
+ }
726
887
  /**
727
888
  * Subscribe to session status changes using $effect.root.
728
889
  * This is designed for use in non-component contexts (e.g., mount.ts).
@@ -760,6 +921,7 @@ export class PlaygroundStore {
760
921
  for (const cleanup of [...this.#statusSubscriptions]) {
761
922
  cleanup();
762
923
  }
924
+ this.#statusListeners.clear();
763
925
  }
764
926
  /**
765
927
  * Refresh messages for the current session.