@flowdrop/flowdrop 2.10.0 → 2.11.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 (175) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/dist/components/App.svelte +112 -29
  3. package/dist/components/CanvasController.svelte +1 -1
  4. package/dist/components/ConfigForm.svelte +5 -5
  5. package/dist/components/ConfigModal.svelte +2 -2
  6. package/dist/components/ConfigModal.svelte.d.ts +1 -1
  7. package/dist/components/ConnectionLine.svelte +1 -1
  8. package/dist/components/EdgeRefresher.svelte +1 -1
  9. package/dist/components/FlowDropZone.svelte +11 -7
  10. package/dist/components/FlowDropZone.svelte.d.ts +12 -0
  11. package/dist/components/LogsSidebar.svelte +15 -12
  12. package/dist/components/MarkdownDisplay.svelte +1 -1
  13. package/dist/components/PipelineStatus.svelte +5 -18
  14. package/dist/components/PortCoordinateTracker.svelte +1 -1
  15. package/dist/components/SchemaForm.svelte +1 -1
  16. package/dist/components/SettingsModal.svelte +1 -1
  17. package/dist/components/SettingsPanel.svelte +1 -1
  18. package/dist/components/WorkflowEditor.svelte +200 -174
  19. package/dist/components/WorkflowInterfaceEditor.svelte +43 -8
  20. package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
  21. package/dist/components/WorkflowInterfaceEntryCard.svelte +117 -44
  22. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
  23. package/dist/components/WorkflowPlaygroundSettings.svelte +551 -0
  24. package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
  25. package/dist/components/chat/AIChatPanel.svelte +1 -1
  26. package/dist/components/form/index.d.ts +2 -2
  27. package/dist/components/form/index.js +2 -2
  28. package/dist/components/nodes/ToolNode.svelte +1 -1
  29. package/dist/components/playground/ControlPanel.svelte +30 -0
  30. package/dist/components/playground/ControlPanel.svelte.d.ts +5 -0
  31. package/dist/components/playground/Playground.svelte +94 -42
  32. package/dist/components/playground/PlaygroundApp.svelte +1 -1
  33. package/dist/components/playground/PlaygroundModal.svelte +1 -1
  34. package/dist/components/playground/PlaygroundStudio.svelte +1 -1
  35. package/dist/core/index.d.ts +1 -1
  36. package/dist/helpers/workflowEditorHelper.d.ts +12 -0
  37. package/dist/helpers/workflowEditorHelper.js +31 -0
  38. package/dist/messages/defaults.d.ts +53 -0
  39. package/dist/messages/defaults.js +48 -2
  40. package/dist/openapi/v1/openapi.yaml +113 -5
  41. package/dist/playground/index.d.ts +3 -1
  42. package/dist/playground/index.js +2 -1
  43. package/dist/playground/mount.d.ts +6 -10
  44. package/dist/playground/mount.js +43 -24
  45. package/dist/schemas/index.js +1 -1
  46. package/dist/schemas/v1/workflow.schema.json +140 -2
  47. package/dist/services/globalSave.js +11 -1
  48. package/dist/services/playgroundService.d.ts +6 -1
  49. package/dist/services/playgroundService.js +5 -0
  50. package/dist/skins/default.d.ts +1 -1
  51. package/dist/skins/drafter.d.ts +1 -1
  52. package/dist/skins/index.d.ts +4 -4
  53. package/dist/skins/index.js +3 -3
  54. package/dist/skins/slate.d.ts +1 -1
  55. package/dist/stores/instanceContainer.svelte.d.ts +15 -0
  56. package/dist/stores/instanceContainer.svelte.js +11 -1
  57. package/dist/stores/playgroundStore.svelte.d.ts +8 -0
  58. package/dist/stores/playgroundStore.svelte.js +18 -4
  59. package/dist/stores/workflowStore.svelte.d.ts +4 -1
  60. package/dist/stores/workflowStore.svelte.js +8 -1
  61. package/dist/styles/base.css +14 -3
  62. package/dist/styles/tokenAliases.d.ts +13 -0
  63. package/dist/styles/tokenAliases.js +89 -0
  64. package/dist/themes/scopedSkinCss.d.ts +30 -0
  65. package/dist/themes/scopedSkinCss.js +95 -0
  66. package/dist/types/index.d.ts +86 -4
  67. package/dist/types/index.js +15 -3
  68. package/dist/types/skin.d.ts +2 -2
  69. package/dist/utils/playgroundChat.d.ts +121 -0
  70. package/dist/utils/playgroundChat.js +275 -0
  71. package/dist/utils/portal.d.ts +8 -0
  72. package/dist/utils/portal.js +15 -0
  73. package/dist/utils/workflowInterface.d.ts +88 -20
  74. package/dist/utils/workflowInterface.js +179 -18
  75. package/dist/webmcp/WebMCPConfirm.svelte +68 -18
  76. package/dist/webmcp/gate.d.ts +6 -0
  77. package/dist/webmcp/gate.js +4 -0
  78. package/dist/webmcp/runtime.js +2 -1
  79. package/package.json +8 -7
  80. package/dist/components/Button.stories.svelte +0 -65
  81. package/dist/components/Button.stories.svelte.d.ts +0 -19
  82. package/dist/components/CanvasBanner.stories.svelte +0 -30
  83. package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
  84. package/dist/components/CanvasContextMenu.stories.svelte +0 -63
  85. package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
  86. package/dist/components/ConfigPanel.stories.svelte +0 -47
  87. package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
  88. package/dist/components/EditorStatusBar.stories.svelte +0 -44
  89. package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
  90. package/dist/components/FlowDropEdge.stories.svelte +0 -197
  91. package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
  92. package/dist/components/LoadingSpinner.stories.svelte +0 -30
  93. package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
  94. package/dist/components/Logo.stories.svelte +0 -22
  95. package/dist/components/Logo.stories.svelte.d.ts +0 -27
  96. package/dist/components/MarkdownDisplay.stories.svelte +0 -38
  97. package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
  98. package/dist/components/Navbar.stories.svelte +0 -58
  99. package/dist/components/Navbar.stories.svelte.d.ts +0 -27
  100. package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
  101. package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
  102. package/dist/components/SchemaForm.stories.svelte +0 -122
  103. package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
  104. package/dist/components/StatusIcon.stories.svelte +0 -60
  105. package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
  106. package/dist/components/StatusLabel.stories.svelte +0 -17
  107. package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
  108. package/dist/components/ThemeToggle.stories.svelte +0 -25
  109. package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
  110. package/dist/components/console/CommandConsole.stories.svelte +0 -111
  111. package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
  112. package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
  113. package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
  114. package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
  115. package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
  116. package/dist/components/form/FormNumberField.stories.svelte +0 -36
  117. package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
  118. package/dist/components/form/FormRangeField.stories.svelte +0 -31
  119. package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
  120. package/dist/components/form/FormSelect.stories.svelte +0 -50
  121. package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
  122. package/dist/components/form/FormTextField.stories.svelte +0 -30
  123. package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
  124. package/dist/components/form/FormTextarea.stories.svelte +0 -34
  125. package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
  126. package/dist/components/form/FormToggle.stories.svelte +0 -30
  127. package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
  128. package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
  129. package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
  130. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
  131. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
  132. package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
  133. package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
  134. package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
  135. package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
  136. package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
  137. package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
  138. package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
  139. package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
  140. package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
  141. package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
  142. package/dist/components/nodes/NotesNode.stories.svelte +0 -76
  143. package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
  144. package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
  145. package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
  146. package/dist/components/nodes/SquareNode.stories.svelte +0 -127
  147. package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
  148. package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
  149. package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
  150. package/dist/components/nodes/ToolNode.stories.svelte +0 -189
  151. package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
  152. package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
  153. package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
  154. package/dist/components/playground/MessageBubble.stories.svelte +0 -151
  155. package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
  156. package/dist/mocks/app-environment.d.ts +0 -8
  157. package/dist/mocks/app-environment.js +0 -16
  158. package/dist/mocks/app-forms.d.ts +0 -6
  159. package/dist/mocks/app-forms.js +0 -29
  160. package/dist/mocks/app-navigation.d.ts +0 -5
  161. package/dist/mocks/app-navigation.js +0 -36
  162. package/dist/mocks/app-stores.d.ts +0 -14
  163. package/dist/mocks/app-stores.js +0 -26
  164. package/dist/stories/CanvasDecorator.svelte +0 -49
  165. package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
  166. package/dist/stories/EdgeDecorator.svelte +0 -125
  167. package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
  168. package/dist/stories/NodeDecorator.svelte +0 -75
  169. package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
  170. package/dist/stories/WebMCPFakeAgent.svelte +0 -229
  171. package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
  172. package/dist/stories/utils.d.ts +0 -93
  173. package/dist/stories/utils.js +0 -156
  174. package/dist/webmcp/WebMCP.stories.svelte +0 -101
  175. package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
@@ -17,6 +17,7 @@ import { isPortExposed } from './portUtils.js';
17
17
  import { LOOPBACK_PORT_NAME } from './connections.js';
18
18
  import { PORTS_CONFIG_KEY } from './nodeFormSchema.js';
19
19
  import { buildHandleId } from './handleIds.js';
20
+ import { isPlaygroundChatHalfSet, normalizePlaygroundChat, playgroundBoundInputs, resolvePlaygroundChat } from './playgroundChat.js';
20
21
  /** Precedence used to pick the single reported status when several apply. */
21
22
  const STATUS_PRECEDENCE = [
22
23
  'dangling',
@@ -174,22 +175,32 @@ export function validateWorkflowInterface(workflow) {
174
175
  }
175
176
  }
176
177
  }
178
+ // Deprecated `turn` marks. With stored Playground settings the server
179
+ // ignores them, so they warrant no warning (the Playground tab offers to
180
+ // remove them). Without a `playground` key (a server before FlowDrop
181
+ // 2.7.0) they are still the only chat set-up, and the selector is offered.
182
+ const checkTurns = !workflow.playground?.chat;
183
+ const turnHint = workflow.playground === undefined
184
+ ? 'a workflow takes at most one input per turn value.'
185
+ : 'only the first one counts. Set the chat up in the Playground settings instead.';
186
+ const directionHint = workflow.playground === undefined ? '' : ' Set the chat up in the Playground settings instead.';
177
187
  for (const entry of workflow.interface.inputs ?? []) {
178
- const otherId = turnTakenBy(workflow.interface.inputs ?? [], entry);
188
+ const otherId = checkTurns ? turnTakenBy(workflow.interface.inputs ?? [], entry) : undefined;
179
189
  if (otherId !== undefined) {
180
190
  issues.push({
181
191
  entryId: entry.id,
182
192
  direction: 'input',
183
193
  severity: 'warning',
184
194
  code: 'interface-turn-duplicate',
185
- message: `Interface input "${entry.id}" has chat turn "${entry.turn}", which input "${otherId}" already has; a workflow takes at most one input per turn value.`
195
+ message: `Interface input "${entry.id}" has the deprecated chat turn "${entry.turn}", which input "${otherId}" already has; ${turnHint}`
186
196
  });
187
197
  }
188
198
  }
189
199
  for (const direction of ['input', 'output']) {
190
200
  const entries = (direction === 'input' ? workflow.interface.inputs : workflow.interface.outputs) ?? [];
191
201
  for (const entry of entries) {
192
- if (entry.turn !== undefined &&
202
+ if (checkTurns &&
203
+ entry.turn !== undefined &&
193
204
  isKnownTurn(entry.turn) &&
194
205
  !turnsFor(direction).includes(entry.turn)) {
195
206
  issues.push({
@@ -197,7 +208,7 @@ export function validateWorkflowInterface(workflow) {
197
208
  direction,
198
209
  severity: 'warning',
199
210
  code: 'interface-turn-direction',
200
- message: `Interface ${direction} "${entry.id}" has chat turn "${entry.turn}", which only applies to ${direction === 'input' ? 'outputs' : 'inputs'}.`
211
+ message: `Interface ${direction} "${entry.id}" has the deprecated chat turn "${entry.turn}", which only applies to ${direction === 'input' ? 'outputs' : 'inputs'}.${directionHint}`
201
212
  });
202
213
  }
203
214
  }
@@ -493,7 +504,9 @@ export function entryFromBindablePort(candidate, existingIds) {
493
504
  };
494
505
  }
495
506
  // ---------------------------------------------------------------------------
496
- // Chat turn ports
507
+ // Chat turn ports — deprecated since 2.11.0, removed in 3.0 with interface
508
+ // `turn`. The chat binding lives in the Playground settings
509
+ // (`utils/playgroundChat.ts`); these stay only so a stored `turn` still reads.
497
510
  // ---------------------------------------------------------------------------
498
511
  /** The turn values an entry of this direction may carry, in selector order. */
499
512
  export function turnsFor(direction) {
@@ -556,26 +569,174 @@ function metaWithLimit(meta, limit) {
556
569
  next.limit = limit;
557
570
  return Object.keys(next).length > 0 ? next : undefined;
558
571
  }
559
- /** Whether any entry of the interface, on either side, declares a `turn`. */
572
+ /**
573
+ * Whether any entry of the interface, on either side, declares a `turn`.
574
+ *
575
+ * @deprecated since 2.11.0, removed in 3.0 with interface `turn`.
576
+ */
560
577
  export function declaresTurnPorts(workflowInterface) {
561
578
  const entries = [...(workflowInterface?.inputs ?? []), ...(workflowInterface?.outputs ?? [])];
562
579
  return entries.some((entry) => Boolean(entry.turn));
563
580
  }
564
581
  /**
565
- * The input entries a person fills in: every input without a `turn`. Turn
566
- * inputs (`message`, `history`, `session_id`, `message_id`, and any value a
567
- * newer server adds) are filled by the session, never by the form.
582
+ * The input entries a person fills in: every input the chat binding does not
583
+ * fill. With `playground` (a server from FlowDrop 2.7.0 on) those are the
584
+ * inputs its binding names (and, while the binding comes from `turn` marks,
585
+ * every input carrying one); without it, the inputs carrying a `turn`
586
+ * (`message`, `history`, `session_id`, `message_id`, and any value a newer
587
+ * server adds). The session fills those, never the form.
568
588
  */
569
- export function interfaceFormEntries(workflowInterface) {
570
- return (workflowInterface?.inputs ?? []).filter((entry) => !entry.turn);
571
- }
572
- /** Resolve the Playground's input mode from a workflow interface. */
573
- export function resolvePlaygroundInputMode(workflowInterface) {
574
- if (!declaresTurnPorts(workflowInterface))
575
- return 'legacy';
576
- if ((workflowInterface?.inputs ?? []).some((entry) => entry.turn === 'message'))
589
+ export function interfaceFormEntries(workflowInterface, playground) {
590
+ return interfaceFormEntriesFor(workflowInterface, resolvePlaygroundChat({ interface: workflowInterface, playground }));
591
+ }
592
+ /**
593
+ * {@link interfaceFormEntries} for a binding already resolved with
594
+ * `resolvePlaygroundChat` (`null` = the workflow carries no `playground`).
595
+ */
596
+ export function interfaceFormEntriesFor(workflowInterface, resolved) {
597
+ const inputs = workflowInterface?.inputs ?? [];
598
+ if (resolved === null)
599
+ return inputs.filter((entry) => !entry.turn);
600
+ const bound = playgroundBoundInputs(resolved.binding);
601
+ // While the chat comes from `turn` marks, an input marked with a value this
602
+ // library does not know (a newer server's) is the session's too.
603
+ const turnFilled = resolved.source === 'interface_turn';
604
+ return inputs.filter((entry) => !bound.has(entry.id) && !(turnFilled && entry.turn));
605
+ }
606
+ /**
607
+ * Resolve the Playground's input mode from a workflow's interface and, from
608
+ * FlowDrop 2.7.0 on, its Playground settings (`workflow.playground`).
609
+ */
610
+ export function resolvePlaygroundInputMode(workflowInterface, playground) {
611
+ return playgroundInputModeFor(workflowInterface, resolvePlaygroundChat({ interface: workflowInterface, playground }));
612
+ }
613
+ /**
614
+ * {@link resolvePlaygroundInputMode} for a binding already resolved with
615
+ * `resolvePlaygroundChat` (`null` = the workflow carries no `playground`).
616
+ */
617
+ export function playgroundInputModeFor(workflowInterface, resolved) {
618
+ if (resolved === null) {
619
+ if (!declaresTurnPorts(workflowInterface))
620
+ return 'legacy';
621
+ if ((workflowInterface?.inputs ?? []).some((entry) => entry.turn === 'message'))
622
+ return 'chat';
623
+ }
624
+ else if (resolved.binding.message !== null) {
577
625
  return 'chat';
578
- return interfaceFormEntries(workflowInterface).length > 0 ? 'form' : 'run';
626
+ }
627
+ return interfaceFormEntriesFor(workflowInterface, resolved).length > 0 ? 'form' : 'run';
628
+ }
629
+ /**
630
+ * What is wrong with a chat binding against the workflow as it is now.
631
+ *
632
+ * Errors mirror the server's checks (an input the interface no longer has,
633
+ * an input bound twice, a reply on a node or port that is gone), so the
634
+ * editor shows what the save would refuse. A reply's port is judged against
635
+ * the node's static and dynamic outputs; a node without metadata is not
636
+ * judged. The one warning is a half-set binding (a message input but no
637
+ * reply). Defaults to the workflow's stored binding. The binding is
638
+ * normalised first, so one from the wire that leaves out its nullable keys
639
+ * (the schema requires only `replies`) reads as unbound there, not as bound
640
+ * to an input that is missing.
641
+ */
642
+ export function playgroundChatIssues(workflow, binding = workflow.playground?.chat ?? null) {
643
+ if (!binding)
644
+ return [];
645
+ const chat = normalizePlaygroundChat(binding);
646
+ const issues = [];
647
+ const inputIds = new Set((workflow.interface?.inputs ?? []).map((entry) => entry.id));
648
+ const named = [
649
+ ['message', chat.message],
650
+ ['history', chat.history?.input ?? null],
651
+ ['session_id', chat.session_id],
652
+ ['message_id', chat.message_id]
653
+ ];
654
+ const used = new Map();
655
+ for (const [key, id] of named) {
656
+ if (id === null)
657
+ continue;
658
+ if (!inputIds.has(id)) {
659
+ issues.push({
660
+ severity: 'error',
661
+ code: 'playground-input-missing',
662
+ key,
663
+ input: id,
664
+ message: `"${key}" is bound to the input "${id}", which is not on the workflow interface.`
665
+ });
666
+ continue;
667
+ }
668
+ const other = used.get(id);
669
+ if (other !== undefined) {
670
+ issues.push({
671
+ severity: 'error',
672
+ code: 'playground-input-duplicate',
673
+ key,
674
+ input: id,
675
+ otherKey: other,
676
+ message: `Input "${id}" is bound twice ("${other}" and "${key}").`
677
+ });
678
+ continue;
679
+ }
680
+ used.set(id, key);
681
+ }
682
+ const nodes = new Map(workflow.nodes.map((node) => [node.id, node]));
683
+ for (const reply of chat.replies) {
684
+ const node = nodes.get(reply.node_id);
685
+ if (!node) {
686
+ issues.push({
687
+ severity: 'error',
688
+ code: 'playground-reply-node-missing',
689
+ reply,
690
+ message: `A reply prints port "${reply.port}" of node "${reply.node_id}", which is not in the workflow.`
691
+ });
692
+ continue;
693
+ }
694
+ const ports = nodeOutputPortIds(node);
695
+ if (ports !== null && !ports.has(reply.port)) {
696
+ issues.push({
697
+ severity: 'error',
698
+ code: 'playground-reply-port-missing',
699
+ reply,
700
+ message: `A reply prints port "${reply.port}" of node "${node.data?.label ?? node.id}", which has no such output.`
701
+ });
702
+ }
703
+ }
704
+ if (isPlaygroundChatHalfSet(chat)) {
705
+ issues.push({
706
+ severity: 'warning',
707
+ code: 'playground-half-set',
708
+ key: 'message',
709
+ message: 'A message input is bound but no reply is, so nothing answers in the chat.'
710
+ });
711
+ }
712
+ return issues;
713
+ }
714
+ /** A node's output ports (static and dynamic), or `null` without metadata. */
715
+ function nodeOutputPorts(node) {
716
+ const metadata = node.data?.metadata;
717
+ if (!metadata)
718
+ return null;
719
+ const dynamic = node.data?.config?.dynamicOutputs ?? [];
720
+ return [
721
+ ...(metadata.outputs ?? []),
722
+ ...dynamic.map((port) => dynamicPortToNodePort(port, 'output'))
723
+ ];
724
+ }
725
+ /** A node's output port ids, or `null` without metadata. */
726
+ function nodeOutputPortIds(node) {
727
+ const ports = nodeOutputPorts(node);
728
+ return ports && new Set(ports.map((port) => port.id));
729
+ }
730
+ /**
731
+ * The node output port a reply names, with the node's label: any output the
732
+ * node has, exposed on the canvas or not (the same ports
733
+ * `playgroundChatIssues` accepts). `null` when the node or port is gone, or
734
+ * the node carries no metadata to tell.
735
+ */
736
+ export function findReplyPort(workflow, reply) {
737
+ const node = workflow.nodes.find((candidate) => candidate.id === reply.node_id);
738
+ const port = node && nodeOutputPorts(node)?.find((candidate) => candidate.id === reply.port);
739
+ return node && port ? { nodeLabel: node.data?.label ?? node.id, port } : null;
579
740
  }
580
741
  /** JSON Schema `type` for an interface entry's lane, when its schema states none. */
581
742
  function formFieldType(dataType) {
@@ -57,7 +57,7 @@
57
57
  }
58
58
  </script>
59
59
 
60
- <div class="fd-webmcp-confirm" data-testid="flowdrop-webmcp-confirm">
60
+ <div class="flowdrop-portal fd-webmcp-confirm" data-testid="flowdrop-webmcp-confirm">
61
61
  <div
62
62
  class="fd-webmcp-confirm__dialog"
63
63
  role="alertdialog"
@@ -76,9 +76,12 @@
76
76
  </p>
77
77
  </header>
78
78
  <div class="fd-webmcp-confirm__body">
79
- <ol id="fd-webmcp-confirm-list" class="fd-webmcp-confirm__list">
79
+ <ol id="fd-webmcp-confirm-list" class="fd-webmcp-confirm__list" role="list">
80
80
  {#each lines as line, i (i)}
81
- <li class="fd-webmcp-confirm__line">{line}</li>
81
+ <li class="fd-webmcp-confirm__line">
82
+ <span class="fd-webmcp-confirm__step" aria-hidden="true">{i + 1}</span>
83
+ <span class="fd-webmcp-confirm__text">{line}</span>
84
+ </li>
82
85
  {/each}
83
86
  </ol>
84
87
  {#if offerRemember}
@@ -118,12 +121,15 @@
118
121
  </div>
119
122
 
120
123
  <style>
121
- /* Mounted on document.body, outside the editor tree: the tokens come from
122
- :root (tokens.css), the button classes from base.css — both global — and
123
- the dark skin from [data-theme='dark'] on <html>. Only the font has no
124
- host to inherit from, so it is set here. The shell follows
125
- SettingsModal: blurred backdrop, header / body / footer with the xl
126
- rhythm, and an enter animation. */
124
+ /* Mounted on document.body, outside the editor tree. Tokens come from :root
125
+ (tokens.css) and, for a skinned editor, from the editor's scope, which the
126
+ gate copies onto the host element; the dark palette follows
127
+ [data-theme='dark'] on <html>; the buttons are .flowdrop-btn from
128
+ base.css. Everything else is set here, because the host page's own
129
+ element rules (h2, p, ol, li, label) reach a dialog on <body>: every
130
+ element below states its margin, padding, font and list style rather than
131
+ trusting the UA defaults. The shell follows SettingsModal: blurred
132
+ backdrop, header / body / footer, an enter animation. */
127
133
  .fd-webmcp-confirm {
128
134
  position: fixed;
129
135
  inset: 0;
@@ -136,7 +142,11 @@
136
142
  backdrop-filter: blur(4px);
137
143
  font-family: var(--fd-font-sans, system-ui, sans-serif);
138
144
  font-size: var(--fd-text-sm, 0.875rem);
145
+ font-weight: 400;
139
146
  line-height: var(--fd-leading-normal, 1.5);
147
+ letter-spacing: normal;
148
+ text-align: left;
149
+ text-transform: none;
140
150
  }
141
151
 
142
152
  .fd-webmcp-confirm__dialog {
@@ -177,7 +187,11 @@
177
187
 
178
188
  .fd-webmcp-confirm__title {
179
189
  margin: 0 0 var(--fd-space-2xs, 0.25rem);
190
+ padding: 0;
191
+ font-family: inherit;
180
192
  font-size: var(--fd-text-lg, 1.125rem);
193
+ letter-spacing: normal;
194
+ text-transform: none;
181
195
  font-weight: 600;
182
196
  line-height: var(--fd-leading-tight, 1.3);
183
197
  color: var(--fd-foreground, #18181b);
@@ -186,6 +200,7 @@
186
200
 
187
201
  .fd-webmcp-confirm__hint {
188
202
  margin: 0;
203
+ padding: 0;
189
204
  font-size: var(--fd-text-sm, 0.875rem);
190
205
  color: var(--fd-muted-foreground, #71717a);
191
206
  }
@@ -197,26 +212,55 @@
197
212
  padding: var(--fd-space-xl, 1rem);
198
213
  }
199
214
 
215
+ /* One row per command: a step number in its own column, sized to the
216
+ widest number (12, 104…), so it never hangs outside the box the way an
217
+ <ol> marker in a fixed gutter does. */
200
218
  .fd-webmcp-confirm__list {
219
+ display: grid;
220
+ grid-template-columns: auto minmax(0, 1fr);
201
221
  margin: 0;
202
- padding: var(--fd-space-md, 0.75rem) var(--fd-space-lg, 0.875rem) var(--fd-space-md, 0.75rem)
203
- var(--fd-space-3xl, 2.25rem);
222
+ padding: 0;
223
+ list-style: none;
204
224
  border: 1px solid var(--fd-border, #d4d4d8);
205
225
  border-radius: var(--fd-radius-md, 0.375rem);
206
226
  background: var(--fd-muted, #f4f4f5);
207
- font-family: var(--fd-font-mono, ui-monospace, monospace);
208
- font-size: var(--fd-text-xs, 0.8125rem);
209
- line-height: var(--fd-leading-relaxed, 1.6);
210
- color: var(--fd-foreground, #18181b);
227
+ overflow: hidden;
211
228
  }
212
229
 
213
230
  .fd-webmcp-confirm__line {
214
- padding: var(--fd-space-3xs, 0.125rem) 0;
215
- overflow-wrap: anywhere;
231
+ display: grid;
232
+ grid-column: 1 / -1;
233
+ grid-template-columns: subgrid;
234
+ align-items: baseline;
235
+ margin: 0;
236
+ padding: 0;
237
+ list-style: none;
216
238
  }
217
239
 
218
- .fd-webmcp-confirm__line::marker {
240
+ .fd-webmcp-confirm__line + .fd-webmcp-confirm__line {
241
+ border-top: 1px solid var(--fd-border-muted, var(--fd-border, #e4e4e7));
242
+ }
243
+
244
+ .fd-webmcp-confirm__step {
245
+ padding: var(--fd-space-xs, 0.5rem) var(--fd-space-sm, 0.625rem) var(--fd-space-xs, 0.5rem)
246
+ var(--fd-space-md, 0.75rem);
247
+ font-family: var(--fd-font-mono, ui-monospace, monospace);
248
+ font-size: var(--fd-text-xs, 0.8125rem);
249
+ font-variant-numeric: tabular-nums;
250
+ line-height: var(--fd-leading-normal, 1.5);
251
+ text-align: right;
219
252
  color: var(--fd-muted-foreground, #71717a);
253
+ user-select: none;
254
+ }
255
+
256
+ .fd-webmcp-confirm__text {
257
+ min-width: 0;
258
+ padding: var(--fd-space-xs, 0.5rem) var(--fd-space-md, 0.75rem) var(--fd-space-xs, 0.5rem) 0;
259
+ font-family: var(--fd-font-mono, ui-monospace, monospace);
260
+ font-size: var(--fd-text-xs, 0.8125rem);
261
+ line-height: var(--fd-leading-normal, 1.5);
262
+ color: var(--fd-foreground, #18181b);
263
+ overflow-wrap: anywhere;
220
264
  }
221
265
 
222
266
  .fd-webmcp-confirm__remember {
@@ -224,13 +268,19 @@
224
268
  align-items: flex-start;
225
269
  gap: var(--fd-space-sm, 0.625rem);
226
270
  margin: var(--fd-space-lg, 0.875rem) 0 0;
271
+ padding: 0;
227
272
  font-size: var(--fd-text-sm, 0.875rem);
273
+ font-weight: 400;
274
+ line-height: var(--fd-leading-normal, 1.5);
275
+ letter-spacing: normal;
276
+ text-transform: none;
228
277
  color: var(--fd-muted-foreground, #71717a);
229
278
  cursor: pointer;
230
279
  }
231
280
 
232
281
  .fd-webmcp-confirm__remember input {
233
282
  flex-shrink: 0;
283
+ appearance: auto;
234
284
  width: 1rem;
235
285
  height: 1rem;
236
286
  margin: 0.2em 0 0;
@@ -78,5 +78,11 @@ export interface CreateGateOptions {
78
78
  messages?: MessagesOverride | (() => MessagesOverride);
79
79
  /** Offer the "don't ask again for edits" choice. Default true. */
80
80
  rememberEdits?: boolean;
81
+ /**
82
+ * The editor's skin scope (`data-fd-scope`), read when a dialog opens. The
83
+ * dialog mounts outside the editor tree, so without it a skinned editor's
84
+ * dialog shows the default tokens.
85
+ */
86
+ skinScope?: () => string | null;
81
87
  }
82
88
  export declare function createApprovalGate(approval: WebMCPApproval, options: CreateGateOptions): ApprovalGate;
@@ -23,6 +23,7 @@ import { mount, unmount } from 'svelte';
23
23
  import { defaultMessages, mergeMessages, messagesContext } from '../messages/index.js';
24
24
  import { describeCommand, summarizeCommands } from './descriptors.js';
25
25
  import WebMCPConfirm from './WebMCPConfirm.svelte';
26
+ import { SCOPE_ATTR } from '../utils/portal.js';
26
27
  /** A second mutating call arrived while a decision was pending. */
27
28
  export class GateBusyError extends Error {
28
29
  constructor() {
@@ -89,6 +90,9 @@ export function createApprovalGate(approval, options) {
89
90
  let settled = false;
90
91
  const host = document.createElement('div');
91
92
  host.className = 'fd-webmcp-confirm-host';
93
+ const scope = options.skinScope?.();
94
+ if (scope)
95
+ host.setAttribute(SCOPE_ATTR, scope);
92
96
  target.appendChild(host);
93
97
  const finish = (approved, remember = false) => {
94
98
  if (settled)
@@ -221,7 +221,8 @@ export function createToolRuntime(options) {
221
221
  container: options.container,
222
222
  editorName,
223
223
  messages: options.messages,
224
- rememberEdits: options.rememberEdits
224
+ rememberEdits: options.rememberEdits,
225
+ skinScope: () => instance.skinScope
225
226
  });
226
227
  const ownsGate = !options.gate;
227
228
  const gateRequest = (tool) => {
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.10.0",
6
+ "version": "2.11.0",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"
@@ -48,6 +48,9 @@
48
48
  "!dist/**/*.test.*",
49
49
  "!dist/**/*.spec.*",
50
50
  "!dist/**/*.map",
51
+ "!dist/**/*.stories.*",
52
+ "!dist/stories",
53
+ "!dist/mocks",
51
54
  "CHANGELOG.md",
52
55
  "MIGRATION-2.0.md"
53
56
  ],
@@ -151,7 +154,7 @@
151
154
  "@iconify/svelte": "^5.0.0",
152
155
  "@xyflow/svelte": "^1.2",
153
156
  "codemirror": "^6.0.2",
154
- "svelte": "^5.0.0"
157
+ "svelte": "^5.29.0"
155
158
  },
156
159
  "peerDependenciesMeta": {
157
160
  "@codemirror/autocomplete": {
@@ -181,9 +184,6 @@
181
184
  "@codemirror/view": {
182
185
  "optional": true
183
186
  },
184
- "@iconify/svelte": {
185
- "optional": true
186
- },
187
187
  "codemirror": {
188
188
  "optional": true
189
189
  }
@@ -224,7 +224,7 @@
224
224
  "@vitest/browser": "^3.2.3",
225
225
  "@vitest/coverage-v8": "^3.2.4",
226
226
  "@vitest/ui": "^3.2.4",
227
- "@xyflow/svelte": "^1.2",
227
+ "@xyflow/svelte": "^1.7.0",
228
228
  "codemirror": "^6.0.2",
229
229
  "eslint": "^9.18.0",
230
230
  "eslint-config-prettier": "^10.0.1",
@@ -253,7 +253,7 @@
253
253
  "yaml": "^2.8.3"
254
254
  },
255
255
  "engines": {
256
- "node": ">=18"
256
+ "node": ">=20"
257
257
  },
258
258
  "keywords": [
259
259
  "svelte",
@@ -298,6 +298,7 @@
298
298
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
299
299
  "lint": "eslint . && prettier --check .",
300
300
  "test": "vitest run",
301
+ "generate:token-aliases": "node scripts/generate-token-aliases.mjs && prettier --write src/lib/styles/tokenAliases.ts",
301
302
  "test:watch": "vitest",
302
303
  "test:ui": "vitest --ui",
303
304
  "test:coverage": "vitest run --coverage",
@@ -1,65 +0,0 @@
1
- <script module lang="ts">
2
- import type { ComponentProps } from 'svelte';
3
- import { defineMeta } from '@storybook/addon-svelte-csf';
4
- import Button from './Button.svelte';
5
- import { fn } from 'storybook/test';
6
-
7
- const { Story } = defineMeta({
8
- title: 'Display/Button',
9
- component: Button,
10
- tags: ['autodocs'],
11
- parameters: {
12
- layout: 'centered'
13
- },
14
- argTypes: {
15
- variant: {
16
- control: { type: 'select' },
17
- options: ['primary', 'secondary', 'outline', 'ghost']
18
- },
19
- size: {
20
- control: { type: 'select' },
21
- options: ['sm', 'md', 'lg']
22
- },
23
- disabled: { control: 'boolean' }
24
- },
25
- args: {
26
- variant: 'secondary',
27
- size: 'md',
28
- disabled: false,
29
- onclick: fn()
30
- }
31
- });
32
- </script>
33
-
34
- <!-- Arg-driven template so the Controls panel can tweak variant/size/disabled live. -->
35
- {#snippet template(args: Omit<ComponentProps<typeof Button>, 'children'>)}
36
- <Button {...args}>Button</Button>
37
- {/snippet}
38
-
39
- <Story name="Primary" args={{ variant: 'primary' }} {template} />
40
-
41
- <Story name="Secondary" args={{ variant: 'secondary' }} {template} />
42
-
43
- <Story name="Outline" args={{ variant: 'outline' }} {template} />
44
-
45
- <Story name="Ghost" args={{ variant: 'ghost' }} {template} />
46
-
47
- <Story name="Disabled" args={{ variant: 'primary', disabled: true }} {template} />
48
-
49
- <!-- Static showcases comparing every variant / size side by side. -->
50
- <Story name="Variants" asChild>
51
- <div style="display: flex; gap: 0.75rem; align-items: center;">
52
- <Button variant="primary">Primary</Button>
53
- <Button variant="secondary">Secondary</Button>
54
- <Button variant="outline">Outline</Button>
55
- <Button variant="ghost">Ghost</Button>
56
- </div>
57
- </Story>
58
-
59
- <Story name="Sizes" asChild>
60
- <div style="display: flex; gap: 0.75rem; align-items: center;">
61
- <Button variant="primary" size="sm">Small</Button>
62
- <Button variant="primary" size="md">Medium</Button>
63
- <Button variant="primary" size="lg">Large</Button>
64
- </div>
65
- </Story>
@@ -1,19 +0,0 @@
1
- import Button from './Button.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 Button: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {}, {}, string>;
18
- type Button = InstanceType<typeof Button>;
19
- export default Button;
@@ -1,30 +0,0 @@
1
- <script module>
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import CanvasBanner from './CanvasBanner.svelte';
4
- import CanvasDecorator from '../stories/CanvasDecorator.svelte';
5
- import Icon from '@iconify/svelte';
6
-
7
- const { Story } = defineMeta({
8
- title: 'Display/CanvasBanner',
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'centered'
12
- }
13
- });
14
- </script>
15
-
16
- <Story name="Default">
17
- <CanvasDecorator>
18
- <CanvasBanner title="Empty Canvas" description="Drag nodes from the sidebar to get started">
19
- {#snippet icon()}
20
- <Icon icon="heroicons:squares-plus" />
21
- {/snippet}
22
- </CanvasBanner>
23
- </CanvasDecorator>
24
- </Story>
25
-
26
- <Story name="No Icon">
27
- <CanvasDecorator>
28
- <CanvasBanner title="No Workflows" description="Create your first workflow to begin" />
29
- </CanvasDecorator>
30
- </Story>
@@ -1,27 +0,0 @@
1
- export default CanvasBanner;
2
- type CanvasBanner = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const CanvasBanner: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- import CanvasBanner from './CanvasBanner.svelte';
15
- 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> {
16
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
- $$bindings?: Bindings;
18
- } & Exports;
19
- (internal: unknown, props: {
20
- $$events?: Events;
21
- $$slots?: Slots;
22
- }): Exports & {
23
- $set?: any;
24
- $on?: any;
25
- };
26
- z_$$bindings?: Bindings;
27
- }