@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
@@ -0,0 +1,551 @@
1
+ <!--
2
+ WorkflowPlaygroundSettings
3
+
4
+ The workflow's Playground settings: its chat binding (`workflow.playground`,
5
+ see `utils/playgroundChat.ts`). Which interface input the person's message
6
+ goes to, which one gets recent messages (and how many), which inputs get
7
+ the session and message ids, which node output ports print as replies, and
8
+ whether sub-workflows print their own replies.
9
+
10
+ Stateless, like `WorkflowInterfaceEditor`: reads `workflow` and reports the
11
+ next `playground` value via `onChange`. The caller routes it through the
12
+ workflow store (`fd.workflow.batchUpdate({ playground })`), so an edit marks
13
+ the workflow dirty and is saved with it — one Save, versioned with the
14
+ workflow. Nothing set = no chat: the Playground shows a form or Run instead.
15
+
16
+ A workflow without settings that still marks its interface with the
17
+ deprecated `turn` keeps chatting through those marks. The controls then
18
+ show what the marks set up, and `onMoveTurns` moves them here: on the
19
+ button, and on the first edit, so an edit never starts from an empty
20
+ binding (which would switch the chat off) and clearing every field really
21
+ means no chat (the marks are gone, nothing falls back to them).
22
+ -->
23
+
24
+ <script lang="ts">
25
+ import Icon from '@iconify/svelte';
26
+ import Button from './Button.svelte';
27
+ import Input from './Input.svelte';
28
+ import Select from './Select.svelte';
29
+ import { m } from '../messages/index.js';
30
+ import type {
31
+ PlaygroundChatBinding,
32
+ PlaygroundReplyPort,
33
+ Workflow,
34
+ WorkflowPlayground
35
+ } from '../types/index.js';
36
+ import { DEFAULT_HISTORY_TURN_LIMIT } from '../types/index.js';
37
+ import {
38
+ emptyPlaygroundChat,
39
+ hasKnownInterfaceTurns,
40
+ interfaceTurnChat,
41
+ isPlaygroundChatSet,
42
+ normalizePlaygroundChat,
43
+ withPlaygroundChat
44
+ } from '../utils/playgroundChat.js';
45
+ import {
46
+ findReplyPort,
47
+ listBindablePorts,
48
+ playgroundChatIssues,
49
+ type PlaygroundChatInputKey,
50
+ type PlaygroundChatIssue
51
+ } from '../utils/workflowInterface.js';
52
+
53
+ interface Props {
54
+ workflow: Workflow;
55
+ /** The next `playground` value, after an edit. */
56
+ onChange: (next: WorkflowPlayground) => void;
57
+ /**
58
+ * Move the deprecated interface `turn` marks into these settings: called
59
+ * with the binding to store (the one they declare, or it with the first
60
+ * edit applied). The caller stores it and clears `turn` from the
61
+ * interface in one update. Also called for every edit while marks are
62
+ * left on the interface beside stored settings, so clearing the binding
63
+ * never falls back to them. Omit to hide the action; edits then go to
64
+ * `onChange` and the marks stay, so clearing every field falls back to
65
+ * them.
66
+ */
67
+ onMoveTurns?: (chat: PlaygroundChatBinding) => void;
68
+ }
69
+
70
+ let { workflow, onChange, onMoveTurns }: Props = $props();
71
+
72
+ /** The stored binding, every key present; `null` = not set up. */
73
+ const stored = $derived(
74
+ workflow.playground?.chat ? normalizePlaygroundChat(workflow.playground.chat) : null
75
+ );
76
+ /** The binding the deprecated interface `turn` marks declare, when nothing is stored. */
77
+ const turnChat = $derived(stored === null ? interfaceTurnChat(workflow.interface) : null);
78
+ /** What the controls show: the binding in effect (stored, else the marks), or an empty one. */
79
+ const chat = $derived(stored ?? turnChat ?? emptyPlaygroundChat());
80
+
81
+ const inputs = $derived(workflow.interface?.inputs ?? []);
82
+ const issues = $derived(playgroundChatIssues(workflow, stored ?? turnChat));
83
+ const errors = $derived(issues.filter((issue) => issue.severity === 'error'));
84
+ const halfSet = $derived(issues.some((issue) => issue.code === 'playground-half-set'));
85
+
86
+ /**
87
+ * Output ports a reply can print from (the exposed ones), plus every stored
88
+ * reply not among them: one on a port that is not exposed on the canvas
89
+ * reads like any other (the server accepts it), one on a node or port that
90
+ * is gone is marked missing.
91
+ */
92
+ const replyOptions = $derived.by(() => {
93
+ const options = listBindablePorts(workflow, 'output').map((candidate) => ({
94
+ reply: { node_id: candidate.nodeId, port: candidate.port.id },
95
+ label: `${candidate.nodeLabel} · ${candidate.port.name ?? candidate.port.id}`,
96
+ missing: false
97
+ }));
98
+ for (const reply of chat.replies) {
99
+ if (!options.some((option) => sameReply(option.reply, reply))) {
100
+ const found = findReplyPort(workflow, reply);
101
+ options.push(
102
+ found
103
+ ? {
104
+ reply,
105
+ label: `${found.nodeLabel} · ${found.port.name ?? found.port.id}`,
106
+ missing: false
107
+ }
108
+ : { reply, label: `${reply.node_id} · ${reply.port}`, missing: true }
109
+ );
110
+ }
111
+ }
112
+ return options;
113
+ });
114
+
115
+ /** Deprecated `turn` marks left on the interface once settings are stored (ignored). */
116
+ const leftoverTurns = $derived(stored !== null && hasKnownInterfaceTurns(workflow.interface));
117
+
118
+ /** Whether either id input is bound: the disclosure is then open. */
119
+ const idsBound = $derived(chat.session_id !== null || chat.message_id !== null);
120
+ /** Whether the person opened the disclosure themselves. */
121
+ let idsOpened = $state(false);
122
+
123
+ /** The label of the field a binding key fills. */
124
+ const keyLabels = $derived<Record<PlaygroundChatInputKey, string>>({
125
+ message: m().playgroundSettings.messageLabel,
126
+ history: m().playgroundSettings.historyLabel,
127
+ session_id: m().playgroundSettings.sessionIdLabel,
128
+ message_id: m().playgroundSettings.messageIdLabel
129
+ });
130
+
131
+ const idFields = $derived([
132
+ { key: 'session_id' as const, label: keyLabels.session_id },
133
+ { key: 'message_id' as const, label: keyLabels.message_id }
134
+ ]);
135
+
136
+ /** Whether the limit field holds something that is not a valid limit. */
137
+ let historyLimitInvalid = $state(false);
138
+
139
+ function sameReply(a: PlaygroundReplyPort, b: PlaygroundReplyPort): boolean {
140
+ return a.node_id === b.node_id && a.port === b.port;
141
+ }
142
+
143
+ function update(patch: Partial<PlaygroundChatBinding>): void {
144
+ const next = { ...chat, ...patch };
145
+ // Any edit while known marks are on the interface removes them: else an
146
+ // edit that clears the binding would let the chat fall back to them.
147
+ if (onMoveTurns && (turnChat !== null || leftoverTurns)) onMoveTurns(next);
148
+ else onChange(withPlaygroundChat(workflow.playground, next));
149
+ }
150
+
151
+ function setInput(key: Exclude<PlaygroundChatInputKey, 'history'>, value: string): void {
152
+ update({ [key]: value === '' ? null : value });
153
+ }
154
+
155
+ function setHistoryInput(value: string): void {
156
+ historyLimitInvalid = false;
157
+ update({
158
+ history:
159
+ value === ''
160
+ ? null
161
+ : { input: value, limit: chat.history?.limit ?? DEFAULT_HISTORY_TURN_LIMIT }
162
+ });
163
+ }
164
+
165
+ function setHistoryLimit(field: HTMLInputElement): void {
166
+ if (chat.history === null) return;
167
+ const parsed = Number(field.value);
168
+ if (field.value.trim() === '' || !Number.isInteger(parsed) || parsed < 1) {
169
+ // Keep what the person typed and say why it is not taken: the stored
170
+ // limit stays, so falling back here would leave the field showing a
171
+ // value nobody saved.
172
+ historyLimitInvalid = true;
173
+ return;
174
+ }
175
+ historyLimitInvalid = false;
176
+ update({ history: { ...chat.history, limit: parsed } });
177
+ }
178
+
179
+ function toggleReply(reply: PlaygroundReplyPort, on: boolean): void {
180
+ const others = chat.replies.filter((other) => !sameReply(other, reply));
181
+ update({ replies: on ? [...others, reply] : others });
182
+ }
183
+
184
+ /** An issue in the person's language (`issue.message` is English, for logs). */
185
+ function issueText(issue: PlaygroundChatIssue): string {
186
+ const texts = m().playgroundSettings.issues;
187
+ const reply = issue.reply ? replyLabel(issue.reply) : '';
188
+ switch (issue.code) {
189
+ case 'playground-input-missing':
190
+ return issue.key && issue.input
191
+ ? texts.inputMissing({ field: keyLabels[issue.key], id: issue.input })
192
+ : issue.message;
193
+ case 'playground-input-duplicate':
194
+ return issue.key && issue.input && issue.otherKey
195
+ ? texts.inputDuplicate({
196
+ field: keyLabels[issue.key],
197
+ id: issue.input,
198
+ other: keyLabels[issue.otherKey]
199
+ })
200
+ : issue.message;
201
+ case 'playground-reply-node-missing':
202
+ return texts.replyNodeMissing({ reply });
203
+ case 'playground-reply-port-missing':
204
+ return texts.replyPortMissing({ reply });
205
+ case 'playground-half-set':
206
+ return m().playgroundSettings.halfSet;
207
+ default:
208
+ return issue.message;
209
+ }
210
+ }
211
+
212
+ /** A reply as the reply list labels it, or `node · port` when it is not listed. */
213
+ function replyLabel(reply: PlaygroundReplyPort): string {
214
+ return (
215
+ replyOptions.find((option) => sameReply(option.reply, reply))?.label ??
216
+ `${reply.node_id} · ${reply.port}`
217
+ );
218
+ }
219
+
220
+ /** An input key's error, for the field's invalid state. */
221
+ function inputError(key: PlaygroundChatInputKey): string | undefined {
222
+ const issue = errors.find((candidate) => candidate.key === key);
223
+ return issue && issueText(issue);
224
+ }
225
+
226
+ function replyError(reply: PlaygroundReplyPort): string | undefined {
227
+ const issue = errors.find((candidate) => candidate.reply && sameReply(candidate.reply, reply));
228
+ return issue && issueText(issue);
229
+ }
230
+
231
+ /**
232
+ * The options for an input select: every interface input, plus the stored
233
+ * value when the interface no longer has it, so the select never rewrites
234
+ * a stored name it cannot list.
235
+ */
236
+ function inputOptions(current: string | null): Array<{ id: string; label: string }> {
237
+ const options = inputs.map((entry) => ({
238
+ id: entry.id,
239
+ label: entry.name && entry.name !== entry.id ? `${entry.name} (${entry.id})` : entry.id
240
+ }));
241
+ if (current !== null && !options.some((option) => option.id === current)) {
242
+ options.push({ id: current, label: m().playgroundSettings.inputMissing({ id: current }) });
243
+ }
244
+ return options;
245
+ }
246
+ </script>
247
+
248
+ <div class="wf-playground" data-testid="workflow-playground-settings">
249
+ {#if stored === null}
250
+ {#if turnChat}
251
+ <div class="wf-playground__note" role="note">
252
+ <p>{m().playgroundSettings.turnSource}</p>
253
+ {#if onMoveTurns && isPlaygroundChatSet(turnChat)}
254
+ <Button variant="secondary" size="sm" onclick={() => turnChat && onMoveTurns?.(turnChat)}>
255
+ {m().playgroundSettings.moveTurns}
256
+ </Button>
257
+ {/if}
258
+ </div>
259
+ {:else}
260
+ <div class="wf-playground__note" role="note">
261
+ <p class="wf-playground__note-title">{m().playgroundSettings.notSetUpTitle}</p>
262
+ <p>{m().playgroundSettings.notSetUp}</p>
263
+ </div>
264
+ {/if}
265
+ {/if}
266
+
267
+ {#if leftoverTurns}
268
+ <div class="wf-playground__note" role="note">
269
+ <p>{m().playgroundSettings.leftoverTurns}</p>
270
+ {#if onMoveTurns}
271
+ <Button variant="secondary" size="sm" onclick={() => stored && onMoveTurns?.(stored)}>
272
+ {m().playgroundSettings.removeTurns}
273
+ </Button>
274
+ {/if}
275
+ </div>
276
+ {/if}
277
+
278
+ {#if inputs.length === 0}
279
+ <p class="wf-playground__hint">{m().playgroundSettings.noInputs}</p>
280
+ {/if}
281
+
282
+ <label class="wf-playground__field">
283
+ <span class="wf-playground__label">{m().playgroundSettings.messageLabel}</span>
284
+ <Select
285
+ size="sm"
286
+ invalid={inputError('message') !== undefined}
287
+ value={chat.message ?? ''}
288
+ onchange={(e) => setInput('message', e.currentTarget.value)}
289
+ >
290
+ <option value="">{m().playgroundSettings.messageNone}</option>
291
+ {#each inputOptions(chat.message) as option (option.id)}
292
+ <option value={option.id}>{option.label}</option>
293
+ {/each}
294
+ </Select>
295
+ <span class="wf-playground__hint">{m().playgroundSettings.messageHint}</span>
296
+ </label>
297
+
298
+ <div class="wf-playground__row">
299
+ <label class="wf-playground__field wf-playground__field--grow">
300
+ <span class="wf-playground__label">{m().playgroundSettings.historyLabel}</span>
301
+ <Select
302
+ size="sm"
303
+ invalid={inputError('history') !== undefined}
304
+ value={chat.history?.input ?? ''}
305
+ onchange={(e) => setHistoryInput(e.currentTarget.value)}
306
+ >
307
+ <option value="">{m().playgroundSettings.inputNone}</option>
308
+ {#each inputOptions(chat.history?.input ?? null) as option (option.id)}
309
+ <option value={option.id}>{option.label}</option>
310
+ {/each}
311
+ </Select>
312
+ </label>
313
+ {#if chat.history !== null}
314
+ <label class="wf-playground__field wf-playground__field--limit">
315
+ <span class="wf-playground__label">{m().playgroundSettings.historyLimitLabel}</span>
316
+ <Input
317
+ size="sm"
318
+ type="number"
319
+ min="1"
320
+ step="1"
321
+ invalid={historyLimitInvalid}
322
+ value={chat.history.limit}
323
+ onchange={(e) => setHistoryLimit(e.currentTarget)}
324
+ />
325
+ {#if historyLimitInvalid}
326
+ <span class="wf-playground__inline wf-playground__inline--error">
327
+ {m().playgroundSettings.historyLimitInvalid}
328
+ </span>
329
+ {/if}
330
+ </label>
331
+ {/if}
332
+ </div>
333
+
334
+ <details
335
+ class="wf-playground__more"
336
+ open={idsBound || idsOpened}
337
+ ontoggle={(e) => (idsOpened = e.currentTarget.open)}
338
+ >
339
+ <summary>
340
+ <Icon icon="heroicons:chevron-right" />
341
+ {m().playgroundSettings.idsDisclosure}
342
+ </summary>
343
+ <div class="wf-playground__more-body">
344
+ {#each idFields as { key, label } (key)}
345
+ <label class="wf-playground__field">
346
+ <span class="wf-playground__label">{label}</span>
347
+ <Select
348
+ size="sm"
349
+ invalid={inputError(key) !== undefined}
350
+ value={chat[key] ?? ''}
351
+ onchange={(e) => setInput(key, e.currentTarget.value)}
352
+ >
353
+ <option value="">{m().playgroundSettings.inputNone}</option>
354
+ {#each inputOptions(chat[key]) as option (option.id)}
355
+ <option value={option.id}>{option.label}</option>
356
+ {/each}
357
+ </Select>
358
+ </label>
359
+ {/each}
360
+ </div>
361
+ </details>
362
+
363
+ <fieldset class="wf-playground__replies">
364
+ <legend class="wf-playground__label">{m().playgroundSettings.repliesLabel}</legend>
365
+ {#if replyOptions.length === 0}
366
+ <p class="wf-playground__hint">{m().playgroundSettings.repliesNone}</p>
367
+ {/if}
368
+ {#each replyOptions as option (`${option.reply.node_id}::${option.reply.port}`)}
369
+ {@const checked = chat.replies.some((reply) => sameReply(reply, option.reply))}
370
+ {@const error = replyError(option.reply)}
371
+ <label class="wf-playground__check" class:wf-playground__check--missing={option.missing}>
372
+ <input
373
+ type="checkbox"
374
+ {checked}
375
+ onchange={(e) => toggleReply(option.reply, e.currentTarget.checked)}
376
+ />
377
+ <span>{option.label}</span>
378
+ </label>
379
+ {#if error}
380
+ <span class="wf-playground__inline wf-playground__inline--error">{error}</span>
381
+ {/if}
382
+ {/each}
383
+ </fieldset>
384
+
385
+ <label class="wf-playground__check">
386
+ <input
387
+ type="checkbox"
388
+ checked={chat.sub_workflow_replies}
389
+ onchange={(e) => update({ sub_workflow_replies: e.currentTarget.checked })}
390
+ />
391
+ <span>{m().playgroundSettings.subWorkflowReplies}</span>
392
+ </label>
393
+
394
+ {#if halfSet}
395
+ <p class="wf-playground__inline wf-playground__inline--error" role="alert">
396
+ {m().playgroundSettings.halfSet}
397
+ </p>
398
+ {/if}
399
+ {#each errors.filter((issue) => issue.key !== undefined) as issue (issue.code + issue.key)}
400
+ <p class="wf-playground__inline wf-playground__inline--error">{issueText(issue)}</p>
401
+ {/each}
402
+
403
+ <p class="wf-playground__meta">{m().playgroundSettings.savedWith}</p>
404
+ </div>
405
+
406
+ <style>
407
+ .wf-playground {
408
+ display: flex;
409
+ flex-direction: column;
410
+ gap: var(--fd-space-md);
411
+ padding: var(--fd-space-md);
412
+ }
413
+
414
+ .wf-playground__note {
415
+ display: flex;
416
+ flex-direction: column;
417
+ align-items: flex-start;
418
+ gap: var(--fd-space-xs);
419
+ padding: var(--fd-space-sm) var(--fd-space-md);
420
+ border: 1px solid var(--fd-border);
421
+ border-radius: var(--fd-radius-md);
422
+ background-color: var(--fd-muted);
423
+ font-size: var(--fd-text-sm);
424
+ line-height: 1.5;
425
+ }
426
+
427
+ .wf-playground__note p {
428
+ margin: 0;
429
+ }
430
+
431
+ .wf-playground__note-title {
432
+ font-weight: 600;
433
+ }
434
+
435
+ .wf-playground__row {
436
+ display: flex;
437
+ flex-wrap: wrap;
438
+ gap: var(--fd-space-sm);
439
+ }
440
+
441
+ .wf-playground__field {
442
+ display: flex;
443
+ flex-direction: column;
444
+ gap: var(--fd-space-2xs);
445
+ min-width: 0;
446
+ }
447
+
448
+ .wf-playground__field--grow {
449
+ flex: 1 1 10rem;
450
+ }
451
+
452
+ .wf-playground__field--limit {
453
+ flex: 0 1 7rem;
454
+ }
455
+
456
+ /* Same voice as the interface editor's `.wf-interface__label`. */
457
+ .wf-playground__label {
458
+ padding: 0;
459
+ font-size: 0.8125rem;
460
+ font-weight: 600;
461
+ line-height: 1.4;
462
+ letter-spacing: -0.01em;
463
+ color: var(--fd-foreground);
464
+ }
465
+
466
+ .wf-playground__hint,
467
+ .wf-playground__meta {
468
+ margin: 0;
469
+ font-size: var(--fd-text-xs);
470
+ line-height: 1.4;
471
+ color: var(--fd-muted-foreground);
472
+ }
473
+
474
+ .wf-playground__more summary {
475
+ display: inline-flex;
476
+ align-items: center;
477
+ gap: var(--fd-space-2xs);
478
+ cursor: pointer;
479
+ font-size: var(--fd-text-sm);
480
+ font-weight: 500;
481
+ color: var(--fd-muted-foreground);
482
+ list-style: none;
483
+ }
484
+
485
+ .wf-playground__more summary::-webkit-details-marker {
486
+ display: none;
487
+ }
488
+
489
+ .wf-playground__more summary :global(svg) {
490
+ transition: transform var(--fd-transition-fast, 150ms);
491
+ }
492
+
493
+ .wf-playground__more[open] summary :global(svg) {
494
+ transform: rotate(90deg);
495
+ }
496
+
497
+ .wf-playground__more-body {
498
+ display: flex;
499
+ flex-direction: column;
500
+ gap: var(--fd-space-sm);
501
+ padding-top: var(--fd-space-sm);
502
+ }
503
+
504
+ .wf-playground__replies {
505
+ display: flex;
506
+ flex-direction: column;
507
+ gap: var(--fd-space-xs);
508
+ margin: 0;
509
+ padding: 0;
510
+ border: 0;
511
+ min-width: 0;
512
+ }
513
+
514
+ .wf-playground__replies legend {
515
+ margin-bottom: var(--fd-space-xs);
516
+ }
517
+
518
+ .wf-playground__check {
519
+ display: flex;
520
+ align-items: center;
521
+ gap: var(--fd-space-xs);
522
+ font-size: var(--fd-text-sm);
523
+ cursor: pointer;
524
+ min-width: 0;
525
+ overflow-wrap: anywhere;
526
+ }
527
+
528
+ .wf-playground__check input[type='checkbox'] {
529
+ flex: none;
530
+ width: 1rem;
531
+ height: 1rem;
532
+ margin: 0;
533
+ accent-color: var(--fd-primary);
534
+ cursor: pointer;
535
+ }
536
+
537
+ .wf-playground__check--missing span {
538
+ color: var(--fd-error);
539
+ font-family: var(--fd-font-mono);
540
+ }
541
+
542
+ .wf-playground__inline {
543
+ margin: 0;
544
+ font-size: var(--fd-text-xs);
545
+ line-height: 1.4;
546
+ }
547
+
548
+ .wf-playground__inline--error {
549
+ color: var(--fd-error);
550
+ }
551
+ </style>
@@ -0,0 +1,20 @@
1
+ import type { PlaygroundChatBinding, Workflow, WorkflowPlayground } from '../types/index.js';
2
+ interface Props {
3
+ workflow: Workflow;
4
+ /** The next `playground` value, after an edit. */
5
+ onChange: (next: WorkflowPlayground) => void;
6
+ /**
7
+ * Move the deprecated interface `turn` marks into these settings: called
8
+ * with the binding to store (the one they declare, or it with the first
9
+ * edit applied). The caller stores it and clears `turn` from the
10
+ * interface in one update. Also called for every edit while marks are
11
+ * left on the interface beside stored settings, so clearing the binding
12
+ * never falls back to them. Omit to hide the action; edits then go to
13
+ * `onChange` and the marks stay, so clearing every field falls back to
14
+ * them.
15
+ */
16
+ onMoveTurns?: (chat: PlaygroundChatBinding) => void;
17
+ }
18
+ declare const WorkflowPlaygroundSettings: import("svelte").Component<Props, {}, "">;
19
+ type WorkflowPlaygroundSettings = ReturnType<typeof WorkflowPlaygroundSettings>;
20
+ export default WorkflowPlaygroundSettings;
@@ -721,7 +721,7 @@
721
721
  }
722
722
  </script>
723
723
 
724
- <div class="ai-chat-panel" role="region" aria-label={t.aiAssistant}>
724
+ <div class="flowdrop-scope ai-chat-panel" role="region" aria-label={t.aiAssistant}>
725
725
  {#if !isChatConfigured}
726
726
  <!-- No backend configured -->
727
727
  <div class="ai-chat-panel__notice">
@@ -9,8 +9,8 @@
9
9
  * @example
10
10
  * ```svelte
11
11
  * <script>
12
- * import { FormField } from "./";
13
- * import type { FieldSchema } from "./";
12
+ * import { FormField } from "@flowdrop/flowdrop/form";
13
+ * import type { FieldSchema } from "@flowdrop/flowdrop/form";
14
14
  *
15
15
  * const schema: FieldSchema = {
16
16
  * type: "string",
@@ -9,8 +9,8 @@
9
9
  * @example
10
10
  * ```svelte
11
11
  * <script>
12
- * import { FormField } from "./";
13
- * import type { FieldSchema } from "./";
12
+ * import { FormField } from "@flowdrop/flowdrop/form";
13
+ * import type { FieldSchema } from "@flowdrop/flowdrop/form";
14
14
  *
15
15
  * const schema: FieldSchema = {
16
16
  * type: "string",
@@ -7,7 +7,7 @@
7
7
  <script lang="ts">
8
8
  import { Position, Handle } from '@xyflow/svelte';
9
9
  import Icon from '@iconify/svelte';
10
- import { getDataTypeColor, getCategoryColorToken } from '../../utils/colors';
10
+ import { getDataTypeColor, getCategoryColorToken } from '../../utils/colors.js';
11
11
  import { getInstance } from '../../stores/getInstance.svelte.js';
12
12
  import type { ConfigValues, NodeMetadata, NodePort } from '../../types/index.js';
13
13
  import NodeConfigButton from './NodeConfigButton.svelte';
@@ -57,6 +57,11 @@
57
57
  * without a chat turn). Empty or absent renders no form.
58
58
  */
59
59
  formEntries?: WorkflowInterfaceEntry[];
60
+ /**
61
+ * One friendly line above the form and composer, e.g. that the workflow
62
+ * has no chat until somebody sets it up. Absent renders nothing.
63
+ */
64
+ notice?: string;
60
65
  /** Current form values, keyed by entry id. */
61
66
  formValues?: Record<string, unknown>;
62
67
  /** Called with the complete form values on every change. */
@@ -89,6 +94,7 @@
89
94
  predefinedMessage,
90
95
  placeholder,
91
96
  formEntries = [],
97
+ notice,
92
98
  formValues = {},
93
99
  onFormChange,
94
100
  showSessionHeader = true,
@@ -284,6 +290,13 @@
284
290
  </header>
285
291
  {/if}
286
292
 
293
+ {#if notice}
294
+ <p class="control-panel__notice" role="note">
295
+ <Icon icon="mdi:information-outline" />
296
+ <span>{notice}</span>
297
+ </p>
298
+ {/if}
299
+
287
300
  {#if formEntries.length > 0}
288
301
  <InterfaceInputForm
289
302
  entries={formEntries}
@@ -317,6 +330,23 @@
317
330
  border-top: 1px solid var(--fd-border);
318
331
  }
319
332
 
333
+ .control-panel__notice {
334
+ display: flex;
335
+ align-items: flex-start;
336
+ gap: var(--fd-space-xs);
337
+ margin: 0;
338
+ padding: var(--fd-space-xs) var(--fd-space-md);
339
+ border-bottom: 1px solid var(--fd-border);
340
+ color: var(--fd-muted-foreground);
341
+ font-size: var(--fd-text-xs);
342
+ line-height: 1.5;
343
+ }
344
+
345
+ .control-panel__notice :global(svg) {
346
+ flex: none;
347
+ margin-top: 0.15em;
348
+ }
349
+
320
350
  .control-panel__header {
321
351
  display: flex;
322
352
  align-items: center;
@@ -34,6 +34,11 @@ interface Props {
34
34
  * without a chat turn). Empty or absent renders no form.
35
35
  */
36
36
  formEntries?: WorkflowInterfaceEntry[];
37
+ /**
38
+ * One friendly line above the form and composer, e.g. that the workflow
39
+ * has no chat until somebody sets it up. Absent renders nothing.
40
+ */
41
+ notice?: string;
37
42
  /** Current form values, keyed by entry id. */
38
43
  formValues?: Record<string, unknown>;
39
44
  /** Called with the complete form values on every change. */