@bian-womp/spark-workbench 0.3.14 → 0.3.16
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 +17 -22
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/InMemoryWorkbench.d.ts.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 +17 -22
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/InMemoryWorkbench.d.ts.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
package/lib/cjs/index.cjs
CHANGED
|
@@ -252,6 +252,7 @@ class InMemoryWorkbench extends AbstractWorkbench {
|
|
|
252
252
|
change: { type: "setInputs", nodeId, inputs },
|
|
253
253
|
...options,
|
|
254
254
|
});
|
|
255
|
+
this.refreshValidation();
|
|
255
256
|
}
|
|
256
257
|
addNode(node, options) {
|
|
257
258
|
const id = node.nodeId ??
|
|
@@ -1385,6 +1386,13 @@ function excludeViewportFromUIState(uiState) {
|
|
|
1385
1386
|
// Counter for generating readable runner IDs
|
|
1386
1387
|
let remoteRunnerCounter = 0;
|
|
1387
1388
|
class RemoteGraphRunner extends AbstractGraphRunner {
|
|
1389
|
+
/**
|
|
1390
|
+
* Generate cache key that includes io type to prevent collisions
|
|
1391
|
+
* between input and output handles with the same name
|
|
1392
|
+
*/
|
|
1393
|
+
getCacheKey(nodeId, handle, io) {
|
|
1394
|
+
return `${nodeId}.${io}.${handle}`;
|
|
1395
|
+
}
|
|
1388
1396
|
/**
|
|
1389
1397
|
* Fetch full registry description from remote and register it locally.
|
|
1390
1398
|
* Simplified with straightforward retry loop.
|
|
@@ -1503,14 +1511,6 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1503
1511
|
if (attempt < this.MAX_REGISTRY_FETCH_ATTEMPTS) {
|
|
1504
1512
|
const delayMs = this.INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
|
|
1505
1513
|
console.warn(`Failed to fetch registry (attempt ${attempt}/${this.MAX_REGISTRY_FETCH_ATTEMPTS}), retrying in ${delayMs}ms...`, lastError);
|
|
1506
|
-
// Emit error event for UI feedback
|
|
1507
|
-
this.emit("error", {
|
|
1508
|
-
kind: "registry",
|
|
1509
|
-
message: `Registry fetch failed (attempt ${attempt}/${this.MAX_REGISTRY_FETCH_ATTEMPTS}), retrying...`,
|
|
1510
|
-
err: lastError,
|
|
1511
|
-
attempt,
|
|
1512
|
-
maxAttempts: this.MAX_REGISTRY_FETCH_ATTEMPTS,
|
|
1513
|
-
});
|
|
1514
1514
|
// Wait before retrying
|
|
1515
1515
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
1516
1516
|
}
|
|
@@ -1737,8 +1737,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1737
1737
|
const snap = await client.api.snapshot();
|
|
1738
1738
|
for (const [nodeId, map] of Object.entries(snap.inputs || {})) {
|
|
1739
1739
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1740
|
-
this.valueCache.set(
|
|
1741
|
-
io: "input",
|
|
1740
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "input"), {
|
|
1742
1741
|
value,
|
|
1743
1742
|
});
|
|
1744
1743
|
this.emit("value", { nodeId, handle, value, io: "input" });
|
|
@@ -1746,8 +1745,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1746
1745
|
}
|
|
1747
1746
|
for (const [nodeId, map] of Object.entries(snap.outputs || {})) {
|
|
1748
1747
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1749
|
-
this.valueCache.set(
|
|
1750
|
-
io: "output",
|
|
1748
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "output"), {
|
|
1751
1749
|
value,
|
|
1752
1750
|
});
|
|
1753
1751
|
this.emit("value", { nodeId, handle, value, io: "output" });
|
|
@@ -1768,8 +1766,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1768
1766
|
const eng = client.engine;
|
|
1769
1767
|
if (!this.listenersBound) {
|
|
1770
1768
|
eng.on("value", (e) => {
|
|
1771
|
-
this.valueCache.set(
|
|
1772
|
-
io: e.io,
|
|
1769
|
+
this.valueCache.set(this.getCacheKey(e.nodeId, e.handle, e.io), {
|
|
1773
1770
|
value: e.value,
|
|
1774
1771
|
runtimeTypeId: e.runtimeTypeId,
|
|
1775
1772
|
});
|
|
@@ -1938,8 +1935,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1938
1935
|
// Hydrate inputs
|
|
1939
1936
|
for (const [nodeId, map] of Object.entries(snapshot.inputs || {})) {
|
|
1940
1937
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1941
|
-
this.valueCache.set(
|
|
1942
|
-
io: "input",
|
|
1938
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "input"), {
|
|
1943
1939
|
value,
|
|
1944
1940
|
});
|
|
1945
1941
|
this.emit("value", {
|
|
@@ -1954,8 +1950,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1954
1950
|
// Hydrate outputs
|
|
1955
1951
|
for (const [nodeId, map] of Object.entries(snapshot.outputs || {})) {
|
|
1956
1952
|
for (const [handle, value] of Object.entries(map || {})) {
|
|
1957
|
-
this.valueCache.set(
|
|
1958
|
-
io: "output",
|
|
1953
|
+
this.valueCache.set(this.getCacheKey(nodeId, handle, "output"), {
|
|
1959
1954
|
value,
|
|
1960
1955
|
});
|
|
1961
1956
|
this.emit("value", {
|
|
@@ -2001,9 +1996,9 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
2001
1996
|
const desc = this.registry.nodes.get(n.typeId);
|
|
2002
1997
|
const handles = Object.keys(resolved ?? desc?.outputs ?? {});
|
|
2003
1998
|
for (const h of handles) {
|
|
2004
|
-
const key =
|
|
1999
|
+
const key = this.getCacheKey(n.nodeId, h, "output");
|
|
2005
2000
|
const rec = cache.get(key);
|
|
2006
|
-
if (rec
|
|
2001
|
+
if (rec) {
|
|
2007
2002
|
if (!out[n.nodeId])
|
|
2008
2003
|
out[n.nodeId] = {};
|
|
2009
2004
|
out[n.nodeId][h] = rec.value;
|
|
@@ -2026,8 +2021,8 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
2026
2021
|
.filter((e) => e.target.nodeId === n.nodeId)
|
|
2027
2022
|
.map((e) => e.target.handle));
|
|
2028
2023
|
for (const h of handles) {
|
|
2029
|
-
const rec = cache.get(
|
|
2030
|
-
if (rec
|
|
2024
|
+
const rec = cache.get(this.getCacheKey(n.nodeId, h, "input"));
|
|
2025
|
+
if (rec)
|
|
2031
2026
|
cur[h] = rec.value;
|
|
2032
2027
|
}
|
|
2033
2028
|
// Merge staged only for non-inbound handles so UI doesn't override runtime values
|