@flowdrop/flowdrop 2.8.0 → 2.10.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 +227 -0
- package/dist/commands/executor.js +52 -8
- package/dist/commands/types.d.ts +3 -0
- package/dist/components/App.svelte +8 -0
- package/dist/components/App.svelte.d.ts +6 -0
- package/dist/components/CanvasContextMenu.stories.svelte +63 -0
- package/dist/components/CanvasContextMenu.stories.svelte.d.ts +19 -0
- package/dist/components/CanvasContextMenu.svelte +259 -0
- package/dist/components/CanvasContextMenu.svelte.d.ts +16 -0
- package/dist/components/CanvasController.svelte +23 -1
- package/dist/components/CanvasController.svelte.d.ts +16 -0
- package/dist/components/UniversalNode.svelte +12 -13
- package/dist/components/WorkflowEditor.svelte +364 -27
- package/dist/components/WorkflowEditor.svelte.d.ts +7 -0
- package/dist/components/WorkflowInterfaceEditor.svelte +28 -3
- package/dist/components/WorkflowInterfaceEntryCard.svelte +112 -2
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +3 -1
- package/dist/components/form/FieldFactory.svelte +478 -0
- package/dist/components/form/FieldFactory.svelte.d.ts +14 -0
- package/dist/components/form/FormField.svelte +19 -404
- package/dist/components/form/FormField.svelte.d.ts +2 -27
- package/dist/components/form/FormFieldLight.svelte +11 -424
- package/dist/components/form/FormFieldLight.svelte.d.ts +2 -28
- package/dist/components/form/FormMarkdownEditor.svelte +11 -4
- package/dist/components/form/FormTemplateEditor.svelte +12 -5
- package/dist/components/form/resolveFieldType.d.ts +18 -15
- package/dist/components/form/resolveFieldType.js +33 -12
- package/dist/components/form/types.d.ts +14 -2
- package/dist/components/nodes/CaptionNode.stories.svelte +65 -0
- package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +18 -0
- package/dist/components/nodes/CaptionNode.svelte +313 -0
- package/dist/components/nodes/CaptionNode.svelte.d.ts +16 -0
- package/dist/components/nodes/NotesNode.svelte +6 -0
- package/dist/components/playground/ChatBubble.svelte +2 -0
- package/dist/components/playground/ChatInput.svelte +18 -34
- package/dist/components/playground/ChatInput.svelte.d.ts +7 -0
- package/dist/components/playground/ControlPanel.svelte +27 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +12 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -8
- package/dist/components/playground/InterfaceInputForm.svelte +74 -0
- package/dist/components/playground/InterfaceInputForm.svelte.d.ts +14 -0
- package/dist/components/playground/LogRow.svelte +2 -0
- package/dist/components/playground/MessageCard.svelte +15 -3
- package/dist/components/playground/MessageNotice.svelte +2 -0
- package/dist/components/playground/MessageStream.svelte +87 -23
- package/dist/components/playground/OriginBadge.svelte +48 -0
- package/dist/components/playground/OriginBadge.svelte.d.ts +7 -0
- package/dist/components/playground/Playground.svelte +155 -38
- package/dist/components/playground/messageDisplay.d.ts +23 -1
- package/dist/components/playground/messageDisplay.js +49 -0
- package/dist/config/endpoints.d.ts +65 -0
- package/dist/config/endpoints.js +39 -0
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.js +2 -1
- package/dist/editor/contextMenu.d.ts +107 -0
- package/dist/editor/contextMenu.js +134 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/messages/defaults.d.ts +63 -0
- package/dist/messages/defaults.js +59 -0
- package/dist/openapi/v1/openapi.yaml +356 -7
- package/dist/playground/commands/registry.js +4 -2
- package/dist/playground/index.d.ts +3 -2
- package/dist/playground/index.js +2 -1
- package/dist/registry/builtinNodeTypes.d.ts +1 -1
- package/dist/registry/builtinNodeTypes.js +1 -0
- package/dist/registry/builtinNodes.js +13 -0
- package/dist/registry/nodeComponentRegistry.d.ts +18 -0
- package/dist/registry/nodeComponentRegistry.js +14 -2
- package/dist/schemas/v1/workflow.schema.json +22 -1
- package/dist/services/historyService.d.ts +1 -1
- package/dist/services/historyService.js +2 -2
- package/dist/services/playgroundService.d.ts +35 -1
- package/dist/services/playgroundService.js +82 -36
- package/dist/stores/inlineEditStore.svelte.d.ts +35 -0
- package/dist/stores/inlineEditStore.svelte.js +63 -0
- package/dist/stores/instanceContainer.svelte.d.ts +6 -0
- package/dist/stores/instanceContainer.svelte.js +2 -0
- package/dist/stores/playgroundStore.svelte.d.ts +59 -2
- package/dist/stores/playgroundStore.svelte.js +128 -2
- package/dist/styles/base.css +8 -0
- package/dist/styles/tokens.css +8 -0
- package/dist/svelte-app.d.ts +15 -0
- package/dist/svelte-app.js +6 -4
- package/dist/types/index.d.ts +34 -1
- package/dist/types/index.js +11 -0
- package/dist/types/playground.d.ts +90 -9
- package/dist/types/playground.js +12 -4
- package/dist/utils/captionText.d.ts +43 -0
- package/dist/utils/captionText.js +49 -0
- package/dist/utils/focus.d.ts +16 -0
- package/dist/utils/focus.js +40 -0
- package/dist/utils/nodeTypes.js +1 -0
- package/dist/utils/nodeWrapper.js +2 -0
- package/dist/utils/workflowInterface.d.ts +83 -1
- package/dist/utils/workflowInterface.js +192 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,233 @@ 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.10.0] - 2026-10-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Interface entries take an optional `turn`: what the port is for in a chat
|
|
13
|
+
turn. Inputs may be `message`, `history`, `session_id` or `message_id` (at
|
|
14
|
+
most one input per value); outputs may be `reply` (any number). A `history`
|
|
15
|
+
entry reads its window from `meta.limit` (default 10). The interface editor
|
|
16
|
+
gains a **Chat turn** selector under "More options" that offers only the
|
|
17
|
+
values valid for the entry's side, warns inline when another input already
|
|
18
|
+
has the value, and adds a "Messages to include" field for `history`. The
|
|
19
|
+
chosen turn shows on the collapsed card. "None" removes the key; a turn this
|
|
20
|
+
editor does not know is listed as it is and round-trips untouched. New type
|
|
21
|
+
`WorkflowInterfaceTurn` and constants `WORKFLOW_INTERFACE_INPUT_TURNS`,
|
|
22
|
+
`WORKFLOW_INTERFACE_OUTPUT_TURNS` and `DEFAULT_HISTORY_TURN_LIMIT` from
|
|
23
|
+
`core`. `validateWorkflowInterface` reports `interface-turn-duplicate` and
|
|
24
|
+
`interface-turn-direction` (warnings). `WorkflowInterfaceEntry.turn` is typed
|
|
25
|
+
`WorkflowInterfaceTurn | (string & {})`: a value from a newer server is a
|
|
26
|
+
valid `turn` and round-trips; check it against the known values before indexing by it.
|
|
27
|
+
- Playground messages carry an `origin` (`user`, `workflow`, `engine`,
|
|
28
|
+
`playground` or `interrupt`): which component posted the row. Rows posted by
|
|
29
|
+
the engine, a console observer or the interrupt system get a small,
|
|
30
|
+
muted origin badge; user and workflow rows, and rows from servers that do not
|
|
31
|
+
send `origin`, get none. New types `PlaygroundMessageOrigin` and
|
|
32
|
+
`ResolvedMessageDisplay`; `PlaygroundMessageDisplay` is now exported from
|
|
33
|
+
`core` and `playground`.
|
|
34
|
+
- The message `display` hint accepts `default` (same as no hint) and `hidden`.
|
|
35
|
+
Hidden rows are kept in the store but not rendered in the message stream or
|
|
36
|
+
the execution logs panel. Hidden is not private: the row has reached the
|
|
37
|
+
browser, so it hides noise, never secrets.
|
|
38
|
+
- Three or more adjacent log-layout rows in the message stream fold into a
|
|
39
|
+
collapsible group ("n log lines"), open by default.
|
|
40
|
+
- Canvas context menu. Right-clicking a node opens a menu with Configure and
|
|
41
|
+
Delete; right-clicking a multi-selection offers "Delete n nodes". Delete runs
|
|
42
|
+
through the same path as the Delete key, so the confirm-delete setting
|
|
43
|
+
applies, connected edges go with the node, and one undo restores both.
|
|
44
|
+
Right-clicking an unselected node selects it first. The menu only opens in
|
|
45
|
+
edit mode (read-only and locked editors keep the browser's own menu), is
|
|
46
|
+
keyboard operable (arrow keys, Home/End, Enter, Escape), and closes on an
|
|
47
|
+
outside click, zoom, pan or window blur. It is a popover in the top layer,
|
|
48
|
+
so no canvas overflow or stacking context can clip or cover it.
|
|
49
|
+
- Shift+F10 and the Menu key open the context menu from the keyboard: on a
|
|
50
|
+
focused node it opens that node's menu, elsewhere on the canvas it opens the
|
|
51
|
+
canvas menu at the centre of the view.
|
|
52
|
+
- `contextMenu.items` mount option (and `contextMenu` prop on `App` and
|
|
53
|
+
`WorkflowEditor`). It receives the built-in entries and the click context
|
|
54
|
+
(`target`, `nodes`, grid-snapped flow `position`, `nodeTypes`, `actions`) and
|
|
55
|
+
returns the final list, so a host can add, remove or reorder entries. If it
|
|
56
|
+
throws or returns a non-array the built-in entries are used; an entry's `run`
|
|
57
|
+
may be async, and its errors (thrown or rejected) are logged and never break the canvas.
|
|
58
|
+
`actions.deleteNodes` returns a promise, so an async `run` can await the deletion
|
|
59
|
+
(including the confirm prompt) before doing more. The `ContextMenuContext`,
|
|
60
|
+
`ContextMenuEntry`, `ContextMenuActions`, `ContextMenuOptions` and
|
|
61
|
+
`ContextMenuTarget` types are exported from `@flowdrop/flowdrop/editor`.
|
|
62
|
+
- `messages.contextMenu` strings (`menuLabel`, `configure`, `delete`,
|
|
63
|
+
`deleteNodes`) so the menu can be translated.
|
|
64
|
+
- Caption node (`caption`): a short, high-contrast line of text (one or two
|
|
65
|
+
lines) that names or marks nearby nodes, for anything a note would be too
|
|
66
|
+
heavy for. It has no ports, no config panel and no status overlay, and its
|
|
67
|
+
text is the node's label. The width follows the text, rounded up to the grid
|
|
68
|
+
and kept between two grid steps (40px on the default grid) and 500px; the
|
|
69
|
+
height is 40px for one line and 60px for two, and longer text is cut off with
|
|
70
|
+
an ellipsis and shown in full as a tooltip. Right-click empty canvas and
|
|
71
|
+
choose "Add caption" (shown when the editor's node types include a node type
|
|
72
|
+
whose `type` is `caption`, or lists `caption` in `supportedTypes`; a backend
|
|
73
|
+
without one gets no menu entry). The new caption opens for typing; Enter or
|
|
74
|
+
clicking away saves, Escape cancels, and an empty or cancelled new caption is
|
|
75
|
+
removed without an undo entry. To edit an existing caption, double-click it,
|
|
76
|
+
press Enter on the focused node, or choose "Edit text" from its menu (which
|
|
77
|
+
replaces Configure for captions). Newlines and pasted formatting are never
|
|
78
|
+
stored, and saving an edit is one undo step ("Add caption" / "Edit caption").
|
|
79
|
+
`CaptionNode` is exported from `@flowdrop/flowdrop/editor`.
|
|
80
|
+
- `--fd-caption-node-bg` and `--fd-caption-node-fg` (default to the theme's
|
|
81
|
+
foreground and background, so the caption reads as inverted in light and dark)
|
|
82
|
+
and `--fd-caption-node-max-width` (500px) tokens for the caption node.
|
|
83
|
+
- `editsInPlace` option on node component registrations (`NodeComponentRegistration`,
|
|
84
|
+
`PluginNodeDefinition` and `registerCustom`): a node that sets it edits its
|
|
85
|
+
text in place, so Enter on the focused node, a double-click and the node
|
|
86
|
+
context menu's "Edit text" ask it to start typing instead of opening the
|
|
87
|
+
config panel. `fd.nodes.editsInPlace(type)` reads it, and `fd.inlineEdit` is
|
|
88
|
+
the channel: a component calls `register(id, start)` on mount (it gets back
|
|
89
|
+
the unregister function), and `request(id)` calls that starter, or holds the
|
|
90
|
+
request until the node registers.
|
|
91
|
+
- `messages.contextMenu.addCaption`, `editText`, `shortcutEnter` and
|
|
92
|
+
`shortcutDelete` (the key hints beside an entry), and a `messages.nodes.caption`
|
|
93
|
+
branch (`placeholder`, `editLabel`), so the caption's strings can be translated.
|
|
94
|
+
|
|
95
|
+
- The Playground reads its input from the workflow interface's turn ports.
|
|
96
|
+
An input with `turn: message` gets the chat box (its content fills that
|
|
97
|
+
port). Turn ports but no `message` input: the inputs without a turn render
|
|
98
|
+
as a form (built from each entry's schema fragment and `dataType`) with a
|
|
99
|
+
Run button, and the turn sends `inputs` and no content. Nothing to fill:
|
|
100
|
+
Run alone. A workflow with a `message` port and other inputs gets the chat
|
|
101
|
+
box with the form above it. Turn-filled ports (`history`, `session_id`,
|
|
102
|
+
`message_id`, and any turn value a newer server adds) never appear in the
|
|
103
|
+
form. A workflow whose interface declares no `turn` at all, and every
|
|
104
|
+
server that predates turn ports, keeps the previous behaviour exactly.
|
|
105
|
+
`showChatInput: false` still hides the chat box; it cannot add one to a
|
|
106
|
+
workflow without a `message` port, and `predefinedMessage` is ignored
|
|
107
|
+
there, because its server refuses message content. Blank required inputs
|
|
108
|
+
are refused before the request; a server refusal (such as the 400 for
|
|
109
|
+
content sent to a form-only workflow) is shown with the server's message
|
|
110
|
+
and leaves Run usable. When the host passes no workflow, or one without an
|
|
111
|
+
`interface` key, the Playground loads it through `workflows.get`; a failure
|
|
112
|
+
keeps the previous behaviour. New: `resolvePlaygroundInputMode()`,
|
|
113
|
+
`interfaceFormEntries()`, `interfaceFormSchema()` and type
|
|
114
|
+
`PlaygroundInputMode` (`playground`; the type also from `core`); store
|
|
115
|
+
getters `fd.playground.inputMode` and `fd.playground.interfaceFormEntries`;
|
|
116
|
+
`messages.playground.inputForm` (`title`, `missingRequired`). The form's
|
|
117
|
+
values and what a turn would send now live in the store:
|
|
118
|
+
`fd.playground.formValues` / `setFormValues()`, and `fd.playground.turnInputs`
|
|
119
|
+
(the inputs, or the required ones still missing, so a Run control can open the
|
|
120
|
+
form instead of failing); new pure `collectInterfaceInputs()` and type
|
|
121
|
+
`InterfaceInputsResult` (`playground`). `fd.playground.lastTurn` /
|
|
122
|
+
`setLastTurn()` hold the sessions door's answer for the turn just taken.
|
|
123
|
+
Run works again for every turn of a session: the one gate any Run control
|
|
124
|
+
reads is `fd.playground.canRun` (not executing, no turn request in flight,
|
|
125
|
+
and not waiting for the legacy `enableRun` message), with `turnPending`,
|
|
126
|
+
`runLocked`, `setTurnPending()`, `lockRunUntilEnabled()` and
|
|
127
|
+
`releaseRunLock()` behind it. `ChatInput` and `ControlPanel` take
|
|
128
|
+
`awaitEnableRun` (default `true`, the old protocol: a Run click locks Run
|
|
129
|
+
until a message with `enableRun` metadata arrives); the Playground turns it
|
|
130
|
+
off for turn-port workflows, whose server never sends it.
|
|
131
|
+
- Optional `sessions` endpoint group: one session's own HTTP surface
|
|
132
|
+
(`get`, `delete`, `messages`, `turn`, `stop`, optional `reset`), served by
|
|
133
|
+
FlowDrop Drupal under `/api/flowdrop/sessions/{sessionId}/…` from the
|
|
134
|
+
release that ships it. When a host configures the group, every per-session
|
|
135
|
+
call goes there; when it does not, the calls stay on the matching
|
|
136
|
+
`playground` keys, so nothing changes against servers that predate it.
|
|
137
|
+
Listing and creating sessions for a workflow stay on `playground`. The
|
|
138
|
+
group is not in `defaultEndpointConfig` (hosts merge groups over the
|
|
139
|
+
defaults, so a default would move every host to paths its server may not
|
|
140
|
+
serve); hosts opt in with the new `sessionsEndpoints` constant. New
|
|
141
|
+
`resolveSessionEndpoint()` and types `SessionEndpointKey`,
|
|
142
|
+
`ResolvedSessionEndpoint`. `/reset` is offered when the winning group has
|
|
143
|
+
a reset path.
|
|
144
|
+
- `PlaygroundService.sendTurn(config, sessionId, {content?, inputs?})` takes
|
|
145
|
+
a turn through whichever door is configured and returns the answer tagged:
|
|
146
|
+
`{kind: 'message', message}` from `playground.sendMessage`,
|
|
147
|
+
`{kind: 'turn', result}` from `sessions.turn` (new type
|
|
148
|
+
`PlaygroundTurnResult`; `PlaygroundTurnResponse`). The Playground uses it.
|
|
149
|
+
`PlaygroundMessageRequest.content` is optional (a form-only workflow takes
|
|
150
|
+
`inputs` alone). Which kind comes back follows the endpoint group the
|
|
151
|
+
request went to, not the shape of the payload. OpenAPI documents the `/sessions/{sessionId}` paths and
|
|
152
|
+
the turn result.
|
|
153
|
+
|
|
154
|
+
### Upgrade notes
|
|
155
|
+
|
|
156
|
+
Type-only changes. Nothing changes at runtime, but TypeScript code can stop
|
|
157
|
+
compiling:
|
|
158
|
+
|
|
159
|
+
- `PlaygroundMessageDisplay` gained `'default'` and `'hidden'`. An exhaustive
|
|
160
|
+
`switch` over it (with a `never` check) must handle both.
|
|
161
|
+
- `PlaygroundStoreActions` gained `setTurnPending`, `lockRunUntilEnabled`,
|
|
162
|
+
`releaseRunLock`, `setFormValues` and `setLastTurn`. Code that implements the
|
|
163
|
+
interface itself, such as a hand-written mock, must add them.
|
|
164
|
+
- `PlaygroundMessageRequest.content` is now optional (see Added), so code that
|
|
165
|
+
reads it as a `string` must handle `undefined`.
|
|
166
|
+
|
|
167
|
+
### Deprecated
|
|
168
|
+
|
|
169
|
+
- `PlaygroundService.sendMessage()`: use `sendTurn()`. It throws when the
|
|
170
|
+
configured door answers with a turn result instead of a message row.
|
|
171
|
+
|
|
172
|
+
### Fixed
|
|
173
|
+
|
|
174
|
+
- The Playground read its translated strings with `m()` inside event
|
|
175
|
+
handlers, which throws outside component initialisation: slash commands,
|
|
176
|
+
a refused launch from Run, and Run's fallback message failed with
|
|
177
|
+
`lifecycle_outside_component`. The strings are now read through a getter
|
|
178
|
+
taken at init.
|
|
179
|
+
- `describe_type`, `get_config` and `set_config` now see the allowed values of a
|
|
180
|
+
config key declared as a `oneOf` (or `anyOf`) of `{ const, title }`, the
|
|
181
|
+
shape the form already renders as a select (#41). The values are reported as
|
|
182
|
+
`enum`, with the titles in a new optional `enumTitles` map on
|
|
183
|
+
`ConfigKeyDescription`; a value outside them gets the same `allowedValues`
|
|
184
|
+
warning as an `enum` violation, and `CONFIG_VALIDATION_ERROR` in strict mode.
|
|
185
|
+
`enum` wins when both are present; a `oneOf` of sub-schemas is ignored.
|
|
186
|
+
- `layout auto` no longer collapses a workflow into one column when a node
|
|
187
|
+
with no edges (a note) comes first in the node list: the start node is the
|
|
188
|
+
first node with no incoming and at least one outgoing edge (#45). A workflow
|
|
189
|
+
without any such node lays out as before.
|
|
190
|
+
- Legacy Run (`awaitEnableRun`) no longer stays locked when `predefinedMessage`
|
|
191
|
+
is a slash command such as `/help`: the command runs without taking a turn,
|
|
192
|
+
so no `enableRun` message ever arrived to unlock Run. The lock is released
|
|
193
|
+
once the command has been sent.
|
|
194
|
+
|
|
195
|
+
## [2.9.0] - 2026-10-04
|
|
196
|
+
|
|
197
|
+
### Fixed
|
|
198
|
+
|
|
199
|
+
- Autocomplete config fields (`format: 'autocomplete'` with `autocomplete.url`)
|
|
200
|
+
render as autocompletes again in the node config panel and `SchemaForm`.
|
|
201
|
+
They had been plain text boxes since 2.0.0-beta.2, when both moved to
|
|
202
|
+
`FormFieldLight`, which had no built-in fallback; a registered override on
|
|
203
|
+
`fd.fields` still wins.
|
|
204
|
+
- `readOnly: true` on a config field now disables it in the node config panel
|
|
205
|
+
and `SchemaForm`. `FormFieldLight` never passed `disabled` on, so read-only
|
|
206
|
+
fields were editable; it now reaches every built-in field, the textarea
|
|
207
|
+
fallback for an unregistered editor, and registered components (as the
|
|
208
|
+
`disabled` prop). Hosts that marked fields `readOnly` but relied on editing
|
|
209
|
+
them will find them locked.
|
|
210
|
+
- Number fields honour `step` in the node config panel and `SchemaForm`.
|
|
211
|
+
- An `object` field whose `format` the form does not render itself (anything
|
|
212
|
+
but `hidden`, `autocomplete` and `ports`) gets the JSON editor. It used to
|
|
213
|
+
fall through to a text field that showed `[object Object]` and saved a string
|
|
214
|
+
over the object on the first keystroke.
|
|
215
|
+
- The markdown and template editors accept a value that is not a string:
|
|
216
|
+
`null` shows an empty editor and a number its text, where a number used to
|
|
217
|
+
throw from CodeMirror (`(config.doc || "").split is not a function`).
|
|
218
|
+
`FormFieldFull` used to coerce the value before handing it over; it now
|
|
219
|
+
reaches the editors as stored, as it always did in the config panel.
|
|
220
|
+
|
|
221
|
+
### Changed
|
|
222
|
+
|
|
223
|
+
- **`FormFieldFull`** (`@flowdrop/flowdrop/form/full`) and `FormField`
|
|
224
|
+
(`@flowdrop/flowdrop/form`) now render through one internal field factory;
|
|
225
|
+
`FormFieldFull` only adds the bundled code, markdown and template editors.
|
|
226
|
+
They used to be two copies of the factory, and the copies had drifted, which
|
|
227
|
+
is how the autocomplete and `readOnly` bugs above shipped. One behaviour
|
|
228
|
+
difference for `FormFieldFull` users: a component registered on `fd.fields`
|
|
229
|
+
now wins for every field, as it always did for `FormField`, where before
|
|
230
|
+
`FormFieldFull` consulted the registry only for autocomplete fields. Neither
|
|
231
|
+
component gained or lost a prop; their props type, `FormFieldFactoryProps`,
|
|
232
|
+
now also lists `node`, `nodes`, `edges`, `workflowId` and `authProvider`,
|
|
233
|
+
which both always accepted.
|
|
234
|
+
|
|
8
235
|
## [2.8.0] - 2026-09-10
|
|
9
236
|
|
|
10
237
|
### Added
|
|
@@ -153,6 +153,36 @@ function describePort(p) {
|
|
|
153
153
|
out.description = p.description;
|
|
154
154
|
return out;
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* The allowed values of a config key, as a plain list plus titles.
|
|
158
|
+
*
|
|
159
|
+
* `enum` wins when present. Otherwise a `oneOf` (or `anyOf`) whose every entry
|
|
160
|
+
* is `{ const, title? }` counts as the allowed values: the form already renders
|
|
161
|
+
* that shape as a select, so the agent tools must treat it the same way. A
|
|
162
|
+
* `oneOf` holding anything else (sub-schemas) says nothing about allowed values
|
|
163
|
+
* and is ignored.
|
|
164
|
+
*/
|
|
165
|
+
function allowedValuesOf(property) {
|
|
166
|
+
if (property.enum && property.enum.length > 0)
|
|
167
|
+
return { values: property.enum };
|
|
168
|
+
for (const alternatives of [property.oneOf, property.anyOf]) {
|
|
169
|
+
if (!Array.isArray(alternatives) || alternatives.length === 0)
|
|
170
|
+
continue;
|
|
171
|
+
const isConst = (e) => typeof e === 'object' && e !== null && 'const' in e;
|
|
172
|
+
if (!alternatives.every(isConst))
|
|
173
|
+
continue;
|
|
174
|
+
const labels = {};
|
|
175
|
+
for (const entry of alternatives) {
|
|
176
|
+
if (typeof entry.title === 'string' && entry.title)
|
|
177
|
+
labels[String(entry.const)] = entry.title;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
values: alternatives.map((e) => e.const),
|
|
181
|
+
...(Object.keys(labels).length > 0 ? { labels } : {})
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
156
186
|
function describeConfigKey(key, property, required) {
|
|
157
187
|
const out = { key };
|
|
158
188
|
if (property) {
|
|
@@ -164,8 +194,12 @@ function describeConfigKey(key, property, required) {
|
|
|
164
194
|
out.title = property.title;
|
|
165
195
|
if (property.description)
|
|
166
196
|
out.description = property.description;
|
|
167
|
-
|
|
168
|
-
|
|
197
|
+
const allowed = allowedValuesOf(property);
|
|
198
|
+
if (allowed) {
|
|
199
|
+
out.enum = allowed.values;
|
|
200
|
+
if (allowed.labels)
|
|
201
|
+
out.enumTitles = allowed.labels;
|
|
202
|
+
}
|
|
169
203
|
if (property.default !== undefined)
|
|
170
204
|
out.default = property.default;
|
|
171
205
|
}
|
|
@@ -325,13 +359,14 @@ function validateConfigValue(key, value, property) {
|
|
|
325
359
|
if (!property)
|
|
326
360
|
return [];
|
|
327
361
|
const warnings = [];
|
|
328
|
-
// Enum validation
|
|
329
|
-
|
|
330
|
-
|
|
362
|
+
// Enum validation (a oneOf of consts counts as an enum)
|
|
363
|
+
const allowed = allowedValuesOf(property)?.values;
|
|
364
|
+
if (allowed) {
|
|
365
|
+
if (!allowed.includes(value)) {
|
|
331
366
|
warnings.push({
|
|
332
367
|
type: 'enum',
|
|
333
|
-
message: `Value ${JSON.stringify(value)} is not in allowed values: ${
|
|
334
|
-
allowedValues:
|
|
368
|
+
message: `Value ${JSON.stringify(value)} is not in allowed values: ${allowed.map((v) => JSON.stringify(v)).join(', ')}`,
|
|
369
|
+
allowedValues: allowed
|
|
335
370
|
});
|
|
336
371
|
}
|
|
337
372
|
}
|
|
@@ -1217,7 +1252,16 @@ function executeAutoLayout(command, context) {
|
|
|
1217
1252
|
for (const e of layoutEdges) {
|
|
1218
1253
|
inDegree.set(e.target, (inDegree.get(e.target) ?? 0) + 1);
|
|
1219
1254
|
}
|
|
1220
|
-
|
|
1255
|
+
// Prefer a root that also has an outgoing edge: a node with no edges at all
|
|
1256
|
+
// (a note, a caption) is in-degree 0 too, and starting the layering there
|
|
1257
|
+
// reaches nothing, which flattens the whole workflow into one column.
|
|
1258
|
+
const outDegree = new Map();
|
|
1259
|
+
for (const e of layoutEdges) {
|
|
1260
|
+
outDegree.set(e.source, (outDegree.get(e.source) ?? 0) + 1);
|
|
1261
|
+
}
|
|
1262
|
+
const startNode = workflow.nodes.find((n) => (inDegree.get(n.id) ?? 0) === 0 && (outDegree.get(n.id) ?? 0) > 0)
|
|
1263
|
+
?.id ??
|
|
1264
|
+
workflow.nodes.find((n) => (inDegree.get(n.id) ?? 0) === 0)?.id ??
|
|
1221
1265
|
workflow.nodes.reduce((leftmost, n) => (n.position.x < leftmost.position.x ? n : leftmost)).id;
|
|
1222
1266
|
const flow = {
|
|
1223
1267
|
component_type: 'flow',
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -211,7 +211,10 @@ export interface ConfigKeyDescription {
|
|
|
211
211
|
type?: string | string[];
|
|
212
212
|
title?: string;
|
|
213
213
|
description?: string;
|
|
214
|
+
/** Allowed values: the schema's `enum`, or the consts of a `oneOf`/`anyOf` of `{ const, title }`. */
|
|
214
215
|
enum?: unknown[];
|
|
216
|
+
/** Display titles for the allowed values, keyed by the value as a string. Only present when the schema gave titles. */
|
|
217
|
+
enumTitles?: Record<string, string>;
|
|
215
218
|
default?: unknown;
|
|
216
219
|
required?: boolean;
|
|
217
220
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
+
import type { ContextMenuOptions } from '../editor/contextMenu.js';
|
|
8
9
|
import { onMount, tick, untrack } from 'svelte';
|
|
9
10
|
import MainLayout from './layouts/MainLayout.svelte';
|
|
10
11
|
import WorkflowEditor from './WorkflowEditor.svelte';
|
|
@@ -183,6 +184,11 @@
|
|
|
183
184
|
* function call you'd rather not invoke unless the prop is actually read.
|
|
184
185
|
*/
|
|
185
186
|
messages?: MessagesOverride | (() => MessagesOverride);
|
|
187
|
+
/**
|
|
188
|
+
* Customise the canvas context menu. `items` receives the built-in entries
|
|
189
|
+
* and returns the final list. The menu only opens in `'edit'` mode.
|
|
190
|
+
*/
|
|
191
|
+
contextMenu?: ContextMenuOptions;
|
|
186
192
|
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
187
193
|
instance?: FlowDropInstance;
|
|
188
194
|
}
|
|
@@ -222,6 +228,7 @@
|
|
|
222
228
|
workflowSettingsSchema,
|
|
223
229
|
workflowFormats,
|
|
224
230
|
messages: messagesOverride,
|
|
231
|
+
contextMenu,
|
|
225
232
|
instance
|
|
226
233
|
}: Props = $props();
|
|
227
234
|
|
|
@@ -1613,6 +1620,7 @@
|
|
|
1613
1620
|
{pipelineId}
|
|
1614
1621
|
{refreshTrigger}
|
|
1615
1622
|
builtinEditors={features.builtinEditors}
|
|
1623
|
+
{contextMenu}
|
|
1616
1624
|
gridVariant={themeConfig?.canvas?.grid ?? 'dots'}
|
|
1617
1625
|
consoleOpen={consoleActive}
|
|
1618
1626
|
onToggleConsole={consoleGroupOffered ? toggleConsole : undefined}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ContextMenuOptions } from '../editor/contextMenu.js';
|
|
1
2
|
import type { NavbarAction } from '../types/navbar.js';
|
|
2
3
|
import type { NodeMetadata, Workflow, ConfigSchema } from '../types/index.js';
|
|
3
4
|
import type { SwapStrategy } from '../utils/nodeSwap.js';
|
|
@@ -128,6 +129,11 @@ interface Props {
|
|
|
128
129
|
* function call you'd rather not invoke unless the prop is actually read.
|
|
129
130
|
*/
|
|
130
131
|
messages?: MessagesOverride | (() => MessagesOverride);
|
|
132
|
+
/**
|
|
133
|
+
* Customise the canvas context menu. `items` receives the built-in entries
|
|
134
|
+
* and returns the final list. The menu only opens in `'edit'` mode.
|
|
135
|
+
*/
|
|
136
|
+
contextMenu?: ContextMenuOptions;
|
|
131
137
|
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
132
138
|
instance?: FlowDropInstance;
|
|
133
139
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import CanvasContextMenu from './CanvasContextMenu.svelte';
|
|
4
|
+
import CanvasDecorator from '../stories/CanvasDecorator.svelte';
|
|
5
|
+
import type { ContextMenuEntry } from '../editor/contextMenu.js';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Editor/CanvasContextMenu',
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const noop = (): void => {};
|
|
16
|
+
|
|
17
|
+
const nodeEntries: ContextMenuEntry[] = [
|
|
18
|
+
{ id: 'configure', label: 'Configure', shortcut: 'Enter', run: noop },
|
|
19
|
+
{ id: 'separator-node', separator: true },
|
|
20
|
+
{ id: 'delete', label: 'Delete', shortcut: 'Delete', run: noop }
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const selectionEntries: ContextMenuEntry[] = [
|
|
24
|
+
{ id: 'delete', label: 'Delete 3 nodes', shortcut: 'Delete', run: noop }
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const consumerEntries: ContextMenuEntry[] = [
|
|
28
|
+
...nodeEntries,
|
|
29
|
+
{ id: 'separator-consumer', separator: true },
|
|
30
|
+
{ id: 'open-docs', label: 'Open documentation', icon: 'mdi:book-open-variant', run: noop }
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const disabledEntries: ContextMenuEntry[] = [
|
|
34
|
+
{ id: 'configure', label: 'Configure', shortcut: 'Enter', run: noop },
|
|
35
|
+
{ id: 'publish', label: 'Publish (not allowed here)', disabled: true, run: noop },
|
|
36
|
+
{ id: 'separator-node', separator: true },
|
|
37
|
+
{ id: 'delete', label: 'Delete', shortcut: 'Delete', run: noop }
|
|
38
|
+
];
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Story name="Node">
|
|
42
|
+
<CanvasDecorator>
|
|
43
|
+
<CanvasContextMenu entries={nodeEntries} x={40} y={40} onselect={noop} onclose={noop} />
|
|
44
|
+
</CanvasDecorator>
|
|
45
|
+
</Story>
|
|
46
|
+
|
|
47
|
+
<Story name="Selection">
|
|
48
|
+
<CanvasDecorator>
|
|
49
|
+
<CanvasContextMenu entries={selectionEntries} x={40} y={40} onselect={noop} onclose={noop} />
|
|
50
|
+
</CanvasDecorator>
|
|
51
|
+
</Story>
|
|
52
|
+
|
|
53
|
+
<Story name="Consumer entry">
|
|
54
|
+
<CanvasDecorator>
|
|
55
|
+
<CanvasContextMenu entries={consumerEntries} x={40} y={40} onselect={noop} onclose={noop} />
|
|
56
|
+
</CanvasDecorator>
|
|
57
|
+
</Story>
|
|
58
|
+
|
|
59
|
+
<Story name="Disabled entry">
|
|
60
|
+
<CanvasDecorator>
|
|
61
|
+
<CanvasContextMenu entries={disabledEntries} x={40} y={40} onselect={noop} onclose={noop} />
|
|
62
|
+
</CanvasDecorator>
|
|
63
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CanvasContextMenu from './CanvasContextMenu.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const CanvasContextMenu: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type CanvasContextMenu = InstanceType<typeof CanvasContextMenu>;
|
|
19
|
+
export default CanvasContextMenu;
|