@flowdrop/flowdrop 2.10.1 → 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 +385 -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 +1030 -207
- 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 +163 -125
- package/dist/components/ConfigModal.svelte +13 -56
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- 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/ConnectionLine.svelte +1 -1
- 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 +58 -55
- package/dist/components/LoopbackLanes.svelte +54 -0
- package/dist/components/LoopbackLanes.svelte.d.ts +8 -0
- package/dist/components/MarkdownDisplay.svelte +1 -1
- 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/PipelineStatus.svelte +5 -18
- 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/SchemaForm.svelte +1 -1
- package/dist/components/SettingsModal.svelte +28 -60
- package/dist/components/SettingsPanel.svelte +516 -242
- 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 +821 -142
- package/dist/components/WorkflowEditor.svelte.d.ts +43 -1
- package/dist/components/WorkflowInterfaceEditor.svelte +106 -100
- package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
- package/dist/components/WorkflowInterfaceEntryCard.svelte +496 -494
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
- package/dist/components/WorkflowInterfaceEntryComposer.svelte +23 -67
- package/dist/components/WorkflowPlaygroundSettings.svelte +514 -0
- package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
- 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 +464 -313
- 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/index.d.ts +2 -2
- package/dist/components/form/index.js +2 -2
- 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 +318 -188
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- 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 -1087
- 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 +7 -1
- package/dist/components/playground/PlaygroundStudio.svelte +31 -33
- 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 +9 -6
- 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 +15 -0
- package/dist/helpers/workflowEditorHelper.js +39 -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 +694 -26
- package/dist/messages/defaults.js +626 -27
- package/dist/messages/types.d.ts +21 -1
- package/dist/openapi/v1/openapi.yaml +222 -5
- package/dist/playground/index.d.ts +31 -2
- package/dist/playground/index.js +31 -1
- package/dist/playground/mount.d.ts +34 -12
- package/dist/playground/mount.js +80 -35
- package/dist/playground/runAction.d.ts +29 -0
- package/dist/playground/runAction.js +38 -0
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/v1/workflow.schema.json +140 -2
- package/dist/services/doctorService.d.ts +52 -0
- package/dist/services/doctorService.js +113 -0
- package/dist/services/globalSave.js +17 -24
- package/dist/services/nodeExecutionService.d.ts +12 -1
- package/dist/services/nodeExecutionService.js +58 -58
- package/dist/services/playgroundService.d.ts +23 -3
- package/dist/services/playgroundService.js +53 -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/default.d.ts +1 -1
- package/dist/skins/drafter.d.ts +1 -1
- package/dist/skins/graphite.d.ts +26 -0
- package/dist/skins/graphite.js +473 -0
- package/dist/skins/index.d.ts +6 -5
- package/dist/skins/index.js +7 -5
- package/dist/skins/slate.d.ts +1 -1
- 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 +68 -0
- package/dist/stores/instanceContainer.svelte.js +49 -2
- 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 +74 -2
- package/dist/stores/playgroundStore.svelte.js +182 -6
- 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 +18 -1
- package/dist/stores/workflowStore.svelte.js +29 -1
- package/dist/styles/base.css +300 -28
- 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.d.ts +13 -0
- package/dist/styles/tokenAliases.js +206 -0
- 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 +47 -0
- package/dist/themes/scopedSkinCss.js +220 -0
- 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 +103 -6
- package/dist/types/index.js +15 -3
- 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 +23 -10
- 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/playgroundChat.d.ts +121 -0
- package/dist/utils/playgroundChat.js +275 -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 +3 -14
- package/dist/utils/portal.js +22 -0
- 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 +128 -27
- package/dist/utils/workflowInterface.js +244 -33
- 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 +68 -18
- 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.d.ts +6 -0
- package/dist/webmcp/gate.js +8 -0
- package/dist/webmcp/index.d.ts +2 -0
- package/dist/webmcp/index.js +1 -0
- package/dist/webmcp/runtime.js +6 -2
- package/dist/webmcp/types.d.ts +2 -0
- package/dist/webmcp/validate.js +5 -1
- package/package.json +14 -7
- package/dist/components/Button.stories.svelte +0 -65
- package/dist/components/Button.stories.svelte.d.ts +0 -19
- package/dist/components/CanvasBanner.stories.svelte +0 -30
- package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
- package/dist/components/CanvasContextMenu.stories.svelte +0 -63
- package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
- package/dist/components/ConfigPanel.stories.svelte +0 -47
- package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
- package/dist/components/EditorStatusBar.stories.svelte +0 -44
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
- package/dist/components/FlowDropEdge.stories.svelte +0 -197
- package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
- package/dist/components/LoadingSpinner.stories.svelte +0 -30
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
- package/dist/components/Logo.stories.svelte +0 -22
- package/dist/components/Logo.stories.svelte.d.ts +0 -27
- package/dist/components/MarkdownDisplay.stories.svelte +0 -38
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
- package/dist/components/Navbar.stories.svelte +0 -58
- package/dist/components/Navbar.stories.svelte.d.ts +0 -27
- package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
- package/dist/components/SchemaForm.stories.svelte +0 -122
- package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
- package/dist/components/Select.svelte +0 -53
- package/dist/components/Select.svelte.d.ts +0 -15
- package/dist/components/StatusIcon.stories.svelte +0 -60
- package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
- package/dist/components/StatusLabel.stories.svelte +0 -17
- package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
- package/dist/components/ThemeToggle.stories.svelte +0 -25
- package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
- package/dist/components/console/CommandConsole.stories.svelte +0 -111
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormNumberField.stories.svelte +0 -36
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormRangeField.stories.svelte +0 -31
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormSelect.stories.svelte +0 -50
- package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextField.stories.svelte +0 -30
- package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextarea.stories.svelte +0 -34
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormToggle.stories.svelte +0 -30
- package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
- package/dist/components/icons/CommandLineIcon.svelte +0 -15
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +0 -26
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
- package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
- package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/NotesNode.stories.svelte +0 -76
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SquareNode.stories.svelte +0 -127
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/ToolNode.stories.svelte +0 -189
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
- package/dist/components/playground/MessageBubble.stories.svelte +0 -151
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
- package/dist/components/toast/WarningIcon.svelte +0 -28
- package/dist/components/toast/WarningIcon.svelte.d.ts +0 -26
- package/dist/mocks/app-environment.d.ts +0 -8
- package/dist/mocks/app-environment.js +0 -16
- package/dist/mocks/app-forms.d.ts +0 -6
- package/dist/mocks/app-forms.js +0 -29
- package/dist/mocks/app-navigation.d.ts +0 -5
- package/dist/mocks/app-navigation.js +0 -36
- package/dist/mocks/app-stores.d.ts +0 -14
- package/dist/mocks/app-stores.js +0 -26
- package/dist/stories/CanvasDecorator.svelte +0 -49
- package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
- package/dist/stories/EdgeDecorator.svelte +0 -125
- package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
- package/dist/stories/NodeDecorator.svelte +0 -75
- package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
- package/dist/stories/WebMCPFakeAgent.svelte +0 -229
- package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
- package/dist/stories/utils.d.ts +0 -93
- package/dist/stories/utils.js +0 -156
- package/dist/webmcp/WebMCP.stories.svelte +0 -101
- package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
package/dist/utils/nodeStatus.js
CHANGED
|
@@ -3,21 +3,50 @@
|
|
|
3
3
|
* Provides utilities for managing and displaying node execution status
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Map an execution status onto the pill vocabulary; `null` = draw nothing.
|
|
7
|
+
*
|
|
8
|
+
* idle -> null nothing happened (a node that never ran).
|
|
9
|
+
* pending -> null queued, not started: no result and no activity
|
|
10
|
+
* to report yet; the pill appears once it runs.
|
|
11
|
+
* running -> running
|
|
12
|
+
* completed -> completed
|
|
13
|
+
* failed -> failed
|
|
14
|
+
* paused -> waiting the run is held, usually for a person.
|
|
15
|
+
* interrupted -> waiting waiting for a human ("Waiting for you").
|
|
16
|
+
* skipped -> skipped
|
|
17
|
+
* cancelled -> skipped the node did not finish and has no result.
|
|
18
|
+
*/
|
|
19
|
+
export function toPillStatus(status) {
|
|
20
|
+
switch (status) {
|
|
21
|
+
case 'running':
|
|
22
|
+
case 'completed':
|
|
23
|
+
case 'failed':
|
|
24
|
+
case 'skipped':
|
|
25
|
+
return status;
|
|
26
|
+
case 'paused':
|
|
27
|
+
case 'interrupted':
|
|
28
|
+
return 'waiting';
|
|
29
|
+
case 'cancelled':
|
|
30
|
+
return 'skipped';
|
|
31
|
+
default:
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** The `--fd-status-*` token name for an execution status (idle falls back to skipped's muted tone). */
|
|
36
|
+
function statusToken(status) {
|
|
37
|
+
switch (status) {
|
|
38
|
+
case 'pending':
|
|
39
|
+
return 'waiting';
|
|
40
|
+
default:
|
|
41
|
+
return toPillStatus(status) ?? 'skipped';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the display color for a node execution status, as a CSS value
|
|
46
|
+
* (`var(--fd-status-*)`), so themes and dark mode apply. Only valid in CSS.
|
|
7
47
|
*/
|
|
8
48
|
export function getStatusColor(status) {
|
|
9
|
-
|
|
10
|
-
idle: '#6b7280', // gray
|
|
11
|
-
pending: '#f59e0b', // amber
|
|
12
|
-
running: '#3b82f6', // blue
|
|
13
|
-
completed: '#10b981', // emerald
|
|
14
|
-
failed: '#ef4444', // red
|
|
15
|
-
cancelled: '#6b7280', // gray
|
|
16
|
-
skipped: '#8b5cf6', // violet
|
|
17
|
-
paused: '#f97316', // orange
|
|
18
|
-
interrupted: '#06b6d4' // cyan
|
|
19
|
-
};
|
|
20
|
-
return statusColors[status] || statusColors.idle;
|
|
49
|
+
return `var(--fd-status-${statusToken(status)})`;
|
|
21
50
|
}
|
|
22
51
|
/**
|
|
23
52
|
* Get the display icon for a node execution status
|
|
@@ -54,38 +83,18 @@ export function getStatusLabel(status) {
|
|
|
54
83
|
return statusLabels[status] || statusLabels.idle;
|
|
55
84
|
}
|
|
56
85
|
/**
|
|
57
|
-
* Get the background color for a node execution status overlay
|
|
86
|
+
* Get the background color for a node execution status overlay, as a CSS value
|
|
87
|
+
* (`var(--fd-status-*-soft)`).
|
|
58
88
|
*/
|
|
59
89
|
export function getStatusBackgroundColor(status) {
|
|
60
|
-
|
|
61
|
-
idle: '#f9fafb', // light gray
|
|
62
|
-
pending: '#fef3c7', // light amber
|
|
63
|
-
running: '#dbeafe', // light blue
|
|
64
|
-
completed: '#d1fae5', // light emerald
|
|
65
|
-
failed: '#fee2e2', // light red
|
|
66
|
-
cancelled: '#f3f4f6', // light gray
|
|
67
|
-
skipped: '#ede9fe', // light violet
|
|
68
|
-
paused: '#ffedd5', // light orange
|
|
69
|
-
interrupted: '#cffafe' // light cyan
|
|
70
|
-
};
|
|
71
|
-
return statusBackgroundColors[status] || statusBackgroundColors.idle;
|
|
90
|
+
return `var(--fd-status-${statusToken(status)}-soft)`;
|
|
72
91
|
}
|
|
73
92
|
/**
|
|
74
|
-
* Get the text color for a node execution status overlay
|
|
93
|
+
* Get the text color for a node execution status overlay, as a CSS value.
|
|
94
|
+
* Same as {@link getStatusColor}: the status tokens are text-safe on `-soft`.
|
|
75
95
|
*/
|
|
76
96
|
export function getStatusTextColor(status) {
|
|
77
|
-
|
|
78
|
-
idle: '#6b7280', // gray
|
|
79
|
-
pending: '#d97706', // amber
|
|
80
|
-
running: '#1d4ed8', // blue
|
|
81
|
-
completed: '#059669', // emerald
|
|
82
|
-
failed: '#dc2626', // red
|
|
83
|
-
cancelled: '#6b7280', // gray
|
|
84
|
-
skipped: '#7c3aed', // violet
|
|
85
|
-
paused: '#ea580c', // orange
|
|
86
|
-
interrupted: '#0891b2' // cyan
|
|
87
|
-
};
|
|
88
|
-
return statusTextColors[status] || statusTextColors.idle;
|
|
97
|
+
return getStatusColor(status);
|
|
89
98
|
}
|
|
90
99
|
/**
|
|
91
100
|
* Create a default NodeExecutionInfo object
|
|
@@ -191,3 +200,22 @@ export function formatLastExecuted(timestamp) {
|
|
|
191
200
|
return date.toLocaleDateString();
|
|
192
201
|
}
|
|
193
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Remove `data.executionInfo` from every node.
|
|
205
|
+
*
|
|
206
|
+
* Run status belongs to a run, not to the workflow: it lives in the
|
|
207
|
+
* instance's `PlaygroundStore` (`fd.playground.nodeStatuses`) and must never
|
|
208
|
+
* be written into a workflow that is synced to the store, saved or exported.
|
|
209
|
+
* Returns the same array when no node carries it, otherwise new node objects
|
|
210
|
+
* for those that did.
|
|
211
|
+
*/
|
|
212
|
+
export function stripExecutionInfo(nodes) {
|
|
213
|
+
if (!nodes.some((node) => 'executionInfo' in node.data))
|
|
214
|
+
return nodes;
|
|
215
|
+
return nodes.map((node) => {
|
|
216
|
+
if (!('executionInfo' in node.data))
|
|
217
|
+
return node;
|
|
218
|
+
const { executionInfo: _dropped, ...data } = node.data;
|
|
219
|
+
return { ...node, data };
|
|
220
|
+
});
|
|
221
|
+
}
|
package/dist/utils/nodeSwap.js
CHANGED
|
@@ -218,7 +218,15 @@ export function getVersionUpgrade(currentMetadata, allNodeTypes) {
|
|
|
218
218
|
const available = allNodeTypes.find((n) => n.node_type_id === currentMetadata.node_type_id);
|
|
219
219
|
if (!available)
|
|
220
220
|
return null;
|
|
221
|
-
|
|
221
|
+
// Backends may omit the version (FlowDrop for Drupal sends none); without
|
|
222
|
+
// both there is nothing to compare, so no upgrade is offered.
|
|
223
|
+
const availableVersion = available.version;
|
|
224
|
+
const currentVersion = currentMetadata.version;
|
|
225
|
+
if (typeof availableVersion !== 'string' || typeof currentVersion !== 'string')
|
|
226
|
+
return null;
|
|
227
|
+
if (availableVersion === '' || currentVersion === '')
|
|
228
|
+
return null;
|
|
229
|
+
if (compareSemver(availableVersion, currentVersion) > 0) {
|
|
222
230
|
return available;
|
|
223
231
|
}
|
|
224
232
|
return null;
|
|
@@ -9,6 +9,7 @@ import type { NodeExecutionInfo } from '../types/index.js';
|
|
|
9
9
|
export interface NodeStatusConfig {
|
|
10
10
|
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
/** @deprecated No effect: the badge shows status only. Details are in the inspector's Last run tab. */
|
|
12
13
|
showDetails?: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A workflow's chat binding (its Playground settings).
|
|
3
|
+
*
|
|
4
|
+
* Which interface input the person's message fills, which one receives recent
|
|
5
|
+
* messages and the two ids, and which node output ports print as replies.
|
|
6
|
+
* Stored per workflow by the Playground (`workflow.playground.chat`) and saved
|
|
7
|
+
* with the workflow. A workflow without stored settings falls back to the
|
|
8
|
+
* deprecated interface `turn` annotations until 3.0, and otherwise has no
|
|
9
|
+
* chat until somebody sets it up.
|
|
10
|
+
*
|
|
11
|
+
* Pure functions over the workflow document: no store, no node graph (the
|
|
12
|
+
* graph-aware checks are `playgroundChatIssues` in `workflowInterface.ts`),
|
|
13
|
+
* never throw, never mutate their arguments.
|
|
14
|
+
*
|
|
15
|
+
* @module utils/playgroundChat
|
|
16
|
+
*/
|
|
17
|
+
import type { PlaygroundChatBinding, PlaygroundChatSource, Workflow, WorkflowInterface, WorkflowPlayground } from '../types/index.js';
|
|
18
|
+
/** The binding in effect for a workflow, and where it came from. */
|
|
19
|
+
export interface ResolvedPlaygroundChat {
|
|
20
|
+
binding: PlaygroundChatBinding;
|
|
21
|
+
source: PlaygroundChatSource;
|
|
22
|
+
}
|
|
23
|
+
/** A binding that binds nothing. */
|
|
24
|
+
export declare function emptyPlaygroundChat(): PlaygroundChatBinding;
|
|
25
|
+
/**
|
|
26
|
+
* A binding in its full shape, every key present. Malformed parts are dropped
|
|
27
|
+
* rather than trusted (the server refuses them on save); a history limit that
|
|
28
|
+
* is not a positive integer falls back to the default.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizePlaygroundChat(chat: unknown): PlaygroundChatBinding;
|
|
31
|
+
/**
|
|
32
|
+
* The binding the deprecated interface `turn` annotations declare, or `null`
|
|
33
|
+
* when no entry declares one. The first input per turn value wins (as on the
|
|
34
|
+
* server); every output with `turn: reply` becomes a reply on the port it is
|
|
35
|
+
* bound to.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated since 2.11.0, removed in 3.0 with interface `turn`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function interfaceTurnChat(workflowInterface: WorkflowInterface | undefined): PlaygroundChatBinding | null;
|
|
40
|
+
/**
|
|
41
|
+
* The binding in effect for the workflow as it is now, or `null` when the
|
|
42
|
+
* workflow carries no `playground` key (a server before FlowDrop 2.7.0: the
|
|
43
|
+
* caller keeps its pre-settings behaviour).
|
|
44
|
+
*
|
|
45
|
+
* The same rule the server applies: stored settings win, then the deprecated
|
|
46
|
+
* interface `turn`, else nothing. An input name the interface no longer has
|
|
47
|
+
* binds nothing. Computed from the document rather than read from
|
|
48
|
+
* `playground.resolved`, which goes stale on the first edit.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolvePlaygroundChat(workflow: Pick<Workflow, 'interface' | 'playground'> | null | undefined): ResolvedPlaygroundChat | null;
|
|
51
|
+
/** The interface inputs a binding fills (so a form must not ask for them). */
|
|
52
|
+
export declare function playgroundBoundInputs(binding: PlaygroundChatBinding): Set<string>;
|
|
53
|
+
/** Whether a binding states anything at all (else it is the same as none). */
|
|
54
|
+
export declare function isPlaygroundChatSet(binding: PlaygroundChatBinding): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a binding is half set: a message input is bound but no reply is,
|
|
57
|
+
* so the person can type but nothing ever answers.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isPlaygroundChatHalfSet(binding: PlaygroundChatBinding): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The `playground` value after replacing its stored binding. `null` (or a
|
|
62
|
+
* binding that binds nothing) clears it: the workflow then has no stored
|
|
63
|
+
* settings. Server-computed `resolved`/`source` are dropped, since they no
|
|
64
|
+
* longer describe the workflow.
|
|
65
|
+
*/
|
|
66
|
+
export declare function withPlaygroundChat(playground: WorkflowPlayground | undefined, chat: PlaygroundChatBinding | null): WorkflowPlayground;
|
|
67
|
+
/**
|
|
68
|
+
* The `playground` value a save sends: only the stored binding (`chat`), or
|
|
69
|
+
* `undefined` when the workflow carries no Playground settings at all (a
|
|
70
|
+
* server before FlowDrop 2.7.0, which must not receive the key).
|
|
71
|
+
*/
|
|
72
|
+
export declare function playgroundForSave(playground: WorkflowPlayground | undefined): {
|
|
73
|
+
chat: PlaygroundChatBinding | null;
|
|
74
|
+
} | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* An interface edit that changes which input ids exist: one renamed (`id` →
|
|
77
|
+
* `to`) or removed. Reported by `WorkflowInterfaceEditor` only when no other
|
|
78
|
+
* input still carries `id`.
|
|
79
|
+
*/
|
|
80
|
+
export type InterfaceInputEdit = {
|
|
81
|
+
kind: 'rename';
|
|
82
|
+
id: string;
|
|
83
|
+
to: string;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'remove';
|
|
86
|
+
id: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The `playground` value that follows an interface edit: a renamed input is
|
|
90
|
+
* renamed in the stored binding, a removed one is unbound (so the binding
|
|
91
|
+
* never names an input the interface no longer has, which the server refuses
|
|
92
|
+
* on save). The same object when the binding does not name the input, or
|
|
93
|
+
* nothing is stored.
|
|
94
|
+
*/
|
|
95
|
+
export declare function followInterfaceInputEdit(playground: WorkflowPlayground | undefined, edit: InterfaceInputEdit): WorkflowPlayground | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* The `playground` value after a node swap: replies on `oldNodeId` move to
|
|
98
|
+
* `newNodeId`, each on the output port its mapping names. A reply whose port
|
|
99
|
+
* has no mapping is left as it was, so it shows as a reply on a missing node
|
|
100
|
+
* rather than vanishing (as interface bindings do). The same object when no
|
|
101
|
+
* reply is on the old node.
|
|
102
|
+
*/
|
|
103
|
+
export declare function rewritePlaygroundReplies(playground: WorkflowPlayground | undefined, oldNodeId: string, newNodeId: string, portMappings: ReadonlyArray<{
|
|
104
|
+
direction: 'input' | 'output';
|
|
105
|
+
oldPortId: string;
|
|
106
|
+
newPortId: string;
|
|
107
|
+
}>): WorkflowPlayground | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the interface still carries a deprecated `turn` mark this library
|
|
110
|
+
* knows (one `withoutInterfaceTurns` removes).
|
|
111
|
+
*/
|
|
112
|
+
export declare function hasKnownInterfaceTurns(workflowInterface: WorkflowInterface | undefined): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The interface with every deprecated `turn` mark this library knows removed
|
|
115
|
+
* (and a history entry's `meta.limit`, which only `turn: history` gave a
|
|
116
|
+
* meaning), for the step that moves the marks into Playground settings. Other
|
|
117
|
+
* `meta` keys stay; an entry left with an empty `meta` loses the key. A turn
|
|
118
|
+
* value from a newer server is not part of the move, so it stays and
|
|
119
|
+
* round-trips verbatim.
|
|
120
|
+
*/
|
|
121
|
+
export declare function withoutInterfaceTurns(workflowInterface: WorkflowInterface | undefined): WorkflowInterface | undefined;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A workflow's chat binding (its Playground settings).
|
|
3
|
+
*
|
|
4
|
+
* Which interface input the person's message fills, which one receives recent
|
|
5
|
+
* messages and the two ids, and which node output ports print as replies.
|
|
6
|
+
* Stored per workflow by the Playground (`workflow.playground.chat`) and saved
|
|
7
|
+
* with the workflow. A workflow without stored settings falls back to the
|
|
8
|
+
* deprecated interface `turn` annotations until 3.0, and otherwise has no
|
|
9
|
+
* chat until somebody sets it up.
|
|
10
|
+
*
|
|
11
|
+
* Pure functions over the workflow document: no store, no node graph (the
|
|
12
|
+
* graph-aware checks are `playgroundChatIssues` in `workflowInterface.ts`),
|
|
13
|
+
* never throw, never mutate their arguments.
|
|
14
|
+
*
|
|
15
|
+
* @module utils/playgroundChat
|
|
16
|
+
*/
|
|
17
|
+
import { DEFAULT_HISTORY_TURN_LIMIT, WORKFLOW_INTERFACE_INPUT_TURNS, WORKFLOW_INTERFACE_OUTPUT_TURNS } from '../types/index.js';
|
|
18
|
+
/** A binding that binds nothing. */
|
|
19
|
+
export function emptyPlaygroundChat() {
|
|
20
|
+
return {
|
|
21
|
+
message: null,
|
|
22
|
+
history: null,
|
|
23
|
+
session_id: null,
|
|
24
|
+
message_id: null,
|
|
25
|
+
replies: [],
|
|
26
|
+
sub_workflow_replies: false
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A binding in its full shape, every key present. Malformed parts are dropped
|
|
31
|
+
* rather than trusted (the server refuses them on save); a history limit that
|
|
32
|
+
* is not a positive integer falls back to the default.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizePlaygroundChat(chat) {
|
|
35
|
+
const source = isRecord(chat) ? chat : {};
|
|
36
|
+
const name = (value) => typeof value === 'string' && value !== '' ? value : null;
|
|
37
|
+
const history = isRecord(source.history) ? source.history : null;
|
|
38
|
+
const historyInput = history ? name(history.input) : null;
|
|
39
|
+
const limit = history?.limit;
|
|
40
|
+
const replies = [];
|
|
41
|
+
for (const reply of Array.isArray(source.replies) ? source.replies : []) {
|
|
42
|
+
const nodeId = isRecord(reply) ? name(reply.node_id) : null;
|
|
43
|
+
const port = isRecord(reply) ? name(reply.port) : null;
|
|
44
|
+
if (nodeId !== null && port !== null)
|
|
45
|
+
replies.push({ node_id: nodeId, port });
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
message: name(source.message),
|
|
49
|
+
history: historyInput === null
|
|
50
|
+
? null
|
|
51
|
+
: {
|
|
52
|
+
input: historyInput,
|
|
53
|
+
limit: typeof limit === 'number' && Number.isInteger(limit) && limit >= 1
|
|
54
|
+
? limit
|
|
55
|
+
: DEFAULT_HISTORY_TURN_LIMIT
|
|
56
|
+
},
|
|
57
|
+
session_id: name(source.session_id),
|
|
58
|
+
message_id: name(source.message_id),
|
|
59
|
+
replies,
|
|
60
|
+
sub_workflow_replies: source.sub_workflow_replies === true
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The binding the deprecated interface `turn` annotations declare, or `null`
|
|
65
|
+
* when no entry declares one. The first input per turn value wins (as on the
|
|
66
|
+
* server); every output with `turn: reply` becomes a reply on the port it is
|
|
67
|
+
* bound to.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated since 2.11.0, removed in 3.0 with interface `turn`.
|
|
70
|
+
*/
|
|
71
|
+
export function interfaceTurnChat(workflowInterface) {
|
|
72
|
+
const inputs = workflowInterface?.inputs ?? [];
|
|
73
|
+
const outputs = workflowInterface?.outputs ?? [];
|
|
74
|
+
if (![...inputs, ...outputs].some((entry) => Boolean(entry.turn)))
|
|
75
|
+
return null;
|
|
76
|
+
const first = (turn) => inputs.find((entry) => entry.turn === turn);
|
|
77
|
+
const history = first('history');
|
|
78
|
+
const limit = history?.meta?.limit;
|
|
79
|
+
const replies = [];
|
|
80
|
+
for (const entry of outputs) {
|
|
81
|
+
const target = entry.bindings[0];
|
|
82
|
+
if (entry.turn === 'reply' && target) {
|
|
83
|
+
replies.push({ node_id: target.nodeId, port: target.portId });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
message: first('message')?.id ?? null,
|
|
88
|
+
history: history
|
|
89
|
+
? {
|
|
90
|
+
input: history.id,
|
|
91
|
+
limit: typeof limit === 'number' && Number.isInteger(limit) && limit > 0
|
|
92
|
+
? limit
|
|
93
|
+
: DEFAULT_HISTORY_TURN_LIMIT
|
|
94
|
+
}
|
|
95
|
+
: null,
|
|
96
|
+
session_id: first('session_id')?.id ?? null,
|
|
97
|
+
message_id: first('message_id')?.id ?? null,
|
|
98
|
+
replies,
|
|
99
|
+
sub_workflow_replies: false
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The binding in effect for the workflow as it is now, or `null` when the
|
|
104
|
+
* workflow carries no `playground` key (a server before FlowDrop 2.7.0: the
|
|
105
|
+
* caller keeps its pre-settings behaviour).
|
|
106
|
+
*
|
|
107
|
+
* The same rule the server applies: stored settings win, then the deprecated
|
|
108
|
+
* interface `turn`, else nothing. An input name the interface no longer has
|
|
109
|
+
* binds nothing. Computed from the document rather than read from
|
|
110
|
+
* `playground.resolved`, which goes stale on the first edit.
|
|
111
|
+
*/
|
|
112
|
+
export function resolvePlaygroundChat(workflow) {
|
|
113
|
+
const playground = workflow?.playground;
|
|
114
|
+
if (playground === undefined)
|
|
115
|
+
return null;
|
|
116
|
+
const stored = playground.chat ? normalizePlaygroundChat(playground.chat) : null;
|
|
117
|
+
const fromTurn = stored ? null : interfaceTurnChat(workflow?.interface);
|
|
118
|
+
const binding = stored ?? fromTurn;
|
|
119
|
+
if (binding === null)
|
|
120
|
+
return { binding: emptyPlaygroundChat(), source: 'none' };
|
|
121
|
+
const inputIds = new Set((workflow?.interface?.inputs ?? []).map((entry) => entry.id));
|
|
122
|
+
const known = (id) => (id !== null && inputIds.has(id) ? id : null);
|
|
123
|
+
const historyInput = binding.history ? known(binding.history.input) : null;
|
|
124
|
+
return {
|
|
125
|
+
binding: {
|
|
126
|
+
...binding,
|
|
127
|
+
message: known(binding.message),
|
|
128
|
+
history: binding.history && historyInput !== null ? binding.history : null,
|
|
129
|
+
session_id: known(binding.session_id),
|
|
130
|
+
message_id: known(binding.message_id)
|
|
131
|
+
},
|
|
132
|
+
source: stored ? 'settings' : 'interface_turn'
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/** The interface inputs a binding fills (so a form must not ask for them). */
|
|
136
|
+
export function playgroundBoundInputs(binding) {
|
|
137
|
+
const ids = [
|
|
138
|
+
binding.message,
|
|
139
|
+
binding.history?.input ?? null,
|
|
140
|
+
binding.session_id,
|
|
141
|
+
binding.message_id
|
|
142
|
+
];
|
|
143
|
+
return new Set(ids.filter((id) => id !== null));
|
|
144
|
+
}
|
|
145
|
+
/** Whether a binding states anything at all (else it is the same as none). */
|
|
146
|
+
export function isPlaygroundChatSet(binding) {
|
|
147
|
+
return (playgroundBoundInputs(binding).size > 0 ||
|
|
148
|
+
binding.replies.length > 0 ||
|
|
149
|
+
binding.sub_workflow_replies);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Whether a binding is half set: a message input is bound but no reply is,
|
|
153
|
+
* so the person can type but nothing ever answers.
|
|
154
|
+
*/
|
|
155
|
+
export function isPlaygroundChatHalfSet(binding) {
|
|
156
|
+
return binding.message !== null && binding.replies.length === 0;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The `playground` value after replacing its stored binding. `null` (or a
|
|
160
|
+
* binding that binds nothing) clears it: the workflow then has no stored
|
|
161
|
+
* settings. Server-computed `resolved`/`source` are dropped, since they no
|
|
162
|
+
* longer describe the workflow.
|
|
163
|
+
*/
|
|
164
|
+
export function withPlaygroundChat(playground, chat) {
|
|
165
|
+
const next = chat && isPlaygroundChatSet(chat) ? normalizePlaygroundChat(chat) : null;
|
|
166
|
+
const rest = { ...(playground ?? { chat: null }), chat: next };
|
|
167
|
+
delete rest.resolved;
|
|
168
|
+
delete rest.source;
|
|
169
|
+
return rest;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The `playground` value a save sends: only the stored binding (`chat`), or
|
|
173
|
+
* `undefined` when the workflow carries no Playground settings at all (a
|
|
174
|
+
* server before FlowDrop 2.7.0, which must not receive the key).
|
|
175
|
+
*/
|
|
176
|
+
export function playgroundForSave(playground) {
|
|
177
|
+
if (playground === undefined)
|
|
178
|
+
return undefined;
|
|
179
|
+
return { chat: playground.chat ? normalizePlaygroundChat(playground.chat) : null };
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The `playground` value that follows an interface edit: a renamed input is
|
|
183
|
+
* renamed in the stored binding, a removed one is unbound (so the binding
|
|
184
|
+
* never names an input the interface no longer has, which the server refuses
|
|
185
|
+
* on save). The same object when the binding does not name the input, or
|
|
186
|
+
* nothing is stored.
|
|
187
|
+
*/
|
|
188
|
+
export function followInterfaceInputEdit(playground, edit) {
|
|
189
|
+
if (!playground?.chat)
|
|
190
|
+
return playground;
|
|
191
|
+
const chat = normalizePlaygroundChat(playground.chat);
|
|
192
|
+
if (!playgroundBoundInputs(chat).has(edit.id))
|
|
193
|
+
return playground;
|
|
194
|
+
const to = edit.kind === 'rename' && edit.to !== '' ? edit.to : null;
|
|
195
|
+
const swap = (id) => (id === edit.id ? to : id);
|
|
196
|
+
return withPlaygroundChat(playground, {
|
|
197
|
+
...chat,
|
|
198
|
+
message: swap(chat.message),
|
|
199
|
+
history: chat.history && chat.history.input === edit.id
|
|
200
|
+
? to === null
|
|
201
|
+
? null
|
|
202
|
+
: { ...chat.history, input: to }
|
|
203
|
+
: chat.history,
|
|
204
|
+
session_id: swap(chat.session_id),
|
|
205
|
+
message_id: swap(chat.message_id)
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The `playground` value after a node swap: replies on `oldNodeId` move to
|
|
210
|
+
* `newNodeId`, each on the output port its mapping names. A reply whose port
|
|
211
|
+
* has no mapping is left as it was, so it shows as a reply on a missing node
|
|
212
|
+
* rather than vanishing (as interface bindings do). The same object when no
|
|
213
|
+
* reply is on the old node.
|
|
214
|
+
*/
|
|
215
|
+
export function rewritePlaygroundReplies(playground, oldNodeId, newNodeId, portMappings) {
|
|
216
|
+
if (!playground?.chat)
|
|
217
|
+
return playground;
|
|
218
|
+
const chat = normalizePlaygroundChat(playground.chat);
|
|
219
|
+
if (!chat.replies.some((reply) => reply.node_id === oldNodeId))
|
|
220
|
+
return playground;
|
|
221
|
+
const replies = chat.replies.map((reply) => {
|
|
222
|
+
if (reply.node_id !== oldNodeId)
|
|
223
|
+
return reply;
|
|
224
|
+
const mapping = portMappings.find((candidate) => candidate.direction === 'output' && candidate.oldPortId === reply.port);
|
|
225
|
+
return mapping ? { node_id: newNodeId, port: mapping.newPortId } : reply;
|
|
226
|
+
});
|
|
227
|
+
return withPlaygroundChat(playground, { ...chat, replies });
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Whether the interface still carries a deprecated `turn` mark this library
|
|
231
|
+
* knows (one `withoutInterfaceTurns` removes).
|
|
232
|
+
*/
|
|
233
|
+
export function hasKnownInterfaceTurns(workflowInterface) {
|
|
234
|
+
const entries = [...(workflowInterface?.inputs ?? []), ...(workflowInterface?.outputs ?? [])];
|
|
235
|
+
return entries.some((entry) => entry.turn !== undefined && KNOWN_TURNS.has(entry.turn));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The interface with every deprecated `turn` mark this library knows removed
|
|
239
|
+
* (and a history entry's `meta.limit`, which only `turn: history` gave a
|
|
240
|
+
* meaning), for the step that moves the marks into Playground settings. Other
|
|
241
|
+
* `meta` keys stay; an entry left with an empty `meta` loses the key. A turn
|
|
242
|
+
* value from a newer server is not part of the move, so it stays and
|
|
243
|
+
* round-trips verbatim.
|
|
244
|
+
*/
|
|
245
|
+
export function withoutInterfaceTurns(workflowInterface) {
|
|
246
|
+
if (workflowInterface === undefined)
|
|
247
|
+
return undefined;
|
|
248
|
+
const strip = (entry) => {
|
|
249
|
+
if (entry.turn === undefined || !KNOWN_TURNS.has(entry.turn))
|
|
250
|
+
return entry;
|
|
251
|
+
const next = { ...entry };
|
|
252
|
+
delete next.turn;
|
|
253
|
+
if (entry.turn === 'history' && next.meta && 'limit' in next.meta) {
|
|
254
|
+
const meta = { ...next.meta };
|
|
255
|
+
delete meta.limit;
|
|
256
|
+
if (Object.keys(meta).length > 0)
|
|
257
|
+
next.meta = meta;
|
|
258
|
+
else
|
|
259
|
+
delete next.meta;
|
|
260
|
+
}
|
|
261
|
+
return next;
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
...workflowInterface,
|
|
265
|
+
...(workflowInterface.inputs && { inputs: workflowInterface.inputs.map(strip) }),
|
|
266
|
+
...(workflowInterface.outputs && { outputs: workflowInterface.outputs.map(strip) })
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const KNOWN_TURNS = new Set([
|
|
270
|
+
...WORKFLOW_INTERFACE_INPUT_TURNS,
|
|
271
|
+
...WORKFLOW_INTERFACE_OUTPUT_TURNS
|
|
272
|
+
]);
|
|
273
|
+
function isRecord(value) {
|
|
274
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
275
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Playground's history chip lists: the conversations (sessions the
|
|
3
|
+
* Playground created) and the runs of the open conversation.
|
|
4
|
+
*
|
|
5
|
+
* Pure: no store, no fetch, never throws, never mutates its arguments.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/playgroundHistory
|
|
8
|
+
*/
|
|
9
|
+
import type { PlaygroundSession, SessionRunsResult } from '../types/playground.js';
|
|
10
|
+
/** One conversation in the history chip. */
|
|
11
|
+
export interface HistoryConversation {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** The conversation that is open. */
|
|
15
|
+
current: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** One run in the history chip. */
|
|
18
|
+
export interface HistoryRun {
|
|
19
|
+
/** Pipeline id of the run. */
|
|
20
|
+
id: string;
|
|
21
|
+
/** 1 for the first run of the conversation. */
|
|
22
|
+
number: number;
|
|
23
|
+
status: string;
|
|
24
|
+
/** What started it: the person's message, when the server reports one. */
|
|
25
|
+
message: string | null;
|
|
26
|
+
startedAt: string | null;
|
|
27
|
+
/** It ran on another version of the workflow than the current one. */
|
|
28
|
+
stale: boolean;
|
|
29
|
+
/** It is the run the view is on (pinned, or the latest). */
|
|
30
|
+
shown: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** The two groups of the history chip. */
|
|
33
|
+
export interface HistoryGroups {
|
|
34
|
+
conversations: HistoryConversation[];
|
|
35
|
+
/** Newest first. */
|
|
36
|
+
runs: HistoryRun[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Group the history: conversations as the store lists them, runs of the open
|
|
40
|
+
* conversation newest first with stale ones marked ({@link isRunStale}
|
|
41
|
+
* against the version the runs endpoint reports as current).
|
|
42
|
+
*
|
|
43
|
+
* @param sessions - The sessions to list (already the Playground's own)
|
|
44
|
+
* @param currentSessionId - The open conversation
|
|
45
|
+
* @param runs - `GET /sessions/{id}/runs` for the open conversation, or `null`
|
|
46
|
+
* @param shownRunId - The run the view is on
|
|
47
|
+
*/
|
|
48
|
+
export declare function historyGroups(sessions: readonly PlaygroundSession[], currentSessionId: string | null | undefined, runs: SessionRunsResult | null | undefined, shownRunId?: string | null): HistoryGroups;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Playground's history chip lists: the conversations (sessions the
|
|
3
|
+
* Playground created) and the runs of the open conversation.
|
|
4
|
+
*
|
|
5
|
+
* Pure: no store, no fetch, never throws, never mutates its arguments.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/playgroundHistory
|
|
8
|
+
*/
|
|
9
|
+
import { isRunStale } from './sessionRuns.js';
|
|
10
|
+
/**
|
|
11
|
+
* Group the history: conversations as the store lists them, runs of the open
|
|
12
|
+
* conversation newest first with stale ones marked ({@link isRunStale}
|
|
13
|
+
* against the version the runs endpoint reports as current).
|
|
14
|
+
*
|
|
15
|
+
* @param sessions - The sessions to list (already the Playground's own)
|
|
16
|
+
* @param currentSessionId - The open conversation
|
|
17
|
+
* @param runs - `GET /sessions/{id}/runs` for the open conversation, or `null`
|
|
18
|
+
* @param shownRunId - The run the view is on
|
|
19
|
+
*/
|
|
20
|
+
export function historyGroups(sessions, currentSessionId, runs, shownRunId) {
|
|
21
|
+
const conversations = sessions.map((session) => ({
|
|
22
|
+
id: session.id,
|
|
23
|
+
name: session.name,
|
|
24
|
+
current: session.id === currentSessionId
|
|
25
|
+
}));
|
|
26
|
+
const list = runs?.runs ?? [];
|
|
27
|
+
const current = runs?.workflowVersion ?? null;
|
|
28
|
+
const items = list.map((run, index) => ({
|
|
29
|
+
id: run.id,
|
|
30
|
+
number: index + 1,
|
|
31
|
+
status: run.status,
|
|
32
|
+
message: run.message,
|
|
33
|
+
startedAt: run.startedAt,
|
|
34
|
+
stale: isRunStale(run.workflowVersion, current),
|
|
35
|
+
shown: run.id === shownRunId
|
|
36
|
+
}));
|
|
37
|
+
return { conversations, runs: items.reverse() };
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The earlier runs of a session that carried named inputs, read back from the
|
|
3
|
+
* session's own messages: a turn started with inputs records them in its user
|
|
4
|
+
* message's `metadata.inputs` (the same data the "Ran with …" label names).
|
|
5
|
+
* Nothing is kept client-side, so the list survives a reload and follows a
|
|
6
|
+
* switch of session.
|
|
7
|
+
*/
|
|
8
|
+
import type { PlaygroundMessage } from '../types/playground.js';
|
|
9
|
+
import type { WorkflowInterfaceEntry } from '../types/index.js';
|
|
10
|
+
/** One earlier run: what it was started with, and when. */
|
|
11
|
+
export interface PlaygroundInputRun {
|
|
12
|
+
/** The user message that started the run. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** ISO 8601 time of that message. */
|
|
15
|
+
timestamp: string;
|
|
16
|
+
/** The inputs it carried, keyed by interface entry id. */
|
|
17
|
+
inputs: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The session's runs that carried inputs, newest first. Only keys the form
|
|
21
|
+
* still has an entry for are kept, so a refill never reintroduces an input the
|
|
22
|
+
* interface dropped since; a run left with none is not listed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function playgroundInputRuns(messages: readonly PlaygroundMessage[], entries: readonly WorkflowInterfaceEntry[], limit?: number): PlaygroundInputRun[];
|
|
25
|
+
/** "Topic: cats · Count: 3": what a run was started with, by input name. */
|
|
26
|
+
export declare function summarizeRunInputs(inputs: Record<string, unknown>, entries: readonly WorkflowInterfaceEntry[]): string;
|