@bian-womp/spark-workbench 0.3.13 → 0.3.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 +16 -22
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts +5 -0
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +16 -22
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts +5 -0
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -18,6 +18,11 @@ export declare class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
18
18
|
private readonly MAX_REGISTRY_FETCH_ATTEMPTS;
|
|
19
19
|
private readonly INITIAL_RETRY_DELAY_MS;
|
|
20
20
|
private readonly REGISTRY_FETCH_TIMEOUT_MS;
|
|
21
|
+
/**
|
|
22
|
+
* Generate cache key that includes io type to prevent collisions
|
|
23
|
+
* between input and output handles with the same name
|
|
24
|
+
*/
|
|
25
|
+
private getCacheKey;
|
|
21
26
|
/**
|
|
22
27
|
* Fetch full registry description from remote and register it locally.
|
|
23
28
|
* Simplified with straightforward retry loop.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGraphRunner.d.ts","sourceRoot":"","sources":["../../../../src/runtime/RemoteGraphRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,OAAO,EACR,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"RemoteGraphRunner.d.ts","sourceRoot":"","sources":["../../../../src/runtime/RemoteGraphRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,QA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GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA6BlE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C9B;;;OAGG;IACH,EAAE,CAAC,CAAC,SAAS,eAAe,EAC1B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC9B,MAAM,IAAI;CAiBd"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1383,6 +1383,13 @@ function excludeViewportFromUIState(uiState) {
|
|
|
1383
1383
|
// Counter for generating readable runner IDs
|
|
1384
1384
|
let remoteRunnerCounter = 0;
|
|
1385
1385
|
class RemoteGraphRunner extends AbstractGraphRunner {
|
|
1386
|
+
/**
|
|
1387
|
+
* Generate cache key that includes io type to prevent collisions
|
|
1388
|
+
* between input and output handles with the same name
|
|
1389
|
+
*/
|
|
1390
|
+
getCacheKey(nodeId, handle, io) {
|
|
1391
|
+
return `${nodeId}.${io}.${handle}`;
|
|
1392
|
+
}
|
|
1386
1393
|
/**
|
|
1387
1394
|
* Fetch full registry description from remote and register it locally.
|
|
1388
1395
|
* Simplified with straightforward retry loop.
|
|
@@ -1501,14 +1508,6 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1501
1508
|
if (attempt < this.MAX_REGISTRY_FETCH_ATTEMPTS) {
|
|
1502
1509
|
const delayMs = this.INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
|
|
1503
1510
|
console.warn(`Failed to fetch registry (attempt ${attempt}/${this.MAX_REGISTRY_FETCH_ATTEMPTS}), retrying in ${delayMs}ms...`, lastError);
|
|
1504
|
-
// Emit error event for UI feedback
|
|
1505
|
-
this.emit("error", {
|
|
1506
|
-
kind: "registry",
|
|
1507
|
-
message: `Registry fetch failed (attempt ${attempt}/${this.MAX_REGISTRY_FETCH_ATTEMPTS}), retrying...`,
|
|
1508
|
-
err: lastError,
|
|
1509
|
-
attempt,
|
|
1510
|
-
maxAttempts: this.MAX_REGISTRY_FETCH_ATTEMPTS,
|
|
1511
|
-
});
|
|
1512
1511
|
// Wait before retrying
|
|
1513
1512
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
1514
1513
|
}
|
|
@@ -1735,8 +1734,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1735
1734
|
const snap = await client.api.snapshot();
|
|
1736
1735
|
for (const [nodeId, map] of Object.entries(snap.inputs || {})) {
|
|
1737
1736
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1738
|
-
this.valueCache.set(
|
|
1739
|
-
io: "input",
|
|
1737
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "input"), {
|
|
1740
1738
|
value,
|
|
1741
1739
|
});
|
|
1742
1740
|
this.emit("value", { nodeId, handle, value, io: "input" });
|
|
@@ -1744,8 +1742,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1744
1742
|
}
|
|
1745
1743
|
for (const [nodeId, map] of Object.entries(snap.outputs || {})) {
|
|
1746
1744
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1747
|
-
this.valueCache.set(
|
|
1748
|
-
io: "output",
|
|
1745
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "output"), {
|
|
1749
1746
|
value,
|
|
1750
1747
|
});
|
|
1751
1748
|
this.emit("value", { nodeId, handle, value, io: "output" });
|
|
@@ -1766,8 +1763,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1766
1763
|
const eng = client.engine;
|
|
1767
1764
|
if (!this.listenersBound) {
|
|
1768
1765
|
eng.on("value", (e) => {
|
|
1769
|
-
this.valueCache.set(
|
|
1770
|
-
io: e.io,
|
|
1766
|
+
this.valueCache.set(this.getCacheKey(e.nodeId, e.handle, e.io), {
|
|
1771
1767
|
value: e.value,
|
|
1772
1768
|
runtimeTypeId: e.runtimeTypeId,
|
|
1773
1769
|
});
|
|
@@ -1936,8 +1932,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1936
1932
|
// Hydrate inputs
|
|
1937
1933
|
for (const [nodeId, map] of Object.entries(snapshot.inputs || {})) {
|
|
1938
1934
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1939
|
-
this.valueCache.set(
|
|
1940
|
-
io: "input",
|
|
1935
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "input"), {
|
|
1941
1936
|
value,
|
|
1942
1937
|
});
|
|
1943
1938
|
this.emit("value", {
|
|
@@ -1952,8 +1947,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1952
1947
|
// Hydrate outputs
|
|
1953
1948
|
for (const [nodeId, map] of Object.entries(snapshot.outputs || {})) {
|
|
1954
1949
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1955
|
-
this.valueCache.set(
|
|
1956
|
-
io: "output",
|
|
1950
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "output"), {
|
|
1957
1951
|
value,
|
|
1958
1952
|
});
|
|
1959
1953
|
this.emit("value", {
|
|
@@ -1999,9 +1993,9 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1999
1993
|
const desc = this.registry.nodes.get(n.typeId);
|
|
2000
1994
|
const handles = Object.keys(resolved ?? desc?.outputs ?? {});
|
|
2001
1995
|
for (const h of handles) {
|
|
2002
|
-
const key =
|
|
1996
|
+
const key = this.getCacheKey(n.nodeId, h, "output");
|
|
2003
1997
|
const rec = cache.get(key);
|
|
2004
|
-
if (rec
|
|
1998
|
+
if (rec) {
|
|
2005
1999
|
if (!out[n.nodeId])
|
|
2006
2000
|
out[n.nodeId] = {};
|
|
2007
2001
|
out[n.nodeId][h] = rec.value;
|
|
@@ -2024,8 +2018,8 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
2024
2018
|
.filter((e) => e.target.nodeId === n.nodeId)
|
|
2025
2019
|
.map((e) => e.target.handle));
|
|
2026
2020
|
for (const h of handles) {
|
|
2027
|
-
const rec = cache.get(
|
|
2028
|
-
if (rec
|
|
2021
|
+
const rec = cache.get(this.getCacheKey(n.nodeId, h, "input"));
|
|
2022
|
+
if (rec)
|
|
2029
2023
|
cur[h] = rec.value;
|
|
2030
2024
|
}
|
|
2031
2025
|
// Merge staged only for non-inbound handles so UI doesn't override runtime values
|