@flowdrop/flowdrop 2.10.1 → 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 (170) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/dist/components/App.svelte +112 -29
  3. package/dist/components/ConfigForm.svelte +5 -5
  4. package/dist/components/ConfigModal.svelte +2 -2
  5. package/dist/components/ConfigModal.svelte.d.ts +1 -1
  6. package/dist/components/ConnectionLine.svelte +1 -1
  7. package/dist/components/LogsSidebar.svelte +15 -12
  8. package/dist/components/MarkdownDisplay.svelte +1 -1
  9. package/dist/components/PipelineStatus.svelte +5 -18
  10. package/dist/components/SchemaForm.svelte +1 -1
  11. package/dist/components/SettingsModal.svelte +1 -1
  12. package/dist/components/SettingsPanel.svelte +1 -1
  13. package/dist/components/WorkflowEditor.svelte +63 -37
  14. package/dist/components/WorkflowInterfaceEditor.svelte +43 -8
  15. package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
  16. package/dist/components/WorkflowInterfaceEntryCard.svelte +117 -44
  17. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
  18. package/dist/components/WorkflowPlaygroundSettings.svelte +551 -0
  19. package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
  20. package/dist/components/chat/AIChatPanel.svelte +1 -1
  21. package/dist/components/form/index.d.ts +2 -2
  22. package/dist/components/form/index.js +2 -2
  23. package/dist/components/nodes/ToolNode.svelte +1 -1
  24. package/dist/components/playground/ControlPanel.svelte +30 -0
  25. package/dist/components/playground/ControlPanel.svelte.d.ts +5 -0
  26. package/dist/components/playground/Playground.svelte +94 -42
  27. package/dist/components/playground/PlaygroundApp.svelte +1 -1
  28. package/dist/components/playground/PlaygroundModal.svelte +1 -1
  29. package/dist/components/playground/PlaygroundStudio.svelte +1 -1
  30. package/dist/core/index.d.ts +1 -1
  31. package/dist/helpers/workflowEditorHelper.d.ts +12 -0
  32. package/dist/helpers/workflowEditorHelper.js +31 -0
  33. package/dist/messages/defaults.d.ts +53 -0
  34. package/dist/messages/defaults.js +48 -2
  35. package/dist/openapi/v1/openapi.yaml +113 -5
  36. package/dist/playground/index.d.ts +3 -1
  37. package/dist/playground/index.js +2 -1
  38. package/dist/playground/mount.d.ts +6 -10
  39. package/dist/playground/mount.js +43 -24
  40. package/dist/schemas/index.js +1 -1
  41. package/dist/schemas/v1/workflow.schema.json +140 -2
  42. package/dist/services/globalSave.js +11 -1
  43. package/dist/services/playgroundService.d.ts +6 -1
  44. package/dist/services/playgroundService.js +5 -0
  45. package/dist/skins/default.d.ts +1 -1
  46. package/dist/skins/drafter.d.ts +1 -1
  47. package/dist/skins/index.d.ts +4 -4
  48. package/dist/skins/index.js +3 -3
  49. package/dist/skins/slate.d.ts +1 -1
  50. package/dist/stores/instanceContainer.svelte.d.ts +15 -0
  51. package/dist/stores/instanceContainer.svelte.js +11 -1
  52. package/dist/stores/playgroundStore.svelte.d.ts +8 -0
  53. package/dist/stores/playgroundStore.svelte.js +18 -4
  54. package/dist/stores/workflowStore.svelte.d.ts +4 -1
  55. package/dist/stores/workflowStore.svelte.js +8 -1
  56. package/dist/styles/base.css +14 -3
  57. package/dist/styles/tokenAliases.d.ts +13 -0
  58. package/dist/styles/tokenAliases.js +89 -0
  59. package/dist/themes/scopedSkinCss.d.ts +30 -0
  60. package/dist/themes/scopedSkinCss.js +95 -0
  61. package/dist/types/index.d.ts +86 -4
  62. package/dist/types/index.js +15 -3
  63. package/dist/types/skin.d.ts +2 -2
  64. package/dist/utils/playgroundChat.d.ts +121 -0
  65. package/dist/utils/playgroundChat.js +275 -0
  66. package/dist/utils/portal.d.ts +8 -0
  67. package/dist/utils/portal.js +15 -0
  68. package/dist/utils/workflowInterface.d.ts +88 -20
  69. package/dist/utils/workflowInterface.js +179 -18
  70. package/dist/webmcp/WebMCPConfirm.svelte +68 -18
  71. package/dist/webmcp/gate.d.ts +6 -0
  72. package/dist/webmcp/gate.js +4 -0
  73. package/dist/webmcp/runtime.js +2 -1
  74. package/package.json +7 -6
  75. package/dist/components/Button.stories.svelte +0 -65
  76. package/dist/components/Button.stories.svelte.d.ts +0 -19
  77. package/dist/components/CanvasBanner.stories.svelte +0 -30
  78. package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
  79. package/dist/components/CanvasContextMenu.stories.svelte +0 -63
  80. package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
  81. package/dist/components/ConfigPanel.stories.svelte +0 -47
  82. package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
  83. package/dist/components/EditorStatusBar.stories.svelte +0 -44
  84. package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
  85. package/dist/components/FlowDropEdge.stories.svelte +0 -197
  86. package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
  87. package/dist/components/LoadingSpinner.stories.svelte +0 -30
  88. package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
  89. package/dist/components/Logo.stories.svelte +0 -22
  90. package/dist/components/Logo.stories.svelte.d.ts +0 -27
  91. package/dist/components/MarkdownDisplay.stories.svelte +0 -38
  92. package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
  93. package/dist/components/Navbar.stories.svelte +0 -58
  94. package/dist/components/Navbar.stories.svelte.d.ts +0 -27
  95. package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
  96. package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
  97. package/dist/components/SchemaForm.stories.svelte +0 -122
  98. package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
  99. package/dist/components/StatusIcon.stories.svelte +0 -60
  100. package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
  101. package/dist/components/StatusLabel.stories.svelte +0 -17
  102. package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
  103. package/dist/components/ThemeToggle.stories.svelte +0 -25
  104. package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
  105. package/dist/components/console/CommandConsole.stories.svelte +0 -111
  106. package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
  107. package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
  108. package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
  109. package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
  110. package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
  111. package/dist/components/form/FormNumberField.stories.svelte +0 -36
  112. package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
  113. package/dist/components/form/FormRangeField.stories.svelte +0 -31
  114. package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
  115. package/dist/components/form/FormSelect.stories.svelte +0 -50
  116. package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
  117. package/dist/components/form/FormTextField.stories.svelte +0 -30
  118. package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
  119. package/dist/components/form/FormTextarea.stories.svelte +0 -34
  120. package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
  121. package/dist/components/form/FormToggle.stories.svelte +0 -30
  122. package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
  123. package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
  124. package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
  125. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
  126. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
  127. package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
  128. package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
  129. package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
  130. package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
  131. package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
  132. package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
  133. package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
  134. package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
  135. package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
  136. package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
  137. package/dist/components/nodes/NotesNode.stories.svelte +0 -76
  138. package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
  139. package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
  140. package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
  141. package/dist/components/nodes/SquareNode.stories.svelte +0 -127
  142. package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
  143. package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
  144. package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
  145. package/dist/components/nodes/ToolNode.stories.svelte +0 -189
  146. package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
  147. package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
  148. package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
  149. package/dist/components/playground/MessageBubble.stories.svelte +0 -151
  150. package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
  151. package/dist/mocks/app-environment.d.ts +0 -8
  152. package/dist/mocks/app-environment.js +0 -16
  153. package/dist/mocks/app-forms.d.ts +0 -6
  154. package/dist/mocks/app-forms.js +0 -29
  155. package/dist/mocks/app-navigation.d.ts +0 -5
  156. package/dist/mocks/app-navigation.js +0 -36
  157. package/dist/mocks/app-stores.d.ts +0 -14
  158. package/dist/mocks/app-stores.js +0 -26
  159. package/dist/stories/CanvasDecorator.svelte +0 -49
  160. package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
  161. package/dist/stories/EdgeDecorator.svelte +0 -125
  162. package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
  163. package/dist/stories/NodeDecorator.svelte +0 -75
  164. package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
  165. package/dist/stories/WebMCPFakeAgent.svelte +0 -229
  166. package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
  167. package/dist/stories/utils.d.ts +0 -93
  168. package/dist/stories/utils.js +0 -156
  169. package/dist/webmcp/WebMCP.stories.svelte +0 -101
  170. package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
@@ -10,6 +10,18 @@
10
10
  /workflow/[id]/playground/[sessionId] route.
11
11
  -->
12
12
 
13
+ <script lang="ts" module>
14
+ /**
15
+ * API base URLs whose server sent a workflow without `playground` (before
16
+ * FlowDrop 2.7.0). Such a server sends none for any workflow, so once one
17
+ * load has said so, a caller that passes the interface needs no further
18
+ * load. Keyed by base URL, not by client: mounting with `endpointConfig`
19
+ * rebuilds the client every time. Lasts for the page; an upgraded server
20
+ * is seen on the next page load.
21
+ */
22
+ const serversWithoutPlaygroundSettings = new Set<string>();
23
+ </script>
24
+
13
25
  <script lang="ts">
14
26
  import { onMount, onDestroy, untrack } from 'svelte';
15
27
  import Icon from '@iconify/svelte';
@@ -23,8 +35,6 @@
23
35
  PlaygroundConfig,
24
36
  PlaygroundSessionStatus
25
37
  } from '../../types/playground.js';
26
- import { playgroundService } from '../../services/playgroundService.js';
27
- import { interruptService } from '../../services/interruptService.js';
28
38
  import { pipelineSignalService } from '../../services/pipelineSignalService.js';
29
39
  import { workflowLaunchService } from '../../services/workflowLaunchService.js';
30
40
  import { provideInstance } from '../../stores/getInstance.svelte.js';
@@ -39,6 +49,7 @@
39
49
  type CommandOutcome
40
50
  } from '../../playground/commands/index.js';
41
51
  import { resolveRunAction } from '../../playground/runAction.js';
52
+ import { isPlaygroundChatHalfSet, isPlaygroundChatSet } from '../../utils/playgroundChat.js';
42
53
  import type { PlaygroundMessageRequest } from '../../types/playground.js';
43
54
 
44
55
  interface Props {
@@ -81,6 +92,20 @@
81
92
  // read below happens in an event handler or after an await.
82
93
  const messages = getMessages();
83
94
 
95
+ /**
96
+ * One line above the composer when the chat binding cannot chat: nothing
97
+ * set up, or a stored binding that no longer binds anything (its inputs
98
+ * were removed) — the form or Run still work — or a message input with no
99
+ * reply, which would take what the person types and never answer.
100
+ */
101
+ const chatNotice = $derived.by(() => {
102
+ const resolved = fd.playground.chatBinding;
103
+ if (resolved === null) return undefined;
104
+ if (!isPlaygroundChatSet(resolved.binding)) return messages().playground.chatNotSetUp;
105
+ if (isPlaygroundChatHalfSet(resolved.binding)) return messages().playground.chatHalfSet;
106
+ return undefined;
107
+ });
108
+
84
109
  let loadedInitialSessionId = $state<string | undefined>(undefined);
85
110
  let autoRunTriggered = $state(false);
86
111
  let isRefreshing = $state(false);
@@ -193,15 +218,15 @@
193
218
  if (workflow) fd.playground.setWorkflow(workflow);
194
219
 
195
220
  const handleVisibility = () => {
196
- if (document.visibilityState === 'visible' && playgroundService.isPolling()) {
221
+ if (document.visibilityState === 'visible' && fd.playgroundService.isPolling()) {
197
222
  const sessionId = fd.playground.currentSession?.id;
198
223
  if (sessionId) {
199
- void playgroundService
224
+ void fd.playgroundService
200
225
  .getMessages(
201
226
  fd.api.config,
202
227
  sessionId,
203
228
  {
204
- since: playgroundService.getLastSequenceNumber() ?? undefined
229
+ since: fd.playgroundService.getLastSequenceNumber() ?? undefined
205
230
  },
206
231
  fd.api.authProvider
207
232
  )
@@ -237,20 +262,45 @@
237
262
  });
238
263
 
239
264
  /**
240
- * Make sure the playground knows the workflow's interface.
265
+ * Make sure the playground knows the workflow's interface and chat binding.
241
266
  *
242
- * The mode (chat box, form, Run) is read from the interface's turn ports.
243
- * A workflow passed in with an `interface` key is used as is; when it is
244
- * missing or has no `interface` key, the workflow is loaded through the
245
- * workflows API (`workflows.get`). Any failure leaves the playground in
246
- * `legacy` mode, which is the behaviour it had before turn ports.
267
+ * The mode (chat box, form, Run) is read from the workflow's Playground
268
+ * settings, else from its interface's deprecated turn ports. A workflow
269
+ * passed in with both an `interface` and a `playground` key is used as is;
270
+ * when either is missing, the workflow is loaded through the workflows API
271
+ * (`workflows.get`) and only the missing keys are taken from there: a key
272
+ * the caller passed is its live copy (the editor's, unsaved edits and all)
273
+ * and never gives way to the saved one. Any failure
274
+ * leaves the playground in `legacy` mode, which is the behaviour it had
275
+ * before turn ports.
247
276
  */
248
277
  async function ensureWorkflowInterface(): Promise<void> {
249
- if (workflow?.interface !== undefined || !fd.api.config) return;
278
+ if (!fd.api.config) return;
279
+ const server = fd.api.config.baseUrl;
280
+ if (
281
+ workflow?.interface !== undefined &&
282
+ (workflow.playground !== undefined || serversWithoutPlaygroundSettings.has(server))
283
+ ) {
284
+ return;
285
+ }
250
286
  try {
251
287
  const loaded = await fd.api.client.loadWorkflow(workflowId);
252
- if (loaded.interface === undefined) return;
253
- fd.playground.setWorkflow(workflow ? { ...workflow, interface: loaded.interface } : loaded);
288
+ if (loaded.playground === undefined) serversWithoutPlaygroundSettings.add(server);
289
+ if (!workflow) {
290
+ if (loaded.interface !== undefined || loaded.playground !== undefined) {
291
+ fd.playground.setWorkflow(loaded);
292
+ }
293
+ return;
294
+ }
295
+ const missingInterface = workflow.interface === undefined && loaded.interface !== undefined;
296
+ const missingPlayground =
297
+ workflow.playground === undefined && loaded.playground !== undefined;
298
+ if (!missingInterface && !missingPlayground) return;
299
+ fd.playground.setWorkflow({
300
+ ...workflow,
301
+ ...(missingInterface && { interface: loaded.interface }),
302
+ ...(missingPlayground && { playground: loaded.playground })
303
+ });
254
304
  } catch (err) {
255
305
  logger.debug('[Playground] Workflow interface unavailable, keeping legacy input:', err);
256
306
  }
@@ -296,8 +346,9 @@
296
346
  }
297
347
 
298
348
  onDestroy(() => {
299
- playgroundService.stopPolling();
300
- interruptService.stopPolling();
349
+ // Only this instance's poller. interruptService polling is page-wide and
350
+ // never started by the library; a host that starts it stops it.
351
+ fd.playgroundService.stopPolling();
301
352
  fd.playground.reset();
302
353
  fd.interrupts.reset();
303
354
  });
@@ -307,7 +358,7 @@
307
358
  fd.playground.setError(null);
308
359
 
309
360
  try {
310
- const sessionList = await playgroundService.listSessions(
361
+ const sessionList = await fd.playgroundService.listSessions(
311
362
  fd.api.config,
312
363
  workflowId,
313
364
  undefined,
@@ -329,7 +380,7 @@
329
380
  const token = ++loadToken;
330
381
 
331
382
  try {
332
- const session = await playgroundService.getSession(
383
+ const session = await fd.playgroundService.getSession(
333
384
  fd.api.config,
334
385
  sessionId,
335
386
  fd.api.authProvider
@@ -341,7 +392,7 @@
341
392
  // user scrolls up (loadOlderMessages). Clear right before applying the
342
393
  // fresh page — not before the await — so switching sessions doesn't blank
343
394
  // the view for the duration of the fetch.
344
- const response = await playgroundService.getMessages(
395
+ const response = await fd.playgroundService.getMessages(
345
396
  fd.api.config,
346
397
  sessionId,
347
398
  {
@@ -382,7 +433,7 @@
382
433
  if (!sessionId || before === null) return;
383
434
 
384
435
  try {
385
- const response = await playgroundService.getMessages(
436
+ const response = await fd.playgroundService.getMessages(
386
437
  fd.api.config,
387
438
  sessionId,
388
439
  {
@@ -419,7 +470,7 @@
419
470
 
420
471
  try {
421
472
  const sessionName = `Session ${fd.playground.sessions.length + 1}`;
422
- const session = await playgroundService.createSession(
473
+ const session = await fd.playgroundService.createSession(
423
474
  fd.api.config,
424
475
  workflowId,
425
476
  sessionName,
@@ -430,7 +481,7 @@
430
481
  // Stop polling the previous (possibly running) session before switching,
431
482
  // mirroring handleSelectSession. Otherwise its next poll keeps the old
432
483
  // 'running' status alive and the new session's chat input stays disabled.
433
- playgroundService.stopPolling();
484
+ fd.playgroundService.stopPolling();
434
485
 
435
486
  if (onSessionNavigate) {
436
487
  onSessionNavigate(session.id);
@@ -454,18 +505,18 @@
454
505
  const currentSessionId = fd.playground.currentSession?.id;
455
506
  if (currentSessionId === sessionId) return;
456
507
 
457
- playgroundService.stopPolling();
508
+ fd.playgroundService.stopPolling();
458
509
  fd.playground.updateSessionStatus('idle');
459
510
  await loadSession(sessionId);
460
511
  }
461
512
 
462
513
  async function handleDeleteSession(sessionId: string): Promise<void> {
463
514
  try {
464
- await playgroundService.deleteSession(fd.api.config, sessionId, fd.api.authProvider);
515
+ await fd.playgroundService.deleteSession(fd.api.config, sessionId, fd.api.authProvider);
465
516
  fd.playground.removeSession(sessionId);
466
517
 
467
518
  if (fd.playground.currentSession?.id === sessionId) {
468
- playgroundService.stopPolling();
519
+ fd.playgroundService.stopPolling();
469
520
  }
470
521
  } catch (err) {
471
522
  const errorMessage = err instanceof Error ? err.message : 'Failed to delete session';
@@ -486,12 +537,12 @@
486
537
  if (!sessionId) return;
487
538
 
488
539
  try {
489
- await playgroundService.resetSession(fd.api.config, sessionId, fd.api.authProvider);
490
- playgroundService.stopPolling();
540
+ await fd.playgroundService.resetSession(fd.api.config, sessionId, fd.api.authProvider);
541
+ fd.playgroundService.stopPolling();
491
542
  fd.playground.updateSessionStatus('idle');
492
543
  fd.playground.setError(null);
493
544
  } catch (err) {
494
- playgroundService.stopPolling();
545
+ fd.playgroundService.stopPolling();
495
546
  fd.playground.updateSessionStatus('idle');
496
547
  logger.error('Failed to reset session:', err);
497
548
  throw err;
@@ -524,7 +575,7 @@
524
575
  fd.playground.updateSessionStatus('running');
525
576
  fd.playground.pinExecution(null);
526
577
  fd.playground.setError(null);
527
- if (!playgroundService.isPolling()) {
578
+ if (!fd.playgroundService.isPolling()) {
528
579
  startPolling(sessionId, true);
529
580
  }
530
581
  }
@@ -719,7 +770,7 @@
719
770
  fd.playground.setError(null);
720
771
 
721
772
  try {
722
- const response = await playgroundService.sendTurn(
773
+ const response = await fd.playgroundService.sendTurn(
723
774
  fd.api.config,
724
775
  sessionId,
725
776
  body,
@@ -737,7 +788,7 @@
737
788
  // mid-session and re-fetching messages that are already in the store.
738
789
  // Seed from the newest loaded message so polling tails live updates
739
790
  // rather than crawling forward from the start of the conversation.
740
- if (!playgroundService.isPolling()) {
791
+ if (!fd.playgroundService.isPolling()) {
741
792
  startPolling(sessionId, true);
742
793
  }
743
794
  return true;
@@ -759,13 +810,13 @@
759
810
  if (!sessionId) return;
760
811
 
761
812
  try {
762
- await playgroundService.stopExecution(fd.api.config, sessionId, fd.api.authProvider);
763
- playgroundService.stopPolling();
813
+ await fd.playgroundService.stopExecution(fd.api.config, sessionId, fd.api.authProvider);
814
+ fd.playgroundService.stopPolling();
764
815
  fd.playground.updateSessionStatus('idle');
765
816
  } catch (err) {
766
817
  const errorMessage = err instanceof Error ? err.message : 'Failed to stop execution';
767
818
  fd.playground.setError(errorMessage);
768
- playgroundService.stopPolling();
819
+ fd.playgroundService.stopPolling();
769
820
  fd.playground.updateSessionStatus('idle');
770
821
  logger.error('Failed to stop execution:', err);
771
822
  }
@@ -779,7 +830,7 @@
779
830
  const pollingInterval = config.pollingInterval ?? 1500;
780
831
  const initialSequenceNumber = seedSequence ? fd.playground.latestSequenceNumber : null;
781
832
 
782
- playgroundService.startPolling(
833
+ fd.playgroundService.startPolling(
783
834
  fd.api.config,
784
835
  sessionId,
785
836
  (response) => fd.playground.applyServerResponse(response, sessionId),
@@ -795,16 +846,16 @@
795
846
  if (!sessionId || isRefreshing) return;
796
847
  isRefreshing = true;
797
848
  try {
798
- const response = await playgroundService.getMessages(
849
+ const response = await fd.playgroundService.getMessages(
799
850
  fd.api.config,
800
851
  sessionId,
801
852
  {
802
- since: playgroundService.getLastSequenceNumber() ?? undefined
853
+ since: fd.playgroundService.getLastSequenceNumber() ?? undefined
803
854
  },
804
855
  fd.api.authProvider
805
856
  );
806
857
  fd.playground.applyServerResponse(response, sessionId);
807
- if (response.sessionStatus === 'running' && !playgroundService.isPolling()) {
858
+ if (response.sessionStatus === 'running' && !fd.playgroundService.isPolling()) {
808
859
  startPolling(sessionId, true);
809
860
  }
810
861
  } catch (err) {
@@ -821,11 +872,11 @@
821
872
  try {
822
873
  // Catch up immediately rather than waiting for the next poll interval.
823
874
  // Use the service's sequence cursor so we only fetch new messages.
824
- const response = await playgroundService.getMessages(
875
+ const response = await fd.playgroundService.getMessages(
825
876
  fd.api.config,
826
877
  sessionId,
827
878
  {
828
- since: playgroundService.getLastSequenceNumber() ?? undefined
879
+ since: fd.playgroundService.getLastSequenceNumber() ?? undefined
829
880
  },
830
881
  fd.api.authProvider
831
882
  );
@@ -836,14 +887,14 @@
836
887
 
837
888
  // Polling continues through awaiting_input now, but restart defensively
838
889
  // in case it stopped for any reason (e.g. component re-mount).
839
- if (!playgroundService.isPolling()) {
890
+ if (!fd.playgroundService.isPolling()) {
840
891
  startPolling(sessionId, true);
841
892
  }
842
893
  }
843
894
  </script>
844
895
 
845
896
  <div
846
- class="playground"
897
+ class="flowdrop-scope playground"
847
898
  class:playground--embedded={mode === 'embedded'}
848
899
  class:playground--standalone={mode === 'standalone'}
849
900
  class:playground--modal={mode === 'modal'}
@@ -924,6 +975,7 @@
924
975
  ? undefined
925
976
  : config.predefinedMessage}
926
977
  formEntries={fd.playground.interfaceFormEntries}
978
+ notice={chatNotice}
927
979
  formValues={fd.playground.formValues}
928
980
  onFormChange={(values) => fd.playground.setFormValues(values)}
929
981
  showSessionHeader={config.showSessionHeader ?? true}
@@ -71,7 +71,7 @@
71
71
  const displayTitle = $derived(navbarTitle ?? workflow?.name ?? 'Playground');
72
72
  </script>
73
73
 
74
- <div class="fd-playground-app">
74
+ <div class="flowdrop-scope fd-playground-app">
75
75
  {#if showNavbar}
76
76
  <Navbar
77
77
  title={displayTitle}
@@ -79,7 +79,7 @@
79
79
  {#if isOpen}
80
80
  <!-- Modal Backdrop -->
81
81
  <div
82
- class="playground-modal-backdrop"
82
+ class="flowdrop-scope playground-modal-backdrop"
83
83
  onclick={handleBackdropClick}
84
84
  onkeydown={handleKeydown}
85
85
  role="dialog"
@@ -163,7 +163,7 @@
163
163
  </script>
164
164
 
165
165
  <div
166
- class="playground-studio"
166
+ class="flowdrop-scope playground-studio"
167
167
  class:playground-studio--resizing={isResizing}
168
168
  style="--playground-studio-min-chat-width: {minChatWidth}px"
169
169
  >
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export type { WorkflowFormat, BuiltinWorkflowFormat } from '../types/index.js';
18
18
  export { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
19
- export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, PortsConfig, PortConfigEntry, PortBinding, WorkflowInterface, WorkflowInterfaceEntry, WorkflowInterfaceTurn, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
19
+ export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, PortsConfig, PortConfigEntry, PortBinding, WorkflowInterface, WorkflowInterfaceEntry, WorkflowInterfaceTurn, WorkflowPlayground, PlaygroundChatBinding, PlaygroundReplyPort, PlaygroundChatSource, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
20
20
  export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from '../types/index.js';
21
21
  export { WORKFLOW_INTERFACE_INPUT_TURNS, WORKFLOW_INTERFACE_OUTPUT_TURNS, DEFAULT_HISTORY_TURN_LIMIT } from '../types/index.js';
22
22
  export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig } from '../types/config.js';
@@ -41,6 +41,18 @@ export declare class NodeOperationsHelper {
41
41
  * Load node execution information for all nodes in the workflow
42
42
  */
43
43
  static loadNodeExecutionInfo(api: ApiContext, workflow: Workflow | null, pipelineId?: string): Promise<Record<string, NodeExecutionInfo>>;
44
+ /**
45
+ * Paint a run's per-node execution info onto canvas nodes.
46
+ *
47
+ * With a map, every node gets its entry (or the idle default, so a node the
48
+ * run never reached does not keep an older status). With `null`, any
49
+ * executionInfo is removed. Pure: returns new node objects only where
50
+ * something changes, and the same array when nothing does.
51
+ */
52
+ static applyExecutionInfo<T extends {
53
+ id: string;
54
+ data: Record<string, unknown>;
55
+ }>(nodes: T[], info: Record<string, NodeExecutionInfo> | null): T[];
44
56
  /**
45
57
  * Create a new node from dropped data
46
58
  */
@@ -104,6 +104,37 @@ export class NodeOperationsHelper {
104
104
  return {};
105
105
  }
106
106
  }
107
+ /**
108
+ * Paint a run's per-node execution info onto canvas nodes.
109
+ *
110
+ * With a map, every node gets its entry (or the idle default, so a node the
111
+ * run never reached does not keep an older status). With `null`, any
112
+ * executionInfo is removed. Pure: returns new node objects only where
113
+ * something changes, and the same array when nothing does.
114
+ */
115
+ static applyExecutionInfo(nodes, info) {
116
+ if (info === null) {
117
+ if (!nodes.some((node) => 'executionInfo' in node.data))
118
+ return nodes;
119
+ return nodes.map((node) => {
120
+ if (!('executionInfo' in node.data))
121
+ return node;
122
+ const { executionInfo: _dropped, ...data } = node.data;
123
+ return { ...node, data };
124
+ });
125
+ }
126
+ return nodes.map((node) => ({
127
+ ...node,
128
+ data: {
129
+ ...node.data,
130
+ executionInfo: info[node.id] ?? {
131
+ status: 'idle',
132
+ executionCount: 0,
133
+ isExecuting: false
134
+ }
135
+ }
136
+ }));
137
+ }
107
138
  /**
108
139
  * Create a new node from dropped data
109
140
  */
@@ -222,6 +222,7 @@ export declare const defaultMessages: {
222
222
  readonly workflowSettingsPanelTitle: "Workflow Settings";
223
223
  readonly workflowSettingsPanelSubtitle: "Settings";
224
224
  readonly workflowSettingsInterfaceTab: "Interface";
225
+ readonly workflowSettingsPlaygroundTab: "Playground";
225
226
  readonly nodeConfigDescription: "Node configuration";
226
227
  readonly closeSettings: "Close settings";
227
228
  readonly closeConfigModal: "Close configuration modal";
@@ -333,6 +334,8 @@ export declare const defaultMessages: {
333
334
  readonly placeholder: "Type your message...";
334
335
  readonly predefinedRun: "Run workflow";
335
336
  };
337
+ readonly chatNotSetUp: "No chat yet. Pick the input the message goes to in Playground settings.";
338
+ readonly chatHalfSet: "Nothing will reply here. Pick the results that print as replies in Playground settings.";
336
339
  readonly inputForm: {
337
340
  readonly title: "Workflow inputs";
338
341
  readonly missingRequired: ({ names }: {
@@ -642,6 +645,11 @@ export declare const defaultMessages: {
642
645
  id: string;
643
646
  }) => string;
644
647
  readonly metaDisclosure: "Server metadata (read-only)";
648
+ readonly turnDeprecated: ({ turn, limit }: {
649
+ turn: string;
650
+ limit?: number;
651
+ }) => string;
652
+ readonly turnOpenPlayground: "Open Playground settings";
645
653
  readonly turnLabel: "Chat turn";
646
654
  readonly turnNone: "None";
647
655
  readonly turns: {
@@ -696,6 +704,51 @@ export declare const defaultMessages: {
696
704
  readonly composerBack: "Back";
697
705
  readonly composerCancel: "Cancel";
698
706
  };
707
+ readonly playgroundSettings: {
708
+ readonly notSetUpTitle: "Not set up";
709
+ readonly notSetUp: "No chat until someone sets it up. The Playground shows a form built from the interface inputs. To chat with this workflow, pick the input the message goes to and the results that print as replies.";
710
+ readonly turnSource: "This workflow chats through \"Chat turn\" marks on its interface, which are deprecated. The fields below show what they set up. Move them here to keep the chat as it is; changing any field moves them too.";
711
+ readonly moveTurns: "Move them here";
712
+ readonly leftoverTurns: "The interface still carries deprecated \"Chat turn\" marks. They are ignored while these settings are set.";
713
+ readonly removeTurns: "Remove them";
714
+ readonly noInputs: "The workflow interface has no inputs yet. Add one on the Interface tab first.";
715
+ readonly messageLabel: "Message goes to";
716
+ readonly messageNone: "Nothing (form only)";
717
+ readonly messageHint: "The input that receives what the person types in the chat.";
718
+ readonly historyLabel: "History goes to";
719
+ readonly historyLimitLabel: "Messages";
720
+ readonly inputNone: "Nothing";
721
+ readonly inputMissing: ({ id }: {
722
+ id: string;
723
+ }) => string;
724
+ readonly idsDisclosure: "Session and message IDs";
725
+ readonly sessionIdLabel: "Session ID goes to";
726
+ readonly messageIdLabel: "Message ID goes to";
727
+ readonly repliesLabel: "Print as replies";
728
+ readonly repliesNone: "No node has an exposed output port yet.";
729
+ readonly subWorkflowReplies: "Also print what sub-workflows reply";
730
+ readonly halfSet: "Nothing will print. The run completes and the chat stays silent. Pick at least one reply.";
731
+ readonly savedWith: "Set for this workflow and saved with it when you press Save.";
732
+ readonly historyLimitInvalid: "A whole number, 1 or more.";
733
+ /** Problems with the binding, by issue code (`playgroundChatIssues`). */
734
+ readonly issues: {
735
+ readonly inputMissing: ({ field, id }: {
736
+ field: string;
737
+ id: string;
738
+ }) => string;
739
+ readonly inputDuplicate: ({ field, id, other }: {
740
+ field: string;
741
+ id: string;
742
+ other: string;
743
+ }) => string;
744
+ readonly replyNodeMissing: ({ reply }: {
745
+ reply: string;
746
+ }) => string;
747
+ readonly replyPortMissing: ({ reply }: {
748
+ reply: string;
749
+ }) => string;
750
+ };
751
+ };
699
752
  readonly webmcp: {
700
753
  readonly confirmTitle: ({ name }: {
701
754
  name: string;
@@ -201,6 +201,7 @@ export const defaultMessages = {
201
201
  workflowSettingsPanelTitle: 'Workflow Settings',
202
202
  workflowSettingsPanelSubtitle: 'Settings',
203
203
  workflowSettingsInterfaceTab: 'Interface',
204
+ workflowSettingsPlaygroundTab: 'Playground',
204
205
  nodeConfigDescription: 'Node configuration',
205
206
  closeSettings: 'Close settings',
206
207
  closeConfigModal: 'Close configuration modal',
@@ -291,6 +292,12 @@ export const defaultMessages = {
291
292
  placeholder: 'Type your message...',
292
293
  predefinedRun: 'Run workflow'
293
294
  },
295
+ // Shown when the workflow's Playground settings bind no chat (and no
296
+ // deprecated interface `turn` does): the form or Run still work.
297
+ chatNotSetUp: 'No chat yet. Pick the input the message goes to in Playground settings.',
298
+ // Shown when a message input is bound but no reply is: the run completes
299
+ // and nothing prints.
300
+ chatHalfSet: 'Nothing will reply here. Pick the results that print as replies in Playground settings.',
294
301
  // The form a workflow's interface inputs render as (inputs without a chat
295
302
  // turn; the session fills the others).
296
303
  inputForm: {
@@ -531,7 +538,13 @@ export const defaultMessages = {
531
538
  moveUp: ({ id }) => `Move "${id}" up`,
532
539
  moveDown: ({ id }) => `Move "${id}" down`,
533
540
  metaDisclosure: 'Server metadata (read-only)',
534
- // The Chat turn selector: what a port is for in a chat turn (`turn`).
541
+ // A port's chat `turn`: deprecated since 2.11.0. With Playground settings
542
+ // (a server from FlowDrop 2.7.0 on) it is read-only and the chat is set up
543
+ // in the Playground settings tab. Without them, the Chat turn selector
544
+ // (`turnLabel`, `turnNone`, `turnDescriptions`, `turnUnknown`,
545
+ // `historyLimitLabel`, `historyLimitPlaceholder`) is still offered, until 3.0.
546
+ turnDeprecated: ({ turn, limit }) => `Chat turn "${turn}"${limit !== undefined ? ` (${limit} messages)` : ''} is deprecated: the chat is set up in the Playground settings now.`,
547
+ turnOpenPlayground: 'Open Playground settings',
535
548
  turnLabel: 'Chat turn',
536
549
  turnNone: 'None',
537
550
  turns: {
@@ -549,7 +562,7 @@ export const defaultMessages = {
549
562
  reply: "Text the session saves as the assistant's answer"
550
563
  },
551
564
  turnUnknown: ({ value }) => `${value} (not known to this editor)`,
552
- turnTakenInline: ({ id }) => `Input "${id}" already has this chat turn. A workflow takes one input per turn value.`,
565
+ turnTakenInline: ({ id }) => `Input "${id}" already has this chat turn, so this one does not count.`,
553
566
  historyLimitLabel: 'Messages to include',
554
567
  historyLimitPlaceholder: ({ limit }) => `${limit} (default)`,
555
568
  // The inline composer that opens from "Add input" / "Add output".
@@ -576,6 +589,39 @@ export const defaultMessages = {
576
589
  composerBack: 'Back',
577
590
  composerCancel: 'Cancel'
578
591
  },
592
+ // The workflow's Playground settings tab: its chat binding (`workflow.playground`).
593
+ playgroundSettings: {
594
+ notSetUpTitle: 'Not set up',
595
+ notSetUp: 'No chat until someone sets it up. The Playground shows a form built from the interface inputs. To chat with this workflow, pick the input the message goes to and the results that print as replies.',
596
+ turnSource: 'This workflow chats through "Chat turn" marks on its interface, which are deprecated. The fields below show what they set up. Move them here to keep the chat as it is; changing any field moves them too.',
597
+ moveTurns: 'Move them here',
598
+ leftoverTurns: 'The interface still carries deprecated "Chat turn" marks. They are ignored while these settings are set.',
599
+ removeTurns: 'Remove them',
600
+ noInputs: 'The workflow interface has no inputs yet. Add one on the Interface tab first.',
601
+ messageLabel: 'Message goes to',
602
+ messageNone: 'Nothing (form only)',
603
+ messageHint: 'The input that receives what the person types in the chat.',
604
+ historyLabel: 'History goes to',
605
+ historyLimitLabel: 'Messages',
606
+ inputNone: 'Nothing',
607
+ inputMissing: ({ id }) => `${id} (not on the interface)`,
608
+ idsDisclosure: 'Session and message IDs',
609
+ sessionIdLabel: 'Session ID goes to',
610
+ messageIdLabel: 'Message ID goes to',
611
+ repliesLabel: 'Print as replies',
612
+ repliesNone: 'No node has an exposed output port yet.',
613
+ subWorkflowReplies: 'Also print what sub-workflows reply',
614
+ halfSet: 'Nothing will print. The run completes and the chat stays silent. Pick at least one reply.',
615
+ savedWith: 'Set for this workflow and saved with it when you press Save.',
616
+ historyLimitInvalid: 'A whole number, 1 or more.',
617
+ /** Problems with the binding, by issue code (`playgroundChatIssues`). */
618
+ issues: {
619
+ inputMissing: ({ field, id }) => `${field}: the input "${id}" is not on the workflow interface.`,
620
+ inputDuplicate: ({ field, id, other }) => `${field}: the input "${id}" is already picked under "${other}".`,
621
+ replyNodeMissing: ({ reply }) => `The reply "${reply}" is on a node that is no longer in the workflow.`,
622
+ replyPortMissing: ({ reply }) => `The reply "${reply}" is on an output the node no longer has.`
623
+ }
624
+ },
579
625
  // The confirm dialog the WebMCP adapter shows before a browser agent's change runs.
580
626
  webmcp: {
581
627
  confirmTitle: ({ name }) => `A browser agent wants to change “${name}”`,