@particle-academy/fancy-flow 0.75.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-2H5H2DDP.js → chunk-44VXYZ4M.js} +4 -4
- package/dist/{chunk-2H5H2DDP.js.map → chunk-44VXYZ4M.js.map} +1 -1
- package/dist/{chunk-4BPCA3ZO.js → chunk-66JAEWPP.js} +3 -3
- package/dist/{chunk-4BPCA3ZO.js.map → chunk-66JAEWPP.js.map} +1 -1
- package/dist/{chunk-LKEDPVR3.js → chunk-KFC3BURT.js} +3 -3
- package/dist/{chunk-LKEDPVR3.js.map → chunk-KFC3BURT.js.map} +1 -1
- package/dist/{chunk-XZFLPKO2.js → chunk-MMCHYY6B.js} +3 -3
- package/dist/{chunk-XZFLPKO2.js.map → chunk-MMCHYY6B.js.map} +1 -1
- package/dist/{chunk-T7E7QPHI.js → chunk-OOQ2MMBE.js} +4 -4
- package/dist/{chunk-T7E7QPHI.js.map → chunk-OOQ2MMBE.js.map} +1 -1
- package/dist/{chunk-ZBHIEKCN.js → chunk-X2UHP2S5.js} +3 -3
- package/dist/{chunk-ZBHIEKCN.js.map → chunk-X2UHP2S5.js.map} +1 -1
- package/dist/{chunk-W7DMO3H7.js → chunk-YNKOEQLI.js} +48 -7
- package/dist/chunk-YNKOEQLI.js.map +1 -0
- package/dist/durable.cjs +42 -37
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -2
- package/dist/durable.js.map +1 -1
- package/dist/engine.cjs +45 -40
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +4 -6
- package/dist/engine.js.map +1 -1
- package/dist/index.cjs +45 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +45 -40
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -3
- package/dist/runtime.cjs +35 -4
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema.cjs +35 -4
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +3 -3
- package/dist/screens.cjs +35 -4
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.js +4 -5
- package/dist/screens.js.map +1 -1
- package/dist/ux.cjs +35 -4
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-UEOE6B52.js +0 -39
- package/dist/chunk-UEOE6B52.js.map +0 -1
- package/dist/chunk-W7DMO3H7.js.map +0 -1
package/dist/durable.cjs
CHANGED
|
@@ -634,8 +634,9 @@ function possiblePortIds(node) {
|
|
|
634
634
|
if (!kind) return ["out"];
|
|
635
635
|
const config = nodeConfig(node);
|
|
636
636
|
const representative = typeof kind.outputs === "function" && !configDeclaresPorts(kind.name, config);
|
|
637
|
-
const
|
|
638
|
-
|
|
637
|
+
const resolved = resolvePortSpec(kind.outputs, representative ? defaultConfigFor(kind) : config);
|
|
638
|
+
if (resolved === void 0) return ["out"];
|
|
639
|
+
return resolved.map((p) => p.id);
|
|
639
640
|
}
|
|
640
641
|
function configDeclaresPorts(kindName, config) {
|
|
641
642
|
const bare = kindName.startsWith("@") ? kindName.slice(kindName.lastIndexOf("/") + 1) : kindName;
|
|
@@ -961,7 +962,7 @@ function activatedPorts(node, result) {
|
|
|
961
962
|
}
|
|
962
963
|
const kind = getNodeKind(node.data?.kind ?? node.type ?? "") ?? void 0;
|
|
963
964
|
const declared = resolveNodePorts(node, kind).outputs?.map((p) => p.id);
|
|
964
|
-
return { ports: declared
|
|
965
|
+
return { ports: declared ?? ["out"], value: result };
|
|
965
966
|
}
|
|
966
967
|
function portValueOf(activated, portId) {
|
|
967
968
|
return activated.values && Object.prototype.hasOwnProperty.call(activated.values, portId) ? activated.values[portId] : activated.value;
|
|
@@ -975,6 +976,39 @@ function announce(onEvent, node, phase) {
|
|
|
975
976
|
onEvent({ type: "node-message", nodeId: node.id, phase, message });
|
|
976
977
|
}
|
|
977
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
|
+
|
|
978
1012
|
// src/registry/subflow.ts
|
|
979
1013
|
var DEFAULT_MAX_DEPTH = 8;
|
|
980
1014
|
function subflowMode(config) {
|
|
@@ -1056,7 +1090,11 @@ var subflowExecutor = async (ctx) => {
|
|
|
1056
1090
|
}
|
|
1057
1091
|
);
|
|
1058
1092
|
if (!result.ok) {
|
|
1059
|
-
|
|
1093
|
+
const reason = result.error ?? "unknown error";
|
|
1094
|
+
if (decodePause(reason)) {
|
|
1095
|
+
ctx.abort(reason);
|
|
1096
|
+
}
|
|
1097
|
+
ctx.abort(`subflow "${ref}" failed: ${reason}`);
|
|
1060
1098
|
}
|
|
1061
1099
|
if (mode === "stream") {
|
|
1062
1100
|
return { __port: "stream", value: result.outputs };
|
|
@@ -2850,39 +2888,6 @@ function idsFor(node) {
|
|
|
2850
2888
|
return [...new Set(ordered)];
|
|
2851
2889
|
}
|
|
2852
2890
|
|
|
2853
|
-
// src/registry/pause.ts
|
|
2854
|
-
var PAUSE_PREFIX = "fancy-flow:pause:";
|
|
2855
|
-
var LEGACY_PAUSE_PREFIXES = [
|
|
2856
|
-
["awaiting-approval:", "approval"],
|
|
2857
|
-
["awaiting-input:", "input"]
|
|
2858
|
-
];
|
|
2859
|
-
function encodePause(signal) {
|
|
2860
|
-
const { nodeId, awaiting, detail } = signal;
|
|
2861
|
-
return PAUSE_PREFIX + JSON.stringify(detail === void 0 ? { nodeId, awaiting } : { nodeId, awaiting, detail });
|
|
2862
|
-
}
|
|
2863
|
-
function decodePause(reason) {
|
|
2864
|
-
if (typeof reason !== "string") return null;
|
|
2865
|
-
if (reason.startsWith(PAUSE_PREFIX)) {
|
|
2866
|
-
const body = reason.slice(PAUSE_PREFIX.length);
|
|
2867
|
-
try {
|
|
2868
|
-
const parsed = JSON.parse(body);
|
|
2869
|
-
if (typeof parsed?.nodeId !== "string" || typeof parsed?.awaiting !== "string") return null;
|
|
2870
|
-
return "detail" in parsed ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail } : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };
|
|
2871
|
-
} catch {
|
|
2872
|
-
return null;
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {
|
|
2876
|
-
if (reason.startsWith(prefix)) {
|
|
2877
|
-
return { nodeId: reason.slice(prefix.length), awaiting };
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
return null;
|
|
2881
|
-
}
|
|
2882
|
-
function pauseForHuman(ctx, awaiting, detail) {
|
|
2883
|
-
return ctx.abort(encodePause({ nodeId: ctx.node.id, awaiting, detail }));
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
2891
|
// src/durable/human.ts
|
|
2887
2892
|
var NotAwaitingHuman = class extends Error {
|
|
2888
2893
|
constructor(message) {
|