@bian-womp/spark-graph 0.1.13 → 0.1.15
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 +107 -44
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/types.d.ts +5 -0
- package/lib/cjs/src/core/types.d.ts.map +1 -1
- package/lib/cjs/src/examples/progress.d.ts.map +1 -1
- package/lib/cjs/src/examples/shared.d.ts.map +1 -1
- package/lib/cjs/src/examples/simple.d.ts.map +1 -1
- package/lib/cjs/src/index.d.ts +1 -1
- package/lib/cjs/src/index.d.ts.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +9 -87
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/index.js +107 -44
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/types.d.ts +5 -0
- package/lib/esm/src/core/types.d.ts.map +1 -1
- package/lib/esm/src/examples/progress.d.ts.map +1 -1
- package/lib/esm/src/examples/shared.d.ts.map +1 -1
- package/lib/esm/src/examples/simple.d.ts.map +1 -1
- package/lib/esm/src/index.d.ts +1 -1
- package/lib/esm/src/index.d.ts.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +9 -87
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -51,6 +51,10 @@ export interface NodeTypeDescriptor<I extends Record<string, DataTypeId> = Recor
|
|
|
51
51
|
inputs: I;
|
|
52
52
|
outputs: O;
|
|
53
53
|
impl: Impl;
|
|
54
|
+
inputDefaults?: Record<string, unknown> | ((ctx: {
|
|
55
|
+
params?: Record<string, unknown>;
|
|
56
|
+
environment: Record<string, unknown>;
|
|
57
|
+
}) => Record<string, unknown>);
|
|
54
58
|
lifecycle?: {
|
|
55
59
|
init?: (initial: Record<string, unknown>, ctx: NodeContext<State>) => void | Promise<void>;
|
|
56
60
|
dispose?: (ctx: NodeContext<State>) => void;
|
|
@@ -60,6 +64,7 @@ export interface GraphNodeDefinition {
|
|
|
60
64
|
nodeId: NodeInstanceId;
|
|
61
65
|
typeId: NodeTypeId;
|
|
62
66
|
params?: Record<string, unknown>;
|
|
67
|
+
initialInputs?: Record<string, unknown>;
|
|
63
68
|
}
|
|
64
69
|
export interface GraphEdgeDefinition {
|
|
65
70
|
id: EdgeInstanceId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,EAAE,EAAE,UAAU,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,oBAAoB,GACpB,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,WAAW,CAAC,KAAK;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,WAAW,CAAC,KAAK,CAAC;IACjE,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACj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c,CAAC;IACnB,MAAM,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,CAAC;IACrD,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../../src/examples/progress.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,wBAAgB,sBAAsB,oBAsBrC;AAED,wBAAgB,2BAA2B,0BAI1C;AAED,wBAAsB,IAAI,
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../../src/examples/progress.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,wBAAgB,sBAAsB,oBAsBrC;AAED,wBAAgB,2BAA2B,0BAI1C;AAED,wBAAsB,IAAI,kBA+DzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/examples/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,eAAe,CAAC;AA2BvE,wBAAgB,uBAAuB,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/examples/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,eAAe,CAAC;AA2BvE,wBAAgB,uBAAuB,IAAI,QAAQ,CAsXlD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,QA+BnD;AAqBD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,QA6BvD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,6BAUrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../../../src/examples/simple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../../../src/examples/simple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyChD,wBAAgB,oBAAoB,oBAEnC;AAED,wBAAgB,yBAAyB,0BAExC;AAGD,wBAAsB,IAAI,kBAkDzB"}
|
package/lib/cjs/src/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { ValidationIssue, ValidationReport } from "./builder/GraphBuilder";
|
|
|
6
6
|
export { GraphRuntime } from "./runtime/GraphRuntime";
|
|
7
7
|
export type { RunnerControl } from "./runtime/RunnerControl";
|
|
8
8
|
export { LocalRunner } from "./runtime/LocalRunner";
|
|
9
|
-
export type { RuntimeEventName, RuntimeEventMap
|
|
9
|
+
export type { RuntimeEventName, RuntimeEventMap } from "./runtime/GraphRuntime";
|
|
10
10
|
export type { Engine, EngineEventListener, EngineEventMap, EngineEventName, } from "./runtime/Engine";
|
|
11
11
|
export { PushEngine } from "./runtime/PushEngine";
|
|
12
12
|
export { BatchedEngine } from "./runtime/BatchedEngine";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,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M,uBAAuB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EACV,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,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,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,83 +1,13 @@
|
|
|
1
|
+
import type { RuntimeValue, RuntimeInvalidate, RuntimeError, RuntimeStats } from "@bian-womp/spark-protocol";
|
|
1
2
|
import type { GraphDefinition, RuntimeNodeStats } from "../core/types";
|
|
2
3
|
import { Registry } from "../builder/Registry";
|
|
3
4
|
export type RuntimeEventListener<K extends RuntimeEventName> = (e: RuntimeEventMap[K]) => void;
|
|
4
5
|
export type RuntimeEventName = "value" | "invalidate" | "error" | "stats";
|
|
5
|
-
export interface ValueEvent {
|
|
6
|
-
nodeId: string;
|
|
7
|
-
handle: string;
|
|
8
|
-
value: unknown;
|
|
9
|
-
io: "input" | "output";
|
|
10
|
-
}
|
|
11
|
-
export type NodeRunErrorEvent = {
|
|
12
|
-
nodeId: string;
|
|
13
|
-
runId: string;
|
|
14
|
-
err: unknown;
|
|
15
|
-
};
|
|
16
|
-
export type EdgeConvertErrorEvent = {
|
|
17
|
-
kind: "edge-convert";
|
|
18
|
-
edgeId: string;
|
|
19
|
-
source: {
|
|
20
|
-
nodeId: string;
|
|
21
|
-
handle: string;
|
|
22
|
-
};
|
|
23
|
-
target: {
|
|
24
|
-
nodeId: string;
|
|
25
|
-
handle: string;
|
|
26
|
-
};
|
|
27
|
-
err: unknown;
|
|
28
|
-
};
|
|
29
|
-
export type RuntimeErrorEvent = NodeRunErrorEvent | EdgeConvertErrorEvent;
|
|
30
|
-
export interface InvalidateEvent {
|
|
31
|
-
reason: string;
|
|
32
|
-
}
|
|
33
|
-
export type NodeStartStats = {
|
|
34
|
-
kind: "node-start";
|
|
35
|
-
nodeId: string;
|
|
36
|
-
runId: string;
|
|
37
|
-
};
|
|
38
|
-
export type NodeProgressStats = {
|
|
39
|
-
kind: "node-progress";
|
|
40
|
-
nodeId: string;
|
|
41
|
-
runId: string;
|
|
42
|
-
progress: number;
|
|
43
|
-
};
|
|
44
|
-
export type NodeDoneStats = {
|
|
45
|
-
kind: "node-done";
|
|
46
|
-
nodeId: string;
|
|
47
|
-
runId: string;
|
|
48
|
-
durationMs?: number;
|
|
49
|
-
};
|
|
50
|
-
export type EdgeStartStats = {
|
|
51
|
-
kind: "edge-start";
|
|
52
|
-
edgeId: string;
|
|
53
|
-
source: {
|
|
54
|
-
nodeId: string;
|
|
55
|
-
handle: string;
|
|
56
|
-
};
|
|
57
|
-
target: {
|
|
58
|
-
nodeId: string;
|
|
59
|
-
handle: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export type EdgeDoneStats = {
|
|
63
|
-
kind: "edge-done";
|
|
64
|
-
edgeId: string;
|
|
65
|
-
source: {
|
|
66
|
-
nodeId: string;
|
|
67
|
-
handle: string;
|
|
68
|
-
};
|
|
69
|
-
target: {
|
|
70
|
-
nodeId: string;
|
|
71
|
-
handle: string;
|
|
72
|
-
};
|
|
73
|
-
durationMs?: number;
|
|
74
|
-
};
|
|
75
|
-
export type StatsEvent = NodeStartStats | NodeProgressStats | NodeDoneStats | EdgeStartStats | EdgeDoneStats;
|
|
76
6
|
export interface RuntimeEventMap {
|
|
77
|
-
value:
|
|
78
|
-
invalidate:
|
|
79
|
-
error:
|
|
80
|
-
stats:
|
|
7
|
+
value: RuntimeValue;
|
|
8
|
+
invalidate: RuntimeInvalidate;
|
|
9
|
+
error: RuntimeError;
|
|
10
|
+
stats: RuntimeStats;
|
|
81
11
|
}
|
|
82
12
|
export declare class GraphRuntime {
|
|
83
13
|
private nodes;
|
|
@@ -97,32 +27,24 @@ export declare class GraphRuntime {
|
|
|
97
27
|
private allInboundHaveValue;
|
|
98
28
|
private invalidateDownstream;
|
|
99
29
|
private propagate;
|
|
30
|
+
private reemitNodeOutputs;
|
|
100
31
|
launch(): void;
|
|
101
32
|
triggerExternal(nodeId: string, event: unknown): void;
|
|
102
33
|
dispose(): void;
|
|
103
|
-
|
|
34
|
+
getNodeIds(): string[];
|
|
35
|
+
getNodeData(nodeId: string): {
|
|
104
36
|
inputs: Record<string, unknown>;
|
|
105
37
|
outputs: Record<string, unknown>;
|
|
106
38
|
state: unknown;
|
|
107
39
|
params?: Record<string, unknown>;
|
|
108
40
|
stats?: RuntimeNodeStats;
|
|
109
41
|
} | undefined;
|
|
110
|
-
|
|
42
|
+
getEnvironment(): Record<string, unknown>;
|
|
111
43
|
setEnvironment(env: Record<string, unknown>): void;
|
|
112
|
-
__unsafe_setEnvironment(env: Record<string, unknown>): void;
|
|
113
|
-
__unsafe_hydrateNode(nodeId: string, data: {
|
|
114
|
-
inputs?: Record<string, unknown>;
|
|
115
|
-
outputs?: Record<string, unknown>;
|
|
116
|
-
state?: unknown;
|
|
117
|
-
params?: Record<string, unknown>;
|
|
118
|
-
}, opts?: {
|
|
119
|
-
replace?: boolean;
|
|
120
|
-
}): void;
|
|
121
44
|
whenIdle(): Promise<void>;
|
|
122
45
|
pause(): void;
|
|
123
46
|
resume(): void;
|
|
124
47
|
__unsafe_invalidateDownstream(nodeId: string): void;
|
|
125
|
-
__unsafe_reemitNodeOutputs(nodeId: string): void;
|
|
126
48
|
__unsafe_scheduleInputsChanged(nodeId: string): void;
|
|
127
49
|
update(def: GraphDefinition, registry: Registry): void;
|
|
128
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphRuntime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/GraphRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAIf,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,IAAI,CAC7D,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAClB,IAAI,CAAC;AAEV,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC;
|
|
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,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,eAAe,EAIf,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,IAAI,CAC7D,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAClB,IAAI,CAAC;AAEV,MAAM,MAAM,gBAAgB,G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IAAI;IAqBrD,OAAO,IAAI,IAAI;IAcf,UAAU,IAAI,MAAM,EAAE;IAKtB,WAAW,CAAC,MAAM,EAAE,MAAM,GACtB;QACE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;KAC1B,GACD,SAAS;IAYb,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI5C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB/B,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IAId,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAInD,8BAA8B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAKpD,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAsMvD"}
|
package/lib/esm/index.js
CHANGED
|
@@ -462,6 +462,39 @@ class GraphRuntime {
|
|
|
462
462
|
stats: { runs: 0, inFlight: false, progress: 0 },
|
|
463
463
|
};
|
|
464
464
|
});
|
|
465
|
+
// After nodes and edges exist, seed registry- and graph-level defaults
|
|
466
|
+
for (const n of def.nodes) {
|
|
467
|
+
const node = gr.nodes.get(n.nodeId);
|
|
468
|
+
const desc = registry.nodes.get(n.typeId);
|
|
469
|
+
if (!node || !desc)
|
|
470
|
+
continue;
|
|
471
|
+
// Resolve registry-level defaults (object or function)
|
|
472
|
+
const regDefaults = typeof desc.inputDefaults === "function"
|
|
473
|
+
? desc.inputDefaults({
|
|
474
|
+
params: n.params,
|
|
475
|
+
environment: gr.environment,
|
|
476
|
+
})
|
|
477
|
+
: desc.inputDefaults ?? {};
|
|
478
|
+
const graphDefaults = n.initialInputs ?? {};
|
|
479
|
+
// Apply precedence: graph-level overrides registry-level
|
|
480
|
+
const merged = {
|
|
481
|
+
...regDefaults,
|
|
482
|
+
...graphDefaults,
|
|
483
|
+
};
|
|
484
|
+
for (const [handle, value] of Object.entries(merged)) {
|
|
485
|
+
// Only seed if input has no inbound wiring
|
|
486
|
+
const hasInbound = gr.edges.some((e) => e.target.nodeId === n.nodeId && e.target.handle === handle);
|
|
487
|
+
if (hasInbound)
|
|
488
|
+
continue;
|
|
489
|
+
if (value === undefined)
|
|
490
|
+
continue;
|
|
491
|
+
// Clone to avoid accidental shared references
|
|
492
|
+
node.inputs[handle] =
|
|
493
|
+
typeof structuredClone === "function"
|
|
494
|
+
? structuredClone(value)
|
|
495
|
+
: JSON.parse(JSON.stringify(value));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
465
498
|
return gr;
|
|
466
499
|
}
|
|
467
500
|
on(event, handler) {
|
|
@@ -587,7 +620,7 @@ class GraphRuntime {
|
|
|
587
620
|
await new Promise((r) => setTimeout(r, delay));
|
|
588
621
|
return exec(attempt + 1);
|
|
589
622
|
}
|
|
590
|
-
this.emit("error", { nodeId, runId, err });
|
|
623
|
+
this.emit("error", { kind: "node-run", nodeId, runId, err });
|
|
591
624
|
}
|
|
592
625
|
finally {
|
|
593
626
|
if (timeoutId)
|
|
@@ -747,6 +780,14 @@ class GraphRuntime {
|
|
|
747
780
|
}
|
|
748
781
|
}
|
|
749
782
|
}
|
|
783
|
+
reemitNodeOutputs(nodeId) {
|
|
784
|
+
const node = this.nodes.get(nodeId);
|
|
785
|
+
if (!node)
|
|
786
|
+
return;
|
|
787
|
+
for (const [handle, value] of Object.entries(node.outputs)) {
|
|
788
|
+
this.propagate(nodeId, handle, value);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
750
791
|
launch() {
|
|
751
792
|
// call onActivated for nodes that implement it
|
|
752
793
|
for (const node of this.nodes.values()) {
|
|
@@ -771,6 +812,11 @@ class GraphRuntime {
|
|
|
771
812
|
});
|
|
772
813
|
node.runtime.onActivated?.(ctx);
|
|
773
814
|
}
|
|
815
|
+
// After activation, schedule nodes that have all inbound inputs present
|
|
816
|
+
for (const nodeId of this.nodes.keys()) {
|
|
817
|
+
if (this.allInboundHaveValue(nodeId))
|
|
818
|
+
this.scheduleInputsChanged(nodeId);
|
|
819
|
+
}
|
|
774
820
|
}
|
|
775
821
|
triggerExternal(nodeId, event) {
|
|
776
822
|
const node = this.nodes.get(nodeId);
|
|
@@ -806,8 +852,11 @@ class GraphRuntime {
|
|
|
806
852
|
this.edges = [];
|
|
807
853
|
this.listeners.clear();
|
|
808
854
|
}
|
|
855
|
+
getNodeIds() {
|
|
856
|
+
return Array.from(this.nodes.keys());
|
|
857
|
+
}
|
|
809
858
|
// Unsafe helpers for serializer: read-only accessors and hydration
|
|
810
|
-
|
|
859
|
+
getNodeData(nodeId) {
|
|
811
860
|
const node = this.nodes.get(nodeId);
|
|
812
861
|
if (!node)
|
|
813
862
|
return undefined;
|
|
@@ -819,33 +868,12 @@ class GraphRuntime {
|
|
|
819
868
|
stats: { ...node.stats },
|
|
820
869
|
};
|
|
821
870
|
}
|
|
822
|
-
|
|
871
|
+
getEnvironment() {
|
|
823
872
|
return { ...this.environment };
|
|
824
873
|
}
|
|
825
874
|
setEnvironment(env) {
|
|
826
875
|
this.environment = { ...env };
|
|
827
876
|
}
|
|
828
|
-
__unsafe_setEnvironment(env) {
|
|
829
|
-
this.setEnvironment(env);
|
|
830
|
-
}
|
|
831
|
-
__unsafe_hydrateNode(nodeId, data, opts) {
|
|
832
|
-
const node = this.nodes.get(nodeId);
|
|
833
|
-
if (!node)
|
|
834
|
-
return;
|
|
835
|
-
if (opts?.replace) {
|
|
836
|
-
node.inputs = {};
|
|
837
|
-
node.outputs = {};
|
|
838
|
-
node.state = {};
|
|
839
|
-
}
|
|
840
|
-
if (data.inputs)
|
|
841
|
-
Object.assign(node.inputs, data.inputs);
|
|
842
|
-
if (data.outputs)
|
|
843
|
-
Object.assign(node.outputs, data.outputs);
|
|
844
|
-
if (data.state !== undefined)
|
|
845
|
-
node.state = data.state;
|
|
846
|
-
if (data.params)
|
|
847
|
-
node.params = data.params;
|
|
848
|
-
}
|
|
849
877
|
async whenIdle() {
|
|
850
878
|
const isIdle = () => {
|
|
851
879
|
for (const n of this.nodes.values()) {
|
|
@@ -877,14 +905,6 @@ class GraphRuntime {
|
|
|
877
905
|
__unsafe_invalidateDownstream(nodeId) {
|
|
878
906
|
this.invalidateDownstream(nodeId);
|
|
879
907
|
}
|
|
880
|
-
__unsafe_reemitNodeOutputs(nodeId) {
|
|
881
|
-
const node = this.nodes.get(nodeId);
|
|
882
|
-
if (!node)
|
|
883
|
-
return;
|
|
884
|
-
for (const [handle, value] of Object.entries(node.outputs)) {
|
|
885
|
-
this.propagate(nodeId, handle, value);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
908
|
__unsafe_scheduleInputsChanged(nodeId) {
|
|
889
909
|
this.scheduleInputsChanged(nodeId);
|
|
890
910
|
}
|
|
@@ -1048,12 +1068,41 @@ class GraphRuntime {
|
|
|
1048
1068
|
}
|
|
1049
1069
|
}
|
|
1050
1070
|
}
|
|
1051
|
-
|
|
1071
|
+
// If input lost inbound, try to re-seed from defaults
|
|
1072
|
+
if (changed) {
|
|
1073
|
+
const defNode = def.nodes.find((n) => n.nodeId === nodeId);
|
|
1074
|
+
if (defNode) {
|
|
1075
|
+
const desc = registry.nodes.get(defNode.typeId);
|
|
1076
|
+
if (desc) {
|
|
1077
|
+
const regDefaults = typeof desc.inputDefaults === "function"
|
|
1078
|
+
? desc.inputDefaults({
|
|
1079
|
+
params: defNode.params,
|
|
1080
|
+
environment: this.environment,
|
|
1081
|
+
})
|
|
1082
|
+
: desc.inputDefaults ?? {};
|
|
1083
|
+
const graphDefaults = defNode.initialInputs ?? {};
|
|
1084
|
+
const merged = {
|
|
1085
|
+
...regDefaults,
|
|
1086
|
+
...graphDefaults,
|
|
1087
|
+
};
|
|
1088
|
+
for (const h of Array.from(prevSet)) {
|
|
1089
|
+
if (!currSet.has(h) && node.inputs[h] === undefined) {
|
|
1090
|
+
const v = merged[h];
|
|
1091
|
+
if (v !== undefined)
|
|
1092
|
+
node.inputs[h] =
|
|
1093
|
+
typeof structuredClone === "function"
|
|
1094
|
+
? structuredClone(v)
|
|
1095
|
+
: JSON.parse(JSON.stringify(v));
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1052
1100
|
this.scheduleInputsChanged(nodeId);
|
|
1101
|
+
}
|
|
1053
1102
|
}
|
|
1054
1103
|
// Re-emit existing outputs to populate new edges
|
|
1055
1104
|
for (const nodeId of this.nodes.keys()) {
|
|
1056
|
-
this.
|
|
1105
|
+
this.reemitNodeOutputs(nodeId);
|
|
1057
1106
|
}
|
|
1058
1107
|
}
|
|
1059
1108
|
}
|
|
@@ -1683,6 +1732,9 @@ function setupBasicGraphRegistry() {
|
|
|
1683
1732
|
Factor: "base.float",
|
|
1684
1733
|
},
|
|
1685
1734
|
outputs: { Value: "base.float[]" },
|
|
1735
|
+
inputDefaults: {
|
|
1736
|
+
Factor: 0.5,
|
|
1737
|
+
},
|
|
1686
1738
|
impl: (ins) => {
|
|
1687
1739
|
const [a, b] = broadcast(ins.ValueA, ins.ValueB);
|
|
1688
1740
|
const t = Number(ins.Factor ?? 0);
|
|
@@ -1734,6 +1786,8 @@ function setupBasicGraphRegistry() {
|
|
|
1734
1786
|
B: "base.float[]",
|
|
1735
1787
|
},
|
|
1736
1788
|
outputs: { Result: "base.float[]" },
|
|
1789
|
+
// Registry-level defaults: Add by default, A=[1], B=[1]
|
|
1790
|
+
inputDefaults: { Operation: 0, A: [1], B: [1] },
|
|
1737
1791
|
impl: (ins) => {
|
|
1738
1792
|
// Gracefully handle missing inputs by treating them as zeros
|
|
1739
1793
|
const a = ins.A === undefined ? [] : asArray(ins.A);
|
|
@@ -1856,6 +1910,8 @@ function setupBasicGraphRegistry() {
|
|
|
1856
1910
|
Seed: "base.float",
|
|
1857
1911
|
},
|
|
1858
1912
|
outputs: { Values: "base.vec3[]" },
|
|
1913
|
+
// Registry-level defaults for convenience
|
|
1914
|
+
inputDefaults: { Domain: 10, Min: [0, 0, 0], Max: [1, 1, 1], Seed: 1 },
|
|
1859
1915
|
impl: (ins) => {
|
|
1860
1916
|
const len = Math.trunc(ins.Domain);
|
|
1861
1917
|
const min = ins.Min ?? [0, 0, 0];
|
|
@@ -1875,12 +1931,14 @@ function registerDelayNode(registry) {
|
|
|
1875
1931
|
registry.registerNode({
|
|
1876
1932
|
id: "async.delay",
|
|
1877
1933
|
categoryId: "compute",
|
|
1878
|
-
inputs: {
|
|
1879
|
-
outputs: {
|
|
1934
|
+
inputs: { Value: "base.float", DelayMs: "base.float" },
|
|
1935
|
+
outputs: { Output: "base.float" },
|
|
1880
1936
|
impl: async (ins, ctx) => {
|
|
1881
|
-
const ms = Number(ins.
|
|
1882
|
-
const
|
|
1883
|
-
if (
|
|
1937
|
+
const ms = Number(ins.DelayMs ?? 200);
|
|
1938
|
+
const valueRaw = ins.Value;
|
|
1939
|
+
if (valueRaw === undefined ||
|
|
1940
|
+
valueRaw === null ||
|
|
1941
|
+
Number.isNaN(Number(valueRaw))) {
|
|
1884
1942
|
return; // wait until x is present to avoid NaN emissions
|
|
1885
1943
|
}
|
|
1886
1944
|
await new Promise((resolve, reject) => {
|
|
@@ -1893,7 +1951,7 @@ function registerDelayNode(registry) {
|
|
|
1893
1951
|
return onAbort();
|
|
1894
1952
|
ctx.abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
1895
1953
|
});
|
|
1896
|
-
return {
|
|
1954
|
+
return { Output: Number(valueRaw) };
|
|
1897
1955
|
},
|
|
1898
1956
|
});
|
|
1899
1957
|
}
|
|
@@ -1948,7 +2006,12 @@ function makeBasicGraphDefinition() {
|
|
|
1948
2006
|
return {
|
|
1949
2007
|
nodes: [
|
|
1950
2008
|
{ nodeId: "n1", typeId: "base.math" },
|
|
1951
|
-
{
|
|
2009
|
+
{
|
|
2010
|
+
nodeId: "n2",
|
|
2011
|
+
typeId: "base.math",
|
|
2012
|
+
// Graph-level defaults override registry if provided
|
|
2013
|
+
initialInputs: { Operation: 2, B: [10] }, // Multiply by 10
|
|
2014
|
+
},
|
|
1952
2015
|
// Transitivity demo nodes
|
|
1953
2016
|
{ nodeId: "n3", typeId: "base.compare" },
|
|
1954
2017
|
{ nodeId: "n4", typeId: "base.randomXYZs" },
|
|
@@ -2007,7 +2070,7 @@ function createAsyncGraphDef() {
|
|
|
2007
2070
|
{
|
|
2008
2071
|
id: "e1",
|
|
2009
2072
|
source: { nodeId: "n1", handle: "Result" },
|
|
2010
|
-
target: { nodeId: "n2", handle: "
|
|
2073
|
+
target: { nodeId: "n2", handle: "Value" },
|
|
2011
2074
|
},
|
|
2012
2075
|
// Demonstrate async edge conversion: vec3[] -> float[] using coercion
|
|
2013
2076
|
{
|
|
@@ -2046,7 +2109,7 @@ function createProgressGraphDef() {
|
|
|
2046
2109
|
const def = {
|
|
2047
2110
|
nodes: [
|
|
2048
2111
|
{ nodeId: "steps", typeId: "base.number" },
|
|
2049
|
-
{ nodeId: "
|
|
2112
|
+
{ nodeId: "delay", typeId: "base.number" },
|
|
2050
2113
|
{ nodeId: "work", typeId: "async.progress" },
|
|
2051
2114
|
],
|
|
2052
2115
|
edges: [
|
|
@@ -2057,7 +2120,7 @@ function createProgressGraphDef() {
|
|
|
2057
2120
|
},
|
|
2058
2121
|
{
|
|
2059
2122
|
id: "e2",
|
|
2060
|
-
source: { nodeId: "
|
|
2123
|
+
source: { nodeId: "delay", handle: "Result" },
|
|
2061
2124
|
target: { nodeId: "work", handle: "DelayMs" },
|
|
2062
2125
|
},
|
|
2063
2126
|
// not wiring ShouldError to show manual input driven error later
|