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
feat: update script imports to use ES module format and enhance build configurations
nirholas6458c8c10d0b
diff --git a/api/artifact.js b/api/artifact.jsindex 37cfb8e46..278e25091 100644--- a/api/artifact.js+++ b/api/artifact.js@@ -55,7 +55,7 @@ function buildHtml({ title, element, appOrigin }) {</head><body>${element}- <script src="${appOrigin}/dist-lib/agent-3d.umd.cjs"></script>+ <script type="module" src="${appOrigin}/dist-lib/agent-3d.js"></script></body></html>`;}diff --git a/chat/src/Message.svelte b/chat/src/Message.svelteindex 3b3099507..d8d06a8bc 100644--- a/chat/src/Message.svelte+++ b/chat/src/Message.svelte@@ -172,7 +172,7 @@>{#if message.role !== 'user'}<div class="relative shrink-0 flex flex-col items-center">- {#if message.role === 'assistant' && hasLogo && isLatestAssistant && effectiveAgentId}+ {#if message.role === 'assistant' && hasLogo && isLatestAssistant}<!-- Thought bubble while thinking -->{#if message.thinking && message.thoughts}<div class="avatar-bubble avatar-bubble--thinking mb-2">@@ -190,14 +190,13 @@<buttondisabled={message.role === 'system'}on:click={() => {- // Toggle between user and assistant:if (message.role === 'user') {message.role = 'assistant';} else {message.role = 'user';}}}- class="shrink-0 rounded-md md:rounded-[6px] {message.role === 'assistant' && hasLogo && isLatestAssistant && effectiveAgentId+ class="shrink-0 rounded-md md:rounded-[6px] {message.role === 'assistant' && hasLogo && isLatestAssistant? 'flex w-[140px] h-[280px]': 'flex h-8 w-8 md:h-9 md:w-9'} {message.role === 'system'? 'border border-teal-200 bg-teal-100'@@ -205,12 +204,12 @@? 'border border-teal-200 bg-teal-100 pb-px': ''}">- {#if message.role === 'assistant' && hasLogo && isLatestAssistant && effectiveAgentId}+ {#if message.role === 'assistant' && hasLogo && isLatestAssistant}<span class="w-full h-full overflow-hidden inline-block shrink-0 rounded-[inherit]"><!-- svelte-ignore custom-element-no-implicit-ns --><agent-3dbind:this={agentEl}- agent-id={effectiveAgentId}+ {...(effectiveAgentId ? { 'agent-id': effectiveAgentId } : { src: '/avatars/cz.glb' })}mode="inline"width="140"height="280"diff --git a/package.json b/package.jsonindex 773fe8f58..439e52535 100644--- a/package.json+++ b/package.json@@ -42,6 +42,7 @@"build": "vite build","build:animations": "node scripts/build-animations.mjs","build:lib": "TARGET=lib vite build",+ "build:lib:full": "TARGET=lib LIB_FORMATS=es,umd vite build","build:artifact": "vite build --config vite.config.artifact.js","publish:lib": "node scripts/publish-lib.mjs","build:chat": "cd chat && node scripts/ensure-deps.mjs && npm run build",diff --git a/public/chat/index.html b/public/chat/index.htmlindex ae4310be7..c362f1873 100644--- a/public/chat/index.html+++ b/public/chat/index.html@@ -43,7 +43,7 @@}}</script>- <script type="module" crossorigin src="/chat/assets/index-CY-8d3mN.js"></script>+ <script type="module" crossorigin src="/chat/assets/index-CzrivwK3.js"></script><link rel="stylesheet" crossorigin href="/chat/assets/index-BvlQ9GOR.css"></head><body>diff --git a/publish/src/cz-flow.js b/publish/src/cz-flow.jsindex 50b176aba..f1c5e1bcd 100644--- a/publish/src/cz-flow.js+++ b/publish/src/cz-flow.js@@ -126,7 +126,7 @@ function buildEmbedSnippet(state) {}return `<agent-3d${agentAttr} src="${state.avatarUrl}" eager></agent-3d>-<script src="https://three.ws/dist-lib/agent-3d.umd.cjs"><\/script>`;+<script type="module" src="https://three.ws/dist-lib/agent-3d.js"><\/script>`;}/**diff --git a/scripts/publish-lib.mjs b/scripts/publish-lib.mjsindex 0e4258d0c..f6792bec9 100644--- a/scripts/publish-lib.mjs+++ b/scripts/publish-lib.mjs@@ -27,7 +27,7 @@ const destRoot = resolve(root, 'dist', 'agent-3d');const files = [{ name: 'agent-3d.js', required: true },- { name: 'agent-3d.umd.cjs', required: true },+ { name: 'agent-3d.umd.cjs', required: false },];for (const f of files) {diff --git a/src/cz-flow.js b/src/cz-flow.jsindex 50b176aba..f1c5e1bcd 100644--- a/src/cz-flow.js+++ b/src/cz-flow.js@@ -126,7 +126,7 @@ function buildEmbedSnippet(state) {}return `<agent-3d${agentAttr} src="${state.avatarUrl}" eager></agent-3d>-<script src="https://three.ws/dist-lib/agent-3d.umd.cjs"><\/script>`;+<script type="module" src="https://three.ws/dist-lib/agent-3d.js"><\/script>`;}/**diff --git a/vite.config.js b/vite.config.jsindex a7ecee47e..0255a15a7 100644--- a/vite.config.js+++ b/vite.config.js@@ -297,15 +297,13 @@ const libConfig = {lib: {entry: resolve(__dirname, 'src/lib.js'),name: 'Agent3D',- formats: ['es', 'umd'],+ formats: process.env.LIB_FORMATS ? process.env.LIB_FORMATS.split(',') : ['es'],fileName: (format) => (format === 'es' ? 'agent-3d.js' : 'agent-3d.umd.cjs'),},rollupOptions: {- // No externals — we want a self-contained drop-in embed.- // inlineDynamicImports must be true: UMD output is incompatible- // with code-splitting, and the lib is meant to be a single drop-in- // bundle anyway. Splitting can come later via a separate ES-only- // build target.+ // No externals — self-contained drop-in embed.+ // inlineDynamicImports keeps the output as a single file so CDN+ // consumers get one <script type="module"> with no chunk fetches.output: { inlineDynamicImports: true },},},