@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.
Files changed (138) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +10 -1
  3. package/dist/components/App.svelte +219 -6
  4. package/dist/components/App.svelte.d.ts +8 -0
  5. package/dist/components/CanvasToolbar.svelte +40 -3
  6. package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
  7. package/dist/components/ConnectPortPicker.svelte +8 -4
  8. package/dist/components/DoctorMenu.svelte +208 -126
  9. package/dist/components/ImpactConfirm.svelte +341 -0
  10. package/dist/components/ImpactConfirm.svelte.d.ts +12 -0
  11. package/dist/components/Input.svelte +2 -2
  12. package/dist/components/Navbar.svelte +48 -3
  13. package/dist/components/Navbar.svelte.d.ts +4 -0
  14. package/dist/components/NodeSidebar.svelte +36 -15
  15. package/dist/components/NodeSidebar.svelte.d.ts +2 -0
  16. package/dist/components/NodeSwapPicker.svelte +4 -14
  17. package/dist/components/RunBar.svelte +36 -1
  18. package/dist/components/RunBar.svelte.d.ts +5 -0
  19. package/dist/components/RunInputsDialog.svelte +198 -0
  20. package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
  21. package/dist/components/SchemaForm.svelte +2 -1
  22. package/dist/components/SchemaForm.svelte.d.ts +2 -1
  23. package/dist/components/WorkflowCompareDialog.svelte +177 -0
  24. package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
  25. package/dist/components/WorkflowEditor.svelte +88 -6
  26. package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
  27. package/dist/components/WorkflowInterfaceEditor.svelte +14 -4
  28. package/dist/components/WorkflowInterfaceEntryCard.svelte +19 -3
  29. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
  30. package/dist/components/form/FormAutocomplete.svelte +76 -12
  31. package/dist/components/nodes/NodeCard.svelte +2 -2
  32. package/dist/components/primitives/Button.svelte +1 -1
  33. package/dist/components/primitives/Button.svelte.d.ts +1 -1
  34. package/dist/components/primitives/Card.svelte +1 -1
  35. package/dist/components/primitives/Card.svelte.d.ts +1 -1
  36. package/dist/components/primitives/Checkbox.svelte +1 -1
  37. package/dist/components/primitives/Checkbox.svelte.d.ts +1 -1
  38. package/dist/components/primitives/Chip.svelte +1 -1
  39. package/dist/components/primitives/Chip.svelte.d.ts +1 -1
  40. package/dist/components/primitives/Combobox.svelte +1 -1
  41. package/dist/components/primitives/Combobox.svelte.d.ts +1 -1
  42. package/dist/components/primitives/Composer.svelte +1 -1
  43. package/dist/components/primitives/Composer.svelte.d.ts +1 -1
  44. package/dist/components/primitives/EmptyState.svelte +1 -1
  45. package/dist/components/primitives/EmptyState.svelte.d.ts +1 -1
  46. package/dist/components/primitives/Field.svelte +1 -1
  47. package/dist/components/primitives/Field.svelte.d.ts +1 -1
  48. package/dist/components/primitives/IconButton.svelte +1 -1
  49. package/dist/components/primitives/IconButton.svelte.d.ts +1 -1
  50. package/dist/components/primitives/Menu.svelte +1 -1
  51. package/dist/components/primitives/Menu.svelte.d.ts +1 -1
  52. package/dist/components/primitives/Notice.svelte +1 -1
  53. package/dist/components/primitives/Notice.svelte.d.ts +1 -1
  54. package/dist/components/primitives/PanelHeader.svelte +1 -1
  55. package/dist/components/primitives/PanelHeader.svelte.d.ts +1 -1
  56. package/dist/components/primitives/Segmented.svelte +2 -2
  57. package/dist/components/primitives/Segmented.svelte.d.ts +2 -2
  58. package/dist/components/primitives/Select.svelte +1 -1
  59. package/dist/components/primitives/Select.svelte.d.ts +1 -1
  60. package/dist/components/primitives/StatusPill.svelte +1 -1
  61. package/dist/components/primitives/StatusPill.svelte.d.ts +1 -1
  62. package/dist/components/primitives/Switch.svelte +1 -1
  63. package/dist/components/primitives/Switch.svelte.d.ts +1 -1
  64. package/dist/components/primitives/Tabs.svelte +2 -2
  65. package/dist/components/primitives/Tabs.svelte.d.ts +2 -2
  66. package/dist/components/primitives/Toolbar.svelte +1 -1
  67. package/dist/components/primitives/Toolbar.svelte.d.ts +1 -1
  68. package/dist/components/primitives/ToolbarSeparator.svelte +1 -1
  69. package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +1 -1
  70. package/dist/components/toast/DismissibleToast.svelte +25 -6
  71. package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
  72. package/dist/config/endpoints.d.ts +7 -0
  73. package/dist/config/endpoints.js +2 -1
  74. package/dist/editor/connectCandidates.d.ts +3 -0
  75. package/dist/editor/connectCandidates.js +14 -5
  76. package/dist/editor/index.d.ts +1 -1
  77. package/dist/editor/index.js +1 -1
  78. package/dist/helpers/workflowEditorHelper.d.ts +15 -0
  79. package/dist/helpers/workflowEditorHelper.js +9 -0
  80. package/dist/index.d.ts +1 -0
  81. package/dist/messages/defaults.d.ts +101 -0
  82. package/dist/messages/defaults.js +92 -1
  83. package/dist/openapi/v1/openapi.yaml +10 -2
  84. package/dist/schemas/v1/workflow.schema.json +1 -1
  85. package/dist/services/draftStorage.d.ts +24 -10
  86. package/dist/services/draftStorage.js +60 -35
  87. package/dist/services/globalSave.d.ts +28 -10
  88. package/dist/services/globalSave.js +135 -31
  89. package/dist/services/impactGate.d.ts +34 -0
  90. package/dist/services/impactGate.js +70 -0
  91. package/dist/services/impactService.d.ts +28 -0
  92. package/dist/services/impactService.js +71 -0
  93. package/dist/services/toastQueue.d.ts +9 -0
  94. package/dist/services/toastService.d.ts +4 -0
  95. package/dist/services/toastService.js +9 -3
  96. package/dist/services/workflowLaunchService.js +3 -1
  97. package/dist/settings/index.d.ts +2 -2
  98. package/dist/settings/index.js +1 -1
  99. package/dist/stores/doctorStore.svelte.d.ts +24 -1
  100. package/dist/stores/doctorStore.svelte.js +105 -2
  101. package/dist/stores/instanceContainer.svelte.d.ts +16 -0
  102. package/dist/stores/instanceContainer.svelte.js +22 -2
  103. package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
  104. package/dist/stores/saveConflictStore.svelte.js +169 -0
  105. package/dist/stores/workflowStore.svelte.d.ts +7 -3
  106. package/dist/stores/workflowStore.svelte.js +14 -5
  107. package/dist/styles/toast.css +10 -1
  108. package/dist/svelte-app.d.ts +23 -0
  109. package/dist/svelte-app.js +114 -3
  110. package/dist/themes/scopedSkinCss.d.ts +22 -0
  111. package/dist/themes/scopedSkinCss.js +27 -1
  112. package/dist/types/doctor.d.ts +3 -1
  113. package/dist/types/events.d.ts +20 -0
  114. package/dist/types/events.js +2 -0
  115. package/dist/types/impact.d.ts +25 -0
  116. package/dist/types/impact.js +7 -0
  117. package/dist/types/index.d.ts +11 -1
  118. package/dist/types/settings.d.ts +31 -0
  119. package/dist/types/settings.js +132 -0
  120. package/dist/ui/index.d.ts +76 -0
  121. package/dist/ui/index.js +81 -0
  122. package/dist/utils/apiUrl.d.ts +55 -0
  123. package/dist/utils/apiUrl.js +117 -0
  124. package/dist/utils/draftRestore.d.ts +27 -0
  125. package/dist/utils/draftRestore.js +36 -0
  126. package/dist/utils/interfaceTags.js +4 -1
  127. package/dist/utils/nodeSearch.d.ts +10 -0
  128. package/dist/utils/nodeSearch.js +37 -0
  129. package/dist/utils/portal.js +45 -3
  130. package/dist/utils/runOffer.d.ts +21 -0
  131. package/dist/utils/runOffer.js +13 -0
  132. package/dist/utils/workflowCompare.d.ts +35 -0
  133. package/dist/utils/workflowCompare.js +84 -0
  134. package/dist/utils/workflowInterface.d.ts +26 -1
  135. package/dist/utils/workflowInterface.js +91 -11
  136. package/dist/webmcp/index.d.ts +5 -0
  137. package/dist/webmcp/index.js +5 -0
  138. package/package.json +8 -2
@@ -17,7 +17,7 @@ import { dynamicPortToNodePort, WORKFLOW_INTERFACE_INPUT_TURNS, WORKFLOW_INTERFA
17
17
  import { isPortExposed } from './portUtils.js';
18
18
  import { LOOPBACK_PORT_NAME } from './connections.js';
19
19
  import { PORTS_CONFIG_KEY } from './nodeFormSchema.js';
20
- import { buildHandleId } from './handleIds.js';
20
+ import { buildHandleId, extractPortId } from './handleIds.js';
21
21
  import { isPlaygroundChatHalfSet, normalizePlaygroundChat, playgroundBoundInputs, resolvePlaygroundChat } from './playgroundChat.js';
22
22
  /** Precedence used to pick the single reported status when several apply. */
23
23
  const STATUS_PRECEDENCE = [
@@ -412,6 +412,22 @@ export function nodeCanvasLabel(node) {
412
412
  const title = node.data?.config?.instanceTitle;
413
413
  return (typeof title === 'string' && title) || node.data?.label || node.id;
414
414
  }
415
+ /**
416
+ * Tells same-named nodes apart in a picker: when two or more items with
417
+ * different node ids share a label, each of them gets " · <node id>" appended.
418
+ * Unique labels, and several ports of one node, stay as they are.
419
+ */
420
+ export function disambiguateLabels(items) {
421
+ const nodesByLabel = new Map();
422
+ for (const item of items) {
423
+ const ids = nodesByLabel.get(item.nodeLabel) ?? new Set();
424
+ ids.add(item.nodeId);
425
+ nodesByLabel.set(item.nodeLabel, ids);
426
+ }
427
+ return items.map((item) => (nodesByLabel.get(item.nodeLabel)?.size ?? 0) > 1
428
+ ? { ...item, nodeLabel: `${item.nodeLabel} · ${item.nodeId}` }
429
+ : item);
430
+ }
415
431
  /**
416
432
  * Every canvas-exposed port of a workflow, for one direction — the candidate
417
433
  * set a binding picker offers (design decision 3: external ⊂ internal, so an
@@ -449,7 +465,7 @@ export function listBindablePorts(workflow, direction) {
449
465
  }
450
466
  }
451
467
  }
452
- return result;
468
+ return disambiguateLabels(result);
453
469
  }
454
470
  /**
455
471
  * A stable key for a bindable port — `nodeId::portId` — the value a picker
@@ -502,18 +518,82 @@ export function rankBindablePorts(workflow, direction) {
502
518
  * re-derives it. DN1's concern — a contract silently keyed on internal port
503
519
  * names — is about that ongoing coupling, which this does not introduce.
504
520
  */
505
- export function entryFromBindablePort(candidate, existingIds) {
521
+ export function entryFromBindablePort(candidate, existingIds, workflow, direction) {
522
+ const suggestion = suggestEntryFromBindablePort(workflow, candidate, existingIds, direction);
523
+ return {
524
+ ...pullEntryFieldsFromPort(candidate.port),
525
+ ...suggestion,
526
+ bindings: [{ nodeId: candidate.nodeId, portId: candidate.port.id }]
527
+ };
528
+ }
529
+ /** Port ids too generic to name a public entry: the node's title names it instead. */
530
+ export const GENERIC_PORT_IDS = [
531
+ 'data',
532
+ 'value',
533
+ 'input',
534
+ 'output',
535
+ 'result',
536
+ 'text'
537
+ ];
538
+ /**
539
+ * The id, title and type to seed a new entry with for a picked port.
540
+ *
541
+ * A generic port id (`data`, `value`, ...) says nothing about the contract, so
542
+ * the bound node's canvas label gives the id (snake_case) and the title. A
543
+ * `mixed` port takes the type of the port at the other end of an edge on its
544
+ * handle, when that one is typed. The id gets a numeric suffix only on a
545
+ * collision with `existingIds`.
546
+ */
547
+ export function suggestEntryFromBindablePort(workflow, candidate, existingIds, direction) {
548
+ const { port } = candidate;
549
+ const generic = GENERIC_PORT_IDS.includes(port.id);
550
+ // The picker label may carry a " · node id" suffix; an entry is named after the node itself.
551
+ const ownNode = workflow?.nodes.find((n) => n.id === candidate.nodeId);
552
+ const label = ownNode ? nodeCanvasLabel(ownNode) : candidate.nodeLabel;
553
+ // Accents fold to their base letter (Übersetzung -> ubersetzung), ß to ss.
554
+ const fromLabel = label
555
+ .normalize('NFD')
556
+ .replace(/[\u0300-\u036f]/g, '')
557
+ .replace(/ß/g, 'ss')
558
+ .toLowerCase()
559
+ .replace(/[^a-z0-9]+/g, '_')
560
+ .replace(/^_+|_+$/g, '')
561
+ .slice(0, 40)
562
+ .replace(/_+$/g, '');
563
+ const base = generic && fromLabel ? fromLabel : port.id;
506
564
  const taken = new Set(existingIds);
507
- let id = candidate.port.id;
565
+ let id = base;
508
566
  for (let n = 2; taken.has(id); n += 1) {
509
- id = `${candidate.port.id}_${n}`;
567
+ id = `${base}_${n}`;
510
568
  }
511
- return {
512
- id,
513
- dataType: candidate.port.dataType,
514
- bindings: [{ nodeId: candidate.nodeId, portId: candidate.port.id }],
515
- ...pullEntryFieldsFromPort(candidate.port)
516
- };
569
+ let dataType = port.dataType;
570
+ if (dataType === 'mixed' && workflow && direction) {
571
+ const handleId = buildHandleId(candidate.nodeId, direction, port.id);
572
+ const edge = workflow.edges.find((e) => direction === 'input' ? e.targetHandle === handleId : e.sourceHandle === handleId);
573
+ const otherNode = edge
574
+ ? workflow.nodes.find((n) => n.id === (direction === 'input' ? edge.source : edge.target))
575
+ : undefined;
576
+ const otherPortId = edge
577
+ ? extractPortId(direction === 'input' ? edge.sourceHandle : edge.targetHandle)
578
+ : null;
579
+ const otherMetadata = otherNode?.data?.metadata;
580
+ if (otherNode && otherMetadata && otherPortId) {
581
+ const otherDirection = direction === 'input' ? 'output' : 'input';
582
+ const dynamicRaw = otherDirection === 'input'
583
+ ? otherNode.data?.config?.dynamicInputs
584
+ : otherNode.data?.config?.dynamicOutputs;
585
+ const otherPorts = [
586
+ ...(otherDirection === 'input'
587
+ ? (otherMetadata.inputs ?? [])
588
+ : (otherMetadata.outputs ?? [])),
589
+ ...(dynamicRaw ?? []).map((dynamic) => dynamicPortToNodePort(dynamic, otherDirection))
590
+ ];
591
+ const otherType = otherPorts.find((other) => other.id === otherPortId)?.dataType;
592
+ if (otherType && otherType !== 'mixed')
593
+ dataType = otherType;
594
+ }
595
+ }
596
+ return { id, name: generic ? label : port.name, dataType };
517
597
  }
518
598
  // ---------------------------------------------------------------------------
519
599
  // Chat turn ports — deprecated since 2.11.0, removed in 3.0 with interface
@@ -10,6 +10,11 @@
10
10
  * These are tools for *editing* a workflow in the browser. They are unrelated
11
11
  * to the tools a running workflow hands to an LLM node.
12
12
  *
13
+ * Experimental in 2.x: names, options and tool shapes may still change in a
14
+ * minor release while WebMCP itself settles (it is behind a browser origin
15
+ * trial). This covers the `webmcp` option of `mountFlowDropApp` too. Pin a
16
+ * minor version (`~2.16.0`) if you depend on it.
17
+ *
13
18
  * @module webmcp
14
19
  *
15
20
  * @example Svelte host
@@ -10,6 +10,11 @@
10
10
  * These are tools for *editing* a workflow in the browser. They are unrelated
11
11
  * to the tools a running workflow hands to an LLM node.
12
12
  *
13
+ * Experimental in 2.x: names, options and tool shapes may still change in a
14
+ * minor release while WebMCP itself settles (it is behind a browser origin
15
+ * trial). This covers the `webmcp` option of `mountFlowDropApp` too. Pin a
16
+ * minor version (`~2.16.0`) if you depend on it.
17
+ *
13
18
  * @module webmcp
14
19
  *
15
20
  * @example Svelte host
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.15.2",
6
+ "version": "2.17.0",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"
@@ -106,6 +106,11 @@
106
106
  "svelte": "./dist/display/index.js",
107
107
  "default": "./dist/display/index.js"
108
108
  },
109
+ "./ui": {
110
+ "types": "./dist/ui/index.d.ts",
111
+ "svelte": "./dist/ui/index.js",
112
+ "default": "./dist/ui/index.js"
113
+ },
109
114
  "./playground": {
110
115
  "types": "./dist/playground/index.d.ts",
111
116
  "svelte": "./dist/playground/index.js",
@@ -272,7 +277,8 @@
272
277
  "dag",
273
278
  "agent",
274
279
  "ai-workflow",
275
- "embeddable"
280
+ "embeddable",
281
+ "workflow-specification"
276
282
  ],
277
283
  "dependencies": {
278
284
  "diff": "^8.0.3",