@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
package/dist/registry.js CHANGED
@@ -1,6 +1,6 @@
1
- export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility } from './chunk-6XKR65XM.js';
1
+ export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility } from './chunk-6AI6CBNL.js';
2
2
  export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
3
- export { BUILTIN_KINDS, DEFAULT_MAX_DEPTH, categoryAccent, clearNodeKindOverrides, declaredRoutes, defaultConfigFor, ensureBuiltinKinds, getNodeKind, kindIds, listNodeKinds, llmRouterExecutor as llmBranchExecutor, llmRouterExecutor, nodeConfig, onNodeKindsChanged, overrideNodeKind, registerBuiltinKinds, registerNodeKind, resolveFallbackPort, resolveKindId, resolveNodePorts, resolvePortSpec, subflowExecutor, subflowMode, subflowPorts, validateConfig } from './chunk-6FP3F5YR.js';
3
+ export { BUILTIN_KINDS, DEFAULT_MAX_DEPTH, categoryAccent, clearNodeKindOverrides, declaredRoutes, defaultConfigFor, ensureBuiltinKinds, getNodeKind, kindIds, listNodeKinds, llmRouterExecutor as llmBranchExecutor, llmRouterExecutor, nodeConfig, onNodeKindsChanged, overrideNodeKind, registerBuiltinKinds, registerNodeKind, resolveFallbackPort, resolveKindId, resolveNodePorts, resolvePortSpec, subflowExecutor, subflowMode, subflowPorts, validateConfig } from './chunk-XCT2CJ5O.js';
4
4
  export { RichInputPreview, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerRichInputAdapter } from './chunk-F5RPRB7A.js';
5
5
  export { capabilityStatus, getLlmClient, getWorkflowResolver, isResolutionFailure, registerLlmClient, registerWorkflowResolver } from './chunk-USL4FMFU.js';
6
6
  //# sourceMappingURL=registry.js.map
@@ -1,5 +1,5 @@
1
- import { F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-7cXcSQlx.js';
2
- import { R as RunOptions, a as RunResult } from './run-flow-DPUPAWk6.js';
1
+ import { F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-JFYjPJAG.js';
2
+ import { R as RunOptions, a as RunResult } from './run-flow-DJ7KYT6E.js';
3
3
 
4
4
  /**
5
5
  * How the flows one trigger fired should treat each other.
@@ -1,5 +1,5 @@
1
- import { F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-7cXcSQlx.cjs';
2
- import { R as RunOptions, a as RunResult } from './run-flow-B24QUO1H.cjs';
1
+ import { F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-JFYjPJAG.cjs';
2
+ import { R as RunOptions, a as RunResult } from './run-flow-COdAOFg2.cjs';
3
3
 
4
4
  /**
5
5
  * How the flows one trigger fired should treat each other.
@@ -1,4 +1,4 @@
1
- import { b as RunIdentity, c as RunIdentityJson, F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-7cXcSQlx.cjs';
1
+ import { b as RunIdentity, c as RunIdentityJson, F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-JFYjPJAG.cjs';
2
2
 
3
3
  type RunOptions = {
4
4
  /** Stop the run after this many ms. Default: no timeout. */
@@ -7,6 +7,15 @@ type RunOptions = {
7
7
  signal?: AbortSignal;
8
8
  /** Initial inputs supplied to entry-point nodes (no incoming edges). */
9
9
  initialInputs?: Record<string, Record<string, unknown>>;
10
+ /**
11
+ * Values for the inputs the graph DECLARES, passed by name.
12
+ *
13
+ * The flat, node-id-free way to configure a run. `initialInputs` is keyed by
14
+ * node id, so a caller had to know the trigger was called `t` and a rename
15
+ * broke every caller while the graph stayed valid. Props are checked against
16
+ * `graph.inputs`, so a misspelling fails the run instead of sitting unread.
17
+ */
18
+ props?: Record<string, unknown>;
10
19
  /** Nesting depth — set by `subflow` when it runs a child graph. */
11
20
  depth?: number;
12
21
  /**
@@ -1,4 +1,4 @@
1
- import { b as RunIdentity, c as RunIdentityJson, F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-7cXcSQlx.js';
1
+ import { b as RunIdentity, c as RunIdentityJson, F as FlowGraph, E as ExecutorRegistry, R as RunEvent } from './types-JFYjPJAG.js';
2
2
 
3
3
  type RunOptions = {
4
4
  /** Stop the run after this many ms. Default: no timeout. */
@@ -7,6 +7,15 @@ type RunOptions = {
7
7
  signal?: AbortSignal;
8
8
  /** Initial inputs supplied to entry-point nodes (no incoming edges). */
9
9
  initialInputs?: Record<string, Record<string, unknown>>;
10
+ /**
11
+ * Values for the inputs the graph DECLARES, passed by name.
12
+ *
13
+ * The flat, node-id-free way to configure a run. `initialInputs` is keyed by
14
+ * node id, so a caller had to know the trigger was called `t` and a rename
15
+ * broke every caller while the graph stayed valid. Props are checked against
16
+ * `graph.inputs`, so a misspelling fails the run instead of sitting unread.
17
+ */
18
+ props?: Record<string, unknown>;
10
19
  /** Nesting depth — set by `subflow` when it runs a child graph. */
11
20
  depth?: number;
12
21
  /**
@@ -1,8 +1,8 @@
1
- import { a as RunResult, R as RunOptions } from '../run-flow-B24QUO1H.cjs';
2
- export { r as runFlow } from '../run-flow-B24QUO1H.cjs';
3
- import { g as NodeRunStatus, F as FlowGraph, E as ExecutorRegistry, a as FlowNode, d as FlowEdge } from '../types-7cXcSQlx.cjs';
4
- export { b as RunIdentity, c as RunIdentityJson, i as escapeSegment } from '../types-7cXcSQlx.cjs';
5
- export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from '../run-cohort-DYCL8Qv6.cjs';
1
+ import { a as RunResult, R as RunOptions } from '../run-flow-COdAOFg2.cjs';
2
+ export { r as runFlow } from '../run-flow-COdAOFg2.cjs';
3
+ import { g as NodeRunStatus, F as FlowGraph, E as ExecutorRegistry, a as FlowNode, d as FlowEdge } from '../types-JFYjPJAG.cjs';
4
+ export { b as RunIdentity, c as RunIdentityJson, i as escapeSegment } from '../types-JFYjPJAG.cjs';
5
+ export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from '../run-cohort-r-L8dMED.cjs';
6
6
  import { NodeChange, EdgeChange, Connection } from '@xyflow/react';
7
7
 
8
8
  type FlowRunFeedEntry = {
@@ -1,8 +1,8 @@
1
- import { a as RunResult, R as RunOptions } from '../run-flow-DPUPAWk6.js';
2
- export { r as runFlow } from '../run-flow-DPUPAWk6.js';
3
- import { g as NodeRunStatus, F as FlowGraph, E as ExecutorRegistry, a as FlowNode, d as FlowEdge } from '../types-7cXcSQlx.js';
4
- export { b as RunIdentity, c as RunIdentityJson, i as escapeSegment } from '../types-7cXcSQlx.js';
5
- export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from '../run-cohort-VX4JG21l.js';
1
+ import { a as RunResult, R as RunOptions } from '../run-flow-DJ7KYT6E.js';
2
+ export { r as runFlow } from '../run-flow-DJ7KYT6E.js';
3
+ import { g as NodeRunStatus, F as FlowGraph, E as ExecutorRegistry, a as FlowNode, d as FlowEdge } from '../types-JFYjPJAG.js';
4
+ export { b as RunIdentity, c as RunIdentityJson, i as escapeSegment } from '../types-JFYjPJAG.js';
5
+ export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from '../run-cohort-BPIOpE8A.js';
6
6
  import { NodeChange, EdgeChange, Connection } from '@xyflow/react';
7
7
 
8
8
  type FlowRunFeedEntry = {
package/dist/runtime.cjs CHANGED
@@ -10224,6 +10224,61 @@ var RunIdentity = class _RunIdentity {
10224
10224
  }
10225
10225
  };
10226
10226
 
10227
+ // src/runtime/workflow-props.ts
10228
+ function typeOf(value) {
10229
+ if (value === null) return "null";
10230
+ if (Array.isArray(value)) return "array";
10231
+ return typeof value;
10232
+ }
10233
+ function resolveWorkflowProps(declared, passed) {
10234
+ const inputs = declared ?? [];
10235
+ const given = passed ?? {};
10236
+ const byName = new Map(inputs.map((input) => [input.name, input]));
10237
+ for (const name of Object.keys(given)) {
10238
+ if (!byName.has(name)) {
10239
+ const known = inputs.map((input) => input.name);
10240
+ const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
10241
+ return {
10242
+ ok: false,
10243
+ code: "unknown_input",
10244
+ error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
10245
+ };
10246
+ }
10247
+ }
10248
+ const resolved = {};
10249
+ for (const input of inputs) {
10250
+ const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
10251
+ const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
10252
+ if (!supplied) {
10253
+ if (hasDefault) {
10254
+ resolved[input.name] = input.default;
10255
+ continue;
10256
+ }
10257
+ if (input.required) {
10258
+ return {
10259
+ ok: false,
10260
+ code: "missing_required",
10261
+ error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
10262
+ };
10263
+ }
10264
+ continue;
10265
+ }
10266
+ const value = given[input.name];
10267
+ if (input.type !== void 0) {
10268
+ const actual = typeOf(value);
10269
+ if (actual !== input.type) {
10270
+ return {
10271
+ ok: false,
10272
+ code: "type_mismatch",
10273
+ error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
10274
+ };
10275
+ }
10276
+ }
10277
+ resolved[input.name] = value;
10278
+ }
10279
+ return { ok: true, props: resolved };
10280
+ }
10281
+
10227
10282
  // src/runtime/run-flow.ts
10228
10283
  async function runFlow(graph, executors, onEvent = () => {
10229
10284
  }, options = {}) {
@@ -10239,6 +10294,13 @@ async function runFlow(graph, executors, onEvent = () => {
10239
10294
  onEvent({ type: "run-error", error: msg });
10240
10295
  return { ok: false, outputs, error: msg };
10241
10296
  }
10297
+ const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
10298
+ if (!propsCheck.ok) {
10299
+ onEvent({ type: "run-error", error: propsCheck.error });
10300
+ return { ok: false, outputs, error: propsCheck.error };
10301
+ }
10302
+ const props = propsCheck.props;
10303
+ const declaresProps = (graph.inputs?.length ?? 0) > 0;
10242
10304
  const incomingByNode = indexIncoming(graph.edges);
10243
10305
  const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
10244
10306
  onEvent({ type: "run-start" });
@@ -10280,7 +10342,7 @@ async function runFlow(graph, executors, onEvent = () => {
10280
10342
  }
10281
10343
  onEvent({ type: "node-status", nodeId: node.id, status: "running" });
10282
10344
  announce(onEvent, node, "start");
10283
- const inputs = collectInputs(node, incoming, portValues, initialInputs);
10345
+ const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
10284
10346
  const exec = pickExecutor(executors, node);
10285
10347
  if (!exec) {
10286
10348
  const msg = `No executor registered for kind=${node.type}`;
@@ -10357,14 +10419,23 @@ function topoSort(graph) {
10357
10419
  const byId = new Map(graph.nodes.map((n) => [n.id, n]));
10358
10420
  return ordered.map((id2) => byId.get(id2)).filter(Boolean);
10359
10421
  }
10360
- function collectInputs(node, incoming, portValues, initial) {
10422
+ function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
10361
10423
  const inputs = { ...initial[node.id] ?? {} };
10424
+ if (incoming.length === 0) {
10425
+ for (const [name, value] of Object.entries(props)) {
10426
+ if (!(name in inputs)) inputs[name] = value;
10427
+ }
10428
+ }
10362
10429
  for (const e of incoming) {
10363
10430
  const portId = e.targetHandle ?? "in";
10364
10431
  const key = `${e.source}:${e.sourceHandle ?? "out"}`;
10365
10432
  if (!portValues.has(key)) continue;
10366
10433
  inputs[portId] = portValues.get(key);
10434
+ if (e.targetHandle == null && !(e.source in inputs)) {
10435
+ inputs[e.source] = portValues.get(key);
10436
+ }
10367
10437
  }
10438
+ if (declaresProps) inputs.$props = props;
10368
10439
  return inputs;
10369
10440
  }
10370
10441
  function pickExecutor(executors, node) {