@flowdrop/flowdrop 2.11.0 → 2.12.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.
- package/CHANGELOG.md +223 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +18 -36
- package/dist/adapters/agentspec/autoLayout.js +75 -93
- package/dist/chat/activity.d.ts +49 -0
- package/dist/chat/activity.js +65 -0
- package/dist/chat/commandClassifier.js +2 -1
- package/dist/commands/executor.js +186 -27
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/parser.js +43 -3
- package/dist/commands/session.d.ts +60 -0
- package/dist/commands/session.js +332 -0
- package/dist/commands/storeIntegration.svelte.js +18 -1
- package/dist/commands/types.d.ts +77 -4
- package/dist/components/App.svelte +966 -226
- package/dist/components/App.svelte.d.ts +26 -2
- package/dist/components/BindablePortListbox.svelte +68 -369
- package/dist/components/Button.svelte +17 -14
- package/dist/components/Button.svelte.d.ts +2 -2
- package/dist/components/CanvasContextMenu.svelte +31 -10
- package/dist/components/CanvasController.svelte +146 -3
- package/dist/components/CanvasController.svelte.d.ts +25 -33
- package/dist/components/CanvasIconButton.svelte +6 -6
- package/dist/components/CanvasToolbar.svelte +103 -0
- package/dist/components/CanvasToolbar.svelte.d.ts +23 -0
- package/dist/components/CanvasZoomControls.svelte +122 -0
- package/dist/components/CanvasZoomControls.svelte.d.ts +15 -0
- package/dist/components/ConfigForm.svelte +159 -121
- package/dist/components/ConfigModal.svelte +11 -54
- package/dist/components/ConfigPanel.svelte +98 -228
- package/dist/components/ConfigPanel.svelte.d.ts +2 -2
- package/dist/components/ConnectPortPicker.svelte +153 -0
- package/dist/components/ConnectPortPicker.svelte.d.ts +22 -0
- package/dist/components/DoctorMenu.svelte +422 -0
- package/dist/components/DoctorMenu.svelte.d.ts +7 -0
- package/dist/components/ExternalLinkRow.svelte +82 -0
- package/dist/components/ExternalLinkRow.svelte.d.ts +14 -0
- package/dist/components/FlowDropEdge.svelte +52 -2
- package/dist/components/FlowDropEdge.svelte.d.ts +5 -1
- package/dist/components/InterfaceNameInput.svelte +103 -0
- package/dist/components/InterfaceNameInput.svelte.d.ts +13 -0
- package/dist/components/InterfaceTag.svelte +215 -0
- package/dist/components/InterfaceTag.svelte.d.ts +20 -0
- package/dist/components/InterfaceTagAnchor.svelte +103 -0
- package/dist/components/InterfaceTagAnchor.svelte.d.ts +12 -0
- package/dist/components/InterfaceTagLayer.svelte +314 -0
- package/dist/components/InterfaceTagLayer.svelte.d.ts +28 -0
- package/dist/components/LogsSidebar.svelte +43 -43
- package/dist/components/LoopbackLanes.svelte +54 -0
- package/dist/components/LoopbackLanes.svelte.d.ts +8 -0
- package/dist/components/Navbar.svelte +539 -169
- package/dist/components/Navbar.svelte.d.ts +20 -1
- package/dist/components/NodeInspector.svelte +153 -0
- package/dist/components/NodeInspector.svelte.d.ts +19 -0
- package/dist/components/NodeLastRun.svelte +212 -0
- package/dist/components/NodeLastRun.svelte.d.ts +13 -0
- package/dist/components/NodeSidebar.svelte +279 -23
- package/dist/components/NodeSidebar.svelte.d.ts +11 -0
- package/dist/components/NodeStatusOverlay.svelte +144 -353
- package/dist/components/NodeStatusOverlay.svelte.d.ts +4 -1
- package/dist/components/PortMappingRow.svelte +28 -44
- package/dist/components/PortPickerListbox.svelte +475 -0
- package/dist/components/PortPickerListbox.svelte.d.ts +73 -0
- package/dist/components/ReadOnlyDetails.svelte +52 -89
- package/dist/components/RunBar.svelte +222 -0
- package/dist/components/RunBar.svelte.d.ts +20 -0
- package/dist/components/RunsMenu.svelte +649 -0
- package/dist/components/RunsMenu.svelte.d.ts +14 -0
- package/dist/components/SettingsModal.svelte +27 -59
- package/dist/components/SettingsPanel.svelte +515 -241
- package/dist/components/StraightGuides.svelte +46 -0
- package/dist/components/StraightGuides.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.svelte +14 -4
- package/dist/components/UniversalNode.svelte +152 -51
- package/dist/components/WebMCPBridgeMenu.svelte +336 -0
- package/dist/components/WebMCPBridgeMenu.svelte.d.ts +3 -0
- package/dist/components/WorkflowEditor.svelte +789 -136
- package/dist/components/WorkflowEditor.svelte.d.ts +43 -1
- package/dist/components/WorkflowInterfaceEditor.svelte +63 -92
- package/dist/components/WorkflowInterfaceEntryCard.svelte +478 -549
- package/dist/components/WorkflowInterfaceEntryComposer.svelte +23 -67
- package/dist/components/WorkflowPlaygroundSettings.svelte +48 -85
- package/dist/components/WorkflowSettingsPanel.svelte +311 -0
- package/dist/components/WorkflowSettingsPanel.svelte.d.ts +20 -0
- package/dist/components/ZoomTier.svelte +56 -0
- package/dist/components/ZoomTier.svelte.d.ts +4 -0
- package/dist/components/chat/AIChatPanel.svelte +463 -312
- package/dist/components/chat/ActivityList.svelte +130 -0
- package/dist/components/chat/ActivityList.svelte.d.ts +11 -0
- package/dist/components/chat/ActivityRow.svelte +179 -0
- package/dist/components/chat/ActivityRow.svelte.d.ts +16 -0
- package/dist/components/chat/CommandPreview.svelte +42 -64
- package/dist/components/console/CommandConsole.svelte +106 -41
- package/dist/components/console/CommandConsole.svelte.d.ts +2 -0
- package/dist/components/console/ConsoleAutocomplete.svelte +14 -13
- package/dist/components/console/ConsoleInput.svelte +60 -27
- package/dist/components/console/ConsoleOutput.svelte +86 -24
- package/dist/components/console/ConsoleStrip.svelte +80 -0
- package/dist/components/console/ConsoleStrip.svelte.d.ts +13 -0
- package/dist/components/form/FieldFactory.svelte +30 -4
- package/dist/components/form/FormArray.svelte +306 -339
- package/dist/components/form/FormArray.svelte.d.ts +10 -0
- package/dist/components/form/FormArrayRows.svelte +443 -0
- package/dist/components/form/FormArrayRows.svelte.d.ts +18 -0
- package/dist/components/form/FormAutocomplete.svelte +2 -2
- package/dist/components/form/FormCheckboxGroup.svelte +10 -85
- package/dist/components/form/FormCodeEditor.svelte +3 -3
- package/dist/components/form/FormFieldWrapper.svelte +98 -18
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +10 -0
- package/dist/components/form/FormFieldset.svelte +44 -28
- package/dist/components/form/FormMarkdownEditor.svelte +6 -6
- package/dist/components/form/FormPorts.svelte +437 -141
- package/dist/components/form/FormSelect.svelte +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +22 -26
- package/dist/components/form/FormToggle.svelte +15 -106
- package/dist/components/form/FormToggle.svelte.d.ts +3 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +38 -3
- package/dist/components/form/humanizeKey.d.ts +7 -0
- package/dist/components/form/humanizeKey.js +21 -0
- package/dist/components/form/types.d.ts +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte +8 -1
- package/dist/components/interrupt/ChoicePrompt.svelte +51 -152
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +0 -2
- package/dist/components/interrupt/ConfirmationPrompt.svelte +18 -201
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +0 -4
- package/dist/components/interrupt/FormPrompt.svelte +22 -147
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +0 -4
- package/dist/components/interrupt/InterruptBubble.svelte +198 -355
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +0 -2
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -10
- package/dist/components/interrupt/TextInputPrompt.svelte +23 -120
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +0 -2
- package/dist/components/layouts/MainLayout.svelte +110 -75
- package/dist/components/layouts/MainLayout.svelte.d.ts +17 -0
- package/dist/components/nodes/CaptionNode.svelte +7 -0
- package/dist/components/nodes/GatewayNode.svelte +66 -431
- package/dist/components/nodes/IdeaNode.svelte +6 -5
- package/dist/components/nodes/NodeCard.svelte +1051 -0
- package/dist/components/nodes/NodeCard.svelte.d.ts +30 -0
- package/dist/components/nodes/NodeConfigButton.svelte +28 -9
- package/dist/components/nodes/NodeProblemMark.svelte +113 -0
- package/dist/components/nodes/NodeProblemMark.svelte.d.ts +8 -0
- package/dist/components/nodes/NodeTip.svelte +104 -0
- package/dist/components/nodes/NodeTip.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +183 -150
- package/dist/components/nodes/SimpleNode.svelte +176 -44
- package/dist/components/nodes/SquareNode.svelte +127 -34
- package/dist/components/nodes/TerminalNode.svelte +232 -88
- package/dist/components/nodes/ToolNode.svelte +49 -381
- package/dist/components/nodes/WorkflowNode.svelte +40 -399
- package/dist/components/playground/ChatBubble.svelte +248 -62
- package/dist/components/playground/ChatInput.svelte +134 -297
- package/dist/components/playground/ChatInput.svelte.d.ts +17 -0
- package/dist/components/playground/ControlPanel.svelte +290 -190
- package/dist/components/playground/ControlPanel.svelte.d.ts +10 -2
- package/dist/components/playground/DockedPlayground.svelte +75 -0
- package/dist/components/playground/DockedPlayground.svelte.d.ts +24 -0
- package/dist/components/playground/ExecutionConsole.svelte +54 -36
- package/dist/components/playground/ExecutionConsole.svelte.d.ts +12 -0
- package/dist/components/playground/ExecutionLogs.svelte +4 -0
- package/dist/components/playground/HeaderMenu.svelte +170 -0
- package/dist/components/playground/HeaderMenu.svelte.d.ts +22 -0
- package/dist/components/playground/InputCollector.svelte +8 -32
- package/dist/components/playground/InputFields.svelte +246 -0
- package/dist/components/playground/InputFields.svelte.d.ts +16 -0
- package/dist/components/playground/InterfaceInputForm.svelte +285 -30
- package/dist/components/playground/InterfaceInputForm.svelte.d.ts +20 -0
- package/dist/components/playground/InterfaceJsonInput.svelte +92 -0
- package/dist/components/playground/InterfaceJsonInput.svelte.d.ts +10 -0
- package/dist/components/playground/LogRow.svelte +12 -12
- package/dist/components/playground/MessageMarkdown.svelte +11 -11
- package/dist/components/playground/MessageStream.svelte +154 -182
- package/dist/components/playground/Playground.svelte +17 -1139
- package/dist/components/playground/PlaygroundApp.svelte +12 -2
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +2 -1
- package/dist/components/playground/PlaygroundHeader.svelte +309 -0
- package/dist/components/playground/PlaygroundHeader.svelte.d.ts +22 -0
- package/dist/components/playground/PlaygroundModal.svelte +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +30 -32
- package/dist/components/playground/PlaygroundSurface.svelte +648 -0
- package/dist/components/playground/PlaygroundSurface.svelte.d.ts +79 -0
- package/dist/components/playground/StepsSummary.svelte +312 -0
- package/dist/components/playground/StepsSummary.svelte.d.ts +11 -0
- package/dist/components/playground/messageDisplay.d.ts +9 -0
- package/dist/components/playground/messageDisplay.js +24 -2
- package/dist/components/playground/stepSummary.d.ts +71 -0
- package/dist/components/playground/stepSummary.js +152 -0
- package/dist/components/ports/PortTypeBadge.svelte +13 -1
- package/dist/components/primitives/Button.svelte +226 -0
- package/dist/components/primitives/Button.svelte.d.ts +31 -0
- package/dist/components/primitives/Card.svelte +110 -0
- package/dist/components/primitives/Card.svelte.d.ts +20 -0
- package/dist/components/primitives/Checkbox.svelte +126 -0
- package/dist/components/primitives/Checkbox.svelte.d.ts +15 -0
- package/dist/components/primitives/Chip.svelte +143 -0
- package/dist/components/primitives/Chip.svelte.d.ts +22 -0
- package/dist/components/primitives/Combobox.svelte +444 -0
- package/dist/components/primitives/Combobox.svelte.d.ts +22 -0
- package/dist/components/primitives/Composer.svelte +293 -0
- package/dist/components/primitives/Composer.svelte.d.ts +47 -0
- package/dist/components/primitives/EmptyState.svelte +113 -0
- package/dist/components/primitives/EmptyState.svelte.d.ts +18 -0
- package/dist/components/primitives/Field.svelte +178 -0
- package/dist/components/primitives/Field.svelte.d.ts +30 -0
- package/dist/components/primitives/IconButton.svelte +156 -0
- package/dist/components/primitives/IconButton.svelte.d.ts +27 -0
- package/dist/components/primitives/Menu.svelte +435 -0
- package/dist/components/primitives/Menu.svelte.d.ts +61 -0
- package/dist/components/primitives/Notice.svelte +161 -0
- package/dist/components/primitives/Notice.svelte.d.ts +22 -0
- package/dist/components/primitives/PanelHeader.svelte +134 -0
- package/dist/components/primitives/PanelHeader.svelte.d.ts +23 -0
- package/dist/components/primitives/Segmented.svelte +198 -0
- package/dist/components/primitives/Segmented.svelte.d.ts +32 -0
- package/dist/components/primitives/Select.svelte +130 -0
- package/dist/components/primitives/Select.svelte.d.ts +26 -0
- package/dist/components/primitives/StatusPill.svelte +218 -0
- package/dist/components/primitives/StatusPill.svelte.d.ts +24 -0
- package/dist/components/primitives/Switch.svelte +113 -0
- package/dist/components/primitives/Switch.svelte.d.ts +14 -0
- package/dist/components/primitives/Tabs.svelte +209 -0
- package/dist/components/primitives/Tabs.svelte.d.ts +32 -0
- package/dist/components/primitives/Toolbar.svelte +94 -0
- package/dist/components/primitives/Toolbar.svelte.d.ts +14 -0
- package/dist/components/primitives/ToolbarSeparator.svelte +40 -0
- package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +7 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte +10 -40
- package/dist/components/surfaces/TabbedSurface.svelte +49 -39
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +8 -0
- package/dist/components/toast/DismissibleToast.svelte +94 -32
- package/dist/components/toast/DismissibleToast.svelte.d.ts +17 -7
- package/dist/config/endpoints.d.ts +43 -1
- package/dist/config/endpoints.js +21 -3
- package/dist/core/index.d.ts +8 -5
- package/dist/core/index.js +1 -1
- package/dist/editor/connectCandidates.d.ts +56 -0
- package/dist/editor/connectCandidates.js +131 -0
- package/dist/editor/contextMenu.d.ts +31 -2
- package/dist/editor/contextMenu.js +96 -9
- package/dist/editor/index.d.ts +3 -1
- package/dist/editor/index.js +1 -0
- package/dist/editor/interfaceMenu.d.ts +35 -0
- package/dist/editor/interfaceMenu.js +47 -0
- package/dist/editor/portMenu.d.ts +23 -0
- package/dist/editor/portMenu.js +34 -0
- package/dist/editor/tidy.d.ts +30 -0
- package/dist/editor/tidy.js +66 -0
- package/dist/helpers/workflowEditorHelper.d.ts +3 -0
- package/dist/helpers/workflowEditorHelper.js +8 -3
- package/dist/layout/fromWorkflow.d.ts +42 -0
- package/dist/layout/fromWorkflow.js +135 -0
- package/dist/layout/geometry.d.ts +102 -0
- package/dist/layout/geometry.js +317 -0
- package/dist/layout/index.d.ts +21 -0
- package/dist/layout/index.js +14 -0
- package/dist/layout/inspect.d.ts +18 -0
- package/dist/layout/inspect.js +81 -0
- package/dist/layout/lanePath.d.ts +23 -0
- package/dist/layout/lanePath.js +47 -0
- package/dist/layout/measure.d.ts +141 -0
- package/dist/layout/measure.js +477 -0
- package/dist/layout/primitives.d.ts +124 -0
- package/dist/layout/primitives.js +461 -0
- package/dist/layout/sweep.d.ts +59 -0
- package/dist/layout/sweep.js +257 -0
- package/dist/layout/toWorkflow.d.ts +43 -0
- package/dist/layout/toWorkflow.js +131 -0
- package/dist/layout/types.d.ts +93 -0
- package/dist/layout/types.js +35 -0
- package/dist/messages/defaults.d.ts +641 -26
- package/dist/messages/defaults.js +578 -25
- package/dist/messages/types.d.ts +21 -1
- package/dist/openapi/v1/openapi.yaml +109 -0
- package/dist/playground/index.d.ts +28 -1
- package/dist/playground/index.js +29 -0
- package/dist/playground/mount.d.ts +28 -2
- package/dist/playground/mount.js +41 -15
- package/dist/playground/runAction.d.ts +29 -0
- package/dist/playground/runAction.js +38 -0
- package/dist/services/doctorService.d.ts +52 -0
- package/dist/services/doctorService.js +113 -0
- package/dist/services/globalSave.js +12 -29
- package/dist/services/nodeExecutionService.d.ts +12 -1
- package/dist/services/nodeExecutionService.js +58 -58
- package/dist/services/playgroundService.d.ts +17 -2
- package/dist/services/playgroundService.js +48 -5
- package/dist/services/runsService.d.ts +42 -0
- package/dist/services/runsService.js +87 -0
- package/dist/services/toastQueue.d.ts +33 -0
- package/dist/services/toastQueue.js +38 -0
- package/dist/services/toastService.d.ts +30 -9
- package/dist/services/toastService.js +81 -46
- package/dist/settings/index.d.ts +1 -0
- package/dist/skins/graphite.d.ts +26 -0
- package/dist/skins/graphite.js +473 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/skins/slate.js +4 -4
- package/dist/stores/attachedRunStore.svelte.d.ts +35 -0
- package/dist/stores/attachedRunStore.svelte.js +47 -0
- package/dist/stores/connectDragStore.svelte.d.ts +39 -0
- package/dist/stores/connectDragStore.svelte.js +42 -0
- package/dist/stores/doctorStore.svelte.d.ts +79 -0
- package/dist/stores/doctorStore.svelte.js +244 -0
- package/dist/stores/editedNodesStore.svelte.d.ts +42 -0
- package/dist/stores/editedNodesStore.svelte.js +84 -0
- package/dist/stores/editorModeStore.svelte.d.ts +34 -0
- package/dist/stores/editorModeStore.svelte.js +55 -0
- package/dist/stores/instanceContainer.svelte.d.ts +53 -0
- package/dist/stores/instanceContainer.svelte.js +38 -1
- package/dist/stores/loopbackLanesStore.svelte.d.ts +18 -0
- package/dist/stores/loopbackLanesStore.svelte.js +25 -0
- package/dist/stores/nodeHighlightStore.svelte.d.ts +34 -0
- package/dist/stores/nodeHighlightStore.svelte.js +56 -0
- package/dist/stores/playgroundStore.svelte.d.ts +66 -2
- package/dist/stores/playgroundStore.svelte.js +164 -2
- package/dist/stores/runController.svelte.d.ts +382 -0
- package/dist/stores/runController.svelte.js +1217 -0
- package/dist/stores/settingsStore.svelte.d.ts +80 -18
- package/dist/stores/settingsStore.svelte.js +180 -62
- package/dist/stores/workflowStore.svelte.d.ts +14 -0
- package/dist/stores/workflowStore.svelte.js +22 -1
- package/dist/styles/base.css +286 -25
- package/dist/styles/fonts/Inter-LICENSE.txt +93 -0
- package/dist/styles/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/styles/fonts/inter.css +19 -0
- package/dist/styles/toast.css +100 -20
- package/dist/styles/tokenAliases.js +118 -1
- package/dist/styles/tokens.css +586 -14
- package/dist/svelte-app.d.ts +38 -5
- package/dist/svelte-app.js +14 -3
- package/dist/themes/graphite.d.ts +2 -0
- package/dist/themes/graphite.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +22 -3
- package/dist/themes/minimal.js +10 -0
- package/dist/themes/scopedSkinCss.d.ts +22 -5
- package/dist/themes/scopedSkinCss.js +136 -11
- package/dist/types/chat.d.ts +6 -0
- package/dist/types/doctor.d.ts +82 -0
- package/dist/types/doctor.js +11 -0
- package/dist/types/events.d.ts +35 -0
- package/dist/types/events.js +4 -1
- package/dist/types/index.d.ts +17 -2
- package/dist/types/navbar.d.ts +36 -0
- package/dist/types/playground.d.ts +66 -0
- package/dist/types/settings.d.ts +120 -7
- package/dist/types/settings.js +35 -3
- package/dist/types/skin.d.ts +21 -8
- package/dist/types/theme.d.ts +40 -2
- package/dist/utils/appearance.d.ts +19 -0
- package/dist/utils/appearance.js +13 -0
- package/dist/utils/canvasFit.d.ts +41 -0
- package/dist/utils/canvasFit.js +44 -0
- package/dist/utils/chipTitles.d.ts +9 -0
- package/dist/utils/chipTitles.js +19 -0
- package/dist/utils/connections.js +8 -0
- package/dist/utils/consoleHighlight.d.ts +28 -0
- package/dist/utils/consoleHighlight.js +269 -0
- package/dist/utils/deprecation.d.ts +17 -0
- package/dist/utils/deprecation.js +29 -0
- package/dist/utils/doctorOperations.d.ts +40 -0
- package/dist/utils/doctorOperations.js +237 -0
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +40 -0
- package/dist/utils/inspectorContext.d.ts +19 -0
- package/dist/utils/inspectorContext.js +12 -0
- package/dist/utils/inspectorSections.d.ts +20 -0
- package/dist/utils/inspectorSections.js +44 -0
- package/dist/utils/inspectorSurface.d.ts +46 -0
- package/dist/utils/inspectorSurface.js +51 -0
- package/dist/utils/interfaceTags.d.ts +102 -0
- package/dist/utils/interfaceTags.js +211 -0
- package/dist/utils/itemRef.d.ts +86 -0
- package/dist/utils/itemRef.js +106 -0
- package/dist/utils/lastRun.d.ts +35 -0
- package/dist/utils/lastRun.js +73 -0
- package/dist/utils/messageNodeLink.d.ts +17 -0
- package/dist/utils/messageNodeLink.js +16 -0
- package/dist/utils/minimapVisibility.d.ts +28 -0
- package/dist/utils/minimapVisibility.js +34 -0
- package/dist/utils/nodeAriaLabel.d.ts +12 -0
- package/dist/utils/nodeAriaLabel.js +17 -0
- package/dist/utils/nodeFingerprint.d.ts +27 -0
- package/dist/utils/nodeFingerprint.js +66 -0
- package/dist/utils/nodeFormSchema.d.ts +10 -0
- package/dist/utils/nodeFormSchema.js +2 -2
- package/dist/utils/nodeGeometry.d.ts +168 -0
- package/dist/utils/nodeGeometry.js +204 -0
- package/dist/utils/nodeProblem.d.ts +19 -0
- package/dist/utils/nodeProblem.js +9 -0
- package/dist/utils/nodeStatus.d.ts +38 -3
- package/dist/utils/nodeStatus.js +67 -39
- package/dist/utils/nodeSwap.js +9 -1
- package/dist/utils/nodeWrapper.d.ts +1 -0
- package/dist/utils/playgroundHistory.d.ts +48 -0
- package/dist/utils/playgroundHistory.js +38 -0
- package/dist/utils/playgroundInputRuns.d.ts +26 -0
- package/dist/utils/playgroundInputRuns.js +50 -0
- package/dist/utils/portExposure.d.ts +49 -0
- package/dist/utils/portExposure.js +122 -0
- package/dist/utils/portUtils.d.ts +16 -0
- package/dist/utils/portUtils.js +37 -0
- package/dist/utils/portal.d.ts +0 -19
- package/dist/utils/portal.js +8 -1
- package/dist/utils/reservedPorts.d.ts +59 -0
- package/dist/utils/reservedPorts.js +60 -0
- package/dist/utils/runEdges.d.ts +24 -0
- package/dist/utils/runEdges.js +35 -0
- package/dist/utils/runsList.d.ts +69 -0
- package/dist/utils/runsList.js +134 -0
- package/dist/utils/selectOptions.d.ts +62 -0
- package/dist/utils/selectOptions.js +137 -0
- package/dist/utils/sessionRuns.d.ts +62 -0
- package/dist/utils/sessionRuns.js +123 -0
- package/dist/utils/sheetWidths.d.ts +29 -0
- package/dist/utils/sheetWidths.js +41 -0
- package/dist/utils/sidebarWidths.d.ts +34 -0
- package/dist/utils/sidebarWidths.js +47 -0
- package/dist/utils/straightWires.d.ts +73 -0
- package/dist/utils/straightWires.js +99 -0
- package/dist/utils/themeScope.svelte.d.ts +10 -0
- package/dist/utils/themeScope.svelte.js +80 -0
- package/dist/utils/wiredHandles.d.ts +10 -0
- package/dist/utils/wiredHandles.js +14 -0
- package/dist/utils/workflowDraft.d.ts +9 -0
- package/dist/utils/workflowDraft.js +39 -0
- package/dist/utils/workflowInterface.d.ts +40 -7
- package/dist/utils/workflowInterface.js +66 -16
- package/dist/utils/zoomTier.d.ts +43 -0
- package/dist/utils/zoomTier.js +107 -0
- package/dist/utils/zoomTierRows.d.ts +41 -0
- package/dist/utils/zoomTierRows.js +103 -0
- package/dist/webmcp/WebMCPConfirm.svelte +1 -1
- package/dist/webmcp/bridge.d.ts +5 -0
- package/dist/webmcp/bridge.js +8 -0
- package/dist/webmcp/bridgeController.svelte.d.ts +84 -0
- package/dist/webmcp/bridgeController.svelte.js +224 -0
- package/dist/webmcp/descriptors.d.ts +1 -1
- package/dist/webmcp/descriptors.js +66 -5
- package/dist/webmcp/fakeWidget.d.ts +34 -0
- package/dist/webmcp/fakeWidget.js +75 -0
- package/dist/webmcp/gate.js +4 -0
- package/dist/webmcp/index.d.ts +2 -0
- package/dist/webmcp/index.js +1 -0
- package/dist/webmcp/runtime.js +4 -1
- package/dist/webmcp/types.d.ts +2 -0
- package/dist/webmcp/validate.js +5 -1
- package/package.json +8 -2
- package/dist/components/Select.svelte +0 -53
- package/dist/components/Select.svelte.d.ts +0 -15
- package/dist/components/icons/CommandLineIcon.svelte +0 -15
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +0 -26
- package/dist/components/toast/WarningIcon.svelte +0 -28
- package/dist/components/toast/WarningIcon.svelte.d.ts +0 -26
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings panel's view of `editor.zoomTiers`: one row per tier below full,
|
|
3
|
+
* each with an on/off switch and a "starts below N%" value.
|
|
4
|
+
*
|
|
5
|
+
* A row's "starts below" is where its tier begins as the canvas zooms out, which
|
|
6
|
+
* is the stored start of the tier above it (the first row's value is the stored
|
|
7
|
+
* `full`). The lowest tier that is on is stored with 0: it extends down to any
|
|
8
|
+
* zoom. Options are limited by the neighbouring rows that are on, so a
|
|
9
|
+
* combination that is not strictly decreasing cannot be picked.
|
|
10
|
+
*/
|
|
11
|
+
import { type ZoomTierConfig, type ZoomTierName } from './zoomTier.js';
|
|
12
|
+
/** The tiers that have a row. Full has none. */
|
|
13
|
+
export type ZoomRowTier = Exclude<ZoomTierName, 'full'>;
|
|
14
|
+
export declare const ZOOM_ROW_TIERS: readonly ZoomRowTier[];
|
|
15
|
+
/** The lowest and highest percentage a row offers, and the step. */
|
|
16
|
+
export declare const ZOOM_BELOW_MIN = 20;
|
|
17
|
+
export declare const ZOOM_BELOW_MAX = 90;
|
|
18
|
+
export declare const ZOOM_BELOW_STEP = 5;
|
|
19
|
+
export interface ZoomRow {
|
|
20
|
+
tier: ZoomRowTier;
|
|
21
|
+
on: boolean;
|
|
22
|
+
/** Percent: the zoom below which this tier starts. Kept while the row is off. */
|
|
23
|
+
below: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The rows for a config. `remembered` supplies the percentage of a row that is
|
|
27
|
+
* off (so switching it back on restores what the user had).
|
|
28
|
+
*/
|
|
29
|
+
export declare function zoomRows(config: unknown, remembered?: Partial<Record<ZoomRowTier, number>>): ZoomRow[];
|
|
30
|
+
/** The config for rows. No row on is `{ full: 0 }`. */
|
|
31
|
+
export declare function zoomConfigFromRows(rows: readonly ZoomRow[]): ZoomTierConfig;
|
|
32
|
+
/** The percentages a row may take: the grid between its neighbours, plus its own value. */
|
|
33
|
+
export declare function zoomBelowOptions(rows: readonly ZoomRow[], tier: ZoomRowTier): number[];
|
|
34
|
+
/**
|
|
35
|
+
* The percentage for a row being switched on: what it had if that still fits
|
|
36
|
+
* between its neighbours, otherwise the grid value nearest the middle of the
|
|
37
|
+
* gap. `null` when there is no room (the neighbours leave no step between them).
|
|
38
|
+
*/
|
|
39
|
+
export declare function zoomBelowForEnable(rows: readonly ZoomRow[], tier: ZoomRowTier): number | null;
|
|
40
|
+
/** The library default's rows (for tests and the panel's reset path). */
|
|
41
|
+
export declare const DEFAULT_ZOOM_ROWS: readonly ZoomRow[];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings panel's view of `editor.zoomTiers`: one row per tier below full,
|
|
3
|
+
* each with an on/off switch and a "starts below N%" value.
|
|
4
|
+
*
|
|
5
|
+
* A row's "starts below" is where its tier begins as the canvas zooms out, which
|
|
6
|
+
* is the stored start of the tier above it (the first row's value is the stored
|
|
7
|
+
* `full`). The lowest tier that is on is stored with 0: it extends down to any
|
|
8
|
+
* zoom. Options are limited by the neighbouring rows that are on, so a
|
|
9
|
+
* combination that is not strictly decreasing cannot be picked.
|
|
10
|
+
*/
|
|
11
|
+
import { ZOOM_TIER_ORDER, DEFAULT_ZOOM_TIERS, normalizeZoomTiers } from './zoomTier.js';
|
|
12
|
+
export const ZOOM_ROW_TIERS = ['outline', 'glyph', 'map'];
|
|
13
|
+
/** The lowest and highest percentage a row offers, and the step. */
|
|
14
|
+
export const ZOOM_BELOW_MIN = 20;
|
|
15
|
+
export const ZOOM_BELOW_MAX = 90;
|
|
16
|
+
export const ZOOM_BELOW_STEP = 5;
|
|
17
|
+
/** The percentage a row starts at when it has never been on. */
|
|
18
|
+
const DEFAULT_BELOW = {
|
|
19
|
+
outline: 75,
|
|
20
|
+
glyph: 45,
|
|
21
|
+
map: 25
|
|
22
|
+
};
|
|
23
|
+
const pct = (zoom) => Math.round(zoom * 100);
|
|
24
|
+
/**
|
|
25
|
+
* The rows for a config. `remembered` supplies the percentage of a row that is
|
|
26
|
+
* off (so switching it back on restores what the user had).
|
|
27
|
+
*/
|
|
28
|
+
export function zoomRows(config, remembered = {}) {
|
|
29
|
+
const valid = normalizeZoomTiers(config);
|
|
30
|
+
const on = ZOOM_TIER_ORDER.filter((t) => typeof valid[t] === 'number');
|
|
31
|
+
return ZOOM_ROW_TIERS.map((tier) => {
|
|
32
|
+
const i = on.indexOf(tier);
|
|
33
|
+
if (i > 0)
|
|
34
|
+
return { tier, on: true, below: pct(valid[on[i - 1]]) };
|
|
35
|
+
return { tier, on: false, below: remembered[tier] ?? DEFAULT_BELOW[tier] };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** The config for rows. No row on is `{ full: 0 }`. */
|
|
39
|
+
export function zoomConfigFromRows(rows) {
|
|
40
|
+
const on = ZOOM_ROW_TIERS.map((t) => rows.find((r) => r.tier === t)).filter((r) => !!r && r.on);
|
|
41
|
+
if (on.length === 0)
|
|
42
|
+
return { full: 0 };
|
|
43
|
+
const config = { full: on[0].below / 100 };
|
|
44
|
+
on.forEach((row, i) => {
|
|
45
|
+
config[row.tier] = i + 1 < on.length ? on[i + 1].below / 100 : 0;
|
|
46
|
+
});
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
/** The nearest row above (higher rank) and below that is on, as percentages. */
|
|
50
|
+
function neighbours(rows, tier) {
|
|
51
|
+
const at = ZOOM_ROW_TIERS.indexOf(tier);
|
|
52
|
+
let above = Infinity;
|
|
53
|
+
let below = -Infinity;
|
|
54
|
+
for (const r of rows) {
|
|
55
|
+
if (!r.on || r.tier === tier)
|
|
56
|
+
continue;
|
|
57
|
+
const i = ZOOM_ROW_TIERS.indexOf(r.tier);
|
|
58
|
+
if (i < at)
|
|
59
|
+
above = Math.min(above, r.below);
|
|
60
|
+
else
|
|
61
|
+
below = Math.max(below, r.below);
|
|
62
|
+
}
|
|
63
|
+
return { above, below };
|
|
64
|
+
}
|
|
65
|
+
/** The percentages a row may take: the grid between its neighbours, plus its own value. */
|
|
66
|
+
export function zoomBelowOptions(rows, tier) {
|
|
67
|
+
const row = rows.find((r) => r.tier === tier);
|
|
68
|
+
const { above, below } = neighbours(rows, tier);
|
|
69
|
+
const out = [];
|
|
70
|
+
for (let n = ZOOM_BELOW_MIN; n <= ZOOM_BELOW_MAX; n += ZOOM_BELOW_STEP) {
|
|
71
|
+
if (n > below && n < above)
|
|
72
|
+
out.push(n);
|
|
73
|
+
}
|
|
74
|
+
if (row?.on && !out.includes(row.below)) {
|
|
75
|
+
out.push(row.below);
|
|
76
|
+
out.sort((a, b) => b - a);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
out.sort((a, b) => b - a);
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The percentage for a row being switched on: what it had if that still fits
|
|
85
|
+
* between its neighbours, otherwise the grid value nearest the middle of the
|
|
86
|
+
* gap. `null` when there is no room (the neighbours leave no step between them).
|
|
87
|
+
*/
|
|
88
|
+
export function zoomBelowForEnable(rows, tier) {
|
|
89
|
+
const row = rows.find((r) => r.tier === tier);
|
|
90
|
+
const { above, below } = neighbours(rows, tier);
|
|
91
|
+
const fits = (n) => n > below && n < above;
|
|
92
|
+
const grid = [];
|
|
93
|
+
for (let n = ZOOM_BELOW_MIN; n <= ZOOM_BELOW_MAX; n += ZOOM_BELOW_STEP)
|
|
94
|
+
if (fits(n))
|
|
95
|
+
grid.push(n);
|
|
96
|
+
if (grid.length === 0)
|
|
97
|
+
return null;
|
|
98
|
+
if (row && fits(row.below))
|
|
99
|
+
return row.below;
|
|
100
|
+
return grid[Math.floor((grid.length - 1) / 2)];
|
|
101
|
+
}
|
|
102
|
+
/** The library default's rows (for tests and the panel's reset path). */
|
|
103
|
+
export const DEFAULT_ZOOM_ROWS = zoomRows(DEFAULT_ZOOM_TIERS);
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
/* Mounted on document.body, outside the editor tree. Tokens come from :root
|
|
125
125
|
(tokens.css) and, for a skinned editor, from the editor's scope, which the
|
|
126
126
|
gate copies onto the host element; the dark palette follows
|
|
127
|
-
[data-theme='dark'] on
|
|
127
|
+
[data-theme='dark'] on the host element (gate.ts); the buttons are .flowdrop-btn from
|
|
128
128
|
base.css. Everything else is set here, because the host page's own
|
|
129
129
|
element rules (h2, p, ol, li, label) reach a dialog on <body>: every
|
|
130
130
|
element below states its margin, padding, font and list style rather than
|
package/dist/webmcp/bridge.d.ts
CHANGED
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
* that expect slow approvals should say so in the dialog copy or use a custom
|
|
32
32
|
* `approval` callback.
|
|
33
33
|
*
|
|
34
|
+
* The widget's own floating UI is hidden once installed: the editor shows a
|
|
35
|
+
* connect button and popover of its own, driven by the controller in
|
|
36
|
+
* `./bridgeController.svelte.ts`. If the widget's private surface is not
|
|
37
|
+
* recognised (a vendored upgrade), the widget's UI stays visible instead.
|
|
38
|
+
*
|
|
34
39
|
* Nothing here decides *who* may reach the page: the bridge is localhost-only
|
|
35
40
|
* and token-gated by design, and the adapter's confirm dialog and the
|
|
36
41
|
* server's permissions still gate every mutation. Hosts should still make the
|
package/dist/webmcp/bridge.js
CHANGED
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
* that expect slow approvals should say so in the dialog copy or use a custom
|
|
32
32
|
* `approval` callback.
|
|
33
33
|
*
|
|
34
|
+
* The widget's own floating UI is hidden once installed: the editor shows a
|
|
35
|
+
* connect button and popover of its own, driven by the controller in
|
|
36
|
+
* `./bridgeController.svelte.ts`. If the widget's private surface is not
|
|
37
|
+
* recognised (a vendored upgrade), the widget's UI stays visible instead.
|
|
38
|
+
*
|
|
34
39
|
* Nothing here decides *who* may reach the page: the bridge is localhost-only
|
|
35
40
|
* and token-gated by design, and the adapter's confirm dialog and the
|
|
36
41
|
* server's permissions still gate every mutation. Hosts should still make the
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
*
|
|
39
44
|
* @module webmcp/bridge
|
|
40
45
|
*/
|
|
46
|
+
import { createBridgeController, setBridgeController } from './bridgeController.svelte.js';
|
|
41
47
|
function unavailable(name) {
|
|
42
48
|
return {
|
|
43
49
|
content: [
|
|
@@ -101,6 +107,8 @@ export function installBridgedModelContext(widget, target = typeof document ===
|
|
|
101
107
|
if (nav?.modelContext)
|
|
102
108
|
return nav.modelContext;
|
|
103
109
|
const bridged = createBridgedModelContext(widget);
|
|
110
|
+
// The editor draws the bridge's UI itself (a button in the zoom controls) from this.
|
|
111
|
+
setBridgeController(createBridgeController(widget));
|
|
104
112
|
Object.defineProperty(target, 'modelContext', { value: bridged, configurable: true });
|
|
105
113
|
return bridged;
|
|
106
114
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
/** Where the bridge connection stands. */
|
|
25
|
+
export type BridgeStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
26
|
+
/** A tool the editor offered through the bridge. */
|
|
27
|
+
export interface BridgeTool {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
/** The immutable view `subscribe` listeners receive. */
|
|
32
|
+
export interface BridgeSnapshot {
|
|
33
|
+
status: BridgeStatus;
|
|
34
|
+
/** The widget's own words for the last status (shown for errors). */
|
|
35
|
+
detail: string;
|
|
36
|
+
tools: readonly BridgeTool[];
|
|
37
|
+
}
|
|
38
|
+
export interface WebMCPBridgeController {
|
|
39
|
+
/** Connection state. Reactive in a Svelte `$derived` / template. */
|
|
40
|
+
readonly status: BridgeStatus;
|
|
41
|
+
/** The widget's last status message; the reason when `status` is `error`. */
|
|
42
|
+
readonly detail: string;
|
|
43
|
+
/** Tools offered through the bridge. Reactive. */
|
|
44
|
+
readonly registeredTools: readonly BridgeTool[];
|
|
45
|
+
/** False when the widget's private surface was not recognised (its own UI is left visible). */
|
|
46
|
+
readonly managed: boolean;
|
|
47
|
+
/** Connect with a token pasted from the desktop bridge. */
|
|
48
|
+
connect(token: string): void;
|
|
49
|
+
/** Drop the connection and forget the token. */
|
|
50
|
+
disconnect(): void;
|
|
51
|
+
/** Call `listener` on every change of status or tools. Returns the unsubscribe function. */
|
|
52
|
+
subscribe(listener: (snapshot: BridgeSnapshot) => void): () => void;
|
|
53
|
+
/** Restore the widget's methods and its own UI. */
|
|
54
|
+
dispose(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The widget surface the controller reads. Everything is optional: what is
|
|
58
|
+
* missing decides whether the controller can manage the widget.
|
|
59
|
+
*/
|
|
60
|
+
export interface BridgeWidgetInternals {
|
|
61
|
+
connect?(token: string): unknown;
|
|
62
|
+
disconnect?(): unknown;
|
|
63
|
+
registerTool?(...args: unknown[]): unknown;
|
|
64
|
+
_updateStatus?(status: string, message?: string): unknown;
|
|
65
|
+
_updateConnectionUI?(isConnected: boolean): unknown;
|
|
66
|
+
isConnected?: boolean;
|
|
67
|
+
availableTools?: Map<string, {
|
|
68
|
+
name?: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
}>;
|
|
71
|
+
elementId?: string;
|
|
72
|
+
SESSION_STORAGE_KEY?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Test hook: forget that the unmanaged warning was already logged. */
|
|
75
|
+
export declare function resetBridgeWarning(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Wrap a bridge widget in a controller. Hooks the instance's own methods, so
|
|
78
|
+
* other widgets and the prototype are untouched.
|
|
79
|
+
*/
|
|
80
|
+
export declare function createBridgeController(widget: BridgeWidgetInternals): WebMCPBridgeController;
|
|
81
|
+
/** The controller of the bridge `installBridgedModelContext` installed, or null. */
|
|
82
|
+
export declare function getBridgeController(): WebMCPBridgeController | null;
|
|
83
|
+
/** Make `controller` the editor's bridge (null clears it). Replaces and disposes a previous one. */
|
|
84
|
+
export declare function setBridgeController(controller: WebMCPBridgeController | null): void;
|
|
@@ -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:
|
|
329
|
-
|
|
330
|
-
|
|
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;
|