@particle-academy/fancy-flow 0.10.0 → 0.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 (43) hide show
  1. package/dist/{chunk-HNBO4HP3.js → chunk-2NQT2A3I.js} +9 -3
  2. package/dist/chunk-2NQT2A3I.js.map +1 -0
  3. package/dist/{chunk-VEI743ZX.js → chunk-3GMBLHTM.js} +3 -3
  4. package/dist/{chunk-VEI743ZX.js.map → chunk-3GMBLHTM.js.map} +1 -1
  5. package/dist/{chunk-6GGFEZH7.js → chunk-D6W5FMCT.js} +18 -8
  6. package/dist/chunk-D6W5FMCT.js.map +1 -0
  7. package/dist/{chunk-CPSOC27D.js → chunk-U5F22BHV.js} +18 -4
  8. package/dist/chunk-U5F22BHV.js.map +1 -0
  9. package/dist/{chunk-NCPQDVUE.js → chunk-YNOI7ONN.js} +54 -28
  10. package/dist/chunk-YNOI7ONN.js.map +1 -0
  11. package/dist/engine.cjs +17 -1
  12. package/dist/engine.cjs.map +1 -1
  13. package/dist/engine.js +2 -2
  14. package/dist/index.cjs +86 -31
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +9 -9
  19. package/dist/registry/index.d.cts +20 -4
  20. package/dist/registry/index.d.ts +20 -4
  21. package/dist/registry.cjs +68 -26
  22. package/dist/registry.cjs.map +1 -1
  23. package/dist/registry.js +2 -2
  24. package/dist/runtime.cjs +17 -1
  25. package/dist/runtime.cjs.map +1 -1
  26. package/dist/runtime.js +3 -3
  27. package/dist/schema/index.d.cts +17 -1
  28. package/dist/schema/index.d.ts +17 -1
  29. package/dist/schema.cjs +45 -6
  30. package/dist/schema.cjs.map +1 -1
  31. package/dist/schema.js +3 -2
  32. package/dist/{types-DKqaUjF_.d.cts → types-BwLr5tZV.d.cts} +15 -1
  33. package/dist/{types-BocBFh6l.d.ts → types-CsEe3EQl.d.ts} +15 -1
  34. package/dist/ux.cjs +5 -0
  35. package/dist/ux.cjs.map +1 -1
  36. package/dist/ux.d.cts +1 -1
  37. package/dist/ux.d.ts +1 -1
  38. package/dist/ux.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunk-6GGFEZH7.js.map +0 -1
  41. package/dist/chunk-CPSOC27D.js.map +0 -1
  42. package/dist/chunk-HNBO4HP3.js.map +0 -1
  43. package/dist/chunk-NCPQDVUE.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -12,19 +12,33 @@ var ReactExports__default = /*#__PURE__*/_interopDefault(ReactExports);
12
12
 
13
13
  // src/registry/registry.ts
14
14
  var kinds = /* @__PURE__ */ new Map();
15
+ var aliases = /* @__PURE__ */ new Map();
15
16
  var listeners = /* @__PURE__ */ new Set();
16
17
  function registerNodeKind(definition) {
17
18
  kinds.set(definition.name, definition);
19
+ for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);
18
20
  notify();
19
21
  return () => {
20
22
  if (kinds.get(definition.name) === definition) {
21
23
  kinds.delete(definition.name);
24
+ for (const alias of definition.aliases ?? []) {
25
+ if (aliases.get(alias) === definition.name) aliases.delete(alias);
26
+ }
22
27
  notify();
23
28
  }
24
29
  };
25
30
  }
31
+ function resolveKindId(id2) {
32
+ if (kinds.has(id2)) return id2;
33
+ const canonical = aliases.get(id2);
34
+ return canonical && kinds.has(canonical) ? canonical : null;
35
+ }
26
36
  function getNodeKind(name) {
27
- return kinds.get(name) ?? null;
37
+ const canonical = resolveKindId(name);
38
+ return canonical ? kinds.get(canonical) ?? null : null;
39
+ }
40
+ function kindIds(kind) {
41
+ return [kind.name, ...kind.aliases ?? []];
28
42
  }
29
43
  function listNodeKinds(category) {
30
44
  const all = Array.from(kinds.values());
@@ -244,7 +258,8 @@ var HTTP_METHODS = [
244
258
  var KINDS = [
245
259
  // ───────────── Triggers ─────────────
246
260
  {
247
- name: "manual_trigger",
261
+ name: "@fancy/manual_trigger",
262
+ aliases: ["manual_trigger"],
248
263
  category: "trigger",
249
264
  label: "Manual",
250
265
  description: "Entry point fired when the user clicks Run.",
@@ -253,7 +268,8 @@ var KINDS = [
253
268
  outputs: [{ id: "out" }]
254
269
  },
255
270
  {
256
- name: "webhook_trigger",
271
+ name: "@fancy/webhook_trigger",
272
+ aliases: ["webhook_trigger"],
257
273
  category: "trigger",
258
274
  label: "Webhook",
259
275
  description: "Triggered by an inbound HTTP request to a host-provided URL.",
@@ -270,7 +286,8 @@ var KINDS = [
270
286
  ]
271
287
  },
272
288
  {
273
- name: "schedule_trigger",
289
+ name: "@fancy/schedule_trigger",
290
+ aliases: ["schedule_trigger"],
274
291
  category: "trigger",
275
292
  label: "Schedule",
276
293
  description: "Fires on a cron schedule (host-implemented).",
@@ -290,7 +307,8 @@ var KINDS = [
290
307
  ]
291
308
  },
292
309
  {
293
- name: "user_input",
310
+ name: "@fancy/user_input",
311
+ aliases: ["user_input"],
294
312
  category: "human",
295
313
  label: "User Input",
296
314
  description: "Pause the flow until the user submits the configured form.",
@@ -330,7 +348,8 @@ var KINDS = [
330
348
  ]
331
349
  },
332
350
  {
333
- name: "rich_user_input",
351
+ name: "@fancy/rich_user_input",
352
+ aliases: ["rich_user_input"],
334
353
  category: "human",
335
354
  label: "Rich User Input",
336
355
  description: "Pause the flow on a fully authored page \u2014 content, required reading, multi-section forms.",
@@ -355,7 +374,8 @@ var KINDS = [
355
374
  },
356
375
  // ───────────── Logic ─────────────
357
376
  {
358
- name: "branch",
377
+ name: "@fancy/branch",
378
+ aliases: ["branch"],
359
379
  category: "logic",
360
380
  label: "Branch",
361
381
  description: "Multi-way branch on a condition or value.",
@@ -367,7 +387,8 @@ var KINDS = [
367
387
  ]
368
388
  },
369
389
  {
370
- name: "switch_case",
390
+ name: "@fancy/switch_case",
391
+ aliases: ["switch_case"],
371
392
  category: "logic",
372
393
  label: "Switch",
373
394
  description: "Route to one of N labelled outputs based on a key.",
@@ -394,7 +415,8 @@ var KINDS = [
394
415
  ]
395
416
  },
396
417
  {
397
- name: "for_each",
418
+ name: "@fancy/for_each",
419
+ aliases: ["for_each"],
398
420
  category: "logic",
399
421
  label: "For Each",
400
422
  description: "Iterate over a list, emitting each item on `item`.",
@@ -407,7 +429,8 @@ var KINDS = [
407
429
  ]
408
430
  },
409
431
  {
410
- name: "merge",
432
+ name: "@fancy/merge",
433
+ aliases: ["merge"],
411
434
  category: "logic",
412
435
  label: "Merge",
413
436
  description: "Combine multiple inputs into one object or array.",
@@ -425,7 +448,8 @@ var KINDS = [
425
448
  ]
426
449
  },
427
450
  {
428
- name: "wait",
451
+ name: "@fancy/wait",
452
+ aliases: ["wait"],
429
453
  category: "logic",
430
454
  label: "Wait",
431
455
  description: "Sleep or wait for an external event.",
@@ -442,7 +466,8 @@ var KINDS = [
442
466
  ]
443
467
  },
444
468
  {
445
- name: "transform",
469
+ name: "@fancy/transform",
470
+ aliases: ["transform"],
446
471
  category: "logic",
447
472
  label: "Transform",
448
473
  description: "Reshape data with an expression.",
@@ -459,7 +484,8 @@ var KINDS = [
459
484
  },
460
485
  // ───────────── Data ─────────────
461
486
  {
462
- name: "memory_store",
487
+ name: "@fancy/memory_store",
488
+ aliases: ["memory_store"],
463
489
  category: "data",
464
490
  label: "Memory Store",
465
491
  description: "Read or write per-conversation memory.",
@@ -479,7 +505,8 @@ var KINDS = [
479
505
  ]
480
506
  },
481
507
  {
482
- name: "data_store",
508
+ name: "@fancy/data_store",
509
+ aliases: ["data_store"],
483
510
  category: "data",
484
511
  label: "Data Store",
485
512
  description: "Key-value or table read/write against a host store.",
@@ -507,7 +534,8 @@ var KINDS = [
507
534
  ]
508
535
  },
509
536
  {
510
- name: "variable",
537
+ name: "@fancy/variable",
538
+ aliases: ["variable"],
511
539
  category: "data",
512
540
  label: "Variable",
513
541
  description: "Workflow-scoped value used by other nodes.",
@@ -519,7 +547,8 @@ var KINDS = [
519
547
  },
520
548
  // ───────────── AI ─────────────
521
549
  {
522
- name: "llm_call",
550
+ name: "@fancy/llm_call",
551
+ aliases: ["llm_call"],
523
552
  category: "ai",
524
553
  label: "LLM Call",
525
554
  description: "Send a prompt + context to a model and receive a response.",
@@ -546,7 +575,8 @@ var KINDS = [
546
575
  ]
547
576
  },
548
577
  {
549
- name: "llm_branch",
578
+ name: "@fancy/llm_branch",
579
+ aliases: ["llm_branch"],
550
580
  category: "ai",
551
581
  label: "LLM Router",
552
582
  description: "Let a model choose which route the flow takes.",
@@ -616,7 +646,8 @@ var KINDS = [
616
646
  ]
617
647
  },
618
648
  {
619
- name: "tool_use",
649
+ name: "@fancy/tool_use",
650
+ aliases: ["tool_use"],
620
651
  category: "ai",
621
652
  label: "Tool Use",
622
653
  description: "Hand control to a host-registered tool by name.",
@@ -627,7 +658,8 @@ var KINDS = [
627
658
  ]
628
659
  },
629
660
  {
630
- name: "embed_search",
661
+ name: "@fancy/embed_search",
662
+ aliases: ["embed_search"],
631
663
  category: "ai",
632
664
  label: "Embed & Search",
633
665
  description: "Embed a query and search a vector store.",
@@ -640,7 +672,8 @@ var KINDS = [
640
672
  },
641
673
  // ───────────── IO ─────────────
642
674
  {
643
- name: "api_request",
675
+ name: "@fancy/api_request",
676
+ aliases: ["api_request"],
644
677
  category: "io",
645
678
  label: "API Request",
646
679
  description: "HTTP request to any URL.",
@@ -654,7 +687,8 @@ var KINDS = [
654
687
  ]
655
688
  },
656
689
  {
657
- name: "webhook_out",
690
+ name: "@fancy/webhook_out",
691
+ aliases: ["webhook_out"],
658
692
  category: "io",
659
693
  label: "Send Webhook",
660
694
  description: "POST a payload to a configured URL.",
@@ -667,7 +701,8 @@ var KINDS = [
667
701
  },
668
702
  // ───────────── Human ─────────────
669
703
  {
670
- name: "human_approval",
704
+ name: "@fancy/human_approval",
705
+ aliases: ["human_approval"],
671
706
  category: "human",
672
707
  label: "Human Approval",
673
708
  description: "Pause until a human approves or denies.",
@@ -681,7 +716,8 @@ var KINDS = [
681
716
  ]
682
717
  },
683
718
  {
684
- name: "notify",
719
+ name: "@fancy/notify",
720
+ aliases: ["notify"],
685
721
  category: "human",
686
722
  label: "Notify",
687
723
  description: "Send a message via Slack / email / SMS / etc.",
@@ -705,7 +741,8 @@ var KINDS = [
705
741
  },
706
742
  // ───────────── Output ─────────────
707
743
  {
708
- name: "output",
744
+ name: "@fancy/output",
745
+ aliases: ["output"],
709
746
  category: "output",
710
747
  label: "Output",
711
748
  description: "Terminal node \u2014 captures the workflow's result.",
@@ -714,7 +751,8 @@ var KINDS = [
714
751
  outputs: []
715
752
  },
716
753
  {
717
- name: "log",
754
+ name: "@fancy/log",
755
+ aliases: ["log"],
718
756
  category: "output",
719
757
  label: "Log",
720
758
  description: "Send to the run feed.",
@@ -10540,6 +10578,12 @@ function collectInputs(node, incoming, portValues, initial) {
10540
10578
  function pickExecutor(executors, node) {
10541
10579
  if (executors[node.id]) return executors[node.id];
10542
10580
  if (node.type && executors[node.type]) return executors[node.type];
10581
+ const kind = node.type ? getNodeKind(node.type) : null;
10582
+ if (kind) {
10583
+ for (const id2 of kindIds(kind)) {
10584
+ if (executors[id2]) return executors[id2];
10585
+ }
10586
+ }
10543
10587
  return executors["*"];
10544
10588
  }
10545
10589
  function activatedPorts(node, result) {
@@ -10667,13 +10711,17 @@ function exportWorkflow(graph, metadata, view) {
10667
10711
  }
10668
10712
  function toSchemaNode(n) {
10669
10713
  const data = n.data ?? {};
10714
+ const kindName = data.kind ?? n.type ?? "custom";
10715
+ const ports = resolveNodePorts(n, getNodeKind(kindName) ?? void 0);
10670
10716
  return {
10671
10717
  id: n.id,
10672
- kind: data.kind ?? n.type ?? "custom",
10718
+ kind: kindName,
10673
10719
  position: { x: n.position.x, y: n.position.y },
10674
10720
  label: data.label,
10675
10721
  description: data.description,
10676
- config: data.config
10722
+ config: data.config,
10723
+ inputs: ports.inputs,
10724
+ outputs: ports.outputs
10677
10725
  };
10678
10726
  }
10679
10727
  function toSchemaEdge(e) {
@@ -10717,15 +10765,20 @@ function importWorkflow(schema, options = {}) {
10717
10765
  issues.push({ level: "warning", nodeId: n.id, message: `${iss.key}: ${iss.message}` });
10718
10766
  }
10719
10767
  }
10768
+ const kindId = kind?.name ?? n.kind;
10720
10769
  return {
10721
10770
  id: n.id,
10722
- type: n.kind,
10771
+ type: kindId,
10723
10772
  position: { x: n.position?.x ?? 0, y: n.position?.y ?? 0 },
10724
10773
  data: {
10725
- kind: n.kind,
10774
+ kind: kindId,
10726
10775
  label: n.label ?? kind?.label ?? n.kind,
10727
10776
  description: n.description,
10728
- config
10777
+ config,
10778
+ // Carry serialized ports back onto the node so a round-trip is stable
10779
+ // and an unknown kind still routes the way the document described.
10780
+ ...n.inputs ? { inputs: n.inputs } : {},
10781
+ ...n.outputs ? { outputs: n.outputs } : {}
10729
10782
  }
10730
10783
  };
10731
10784
  });
@@ -10871,7 +10924,9 @@ function previewValue(v) {
10871
10924
  // src/registry/index.ts
10872
10925
  function buildNodeTypes() {
10873
10926
  const map = {};
10874
- for (const k of listNodeKinds()) map[k.name] = RegistryNode;
10927
+ for (const k of listNodeKinds()) {
10928
+ for (const id2 of kindIds(k)) map[id2] = RegistryNode;
10929
+ }
10875
10930
  return map;
10876
10931
  }
10877
10932