@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/screens.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { FlowViewer } from './chunk-
|
|
2
|
-
export { FlowViewer } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { FlowViewer } from './chunk-44VXYZ4M.js';
|
|
2
|
+
export { FlowViewer } from './chunk-44VXYZ4M.js';
|
|
3
|
+
import './chunk-66JAEWPP.js';
|
|
4
4
|
import './chunk-F5RPRB7A.js';
|
|
5
5
|
import './chunk-OWENS2H5.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-W7DMO3H7.js';
|
|
6
|
+
import './chunk-YNKOEQLI.js';
|
|
8
7
|
import './chunk-2QXKDLGT.js';
|
|
9
8
|
import { registerSchemaComponents } from '@particle-academy/fancy-screens';
|
|
10
9
|
|
package/dist/screens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/screens.ts"],"names":[],"mappings":"
|
|
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
|
@@ -528,8 +528,9 @@ function possiblePortIds(node) {
|
|
|
528
528
|
if (!kind) return ["out"];
|
|
529
529
|
const config = nodeConfig(node);
|
|
530
530
|
const representative = typeof kind.outputs === "function" && !configDeclaresPorts(kind.name, config);
|
|
531
|
-
const
|
|
532
|
-
|
|
531
|
+
const resolved = resolvePortSpec(kind.outputs, representative ? defaultConfigFor(kind) : config);
|
|
532
|
+
if (resolved === void 0) return ["out"];
|
|
533
|
+
return resolved.map((p) => p.id);
|
|
533
534
|
}
|
|
534
535
|
function configDeclaresPorts(kindName, config) {
|
|
535
536
|
const bare = kindName.startsWith("@") ? kindName.slice(kindName.lastIndexOf("/") + 1) : kindName;
|
|
@@ -855,7 +856,7 @@ function activatedPorts(node, result) {
|
|
|
855
856
|
}
|
|
856
857
|
const kind = getNodeKind(node.data?.kind ?? node.type ?? "") ?? void 0;
|
|
857
858
|
const declared = resolveNodePorts(node, kind).outputs?.map((p) => p.id);
|
|
858
|
-
return { ports: declared
|
|
859
|
+
return { ports: declared ?? ["out"], value: result };
|
|
859
860
|
}
|
|
860
861
|
function portValueOf(activated, portId) {
|
|
861
862
|
return activated.values && Object.prototype.hasOwnProperty.call(activated.values, portId) ? activated.values[portId] : activated.value;
|
|
@@ -869,6 +870,32 @@ function announce(onEvent, node, phase) {
|
|
|
869
870
|
onEvent({ type: "node-message", nodeId: node.id, phase, message });
|
|
870
871
|
}
|
|
871
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
|
+
|
|
872
899
|
// src/registry/subflow.ts
|
|
873
900
|
var DEFAULT_MAX_DEPTH = 8;
|
|
874
901
|
function subflowMode(config) {
|
|
@@ -950,7 +977,11 @@ var subflowExecutor = async (ctx) => {
|
|
|
950
977
|
}
|
|
951
978
|
);
|
|
952
979
|
if (!result.ok) {
|
|
953
|
-
|
|
980
|
+
const reason = result.error ?? "unknown error";
|
|
981
|
+
if (decodePause(reason)) {
|
|
982
|
+
ctx.abort(reason);
|
|
983
|
+
}
|
|
984
|
+
ctx.abort(`subflow "${ref}" failed: ${reason}`);
|
|
954
985
|
}
|
|
955
986
|
if (mode === "stream") {
|
|
956
987
|
return { __port: "stream", value: result.outputs };
|