Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(forge): polish Forge surface, nav, and home + add MCP 3D challenge test
nirholas439727bd351e
diff --git a/pages/forge.html b/pages/forge.htmlindex e7a3c332f..144603f66 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -738,6 +738,101 @@color: var(--ink-dim);margin-top: var(--space-xs);}+ .gen-meta strong {+ color: var(--ink);+ font-weight: 600;+ }++ /* Honest elapsed-vs-typical meter. The fill maps real elapsed time+ against the engine's real catalog ETA on an asymptotic curve that+ never reaches 100% on its own — only a real finished GLB snaps it to+ full. Past the typical time it holds near the cap and recolours to+ amber ("longer than usual"), so the bar is informative, never faked. */+ .gen-progress {+ position: relative;+ height: 5px;+ margin-top: var(--space-sm);+ border-radius: 999px;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ overflow: hidden;+ }+ .gen-progress-fill {+ position: absolute;+ inset: 0;+ width: 0%;+ border-radius: inherit;+ background: linear-gradient(+ 90deg,+ color-mix(in srgb, var(--accent) 70%, transparent),+ var(--accent)+ );+ transition: width 0.9s cubic-bezier(0.33, 1, 0.68, 1), background 0.4s ease;+ }+ /* Moving sheen reads as live work without implying a known finish. */+ .gen-progress-fill::after {+ content: '';+ position: absolute;+ inset: 0;+ background: linear-gradient(+ 100deg,+ transparent 30%,+ rgba(255, 255, 255, 0.28) 50%,+ transparent 70%+ );+ background-size: 220% 100%;+ animation: gen-sheen 1.6s linear infinite;+ }+ .gen-progress[data-over='true'] .gen-progress-fill {+ background: linear-gradient(+ 90deg,+ color-mix(in srgb, var(--warning, #e0a93e) 70%, transparent),+ var(--warning, #e0a93e)+ );+ }+ .gen-progress[data-done='true'] .gen-progress-fill {+ background: linear-gradient(+ 90deg,+ color-mix(in srgb, var(--success) 70%, transparent),+ var(--success)+ );+ }+ .gen-progress[data-done='true'] .gen-progress-fill::after,+ .gen-progress[data-indeterminate='true'] .gen-progress-fill::after {+ animation-play-state: running;+ }+ /* No catalog ETA (unknown duration) — a slim travelling band instead of+ a measured fill, so we never imply a finish time we don't have. */+ .gen-progress[data-indeterminate='true'] .gen-progress-fill {+ width: 38% !important;+ animation: gen-indeterminate 1.5s ease-in-out infinite;+ }+ @keyframes gen-sheen {+ to {+ background-position: -220% 0;+ }+ }+ @keyframes gen-indeterminate {+ 0% {+ transform: translateX(-120%);+ }+ 100% {+ transform: translateX(330%);+ }+ }+ @media (prefers-reduced-motion: reduce) {+ .gen-progress-fill::after {+ animation: none;+ }+ .gen-progress[data-indeterminate='true'] .gen-progress-fill {+ animation: none;+ width: 100% !important;+ opacity: 0.5;+ }+ .gen-progress-fill {+ transition: none;+ }+ }/* Result state */.viewer-shell {@@ -1368,8 +1463,22 @@name="prompt"maxlength="1000"placeholder="a worn leather armchair, studio lighting, plain background"- aria-describedby="prompt-hint"+ aria-describedby="prompt-coach"></textarea>+ <div class="prompt-tools" id="prompt-tools">+ <button type="button" class="ptool" id="surprise" aria-label="Fill the box with a random vivid prompt">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <rect x="3" y="3" width="18" height="18" rx="3" />+ <circle cx="8.5" cy="8.5" r="1.4" fill="currentColor" stroke="none" />+ <circle cx="15.5" cy="15.5" r="1.4" fill="currentColor" stroke="none" />+ <circle cx="15.5" cy="8.5" r="1.4" fill="currentColor" stroke="none" />+ <circle cx="8.5" cy="15.5" r="1.4" fill="currentColor" stroke="none" />+ </svg>+ Surprise me+ </button>+ <span class="prompt-coach" id="prompt-coach" data-grade="tip" aria-live="polite"></span>+ <span class="prompt-count" id="prompt-count">0 / 1000</span>+ </div></div><!-- Image / multi-view → 3D -->@@ -1488,6 +1597,7 @@</div><button class="btn" id="generate" type="submit"><span id="generate-label">Generate</span>+ <kbd class="gen-kbd" aria-hidden="true">⌘↵</kbd></button></div></form>@@ -1498,6 +1608,7 @@<button class="chip" type="button">a potted monstera plant</button><button class="chip" type="button">a vintage film camera</button><button class="chip" type="button">a glazed ceramic teapot</button>+ <button class="chips-more" type="button" id="chips-more" aria-label="Swap in a fresh set of example prompts">↻ More ideas</button></div><section class="stage" id="stage" aria-live="polite">@@ -1530,6 +1641,17 @@<span class="dot" aria-hidden="true"></span><span>Finalizing GLB</span></div>+ <div+ class="gen-progress"+ id="gen-progress"+ role="progressbar"+ aria-label="Generation progress"+ aria-valuemin="0"+ aria-valuemax="100"+ aria-valuenow="0"+ >+ <div class="gen-progress-fill" id="gen-progress-fill"></div>+ </div><div class="gen-meta" id="gen-meta">Elapsed 0s</div><div style="margin-top: var(--space-sm)"><button class="btn btn-ghost" type="button" id="cancel">Cancel</button>diff --git a/pages/home.html b/pages/home.htmlindex 4a849e161..970d00c10 100644--- a/pages/home.html+++ b/pages/home.html@@ -3176,8 +3176,63 @@#home-forge .hf-btn:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 2px; }#home-forge .hf-btn--bright { background: var(--text); border-color: var(--text); color: #0a0a0c; font-weight: 600; }#home-forge .hf-btn--bright:hover { background: #e8e8e8; color: #0a0a0c; }+ #home-forge .hf-btn svg { width: 14px; height: 14px; flex: none; }+ /* Accent action — the primary "where does this go next" CTA in the bar. */+ #home-forge .hf-btn--accent { color: var(--text); border-color: rgba(139, 92, 246, 0.55); background: rgba(139, 92, 246, 0.12); }+ #home-forge .hf-btn--accent:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.2); color: #fff; }+ #home-forge .hf-icon-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }+ #home-forge .hf-icon-btn svg { width: 15px; height: 15px; }+ #home-forge .hf-btn[aria-pressed='false'] { color: var(--text-3); }+ #home-forge .hf-result-region:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 4px; }+ #home-forge .hf-result-actions { display: flex; gap: 6px; flex: none; max-width: 100%; overflow-x: auto; scrollbar-width: none; }+ #home-forge .hf-result-actions::-webkit-scrollbar { display: none; }#home-forge .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }+ /* Session history rail — real captured frames of your recent forges. */+ #home-forge .hf-history {+ position: absolute; left: 16px; top: 50px; z-index: 6;+ display: flex; flex-direction: column; gap: 8px; align-items: flex-start;+ max-height: calc(100% - 210px); pointer-events: none;+ }+ #home-forge .hf-history[hidden] { display: none; }+ #home-forge .hf-history-label {+ font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;+ text-transform: uppercase; color: var(--text-3); padding-left: 2px;+ }+ #home-forge .hf-history-track {+ display: flex; flex-direction: column; gap: 8px; overflow-y: auto;+ scrollbar-width: none; padding: 2px; pointer-events: auto;+ }+ #home-forge .hf-history-track::-webkit-scrollbar { display: none; }+ #home-forge .hf-thumb {+ width: 46px; height: 46px; flex: none; border-radius: 10px; cursor: pointer; padding: 0;+ border: 1px solid var(--hairline); overflow: hidden; position: relative;+ background: #0e0e12 center / cover no-repeat;+ transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;+ animation: hf-thumb-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ @keyframes hf-thumb-in { from { opacity: 0; transform: translateX(-6px) scale(0.9); } }+ #home-forge .hf-thumb:hover { transform: translateX(2px) scale(1.05); border-color: var(--hairline-strong); box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.85); }+ #home-forge .hf-thumb:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 2px; }+ #home-forge .hf-thumb[aria-current='true'] { border-color: #8b5cf6; box-shadow: 0 0 0 1px #8b5cf6, 0 8px 22px -10px rgba(139, 92, 246, 0.7); }+ #home-forge .hf-thumb-fallback {+ display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;+ font-family: var(--font-mono); font-size: 15px; text-transform: uppercase; color: var(--text-3);+ background: radial-gradient(120% 120% at 30% 20%, #1a1a22, #0c0c10);+ }++ /* Ephemeral confirmation toast (copy link, etc.). */+ #home-forge .hf-toast {+ position: absolute; left: 50%; bottom: 168px; z-index: 8; transform: translateX(-50%) translateY(6px);+ padding: 7px 15px; border-radius: 999px; pointer-events: none; opacity: 0;+ background: rgba(12, 12, 16, 0.92); border: 1px solid var(--hairline-strong);+ -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);+ font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em; color: var(--text-2);+ transition: opacity 0.2s ease, transform 0.2s ease;+ }+ #home-forge .hf-toast[hidden] { display: none; }+ #home-forge .hf-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }+@media (max-width: 720px) {#home-forge .hf-chamber { min-height: 600px; border-radius: 16px; }#home-forge .hf-state { padding: 24px 18px 190px; }@@ -3217,6 +3272,14 @@<span>draft · free lane</span></div>+ <!-- Session history — real captured frames of models you forged here,+ persisted on this device. Click one to bring it back on stage. -->+ <div class="hf-history" data-hf-history hidden>+ <span class="hf-history-label">Recent</span>+ <div class="hf-history-track" data-hf-history-track role="list" aria-label="Models you forged this session"></div>+ </div>+ <div class="hf-toast" data-hf-toast role="status" aria-live="polite" hidden></div>+<div class="hf-state" data-hf-idle><h3>Nothing forged yet</h3><p>Type a description — or take the suggestion — and a real textured mesh lands here, usually in seconds.</p>@@ -3235,11 +3298,30 @@<div class="hf-result" data-hf-result hidden><div class="hf-viewer" data-hf-viewer-slot></div><div class="hf-scan" data-hf-scan aria-hidden="true"></div>- <div class="hf-result-bar">+ <div class="hf-result-bar" data-hf-result-region tabindex="-1" role="group" aria-label="Forged model — actions"><span class="hf-result-meta" data-hf-result-meta></span><div class="hf-result-actions">- <a class="hf-btn" data-hf-download download>Download GLB</a>- <button type="button" class="hf-btn" data-hf-again>Clear</button>+ <button type="button" class="hf-btn hf-icon-btn" data-hf-spin aria-pressed="true" title="Pause auto-rotate" aria-label="Toggle auto-rotate">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/><path d="M3 21v-5h5"/></svg>+ </button>+ <button type="button" class="hf-btn" data-hf-vary>+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9z"/><path d="M19 14.5l.8 2 .2.5 2 .8-2 .8-.2.5-.8 2-.8-2-.2-.5-2-.8 2-.8.2-.5z"/></svg>+ Variation+ </button>+ <a class="hf-btn hf-btn--accent" data-hf-scene target="_blank" rel="noopener">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2 3 7v10l9 5 9-5V7z"/><path d="M3 7l9 5 9-5"/><path d="M12 12v10"/></svg>+ Scene Studio+ </a>+ <button type="button" class="hf-btn hf-icon-btn" data-hf-share title="Copy share link" aria-label="Copy share link">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1.5 1.5"/><path d="M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1.5-1.5"/></svg>+ </button>+ <a class="hf-btn" data-hf-download download>+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12"/><path d="m7 11 5 5 5-5"/><path d="M5 21h14"/></svg>+ GLB+ </a>+ <button type="button" class="hf-btn hf-icon-btn" data-hf-again title="Clear" aria-label="Clear and forge another">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>+ </button></div></div></div>diff --git a/public/buttons.css b/public/buttons.cssindex 877d12d20..6b5e2630e 100644--- a/public/buttons.css+++ b/public/buttons.css@@ -168,6 +168,43 @@border-color: var(--btn-primary-bg-active);}+/* ── Variant — forge (Text → 3D) ──────────────────────────────────────────── */+/* The generation suite's signature: the Forge iris gradient as a hairline+ border, with a live pulse dot. Dark-surface pages only (the gradient+ border is painted over a near-black padding-box). */+.btn--forge {+ border-color: transparent;+ color: var(--text, #e8e8e8);+ background:+ linear-gradient(var(--btn-forge-surface, #0c0c0f), var(--btn-forge-surface, #0c0c0f)) padding-box,+ linear-gradient(120deg, rgba(255, 180, 84, 0.5), rgba(255, 106, 213, 0.5) 38%, rgba(139, 92, 246, 0.5) 64%, rgba(79, 195, 255, 0.5)) border-box;+}+.btn--forge:hover:not(:disabled):not([aria-disabled='true']) {+ border-color: transparent;+ background:+ linear-gradient(var(--btn-forge-surface, #101014), var(--btn-forge-surface, #101014)) padding-box,+ linear-gradient(120deg, #ffb454, #ff6ad5 38%, #8b5cf6 64%, #4fc3ff) border-box;+ box-shadow: 0 0 18px rgba(139, 92, 246, 0.18);+}+.btn--forge:active:not(:disabled):not([aria-disabled='true']) {+ box-shadow: 0 0 10px rgba(139, 92, 246, 0.12);+}+.btn--forge .btn-forge-dot {+ width: 6px;+ height: 6px;+ flex: 0 0 auto;+ border-radius: 50%;+ background: conic-gradient(from 210deg, #ffb454, #ff6ad5, #8b5cf6, #4fc3ff, #ffb454);+ animation: btn-forge-pulse 2.4s var(--ease-standard, ease-in-out) infinite;+}+@keyframes btn-forge-pulse {+ 0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45); }+ 50% { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0); }+}+@media (prefers-reduced-motion: reduce) {+ .btn--forge .btn-forge-dot { animation: none; }+}+/* ── Variant — secondary (explicit alias of the default style) ────────────── */.btn--secondary {background: var(--btn-secondary-bg);diff --git a/public/nav-data.js b/public/nav-data.jsindex 955d7eeea..b175653bd 100644--- a/public/nav-data.js+++ b/public/nav-data.js@@ -14,8 +14,11 @@// - default layout: single-column dropdown of `items`// - 'wide': two-column dropdown of `items`// - 'mega': right-anchored three-column dropdown of named `columns`-// item: { title, href, desc, badge?, attrs? }+// item: { title, href, desc, badge?, badgeTone?, attrs? }+// - badgeTone: 'live' tints the badge green with a pulse dot (running now)// - attrs: extra HTML attributes, e.g. { 'data-glossary-open': '' }+// top-level link: { label, href, highlight? }+// - highlight: renders as the iridescent "hot" pill (one per nav, max)export const NAV_GROUPS = [{@@ -25,12 +28,14 @@ export const NAV_GROUPS = [title: 'Text to 3D',href: '/forge',badge: 'Live',+ badgeTone: 'live',desc: 'Describe an object → textured GLB, usually in seconds',},{title: 'Describe it to 3D',href: '/create/prompt',badge: 'Live',+ badgeTone: 'live',desc: 'Type a description → rigged 3D avatar in about a minute',},{@@ -291,7 +296,7 @@ export const NAV_GROUPS = [// Top-level links rendered after the dropdown groups (no submenu).export const NAV_LINKS = [- { label: 'Text → 3D', href: '/forge', badge: 'Live' },+ { label: 'Text → 3D', href: '/forge', highlight: true },{ label: 'Pricing', href: '/pricing' },];diff --git a/public/nav.css b/public/nav.cssindex 23bd4582e..22e7ff2e7 100644--- a/public/nav.css+++ b/public/nav.css@@ -381,6 +381,43 @@background: rgba(255,255,255,0.1); color: var(--nv-text);text-transform: uppercase;}+/* "live" tone — this feature is running right now, not merely new. */+.nav-pill-live {+ background: rgba(88,214,141,0.12); color: #6fdf9d;+ box-shadow: inset 0 0 0 1px rgba(88,214,141,0.22);+}++/* ── "Hot" top-level link — the one feature the nav spotlights ──────────── */+/* Iridescent thread shared with the Forge brand (home #home-forge --hf-iris). */+.nav-main > a.nav-hot {+ gap: 7px; margin-left: 4px; padding: 4px 12px 4px 10px;+ border: 1px solid rgba(255,255,255,0.14); border-radius: 999px;+ color: var(--nv-text); font-weight: 500;+ background: rgba(255,255,255,0.03);+ transition: border-color 0.15s, background 0.15s, color 0.12s;+}+.nav-main > a.nav-hot:hover {+ border-color: rgba(255,255,255,0.3);+ background: rgba(255,255,255,0.06);+}+.nav-main > a.nav-hot:hover .nav-hot-label {+ background: linear-gradient(120deg, #ffb454, #ff6ad5 38%, #8b5cf6 64%, #4fc3ff);+ -webkit-background-clip: text; background-clip: text;+ -webkit-text-fill-color: transparent; color: transparent;+}+.nav-hot-dot {+ width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%;+ background: conic-gradient(from 210deg, #ffb454, #ff6ad5, #8b5cf6, #4fc3ff, #ffb454);+ animation: nav-hot-pulse 2.4s ease-in-out infinite;+}+@keyframes nav-hot-pulse {+ 0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.45); }+ 50% { box-shadow: 0 0 0 4px rgba(139,92,246,0); }+}+/* Drawer rendering of the same link: keep the dot, drop the pill chrome. */+.nav-drawer a.nav-hot {+ display: flex; align-items: center; gap: 8px; color: var(--nv-text);+}.nav-pop-note {padding: 6px 12px 8px; font-size: var(--text-2xs); color: var(--nv-text-4);line-height: 1.45; grid-column: 1 / -1;diff --git a/public/nav.js b/public/nav.jsindex c0a603aca..e22c9e45b 100644--- a/public/nav.js+++ b/public/nav.js@@ -135,7 +135,8 @@ function attrString(attrs) {}function renderMenuItem(item) {- const badge = item.badge ? ` <span class="nav-pill-sm">${escHtml(item.badge)}</span>` : '';+ const tone = item.badgeTone === 'live' ? ' nav-pill-live' : '';+ const badge = item.badge ? ` <span class="nav-pill-sm${tone}">${escHtml(item.badge)}</span>` : '';return (`<a class="nav-mi" href="${escHtml(item.href)}" role="menuitem"${attrString(item.attrs)}>` +`<span class="nav-mi-t">${escHtml(item.title)}${badge}</span>` +@@ -171,6 +172,13 @@ function renderGroup(group) {}function renderTopLink(link) {+ if (link.highlight) {+ return (+ `<a class="nav-hot" href="${escHtml(link.href)}">` ++ `<span class="nav-hot-dot" aria-hidden="true"></span>` ++ `<span class="nav-hot-label">${escHtml(link.label)}</span></a>`+ );+ }const badge = link.badge ? ` <span class="nav-pill-sm">${escHtml(link.badge)}</span>` : '';return `<a href="${escHtml(link.href)}">${escHtml(link.label)}${badge}</a>`;}diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.jsindex 2ae796326..eb0e00138 100644--- a/src/dashboard-next/pages/home.js+++ b/src/dashboard-next/pages/home.js@@ -487,26 +487,169 @@ const ICON_CHAT = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" sconst ICON_COIN = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="5.5"/><path d="M8 5v6M6 7h3.2a1.2 1.2 0 010 2.4H7a1.2 1.2 0 000 2.4h3.2"/></svg>';// ── Launch announcement: text-to-3D ───────────────────────────────────────+//+// Not a passive notice — a working launchpad. The bar embeds a real prompt+// composer that deep-links into the Forge (/forge?prompt=…, which pre-fills+// and focuses the field), a typewriter that teaches by cycling the Forge's+// own example prompts, and one-tap example chips. The animated mesh visual+// (a CSS wireframe cube under a sweeping scan ring) signals "generation"+// without a single image asset.++const FORGE_PROMPT_CAP = 300;++// The Forge's own example prompts (pages/forge.html #examples). Kept in sync+// so the launchpad teaches the same vocabulary the destination uses.+const FORGE_EXAMPLES = [+ 'a low-poly red fox, sitting',+ 'a sci-fi combat helmet, brushed metal',+ 'a potted monstera plant',+ 'a vintage film camera',+ 'a glazed ceramic teapot',+];++function forgeHref(prompt) {+ const p = (prompt || '').trim().slice(0, FORGE_PROMPT_CAP);+ return p ? `/forge?prompt=${encodeURIComponent(p)}` : '/forge';+}function renderForgeAnnounce(host) {+ const reduceMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ?? false;+host.innerHTML = `- <div class="dnx-announce" role="region" aria-label="New feature announcement">- <span class="dnx-announce-badge">New</span>- <p class="dnx-announce-text">- <strong>Text to 3D is live.</strong>- Describe any object and Forge generates a textured GLB you can drop into scenes, worlds, and widgets.- </p>- <a class="dn-btn dnx-announce-cta" href="/forge">Try Forge →</a>- <button class="dnx-announce-dismiss" aria-label="Dismiss announcement" title="Dismiss">- <svg viewBox="0 0 12 12" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M1 1l10 10M11 1L1 11"/></svg>+ <div class="dnx-forge${reduceMotion ? ' is-still' : ''}" role="region" aria-label="New: Text to 3D">+ <div class="dnx-forge-visual" aria-hidden="true">+ <span class="dnx-forge-ring"></span>+ <span class="dnx-forge-stage">+ <span class="dnx-forge-cube">+ <i></i><i></i><i></i><i></i><i></i><i></i>+ </span>+ </span>+ <span class="dnx-forge-scan"></span>+ </div>+ <div class="dnx-forge-body">+ <div class="dnx-forge-head">+ <span class="dnx-forge-badge">New</span>+ <span class="dnx-forge-title">Text to 3D is live</span>+ <span class="dnx-forge-sub">Describe any object — get a downloadable, textured GLB in seconds.</span>+ </div>+ <form class="dnx-forge-form" novalidate>+ <label class="dnx-forge-field">+ <span class="sr-only">Describe an object to forge into 3D</span>+ <input+ class="dnx-forge-input"+ type="text"+ name="prompt"+ autocomplete="off"+ spellcheck="false"+ maxlength="${FORGE_PROMPT_CAP}"+ aria-label="Describe an object to forge into 3D"+ />+ </label>+ <button class="dnx-forge-go" type="submit">+ Forge+ <svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 8h9M9 4l4 4-4 4"/></svg>+ </button>+ </form>+ <div class="dnx-forge-chips" aria-label="Example prompts">+ <span class="dnx-forge-chips-label">Try</span>+ ${FORGE_EXAMPLES.slice(0, 3).map((ex) => {+ const short = ex.replace(/^a\s+/i, '').split(',')[0];+ return `<a class="dnx-forge-chip" href="${forgeHref(ex)}" title="${esc(ex)}">${esc(short)}</a>`;+ }).join('')}+ </div>+ </div>+ <button class="dnx-forge-dismiss" aria-label="Dismiss announcement" title="Dismiss">+ <svg viewBox="0 0 12 12" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M1 1l10 10M11 1L1 11"/></svg></button></div>`;- host.querySelector('.dnx-announce-dismiss').addEventListener('click', () => {+ const root = host.querySelector('.dnx-forge');+ const input = host.querySelector('.dnx-forge-input');+ const form = host.querySelector('.dnx-forge-form');++ // Submit → deep-link into the Forge with whatever the user typed. Empty+ // field falls back to the example currently on display, so the button is+ // never a dead end.+ let currentExample = FORGE_EXAMPLES[0];+ form.addEventListener('submit', (e) => {+ e.preventDefault();+ stopTypewriter();+ location.href = forgeHref(input.value || currentExample);+ });++ // Dismiss — persist so it stays gone, and tear down timers.+ host.querySelector('.dnx-forge-dismiss').addEventListener('click', () => {localStorage.setItem(FORGE_ANNOUNCE_DISMISSED_KEY, '1');+ stopTypewriter();host.remove();});++ // Typewriter: types each example into the placeholder, holds, erases, and+ // advances. Pauses while the field is focused or non-empty so it never+ // fights the user. Reduced-motion swaps the whole phrase on a slow timer.+ let twTimer = null;+ let exampleIdx = 0;+ const paused = () => document.activeElement === input || input.value.length > 0;++ function setExample(text) {+ currentExample = text;+ input.placeholder = text;+ }++ function stopTypewriter() {+ if (twTimer) { clearTimeout(twTimer); twTimer = null; }+ }++ if (reduceMotion) {+ setExample(currentExample);+ const rotate = () => {+ twTimer = setTimeout(() => {+ exampleIdx = (exampleIdx + 1) % FORGE_EXAMPLES.length;+ if (!paused()) setExample(FORGE_EXAMPLES[exampleIdx]);+ rotate();+ }, 3800);+ };+ rotate();+ } else {+ let charIdx = 0;+ let erasing = false;+ const step = () => {+ if (paused()) {+ input.placeholder = '';+ twTimer = setTimeout(step, 600);+ return;+ }+ const target = FORGE_EXAMPLES[exampleIdx];+ if (!erasing) {+ charIdx++;+ currentExample = target;+ input.placeholder = target.slice(0, charIdx);+ if (charIdx >= target.length) {+ erasing = true;+ twTimer = setTimeout(step, 1900); // hold full phrase+ return;+ }+ twTimer = setTimeout(step, 42 + Math.floor(charIdx % 3) * 14);+ } else {+ charIdx--;+ input.placeholder = target.slice(0, charIdx);+ if (charIdx <= 0) {+ erasing = false;+ exampleIdx = (exampleIdx + 1) % FORGE_EXAMPLES.length;+ twTimer = setTimeout(step, 320);+ return;+ }+ twTimer = setTimeout(step, 22);+ }+ };+ step();+ // Resume cleanly when the user blurs an empty field.+ input.addEventListener('blur', () => {+ if (!input.value && !twTimer) step();+ });+ input.addEventListener('focus', () => { input.placeholder = ''; });+ }}// ── Onboarding checklist ──────────────────────────────────────────────────diff --git a/src/forge.js b/src/forge.jsindex d493dcab3..3e0cfaf8f 100644--- a/src/forge.js+++ b/src/forge.js@@ -52,6 +52,8 @@ const els = {},genPreview: document.getElementById('gen-preview'),genMeta: document.getElementById('gen-meta'),+ genProgress: document.getElementById('gen-progress'),+ genProgressFill: document.getElementById('gen-progress-fill'),steps: {image: document.getElementById('step-image'),mesh: document.getElementById('step-mesh'),@@ -189,17 +191,75 @@ function setStepLabel(step, text) {if (node) node.textContent = text;}+// The typical end-to-end time for the current engine+tier, straight from the+// catalog's real estimate matrix (estimateEtaSeconds). Null when no catalog or+// estimate exists — the meter then runs indeterminate rather than inventing a+// duration.+function currentEtaSeconds() {+ if (!catalog) return null;+ const backend = catalog.backends?.find((b) => b.id === selectedEngine.backend);+ const est = (backend?.estimates?.[selectedEngine.path] || []).find(+ (e) => e.tier === selectedTier,+ );+ return Number(est?.eta_seconds) > 0 ? Number(est.eta_seconds) : null;+}++// Map real elapsed seconds onto an honest fill fraction. The curve approaches+// 1 asymptotically and is capped below it, so the bar can never reach full on+// time alone — only a real finished GLB sets it to 100% (see markDone). At+// elapsed = typical the fill sits ~0.78; it keeps creeping past that but never+// claims completion.+function honestFill(elapsedS, typicalS) {+ const frac = 1 - Math.exp(-elapsedS / (typicalS * 0.66));+ return Math.min(frac, 0.95);+}++function setProgress(pct) {+ if (!els.genProgressFill || !els.genProgress) return;+ const clamped = Math.max(0, Math.min(100, pct));+ els.genProgressFill.style.width = `${clamped}%`;+ els.genProgress.setAttribute('aria-valuenow', String(Math.round(clamped)));+}+function startElapsed() {const started = performance.now();stopElapsed();+ const typical = currentEtaSeconds();+ // Reset the meter to a clean running state for this job.+ if (els.genProgress) {+ els.genProgress.dataset.done = 'false';+ els.genProgress.dataset.over = 'false';+ els.genProgress.dataset.indeterminate = typical ? 'false' : 'true';+ }+ setProgress(0);const tick = () => {const s = Math.floor((performance.now() - started) / 1000);- els.genMeta.textContent = `Elapsed ${s}s`;+ if (typical) {+ const over = s > typical;+ setProgress(honestFill(s, typical) * 100);+ if (els.genProgress) els.genProgress.dataset.over = String(over);+ els.genMeta.innerHTML = over+ ? `Elapsed <strong>${s}s</strong> · longer than usual, still working`+ : `Elapsed <strong>${s}s</strong> · ~${typical}s typical`;+ } else {+ // Unknown duration — the bar travels (indeterminate) and we report only+ // the honest elapsed count.+ els.genMeta.innerHTML = `Elapsed <strong>${s}s</strong>`;+ }};tick();elapsedTimer = window.setInterval(tick, 1000);}+// Snap the meter to a finished, successful state — the only path to 100%.+function markProgressDone() {+ if (!els.genProgress) return;+ els.genProgress.dataset.indeterminate = 'false';+ els.genProgress.dataset.over = 'false';+ els.genProgress.dataset.done = 'true';+ setProgress(100);+}+function stopElapsed() {if (elapsedTimer) {window.clearInterval(elapsedTimer);@@ -1258,6 +1318,7 @@ async function run(cfg) {if (done.creation_id) currentCreationId = done.creation_id;setStep('mesh', 'done');setStep('finish', 'done');+ markProgressDone();// Prefer the poll's recorded meta; fall back to the submit response.showResult(done.glb_url, label || 'Forged model', {views_used: done.views_used ?? job.views_used,diff --git a/tests/api/mcp-3d-challenge.test.js b/tests/api/mcp-3d-challenge.test.jsnew file mode 100644index 000000000..b98717962--- /dev/null+++ b/tests/api/mcp-3d-challenge.test.js@@ -0,0 +1,146 @@+/**+ * The 3D Studio MCP endpoint (api/mcp-3d.js) must issue its OWN auth/payment+ * challenge — resource URL /api/mcp-3d, a text→3D description, and a bazaar+ * discovery example that calls text_to_3d. Before STUDIO_CHALLENGE existed it+ * inherited the main /api/mcp envelope and advertised itself to x402+ * facilitators as the avatar/validation server, so agents indexed (and paid+ * against) the wrong resource.+ */+import { describe, it, expect, vi } from 'vitest';+import { Readable } from 'node:stream';++// Env the real 402 challenge builder reads. Set before importing the handler.+process.env.PUBLIC_APP_ORIGIN = 'https://three.ws';+process.env.X402_PAY_TO_BASE ||= '0x0000000000000000000000000000000000000001';+process.env.X402_ASSET_ADDRESS_BASE ||= '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';++// Bearer path is out of scope — no token is ever presented in these tests.+vi.mock('../../api/_lib/auth.js', () => ({+ extractBearer: () => null,+ authenticateBearer: vi.fn(async () => null),+}));++// No Upstash in unit tests.+vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: {+ mcpIp: vi.fn(async () => ({ success: true, reset: Date.now() + 1000 })),+ mcpUser: vi.fn(async () => ({ success: true, reset: Date.now() + 1000 })),+ mcp3dGenerate: vi.fn(async () => ({ success: true, reset: Date.now() + 1000 })),+ mcp3dStatus: vi.fn(async () => ({ success: true, reset: Date.now() + 1000 })),+ mcpInspect: vi.fn(async () => ({ success: true })),+ mcpOptimize: vi.fn(async () => ({ success: true })),+ },+ clientIp: vi.fn(() => '203.0.113.9'),+}));++// ── Heavy studio-tool dependencies (imported transitively by the catalog) ────+vi.mock('../../api/_lib/usage.js', () => ({+ recordEvent: vi.fn(),+ logger: () => ({ info: () => {}, warn: () => {}, error: () => {} }),+}));+vi.mock('../../api/_providers/replicate.js', () => ({+ createRegenProvider: vi.fn(() => ({+ submit: vi.fn(async () => ({ extJobId: 'pred_123', eta: 45 })),+ status: vi.fn(async () => ({ status: 'running' })),+ })),+}));+vi.mock('../../api/_mcp3d/text-to-image.js', () => ({+ textToImage: vi.fn(async () => ({ imageUrl: 'https://img.test/a.png', model: 'flux' })),+}));++const { default: handler } = await import('../../api/mcp-3d.js');++function makeRes() {+ return {+ statusCode: 200,+ headers: {},+ body: null,+ setHeader(name, value) {+ this.headers[String(name).toLowerCase()] = value;+ },+ end(body) {+ this.body = body ?? null;+ },+ };+}++function makeReq({ method = 'POST', headers = {}, body = null } = {}) {+ const payload = body == null ? '' : JSON.stringify(body);+ const req = Readable.from(payload ? [Buffer.from(payload, 'utf8')] : []);+ req.method = method;+ req.url = '/api/mcp-3d';+ req.headers = {+ 'content-type': 'application/json',+ 'x-forwarded-for': '203.0.113.9',+ ...headers,+ };+ return req;+}++const TOOLS_LIST = { jsonrpc: '2.0', id: 1, method: 'tools/list' };++describe('POST /api/mcp-3d — unauthenticated challenge identity', () => {+ it('plain x402 clients get a 402 naming the 3D Studio resource', async () => {+ const res = makeRes();+ await handler(makeReq({ body: TOOLS_LIST }), res);+ expect(res.statusCode).toBe(402);+ const challenge = JSON.parse(res.body);+ expect(challenge.resource.url).toBe('https://three.ws/api/mcp-3d');+ expect(challenge.resource.description).toContain('text_to_3d');+ expect(challenge.resource.serviceName).toBe('three.ws 3D Studio MCP');+ expect(challenge.resource.tags).toContain('text-to-3d');+ for (const accept of challenge.accepts) {+ expect(accept.resource).toBe('https://three.ws/api/mcp-3d');+ }+ });++ it('bazaar discovery example calls text_to_3d, not a main-server tool', async () => {+ const res = makeRes();+ await handler(makeReq({ body: TOOLS_LIST }), res);+ const { extensions } = JSON.parse(res.body);+ expect(extensions.bazaar.discoverable).toBe(true);+ expect(extensions.bazaar.info.input.body.params.name).toBe('text_to_3d');+ expect(extensions.bazaar.info.output.example.result.structuredContent.job_id).toBeTruthy();+ });++ it('MCP protocol clients get a 401 with the same studio envelope', async () => {+ const res = makeRes();+ await handler(+ makeReq({ body: TOOLS_LIST, headers: { accept: 'application/json, text/event-stream' } }),+ res,+ );+ expect(res.statusCode).toBe(401);+ expect(res.headers['www-authenticate']).toContain('oauth-protected-resource');+ const challenge = JSON.parse(res.body);+ expect(challenge.resource.url).toBe('https://three.ws/api/mcp-3d');+ expect(challenge.resource.serviceName).toBe('three.ws 3D Studio MCP');+ });++ it('GET (SSE probe) advertises the studio resource as well', async () => {+ const res = makeRes();+ await handler(makeReq({ method: 'GET', body: null }), res);+ expect(res.statusCode).toBe(402);+ const challenge = JSON.parse(res.body);+ expect(challenge.resource.url).toBe('https://three.ws/api/mcp-3d');+ expect(challenge.resource.description).toContain('text_to_3d');+ });++ it('the free public getting_started tool is still served with no credentials', async () => {+ const res = makeRes();+ await handler(+ makeReq({+ body: {+ jsonrpc: '2.0',+ id: 2,+ method: 'tools/call',+ params: { name: 'getting_started', arguments: {} },+ },+ }),+ res,+ );+ expect(res.statusCode).toBe(200);+ const out = JSON.parse(res.body);+ expect(out.error).toBeUndefined();+ expect(out.result?.content?.[0]?.text).toBeTruthy();+ });+});