@particle-academy/fancy-flow 0.50.0 → 0.51.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.
- 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-XJMWMU4J.js → chunk-4GO2CHAY.js} +90 -7
- package/dist/chunk-4GO2CHAY.js.map +1 -0
- package/dist/{chunk-OWDSPRAF.js → chunk-OECW2E5D.js} +4 -4
- package/dist/{chunk-OWDSPRAF.js.map → chunk-OECW2E5D.js.map} +1 -1
- package/dist/{chunk-BAHJVX3S.js → chunk-OK7KJLWA.js} +3 -3
- package/dist/{chunk-BAHJVX3S.js.map → chunk-OK7KJLWA.js.map} +1 -1
- package/dist/{chunk-I4F6GI3A.js → chunk-RSRXKZ52.js} +3 -3
- package/dist/{chunk-I4F6GI3A.js.map → chunk-RSRXKZ52.js.map} +1 -1
- package/dist/{chunk-3W26FA7Q.js → chunk-SPINP4EJ.js} +18 -4
- package/dist/chunk-SPINP4EJ.js.map +1 -0
- package/dist/{chunk-DQJIU55F.js → chunk-VUU3CDBT.js} +3 -3
- package/dist/{chunk-DQJIU55F.js.map → chunk-VUU3CDBT.js.map} +1 -1
- 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 +88 -5
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -1
- package/dist/engine.cjs +88 -5
- 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 +103 -6
- 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 +88 -5
- 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 +88 -5
- 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 +103 -6
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/screens.cjs +88 -5
- 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.cts → types-JFYjPJAG.d.cts} +37 -1
- package/dist/{types-7cXcSQlx.d.ts → types-JFYjPJAG.d.ts} +37 -1
- package/dist/{types-CDgIIj4c.d.ts → types-s643U1Hi.d.ts} +1 -1
- package/dist/ux.cjs +88 -5
- 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-3W26FA7Q.js.map +0 -1
- package/dist/chunk-XJMWMU4J.js.map +0 -1
package/dist/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-SPINP4EJ.js';
|
|
2
|
+
import './chunk-4GO2CHAY.js';
|
|
3
3
|
import './chunk-F5RPRB7A.js';
|
|
4
4
|
import './chunk-USL4FMFU.js';
|
|
5
5
|
//# sourceMappingURL=schema.js.map
|
package/dist/screens.cjs
CHANGED
|
@@ -9411,6 +9411,61 @@ var RunIdentity = class _RunIdentity {
|
|
|
9411
9411
|
}
|
|
9412
9412
|
};
|
|
9413
9413
|
|
|
9414
|
+
// src/runtime/workflow-props.ts
|
|
9415
|
+
function typeOf(value) {
|
|
9416
|
+
if (value === null) return "null";
|
|
9417
|
+
if (Array.isArray(value)) return "array";
|
|
9418
|
+
return typeof value;
|
|
9419
|
+
}
|
|
9420
|
+
function resolveWorkflowProps(declared, passed) {
|
|
9421
|
+
const inputs = declared ?? [];
|
|
9422
|
+
const given = passed ?? {};
|
|
9423
|
+
const byName = new Map(inputs.map((input) => [input.name, input]));
|
|
9424
|
+
for (const name of Object.keys(given)) {
|
|
9425
|
+
if (!byName.has(name)) {
|
|
9426
|
+
const known = inputs.map((input) => input.name);
|
|
9427
|
+
const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
|
|
9428
|
+
return {
|
|
9429
|
+
ok: false,
|
|
9430
|
+
code: "unknown_input",
|
|
9431
|
+
error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
|
|
9432
|
+
};
|
|
9433
|
+
}
|
|
9434
|
+
}
|
|
9435
|
+
const resolved = {};
|
|
9436
|
+
for (const input of inputs) {
|
|
9437
|
+
const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
|
|
9438
|
+
const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
|
|
9439
|
+
if (!supplied) {
|
|
9440
|
+
if (hasDefault) {
|
|
9441
|
+
resolved[input.name] = input.default;
|
|
9442
|
+
continue;
|
|
9443
|
+
}
|
|
9444
|
+
if (input.required) {
|
|
9445
|
+
return {
|
|
9446
|
+
ok: false,
|
|
9447
|
+
code: "missing_required",
|
|
9448
|
+
error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
|
|
9449
|
+
};
|
|
9450
|
+
}
|
|
9451
|
+
continue;
|
|
9452
|
+
}
|
|
9453
|
+
const value = given[input.name];
|
|
9454
|
+
if (input.type !== void 0) {
|
|
9455
|
+
const actual = typeOf(value);
|
|
9456
|
+
if (actual !== input.type) {
|
|
9457
|
+
return {
|
|
9458
|
+
ok: false,
|
|
9459
|
+
code: "type_mismatch",
|
|
9460
|
+
error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
|
|
9461
|
+
};
|
|
9462
|
+
}
|
|
9463
|
+
}
|
|
9464
|
+
resolved[input.name] = value;
|
|
9465
|
+
}
|
|
9466
|
+
return { ok: true, props: resolved };
|
|
9467
|
+
}
|
|
9468
|
+
|
|
9414
9469
|
// src/runtime/run-flow.ts
|
|
9415
9470
|
async function runFlow(graph, executors, onEvent = () => {
|
|
9416
9471
|
}, options = {}) {
|
|
@@ -9426,6 +9481,13 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
9426
9481
|
onEvent({ type: "run-error", error: msg });
|
|
9427
9482
|
return { ok: false, outputs, error: msg };
|
|
9428
9483
|
}
|
|
9484
|
+
const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
|
|
9485
|
+
if (!propsCheck.ok) {
|
|
9486
|
+
onEvent({ type: "run-error", error: propsCheck.error });
|
|
9487
|
+
return { ok: false, outputs, error: propsCheck.error };
|
|
9488
|
+
}
|
|
9489
|
+
const props = propsCheck.props;
|
|
9490
|
+
const declaresProps = (graph.inputs?.length ?? 0) > 0;
|
|
9429
9491
|
const incomingByNode = indexIncoming(graph.edges);
|
|
9430
9492
|
const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
|
|
9431
9493
|
onEvent({ type: "run-start" });
|
|
@@ -9467,10 +9529,11 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
9467
9529
|
}
|
|
9468
9530
|
onEvent({ type: "node-status", nodeId: node.id, status: "running" });
|
|
9469
9531
|
announce(onEvent, node, "start");
|
|
9470
|
-
const inputs = collectInputs(node, incoming, portValues, initialInputs);
|
|
9532
|
+
const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
|
|
9471
9533
|
const exec = pickExecutor(executors, node);
|
|
9472
9534
|
if (!exec) {
|
|
9473
|
-
const
|
|
9535
|
+
const tried = executorLookupIds(node);
|
|
9536
|
+
const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")} and the wildcard "*". Key your registry by one of those.`;
|
|
9474
9537
|
errors.push(msg);
|
|
9475
9538
|
onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
|
|
9476
9539
|
onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
|
|
@@ -9544,8 +9607,13 @@ function topoSort(graph) {
|
|
|
9544
9607
|
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
9545
9608
|
return ordered.map((id2) => byId.get(id2)).filter(Boolean);
|
|
9546
9609
|
}
|
|
9547
|
-
function collectInputs(node, incoming, portValues, initial) {
|
|
9610
|
+
function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
|
|
9548
9611
|
const inputs = { ...initial[node.id] ?? {} };
|
|
9612
|
+
if (incoming.length === 0) {
|
|
9613
|
+
for (const [name, value] of Object.entries(props)) {
|
|
9614
|
+
if (!(name in inputs)) inputs[name] = value;
|
|
9615
|
+
}
|
|
9616
|
+
}
|
|
9549
9617
|
for (const e of incoming) {
|
|
9550
9618
|
const portId = e.targetHandle ?? "in";
|
|
9551
9619
|
const key = `${e.source}:${e.sourceHandle ?? "out"}`;
|
|
@@ -9555,16 +9623,31 @@ function collectInputs(node, incoming, portValues, initial) {
|
|
|
9555
9623
|
inputs[e.source] = portValues.get(key);
|
|
9556
9624
|
}
|
|
9557
9625
|
}
|
|
9626
|
+
if (declaresProps) inputs.$props = props;
|
|
9558
9627
|
return inputs;
|
|
9559
9628
|
}
|
|
9629
|
+
function executorLookupIds(node) {
|
|
9630
|
+
const ids = [node.id];
|
|
9631
|
+
if (node.type) ids.push(node.type);
|
|
9632
|
+
const declared = node.data?.kind;
|
|
9633
|
+
const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
|
|
9634
|
+
if (kindName && kindName !== node.type) ids.push(kindName);
|
|
9635
|
+
for (const name of [kindName, node.type]) {
|
|
9636
|
+
const kind = name ? getNodeKind(name) : null;
|
|
9637
|
+
if (!kind) continue;
|
|
9638
|
+
for (const id2 of kindIds(kind)) ids.push(id2);
|
|
9639
|
+
}
|
|
9640
|
+
return [...new Set(ids)];
|
|
9641
|
+
}
|
|
9560
9642
|
function pickExecutor(executors, node) {
|
|
9561
9643
|
if (executors[node.id]) return executors[node.id];
|
|
9562
9644
|
if (node.type && executors[node.type]) return executors[node.type];
|
|
9563
9645
|
const declared = node.data?.kind;
|
|
9564
9646
|
const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
|
|
9565
9647
|
if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
|
|
9566
|
-
const
|
|
9567
|
-
|
|
9648
|
+
for (const name of [kindName, node.type]) {
|
|
9649
|
+
const kind = name ? getNodeKind(name) : null;
|
|
9650
|
+
if (!kind) continue;
|
|
9568
9651
|
for (const id2 of kindIds(kind)) {
|
|
9569
9652
|
if (executors[id2]) return executors[id2];
|
|
9570
9653
|
}
|