@flowdrop/flowdrop 2.15.2 → 2.17.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 +140 -0
- package/README.md +10 -1
- package/dist/components/App.svelte +219 -6
- package/dist/components/App.svelte.d.ts +8 -0
- package/dist/components/CanvasToolbar.svelte +40 -3
- package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
- package/dist/components/ConnectPortPicker.svelte +8 -4
- package/dist/components/DoctorMenu.svelte +208 -126
- package/dist/components/ImpactConfirm.svelte +341 -0
- package/dist/components/ImpactConfirm.svelte.d.ts +12 -0
- package/dist/components/Input.svelte +2 -2
- package/dist/components/Navbar.svelte +48 -3
- package/dist/components/Navbar.svelte.d.ts +4 -0
- package/dist/components/NodeSidebar.svelte +36 -15
- package/dist/components/NodeSidebar.svelte.d.ts +2 -0
- package/dist/components/NodeSwapPicker.svelte +4 -14
- package/dist/components/RunBar.svelte +36 -1
- package/dist/components/RunBar.svelte.d.ts +5 -0
- package/dist/components/RunInputsDialog.svelte +198 -0
- package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
- package/dist/components/SchemaForm.svelte +2 -1
- package/dist/components/SchemaForm.svelte.d.ts +2 -1
- package/dist/components/WorkflowCompareDialog.svelte +177 -0
- package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
- package/dist/components/WorkflowEditor.svelte +88 -6
- package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
- package/dist/components/WorkflowInterfaceEditor.svelte +14 -4
- package/dist/components/WorkflowInterfaceEntryCard.svelte +19 -3
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
- package/dist/components/form/FormAutocomplete.svelte +76 -12
- package/dist/components/nodes/NodeCard.svelte +2 -2
- package/dist/components/primitives/Button.svelte +1 -1
- package/dist/components/primitives/Button.svelte.d.ts +1 -1
- package/dist/components/primitives/Card.svelte +1 -1
- package/dist/components/primitives/Card.svelte.d.ts +1 -1
- package/dist/components/primitives/Checkbox.svelte +1 -1
- package/dist/components/primitives/Checkbox.svelte.d.ts +1 -1
- package/dist/components/primitives/Chip.svelte +1 -1
- package/dist/components/primitives/Chip.svelte.d.ts +1 -1
- package/dist/components/primitives/Combobox.svelte +1 -1
- package/dist/components/primitives/Combobox.svelte.d.ts +1 -1
- package/dist/components/primitives/Composer.svelte +1 -1
- package/dist/components/primitives/Composer.svelte.d.ts +1 -1
- package/dist/components/primitives/EmptyState.svelte +1 -1
- package/dist/components/primitives/EmptyState.svelte.d.ts +1 -1
- package/dist/components/primitives/Field.svelte +1 -1
- package/dist/components/primitives/Field.svelte.d.ts +1 -1
- package/dist/components/primitives/IconButton.svelte +1 -1
- package/dist/components/primitives/IconButton.svelte.d.ts +1 -1
- package/dist/components/primitives/Menu.svelte +1 -1
- package/dist/components/primitives/Menu.svelte.d.ts +1 -1
- package/dist/components/primitives/Notice.svelte +1 -1
- package/dist/components/primitives/Notice.svelte.d.ts +1 -1
- package/dist/components/primitives/PanelHeader.svelte +1 -1
- package/dist/components/primitives/PanelHeader.svelte.d.ts +1 -1
- package/dist/components/primitives/Segmented.svelte +2 -2
- package/dist/components/primitives/Segmented.svelte.d.ts +2 -2
- package/dist/components/primitives/Select.svelte +1 -1
- package/dist/components/primitives/Select.svelte.d.ts +1 -1
- package/dist/components/primitives/StatusPill.svelte +1 -1
- package/dist/components/primitives/StatusPill.svelte.d.ts +1 -1
- package/dist/components/primitives/Switch.svelte +1 -1
- package/dist/components/primitives/Switch.svelte.d.ts +1 -1
- package/dist/components/primitives/Tabs.svelte +2 -2
- package/dist/components/primitives/Tabs.svelte.d.ts +2 -2
- package/dist/components/primitives/Toolbar.svelte +1 -1
- package/dist/components/primitives/Toolbar.svelte.d.ts +1 -1
- package/dist/components/primitives/ToolbarSeparator.svelte +1 -1
- package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +1 -1
- package/dist/components/toast/DismissibleToast.svelte +25 -6
- package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
- package/dist/config/endpoints.d.ts +7 -0
- package/dist/config/endpoints.js +2 -1
- package/dist/editor/connectCandidates.d.ts +3 -0
- package/dist/editor/connectCandidates.js +14 -5
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/helpers/workflowEditorHelper.d.ts +15 -0
- package/dist/helpers/workflowEditorHelper.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/messages/defaults.d.ts +101 -0
- package/dist/messages/defaults.js +92 -1
- package/dist/openapi/v1/openapi.yaml +10 -2
- package/dist/schemas/v1/workflow.schema.json +1 -1
- package/dist/services/draftStorage.d.ts +24 -10
- package/dist/services/draftStorage.js +60 -35
- package/dist/services/globalSave.d.ts +28 -10
- package/dist/services/globalSave.js +135 -31
- package/dist/services/impactGate.d.ts +34 -0
- package/dist/services/impactGate.js +70 -0
- package/dist/services/impactService.d.ts +28 -0
- package/dist/services/impactService.js +71 -0
- package/dist/services/toastQueue.d.ts +9 -0
- package/dist/services/toastService.d.ts +4 -0
- package/dist/services/toastService.js +9 -3
- package/dist/services/workflowLaunchService.js +3 -1
- package/dist/settings/index.d.ts +2 -2
- package/dist/settings/index.js +1 -1
- package/dist/stores/doctorStore.svelte.d.ts +24 -1
- package/dist/stores/doctorStore.svelte.js +105 -2
- package/dist/stores/instanceContainer.svelte.d.ts +16 -0
- package/dist/stores/instanceContainer.svelte.js +22 -2
- package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
- package/dist/stores/saveConflictStore.svelte.js +169 -0
- package/dist/stores/workflowStore.svelte.d.ts +7 -3
- package/dist/stores/workflowStore.svelte.js +14 -5
- package/dist/styles/toast.css +10 -1
- package/dist/svelte-app.d.ts +23 -0
- package/dist/svelte-app.js +114 -3
- package/dist/themes/scopedSkinCss.d.ts +22 -0
- package/dist/themes/scopedSkinCss.js +27 -1
- package/dist/types/doctor.d.ts +3 -1
- package/dist/types/events.d.ts +20 -0
- package/dist/types/events.js +2 -0
- package/dist/types/impact.d.ts +25 -0
- package/dist/types/impact.js +7 -0
- package/dist/types/index.d.ts +11 -1
- package/dist/types/settings.d.ts +31 -0
- package/dist/types/settings.js +132 -0
- package/dist/ui/index.d.ts +76 -0
- package/dist/ui/index.js +81 -0
- package/dist/utils/apiUrl.d.ts +55 -0
- package/dist/utils/apiUrl.js +117 -0
- package/dist/utils/draftRestore.d.ts +27 -0
- package/dist/utils/draftRestore.js +36 -0
- package/dist/utils/interfaceTags.js +4 -1
- package/dist/utils/nodeSearch.d.ts +10 -0
- package/dist/utils/nodeSearch.js +37 -0
- package/dist/utils/portal.js +45 -3
- package/dist/utils/runOffer.d.ts +21 -0
- package/dist/utils/runOffer.js +13 -0
- package/dist/utils/workflowCompare.d.ts +35 -0
- package/dist/utils/workflowCompare.js +84 -0
- package/dist/utils/workflowInterface.d.ts +26 -1
- package/dist/utils/workflowInterface.js +91 -11
- package/dist/webmcp/index.d.ts +5 -0
- package/dist/webmcp/index.js +5 -0
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,146 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.17.0] - 2026-11-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Save asks before a change that breaks or switches off what uses the workflow, listing what is affected and asking to save anyway (needs the new optional `workflows.impact` endpoint). The dialog opens on Cancel and is a native modal dialog.
|
|
13
|
+
|
|
14
|
+
- **Field schema for every editor setting.** `SETTINGS_FIELD_SCHEMA` (and the `SettingsFieldSchema` type),
|
|
15
|
+
exported from `@flowdrop/flowdrop/settings`, describes each setting: its type, a short label and the
|
|
16
|
+
values it allows.
|
|
17
|
+
|
|
18
|
+
- Publishing a generic port (data, value, ...) suggests the id, title and type from the node instead of data, data_2 and Mixed.
|
|
19
|
+
|
|
20
|
+
- New interface rows open their Title, Description, Required and Example fields; Mixed and untitled inputs are flagged.
|
|
21
|
+
|
|
22
|
+
- Toasts accept `actions` (several follow-up buttons); a toast with actions stays until it is closed.
|
|
23
|
+
|
|
24
|
+
- The navbar's main action (Save) shows a dot and says 'Unsaved changes' while the workflow has changes that are not saved.
|
|
25
|
+
|
|
26
|
+
- mountFlowDropApp asks the browser to confirm leaving the page while there are unsaved changes (`features.confirmUnsavedLeave`, on by default).
|
|
27
|
+
|
|
28
|
+
- When a stored draft differs from the loaded workflow, the editor offers Restore or Discard (and says when the workflow was saved after the draft).
|
|
29
|
+
|
|
30
|
+
- A compare dialog lists the steps, wires, interface and chat settings that differ between two versions of a workflow.
|
|
31
|
+
|
|
32
|
+
- A save refused with 409 CONFLICT shows Keep mine / Load theirs / Compare instead of a plain error.
|
|
33
|
+
|
|
34
|
+
- Edit mode has a Run button (`features.runButton`, on with the default endpoint config; `false` turns it off): it saves unsaved changes first, then starts the workflow through `host.onRun` or the `workflows.run` endpoint and shows the run on the canvas.
|
|
35
|
+
|
|
36
|
+
- Run opens a form built from the workflow interface's inputs and remembers the last values for the page.
|
|
37
|
+
|
|
38
|
+
- The run pill links 'Open run' when `features.adminLinks.run` is set; a queued run says it waits for the site's queue.
|
|
39
|
+
|
|
40
|
+
- Doctor remedies with `params.automatic: true` are applied by the editor when their problem first appears after load, as one undoable edit with an Undo toast.
|
|
41
|
+
|
|
42
|
+
- The Problems indicator shows 'Checking...' for a slow check and 'Check unavailable' with Retry when the check fails, instead of staying blank.
|
|
43
|
+
|
|
44
|
+
- The editor offers a 'Skip to the canvas' link, and mountFlowDropApp accepts navbarTitleLevel to render the title as the page's H1.
|
|
45
|
+
|
|
46
|
+
- Node search in the palette and the swap picker ranks exact name and keyword matches first.
|
|
47
|
+
|
|
48
|
+
- A palette item can be added by click or Enter: next to the selected node, else in the middle of the view.
|
|
49
|
+
|
|
50
|
+
- Port pins can be reached with Tab; Enter opens the port menu with 'Connect to…'.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Drafts carry `metadata.baseRevision`, include interface and Playground edits, and are removed when the workflow is saved; `draftFingerprint` is exported.
|
|
55
|
+
|
|
56
|
+
- Run asks for a workflow's inputs also when it has no Playground settings.
|
|
57
|
+
|
|
58
|
+
- Autosave never opens the impact question: a save that needs an answer is skipped, the workflow stays unsaved, and an info toast says once that autosave waits for Save (no further impact request until the workflow changes). A 401 or 403 from the impact route counts as no impact check, like 404 and 405.
|
|
59
|
+
|
|
60
|
+
- Doctor's Undo only undoes the automatic fix, and its toast goes once the history moves on. A reload never applies an automatic fix again.
|
|
61
|
+
|
|
62
|
+
- The save conflict toast follows `showToasts` and `onApiError`.
|
|
63
|
+
|
|
64
|
+
- Host `messages` reach the impact dialog, the draft offer, the conflict toast and the Doctor toast.
|
|
65
|
+
|
|
66
|
+
- A stored draft stays while its Restore or Discard offer is open, however long the offer waits.
|
|
67
|
+
|
|
68
|
+
- Port pins are Tab stops only on the selected node, not on every node; the palette adds one node per key press (Enter on key down, Space on key up).
|
|
69
|
+
|
|
70
|
+
- A generated interface id keeps accented letters as plain letters (`Übersetzung` gives `ubersetzung`).
|
|
71
|
+
|
|
72
|
+
- "Connect to…" lists trigger pins under "Other types" when connecting a data port, and data ports when connecting a trigger pin.
|
|
73
|
+
|
|
74
|
+
- Port and interface pickers show each node's own title, and add the node id when two nodes share a name.
|
|
75
|
+
|
|
76
|
+
- An edit made while a save is in flight stays unsaved instead of being marked saved. `WorkflowStore.markAsSaved(version?)` takes the edit version the save was taken at, and `globalSaveWorkflow`'s `onMarkAsSaved` receives it.
|
|
77
|
+
|
|
78
|
+
- A second save while one is in flight joins it instead of sending the old revision again (which the server refused as a conflict). A Save pressed during an autosave that is waiting for the impact answer asks the question itself.
|
|
79
|
+
|
|
80
|
+
- The impact question comes before `onBeforeSave`, so a cancelled question never leaves a host with `onBeforeSave` and no outcome hook; Cmd+S or autosave while the question is open no longer moves the focus out of it.
|
|
81
|
+
|
|
82
|
+
- The save conflict choices stay on screen after Compare is cancelled or loading the saved version fails (toast actions accept `keepOpen`); the compare dialog heads its shared list 'Different in the two versions' and names steps by their title.
|
|
83
|
+
|
|
84
|
+
- The Run form and the compare dialog take the editor's skin; the Run form no longer closes when a text selection ends over the backdrop.
|
|
85
|
+
|
|
86
|
+
- The Problems indicator announces 'Checking...' and 'Check unavailable' to screen readers; a new automatic fix replaces the previous Undo toast; an impact question closes when its editor is destroyed.
|
|
87
|
+
|
|
88
|
+
## [2.16.0] - 2026-10-24
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- **Autocomplete URLs relative to the API base** (#49). An `autocomplete.url` without a leading
|
|
93
|
+
slash (`secrets/options`, or `./secrets/options`) resolves against the editor's
|
|
94
|
+
`endpointConfig.baseUrl` in every form (config panel, `SchemaForm`, interrupt forms), so a backend
|
|
95
|
+
can name its own option endpoints and they work behind any API base, including a hub's proxy mount
|
|
96
|
+
such as `/api/flowdrop/remotes/{id}`. `https://…` and `//host/…` URLs are used as given, and a
|
|
97
|
+
`/path` URL stays relative to the site (as in the docs' `/api/users/search` example);
|
|
98
|
+
`SchemaForm`'s `baseUrl` prop still goes in front of it. A `SchemaForm` given a `baseUrl` prop
|
|
99
|
+
resolves no-slash URLs against the prop instead (as a standalone `SchemaForm` always did); with
|
|
100
|
+
neither it is used as given, with a logged warning. Malformed URLs are refused, so nothing is
|
|
101
|
+
fetched and one error is logged per URL; the rule is in `docs/config-schema-guide.md`. Query
|
|
102
|
+
parameters now go in front of a `#fragment` instead of into it.
|
|
103
|
+
- **Interrupt forms send the editor's auth with autocomplete requests.** `FormPrompt` has no
|
|
104
|
+
`authProvider` of its own, so its autocomplete fields went out without auth. They now use the
|
|
105
|
+
instance's auth provider for requests to the page's own origin or under the API base, judged by
|
|
106
|
+
the URL as the browser resolves it, not by its text. Requests to other hosts, including a
|
|
107
|
+
`baseUrl` prop pointing elsewhere, still use only the form's provider.
|
|
108
|
+
- **`App` takes a `navbarEnd` snippet.** It renders at the navbar's trailing end, before the settings
|
|
109
|
+
gear, so a host can put its own controls there, such as a user menu. `Navbar` already had this as
|
|
110
|
+
its `end` slot; `App` now forwards it. It shows only when the navbar does. `mountFlowDropApp`
|
|
111
|
+
takes `navbarEnd` as an element callback, `(target: HTMLElement) => void | (() => void)`, so
|
|
112
|
+
hosts without Svelte snippets can fill the slot. It is called with the element once that is in
|
|
113
|
+
the page, and the function it returns runs on cleanup. A
|
|
114
|
+
callback that throws is logged and skipped, and `mountFlowDropApp` warns when `navbarEnd` is
|
|
115
|
+
given while `showNavbar` is off.
|
|
116
|
+
- **`@flowdrop/flowdrop/ui` exports the editor's design-system components.** The primitives
|
|
117
|
+
(`Button`, `Card`, `Checkbox`, `Chip`, `Combobox`, `Composer`, `EmptyState`, `Field`, `IconButton`,
|
|
118
|
+
`Menu`, `Notice`, `PanelHeader`, `Segmented`, `Select`, `StatusPill`, `Switch`, `Tabs`, `Toolbar`,
|
|
119
|
+
`ToolbarSeparator`), the surfaces (`SurfaceOverlay`, `TabbedSurface`) and `Input` and `Textarea`, so a
|
|
120
|
+
host can build its own pages from the same components and `--fd-*` tokens as the editor. The entry is
|
|
121
|
+
**experimental** in 2.x: names and props may still change in a minor release while the design system
|
|
122
|
+
settles. It becomes semver-stable no later than 3.0, so pin a minor version (`~2.16.0`) if you use it.
|
|
123
|
+
- **`skinCss` and `graphiteSkin` give a host's own pages the editor's look.** `skinCss(graphiteSkin)` returns
|
|
124
|
+
the Graphite tokens as CSS for `:root` (or another selector, e.g. `.flowdrop-scope`), with the dark
|
|
125
|
+
palette under `data-theme="dark"` on that same element. Load `tokens.css` first and add the result as a
|
|
126
|
+
stylesheet. Both are exported from `@flowdrop/flowdrop/ui`. The components' base styles apply inside
|
|
127
|
+
`.flowdrop-root`, `.flowdrop-scope` or `.flowdrop-portal`, so wrap host content in one of them. A
|
|
128
|
+
`SurfaceOverlay` opened inside a `.flowdrop-scope` wrapper keeps the wrapper's skin, although it is
|
|
129
|
+
moved to `<body>`, and follows the wrapper's `data-theme`; set one on the wrapper, or the overlay
|
|
130
|
+
follows the editor's stored theme setting. The entry
|
|
131
|
+
also exports `tabId` and `tabPanelId` and the prop types `MenuItem`, `MenuEntry`, `MenuGroup`,
|
|
132
|
+
`MenuSeparator`, `SegmentedOption`, `SelectOption`, `StatusPillStatus`, `SurfaceTab`, `TabItem` and
|
|
133
|
+
`FlowDropSkin`.
|
|
134
|
+
|
|
135
|
+
### Changed
|
|
136
|
+
|
|
137
|
+
- **An autocomplete `url` without a leading slash now resolves against the API base** (#49). Until
|
|
138
|
+
2.15 the config panel and interrupt forms fetched `secrets/options` relative to the page's URL, as
|
|
139
|
+
the browser resolves it. A backend that relied on that must send a `/path` or absolute URL
|
|
140
|
+
instead.
|
|
141
|
+
- **`@flowdrop/flowdrop/webmcp` is labelled experimental from 2.16.0**, like the new `./ui` entry;
|
|
142
|
+
releases up to 2.15 keep their usual semver promise. WebMCP is
|
|
143
|
+
still behind a browser origin trial, and the adapter already changed shape in a minor (2.8.0). Its
|
|
144
|
+
names, options and tool shapes may change in a minor release; every change is listed here. This
|
|
145
|
+
covers the `webmcp` option of `mountFlowDropApp`. The README's entry table lists it now, with a note
|
|
146
|
+
on what experimental means.
|
|
147
|
+
|
|
8
148
|
## [2.15.2] - 2026-10-18
|
|
9
149
|
|
|
10
150
|
### Fixed
|
package/README.md
CHANGED
|
@@ -154,11 +154,15 @@ FlowDrop provides tree-shakeable sub-module exports so you can import only what
|
|
|
154
154
|
| `@flowdrop/flowdrop/form/code` | Code editor field (CodeMirror) |
|
|
155
155
|
| `@flowdrop/flowdrop/form/markdown` | Markdown editor field |
|
|
156
156
|
| `@flowdrop/flowdrop/display` | MarkdownDisplay component |
|
|
157
|
+
| `@flowdrop/flowdrop/ui` | Design-system components: primitives, surfaces, Input, Textarea (experimental in 2.x) |
|
|
157
158
|
| `@flowdrop/flowdrop/playground` | Playground components and services |
|
|
158
159
|
| `@flowdrop/flowdrop/settings` | SettingsPanel, stores, services |
|
|
159
160
|
| `@flowdrop/flowdrop/styles` | Base CSS stylesheet |
|
|
160
161
|
| `@flowdrop/flowdrop/schema` | Workflow JSON schema |
|
|
161
162
|
| `@flowdrop/flowdrop/openapi` | OpenAPI spec (YAML) for the FlowDrop backend API |
|
|
163
|
+
| `@flowdrop/flowdrop/webmcp` | WebMCP editor tools for browser agents: `attachWebMCP`, `createToolRuntime`, approval gate (experimental in 2.x) |
|
|
164
|
+
|
|
165
|
+
Entries marked **experimental** may change in a minor release while their API settles; every change is listed in the CHANGELOG. Pin a minor version (`~2.16.0`) if you depend on one. All other entries follow semantic versioning.
|
|
162
166
|
|
|
163
167
|
### OpenAPI spec
|
|
164
168
|
|
|
@@ -279,12 +283,17 @@ FLOWDROP_API_BASE_URL=http://your-backend/api node build
|
|
|
279
283
|
|
|
280
284
|
Runtime configuration means you build once and deploy to staging, production, or anywhere else with just environment variables.
|
|
281
285
|
|
|
286
|
+
## Specification
|
|
287
|
+
|
|
288
|
+
The editor implements the [FlowDrop Workflow Specification](https://flowdrop.io/spec/), version 1.0: the rules a FlowDrop workflow obeys, stated independently of any one implementation. The specification has 386 numbered rules (217 core, 167 extended, 2 optional) covering how a workflow is written, stored, validated and executed, with rulings for the hard cases and conformance fixtures you can run against your own backend. Rules are also published as [machine-readable JSON](https://flowdrop.io/spec/rules.json), and the source is on [GitHub](https://github.com/flowdrop-io/flowdrop-spec).
|
|
289
|
+
|
|
282
290
|
## Documentation
|
|
283
291
|
|
|
284
292
|
| Resource | Description |
|
|
285
293
|
| -------------------------------------------------------------------------------------------- | ------------------------ |
|
|
286
294
|
| [QUICK_START.md](https://flowdrop.mintlify.app/docs/quickstart) | Get running in 5 minutes |
|
|
287
|
-
| [API Documentation](https://flowdrop.
|
|
295
|
+
| [API Documentation](https://flowdrop.io/docs/api/) | REST API specification |
|
|
296
|
+
| [Workflow Specification](https://flowdrop.io/spec/) | Rules for workflows |
|
|
288
297
|
| [CHANGELOG.md](https://github.com/flowdrop-io/flowdrop/blob/main/libs/flowdrop/CHANGELOG.md) | Version history |
|
|
289
298
|
|
|
290
299
|
## Development
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import type { ContextMenuOptions } from '../editor/contextMenu.js';
|
|
9
|
-
import { onMount, tick, untrack } from 'svelte';
|
|
9
|
+
import { onDestroy, onMount, tick, untrack } from 'svelte';
|
|
10
10
|
import { MediaQuery } from 'svelte/reactivity';
|
|
11
11
|
import { on } from 'svelte/events';
|
|
12
12
|
import MainLayout from './layouts/MainLayout.svelte';
|
|
@@ -21,10 +21,16 @@
|
|
|
21
21
|
import ConfigForm from './ConfigForm.svelte';
|
|
22
22
|
import NodeInspector from './NodeInspector.svelte';
|
|
23
23
|
import WorkflowSettingsPanel from './WorkflowSettingsPanel.svelte';
|
|
24
|
+
import WorkflowCompareDialog from './WorkflowCompareDialog.svelte';
|
|
25
|
+
import RunInputsDialog from './RunInputsDialog.svelte';
|
|
24
26
|
import ConfigPanel from './ConfigPanel.svelte';
|
|
25
27
|
import WorkflowInterfaceEditor from './WorkflowInterfaceEditor.svelte';
|
|
26
28
|
import WorkflowPlaygroundSettings from './WorkflowPlaygroundSettings.svelte';
|
|
27
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
resolvePlaygroundChat,
|
|
31
|
+
withPlaygroundChat,
|
|
32
|
+
withoutInterfaceTurns
|
|
33
|
+
} from '../utils/playgroundChat.js';
|
|
28
34
|
import ReadOnlyDetails from './ReadOnlyDetails.svelte';
|
|
29
35
|
import CommandConsole from './console/CommandConsole.svelte';
|
|
30
36
|
import ConsoleStrip from './console/ConsoleStrip.svelte';
|
|
@@ -80,7 +86,10 @@
|
|
|
80
86
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
81
87
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
82
88
|
import { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
|
|
83
|
-
import { apiToasts, dismissToast } from '../services/toastService.js';
|
|
89
|
+
import { apiToasts, dismissToast, showError, showInfo } from '../services/toastService.js';
|
|
90
|
+
import { workflowLaunchService } from '../services/workflowLaunchService.js';
|
|
91
|
+
import { canOfferRun } from '../utils/runOffer.js';
|
|
92
|
+
import { collectInterfaceInputs, interfaceFormEntriesFor } from '../utils/workflowInterface.js';
|
|
84
93
|
import { initAutoSave } from '../services/autoSaveService.js';
|
|
85
94
|
import {
|
|
86
95
|
getUiSettings,
|
|
@@ -191,10 +200,17 @@
|
|
|
191
200
|
refreshTrigger?: number;
|
|
192
201
|
/** Custom navbar title */
|
|
193
202
|
navbarTitle?: string;
|
|
203
|
+
/** Heading level of the navbar title: 1 renders it as the page's H1 (default 2) */
|
|
204
|
+
navbarTitleLevel?: 1 | 2;
|
|
194
205
|
/** Custom navbar actions */
|
|
195
206
|
navbarActions?: NavbarAction[];
|
|
196
207
|
/** White-label logo for the navbar (replaces the FlowDrop wordmark) */
|
|
197
208
|
branding?: NavbarBranding;
|
|
209
|
+
/**
|
|
210
|
+
* Host content at the navbar's trailing end, before the settings gear (the
|
|
211
|
+
* navbar's `end` slot), e.g. a user menu. Only shown with the navbar.
|
|
212
|
+
*/
|
|
213
|
+
navbarEnd?: Snippet;
|
|
198
214
|
/** Show settings gear icon in navbar */
|
|
199
215
|
showSettings?: boolean;
|
|
200
216
|
/** Show the "Connected" status indicator in the navbar (default: true) */
|
|
@@ -281,8 +297,10 @@
|
|
|
281
297
|
pipelineId,
|
|
282
298
|
refreshTrigger = 0,
|
|
283
299
|
navbarTitle,
|
|
300
|
+
navbarTitleLevel = 2,
|
|
284
301
|
navbarActions = [],
|
|
285
302
|
branding,
|
|
303
|
+
navbarEnd,
|
|
286
304
|
showSettings = true,
|
|
287
305
|
showStatus = true,
|
|
288
306
|
apiBaseUrl,
|
|
@@ -456,6 +474,10 @@
|
|
|
456
474
|
// — Svelte enforces that. The context value is a getter that closes over
|
|
457
475
|
// the live $derived, so child components always read the current tree.
|
|
458
476
|
setMessages(() => mergedMessages);
|
|
477
|
+
// Code outside the component tree (the impact dialog) reads the same tree from the instance.
|
|
478
|
+
fd.setMessages(() => mergedMessages);
|
|
479
|
+
// Do not leave the instance holding a getter into this destroyed component.
|
|
480
|
+
onDestroy(() => fd.setMessages(() => defaultMessages));
|
|
459
481
|
|
|
460
482
|
// Default navbar primary actions — used when no `navbarActions` prop is supplied.
|
|
461
483
|
// Derived so the labels track locale changes.
|
|
@@ -560,6 +582,122 @@
|
|
|
560
582
|
let error = $state<string | null>(null);
|
|
561
583
|
let endpointConfig = $state<EndpointConfig | null>(null);
|
|
562
584
|
|
|
585
|
+
/**
|
|
586
|
+
* The Edit canvas offers a Run button: editable, saved, and either the host
|
|
587
|
+
* supplies `onRun` or the backend has the `workflows.run` endpoint.
|
|
588
|
+
*/
|
|
589
|
+
const runOffered = $derived(
|
|
590
|
+
canOfferRun({
|
|
591
|
+
runButton: features.runButton,
|
|
592
|
+
canvasEditable,
|
|
593
|
+
pipelineId,
|
|
594
|
+
workflowId: fd.workflow.current?.id,
|
|
595
|
+
hostCanRun: !!fd.host.current.onRun,
|
|
596
|
+
backendCanRun: workflowLaunchService.isSupported(endpointConfig)
|
|
597
|
+
})
|
|
598
|
+
);
|
|
599
|
+
let runStarting = $state(false);
|
|
600
|
+
|
|
601
|
+
// The Run form: open while it asks for the inputs; the values stay per workflow id for the page.
|
|
602
|
+
let runDialogOpen = $state(false);
|
|
603
|
+
let runDialogValues = $state<Record<string, unknown>>({});
|
|
604
|
+
let runDialogError = $state<string | null>(null);
|
|
605
|
+
const runInputValues = new Map<string, Record<string, unknown>>();
|
|
606
|
+
|
|
607
|
+
/** The inputs a person fills in before a run: the interface inputs the chat binding does not fill. */
|
|
608
|
+
const runInputEntries = $derived.by(() => {
|
|
609
|
+
const workflow = fd.workflow.current;
|
|
610
|
+
if (!workflow) return [];
|
|
611
|
+
// Every input the chat does not fill, also in the Playground's legacy mode (no turn ports, no
|
|
612
|
+
// settings): the server refuses a run that leaves a required input out.
|
|
613
|
+
return interfaceFormEntriesFor(workflow.interface, resolvePlaygroundChat(workflow));
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Start the run with these inputs through `host.onRun` or the `workflows.run` endpoint and show it
|
|
618
|
+
* as the shown run. Returns the reason when the run did not start, `null` otherwise.
|
|
619
|
+
*/
|
|
620
|
+
async function launchRun(inputs: Record<string, unknown>): Promise<string | null> {
|
|
621
|
+
const workflow = fd.workflow.current;
|
|
622
|
+
if (!workflow?.id) return null;
|
|
623
|
+
try {
|
|
624
|
+
const hostOnRun = fd.host.current.onRun;
|
|
625
|
+
if (hostOnRun) {
|
|
626
|
+
const envelope = await fd.runs.wrapHostHooks(fd.host.current).onRun!(inputs);
|
|
627
|
+
if (envelope.ok && (envelope.data as { queued?: boolean } | undefined)?.queued) {
|
|
628
|
+
showInfo(mergedMessages.runButton.queued);
|
|
629
|
+
}
|
|
630
|
+
return envelope.ok ? null : (envelope.message ?? mergedMessages.runButton.failed);
|
|
631
|
+
}
|
|
632
|
+
const result = await workflowLaunchService.launch(
|
|
633
|
+
endpointConfig,
|
|
634
|
+
workflow.id,
|
|
635
|
+
{ inputs, workflow },
|
|
636
|
+
authProvider
|
|
637
|
+
);
|
|
638
|
+
if (result.status === 'launched') {
|
|
639
|
+
fd.runs.openRun(result.pipelineId, result.runStatus);
|
|
640
|
+
if (result.queued) showInfo(mergedMessages.runButton.queued);
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
if (result.status === 'unsupported') return null;
|
|
644
|
+
return 'message' in result ? result.message : mergedMessages.runButton.failed;
|
|
645
|
+
} catch (error) {
|
|
646
|
+
return error instanceof Error ? error.message : mergedMessages.runButton.failed;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Run the workflow from the canvas: save unsaved changes first, then start the run. A workflow
|
|
652
|
+
* with inputs opens the Run form; one without runs at once. A refusal shows the server's message.
|
|
653
|
+
*/
|
|
654
|
+
async function startRun(): Promise<void> {
|
|
655
|
+
if (runStarting) return;
|
|
656
|
+
runStarting = true;
|
|
657
|
+
try {
|
|
658
|
+
if (fd.workflow.isDirty) {
|
|
659
|
+
// The save toast already explains a failed save.
|
|
660
|
+
if (!(await saveWorkflow())) return;
|
|
661
|
+
}
|
|
662
|
+
const workflow = fd.workflow.current;
|
|
663
|
+
if (!workflow?.id) return;
|
|
664
|
+
if (runInputEntries.length > 0) {
|
|
665
|
+
runDialogValues = runInputValues.get(workflow.id) ?? {};
|
|
666
|
+
runDialogError = null;
|
|
667
|
+
runDialogOpen = true;
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
const refusal = await launchRun({});
|
|
671
|
+
if (refusal) showError(refusal);
|
|
672
|
+
} finally {
|
|
673
|
+
runStarting = false;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** Run from the form: empty required inputs are refused here; a refusal from the server stays in the form. */
|
|
678
|
+
async function submitRunInputs(): Promise<void> {
|
|
679
|
+
const workflowId = fd.workflow.current?.id;
|
|
680
|
+
if (runStarting || !workflowId) return;
|
|
681
|
+
runInputValues.set(workflowId, runDialogValues);
|
|
682
|
+
const collected = collectInterfaceInputs(runInputEntries, runDialogValues);
|
|
683
|
+
if (!collected.ok) {
|
|
684
|
+
const names = (list: { id: string }[]) => list.map((entry) => entry.id).join(', ');
|
|
685
|
+
runDialogError = collected.missing.length
|
|
686
|
+
? mergedMessages.runInputsDialog.missing({ names: names(collected.missing) })
|
|
687
|
+
: mergedMessages.runInputsDialog.invalid({ names: names(collected.invalid) });
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
runStarting = true;
|
|
691
|
+
runDialogError = null;
|
|
692
|
+
try {
|
|
693
|
+
const refusal = await launchRun(collected.inputs);
|
|
694
|
+
if (refusal) runDialogError = refusal;
|
|
695
|
+
else runDialogOpen = false;
|
|
696
|
+
} finally {
|
|
697
|
+
runStarting = false;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
563
701
|
// ConfigSidebar state
|
|
564
702
|
let isConfigSidebarOpen = $state(false);
|
|
565
703
|
let selectedNodeId = $state<string | null>(null);
|
|
@@ -935,6 +1073,7 @@
|
|
|
935
1073
|
return true;
|
|
936
1074
|
}
|
|
937
1075
|
$effect(() => fd.doctor.setFocusHandler(focusProblemNode));
|
|
1076
|
+
$effect(() => fd.doctor.setAutoApply(canvasEditable));
|
|
938
1077
|
|
|
939
1078
|
// The Doctor diagnoses the draft a moment after each edit, and on load (and
|
|
940
1079
|
// once the workflow has an id). Reading the version and the id is the trigger.
|
|
@@ -1166,7 +1305,7 @@
|
|
|
1166
1305
|
: undefined
|
|
1167
1306
|
);
|
|
1168
1307
|
|
|
1169
|
-
async function saveWorkflow(): Promise<boolean> {
|
|
1308
|
+
async function saveWorkflow(options: { interactive?: boolean } = {}): Promise<boolean> {
|
|
1170
1309
|
// Commit any in-flight config edit so the save and its history are
|
|
1171
1310
|
// consistent (the value itself is already live in the store).
|
|
1172
1311
|
flushNodeConfigEdit();
|
|
@@ -1174,7 +1313,8 @@
|
|
|
1174
1313
|
eventHandlers: { onBeforeSave, onAfterSave, onSaveError, onApiError },
|
|
1175
1314
|
features,
|
|
1176
1315
|
instance: fd,
|
|
1177
|
-
|
|
1316
|
+
interactive: options.interactive,
|
|
1317
|
+
onMarkAsSaved: (version) => fd.workflow.markAsSaved(version)
|
|
1178
1318
|
});
|
|
1179
1319
|
}
|
|
1180
1320
|
|
|
@@ -1336,7 +1476,8 @@
|
|
|
1336
1476
|
const cleanupAutoSave = initAutoSave({
|
|
1337
1477
|
isDirty: () => fd.workflow.isDirty,
|
|
1338
1478
|
onSave: async () => {
|
|
1339
|
-
|
|
1479
|
+
// A timer must not open a question: a save that needs an answer waits.
|
|
1480
|
+
await saveWorkflow({ interactive: false });
|
|
1340
1481
|
},
|
|
1341
1482
|
onError: (error) => {
|
|
1342
1483
|
// Don't show toast for auto-save errors to avoid noise
|
|
@@ -1483,6 +1624,7 @@
|
|
|
1483
1624
|
const consoleStripShown = $derived(consoleGroupOffered && canvasEditable);
|
|
1484
1625
|
/** Id of the Console panel, for the strip's `aria-controls`. */
|
|
1485
1626
|
const consolePanelId = `${scopeId}-console-panel`;
|
|
1627
|
+
const canvasRegionId = `${scopeId}-canvas`;
|
|
1486
1628
|
/** Node-swap sub-flow occupies the right sidebar regardless of placement. */
|
|
1487
1629
|
const swapActive = $derived(swapMode !== 'idle');
|
|
1488
1630
|
|
|
@@ -2026,6 +2168,7 @@
|
|
|
2026
2168
|
activeFormat={fd.workflow.format}
|
|
2027
2169
|
categoriesDefaultOpen={themeConfig?.sidebar?.categoriesDefaultOpen ?? false}
|
|
2028
2170
|
listStyle={themeConfig?.display?.sidebarList}
|
|
2171
|
+
onadd={(n) => workflowEditorRef?.addNodeFromPalette(n)}
|
|
2029
2172
|
/>
|
|
2030
2173
|
{/if}
|
|
2031
2174
|
{/snippet}
|
|
@@ -2088,6 +2231,14 @@
|
|
|
2088
2231
|
|
|
2089
2232
|
<!-- MainLayout wrapper for workflow editor -->
|
|
2090
2233
|
<div class="flowdrop-root" data-fd-scope={scopeId} use:themeScope={{ mirror: true }}>
|
|
2234
|
+
<a
|
|
2235
|
+
class="flowdrop-skip-link"
|
|
2236
|
+
href={`#${canvasRegionId}`}
|
|
2237
|
+
onclick={(e) => {
|
|
2238
|
+
e.preventDefault();
|
|
2239
|
+
document.getElementById(canvasRegionId)?.focus();
|
|
2240
|
+
}}>{mergedMessages.layout.skipToCanvas}</a
|
|
2241
|
+
>
|
|
2091
2242
|
<MainLayout
|
|
2092
2243
|
{height}
|
|
2093
2244
|
{width}
|
|
@@ -2120,11 +2271,14 @@
|
|
|
2120
2271
|
{/snippet}
|
|
2121
2272
|
<Navbar
|
|
2122
2273
|
title={breadcrumbTitle}
|
|
2274
|
+
titleLevel={navbarTitleLevel}
|
|
2123
2275
|
primaryActions={navbarActions.length > 0 ? navbarActions : defaultPrimaryActions}
|
|
2124
2276
|
{showStatus}
|
|
2125
2277
|
{showSettings}
|
|
2126
2278
|
{branding}
|
|
2279
|
+
end={navbarEnd}
|
|
2127
2280
|
saveShortcut
|
|
2281
|
+
dirty={canvasEditable && fd.workflow.isDirty}
|
|
2128
2282
|
onWorkflowSettings={toggleWorkflowSettings}
|
|
2129
2283
|
status={doctorStatus}
|
|
2130
2284
|
workflowSettingsOpen={isWorkflowSettingsOpen}
|
|
@@ -2297,6 +2451,8 @@
|
|
|
2297
2451
|
closeActiveConfig();
|
|
2298
2452
|
} else closeConfigSidebar();
|
|
2299
2453
|
}}
|
|
2454
|
+
id={canvasRegionId}
|
|
2455
|
+
tabindex="-1"
|
|
2300
2456
|
role="region"
|
|
2301
2457
|
aria-label={mergedMessages.layout.workflowCanvas}
|
|
2302
2458
|
>
|
|
@@ -2395,6 +2551,7 @@
|
|
|
2395
2551
|
activeFormat={fd.workflow.format}
|
|
2396
2552
|
categoriesDefaultOpen={themeConfig?.sidebar?.categoriesDefaultOpen ?? false}
|
|
2397
2553
|
listStyle={themeConfig?.display?.sidebarList}
|
|
2554
|
+
onadd={(n) => workflowEditorRef?.addNodeFromPalette(n)}
|
|
2398
2555
|
/>
|
|
2399
2556
|
</div>
|
|
2400
2557
|
{/if}
|
|
@@ -2417,6 +2574,8 @@
|
|
|
2417
2574
|
editorMode={effectiveEditorMode}
|
|
2418
2575
|
onEditorModeChange={testModeAvailable ? (next) => fd.editorMode.set(next) : undefined}
|
|
2419
2576
|
onOpenTest={testModeAvailable ? () => fd.editorMode.set('test') : undefined}
|
|
2577
|
+
onRun={runOffered ? () => void startRun() : undefined}
|
|
2578
|
+
runBusy={runStarting}
|
|
2420
2579
|
onAskAssistant={askAssistant}
|
|
2421
2580
|
showRuns={testMode && features.runsList}
|
|
2422
2581
|
adminLinks={features.adminLinks}
|
|
@@ -2424,6 +2583,33 @@
|
|
|
2424
2583
|
/>
|
|
2425
2584
|
</div>
|
|
2426
2585
|
</MainLayout>
|
|
2586
|
+
|
|
2587
|
+
{#if runOffered}
|
|
2588
|
+
<RunInputsDialog
|
|
2589
|
+
open={runDialogOpen}
|
|
2590
|
+
workflowName={fd.workflow.current?.name ?? ''}
|
|
2591
|
+
entries={runInputEntries}
|
|
2592
|
+
values={runDialogValues}
|
|
2593
|
+
onChange={(values) => {
|
|
2594
|
+
runDialogValues = values;
|
|
2595
|
+
const id = fd.workflow.current?.id;
|
|
2596
|
+
if (id) runInputValues.set(id, values);
|
|
2597
|
+
}}
|
|
2598
|
+
onRun={() => void submitRunInputs()}
|
|
2599
|
+
runBusy={runStarting}
|
|
2600
|
+
error={runDialogError}
|
|
2601
|
+
onClose={() => (runDialogOpen = false)}
|
|
2602
|
+
/>
|
|
2603
|
+
{/if}
|
|
2604
|
+
|
|
2605
|
+
{#if fd.saveConflict.comparison}
|
|
2606
|
+
<WorkflowCompareDialog
|
|
2607
|
+
comparison={fd.saveConflict.comparison}
|
|
2608
|
+
onKeepMine={() => void fd.saveConflict.keepMine()}
|
|
2609
|
+
onLoadTheirs={() => fd.saveConflict.acceptTheirs()}
|
|
2610
|
+
onClose={() => fd.saveConflict.closeComparison()}
|
|
2611
|
+
/>
|
|
2612
|
+
{/if}
|
|
2427
2613
|
</div>
|
|
2428
2614
|
|
|
2429
2615
|
<!--
|
|
@@ -2467,6 +2653,33 @@
|
|
|
2467
2653
|
{/if}
|
|
2468
2654
|
|
|
2469
2655
|
<style>
|
|
2656
|
+
/* Hidden until focused, then the first thing on screen. */
|
|
2657
|
+
.flowdrop-skip-link {
|
|
2658
|
+
position: absolute;
|
|
2659
|
+
width: 1px;
|
|
2660
|
+
height: 1px;
|
|
2661
|
+
overflow: hidden;
|
|
2662
|
+
clip-path: inset(50%);
|
|
2663
|
+
white-space: nowrap;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
.flowdrop-skip-link:focus {
|
|
2667
|
+
position: fixed;
|
|
2668
|
+
top: var(--fd-space-xs);
|
|
2669
|
+
left: var(--fd-space-xs);
|
|
2670
|
+
z-index: 1000;
|
|
2671
|
+
width: auto;
|
|
2672
|
+
height: auto;
|
|
2673
|
+
overflow: visible;
|
|
2674
|
+
clip-path: none;
|
|
2675
|
+
padding: var(--fd-space-xs) var(--fd-space-md);
|
|
2676
|
+
background: var(--fd-background);
|
|
2677
|
+
color: var(--fd-foreground);
|
|
2678
|
+
border-radius: var(--fd-radius-md);
|
|
2679
|
+
box-shadow: var(--fd-shadow-lg);
|
|
2680
|
+
font-size: var(--fd-text-sm);
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2470
2683
|
.flowdrop-root {
|
|
2471
2684
|
display: contents;
|
|
2472
2685
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ContextMenuOptions } from '../editor/contextMenu.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { NavbarAction, NavbarBranding } from '../types/navbar.js';
|
|
3
4
|
import type { NodeMetadata, Workflow, ConfigSchema } from '../types/index.js';
|
|
4
5
|
import type { SwapStrategy } from '../utils/nodeSwap.js';
|
|
@@ -97,10 +98,17 @@ interface Props {
|
|
|
97
98
|
refreshTrigger?: number;
|
|
98
99
|
/** Custom navbar title */
|
|
99
100
|
navbarTitle?: string;
|
|
101
|
+
/** Heading level of the navbar title: 1 renders it as the page's H1 (default 2) */
|
|
102
|
+
navbarTitleLevel?: 1 | 2;
|
|
100
103
|
/** Custom navbar actions */
|
|
101
104
|
navbarActions?: NavbarAction[];
|
|
102
105
|
/** White-label logo for the navbar (replaces the FlowDrop wordmark) */
|
|
103
106
|
branding?: NavbarBranding;
|
|
107
|
+
/**
|
|
108
|
+
* Host content at the navbar's trailing end, before the settings gear (the
|
|
109
|
+
* navbar's `end` slot), e.g. a user menu. Only shown with the navbar.
|
|
110
|
+
*/
|
|
111
|
+
navbarEnd?: Snippet;
|
|
104
112
|
/** Show settings gear icon in navbar */
|
|
105
113
|
showSettings?: boolean;
|
|
106
114
|
/** Show the "Connected" status indicator in the navbar (default: true) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list and the run pill.
|
|
3
|
+
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list, the Run button and the run pill.
|
|
4
4
|
|
|
5
5
|
Each group draws only when its prop is given. The switch needs `onEditorModeChange`;
|
|
6
6
|
the Runs list needs `showRuns` (the host turns it on in Test mode); the pill shows while the instance has a run.
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
import { getInstance } from '../stores/getInstance.svelte.js';
|
|
17
17
|
import Toolbar from './primitives/Toolbar.svelte';
|
|
18
18
|
import Segmented from './primitives/Segmented.svelte';
|
|
19
|
+
import Icon from '@iconify/svelte';
|
|
20
|
+
import Button from './primitives/Button.svelte';
|
|
19
21
|
import RunBar from './RunBar.svelte';
|
|
20
22
|
import RunsMenu from './RunsMenu.svelte';
|
|
23
|
+
import { expandAdminUrl } from '../utils/runsList.js';
|
|
21
24
|
|
|
22
25
|
interface Props {
|
|
23
26
|
/** Current editor mode. */
|
|
@@ -28,6 +31,10 @@
|
|
|
28
31
|
onOpenTest?: () => void;
|
|
29
32
|
/** Take a failed run to the Assistant (the pill's "Ask the Assistant"). */
|
|
30
33
|
onAskAssistant?: (runId: string) => void;
|
|
34
|
+
/** Start the workflow. The Run button is drawn in Edit mode only, and only when this is set. */
|
|
35
|
+
onRun?: () => void;
|
|
36
|
+
/** A run is being started (saving, or waiting for the server): the button spins and blocks. */
|
|
37
|
+
runBusy?: boolean;
|
|
31
38
|
/** Show the run pill while a run exists. @default true */
|
|
32
39
|
showRun?: boolean;
|
|
33
40
|
/** Show the Runs list (Test mode's past runs). The host decides when. @default false */
|
|
@@ -41,6 +48,8 @@
|
|
|
41
48
|
onEditorModeChange,
|
|
42
49
|
onOpenTest,
|
|
43
50
|
onAskAssistant,
|
|
51
|
+
onRun,
|
|
52
|
+
runBusy = false,
|
|
44
53
|
showRun = true,
|
|
45
54
|
showRuns = false,
|
|
46
55
|
adminLinks
|
|
@@ -56,7 +65,15 @@
|
|
|
56
65
|
]);
|
|
57
66
|
|
|
58
67
|
// Drawn when it has controls; a pill-only host gets the toolbar while a run exists.
|
|
59
|
-
const
|
|
68
|
+
const runMsgs = $derived(getMsgs().runButton);
|
|
69
|
+
const runOffered = $derived(!!onRun && editorMode === 'edit' && !fd.runs.isLive);
|
|
70
|
+
const runLink = $derived(
|
|
71
|
+
expandAdminUrl(adminLinks?.run, {
|
|
72
|
+
workflowId: fd.workflow.current?.id,
|
|
73
|
+
pipelineId: fd.runs.activeRun?.runId ?? undefined
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
const drawn = $derived(!!onEditorModeChange || !!onRun || (showRun && !!fd.runs.activeRun));
|
|
60
77
|
</script>
|
|
61
78
|
|
|
62
79
|
{#if drawn}
|
|
@@ -75,8 +92,28 @@
|
|
|
75
92
|
{#if showRuns}
|
|
76
93
|
<RunsMenu {adminLinks} />
|
|
77
94
|
{/if}
|
|
95
|
+
{#if runOffered}
|
|
96
|
+
<Button
|
|
97
|
+
variant="secondary"
|
|
98
|
+
size="md"
|
|
99
|
+
data-testid="canvas-run"
|
|
100
|
+
title={runMsgs.title}
|
|
101
|
+
loading={runBusy}
|
|
102
|
+
onclick={() => onRun?.()}
|
|
103
|
+
>
|
|
104
|
+
{#snippet leadingIcon()}
|
|
105
|
+
<Icon icon="mdi:play" aria-hidden="true" />
|
|
106
|
+
{/snippet}
|
|
107
|
+
{runMsgs.label}
|
|
108
|
+
</Button>
|
|
109
|
+
{/if}
|
|
78
110
|
{#if showRun}
|
|
79
|
-
<RunBar
|
|
111
|
+
<RunBar
|
|
112
|
+
mode={editorMode}
|
|
113
|
+
{onAskAssistant}
|
|
114
|
+
onOpen={onOpenTest}
|
|
115
|
+
runLink={runLink ?? undefined}
|
|
116
|
+
/>
|
|
80
117
|
{/if}
|
|
81
118
|
</Toolbar>
|
|
82
119
|
</div>
|