@flowdrop/flowdrop 2.1.0 → 2.2.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 +17 -0
- package/dist/components/App.svelte +36 -9
- package/dist/components/App.svelte.d.ts +7 -0
- package/dist/services/globalSave.js +9 -2
- package/dist/svelte-app.d.ts +7 -0
- package/dist/svelte-app.js +3 -2
- package/dist/utils/workflowInterface.d.ts +10 -1
- package/dist/utils/workflowInterface.js +18 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.2.0] - 2026-08-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`workflowFormats` mount option.** Pass the format ids a host actually supports (e.g. `['flowdrop']`) to scope the "Workflow Format" select in Workflow Settings to that set. With one or zero options remaining the field is hidden entirely rather than rendered as a single-choice select, and an unknown id filters to nothing instead of erroring. Omit the option to keep offering every registered format.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **Applying workflow settings could rewrite a non-default format.** When the format field is absent from the settings form the applied config carries no `format` key, and the handler fell back to `DEFAULT_WORKFLOW_FORMAT` — silently rewriting a workflow's stored format on an unrelated name or description edit. It now falls back to the workflow's current format.
|
|
19
|
+
|
|
20
|
+
## [2.1.1] - 2026-08-18
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **Interface bindings resolved against the wrong side of a node.** A `PortBinding` carries no direction, and resolution re-derived one by searching a node's inputs first. Because a `portId` is only unique within one side of a node, any node declaring an input and an output under the same id resolved to the wrong port — `chat_output` ships exactly that shape (input `message`, output `message`), so every output entry bound to it reported a spurious direction mismatch against a port the binding picker never offered. Resolution now prefers the owning entry's own direction and falls back to the other side, so a genuinely misdirected binding is still reported. This also corrects the `hidden` exposure check, the `type-mismatch` check, and the bound-port ring, all of which were reading the opposite port for such nodes.
|
|
25
|
+
- **Saving or exporting a workflow stripped its declared interface.** `globalSaveWorkflow` and `globalExportWorkflow` rebuild the workflow from an explicit key list and neither named `interface`; since an absent `interface` means "declares no contract," a save dropped the contract and an export/re-import round trip lost it.
|
|
26
|
+
|
|
10
27
|
## [2.1.0] - 2026-08-18
|
|
11
28
|
|
|
12
29
|
**The workflow interface release.** A workflow can now declare its public call signature — named inputs and outputs bound to internal node ports — and author it in a dedicated settings panel. Entirely additive: workflows without an `interface` behave exactly as before.
|
|
@@ -163,6 +163,13 @@
|
|
|
163
163
|
swapStrategies?: SwapStrategy[];
|
|
164
164
|
/** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
|
|
165
165
|
workflowSettingsSchema?: ConfigSchema;
|
|
166
|
+
/**
|
|
167
|
+
* Format ids this host supports (e.g. `['flowdrop']`). Filters the
|
|
168
|
+
* "Workflow Format" options in the Workflow Settings panel; when one or
|
|
169
|
+
* zero options remain the field is hidden entirely and the stored format
|
|
170
|
+
* is left untouched. Omit to offer every registered format.
|
|
171
|
+
*/
|
|
172
|
+
workflowFormats?: string[];
|
|
166
173
|
/**
|
|
167
174
|
* Override user-facing strings. Pass either a partial of the `Messages`
|
|
168
175
|
* tree directly, or a callback that returns one. Missing keys fall through
|
|
@@ -212,6 +219,7 @@
|
|
|
212
219
|
showSettingsResetButton,
|
|
213
220
|
swapStrategies,
|
|
214
221
|
workflowSettingsSchema,
|
|
222
|
+
workflowFormats,
|
|
215
223
|
messages: messagesOverride,
|
|
216
224
|
instance
|
|
217
225
|
}: Props = $props();
|
|
@@ -371,6 +379,15 @@
|
|
|
371
379
|
// workflowSettingsSchema field, but a consumer schema could still collide.
|
|
372
380
|
const WORKFLOW_SETTINGS_RESERVED = new Set(['name', 'description', 'format', 'interface']);
|
|
373
381
|
|
|
382
|
+
// Registered formats this host offers — the mount-level `workflowFormats`
|
|
383
|
+
// allowlist filters the registry (an unknown id filters to nothing rather
|
|
384
|
+
// than erroring; the field simply hides).
|
|
385
|
+
let workflowFormatOptions = $derived(
|
|
386
|
+
fd.formats
|
|
387
|
+
.getOneOfOptions()
|
|
388
|
+
.filter((option) => !workflowFormats || workflowFormats.includes(option.const))
|
|
389
|
+
);
|
|
390
|
+
|
|
374
391
|
// Workflow configuration schema (derived to pick up dynamic format options)
|
|
375
392
|
let workflowConfigSchema: ConfigSchema = $derived.by(() => {
|
|
376
393
|
const extraProps = Object.fromEntries(
|
|
@@ -403,13 +420,18 @@
|
|
|
403
420
|
format: 'multiline',
|
|
404
421
|
default: ''
|
|
405
422
|
},
|
|
406
|
-
format
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
423
|
+
// A format choice is only real when the host supports more than one
|
|
424
|
+
// format: with a single (or empty) filtered option set the field is
|
|
425
|
+
// hidden, and the stored format is preserved on apply (see onChange).
|
|
426
|
+
...(workflowFormatOptions.length > 1 && {
|
|
427
|
+
format: {
|
|
428
|
+
type: 'string' as const,
|
|
429
|
+
title: 'Workflow Format',
|
|
430
|
+
description: 'The specification format for this workflow',
|
|
431
|
+
oneOf: workflowFormatOptions,
|
|
432
|
+
default: 'flowdrop'
|
|
433
|
+
}
|
|
434
|
+
}),
|
|
413
435
|
...extraProps
|
|
414
436
|
},
|
|
415
437
|
required: ['name', ...extraRequired]
|
|
@@ -420,7 +442,9 @@
|
|
|
420
442
|
let workflowConfigValues = $derived({
|
|
421
443
|
name: fd.workflow.name || '',
|
|
422
444
|
description: fd.workflow.current?.description || '',
|
|
423
|
-
|
|
445
|
+
...(workflowFormatOptions.length > 1 && {
|
|
446
|
+
format: fd.workflow.current?.metadata?.format || 'flowdrop'
|
|
447
|
+
}),
|
|
424
448
|
...(fd.workflow.current?.config ?? {})
|
|
425
449
|
});
|
|
426
450
|
|
|
@@ -1183,8 +1207,11 @@
|
|
|
1183
1207
|
// Sync workflow settings changes immediately on field blur
|
|
1184
1208
|
const wf = fd.workflow.current;
|
|
1185
1209
|
if (wf) {
|
|
1186
|
-
const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
|
|
1187
1210
|
const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
|
|
1211
|
+
// Fall back to the CURRENT format, not the default: when the field is
|
|
1212
|
+
// hidden (host supports one format) config.format is absent, and
|
|
1213
|
+
// applying name/description must not silently rewrite the format.
|
|
1214
|
+
const newFormat = (config.format as string) || currentFormat;
|
|
1188
1215
|
|
|
1189
1216
|
// Warn about incompatible nodes when format changes
|
|
1190
1217
|
if (newFormat !== currentFormat) {
|
|
@@ -109,6 +109,13 @@ interface Props {
|
|
|
109
109
|
swapStrategies?: SwapStrategy[];
|
|
110
110
|
/** Additional JSON Schema properties to show in the Workflow Settings panel. Values are persisted in workflow.config. */
|
|
111
111
|
workflowSettingsSchema?: ConfigSchema;
|
|
112
|
+
/**
|
|
113
|
+
* Format ids this host supports (e.g. `['flowdrop']`). Filters the
|
|
114
|
+
* "Workflow Format" options in the Workflow Settings panel; when one or
|
|
115
|
+
* zero options remain the field is hidden entirely and the stored format
|
|
116
|
+
* is left untouched. Omit to offer every registered format.
|
|
117
|
+
*/
|
|
118
|
+
workflowFormats?: string[];
|
|
112
119
|
/**
|
|
113
120
|
* Override user-facing strings. Pass either a partial of the `Messages`
|
|
114
121
|
* tree directly, or a callback that returns one. Missing keys fall through
|
|
@@ -120,7 +120,11 @@ export async function globalSaveWorkflow(options = {}) {
|
|
|
120
120
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
121
121
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
122
122
|
updatedAt: new Date().toISOString()
|
|
123
|
-
}
|
|
123
|
+
},
|
|
124
|
+
// Explicit key list, so every contract field must be named here:
|
|
125
|
+
// omitting `interface` silently strips the declared contract on save
|
|
126
|
+
// (absent means "declares no interface" to the server).
|
|
127
|
+
...(currentWorkflow.interface !== undefined && { interface: currentWorkflow.interface })
|
|
124
128
|
};
|
|
125
129
|
// Step 4 — Persist via this instance's API client.
|
|
126
130
|
// id-presence (computed above) decides update vs create — never UUID-regex.
|
|
@@ -216,7 +220,10 @@ export async function globalExportWorkflow(options = {}) {
|
|
|
216
220
|
format: currentWorkflow.metadata?.format || DEFAULT_WORKFLOW_FORMAT,
|
|
217
221
|
createdAt: currentWorkflow.metadata?.createdAt || new Date().toISOString(),
|
|
218
222
|
updatedAt: new Date().toISOString()
|
|
219
|
-
}
|
|
223
|
+
},
|
|
224
|
+
// Same rule as the save path: the export must carry the declared
|
|
225
|
+
// contract, or a re-import round-trip loses `interface`.
|
|
226
|
+
...(currentWorkflow.interface !== undefined && { interface: currentWorkflow.interface })
|
|
220
227
|
};
|
|
221
228
|
// Trigger browser download
|
|
222
229
|
const dataStr = JSON.stringify(finalWorkflow, null, 2);
|
package/dist/svelte-app.d.ts
CHANGED
|
@@ -101,6 +101,13 @@ export interface FlowDropMountOptions {
|
|
|
101
101
|
draftStorage?: DraftStorageOption;
|
|
102
102
|
/** Custom workflow format adapters to register */
|
|
103
103
|
formatAdapters?: WorkflowFormatAdapter[];
|
|
104
|
+
/**
|
|
105
|
+
* Format ids this host supports (e.g. `['flowdrop']`). Filters the
|
|
106
|
+
* "Workflow Format" options in the Workflow Settings panel; when one or
|
|
107
|
+
* zero options remain the field is hidden entirely and the stored format
|
|
108
|
+
* is left untouched. Omit to offer every registered format.
|
|
109
|
+
*/
|
|
110
|
+
workflowFormats?: string[];
|
|
104
111
|
/** Visual theme — named built-in ('default' | 'minimal') or custom theme object */
|
|
105
112
|
theme?: FlowDropTheme | FlowDropThemeName;
|
|
106
113
|
/** Which settings tabs to show in the modal (defaults to all) */
|
package/dist/svelte-app.js
CHANGED
|
@@ -132,7 +132,7 @@ async function configureInstance(fd, options) {
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
export async function mountFlowDropApp(container, options = {}) {
|
|
135
|
-
const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
|
|
135
|
+
const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, workflowFormats, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
|
|
136
136
|
// Per-instance state container — this is what allows multiple FlowDrop
|
|
137
137
|
// editors to coexist on one page without sharing workflow/history state.
|
|
138
138
|
const { fd, isDefault } = acquireInstance(instanceId);
|
|
@@ -206,7 +206,8 @@ export async function mountFlowDropApp(container, options = {}) {
|
|
|
206
206
|
theme,
|
|
207
207
|
settingsCategories,
|
|
208
208
|
showSettingsSyncButton,
|
|
209
|
-
showSettingsResetButton
|
|
209
|
+
showSettingsResetButton,
|
|
210
|
+
workflowFormats
|
|
210
211
|
}
|
|
211
212
|
});
|
|
212
213
|
// Set up draft auto-save manager
|
|
@@ -70,8 +70,17 @@ export interface InterfaceIssue {
|
|
|
70
70
|
* metadata ports (inputs and outputs) for the bound port. Returns `null` if
|
|
71
71
|
* the node no longer exists, or the port isn't among that node's metadata
|
|
72
72
|
* ports — the two ways a binding goes dangling.
|
|
73
|
+
*
|
|
74
|
+
* `PortBinding` carries no direction of its own, and a `portId` is only unique
|
|
75
|
+
* within one side of a node: plenty of node types name an input and an output
|
|
76
|
+
* the same thing (`chat_output` has both an input `message` and an output
|
|
77
|
+
* `message`). `prefer` — the owning entry's direction — decides which side is
|
|
78
|
+
* searched first, so such a binding resolves to the port the author actually
|
|
79
|
+
* picked. The other side is still searched as a fallback, so a genuinely
|
|
80
|
+
* misdirected binding (a port that exists only on the opposite side) still
|
|
81
|
+
* resolves and gets reported by `validateWorkflowInterface`.
|
|
73
82
|
*/
|
|
74
|
-
export declare function resolveBinding(workflow: Workflow, binding: PortBinding): ResolvedBinding | null;
|
|
83
|
+
export declare function resolveBinding(workflow: Workflow, binding: PortBinding, prefer?: 'input' | 'output'): ResolvedBinding | null;
|
|
75
84
|
/**
|
|
76
85
|
* Resolve every entry of `workflow.interface` (inputs then outputs) against
|
|
77
86
|
* the live node graph, with a health status per entry.
|
|
@@ -33,19 +33,28 @@ const STATUS_PRECEDENCE = [
|
|
|
33
33
|
* metadata ports (inputs and outputs) for the bound port. Returns `null` if
|
|
34
34
|
* the node no longer exists, or the port isn't among that node's metadata
|
|
35
35
|
* ports — the two ways a binding goes dangling.
|
|
36
|
+
*
|
|
37
|
+
* `PortBinding` carries no direction of its own, and a `portId` is only unique
|
|
38
|
+
* within one side of a node: plenty of node types name an input and an output
|
|
39
|
+
* the same thing (`chat_output` has both an input `message` and an output
|
|
40
|
+
* `message`). `prefer` — the owning entry's direction — decides which side is
|
|
41
|
+
* searched first, so such a binding resolves to the port the author actually
|
|
42
|
+
* picked. The other side is still searched as a fallback, so a genuinely
|
|
43
|
+
* misdirected binding (a port that exists only on the opposite side) still
|
|
44
|
+
* resolves and gets reported by `validateWorkflowInterface`.
|
|
36
45
|
*/
|
|
37
|
-
export function resolveBinding(workflow, binding) {
|
|
46
|
+
export function resolveBinding(workflow, binding, prefer = 'input') {
|
|
38
47
|
const node = workflow.nodes.find((candidate) => candidate.id === binding.nodeId);
|
|
39
48
|
if (!node)
|
|
40
49
|
return null;
|
|
41
50
|
const metadata = node.data?.metadata;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return
|
|
51
|
+
const find = (direction) => {
|
|
52
|
+
const ports = direction === 'input' ? metadata?.inputs : metadata?.outputs;
|
|
53
|
+
const port = ports?.find((candidate) => candidate.id === binding.portId);
|
|
54
|
+
return port ? { node, port, direction } : null;
|
|
55
|
+
};
|
|
56
|
+
const other = prefer === 'input' ? 'output' : 'input';
|
|
57
|
+
return find(prefer) ?? find(other);
|
|
49
58
|
}
|
|
50
59
|
/** The instance's `config.ports` entries for a resolved binding's own direction. */
|
|
51
60
|
function portConfigEntriesFor(target) {
|
|
@@ -60,7 +69,7 @@ function resolveEntry(workflow, entry, direction) {
|
|
|
60
69
|
if (entry.bindings.length === 0) {
|
|
61
70
|
return { entry, direction, targets: [], status: 'unbound' };
|
|
62
71
|
}
|
|
63
|
-
const resolved = entry.bindings.map((binding) => resolveBinding(workflow, binding));
|
|
72
|
+
const resolved = entry.bindings.map((binding) => resolveBinding(workflow, binding, direction));
|
|
64
73
|
const targets = resolved.filter((target) => target !== null);
|
|
65
74
|
const isDangling = targets.length !== resolved.length;
|
|
66
75
|
let status;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.2.0",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|