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.

test(home): let the chaos harness drive the real runtime against its own containers

nirholas1e9c3f16c7bc
diff --git a/scripts/home-chaos.mjs b/scripts/home-chaos.mjs
index a3031af3a..29a6760d8 100644
--- a/scripts/home-chaos.mjs
+++ b/scripts/home-chaos.mjs
@@ -73,6 +73,25 @@ async function establishedTo(port) {
* a scenario is actually about the database (scenario 5) it swaps in the real
* store module instead.
*/
+/**
+ * The address resolution the chaos runtimes use.
+ *
+ * Production resolves a home's hostname through the SSRF guard and refuses any
+ * private address, which is exactly right and which refuses every container in
+ * this fleet: they live on 127.0.0.1. The runtime exposes `resolveDial` as a
+ * seam for this reason. Nothing else about the runtime is stubbed here, the
+ * production default is `defaultResolveDial`, and
+ * tests/home-security.test.js asserts that a runtime built the way production
+ * builds it still refuses loopback.
+ */
+const resolveLoopbackDial = async (baseUrl) => {
+ const url = new URL(baseUrl);
+ if (url.hostname !== '127.0.0.1' && url.hostname !== 'localhost') {
+ throw new Error(`the chaos harness only ever dials its own containers, not ${url.hostname}`);
+ }
+ return { host: url.hostname, addresses: [{ address: '127.0.0.1', family: 4 }], secure: false };
+};
+
function fleetStore(houses, { overrideUrl } = {}) {
const byId = new Map(houses.map((h) => [homeIdFor(h.index), h]));
const handshakes = [];
@@ -93,6 +112,7 @@ function fleetStore(houses, { overrideUrl } = {}) {
handshakes.push({ id, at: Date.now(), ...update });
return null;
},
+ resolveDial: resolveLoopbackDial,
};
return store;
}