@particle-academy/fancy-flow 0.49.0 → 0.51.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 (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-6XKR65XM.js → chunk-6AI6CBNL.js} +3 -3
  8. package/dist/{chunk-6XKR65XM.js.map → chunk-6AI6CBNL.js.map} +1 -1
  9. package/dist/{chunk-AVRGZFXG.js → chunk-7XTTXMGB.js} +4 -4
  10. package/dist/{chunk-AVRGZFXG.js.map → chunk-7XTTXMGB.js.map} +1 -1
  11. package/dist/{chunk-UL3DGSSG.js → chunk-HXGGCMR7.js} +3 -3
  12. package/dist/{chunk-UL3DGSSG.js.map → chunk-HXGGCMR7.js.map} +1 -1
  13. package/dist/{chunk-YOK3WKWC.js → chunk-LH76EIFL.js} +18 -4
  14. package/dist/chunk-LH76EIFL.js.map +1 -0
  15. package/dist/{chunk-VUL7CUFW.js → chunk-SKEZ5AGI.js} +3 -3
  16. package/dist/{chunk-VUL7CUFW.js.map → chunk-SKEZ5AGI.js.map} +1 -1
  17. package/dist/{chunk-6FP3F5YR.js → chunk-XCT2CJ5O.js} +75 -4
  18. package/dist/chunk-XCT2CJ5O.js.map +1 -0
  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 +73 -2
  24. package/dist/durable.cjs.map +1 -1
  25. package/dist/durable.js +1 -1
  26. package/dist/engine.cjs +73 -2
  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 +88 -3
  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 +73 -2
  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 +73 -2
  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 +88 -3
  63. package/dist/schema.cjs.map +1 -1
  64. package/dist/schema.js +2 -2
  65. package/dist/screens.cjs +73 -2
  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.ts → types-JFYjPJAG.d.cts} +37 -1
  72. package/dist/{types-7cXcSQlx.d.cts → types-JFYjPJAG.d.ts} +37 -1
  73. package/dist/{types-CDgIIj4c.d.ts → types-s643U1Hi.d.ts} +1 -1
  74. package/dist/ux.cjs +73 -2
  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-6FP3F5YR.js.map +0 -1
  81. package/dist/chunk-YOK3WKWC.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { C as ConfigField, N as NodeKindDefinition, O as OutputField } from './types-BtMOnb9I.cjs';
1
+ import { C as ConfigField, N as NodeKindDefinition, O as OutputField } from './types-3sPauVRT.cjs';
2
2
  import 'react';
3
- import './types-7cXcSQlx.cjs';
3
+ import './types-JFYjPJAG.cjs';
4
4
  import '@xyflow/react';
5
5
  import './pause-9iT4tCEV.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
- import { C as ConfigField, N as NodeKindDefinition, O as OutputField } from './types-CDgIIj4c.js';
1
+ import { C as ConfigField, N as NodeKindDefinition, O as OutputField } from './types-s643U1Hi.js';
2
2
  import 'react';
3
- import './types-7cXcSQlx.js';
3
+ import './types-JFYjPJAG.js';
4
4
  import '@xyflow/react';
5
5
  import './pause-9iT4tCEV.js';
6
6
 
@@ -1,5 +1,5 @@
1
- import { F as FlowGraph, R as RunEvent, b as RunIdentity, E as ExecutorRegistry, a as FlowNode, N as NodeExecutor, c as RunIdentityJson } from '../types-7cXcSQlx.cjs';
2
- import { a as RunResult } from '../run-flow-B24QUO1H.cjs';
1
+ import { F as FlowGraph, R as RunEvent, b as RunIdentity, E as ExecutorRegistry, a as FlowNode, N as NodeExecutor, c as RunIdentityJson } from '../types-JFYjPJAG.cjs';
2
+ import { a as RunResult } from '../run-flow-COdAOFg2.cjs';
3
3
  import { b as PauseSignal } from '../pause-9iT4tCEV.cjs';
4
4
  import '@xyflow/react';
5
5
 
@@ -1,5 +1,5 @@
1
- import { F as FlowGraph, R as RunEvent, b as RunIdentity, E as ExecutorRegistry, a as FlowNode, N as NodeExecutor, c as RunIdentityJson } from '../types-7cXcSQlx.js';
2
- import { a as RunResult } from '../run-flow-DPUPAWk6.js';
1
+ import { F as FlowGraph, R as RunEvent, b as RunIdentity, E as ExecutorRegistry, a as FlowNode, N as NodeExecutor, c as RunIdentityJson } from '../types-JFYjPJAG.js';
2
+ import { a as RunResult } from '../run-flow-DJ7KYT6E.js';
3
3
  import { b as PauseSignal } from '../pause-9iT4tCEV.js';
4
4
  import '@xyflow/react';
5
5
 
package/dist/durable.cjs CHANGED
@@ -9329,6 +9329,61 @@ var RunIdentity = class _RunIdentity {
9329
9329
  }
9330
9330
  };
9331
9331
 
9332
+ // src/runtime/workflow-props.ts
9333
+ function typeOf(value) {
9334
+ if (value === null) return "null";
9335
+ if (Array.isArray(value)) return "array";
9336
+ return typeof value;
9337
+ }
9338
+ function resolveWorkflowProps(declared, passed) {
9339
+ const inputs = declared ?? [];
9340
+ const given = passed ?? {};
9341
+ const byName = new Map(inputs.map((input) => [input.name, input]));
9342
+ for (const name of Object.keys(given)) {
9343
+ if (!byName.has(name)) {
9344
+ const known = inputs.map((input) => input.name);
9345
+ const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
9346
+ return {
9347
+ ok: false,
9348
+ code: "unknown_input",
9349
+ error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
9350
+ };
9351
+ }
9352
+ }
9353
+ const resolved = {};
9354
+ for (const input of inputs) {
9355
+ const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
9356
+ const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
9357
+ if (!supplied) {
9358
+ if (hasDefault) {
9359
+ resolved[input.name] = input.default;
9360
+ continue;
9361
+ }
9362
+ if (input.required) {
9363
+ return {
9364
+ ok: false,
9365
+ code: "missing_required",
9366
+ error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
9367
+ };
9368
+ }
9369
+ continue;
9370
+ }
9371
+ const value = given[input.name];
9372
+ if (input.type !== void 0) {
9373
+ const actual = typeOf(value);
9374
+ if (actual !== input.type) {
9375
+ return {
9376
+ ok: false,
9377
+ code: "type_mismatch",
9378
+ error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
9379
+ };
9380
+ }
9381
+ }
9382
+ resolved[input.name] = value;
9383
+ }
9384
+ return { ok: true, props: resolved };
9385
+ }
9386
+
9332
9387
  // src/runtime/run-flow.ts
9333
9388
  async function runFlow(graph, executors, onEvent = () => {
9334
9389
  }, options = {}) {
@@ -9344,6 +9399,13 @@ async function runFlow(graph, executors, onEvent = () => {
9344
9399
  onEvent({ type: "run-error", error: msg });
9345
9400
  return { ok: false, outputs, error: msg };
9346
9401
  }
9402
+ const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
9403
+ if (!propsCheck.ok) {
9404
+ onEvent({ type: "run-error", error: propsCheck.error });
9405
+ return { ok: false, outputs, error: propsCheck.error };
9406
+ }
9407
+ const props = propsCheck.props;
9408
+ const declaresProps = (graph.inputs?.length ?? 0) > 0;
9347
9409
  const incomingByNode = indexIncoming(graph.edges);
9348
9410
  const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
9349
9411
  onEvent({ type: "run-start" });
@@ -9385,7 +9447,7 @@ async function runFlow(graph, executors, onEvent = () => {
9385
9447
  }
9386
9448
  onEvent({ type: "node-status", nodeId: node.id, status: "running" });
9387
9449
  announce(onEvent, node, "start");
9388
- const inputs = collectInputs(node, incoming, portValues, initialInputs);
9450
+ const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
9389
9451
  const exec = pickExecutor(executors, node);
9390
9452
  if (!exec) {
9391
9453
  const msg = `No executor registered for kind=${node.type}`;
@@ -9462,14 +9524,23 @@ function topoSort(graph) {
9462
9524
  const byId = new Map(graph.nodes.map((n) => [n.id, n]));
9463
9525
  return ordered.map((id2) => byId.get(id2)).filter(Boolean);
9464
9526
  }
9465
- function collectInputs(node, incoming, portValues, initial) {
9527
+ function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
9466
9528
  const inputs = { ...initial[node.id] ?? {} };
9529
+ if (incoming.length === 0) {
9530
+ for (const [name, value] of Object.entries(props)) {
9531
+ if (!(name in inputs)) inputs[name] = value;
9532
+ }
9533
+ }
9467
9534
  for (const e of incoming) {
9468
9535
  const portId = e.targetHandle ?? "in";
9469
9536
  const key = `${e.source}:${e.sourceHandle ?? "out"}`;
9470
9537
  if (!portValues.has(key)) continue;
9471
9538
  inputs[portId] = portValues.get(key);
9539
+ if (e.targetHandle == null && !(e.source in inputs)) {
9540
+ inputs[e.source] = portValues.get(key);
9541
+ }
9472
9542
  }
9543
+ if (declaresProps) inputs.$props = props;
9473
9544
  return inputs;
9474
9545
  }
9475
9546
  function pickExecutor(executors, node) {