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.

Add Playwright scripts for verifying and capturing app-next deployment states

nirholasb4a71b149765
diff --git a/api/walk-og.js b/api/walk-og.js
new file mode 100644
index 000000000..322e92c18
--- /dev/null
+++ b/api/walk-og.js
@@ -0,0 +1,132 @@
+/**
+ * Walk OG image endpoint
+ * ----------------------
+ * GET /api/walk-og?avatar=<id>&handle=<handle>
+ *
+ * Returns an SVG Open Graph card (1200×630) showing the avatar's thumbnail,
+ * a "Walk with @handle" headline, and the three.ws branding.
+ *
+ * If the avatar has a real thumbnail_url, it is embedded as a base64 data-URI
+ * so the SVG is self-contained and renders correctly in all OG crawlers.
+ * On any fetch failure the card degrades to a text-only graphic.
+ */
+
+import { getAvatar } from './_lib/avatars.js';
+import { cors, wrap } from './_lib/http.js';
+
+const CACHE = 'public, max-age=3600, s-maxage=86400';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+
+ const url = new URL(req.url, 'http://x');
+ const id = url.searchParams.get('avatar') || '';
+ const handle = url.searchParams.get('handle') || '';
+
+ let thumbDataUri = '';
+ if (id) {
+ try {
+ const avatar = await getAvatar({ id });
+ if (avatar?.thumbnail_url) {
+ const r = await fetch(avatar.thumbnail_url);
+ if (r.ok) {
+ const buf = await r.arrayBuffer();
+ const ct = r.headers.get('content-type') || 'image/jpeg';
+ thumbDataUri = `data:${ct};base64,${Buffer.from(buf).toString('base64')}`;
+ }
+ }
+ } catch {
+ // degrade gracefully
+ }
+ }
+
+ const displayHandle = handle ? `@${handle}` : 'three.ws';
+
+ res.statusCode = 200;
+ res.setHeader('content-type', 'image/svg+xml; charset=utf-8');
+ res.setHeader('cache-control', CACHE);
+ res.end(renderSvg({ thumbDataUri, displayHandle }));
+});
+
+function renderSvg({ thumbDataUri, displayHandle }) {
+ const safeHandle = escapeXml(truncate(displayHandle, 40));
+
+ const avatarBlock = thumbDataUri
+ ? `<image href="${thumbDataUri}" x="720" y="60" width="420" height="510" preserveAspectRatio="xMidYMid meet" clip-path="url(#thumb-clip)" />`
+ : `<rect x="720" y="60" width="420" height="510" rx="24" fill="#1a1a2e" />
+ <text x="930" y="340" fill="#3d3d6b" font-family="Inter, system-ui, sans-serif" font-size="80" text-anchor="middle">👟</text>`;
+
+ return `<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="1200" height="630" viewBox="0 0 1200 630" role="img"
+ aria-label="Walk with ${safeHandle} on three.ws">
+ <defs>
+ <clipPath id="thumb-clip">
+ <rect x="720" y="60" width="420" height="510" rx="24" />
+ </clipPath>
+ <linearGradient id="bg-grad" x1="0" y1="0" x2="1200" y2="630" gradientUnits="userSpaceOnUse">
+ <stop offset="0%" stop-color="#06040f" />
+ <stop offset="100%" stop-color="#0d0921" />
+ </linearGradient>
+ <linearGradient id="fade" x1="0" y1="0" x2="1" y2="0">
+ <stop offset="60%" stop-color="transparent" />
+ <stop offset="100%" stop-color="rgba(13,9,33,0.9)" />
+ </linearGradient>
+ </defs>
+
+ <!-- background -->
+ <rect width="1200" height="630" fill="url(#bg-grad)" />
+
+ <!-- subtle grid lines -->
+ <line x1="0" y1="210" x2="1200" y2="210" stroke="rgba(124,58,237,0.07)" stroke-width="1"/>
+ <line x1="0" y1="420" x2="1200" y2="420" stroke="rgba(124,58,237,0.07)" stroke-width="1"/>
+ <line x1="400" y1="0" x2="400" y2="630" stroke="rgba(124,58,237,0.07)" stroke-width="1"/>
+
+ <!-- avatar thumbnail -->
+ ${avatarBlock}
+
+ <!-- right-side fade so text is legible -->
+ <rect x="600" y="0" width="600" height="630" fill="url(#fade)" />
+
+ <!-- accent line -->
+ <rect x="72" y="160" width="4" height="80" rx="2" fill="#7c3aed" />
+
+ <!-- headline -->
+ <text x="92" y="220" fill="#f5f5f5"
+ font-family="Inter, -apple-system, system-ui, sans-serif"
+ font-size="28" font-weight="400" letter-spacing="-0.5">Walk with</text>
+ <text x="92" y="280" fill="#a78bfa"
+ font-family="Inter, -apple-system, system-ui, sans-serif"
+ font-size="44" font-weight="700" letter-spacing="-1">${safeHandle}</text>
+
+ <!-- subheadline -->
+ <text x="92" y="340" fill="rgba(245,245,245,0.55)"
+ font-family="Inter, -apple-system, system-ui, sans-serif"
+ font-size="22" font-weight="300">Your 3D avatar walks anywhere on the web.</text>
+
+ <!-- CTA pill -->
+ <rect x="92" y="380" width="200" height="44" rx="22" fill="#7c3aed" />
+ <text x="192" y="408" fill="#fff"
+ font-family="Inter, -apple-system, system-ui, sans-serif"
+ font-size="16" font-weight="600" text-anchor="middle">Try it free →</text>
+
+ <!-- branding -->
+ <text x="92" y="580" fill="rgba(245,245,245,0.25)"
+ font-family="Inter, -apple-system, system-ui, sans-serif"
+ font-size="18" font-weight="400" letter-spacing="3">three.ws</text>
+</svg>`;
+}
+
+function truncate(s, n) {
+ s = String(s || '');
+ return s.length <= n ? s : s.slice(0, n - 1) + '…';
+}
+
+function escapeXml(s) {
+ return String(s)
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&apos;');
+}
diff --git a/pages/discover-next.html b/pages/discover-next.html
new file mode 100644
index 000000000..ebfe5cac6
--- /dev/null
+++ b/pages/discover-next.html
@@ -0,0 +1,400 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Discover agents · three.ws</title>
+ <meta name="description" content="Browse every 3D AI agent on three.ws. Talk, embed, remix." />
+ <link rel="icon" href="/favicon.ico" />
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link href="https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800;900&display=swap" rel="stylesheet" />
+ <style>
+ :root {
+ color-scheme: dark;
+ --bg: #050505;
+ --bg-soft: #0a0a0a;
+ --panel: #111;
+ --panel-soft: #161616;
+ --border: #1e1e1e;
+ --border-strong: #2a2a2a;
+ --text: #f0f0f0;
+ --text-soft: #888;
+ --muted: #444;
+ --ok: #22c55e;
+ --font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
+ }
+ * { box-sizing: border-box; }
+ html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; min-height: 100vh; }
+ a { color: inherit; text-decoration: none; }
+ button { font-family: inherit; cursor: pointer; }
+
+ /* ── NAV ── */
+ .nav {
+ position: sticky; top: 0; z-index: 100;
+ backdrop-filter: blur(18px);
+ background: rgba(5, 5, 5, 0.86);
+ border-bottom: 1px solid var(--border);
+ }
+ .nav-inner {
+ max-width: 1440px; margin: 0 auto;
+ display: flex; align-items: center; gap: 24px;
+ padding: 14px 24px;
+ }
+ .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
+ .brand-dot { width: 20px; height: 20px; border-radius: 5px; background: var(--text); }
+ .nav-links { display: flex; gap: 2px; margin-left: 16px; flex: 1; }
+ .nav-links a { padding: 8px 13px; border-radius: 8px; color: var(--text-soft); font-size: 14px; font-weight: 500; transition: background 0.12s, color 0.12s; }
+ .nav-links a:hover, .nav-links a.active { background: var(--panel); color: var(--text); }
+ .nav-end { display: flex; align-items: center; gap: 8px; }
+ .nav-end a { font-size: 13px; color: var(--text-soft); padding: 7px 13px; border-radius: 8px; }
+ .nav-end a:hover { color: var(--text); }
+ .nav-end .cta { background: var(--text); color: var(--bg); font-weight: 600; padding: 7px 15px; border-radius: 8px; font-size: 13px; }
+ .nav-end .cta:hover { opacity: 0.88; }
+ @media (max-width: 860px) { .nav-links { display: none; } .nav-inner { padding: 12px 18px; } }
+
+ /* ── HERO SEARCH ── */
+ .hero {
+ max-width: 720px; margin: 0 auto;
+ padding: 64px 24px 40px;
+ text-align: center;
+ }
+ .hero-eyebrow {
+ font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
+ color: var(--muted); margin-bottom: 16px;
+ }
+ .hero h1 {
+ font-size: clamp(36px, 5vw, 56px);
+ letter-spacing: -0.03em; font-weight: 800;
+ margin: 0 0 12px; line-height: 1.05;
+ }
+ .hero-sub { font-size: 15px; color: var(--text-soft); margin: 0 0 32px; }
+
+ .search-wrap {
+ position: relative; max-width: 540px; margin: 0 auto;
+ }
+ .search-icon {
+ position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
+ color: var(--muted); font-size: 15px; pointer-events: none;
+ }
+ .search-input {
+ width: 100%;
+ background: var(--panel); border: 1px solid var(--border-strong);
+ border-radius: 12px; outline: none;
+ color: var(--text); font-family: var(--font); font-size: 15px;
+ padding: 14px 44px 14px 44px;
+ }
+ .search-input::placeholder { color: var(--muted); }
+ .search-input:focus { border-color: var(--text-soft); }
+ .search-clear {
+ position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
+ background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px;
+ display: none;
+ }
+ .search-clear.visible { display: block; }
+ .search-clear:hover { color: var(--text); }
+
+ /* ── STATS ── */
+ .stats-bar {
+ max-width: 1440px; margin: 0 auto; padding: 0 24px 32px;
+ display: flex; align-items: center; gap: 24px;
+ font-size: 12.5px; color: var(--muted);
+ }
+ .stats-bar strong { color: var(--text-soft); font-weight: 600; }
+
+ /* ── FILTER BAR ── */
+ .filter-bar {
+ max-width: 1440px; margin: 0 auto; padding: 0 24px 28px;
+ display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
+ }
+ .filter-btn {
+ background: transparent; color: var(--text-soft);
+ border: 1px solid var(--border-strong); border-radius: 99px;
+ padding: 6px 14px; font-size: 12.5px; font-weight: 500;
+ transition: background 0.12s, color 0.12s, border-color 0.12s;
+ }
+ .filter-btn:hover { color: var(--text); border-color: var(--text-soft); }
+ .filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
+
+ /* ── GRID ── */
+ .grid-wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px 80px; }
+ .grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
+ gap: 12px;
+ }
+ @media (max-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
+
+ .card {
+ position: relative; aspect-ratio: 3 / 4;
+ background: var(--panel); border: 1px solid var(--border);
+ border-radius: 14px; overflow: hidden;
+ display: block;
+ transition: border-color 0.18s, transform 0.18s;
+ }
+ .card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
+ .card img {
+ position: absolute; inset: 0;
+ width: 100%; height: 100%; object-fit: cover;
+ transition: opacity 0.3s;
+ }
+ .card img.loading { opacity: 0; }
+ .card-meta {
+ position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
+ padding: 32px 14px 14px;
+ background: linear-gradient(transparent, rgba(5,5,5,0.9) 60%);
+ }
+ .card-name { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .card-author { font-size: 11.5px; color: var(--text-soft); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .card-badge {
+ position: absolute; top: 10px; left: 10px; z-index: 3;
+ font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
+ padding: 3px 8px; border-radius: 99px;
+ background: rgba(5,5,5,0.75); color: var(--text-soft);
+ border: 1px solid var(--border-strong);
+ backdrop-filter: blur(6px);
+ }
+ .card-badge.live { color: var(--ok); border-color: rgba(34,197,94,0.3); }
+
+ /* ── LOAD MORE / STATUS ── */
+ .load-more-wrap { text-align: center; padding: 32px 0 0; }
+ .load-more {
+ background: transparent; color: var(--text-soft);
+ border: 1px solid var(--border-strong);
+ border-radius: 10px; padding: 12px 32px;
+ font-size: 14px; font-weight: 500;
+ transition: color 0.12s, border-color 0.12s;
+ }
+ .load-more:hover { color: var(--text); border-color: var(--text-soft); }
+ .load-more[disabled] { opacity: 0.4; pointer-events: none; }
+
+ .status-msg {
+ text-align: center; color: var(--muted); font-size: 14px;
+ padding: 48px 0; display: none;
+ }
+ .status-msg.visible { display: block; }
+
+ /* ── SKELETON ── */
+ .card-skel {
+ aspect-ratio: 3 / 4; background: var(--panel);
+ border: 1px solid var(--border); border-radius: 14px;
+ animation: shimmer 1.4s infinite;
+ }
+ @keyframes shimmer {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.5; }
+ }
+ </style>
+</head>
+<body>
+ <header class="nav">
+ <div class="nav-inner">
+ <a class="brand" href="/home-next">
+ <span class="brand-dot"></span>
+ <span>three.ws</span>
+ </a>
+ <nav class="nav-links">
+ <a href="/create">Build</a>
+ <a href="/home-next#embed">Embed</a>
+ <a href="/discover-next" class="active">Discover</a>
+ <a href="/pricing">Pricing</a>
+ <a href="/docs">Docs</a>
+ </nav>
+ <div class="nav-end">
+ <a href="/login">Sign in</a>
+ <a class="cta" href="/dashboard-next">Console</a>
+ </div>
+ </div>
+ </header>
+
+ <section class="hero">
+ <p class="hero-eyebrow">Agent directory</p>
+ <h1>Discover agents.</h1>
+ <p class="hero-sub">Talk to a 3D AI agent, embed it on your site, or remix it into your own.</p>
+ <div class="search-wrap">
+ <span class="search-icon">⌕</span>
+ <input class="search-input" id="search" type="search" placeholder="Search by name…" autocomplete="off" />
+ <button class="search-clear" id="search-clear" aria-label="Clear">×</button>
+ </div>
+ </section>
+
+ <div class="stats-bar" id="stats-bar" style="display:none">
+ <span><strong id="stat-total">—</strong> agents</span>
+ <span><strong id="stat-3d">—</strong> with 3D avatars</span>
+ </div>
+
+ <div class="filter-bar" id="filter-bar">
+ <button class="filter-btn active" data-source="all">All</button>
+ <button class="filter-btn" data-source="avatar">3D avatars</button>
+ <button class="filter-btn" data-source="onchain">On-chain</button>
+ </div>
+
+ <div class="grid-wrap">
+ <div class="grid" id="grid"></div>
+ <p class="status-msg" id="status-msg">No agents found.</p>
+ <div class="load-more-wrap">
+ <button class="load-more" id="load-more" style="display:none">Load more</button>
+ </div>
+ </div>
+
+ <script>
+ const grid = document.getElementById('grid');
+ const loadMoreBtn = document.getElementById('load-more');
+ const statusMsg = document.getElementById('status-msg');
+ const searchInput = document.getElementById('search');
+ const searchClear = document.getElementById('search-clear');
+
+ let cursor = null;
+ let loading = false;
+ let exhausted = false;
+ let activeSource = 'all';
+ let activeQ = '';
+ let debounceTimer;
+
+ // ── Fetch a page ────────────────────────────────────────────────
+ async function fetchPage() {
+ if (loading || exhausted) return;
+ loading = true;
+ loadMoreBtn.disabled = true;
+
+ const params = new URLSearchParams({ limit: '36', quality: 'high', source: activeSource });
+ if (activeQ) params.set('q', activeQ);
+ if (cursor) params.set('cursor', cursor);
+
+ try {
+ const r = await fetch(`/api/explore?${params}`);
+ if (!r.ok) throw new Error(`${r.status}`);
+ const d = await r.json();
+
+ // First page: remove skeletons
+ if (!cursor) grid.innerHTML = '';
+
+ const items = d.items || [];
+ if (items.length === 0 && !cursor) {
+ statusMsg.classList.add('visible');
+ } else {
+ statusMsg.classList.remove('visible');
+ items.forEach((item) => grid.appendChild(renderCard(item)));
+ }
+
+ cursor = d.nextCursor || null;
+ exhausted = !cursor;
+ loadMoreBtn.style.display = exhausted ? 'none' : '';
+ loadMoreBtn.disabled = false;
+
+ // Stats on first page
+ if (!params.get('cursor') && d.totalCount != null) {
+ const total = document.getElementById('stat-total');
+ const s3d = document.getElementById('stat-3d');
+ if (total) total.textContent = Number(d.totalCount).toLocaleString();
+ if (s3d && d.count3d != null) s3d.textContent = Number(d.count3d).toLocaleString();
+ document.getElementById('stats-bar').style.display = '';
+ }
+ } catch (err) {
+ console.error('explore fetch failed:', err);
+ if (!cursor) {
+ statusMsg.textContent = 'Failed to load agents.';
+ statusMsg.classList.add('visible');
+ grid.innerHTML = '';
+ }
+ }
+ loading = false;
+ }
+
+ // ── Render a card ────────────────────────────────────────────────
+ function escHtml(s) {
+ return String(s ?? '').replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
+ }
+
+ function renderCard(item) {
+ const a = document.createElement('a');
+ a.className = 'card';
+
+ if (item.kind === 'avatar') {
+ a.href = `/agent-next?id=${encodeURIComponent(item.avatarId)}`;
+ const imgSrc = item.image || '';
+ const author = item.slug ? `@${item.slug}` : '';
+ a.innerHTML = `
+ ${imgSrc ? `<img src="${escHtml(imgSrc)}" alt="${escHtml(item.name)}" loading="lazy" class="loading" />` : ''}
+ <span class="card-badge live">● Live</span>
+ <div class="card-meta">
+ <div class="card-name">${escHtml(item.name || 'Untitled')}</div>
+ ${author ? `<div class="card-author">${escHtml(author)}</div>` : ''}
+ </div>
+ `;
+ const img = a.querySelector('img');
+ if (img) img.addEventListener('load', () => img.classList.remove('loading'));
+ } else {
+ // On-chain ERC-8004 agent
+ const detailUrl = `/discover/a/${encodeURIComponent(item.chainId)}/${encodeURIComponent(item.agentId)}`;
+ a.href = detailUrl;
+ const imgSrc = item.image || '';
+ a.innerHTML = `
+ ${imgSrc ? `<img src="${escHtml(imgSrc)}" alt="${escHtml(item.name)}" loading="lazy" class="loading" />` : ''}
+ <span class="card-badge">On-chain</span>
+ <div class="card-meta">
+ <div class="card-name">${escHtml(item.name || 'Agent')}</div>
+ ${item.chainName ? `<div class="card-author">${escHtml(item.chainName)}</div>` : ''}
+ </div>
+ `;
+ const img = a.querySelector('img');
+ if (img) img.addEventListener('load', () => img.classList.remove('loading'));
+ }
+ return a;
+ }
+
+ // ── Skeletons while loading ──────────────────────────────────────
+ function showSkeletons(n = 12) {
+ grid.innerHTML = '';
+ for (let i = 0; i < n; i++) {
+ const d = document.createElement('div');
+ d.className = 'card-skel';
+ grid.appendChild(d);
+ }
+ }
+
+ // ── Reset and reload ─────────────────────────────────────────────
+ function reload() {
+ cursor = null;
+ exhausted = false;
+ statusMsg.classList.remove('visible');
+ showSkeletons();
+ fetchPage();
+ }
+
+ // ── Filters ──────────────────────────────────────────────────────
+ document.getElementById('filter-bar').addEventListener('click', (e) => {
+ const btn = e.target.closest('[data-source]');
+ if (!btn) return;
+ document.querySelectorAll('.filter-btn').forEach((b) => b.classList.remove('active'));
+ btn.classList.add('active');
+ activeSource = btn.dataset.source;
+ reload();
+ });
+
+ // ── Search ───────────────────────────────────────────────────────
+ searchInput.addEventListener('input', () => {
+ const q = searchInput.value.trim();
+ searchClear.classList.toggle('visible', q.length > 0);
+ clearTimeout(debounceTimer);
+ debounceTimer = setTimeout(() => {
+ activeQ = q;
+ reload();
+ }, 320);
+ });
+ searchClear.addEventListener('click', () => {
+ searchInput.value = '';
+ searchClear.classList.remove('visible');
+ activeQ = '';
+ reload();
+ });
+
+ // ── Load more ────────────────────────────────────────────────────
+ loadMoreBtn.addEventListener('click', fetchPage);
+
+ // ── Init ─────────────────────────────────────────────────────────
+ showSkeletons();
+ fetchPage();
+ </script>
+</body>
+</html>
diff --git a/pages/embed-walk.html b/pages/embed-walk.html
new file mode 100644
index 000000000..dedc10e28
--- /dev/null
+++ b/pages/embed-walk.html
@@ -0,0 +1,647 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Walk Avatar Embed Generator · three.ws</title>
+ <meta name="description" content="Generate an embed snippet for your three.ws walking avatar — iframe or one-line JS tag." />
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+
+ :root {
+ --bg: #0a0a0a;
+ --surface: #111111;
+ --surface2: #1a1a1a;
+ --border: rgba(255,255,255,0.08);
+ --text: #f5f5f5;
+ --text-muted: #71717a;
+ --accent: #7c3aed;
+ --accent-light: #a78bfa;
+ --radius: 10px;
+ --font: 'Inter', system-ui, -apple-system, sans-serif;
+ --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
+ }
+
+ html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
+
+ a { color: var(--accent-light); text-decoration: none; }
+ a:hover { text-decoration: underline; }
+
+ /* ── Layout ─────────────────────────────────────────────────────── */
+ .ew-topbar {
+ display: flex; align-items: center; gap: 12px;
+ padding: 14px 24px;
+ border-bottom: 1px solid var(--border);
+ background: var(--surface);
+ }
+ .ew-topbar-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
+ .ew-topbar-logo svg { width: 22px; height: 22px; }
+ .ew-topbar-sep { color: var(--text-muted); }
+ .ew-topbar-title { color: var(--text-muted); font-size: 14px; }
+ .ew-topbar-back { margin-left: auto; font-size: 13px; color: var(--text-muted); }
+
+ .ew-layout {
+ display: grid;
+ grid-template-columns: 380px 1fr;
+ min-height: calc(100vh - 53px);
+ }
+ @media (max-width: 800px) { .ew-layout { grid-template-columns: 1fr; } }
+
+ /* ── Left panel (config) ─────────────────────────────────────────── */
+ .ew-config {
+ border-right: 1px solid var(--border);
+ overflow-y: auto;
+ padding: 24px;
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ }
+
+ .ew-section-title {
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-muted);
+ margin-bottom: 8px;
+ }
+
+ .ew-field { display: flex; flex-direction: column; gap: 6px; }
+ .ew-label { font-size: 13px; color: var(--text-muted); }
+ .ew-input, .ew-select {
+ background: var(--surface2);
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ color: var(--text);
+ font-size: 13px;
+ padding: 8px 10px;
+ font-family: var(--font);
+ outline: none;
+ width: 100%;
+ transition: border-color 0.15s;
+ }
+ .ew-input:focus, .ew-select:focus { border-color: var(--accent); }
+ .ew-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
+ .ew-select option { background: #1a1a1a; }
+
+ .ew-radio-group { display: flex; gap: 6px; flex-wrap: wrap; }
+ .ew-radio-group label {
+ display: flex; align-items: center; gap: 6px;
+ padding: 6px 12px;
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ cursor: pointer;
+ font-size: 13px;
+ transition: border-color 0.15s, background 0.15s;
+ }
+ .ew-radio-group label:has(input:checked) { border-color: var(--accent); background: rgba(124,58,237,0.12); color: var(--accent-light); }
+ .ew-radio-group input { display: none; }
+
+ .ew-toggle-row { display: flex; align-items: center; justify-content: space-between; }
+ .ew-toggle {
+ position: relative; width: 36px; height: 20px;
+ background: var(--surface2);
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ cursor: pointer;
+ transition: background 0.2s;
+ flex-shrink: 0;
+ }
+ .ew-toggle.on { background: var(--accent); border-color: var(--accent); }
+ .ew-toggle::after {
+ content: ''; position: absolute; width: 14px; height: 14px;
+ background: #fff; border-radius: 50%; top: 2px; left: 2px;
+ transition: transform 0.2s;
+ }
+ .ew-toggle.on::after { transform: translateX(16px); }
+
+ .ew-slider-row { display: flex; align-items: center; gap: 10px; }
+ .ew-slider { flex: 1; accent-color: var(--accent); cursor: pointer; }
+ .ew-slider-val { font-size: 12px; color: var(--text-muted); min-width: 30px; text-align: right; font-family: var(--mono); }
+
+ .ew-size-presets { display: flex; gap: 6px; margin-bottom: 8px; }
+ .ew-size-preset {
+ padding: 5px 10px;
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ font-size: 12px;
+ cursor: pointer;
+ background: none;
+ color: var(--text-muted);
+ transition: all 0.15s;
+ }
+ .ew-size-preset:hover, .ew-size-preset.active { border-color: var(--accent); color: var(--accent-light); background: rgba(124,58,237,0.1); }
+
+ .ew-wh { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
+
+ .ew-avatar-input-row { display: flex; gap: 8px; align-items: flex-end; }
+ .ew-avatar-input-row .ew-input { flex: 1; }
+ .ew-avatar-preview {
+ width: 52px; height: 52px; border-radius: 8px;
+ background: var(--surface2); border: 1px solid var(--border);
+ object-fit: cover; flex-shrink: 0; display: block;
+ }
+
+ /* ── Right panel (preview + snippet) ────────────────────────────── */
+ .ew-preview-panel {
+ display: flex; flex-direction: column;
+ padding: 24px;
+ gap: 20px;
+ }
+
+ .ew-preview-wrap {
+ flex: 1;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ overflow: hidden;
+ background: var(--surface);
+ position: relative;
+ min-height: 300px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .ew-preview-iframe {
+ border: none;
+ display: block;
+ }
+ .ew-preview-label {
+ position: absolute;
+ top: 10px;
+ left: 50%;
+ transform: translateX(-50%);
+ font-size: 11px;
+ color: var(--text-muted);
+ background: rgba(0,0,0,0.7);
+ padding: 3px 10px;
+ border-radius: 999px;
+ pointer-events: none;
+ white-space: nowrap;
+ }
+ .ew-preview-new-tab {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ font-size: 11px;
+ color: var(--text-muted);
+ background: rgba(0,0,0,0.7);
+ padding: 3px 10px;
+ border-radius: 999px;
+ text-decoration: none;
+ transition: color 0.15s;
+ }
+ .ew-preview-new-tab:hover { color: var(--text); text-decoration: none; }
+
+ .ew-snippet-section { display: flex; flex-direction: column; gap: 10px; }
+
+ .ew-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
+ .ew-tab {
+ padding: 8px 14px;
+ font-size: 13px;
+ color: var(--text-muted);
+ cursor: pointer;
+ border: none;
+ background: none;
+ border-bottom: 2px solid transparent;
+ margin-bottom: -1px;
+ transition: color 0.15s, border-color 0.15s;
+ }
+ .ew-tab.active { color: var(--text); border-bottom-color: var(--accent); }
+ .ew-tab:hover:not(.active) { color: var(--text); }
+
+ .ew-code-block {
+ position: relative;
+ background: var(--surface2);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ overflow: hidden;
+ }
+ .ew-code-block pre {
+ padding: 14px 16px;
+ font-family: var(--mono);
+ font-size: 12px;
+ line-height: 1.6;
+ color: var(--text);
+ overflow-x: auto;
+ white-space: pre;
+ }
+ .ew-copy-btn {
+ position: absolute;
+ top: 8px;
+ right: 8px;
+ padding: 4px 10px;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ font-size: 11px;
+ color: var(--text-muted);
+ cursor: pointer;
+ transition: all 0.15s;
+ font-family: var(--font);
+ }
+ .ew-copy-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
+ .ew-copy-btn.copied { color: #4ade80; border-color: rgba(74,222,128,0.3); }
+
+ .ew-note {
+ font-size: 12px;
+ color: var(--text-muted);
+ line-height: 1.5;
+ padding: 10px 12px;
+ background: rgba(124,58,237,0.08);
+ border: 1px solid rgba(124,58,237,0.2);
+ border-radius: 6px;
+ }
+
+ /* color swatch */
+ .ew-color-row { display: flex; align-items: center; gap: 8px; }
+ .ew-color-row input[type=color] { width: 36px; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 2px; background: var(--surface2); cursor: pointer; }
+
+ /* skeleton for avatar thumb */
+ @keyframes shimmer { from { opacity: 0.4; } to { opacity: 1; } }
+ .ew-avatar-preview.loading { animation: shimmer 0.9s ease-in-out alternate infinite; }
+ </style>
+</head>
+<body>
+<nav class="ew-topbar">
+ <a href="/" class="ew-topbar-logo">
+ <svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="15" stroke="#7c3aed" stroke-width="2"/><path d="M8 16l8-8 8 8-8 8-8-8z" fill="#7c3aed" opacity=".5"/><circle cx="16" cy="16" r="4" fill="#a78bfa"/></svg>
+ three.ws
+ </a>
+ <span class="ew-topbar-sep">/</span>
+ <span class="ew-topbar-title">Walk Embed Generator</span>
+ <a href="/walk" class="ew-topbar-back">← Back to Walk</a>
+</nav>
+
+<div class="ew-layout">
+ <!-- ── Left: config ──────────────────────────────────────────── -->
+ <aside class="ew-config">
+
+ <div>
+ <div class="ew-section-title">Avatar</div>
+ <div class="ew-field">
+ <label class="ew-label" for="cfg-avatar">Avatar ID</label>
+ <div class="ew-avatar-input-row">
+ <input id="cfg-avatar" class="ew-input" type="text" placeholder="paste avatar UUID…" spellcheck="false" />
+ <img id="avatar-thumb" class="ew-avatar-preview" src="" alt="avatar preview" />
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Controls</div>
+ <div class="ew-radio-group" id="cfg-controls">
+ <label><input type="radio" name="controls" value="joystick" checked> Joystick</label>
+ <label><input type="radio" name="controls" value="keyboard"> Keyboard</label>
+ <label><input type="radio" name="controls" value="none"> None (autoplay)</label>
+ <label><input type="radio" name="controls" value="auto"> Auto (device)</label>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Background</div>
+ <div class="ew-radio-group" id="cfg-bg-type">
+ <label><input type="radio" name="bg-type" value="transparent" checked> Transparent</label>
+ <label><input type="radio" name="bg-type" value="color"> Color</label>
+ <label><input type="radio" name="bg-type" value="none"> Black</label>
+ </div>
+ <div class="ew-color-row" id="bg-color-row" style="margin-top:10px;display:none">
+ <input type="color" id="cfg-bg-color" value="#1a1a2e" />
+ <span class="ew-label" id="bg-color-label">#1a1a2e</span>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Size</div>
+ <div class="ew-size-presets" id="size-presets">
+ <button class="ew-size-preset" data-w="200" data-h="280">S</button>
+ <button class="ew-size-preset active" data-w="320" data-h="480">M</button>
+ <button class="ew-size-preset" data-w="480" data-h="720">L</button>
+ <button class="ew-size-preset" data-w="" data-h="">Custom</button>
+ </div>
+ <div class="ew-wh">
+ <div class="ew-field">
+ <label class="ew-label" for="cfg-w">Width (px)</label>
+ <input id="cfg-w" class="ew-input" type="number" value="320" min="100" max="2000" />
+ </div>
+ <div class="ew-field">
+ <label class="ew-label" for="cfg-h">Height (px)</label>
+ <input id="cfg-h" class="ew-input" type="number" value="480" min="100" max="2000" />
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Walk Speed</div>
+ <div class="ew-slider-row">
+ <input type="range" id="cfg-speed" class="ew-slider" min="0.5" max="2" step="0.05" value="1" />
+ <span class="ew-slider-val" id="cfg-speed-val">1×</span>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Options</div>
+ <div class="ew-field" style="gap:12px">
+ <div class="ew-toggle-row">
+ <span class="ew-label">Autoplay idle animation</span>
+ <div class="ew-toggle on" id="cfg-autoplay" role="switch" aria-checked="true" tabindex="0"></div>
+ </div>
+ <div class="ew-toggle-row">
+ <span class="ew-label">Shadow ground disc</span>
+ <div class="ew-toggle" id="cfg-ground" role="switch" aria-checked="false" tabindex="0"></div>
+ </div>
+ <div class="ew-toggle-row">
+ <span class="ew-label">Orbit drag (desktop)</span>
+ <div class="ew-toggle" id="cfg-orbit" role="switch" aria-checked="false" tabindex="0"></div>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <div class="ew-section-title">Embed Type</div>
+ <div class="ew-radio-group" id="cfg-embed-type">
+ <label><input type="radio" name="embed-type" value="iframe" checked> iframe</label>
+ <label><input type="radio" name="embed-type" value="js"> JS SDK (script tag)</label>
+ </div>
+ </div>
+
+ </aside>
+
+ <!-- ── Right: preview + snippet ──────────────────────────────── -->
+ <main class="ew-preview-panel">
+ <div class="ew-preview-wrap" id="preview-wrap">
+ <span class="ew-preview-label">Live preview</span>
+ <a class="ew-preview-new-tab" id="preview-new-tab" href="#" target="_blank" rel="noopener">↗ New tab</a>
+ <iframe id="preview-iframe" class="ew-preview-iframe" title="Avatar preview" allow="autoplay" loading="lazy"></iframe>
+ </div>
+
+ <div class="ew-snippet-section">
+ <div class="ew-tabs" id="snippet-tabs">
+ <button class="ew-tab active" data-tab="html">HTML</button>
+ <button class="ew-tab" data-tab="react">React</button>
+ <button class="ew-tab" data-tab="vue">Vue</button>
+ <button class="ew-tab" data-tab="svelte">Svelte</button>
+ </div>
+
+ <div class="ew-code-block">
+ <pre id="snippet-code"></pre>
+ <button class="ew-copy-btn" id="copy-btn">Copy</button>
+ </div>
+
+ <p id="framework-note" class="ew-note" style="display:none">
+ Install the React wrapper: <code>npm i @threews/react</code> — then import <code>WalkEmbed</code> from it.
+ </p>
+ </div>
+ </main>
+</div>
+
+<script type="module">
+const ORIGIN = location.origin;
+
+// ── State ──────────────────────────────────────────────────────────────────
+const cfg = {
+ avatarId: '',
+ controls: 'joystick',
+ bgType: 'transparent',
+ bgColor: '#1a1a2e',
+ w: 320,
+ h: 480,
+ speed: 1,
+ autoplay: true,
+ ground: false,
+ orbit: false,
+ embedType: 'iframe',
+ tab: 'html',
+};
+
+// ── Read URL state ─────────────────────────────────────────────────────────
+(function readUrl() {
+ const p = new URLSearchParams(location.search);
+ if (p.get('avatar')) cfg.avatarId = p.get('avatar');
+ if (p.get('controls')) cfg.controls = p.get('controls');
+ if (p.get('bg')) { const v = p.get('bg'); if (v === 'transparent') { cfg.bgType = 'transparent'; } else { cfg.bgType = 'color'; cfg.bgColor = v; } }
+ if (p.get('w')) cfg.w = parseInt(p.get('w')) || 320;
+ if (p.get('h')) cfg.h = parseInt(p.get('h')) || 480;
+ if (p.get('speed')) cfg.speed = parseFloat(p.get('speed')) || 1;
+ if (p.get('autoplay') === 'false') cfg.autoplay = false;
+ if (p.get('ground') === 'true') cfg.ground = true;
+ if (p.get('orbit') === 'true') cfg.orbit = true;
+ if (p.get('type')) cfg.embedType = p.get('type');
+})();
+
+// ── DOM refs ───────────────────────────────────────────────────────────────
+const avatarInput = document.getElementById('cfg-avatar');
+const avatarThumb = document.getElementById('avatar-thumb');
+const speedSlider = document.getElementById('cfg-speed');
+const speedVal = document.getElementById('cfg-speed-val');
+const wInput = document.getElementById('cfg-w');
+const hInput = document.getElementById('cfg-h');
+const bgColorInput = document.getElementById('cfg-bg-color');
+const bgColorLabel = document.getElementById('bg-color-label');
+const bgColorRow = document.getElementById('bg-color-row');
+const iframe = document.getElementById('preview-iframe');
+const newTabLink = document.getElementById('preview-new-tab');
+const snippetCode = document.getElementById('snippet-code');
+const copyBtn = document.getElementById('copy-btn');
+const frameworkNote = document.getElementById('framework-note');
+const previewWrap = document.getElementById('preview-wrap');
+
+// ── Wire initial values ────────────────────────────────────────────────────
+avatarInput.value = cfg.avatarId;
+speedSlider.value = cfg.speed;
+speedVal.textContent = cfg.speed + '×';
+wInput.value = cfg.w;
+hInput.value = cfg.h;
+bgColorInput.value = cfg.bgColor;
+bgColorLabel.textContent = cfg.bgColor;
+
+document.querySelectorAll('input[name=controls]').forEach(r => { if (r.value === cfg.controls) r.checked = true; });
+document.querySelectorAll('input[name=bg-type]').forEach(r => { if (r.value === cfg.bgType) r.checked = true; });
+document.querySelectorAll('input[name=embed-type]').forEach(r => { if (r.value === cfg.embedType) r.checked = true; });
+
+if (cfg.bgType === 'color') bgColorRow.style.display = 'flex';
+setToggle('cfg-autoplay', cfg.autoplay);
+setToggle('cfg-ground', cfg.ground);
+setToggle('cfg-orbit', cfg.orbit);
+
+// ── Helpers ────────────────────────────────────────────────────────────────
+function setToggle(id, val) {
+ const el = document.getElementById(id);
+ el.classList.toggle('on', val);
+ el.setAttribute('aria-checked', String(val));
+}
+
+function buildSrc() {
+ const p = new URLSearchParams();
+ if (cfg.avatarId) p.set('avatar', cfg.avatarId);
+ p.set('controls', cfg.controls);
+ const bg = cfg.bgType === 'transparent' ? 'transparent' : cfg.bgType === 'color' ? cfg.bgColor : '#000000';
+ p.set('bg', bg);
+ if (cfg.speed !== 1) p.set('speed', String(cfg.speed));
+ if (!cfg.autoplay) p.set('autoplay', 'false');
+ if (cfg.ground) p.set('ground', 'true');
+ if (cfg.orbit) p.set('orbit', 'true');
+ return `${ORIGIN}/walk-embed?${p}`;
+}
+
+function buildSnippet(tab) {
+ const src = buildSrc();
+ const w = cfg.w, h = cfg.h;
+
+ if (cfg.embedType === 'js') {
+ const attrs = [`src="${ORIGIN}/walk-embed-sdk.js"`];
+ if (cfg.avatarId) attrs.push(`data-avatar="${cfg.avatarId}"`);
+ attrs.push(`data-controls="${cfg.controls}"`);
+ const bg = cfg.bgType === 'transparent' ? 'transparent' : cfg.bgType === 'color' ? cfg.bgColor : '#000000';
+ if (bg !== 'transparent') attrs.push(`data-bg="${bg}"`);
+ attrs.push(`data-width="${w}"`, `data-height="${h}"`);
+ if (cfg.speed !== 1) attrs.push(`data-speed="${cfg.speed}"`);
+ if (!cfg.autoplay) attrs.push(`data-autoplay="false"`);
+ if (cfg.ground) attrs.push(`data-ground="true"`);
+ if (cfg.orbit) attrs.push(`data-orbit="true"`);
+ const tag = `<script\n ${attrs.join('\n ')}>\n<\/script>`;
+ if (tab === 'react') return `import { useEffect } from 'react';\n\nexport function WalkAvatar() {\n useEffect(() => {\n const s = document.createElement('script');\n s.src = '${ORIGIN}/walk-embed-sdk.js';\n ${cfg.avatarId ? `s.dataset.avatar = '${cfg.avatarId}';\n ` : ''}s.dataset.controls = '${cfg.controls}';\n s.dataset.width = '${w}';\n s.dataset.height = '${h}';\n document.body.appendChild(s);\n return () => window.ThreeWalkAvatar?.unmount();\n }, []);\n return null;\n}`;
+ if (tab === 'vue') return `<!-- In your component -->\n<script setup>\nimport { onMounted, onUnmounted } from 'vue';\nonMounted(() => {\n const s = document.createElement('script');\n s.src = '${ORIGIN}/walk-embed-sdk.js';\n ${cfg.avatarId ? `s.dataset.avatar = '${cfg.avatarId}';\n ` : ''}s.dataset.controls = '${cfg.controls}';\n s.dataset.width = '${w}';\n s.dataset.height = '${h}';\n document.body.appendChild(s);\n});\nonUnmounted(() => window.ThreeWalkAvatar?.unmount());\n<\/script>`;
+ if (tab === 'svelte') return `<script>\n import { onMount, onDestroy } from 'svelte';\n onMount(() => {\n const s = document.createElement('script');\n s.src = '${ORIGIN}/walk-embed-sdk.js';\n ${cfg.avatarId ? `s.dataset.avatar = '${cfg.avatarId}';\n ` : ''}s.dataset.controls = '${cfg.controls}';\n s.dataset.width = '${w}';\n s.dataset.height = '${h}';\n document.body.appendChild(s);\n return () => window.ThreeWalkAvatar?.unmount();\n });\n<\/script>`;
+ return tag;
+ }
+
+ // iframe
+ const style = `border:0;border-radius:12px;max-width:100%`;
+ const base = `<iframe\n src="${src}"\n width="${w}"\n height="${h}"\n style="${style}"\n allow="autoplay"\n title="Walking avatar"\n loading="lazy">\n</iframe>`;
+
+ if (tab === 'react') return `export function WalkAvatar() {\n return (\n <iframe\n src="${src}"\n width={${w}}\n height={${h}}\n style={{ border: 0, borderRadius: 12, maxWidth: '100%' }}\n allow="autoplay"\n title="Walking avatar"\n loading="lazy"\n />\n );\n}`;
+ if (tab === 'vue') return `<template>\n <iframe\n :src="\`${src}\`"\n :width="${w}"\n :height="${h}"\n style="border:0;border-radius:12px;max-width:100%"\n allow="autoplay"\n title="Walking avatar"\n loading="lazy"\n />\n</template>`;
+ if (tab === 'svelte') return `<iframe\n src="${src}"\n width="${w}"\n height="${h}"\n style="border:0;border-radius:12px;max-width:100%"\n allow="autoplay"\n title="Walking avatar"\n loading="lazy"\n/>`;
+ return base;
+}
+
+// ── Render ─────────────────────────────────────────────────────────────────
+let updateTimer = null;
+function scheduleUpdate() {
+ clearTimeout(updateTimer);
+ updateTimer = setTimeout(update, 120);
+}
+
+function update() {
+ const src = buildSrc();
+ if (iframe.src !== src) {
+ iframe.src = src;
+ newTabLink.href = src;
+ }
+ iframe.width = cfg.w;
+ iframe.height = cfg.h;
+
+ // Keep preview container reasonable
+ const maxW = previewWrap.clientWidth - 32;
+ const maxH = Math.max(300, window.innerHeight * 0.55);
+ const scale = Math.min(1, maxW / cfg.w, maxH / cfg.h);
+ iframe.style.width = Math.round(cfg.w * scale) + 'px';
+ iframe.style.height = Math.round(cfg.h * scale) + 'px';
+
+ // Snippet
+ const activeTab = document.querySelector('.ew-tab.active')?.dataset.tab || 'html';
+ snippetCode.textContent = buildSnippet(activeTab);
+ frameworkNote.style.display = (activeTab !== 'html' && cfg.embedType === 'iframe') ? 'none' : (activeTab !== 'html' ? 'block' : 'none');
+
+ // URL state
+ const p = new URLSearchParams();
+ if (cfg.avatarId) p.set('avatar', cfg.avatarId);
+ if (cfg.controls !== 'joystick') p.set('controls', cfg.controls);
+ const bg = cfg.bgType === 'transparent' ? null : cfg.bgType === 'color' ? cfg.bgColor : '#000000';
+ if (bg) p.set('bg', bg);
+ if (cfg.w !== 320) p.set('w', cfg.w);
+ if (cfg.h !== 480) p.set('h', cfg.h);
+ if (cfg.speed !== 1) p.set('speed', cfg.speed);
+ if (!cfg.autoplay) p.set('autoplay', 'false');
+ if (cfg.ground) p.set('ground', 'true');
+ if (cfg.orbit) p.set('orbit', 'true');
+ if (cfg.embedType !== 'iframe') p.set('type', cfg.embedType);
+ const qs = p.toString();
+ history.replaceState(null, '', qs ? `?${qs}` : location.pathname);
+
+ // Avatar thumb
+ if (cfg.avatarId && cfg.avatarId.length > 8) {
+ avatarThumb.classList.add('loading');
+ avatarThumb.src = `${ORIGIN}/api/avatars/${encodeURIComponent(cfg.avatarId)}/thumbnail`;
+ avatarThumb.onerror = () => { avatarThumb.classList.remove('loading'); avatarThumb.removeAttribute('src'); };
+ avatarThumb.onload = () => avatarThumb.classList.remove('loading');
+ }
+}
+
+// ── Event wiring ───────────────────────────────────────────────────────────
+avatarInput.addEventListener('input', () => { cfg.avatarId = avatarInput.value.trim(); scheduleUpdate(); });
+
+document.querySelectorAll('input[name=controls]').forEach(r => r.addEventListener('change', () => { cfg.controls = r.value; scheduleUpdate(); }));
+
+document.querySelectorAll('input[name=bg-type]').forEach(r => r.addEventListener('change', () => {
+ cfg.bgType = r.value;
+ bgColorRow.style.display = r.value === 'color' ? 'flex' : 'none';
+ scheduleUpdate();
+}));
+
+bgColorInput.addEventListener('input', () => {
+ cfg.bgColor = bgColorInput.value;
+ bgColorLabel.textContent = bgColorInput.value;
+ scheduleUpdate();
+});
+
+document.querySelectorAll('input[name=embed-type]').forEach(r => r.addEventListener('change', () => { cfg.embedType = r.value; scheduleUpdate(); }));
+
+wInput.addEventListener('input', () => { cfg.w = parseInt(wInput.value) || 320; scheduleUpdate(); });
+hInput.addEventListener('input', () => { cfg.h = parseInt(hInput.value) || 480; scheduleUpdate(); });
+
+speedSlider.addEventListener('input', () => {
+ cfg.speed = parseFloat(speedSlider.value);
+ speedVal.textContent = cfg.speed.toFixed(2).replace(/\.?0+$/, '') + '×';
+ scheduleUpdate();
+});
+
+document.getElementById('size-presets').addEventListener('click', e => {
+ const btn = e.target.closest('.ew-size-preset');
+ if (!btn) return;
+ document.querySelectorAll('.ew-size-preset').forEach(b => b.classList.remove('active'));
+ btn.classList.add('active');
+ const w = parseInt(btn.dataset.w), h = parseInt(btn.dataset.h);
+ if (w && h) { cfg.w = w; cfg.h = h; wInput.value = w; hInput.value = h; }
+ scheduleUpdate();
+});
+
+['cfg-autoplay', 'cfg-ground', 'cfg-orbit'].forEach(id => {
+ const el = document.getElementById(id);
+ const key = id.replace('cfg-', '');
+ el.addEventListener('click', () => {
+ cfg[key] = !cfg[key];
+ setToggle(id, cfg[key]);
+ scheduleUpdate();
+ });
+ el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); el.click(); } });
+});
+
+document.getElementById('snippet-tabs').addEventListener('click', e => {
+ const btn = e.target.closest('.ew-tab');
+ if (!btn) return;
+ document.querySelectorAll('.ew-tab').forEach(t => t.classList.remove('active'));
+ btn.classList.add('active');
+ cfg.tab = btn.dataset.tab;
+ scheduleUpdate();
+});
+
+copyBtn.addEventListener('click', async () => {
+ try {
+ await navigator.clipboard.writeText(snippetCode.textContent);
+ copyBtn.textContent = 'Copied!';
+ copyBtn.classList.add('copied');
+ setTimeout(() => { copyBtn.textContent = 'Copy'; copyBtn.classList.remove('copied'); }, 2000);
+ } catch {
+ copyBtn.textContent = 'Copy';
+ }
+});
+
+window.addEventListener('resize', scheduleUpdate);
+
+// ── Initial render ─────────────────────────────────────────────────────────
+update();
+</script>
+</body>
+</html>
diff --git a/pages/walk-app.html b/pages/walk-app.html
new file mode 100644
index 000000000..a3b79b876
--- /dev/null
+++ b/pages/walk-app.html
@@ -0,0 +1,523 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <title>Walk · three.ws</title>
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
+ />
+ <meta name="author" content="nirholas" />
+ <meta
+ name="description"
+ content="See a 3D agent walking on your real floor through your phone camera. Joystick or WASD. One-tap AR. Built on three.ws."
+ />
+ <meta name="theme-color" content="#000000" />
+
+ <!--
+ Multiplayer server URL. Empty in dev — the page falls back to
+ ws://<host>:2567 so `npm run dev:walk-all` works out of the box.
+ In production, set this to the deployed Colyseus host once the
+ multiplayer/ workspace is live (see multiplayer/README.md):
+ <meta name="walk-server" content="wss://three-ws-multiplayer.fly.dev">
+ -->
+ <meta name="walk-server" content="" />
+
+ <link rel="shortcut icon" href="/favicon.ico" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/mobile.css" />
+
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:title" content="Walk · three.ws" />
+ <meta property="og:description" content="A 3D avatar you can walk around — in the browser and in AR." />
+ <meta property="og:url" content="https://three.ws/walk" />
+ <meta property="og:image" id="og-image" content="https://three.ws/api/walk-og" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="Walk · three.ws" />
+ <meta name="twitter:description" content="A 3D avatar you can walk around — in the browser and in AR." />
+ <meta name="twitter:image" id="twitter-image" content="https://three.ws/api/walk-og" />
+ <script>
+ // Patch OG image to include avatar + handle from URL params so
+ // shared links unfurl with the correct avatar thumbnail.
+ (function() {
+ var p = new URLSearchParams(location.search);
+ var av = p.get('avatar') || '';
+ var handle = p.get('handle') || '';
+ if (av) {
+ var q = new URLSearchParams();
+ if (av) q.set('avatar', av);
+ if (handle) q.set('handle', handle);
+ var src = 'https://three.ws/api/walk-og?' + q;
+ document.getElementById('og-image').content = src;
+ document.getElementById('twitter-image').content = src;
+ }
+ })();
+ </script>
+
+ <style>
+ :root {
+ --bg: #0a0a0a;
+ --panel: rgba(17, 17, 17, 0.72);
+ --border: rgba(255, 255, 255, 0.08);
+ --text: #fafafa;
+ --text-2: #a1a1aa;
+ --accent: #7dd3fc;
+ --danger: #f87171;
+ }
+
+ html, body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background: #000;
+ color: var(--text);
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ touch-action: none;
+ overscroll-behavior: none;
+ }
+
+ #walk-stage {
+ position: fixed;
+ inset: 0;
+ background:
+ radial-gradient(80% 60% at 50% 30%, #1a2538 0%, #0a0a0a 70%) #0a0a0a;
+ }
+
+ #walk-camera-feed {
+ position: fixed;
+ inset: 0;
+ width: 100vw;
+ height: 100vh;
+ object-fit: cover;
+ z-index: 1;
+ display: none;
+ background: #000;
+ }
+ #walk-stage.is-ar #walk-camera-feed { display: block; }
+ #walk-stage.is-ar {
+ background: transparent;
+ }
+
+ #walk-canvas {
+ position: fixed;
+ inset: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 2;
+ display: block;
+ /* Joystick / buttons sit on the UI layer above this. The canvas
+ accepts pointer events for the camera-orbit drag handler. */
+ }
+
+ #walk-hud {
+ position: fixed;
+ top: env(safe-area-inset-top, 0);
+ left: 0;
+ right: 0;
+ z-index: 4;
+ display: flex;
+ gap: 8px;
+ align-items: flex-start;
+ justify-content: space-between;
+ padding: 14px 16px;
+ pointer-events: none;
+ }
+ #walk-hud > * { pointer-events: auto; }
+
+ .walk-card {
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 12px;
+ padding: 10px 12px;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ font-size: 13px;
+ line-height: 1.35;
+ max-width: min(60vw, 320px);
+ }
+ .walk-card h1 {
+ margin: 0 0 2px 0;
+ font-size: 14px;
+ font-weight: 600;
+ letter-spacing: 0.01em;
+ }
+ .walk-card p {
+ margin: 0;
+ color: var(--text-2);
+ font-size: 12px;
+ }
+ .walk-card a {
+ color: var(--accent);
+ text-decoration: none;
+ }
+
+ .walk-actions {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ align-items: flex-end;
+ }
+
+ .walk-btn {
+ appearance: none;
+ border: 1px solid var(--border);
+ background: var(--panel);
+ color: var(--text);
+ font: inherit;
+ font-size: 13px;
+ font-weight: 500;
+ padding: 8px 12px;
+ border-radius: 999px;
+ cursor: pointer;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ transition: transform 0.12s ease, background 0.12s ease;
+ }
+ .walk-btn:hover { background: rgba(34, 34, 34, 0.85); }
+ .walk-btn:active { transform: scale(0.97); }
+ .walk-btn[aria-pressed="true"] {
+ background: rgba(125, 211, 252, 0.18);
+ border-color: rgba(125, 211, 252, 0.45);
+ color: #e0f2fe;
+ }
+ .walk-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
+ .walk-btn .dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--text-2);
+ }
+ .walk-btn[aria-pressed="true"] .dot {
+ background: var(--accent);
+ box-shadow: 0 0 8px var(--accent);
+ }
+
+ #walk-joystick {
+ position: fixed;
+ z-index: 5;
+ left: 24px;
+ bottom: calc(28px + env(safe-area-inset-bottom, 0));
+ width: 140px;
+ height: 140px;
+ touch-action: none;
+ pointer-events: auto;
+ }
+
+ #walk-status {
+ position: fixed;
+ z-index: 6;
+ left: 50%;
+ bottom: calc(24px + env(safe-area-inset-bottom, 0));
+ transform: translateX(-50%);
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ padding: 8px 14px;
+ font-size: 12px;
+ color: var(--text-2);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ pointer-events: none;
+ transition: opacity 0.2s ease;
+ }
+ #walk-status.is-error { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); }
+ #walk-status.is-hidden { opacity: 0; }
+
+ #walk-help {
+ position: fixed;
+ z-index: 5;
+ right: 16px;
+ bottom: calc(28px + env(safe-area-inset-bottom, 0));
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ align-items: flex-end;
+ color: var(--text-2);
+ font-size: 11px;
+ pointer-events: none;
+ }
+ .walk-key {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ padding: 4px 8px;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ }
+ .walk-key kbd {
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 10.5px;
+ padding: 1px 5px;
+ border-radius: 4px;
+ background: rgba(255, 255, 255, 0.08);
+ border: 1px solid var(--border);
+ color: var(--text);
+ }
+
+ /* Hide help text on small/touch screens — joystick is enough.
+ Joystick stays visible on all devices: mouse-drag works on
+ desktop the same way touch does on mobile, and keeping the
+ element laid out from page load ensures nipplejs measures
+ its 140×140 zone correctly. */
+ @media (hover: none), (max-width: 640px) {
+ #walk-help { display: none; }
+ }
+
+ /* ── Multiplayer HUD ────────────────────────────────────────────── */
+ #walk-online {
+ appearance: none;
+ border: 1px solid var(--border);
+ background: var(--panel);
+ color: var(--text);
+ font: inherit;
+ font-size: 12px;
+ font-weight: 500;
+ padding: 6px 10px;
+ border-radius: 999px;
+ cursor: default;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ transition: background 0.12s ease;
+ }
+ #walk-online .dot {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: var(--text-2);
+ }
+ #walk-online[data-status="online"] .dot {
+ background: #34d399;
+ box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
+ }
+ #walk-online[data-status="connecting"] .dot,
+ #walk-online[data-status="offline"] .dot {
+ background: #fde047;
+ }
+ #walk-online[data-status="failed"] {
+ cursor: pointer;
+ border-color: rgba(248, 113, 113, 0.5);
+ }
+ #walk-online[data-status="failed"] .dot {
+ background: var(--danger);
+ }
+ #walk-online .count {
+ color: var(--text-2);
+ font-variant-numeric: tabular-nums;
+ min-width: 1ch;
+ text-align: right;
+ }
+ #walk-online[data-status="online"] .count { color: var(--text); }
+
+ /* Floating name tag for remote players — positioned by walk.js
+ from world-space → screen-space each frame. Pointer-events
+ off so it never blocks the orbit drag. */
+ .walk-remote-label {
+ position: fixed;
+ top: 0; left: 0;
+ z-index: 3;
+ background: rgba(10, 10, 10, 0.72);
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ padding: 3px 9px;
+ font-size: 11px;
+ font-weight: 500;
+ color: var(--text);
+ white-space: nowrap;
+ pointer-events: none;
+ transform: translate(-50%, -100%);
+ backdrop-filter: blur(6px);
+ -webkit-backdrop-filter: blur(6px);
+ will-change: transform;
+ }
+
+ /* ── IRL AR mobile CTA ─────────────────────────────────────────
+ Hidden until walk.js detects a touch device with camera
+ support and the avatar has finished loading. Sells the
+ project's IRL-not-metaverse positioning: "your agent on
+ your real floor" instead of "explore a virtual world".
+ */
+ #walk-ar-cta {
+ position: fixed;
+ z-index: 7;
+ left: 50%;
+ top: calc(env(safe-area-inset-top, 0) + 76px);
+ transform: translateX(-50%) translateY(-6px);
+ display: none;
+ align-items: center;
+ gap: 10px;
+ padding: 10px 14px 10px 12px;
+ background: linear-gradient(135deg, rgba(125, 211, 252, 0.92), rgba(96, 165, 250, 0.92));
+ color: #07111c;
+ border: 1px solid rgba(255, 255, 255, 0.35);
+ border-radius: 999px;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ opacity: 0;
+ transition: opacity 0.25s ease, transform 0.25s ease;
+ white-space: nowrap;
+ max-width: calc(100vw - 32px);
+ }
+ #walk-ar-cta.is-visible {
+ display: inline-flex;
+ opacity: 1;
+ transform: translateX(-50%) translateY(0);
+ }
+ #walk-ar-cta .pulse {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: #f87171;
+ box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.6);
+ animation: walk-cta-pulse 1.6s infinite;
+ }
+ @keyframes walk-cta-pulse {
+ 0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.55); }
+ 70% { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
+ 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
+ }
+ #walk-ar-cta .dismiss {
+ margin-left: 4px;
+ padding: 2px 6px;
+ font-size: 14px;
+ line-height: 1;
+ background: rgba(7, 17, 28, 0.18);
+ border-radius: 999px;
+ color: #07111c;
+ font-weight: 700;
+ }
+
+ /* ── Recording UI ──────────────────────────────────────────── */
+ #walk-record-btn .dot { transition: background 0.15s ease, box-shadow 0.15s ease; }
+ #walk-record-btn[data-recording="true"] .dot {
+ background: #f87171;
+ box-shadow: 0 0 8px rgba(248, 113, 113, 0.8);
+ animation: walk-rec-pulse 0.9s infinite;
+ }
+ @keyframes walk-rec-pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.45; }
+ }
+ #walk-record-status {
+ position: fixed;
+ z-index: 6;
+ left: 50%;
+ top: calc(env(safe-area-inset-top, 0) + 12px);
+ transform: translateX(-50%);
+ background: rgba(248, 113, 113, 0.92);
+ color: #fff;
+ border: 1px solid rgba(255, 255, 255, 0.25);
+ border-radius: 999px;
+ padding: 6px 12px;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.02em;
+ display: none;
+ align-items: center;
+ gap: 8px;
+ pointer-events: none;
+ backdrop-filter: blur(6px);
+ -webkit-backdrop-filter: blur(6px);
+ }
+ #walk-record-status.is-visible { display: inline-flex; }
+ #walk-record-status .rec-dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: #fff;
+ animation: walk-rec-pulse 0.9s infinite;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="walk-stage">
+ <video id="walk-camera-feed" autoplay playsinline muted></video>
+ <canvas id="walk-canvas"></canvas>
+
+ <div id="walk-hud">
+ <div class="walk-card">
+ <h1>three.ws · walk</h1>
+ <p>Drag to orbit. Joystick or <kbd>WASD</kbd> to move.</p>
+ </div>
+ <div class="walk-actions">
+ <button
+ type="button"
+ id="walk-online"
+ data-status="idle"
+ title="Multiplayer presence"
+ >
+ <span class="dot"></span>
+ <span data-label>solo</span>
+ <span class="count" id="walk-online-count">1</span>
+ </button>
+ <button
+ type="button"
+ class="walk-btn"
+ id="walk-ar-toggle"
+ aria-pressed="false"
+ title="Put your avatar on your real floor"
+ >
+ <span class="dot"></span>
+ <span data-label>AR</span>
+ </button>
+ <button
+ type="button"
+ class="walk-btn"
+ id="walk-record-btn"
+ data-recording="false"
+ title="Record a 6-second clip to share"
+ >
+ <span class="dot"></span>
+ <span data-label>Record</span>
+ </button>
+ <a class="walk-btn" href="/" title="Back to three.ws home" style="text-decoration:none">
+ <span>← home</span>
+ </a>
+ </div>
+ </div>
+
+ <button type="button" id="walk-ar-cta" aria-hidden="true">
+ <span class="pulse"></span>
+ <span>See your avatar on your floor — tap for AR</span>
+ <span class="dismiss" aria-label="Dismiss">×</span>
+ </button>
+
+ <div id="walk-record-status" role="status" aria-live="polite">
+ <span class="rec-dot"></span>
+ <span data-label>REC 6s</span>
+ </div>
+
+ <div id="walk-joystick" aria-label="Movement joystick"></div>
+
+ <div id="walk-help" aria-hidden="true">
+ <span class="walk-key"><kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> move</span>
+ <span class="walk-key"><kbd>shift</kbd> run</span>
+ <span class="walk-key"><kbd>drag</kbd> orbit camera</span>
+ </div>
+
+ <div id="walk-status">loading avatar…</div>
+ </div>
+
+ <script type="module" src="/src/walk.js"></script>
+ </body>
+</html>
diff --git a/pages/walk.html b/pages/walk.html
index 2893b41bc..a3b79b876 100644
--- a/pages/walk.html
+++ b/pages/walk.html
@@ -36,10 +36,28 @@
<meta property="og:title" content="Walk · three.ws" />
<meta property="og:description" content="A 3D avatar you can walk around — in the browser and in AR." />
<meta property="og:url" content="https://three.ws/walk" />
- <meta property="og:image" content="https://three.ws/assets/og-image.png" />
+ <meta property="og:image" id="og-image" content="https://three.ws/api/walk-og" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Walk · three.ws" />
<meta name="twitter:description" content="A 3D avatar you can walk around — in the browser and in AR." />
+ <meta name="twitter:image" id="twitter-image" content="https://three.ws/api/walk-og" />
+ <script>
+ // Patch OG image to include avatar + handle from URL params so
+ // shared links unfurl with the correct avatar thumbnail.
+ (function() {
+ var p = new URLSearchParams(location.search);
+ var av = p.get('avatar') || '';
+ var handle = p.get('handle') || '';
+ if (av) {
+ var q = new URLSearchParams();
+ if (av) q.set('avatar', av);
+ if (handle) q.set('handle', handle);
+ var src = 'https://three.ws/api/walk-og?' + q;
+ document.getElementById('og-image').content = src;
+ document.getElementById('twitter-image').content = src;
+ }
+ })();
+ </script>
<style>
:root {
diff --git a/public/style.css b/public/style.css
index 8057f9536..c7c27297a 100644
--- a/public/style.css
+++ b/public/style.css
@@ -8058,112 +8058,142 @@ body[data-layout='next'] .next-drawer__body .dg.main {
}
/* ── Bottom dock ────────────────────────────────────────────────────────── */
+/* Compact playback pill — auto-width, recedes into the stage.
+ * Holds play + loop. Scrubber sits as a hairline underline below it,
+ * thumb + time only appear on hover/focus. The clip name is pulled
+ * out to the bottom-left as a museum-style caption (see below). */
.next-dock {
position: fixed;
left: 50%;
- bottom: max(24px, env(safe-area-inset-bottom, 24px));
+ bottom: max(28px, env(safe-area-inset-bottom, 28px));
transform: translateX(-50%);
- display: flex;
+ display: inline-flex;
align-items: center;
- gap: 10px;
- padding: 8px 12px;
- background: rgba(15, 15, 22, 0.78);
- border: 1px solid rgba(255, 255, 255, 0.08);
+ justify-content: center;
+ gap: 6px;
+ padding: 5px 8px;
+ background: rgba(15, 15, 22, 0.55);
+ border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 999px;
- box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
- backdrop-filter: blur(20px);
- -webkit-backdrop-filter: blur(20px);
+ box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
+ backdrop-filter: blur(18px) saturate(150%);
+ -webkit-backdrop-filter: blur(18px) saturate(150%);
z-index: 34;
- width: min(720px, calc(100vw - 32px));
+ width: auto;
+ min-width: 200px;
+ max-width: calc(100vw - 32px);
box-sizing: border-box;
+ transition: background 0.2s ease, border-color 0.2s ease;
+}
+.next-dock:hover,
+.next-dock:focus-within {
+ background: rgba(15, 15, 22, 0.82);
+ border-color: rgba(255, 255, 255, 0.12);
}
+/* Clip caption — pulled out of the dock to bottom-left of the viewport.
+ * Reads as a "now playing" placard, fills negative space without competing
+ * with the avatar. Click still opens the animation grid (aria-controls). */
.next-dock__clip {
+ position: fixed;
+ left: max(20px, env(safe-area-inset-left, 20px));
+ bottom: max(30px, env(safe-area-inset-bottom, 30px));
display: inline-flex;
align-items: center;
gap: 6px;
- padding: 6px 10px;
- background: rgba(255, 255, 255, 0.04);
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 999px;
- color: rgba(255, 255, 255, 0.9);
- font-family: inherit;
- font-size: var(--text-xs);
+ padding: 8px 0;
+ background: transparent;
+ border: 0;
+ color: rgba(255, 255, 255, 0.55);
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 11px;
font-weight: 500;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
cursor: pointer;
white-space: nowrap;
- max-width: 180px;
+ max-width: 240px;
overflow: hidden;
text-overflow: ellipsis;
- transition: background 0.15s ease, border-color 0.15s ease;
-}
-.next-dock__clip:hover {
- background: rgba(255, 255, 255, 0.08);
- border-color: rgba(255, 255, 255, 0.16);
+ transition: color 0.18s ease;
+ z-index: 34;
}
-.next-dock__clip--open {
- background: rgba(139, 92, 246, 0.18);
- border-color: rgba(139, 92, 246, 0.4);
- color: #fff;
+.next-dock__clip::before {
+ content: '◆';
+ color: rgba(255, 255, 255, 0.35);
+ font-size: 8px;
+ margin-right: 2px;
}
+.next-dock__clip:hover { color: rgba(255, 255, 255, 0.95); }
+.next-dock__clip--open { color: #fff; }
.next-dock__clip-name {
overflow: hidden;
text-overflow: ellipsis;
- max-width: 140px;
+ max-width: 200px;
}
.next-dock__caret {
flex-shrink: 0;
- transition: transform 0.18s ease;
+ opacity: 0.55;
+ transition: transform 0.18s ease, opacity 0.18s ease;
}
-.next-dock__clip--open .next-dock__caret { transform: rotate(180deg); }
+.next-dock__clip:hover .next-dock__caret { opacity: 1; }
+.next-dock__clip--open .next-dock__caret { transform: rotate(180deg); opacity: 1; }
+/* Play — smaller, neutral white (no purple shouting). */
.next-dock__play {
- width: 40px;
- height: 40px;
+ width: 32px;
+ height: 32px;
display: inline-flex;
align-items: center;
justify-content: center;
- background: linear-gradient(180deg, rgba(139, 92, 246, 0.85), rgba(124, 58, 237, 0.95));
- color: #fff;
+ background: rgba(255, 255, 255, 0.95);
+ color: #0a0a0c;
border: 0;
border-radius: 50%;
cursor: pointer;
- box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
- transition: transform 0.15s ease, box-shadow 0.15s ease;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
+ transition: transform 0.15s ease, background 0.15s ease;
flex-shrink: 0;
}
+.next-dock__play svg { width: 14px; height: 14px; }
@media (hover: none) and (pointer: coarse) {
- .next-dock__play {
- width: 48px;
- height: 48px;
- }
+ .next-dock__play { width: 40px; height: 40px; }
+ .next-dock__play svg { width: 16px; height: 16px; }
}
-.next-dock__play:hover { transform: scale(1.05); }
+.next-dock__play:hover { transform: scale(1.05); background: #fff; }
.next-dock__play:active { transform: scale(0.97); }
.next-dock__icon { display: none; }
.next-dock__icon--play { display: block; }
.next-dock__play--playing .next-dock__icon--play { display: none; }
.next-dock__play--playing .next-dock__icon--pause { display: block; }
+/* Scrubber — hairline underline beneath the pill. 2px dim default,
+ * thickens + reveals thumb on hover/focus. */
.next-dock__scrub {
- position: relative;
- flex: 1 1 auto;
- height: 32px;
+ position: absolute;
+ left: 14px;
+ right: 14px;
+ bottom: -10px;
+ height: 12px;
display: flex;
align-items: center;
- min-width: 0;
+ min-width: 120px;
+ opacity: 0.5;
+ transition: opacity 0.2s ease;
}
+.next-dock:hover .next-dock__scrub,
+.next-dock:focus-within .next-dock__scrub { opacity: 1; }
.next-dock__scrub-fill {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
- height: 4px;
- border-radius: 2px;
- background: linear-gradient(90deg, #8b5cf6, #c4b5fd);
+ height: 2px;
+ border-radius: 1px;
+ background: rgba(255, 255, 255, 0.85);
width: 0%;
pointer-events: none;
- box-shadow: 0 0 8px rgba(139, 92, 246, 0.45);
+ transition: height 0.2s ease;
}
.next-dock__scrub::before {
content: '';
@@ -8172,79 +8202,130 @@ body[data-layout='next'] .next-drawer__body .dg.main {
right: 0;
top: 50%;
transform: translateY(-50%);
- height: 4px;
- border-radius: 2px;
- background: rgba(255, 255, 255, 0.1);
+ height: 2px;
+ border-radius: 1px;
+ background: rgba(255, 255, 255, 0.16);
pointer-events: none;
+ transition: height 0.2s ease;
}
+.next-dock:hover .next-dock__scrub::before,
+.next-dock:focus-within .next-dock__scrub::before,
+.next-dock:hover .next-dock__scrub-fill,
+.next-dock:focus-within .next-dock__scrub-fill { height: 3px; }
.next-dock__scrub-input {
position: relative;
width: 100%;
- height: 32px;
+ height: 12px;
appearance: none;
background: transparent;
margin: 0;
cursor: pointer;
z-index: 1;
}
-.next-dock__scrub-input::-webkit-slider-runnable-track {
- height: 4px;
- background: transparent;
-}
-.next-dock__scrub-input::-moz-range-track {
- height: 4px;
- background: transparent;
-}
+.next-dock__scrub-input::-webkit-slider-runnable-track { height: 2px; background: transparent; }
+.next-dock__scrub-input::-moz-range-track { height: 2px; background: transparent; }
.next-dock__scrub-input::-webkit-slider-thumb {
appearance: none;
- width: 14px;
- height: 14px;
+ width: 11px;
+ height: 11px;
border-radius: 50%;
background: #fff;
- border: 2px solid #8b5cf6;
- margin-top: -5px;
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
+ border: 0;
+ margin-top: -4px;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
cursor: grab;
+ opacity: 0;
+ transition: opacity 0.18s ease;
}
+.next-dock:hover .next-dock__scrub-input::-webkit-slider-thumb,
+.next-dock:focus-within .next-dock__scrub-input::-webkit-slider-thumb { opacity: 1; }
.next-dock__scrub-input:active::-webkit-slider-thumb { cursor: grabbing; }
.next-dock__scrub-input::-moz-range-thumb {
- width: 14px;
- height: 14px;
+ width: 11px;
+ height: 11px;
border-radius: 50%;
background: #fff;
- border: 2px solid #8b5cf6;
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
+ border: 0;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
+ opacity: 0;
+ transition: opacity 0.18s ease;
}
+.next-dock:hover .next-dock__scrub-input::-moz-range-thumb,
+.next-dock:focus-within .next-dock__scrub-input::-moz-range-thumb { opacity: 1; }
.next-dock__scrub-input:focus-visible::-webkit-slider-thumb {
- outline: 2px solid rgba(139, 92, 246, 0.6);
+ outline: 2px solid rgba(255, 255, 255, 0.5);
outline-offset: 2px;
}
+/* Time — hidden until hover. */
.next-dock__time {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 11px;
- color: rgba(255, 255, 255, 0.55);
+ color: rgba(255, 255, 255, 0.6);
font-variant-numeric: tabular-nums;
white-space: nowrap;
flex-shrink: 0;
+ max-width: 0;
+ overflow: hidden;
+ opacity: 0;
+ transition: max-width 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
+ padding: 0;
+}
+.next-dock:hover .next-dock__time,
+.next-dock:focus-within .next-dock__time {
+ max-width: 84px;
+ opacity: 1;
+ padding: 0 4px;
}
+/* Loop — muted neutral, no purple. */
.next-dock__loop {
- width: 28px;
- height: 28px;
+ width: 26px;
+ height: 26px;
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
border: 0;
border-radius: 6px;
- color: rgba(139, 92, 246, 0.85);
+ color: rgba(255, 255, 255, 0.45);
cursor: pointer;
transition: color 0.15s ease, background 0.15s ease;
flex-shrink: 0;
}
-.next-dock__loop:hover { background: rgba(255, 255, 255, 0.06); }
-.next-dock__loop--off { color: rgba(255, 255, 255, 0.35); }
+.next-dock__loop:hover { color: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.06); }
+.next-dock__loop--off { color: rgba(255, 255, 255, 0.2); }
+
+/* Stage atmosphere — two screen-blended glows give the empty canvas
+ * a "studio" feel without darkening or tinting the avatar. */
+body[data-layout='next'] .next-chrome::before,
+body[data-layout='next'] .next-chrome::after {
+ content: '';
+ position: fixed;
+ pointer-events: none;
+ z-index: 1;
+ mix-blend-mode: screen;
+}
+body[data-layout='next'] .next-chrome::before {
+ /* overhead key-light wash */
+ left: 50%;
+ top: -180px;
+ transform: translateX(-50%);
+ width: 900px;
+ height: 700px;
+ max-width: 110vw;
+ background: radial-gradient(ellipse at center, rgba(140, 130, 200, 0.07), transparent 65%);
+}
+body[data-layout='next'] .next-chrome::after {
+ /* floor pool that grounds the avatar */
+ left: 50%;
+ bottom: -120px;
+ transform: translateX(-50%);
+ width: 1000px;
+ height: 360px;
+ max-width: 110vw;
+ background: radial-gradient(ellipse at center 60%, rgba(200, 200, 230, 0.09), transparent 70%);
+}
/* ── Animation grid (expands above the dock) ────────────────────────────── */
.next-grid {
@@ -8314,14 +8395,17 @@ body[data-layout='next'] .next-drawer__body .dg.main {
.next-share-menu { top: 70px; right: 54px; width: calc(100vw - 64px); max-width: 320px; }
.next-drawer { width: 100vw; max-width: 100vw; }
.next-dock {
- bottom: 14px;
- width: calc(100vw - 16px);
- padding: 6px 8px;
- gap: 6px;
+ bottom: max(18px, env(safe-area-inset-bottom, 18px));
+ padding: 5px 6px;
+ gap: 4px;
+ }
+ .next-dock__clip {
+ left: max(14px, env(safe-area-inset-left, 14px));
+ bottom: max(20px, env(safe-area-inset-bottom, 20px));
+ max-width: 160px;
+ font-size: 10px;
}
- .next-dock__time { display: none; }
- .next-dock__clip { max-width: 110px; }
- .next-dock__clip-name { max-width: 80px; }
+ .next-dock__clip-name { max-width: 130px; }
.next-grid {
bottom: 70px;
width: calc(100vw - 16px);
diff --git a/scratch/app-next-deploy-share.png b/scratch/app-next-deploy-share.png
new file mode 100644
index 000000000..784ac1760
Binary files /dev/null and b/scratch/app-next-deploy-share.png differ
diff --git a/scratch/app-next-deploy-undeployed.png b/scratch/app-next-deploy-undeployed.png
new file mode 100644
index 000000000..5ff2e5039
Binary files /dev/null and b/scratch/app-next-deploy-undeployed.png differ
diff --git a/scripts/_verify-app-next-dock.mjs b/scripts/_verify-app-next-dock.mjs
new file mode 100644
index 000000000..d9a517125
--- /dev/null
+++ b/scripts/_verify-app-next-dock.mjs
@@ -0,0 +1,66 @@
+import { chromium } from 'playwright';
+
+const browser = await chromium.launch({
+ args: ['--use-gl=swiftshader', '--enable-unsafe-swiftshader'],
+});
+const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
+
+page.on('pageerror', (e) => console.log('PAGEERROR:', e.message.slice(0, 400)));
+page.on('console', (m) => {
+ const t = m.type();
+ if (t === 'error') console.log('[err]', m.text().slice(0, 300));
+});
+
+const url = process.argv[2] || 'http://localhost:3001/app';
+
+// Set Next layout BEFORE the page loads so dock chrome paints right away.
+await page.addInitScript(() => {
+ try { localStorage.setItem('3dagent:viewer-layout', 'next'); } catch {}
+});
+
+console.log('→', url);
+await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
+
+// Wait for the viewer + animations.
+await page.waitForFunction(
+ () =>
+ window.VIEWER?.viewer?.content &&
+ window.VIEWER?.viewer?.animationManager?.getAnimationDefs?.()?.length > 0,
+ { timeout: 25000 },
+);
+
+await page.evaluate(async () => {
+ const v = window.VIEWER.viewer;
+ v.state.autoRotate = false;
+ if (v.controls) v.controls.autoRotate = false;
+});
+await page.waitForTimeout(1500);
+
+// Confirm Next chrome is showing.
+const layout = await page.evaluate(() => document.body.dataset.layout);
+const dockBox = await page.evaluate(() => {
+ const dock = document.getElementById('next-dock');
+ const clip = document.getElementById('next-dock-clip');
+ if (!dock) return { ok: false };
+ const dr = dock.getBoundingClientRect();
+ const cr = clip ? clip.getBoundingClientRect() : null;
+ return {
+ ok: true,
+ dock: { x: dr.x, y: dr.y, w: dr.width, h: dr.height },
+ clip: cr ? { x: cr.x, y: cr.y, w: cr.width, h: cr.height } : null,
+ clipText: clip ? clip.querySelector('#next-dock-clip-name')?.textContent : null,
+ };
+});
+console.log('layout =', layout);
+console.log('geometry =', JSON.stringify(dockBox, null, 2));
+
+await page.screenshot({ path: '/tmp/app-next-dock-idle.png', timeout: 30000, animations: 'disabled' });
+console.log('→ /tmp/app-next-dock-idle.png');
+
+// Hover the dock — should expand the scrubber/time.
+await page.hover('#next-dock');
+await page.waitForTimeout(400);
+await page.screenshot({ path: '/tmp/app-next-dock-hover.png', timeout: 30000, animations: 'disabled' });
+console.log('→ /tmp/app-next-dock-hover.png');
+
+await browser.close();
diff --git a/scripts/screenshot-app-next-deploy.mjs b/scripts/screenshot-app-next-deploy.mjs
new file mode 100644
index 000000000..434f26816
--- /dev/null
+++ b/scripts/screenshot-app-next-deploy.mjs
@@ -0,0 +1,48 @@
+import { chromium } from 'playwright';
+
+const browser = await chromium.launch({
+ args: [
+ '--use-gl=swiftshader',
+ '--enable-unsafe-swiftshader',
+ '--no-sandbox',
+ '--disable-dev-shm-usage',
+ '--disable-gpu-sandbox',
+ ],
+});
+
+const ctx = await browser.newContext({ viewport: { width: 1400, height: 900 } });
+const page = await ctx.newPage();
+await page.goto('http://localhost:3000/app-next', { waitUntil: 'load' });
+
+await page.waitForFunction(() => !!document.getElementById('nxt-deploy-btn'), { timeout: 5000 });
+
+// Reveal both un-deployed surfaces.
+await page.evaluate(() => {
+ const src = document.getElementById('deploy-onchain-btn');
+ src.setAttribute('href', '/deploy?agent=demo-agent');
+ src.hidden = false;
+});
+await page.waitForTimeout(300);
+await page.screenshot({ path: 'scratch/app-next-deploy-undeployed.png', fullPage: false });
+console.log('saved scratch/app-next-deploy-undeployed.png');
+
+// Open share popover.
+await page.click('#nxt-share-btn');
+await page.waitForTimeout(400);
+await page.screenshot({ path: 'scratch/app-next-deploy-share.png', fullPage: false });
+console.log('saved scratch/app-next-deploy-share.png');
+
+// Now flip to deployed.
+await page.click('#nxt-share-close');
+await page.evaluate(() => {
+ const src = document.getElementById('deploy-onchain-btn');
+ src.classList.add('is-deployed');
+ src.setAttribute('href', 'https://basescan.org/token/0xabc');
+ src.setAttribute('target', '_blank');
+ src.querySelector('[data-state-label]').textContent = 'Deployed ✓ Base';
+});
+await page.waitForTimeout(300);
+await page.screenshot({ path: 'scratch/app-next-deploy-deployed.png', fullPage: false });
+console.log('saved scratch/app-next-deploy-deployed.png');
+
+await browser.close();
diff --git a/scripts/verify-app-next-deploy.mjs b/scripts/verify-app-next-deploy.mjs
new file mode 100644
index 000000000..c1fa679f8
--- /dev/null
+++ b/scripts/verify-app-next-deploy.mjs
@@ -0,0 +1,158 @@
+// Headless verification: /app-next deploy-on-chain wiring.
+//
+// Boots the page, waits for the viewer, then drives #deploy-onchain-btn (the
+// hidden host that /src/app.js owns) and confirms the Next overlay mirrors it
+// into:
+// • #nxt-deploy-btn — pill in the secondary action bar
+// • #nxt-share-deploy — row in the share popover
+//
+// Captures console errors as a hard failure.
+
+import { chromium } from 'playwright';
+
+const BASE = process.env.BASE_URL || 'http://localhost:3000';
+const URL = `${BASE}/app-next`;
+
+const browser = await chromium.launch({
+ args: [
+ '--use-gl=swiftshader',
+ '--enable-unsafe-swiftshader',
+ '--no-sandbox',
+ '--disable-dev-shm-usage',
+ '--disable-gpu-sandbox',
+ ],
+});
+
+const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 } });
+const page = await ctx.newPage();
+const errors = [];
+page.on('console', (msg) => {
+ if (msg.type() === 'error') errors.push(`[console.error] ${msg.text()}`);
+});
+page.on('pageerror', (err) => errors.push(`[pageerror] ${err.message}`));
+
+console.log(`→ goto ${URL}`);
+await page.goto(URL, { waitUntil: 'load', timeout: 30000 });
+
+// Wait for the overlay's wireDeployMirror() to bind. It runs at DOMContentLoaded,
+// then immediately runs sync() once. We confirm the mirror is wired by reading
+// initial hidden state.
+await page.waitForFunction(() => !!document.getElementById('nxt-deploy-btn'), { timeout: 5000 });
+await page.waitForFunction(
+ () => !!document.getElementById('deploy-onchain-btn'),
+ { timeout: 5000 },
+);
+
+// 1) Both mirrors should be hidden initially (no agent in scope).
+const initial = await page.evaluate(() => ({
+ srcHidden: document.getElementById('deploy-onchain-btn').hidden,
+ pillHidden: document.getElementById('nxt-deploy-btn').hidden,
+ rowHidden: document.getElementById('nxt-share-deploy').hidden,
+}));
+console.log('initial state:', initial);
+if (!initial.srcHidden || !initial.pillHidden || !initial.rowHidden) {
+ throw new Error('Expected all deploy surfaces hidden before app.js reveals the host.');
+}
+
+// 2) Simulate app.js revealing the host with an un-deployed agent.
+console.log('→ simulating un-deployed agent in scope');
+await page.evaluate(() => {
+ const src = document.getElementById('deploy-onchain-btn');
+ src.setAttribute('href', '/deploy?agent=test-agent-123');
+ src.querySelector('[data-state-label]').textContent = 'Deploy on-chain';
+ src.hidden = false;
+});
+
+await page.waitForFunction(
+ () => document.getElementById('nxt-deploy-btn').hidden === false,
+ { timeout: 2000 },
+);
+
+const afterUndeployed = await page.evaluate(() => ({
+ pillHidden: document.getElementById('nxt-deploy-btn').hidden,
+ pillHref: document.getElementById('nxt-deploy-btn').getAttribute('href'),
+ pillLabel: document.getElementById('nxt-deploy-label').textContent.trim(),
+ pillIsDeployedClass: document.getElementById('nxt-deploy-btn').classList.contains('is-deployed'),
+ rowHidden: document.getElementById('nxt-share-deploy').hidden,
+ rowHref: document.getElementById('nxt-share-deploy').getAttribute('href'),
+ rowLabel: document.getElementById('nxt-share-deploy-label').textContent.trim(),
+ rowSub: document.getElementById('nxt-share-deploy-sub').textContent.trim(),
+ dividerHidden: document.getElementById('nxt-share-deploy-divider').hidden,
+}));
+console.log('after un-deployed state:', afterUndeployed);
+if (
+ afterUndeployed.pillHidden ||
+ afterUndeployed.rowHidden ||
+ afterUndeployed.dividerHidden ||
+ afterUndeployed.pillHref !== '/deploy?agent=test-agent-123' ||
+ afterUndeployed.rowHref !== '/deploy?agent=test-agent-123' ||
+ !/Deploy on-chain/i.test(afterUndeployed.pillLabel) ||
+ !/Deploy on-chain/i.test(afterUndeployed.rowLabel) ||
+ afterUndeployed.pillIsDeployedClass ||
+ !/Register/i.test(afterUndeployed.rowSub)
+) {
+ throw new Error('Mirror did not propagate un-deployed state correctly.');
+}
+
+// 3) Simulate the deployed-state update (app.js sets is-deployed + new href).
+console.log('→ simulating deployed agent');
+await page.evaluate(() => {
+ const src = document.getElementById('deploy-onchain-btn');
+ src.classList.add('is-deployed');
+ src.setAttribute('href', 'https://basescan.org/token/0xabc?a=42');
+ src.setAttribute('target', '_blank');
+ src.setAttribute('rel', 'noopener');
+ src.querySelector('[data-state-label]').textContent = 'Deployed ✓ Base';
+});
+
+await page.waitForFunction(
+ () =>
+ document
+ .getElementById('nxt-deploy-btn')
+ .classList.contains('is-deployed'),
+ { timeout: 2000 },
+);
+
+const afterDeployed = await page.evaluate(() => ({
+ pillHref: document.getElementById('nxt-deploy-btn').getAttribute('href'),
+ pillTarget: document.getElementById('nxt-deploy-btn').getAttribute('target'),
+ pillRel: document.getElementById('nxt-deploy-btn').getAttribute('rel'),
+ pillLabel: document.getElementById('nxt-deploy-label').textContent.trim(),
+ rowIsDeployedClass: document
+ .getElementById('nxt-share-deploy')
+ .classList.contains('is-deployed'),
+ rowSub: document.getElementById('nxt-share-deploy-sub').textContent.trim(),
+}));
+console.log('after deployed state:', afterDeployed);
+if (
+ !/Deployed/i.test(afterDeployed.pillLabel) ||
+ afterDeployed.pillHref !== 'https://basescan.org/token/0xabc?a=42' ||
+ afterDeployed.pillTarget !== '_blank' ||
+ afterDeployed.pillRel !== 'noopener' ||
+ !afterDeployed.rowIsDeployedClass ||
+ !/live on-chain/i.test(afterDeployed.rowSub)
+) {
+ throw new Error('Mirror did not propagate deployed state correctly.');
+}
+
+// 4) Open the share popover and confirm the row is reachable.
+console.log('→ opening share popover');
+await page.click('#nxt-share-btn');
+const popOpen = await page.evaluate(() => !document.getElementById('nxt-share-popover').hidden);
+if (!popOpen) throw new Error('Share popover did not open.');
+const rowReachable = await page.evaluate(() => {
+ const row = document.getElementById('nxt-share-deploy');
+ if (!row || row.hidden) return false;
+ const cs = getComputedStyle(row);
+ return cs.display !== 'none' && cs.visibility !== 'hidden';
+});
+if (!rowReachable) throw new Error('Deploy row not reachable inside open share popover.');
+
+console.log(`→ console errors collected: ${errors.length}`);
+if (errors.length) {
+ for (const e of errors) console.log(' ', e);
+ throw new Error(`Page produced ${errors.length} console error(s).`);
+}
+
+await browser.close();
+console.log('\nOK — /app-next deploy-on-chain wiring verified.');
diff --git a/scripts/walk-smoke.mjs b/scripts/walk-smoke.mjs
new file mode 100644
index 000000000..b290c693a
--- /dev/null
+++ b/scripts/walk-smoke.mjs
@@ -0,0 +1,58 @@
+import { chromium } from 'playwright';
+
+// SwiftShader headless WebGL is flaky on three.js scenes (see memory:
+// playwright-webgl-headless). Use the canonical recipe: --use-gl=swiftshader,
+// --enable-unsafe-swiftshader, and an ignore-list for the known crash strings.
+const browser = await chromium.launch({
+ args: [
+ '--use-gl=swiftshader',
+ '--enable-unsafe-swiftshader',
+ '--no-sandbox',
+ '--disable-dev-shm-usage',
+ ],
+});
+const ctx = await browser.newContext({
+ viewport: { width: 1024, height: 720 },
+ userAgent: 'Mozilla/5.0 walk-smoke-test',
+});
+const page = await ctx.newPage();
+
+const consoleMessages = [];
+const pageErrors = [];
+page.on('console', (msg) => consoleMessages.push({ type: msg.type(), text: msg.text() }));
+page.on('pageerror', (err) => pageErrors.push(err.message));
+
+await page.goto('http://localhost:3000/walk', { waitUntil: 'domcontentloaded', timeout: 15000 });
+// Give the avatar/animation manifest a moment to fetch + parse.
+await page.waitForTimeout(4500);
+
+const ui = await page.evaluate(() => ({
+ hasArBtn: !!document.getElementById('walk-ar-toggle'),
+ hasRecordBtn: !!document.getElementById('walk-record-btn'),
+ hasArCta: !!document.getElementById('walk-ar-cta'),
+ hasRecordStatus: !!document.getElementById('walk-record-status'),
+ canvasSize: (() => {
+ const c = /** @type {HTMLCanvasElement|null} */(document.getElementById('walk-canvas'));
+ return c ? { w: c.width, h: c.height } : null;
+ })(),
+ statusText: document.getElementById('walk-status')?.textContent || null,
+}));
+
+const fatal = pageErrors.filter((m) =>
+ !/swiftshader|webgl context|GroupMarkerNotSet|TextureProxy|GL_/i.test(m),
+);
+const errs = consoleMessages.filter((m) =>
+ m.type === 'error' && !/swiftshader|webgl context|GroupMarkerNotSet|TextureProxy|GL_|Failed to load resource/i.test(m.text),
+);
+
+console.log('UI present:', JSON.stringify(ui, null, 2));
+console.log('\nfatal pageerrors (filtered):', fatal);
+console.log('console errors (filtered):', errs);
+console.log('\nall pageerrors:', pageErrors);
+console.log('all console (last 20):', consoleMessages.slice(-20));
+
+await browser.close();
+
+if (fatal.length > 0 || errs.length > 0) {
+ process.exit(1);
+}
diff --git a/src/walk.js b/src/walk.js
index e02ab0c94..cf514497f 100644
--- a/src/walk.js
+++ b/src/walk.js
@@ -196,7 +196,7 @@ const PITCH_MAX = 0.7;
// Place the camera at its starting pose immediately so frame 0 isn't blank.
function applyCameraImmediate() {
- const offset = CAM_OFFSET.clone();
+ const offset = CAM_OFFSET.clone().multiplyScalar(camZoom);
offset.applyAxisAngle(new Vector3(1, 0, 0), -cameraPitch);
offset.applyAxisAngle(new Vector3(0, 1, 0), cameraYaw);
camDesired.copy(avatarRig.position).add(offset);
@@ -257,13 +257,107 @@ const input = {
joy: { x: 0, y: 0, active: false },
};
+// ── Jump state ────────────────────────────────────────────────────────────
+let jumpVelocity = 0;
+let jumpActive = false;
+const JUMP_FORCE = 5.8;
+const GRAVITY = -14;
+const GROUND_Y = 0;
+
+function triggerJump() {
+ if (jumpActive) return;
+ jumpActive = true;
+ jumpVelocity = JUMP_FORCE;
+}
+
+// ── Snap-turn (Q / E) ────────────────────────────────────────────────────
+const SNAP_TURN_RAD = Math.PI / 4; // 45°
+
+// ── Scroll-wheel zoom ────────────────────────────────────────────────────
+const CAM_ZOOM_MIN = 0.6;
+const CAM_ZOOM_MAX = 3.2;
+let camZoom = 1.0; // multiplier on CAM_OFFSET distance
+
+canvas.addEventListener('wheel', (e) => {
+ e.preventDefault();
+ camZoom = Math.max(CAM_ZOOM_MIN, Math.min(CAM_ZOOM_MAX, camZoom + e.deltaY * 0.001));
+}, { passive: false });
+
+// ── Pointer lock (click canvas → lock; Esc → unlock) ────────────────────
+let pointerLocked = false;
+
+canvas.addEventListener('click', () => {
+ if (!pointerLocked && !IS_TOUCH) {
+ canvas.requestPointerLock?.();
+ }
+});
+document.addEventListener('pointerlockchange', () => {
+ pointerLocked = document.pointerLockElement === canvas;
+});
+document.addEventListener('mousemove', (e) => {
+ if (!pointerLocked) return;
+ cameraYaw -= e.movementX * 0.002;
+ cameraPitch = Math.max(PITCH_MIN, Math.min(PITCH_MAX, cameraPitch - e.movementY * 0.002));
+});
+
+// ── Help overlay (? key) ─────────────────────────────────────────────────
+const helpOverlay = (() => {
+ const el = document.createElement('div');
+ el.id = 'walk-help-overlay';
+ el.setAttribute('aria-hidden', 'true');
+ el.style.cssText = [
+ 'position:fixed', 'inset:0', 'z-index:9999',
+ 'display:flex', 'align-items:center', 'justify-content:center',
+ 'background:rgba(0,0,0,0.72)', 'backdrop-filter:blur(6px)',
+ 'color:#fff', 'font-family:system-ui,sans-serif',
+ 'opacity:0', 'pointer-events:none',
+ 'transition:opacity 0.18s',
+ ].join(';');
+ el.innerHTML = `
+ <div style="max-width:380px;width:90%;background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.12);border-radius:16px;padding:28px 32px">
+ <h2 style="margin:0 0 20px;font-size:18px;font-weight:600;letter-spacing:-0.3px">Controls</h2>
+ <table style="width:100%;border-collapse:collapse;font-size:14px;line-height:2">
+ <tr><td style="color:#aaa;padding-right:16px">W A S D / Arrows</td><td>Move</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Shift</td><td>Run</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Space</td><td>Jump</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Q / E</td><td>Snap turn 45°</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Mouse drag / click</td><td>Orbit camera</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Scroll wheel</td><td>Zoom in / out</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">?</td><td>Toggle this overlay</td></tr>
+ <tr><td style="color:#aaa;padding-right:16px">Esc</td><td>Release pointer lock</td></tr>
+ </table>
+ <p style="margin:20px 0 0;font-size:12px;color:#666">Click the canvas to lock the mouse for first-person look.</p>
+ </div>`;
+ document.body.appendChild(el);
+ return el;
+})();
+
+let helpVisible = false;
+function toggleHelp() {
+ helpVisible = !helpVisible;
+ helpOverlay.style.opacity = helpVisible ? '1' : '0';
+ helpOverlay.style.pointerEvents = helpVisible ? 'auto' : 'none';
+ helpOverlay.setAttribute('aria-hidden', String(!helpVisible));
+}
+helpOverlay.addEventListener('click', (e) => {
+ if (e.target === helpOverlay) toggleHelp();
+});
+
window.addEventListener('keydown', (e) => {
+ // Don't steal events from text inputs.
+ if (e.target !== document.body && e.target !== canvas) return;
switch (e.code) {
case 'KeyW': case 'ArrowUp': input.keys.forward = 1; break;
case 'KeyS': case 'ArrowDown': input.keys.back = 1; break;
case 'KeyA': case 'ArrowLeft': input.keys.left = 1; break;
case 'KeyD': case 'ArrowRight': input.keys.right = 1; break;
case 'ShiftLeft': case 'ShiftRight': input.keys.run = true; break;
+ case 'Space': e.preventDefault(); triggerJump(); break;
+ case 'KeyQ': cameraYaw += SNAP_TURN_RAD; break;
+ case 'KeyE': cameraYaw -= SNAP_TURN_RAD; break;
+ case 'Slash':
+ if (e.shiftKey) { e.preventDefault(); toggleHelp(); }
+ break;
default: return;
}
});
@@ -733,6 +827,17 @@ function readMoveInput() {
function tick() {
const dt = Math.min(clock.getDelta(), 0.05); // clamp huge frames after a tab switch
+ // Jump physics — simple parabola in Y, lands back at GROUND_Y.
+ if (jumpActive && avatar) {
+ jumpVelocity += GRAVITY * dt;
+ avatarRig.position.y += jumpVelocity * dt;
+ if (avatarRig.position.y <= GROUND_Y) {
+ avatarRig.position.y = GROUND_Y;
+ jumpVelocity = 0;
+ jumpActive = false;
+ }
+ }
+
// 1. Resolve move input in camera-relative XZ space.
const { ix, iy } = readMoveInput();
const mag = Math.min(1, Math.hypot(ix, iy));
@@ -811,7 +916,7 @@ function tick() {
if (avatar) avatar.rotation.x = avatarLean;
// 2. Update camera follow-rig.
- const offset = CAM_OFFSET.clone();
+ const offset = CAM_OFFSET.clone().multiplyScalar(camZoom);
offset.applyAxisAngle(new Vector3(1, 0, 0), -cameraPitch);
offset.applyAxisAngle(upY, cameraYaw);
camDesired.copy(avatarRig.position).add(offset);
diff --git a/vercel.json b/vercel.json
index 1d14479b4..0615a6774 100644
--- a/vercel.json
+++ b/vercel.json
@@ -273,6 +273,19 @@
"src": "/walk/?",
"dest": "/walk.html"
},
+ {
+ "src": "/wk/([A-Za-z0-9_-]+)",
+ "dest": "/walk?avatar=$1",
+ "status": 302
+ },
+ {
+ "src": "/api/walk-og",
+ "dest": "/api/walk-og.js"
+ },
+ {
+ "src": "/embed/walk/?",
+ "dest": "/embed-walk.html"
+ },
{
"src": "/walk-embed/?",
"headers": {
@@ -1984,6 +1997,14 @@
"src": "/legal/tos/?",
"dest": "/legal/tos.html"
},
+ {
+ "src": "/extension/privacy/?",
+ "dest": "/extension-privacy.html"
+ },
+ {
+ "src": "/extension/terms/?",
+ "dest": "/extension-terms.html"
+ },
{
"src": "/features",
"dest": "/features.html"
diff --git a/vite.config.js b/vite.config.js
index 1563877ee..f0a526253 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -176,6 +176,7 @@ creating: resolve(__dirname, 'pages/creating.html'),
'home-next': resolve(__dirname, 'pages/home-next.html'),
'home-v3': resolve(__dirname, 'pages/home-v3.html'),
'agent-next': resolve(__dirname, 'pages/agent-next.html'),
+ 'discover-next': resolve(__dirname, 'pages/discover-next.html'),
walk: resolve(__dirname, 'pages/walk.html'),
'walk-embed': resolve(__dirname, 'pages/walk-embed.html'),
pose: resolve(__dirname, 'pages/pose.html'),