@particle-academy/fancy-flow 0.44.0 → 0.45.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 (41) hide show
  1. package/dist/{ConfigFieldRenderer-LotNHeG8.d.cts → ConfigFieldRenderer-Dzy4f6rG.d.cts} +2 -2
  2. package/dist/{ConfigFieldRenderer-BHQDZer6.d.ts → ConfigFieldRenderer-WqJr-td_.d.ts} +2 -2
  3. package/dist/{FlowViewer-nLqo7s2E.d.cts → FlowViewer-BbbUJe2b.d.cts} +1 -1
  4. package/dist/{FlowViewer-C4QAVgWv.d.ts → FlowViewer-csuaTL5t.d.ts} +1 -1
  5. package/dist/{capabilities-CkhKj_U_.d.ts → capabilities-Brn74URS.d.ts} +2 -2
  6. package/dist/{capabilities-BtJQTbnw.d.cts → capabilities-CYCeIx6I.d.cts} +2 -2
  7. package/dist/engine.cjs +70 -10
  8. package/dist/engine.cjs.map +1 -1
  9. package/dist/engine.d.cts +42 -7
  10. package/dist/engine.d.ts +42 -7
  11. package/dist/engine.js +65 -9
  12. package/dist/engine.js.map +1 -1
  13. package/dist/fields/react-fancy.d.cts +3 -3
  14. package/dist/fields/react-fancy.d.ts +3 -3
  15. package/dist/index.d.cts +10 -10
  16. package/dist/index.d.ts +10 -10
  17. package/dist/layout/index.d.cts +1 -1
  18. package/dist/layout/index.d.ts +1 -1
  19. package/dist/llm/prism.d.cts +2 -2
  20. package/dist/llm/prism.d.ts +2 -2
  21. package/dist/llm/vercel-ai.d.cts +2 -2
  22. package/dist/llm/vercel-ai.d.ts +2 -2
  23. package/dist/registry/index.d.cts +6 -6
  24. package/dist/registry/index.d.ts +6 -6
  25. package/dist/{registry-C9KMVpn7.d.cts → registry-Budds73w.d.cts} +1 -1
  26. package/dist/{registry-FGCBprcn.d.ts → registry-D0I20HJ3.d.ts} +1 -1
  27. package/dist/{run-cohort-BnP6ErHi.d.ts → run-cohort-CV7EcwGG.d.ts} +1 -1
  28. package/dist/{run-cohort-Bjv2ZU6g.d.cts → run-cohort-DitsaYgS.d.cts} +1 -1
  29. package/dist/runtime/index.d.cts +3 -3
  30. package/dist/runtime/index.d.ts +3 -3
  31. package/dist/schema/index.d.cts +1 -1
  32. package/dist/schema/index.d.ts +1 -1
  33. package/dist/screens.d.cts +2 -2
  34. package/dist/screens.d.ts +2 -2
  35. package/dist/{types-sOmpCitB.d.cts → types-CMSrWVYM.d.cts} +1 -1
  36. package/dist/{types-sOmpCitB.d.ts → types-CMSrWVYM.d.ts} +1 -1
  37. package/dist/{types-JViq8reb.d.ts → types-D6ZSKBly.d.ts} +2 -2
  38. package/dist/{types-B78Rm69S.d.cts → types-nQOA8jpk.d.cts} +2 -2
  39. package/dist/ux.d.cts +2 -2
  40. package/dist/ux.d.ts +2 -2
  41. package/package.json +1 -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-sOmpCitB.cjs';
4
- import { a as ConfigField } from './types-B78Rm69S.cjs';
3
+ import { F as FlowGraph } from './types-CMSrWVYM.cjs';
4
+ import { C as ConfigField } from './types-nQOA8jpk.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-sOmpCitB.js';
4
- import { a as ConfigField } from './types-JViq8reb.js';
3
+ import { F as FlowGraph } from './types-CMSrWVYM.js';
4
+ import { C as ConfigField } from './types-D6ZSKBly.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, b as FlowNode } from './types-sOmpCitB.cjs';
3
+ import { F as FlowGraph, a as FlowNode } from './types-CMSrWVYM.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,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { F as FlowGraph, b as FlowNode } from './types-sOmpCitB.js';
3
+ import { F as FlowGraph, a as FlowNode } from './types-CMSrWVYM.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,4 +1,4 @@
1
- import { F as FlowGraph } from './types-sOmpCitB.js';
1
+ import { F as FlowGraph } from './types-CMSrWVYM.js';
2
2
 
3
3
  /**
4
4
  * Host capabilities — the services core nodes need but must never depend on.
@@ -109,4 +109,4 @@ type CapabilityId = "llm" | "workflow_resolver" | "document";
109
109
  */
110
110
  declare function capabilityStatus(): Record<CapabilityId, boolean>;
111
111
 
112
- export { type CapabilityId as C, type LlmClient as L, type WorkflowResolution as W, type LlmRouteRequest as a, type LlmRoute as b, type LlmRouteChoice as c, type WorkflowResolutionFailure as d, type WorkflowResolver as e, capabilityStatus as f, getLlmClient as g, getWorkflowResolver as h, isResolutionFailure as i, registerWorkflowResolver as j, registerLlmClient as r };
112
+ export { type CapabilityId as C, type LlmClient as L, type WorkflowResolver as W, type LlmRouteRequest as a, type LlmRoute as b, type LlmRouteChoice as c, type WorkflowResolution as d, type WorkflowResolutionFailure as e, capabilityStatus as f, getLlmClient as g, getWorkflowResolver as h, isResolutionFailure as i, registerWorkflowResolver as j, registerLlmClient as r };
@@ -1,4 +1,4 @@
1
- import { F as FlowGraph } from './types-sOmpCitB.cjs';
1
+ import { F as FlowGraph } from './types-CMSrWVYM.cjs';
2
2
 
3
3
  /**
4
4
  * Host capabilities — the services core nodes need but must never depend on.
@@ -109,4 +109,4 @@ type CapabilityId = "llm" | "workflow_resolver" | "document";
109
109
  */
110
110
  declare function capabilityStatus(): Record<CapabilityId, boolean>;
111
111
 
112
- export { type CapabilityId as C, type LlmClient as L, type WorkflowResolution as W, type LlmRouteRequest as a, type LlmRoute as b, type LlmRouteChoice as c, type WorkflowResolutionFailure as d, type WorkflowResolver as e, capabilityStatus as f, getLlmClient as g, getWorkflowResolver as h, isResolutionFailure as i, registerWorkflowResolver as j, registerLlmClient as r };
112
+ export { type CapabilityId as C, type LlmClient as L, type WorkflowResolver as W, type LlmRouteRequest as a, type LlmRoute as b, type LlmRouteChoice as c, type WorkflowResolution as d, type WorkflowResolutionFailure as e, capabilityStatus as f, getLlmClient as g, getWorkflowResolver as h, isResolutionFailure as i, registerWorkflowResolver as j, registerLlmClient as r };
package/dist/engine.cjs CHANGED
@@ -280,9 +280,9 @@ function collectInputs(node, incoming, portValues, initial) {
280
280
  const inputs = { ...initial[node.id] ?? {} };
281
281
  for (const e of incoming) {
282
282
  const portId = e.targetHandle ?? "in";
283
- const key = `${e.source}:${e.sourceHandle ?? "out"}`;
284
- if (!portValues.has(key)) continue;
285
- inputs[portId] = portValues.get(key);
283
+ const key2 = `${e.source}:${e.sourceHandle ?? "out"}`;
284
+ if (!portValues.has(key2)) continue;
285
+ inputs[portId] = portValues.get(key2);
286
286
  }
287
287
  return inputs;
288
288
  }
@@ -610,10 +610,10 @@ function checkRuntimeSupport(manifest, hostRuntimes, engineVersions) {
610
610
  }
611
611
  return problems;
612
612
  }
613
- function satisfiesRange(version, range) {
613
+ function satisfiesRange(version2, range) {
614
614
  const trimmed = range.trim();
615
615
  if (trimmed === "*" || trimmed === "") return true;
616
- const v = parseVersion(version);
616
+ const v = parseVersion(version2);
617
617
  if (!v) return false;
618
618
  for (const clause of trimmed.split("||").map((c) => c.trim())) {
619
619
  if (satisfiesClause(v, clause)) return true;
@@ -646,8 +646,8 @@ function satisfiesClause(v, clause) {
646
646
  return false;
647
647
  }
648
648
  }
649
- function parseVersion(version) {
650
- const m = /^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(version.trim());
649
+ function parseVersion(version2) {
650
+ const m = /^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(version2.trim());
651
651
  return m ? [Number(m[1]), Number(m[2]), Number(m[3] ?? 0)] : null;
652
652
  }
653
653
  function compare(a, b) {
@@ -671,6 +671,9 @@ function registerLlmClient(client) {
671
671
  return () => {
672
672
  };
673
673
  }
674
+ function isResolutionFailure(value) {
675
+ return typeof value === "object" && value !== null && "reason" in value && value.reason !== void 0;
676
+ }
674
677
  function registerWorkflowResolver(resolver) {
675
678
  return () => {
676
679
  };
@@ -725,13 +728,13 @@ function deepEqual(a, b) {
725
728
  const keys = Object.keys(left);
726
729
  if (keys.length !== Object.keys(right).length) return false;
727
730
  return keys.every(
728
- (key) => Object.prototype.hasOwnProperty.call(right, key) && deepEqual(left[key], right[key])
731
+ (key2) => Object.prototype.hasOwnProperty.call(right, key2) && deepEqual(left[key2], right[key2])
729
732
  );
730
733
  }
731
734
  function definedEntries(value) {
732
735
  const out = {};
733
- for (const [key, item] of Object.entries(value)) {
734
- if (item !== void 0) out[key] = item;
736
+ for (const [key2, item] of Object.entries(value)) {
737
+ if (item !== void 0) out[key2] = item;
735
738
  }
736
739
  return out;
737
740
  }
@@ -937,6 +940,62 @@ function validateFixtureFile(input, expectedKind) {
937
940
  return problems;
938
941
  }
939
942
 
943
+ // src/analysis/subflow-cycle.ts
944
+ async function findSubflowCycle(graph, resolver, rootRef) {
945
+ return walk(
946
+ graph,
947
+ resolver,
948
+ rootRef === void 0 ? [] : [rootRef],
949
+ rootRef === void 0 ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([key(rootRef, void 0)])
950
+ );
951
+ }
952
+ async function walk(graph, resolver, path, onPath) {
953
+ for (const [ref, version2] of references(graph?.nodes ?? [])) {
954
+ const k = key(ref, version2);
955
+ if (onPath.has(k)) return [...path, ref];
956
+ const resolved = await resolver(ref, version2);
957
+ if (!resolved || isResolutionFailure(resolved)) continue;
958
+ const found = await walk(
959
+ resolved,
960
+ resolver,
961
+ [...path, ref],
962
+ new Set(onPath).add(k)
963
+ );
964
+ if (found.length) return found;
965
+ }
966
+ return [];
967
+ }
968
+ function references(nodes) {
969
+ const found = [];
970
+ for (const raw of nodes) {
971
+ const n = raw;
972
+ const kind = kindName(String(n?.data?.kind ?? n?.type ?? ""));
973
+ const config = n?.data?.config ?? {};
974
+ if (kind === "subflow") {
975
+ const ref = String(config.workflow ?? "").trim();
976
+ if (ref) found.push([ref, version(config.version)]);
977
+ continue;
978
+ }
979
+ if (kind === "subgraph") {
980
+ const nested = config.graph?.nodes;
981
+ if (Array.isArray(nested)) found.push(...references(nested));
982
+ }
983
+ }
984
+ return found;
985
+ }
986
+ function kindName(type) {
987
+ const slash = type.lastIndexOf("/");
988
+ return slash === -1 ? type : type.slice(slash + 1);
989
+ }
990
+ function version(pin) {
991
+ if (pin === void 0 || pin === null || pin === "") return void 0;
992
+ const n = Number(pin);
993
+ return Number.isInteger(n) ? n : void 0;
994
+ }
995
+ function key(ref, v) {
996
+ return v === void 0 ? ref : `${ref}@${v}`;
997
+ }
998
+
940
999
  exports.LEGACY_PAUSE_PREFIXES = LEGACY_PAUSE_PREFIXES;
941
1000
  exports.NODE_MANIFEST_SCHEMA_VERSION = NODE_MANIFEST_SCHEMA_VERSION;
942
1001
  exports.PAUSE_PREFIX = PAUSE_PREFIX;
@@ -945,6 +1004,7 @@ exports.checkRuntimeSupport = checkRuntimeSupport;
945
1004
  exports.decodePause = decodePause;
946
1005
  exports.defaultConfigFor = defaultConfigFor;
947
1006
  exports.encodePause = encodePause;
1007
+ exports.findSubflowCycle = findSubflowCycle;
948
1008
  exports.getNodeKind = getNodeKind;
949
1009
  exports.isPause = isPause;
950
1010
  exports.kindIds = kindIds;