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.

strip-sw-from-embeds + upload-proxy test follow-up

nirholascd86d50bb462
diff --git a/scripts/strip-sw-from-embeds.mjs b/scripts/strip-sw-from-embeds.mjs
index 2a8875790..3e8c019d9 100644
--- a/scripts/strip-sw-from-embeds.mjs
+++ b/scripts/strip-sw-from-embeds.mjs
@@ -64,8 +64,9 @@ function walk(dir) {
if (!EMBED_ENTRIES.has(name)) continue;
scanned.push(full);
const html = readFileSync(full, 'utf8');
- if (!REGISTER_SW_RE.test(html)) continue;
- writeFileSync(full, html.replace(REGISTER_SW_RE, ''));
+ const next = html.replace(REGISTER_SW_RE, '');
+ if (next === html) continue;
+ writeFileSync(full, next);
stripped.push(full);
}
}
diff --git a/tests/api/avatars-upload-proxy.test.js b/tests/api/avatars-upload-proxy.test.js
index 64a3759eb..43e33941e 100644
--- a/tests/api/avatars-upload-proxy.test.js
+++ b/tests/api/avatars-upload-proxy.test.js
@@ -35,7 +35,11 @@ vi.mock('../../api/_lib/rate-limit.js', () => ({
clientIp: () => '127.0.0.1',
}));
-const putObjectMock = vi.fn(async () => undefined);
+// vi.hoisted ensures the mock factory can reference putObjectMock even after
+// vi.mock() is hoisted above const declarations by Vitest's transformer.
+const { putObjectMock } = vi.hoisted(() => ({
+ putObjectMock: vi.fn(async () => undefined),
+}));
vi.mock('../../api/_lib/r2.js', () => ({
presignUpload: async ({ key }) => `https://r2.test/upload/${key}?sig=mock`,
headObject: async () => null,