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(html): correct script source path in app.html and handle promise rejection in create.html feat(tests): update ignore patterns in test-pages.mjs and enhance path resolution in vite.config.js

nirholas6e0d517b174e
diff --git a/app.html b/app.html
index 6df052592..cd9416ce9 100644
--- a/app.html
+++ b/app.html
@@ -53,7 +53,7 @@
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap"
rel="stylesheet"
/>
- <script defer type="module" src="src/app.js"></script>
+ <script defer type="module" src="/src/app.js"></script>
</head>
<body>
<header>
diff --git a/create.html b/create.html
index 261293b9a..2111097f9 100644
--- a/create.html
+++ b/create.html
@@ -557,7 +557,8 @@
sessionStorage.setItem('login_redirect', '/create');
location.replace('/login');
}
- });
+ })
+ .catch(function () {});
</script>
</head>
<body>
diff --git a/scripts/test-pages.mjs b/scripts/test-pages.mjs
index 570def6e2..1829e4a3b 100644
--- a/scripts/test-pages.mjs
+++ b/scripts/test-pages.mjs
@@ -65,7 +65,6 @@ const ROUTES = [
`/reputation/?agent=1:${SAMPLE_AGENT}`,
'/settings',
'/admin',
- '/chat',
'/pumpfun',
'/strategy-lab',
@@ -96,10 +95,14 @@ const IGNORE_PATTERNS = [
/marketplace\.olas\.network/, // third-party API, no CORS for localhost
/blocked by CORS policy/,
/three\.ws\/dist-lib/,
+ /three\.ws\/+api\//, // prod API hardcoded in demo/test pages (embed-test, artifact-example)
/localhost:\d+\/api\//, // serverless functions need `vercel dev`, not `vite dev`
+ /localhost:\d+\/chat/, // chat is a separate Svelte app (run `npm run dev` in chat/)
/\/wallet\/(connect-button|state).*\.js/, // cascades from esm.sh import in connect-button.js
/\/node_modules\/vite\/dist\/client\/env\.mjs/, // Vite dev injection 404s in some flows
/rpc\.\d+\.io/, // placeholder RPC URL from sample agent IDs
+ /Unexpected token .+, .<!doctype /, // API endpoint returned HTML instead of JSON (dev-only: no serverless functions)
+ /Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text\/html"/, // Vite html-proxy MIME mismatch for public/ files served via dynamic paths
];
function shouldIgnore(text) {
diff --git a/vite.config.js b/vite.config.js
index e77b2aad8..1a44ce592 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -146,6 +146,9 @@ const appConfig = {
filePath = resolve(root, 'agent-embed.html');
else if (!filePath && /^\/agent\/[^/]+$/.test(path))
filePath = resolve(root, 'agent-home.html');
+ // /a/<chainId>/<agentId>/edit → chain-edit page
+ else if (!filePath && /^\/a\/[^/]+(?:\/[^/]+){1,2}\/edit\/?$/.test(path))
+ filePath = resolve(root, 'a-edit.html');
// /a/<chainId>/<agentId>/embed or /a/<chainId>/<registry>/<agentId>/embed → iframe viewer
else if (!filePath && /^\/a\/[^/]+(?:\/[^/]+){1,2}\/embed\/?$/.test(path))
filePath = resolve(root, 'a-embed.html');
@@ -155,19 +158,12 @@ const appConfig = {
if (!filePath) return next();
try {
const html = readFileSync(filePath, 'utf8');
- // Use the file's path-relative URL (not req.url) so Vite can
- // resolve html-proxy modules (inline <script type="module">)
- // back to a real file. Otherwise virtual module IDs derived
- // from req.url (e.g. /agent/0xfoo) 500 because nothing on
- // disk matches.
- // Use the file's path-relative URL (not req.url) so Vite can
- // resolve html-proxy modules (inline <script type="module">)
- // back to a real file. Otherwise virtual module IDs derived
- // from req.url (e.g. /agent/0xfoo) 500 because nothing on
- // disk matches. Files in /public stay on req.url since they
- // can't be import-analyzed by Vite anyway.
+ // Always use the actual on-disk file path as the URL for
+ // transformIndexHtml so Vite can resolve html-proxy requests
+ // for inline <script type="module"> back to the correct file,
+ // regardless of which dynamic URL the page was served from.
const rel = filePath.slice(root.length + 1).replace(/\\/g, '/');
- const fileUrl = rel.startsWith('public/') ? url : '/' + rel;
+ const fileUrl = '/' + rel;
const transformed = await server.transformIndexHtml(fileUrl, html);
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.end(transformed);