@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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context menu of a port: "Connect to…" first, then the workflow
|
|
3
|
+
* interface entries (publish, rename, unpublish). Pure: builds entries for
|
|
4
|
+
* `CanvasContextMenu`, which runs them through the editor.
|
|
5
|
+
*
|
|
6
|
+
* @module editor/portMenu
|
|
7
|
+
*/
|
|
8
|
+
import { canConnectFrom } from './connectCandidates.js';
|
|
9
|
+
import { buildPortInterfaceEntries } from './interfaceMenu.js';
|
|
10
|
+
import { defaultMessages } from '../messages/defaults.js';
|
|
11
|
+
/**
|
|
12
|
+
* Entries for a port: "Connect to…" (not on a hidden port or a trigger's
|
|
13
|
+
* event input), a separator, then the interface entries when it has any.
|
|
14
|
+
*/
|
|
15
|
+
export function buildPortMenuEntries(workflow, target, actions, messages = defaultMessages.contextMenu) {
|
|
16
|
+
const connect = canConnectFrom(workflow, target)
|
|
17
|
+
? [
|
|
18
|
+
{
|
|
19
|
+
id: 'connect-to',
|
|
20
|
+
icon: 'mdi:vector-polyline-plus',
|
|
21
|
+
label: messages.connectTo,
|
|
22
|
+
run: () => actions.connectTo(target)
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
: [];
|
|
26
|
+
const iface = buildPortInterfaceEntries(workflow, target, actions, messages);
|
|
27
|
+
return [
|
|
28
|
+
...connect,
|
|
29
|
+
...(connect.length > 0 && iface.length > 0
|
|
30
|
+
? [{ id: 'separator-port', separator: true }]
|
|
31
|
+
: []),
|
|
32
|
+
...iface
|
|
33
|
+
];
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Tidy up" from the canvas: what the toast says, and the steps of the move animation.
|
|
3
|
+
*
|
|
4
|
+
* Pure (no Svelte, no DOM). The tidy itself is the `layout beautify` / `layout node beautify`
|
|
5
|
+
* command; the editor runs it, then uses these to show what happened.
|
|
6
|
+
*
|
|
7
|
+
* @module editor/tidy
|
|
8
|
+
*/
|
|
9
|
+
import type { LayoutResultData } from '../commands/types.js';
|
|
10
|
+
import { defaultMessages } from '../messages/defaults.js';
|
|
11
|
+
type TidyMessages = typeof defaultMessages.tidy;
|
|
12
|
+
/** How long the cards take to slide to their new place. */
|
|
13
|
+
export declare const TIDY_ANIMATION_MS = 250;
|
|
14
|
+
/**
|
|
15
|
+
* What improved, one phrase each, in the order a reader cares about: overlaps and spacing, wires
|
|
16
|
+
* through ports, straight wires, flow direction, crossings. Overlaps and spacing say how many are
|
|
17
|
+
* left. When something got worse (the score ranks overlaps and spacing over wires) a last phrase
|
|
18
|
+
* says what it cost. Empty when nothing changed that it counts.
|
|
19
|
+
*/
|
|
20
|
+
export declare function describeTidy(data: LayoutResultData, messages?: TidyMessages): string[];
|
|
21
|
+
type XY = {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The positions at time `t` (0 to 1) of a move from `from` to `to`. Only ids in both maps that
|
|
27
|
+
* moved are returned; everything else stays where it is.
|
|
28
|
+
*/
|
|
29
|
+
export declare function tweenPositions(from: ReadonlyMap<string, XY>, to: ReadonlyMap<string, XY>, t: number): Map<string, XY>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Tidy up" from the canvas: what the toast says, and the steps of the move animation.
|
|
3
|
+
*
|
|
4
|
+
* Pure (no Svelte, no DOM). The tidy itself is the `layout beautify` / `layout node beautify`
|
|
5
|
+
* command; the editor runs it, then uses these to show what happened.
|
|
6
|
+
*
|
|
7
|
+
* @module editor/tidy
|
|
8
|
+
*/
|
|
9
|
+
import { defaultMessages } from '../messages/defaults.js';
|
|
10
|
+
/** How long the cards take to slide to their new place. */
|
|
11
|
+
export const TIDY_ANIMATION_MS = 250;
|
|
12
|
+
/**
|
|
13
|
+
* What improved, one phrase each, in the order a reader cares about: overlaps and spacing, wires
|
|
14
|
+
* through ports, straight wires, flow direction, crossings. Overlaps and spacing say how many are
|
|
15
|
+
* left. When something got worse (the score ranks overlaps and spacing over wires) a last phrase
|
|
16
|
+
* says what it cost. Empty when nothing changed that it counts.
|
|
17
|
+
*/
|
|
18
|
+
export function describeTidy(data, messages = defaultMessages.tidy) {
|
|
19
|
+
const { before, after } = data;
|
|
20
|
+
const parts = [];
|
|
21
|
+
const gain = (n, say, left) => {
|
|
22
|
+
if (n > 0)
|
|
23
|
+
parts.push(say({ n, left }));
|
|
24
|
+
};
|
|
25
|
+
gain(before.overlaps - after.overlaps, messages.unoverlapped, after.overlaps);
|
|
26
|
+
gain(before.spacing - after.spacing, messages.spaced, after.spacing);
|
|
27
|
+
gain(before.passes - after.passes, messages.unpassed);
|
|
28
|
+
gain(after.straight - before.straight, messages.straightened);
|
|
29
|
+
gain(before.backward - after.backward, messages.unbackward);
|
|
30
|
+
gain(before.crossings - after.crossings, messages.uncrossed);
|
|
31
|
+
// The score ranks overlaps and spacing over wires, so a tidy can trade a worse wire count for
|
|
32
|
+
// them: say so instead of reading as a pure win.
|
|
33
|
+
const costs = [];
|
|
34
|
+
const loss = (n, say) => {
|
|
35
|
+
if (n > 0)
|
|
36
|
+
costs.push(say({ n }));
|
|
37
|
+
};
|
|
38
|
+
loss(after.overlaps - before.overlaps, messages.moreOverlaps);
|
|
39
|
+
loss(after.spacing - before.spacing, messages.moreSpacing);
|
|
40
|
+
loss(after.passes - before.passes, messages.morePassed);
|
|
41
|
+
loss(before.straight - after.straight, messages.fewerStraight);
|
|
42
|
+
loss(after.backward - before.backward, messages.moreBackward);
|
|
43
|
+
loss(after.crossings - before.crossings, messages.moreCrossings);
|
|
44
|
+
if (costs.length)
|
|
45
|
+
parts.push(messages.tradeOff({ what: costs.join(', ') }));
|
|
46
|
+
return parts;
|
|
47
|
+
}
|
|
48
|
+
/** Ease out: fast start, gentle landing. */
|
|
49
|
+
function easeOutCubic(t) {
|
|
50
|
+
return 1 - (1 - t) ** 3;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The positions at time `t` (0 to 1) of a move from `from` to `to`. Only ids in both maps that
|
|
54
|
+
* moved are returned; everything else stays where it is.
|
|
55
|
+
*/
|
|
56
|
+
export function tweenPositions(from, to, t) {
|
|
57
|
+
const k = easeOutCubic(Math.min(1, Math.max(0, t)));
|
|
58
|
+
const out = new Map();
|
|
59
|
+
for (const [id, end] of to) {
|
|
60
|
+
const start = from.get(id);
|
|
61
|
+
if (!start || (start.x === end.x && start.y === end.y))
|
|
62
|
+
continue;
|
|
63
|
+
out.set(id, { x: start.x + (end.x - start.x) * k, y: start.y + (end.y - start.y) * k });
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
@@ -48,6 +48,9 @@ export declare class NodeOperationsHelper {
|
|
|
48
48
|
* run never reached does not keep an older status). With `null`, any
|
|
49
49
|
* executionInfo is removed. Pure: returns new node objects only where
|
|
50
50
|
* something changes, and the same array when nothing does.
|
|
51
|
+
*
|
|
52
|
+
* @deprecated The editor no longer paints status onto nodes: it is kept in
|
|
53
|
+
* `fd.playground.nodeStatuses` and read by the overlay. Removed in 3.0.
|
|
51
54
|
*/
|
|
52
55
|
static applyExecutionInfo<T extends {
|
|
53
56
|
id: string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { hasCycles, hasInvalidCycles } from '../utils/connections.js';
|
|
6
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
7
7
|
import { getDefaultInstance } from '../stores/instanceContainer.svelte.js';
|
|
8
|
+
import { stripExecutionInfo } from '../utils/nodeStatus.js';
|
|
8
9
|
import { nodeExecutionService } from '../services/nodeExecutionService.js';
|
|
9
10
|
import { WorkflowAdapter } from '../adapters/WorkflowAdapter.js';
|
|
10
11
|
import { AgentSpecAdapter } from '../adapters/agentspec/AgentSpecAdapter.js';
|
|
@@ -111,6 +112,9 @@ export class NodeOperationsHelper {
|
|
|
111
112
|
* run never reached does not keep an older status). With `null`, any
|
|
112
113
|
* executionInfo is removed. Pure: returns new node objects only where
|
|
113
114
|
* something changes, and the same array when nothing does.
|
|
115
|
+
*
|
|
116
|
+
* @deprecated The editor no longer paints status onto nodes: it is kept in
|
|
117
|
+
* `fd.playground.nodeStatuses` and read by the overlay. Removed in 3.0.
|
|
114
118
|
*/
|
|
115
119
|
static applyExecutionInfo(nodes, info) {
|
|
116
120
|
if (info === null) {
|
|
@@ -203,7 +207,8 @@ export class WorkflowOperationsHelper {
|
|
|
203
207
|
static updateWorkflow(workflow, nodes, edges) {
|
|
204
208
|
return {
|
|
205
209
|
...workflow,
|
|
206
|
-
|
|
210
|
+
// Run status never goes into the workflow: it lives in fd.playground.
|
|
211
|
+
nodes: stripExecutionInfo(nodes),
|
|
207
212
|
edges,
|
|
208
213
|
metadata: this.generateMetadata(workflow.metadata)
|
|
209
214
|
};
|
|
@@ -266,7 +271,7 @@ export class WorkflowOperationsHelper {
|
|
|
266
271
|
const workflowToSave = {
|
|
267
272
|
id: workflowId,
|
|
268
273
|
name: workflow.name || 'Untitled Workflow',
|
|
269
|
-
nodes: workflow.nodes || [],
|
|
274
|
+
nodes: stripExecutionInfo(workflow.nodes || []),
|
|
270
275
|
edges: workflow.edges || [],
|
|
271
276
|
metadata: {
|
|
272
277
|
schemaVersion: workflow.metadata?.schemaVersion || '1.0.0',
|
|
@@ -310,7 +315,7 @@ export class WorkflowOperationsHelper {
|
|
|
310
315
|
const workflowToExport = {
|
|
311
316
|
id: workflowId,
|
|
312
317
|
name: workflow.name || 'Untitled Workflow',
|
|
313
|
-
nodes: workflow.nodes || [],
|
|
318
|
+
nodes: stripExecutionInfo(workflow.nodes || []),
|
|
314
319
|
edges: workflow.edges || [],
|
|
315
320
|
metadata: {
|
|
316
321
|
schemaVersion: workflow.metadata?.schemaVersion || '1.0.0',
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node layout: build the layout model from a workflow.
|
|
3
|
+
*
|
|
4
|
+
* Handles come from the canvas when it has measured them (`measured`, the same
|
|
5
|
+
* truth "Straighten wires" uses), so every node type is right. Without a
|
|
6
|
+
* measurement a card falls back to the card contract (`computeNodeGeometry`)
|
|
7
|
+
* over its exposed ports in display order, which is exactly what the default
|
|
8
|
+
* card and the gateway render.
|
|
9
|
+
*
|
|
10
|
+
* Either way the port lists decide which handles the `ports` primitive may move:
|
|
11
|
+
* reserved ports, header pins, `loop_back` and gateway branches stay (D4).
|
|
12
|
+
*
|
|
13
|
+
* @module layout/fromWorkflow
|
|
14
|
+
*/
|
|
15
|
+
import type { WorkflowEdge, WorkflowNode } from '../types/index.js';
|
|
16
|
+
import type { LayoutGraph, LayoutHandle } from './types.js';
|
|
17
|
+
/** A card as the canvas measured it: size, and handle centres from its top-left. */
|
|
18
|
+
export interface MeasuredCard {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
inputs: Array<Pick<LayoutHandle, 'portId' | 'dx' | 'dy'>>;
|
|
22
|
+
outputs: Array<Pick<LayoutHandle, 'portId' | 'dx' | 'dy'>>;
|
|
23
|
+
}
|
|
24
|
+
export interface FromWorkflowOptions {
|
|
25
|
+
/** The canvas measurement of a node, or undefined when it has none. */
|
|
26
|
+
measured?: (nodeId: string) => MeasuredCard | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The node's visual type (`note`, `caption`, `gateway`, …). Default: the
|
|
29
|
+
* configured `nodeType`, else the metadata type. The editor passes the
|
|
30
|
+
* registry's resolution.
|
|
31
|
+
*/
|
|
32
|
+
visualType?: (node: WorkflowNode) => string;
|
|
33
|
+
/** The *Show descriptions* setting (the fallback geometry depends on it). */
|
|
34
|
+
showDescriptions?: boolean;
|
|
35
|
+
/** Room each node's interface tags take beside it (`interfaceTagReserve`). */
|
|
36
|
+
tagReserve?: ReadonlyMap<string, {
|
|
37
|
+
left: number;
|
|
38
|
+
right: number;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
/** The layout model of a workflow. Edges without a port on either end are left out. */
|
|
42
|
+
export declare function fromWorkflow(nodes: readonly WorkflowNode[], edges: readonly WorkflowEdge[], options?: FromWorkflowOptions): LayoutGraph;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node layout: build the layout model from a workflow.
|
|
3
|
+
*
|
|
4
|
+
* Handles come from the canvas when it has measured them (`measured`, the same
|
|
5
|
+
* truth "Straighten wires" uses), so every node type is right. Without a
|
|
6
|
+
* measurement a card falls back to the card contract (`computeNodeGeometry`)
|
|
7
|
+
* over its exposed ports in display order, which is exactly what the default
|
|
8
|
+
* card and the gateway render.
|
|
9
|
+
*
|
|
10
|
+
* Either way the port lists decide which handles the `ports` primitive may move:
|
|
11
|
+
* reserved ports, header pins, `loop_back` and gateway branches stay (D4).
|
|
12
|
+
*
|
|
13
|
+
* @module layout/fromWorkflow
|
|
14
|
+
*/
|
|
15
|
+
import { dynamicPortToNodePort } from '../types/index.js';
|
|
16
|
+
import { computeNodeGeometry, NODE_WIDTH } from '../utils/nodeGeometry.js';
|
|
17
|
+
import { isPortVisible, isReservedPort, orderPortsFor } from '../utils/portUtils.js';
|
|
18
|
+
import { extractPortId } from '../utils/handleIds.js';
|
|
19
|
+
import { isLoopbackEdge, LOOPBACK_PORT_NAME } from '../utils/connections.js';
|
|
20
|
+
import { resolveBuiltinAlias } from '../registry/builtinNodeTypes.js';
|
|
21
|
+
/** Size assumed for an annotation that has not been measured. */
|
|
22
|
+
const ANNOTATION_FALLBACK = { width: 280, height: 120 };
|
|
23
|
+
function defaultVisualType(node) {
|
|
24
|
+
const configured = node.data?.config?.nodeType;
|
|
25
|
+
const type = typeof configured === 'string' && configured ? configured : node.data?.metadata?.type;
|
|
26
|
+
return resolveBuiltinAlias(String(type ?? ''));
|
|
27
|
+
}
|
|
28
|
+
function kindFor(visualType) {
|
|
29
|
+
return visualType === 'note' || visualType === 'caption' ? visualType : 'card';
|
|
30
|
+
}
|
|
31
|
+
/** Exposed ports in display order, the way the card renders them. */
|
|
32
|
+
function exposedPorts(node, gateway) {
|
|
33
|
+
const config = node.data?.config ?? {};
|
|
34
|
+
const metadata = node.data?.metadata;
|
|
35
|
+
const portsConfig = config.ports ?? {};
|
|
36
|
+
const dynamic = (key, direction) => gateway
|
|
37
|
+
? []
|
|
38
|
+
: (config[key] ?? []).map((p) => dynamicPortToNodePort(p, direction));
|
|
39
|
+
const inputs = orderPortsFor([...(metadata?.inputs ?? []), ...dynamic('dynamicInputs', 'input')], portsConfig.inputs).filter((port) => isPortVisible(port, 'input', portsConfig));
|
|
40
|
+
const outputs = gateway
|
|
41
|
+
? (config.branches ?? []).map((branch, index) => ({
|
|
42
|
+
id: branch.name,
|
|
43
|
+
name: branch.label || branch.name || String(index + 1),
|
|
44
|
+
type: 'output',
|
|
45
|
+
dataType: 'trigger'
|
|
46
|
+
}))
|
|
47
|
+
: orderPortsFor([...(metadata?.outputs ?? []), ...dynamic('dynamicOutputs', 'output')], portsConfig.outputs).filter((port) => isPortVisible(port, 'output', portsConfig));
|
|
48
|
+
return { inputs, outputs };
|
|
49
|
+
}
|
|
50
|
+
function cardFor(node, options) {
|
|
51
|
+
const visualType = (options.visualType ?? defaultVisualType)(node);
|
|
52
|
+
const kind = kindFor(visualType);
|
|
53
|
+
const measured = options.measured?.(node.id);
|
|
54
|
+
const tags = options.tagReserve?.get(node.id);
|
|
55
|
+
const base = {
|
|
56
|
+
id: node.id,
|
|
57
|
+
kind,
|
|
58
|
+
x: node.position.x,
|
|
59
|
+
y: node.position.y,
|
|
60
|
+
...(tags && (tags.left > 0 || tags.right > 0) ? { tags: { ...tags } } : {})
|
|
61
|
+
};
|
|
62
|
+
if (kind !== 'card') {
|
|
63
|
+
return {
|
|
64
|
+
...base,
|
|
65
|
+
width: measured?.width ?? node.measured?.width ?? node.width ?? ANNOTATION_FALLBACK.width,
|
|
66
|
+
height: measured?.height ?? node.measured?.height ?? node.height ?? ANNOTATION_FALLBACK.height,
|
|
67
|
+
inputs: [],
|
|
68
|
+
outputs: []
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const gateway = visualType === 'gateway';
|
|
72
|
+
const ports = exposedPorts(node, gateway);
|
|
73
|
+
const geometry = computeNodeGeometry({
|
|
74
|
+
inputs: ports.inputs,
|
|
75
|
+
outputs: ports.outputs,
|
|
76
|
+
showDescriptions: options.showDescriptions ?? false,
|
|
77
|
+
execPins: gateway ? 'input' : 'completion'
|
|
78
|
+
});
|
|
79
|
+
const pins = new Set(geometry.handles.filter((h) => h.kind === 'pin').map((h) => `${h.direction}:${h.portId}`));
|
|
80
|
+
const byId = new Map([
|
|
81
|
+
...ports.inputs.map((p) => [`input:${p.id}`, p]),
|
|
82
|
+
...ports.outputs.map((p) => [`output:${p.id}`, p])
|
|
83
|
+
]);
|
|
84
|
+
const fixed = (direction, portId) => {
|
|
85
|
+
if (pins.has(`${direction}:${portId}`))
|
|
86
|
+
return true;
|
|
87
|
+
if (direction === 'output' && gateway)
|
|
88
|
+
return true;
|
|
89
|
+
if (direction === 'input' && portId === LOOPBACK_PORT_NAME)
|
|
90
|
+
return true;
|
|
91
|
+
const port = byId.get(`${direction}:${portId}`);
|
|
92
|
+
return port ? isReservedPort(port) : true;
|
|
93
|
+
};
|
|
94
|
+
const handles = (direction, list) => [...list]
|
|
95
|
+
.sort((a, b) => a.dy - b.dy)
|
|
96
|
+
.map((h) => ({
|
|
97
|
+
portId: h.portId,
|
|
98
|
+
dx: h.dx,
|
|
99
|
+
dy: h.dy,
|
|
100
|
+
...(fixed(direction, h.portId) ? { fixed: true } : {})
|
|
101
|
+
}));
|
|
102
|
+
const computed = (direction) => geometry.handles
|
|
103
|
+
.filter((h) => h.direction === direction)
|
|
104
|
+
.map((h) => ({ portId: h.portId, dx: h.x, dy: h.y }));
|
|
105
|
+
return {
|
|
106
|
+
...base,
|
|
107
|
+
// The canvas measurement when there is one, else the card contract. Never the size saved on
|
|
108
|
+
// the node: it was measured under an older card and goes stale (saved workflows carry a
|
|
109
|
+
// `measured` width of 290), and the handles come from the same contract.
|
|
110
|
+
width: measured?.width ?? geometry.width ?? NODE_WIDTH,
|
|
111
|
+
height: measured?.height ?? geometry.height,
|
|
112
|
+
inputs: handles('input', measured?.inputs ?? computed('input')),
|
|
113
|
+
outputs: handles('output', measured?.outputs ?? computed('output'))
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/** The layout model of a workflow. Edges without a port on either end are left out. */
|
|
117
|
+
export function fromWorkflow(nodes, edges, options = {}) {
|
|
118
|
+
const cards = nodes.map((node) => cardFor(node, options));
|
|
119
|
+
const wires = [];
|
|
120
|
+
for (const edge of edges) {
|
|
121
|
+
const sourcePort = extractPortId(edge.sourceHandle);
|
|
122
|
+
const targetPort = extractPortId(edge.targetHandle);
|
|
123
|
+
if (!sourcePort || !targetPort)
|
|
124
|
+
continue;
|
|
125
|
+
wires.push({
|
|
126
|
+
id: edge.id,
|
|
127
|
+
source: edge.source,
|
|
128
|
+
sourcePort,
|
|
129
|
+
target: edge.target,
|
|
130
|
+
targetPort,
|
|
131
|
+
loopback: isLoopbackEdge(edge) || targetPort === LOOPBACK_PORT_NAME
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return { cards, wires };
|
|
135
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node layout: where the wires run.
|
|
3
|
+
*
|
|
4
|
+
* A wire's two ends come from its cards and handles. Its path is the bezier
|
|
5
|
+
* xyflow draws (`getBezierPath`, right to left, curvature 0.25), sampled into
|
|
6
|
+
* a polyline so crossings can be found with plain segment tests; a loopback
|
|
7
|
+
* drawn as a return lane is a polyline already.
|
|
8
|
+
*
|
|
9
|
+
* Return lanes (decision D5): one track per loopback, the first
|
|
10
|
+
* {@link LANE_CLEARANCE} under the lowest card of its loop body (the cards on a
|
|
11
|
+
* forward path from the loop's target back to its source). Shorter spans are
|
|
12
|
+
* placed first, so a loopback whose span overlaps one already placed goes
|
|
13
|
+
* {@link LANE_TRACK_PITCH} below it: lanes nest instead of crossing, and spans
|
|
14
|
+
* that do not overlap share a track. Loops in rows far apart do not count as
|
|
15
|
+
* overlapping: only lanes whose legs share a y range stack. Any other card under the span has to keep
|
|
16
|
+
* clear of the lane (`measure` counts it as a spacing break). A lane's vertical
|
|
17
|
+
* legs sit one pitch further out per level it wraps, on both ends.
|
|
18
|
+
*
|
|
19
|
+
* @module layout/geometry
|
|
20
|
+
*/
|
|
21
|
+
import { type LayoutCard, type LayoutGraph, type LayoutOptions, type LayoutWire } from './types.js';
|
|
22
|
+
export type XY = readonly [number, number];
|
|
23
|
+
export interface WireEnds {
|
|
24
|
+
sx: number;
|
|
25
|
+
sy: number;
|
|
26
|
+
tx: number;
|
|
27
|
+
ty: number;
|
|
28
|
+
}
|
|
29
|
+
export interface WirePath extends WireEnds {
|
|
30
|
+
wire: LayoutWire;
|
|
31
|
+
/** The path as a polyline. */
|
|
32
|
+
points: XY[];
|
|
33
|
+
/** The lane's y, for a loopback drawn as a lane. */
|
|
34
|
+
laneY?: number;
|
|
35
|
+
/** The loop body, for a loopback drawn as a lane. */
|
|
36
|
+
body?: Set<string>;
|
|
37
|
+
}
|
|
38
|
+
/** Cards by id. */
|
|
39
|
+
export declare function cardIndex(graph: LayoutGraph): Map<string, LayoutCard>;
|
|
40
|
+
/** Where a wire's two handles are, or undefined when a card or a handle is unknown. */
|
|
41
|
+
export declare function wireEnds(wire: LayoutWire, cards: ReadonlyMap<string, LayoutCard>): WireEnds | undefined;
|
|
42
|
+
/** The bezier xyflow draws from a right-side source to a left-side target, as a polyline. */
|
|
43
|
+
export declare function bezierPoints({ sx, sy, tx, ty }: WireEnds): XY[];
|
|
44
|
+
/**
|
|
45
|
+
* A return lane: out of the source, down to the lane, back along it, up into the target.
|
|
46
|
+
*
|
|
47
|
+
* `outDepth` / `inDepth` push the two vertical legs {@link LANE_TRACK_PITCH} further out
|
|
48
|
+
* per level (the source side runs right of the source, the target side left of the
|
|
49
|
+
* target), so on both ends an outer lane turns further out than the inner lane it wraps.
|
|
50
|
+
*/
|
|
51
|
+
export declare function lanePoints({ sx, sy, tx, ty }: WireEnds, laneY: number, outDepth?: number, inDepth?: number): XY[];
|
|
52
|
+
/**
|
|
53
|
+
* The loop body of a loopback: every card on a forward path from the wire's
|
|
54
|
+
* target (the loop) to its source, both included.
|
|
55
|
+
*
|
|
56
|
+
* It depends only on the wires, never on where the cards are, so it is worked out once per wire
|
|
57
|
+
* list (a sweep moves cards a thousand times over the same wires) and the same set is returned
|
|
58
|
+
* every time: do not mutate it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function loopBody(graph: LayoutGraph, wire: LayoutWire): Set<string>;
|
|
61
|
+
/** Where a loopback's lane runs: its y, and how many lanes it wraps (0 = innermost). */
|
|
62
|
+
export interface LaneTrack {
|
|
63
|
+
y: number;
|
|
64
|
+
depth: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The track of every loopback (by wire id). Shorter spans first; a lane goes one
|
|
68
|
+
* track below every placed lane whose span overlaps its own, and one level deeper.
|
|
69
|
+
*/
|
|
70
|
+
export declare function assignTracks(graph: LayoutGraph, cards?: ReadonlyMap<string, LayoutCard>): Map<string, LaneTrack>;
|
|
71
|
+
/** The lane y of every loopback (by wire id). */
|
|
72
|
+
export declare function assignLanes(graph: LayoutGraph, cards?: ReadonlyMap<string, LayoutCard>): Map<string, number>;
|
|
73
|
+
/** A loopback drawn as a return lane. */
|
|
74
|
+
export interface LoopbackLane {
|
|
75
|
+
/** The lane polyline, from the source handle to the target handle. */
|
|
76
|
+
points: XY[];
|
|
77
|
+
/** The lane's y. */
|
|
78
|
+
laneY: number;
|
|
79
|
+
/** The loop body: the cards the lane runs under. */
|
|
80
|
+
body: Set<string>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The return lane of every loopback in the graph, by wire id: the one place a
|
|
84
|
+
* lane's points are made, so what the edge draws and what `measure` counts are
|
|
85
|
+
* the same. Loopbacks into one port share the final climb, which sits as far
|
|
86
|
+
* out as the outermost of them needs.
|
|
87
|
+
*/
|
|
88
|
+
export declare function loopbackLanes(graph: LayoutGraph, cards?: ReadonlyMap<string, LayoutCard>): Map<string, LoopbackLane>;
|
|
89
|
+
/**
|
|
90
|
+
* Every wire whose ends are known, with its path. With `only`, just the wires it picks (a return
|
|
91
|
+
* lane still sees the whole graph: its track depends on the other loopbacks).
|
|
92
|
+
*/
|
|
93
|
+
export declare function wirePaths(graph: LayoutGraph, options: Pick<LayoutOptions, 'loopbacks'>, only?: (wire: LayoutWire) => boolean,
|
|
94
|
+
/** The graph's lanes, when the caller has them already. */
|
|
95
|
+
known?: ReadonlyMap<string, LoopbackLane>): WirePath[];
|
|
96
|
+
/** Where two segments cross, strictly inside both (touching ends do not count). */
|
|
97
|
+
export declare function segmentCrossing(p1: XY, p2: XY, p3: XY, p4: XY): XY | null;
|
|
98
|
+
export type Box = readonly [minX: number, minY: number, maxX: number, maxY: number];
|
|
99
|
+
/** A polyline's bounding box. */
|
|
100
|
+
export declare function boxOf(points: readonly XY[]): Box;
|
|
101
|
+
/** The first point where two polylines cross, or null. */
|
|
102
|
+
export declare function polylineCrossing(a: readonly XY[], b: readonly XY[]): XY | null;
|