@particle-academy/fancy-flow 0.76.0 → 0.77.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 (46) hide show
  1. package/dist/{chunk-ZKAPSUTL.js → chunk-2VI24UPB.js} +3 -3
  2. package/dist/{chunk-ZKAPSUTL.js.map → chunk-2VI24UPB.js.map} +1 -1
  3. package/dist/{chunk-PXVISCSC.js → chunk-ARSOSEJV.js} +4 -4
  4. package/dist/{chunk-PXVISCSC.js.map → chunk-ARSOSEJV.js.map} +1 -1
  5. package/dist/{chunk-G4GKDJG5.js → chunk-CQAMEPPI.js} +3 -3
  6. package/dist/{chunk-G4GKDJG5.js.map → chunk-CQAMEPPI.js.map} +1 -1
  7. package/dist/{chunk-V2657EQG.js → chunk-EEIWAIXW.js} +45 -5
  8. package/dist/chunk-EEIWAIXW.js.map +1 -0
  9. package/dist/{chunk-4KYW5BT4.js → chunk-EGXA4SYJ.js} +4 -4
  10. package/dist/{chunk-4KYW5BT4.js.map → chunk-EGXA4SYJ.js.map} +1 -1
  11. package/dist/{chunk-CYVVUKHH.js → chunk-G5RAGPVD.js} +3 -3
  12. package/dist/{chunk-CYVVUKHH.js.map → chunk-G5RAGPVD.js.map} +1 -1
  13. package/dist/{chunk-M34S7XUM.js → chunk-T6WIIGSK.js} +3 -3
  14. package/dist/{chunk-M34S7XUM.js.map → chunk-T6WIIGSK.js.map} +1 -1
  15. package/dist/durable.cjs +39 -35
  16. package/dist/durable.cjs.map +1 -1
  17. package/dist/durable.js +1 -2
  18. package/dist/durable.js.map +1 -1
  19. package/dist/engine.cjs +42 -38
  20. package/dist/engine.cjs.map +1 -1
  21. package/dist/engine.js +4 -6
  22. package/dist/engine.js.map +1 -1
  23. package/dist/index.cjs +42 -38
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.js +12 -13
  26. package/dist/index.js.map +1 -1
  27. package/dist/registry.cjs +42 -38
  28. package/dist/registry.cjs.map +1 -1
  29. package/dist/registry.js +2 -3
  30. package/dist/runtime.cjs +32 -2
  31. package/dist/runtime.cjs.map +1 -1
  32. package/dist/runtime.js +3 -3
  33. package/dist/schema.cjs +32 -2
  34. package/dist/schema.cjs.map +1 -1
  35. package/dist/schema.js +3 -3
  36. package/dist/screens.cjs +32 -2
  37. package/dist/screens.cjs.map +1 -1
  38. package/dist/screens.js +4 -5
  39. package/dist/screens.js.map +1 -1
  40. package/dist/ux.cjs +32 -2
  41. package/dist/ux.cjs.map +1 -1
  42. package/dist/ux.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk-UEOE6B52.js +0 -39
  45. package/dist/chunk-UEOE6B52.js.map +0 -1
  46. package/dist/chunk-V2657EQG.js.map +0 -1
package/dist/screens.js CHANGED
@@ -1,10 +1,9 @@
1
- import { FlowViewer } from './chunk-4KYW5BT4.js';
2
- export { FlowViewer } from './chunk-4KYW5BT4.js';
3
- import './chunk-M34S7XUM.js';
1
+ import { FlowViewer } from './chunk-EGXA4SYJ.js';
2
+ export { FlowViewer } from './chunk-EGXA4SYJ.js';
3
+ import './chunk-T6WIIGSK.js';
4
4
  import './chunk-F5RPRB7A.js';
5
5
  import './chunk-OWENS2H5.js';
6
- import './chunk-UEOE6B52.js';
7
- import './chunk-V2657EQG.js';
6
+ import './chunk-EEIWAIXW.js';
8
7
  import './chunk-2QXKDLGT.js';
9
8
  import { registerSchemaComponents } from '@particle-academy/fancy-screens';
10
9
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/screens.ts"],"names":[],"mappings":";;;;;;;;;;AAwBO,SAAS,kBAAA,GAA2B;AACzC,EAAA,wBAAA,CAAyB;AAAA,IACvB;AAAA,GACD,CAAA;AACH","file":"screens.js","sourcesContent":["// /screens subpath — the ONLY module that imports fancy-screens (optional\n// peer). Keeps the base `.` import graph free of it, so an app that never\n// touches fancy-screens never pays for it.\nimport { registerSchemaComponents } from \"@particle-academy/fancy-screens\";\nimport type { ComponentType } from \"react\";\nimport { FlowViewer } from \"./components/FlowViewer\";\n\n/**\n * Register fancy-flow's components with fancy-screens, so an agent-emitted\n * `ScreenSchema` can place a workflow in a page:\n *\n * ```json\n * { \"type\": \"FlowViewer\", \"props\": { \"graph\": { \"nodes\": [], \"edges\": [] } } }\n * ```\n *\n * Call once at host startup.\n *\n * **Only the VIEWER is registered, deliberately.** A schema is JSON an agent\n * emits, and `FlowEditor` needs executors, run handlers and controlled state\n * that cannot be expressed as JSON props — registering it would let an agent\n * emit an editor that renders but does nothing, which is worse than not\n * offering it. The viewer is complete from props alone, which is exactly what\n * makes it schema-safe.\n */\nexport function registerFlowSchema(): void {\n registerSchemaComponents({\n FlowViewer: FlowViewer as unknown as ComponentType<Record<string, unknown>>,\n });\n}\n\nexport { FlowViewer } from \"./components/FlowViewer\";\nexport type { FlowViewerProps, FlowViewerClassNames, FlowNodeStatus } from \"./components/FlowViewer\";\n"]}
1
+ {"version":3,"sources":["../src/screens.ts"],"names":[],"mappings":";;;;;;;;;AAwBO,SAAS,kBAAA,GAA2B;AACzC,EAAA,wBAAA,CAAyB;AAAA,IACvB;AAAA,GACD,CAAA;AACH","file":"screens.js","sourcesContent":["// /screens subpath — the ONLY module that imports fancy-screens (optional\n// peer). Keeps the base `.` import graph free of it, so an app that never\n// touches fancy-screens never pays for it.\nimport { registerSchemaComponents } from \"@particle-academy/fancy-screens\";\nimport type { ComponentType } from \"react\";\nimport { FlowViewer } from \"./components/FlowViewer\";\n\n/**\n * Register fancy-flow's components with fancy-screens, so an agent-emitted\n * `ScreenSchema` can place a workflow in a page:\n *\n * ```json\n * { \"type\": \"FlowViewer\", \"props\": { \"graph\": { \"nodes\": [], \"edges\": [] } } }\n * ```\n *\n * Call once at host startup.\n *\n * **Only the VIEWER is registered, deliberately.** A schema is JSON an agent\n * emits, and `FlowEditor` needs executors, run handlers and controlled state\n * that cannot be expressed as JSON props — registering it would let an agent\n * emit an editor that renders but does nothing, which is worse than not\n * offering it. The viewer is complete from props alone, which is exactly what\n * makes it schema-safe.\n */\nexport function registerFlowSchema(): void {\n registerSchemaComponents({\n FlowViewer: FlowViewer as unknown as ComponentType<Record<string, unknown>>,\n });\n}\n\nexport { FlowViewer } from \"./components/FlowViewer\";\nexport type { FlowViewerProps, FlowViewerClassNames, FlowNodeStatus } from \"./components/FlowViewer\";\n"]}
package/dist/ux.cjs CHANGED
@@ -870,6 +870,32 @@ function announce(onEvent, node, phase) {
870
870
  onEvent({ type: "node-message", nodeId: node.id, phase, message });
871
871
  }
872
872
 
873
+ // src/registry/pause.ts
874
+ var PAUSE_PREFIX = "fancy-flow:pause:";
875
+ var LEGACY_PAUSE_PREFIXES = [
876
+ ["awaiting-approval:", "approval"],
877
+ ["awaiting-input:", "input"]
878
+ ];
879
+ function decodePause(reason) {
880
+ if (typeof reason !== "string") return null;
881
+ if (reason.startsWith(PAUSE_PREFIX)) {
882
+ const body = reason.slice(PAUSE_PREFIX.length);
883
+ try {
884
+ const parsed = JSON.parse(body);
885
+ if (typeof parsed?.nodeId !== "string" || typeof parsed?.awaiting !== "string") return null;
886
+ return "detail" in parsed ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail } : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };
887
+ } catch {
888
+ return null;
889
+ }
890
+ }
891
+ for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {
892
+ if (reason.startsWith(prefix)) {
893
+ return { nodeId: reason.slice(prefix.length), awaiting };
894
+ }
895
+ }
896
+ return null;
897
+ }
898
+
873
899
  // src/registry/subflow.ts
874
900
  var DEFAULT_MAX_DEPTH = 8;
875
901
  function subflowMode(config) {
@@ -951,7 +977,11 @@ var subflowExecutor = async (ctx) => {
951
977
  }
952
978
  );
953
979
  if (!result.ok) {
954
- ctx.abort(`subflow "${ref}" failed: ${result.error ?? "unknown error"}`);
980
+ const reason = result.error ?? "unknown error";
981
+ if (decodePause(reason)) {
982
+ ctx.abort(reason);
983
+ }
984
+ ctx.abort(`subflow "${ref}" failed: ${reason}`);
955
985
  }
956
986
  if (mode === "stream") {
957
987
  return { __port: "stream", value: result.outputs };
@@ -1759,7 +1789,7 @@ var KINDS = [
1759
1789
  executor: forEachExecutor,
1760
1790
  category: "logic",
1761
1791
  label: "For Each",
1762
- description: "Iterate over a list, emitting each item on `item`.",
1792
+ description: "Publishes the resolved list and its size on BOTH `item` and `done`. Fan-out as DATA, not as jobs -- nothing runs per item.",
1763
1793
  icon: "\u21BB",
1764
1794
  inputs: [{ id: "in" }],
1765
1795
  outputs: [{ id: "item", label: "item" }, { id: "done", label: "done" }],