@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
@@ -0,0 +1,224 @@
1
+ /**
2
+ * WebMCP desktop bridge — a typed controller over the vendored widget.
3
+ *
4
+ * The bridge's page-side script (`@jason.today/webmcp`, vendored by the Drupal
5
+ * module, written against **0.1.13**) draws its own unstyled floating widget and
6
+ * keeps its connection state inside it. This controller lets the editor draw
7
+ * the bridge UI with its own components instead: it hides the widget's DOM and
8
+ * mirrors its state into a small reactive surface (`status`, `registeredTools`,
9
+ * `connect`, `disconnect`, `subscribe`).
10
+ *
11
+ * What it relies on in the widget (0.1.13):
12
+ * - public: `connect(token)`, `disconnect()`, `registerTool(...)`,
13
+ * `isConnected`, `availableTools` (a `Map`), `elementId`;
14
+ * - private, hooked on the *instance* (never the prototype): `_updateStatus(status,
15
+ * message)` and `_updateConnectionUI(isConnected)`.
16
+ *
17
+ * The private methods are feature-detected. When any is missing (an upgrade
18
+ * renamed them) the controller is **unmanaged**: the widget's own UI stays
19
+ * visible, nothing is wrapped, a warning is logged once, and the editor draws
20
+ * no bridge button — connecting keeps working through the widget.
21
+ *
22
+ * @module webmcp/bridgeController
23
+ */
24
+ const PRIVATE_METHODS = ['_updateStatus', '_updateConnectionUI'];
25
+ let warned = false;
26
+ function warnOnce(missing) {
27
+ if (warned)
28
+ return;
29
+ warned = true;
30
+ // eslint-disable-next-line no-console
31
+ console.warn(`[flowdrop] WebMCP bridge widget changed (missing ${missing.join(', ')}); ` +
32
+ "leaving the widget's own UI visible. The editor's bridge button is off.");
33
+ }
34
+ /** Test hook: forget that the unmanaged warning was already logged. */
35
+ export function resetBridgeWarning() {
36
+ warned = false;
37
+ }
38
+ function missingSurface(widget) {
39
+ const missing = PRIVATE_METHODS.filter((m) => typeof widget[m] !== 'function');
40
+ if (typeof widget.connect !== 'function')
41
+ missing.push('connect');
42
+ if (typeof widget.disconnect !== 'function')
43
+ missing.push('disconnect');
44
+ if (!(widget.availableTools instanceof Map))
45
+ missing.push('availableTools');
46
+ return missing;
47
+ }
48
+ function widgetElement(widget) {
49
+ if (typeof document === 'undefined')
50
+ return null;
51
+ const byId = widget.elementId ? document.getElementById(widget.elementId) : null;
52
+ return byId ?? document.querySelector('[data-webmcp-widget]');
53
+ }
54
+ /** Map the widget's (status, message) to ours. A disconnect that carries a reason is an error. */
55
+ function classify(status, message) {
56
+ switch (status) {
57
+ case 'connected':
58
+ return 'connected';
59
+ case 'connecting':
60
+ case 'pending-auth':
61
+ return 'connecting';
62
+ case 'disconnected':
63
+ return message && message !== 'Disconnected' ? 'error' : 'disconnected';
64
+ default:
65
+ return 'disconnected';
66
+ }
67
+ }
68
+ /** What the widget's status line already says, for a widget that auto-reconnected before we hooked it. */
69
+ function seed(widget) {
70
+ if (widget.isConnected)
71
+ return { status: 'connected', detail: '' };
72
+ const text = widgetElement(widget)?.querySelector('.webmcp-status')?.textContent?.trim() ?? '';
73
+ if (/^(connecting|registering)/i.test(text))
74
+ return { status: 'connecting', detail: text };
75
+ if (/^connected/i.test(text))
76
+ return { status: 'connected', detail: text };
77
+ if (text && !/^disconnected$/i.test(text))
78
+ return { status: 'error', detail: text };
79
+ // The widget reconnects from sessionStorage inside its constructor, before we can hook it.
80
+ try {
81
+ const key = widget.SESSION_STORAGE_KEY ?? 'webmcp_token';
82
+ if (typeof sessionStorage !== 'undefined' && sessionStorage.getItem(key)) {
83
+ return { status: 'connecting', detail: '' };
84
+ }
85
+ }
86
+ catch {
87
+ /* storage blocked: start disconnected */
88
+ }
89
+ return { status: 'disconnected', detail: '' };
90
+ }
91
+ /**
92
+ * Wrap a bridge widget in a controller. Hooks the instance's own methods, so
93
+ * other widgets and the prototype are untouched.
94
+ */
95
+ export function createBridgeController(widget) {
96
+ const missing = missingSurface(widget);
97
+ const managed = missing.length === 0;
98
+ if (!managed)
99
+ warnOnce(missing);
100
+ let status = $state('disconnected');
101
+ let detail = $state('');
102
+ // Bumped when a tool registers: the widget's Map is not reactive.
103
+ let toolsVersion = $state(0);
104
+ const listeners = new Set();
105
+ const readTools = () => Array.from(widget.availableTools?.entries() ?? [], ([name, tool]) => ({
106
+ name,
107
+ description: tool.description ?? ''
108
+ }));
109
+ const emit = () => {
110
+ if (listeners.size === 0)
111
+ return;
112
+ const snapshot = { status, detail, tools: readTools() };
113
+ listeners.forEach((listener) => listener(snapshot));
114
+ };
115
+ /** True from the user's disconnect until the next connect: its "Disconnected" is not an error. */
116
+ let userClosed = false;
117
+ const restore = [];
118
+ if (managed) {
119
+ const initial = seed(widget);
120
+ status = initial.status;
121
+ detail = initial.detail;
122
+ const hook = (key, after) => {
123
+ const original = widget[key];
124
+ const had = Object.prototype.hasOwnProperty.call(widget, key);
125
+ widget[key] = function (...args) {
126
+ try {
127
+ return original.apply(widget, args);
128
+ }
129
+ finally {
130
+ after(...args);
131
+ }
132
+ };
133
+ restore.push(() => {
134
+ if (had)
135
+ widget[key] = original;
136
+ else
137
+ delete widget[key];
138
+ });
139
+ };
140
+ hook('_updateStatus', (widgetStatus, message) => {
141
+ const text = message ?? '';
142
+ let next = classify(widgetStatus, text);
143
+ // After a failed connect the socket's close event reports a bare "Disconnected":
144
+ // keep the error visible until the person tries again.
145
+ if (next === 'disconnected' && status === 'error' && !userClosed)
146
+ next = 'error';
147
+ // The bare "Disconnected" that follows a failure must not replace its reason.
148
+ const keepReason = next === 'error' && status === 'error' && text === 'Disconnected';
149
+ if (!keepReason)
150
+ detail = next === 'error' || next === 'connecting' ? text : '';
151
+ status = next;
152
+ if (next === 'connecting' || next === 'connected')
153
+ userClosed = false;
154
+ emit();
155
+ });
156
+ hook('_updateConnectionUI', () => {
157
+ // Keep the widget's own UI hidden even if a vendored upgrade re-shows it.
158
+ hide();
159
+ });
160
+ hook('registerTool', () => {
161
+ toolsVersion += 1;
162
+ emit();
163
+ });
164
+ const hide = () => {
165
+ const el = widgetElement(widget);
166
+ if (el)
167
+ el.style.setProperty('display', 'none', 'important');
168
+ };
169
+ hide();
170
+ restore.push(() => {
171
+ const el = widgetElement(widget);
172
+ if (el)
173
+ el.style.removeProperty('display');
174
+ });
175
+ }
176
+ return {
177
+ get status() {
178
+ return status;
179
+ },
180
+ get detail() {
181
+ return detail;
182
+ },
183
+ get registeredTools() {
184
+ void toolsVersion;
185
+ return readTools();
186
+ },
187
+ managed,
188
+ connect(token) {
189
+ userClosed = false;
190
+ const result = widget.connect?.(token);
191
+ // The widget reports failures through its status; a rejection is a bug there.
192
+ if (result && typeof result.catch === 'function') {
193
+ result.catch(() => { });
194
+ }
195
+ },
196
+ disconnect() {
197
+ userClosed = true;
198
+ widget.disconnect?.();
199
+ },
200
+ subscribe(listener) {
201
+ listeners.add(listener);
202
+ return () => listeners.delete(listener);
203
+ },
204
+ dispose() {
205
+ restore
206
+ .splice(0)
207
+ .reverse()
208
+ .forEach((fn) => fn());
209
+ listeners.clear();
210
+ }
211
+ };
212
+ }
213
+ /** The controller of the installed bridge, if any. A holder object so reads are reactive. */
214
+ const current = $state({ controller: null });
215
+ /** The controller of the bridge `installBridgedModelContext` installed, or null. */
216
+ export function getBridgeController() {
217
+ return current.controller;
218
+ }
219
+ /** Make `controller` the editor's bridge (null clears it). Replaces and disposes a previous one. */
220
+ export function setBridgeController(controller) {
221
+ if (current.controller && current.controller !== controller)
222
+ current.controller.dispose();
223
+ current.controller = controller;
224
+ }
@@ -23,7 +23,7 @@ import { type ToolDescriptor, type ToolInputSchema } from './types.js';
23
23
  import { validateToolArgs } from './validate.js';
24
24
  export { validateToolArgs };
25
25
  /** Command types exposed as one tool each (verb === command type). */
26
- export declare const EXPOSED_COMMAND_TYPES: readonly ["add_node", "delete_node", "rename_node", "move_node", "swap_node", "set_config", "get_config", "connect", "disconnect_ports", "disconnect_node", "list_nodes", "list_edges", "list_types", "describe_type", "search_types", "info", "undo", "redo", "auto_layout", "beautify_layout"];
26
+ export declare const EXPOSED_COMMAND_TYPES: readonly ["add_node", "delete_node", "rename_node", "move_node", "swap_node", "set_config", "get_config", "connect", "disconnect_ports", "disconnect_node", "list_nodes", "list_edges", "list_types", "describe_type", "search_types", "info", "undo", "redo", "auto_layout", "beautify_layout", "inspect_node_layout", "beautify_node"];
27
27
  /**
28
28
  * Command types folded into the single `view` tool (its `action` enum). The
29
29
  * list itself lives in the command classifier, next to `isViewCommand`, so
@@ -19,6 +19,7 @@
19
19
  import { isMutatingCommand, VIEW_COMMAND_TYPES } from '../chat/commandClassifier.js';
20
20
  import { ToolArgumentError } from './types.js';
21
21
  import { validateToolArgs } from './validate.js';
22
+ import { LAYOUT_GRID } from '../layout/types.js';
22
23
  export { validateToolArgs };
23
24
  // ============================================================================
24
25
  // What is exposed
@@ -44,7 +45,9 @@ export const EXPOSED_COMMAND_TYPES = [
44
45
  'undo',
45
46
  'redo',
46
47
  'auto_layout',
47
- 'beautify_layout'
48
+ 'beautify_layout',
49
+ 'inspect_node_layout',
50
+ 'beautify_node'
48
51
  ];
49
52
  /**
50
53
  * Command types folded into the single `view` tool (its `action` enum). The
@@ -111,6 +114,18 @@ const object = (properties, required = []) => ({
111
114
  additionalProperties: false
112
115
  });
113
116
  const EMPTY = object({});
117
+ /** A layout gap in pixels, for the two `layout node` tools. */
118
+ const gapArg = (between) => ({
119
+ type: 'integer',
120
+ minimum: 0,
121
+ multipleOf: LAYOUT_GRID,
122
+ description: `Gap in px to keep between cards ${between}; a multiple of 20 (the layout grid, whatever the editor's grid size is). Default: the editor's layout gap setting.`
123
+ });
124
+ /** The optional `gapX` / `gapY` arguments of the `layout node` tools, when given. */
125
+ const gapArgs = (a) => ({
126
+ ...(typeof a.gapX === 'number' ? { gapX: a.gapX } : {}),
127
+ ...(typeof a.gapY === 'number' ? { gapY: a.gapY } : {})
128
+ });
114
129
  /**
115
130
  * `SetConfigCommand.value` is the DSL's raw token: the executor parses it with
116
131
  * the same rules the text DSL uses (`"…"` → string, bare `12` → number, `true`
@@ -324,10 +339,56 @@ const COMMANDS = {
324
339
  summarize: (c) => `Auto-layout (${c.direction ?? 'horizontal'})`
325
340
  },
326
341
  beautify_layout: {
327
- description: 'Tidy the layout of all nodes. Moves existing nodes.',
328
- inputSchema: EMPTY,
329
- build: () => ({ type: 'beautify_layout' }),
330
- summarize: () => 'Beautify layout'
342
+ description: 'Tidy the layout of all nodes. Moves existing nodes. Puts every node into its column, clears overlaps and tight spacing, reorders ports and straightens wires to cut crossings; prints one line per step and the score before and after, or says nothing improved. Refuses a graph of more than 120 nodes (code TOO_LARGE): tidy those one node at a time with beautify_node. Use dryRun to preview. gapX / gapY set the spacing to keep between cards for this call (default: the layout gap settings of the editor). One undo step.',
343
+ inputSchema: object({
344
+ dryRun: {
345
+ type: 'boolean',
346
+ description: 'Report the steps and the score without changing the workflow.'
347
+ },
348
+ gapX: gapArg('side by side'),
349
+ gapY: gapArg('stacked')
350
+ }),
351
+ build: (a) => ({
352
+ type: 'beautify_layout',
353
+ ...(a.dryRun === true ? { dryRun: true } : {}),
354
+ ...gapArgs(a)
355
+ }),
356
+ summarize: (c) => `${c.dryRun ? 'Preview tidy of' : 'Tidy'} layout`
357
+ },
358
+ inspect_node_layout: {
359
+ description: 'Report how one node sits on the canvas: for each wire, whether it is straight or off by how many pixels, plus crossings, overlaps and spacing. Changes nothing. Run it before beautify_node to see what is wrong. gapX / gapY set the spacing to judge against for this call (default: the layout gap settings of the editor).',
360
+ inputSchema: object({ nodeId: nodeId(), gapX: gapArg('side by side'), gapY: gapArg('stacked') }, ['nodeId']),
361
+ build: (a) => ({
362
+ type: 'inspect_node_layout',
363
+ nodeId: a.nodeId,
364
+ ...gapArgs(a)
365
+ }),
366
+ summarize: (c) => `Inspect layout of ${c.nodeId}`
367
+ },
368
+ beautify_node: {
369
+ description: 'Tidy the layout of ONE node; no other node moves (notes and captions are never moved either, cards just keep clear of them). Strategies: column (x into its column), ports (reorder connected ports to cut crossings), align (y that straightens a wire), clear (y out of overlaps), all (those four in turn, the default). It says what changed and the score, or why nothing improved. Call inspect_node_layout first; use dryRun to preview without applying. gapX / gapY set the spacing to keep between cards for this call (default: the layout gap settings of the editor). One undo step.',
370
+ inputSchema: object({
371
+ nodeId: nodeId(),
372
+ strategy: {
373
+ type: 'string',
374
+ enum: ['column', 'ports', 'align', 'clear', 'all'],
375
+ description: 'What to fix. Default all.'
376
+ },
377
+ dryRun: {
378
+ type: 'boolean',
379
+ description: 'Report the proposal and its score without changing the workflow.'
380
+ },
381
+ gapX: gapArg('side by side'),
382
+ gapY: gapArg('stacked')
383
+ }, ['nodeId']),
384
+ build: (a) => ({
385
+ type: 'beautify_node',
386
+ nodeId: a.nodeId,
387
+ ...(a.strategy ? { strategy: a.strategy } : {}),
388
+ ...(a.dryRun === true ? { dryRun: true } : {}),
389
+ ...gapArgs(a)
390
+ }),
391
+ summarize: (c) => `${c.dryRun ? 'Preview beautify of' : 'Beautify'} ${c.nodeId}${c.strategy ? ` (${c.strategy})` : ''}`
331
392
  }
332
393
  };
333
394
  /** The record for one exposed command — for tests that check its shape. */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * WebMCP bridge — a fake of the vendored widget, for tests and the test route.
3
+ *
4
+ * Has the same surface the bridge controller relies on in
5
+ * `@jason.today/webmcp` **0.1.13**: public `connect` / `disconnect` /
6
+ * `registerTool` / `isConnected` / `availableTools` / `elementId`, the private
7
+ * `_updateStatus(status, message)` and `_updateConnectionUI(isConnected)`, and a
8
+ * `[data-webmcp-widget]` container with a `.webmcp-status` line (so a test can
9
+ * see the controller hide it). No network: `connect` settles by token.
10
+ *
11
+ * Tokens: `hold` stays "connecting" until `settle()`, `fail` ends in a
12
+ * registration error, anything else connects.
13
+ *
14
+ * @module webmcp/fakeWidget
15
+ */
16
+ export interface FakeBridgeWidget {
17
+ isConnected: boolean;
18
+ elementId: string;
19
+ availableTools: Map<string, {
20
+ name: string;
21
+ description: string;
22
+ }>;
23
+ SESSION_STORAGE_KEY: string;
24
+ connect(token: string): Promise<void>;
25
+ disconnect(): void;
26
+ registerTool(name: string, description: string, inputSchema: object, execute: (args: unknown) => unknown): void;
27
+ _updateStatus(status: string, message?: string): void;
28
+ _updateConnectionUI(isConnected: boolean): void;
29
+ /** Finish a `hold` connect as connected. */
30
+ settle(): void;
31
+ /** Remove the widget's DOM. */
32
+ destroy(): void;
33
+ }
34
+ export declare function createFakeBridgeWidget(): FakeBridgeWidget;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * WebMCP bridge — a fake of the vendored widget, for tests and the test route.
3
+ *
4
+ * Has the same surface the bridge controller relies on in
5
+ * `@jason.today/webmcp` **0.1.13**: public `connect` / `disconnect` /
6
+ * `registerTool` / `isConnected` / `availableTools` / `elementId`, the private
7
+ * `_updateStatus(status, message)` and `_updateConnectionUI(isConnected)`, and a
8
+ * `[data-webmcp-widget]` container with a `.webmcp-status` line (so a test can
9
+ * see the controller hide it). No network: `connect` settles by token.
10
+ *
11
+ * Tokens: `hold` stays "connecting" until `settle()`, `fail` ends in a
12
+ * registration error, anything else connects.
13
+ *
14
+ * @module webmcp/fakeWidget
15
+ */
16
+ let counter = 0;
17
+ export function createFakeBridgeWidget() {
18
+ const elementId = `webmcp-widget-fake${counter++}`;
19
+ const container = document.createElement('div');
20
+ container.id = elementId;
21
+ container.dataset.webmcpWidget = 'true';
22
+ container.textContent = 'WebMCP';
23
+ const statusLine = document.createElement('div');
24
+ statusLine.className = 'webmcp-status';
25
+ statusLine.textContent = 'Disconnected';
26
+ container.appendChild(statusLine);
27
+ document.body.appendChild(container);
28
+ let release = null;
29
+ const widget = {
30
+ isConnected: false,
31
+ elementId,
32
+ availableTools: new Map(),
33
+ SESSION_STORAGE_KEY: 'webmcp_token',
34
+ async connect(token) {
35
+ if (!token) {
36
+ widget._updateStatus('disconnected', 'Error: No token provided');
37
+ return;
38
+ }
39
+ widget._updateStatus('connecting', 'Connecting...');
40
+ if (token === 'hold') {
41
+ await new Promise((resolve) => (release = resolve));
42
+ }
43
+ else {
44
+ await Promise.resolve();
45
+ }
46
+ if (token === 'fail') {
47
+ widget._updateStatus('disconnected', 'Registration failed');
48
+ return;
49
+ }
50
+ widget.isConnected = true;
51
+ widget._updateStatus('connected', 'Connected to /fake');
52
+ widget._updateConnectionUI(true);
53
+ },
54
+ disconnect() {
55
+ widget.isConnected = false;
56
+ widget._updateStatus('disconnected', 'Disconnected');
57
+ widget._updateConnectionUI(false);
58
+ },
59
+ registerTool(name, description) {
60
+ widget.availableTools.set(name, { name, description });
61
+ },
62
+ _updateStatus(_status, message) {
63
+ statusLine.textContent = message ?? _status;
64
+ },
65
+ _updateConnectionUI() { },
66
+ settle() {
67
+ release?.();
68
+ release = null;
69
+ },
70
+ destroy() {
71
+ container.remove();
72
+ }
73
+ };
74
+ return widget;
75
+ }
@@ -24,6 +24,7 @@ import { defaultMessages, mergeMessages, messagesContext } from '../messages/ind
24
24
  import { describeCommand, summarizeCommands } from './descriptors.js';
25
25
  import WebMCPConfirm from './WebMCPConfirm.svelte';
26
26
  import { SCOPE_ATTR } from '../utils/portal.js';
27
+ import { themeScope } from '../utils/themeScope.svelte.js';
27
28
  /** A second mutating call arrived while a decision was pending. */
28
29
  export class GateBusyError extends Error {
29
30
  constructor() {
@@ -93,6 +94,8 @@ export function createApprovalGate(approval, options) {
93
94
  const scope = options.skinScope?.();
94
95
  if (scope)
95
96
  host.setAttribute(SCOPE_ATTR, scope);
97
+ // The colour scheme is data-theme on the editor scope, not on <html>.
98
+ const theme = themeScope(host);
96
99
  target.appendChild(host);
97
100
  const finish = (approved, remember = false) => {
98
101
  if (settled)
@@ -100,6 +103,7 @@ export function createApprovalGate(approval, options) {
100
103
  settled = true;
101
104
  dismiss = null;
102
105
  void unmount(component);
106
+ theme.destroy();
103
107
  host.remove();
104
108
  if (approved && remember)
105
109
  editsPreApproved = true;
@@ -37,3 +37,5 @@ export type { FakeModelContext } from './fake.js';
37
37
  export { createBridgedModelContext, installBridgedModelContext } from './bridge.js';
38
38
  export type { WebMCPWidgetLike, BridgedModelContext } from './bridge.js';
39
39
  export type { ToolDescriptor, ToolInputSchema, ToolSchemaProperty, ToolResult, ToolExecuteOptions, RegisteredToolDefinition, RegisterToolOptions, ModelContextLike, WebMCPApproval, WebMCPApprovalRequest, HostCode, HostEnvelope, RunStarted, RunPending, RunStatus, WebMCPOptions, WebMCPMountOptions, WebMCPHandle, HostHooks, HostToolDescriptor, ToolPreview, ToolRuntime, ToolRuntimeOptions } from './types.js';
40
+ export { getBridgeController, createBridgeController } from './bridgeController.svelte.js';
41
+ export type { WebMCPBridgeController, BridgeStatus, BridgeTool, BridgeSnapshot } from './bridgeController.svelte.js';
@@ -32,3 +32,4 @@ export { validateToolArgs, VALIDATOR_KEYWORDS } from './validate.js';
32
32
  export { ToolArgumentError } from './types.js';
33
33
  export { createFakeModelContext } from './fake.js';
34
34
  export { createBridgedModelContext, installBridgedModelContext } from './bridge.js';
35
+ export { getBridgeController, createBridgeController } from './bridgeController.svelte.js';
@@ -207,7 +207,10 @@ export function buildHostToolDescriptors(hooks) {
207
207
  */
208
208
  export function createToolRuntime(options) {
209
209
  const { instance } = options;
210
- const hooks = options.hooks ?? {};
210
+ // `run` and `run_status` go through the instance's run controller, so a run
211
+ // an agent starts is the run the editor's run bar shows. The wrapped hooks
212
+ // answer exactly as the host's do.
213
+ const hooks = instance.runs.wrapHostHooks(options.hooks ?? {});
211
214
  let disposed = false;
212
215
  const nodeTypes = () => {
213
216
  const source = options.nodeTypes;
@@ -32,6 +32,8 @@ export interface ToolSchemaProperty {
32
32
  anyOf?: readonly ToolSchemaProperty[];
33
33
  minimum?: number;
34
34
  maximum?: number;
35
+ /** The value must be a whole multiple of this (JSON Schema `multipleOf`). */
36
+ multipleOf?: number;
35
37
  }
36
38
  /** A tool's input schema: always an object with `additionalProperties: false`. */
37
39
  export interface ToolInputSchema {
@@ -32,7 +32,8 @@ export const VALIDATOR_KEYWORDS = new Set([
32
32
  'items',
33
33
  'anyOf',
34
34
  'minimum',
35
- 'maximum'
35
+ 'maximum',
36
+ 'multipleOf'
36
37
  ]);
37
38
  function typeOf(value) {
38
39
  if (value === null)
@@ -75,6 +76,9 @@ function validateProperty(path, value, schema) {
75
76
  if (schema.maximum !== undefined && value > schema.maximum) {
76
77
  throw new ToolArgumentError(`${path}: must be <= ${schema.maximum}`);
77
78
  }
79
+ if (schema.multipleOf !== undefined && value % schema.multipleOf !== 0) {
80
+ throw new ToolArgumentError(`${path}: must be a multiple of ${schema.multipleOf}`);
81
+ }
78
82
  if (schema.type === 'object' && schema.properties) {
79
83
  validateObject(path, value, schema);
80
84
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.11.0",
6
+ "version": "2.13.0",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"
@@ -236,11 +236,13 @@
236
236
  "npm-watch": "^0.13.0",
237
237
  "picomatch": "^4.0.4",
238
238
  "playwright": "^1.53.0",
239
+ "postcss-html": "^2.0.0",
239
240
  "prettier": "^3.4.2",
240
241
  "prettier-plugin-svelte": "^3.3.3",
241
242
  "publint": "^0.3.2",
242
243
  "storybook": "^10.2.15",
243
244
  "storybook-addon-tag-badges": "^3.0.6",
245
+ "stylelint": "^17.16.0",
244
246
  "svelte": "^5.0.0",
245
247
  "svelte-check": "^4.0.0",
246
248
  "terser": "^5.43.1",
@@ -296,8 +298,12 @@
296
298
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
297
299
  "check:bundle": "node scripts/check-bundle.mjs",
298
300
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
299
- "lint": "eslint . && prettier --check .",
301
+ "lint": "eslint . && prettier --check . && pnpm run lint:styles",
302
+ "lint:styles": "node scripts/style-ratchet.mjs",
303
+ "lint:styles:update": "node scripts/style-ratchet.mjs --update",
300
304
  "test": "vitest run",
305
+ "test:unit": "vitest run --project=unit",
306
+ "test:stories": "vitest run --project=storybook",
301
307
  "generate:token-aliases": "node scripts/generate-token-aliases.mjs && prettier --write src/lib/styles/tokenAliases.ts",
302
308
  "test:watch": "vitest",
303
309
  "test:ui": "vitest --ui",
@@ -1,53 +0,0 @@
1
- <!--
2
- Select — typed wrapper over the shared `.flowdrop-input` system (base.css).
3
-
4
- Renders the field shell (`.flowdrop-input .flowdrop-input--select`) plus a
5
- built-in chevron overlay (`.flowdrop-select-wrap`), so selects match the exact
6
- look of Input/Textarea. The native arrow is removed; the chevron tints to
7
- --fd-primary on focus. Pass <option>/<optgroup> as children. Native attributes
8
- (value, disabled, id, aria-*, onchange…) forward to the underlying <select>.
9
-
10
- Internal for now; see Button.svelte / Input.svelte for the pattern.
11
- -->
12
-
13
- <script lang="ts">
14
- import type { Snippet } from 'svelte';
15
- import type { HTMLSelectAttributes } from 'svelte/elements';
16
-
17
- // Omit native numeric `size` so our design-token size (matching Button) wins.
18
- interface Props extends Omit<HTMLSelectAttributes, 'size'> {
19
- /** Size — `md` is the base; `sm`/`lg` add a modifier */
20
- size?: 'sm' | 'md' | 'lg';
21
- /** Renders the error-border state */
22
- invalid?: boolean;
23
- /** Extra classes appended to the <select> */
24
- class?: string;
25
- /** The <option>/<optgroup> elements */
26
- children: Snippet;
27
- }
28
-
29
- let { size = 'md', invalid = false, class: className = '', children, ...rest }: Props = $props();
30
-
31
- const selectClass = $derived(
32
- [
33
- 'flowdrop-input',
34
- 'flowdrop-input--select',
35
- size === 'md' ? '' : `flowdrop-input--${size}`,
36
- invalid ? 'flowdrop-input--invalid' : '',
37
- className
38
- ]
39
- .filter(Boolean)
40
- .join(' ')
41
- );
42
- </script>
43
-
44
- <div class="flowdrop-select-wrap">
45
- <select class={selectClass} {...rest}>
46
- {@render children()}
47
- </select>
48
- <span class="flowdrop-select-wrap__icon" aria-hidden="true">
49
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
50
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 9l6 6 6-6" />
51
- </svg>
52
- </span>
53
- </div>
@@ -1,15 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLSelectAttributes } from 'svelte/elements';
3
- interface Props extends Omit<HTMLSelectAttributes, 'size'> {
4
- /** Size — `md` is the base; `sm`/`lg` add a modifier */
5
- size?: 'sm' | 'md' | 'lg';
6
- /** Renders the error-border state */
7
- invalid?: boolean;
8
- /** Extra classes appended to the <select> */
9
- class?: string;
10
- /** The <option>/<optgroup> elements */
11
- children: Snippet;
12
- }
13
- declare const Select: import("svelte").Component<Props, {}, "">;
14
- type Select = ReturnType<typeof Select>;
15
- export default Select;
@@ -1,15 +0,0 @@
1
- <!-- Inline SVG equivalent of heroicons:command-line (outline) -->
2
- <svg
3
- xmlns="http://www.w3.org/2000/svg"
4
- viewBox="0 0 24 24"
5
- fill="none"
6
- stroke="currentColor"
7
- stroke-width="1.5"
8
- stroke-linecap="round"
9
- stroke-linejoin="round"
10
- aria-hidden="true"
11
- >
12
- <path
13
- d="M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"
14
- />
15
- </svg>