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: integrate Avaturn Agent for enhanced 3D interaction
nirholasc2175458544e
diff --git a/README.md b/README.mdindex e32c3e2fa..c55cf2fd0 100644--- a/README.md+++ b/README.md@@ -21,19 +21,7 @@ description: 3D Agent** is an open-source, browser-native 3D model viewer built<br/><p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="650" height="56" viewBox="0 0 650 56">- <defs>- <linearGradient id="hg1" x1="0%" y1="0%" x2="100%" y2="0%">- <stop offset="0%" style="stop-color:#00d2ff"/>- <stop offset="100%" style="stop-color:#7b2ff7"/>- </linearGradient>- </defs>- <rect width="650" height="56" rx="12" fill="#111119"/>- <text x="325" y="35" text-anchor="middle" font-family="SF Pro Display, Inter, sans-serif" font-size="13" fill="#ccc" letter-spacing="1">- DRAG & DROP · REAL-TIME LIGHTING · ANIMATION PLAYBACK · GLTF VALIDATION · ZERO UPLOADS- </text>- <rect x="0" y="0" width="650" height="3" rx="1.5" fill="url(#hg1)" opacity="0.6"/>- </svg>+ <img src="assets/header-banner.svg" width="650" height="56" alt="DRAG & DROP · REAL-TIME LIGHTING · ANIMATION PLAYBACK · GLTF VALIDATION · ZERO UPLOADS"/></p><br/>@@ -87,29 +75,7 @@ It's built for **3D artists** previewing exports, **game developers** debugging<br/><p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="520" height="200" viewBox="0 0 520 200">- <defs>- <linearGradient id="step" x1="0%" y1="0%" x2="100%" y2="0%">- <stop offset="0%" style="stop-color:#00d2ff"/>- <stop offset="100%" style="stop-color:#7b2ff7"/>- </linearGradient>- </defs>- <rect width="520" height="200" rx="14" fill="#0d0d14"/>- <!-- Step 1 -->- <circle cx="60" cy="50" r="20" fill="none" stroke="#00d2ff" stroke-width="2"/>- <text x="60" y="56" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#00d2ff">1</text>- <text x="100" y="46" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">git clone https://github.com/nirholas/3d-agent.git</text>- <text x="100" y="64" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#666">cd 3D</text>- <!-- Step 2 -->- <circle cx="60" cy="110" r="20" fill="none" stroke="#7b2ff7" stroke-width="2"/>- <text x="60" y="116" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#7b2ff7">2</text>- <text x="100" y="116" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">npm install</text>- <!-- Step 3 -->- <circle cx="60" cy="165" r="20" fill="none" stroke="#ff0080" stroke-width="2"/>- <text x="60" y="171" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#ff0080">3</text>- <text x="100" y="162" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">npm run dev</text>- <text x="100" y="180" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#666">→ http://localhost:3000</text>- </svg>+ <img src="assets/quickstart.svg" width="520" height="200" alt="Quickstart steps"/></p>```bash@@ -143,65 +109,7 @@ Open **http://localhost:3000** and drop any `.glb` or `.gltf` file onto the page<br/><p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="650" height="340" viewBox="0 0 650 340">- <defs>- <linearGradient id="ab" x1="0%" y1="0%" x2="100%" y2="100%">- <stop offset="0%" style="stop-color:#0d0d14"/>- <stop offset="100%" style="stop-color:#12121f"/>- </linearGradient>- </defs>- <rect width="650" height="340" rx="14" fill="url(#ab)"/>-- <!-- App -->- <rect x="240" y="20" width="170" height="50" rx="8" fill="#111" stroke="#00d2ff" stroke-width="1.5"/>- <text x="325" y="50" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#00d2ff">app.js</text>- <text x="325" y="62" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">Entry point & dropzone</text>-- <!-- Lines from App -->- <line x1="280" y1="70" x2="140" y2="120" stroke="#333" stroke-width="1"/>- <line x1="325" y1="70" x2="325" y2="120" stroke="#333" stroke-width="1"/>- <line x1="370" y1="70" x2="510" y2="120" stroke="#333" stroke-width="1"/>-- <!-- Viewer -->- <rect x="55" y="120" width="170" height="50" rx="8" fill="#111" stroke="#7b2ff7" stroke-width="1.5"/>- <text x="140" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#7b2ff7">viewer.js</text>- <text x="140" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">Three.js scene & GUI</text>-- <!-- Validator -->- <rect x="240" y="120" width="170" height="50" rx="8" fill="#111" stroke="#ff0080" stroke-width="1.5"/>- <text x="325" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#ff0080">validator.js</text>- <text x="325" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">glTF spec validation</text>-- <!-- Environments -->- <rect x="425" y="120" width="170" height="50" rx="8" fill="#111" stroke="#ff6b35" stroke-width="1.5"/>- <text x="510" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#ff6b35">environments.js</text>- <text x="510" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">HDR env map registry</text>-- <!-- Lines to Components -->- <line x1="325" y1="170" x2="325" y2="220" stroke="#333" stroke-width="1"/>-- <!-- Components header -->- <rect x="140" y="220" width="370" height="36" rx="8" fill="#111" stroke="#00ff88" stroke-width="1.5"/>- <text x="325" y="244" text-anchor="middle" font-family="SF Mono, monospace" font-size="13" font-weight="600" fill="#00ff88">components/</text>-- <!-- Component boxes -->- <rect x="55" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>- <text x="120" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">footer.jsx</text>-- <rect x="200" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>- <text x="265" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-report</text>-- <rect x="345" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>- <text x="410" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-table</text>-- <rect x="490" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>- <text x="555" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-toggle</text>-- <line x1="200" y1="256" x2="120" y2="276" stroke="#333" stroke-width="1"/>- <line x1="280" y1="256" x2="265" y2="276" stroke="#333" stroke-width="1"/>- <line x1="370" y1="256" x2="410" y2="276" stroke="#333" stroke-width="1"/>- <line x1="450" y1="256" x2="555" y2="276" stroke="#333" stroke-width="1"/>- </svg>+ <img src="assets/architecture.svg" width="650" height="340" alt="Architecture diagram"/></p>```@@ -278,16 +186,7 @@ https://3d.irish/#model=https://example.com/model.glb&kiosk=true### 1. Preview a Local Model<p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="500" height="80" viewBox="0 0 500 80">- <rect width="500" height="80" rx="10" fill="#0d0d14"/>- <text x="30" y="36" font-family="Inter, sans-serif" font-size="22" fill="#00d2ff">①</text>- <text x="60" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Open 3d.irish</text>- <text x="200" y="36" font-family="Inter, sans-serif" font-size="22" fill="#7b2ff7">②</text>- <text x="230" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Drop .glb file</text>- <text x="370" y="36" font-family="Inter, sans-serif" font-size="22" fill="#ff0080">③</text>- <text x="400" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Inspect</text>- <text x="30" y="62" font-family="Inter, sans-serif" font-size="10" fill="#666">Works with multi-file drops — textures and .bin files are auto-resolved.</text>- </svg>+ <img src="assets/tutorial-steps.svg" width="500" height="80" alt="Step 1: Open 3d.irish · Step 2: Drop .glb file · Step 3: Inspect"/></p>Just drag any `.glb` or `.gltf` file (along with its textures and `.bin` if separate) onto the page. The viewer auto-detects the root glTF file and resolves all relative resource URIs.@@ -367,42 +266,7 @@ Use an `<iframe>` with kiosk mode for clean embedding:<br/><p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="650" height="260" viewBox="0 0 650 260">- <rect width="650" height="260" rx="14" fill="#0d0d14"/>- <text x="325" y="30" text-anchor="middle" font-family="Inter, sans-serif" font-size="10" fill="#666" letter-spacing="3">WHAT'S NEXT</text>-- <rect x="20" y="50" width="295" height="38" rx="6" fill="#111" stroke="#00d2ff" stroke-opacity="0.3"/>- <text x="35" y="74" font-family="Inter, sans-serif" font-size="12" fill="#00d2ff">◆</text>- <text x="55" y="74" font-family="Inter, sans-serif" font-size="11" fill="#ccc">AI-powered model analysis & suggestions</text>-- <rect x="335" y="50" width="295" height="38" rx="6" fill="#111" stroke="#7b2ff7" stroke-opacity="0.3"/>- <text x="350" y="74" font-family="Inter, sans-serif" font-size="12" fill="#7b2ff7">◆</text>- <text x="370" y="74" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Screenshot & video export</text>-- <rect x="20" y="100" width="295" height="38" rx="6" fill="#111" stroke="#ff0080" stroke-opacity="0.3"/>- <text x="35" y="124" font-family="Inter, sans-serif" font-size="12" fill="#ff0080">◆</text>- <text x="55" y="124" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Measurement tools (distances, angles)</text>-- <rect x="335" y="100" width="295" height="38" rx="6" fill="#111" stroke="#ff6b35" stroke-opacity="0.3"/>- <text x="350" y="124" font-family="Inter, sans-serif" font-size="12" fill="#ff6b35">◆</text>- <text x="370" y="124" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Texture channel inspector (normal, AO, etc.)</text>-- <rect x="20" y="150" width="295" height="38" rx="6" fill="#111" stroke="#00ff88" stroke-opacity="0.3"/>- <text x="35" y="174" font-family="Inter, sans-serif" font-size="12" fill="#00ff88">◆</text>- <text x="55" y="174" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Side-by-side model comparison</text>-- <rect x="335" y="150" width="295" height="38" rx="6" fill="#111" stroke="#ffe66d" stroke-opacity="0.3"/>- <text x="350" y="174" font-family="Inter, sans-serif" font-size="12" fill="#ffe66d">◆</text>- <text x="370" y="174" font-family="Inter, sans-serif" font-size="11" fill="#ccc">AR mode (WebXR quick-look)</text>-- <rect x="20" y="200" width="295" height="38" rx="6" fill="#111" stroke="#00d2ff" stroke-opacity="0.3"/>- <text x="35" y="224" font-family="Inter, sans-serif" font-size="12" fill="#00d2ff">◆</text>- <text x="55" y="224" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Scene graph tree explorer</text>-- <rect x="335" y="200" width="295" height="38" rx="6" fill="#111" stroke="#7b2ff7" stroke-opacity="0.3"/>- <text x="350" y="224" font-family="Inter, sans-serif" font-size="12" fill="#7b2ff7">◆</text>- <text x="370" y="224" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Material editor with live PBR preview</text>- </svg>+ <img src="assets/roadmap.svg" width="650" height="260" alt="Roadmap"/></p>- **AI Model Analysis** — describe meshes, materials, and suggest optimizations@@ -538,18 +402,7 @@ For deeper technical detail, see the `docs/` directory:<br/><p align="center">- <svg xmlns="http://www.w3.org/2000/svg" width="400" height="60" viewBox="0 0 400 60">- <defs>- <linearGradient id="ft" x1="0%" y1="0%" x2="100%" y2="0%">- <stop offset="0%" style="stop-color:#00d2ff"/>- <stop offset="50%" style="stop-color:#7b2ff7"/>- <stop offset="100%" style="stop-color:#ff0080"/>- </linearGradient>- </defs>- <rect width="400" height="60" rx="10" fill="#0d0d14"/>- <text x="200" y="28" text-anchor="middle" font-family="Inter, sans-serif" font-size="11" fill="#888">Built by</text>- <text x="200" y="48" text-anchor="middle" font-family="Inter, sans-serif" font-size="14" font-weight="600" fill="url(#ft)">nirholas</text>- </svg>+ <img src="assets/footer-banner.svg" width="400" height="60" alt="Built by nirholas"/></p><p align="center">diff --git a/api/avaturn-session.js b/api/avaturn-session.jsnew file mode 100644index 000000000..f81ea4eb7--- /dev/null+++ b/api/avaturn-session.js@@ -0,0 +1,30 @@+export default async function handler(req, res) {+ if (req.method !== 'POST') {+ return res.status(405).json({ error: 'Method not allowed' });+ }++ const apiKey = process.env.AVATURN_API_KEY;+ if (!apiKey) {+ return res.status(500).json({ error: 'AVATURN_API_KEY not configured' });+ }++ try {+ const response = await fetch('https://api.avaturn.live/api/v1/sessions', {+ method: 'POST',+ headers: {+ Authorization: `Bearer ${apiKey}`,+ 'Content-Type': 'application/json',+ },+ });++ if (!response.ok) {+ const text = await response.text();+ return res.status(response.status).json({ error: `Avaturn API error: ${text}` });+ }++ const data = await response.json();+ return res.status(200).json({ token: data.token, sessionId: data.session_id });+ } catch (err) {+ return res.status(500).json({ error: 'Failed to create Avaturn session' });+ }+}diff --git a/assets/architecture.svg b/assets/architecture.svgnew file mode 100644index 000000000..d6cb696b2--- /dev/null+++ b/assets/architecture.svg@@ -0,0 +1,59 @@+<svg xmlns="http://www.w3.org/2000/svg" width="650" height="340" viewBox="0 0 650 340">+ <defs>+ <linearGradient id="ab" x1="0%" y1="0%" x2="100%" y2="100%">+ <stop offset="0%" style="stop-color:#0d0d14"/>+ <stop offset="100%" style="stop-color:#12121f"/>+ </linearGradient>+ </defs>+ <rect width="650" height="340" rx="14" fill="url(#ab)"/>++ <!-- App -->+ <rect x="240" y="20" width="170" height="50" rx="8" fill="#111" stroke="#00d2ff" stroke-width="1.5"/>+ <text x="325" y="50" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#00d2ff">app.js</text>+ <text x="325" y="62" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">Entry point & dropzone</text>++ <!-- Lines from App -->+ <line x1="280" y1="70" x2="140" y2="120" stroke="#333" stroke-width="1"/>+ <line x1="325" y1="70" x2="325" y2="120" stroke="#333" stroke-width="1"/>+ <line x1="370" y1="70" x2="510" y2="120" stroke="#333" stroke-width="1"/>++ <!-- Viewer -->+ <rect x="55" y="120" width="170" height="50" rx="8" fill="#111" stroke="#7b2ff7" stroke-width="1.5"/>+ <text x="140" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#7b2ff7">viewer.js</text>+ <text x="140" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">Three.js scene & GUI</text>++ <!-- Validator -->+ <rect x="240" y="120" width="170" height="50" rx="8" fill="#111" stroke="#ff0080" stroke-width="1.5"/>+ <text x="325" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#ff0080">validator.js</text>+ <text x="325" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">glTF spec validation</text>++ <!-- Environments -->+ <rect x="425" y="120" width="170" height="50" rx="8" fill="#111" stroke="#ff6b35" stroke-width="1.5"/>+ <text x="510" y="150" text-anchor="middle" font-family="SF Mono, monospace" font-size="14" font-weight="600" fill="#ff6b35">environments.js</text>+ <text x="510" y="162" text-anchor="middle" font-family="Inter, sans-serif" font-size="9" fill="#666">HDR env map registry</text>++ <!-- Lines to Components -->+ <line x1="325" y1="170" x2="325" y2="220" stroke="#333" stroke-width="1"/>++ <!-- Components header -->+ <rect x="140" y="220" width="370" height="36" rx="8" fill="#111" stroke="#00ff88" stroke-width="1.5"/>+ <text x="325" y="244" text-anchor="middle" font-family="SF Mono, monospace" font-size="13" font-weight="600" fill="#00ff88">components/</text>++ <!-- Component boxes -->+ <rect x="55" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>+ <text x="120" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">footer.jsx</text>++ <rect x="200" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>+ <text x="265" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-report</text>++ <rect x="345" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>+ <text x="410" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-table</text>++ <rect x="490" y="276" width="130" height="40" rx="6" fill="#0a0a12" stroke="#444" stroke-width="1"/>+ <text x="555" y="300" text-anchor="middle" font-family="SF Mono, monospace" font-size="10" fill="#aaa">validator-toggle</text>++ <line x1="200" y1="256" x2="120" y2="276" stroke="#333" stroke-width="1"/>+ <line x1="280" y1="256" x2="265" y2="276" stroke="#333" stroke-width="1"/>+ <line x1="370" y1="256" x2="410" y2="276" stroke="#333" stroke-width="1"/>+ <line x1="450" y1="256" x2="555" y2="276" stroke="#333" stroke-width="1"/>+</svg>diff --git a/assets/footer-banner.svg b/assets/footer-banner.svgnew file mode 100644index 000000000..c23ab0954--- /dev/null+++ b/assets/footer-banner.svg@@ -0,0 +1,12 @@+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="60" viewBox="0 0 400 60">+ <defs>+ <linearGradient id="ft" x1="0%" y1="0%" x2="100%" y2="0%">+ <stop offset="0%" style="stop-color:#00d2ff"/>+ <stop offset="50%" style="stop-color:#7b2ff7"/>+ <stop offset="100%" style="stop-color:#ff0080"/>+ </linearGradient>+ </defs>+ <rect width="400" height="60" rx="10" fill="#0d0d14"/>+ <text x="200" y="28" text-anchor="middle" font-family="Inter, sans-serif" font-size="11" fill="#888">Built by</text>+ <text x="200" y="48" text-anchor="middle" font-family="Inter, sans-serif" font-size="14" font-weight="600" fill="url(#ft)">nirholas</text>+</svg>diff --git a/assets/header-banner.svg b/assets/header-banner.svgnew file mode 100644index 000000000..093061989--- /dev/null+++ b/assets/header-banner.svg@@ -0,0 +1,13 @@+<svg xmlns="http://www.w3.org/2000/svg" width="650" height="56" viewBox="0 0 650 56">+ <defs>+ <linearGradient id="hg1" x1="0%" y1="0%" x2="100%" y2="0%">+ <stop offset="0%" style="stop-color:#00d2ff"/>+ <stop offset="100%" style="stop-color:#7b2ff7"/>+ </linearGradient>+ </defs>+ <rect width="650" height="56" rx="12" fill="#111119"/>+ <text x="325" y="35" text-anchor="middle" font-family="SF Pro Display, Inter, sans-serif" font-size="13" fill="#ccc" letter-spacing="1">+ DRAG & DROP · REAL-TIME LIGHTING · ANIMATION PLAYBACK · GLTF VALIDATION · ZERO UPLOADS+ </text>+ <rect x="0" y="0" width="650" height="3" rx="1.5" fill="url(#hg1)" opacity="0.6"/>+</svg>diff --git a/assets/quickstart.svg b/assets/quickstart.svgnew file mode 100644index 000000000..c1025b44f--- /dev/null+++ b/assets/quickstart.svg@@ -0,0 +1,23 @@+<svg xmlns="http://www.w3.org/2000/svg" width="520" height="200" viewBox="0 0 520 200">+ <defs>+ <linearGradient id="step" x1="0%" y1="0%" x2="100%" y2="0%">+ <stop offset="0%" style="stop-color:#00d2ff"/>+ <stop offset="100%" style="stop-color:#7b2ff7"/>+ </linearGradient>+ </defs>+ <rect width="520" height="200" rx="14" fill="#0d0d14"/>+ <!-- Step 1 -->+ <circle cx="60" cy="50" r="20" fill="none" stroke="#00d2ff" stroke-width="2"/>+ <text x="60" y="56" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#00d2ff">1</text>+ <text x="100" y="46" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">git clone https://github.com/nirholas/3d-agent.git</text>+ <text x="100" y="64" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#666">cd 3D</text>+ <!-- Step 2 -->+ <circle cx="60" cy="110" r="20" fill="none" stroke="#7b2ff7" stroke-width="2"/>+ <text x="60" y="116" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#7b2ff7">2</text>+ <text x="100" y="116" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">npm install</text>+ <!-- Step 3 -->+ <circle cx="60" cy="165" r="20" fill="none" stroke="#ff0080" stroke-width="2"/>+ <text x="60" y="171" text-anchor="middle" font-family="Inter, sans-serif" font-size="16" font-weight="700" fill="#ff0080">3</text>+ <text x="100" y="162" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#e0e0e0">npm run dev</text>+ <text x="100" y="180" font-family="SF Mono, Fira Code, monospace" font-size="13" fill="#666">→ http://localhost:3000</text>+</svg>diff --git a/assets/roadmap.svg b/assets/roadmap.svgnew file mode 100644index 000000000..c50eecabd--- /dev/null+++ b/assets/roadmap.svg@@ -0,0 +1,36 @@+<svg xmlns="http://www.w3.org/2000/svg" width="650" height="260" viewBox="0 0 650 260">+ <rect width="650" height="260" rx="14" fill="#0d0d14"/>+ <text x="325" y="30" text-anchor="middle" font-family="Inter, sans-serif" font-size="10" fill="#666" letter-spacing="3">WHAT'S NEXT</text>++ <rect x="20" y="50" width="295" height="38" rx="6" fill="#111" stroke="#00d2ff" stroke-opacity="0.3"/>+ <text x="35" y="74" font-family="Inter, sans-serif" font-size="12" fill="#00d2ff">◆</text>+ <text x="55" y="74" font-family="Inter, sans-serif" font-size="11" fill="#ccc">AI-powered model analysis & suggestions</text>++ <rect x="335" y="50" width="295" height="38" rx="6" fill="#111" stroke="#7b2ff7" stroke-opacity="0.3"/>+ <text x="350" y="74" font-family="Inter, sans-serif" font-size="12" fill="#7b2ff7">◆</text>+ <text x="370" y="74" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Screenshot & video export</text>++ <rect x="20" y="100" width="295" height="38" rx="6" fill="#111" stroke="#ff0080" stroke-opacity="0.3"/>+ <text x="35" y="124" font-family="Inter, sans-serif" font-size="12" fill="#ff0080">◆</text>+ <text x="55" y="124" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Measurement tools (distances, angles)</text>++ <rect x="335" y="100" width="295" height="38" rx="6" fill="#111" stroke="#ff6b35" stroke-opacity="0.3"/>+ <text x="350" y="124" font-family="Inter, sans-serif" font-size="12" fill="#ff6b35">◆</text>+ <text x="370" y="124" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Texture channel inspector (normal, AO, etc.)</text>++ <rect x="20" y="150" width="295" height="38" rx="6" fill="#111" stroke="#00ff88" stroke-opacity="0.3"/>+ <text x="35" y="174" font-family="Inter, sans-serif" font-size="12" fill="#00ff88">◆</text>+ <text x="55" y="174" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Side-by-side model comparison</text>++ <rect x="335" y="150" width="295" height="38" rx="6" fill="#111" stroke="#ffe66d" stroke-opacity="0.3"/>+ <text x="350" y="174" font-family="Inter, sans-serif" font-size="12" fill="#ffe66d">◆</text>+ <text x="370" y="174" font-family="Inter, sans-serif" font-size="11" fill="#ccc">AR mode (WebXR quick-look)</text>++ <rect x="20" y="200" width="295" height="38" rx="6" fill="#111" stroke="#00d2ff" stroke-opacity="0.3"/>+ <text x="35" y="224" font-family="Inter, sans-serif" font-size="12" fill="#00d2ff">◆</text>+ <text x="55" y="224" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Scene graph tree explorer</text>++ <rect x="335" y="200" width="295" height="38" rx="6" fill="#111" stroke="#7b2ff7" stroke-opacity="0.3"/>+ <text x="350" y="224" font-family="Inter, sans-serif" font-size="12" fill="#7b2ff7">◆</text>+ <text x="370" y="224" font-family="Inter, sans-serif" font-size="11" fill="#ccc">Material editor with live PBR preview</text>+</svg>diff --git a/assets/tutorial-steps.svg b/assets/tutorial-steps.svgnew file mode 100644index 000000000..0939a1bb9--- /dev/null+++ b/assets/tutorial-steps.svg@@ -0,0 +1,10 @@+<svg xmlns="http://www.w3.org/2000/svg" width="500" height="80" viewBox="0 0 500 80">+ <rect width="500" height="80" rx="10" fill="#0d0d14"/>+ <text x="30" y="36" font-family="Inter, sans-serif" font-size="22" fill="#00d2ff">①</text>+ <text x="60" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Open 3d.irish</text>+ <text x="200" y="36" font-family="Inter, sans-serif" font-size="22" fill="#7b2ff7">②</text>+ <text x="230" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Drop .glb file</text>+ <text x="370" y="36" font-family="Inter, sans-serif" font-size="22" fill="#ff0080">③</text>+ <text x="400" y="36" font-family="Inter, sans-serif" font-size="13" fill="#ccc">Inspect</text>+ <text x="30" y="62" font-family="Inter, sans-serif" font-size="10" fill="#666">Works with multi-file drops — textures and .bin files are auto-resolved.</text>+</svg>diff --git a/package.json b/package.jsonindex c8fa9f36a..8688efe23 100644--- a/package.json+++ b/package.json@@ -38,6 +38,7 @@"postversion": "git push && git push --tags"},"dependencies": {+ "@avaturn-live/web-sdk": "^0.4.0","@chenglou/pretext": "^0.0.5","dat.gui": "^0.7.9","gltf-validator": "^2.0.0-dev.3.10",diff --git a/src/app.js b/src/app.jsindex aa375d2f1..383fee9ec 100644--- a/src/app.js+++ b/src/app.js@@ -4,6 +4,7 @@ import { Viewer } from './viewer.js';import { SimpleDropzone } from 'simple-dropzone';import { Validator } from './validator.js';import { Footer } from './components/footer';+import { AvaturnAgent } from './avaturn-agent.js';import queryString from 'query-string';window.THREE = THREE;@@ -157,5 +158,9 @@ document.addEventListener('DOMContentLoaded', () => {window.VIEWER.app = app;+ // Initialize Avaturn Agent+ const agent = new AvaturnAgent(document.body);+ window.VIEWER.agent = agent;+console.info('[3D Agent] Debugging data exported as `window.VIEWER`.');});diff --git a/src/avaturn-agent.js b/src/avaturn-agent.jsnew file mode 100644index 000000000..a4378c83c--- /dev/null+++ b/src/avaturn-agent.js@@ -0,0 +1,150 @@+import { AvaturnHead } from '@avaturn-live/web-sdk';++export class AvaturnAgent {+ constructor(containerEl) {+ this.container = containerEl;+ this.avatar = null;+ this.sessionId = null;+ this.isConnected = false;+ this.isLoading = false;++ this._buildUI();+ }++ _buildUI() {+ // Avatar panel+ this.panel = document.createElement('div');+ this.panel.className = 'avaturn-panel';+ this.panel.innerHTML = `+ <div class="avaturn-header">+ <span class="avaturn-title">3D Agent</span>+ <button class="avaturn-close" aria-label="Close">×</button>+ </div>+ <div class="avaturn-video-wrap">+ <div class="avaturn-video" id="avaturn-video"></div>+ <div class="avaturn-status">Click to connect</div>+ </div>+ <div class="avaturn-controls">+ <input type="text" class="avaturn-input" placeholder="Ask the agent..." />+ <button class="avaturn-send" aria-label="Send">+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>+ </button>+ </div>+ <div class="avaturn-mic-row">+ <button class="avaturn-mic" aria-label="Toggle microphone">+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5zm6 6c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>+ </button>+ </div>+ `;+ this.panel.style.display = 'none';+ this.container.appendChild(this.panel);++ // Toggle button+ this.toggleBtn = document.createElement('button');+ this.toggleBtn.className = 'avaturn-toggle';+ this.toggleBtn.innerHTML = `+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/><path d="M7 9h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2z"/></svg>+ `;+ this.toggleBtn.title = 'Talk to 3D Agent';+ this.container.appendChild(this.toggleBtn);++ // Event listeners+ this.toggleBtn.addEventListener('click', () => this._togglePanel());+ this.panel.querySelector('.avaturn-close').addEventListener('click', () => this._togglePanel());+ this.panel.querySelector('.avaturn-send').addEventListener('click', () => this._sendMessage());+ this.panel.querySelector('.avaturn-input').addEventListener('keydown', (e) => {+ if (e.key === 'Enter') this._sendMessage();+ });+ this.panel.querySelector('.avaturn-mic').addEventListener('click', () => this._toggleMic());+ }++ _togglePanel() {+ const visible = this.panel.style.display !== 'none';+ this.panel.style.display = visible ? 'none' : 'flex';+ this.toggleBtn.classList.toggle('active', !visible);++ if (!visible && !this.isConnected && !this.isLoading) {+ this._connect();+ }+ }++ async _connect() {+ this.isLoading = true;+ this._setStatus('Connecting...');++ try {+ const res = await fetch('/api/avaturn-session', { method: 'POST' });+ if (!res.ok) {+ const err = await res.json();+ throw new Error(err.error || 'Session creation failed');+ }++ const { token, sessionId } = await res.json();+ this.sessionId = sessionId;++ const videoEl = this.panel.querySelector('#avaturn-video');+ this.avatar = new AvaturnHead(videoEl, {+ sessionToken: token,+ audioSource: false,+ keepAlive: true,+ });++ this.avatar.on('init', () => {+ this.isConnected = true;+ this.isLoading = false;+ this._setStatus('');+ this.avatar.task('Hello! I\'m your 3D Agent. Ask me anything about 3D models.');+ });++ this.avatar.on('avatar_started_speaking', () => {+ this.panel.querySelector('.avaturn-video-wrap').classList.add('speaking');+ });++ this.avatar.on('avatar_ended_speaking', () => {+ this.panel.querySelector('.avaturn-video-wrap').classList.remove('speaking');+ });++ this.avatar.on('dispose', () => {+ this.isConnected = false;+ this._setStatus('Disconnected');+ });++ await this.avatar.init();+ } catch (err) {+ console.error('[3D Agent] Avaturn connection failed:', err);+ this.isLoading = false;+ this._setStatus('Connection failed. Check API key.');+ }+ }++ _sendMessage() {+ const input = this.panel.querySelector('.avaturn-input');+ const text = input.value.trim();+ if (!text || !this.avatar || !this.isConnected) return;++ this.avatar.task(text);+ input.value = '';+ }++ _toggleMic() {+ if (!this.avatar || !this.isConnected) return;+ this.avatar.toggleLocalAudio();+ this.panel.querySelector('.avaturn-mic').classList.toggle('active');+ }++ _setStatus(msg) {+ const statusEl = this.panel.querySelector('.avaturn-status');+ statusEl.textContent = msg;+ statusEl.style.display = msg ? 'flex' : 'none';+ }++ dispose() {+ if (this.avatar) {+ this.avatar.dispose();+ this.avatar = null;+ }+ this.isConnected = false;+ this.panel.remove();+ this.toggleBtn.remove();+ }+}diff --git a/style.css b/style.cssindex efcfc6737..1da9e1333 100644--- a/style.css+++ b/style.css@@ -721,3 +721,217 @@ footer .separator {.phi-grid.visible ~ .phi-grid-label {display: block;}++/******************************************************************************+ * Avaturn Agent Panel+ */++.avaturn-toggle {+ position: fixed;+ bottom: 1.5em;+ left: 1.5em;+ width: 48px;+ height: 48px;+ border-radius: 50%;+ border: 1px solid rgba(255, 255, 255, 0.1);+ background: rgba(10, 10, 10, 0.9);+ backdrop-filter: blur(12px);+ -webkit-backdrop-filter: blur(12px);+ color: rgba(255, 255, 255, 0.6);+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ transition: all 0.25s ease;+ z-index: 50;+}++.avaturn-toggle:hover {+ background: rgba(255, 255, 255, 0.08);+ color: #fff;+ border-color: rgba(255, 255, 255, 0.25);+ transform: scale(1.05);+}++.avaturn-toggle.active {+ color: #fff;+ border-color: rgba(255, 255, 255, 0.3);+}++.avaturn-panel {+ position: fixed;+ bottom: 5em;+ left: 1.5em;+ width: 320px;+ max-height: 500px;+ display: flex;+ flex-direction: column;+ background: rgba(10, 10, 10, 0.95);+ backdrop-filter: blur(20px);+ -webkit-backdrop-filter: blur(20px);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 16px;+ overflow: hidden;+ z-index: 50;+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);+}++.avaturn-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.75em 1em;+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);+}++.avaturn-title {+ font-family: 'Inter', sans-serif;+ font-size: 0.85rem;+ font-weight: 500;+ color: rgba(255, 255, 255, 0.8);+ letter-spacing: 0.03em;+}++.avaturn-close {+ background: none;+ border: none;+ color: rgba(255, 255, 255, 0.4);+ font-size: 1.3rem;+ cursor: pointer;+ padding: 0;+ line-height: 1;+ transition: color 0.2s ease;+}++.avaturn-close:hover {+ color: #fff;+}++.avaturn-video-wrap {+ position: relative;+ width: 100%;+ aspect-ratio: 16 / 10;+ background: #000;+ overflow: hidden;+}++.avaturn-video-wrap.speaking {+ box-shadow: inset 0 0 20px rgba(100, 200, 255, 0.1);+}++.avaturn-video-wrap #avaturn-video {+ width: 100%;+ height: 100%;+}++.avaturn-video-wrap #avaturn-video video {+ width: 100%;+ height: 100%;+ object-fit: cover;+}++.avaturn-status {+ position: absolute;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ font-family: 'Inter', sans-serif;+ font-size: 0.8rem;+ color: rgba(255, 255, 255, 0.35);+ letter-spacing: 0.03em;+ pointer-events: none;+}++.avaturn-controls {+ display: flex;+ gap: 0.5em;+ padding: 0.75em;+ border-top: 1px solid rgba(255, 255, 255, 0.06);+}++.avaturn-input {+ flex: 1;+ background: rgba(255, 255, 255, 0.05);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 8px;+ padding: 0.5em 0.75em;+ color: #fff;+ font-family: 'Inter', sans-serif;+ font-size: 0.85rem;+ outline: none;+ transition: border-color 0.2s ease;+}++.avaturn-input::placeholder {+ color: rgba(255, 255, 255, 0.25);+}++.avaturn-input:focus {+ border-color: rgba(255, 255, 255, 0.2);+}++.avaturn-send {+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 8px;+ color: rgba(255, 255, 255, 0.5);+ cursor: pointer;+ padding: 0.5em 0.625em;+ display: flex;+ align-items: center;+ transition: all 0.2s ease;+}++.avaturn-send:hover {+ background: rgba(255, 255, 255, 0.1);+ color: #fff;+}++.avaturn-mic-row {+ display: flex;+ justify-content: center;+ padding: 0 0.75em 0.75em;+}++.avaturn-mic {+ background: rgba(255, 255, 255, 0.04);+ border: 1px solid rgba(255, 255, 255, 0.06);+ border-radius: 50%;+ width: 32px;+ height: 32px;+ display: flex;+ align-items: center;+ justify-content: center;+ color: rgba(255, 255, 255, 0.35);+ cursor: pointer;+ transition: all 0.2s ease;+}++.avaturn-mic:hover {+ background: rgba(255, 255, 255, 0.08);+ color: rgba(255, 255, 255, 0.7);+}++.avaturn-mic.active {+ background: rgba(255, 80, 80, 0.15);+ border-color: rgba(255, 80, 80, 0.3);+ color: #ff5050;+}++@media screen and (max-width: 700px) {+ .avaturn-toggle {+ bottom: 1em;+ left: 1em;+ width: 42px;+ height: 42px;+ }++ .avaturn-panel {+ bottom: 4em;+ left: 0.75em;+ right: 0.75em;+ width: auto;+ max-height: 60vh;+ }+}diff --git a/vercel.json b/vercel.jsonindex 922cb256f..2d3462646 100644--- a/vercel.json+++ b/vercel.json@@ -1,6 +1,10 @@{"public": true,"routes": [+ {+ "src": "/api/(.*)",+ "dest": "/api/$1"+ },{"src": "/assets/(.*)","headers": { "cache-control": "max-age=604800, public" },