@particle-academy/fancy-flow 0.50.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-I4F6GI3A.js → chunk-6AI6CBNL.js} +3 -3
  8. package/dist/{chunk-I4F6GI3A.js.map → chunk-6AI6CBNL.js.map} +1 -1
  9. package/dist/{chunk-OWDSPRAF.js → chunk-7XTTXMGB.js} +4 -4
  10. package/dist/{chunk-OWDSPRAF.js.map → chunk-7XTTXMGB.js.map} +1 -1
  11. package/dist/{chunk-BAHJVX3S.js → chunk-HXGGCMR7.js} +3 -3
  12. package/dist/{chunk-BAHJVX3S.js.map → chunk-HXGGCMR7.js.map} +1 -1
  13. package/dist/{chunk-3W26FA7Q.js → chunk-LH76EIFL.js} +18 -4
  14. package/dist/chunk-LH76EIFL.js.map +1 -0
  15. package/dist/{chunk-DQJIU55F.js → chunk-SKEZ5AGI.js} +3 -3
  16. package/dist/{chunk-DQJIU55F.js.map → chunk-SKEZ5AGI.js.map} +1 -1
  17. package/dist/{chunk-XJMWMU4J.js → chunk-XCT2CJ5O.js} +72 -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 +70 -2
  24. package/dist/durable.cjs.map +1 -1
  25. package/dist/durable.js +1 -1
  26. package/dist/engine.cjs +70 -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 +85 -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 +70 -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 +70 -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 +85 -3
  63. package/dist/schema.cjs.map +1 -1
  64. package/dist/schema.js +2 -2
  65. package/dist/screens.cjs +70 -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.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 +70 -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-3W26FA7Q.js.map +0 -1
  81. package/dist/chunk-XJMWMU4J.js.map +0 -1
package/dist/engine.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-B24QUO1H.cjs';
2
- import { F as FlowGraph, R as RunEvent, N as NodeExecutor } from './types-7cXcSQlx.cjs';
3
- export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, d as FlowEdge, a as FlowNode, e as FlowNodeData, f as FlowNodeKind, g as NodeRunStatus, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, b as RunIdentity, c as RunIdentityJson, S as SubgraphNodeData, T as TriggerNodeData, i as escapeSegment } from './types-7cXcSQlx.cjs';
4
- export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-DYCL8Qv6.cjs';
5
- export { d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, a as resolveKindId, v as validateConfig } from './registry-DQh7ZmnM.cjs';
6
- export { b as CapabilityRequirement, C as ConfigField, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-BtMOnb9I.cjs';
1
+ export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-COdAOFg2.cjs';
2
+ import { F as FlowGraph, R as RunEvent, N as NodeExecutor } from './types-JFYjPJAG.cjs';
3
+ export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, d as FlowEdge, a as FlowNode, e as FlowNodeData, f as FlowNodeKind, g as NodeRunStatus, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, b as RunIdentity, c as RunIdentityJson, S as SubgraphNodeData, T as TriggerNodeData, i as escapeSegment } from './types-JFYjPJAG.cjs';
4
+ export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-r-L8dMED.cjs';
5
+ export { d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, a as resolveKindId, v as validateConfig } from './registry-C6TMfiD_.cjs';
6
+ export { b as CapabilityRequirement, C as ConfigField, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-3sPauVRT.cjs';
7
7
  import { P as PauseAwaiting } from './pause-9iT4tCEV.cjs';
8
8
  export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.cjs';
9
- import { W as WorkflowResolver } from './capabilities-VzgDApur.cjs';
9
+ import { W as WorkflowResolver } from './capabilities-BYa5p5jw.cjs';
10
10
  import '@xyflow/react';
11
11
  import 'react';
12
12
 
package/dist/engine.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-DPUPAWk6.js';
2
- import { F as FlowGraph, R as RunEvent, N as NodeExecutor } from './types-7cXcSQlx.js';
3
- export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, d as FlowEdge, a as FlowNode, e as FlowNodeData, f as FlowNodeKind, g as NodeRunStatus, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, b as RunIdentity, c as RunIdentityJson, S as SubgraphNodeData, T as TriggerNodeData, i as escapeSegment } from './types-7cXcSQlx.js';
4
- export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-VX4JG21l.js';
5
- export { d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, a as resolveKindId, v as validateConfig } from './registry-6cB5wCv6.js';
6
- export { b as CapabilityRequirement, C as ConfigField, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-CDgIIj4c.js';
1
+ export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-DJ7KYT6E.js';
2
+ import { F as FlowGraph, R as RunEvent, N as NodeExecutor } from './types-JFYjPJAG.js';
3
+ export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, d as FlowEdge, a as FlowNode, e as FlowNodeData, f as FlowNodeKind, g as NodeRunStatus, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, b as RunIdentity, c as RunIdentityJson, S as SubgraphNodeData, T as TriggerNodeData, i as escapeSegment } from './types-JFYjPJAG.js';
4
+ export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-BPIOpE8A.js';
5
+ export { d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, a as resolveKindId, v as validateConfig } from './registry-3RkSYrMi.js';
6
+ export { b as CapabilityRequirement, C as ConfigField, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-s643U1Hi.js';
7
7
  import { P as PauseAwaiting } from './pause-9iT4tCEV.js';
8
8
  export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.js';
9
- import { W as WorkflowResolver } from './capabilities-B00VXLUp.js';
9
+ import { W as WorkflowResolver } from './capabilities-COOXRiNL.js';
10
10
  import '@xyflow/react';
11
11
  import 'react';
12
12
 
package/dist/engine.js CHANGED
@@ -1,8 +1,8 @@
1
- export { runCohort } from './chunk-DQJIU55F.js';
1
+ export { runCohort } from './chunk-SKEZ5AGI.js';
2
2
  import { decodePause } from './chunk-UEOE6B52.js';
3
3
  export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
4
- import { runFlow, getNodeKind, resolveNodePorts } from './chunk-XJMWMU4J.js';
5
- export { RunIdentity, defaultConfigFor, escapeSegment, getNodeKind, kindIds, listNodeKinds, registerNodeKind, resolveKindId, runFlow, validateConfig } from './chunk-XJMWMU4J.js';
4
+ import { runFlow, getNodeKind, resolveNodePorts } from './chunk-XCT2CJ5O.js';
5
+ export { RunIdentity, defaultConfigFor, escapeSegment, getNodeKind, kindIds, listNodeKinds, registerNodeKind, resolveKindId, runFlow, validateConfig } from './chunk-XCT2CJ5O.js';
6
6
  import './chunk-F5RPRB7A.js';
7
7
  import { isResolutionFailure, registerLlmClient, registerWorkflowResolver } from './chunk-USL4FMFU.js';
8
8
 
@@ -1,8 +1,8 @@
1
- import { C as ConfigFieldRenderFn } from '../ConfigFieldRenderer-CrXFq6Eb.cjs';
1
+ import { C as ConfigFieldRenderFn } from '../ConfigFieldRenderer-Bc9Txnql.cjs';
2
2
  import 'react';
3
- import '../types-7cXcSQlx.cjs';
3
+ import '../types-JFYjPJAG.cjs';
4
4
  import '@xyflow/react';
5
- import '../types-BtMOnb9I.cjs';
5
+ import '../types-3sPauVRT.cjs';
6
6
  import '../pause-9iT4tCEV.cjs';
7
7
 
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { C as ConfigFieldRenderFn } from '../ConfigFieldRenderer-u3nYHovX.js';
1
+ import { C as ConfigFieldRenderFn } from '../ConfigFieldRenderer-Bt3RGT7Z.js';
2
2
  import 'react';
3
- import '../types-7cXcSQlx.js';
3
+ import '../types-JFYjPJAG.js';
4
4
  import '@xyflow/react';
5
- import '../types-CDgIIj4c.js';
5
+ import '../types-s643U1Hi.js';
6
6
  import '../pause-9iT4tCEV.js';
7
7
 
8
8
  /**
package/dist/index.cjs CHANGED
@@ -11098,6 +11098,61 @@ var RunIdentity = class _RunIdentity {
11098
11098
  }
11099
11099
  };
11100
11100
 
11101
+ // src/runtime/workflow-props.ts
11102
+ function typeOf(value) {
11103
+ if (value === null) return "null";
11104
+ if (Array.isArray(value)) return "array";
11105
+ return typeof value;
11106
+ }
11107
+ function resolveWorkflowProps(declared, passed) {
11108
+ const inputs = declared ?? [];
11109
+ const given = passed ?? {};
11110
+ const byName = new Map(inputs.map((input) => [input.name, input]));
11111
+ for (const name of Object.keys(given)) {
11112
+ if (!byName.has(name)) {
11113
+ const known = inputs.map((input) => input.name);
11114
+ const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
11115
+ return {
11116
+ ok: false,
11117
+ code: "unknown_input",
11118
+ error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
11119
+ };
11120
+ }
11121
+ }
11122
+ const resolved = {};
11123
+ for (const input of inputs) {
11124
+ const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
11125
+ const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
11126
+ if (!supplied) {
11127
+ if (hasDefault) {
11128
+ resolved[input.name] = input.default;
11129
+ continue;
11130
+ }
11131
+ if (input.required) {
11132
+ return {
11133
+ ok: false,
11134
+ code: "missing_required",
11135
+ error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
11136
+ };
11137
+ }
11138
+ continue;
11139
+ }
11140
+ const value = given[input.name];
11141
+ if (input.type !== void 0) {
11142
+ const actual = typeOf(value);
11143
+ if (actual !== input.type) {
11144
+ return {
11145
+ ok: false,
11146
+ code: "type_mismatch",
11147
+ error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
11148
+ };
11149
+ }
11150
+ }
11151
+ resolved[input.name] = value;
11152
+ }
11153
+ return { ok: true, props: resolved };
11154
+ }
11155
+
11101
11156
  // src/runtime/run-flow.ts
11102
11157
  async function runFlow(graph, executors, onEvent = () => {
11103
11158
  }, options = {}) {
@@ -11113,6 +11168,13 @@ async function runFlow(graph, executors, onEvent = () => {
11113
11168
  onEvent({ type: "run-error", error: msg });
11114
11169
  return { ok: false, outputs, error: msg };
11115
11170
  }
11171
+ const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
11172
+ if (!propsCheck.ok) {
11173
+ onEvent({ type: "run-error", error: propsCheck.error });
11174
+ return { ok: false, outputs, error: propsCheck.error };
11175
+ }
11176
+ const props = propsCheck.props;
11177
+ const declaresProps = (graph.inputs?.length ?? 0) > 0;
11116
11178
  const incomingByNode = indexIncoming(graph.edges);
11117
11179
  const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
11118
11180
  onEvent({ type: "run-start" });
@@ -11154,7 +11216,7 @@ async function runFlow(graph, executors, onEvent = () => {
11154
11216
  }
11155
11217
  onEvent({ type: "node-status", nodeId: node.id, status: "running" });
11156
11218
  announce(onEvent, node, "start");
11157
- const inputs = collectInputs(node, incoming, portValues, initialInputs);
11219
+ const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
11158
11220
  const exec = pickExecutor(executors, node);
11159
11221
  if (!exec) {
11160
11222
  const msg = `No executor registered for kind=${node.type}`;
@@ -11231,8 +11293,13 @@ function topoSort(graph) {
11231
11293
  const byId = new Map(graph.nodes.map((n) => [n.id, n]));
11232
11294
  return ordered.map((id2) => byId.get(id2)).filter(Boolean);
11233
11295
  }
11234
- function collectInputs(node, incoming, portValues, initial) {
11296
+ function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
11235
11297
  const inputs = { ...initial[node.id] ?? {} };
11298
+ if (incoming.length === 0) {
11299
+ for (const [name, value] of Object.entries(props)) {
11300
+ if (!(name in inputs)) inputs[name] = value;
11301
+ }
11302
+ }
11236
11303
  for (const e of incoming) {
11237
11304
  const portId = e.targetHandle ?? "in";
11238
11305
  const key = `${e.source}:${e.sourceHandle ?? "out"}`;
@@ -11242,6 +11309,7 @@ function collectInputs(node, incoming, portValues, initial) {
11242
11309
  inputs[e.source] = portValues.get(key);
11243
11310
  }
11244
11311
  }
11312
+ if (declaresProps) inputs.$props = props;
11245
11313
  return inputs;
11246
11314
  }
11247
11315
  function pickExecutor(executors, node) {
@@ -14116,6 +14184,9 @@ function exportWorkflow(graph, metadata, view) {
14116
14184
  $schema: WORKFLOW_SCHEMA_URL,
14117
14185
  version: WORKFLOW_SCHEMA_VERSION,
14118
14186
  metadata: metadata ? { ...metadata, updatedAt: Date.now() } : void 0,
14187
+ // Round-trips, or a saved workflow silently forgets its own contract and
14188
+ // every caller's props become "unknown input" on the next load.
14189
+ ...graph.inputs && graph.inputs.length > 0 ? { inputs: graph.inputs } : {},
14119
14190
  graph: {
14120
14191
  nodes: graph.nodes.map(toSchemaNode),
14121
14192
  edges: graph.edges.map(toSchemaEdge)
@@ -14238,7 +14309,18 @@ function importWorkflow(schema, options = {}) {
14238
14309
  };
14239
14310
  }).filter((e) => e !== null);
14240
14311
  const ok = issues.every((i) => i.level !== "error");
14241
- return { ok, graph: { nodes, edges }, issues };
14312
+ const declaredInputs = Array.isArray(s.inputs) ? s.inputs.filter(
14313
+ (input) => input !== null && typeof input === "object" && typeof input.name === "string"
14314
+ ) : void 0;
14315
+ return {
14316
+ ok,
14317
+ graph: {
14318
+ nodes,
14319
+ edges,
14320
+ ...declaredInputs && declaredInputs.length > 0 ? { inputs: declaredInputs } : {}
14321
+ },
14322
+ issues
14323
+ };
14242
14324
  }
14243
14325
  function workflowToBlob(schema) {
14244
14326
  return new Blob([JSON.stringify(schema, null, 2)], { type: "application/json" });