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 health checks, scene studio updates, and page refinements
nirholas6a508bb96daa
diff --git a/pages/forge.html b/pages/forge.htmlindex bebb23843..023770280 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -355,6 +355,11 @@grid-template-columns: repeat(2, 1fr);}}+ /* Sketch mode reuses the view-slot kit with a single, wider slot.+ Declared after both .views-grid rules so it wins at every width. */+ .sketch-grid {+ grid-template-columns: minmax(140px, 240px);+ }.view-slot {position: relative;aspect-ratio: 1 / 1;@@ -1214,6 +1219,11 @@<button type="button" role="tab" data-mode="image" aria-selected="false">From photos</button>+ <!-- Hidden until the catalog reports a live sketch engine (TripoSG+ self-host) — no dead tab on deployments without the worker. -->+ <button type="button" role="tab" data-mode="sketch" aria-selected="false" hidden>+ From a sketch+ </button></div></div>@@ -1260,6 +1270,36 @@</p></div>+ <!-- Sketch → 3D (TripoSG-scribble) -->+ <div id="sketch-pane" class="image-pane is-hidden">+ <div+ class="views-grid sketch-grid"+ id="sketch-grid"+ aria-label="Your sketch — add one drawing"+ ></div>+ <input+ type="file"+ id="sketch-file-input"+ accept="image/png,image/jpeg,image/webp"+ hidden+ />+ <label for="sketch-prompt" class="is-hidden"+ >What does the sketch depict? (required)</label+ >+ <textarea+ id="sketch-prompt"+ class="image-prompt"+ maxlength="1000"+ placeholder="What is it? — e.g. “a cartoon rocket with two tail fins” (required)"+ ></textarea>+ <p class="views-hint">+ Drop one drawing — dark strokes on a light background work best — and say+ what it depicts. PNG/JPG/WebP, up to 8 MB. The result is untextured+ geometry: use <strong>Stylize</strong> or <strong>Retexture</strong> on it+ after.+ </p>+ </div>+<!-- Quality tier + generation engine + BYOK key --><div class="forge-quality" id="forge-quality"><div class="fq-row">diff --git a/pages/launches.html b/pages/launches.htmlindex 024d4dad2..6714716e5 100644--- a/pages/launches.html+++ b/pages/launches.html@@ -40,7 +40,10 @@<link rel="stylesheet" href="/src/launches.css" /><link rel="stylesheet" href="/footer.css" /><script defer src="/footer-newsletter.js"></script>- </head>++ <link rel="canonical" href="https://three.ws/launches">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agent Launches","description":"Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.","url":"https://three.ws/launches","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>+</head><body><header><div id="nav-container"></div></header><script src="/nav.js"></script>diff --git a/pages/play/agent-wallet.html b/pages/play/agent-wallet.htmlindex 1360dd2e3..2e800b21e 100644--- a/pages/play/agent-wallet.html+++ b/pages/play/agent-wallet.html@@ -244,6 +244,9 @@.badge { display:none; }}</style>++ <meta property="og:site_name" content="three.ws">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Agent Wallet (x402 on Solana)","description":"Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.","url":"https://three.ws/play/agent-wallet","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script></head><body><div id="app">diff --git a/pages/scene.html b/pages/scene.htmlindex 91bd12b8c..e6fda49cc 100644--- a/pages/scene.html+++ b/pages/scene.html@@ -1,8 +1,9 @@<!doctype html><html lang="en" data-theme="dark"><head>- <!-- Scene Studio is dark-locked: pro 3D tools read best on a dark chrome,- so this page pins the theme instead of running the site theme boot. -->+ <script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <!-- Scene Studio is dark-locked (the entry module re-pins data-theme="dark"+ after the site theme boot): the editor chrome only ships dark. --><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Scene Studio · Assemble 3D worlds · three.ws</title>@@ -67,7 +68,10 @@<script src="/scene-studio/libs/tern-threejs/threejs.js"></script><script src="/scene-studio/libs/signals.min.js"></script><script src="/scene-studio/draco/draco_encoder.js"></script>- </head>++ <link rel="canonical" href="https://three.ws/scene">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Scene Studio","description":"Full 3D scene editor in the browser — import GLB models, arrange them with transform gizmos, edit materials and lights, and export complete scenes.","url":"https://three.ws/scene","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>+</head><body class="scene-studio"><div id="nav-container"></div><div id="studio-app" role="application" aria-label="Scene Studio 3D editor"></div>diff --git a/public/changelog.json b/public/changelog.jsonindex feff0ebd3..9ee52bae1 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-12T06:03:34.369Z",+ "generated_at": "2026-06-12T06:06:04.920Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",diff --git a/public/features.json b/public/features.jsonindex ffcc3e99f..c50067ac2 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-12T06:03:34.326Z",+ "generated_at": "2026-06-12T06:06:04.907Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 250391262..464e07c5b 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -42,6 +42,20 @@.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }.sm-brand:hover { text-decoration: none; }</style>++ <meta property="og:type" content="website">+ <meta property="og:site_name" content="three.ws">+ <meta property="og:title" content="Sitemap · three.ws">+ <meta property="og:description" content="Human-readable index of every page on three.ws.">+ <meta property="og:url" content="https://three.ws/sitemap">+ <meta property="og:image" content="https://three.ws/og-image.png">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:title" content="Sitemap · three.ws">+ <meta name="twitter:description" content="Human-readable index of every page on three.ws.">+ <meta name="twitter:image" content="https://three.ws/og-image.png">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script></head><body><header class="sm-topbar">diff --git a/scripts/forge-health-browser-check.mjs b/scripts/forge-health-browser-check.mjsnew file mode 100644index 000000000..03deedc6f--- /dev/null+++ b/scripts/forge-health-browser-check.mjs@@ -0,0 +1,56 @@+// One-off verification: load /forge in a real browser, confirm the engine+// selector renders, the ?health fetch fires, and no console errors come from+// our code. Run: node scripts/forge-health-browser-check.mjs [baseUrl]+import { chromium } from 'playwright';++const BASE = process.argv[2] || 'http://localhost:4173';+const browser = await chromium.launch({+ args: ['--disable-gpu', '--disable-dev-shm-usage', '--no-sandbox'],+});+const page = await browser.newPage();+// The model-viewer WebGL component crashes headless Chromium in this sandbox+// and is irrelevant to the engine-selector check — block it.+await page.route('**/model-viewer*', (route) => route.abort());++const consoleErrors = [];+page.on('console', (msg) => {+ if (msg.type() === 'error') consoleErrors.push(msg.text());+});+page.on('pageerror', (err) => consoleErrors.push(`pageerror: ${err.message}`));++let healthRequest = null;+let healthStatus = null;+page.on('request', (req) => {+ if (req.url().includes('forge?health')) healthRequest = req.url();+});+page.on('response', (res) => {+ if (res.url().includes('forge?health')) healthStatus = res.status();+});++await page.goto(`${BASE}/forge`, { waitUntil: 'domcontentloaded' });+// Engine buttons render after the catalog fetch resolves.+await page.waitForSelector('#engine button', { timeout: 20_000 });+await page.waitForTimeout(3_000); // let the health fetch land++const engines = await page.$$eval('#engine button', (btns) =>+ btns.map((b) => ({+ backend: b.dataset.backend,+ label: b.textContent.trim(),+ disabled: b.disabled,+ health: b.dataset.health || null,+ title: b.title,+ })),+);++console.log('health fetch:', healthRequest, '→', healthStatus);+console.log('engine buttons:');+for (const e of engines) {+ console.log(+ ` ${e.disabled ? '✗' : '✓'} ${e.backend} (${e.label}) health=${e.health ?? '–'} title="${e.title}"`,+ );+}+console.log('console errors:', consoleErrors.length ? consoleErrors : 'none');++await page.screenshot({ path: '/tmp/forge-engine-check.png', clip: { x: 0, y: 0, width: 1280, height: 900 } });+await browser.close();+process.exit(consoleErrors.length ? 1 : 0);diff --git a/scripts/forge-health-stub-api.mjs b/scripts/forge-health-stub-api.mjsnew file mode 100644index 000000000..ce858ed54--- /dev/null+++ b/scripts/forge-health-stub-api.mjs@@ -0,0 +1,46 @@+// One-off stub upstream for the /forge health browser check: serves the REAL+// buildCatalog() plus a controlled ?health payload so the engine selector's+// down/degraded states can be exercised in a real browser before the endpoint+// is deployed. Point Vite at it with DEV_API_PROXY=http://localhost:3199.+import http from 'node:http';++process.env.NVIDIA_API_KEY = 'nvapi-stub';+process.env.REPLICATE_API_TOKEN = 'r8-stub';+const { buildCatalog } = await import('../api/_lib/forge-tiers.js');++const HEALTH = {+ status: 'degraded',+ generated_at: new Date().toISOString(),+ cached: false,+ backends: {+ nvidia: {+ id: 'nvidia',+ status: 'degraded',+ message: 'NVIDIA NIM is throttling — the free lane may queue.',+ },+ trellis: {+ id: 'trellis',+ status: 'down',+ message: 'The Replicate account is out of credit.',+ },+ meshy: { id: 'meshy', status: 'byok', message: 'Meshy 6 uses your own API key.' },+ tripo: { id: 'tripo', status: 'byok', message: 'Tripo v3.1 uses your own API key.' },+ hunyuan3d: { id: 'hunyuan3d', status: 'unconfigured', message: 'Not deployed.' },+ triposg: { id: 'triposg', status: 'unconfigured', message: 'Not deployed.' },+ },+};++http+ .createServer((req, res) => {+ const url = new URL(req.url, 'http://localhost');+ res.setHeader('content-type', 'application/json');+ if (url.pathname === '/api/forge' && url.searchParams.has('catalog')) {+ return res.end(JSON.stringify(buildCatalog()));+ }+ if (url.pathname === '/api/forge' && url.searchParams.has('health')) {+ return res.end(JSON.stringify(HEALTH));+ }+ res.statusCode = 404;+ res.end('{"error":"stub_unrouted"}');+ })+ .listen(3199, () => console.log('forge stub api on :3199'));diff --git a/scripts/tmp-scene-check.mjs b/scripts/tmp-scene-check.mjsdeleted file mode 100644index adad4b85e..000000000--- a/scripts/tmp-scene-check.mjs+++ /dev/null@@ -1,25 +0,0 @@-import { chromium } from 'playwright';--const browser = await chromium.launch();-const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });-const errors = [];-page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); });-page.on('pageerror', (e) => errors.push('PAGEERROR: ' + e.message));--await page.goto('http://localhost:3010/pages/scene.html', { waitUntil: 'load', timeout: 30000 });-await page.waitForTimeout(4000);--const result = await page.evaluate(() => ({- hasMenubar: !!document.querySelector('#studio-app #menubar'),- hasSidebar: !!document.querySelector('#studio-app #sidebar'),- hasViewportCanvas: !!document.querySelector('#studio-app #viewport canvas'),- hasToolbar: !!document.querySelector('#studio-app #toolbar'),- hasNav: !!document.querySelector('header'),- menubarTop: document.querySelector('#studio-app')?.getBoundingClientRect().top,- editorGlobal: typeof window.editor,- bodyOverflow: getComputedStyle(document.body).overflow,-}));-console.log(JSON.stringify(result, null, 1));-await page.screenshot({ path: '/tmp/scene-studio.png' });-console.log('console errors:', errors.length ? errors : 'none');-await browser.close();diff --git a/scripts/tmp-scene-check2.mjs b/scripts/tmp-scene-check2.mjsdeleted file mode 100644index 6bdd563f0..000000000--- a/scripts/tmp-scene-check2.mjs+++ /dev/null@@ -1,15 +0,0 @@-import { chromium } from 'playwright';-const browser = await chromium.launch();-const page = await browser.newPage();-const failed = [];-page.on('response', (r) => { if (r.status() >= 400) failed.push(r.status() + ' ' + r.url()); });-await page.goto('http://localhost:3010/pages/scene.html', { waitUntil: 'load', timeout: 30000 });-await page.waitForTimeout(3000);-console.log('failed requests:', failed);-const navInfo = await page.evaluate(() => ({- navScript: !!document.querySelector('script[src="/nav.js"]'),- headerEl: !!document.querySelector('header, .site-nav, nav'),- bodyFirstChildren: [...document.body.children].slice(0, 5).map((e) => e.tagName + (e.id ? '#' + e.id : '')),-}));-console.log(JSON.stringify(navInfo, null, 1));-await browser.close();diff --git a/scripts/tmp-theme-check.mjs b/scripts/tmp-theme-check.mjsnew file mode 100644index 000000000..71f8cebd6--- /dev/null+++ b/scripts/tmp-theme-check.mjs@@ -0,0 +1,15 @@+import { chromium } from 'playwright';+const browser = await chromium.launch();+const ctx = await browser.newContext({ colorScheme: 'light' });+const page = await ctx.newPage();+await page.addInitScript(() => localStorage.setItem('twx_theme', 'light'));+await page.goto('http://localhost:3010/pages/scene.html', { waitUntil: 'load' });+await page.waitForSelector('#studio-app #menubar');+await page.waitForTimeout(1500);+const r = await page.evaluate(() => ({+ dataTheme: document.documentElement.getAttribute('data-theme'),+ menubarBg: getComputedStyle(document.querySelector('#studio-app #menubar')).backgroundColor,+ appBg: getComputedStyle(document.querySelector('#studio-app')).backgroundColor,+}));+console.log(JSON.stringify(r));+await browser.close();diff --git a/src/forge.js b/src/forge.jsindex 9c2e5bb08..571fa37b3 100644--- a/src/forge.js+++ b/src/forge.js@@ -3,7 +3,7 @@ import { skeletonHTML, errorStateHTML, ensureStateKitStyles } from './shared/staimport { showSharePanel } from './shared/share.js';ensureStateKitStyles();//-// Drives /api/forge. Two paths share one polling loop:+// Drives /api/forge. Three paths share one polling loop:// • Text → 3D — POST a prompt; FLUX paints a reference image, then TRELLIS// reconstructs the mesh.// • Image / multi-view → 3D — the user adds 1–4 photos of one object from@@ -11,6 +11,9 @@ ensureStateKitStyles();// presigned URL (/api/forge-upload), then their public URLs are POSTed as// image_urls. With >1 view the backend fuses them (multi-view conditioning)// and reports how many views it used + which backend handled it.+// • Sketch → 3D — one drawing + a required prompt naming what it depicts,+// generated by the self-host TripoSG scribble engine (path: 'sketch').+// The mode tab only appears when the catalog reports that engine live.//// State transitions are driven by real API responses; the only timer is the// honest elapsed counter. Nothing fakes progress.@@ -36,6 +39,10 @@ const els = {viewsGrid: document.getElementById('views-grid'),fileInput: document.getElementById('view-file-input'),imagePrompt: document.getElementById('image-prompt'),+ sketchPane: document.getElementById('sketch-pane'),+ sketchGrid: document.getElementById('sketch-grid'),+ sketchFileInput: document.getElementById('sketch-file-input'),+ sketchPrompt: document.getElementById('sketch-prompt'),states: {empty: document.getElementById('state-empty'),generating: document.getElementById('state-generating'),@@ -78,7 +85,7 @@ const els = {let aspectRatio = '1:1';let elapsedTimer = null;let pollAbort = false;-let mode = 'text'; // 'text' | 'image' — input mode (prompt vs photos)+let mode = 'text'; // 'text' | 'image' | 'sketch' — input mode (prompt vs photos vs drawing)let lastJob = null; // { prompt, imageUrls } — for retrylet currentCreationId = null;@@ -100,7 +107,7 @@ let userPickedEngine = false;let providerKey = '';// Friendly engine labels + where to mint a key, keyed by backend id.-const ENGINE_LABELS = { nvidia: 'Free', trellis: 'Fast', meshy: 'Meshy', tripo: 'Tripo', hunyuan3d: 'Hunyuan3D' };+const ENGINE_LABELS = { nvidia: 'Free', trellis: 'Fast', meshy: 'Meshy', tripo: 'Tripo', hunyuan3d: 'Hunyuan3D', triposg: 'TripoSG' };const KEY_HINTS = {meshy: { label: 'Meshy AI', url: 'https://www.meshy.ai/settings/api' },tripo: { label: 'Tripo AI', url: 'https://platform.tripo3d.ai/api-keys' },@@ -120,6 +127,9 @@ const slots = VIEW_LABELS.map(() => ({// from the first free slot.let pickerTarget = null;+// Sketch mode input — one drawing, same lifecycle as a view slot.+const sketch = { state: 'empty', url: null, objectUrl: null, errorMsg: '' };+// Stable anonymous handle for this browser. /forge has no login, so durable// creations + the gallery are scoped to this id (hashed server-side). Sent on// every request via the x-forge-client header.@@ -187,16 +197,21 @@ function sleep(ms) {// Mode switching --------------------------------------------------------------function setMode(next) {- if (next !== 'text' && next !== 'image') return;+ if (next !== 'text' && next !== 'image' && next !== 'sketch') return;mode = next;els.textPane.classList.toggle('is-hidden', mode !== 'text');els.imagePane.classList.toggle('is-hidden', mode !== 'image');+ els.sketchPane?.classList.toggle('is-hidden', mode !== 'sketch');els.examples.classList.toggle('is-hidden', mode !== 'text');for (const b of els.modeSwitch.querySelectorAll('button')) {b.setAttribute('aria-selected', String(b.dataset.mode === mode));}+ // Sketch serves through its own engine set (TripoSG) — rebuild the selector+ // so each mode only offers engines that can actually take its input.+ if (catalog) buildEngineButtons();updateAspectVisibility();if (mode === 'text') els.prompt.focus();+ if (mode === 'sketch' && sketch.state === 'empty') sketchSlotEl()?.focus();}// Aspect ratio only shapes the synthesized reference image — irrelevant when@@ -226,9 +241,21 @@ async function loadCatalog() {}buildEngineButtons();selectTier(selectedTier);+ revealSketchMode();loadHealth();}+// Sketch→3D needs the self-host TripoSG worker — the tab stays hidden unless+// the catalog reports that engine configured, so there is no dead mode on+// deployments without it.+function revealSketchMode() {+ const tab = els.modeSwitch?.querySelector('button[data-mode="sketch"]');+ if (!tab) return;+ const live = catalog.backends.some((b) => b.paths?.includes('sketch') && b.configured);+ tab.hidden = !live;+ if (live) buildSketchSlot();+}+// Live-probe the backends in the background, then tighten the engine buttons:// a lane whose upstream is down gets disabled with the real reason instead of// failing after the user has already typed a prompt and clicked Generate.@@ -245,12 +272,19 @@ async function loadHealth() {function buildEngineButtons() {if (!els.engine) return;- const usable = catalog.backends.filter((b) => b.configured || b.byok);+ // Each mode offers only the engines that take its input: sketch mode shows+ // the sketch-path engines (TripoSG); text/photo modes hide sketch-only ones.+ const usable = catalog.backends.filter((b) => {+ if (!(b.configured || b.byok)) return false;+ const sketchOnly = Array.isArray(b.paths) && b.paths.every((p) => p === 'sketch');+ return mode === 'sketch' ? b.paths.includes('sketch') : !sketchOnly;+ });els.engine.innerHTML = '';for (const b of usable) {// Each backend exposes the geometry-first path when it supports it; the// image-intermediate engines (TRELLIS, Hunyuan3D) keep the image path.- const path = b.paths.includes('geometry') ? 'geometry' : 'image';+ const path =+ mode === 'sketch' ? 'sketch' : b.paths.includes('geometry') ? 'geometry' : 'image';const btn = document.createElement('button');btn.type = 'button';btn.dataset.engine = b.id;@@ -308,7 +342,7 @@ function updateEngineAvailability() {}if (blocked && btn.dataset.backend === selectedEngine.backend) bounceTo = true;}- const defaultId = catalog.default_backend_for_tier?.[selectedTier]?.[selectedEngine.path === 'geometry' ? 'geometry' : 'image'];+ const defaultId = catalog.default_backend_for_tier?.[selectedTier]?.[selectedEngine.path] ?? null;if (bounceTo) {// Forced move: the selected engine can't serve photos. Prefer the standing// photo default, else the first enabled button.@@ -381,7 +415,12 @@ function updateEstimate() {if (est && est.credits != null) parts.push(`~${est.credits} credits`);if (backend.poly_control) parts.push(`up to ${tierMeta.polycount.toLocaleString()} polys`);else parts.push('image-intermediate · no poly target');- const pathLabel = selectedEngine.path === 'geometry' ? 'geometry-first' : 'fast path';+ const pathLabel =+ selectedEngine.path === 'geometry'+ ? 'geometry-first'+ : selectedEngine.path === 'sketch'+ ? 'sketch→3D · untextured'+ : 'fast path';parts.push(pathLabel);els.estimate.innerHTML = parts.join(' · ');}@@ -553,6 +592,34 @@ function handleFiles(startIndex, fileList) {}}+// Presign → PUT to object storage → public URL. Shared by the view slots and+// the sketch uploader. Returns { ok: true, url } or { ok: false, message }.+async function presignAndPut(file) {+ try {+ const presignRes = await fetch('/api/forge-upload', {+ method: 'POST',+ headers: { 'content-type': 'application/json', ...CLIENT_HEADERS },+ body: JSON.stringify({ content_type: file.type, size_bytes: file.size }),+ });+ const presign = await presignRes.json().catch(() => ({}));+ if (presignRes.status === 503) return { ok: false, message: 'Uploads unavailable — paste a URL.' };+ if (presignRes.status === 429) return { ok: false, message: 'Rate limited — retry shortly.' };+ if (!presignRes.ok || !presign.upload_url || !presign.public_url) {+ return { ok: false, message: presign.message || 'Upload failed.' };+ }++ const putRes = await fetch(presign.upload_url, {+ method: 'PUT',+ headers: { 'content-type': file.type },+ body: file,+ });+ if (!putRes.ok) return { ok: false, message: `Storage rejected the file (${putRes.status}).` };+ return { ok: true, url: presign.public_url };+ } catch {+ return { ok: false, message: 'Network error during upload.' };+ }+}+// Upload one file into a slot: presign → PUT to object storage → record the// public URL. The slot moves empty/error → uploading → uploaded|error, each a// real, designed state. The local blob preview shows immediately.@@ -572,42 +639,14 @@ async function uploadToSlot(index, file) {slots[index] = { state: 'uploading', url: null, objectUrl, errorMsg: '' };renderSlot(index);- try {- const presignRes = await fetch('/api/forge-upload', {- method: 'POST',- headers: { 'content-type': 'application/json', ...CLIENT_HEADERS },- body: JSON.stringify({ content_type: file.type, size_bytes: file.size }),- });- const presign = await presignRes.json().catch(() => ({}));- if (presignRes.status === 503) {- setSlotError(index, 'Uploads unavailable — paste a URL.');- return;- }- if (presignRes.status === 429) {- setSlotError(index, 'Rate limited — retry shortly.');- return;- }- if (!presignRes.ok || !presign.upload_url || !presign.public_url) {- setSlotError(index, presign.message || 'Upload failed.');- return;- }-- const putRes = await fetch(presign.upload_url, {- method: 'PUT',- headers: { 'content-type': file.type },- body: file,- });- if (!putRes.ok) {- setSlotError(index, `Storage rejected the file (${putRes.status}).`);- return;- }-- // Success — keep the local blob preview, remember the public URL.- slots[index] = { state: 'uploaded', url: presign.public_url, objectUrl, errorMsg: '' };- renderSlot(index);- } catch {- setSlotError(index, 'Network error during upload.');+ const up = await presignAndPut(file);+ if (!up.ok) {+ setSlotError(index, up.message);+ return;}+ // Success — keep the local blob preview, remember the public URL.+ slots[index] = { state: 'uploaded', url: up.url, objectUrl, errorMsg: '' };+ renderSlot(index);}function setSlotError(index, message) {@@ -626,6 +665,131 @@ function uploadedUrls() {return slots.filter((s) => s.state === 'uploaded' && s.url).map((s) => s.url);}+// Sketch slot ------------------------------------------------------------------+// One drawing, built from the same .view-slot kit as the photo slots so every+// state (empty / uploading / uploaded / error) is already designed.++function sketchSlotEl() {+ return els.sketchGrid?.querySelector('.view-slot') || null;+}++function buildSketchSlot() {+ if (!els.sketchGrid || els.sketchGrid.childElementCount) return;+ const slot = document.createElement('div');+ slot.className = 'view-slot';+ slot.tabIndex = 0;+ slot.setAttribute('role', 'button');+ slot.innerHTML = `+ <div class="vs-empty">+ <span class="vs-icon" aria-hidden="true">✎</span>+ <span class="vs-label">Sketch</span>+ </div>+ <div class="vs-uploading">+ <div class="shimmer" aria-hidden="true"></div>+ <span>Uploading…</span>+ </div>+ <img class="vs-thumb" alt="" />+ <span class="vs-badge">Sketch</span>+ <button type="button" class="vs-remove" aria-label="Remove sketch">×</button>+ <div class="vs-error">+ <span class="vs-error-msg">Upload failed</span>+ <button type="button" class="vs-retry">Retry</button>+ </div>`;++ slot.querySelector('.vs-remove').addEventListener('click', (e) => {+ e.stopPropagation();+ clearSketch();+ });+ slot.querySelector('.vs-retry').addEventListener('click', (e) => {+ e.stopPropagation();+ openSketchPicker();+ });+ slot.addEventListener('click', () => {+ if (sketch.state === 'empty' || sketch.state === 'error') openSketchPicker();+ });+ slot.addEventListener('keydown', (e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ if (sketch.state === 'empty' || sketch.state === 'error') openSketchPicker();+ }+ });+ slot.addEventListener('dragover', (e) => {+ e.preventDefault();+ e.dataTransfer.dropEffect = 'copy';+ slot.classList.add('drop-target');+ });+ slot.addEventListener('dragleave', () => slot.classList.remove('drop-target'));+ slot.addEventListener('drop', (e) => {+ e.preventDefault();+ slot.classList.remove('drop-target');+ const file = e.dataTransfer.files?.[0];+ if (file) uploadSketch(file);+ });++ els.sketchGrid.appendChild(slot);+ renderSketchSlot();+}++function openSketchPicker() {+ if (!els.sketchFileInput) return;+ els.sketchFileInput.value = '';+ els.sketchFileInput.click();+}++function renderSketchSlot() {+ const el = sketchSlotEl();+ if (!el) return;+ el.dataset.state = sketch.state;+ const img = el.querySelector('.vs-thumb');+ if (sketch.objectUrl) {+ img.src = sketch.objectUrl;+ img.alt = 'Your sketch';+ } else {+ img.removeAttribute('src');+ img.alt = '';+ }+ el.querySelector('.vs-error-msg').textContent = sketch.errorMsg || 'Upload failed';+ const labels = {+ empty: 'Sketch, empty — add a drawing',+ uploading: 'Sketch, uploading',+ uploaded: 'Sketch, uploaded',+ error: 'Sketch, upload failed',+ };+ el.setAttribute('aria-label', labels[sketch.state] || 'Sketch');+}++function clearSketch() {+ if (sketch.objectUrl) URL.revokeObjectURL(sketch.objectUrl);+ Object.assign(sketch, { state: 'empty', url: null, objectUrl: null, errorMsg: '' });+ renderSketchSlot();+}++async function uploadSketch(file) {+ if (!ACCEPTED_TYPES.has(file.type)) {+ Object.assign(sketch, { state: 'error', url: null, errorMsg: 'Use PNG, JPG, or WebP.' });+ renderSketchSlot();+ return;+ }+ if (file.size > MAX_UPLOAD_BYTES) {+ Object.assign(sketch, { state: 'error', url: null, errorMsg: 'Too large (max 8 MB).' });+ renderSketchSlot();+ return;+ }+ if (sketch.objectUrl) URL.revokeObjectURL(sketch.objectUrl);+ Object.assign(sketch, {+ state: 'uploading',+ url: null,+ objectUrl: URL.createObjectURL(file),+ errorMsg: '',+ });+ renderSketchSlot();++ const up = await presignAndPut(file);+ if (up.ok) Object.assign(sketch, { state: 'uploaded', url: up.url, errorMsg: '' });+ else Object.assign(sketch, { state: 'error', url: null, errorMsg: up.message });+ renderSketchSlot();+}+function firstPreviewUrl() {const s = slots.find((x) => x.state === 'uploaded' && (x.objectUrl || x.url));return s ? s.objectUrl || s.url : null;@@ -755,6 +919,7 @@ function setViewsBadge(meta) {if (meta?.backend) parts.push(ENGINE_LABELS[meta.backend] || meta.backend);if (meta?.tier) parts.push(meta.tier);if (meta?.path === 'geometry') parts.push('geometry-first');+ if (meta?.path === 'sketch') parts.push('sketch→3D');if (parts.length === 0) {els.resultViews.classList.add('is-hidden');els.resultViews.textContent = '';@@ -869,7 +1034,8 @@ async function loadGallery() {prov.style.right = 'auto';prov.style.top = Number(c.views_used) > 1 ? '28px' : '6px';prov.textContent = [ENGINE_LABELS[c.backend] || c.backend, c.tier].filter(Boolean).join(' ');- prov.title = `${c.path === 'geometry' ? 'Geometry-first' : 'Image path'} · ${c.backend || ''} · ${c.tier || ''}`.trim();+ prov.title =+ `${c.path === 'geometry' ? 'Geometry-first' : c.path === 'sketch' ? 'Sketch→3D' : 'Image path'} · ${c.backend || ''} · ${c.tier || ''}`.trim();card.appendChild(prov);}@@ -954,10 +1120,25 @@ async function run(cfg) {const isImage = Array.isArray(cfg.imageUrls) && cfg.imageUrls.length > 0;const isGeometry = selectedEngine.path === 'geometry';+ const isSketch = selectedEngine.path === 'sketch';const meshLabel = `Generating ${selectedTier} mesh`;// Reset the generating panel to its real starting state for this run.- if (isImage) {+ if (isSketch) {+ // The drawing IS the reference — no synthesis step, straight to geometry.+ setStepLabel('image', 'Sketch uploaded');+ setStepLabel('mesh', `Generating ${selectedTier} geometry from the sketch`);+ setStep('image', 'done');+ setStep('mesh', 'active');+ const preview = sketch.objectUrl || sketch.url;+ els.genPreview.innerHTML = preview ? '' : '<div class="shimmer" aria-hidden="true"></div>';+ if (preview) {+ const img = new Image();+ img.alt = 'Your sketch';+ img.src = preview;+ els.genPreview.appendChild(img);+ }+ } else if (isImage) {const n = cfg.imageUrls.length;setStepLabel('image', `Conditioning on ${n} ${n === 1 ? 'view' : 'views'}`);setStepLabel('mesh', isGeometry ? meshLabel : 'Reconstructing textured mesh');@@ -1079,6 +1260,31 @@ function submit() {return;}+ // Sketch mode — one drawing + a required prompt naming what it depicts.+ if (mode === 'sketch') {+ if (sketch.state === 'uploading') {+ els.generateLabel.textContent = 'Waiting for upload…';+ setTimeout(() => {+ if (!els.generate.disabled) els.generateLabel.textContent = 'Generate';+ }, 1600);+ return;+ }+ if (sketch.state !== 'uploaded' || !sketch.url) {+ const slot = sketchSlotEl();+ slot?.focus();+ slot?.classList.add('drop-target');+ setTimeout(() => slot?.classList.remove('drop-target'), 600);+ return;+ }+ const prompt = els.sketchPrompt.value.trim();+ if (prompt.length < 3) {+ els.sketchPrompt.focus();+ return;+ }+ run({ prompt, imageUrls: [sketch.url] });+ return;+ }+// Image / multi-view mode.if (slots.some((s) => s.state === 'uploading')) {els.generateLabel.textContent = 'Waiting for uploads…';@@ -1127,6 +1333,13 @@ function submitOnModifierEnter(e) {}els.prompt.addEventListener('keydown', submitOnModifierEnter);els.imagePrompt.addEventListener('keydown', submitOnModifierEnter);+els.sketchPrompt?.addEventListener('keydown', submitOnModifierEnter);++els.sketchFileInput?.addEventListener('change', () => {+ const file = els.sketchFileInput.files?.[0];+ if (file) uploadSketch(file);+ els.sketchFileInput.value = '';+});els.aspect.addEventListener('click', (e) => {const btn = e.target.closest('button[data-aspect]');@@ -1175,6 +1388,8 @@ els.again.addEventListener('click', () => {if (mode === 'text') {els.prompt.focus();els.prompt.select();+ } else if (mode === 'sketch') {+ (sketch.state === 'uploaded' ? els.sketchPrompt : sketchSlotEl())?.focus();} else {slotEl(0)?.focus();}diff --git a/src/scene-studio/main.js b/src/scene-studio/main.jsindex 4486974ad..1058abbb9 100644--- a/src/scene-studio/main.js+++ b/src/scene-studio/main.js@@ -6,6 +6,10 @@import './vendor/css/main.css';import './studio.css';+// Dark-locked surface: the injected site theme boot honors the user's saved+// theme, but the studio chrome (vendor css + studio.css) only ships dark.+document.documentElement.setAttribute('data-theme', 'dark');+import * as THREE from 'three';import { Editor } from './vendor/js/Editor.js';diff --git a/workers/deploy/deploy-all.sh b/workers/deploy/deploy-all.shindex dba293854..42513b13f 100755--- a/workers/deploy/deploy-all.sh+++ b/workers/deploy/deploy-all.sh@@ -47,9 +47,9 @@ command -v gcloud >/dev/null 2>&1 || die "gcloud not found on PATH"gcloud auth print-access-token >/dev/null 2>&1 || die "gcloud is not authenticated — run 'gcloud auth login'"# service key -> "worker_dir|cloud_run_service|controller_env_var"-svc_dir() { case "$1" in hunyuan3d) echo model-hunyuan3d;; trellis) echo model-trellis;; triposr) echo model-triposr;; unirig) echo unirig;; *) echo "";; esac; }-svc_runname() { case "$1" in hunyuan3d) echo model-hunyuan3d;; trellis) echo model-trellis;; triposr) echo model-triposr;; unirig) echo unirig;; *) echo "";; esac; }-svc_ctrlenv() { case "$1" in hunyuan3d) echo MODEL_HUNYUAN3D_URL;; trellis) echo MODEL_TRELLIS_URL;; triposr) echo MODEL_TRIPOSR_URL;; unirig) echo UNIRIG_URL;; *) echo "";; esac; }+svc_dir() { case "$1" in hunyuan3d) echo model-hunyuan3d;; trellis) echo model-trellis;; triposr) echo model-triposr;; triposg) echo model-triposg;; unirig) echo unirig;; *) echo "";; esac; }+svc_runname() { case "$1" in hunyuan3d) echo model-hunyuan3d;; trellis) echo model-trellis;; triposr) echo model-triposr;; triposg) echo model-triposg;; unirig) echo unirig;; *) echo "";; esac; }+svc_ctrlenv() { case "$1" in hunyuan3d) echo MODEL_HUNYUAN3D_URL;; trellis) echo MODEL_TRELLIS_URL;; triposr) echo MODEL_TRIPOSR_URL;; triposg) echo MODEL_TRIPOSG_URL;; unirig) echo UNIRIG_URL;; *) echo "";; esac; }TAG="$(git rev-parse --short HEAD 2>/dev/null || echo manual)"@@ -151,7 +151,7 @@ build_and_deploy() {}for svc in $SERVICES; do- [ -n "$(svc_dir "$svc")" ] || die "unknown service '$svc' (valid: hunyuan3d trellis triposr unirig)"+ [ -n "$(svc_dir "$svc")" ] || die "unknown service '$svc' (valid: hunyuan3d trellis triposr triposg unirig)"build_and_deploy "$svc"donediff --git a/workers/deploy/stage-weights.sh b/workers/deploy/stage-weights.shindex 3cb907778..927cb8f1e 100755--- a/workers/deploy/stage-weights.sh+++ b/workers/deploy/stage-weights.sh@@ -15,7 +15,7 @@# box with ~80 GB free disk (e.g. a GCE VM).## Usage (Cloud Shell, full fleet):-# HF_TOKEN=hf_xxx SERVICES="hunyuan3d trellis triposr unirig" ./stage-weights.sh+# HF_TOKEN=hf_xxx SERVICES="hunyuan3d trellis triposr triposg unirig" ./stage-weights.sh## Env:# WEIGHTS_BUCKET GCS bucket name (default: three-ws-model-weights)@@ -36,11 +36,15 @@ STAGE_DIR="${STAGE_DIR:-/tmp/three-ws-weights}"FORCE="${FORCE:-0}"# service -> "hf_repo|bucket_subdir" (sources documented in each worker's main.py)+# `triposg` is three repos: the image pipeline, the scribble (sketch→3D)+# pipeline, and RMBG-1.4 for its image-mode background removal — stage_one+# handles the multi-repo case.weight_source() {case "$1" inhunyuan3d) echo "tencent/Hunyuan3D-2.1|hunyuan3d-2.1" ;;trellis) echo "microsoft/TRELLIS-image-large|trellis-large" ;;triposr) echo "stabilityai/TripoSR|triposr" ;;+ triposg) echo "VAST-AI/TripoSG|triposg VAST-AI/TripoSG-scribble|triposg-scribble briaai/RMBG-1.4|rmbg-1.4" ;;unirig) echo "VAST-AI/UniRig|unirig" ;;*) echo "" ;;esac@@ -94,10 +98,18 @@ if [ "$LOCAL_STAGE" != "1" ]; thenfistage_one() {- local svc="$1" src repo subdir dest target+ local svc="$1" src pairsrc="$(weight_source "$svc")"- [ -n "$src" ] || die "unknown service '$svc' (valid: hunyuan3d trellis triposr unirig)"- repo="${src%%|*}"; subdir="${src##*|}"+ [ -n "$src" ] || die "unknown service '$svc' (valid: hunyuan3d trellis triposr triposg unirig)"+ # A service may need several HF repos (triposg) — stage each pair.+ for pair in $src; do+ stage_repo "$svc" "$pair"+ done+}++stage_repo() {+ local svc="$1" repo subdir dest target+ repo="${2%%|*}"; subdir="${2##*|}"dest="gs://${WEIGHTS_BUCKET}/${subdir}"if [ "$FORCE" != "1" ] && gcloud storage ls "${dest}/" >/dev/null 2>&1; then