@particle-academy/fancy-flow 0.49.0 → 0.51.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/{ConfigFieldRenderer-CrXFq6Eb.d.cts → ConfigFieldRenderer-Bc9Txnql.d.cts} +2 -2
- package/dist/{ConfigFieldRenderer-u3nYHovX.d.ts → ConfigFieldRenderer-Bt3RGT7Z.d.ts} +2 -2
- package/dist/{FlowViewer-DRgjeWJ7.d.ts → FlowViewer-BI_AyyvU.d.ts} +1 -1
- package/dist/{FlowViewer-CFSMlCqi.d.cts → FlowViewer-DABx-6A-.d.cts} +1 -1
- package/dist/{capabilities-VzgDApur.d.cts → capabilities-BYa5p5jw.d.cts} +1 -1
- package/dist/{capabilities-B00VXLUp.d.ts → capabilities-COOXRiNL.d.ts} +1 -1
- package/dist/{chunk-6XKR65XM.js → chunk-6AI6CBNL.js} +3 -3
- package/dist/{chunk-6XKR65XM.js.map → chunk-6AI6CBNL.js.map} +1 -1
- package/dist/{chunk-AVRGZFXG.js → chunk-7XTTXMGB.js} +4 -4
- package/dist/{chunk-AVRGZFXG.js.map → chunk-7XTTXMGB.js.map} +1 -1
- package/dist/{chunk-UL3DGSSG.js → chunk-HXGGCMR7.js} +3 -3
- package/dist/{chunk-UL3DGSSG.js.map → chunk-HXGGCMR7.js.map} +1 -1
- package/dist/{chunk-YOK3WKWC.js → chunk-LH76EIFL.js} +18 -4
- package/dist/chunk-LH76EIFL.js.map +1 -0
- package/dist/{chunk-VUL7CUFW.js → chunk-SKEZ5AGI.js} +3 -3
- package/dist/{chunk-VUL7CUFW.js.map → chunk-SKEZ5AGI.js.map} +1 -1
- package/dist/{chunk-6FP3F5YR.js → chunk-XCT2CJ5O.js} +75 -4
- package/dist/chunk-XCT2CJ5O.js.map +1 -0
- package/dist/connectors.d.cts +2 -2
- package/dist/connectors.d.ts +2 -2
- package/dist/durable/index.d.cts +2 -2
- package/dist/durable/index.d.ts +2 -2
- package/dist/durable.cjs +73 -2
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -1
- package/dist/engine.cjs +73 -2
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +7 -7
- package/dist/engine.d.ts +7 -7
- package/dist/engine.js +3 -3
- package/dist/fields/react-fancy.d.cts +3 -3
- package/dist/fields/react-fancy.d.ts +3 -3
- package/dist/index.cjs +88 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/dist/layout/index.d.cts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/llm/prism.d.cts +2 -2
- package/dist/llm/prism.d.ts +2 -2
- package/dist/llm/vercel-ai.d.cts +2 -2
- package/dist/llm/vercel-ai.d.ts +2 -2
- package/dist/registry/index.d.cts +6 -6
- package/dist/registry/index.d.ts +6 -6
- package/dist/{registry-6cB5wCv6.d.ts → registry-3RkSYrMi.d.ts} +1 -1
- package/dist/{registry-DQh7ZmnM.d.cts → registry-C6TMfiD_.d.cts} +1 -1
- package/dist/registry.cjs +73 -2
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/{run-cohort-VX4JG21l.d.ts → run-cohort-BPIOpE8A.d.ts} +2 -2
- package/dist/{run-cohort-DYCL8Qv6.d.cts → run-cohort-r-L8dMED.d.cts} +2 -2
- package/dist/{run-flow-B24QUO1H.d.cts → run-flow-COdAOFg2.d.cts} +10 -1
- package/dist/{run-flow-DPUPAWk6.d.ts → run-flow-DJ7KYT6E.d.ts} +10 -1
- package/dist/runtime/index.d.cts +5 -5
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime.cjs +73 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema/index.d.cts +12 -1
- package/dist/schema/index.d.ts +12 -1
- package/dist/schema.cjs +88 -3
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/screens.cjs +73 -2
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.d.cts +2 -2
- package/dist/screens.d.ts +2 -2
- package/dist/screens.js +4 -4
- package/dist/{types-BtMOnb9I.d.cts → types-3sPauVRT.d.cts} +1 -1
- package/dist/{types-7cXcSQlx.d.ts → types-JFYjPJAG.d.cts} +37 -1
- package/dist/{types-7cXcSQlx.d.cts → types-JFYjPJAG.d.ts} +37 -1
- package/dist/{types-CDgIIj4c.d.ts → types-s643U1Hi.d.ts} +1 -1
- package/dist/ux.cjs +73 -2
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.d.cts +2 -2
- package/dist/ux.d.ts +2 -2
- package/dist/ux.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6FP3F5YR.js.map +0 -1
- package/dist/chunk-YOK3WKWC.js.map +0 -1
package/dist/durable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { truthy } from './chunk-BHM5HGXH.js';
|
|
2
2
|
import { pauseForHuman, decodePause } from './chunk-UEOE6B52.js';
|
|
3
|
-
import { getNodeKind, runFlow, resolveKindId, kindIds, RunIdentity } from './chunk-
|
|
3
|
+
import { getNodeKind, runFlow, resolveKindId, kindIds, RunIdentity } from './chunk-XCT2CJ5O.js';
|
|
4
4
|
import './chunk-F5RPRB7A.js';
|
|
5
5
|
import './chunk-USL4FMFU.js';
|
|
6
6
|
|
package/dist/engine.cjs
CHANGED
|
@@ -10334,6 +10334,61 @@ var RunIdentity = class _RunIdentity {
|
|
|
10334
10334
|
}
|
|
10335
10335
|
};
|
|
10336
10336
|
|
|
10337
|
+
// src/runtime/workflow-props.ts
|
|
10338
|
+
function typeOf(value) {
|
|
10339
|
+
if (value === null) return "null";
|
|
10340
|
+
if (Array.isArray(value)) return "array";
|
|
10341
|
+
return typeof value;
|
|
10342
|
+
}
|
|
10343
|
+
function resolveWorkflowProps(declared, passed) {
|
|
10344
|
+
const inputs = declared ?? [];
|
|
10345
|
+
const given = passed ?? {};
|
|
10346
|
+
const byName = new Map(inputs.map((input) => [input.name, input]));
|
|
10347
|
+
for (const name of Object.keys(given)) {
|
|
10348
|
+
if (!byName.has(name)) {
|
|
10349
|
+
const known = inputs.map((input) => input.name);
|
|
10350
|
+
const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
|
|
10351
|
+
return {
|
|
10352
|
+
ok: false,
|
|
10353
|
+
code: "unknown_input",
|
|
10354
|
+
error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
|
|
10355
|
+
};
|
|
10356
|
+
}
|
|
10357
|
+
}
|
|
10358
|
+
const resolved = {};
|
|
10359
|
+
for (const input of inputs) {
|
|
10360
|
+
const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
|
|
10361
|
+
const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
|
|
10362
|
+
if (!supplied) {
|
|
10363
|
+
if (hasDefault) {
|
|
10364
|
+
resolved[input.name] = input.default;
|
|
10365
|
+
continue;
|
|
10366
|
+
}
|
|
10367
|
+
if (input.required) {
|
|
10368
|
+
return {
|
|
10369
|
+
ok: false,
|
|
10370
|
+
code: "missing_required",
|
|
10371
|
+
error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
|
|
10372
|
+
};
|
|
10373
|
+
}
|
|
10374
|
+
continue;
|
|
10375
|
+
}
|
|
10376
|
+
const value = given[input.name];
|
|
10377
|
+
if (input.type !== void 0) {
|
|
10378
|
+
const actual = typeOf(value);
|
|
10379
|
+
if (actual !== input.type) {
|
|
10380
|
+
return {
|
|
10381
|
+
ok: false,
|
|
10382
|
+
code: "type_mismatch",
|
|
10383
|
+
error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
|
|
10384
|
+
};
|
|
10385
|
+
}
|
|
10386
|
+
}
|
|
10387
|
+
resolved[input.name] = value;
|
|
10388
|
+
}
|
|
10389
|
+
return { ok: true, props: resolved };
|
|
10390
|
+
}
|
|
10391
|
+
|
|
10337
10392
|
// src/runtime/run-flow.ts
|
|
10338
10393
|
async function runFlow(graph, executors, onEvent = () => {
|
|
10339
10394
|
}, options = {}) {
|
|
@@ -10349,6 +10404,13 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
10349
10404
|
onEvent({ type: "run-error", error: msg });
|
|
10350
10405
|
return { ok: false, outputs, error: msg };
|
|
10351
10406
|
}
|
|
10407
|
+
const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
|
|
10408
|
+
if (!propsCheck.ok) {
|
|
10409
|
+
onEvent({ type: "run-error", error: propsCheck.error });
|
|
10410
|
+
return { ok: false, outputs, error: propsCheck.error };
|
|
10411
|
+
}
|
|
10412
|
+
const props = propsCheck.props;
|
|
10413
|
+
const declaresProps = (graph.inputs?.length ?? 0) > 0;
|
|
10352
10414
|
const incomingByNode = indexIncoming(graph.edges);
|
|
10353
10415
|
const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
|
|
10354
10416
|
onEvent({ type: "run-start" });
|
|
@@ -10390,7 +10452,7 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
10390
10452
|
}
|
|
10391
10453
|
onEvent({ type: "node-status", nodeId: node.id, status: "running" });
|
|
10392
10454
|
announce(onEvent, node, "start");
|
|
10393
|
-
const inputs = collectInputs(node, incoming, portValues, initialInputs);
|
|
10455
|
+
const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
|
|
10394
10456
|
const exec = pickExecutor(executors, node);
|
|
10395
10457
|
if (!exec) {
|
|
10396
10458
|
const msg = `No executor registered for kind=${node.type}`;
|
|
@@ -10467,14 +10529,23 @@ function topoSort(graph) {
|
|
|
10467
10529
|
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
10468
10530
|
return ordered.map((id2) => byId.get(id2)).filter(Boolean);
|
|
10469
10531
|
}
|
|
10470
|
-
function collectInputs(node, incoming, portValues, initial) {
|
|
10532
|
+
function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
|
|
10471
10533
|
const inputs = { ...initial[node.id] ?? {} };
|
|
10534
|
+
if (incoming.length === 0) {
|
|
10535
|
+
for (const [name, value] of Object.entries(props)) {
|
|
10536
|
+
if (!(name in inputs)) inputs[name] = value;
|
|
10537
|
+
}
|
|
10538
|
+
}
|
|
10472
10539
|
for (const e of incoming) {
|
|
10473
10540
|
const portId = e.targetHandle ?? "in";
|
|
10474
10541
|
const key2 = `${e.source}:${e.sourceHandle ?? "out"}`;
|
|
10475
10542
|
if (!portValues.has(key2)) continue;
|
|
10476
10543
|
inputs[portId] = portValues.get(key2);
|
|
10544
|
+
if (e.targetHandle == null && !(e.source in inputs)) {
|
|
10545
|
+
inputs[e.source] = portValues.get(key2);
|
|
10546
|
+
}
|
|
10477
10547
|
}
|
|
10548
|
+
if (declaresProps) inputs.$props = props;
|
|
10478
10549
|
return inputs;
|
|
10479
10550
|
}
|
|
10480
10551
|
function pickExecutor(executors, node) {
|