Skip to content

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.

fix(ops): keep the custodial key audit's JSON on stdout free of RPC lane chatter

nirholas6d4c22505707
diff --git a/scripts/audit-custodial-key-health.mjs b/scripts/audit-custodial-key-health.mjs
index 92c1c403b..393d7bd95 100644
--- a/scripts/audit-custodial-key-health.mjs
+++ b/scripts/audit-custodial-key-health.mjs
@@ -34,6 +34,17 @@ import { readFileSync } from 'node:fs';
const AS_JSON = process.argv.includes('--json');
const PLATFORM_ONLY = process.argv.includes('--platform-only');
+// In --json mode stdout carries ONE value: the report. The Solana connection
+// lane logs its failovers ("[solana-rpc] ... demoting that method") on stdout,
+// and a single such line ahead of the payload makes the whole thing unparseable
+// to anything reading stdout as JSON. That is not hypothetical: it is what left
+// the gcp-triage custodial-keys probe blind with "unparseable custodial audit
+// output" while the audit itself was working fine. Diagnostics belong on stderr
+// here, so a human still sees them and the parser still gets clean JSON. The
+// report is written through emitJson, which keeps the real stdout writer.
+const emitJson = console.log.bind(console);
+if (AS_JSON) console.log = (...args) => console.error(...args);
+
// Same ownership markers the reclaim leg uses (api/_lib/economy-sweepback.js):
// platform agents live under one owner email or the agent-email suffix.
const PLATFORM_OWNER_EMAIL = '[email protected]';
@@ -188,7 +199,7 @@ const report = {
};
if (AS_JSON) {
- console.log(JSON.stringify(report, null, 2));
+ emitJson(JSON.stringify(report, null, 2));
process.exit(0);
}