Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(inference-nodes): stop double-parsing Redis records the REST client already deserialized
nirholasb678824fa505
diff --git a/api/_lib/inference-nodes.js b/api/_lib/inference-nodes.jsindex 660751a53..3b650a080 100644--- a/api/_lib/inference-nodes.js+++ b/api/_lib/inference-nodes.js@@ -97,6 +97,26 @@ export async function verifyResultReceipt({ jobId, model, prompt, output, startereturn verifyNodeSignature(receipt.publicKey, payload, receipt.signature);}+/**+ * Read a JSON record back out of Redis.+ *+ * The Upstash REST client deserializes on the way out: a value stored as a+ * JSON string comes back already parsed as an object. Calling JSON.parse on+ * that object stringifies it to "[object Object]" first and throws, which+ * took out getNode's Redis fallback, claimJob and getJob (every read path in+ * the queue). Accept either shape so the record survives whichever form the+ * client hands back.+ */+function parseRecord(raw) {+ if (raw === null || raw === undefined) return null;+ if (typeof raw === 'object') return raw;+ try {+ return JSON.parse(raw);+ } catch {+ return null;+ }+}+// ── Durable node registry (Postgres) ─────────────────────────────────────────let _ensured = null;@@ -155,8 +175,7 @@ export async function getNode(publicKey) {} catch { /* fall through to Redis */ }const r = getRedis();if (!r) return null;- const raw = await r.get(`${NODE_PREFIX}${publicKey}`);- return raw ? JSON.parse(raw) : null;+ return parseRecord(await r.get(`${NODE_PREFIX}${publicKey}`));}// ── Job queue ────────────────────────────────────────────────────────────────@@ -194,9 +213,8 @@ export async function claimJob({ capability, publicKey }) {if (!r) return null;const id = await r.rpop(`${QUEUE_PREFIX}${capability}`);if (!id) return null;- const raw = await r.get(`${JOB_PREFIX}${id}`);- if (!raw) return null; // expired between push and pop- const job = JSON.parse(raw);+ const job = parseRecord(await r.get(`${JOB_PREFIX}${id}`));+ if (!job) return null; // expired between push and popif (job.status !== 'queued') return null;job.status = 'running';job.claimedBy = publicKey;@@ -209,8 +227,7 @@ export async function claimJob({ capability, publicKey }) {export async function getJob(jobId) {const r = getRedis();if (!r) return null;- const raw = await r.get(`${JOB_PREFIX}${jobId}`);- return raw ? JSON.parse(raw) : null;+ return parseRecord(await r.get(`${JOB_PREFIX}${jobId}`));}/**diff --git a/packages/node-operator/scripts/e2e-local.mjs b/packages/node-operator/scripts/e2e-local.mjsindex e5cbb5bf9..90e860b2a 100644--- a/packages/node-operator/scripts/e2e-local.mjs+++ b/packages/node-operator/scripts/e2e-local.mjs@@ -105,7 +105,9 @@ async function main() {capability: 'text-embedding',pollIntervalMs: 250,cacheDir: join(PKG, 'models'),- log,+ // createJobLoop wants a console-like object (it calls .log and .warn),+ // not a bare log function.+ log: { log, warn: log, error: log },});const runP = loop.run();// Wait until the job completes (poll stats) or time out.