@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/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-
|
|
2
|
-
export { runCohort } from './chunk-
|
|
3
|
-
export { RunIdentity, escapeSegment, runFlow } from './chunk-
|
|
1
|
+
export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-OK7KJLWA.js';
|
|
2
|
+
export { runCohort } from './chunk-VUU3CDBT.js';
|
|
3
|
+
export { RunIdentity, escapeSegment, runFlow } from './chunk-4GO2CHAY.js';
|
|
4
4
|
import './chunk-F5RPRB7A.js';
|
|
5
5
|
import './chunk-USL4FMFU.js';
|
|
6
6
|
//# sourceMappingURL=runtime.js.map
|
package/dist/schema/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PortDescriptor, F as FlowGraph } from '../types-
|
|
1
|
+
import { W as WorkflowInput, P as PortDescriptor, F as FlowGraph } from '../types-JFYjPJAG.cjs';
|
|
2
2
|
import '@xyflow/react';
|
|
3
3
|
|
|
4
4
|
/** Schema version. Bump on breaking shape changes; add migrations as needed. */
|
|
@@ -8,6 +8,17 @@ type WorkflowSchema = {
|
|
|
8
8
|
$schema: typeof WORKFLOW_SCHEMA_URL;
|
|
9
9
|
version: typeof WORKFLOW_SCHEMA_VERSION;
|
|
10
10
|
metadata?: WorkflowMetadata;
|
|
11
|
+
/**
|
|
12
|
+
* What this workflow accepts at run start, passed BY NAME.
|
|
13
|
+
*
|
|
14
|
+
* Lives beside `graph` rather than inside it because it describes the
|
|
15
|
+
* workflow's CONTRACT, not its topology: a caller reads this to know what to
|
|
16
|
+
* pass, and reading it should not mean walking nodes looking for a trigger.
|
|
17
|
+
*
|
|
18
|
+
* Omitted entirely when a workflow takes none, so every existing saved
|
|
19
|
+
* document is unchanged byte for byte.
|
|
20
|
+
*/
|
|
21
|
+
inputs?: WorkflowInput[];
|
|
11
22
|
graph: {
|
|
12
23
|
nodes: WorkflowSchemaNode[];
|
|
13
24
|
edges: WorkflowSchemaEdge[];
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PortDescriptor, F as FlowGraph } from '../types-
|
|
1
|
+
import { W as WorkflowInput, P as PortDescriptor, F as FlowGraph } from '../types-JFYjPJAG.js';
|
|
2
2
|
import '@xyflow/react';
|
|
3
3
|
|
|
4
4
|
/** Schema version. Bump on breaking shape changes; add migrations as needed. */
|
|
@@ -8,6 +8,17 @@ type WorkflowSchema = {
|
|
|
8
8
|
$schema: typeof WORKFLOW_SCHEMA_URL;
|
|
9
9
|
version: typeof WORKFLOW_SCHEMA_VERSION;
|
|
10
10
|
metadata?: WorkflowMetadata;
|
|
11
|
+
/**
|
|
12
|
+
* What this workflow accepts at run start, passed BY NAME.
|
|
13
|
+
*
|
|
14
|
+
* Lives beside `graph` rather than inside it because it describes the
|
|
15
|
+
* workflow's CONTRACT, not its topology: a caller reads this to know what to
|
|
16
|
+
* pass, and reading it should not mean walking nodes looking for a trigger.
|
|
17
|
+
*
|
|
18
|
+
* Omitted entirely when a workflow takes none, so every existing saved
|
|
19
|
+
* document is unchanged byte for byte.
|
|
20
|
+
*/
|
|
21
|
+
inputs?: WorkflowInput[];
|
|
11
22
|
graph: {
|
|
12
23
|
nodes: WorkflowSchemaNode[];
|
|
13
24
|
edges: WorkflowSchemaEdge[];
|
package/dist/schema.cjs
CHANGED
|
@@ -9226,6 +9226,61 @@ var RunIdentity = class _RunIdentity {
|
|
|
9226
9226
|
}
|
|
9227
9227
|
};
|
|
9228
9228
|
|
|
9229
|
+
// src/runtime/workflow-props.ts
|
|
9230
|
+
function typeOf(value) {
|
|
9231
|
+
if (value === null) return "null";
|
|
9232
|
+
if (Array.isArray(value)) return "array";
|
|
9233
|
+
return typeof value;
|
|
9234
|
+
}
|
|
9235
|
+
function resolveWorkflowProps(declared, passed) {
|
|
9236
|
+
const inputs = declared ?? [];
|
|
9237
|
+
const given = passed ?? {};
|
|
9238
|
+
const byName = new Map(inputs.map((input) => [input.name, input]));
|
|
9239
|
+
for (const name of Object.keys(given)) {
|
|
9240
|
+
if (!byName.has(name)) {
|
|
9241
|
+
const known = inputs.map((input) => input.name);
|
|
9242
|
+
const suffix = known.length === 0 ? "this workflow declares no inputs" : `known inputs: ${known.join(", ")}`;
|
|
9243
|
+
return {
|
|
9244
|
+
ok: false,
|
|
9245
|
+
code: "unknown_input",
|
|
9246
|
+
error: `Unknown workflow input "${name}" \u2014 ${suffix}.`
|
|
9247
|
+
};
|
|
9248
|
+
}
|
|
9249
|
+
}
|
|
9250
|
+
const resolved = {};
|
|
9251
|
+
for (const input of inputs) {
|
|
9252
|
+
const supplied = Object.prototype.hasOwnProperty.call(given, input.name);
|
|
9253
|
+
const hasDefault = Object.prototype.hasOwnProperty.call(input, "default");
|
|
9254
|
+
if (!supplied) {
|
|
9255
|
+
if (hasDefault) {
|
|
9256
|
+
resolved[input.name] = input.default;
|
|
9257
|
+
continue;
|
|
9258
|
+
}
|
|
9259
|
+
if (input.required) {
|
|
9260
|
+
return {
|
|
9261
|
+
ok: false,
|
|
9262
|
+
code: "missing_required",
|
|
9263
|
+
error: `Missing required workflow input "${input.name}"${input.type ? ` (${input.type})` : ""}.`
|
|
9264
|
+
};
|
|
9265
|
+
}
|
|
9266
|
+
continue;
|
|
9267
|
+
}
|
|
9268
|
+
const value = given[input.name];
|
|
9269
|
+
if (input.type !== void 0) {
|
|
9270
|
+
const actual = typeOf(value);
|
|
9271
|
+
if (actual !== input.type) {
|
|
9272
|
+
return {
|
|
9273
|
+
ok: false,
|
|
9274
|
+
code: "type_mismatch",
|
|
9275
|
+
error: `Workflow input "${input.name}" expects ${input.type}, got ${actual}.`
|
|
9276
|
+
};
|
|
9277
|
+
}
|
|
9278
|
+
}
|
|
9279
|
+
resolved[input.name] = value;
|
|
9280
|
+
}
|
|
9281
|
+
return { ok: true, props: resolved };
|
|
9282
|
+
}
|
|
9283
|
+
|
|
9229
9284
|
// src/runtime/run-flow.ts
|
|
9230
9285
|
async function runFlow(graph, executors, onEvent = () => {
|
|
9231
9286
|
}, options = {}) {
|
|
@@ -9241,6 +9296,13 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
9241
9296
|
onEvent({ type: "run-error", error: msg });
|
|
9242
9297
|
return { ok: false, outputs, error: msg };
|
|
9243
9298
|
}
|
|
9299
|
+
const propsCheck = resolveWorkflowProps(graph.inputs, options.props);
|
|
9300
|
+
if (!propsCheck.ok) {
|
|
9301
|
+
onEvent({ type: "run-error", error: propsCheck.error });
|
|
9302
|
+
return { ok: false, outputs, error: propsCheck.error };
|
|
9303
|
+
}
|
|
9304
|
+
const props = propsCheck.props;
|
|
9305
|
+
const declaresProps = (graph.inputs?.length ?? 0) > 0;
|
|
9244
9306
|
const incomingByNode = indexIncoming(graph.edges);
|
|
9245
9307
|
const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
|
|
9246
9308
|
onEvent({ type: "run-start" });
|
|
@@ -9282,10 +9344,11 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
9282
9344
|
}
|
|
9283
9345
|
onEvent({ type: "node-status", nodeId: node.id, status: "running" });
|
|
9284
9346
|
announce(onEvent, node, "start");
|
|
9285
|
-
const inputs = collectInputs(node, incoming, portValues, initialInputs);
|
|
9347
|
+
const inputs = collectInputs(node, incoming, portValues, initialInputs, props, declaresProps);
|
|
9286
9348
|
const exec = pickExecutor(executors, node);
|
|
9287
9349
|
if (!exec) {
|
|
9288
|
-
const
|
|
9350
|
+
const tried = executorLookupIds(node);
|
|
9351
|
+
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.`;
|
|
9289
9352
|
errors.push(msg);
|
|
9290
9353
|
onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
|
|
9291
9354
|
onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
|
|
@@ -9359,8 +9422,13 @@ function topoSort(graph) {
|
|
|
9359
9422
|
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
9360
9423
|
return ordered.map((id2) => byId.get(id2)).filter(Boolean);
|
|
9361
9424
|
}
|
|
9362
|
-
function collectInputs(node, incoming, portValues, initial) {
|
|
9425
|
+
function collectInputs(node, incoming, portValues, initial, props, declaresProps) {
|
|
9363
9426
|
const inputs = { ...initial[node.id] ?? {} };
|
|
9427
|
+
if (incoming.length === 0) {
|
|
9428
|
+
for (const [name, value] of Object.entries(props)) {
|
|
9429
|
+
if (!(name in inputs)) inputs[name] = value;
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9364
9432
|
for (const e of incoming) {
|
|
9365
9433
|
const portId = e.targetHandle ?? "in";
|
|
9366
9434
|
const key = `${e.source}:${e.sourceHandle ?? "out"}`;
|
|
@@ -9370,16 +9438,31 @@ function collectInputs(node, incoming, portValues, initial) {
|
|
|
9370
9438
|
inputs[e.source] = portValues.get(key);
|
|
9371
9439
|
}
|
|
9372
9440
|
}
|
|
9441
|
+
if (declaresProps) inputs.$props = props;
|
|
9373
9442
|
return inputs;
|
|
9374
9443
|
}
|
|
9444
|
+
function executorLookupIds(node) {
|
|
9445
|
+
const ids = [node.id];
|
|
9446
|
+
if (node.type) ids.push(node.type);
|
|
9447
|
+
const declared = node.data?.kind;
|
|
9448
|
+
const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
|
|
9449
|
+
if (kindName && kindName !== node.type) ids.push(kindName);
|
|
9450
|
+
for (const name of [kindName, node.type]) {
|
|
9451
|
+
const kind = name ? getNodeKind(name) : null;
|
|
9452
|
+
if (!kind) continue;
|
|
9453
|
+
for (const id2 of kindIds(kind)) ids.push(id2);
|
|
9454
|
+
}
|
|
9455
|
+
return [...new Set(ids)];
|
|
9456
|
+
}
|
|
9375
9457
|
function pickExecutor(executors, node) {
|
|
9376
9458
|
if (executors[node.id]) return executors[node.id];
|
|
9377
9459
|
if (node.type && executors[node.type]) return executors[node.type];
|
|
9378
9460
|
const declared = node.data?.kind;
|
|
9379
9461
|
const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
|
|
9380
9462
|
if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
|
|
9381
|
-
const
|
|
9382
|
-
|
|
9463
|
+
for (const name of [kindName, node.type]) {
|
|
9464
|
+
const kind = name ? getNodeKind(name) : null;
|
|
9465
|
+
if (!kind) continue;
|
|
9383
9466
|
for (const id2 of kindIds(kind)) {
|
|
9384
9467
|
if (executors[id2]) return executors[id2];
|
|
9385
9468
|
}
|
|
@@ -10506,6 +10589,9 @@ function exportWorkflow(graph, metadata, view) {
|
|
|
10506
10589
|
$schema: WORKFLOW_SCHEMA_URL,
|
|
10507
10590
|
version: WORKFLOW_SCHEMA_VERSION,
|
|
10508
10591
|
metadata: metadata ? { ...metadata, updatedAt: Date.now() } : void 0,
|
|
10592
|
+
// Round-trips, or a saved workflow silently forgets its own contract and
|
|
10593
|
+
// every caller's props become "unknown input" on the next load.
|
|
10594
|
+
...graph.inputs && graph.inputs.length > 0 ? { inputs: graph.inputs } : {},
|
|
10509
10595
|
graph: {
|
|
10510
10596
|
nodes: graph.nodes.map(toSchemaNode),
|
|
10511
10597
|
edges: graph.edges.map(toSchemaEdge)
|
|
@@ -10628,7 +10714,18 @@ function importWorkflow(schema, options = {}) {
|
|
|
10628
10714
|
};
|
|
10629
10715
|
}).filter((e) => e !== null);
|
|
10630
10716
|
const ok = issues.every((i) => i.level !== "error");
|
|
10631
|
-
|
|
10717
|
+
const declaredInputs = Array.isArray(s.inputs) ? s.inputs.filter(
|
|
10718
|
+
(input) => input !== null && typeof input === "object" && typeof input.name === "string"
|
|
10719
|
+
) : void 0;
|
|
10720
|
+
return {
|
|
10721
|
+
ok,
|
|
10722
|
+
graph: {
|
|
10723
|
+
nodes,
|
|
10724
|
+
edges,
|
|
10725
|
+
...declaredInputs && declaredInputs.length > 0 ? { inputs: declaredInputs } : {}
|
|
10726
|
+
},
|
|
10727
|
+
issues
|
|
10728
|
+
};
|
|
10632
10729
|
}
|
|
10633
10730
|
function workflowToBlob(schema) {
|
|
10634
10731
|
return new Blob([JSON.stringify(schema, null, 2)], { type: "application/json" });
|