@bian-womp/spark-graph 0.2.47 → 0.2.48
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 +52 -22
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/index.d.ts +1 -0
- package/lib/cjs/src/index.d.ts.map +1 -1
- package/lib/cjs/src/runtime/EngineFactory.d.ts +10 -0
- package/lib/cjs/src/runtime/EngineFactory.d.ts.map +1 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +4 -4
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/cjs/src/runtime/HybridEngine.d.ts.map +1 -1
- package/lib/esm/index.js +52 -23
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/index.d.ts +1 -0
- package/lib/esm/src/index.d.ts.map +1 -1
- package/lib/esm/src/runtime/EngineFactory.d.ts +10 -0
- package/lib/esm/src/runtime/EngineFactory.d.ts.map +1 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts +4 -4
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/src/runtime/HybridEngine.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/src/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { BatchedEngine } from "./runtime/BatchedEngine";
|
|
|
12
12
|
export { PullEngine } from "./runtime/PullEngine";
|
|
13
13
|
export { HybridEngine } from "./runtime/HybridEngine";
|
|
14
14
|
export { StepEngine } from "./runtime/StepEngine";
|
|
15
|
+
export { createEngine } from "./runtime/EngineFactory";
|
|
15
16
|
export { ComputeCategory } from "./plugins/compute";
|
|
16
17
|
export { CompositeCategory } from "./plugins/composite";
|
|
17
18
|
export { createSimpleGraphRegistry, createSimpleGraphDef, } from "./examples/simple";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,Y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AY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RunnerOptions } from "@bian-womp/spark-protocol";
|
|
2
|
+
import type { Engine } from "./Engine";
|
|
3
|
+
import type { GraphRuntime } from "./GraphRuntime";
|
|
4
|
+
export type EngineConfig = Omit<RunnerOptions, "invalidate">;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an Engine instance for the given GraphRuntime based on engine configuration.
|
|
7
|
+
* This is the single source of truth for engine creation, used by both local and remote runners.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createEngine(runtime: GraphRuntime, config?: EngineConfig): Engine;
|
|
10
|
+
//# sourceMappingURL=EngineFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineFactory.d.ts","sourceRoot":"","sources":["../../../../src/runtime/EngineFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,CAuBR"}
|
|
@@ -30,10 +30,10 @@ export declare class GraphRuntime {
|
|
|
30
30
|
getOutput(nodeId: string, output: string): unknown;
|
|
31
31
|
private static buildEdgeConverters;
|
|
32
32
|
private createExecutionContext;
|
|
33
|
-
private
|
|
33
|
+
private scheduleInputsChangedInternal;
|
|
34
34
|
private allInboundHaveValue;
|
|
35
35
|
private getEffectiveInputs;
|
|
36
|
-
private
|
|
36
|
+
private invalidateDownstreamInternal;
|
|
37
37
|
private propagate;
|
|
38
38
|
private static computeResolvedHandleMap;
|
|
39
39
|
private static buildEdges;
|
|
@@ -56,8 +56,8 @@ export declare class GraphRuntime {
|
|
|
56
56
|
whenIdle(): Promise<void>;
|
|
57
57
|
pause(): void;
|
|
58
58
|
resume(): void;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
invalidateDownstream(nodeId: string): void;
|
|
60
|
+
scheduleInputsChanged(nodeId: string): void;
|
|
61
61
|
hydrate(payload: {
|
|
62
62
|
inputs?: Record<string, Record<string, unknown>>;
|
|
63
63
|
outputs?: Record<string, Record<string, unknown>>;
|
|
@@ -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,EACZ,eAAe,EACf,eAAe,EAIhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAIV,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,IAAI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EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,YAAa,SAAQ,cAAc;IAMN,OAAO,CAAC,IAAI;IALpD,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAA6B;gBACnC,YAAY,EAAE,YAAY,EAAU,IAAI,GAAE,aAAkB;IAKxE,OAAO,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"HybridEngine.d.ts","sourceRoot":"","sources":["../../../../src/runtime/HybridEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,YAAa,SAAQ,cAAc;IAMN,OAAO,CAAC,IAAI;IALpD,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAA6B;gBACnC,YAAY,EAAE,YAAY,EAAU,IAAI,GAAE,aAAkB;IAKxE,OAAO,CAAC,YAAY;IAqBX,MAAM,IAAI,IAAI;IAId,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAyBhE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAKrD,OAAO,IAAI,IAAI;CAOzB"}
|
package/lib/esm/index.js
CHANGED
|
@@ -564,7 +564,7 @@ class GraphRuntime {
|
|
|
564
564
|
if (!this.paused) {
|
|
565
565
|
// Only schedule if all inbound inputs are present (or there are none)
|
|
566
566
|
if (anyChanged && this.allInboundHaveValue(nodeId))
|
|
567
|
-
this.
|
|
567
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
568
568
|
// Recompute dynamic handles for this node when its direct inputs change
|
|
569
569
|
if (anyChanged)
|
|
570
570
|
this.scheduleRecomputeHandles(nodeId);
|
|
@@ -648,10 +648,10 @@ class GraphRuntime {
|
|
|
648
648
|
state: node.state,
|
|
649
649
|
setState: (next) => Object.assign(node.state, next),
|
|
650
650
|
emit: emitHandler,
|
|
651
|
-
invalidateDownstream: () => this.
|
|
651
|
+
invalidateDownstream: () => this.invalidateDownstreamInternal(nodeId),
|
|
652
652
|
scheduleInputsChanged: () => {
|
|
653
653
|
if (this.allInboundHaveValue(nodeId)) {
|
|
654
|
-
this.
|
|
654
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
655
655
|
}
|
|
656
656
|
},
|
|
657
657
|
getInput: (handle) => inputs[handle],
|
|
@@ -661,7 +661,7 @@ class GraphRuntime {
|
|
|
661
661
|
reportProgress,
|
|
662
662
|
};
|
|
663
663
|
}
|
|
664
|
-
|
|
664
|
+
scheduleInputsChangedInternal(nodeId) {
|
|
665
665
|
const node = this.nodes.get(nodeId);
|
|
666
666
|
if (!node)
|
|
667
667
|
return;
|
|
@@ -865,7 +865,7 @@ class GraphRuntime {
|
|
|
865
865
|
}
|
|
866
866
|
return effective;
|
|
867
867
|
}
|
|
868
|
-
|
|
868
|
+
invalidateDownstreamInternal(nodeId) {
|
|
869
869
|
// Notifies dependents; for now we propagate current outputs
|
|
870
870
|
for (const e of this.edges.filter((e) => e.source.nodeId === nodeId)) {
|
|
871
871
|
const value = this.getOutput(nodeId, e.source.handle);
|
|
@@ -958,7 +958,7 @@ class GraphRuntime {
|
|
|
958
958
|
// Recompute dynamic handles for the destination node on input change
|
|
959
959
|
this.scheduleRecomputeHandles(e.target.nodeId);
|
|
960
960
|
if (!this.paused && this.allInboundHaveValue(e.target.nodeId))
|
|
961
|
-
this.
|
|
961
|
+
this.scheduleInputsChangedInternal(e.target.nodeId);
|
|
962
962
|
}
|
|
963
963
|
};
|
|
964
964
|
if (e.convertAsync) {
|
|
@@ -1160,7 +1160,7 @@ class GraphRuntime {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
1162
|
// Invalidate downstream for this node so UI refreshes
|
|
1163
|
-
this.
|
|
1163
|
+
this.invalidateDownstreamInternal(nodeId);
|
|
1164
1164
|
}
|
|
1165
1165
|
launch(invalidate = false) {
|
|
1166
1166
|
// call onActivated for nodes that implement it
|
|
@@ -1175,7 +1175,7 @@ class GraphRuntime {
|
|
|
1175
1175
|
// After activation, schedule nodes that have all inbound inputs present
|
|
1176
1176
|
for (const nodeId of this.nodes.keys()) {
|
|
1177
1177
|
if (this.allInboundHaveValue(nodeId))
|
|
1178
|
-
this.
|
|
1178
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
@@ -1188,9 +1188,9 @@ class GraphRuntime {
|
|
|
1188
1188
|
typeof event === "object" &&
|
|
1189
1189
|
event.type === "invalidate") {
|
|
1190
1190
|
if (this.allInboundHaveValue(nodeId))
|
|
1191
|
-
this.
|
|
1191
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
1192
1192
|
else
|
|
1193
|
-
this.
|
|
1193
|
+
this.invalidateDownstreamInternal(nodeId);
|
|
1194
1194
|
}
|
|
1195
1195
|
else {
|
|
1196
1196
|
node.runtime.onExternalEvent?.(event, node.state);
|
|
@@ -1293,11 +1293,11 @@ class GraphRuntime {
|
|
|
1293
1293
|
resume() {
|
|
1294
1294
|
this.paused = false;
|
|
1295
1295
|
}
|
|
1296
|
-
|
|
1297
|
-
this.
|
|
1296
|
+
invalidateDownstream(nodeId) {
|
|
1297
|
+
this.invalidateDownstreamInternal(nodeId);
|
|
1298
1298
|
}
|
|
1299
|
-
|
|
1300
|
-
this.
|
|
1299
|
+
scheduleInputsChanged(nodeId) {
|
|
1300
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
1301
1301
|
}
|
|
1302
1302
|
// Hydrate inputs/outputs without triggering computation; optionally re-emit outputs downstream
|
|
1303
1303
|
hydrate(payload, opts) {
|
|
@@ -1494,7 +1494,7 @@ class GraphRuntime {
|
|
|
1494
1494
|
if (bucketsForNode.size === 0)
|
|
1495
1495
|
this.arrayInputBuckets.delete(nodeId);
|
|
1496
1496
|
}
|
|
1497
|
-
this.
|
|
1497
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
1500
|
// Re-emit outputs when per-handle target sets change (precise and simple)
|
|
@@ -1537,7 +1537,7 @@ class GraphRuntime {
|
|
|
1537
1537
|
if (val !== undefined)
|
|
1538
1538
|
this.propagate(nodeId, handle, val);
|
|
1539
1539
|
else if (this.allInboundHaveValue(nodeId))
|
|
1540
|
-
this.
|
|
1540
|
+
this.scheduleInputsChangedInternal(nodeId);
|
|
1541
1541
|
}
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
@@ -1917,7 +1917,7 @@ class BatchedEngine extends AbstractEngine {
|
|
|
1917
1917
|
this.dirtyNodes.clear();
|
|
1918
1918
|
this.graphRuntime.resume();
|
|
1919
1919
|
for (const n of nodes)
|
|
1920
|
-
this.graphRuntime.
|
|
1920
|
+
this.graphRuntime.scheduleInputsChanged(n);
|
|
1921
1921
|
await this.graphRuntime.whenIdle();
|
|
1922
1922
|
this.graphRuntime.pause();
|
|
1923
1923
|
}
|
|
@@ -1938,7 +1938,7 @@ class PullEngine extends AbstractEngine {
|
|
|
1938
1938
|
// Pull API
|
|
1939
1939
|
async computeNode(nodeId) {
|
|
1940
1940
|
this.graphRuntime.resume();
|
|
1941
|
-
this.graphRuntime.
|
|
1941
|
+
this.graphRuntime.scheduleInputsChanged(nodeId);
|
|
1942
1942
|
await this.graphRuntime.whenIdle();
|
|
1943
1943
|
this.graphRuntime.pause();
|
|
1944
1944
|
}
|
|
@@ -1967,7 +1967,7 @@ class HybridEngine extends AbstractEngine {
|
|
|
1967
1967
|
const nodes = Array.from(this.dirtyNodes);
|
|
1968
1968
|
this.dirtyNodes.clear();
|
|
1969
1969
|
for (const n of nodes)
|
|
1970
|
-
this.graphRuntime.
|
|
1970
|
+
this.graphRuntime.scheduleInputsChanged(n);
|
|
1971
1971
|
if (this.flushTimer) {
|
|
1972
1972
|
clearTimeout(this.flushTimer);
|
|
1973
1973
|
this.flushTimer = undefined;
|
|
@@ -1997,14 +1997,14 @@ class HybridEngine extends AbstractEngine {
|
|
|
1997
1997
|
const nodes = Array.from(this.dirtyNodes);
|
|
1998
1998
|
this.dirtyNodes.clear();
|
|
1999
1999
|
for (const n of nodes)
|
|
2000
|
-
this.graphRuntime.
|
|
2000
|
+
this.graphRuntime.scheduleInputsChanged(n);
|
|
2001
2001
|
this.flushTimer = undefined;
|
|
2002
2002
|
}, windowMs);
|
|
2003
2003
|
}
|
|
2004
2004
|
super.setInputs(nodeId, inputs);
|
|
2005
2005
|
this.dirtyNodes.add(nodeId);
|
|
2006
2006
|
if (!this.batching)
|
|
2007
|
-
this.graphRuntime.
|
|
2007
|
+
this.graphRuntime.scheduleInputsChanged(nodeId);
|
|
2008
2008
|
}
|
|
2009
2009
|
triggerExternal(nodeId, event) {
|
|
2010
2010
|
super.triggerExternal(nodeId, event);
|
|
@@ -2041,12 +2041,41 @@ class StepEngine extends AbstractEngine {
|
|
|
2041
2041
|
this.dirtyNodes.clear();
|
|
2042
2042
|
this.graphRuntime.resume();
|
|
2043
2043
|
for (const n of nodes)
|
|
2044
|
-
this.graphRuntime.
|
|
2044
|
+
this.graphRuntime.scheduleInputsChanged(n);
|
|
2045
2045
|
await this.graphRuntime.whenIdle();
|
|
2046
2046
|
this.graphRuntime.pause();
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
|
|
2050
|
+
/**
|
|
2051
|
+
* Creates an Engine instance for the given GraphRuntime based on engine configuration.
|
|
2052
|
+
* This is the single source of truth for engine creation, used by both local and remote runners.
|
|
2053
|
+
*/
|
|
2054
|
+
function createEngine(runtime, config) {
|
|
2055
|
+
const engineKind = config?.engine ?? "push";
|
|
2056
|
+
const batched = config?.batched ?? { flushIntervalMs: 0 };
|
|
2057
|
+
const hybrid = config?.hybrid ?? { windowMs: 250, batchThreshold: 3 };
|
|
2058
|
+
switch (engineKind) {
|
|
2059
|
+
case "push":
|
|
2060
|
+
return new PushEngine(runtime);
|
|
2061
|
+
case "batched":
|
|
2062
|
+
return new BatchedEngine(runtime, {
|
|
2063
|
+
flushIntervalMs: batched.flushIntervalMs,
|
|
2064
|
+
});
|
|
2065
|
+
case "pull":
|
|
2066
|
+
return new PullEngine(runtime);
|
|
2067
|
+
case "hybrid":
|
|
2068
|
+
return new HybridEngine(runtime, {
|
|
2069
|
+
windowMs: hybrid.windowMs,
|
|
2070
|
+
batchThreshold: hybrid.batchThreshold,
|
|
2071
|
+
});
|
|
2072
|
+
case "step":
|
|
2073
|
+
return new StepEngine(runtime);
|
|
2074
|
+
default:
|
|
2075
|
+
throw new Error(`Unknown engine kind: ${engineKind}`);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2050
2079
|
const ComputeCategory = {
|
|
2051
2080
|
id: "compute",
|
|
2052
2081
|
displayName: "Compute",
|
|
@@ -3446,5 +3475,5 @@ function createValidationGraphRegistry() {
|
|
|
3446
3475
|
return registry;
|
|
3447
3476
|
}
|
|
3448
3477
|
|
|
3449
|
-
export { BatchedEngine, CompositeCategory, ComputeCategory, GraphBuilder, GraphRuntime, HybridEngine, PullEngine, PushEngine, Registry, StepEngine, createAsyncGraphDef, createAsyncGraphRegistry, createProgressGraphDef, createProgressGraphRegistry, createSimpleGraphDef, createSimpleGraphRegistry, createValidationGraphDef, createValidationGraphRegistry, getInputTypeId, getTypedOutputTypeId, getTypedOutputValue, installLogging, isInputPrivate, isTypedOutput, registerDelayNode, registerProgressNodes, typed };
|
|
3478
|
+
export { BatchedEngine, CompositeCategory, ComputeCategory, GraphBuilder, GraphRuntime, HybridEngine, PullEngine, PushEngine, Registry, StepEngine, createAsyncGraphDef, createAsyncGraphRegistry, createEngine, createProgressGraphDef, createProgressGraphRegistry, createSimpleGraphDef, createSimpleGraphRegistry, createValidationGraphDef, createValidationGraphRegistry, getInputTypeId, getTypedOutputTypeId, getTypedOutputValue, installLogging, isInputPrivate, isTypedOutput, registerDelayNode, registerProgressNodes, typed };
|
|
3450
3479
|
//# sourceMappingURL=index.js.map
|