@particle-academy/fancy-flow 0.50.0 → 0.51.1

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 (81) hide show
  1. package/dist/{ConfigFieldRenderer-CrXFq6Eb.d.cts → ConfigFieldRenderer-Bc9Txnql.d.cts} +2 -2
  2. package/dist/{ConfigFieldRenderer-u3nYHovX.d.ts → ConfigFieldRenderer-Bt3RGT7Z.d.ts} +2 -2
  3. package/dist/{FlowViewer-DRgjeWJ7.d.ts → FlowViewer-BI_AyyvU.d.ts} +1 -1
  4. package/dist/{FlowViewer-CFSMlCqi.d.cts → FlowViewer-DABx-6A-.d.cts} +1 -1
  5. package/dist/{capabilities-VzgDApur.d.cts → capabilities-BYa5p5jw.d.cts} +1 -1
  6. package/dist/{capabilities-B00VXLUp.d.ts → capabilities-COOXRiNL.d.ts} +1 -1
  7. package/dist/{chunk-XJMWMU4J.js → chunk-4GO2CHAY.js} +90 -7
  8. package/dist/chunk-4GO2CHAY.js.map +1 -0
  9. package/dist/{chunk-OWDSPRAF.js → chunk-OECW2E5D.js} +4 -4
  10. package/dist/{chunk-OWDSPRAF.js.map → chunk-OECW2E5D.js.map} +1 -1
  11. package/dist/{chunk-BAHJVX3S.js → chunk-OK7KJLWA.js} +3 -3
  12. package/dist/{chunk-BAHJVX3S.js.map → chunk-OK7KJLWA.js.map} +1 -1
  13. package/dist/{chunk-I4F6GI3A.js → chunk-RSRXKZ52.js} +3 -3
  14. package/dist/{chunk-I4F6GI3A.js.map → chunk-RSRXKZ52.js.map} +1 -1
  15. package/dist/{chunk-3W26FA7Q.js → chunk-SPINP4EJ.js} +18 -4
  16. package/dist/chunk-SPINP4EJ.js.map +1 -0
  17. package/dist/{chunk-DQJIU55F.js → chunk-VUU3CDBT.js} +3 -3
  18. package/dist/{chunk-DQJIU55F.js.map → chunk-VUU3CDBT.js.map} +1 -1
  19. package/dist/connectors.d.cts +2 -2
  20. package/dist/connectors.d.ts +2 -2
  21. package/dist/durable/index.d.cts +2 -2
  22. package/dist/durable/index.d.ts +2 -2
  23. package/dist/durable.cjs +88 -5
  24. package/dist/durable.cjs.map +1 -1
  25. package/dist/durable.js +1 -1
  26. package/dist/engine.cjs +88 -5
  27. package/dist/engine.cjs.map +1 -1
  28. package/dist/engine.d.cts +7 -7
  29. package/dist/engine.d.ts +7 -7
  30. package/dist/engine.js +3 -3
  31. package/dist/fields/react-fancy.d.cts +3 -3
  32. package/dist/fields/react-fancy.d.ts +3 -3
  33. package/dist/index.cjs +103 -6
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +11 -11
  36. package/dist/index.d.ts +11 -11
  37. package/dist/index.js +11 -11
  38. package/dist/layout/index.d.cts +1 -1
  39. package/dist/layout/index.d.ts +1 -1
  40. package/dist/llm/prism.d.cts +2 -2
  41. package/dist/llm/prism.d.ts +2 -2
  42. package/dist/llm/vercel-ai.d.cts +2 -2
  43. package/dist/llm/vercel-ai.d.ts +2 -2
  44. package/dist/registry/index.d.cts +6 -6
  45. package/dist/registry/index.d.ts +6 -6
  46. package/dist/{registry-6cB5wCv6.d.ts → registry-3RkSYrMi.d.ts} +1 -1
  47. package/dist/{registry-DQh7ZmnM.d.cts → registry-C6TMfiD_.d.cts} +1 -1
  48. package/dist/registry.cjs +88 -5
  49. package/dist/registry.cjs.map +1 -1
  50. package/dist/registry.js +2 -2
  51. package/dist/{run-cohort-VX4JG21l.d.ts → run-cohort-BPIOpE8A.d.ts} +2 -2
  52. package/dist/{run-cohort-DYCL8Qv6.d.cts → run-cohort-r-L8dMED.d.cts} +2 -2
  53. package/dist/{run-flow-B24QUO1H.d.cts → run-flow-COdAOFg2.d.cts} +10 -1
  54. package/dist/{run-flow-DPUPAWk6.d.ts → run-flow-DJ7KYT6E.d.ts} +10 -1
  55. package/dist/runtime/index.d.cts +5 -5
  56. package/dist/runtime/index.d.ts +5 -5
  57. package/dist/runtime.cjs +88 -5
  58. package/dist/runtime.cjs.map +1 -1
  59. package/dist/runtime.js +3 -3
  60. package/dist/schema/index.d.cts +12 -1
  61. package/dist/schema/index.d.ts +12 -1
  62. package/dist/schema.cjs +103 -6
  63. package/dist/schema.cjs.map +1 -1
  64. package/dist/schema.js +2 -2
  65. package/dist/screens.cjs +88 -5
  66. package/dist/screens.cjs.map +1 -1
  67. package/dist/screens.d.cts +2 -2
  68. package/dist/screens.d.ts +2 -2
  69. package/dist/screens.js +4 -4
  70. package/dist/{types-BtMOnb9I.d.cts → types-3sPauVRT.d.cts} +1 -1
  71. package/dist/{types-7cXcSQlx.d.cts → types-JFYjPJAG.d.cts} +37 -1
  72. package/dist/{types-7cXcSQlx.d.ts → types-JFYjPJAG.d.ts} +37 -1
  73. package/dist/{types-CDgIIj4c.d.ts → types-s643U1Hi.d.ts} +1 -1
  74. package/dist/ux.cjs +88 -5
  75. package/dist/ux.cjs.map +1 -1
  76. package/dist/ux.d.cts +2 -2
  77. package/dist/ux.d.ts +2 -2
  78. package/dist/ux.js +1 -1
  79. package/package.json +1 -1
  80. package/dist/chunk-3W26FA7Q.js.map +0 -1
  81. package/dist/chunk-XJMWMU4J.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { F as FlowGraph } from './types-7cXcSQlx.cjs';
4
- import { C as ConfigField } from './types-BtMOnb9I.cjs';
3
+ import { F as FlowGraph } from './types-JFYjPJAG.cjs';
4
+ import { C as ConfigField } from './types-3sPauVRT.cjs';
5
5
 
6
6
  /** What a host renderer is handed. */
7
7
  type ConfigFieldRenderContext = {
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { F as FlowGraph } from './types-7cXcSQlx.js';
4
- import { C as ConfigField } from './types-CDgIIj4c.js';
3
+ import { F as FlowGraph } from './types-JFYjPJAG.js';
4
+ import { C as ConfigField } from './types-s643U1Hi.js';
5
5
 
6
6
  /** What a host renderer is handed. */
7
7
  type ConfigFieldRenderContext = {
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { F as FlowGraph, a as FlowNode } from './types-7cXcSQlx.js';
3
+ import { F as FlowGraph, a as FlowNode } from './types-JFYjPJAG.js';
4
4
 
5
5
  /** Outcome of one node in a run, for annotating the graph after the fact. */
6
6
  type FlowNodeStatus = "ok" | "running" | "failed" | "skipped" | "pending";
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { F as FlowGraph, a as FlowNode } from './types-7cXcSQlx.cjs';
3
+ import { F as FlowGraph, a as FlowNode } from './types-JFYjPJAG.cjs';
4
4
 
5
5
  /** Outcome of one node in a run, for annotating the graph after the fact. */
6
6
  type FlowNodeStatus = "ok" | "running" | "failed" | "skipped" | "pending";
@@ -1,4 +1,4 @@
1
- import { F as FlowGraph } from './types-7cXcSQlx.cjs';
1
+ import { F as FlowGraph } from './types-JFYjPJAG.cjs';
2
2
 
3
3
  /**
4
4
  * Host capabilities — the services core nodes need but must never depend on.
@@ -1,4 +1,4 @@
1
- import { F as FlowGraph } from './types-7cXcSQlx.js';
1
+ import { F as FlowGraph } from './types-JFYjPJAG.js';
2
2
 
3
3
  /**
4
4
  * Host capabilities — the services core nodes need but must never depend on.
@@ -9301,6 +9301,61 @@ var RunIdentity = class _RunIdentity {
9301
9301
  }
9302
9302
  };
9303
9303
 
9304
+ // src/runtime/workflow-props.ts
9305
+ function typeOf(value) {
9306
+ if (value === null) return "null";
9307
+ if (Array.isArray(value)) return "array";
9308
+ return typeof value;
9309
+ }
9310
+ function resolveWorkflowProps(declared, passed) {
9311
+ const inputs = declared ?? [];
9312
+ const given = passed ?? {};
9313
+ const byName = new Map(inputs.map((input) => [input.name, input]));
9314
+ for (const name of Object.keys(given)) {
9315
+ if (!byName.has(name)) {
9316
+ const known = inputs.map((input) => input.name);
9317
+ const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
9318
+ return {
9319
+ ok: false,
9320
+ code: "unknown_input",
9321
+ error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
9322
+ };
9323
+ }
9324
+ }
9325
+ const resolved = {};
9326
+ for (const input of inputs) {
9327
+ const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
9328
+ const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
9329
+ if (!supplied) {
9330
+ if (hasDefault) {
9331
+ resolved[input.name] = input.default;
9332
+ continue;
9333
+ }
9334
+ if (input.required) {
9335
+ return {
9336
+ ok: false,
9337
+ code: "missing_required",
9338
+ error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
9339
+ };
9340
+ }
9341
+ continue;
9342
+ }
9343
+ const value = given[input.name];
9344
+ if (input.type !== void 0) {
9345
+ const actual = typeOf(value);
9346
+ if (actual !== input.type) {
9347
+ return {
9348
+ ok: false,
9349
+ code: "type_mismatch",
9350
+ error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
9351
+ };
9352
+ }
9353
+ }
9354
+ resolved[input.name] = value;
9355
+ }
9356
+ return { ok: true, props: resolved };
9357
+ }
9358
+
9304
9359
  // src/runtime/run-flow.ts
9305
9360
  async function runFlow(graph, executors, onEvent = () => {
9306
9361
  }, options = {}) {
@@ -9316,6 +9371,13 @@ async function runFlow(graph, executors, onEvent = () => {
9316
9371
  onEvent({ type: "run-error", error: msg });
9317
9372
  return { ok: false, outputs, error: msg };
9318
9373
  }
9374
+ const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
9375
+ if (!propsCheck.ok) {
9376
+ onEvent({ type: "run-error", error: propsCheck.error });
9377
+ return { ok: false, outputs, error: propsCheck.error };
9378
+ }
9379
+ const props = propsCheck.props;
9380
+ const declaresProps = (graph.inputs?.length ?? 0) > 0;
9319
9381
  const incomingByNode = indexIncoming(graph.edges);
9320
9382
  const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
9321
9383
  onEvent({ type: "run-start" });
@@ -9357,10 +9419,11 @@ async function runFlow(graph, executors, onEvent = () => {
9357
9419
  }
9358
9420
  onEvent({ type: "node-status", nodeId: node.id, status: "running" });
9359
9421
  announce(onEvent, node, "start");
9360
- const inputs = collectInputs(node, incoming, portValues, initialInputs);
9422
+ const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
9361
9423
  const exec = pickExecutor(executors, node);
9362
9424
  if (!exec) {
9363
- const msg = `No executor registered for kind=${node.type}`;
9425
+ const tried = executorLookupIds(node);
9426
+ const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")} and the wildcard "*". Key your registry by one of those.`;
9364
9427
  errors.push(msg);
9365
9428
  onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
9366
9429
  onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
@@ -9434,8 +9497,13 @@ function topoSort(graph) {
9434
9497
  const byId = new Map(graph.nodes.map((n) => [n.id, n]));
9435
9498
  return ordered.map((id2) => byId.get(id2)).filter(Boolean);
9436
9499
  }
9437
- function collectInputs(node, incoming, portValues, initial) {
9500
+ function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
9438
9501
  const inputs = { ...initial[node.id] ?? {} };
9502
+ if (incoming.length === 0) {
9503
+ for (const [name, value] of Object.entries(props)) {
9504
+ if (!(name in inputs)) inputs[name] = value;
9505
+ }
9506
+ }
9439
9507
  for (const e of incoming) {
9440
9508
  const portId = e.targetHandle ?? "in";
9441
9509
  const key = `${e.source}:${e.sourceHandle ?? "out"}`;
@@ -9445,16 +9513,31 @@ function collectInputs(node, incoming, portValues, initial) {
9445
9513
  inputs[e.source] = portValues.get(key);
9446
9514
  }
9447
9515
  }
9516
+ if (declaresProps) inputs.$props = props;
9448
9517
  return inputs;
9449
9518
  }
9519
+ function executorLookupIds(node) {
9520
+ const ids = [node.id];
9521
+ if (node.type) ids.push(node.type);
9522
+ const declared = node.data?.kind;
9523
+ const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9524
+ if (kindName && kindName !== node.type) ids.push(kindName);
9525
+ for (const name of [kindName, node.type]) {
9526
+ const kind = name ? getNodeKind(name) : null;
9527
+ if (!kind) continue;
9528
+ for (const id2 of kindIds(kind)) ids.push(id2);
9529
+ }
9530
+ return [...new Set(ids)];
9531
+ }
9450
9532
  function pickExecutor(executors, node) {
9451
9533
  if (executors[node.id]) return executors[node.id];
9452
9534
  if (node.type && executors[node.type]) return executors[node.type];
9453
9535
  const declared = node.data?.kind;
9454
9536
  const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9455
9537
  if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
9456
- const kind = kindName ? getNodeKind(kindName) : null;
9457
- if (kind) {
9538
+ for (const name of [kindName, node.type]) {
9539
+ const kind = name ? getNodeKind(name) : null;
9540
+ if (!kind) continue;
9458
9541
  for (const id2 of kindIds(kind)) {
9459
9542
  if (executors[id2]) return executors[id2];
9460
9543
  }
@@ -10624,5 +10707,5 @@ function LaneNodeInner(props) {
10624
10707
  var LaneNode = memo(LaneNodeInner);
10625
10708
 
10626
10709
  export { BUILTIN_KINDS, Background, BackgroundVariant, Controls, DEFAULT_MAX_DEPTH, FlowEditorProvider, Handle, LaneNode, MiniMap, NodeResizer, NodeToolbar, NoteNode, Position, ReactFlowProvider, RunIdentity, ViewportPortal, addEdge2 as addEdge, applyEdgeChanges, applyNodeChanges, categoryAccent, clearNodeKindOverrides, declaredRoutes, defaultConfigFor, ensureBuiltinKinds, escapeSegment, getNodeKind, index, kindIds, listNodeKinds, llmRouterExecutor, nodeConfig, onNodeKindsChanged, overrideNodeKind, reconnectEdge2 as reconnectEdge, registerBuiltinKinds, registerNodeKind, resolveFallbackPort, resolveKindId, resolveNodePorts, resolvePortSpec, runFlow, subflowExecutor, subflowMode, subflowPorts, useFlowEditor, useFlowEditorOptional, useReactFlow, validateConfig };
10627
- //# sourceMappingURL=chunk-XJMWMU4J.js.map
10628
- //# sourceMappingURL=chunk-XJMWMU4J.js.map
10710
+ //# sourceMappingURL=chunk-4GO2CHAY.js.map
10711
+ //# sourceMappingURL=chunk-4GO2CHAY.js.map