@bian-womp/spark-graph 0.3.43 → 0.3.45
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/lib/cjs/index.cjs +53 -67
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +1 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/Graph.d.ts +4 -6
- package/lib/cjs/src/runtime/components/Graph.d.ts.map +1 -1
- package/lib/esm/index.js +53 -67
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +1 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/Graph.d.ts +4 -6
- package/lib/esm/src/runtime/components/Graph.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -75,6 +75,7 @@ export declare class GraphRuntime implements IRuntime, INodeExecutor, IEdgePropa
|
|
|
75
75
|
isPaused(): boolean;
|
|
76
76
|
pause(): void;
|
|
77
77
|
resume(): void;
|
|
78
|
+
private executeNodeAutoRun;
|
|
78
79
|
copyOutputs(fromNodeId: string, toNodeId: string, options?: {
|
|
79
80
|
dry?: boolean;
|
|
80
81
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphRuntime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/GraphRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EAEZ,eAAe,EAGf,OAAO,EACR,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC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,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAChC,IAAI;IAeP;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAoCvB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAgBlC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmD7B;;OAEG;IACH,OAAO,CAAC,aAAa;IAyDrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuCzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;OAGG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAuB1C;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,oBAAoB,IAAI,IAAI;CAG7B"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { ResolvedHandles } from "@bian-womp/spark-protocol";
|
|
2
2
|
import { Registry } from "../../builder/Registry";
|
|
3
|
+
import { EventEmitter } from "./EventEmitter";
|
|
3
4
|
import type { RuntimeNode, RuntimeEdge, ReadonlyRuntimeNode, ExecutionPlan } from "./types";
|
|
4
5
|
/**
|
|
5
6
|
* Graph component - manages nodes, edges, and handle resolution
|
|
6
7
|
* This is the ONLY place where nodes, edges, and resolvedByNode are directly updated.
|
|
7
8
|
*/
|
|
8
9
|
export declare class Graph {
|
|
10
|
+
private eventEmitter;
|
|
9
11
|
private registry?;
|
|
10
12
|
private nodes;
|
|
11
13
|
private edges;
|
|
12
14
|
private resolvedByNode;
|
|
13
|
-
constructor(registry?: Registry | undefined);
|
|
15
|
+
constructor(eventEmitter: EventEmitter, registry?: Registry | undefined);
|
|
14
16
|
/**
|
|
15
17
|
* Get a node by ID (readonly to prevent accidental modifications)
|
|
16
18
|
*/
|
|
@@ -43,11 +45,7 @@ export declare class Graph {
|
|
|
43
45
|
/**
|
|
44
46
|
* Update node inputs
|
|
45
47
|
*/
|
|
46
|
-
updateNodeInput(nodeId: string, handle: string, value: unknown): void;
|
|
47
|
-
/**
|
|
48
|
-
* Delete a node input handle
|
|
49
|
-
*/
|
|
50
|
-
deleteNodeInput(nodeId: string, handle: string): void;
|
|
48
|
+
updateNodeInput(nodeId: string, handle: string, value: unknown, calculated?: boolean): void;
|
|
51
49
|
/**
|
|
52
50
|
* Update node outputs
|
|
53
51
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/components/Graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/components/Graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,KAAK;IAMd,OAAO,CAAC,YAAY;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 +493,8 @@ Registry.idCounter = 0;
|
|
|
493
493
|
* This is the ONLY place where nodes, edges, and resolvedByNode are directly updated.
|
|
494
494
|
*/
|
|
495
495
|
class Graph {
|
|
496
|
-
constructor(registry) {
|
|
496
|
+
constructor(eventEmitter, registry) {
|
|
497
|
+
this.eventEmitter = eventEmitter;
|
|
497
498
|
this.registry = registry;
|
|
498
499
|
this.nodes = new Map();
|
|
499
500
|
this.edges = [];
|
|
@@ -550,7 +551,7 @@ class Graph {
|
|
|
550
551
|
/**
|
|
551
552
|
* Update node inputs
|
|
552
553
|
*/
|
|
553
|
-
updateNodeInput(nodeId, handle, value) {
|
|
554
|
+
updateNodeInput(nodeId, handle, value, calculated = true) {
|
|
554
555
|
const node = this.getNodeMutable(nodeId);
|
|
555
556
|
if (!node)
|
|
556
557
|
return;
|
|
@@ -560,15 +561,16 @@ class Graph {
|
|
|
560
561
|
else {
|
|
561
562
|
node.inputs[handle] = value;
|
|
562
563
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
564
|
+
if (calculated) {
|
|
565
|
+
this.updateNodeLastInputAt(nodeId, handle, Date.now());
|
|
566
|
+
}
|
|
567
|
+
this.eventEmitter.emit("value", {
|
|
568
|
+
nodeId,
|
|
569
|
+
handle,
|
|
570
|
+
value,
|
|
571
|
+
io: "input",
|
|
572
|
+
runtimeTypeId: unwrapTypeId(value),
|
|
573
|
+
});
|
|
572
574
|
}
|
|
573
575
|
/**
|
|
574
576
|
* Update node outputs
|
|
@@ -577,7 +579,19 @@ class Graph {
|
|
|
577
579
|
const node = this.nodes.get(nodeId);
|
|
578
580
|
if (!node)
|
|
579
581
|
return;
|
|
580
|
-
|
|
582
|
+
if (value === undefined) {
|
|
583
|
+
delete node.outputs[handle];
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
node.outputs[handle] = value;
|
|
587
|
+
}
|
|
588
|
+
this.eventEmitter.emit("value", {
|
|
589
|
+
nodeId,
|
|
590
|
+
handle,
|
|
591
|
+
value,
|
|
592
|
+
io: "output",
|
|
593
|
+
runtimeTypeId: unwrapTypeId(value),
|
|
594
|
+
});
|
|
581
595
|
}
|
|
582
596
|
/**
|
|
583
597
|
* Update node state
|
|
@@ -650,9 +664,8 @@ class Graph {
|
|
|
650
664
|
const node = this.nodes.get(nodeId);
|
|
651
665
|
if (!node)
|
|
652
666
|
return;
|
|
653
|
-
if (!node.lastInputAt)
|
|
667
|
+
if (!node.lastInputAt)
|
|
654
668
|
node.lastInputAt = {};
|
|
655
|
-
}
|
|
656
669
|
node.lastInputAt[handle] = timestamp;
|
|
657
670
|
}
|
|
658
671
|
/**
|
|
@@ -1975,13 +1988,6 @@ class EdgePropagator {
|
|
|
1975
1988
|
return false;
|
|
1976
1989
|
}
|
|
1977
1990
|
this.graph.updateNodeOutput(srcNodeId, srcHandle, value);
|
|
1978
|
-
this.eventEmitter.emit("value", {
|
|
1979
|
-
nodeId: srcNodeId,
|
|
1980
|
-
handle: srcHandle,
|
|
1981
|
-
value,
|
|
1982
|
-
io: "output",
|
|
1983
|
-
runtimeTypeId: unwrapTypeId(value),
|
|
1984
|
-
});
|
|
1985
1991
|
return true;
|
|
1986
1992
|
}
|
|
1987
1993
|
/**
|
|
@@ -2203,16 +2209,7 @@ class EdgePropagator {
|
|
|
2203
2209
|
* Set target input value and emit event
|
|
2204
2210
|
*/
|
|
2205
2211
|
setTargetInput(edge, dstNode, value) {
|
|
2206
|
-
const now = Date.now();
|
|
2207
2212
|
this.graph.updateNodeInput(edge.target.nodeId, edge.target.handle, value);
|
|
2208
|
-
this.graph.updateNodeLastInputAt(edge.target.nodeId, edge.target.handle, now);
|
|
2209
|
-
this.eventEmitter.emit("value", {
|
|
2210
|
-
nodeId: edge.target.nodeId,
|
|
2211
|
-
handle: edge.target.handle,
|
|
2212
|
-
value,
|
|
2213
|
-
io: "input",
|
|
2214
|
-
runtimeTypeId: unwrapTypeId(value),
|
|
2215
|
-
});
|
|
2216
2213
|
this.handleResolver.scheduleRecomputeHandles(edge.target.nodeId);
|
|
2217
2214
|
}
|
|
2218
2215
|
/**
|
|
@@ -2428,7 +2425,7 @@ class NodeExecutor {
|
|
|
2428
2425
|
return;
|
|
2429
2426
|
const runMode = this.runtime.getRunMode();
|
|
2430
2427
|
if (!runMode) {
|
|
2431
|
-
console.
|
|
2428
|
+
console.trace("NodeExecutor.execute: no runMode, skipping execution");
|
|
2432
2429
|
return;
|
|
2433
2430
|
}
|
|
2434
2431
|
// In manual mode, require runContextIds unless autoRun policy is set
|
|
@@ -2442,12 +2439,12 @@ class NodeExecutor {
|
|
|
2442
2439
|
]);
|
|
2443
2440
|
}
|
|
2444
2441
|
else {
|
|
2445
|
-
console.
|
|
2442
|
+
console.trace("NodeExecutor.execute: no runContextIds provided in manual mode, skipping execution");
|
|
2446
2443
|
return;
|
|
2447
2444
|
}
|
|
2448
2445
|
}
|
|
2449
2446
|
if (runMode === "auto" && runContextIds && runContextIds.size > 0) {
|
|
2450
|
-
console.
|
|
2447
|
+
console.trace("NodeExecutor.execute: runContextIds provided in auto mode, ignoring");
|
|
2451
2448
|
runContextIds = undefined;
|
|
2452
2449
|
}
|
|
2453
2450
|
// Early validation for auto-mode paused state
|
|
@@ -3022,8 +3019,8 @@ class GraphRuntime {
|
|
|
3022
3019
|
this.pauseRefCount = 0;
|
|
3023
3020
|
this.persistentPauseToken = null;
|
|
3024
3021
|
// Initialize components
|
|
3025
|
-
this.graph = new Graph();
|
|
3026
3022
|
this.eventEmitter = new EventEmitter();
|
|
3023
|
+
this.graph = new Graph(this.eventEmitter);
|
|
3027
3024
|
this.runContextManager = new RunContextManager(this.graph, "debug");
|
|
3028
3025
|
this.handleResolver = new HandleResolver(this.graph, this.eventEmitter, this.runContextManager, this);
|
|
3029
3026
|
this.edgePropagator = new EdgePropagator(this.graph, this.eventEmitter, this.runContextManager, this.handleResolver, this);
|
|
@@ -3133,7 +3130,7 @@ class GraphRuntime {
|
|
|
3133
3130
|
if (hasInbound)
|
|
3134
3131
|
continue;
|
|
3135
3132
|
// Validate input value against declared type
|
|
3136
|
-
if (
|
|
3133
|
+
if (registry) {
|
|
3137
3134
|
const desc = registry.nodes.get(node.typeId);
|
|
3138
3135
|
const resolved = this.graph.getResolvedHandles(nodeId);
|
|
3139
3136
|
// Get declared types (may be union); prefer resolved handles over registry statics
|
|
@@ -3155,7 +3152,7 @@ class GraphRuntime {
|
|
|
3155
3152
|
return true;
|
|
3156
3153
|
return typeDesc.validate(value);
|
|
3157
3154
|
});
|
|
3158
|
-
if (!isValidForAny) {
|
|
3155
|
+
if (value !== undefined && !isValidForAny) {
|
|
3159
3156
|
const typeLabel = typeIds.join("|");
|
|
3160
3157
|
const errorMessage = `Invalid value for input ${nodeId}.${handle} (type ${typeLabel}): ${JSON.stringify(value)}`;
|
|
3161
3158
|
this.eventEmitter.emit("error", {
|
|
@@ -3184,11 +3181,7 @@ class GraphRuntime {
|
|
|
3184
3181
|
// However, if autoRun policy is set, nodes run automatically even in manual mode.
|
|
3185
3182
|
if (anyChanged) {
|
|
3186
3183
|
this.handleResolver.scheduleRecomputeHandles(nodeId);
|
|
3187
|
-
|
|
3188
|
-
const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
|
|
3189
|
-
if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
|
|
3190
|
-
this.execute(nodeId);
|
|
3191
|
-
}
|
|
3184
|
+
this.executeNodeAutoRun(nodeId);
|
|
3192
3185
|
}
|
|
3193
3186
|
}
|
|
3194
3187
|
getOutput(nodeId, output) {
|
|
@@ -3403,17 +3396,28 @@ class GraphRuntime {
|
|
|
3403
3396
|
}
|
|
3404
3397
|
}
|
|
3405
3398
|
}
|
|
3399
|
+
executeNodeAutoRun(nodeId) {
|
|
3400
|
+
const node = this.graph.getNode(nodeId);
|
|
3401
|
+
const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
|
|
3402
|
+
let runContextIdsToUse = undefined;
|
|
3403
|
+
if (this.runMode === "manual") {
|
|
3404
|
+
runContextIdsToUse = new Set([
|
|
3405
|
+
this.runContextManager.createRunContext(nodeId, undefined, {
|
|
3406
|
+
propagate: false,
|
|
3407
|
+
}),
|
|
3408
|
+
]);
|
|
3409
|
+
}
|
|
3410
|
+
if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
|
|
3411
|
+
this.execute(nodeId, runContextIdsToUse);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3406
3414
|
copyOutputs(fromNodeId, toNodeId, options) {
|
|
3407
3415
|
const fromNode = this.getNodeData(fromNodeId);
|
|
3408
3416
|
if (!fromNode?.outputs)
|
|
3409
3417
|
return;
|
|
3410
3418
|
this.hydrate({ outputs: { [toNodeId]: { ...fromNode.outputs } } }, { invalidate: !options?.dry });
|
|
3411
3419
|
this.handleResolver.scheduleRecomputeHandles(toNodeId);
|
|
3412
|
-
|
|
3413
|
-
const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
|
|
3414
|
-
if (shouldAutoRun && this.graph.allInboundHaveValue(toNodeId)) {
|
|
3415
|
-
this.execute(toNodeId);
|
|
3416
|
-
}
|
|
3420
|
+
this.executeNodeAutoRun(toNodeId);
|
|
3417
3421
|
}
|
|
3418
3422
|
hydrate(payload, opts) {
|
|
3419
3423
|
const releasePause = this.requestPause();
|
|
@@ -3430,14 +3434,7 @@ class GraphRuntime {
|
|
|
3430
3434
|
const clonedValue = structuredClone(v);
|
|
3431
3435
|
const same = valuesEqual(prev, clonedValue);
|
|
3432
3436
|
if (!same) {
|
|
3433
|
-
this.graph.updateNodeInput(nodeId, h, clonedValue);
|
|
3434
|
-
this.eventEmitter.emit("value", {
|
|
3435
|
-
nodeId,
|
|
3436
|
-
handle: h,
|
|
3437
|
-
value: clonedValue,
|
|
3438
|
-
io: "input",
|
|
3439
|
-
runtimeTypeId: unwrapTypeId(clonedValue),
|
|
3440
|
-
});
|
|
3437
|
+
this.graph.updateNodeInput(nodeId, h, clonedValue, false);
|
|
3441
3438
|
nodeChanged = true;
|
|
3442
3439
|
}
|
|
3443
3440
|
}
|
|
@@ -3452,13 +3449,6 @@ class GraphRuntime {
|
|
|
3452
3449
|
for (const [h, v] of Object.entries(map || {})) {
|
|
3453
3450
|
const clonedValue = structuredClone(v);
|
|
3454
3451
|
this.graph.updateNodeOutput(nodeId, h, clonedValue);
|
|
3455
|
-
this.eventEmitter.emit("value", {
|
|
3456
|
-
nodeId,
|
|
3457
|
-
handle: h,
|
|
3458
|
-
value: clonedValue,
|
|
3459
|
-
io: "output",
|
|
3460
|
-
runtimeTypeId: unwrapTypeId(clonedValue),
|
|
3461
|
-
});
|
|
3462
3452
|
}
|
|
3463
3453
|
}
|
|
3464
3454
|
// Trigger handle resolution for nodes with changed inputs
|
|
@@ -3648,7 +3638,7 @@ class GraphRuntime {
|
|
|
3648
3638
|
if (!currSet.has(handle)) {
|
|
3649
3639
|
const node = this.graph.getNode(nodeId);
|
|
3650
3640
|
if (node && handle in node.inputs) {
|
|
3651
|
-
this.graph.
|
|
3641
|
+
this.graph.updateNodeInput(nodeId, handle, undefined);
|
|
3652
3642
|
changed = true;
|
|
3653
3643
|
}
|
|
3654
3644
|
}
|
|
@@ -3657,11 +3647,7 @@ class GraphRuntime {
|
|
|
3657
3647
|
this.edgePropagator.clearArrayBuckets(nodeId);
|
|
3658
3648
|
// Trigger handle resolution when inputs are removed
|
|
3659
3649
|
this.handleResolver.scheduleRecomputeHandles(nodeId);
|
|
3660
|
-
|
|
3661
|
-
const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
|
|
3662
|
-
if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
|
|
3663
|
-
this.execute(nodeId);
|
|
3664
|
-
}
|
|
3650
|
+
this.executeNodeAutoRun(nodeId);
|
|
3665
3651
|
}
|
|
3666
3652
|
}
|
|
3667
3653
|
// Propagate changes on edges added
|