@bian-womp/spark-graph 0.3.72 → 0.3.73
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 +32 -36
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +7 -6
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts +2 -7
- package/lib/cjs/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/interfaces.d.ts +2 -1
- package/lib/cjs/src/runtime/components/interfaces.d.ts.map +1 -1
- package/lib/esm/index.js +32 -36
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +7 -6
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts +2 -7
- package/lib/esm/src/runtime/components/EdgePropagator.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/interfaces.d.ts +2 -1
- package/lib/esm/src/runtime/components/interfaces.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import type { RuntimeValue, RuntimeInvalidate, RuntimeError, RuntimeStats, Graph
|
|
|
2
2
|
import type { RuntimeNodeStats } from "../core/types";
|
|
3
3
|
import { Registry } from "../builder/Registry";
|
|
4
4
|
import type { INodeExecutor, IRuntime, IEdgePropagator, RuntimeValidator, RuntimeValidationError } from "./components/interfaces";
|
|
5
|
-
import type { RunContextId } from "./components/types";
|
|
5
|
+
import type { RunContextId, RuntimeEdge } from "./components/types";
|
|
6
6
|
export type RuntimeEventListener<K extends RuntimeEventName> = (e: RuntimeEventMap[K]) => void;
|
|
7
7
|
export type RuntimeEventName = "value" | "invalidate" | "error" | "stats";
|
|
8
8
|
export interface RuntimeEventMap {
|
|
@@ -31,14 +31,15 @@ export declare class GraphRuntime implements IRuntime, INodeExecutor, IEdgePropa
|
|
|
31
31
|
startPaused?: boolean;
|
|
32
32
|
}): GraphRuntime;
|
|
33
33
|
on<K extends RuntimeEventName>(event: K, handler: RuntimeEventListener<K>): () => void;
|
|
34
|
-
setInputs(nodeId: string, inputs: Record<string, unknown>): void;
|
|
35
|
-
getOutput(nodeId: string, output: string): unknown;
|
|
36
|
-
launch(invalidate?: boolean, startPaused?: boolean): void;
|
|
37
|
-
triggerExternal(nodeId: string, event: unknown): void;
|
|
38
34
|
/**
|
|
39
35
|
* Check if an event is an invalidate event that should trigger re-execution
|
|
40
36
|
*/
|
|
41
37
|
private isInvalidateEvent;
|
|
38
|
+
private executeNodeAutoRun;
|
|
39
|
+
setInputs(nodeId: string, inputs: Record<string, unknown>): void;
|
|
40
|
+
getOutput(nodeId: string, output: string): unknown;
|
|
41
|
+
launch(invalidate?: boolean, startPaused?: boolean): void;
|
|
42
|
+
triggerExternal(nodeId: string, event: unknown): void;
|
|
42
43
|
cancelNodeRuns(nodeIds: string[]): void;
|
|
43
44
|
getNodeIds(): string[];
|
|
44
45
|
getNodeData(nodeId: string): {
|
|
@@ -79,7 +80,7 @@ export declare class GraphRuntime implements IRuntime, INodeExecutor, IEdgePropa
|
|
|
79
80
|
isPaused(): boolean;
|
|
80
81
|
pause(): void;
|
|
81
82
|
resume(): void;
|
|
82
|
-
|
|
83
|
+
setTargetInput(edge: RuntimeEdge, value: unknown, reason: string): void;
|
|
83
84
|
copyOutputs(fromNodeId: string, toNodeId: string, options?: {
|
|
84
85
|
dry?: boolean;
|
|
85
86
|
}): 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,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AI,IAAI;IAMb,MAAM,IAAI,IAAI;IAsBd,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAMvE,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAQpF,OAAO,CACL,OAAO,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACnD,EACD,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9B,IAAI;IA4CP,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAoPtD,OAAO,IAAI,IAAI;IAcf,OAAO,CACL,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QACL,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;QAClC,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GACA,IAAI;IAIP,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI;IAIxG,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAG3C"}
|
|
@@ -2,7 +2,7 @@ import type { RunContextId } from "./types";
|
|
|
2
2
|
import type { Graph } from "./Graph";
|
|
3
3
|
import type { EventEmitter } from "./EventEmitter";
|
|
4
4
|
import type { RunContextManager } from "./RunContextManager";
|
|
5
|
-
import { INodeExecutor,
|
|
5
|
+
import { INodeExecutor, IEdgePropagator, IRuntime } from "./interfaces";
|
|
6
6
|
/**
|
|
7
7
|
* EdgePropagator component - handles value propagation through edges
|
|
8
8
|
*/
|
|
@@ -10,11 +10,10 @@ export declare class EdgePropagator implements IEdgePropagator {
|
|
|
10
10
|
private readonly graph;
|
|
11
11
|
private readonly eventEmitter;
|
|
12
12
|
private readonly runContextManager;
|
|
13
|
-
private readonly handleResolver;
|
|
14
13
|
private readonly nodeExecutor;
|
|
15
14
|
private readonly runtime;
|
|
16
15
|
private arrayInputBuckets;
|
|
17
|
-
constructor(graph: Graph, eventEmitter: EventEmitter, runContextManager: RunContextManager,
|
|
16
|
+
constructor(graph: Graph, eventEmitter: EventEmitter, runContextManager: RunContextManager, nodeExecutor: INodeExecutor, runtime: IRuntime);
|
|
18
17
|
/**
|
|
19
18
|
* Set source output value and emit event
|
|
20
19
|
*/
|
|
@@ -55,10 +54,6 @@ export declare class EdgePropagator implements IEdgePropagator {
|
|
|
55
54
|
* Check if input value should be set (respecting skipPropagateValues)
|
|
56
55
|
*/
|
|
57
56
|
private shouldSetInputValue;
|
|
58
|
-
/**
|
|
59
|
-
* Set target input value and emit event
|
|
60
|
-
*/
|
|
61
|
-
private setTargetInput;
|
|
62
57
|
/**
|
|
63
58
|
* Execute downstream if conditions are met
|
|
64
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdgePropagator.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/components/EdgePropagator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,aAAa,EA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OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgBjC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI;IAiBxG;;;OAGG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAkB1C;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,oBAAoB,IAAI,IAAI;CAG7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunMode } from "@bian-womp/spark-protocol";
|
|
2
|
-
import type { RunContextId } from "./types";
|
|
2
|
+
import type { RunContextId, RuntimeEdge } from "./types";
|
|
3
3
|
import type { Graph } from "./Graph";
|
|
4
4
|
import type { Registry } from "../../builder/Registry";
|
|
5
5
|
/**
|
|
@@ -54,5 +54,6 @@ export interface IRuntimeValidator {
|
|
|
54
54
|
export interface IRuntime extends IRuntimeValidator {
|
|
55
55
|
isPaused(): boolean;
|
|
56
56
|
getRunMode(): RunMode | null;
|
|
57
|
+
setTargetInput(edge: RuntimeEdge, value: unknown, reason: string): void;
|
|
57
58
|
}
|
|
58
59
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/components/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"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EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,KAAK,KAAK,GAAG,sBAAsB,CAAC;AAEpH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAAC;CAC1E;AAED;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,iBAAiB;IACjD,QAAQ,IAAI,OAAO,CAAC;IACpB,UAAU,IAAI,OAAO,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACzE"}
|
package/lib/esm/index.js
CHANGED
|
@@ -2521,11 +2521,10 @@ class HandleResolver {
|
|
|
2521
2521
|
* EdgePropagator component - handles value propagation through edges
|
|
2522
2522
|
*/
|
|
2523
2523
|
class EdgePropagator {
|
|
2524
|
-
constructor(graph, eventEmitter, runContextManager,
|
|
2524
|
+
constructor(graph, eventEmitter, runContextManager, nodeExecutor, runtime) {
|
|
2525
2525
|
this.graph = graph;
|
|
2526
2526
|
this.eventEmitter = eventEmitter;
|
|
2527
2527
|
this.runContextManager = runContextManager;
|
|
2528
|
-
this.handleResolver = handleResolver;
|
|
2529
2528
|
this.nodeExecutor = nodeExecutor;
|
|
2530
2529
|
this.runtime = runtime;
|
|
2531
2530
|
this.arrayInputBuckets = new Map();
|
|
@@ -2714,7 +2713,7 @@ class EdgePropagator {
|
|
|
2714
2713
|
// Set input value (respecting skipPropagateValues)
|
|
2715
2714
|
const shouldSetValue = this.shouldSetInputValue(effectiveRunContexts);
|
|
2716
2715
|
if (shouldSetValue && valueChanged) {
|
|
2717
|
-
this.setTargetInput(edge, processedValue);
|
|
2716
|
+
this.runtime.setTargetInput(edge, processedValue, "applyToTarget");
|
|
2718
2717
|
}
|
|
2719
2718
|
else if (shouldSetValue && !valueChanged) {
|
|
2720
2719
|
// Even if value didn't change, update timestamp if we're forcing execution
|
|
@@ -2770,13 +2769,6 @@ class EdgePropagator {
|
|
|
2770
2769
|
}
|
|
2771
2770
|
return true;
|
|
2772
2771
|
}
|
|
2773
|
-
/**
|
|
2774
|
-
* Set target input value and emit event
|
|
2775
|
-
*/
|
|
2776
|
-
setTargetInput(edge, value) {
|
|
2777
|
-
this.graph.updateNodeInput(edge.target.nodeId, edge.target.handle, value);
|
|
2778
|
-
this.handleResolver.scheduleRecomputeHandles(edge.target.nodeId);
|
|
2779
|
-
}
|
|
2780
2772
|
/**
|
|
2781
2773
|
* Execute downstream if conditions are met
|
|
2782
2774
|
*/
|
|
@@ -3620,7 +3612,7 @@ class GraphRuntime {
|
|
|
3620
3612
|
this.graph = new Graph(this.eventEmitter);
|
|
3621
3613
|
this.runContextManager = new RunContextManager(this.graph, "warn");
|
|
3622
3614
|
this.handleResolver = new HandleResolver(this.graph, this.eventEmitter, this.runContextManager, this);
|
|
3623
|
-
this.edgePropagator = new EdgePropagator(this.graph, this.eventEmitter, this.runContextManager, this
|
|
3615
|
+
this.edgePropagator = new EdgePropagator(this.graph, this.eventEmitter, this.runContextManager, this, this);
|
|
3624
3616
|
// Create NodeExecutor with EdgePropagator and HandleResolver
|
|
3625
3617
|
this.nodeExecutor = new NodeExecutor(this.graph, this.eventEmitter, this.runContextManager, this.handleResolver, this, this);
|
|
3626
3618
|
// Create RuntimeValidatorManager
|
|
@@ -3709,6 +3701,30 @@ class GraphRuntime {
|
|
|
3709
3701
|
on(event, handler) {
|
|
3710
3702
|
return this.eventEmitter.on(event, handler);
|
|
3711
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* Check if an event is an invalidate event that should trigger re-execution
|
|
3706
|
+
*/
|
|
3707
|
+
isInvalidateEvent(event) {
|
|
3708
|
+
if (!event || typeof event !== "object")
|
|
3709
|
+
return false;
|
|
3710
|
+
// Check if event has action === "invalidate"
|
|
3711
|
+
const e = event;
|
|
3712
|
+
return e.action === "invalidate";
|
|
3713
|
+
}
|
|
3714
|
+
executeNodeAutoRun(nodeId, opts) {
|
|
3715
|
+
const node = this.graph.getNode(nodeId);
|
|
3716
|
+
const shouldAutoRun = this.runMode === "auto" || node?.policy?.autoRun === true;
|
|
3717
|
+
let runContextIdsToUse = undefined;
|
|
3718
|
+
if (this.runMode === "manual") {
|
|
3719
|
+
runContextIdsToUse = new Set([this.runContextManager.createRunContext(nodeId, { propagate: false })]);
|
|
3720
|
+
}
|
|
3721
|
+
if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
|
|
3722
|
+
this.execute(nodeId, {
|
|
3723
|
+
runContextIds: runContextIdsToUse,
|
|
3724
|
+
reason: opts?.reason ?? "executeNodeAutoRun",
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3712
3728
|
setInputs(nodeId, inputs) {
|
|
3713
3729
|
const node = this.graph.getNode(nodeId);
|
|
3714
3730
|
if (!node)
|
|
@@ -3764,8 +3780,6 @@ class GraphRuntime {
|
|
|
3764
3780
|
const same = valuesEqual(prev, value);
|
|
3765
3781
|
if (!same) {
|
|
3766
3782
|
this.graph.updateNodeInput(nodeId, handle, value);
|
|
3767
|
-
// Emit value event for input updates
|
|
3768
|
-
this.eventEmitter.emit("value", { nodeId, handle, value, io: "input" });
|
|
3769
3783
|
anyChanged = true;
|
|
3770
3784
|
}
|
|
3771
3785
|
}
|
|
@@ -3817,16 +3831,6 @@ class GraphRuntime {
|
|
|
3817
3831
|
// Forward event to node's onExternalEvent handler for custom actions
|
|
3818
3832
|
node.runtime.onExternalEvent?.(event, node.state);
|
|
3819
3833
|
}
|
|
3820
|
-
/**
|
|
3821
|
-
* Check if an event is an invalidate event that should trigger re-execution
|
|
3822
|
-
*/
|
|
3823
|
-
isInvalidateEvent(event) {
|
|
3824
|
-
if (!event || typeof event !== "object")
|
|
3825
|
-
return false;
|
|
3826
|
-
// Check if event has action === "invalidate"
|
|
3827
|
-
const e = event;
|
|
3828
|
-
return e.action === "invalidate";
|
|
3829
|
-
}
|
|
3830
3834
|
cancelNodeRuns(nodeIds) {
|
|
3831
3835
|
this.nodeExecutor.cancelNodeRuns(nodeIds);
|
|
3832
3836
|
}
|
|
@@ -3854,6 +3858,7 @@ class GraphRuntime {
|
|
|
3854
3858
|
this.nodeExecutor.setEnvironment(this.environment);
|
|
3855
3859
|
for (const nodeId of this.graph.getNodeIds()) {
|
|
3856
3860
|
this.handleResolver.scheduleRecomputeHandles(nodeId);
|
|
3861
|
+
this.executeNodeAutoRun(nodeId, { reason: "setEnvironment" });
|
|
3857
3862
|
}
|
|
3858
3863
|
}
|
|
3859
3864
|
setCustomNodeData(customNodeData) {
|
|
@@ -4001,19 +4006,10 @@ class GraphRuntime {
|
|
|
4001
4006
|
}
|
|
4002
4007
|
}
|
|
4003
4008
|
}
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
if (this.runMode === "manual") {
|
|
4009
|
-
runContextIdsToUse = new Set([this.runContextManager.createRunContext(nodeId, { propagate: false })]);
|
|
4010
|
-
}
|
|
4011
|
-
if (shouldAutoRun && this.graph.allInboundHaveValue(nodeId)) {
|
|
4012
|
-
this.execute(nodeId, {
|
|
4013
|
-
runContextIds: runContextIdsToUse,
|
|
4014
|
-
reason: opts?.reason ?? "executeNodeAutoRun",
|
|
4015
|
-
});
|
|
4016
|
-
}
|
|
4009
|
+
setTargetInput(edge, value, reason) {
|
|
4010
|
+
this.graph.updateNodeInput(edge.target.nodeId, edge.target.handle, value);
|
|
4011
|
+
this.handleResolver.scheduleRecomputeHandles(edge.target.nodeId);
|
|
4012
|
+
this.executeNodeAutoRun(edge.target.nodeId, { reason });
|
|
4017
4013
|
}
|
|
4018
4014
|
copyOutputs(fromNodeId, toNodeId, options) {
|
|
4019
4015
|
const fromNode = this.getNodeData(fromNodeId);
|