@flowdrop/flowdrop 2.5.0 → 2.6.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 (52) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/chat/commandClassifier.d.ts +17 -0
  3. package/dist/chat/commandClassifier.js +29 -0
  4. package/dist/chat/index.d.ts +1 -1
  5. package/dist/chat/index.js +1 -1
  6. package/dist/components/App.svelte +8 -0
  7. package/dist/components/BindablePortListbox.svelte +426 -0
  8. package/dist/components/BindablePortListbox.svelte.d.ts +23 -0
  9. package/dist/components/WorkflowInterfaceEditor.svelte +142 -36
  10. package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +8 -0
  11. package/dist/components/WorkflowInterfaceEntryCard.svelte +537 -294
  12. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +6 -3
  13. package/dist/components/WorkflowInterfaceEntryComposer.svelte +331 -0
  14. package/dist/components/WorkflowInterfaceEntryComposer.svelte.d.ts +19 -0
  15. package/dist/messages/context.d.ts +6 -0
  16. package/dist/messages/context.js +8 -0
  17. package/dist/messages/defaults.d.ts +45 -2
  18. package/dist/messages/defaults.js +36 -3
  19. package/dist/messages/index.d.ts +1 -1
  20. package/dist/messages/index.js +1 -1
  21. package/dist/stores/instanceContainer.svelte.d.ts +26 -0
  22. package/dist/stores/instanceContainer.svelte.js +24 -0
  23. package/dist/stories/WebMCPFakeAgent.svelte +229 -0
  24. package/dist/stories/WebMCPFakeAgent.svelte.d.ts +10 -0
  25. package/dist/styles/base.css +4 -2
  26. package/dist/svelte-app.d.ts +20 -0
  27. package/dist/svelte-app.js +49 -1
  28. package/dist/utils/focus.d.ts +18 -0
  29. package/dist/utils/focus.js +24 -0
  30. package/dist/utils/whenWorkflowLoaded.svelte.d.ts +17 -0
  31. package/dist/utils/whenWorkflowLoaded.svelte.js +42 -0
  32. package/dist/utils/workflowInterface.d.ts +47 -3
  33. package/dist/utils/workflowInterface.js +84 -9
  34. package/dist/webmcp/WebMCP.stories.svelte +101 -0
  35. package/dist/webmcp/WebMCP.stories.svelte.d.ts +18 -0
  36. package/dist/webmcp/WebMCPConfirm.svelte +170 -0
  37. package/dist/webmcp/WebMCPConfirm.svelte.d.ts +11 -0
  38. package/dist/webmcp/descriptors.d.ts +59 -0
  39. package/dist/webmcp/descriptors.js +464 -0
  40. package/dist/webmcp/fake.d.ts +23 -0
  41. package/dist/webmcp/fake.js +42 -0
  42. package/dist/webmcp/gate.d.ts +40 -0
  43. package/dist/webmcp/gate.js +92 -0
  44. package/dist/webmcp/index.d.ts +34 -0
  45. package/dist/webmcp/index.js +31 -0
  46. package/dist/webmcp/register.d.ts +33 -0
  47. package/dist/webmcp/register.js +267 -0
  48. package/dist/webmcp/types.d.ts +166 -0
  49. package/dist/webmcp/types.js +23 -0
  50. package/dist/webmcp/validate.d.ts +32 -0
  51. package/dist/webmcp/validate.js +118 -0
  52. package/package.json +6 -1
@@ -1,13 +1,16 @@
1
1
  import type { PortDataTypeConfig, WorkflowInterfaceEntry } from '../types/index.js';
2
- import { type BindablePort, type InterfaceIssue, type ResolvedInterfaceEntry } from '../utils/workflowInterface.js';
2
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
3
+ import { type RankedBindablePort, type InterfaceIssue, type ResolvedInterfaceEntry } from '../utils/workflowInterface.js';
3
4
  interface Props {
4
5
  entry: WorkflowInterfaceEntry;
5
6
  direction: 'inputs' | 'outputs';
6
7
  status: ResolvedInterfaceEntry | undefined;
7
- /** Candidate ports for this direction, for the binding picker. */
8
- candidates: BindablePort[];
8
+ /** Candidate ports for this direction, ranked, for the binding picker. */
9
+ candidates: RankedBindablePort[];
9
10
  /** The authoring vocabulary offered by the dataType picker. */
10
11
  dataTypes: PortDataTypeConfig[];
12
+ /** The instance's checker — shape symbol and lane colour of the bound port. */
13
+ checker: PortCompatibilityChecker;
11
14
  /** The issues this card explains in its footer. */
12
15
  footerIssues: InterfaceIssue[];
13
16
  /** Input side only: the bound port already receives another edge. */
@@ -0,0 +1,331 @@
1
+ <!--
2
+ WorkflowInterfaceEntryComposer
3
+
4
+ The inline form that opens from "Add input" / "Add output" in
5
+ `WorkflowInterfaceEditor`. Two steps, deliberately small:
6
+
7
+ 1. "Bind it to an existing port?" — yes takes the author to a port picker;
8
+ no adds an empty entry straight away (the pre-composer behaviour).
9
+ 2. The picker: a custom listbox over `rankBindablePorts`, ports nothing is
10
+ using yet first, then the connected or already-published ones, each row
11
+ carrying the metadata a native <select> cannot show — type, node › port,
12
+ description, and why a port sits in the second group.
13
+
14
+ Stateless towards the workflow: it reports the author's choice through
15
+ `onBind` / `onCustom` / `onCancel` and the editor builds the entry.
16
+ -->
17
+
18
+ <script lang="ts">
19
+ import Icon from '@iconify/svelte';
20
+ import Button from './Button.svelte';
21
+ import IconButton from './IconButton.svelte';
22
+ import { m } from '../messages/index.js';
23
+ import type { RankedBindablePort } from '../utils/workflowInterface.js';
24
+ import BindablePortListbox from './BindablePortListbox.svelte';
25
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
26
+ import { focusOnMount } from '../utils/focus.js';
27
+
28
+ interface Props {
29
+ direction: 'inputs' | 'outputs';
30
+ /** From `rankBindablePorts` — already ordered free-first. */
31
+ candidates: RankedBindablePort[];
32
+ /**
33
+ * The instance's port-compatibility checker — the source of each row's
34
+ * shape symbol and lane chip, so a candidate reads exactly as its port does
35
+ * on the canvas.
36
+ */
37
+ checker: PortCompatibilityChecker;
38
+ onBind: (candidate: RankedBindablePort) => void;
39
+ onCustom: () => void;
40
+ onCancel: () => void;
41
+ }
42
+
43
+ const { direction, candidates, checker, onBind, onCustom, onCancel }: Props = $props();
44
+
45
+ const isInput = $derived(direction === 'inputs');
46
+
47
+ let mode = $state<'choose' | 'bind'>('choose');
48
+ let selected = $state<RankedBindablePort | undefined>(undefined);
49
+
50
+ function confirm(candidate: RankedBindablePort | undefined = selected): void {
51
+ if (candidate) onBind(candidate);
52
+ }
53
+
54
+ function handleChoiceKeydown(event: KeyboardEvent): void {
55
+ if (event.key === 'Escape') {
56
+ event.preventDefault();
57
+ onCancel();
58
+ }
59
+ }
60
+ </script>
61
+
62
+ <div
63
+ class="wf-composer"
64
+ role="group"
65
+ aria-label={isInput
66
+ ? m().workflowInterface.composerTitleInput
67
+ : m().workflowInterface.composerTitleOutput}
68
+ >
69
+ <div class="wf-composer__header">
70
+ <div class="wf-composer__heading">
71
+ <span class="wf-composer__icon">
72
+ <Icon icon="heroicons:sparkles" />
73
+ </span>
74
+ <div class="wf-composer__heading-text">
75
+ <span class="wf-composer__title">
76
+ {isInput
77
+ ? m().workflowInterface.composerTitleInput
78
+ : m().workflowInterface.composerTitleOutput}
79
+ </span>
80
+ <span class="wf-composer__step">
81
+ {m().workflowInterface.composerStep({ step: mode === 'choose' ? 1 : 2, total: 2 })}
82
+ </span>
83
+ </div>
84
+ </div>
85
+ <IconButton
86
+ size="sm"
87
+ class="wf-composer__close"
88
+ ariaLabel={m().workflowInterface.composerClose}
89
+ onclick={onCancel}
90
+ >
91
+ <Icon icon="heroicons:x-mark" />
92
+ </IconButton>
93
+ </div>
94
+
95
+ {#if mode === 'choose'}
96
+ <p class="wf-composer__question">{m().workflowInterface.composerQuestion}</p>
97
+ <div
98
+ class="wf-composer__choices"
99
+ role="group"
100
+ aria-label={m().workflowInterface.composerQuestion}
101
+ >
102
+ <button
103
+ type="button"
104
+ class="wf-composer__choice"
105
+ {@attach focusOnMount()}
106
+ onclick={() => (mode = 'bind')}
107
+ onkeydown={handleChoiceKeydown}
108
+ >
109
+ <span class="wf-composer__choice-icon">
110
+ <Icon icon="heroicons:link" />
111
+ </span>
112
+ <span class="wf-composer__choice-text">
113
+ <span class="wf-composer__choice-title">{m().workflowInterface.composerBindYes}</span>
114
+ <span class="wf-composer__choice-hint">{m().workflowInterface.composerBindYesHint}</span>
115
+ </span>
116
+ <Icon icon="heroicons:chevron-right" class="wf-composer__choice-arrow" />
117
+ </button>
118
+ <button
119
+ type="button"
120
+ class="wf-composer__choice"
121
+ onclick={onCustom}
122
+ onkeydown={handleChoiceKeydown}
123
+ >
124
+ <span class="wf-composer__choice-icon">
125
+ <Icon icon="heroicons:pencil-square" />
126
+ </span>
127
+ <span class="wf-composer__choice-text">
128
+ <span class="wf-composer__choice-title">{m().workflowInterface.composerBindNo}</span>
129
+ <span class="wf-composer__choice-hint">{m().workflowInterface.composerBindNoHint}</span>
130
+ </span>
131
+ <Icon icon="heroicons:plus" class="wf-composer__choice-arrow" />
132
+ </button>
133
+ </div>
134
+ {:else}
135
+ <BindablePortListbox
136
+ {direction}
137
+ {candidates}
138
+ {checker}
139
+ idPrefix="wf-composer-option-{direction}"
140
+ autofocus
141
+ onHighlight={(candidate) => (selected = candidate)}
142
+ onConfirm={(candidate) => confirm(candidate)}
143
+ {onCancel}
144
+ />
145
+
146
+ <div class="wf-composer__actions">
147
+ <Button variant="ghost" size="sm" onclick={() => (mode = 'choose')}>
148
+ <Icon icon="heroicons:arrow-left" />
149
+ {m().workflowInterface.composerBack}
150
+ </Button>
151
+ <span class="wf-composer__actions-spacer"></span>
152
+ <Button variant="ghost" size="sm" onclick={onCancel}>
153
+ {m().workflowInterface.composerCancel}
154
+ </Button>
155
+ <Button variant="primary" size="sm" disabled={!selected} onclick={() => confirm()}>
156
+ <Icon icon="heroicons:plus" />
157
+ {isInput ? m().workflowInterface.addInput : m().workflowInterface.addOutput}
158
+ </Button>
159
+ </div>
160
+ {/if}
161
+ </div>
162
+
163
+ <style>
164
+ /*
165
+ A draft object, visibly not yet one of the cards below it: a dashed
166
+ primary edge on a faintly primary-tinted surface, its own small header
167
+ with a step counter, and its own close. Everything else — inputs,
168
+ buttons, badges — is the shared control system.
169
+ */
170
+ .wf-composer {
171
+ display: flex;
172
+ flex-direction: column;
173
+ gap: var(--fd-space-sm);
174
+ padding: var(--fd-space-sm);
175
+ border: 1px dashed color-mix(in srgb, var(--fd-primary) 55%, var(--fd-border));
176
+ border-radius: var(--fd-radius-lg);
177
+ background-color: color-mix(in srgb, var(--fd-primary) 4%, var(--fd-card));
178
+ box-shadow: var(--fd-shadow-sm);
179
+ }
180
+
181
+ .wf-composer__header {
182
+ display: flex;
183
+ align-items: flex-start;
184
+ justify-content: space-between;
185
+ gap: var(--fd-space-sm);
186
+ }
187
+
188
+ .wf-composer__heading {
189
+ display: flex;
190
+ align-items: center;
191
+ gap: var(--fd-space-xs);
192
+ min-width: 0;
193
+ }
194
+
195
+ .wf-composer__icon {
196
+ display: inline-flex;
197
+ align-items: center;
198
+ justify-content: center;
199
+ width: 1.75rem;
200
+ height: 1.75rem;
201
+ border-radius: var(--fd-radius-md);
202
+ background-color: var(--fd-primary-muted);
203
+ color: var(--fd-primary);
204
+ font-size: 0.9375rem;
205
+ flex-shrink: 0;
206
+ }
207
+
208
+ .wf-composer__heading-text {
209
+ display: flex;
210
+ flex-direction: column;
211
+ min-width: 0;
212
+ }
213
+
214
+ .wf-composer__title {
215
+ font-size: var(--fd-text-sm);
216
+ font-weight: 600;
217
+ line-height: 1.3;
218
+ color: var(--fd-foreground);
219
+ }
220
+
221
+ .wf-composer__step {
222
+ font-size: var(--fd-text-2xs);
223
+ font-weight: 500;
224
+ letter-spacing: 0.04em;
225
+ text-transform: uppercase;
226
+ color: var(--fd-primary);
227
+ }
228
+
229
+ .wf-composer :global(.wf-composer__close) {
230
+ flex-shrink: 0;
231
+ }
232
+
233
+ .wf-composer__question {
234
+ margin: 0;
235
+ font-size: 0.8125rem;
236
+ font-weight: 600;
237
+ letter-spacing: -0.01em;
238
+ color: var(--fd-foreground);
239
+ }
240
+
241
+ .wf-composer__choices {
242
+ display: flex;
243
+ flex-direction: column;
244
+ gap: var(--fd-space-xs);
245
+ }
246
+
247
+ .wf-composer__choice {
248
+ display: flex;
249
+ align-items: center;
250
+ gap: var(--fd-space-sm);
251
+ width: 100%;
252
+ padding: var(--fd-space-xs) var(--fd-space-sm);
253
+ border: 1px solid var(--fd-border);
254
+ border-radius: var(--fd-radius-md);
255
+ background-color: var(--fd-card);
256
+ color: var(--fd-foreground);
257
+ text-align: left;
258
+ cursor: pointer;
259
+ transition:
260
+ border-color var(--fd-transition-fast),
261
+ background-color var(--fd-transition-fast),
262
+ box-shadow var(--fd-transition-fast);
263
+ }
264
+
265
+ .wf-composer__choice:hover {
266
+ border-color: var(--fd-primary);
267
+ background-color: var(--fd-primary-muted);
268
+ }
269
+
270
+ .wf-composer__choice:focus-visible {
271
+ outline: none;
272
+ border-color: var(--fd-primary);
273
+ box-shadow: 0 0 0 var(--fd-ring-width) var(--fd-primary-muted);
274
+ }
275
+
276
+ .wf-composer__choice-icon {
277
+ display: inline-flex;
278
+ align-items: center;
279
+ justify-content: center;
280
+ width: 1.75rem;
281
+ height: 1.75rem;
282
+ border-radius: var(--fd-radius-full);
283
+ background-color: var(--fd-muted);
284
+ color: var(--fd-muted-foreground);
285
+ font-size: 0.9375rem;
286
+ flex-shrink: 0;
287
+ transition:
288
+ background-color var(--fd-transition-fast),
289
+ color var(--fd-transition-fast);
290
+ }
291
+
292
+ .wf-composer__choice:hover .wf-composer__choice-icon {
293
+ background-color: var(--fd-card);
294
+ color: var(--fd-primary);
295
+ }
296
+
297
+ .wf-composer__choice-text {
298
+ display: flex;
299
+ flex-direction: column;
300
+ gap: 0.0625rem;
301
+ flex: 1;
302
+ min-width: 0;
303
+ }
304
+
305
+ .wf-composer__choice-title {
306
+ font-size: 0.8125rem;
307
+ font-weight: 600;
308
+ line-height: 1.35;
309
+ }
310
+
311
+ .wf-composer__choice-hint {
312
+ font-size: var(--fd-text-xs);
313
+ line-height: 1.45;
314
+ color: var(--fd-muted-foreground);
315
+ }
316
+
317
+ .wf-composer :global(.wf-composer__choice-arrow) {
318
+ flex-shrink: 0;
319
+ color: var(--fd-muted-foreground);
320
+ }
321
+
322
+ .wf-composer__actions {
323
+ display: flex;
324
+ align-items: center;
325
+ gap: var(--fd-space-xs);
326
+ }
327
+
328
+ .wf-composer__actions-spacer {
329
+ flex: 1;
330
+ }
331
+ </style>
@@ -0,0 +1,19 @@
1
+ import type { RankedBindablePort } from '../utils/workflowInterface.js';
2
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
3
+ interface Props {
4
+ direction: 'inputs' | 'outputs';
5
+ /** From `rankBindablePorts` — already ordered free-first. */
6
+ candidates: RankedBindablePort[];
7
+ /**
8
+ * The instance's port-compatibility checker — the source of each row's
9
+ * shape symbol and lane chip, so a candidate reads exactly as its port does
10
+ * on the canvas.
11
+ */
12
+ checker: PortCompatibilityChecker;
13
+ onBind: (candidate: RankedBindablePort) => void;
14
+ onCustom: () => void;
15
+ onCancel: () => void;
16
+ }
17
+ declare const WorkflowInterfaceEntryComposer: import("svelte").Component<Props, {}, "">;
18
+ type WorkflowInterfaceEntryComposer = ReturnType<typeof WorkflowInterfaceEntryComposer>;
19
+ export default WorkflowInterfaceEntryComposer;
@@ -14,6 +14,12 @@
14
14
  */
15
15
  import type { Messages } from './types.js';
16
16
  export declare function setMessages(getter: () => Messages): void;
17
+ /**
18
+ * The context entry `setMessages` would create, for code that mounts a
19
+ * component imperatively (`mount(Component, { target, context })`) and so has
20
+ * no provider above it. The WebMCP confirm dialog is mounted this way.
21
+ */
22
+ export declare function messagesContext(getter: () => Messages): Map<unknown, unknown>;
17
23
  /**
18
24
  * Returns the current messages getter. Components should call the result on
19
25
  * every read so locale switches in the consumer's i18n library propagate
@@ -19,6 +19,14 @@ const defaultGetter = () => defaultMessages;
19
19
  export function setMessages(getter) {
20
20
  setContext(KEY, getter);
21
21
  }
22
+ /**
23
+ * The context entry `setMessages` would create, for code that mounts a
24
+ * component imperatively (`mount(Component, { target, context })`) and so has
25
+ * no provider above it. The WebMCP confirm dialog is mounted this way.
26
+ */
27
+ export function messagesContext(getter) {
28
+ return new Map([[KEY, getter]]);
29
+ }
22
30
  /**
23
31
  * Returns the current messages getter. Components should call the result on
24
32
  * every read so locale switches in the consumer's i18n library propagate
@@ -523,8 +523,6 @@ export declare const defaultMessages: {
523
523
  readonly outputsHeading: "Outputs";
524
524
  readonly addInput: "Add input";
525
525
  readonly addOutput: "Add output";
526
- readonly noInputs: "No inputs declared yet.";
527
- readonly noOutputs: "No outputs declared yet.";
528
526
  readonly idLabel: "ID";
529
527
  readonly nameLabel: "Name";
530
528
  readonly descriptionLabel: "Description";
@@ -545,6 +543,14 @@ export declare const defaultMessages: {
545
543
  readonly removeExample: "Remove example";
546
544
  readonly bindingLabel: "Bound port";
547
545
  readonly bindingUnbound: "Not bound";
546
+ readonly bindingChange: "Change the bound port";
547
+ readonly bindingChoose: "Choose a port to bind";
548
+ readonly bindingCurrent: "Current";
549
+ readonly bindingUnbind: "Unbind";
550
+ readonly bindingDangling: ({ nodeId, portId }: {
551
+ nodeId: string;
552
+ portId: string;
553
+ }) => string;
548
554
  readonly moreOptions: "More options";
549
555
  readonly pullFromPort: "Pull from port";
550
556
  readonly pullFromPortTitle: "Fill name, data type, description, required and default from the bound port's own declaration";
@@ -558,5 +564,42 @@ export declare const defaultMessages: {
558
564
  id: string;
559
565
  }) => string;
560
566
  readonly metaDisclosure: "Server metadata (read-only)";
567
+ readonly composerTitleInput: "New input";
568
+ readonly composerTitleOutput: "New output";
569
+ readonly composerStep: ({ step, total }: {
570
+ step: number;
571
+ total: number;
572
+ }) => string;
573
+ readonly composerClose: "Close without adding";
574
+ readonly composerQuestion: "Bind it to an existing port?";
575
+ readonly composerBindYes: "Yes, bind to a port";
576
+ readonly composerBindYesHint: "Pick an exposed port. The entry takes its id, name, type and description from it.";
577
+ readonly composerBindNo: "No, add a custom entry";
578
+ readonly composerBindNoHint: "Start with an empty entry. Bind it later, or leave it unbound.";
579
+ readonly composerSearchLabel: "Search ports";
580
+ readonly composerSearchPlaceholder: "Search by node, port or type…";
581
+ readonly composerListLabelInput: "Exposed input ports";
582
+ readonly composerListLabelOutput: "Exposed output ports";
583
+ readonly composerGroupFree: "Available";
584
+ readonly composerGroupTaken: "Connected or already published";
585
+ readonly composerNoPorts: "No exposed ports to bind yet. Expose a port on a node first.";
586
+ readonly composerNoMatches: "No ports match your search.";
587
+ readonly composerConnected: "Connected";
588
+ readonly composerPublishedAs: ({ id }: {
589
+ id: string;
590
+ }) => string;
591
+ readonly composerRequired: "Required";
592
+ readonly composerBack: "Back";
593
+ readonly composerCancel: "Cancel";
594
+ };
595
+ readonly webmcp: {
596
+ readonly confirmTitle: ({ name }: {
597
+ name: string;
598
+ }) => string;
599
+ readonly confirmCount: ({ count }: {
600
+ count: number;
601
+ }) => string;
602
+ readonly reject: "Reject";
603
+ readonly apply: "Apply";
561
604
  };
562
605
  };
@@ -445,8 +445,6 @@ export const defaultMessages = {
445
445
  outputsHeading: 'Outputs',
446
446
  addInput: 'Add input',
447
447
  addOutput: 'Add output',
448
- noInputs: 'No inputs declared yet.',
449
- noOutputs: 'No outputs declared yet.',
450
448
  idLabel: 'ID',
451
449
  nameLabel: 'Name',
452
450
  descriptionLabel: 'Description',
@@ -463,12 +461,47 @@ export const defaultMessages = {
463
461
  removeExample: 'Remove example',
464
462
  bindingLabel: 'Bound port',
465
463
  bindingUnbound: 'Not bound',
464
+ bindingChange: 'Change the bound port',
465
+ bindingChoose: 'Choose a port to bind',
466
+ bindingCurrent: 'Current',
467
+ bindingUnbind: 'Unbind',
468
+ bindingDangling: ({ nodeId, portId }) => `${nodeId} › ${portId} (missing)`,
466
469
  moreOptions: 'More options',
467
470
  pullFromPort: 'Pull from port',
468
471
  pullFromPortTitle: "Fill name, data type, description, required and default from the bound port's own declaration",
469
472
  removeEntry: ({ id }) => `Remove interface entry "${id}"`,
470
473
  moveUp: ({ id }) => `Move "${id}" up`,
471
474
  moveDown: ({ id }) => `Move "${id}" down`,
472
- metaDisclosure: 'Server metadata (read-only)'
475
+ metaDisclosure: 'Server metadata (read-only)',
476
+ // The inline composer that opens from "Add input" / "Add output".
477
+ composerTitleInput: 'New input',
478
+ composerTitleOutput: 'New output',
479
+ composerStep: ({ step, total }) => `Step ${step} of ${total}`,
480
+ composerClose: 'Close without adding',
481
+ composerQuestion: 'Bind it to an existing port?',
482
+ composerBindYes: 'Yes, bind to a port',
483
+ composerBindYesHint: 'Pick an exposed port. The entry takes its id, name, type and description from it.',
484
+ composerBindNo: 'No, add a custom entry',
485
+ composerBindNoHint: 'Start with an empty entry. Bind it later, or leave it unbound.',
486
+ composerSearchLabel: 'Search ports',
487
+ composerSearchPlaceholder: 'Search by node, port or type…',
488
+ composerListLabelInput: 'Exposed input ports',
489
+ composerListLabelOutput: 'Exposed output ports',
490
+ composerGroupFree: 'Available',
491
+ composerGroupTaken: 'Connected or already published',
492
+ composerNoPorts: 'No exposed ports to bind yet. Expose a port on a node first.',
493
+ composerNoMatches: 'No ports match your search.',
494
+ composerConnected: 'Connected',
495
+ composerPublishedAs: ({ id }) => `Published as ${id}`,
496
+ composerRequired: 'Required',
497
+ composerBack: 'Back',
498
+ composerCancel: 'Cancel'
499
+ },
500
+ // The confirm dialog the WebMCP adapter shows before a browser agent's change runs.
501
+ webmcp: {
502
+ confirmTitle: ({ name }) => `A browser agent wants to change “${name}”`,
503
+ confirmCount: ({ count }) => `${count === 1 ? '1 change' : `${count} changes`} — applied together, undone together.`,
504
+ reject: 'Reject',
505
+ apply: 'Apply'
473
506
  }
474
507
  };
@@ -6,5 +6,5 @@
6
6
  */
7
7
  export { defaultMessages } from './defaults.js';
8
8
  export { mergeMessages } from './merge.js';
9
- export { setMessages, getMessages, m } from './context.js';
9
+ export { setMessages, getMessages, messagesContext, m } from './context.js';
10
10
  export type { Messages, MessagesOverride, DeepPartial } from './types.js';
@@ -6,4 +6,4 @@
6
6
  */
7
7
  export { defaultMessages } from './defaults.js';
8
8
  export { mergeMessages } from './merge.js';
9
- export { setMessages, getMessages, m } from './context.js';
9
+ export { setMessages, getMessages, messagesContext, m } from './context.js';
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * @module stores/instanceContainer
15
15
  */
16
+ import type { NodeMetadata } from '../types/index.js';
16
17
  import { HistoryService } from '../services/historyService.js';
17
18
  import { WorkflowStore } from './workflowStore.svelte.js';
18
19
  import { HistoryStore } from './historyStore.svelte.js';
@@ -76,6 +77,20 @@ export interface FlowDropInstance {
76
77
  readonly portCoordinates: PortCoordinateStore;
77
78
  /** Pipeline panel open/close state (instance-scoped persistence). */
78
79
  readonly pipelinePanel: PipelinePanelStore;
80
+ /**
81
+ * The node types this editor currently knows: what `App` fetched (or was
82
+ * given), merged with the format-provided nodes. Written by the editor as
83
+ * its fetch lands; read by anything that needs the list without fetching
84
+ * again (the WebMCP adapter's `list_types`, `add_node`).
85
+ */
86
+ readonly nodeTypes: NodeTypesStore;
87
+ /**
88
+ * Run `fn` when this instance is destroyed. Returns an unsubscribe; calling
89
+ * it before `destroy()` means `fn` never runs. Adapters that bind to an
90
+ * instance (WebMCP, host integrations) hook their teardown here instead of
91
+ * wrapping `destroy`.
92
+ */
93
+ onDestroy(fn: () => void): () => void;
79
94
  /**
80
95
  * Dispose all per-instance resources (subscriptions, effect roots,
81
96
  * external callbacks). Safe to call more than once. Must not touch
@@ -83,6 +98,17 @@ export interface FlowDropInstance {
83
98
  */
84
99
  destroy(): void;
85
100
  }
101
+ /**
102
+ * The instance's node-type list. A getter and a setter over one `$state`, so
103
+ * a reader inside an effect tracks it and a reader outside one just gets the
104
+ * current array.
105
+ */
106
+ export declare class NodeTypesStore {
107
+ #private;
108
+ /** The list as last set; empty until the editor's fetch lands. */
109
+ get current(): NodeMetadata[];
110
+ set(list: NodeMetadata[]): void;
111
+ }
86
112
  export interface CreateInstanceOptions {
87
113
  /** Explicit instance id; auto-generated (`fd-<n>`) when omitted. */
88
114
  id?: string;
@@ -31,6 +31,21 @@ import { BUILTIN_NODE_COMPONENTS } from '../registry/builtinNodes.js';
31
31
  import { getBuiltinFormatAdapters } from '../registry/builtinFormats.js';
32
32
  /** Storage key prefix shared by the default instance and legacy consumers. */
33
33
  export const DEFAULT_DRAFT_PREFIX = 'flowdrop:draft';
34
+ /**
35
+ * The instance's node-type list. A getter and a setter over one `$state`, so
36
+ * a reader inside an effect tracks it and a reader outside one just gets the
37
+ * current array.
38
+ */
39
+ export class NodeTypesStore {
40
+ #list = $state([]);
41
+ /** The list as last set; empty until the editor's fetch lands. */
42
+ get current() {
43
+ return this.#list;
44
+ }
45
+ set(list) {
46
+ this.#list = list;
47
+ }
48
+ }
34
49
  // Feeds auto-generated ids only (`fd-1`, `fd-2`, …) — cosmetic monotonicity.
35
50
  // Incrementing across SSR requests is harmless; no state hangs off the value.
36
51
  let instanceCounter = 0;
@@ -89,6 +104,15 @@ export function createFlowDropInstance(options = {}) {
89
104
  portCompatibility: new PortCompatibilityChecker(DEFAULT_PORT_CONFIG),
90
105
  // The default instance keeps the legacy bare localStorage key.
91
106
  pipelinePanel: new PipelinePanelStore(id),
107
+ nodeTypes: new NodeTypesStore(),
108
+ onDestroy(fn) {
109
+ cleanups.push(fn);
110
+ return () => {
111
+ const i = cleanups.indexOf(fn);
112
+ if (i !== -1)
113
+ cleanups.splice(i, 1);
114
+ };
115
+ },
92
116
  destroy() {
93
117
  while (cleanups.length > 0) {
94
118
  cleanups.pop()?.();