@particle-academy/fancy-flow 0.76.0 → 0.77.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.
- package/dist/{chunk-4KYW5BT4.js → chunk-44VXYZ4M.js} +4 -4
- package/dist/{chunk-4KYW5BT4.js.map → chunk-44VXYZ4M.js.map} +1 -1
- package/dist/{chunk-M34S7XUM.js → chunk-66JAEWPP.js} +3 -3
- package/dist/{chunk-M34S7XUM.js.map → chunk-66JAEWPP.js.map} +1 -1
- package/dist/{chunk-G4GKDJG5.js → chunk-KFC3BURT.js} +3 -3
- package/dist/{chunk-G4GKDJG5.js.map → chunk-KFC3BURT.js.map} +1 -1
- package/dist/{chunk-CYVVUKHH.js → chunk-MMCHYY6B.js} +3 -3
- package/dist/{chunk-CYVVUKHH.js.map → chunk-MMCHYY6B.js.map} +1 -1
- package/dist/{chunk-PXVISCSC.js → chunk-OOQ2MMBE.js} +4 -4
- package/dist/{chunk-PXVISCSC.js.map → chunk-OOQ2MMBE.js.map} +1 -1
- package/dist/{chunk-ZKAPSUTL.js → chunk-X2UHP2S5.js} +3 -3
- package/dist/{chunk-ZKAPSUTL.js.map → chunk-X2UHP2S5.js.map} +1 -1
- package/dist/{chunk-V2657EQG.js → chunk-YNKOEQLI.js} +44 -4
- package/dist/chunk-YNKOEQLI.js.map +1 -0
- package/dist/durable.cjs +38 -34
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -2
- package/dist/durable.js.map +1 -1
- package/dist/engine.cjs +41 -37
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +4 -6
- package/dist/engine.js.map +1 -1
- package/dist/index.cjs +41 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +41 -37
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -3
- package/dist/runtime.cjs +31 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema.cjs +31 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +3 -3
- package/dist/screens.cjs +31 -1
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.js +4 -5
- package/dist/screens.js.map +1 -1
- package/dist/ux.cjs +31 -1
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-UEOE6B52.js +0 -39
- package/dist/chunk-UEOE6B52.js.map +0 -1
- package/dist/chunk-V2657EQG.js.map +0 -1
package/dist/durable.cjs
CHANGED
|
@@ -976,6 +976,39 @@ function announce(onEvent, node, phase) {
|
|
|
976
976
|
onEvent({ type: "node-message", nodeId: node.id, phase, message });
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
+
// src/registry/pause.ts
|
|
980
|
+
var PAUSE_PREFIX = "fancy-flow:pause:";
|
|
981
|
+
var LEGACY_PAUSE_PREFIXES = [
|
|
982
|
+
["awaiting-approval:", "approval"],
|
|
983
|
+
["awaiting-input:", "input"]
|
|
984
|
+
];
|
|
985
|
+
function encodePause(signal) {
|
|
986
|
+
const { nodeId, awaiting, detail } = signal;
|
|
987
|
+
return PAUSE_PREFIX + JSON.stringify(detail === void 0 ? { nodeId, awaiting } : { nodeId, awaiting, detail });
|
|
988
|
+
}
|
|
989
|
+
function decodePause(reason) {
|
|
990
|
+
if (typeof reason !== "string") return null;
|
|
991
|
+
if (reason.startsWith(PAUSE_PREFIX)) {
|
|
992
|
+
const body = reason.slice(PAUSE_PREFIX.length);
|
|
993
|
+
try {
|
|
994
|
+
const parsed = JSON.parse(body);
|
|
995
|
+
if (typeof parsed?.nodeId !== "string" || typeof parsed?.awaiting !== "string") return null;
|
|
996
|
+
return "detail" in parsed ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail } : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };
|
|
997
|
+
} catch {
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {
|
|
1002
|
+
if (reason.startsWith(prefix)) {
|
|
1003
|
+
return { nodeId: reason.slice(prefix.length), awaiting };
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return null;
|
|
1007
|
+
}
|
|
1008
|
+
function pauseForHuman(ctx, awaiting, detail) {
|
|
1009
|
+
return ctx.abort(encodePause({ nodeId: ctx.node.id, awaiting, detail }));
|
|
1010
|
+
}
|
|
1011
|
+
|
|
979
1012
|
// src/registry/subflow.ts
|
|
980
1013
|
var DEFAULT_MAX_DEPTH = 8;
|
|
981
1014
|
function subflowMode(config) {
|
|
@@ -1057,7 +1090,11 @@ var subflowExecutor = async (ctx) => {
|
|
|
1057
1090
|
}
|
|
1058
1091
|
);
|
|
1059
1092
|
if (!result.ok) {
|
|
1060
|
-
|
|
1093
|
+
const reason = result.error ?? "unknown error";
|
|
1094
|
+
if (decodePause(reason)) {
|
|
1095
|
+
ctx.abort(reason);
|
|
1096
|
+
}
|
|
1097
|
+
ctx.abort(`subflow "${ref}" failed: ${reason}`);
|
|
1061
1098
|
}
|
|
1062
1099
|
if (mode === "stream") {
|
|
1063
1100
|
return { __port: "stream", value: result.outputs };
|
|
@@ -2851,39 +2888,6 @@ function idsFor(node) {
|
|
|
2851
2888
|
return [...new Set(ordered)];
|
|
2852
2889
|
}
|
|
2853
2890
|
|
|
2854
|
-
// src/registry/pause.ts
|
|
2855
|
-
var PAUSE_PREFIX = "fancy-flow:pause:";
|
|
2856
|
-
var LEGACY_PAUSE_PREFIXES = [
|
|
2857
|
-
["awaiting-approval:", "approval"],
|
|
2858
|
-
["awaiting-input:", "input"]
|
|
2859
|
-
];
|
|
2860
|
-
function encodePause(signal) {
|
|
2861
|
-
const { nodeId, awaiting, detail } = signal;
|
|
2862
|
-
return PAUSE_PREFIX + JSON.stringify(detail === void 0 ? { nodeId, awaiting } : { nodeId, awaiting, detail });
|
|
2863
|
-
}
|
|
2864
|
-
function decodePause(reason) {
|
|
2865
|
-
if (typeof reason !== "string") return null;
|
|
2866
|
-
if (reason.startsWith(PAUSE_PREFIX)) {
|
|
2867
|
-
const body = reason.slice(PAUSE_PREFIX.length);
|
|
2868
|
-
try {
|
|
2869
|
-
const parsed = JSON.parse(body);
|
|
2870
|
-
if (typeof parsed?.nodeId !== "string" || typeof parsed?.awaiting !== "string") return null;
|
|
2871
|
-
return "detail" in parsed ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail } : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };
|
|
2872
|
-
} catch {
|
|
2873
|
-
return null;
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {
|
|
2877
|
-
if (reason.startsWith(prefix)) {
|
|
2878
|
-
return { nodeId: reason.slice(prefix.length), awaiting };
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
return null;
|
|
2882
|
-
}
|
|
2883
|
-
function pauseForHuman(ctx, awaiting, detail) {
|
|
2884
|
-
return ctx.abort(encodePause({ nodeId: ctx.node.id, awaiting, detail }));
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
2891
|
// src/durable/human.ts
|
|
2888
2892
|
var NotAwaitingHuman = class extends Error {
|
|
2889
2893
|
constructor(message) {
|