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
Add NVIDIA NIM forge backend and pages; refine MCP server manifests and rate limits
nirholas9a078939c377
diff --git a/.gitignore b/.gitignoreindex 8ef8550cc..a1c4dbbba 100644--- a/.gitignore+++ b/.gitignore@@ -271,3 +271,6 @@ src/embodiment/src/embody.jspages/embody.htmlapi/_lib/migrations/20260623170000_agent_bodies.sql++# MCP registry publisher auth token (never commit)+.mcp_publisher_tokendiff --git a/api/_lib/agent-trade-guards.js b/api/_lib/agent-trade-guards.jsindex 56ac4e28b..ba5d7a956 100644--- a/api/_lib/agent-trade-guards.js+++ b/api/_lib/agent-trade-guards.js@@ -441,6 +441,9 @@ export function tradeGuardResponse(blocked) {}export { LAMPORTS_PER_SOL };+// Re-export the policy-rules reader so routes can treat agent-trade-guards as the+// single barrel for spend/policy helpers (solana-wallet.js imports it from here).+export { getPolicyRules };/*** Sum the USD-equivalent of an agent's outbound spends over the trailing window.diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex c4015ae26..f073428c3 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -379,6 +379,10 @@ export const limits = {// keep that egress bounded. Non-critical: a Redis outage must never block a// rewrite (the enhancer degrades gracefully to the original prompt anyway).forgeEnhance: (key) => getLimiter('forge:enhance', { limit: 40, window: '1 h' }).limit(key),+ // Self-hosted TRELLIS NIM demo (api/forge-nim) — each call is one real+ // image/text→3D inference against the NIM, so cap per principal to keep that+ // GPU egress bounded. Non-critical: a Redis blip must never block the demo.+ forgeNim: (key) => getLimiter('forge:nim', { limit: 30, window: '1 h' }).limit(key),// Diorama composer (api/diorama action:compose) — one free-first LLM// completion per call that decomposes a sentence into a placed object set.// Paid upstream egress, so cap per IP and add a global hourly circuit breaker.diff --git a/api/forge-nim.js b/api/forge-nim.jsnew file mode 100644index 000000000..03f08631b--- /dev/null+++ b/api/forge-nim.js@@ -0,0 +1,342 @@+// POST /api/forge-nim — drive a SELF-HOSTED TRELLIS NIM directly.+//+// The demo page (/forge-nim) showcases the one contract a self-hosted NIM+// (nvcr.io/nim/microsoft/trellis, large:image) actually exposes:+//+// POST {baseUrl}/v1/infer+// { mode:"image"|"text", image|prompt, ss_sampling_steps,+// slat_sampling_steps, output_format:"glb", seed? }+// 200 { artifacts: [ { base64 } ] } ← GLB returned SYNCHRONOUSLY+//+// Unlike NVIDIA's hosted NVCF preview (text-only, async poll, rejects real+// photos), a self-host NIM reconstructs a textured GLB from a real reference+// image in a single hop and inlines it as base64. This endpoint is a thin,+// honest proxy: browsers can't POST cross-origin to a private NIM (CORS + the+// container's plain-HTTP API), so we forward server-side, normalize every+// documented artifact shape to base64, and hand the bytes straight back. The+// page decodes that base64 into a Blob and renders it — so the NIM's wire+// contract is visible end-to-end, no R2 round-trip, no mocks.+//+// GET /api/forge-nim?action=health → { configured, reachable, baseUrl }+//+// The NIM URL comes from MODEL_TRELLIS_URL; a request may override it (handy for+// pointing the demo at your own box), but the override is SSRF-guarded — only+// https hosts that don't resolve to private/loopback/link-local/metadata space,+// so this can never be turned into an internal-network probe.++import { cors, method, wrap, error, readJson, json } from './_lib/http.js';+import { limits, clientIp } from './_lib/rate-limit.js';+import { env } from './_lib/env.js';++const INFER_PATH = '/v1/infer';+const READY_PATH = '/v1/health/ready'; // NIM containers expose this by convention+const SUBMIT_TIMEOUT_MS = 120_000; // a cold large:image NIM can take a while on the first hit+const HEALTH_TIMEOUT_MS = 5_000;+const PROMPT_MAX = 77; // TRELLIS truncates beyond this; match the provider+const STYLE_SUFFIX = ', studio lighting';+const STYLE_WORDS = ['studio', 'light', 'bright', 'backlit', 'colorful', 'vibrant', 'cartoon', 'stylized'];+const MAX_IMAGE_BYTES = 10 * 1024 * 1024; // 10 MB decoded reference image ceiling+const MAX_BODY_BYTES = 16 * 1024 * 1024; // base64 inflates ~33%, plus JSON envelope++function trellisSteps(tier) {+ return tier === 'high' ? { ss: 40, slat: 40 } : { ss: 15, slat: 15 };+}++// Mirror the provider's prompt shaping so text-mode results look the same as the+// production forge lane: keep an already-styled prompt, else append a lighting+// cue, always inside TRELLIS's 77-char window.+function shapePrompt(raw) {+ const text = String(raw || '').trim();+ if (!text) return '';+ const lower = text.toLowerCase();+ if (STYLE_WORDS.some((w) => lower.includes(w))) return text.slice(0, PROMPT_MAX);+ return (text.slice(0, PROMPT_MAX - STYLE_SUFFIX.length) + STYLE_SUFFIX).slice(0, PROMPT_MAX);+}++// Block override URLs that point anywhere we don't host the NIM. Only https,+// never an IP literal in private/loopback/link-local space, never the cloud+// metadata host. The env-configured URL is exempt (it's operator-trusted and may+// legitimately be an internal address reachable only from the function).+function assertSafeBaseUrl(raw) {+ let u;+ try {+ u = new URL(raw);+ } catch {+ throw Object.assign(new Error('baseUrl must be a valid URL'), { status: 400, code: 'bad_base_url' });+ }+ if (u.protocol !== 'https:') {+ throw Object.assign(new Error('baseUrl must use https'), { status: 400, code: 'bad_base_url' });+ }+ const host = u.hostname.toLowerCase();+ const blockedHost =+ host === 'localhost' ||+ host === '0.0.0.0' ||+ host === 'metadata.google.internal' ||+ host.endsWith('.local') ||+ host.endsWith('.internal');+ if (blockedHost) {+ throw Object.assign(new Error('baseUrl host is not allowed'), { status: 400, code: 'bad_base_url' });+ }+ // IPv4 literal → reject private/loopback/link-local/CGNAT ranges.+ const m = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);+ if (m) {+ const [a, b] = [Number(m[1]), Number(m[2])];+ const isPrivate =+ a === 10 ||+ a === 127 ||+ (a === 169 && b === 254) ||+ (a === 172 && b >= 16 && b <= 31) ||+ (a === 192 && b === 168) ||+ (a === 100 && b >= 64 && b <= 127) ||+ a === 0;+ if (isPrivate) {+ throw Object.assign(new Error('baseUrl host is not allowed'), { status: 400, code: 'bad_base_url' });+ }+ }+ // Bare IPv6 literal — refuse; we can't cheaply classify every reserved range.+ if (host.includes(':')) {+ throw Object.assign(new Error('baseUrl host is not allowed'), { status: 400, code: 'bad_base_url' });+ }+ return u.origin;+}++// Resolve the NIM origin for this request. A caller-supplied baseUrl is SSRF+// guarded; absent that, fall back to the operator-configured MODEL_TRELLIS_URL.+function resolveBaseUrl(requested) {+ if (requested) return assertSafeBaseUrl(requested);+ const configured = env.MODEL_TRELLIS_URL || process.env.MODEL_TRELLIS_URL;+ if (!configured) {+ throw Object.assign(+ new Error(+ 'No self-hosted TRELLIS NIM is configured. Set MODEL_TRELLIS_URL on the deployment, or pass a baseUrl pointing at your own NIM (nvcr.io/nim/microsoft/trellis).',+ ),+ { status: 503, code: 'nim_unconfigured' },+ );+ }+ return configured.replace(/\/$/, '');+}++// Pull a real reference image into a data-uri the NIM accepts. Accept a data-uri+// the page already built (the common path — the dropzone reads the File locally),+// or fetch an http(s) URL. Bound the size so a huge upload can't blow the body.+async function toImageDataUri(image) {+ if (typeof image !== 'string' || !image) {+ throw Object.assign(new Error('image is required for image mode'), { status: 400, code: 'no_image' });+ }+ if (image.startsWith('data:')) {+ const comma = image.indexOf(',');+ const b64 = comma >= 0 ? image.slice(comma + 1) : '';+ if (Buffer.byteLength(b64, 'utf8') * 0.75 > MAX_IMAGE_BYTES) {+ throw Object.assign(new Error('reference image exceeds 10 MB'), { status: 413, code: 'image_too_large' });+ }+ return image;+ }+ if (/^https?:\/\//i.test(image)) {+ const res = await fetch(image, { signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS * 3) });+ if (!res.ok) {+ throw Object.assign(new Error(`could not fetch reference image (${res.status})`), {+ status: 502,+ code: 'image_fetch_failed',+ });+ }+ const ct = (res.headers.get('content-type') || 'image/png').split(';')[0].trim() || 'image/png';+ const buf = Buffer.from(await res.arrayBuffer());+ if (buf.length > MAX_IMAGE_BYTES) {+ throw Object.assign(new Error('reference image exceeds 10 MB'), { status: 413, code: 'image_too_large' });+ }+ return `data:${ct};base64,${buf.toString('base64')}`;+ }+ throw Object.assign(new Error('image must be a data: or http(s) URL'), { status: 400, code: 'bad_image' });+}++// Normalize every documented TRELLIS artifact shape to base64 GLB bytes. The+// canonical shape is { artifacts:[{ base64 }] }, but a NIM may inline under+// `data`, return a bare base64 string, serve the GLB from a URL artifact, or+// stream the raw bytes directly. Accept them all so the demo works against+// whatever build is deployed. Returns a Buffer or throws a clean boundary error.+async function extractGlb(res) {+ const ct = (res.headers.get('content-type') || '').toLowerCase();+ if (ct.includes('json')) {+ const data = await res.json().catch(() => null);+ const a0 = data?.artifacts?.[0];+ if (typeof a0 === 'string' && a0 && !a0.startsWith('http')) return Buffer.from(a0, 'base64');+ const inline = a0?.base64 ?? a0?.data ?? (typeof data?.output === 'string' ? data.output : null);+ if (typeof inline === 'string' && inline && !inline.startsWith('http')) return Buffer.from(inline, 'base64');+ const url = a0?.url ?? (typeof inline === 'string' && inline.startsWith('http') ? inline : null);+ if (url) {+ const r = await fetch(url, { signal: AbortSignal.timeout(SUBMIT_TIMEOUT_MS) });+ if (r.ok) return Buffer.from(await r.arrayBuffer());+ throw Object.assign(new Error(`artifact url fetch ${r.status}`), { status: 502, code: 'nim_bad_artifact' });+ }+ // Object with numeric-string keys: { artifacts: { "0": {…} } }+ const arts = data?.artifacts;+ if (arts && typeof arts === 'object' && !Array.isArray(arts)) {+ const v = arts['0'] ?? Object.values(arts)[0];+ const b64 = v?.base64 ?? (typeof v === 'string' && !v.startsWith('http') ? v : null);+ if (b64) return Buffer.from(b64, 'base64');+ }+ throw Object.assign(+ new Error(`NIM returned no GLB artifact (keys: ${JSON.stringify(Object.keys(data || {}))})`),+ { status: 502, code: 'nim_no_artifact' },+ );+ }+ if (ct.includes('gltf') || ct.includes('octet-stream') || ct.startsWith('model/') || ct.includes('binary')) {+ return Buffer.from(await res.arrayBuffer());+ }+ const snippet = (await res.text().catch(() => '')).slice(0, 160);+ throw Object.assign(new Error(`unexpected content-type from NIM: ${ct} — ${snippet}`), {+ status: 502,+ code: 'nim_bad_response',+ });+}++// GET ?action=health — surface whether a NIM is wired up and reachable so the+// page can show an honest status pill before the user spends a generation.+async function health(req, res) {+ let baseUrl;+ try {+ baseUrl = resolveBaseUrl((new URL(req.url, 'http://x').searchParams.get('baseUrl') || '').trim());+ } catch (err) {+ return json(res, 200, {+ configured: false,+ reachable: false,+ reason: err.message,+ });+ }+ let reachable = false;+ let detail = null;+ try {+ const key = env.NVIDIA_API_KEY || process.env.NVIDIA_API_KEY;+ const r = await fetch(`${baseUrl}${READY_PATH}`, {+ headers: key ? { authorization: `Bearer ${key}` } : {},+ signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS),+ });+ reachable = r.ok;+ if (!r.ok) detail = `ready check returned ${r.status}`;+ } catch (err) {+ detail = err?.name === 'TimeoutError' ? 'ready check timed out' : `unreachable: ${err?.message || err}`;+ }+ return json(res, 200, {+ configured: true,+ reachable,+ baseUrl: maskUrl(baseUrl),+ endpoint: `${maskUrl(baseUrl)}${INFER_PATH}`,+ detail,+ });+}++// Show the host but hide any credential/path noise — enough for the operator to+// confirm which box they're hitting without leaking a token in a query string.+function maskUrl(u) {+ try {+ const url = new URL(u);+ return `${url.protocol}//${url.host}`;+ } catch {+ return u;+ }+}++async function infer(req, res) {+ const rl = await limits.forgeNim(clientIp(req));+ if (!rl.success) {+ return error(res, 429, 'rate_limited', 'Too many NIM generations — wait a moment and try again.');+ }++ const body = await readJson(req, MAX_BODY_BYTES);+ const mode = body?.mode === 'text' ? 'text' : 'image';+ const tier = body?.tier === 'high' ? 'high' : 'draft';+ const seed = Number.isInteger(body?.seed) ? body.seed : null;+ const baseUrl = resolveBaseUrl(typeof body?.baseUrl === 'string' ? body.baseUrl.trim() : '');+ const steps = trellisSteps(tier);++ let payload;+ if (mode === 'text') {+ const prompt = shapePrompt(body?.prompt);+ if (!prompt) return error(res, 400, 'no_prompt', 'Describe the object in a few words first.');+ payload = {+ mode: 'text',+ prompt,+ ss_sampling_steps: steps.ss,+ slat_sampling_steps: steps.slat,+ output_format: 'glb',+ };+ } else {+ const imageDataUri = await toImageDataUri(body?.image || body?.imageUrl);+ payload = {+ mode: 'image',+ image: imageDataUri,+ ss_sampling_steps: steps.ss,+ slat_sampling_steps: steps.slat,+ output_format: 'glb',+ };+ }+ if (seed !== null) payload.seed = seed;++ const key = env.NVIDIA_API_KEY || process.env.NVIDIA_API_KEY;+ const t0 = Date.now();+ let upstream;+ try {+ upstream = await fetch(`${baseUrl}${INFER_PATH}`, {+ method: 'POST',+ headers: {+ ...(key ? { authorization: `Bearer ${key}` } : {}),+ accept: 'application/json',+ 'content-type': 'application/json',+ },+ body: JSON.stringify(payload),+ signal: AbortSignal.timeout(SUBMIT_TIMEOUT_MS),+ });+ } catch (err) {+ const timedOut = err?.name === 'TimeoutError' || err?.name === 'AbortError';+ return error(+ res,+ timedOut ? 504 : 502,+ timedOut ? 'nim_timeout' : 'nim_unreachable',+ timedOut+ ? 'The NIM did not respond in time — a large:image build can be slow on a cold start. Try again.'+ : `Could not reach the NIM: ${err?.message || err}`,+ );+ }++ if (!upstream.ok) {+ const detail = (await upstream.text().catch(() => '')).slice(0, 300);+ if (upstream.status === 401 || upstream.status === 403) {+ return error(res, 502, 'nim_auth', 'The NIM rejected the request (auth). Check NVIDIA_API_KEY or the gateway.');+ }+ return error(res, 502, 'nim_error', `NIM /v1/infer returned ${upstream.status}${detail ? `: ${detail}` : ''}`);+ }++ let glb;+ try {+ glb = await extractGlb(upstream);+ } catch (err) {+ return error(res, err.status || 502, err.code || 'nim_bad_response', err.message);+ }+ if (!glb || glb.length === 0) {+ return error(res, 502, 'nim_empty', 'The NIM returned an empty GLB.');+ }++ const ms = Date.now() - t0;+ return json(res, 200, {+ ok: true,+ mode,+ tier,+ contract: 'artifacts[0].base64',+ endpoint: `${maskUrl(baseUrl)}${INFER_PATH}`,+ bytes: glb.length,+ ms,+ glb_base64: glb.toString('base64'),+ });+}++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;++ const url = new URL(req.url, 'http://x');+ if (req.method === 'GET') {+ if ((url.searchParams.get('action') || '').trim() === 'health') return health(req, res);+ return error(res, 400, 'bad_action', 'Use ?action=health, or POST to generate.');+ }+ if (!method(req, res, ['POST', 'GET'])) return;+ return infer(req, res);+});diff --git a/api/nim-forge.js b/api/nim-forge.jsnew file mode 100644index 000000000..b3cc8d07e--- /dev/null+++ b/api/nim-forge.js@@ -0,0 +1,169 @@+// Isolated NIM TRELLIS demo endpoint — talks DIRECTLY to a self-hosted Microsoft+// TRELLIS NIM (nvcr.io/nim/microsoft/trellis, large:image) at /v1/infer, which+// accepts REAL user images and returns the GLB synchronously as+// { artifacts:[{ base64 }] }. This is fully standalone: it shares NO routing,+// state, or env with the production /forge pipeline, so the live demo can never+// affect production. The NIM URL + optional bearer live server-side and are never+// exposed to the browser.+//+// GET /api/nim-forge → { configured } readiness (no secrets leaked)+// POST /api/nim-forge { image } → { glb_base64, bytes, ms } (image→3D)+// POST /api/nim-forge { prompt } → { glb_base64, bytes, ms } (text→3D)+//+// The hosted NVIDIA preview rejects real images (only its 4 sample example_ids,+// verified live) — so this demo only works against a self-hosted NIM. Point+// NIM_TRELLIS_URL (or MODEL_TRELLIS_URL) at it.++import { wrap, cors, json, method, readJson } from './_lib/http.js';++const NIM_URL = process.env.NIM_TRELLIS_URL || process.env.MODEL_TRELLIS_URL || '';+const NIM_KEY = process.env.NIM_TRELLIS_KEY || process.env.NVIDIA_API_KEY || '';++// A self-host NIM reconstructs in ~15–45 s on an L4; give the synchronous call+// generous headroom under the function's max duration.+const INFER_TIMEOUT_MS = 110_000;++// TRELLIS accepts 10–50 sampling steps. A self-hosted NIM serves the full window+// (unlike the hosted preview, which only completes at the low end), so the tiers+// scale real fidelity here.+function stepsForTier(tier) {+ switch (tier) {+ case 'high':+ return 40;+ case 'standard':+ return 25;+ case 'draft':+ default:+ return 15;+ }+}++// Normalize every GLB artifact shape a TRELLIS NIM can return into raw bytes:+// { artifacts:[{base64}] } (documented), { data }, a bare base64 string, a CDN+// { url } (fetched here), an object with numeric-string keys, or raw model bytes+// when the gateway ignores Accept.+async function extractGlb(res) {+ const ct = (res.headers.get('content-type') || '').toLowerCase();+ if (ct.includes('json')) {+ const data = await res.json().catch(() => null);+ const a0 = data?.artifacts?.[0];+ if (typeof a0 === 'string' && a0 && !a0.startsWith('http')) return Buffer.from(a0, 'base64');+ const inline = a0?.base64 ?? a0?.data ?? (typeof data?.output === 'string' ? data.output : null);+ if (typeof inline === 'string' && inline && !inline.startsWith('http')) return Buffer.from(inline, 'base64');+ const url = a0?.url ?? (typeof inline === 'string' && inline.startsWith('http') ? inline : null);+ if (url) {+ const r = await fetch(url, { signal: AbortSignal.timeout(INFER_TIMEOUT_MS) });+ if (r.ok) return Buffer.from(await r.arrayBuffer());+ throw Object.assign(new Error(`artifact url fetch ${r.status}`), { status: 502 });+ }+ const arts = data?.artifacts;+ if (arts && typeof arts === 'object' && !Array.isArray(arts)) {+ const v = arts['0'] ?? Object.values(arts)[0];+ const b64 = v?.base64 ?? (typeof v === 'string' && !v.startsWith('http') ? v : null);+ if (b64) return Buffer.from(b64, 'base64');+ }+ throw Object.assign(+ new Error(`no GLB in response: keys=${JSON.stringify(Object.keys(data || {}))}`),+ { status: 502 },+ );+ }+ if (ct.includes('gltf') || ct.includes('octet-stream') || ct.startsWith('model/') || ct.includes('binary')) {+ return Buffer.from(await res.arrayBuffer());+ }+ const t = await res.text().catch(() => '');+ throw Object.assign(new Error(`unexpected content-type ${ct || 'none'}: ${t.slice(0, 160)}`), { status: 502 });+}++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;++ // Readiness probe — the page calls this on load to show a configured/offline+ // badge. Never reveals the URL or key.+ if (req.method === 'GET') {+ return json(res, 200, { configured: Boolean(NIM_URL), endpoint: '/v1/infer' });+ }+ if (!method(req, res, ['GET', 'POST'])) return;++ if (!NIM_URL) {+ return json(res, 503, {+ error: 'unconfigured',+ message:+ 'Self-hosted TRELLIS NIM is not configured. Set NIM_TRELLIS_URL (or MODEL_TRELLIS_URL) to your NIM base URL.',+ });+ }++ // Up to ~12 MB so a base64 image comfortably fits; the page downscales before+ // upload, so real payloads are far smaller.+ const body = await readJson(req, 12_000_000).catch(() => null);+ if (!body) return json(res, 400, { error: 'bad_request', message: 'JSON body required.' });++ const image = typeof body.image === 'string' ? body.image.trim() : '';+ const prompt = typeof body.prompt === 'string' ? body.prompt.trim() : '';+ const tier = typeof body.tier === 'string' ? body.tier : 'standard';+ const seed = Number.isInteger(body.seed) ? body.seed : 0;+ const steps = stepsForTier(tier);++ if (!image && !prompt) {+ return json(res, 400, { error: 'bad_request', message: 'Provide an image (data-uri) or a prompt.' });+ }+ if (image && !/^data:image\/[a-z0-9.+-]+;base64,/i.test(image)) {+ return json(res, 400, { error: 'bad_image', message: 'image must be a base64 data-uri.' });+ }++ const payload = image+ ? { mode: 'image', image, ss_sampling_steps: steps, slat_sampling_steps: steps, output_format: 'glb', seed }+ : { mode: 'text', prompt, ss_sampling_steps: steps, slat_sampling_steps: steps, output_format: 'glb', seed };++ const url = `${NIM_URL.replace(/\/$/, '')}/v1/infer`;+ const headers = { 'content-type': 'application/json', accept: 'application/json' };+ if (NIM_KEY) headers.authorization = `Bearer ${NIM_KEY}`;++ const t0 = Date.now();+ let upstream;+ try {+ upstream = await fetch(url, {+ method: 'POST',+ headers,+ body: JSON.stringify(payload),+ signal: AbortSignal.timeout(INFER_TIMEOUT_MS),+ });+ } catch (err) {+ return json(res, 502, { error: 'nim_unreachable', message: `Could not reach the NIM: ${err?.message || err}` });+ }++ if (!upstream.ok) {+ let detail = '';+ try {+ const d = await upstream.json();+ detail = d?.detail || d?.message || d;+ } catch {+ detail = (await upstream.text().catch(() => '')).slice(0, 300);+ }+ if (detail && typeof detail !== 'string') detail = JSON.stringify(detail);+ return json(res, 502, {+ error: 'nim_error',+ upstream_status: upstream.status,+ message: detail || `NIM returned ${upstream.status}`,+ });+ }++ let glb;+ try {+ glb = await extractGlb(upstream);+ } catch (err) {+ return json(res, err.status || 502, { error: 'nim_no_glb', message: err.message });+ }+ if (!glb?.length) return json(res, 502, { error: 'nim_no_glb', message: 'NIM returned an empty model.' });++ return json(res, 200, {+ glb_base64: glb.toString('base64'),+ bytes: glb.length,+ ms: Date.now() - t0,+ mode: image ? 'image_to_3d' : 'text_to_3d',+ steps,+ });+});++// Self-host reconstruction is synchronous and can run tens of seconds; give the+// function room beyond the default so a real generation completes inline.+export const config = { maxDuration: 300 };diff --git a/packages/intel-mcp/server.json b/packages/intel-mcp/server.jsonindex fa45fb3e5..57ffd5bc0 100644--- a/packages/intel-mcp/server.json+++ b/packages/intel-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/intel-mcp","title": "three.ws Intel",- "description": "Read the market the way the smart money does — coin smart-money scores, wallet reputation, signal feeds, KOL leaderboards/trades, and the copy-trade Smart Money directory.",+ "description": "Coin smart-money scores, wallet reputation, signal feeds, and KOL leaderboards.","websiteUrl": "https://three.ws","icons": [{diff --git a/packages/marketplace-mcp/server.json b/packages/marketplace-mcp/server.jsonindex da9deb262..64f6a24da 100644--- a/packages/marketplace-mcp/server.json+++ b/packages/marketplace-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/marketplace-mcp","title": "three.ws Marketplace",- "description": "Browse and discover the public three.ws agent marketplace and skills catalog — search, page, and inspect agents and skills. Read-only.",+ "description": "Browse and discover the public three.ws agent marketplace and skills catalog. Read-only.","websiteUrl": "https://three.ws","icons": [{diff --git a/packages/naming-mcp/server.json b/packages/naming-mcp/server.jsonindex 85f503bed..7989fc0d6 100644--- a/packages/naming-mcp/server.json+++ b/packages/naming-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/naming-mcp","title": "three.ws Naming",- "description": "The on-chain identity layer for AI agents — resolve Solana .sol names, reverse-lookup wallets, and check whether a *.threews.sol agent handle is free to claim.",+ "description": "On-chain identity for AI agents: resolve .sol names, reverse-lookup wallets, check handles.","websiteUrl": "https://three.ws","icons": [{diff --git a/packages/scene-mcp/server.json b/packages/scene-mcp/server.jsonindex 2b4000f4f..fd15ad961 100644--- a/packages/scene-mcp/server.json+++ b/packages/scene-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/scene-mcp","title": "three.ws Scenes",- "description": "Speak 3D worlds into being — compose a placed diorama plan from one sentence, then browse the saved gallery.",+ "description": "Compose a placed 3D diorama from one sentence, then browse the saved scene gallery.","websiteUrl": "https://three.ws","icons": [{diff --git a/packages/vanity-mcp/server.json b/packages/vanity-mcp/server.jsonindex 7f91f74c3..11361b3c5 100644--- a/packages/vanity-mcp/server.json+++ b/packages/vanity-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/vanity-mcp","title": "three.ws Vanity",- "description": "Read the three.ws vanity-address grind-bounty market — quote a pattern's difficulty + USDC price, appraise any address's rarity, and browse the board, claimable queue, leaderboard, and proof-of-grind gallery.",+ "description": "Read the three.ws vanity-address market: quote difficulty + USDC price, browse the board.","websiteUrl": "https://three.ws","icons": [{diff --git a/packages/x402-mcp/server.json b/packages/x402-mcp/server.jsonindex 95ea7346f..15bf8f7c9 100644--- a/packages/x402-mcp/server.json+++ b/packages/x402-mcp/server.json@@ -2,7 +2,7 @@"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json","name": "io.github.nirholas/x402-mcp","title": "x402 Wallet",- "description": "A self-custodial x402 wallet for AI agents — discover, inspect, and pay any x402 service in USDC from your own Solana key.",+ "description": "Self-custodial x402 wallet for AI agents: discover, inspect, and pay any x402 service in USDC.","websiteUrl": "https://three.ws","icons": [{diff --git a/pages/agi.html b/pages/agi.htmlindex f5f637daf..fba0829e0 100644--- a/pages/agi.html+++ b/pages/agi.html@@ -17,7 +17,7 @@property="og:description"content="Artificial general intelligence in a single domain: pump.fun memecoin trading. It reads launches, the wallet graph, and order flow faster than any human — then sizes, enters, and exits on its own. Outside that domain it claims nothing."/>- <meta property="og:image" content="https://three.ws/og-image.png" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=The+AGI+%E2%80%94+narrow+by+design&d=The+first+AGI%2C+narrow+by+design%3A+a+single+autonomous+agent+that+is+genuinely+superhuman+at+one+thing+%E2%80%94+trading+memecoins+on+pump.fun+%28Solana%29+%E2%80%94+and+deliberately&p=%2Fagi" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="630" /><meta name="twitter:card" content="summary_large_image" />@@ -34,7 +34,13 @@<link rel="stylesheet" href="/footer.css" /><meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" /><link rel="canonical" href="https://three.ws/agi" />- </head>++ <meta property="og:locale" content="en_US">+ <meta property="og:image:alt" content="The AGI — narrow by design — three.ws">+ <meta name="twitter:description" content="The first AGI, narrow by design: a single autonomous agent that is genuinely superhuman at one thing — trading memecoins on pump.fun (Solana) — and deliberately nothing else. Watch its embodied 3D body react to the market in real time, read every decision it makes with its stated confidence, and hold it to a chain-proven track record. Outside that one domain, it claims nothing.">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=The+AGI+%E2%80%94+narrow+by+design&d=The+first+AGI%2C+narrow+by+design%3A+a+single+autonomous+agent+that+is+genuinely+superhuman+at+one+thing+%E2%80%94+trading+memecoins+on+pump.fun+%28Solana%29+%E2%80%94+and+deliberately&p=%2Fagi">+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"The AGI — narrow by design","description":"The first AGI, narrow by design: a single autonomous agent that is genuinely superhuman at one thing — trading memecoins on pump.fun (Solana) — and deliberately nothing else. Watch its embodied 3D body react to the market in real time, read every decision it makes with its stated confidence, and hold it to a chain-proven track record. Outside that one domain, it claims nothing.","url":"https://three.ws/agi","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=The+AGI+%E2%80%94+narrow+by+design&d=The+first+AGI%2C+narrow+by+design%3A+a+single+autonomous+agent+that+is+genuinely+superhuman+at+one+thing+%E2%80%94+trading+memecoins+on+pump.fun+%28Solana%29+%E2%80%94+and+deliberately&p=%2Fagi"}]}</script>+</head><body><header><div id="nav-container"></div></header><script src="/nav.js"></script>diff --git a/pages/ca2x402.html b/pages/ca2x402.htmlindex b29f0b2a2..d03db988d 100644--- a/pages/ca2x402.html+++ b/pages/ca2x402.html@@ -17,7 +17,7 @@property="og:description"content="Turn any contract address into a payable x402 service. Paste a CA → get a live endpoint other agents can pay to query, with copy-paste call snippets and the live 402 challenge."/>- <meta property="og:image" content="https://three.ws/og-image.png" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=build&t=CA+%E2%86%92+x402&d=Paste+any+token+contract+address+and+get+a+live%2C+agent-payable+x402+endpoint+for+its+market+intel+%E2%80%94+price%2C+momentum%2C+and+a+bullish%2Fbearish+signal+%E2%80%94+for+%240.01+US&p=%2Fca2x402" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="630" /><meta name="twitter:card" content="summary_large_image" />@@ -34,7 +34,13 @@<link rel="stylesheet" href="/footer.css" /><meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" /><link rel="canonical" href="https://three.ws/ca2x402" />- </head>++ <meta property="og:locale" content="en_US">+ <meta property="og:image:alt" content="CA → x402 — three.ws">+ <meta name="twitter:description" content="Paste any token contract address and get a live, agent-payable x402 endpoint for its market intel — price, momentum, and a bullish/bearish signal — for $0.01 USDC, discoverable in the x402 bazaar.">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=CA+%E2%86%92+x402&d=Paste+any+token+contract+address+and+get+a+live%2C+agent-payable+x402+endpoint+for+its+market+intel+%E2%80%94+price%2C+momentum%2C+and+a+bullish%2Fbearish+signal+%E2%80%94+for+%240.01+US&p=%2Fca2x402">+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"CA → x402","description":"Paste any token contract address and get a live, agent-payable x402 endpoint for its market intel — price, momentum, and a bullish/bearish signal — for $0.01 USDC, discoverable in the x402 bazaar.","url":"https://three.ws/ca2x402","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=build&t=CA+%E2%86%92+x402&d=Paste+any+token+contract+address+and+get+a+live%2C+agent-payable+x402+endpoint+for+its+market+intel+%E2%80%94+price%2C+momentum%2C+and+a+bullish%2Fbearish+signal+%E2%80%94+for+%240.01+US&p=%2Fca2x402"}]}</script>+</head><body><header><div id="nav-container"></div></header><script src="/nav.js"></script>diff --git a/pages/forge-nim.html b/pages/forge-nim.htmlnew file mode 100644index 000000000..006848c40--- /dev/null+++ b/pages/forge-nim.html@@ -0,0 +1,1094 @@+<!doctype html>+<html lang="en">+ <head>+ <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>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Forge · NIM Self-Host · Image → 3D · three.ws</title>+ <meta+ name="description"+ content="Drive a self-hosted TRELLIS NIM (nvcr.io/nim/microsoft/trellis) directly. Drop a photo, hit /v1/infer, and get the GLB back synchronously as base64 — rendered live, downloadable."+ />+ <meta property="og:title" content="Forge — Self-Hosted NIM · Image → 3D · three.ws" />+ <meta+ property="og:description"+ content="A forge-styled demo for a self-hosted TRELLIS NIM. Real photo in, synchronous GLB out of /v1/infer. No async poll, no mocks."+ />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/forge-nim" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=build&t=Forge+%E2%80%94+Self-Hosted+NIM&d=Drop+a+photo%2C+hit+%2Fv1%2Finfer%2C+get+the+GLB+back+synchronously+from+a+self-hosted+TRELLIS+NIM.&p=%2Fforge-nim" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Forge · NIM Self-Host · Image → 3D · three.ws" />+ <meta+ name="twitter:description"+ content="Drive a self-hosted TRELLIS NIM directly: photo in, synchronous GLB out of /v1/infer."+ />+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=Forge+%E2%80%94+Self-Hosted+NIM&d=Drop+a+photo%2C+hit+%2Fv1%2Finfer%2C+get+the+GLB+back+synchronously+from+a+self-hosted+TRELLIS+NIM.&p=%2Fforge-nim" />+ <meta name="theme-color" content="#080814" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/site.webmanifest" />+ <link rel="canonical" href="https://three.ws/forge-nim" />+ <link rel="stylesheet" href="/style.css" />+ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw"+ crossorigin="anonymous"+ ></script>+ <style>+ .forge-main {+ max-width: none;+ margin: 0;+ padding: var(--space-md) clamp(var(--space-md), 4vw, var(--space-2xl)) var(--space-2xl);+ }+ .forge-head {+ display: flex;+ align-items: baseline;+ flex-wrap: wrap;+ gap: var(--space-md);+ height: auto;+ padding: 0 0 var(--space-md);+ background: none;+ backdrop-filter: none;+ -webkit-backdrop-filter: none;+ border-bottom: 1px solid var(--stroke);+ overflow: visible;+ white-space: normal;+ line-height: var(--leading-normal);+ margin-bottom: var(--space-lg);+ }+ .forge-head h1 {+ font-family: var(--font-display);+ font-size: var(--text-xl);+ line-height: 1;+ margin: 0;+ color: var(--ink);+ flex: none;+ }+ .forge-head .nvbadge {+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: #76b900;+ border: 1px solid rgba(118, 185, 0, 0.4);+ background: rgba(118, 185, 0, 0.08);+ border-radius: 999px;+ padding: 0.15rem 0.55rem;+ align-self: center;+ }+ .forge-head p {+ color: var(--ink-dim);+ font-size: var(--text-sm);+ margin: 0;+ line-height: var(--leading-normal);+ flex: 1 1 320px;+ min-width: 0;+ }++ /* Health pill ------------------------------------------------- */+ .nim-status {+ display: inline-flex;+ align-items: center;+ gap: 0.5rem;+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ color: var(--ink-dim);+ border: 1px solid var(--stroke);+ border-radius: 999px;+ padding: 0.3rem 0.7rem;+ background: var(--surface-1);+ align-self: center;+ }+ .nim-status .dot {+ width: 0.55rem;+ height: 0.55rem;+ border-radius: 50%;+ background: var(--ink-dim);+ box-shadow: 0 0 0 0 rgba(118, 185, 0, 0.5);+ transition: background 0.2s;+ }+ .nim-status[data-state='live'] .dot {+ background: #76b900;+ box-shadow: 0 0 10px rgba(118, 185, 0, 0.7);+ }+ .nim-status[data-state='down'] .dot {+ background: var(--warning, #e0a93e);+ }+ .nim-status[data-state='off'] .dot {+ background: var(--ink-faint, #555);+ }++ /* Workspace --------------------------------------------------- */+ .forge-workspace {+ display: grid;+ grid-template-columns: minmax(0, 1fr);+ gap: var(--space-lg);+ align-items: start;+ }+ @media (min-width: 1080px) {+ .forge-workspace {+ grid-template-columns: minmax(380px, 440px) minmax(0, 1fr);+ gap: var(--space-xl);+ }+ .forge-rail {+ position: sticky;+ top: 84px;+ }+ }+ .forge-stage {+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: var(--space-lg);+ }++ /* Composer ---------------------------------------------------- */+ .composer {+ background: var(--surface-glass);+ border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-lg);+ padding: var(--space-md);+ box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);+ display: flex;+ flex-direction: column;+ gap: var(--space-md);+ }+ .mode-switch {+ display: inline-flex;+ gap: 2px;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ padding: 2px;+ width: 100%;+ }+ .mode-switch button {+ flex: 1;+ background: transparent;+ border: none;+ color: var(--ink-dim);+ font-family: var(--font-display);+ font-weight: 600;+ font-size: var(--text-sm);+ padding: 0.5rem 0.6rem;+ border-radius: var(--radius-sm);+ cursor: pointer;+ transition: background 0.15s, color 0.15s;+ }+ .mode-switch button:hover {+ color: var(--ink);+ }+ .mode-switch button[aria-selected='true'] {+ background: var(--surface-3);+ color: var(--ink);+ }+ .pane {+ display: none;+ }+ .pane.active {+ display: block;+ }++ /* Dropzone ---------------------------------------------------- */+ .dropzone {+ position: relative;+ border: 1.5px dashed var(--stroke-strong);+ border-radius: var(--radius-md);+ background: var(--surface-1);+ min-height: 200px;+ display: grid;+ place-items: center;+ text-align: center;+ padding: var(--space-lg);+ cursor: pointer;+ transition: border-color 0.15s, background 0.15s;+ color: var(--ink-dim);+ }+ .dropzone:hover,+ .dropzone:focus-visible {+ border-color: #76b900;+ background: var(--surface-2);+ outline: none;+ }+ .dropzone.dragover {+ border-color: #76b900;+ background: rgba(118, 185, 0, 0.06);+ }+ .dropzone .dz-inner {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 0.45rem;+ pointer-events: none;+ }+ .dropzone svg {+ color: var(--ink-dim);+ }+ .dropzone .dz-title {+ color: var(--ink);+ font-weight: 600;+ font-size: var(--text-sm);+ }+ .dropzone .dz-hint {+ font-size: var(--text-xs);+ color: var(--ink-dim);+ }+ .dropzone img.dz-preview {+ position: absolute;+ inset: 4px;+ width: calc(100% - 8px);+ height: calc(100% - 8px);+ object-fit: contain;+ border-radius: calc(var(--radius-md) - 3px);+ background: var(--surface-0, #0b0b12);+ }+ .dz-clear {+ position: absolute;+ top: 8px;+ right: 8px;+ z-index: 2;+ width: 26px;+ height: 26px;+ border-radius: 50%;+ border: 1px solid var(--stroke-strong);+ background: rgba(10, 10, 16, 0.72);+ color: var(--ink);+ cursor: pointer;+ display: none;+ align-items: center;+ justify-content: center;+ font-size: 14px;+ line-height: 1;+ }+ .dz-clear:hover {+ background: rgba(10, 10, 16, 0.92);+ }+ .dropzone.has-image .dz-clear {+ display: inline-flex;+ }+ .dropzone.has-image .dz-inner {+ display: none;+ }++ .composer textarea {+ width: 100%;+ min-height: 120px;+ resize: vertical;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ padding: 0.7rem 0.8rem;+ outline: none;+ color: var(--ink);+ font-family: var(--font-body);+ font-size: var(--text-base);+ line-height: var(--leading-normal);+ }+ .composer textarea:focus {+ border-color: #76b900;+ }+ .composer textarea::placeholder {+ color: var(--ink-dim);+ }++ .field-label {+ display: block;+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--ink-dim);+ margin-bottom: 0.4rem;+ }+ .tier {+ display: inline-flex;+ gap: 2px;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ padding: 2px;+ }+ .tier button {+ background: transparent;+ border: none;+ color: var(--ink-dim);+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ padding: 0.35rem 0.7rem;+ border-radius: var(--radius-sm);+ cursor: pointer;+ transition: background 0.15s, color 0.15s;+ }+ .tier button:hover {+ color: var(--ink);+ }+ .tier button[aria-pressed='true'] {+ background: var(--surface-3);+ color: var(--ink);+ }+ .composer-row {+ display: flex;+ align-items: flex-end;+ justify-content: space-between;+ gap: var(--space-sm);+ flex-wrap: wrap;+ }++ /* Buttons ----------------------------------------------------- */+ .btn {+ display: inline-flex;+ align-items: center;+ gap: 0.5rem;+ font-family: var(--font-display);+ font-weight: 600;+ font-size: var(--text-base);+ color: #0b0b0b;+ background: var(--accent);+ border: 1px solid var(--accent);+ border-radius: var(--radius-md);+ padding: 0.6rem 1.2rem;+ cursor: pointer;+ transition: transform 0.12s ease, opacity 0.15s, box-shadow 0.15s;+ }+ .btn:hover {+ box-shadow: 0 0 0 4px var(--accent-soft);+ }+ .btn:active {+ transform: translateY(1px);+ }+ .btn[disabled] {+ opacity: 0.45;+ cursor: not-allowed;+ }+ .btn-ghost {+ background: transparent;+ color: var(--ink);+ border: 1px solid var(--stroke-strong);+ }+ .btn-ghost:hover {+ background: var(--surface-2);+ box-shadow: none;+ }+ #generate {+ width: 100%;+ justify-content: center;+ font-size: var(--text-lg);+ padding: 0.8rem 1.2rem;+ background: #76b900;+ border-color: #76b900;+ color: #07120a;+ }+ #generate:hover:not([disabled]) {+ box-shadow: 0 0 0 4px rgba(118, 185, 0, 0.25), 0 10px 30px -10px rgba(118, 185, 0, 0.5);+ }+ .spinner {+ width: 16px;+ height: 16px;+ border-radius: 50%;+ border: 2px solid rgba(7, 18, 10, 0.35);+ border-top-color: #07120a;+ animation: nim-spin 0.7s linear infinite;+ }+ @keyframes nim-spin {+ to {+ transform: rotate(360deg);+ }+ }++ /* Advanced / endpoint ----------------------------------------- */+ details.advanced {+ border-top: 1px solid var(--stroke);+ padding-top: var(--space-sm);+ }+ details.advanced summary {+ cursor: pointer;+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ color: var(--ink-dim);+ list-style: none;+ }+ details.advanced summary::-webkit-details-marker {+ display: none;+ }+ details.advanced summary::before {+ content: '▸ ';+ }+ details.advanced[open] summary::before {+ content: '▾ ';+ }+ details.advanced input {+ width: 100%;+ margin-top: 0.5rem;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ padding: 0.55rem 0.7rem;+ color: var(--ink);+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ outline: none;+ }+ details.advanced input:focus {+ border-color: #76b900;+ }+ .contract {+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ line-height: 1.6;+ color: var(--ink-dim);+ background: var(--surface-0, #0b0b12);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ padding: 0.7rem 0.8rem;+ overflow-x: auto;+ white-space: pre;+ }+ .contract .k {+ color: #76b900;+ }++ /* Stage ------------------------------------------------------- */+ .stage {+ background: var(--surface-glass);+ border: 1px solid var(--stroke-strong);+ border-radius: var(--radius-lg);+ min-height: 460px;+ position: relative;+ overflow: hidden;+ display: flex;+ flex-direction: column;+ }+ .stage-view {+ position: relative;+ flex: 1;+ min-height: 420px;+ background: radial-gradient(120% 120% at 50% 18%, #141b2e 0%, #0b0e18 55%, #05060c 100%);+ }+ model-viewer {+ width: 100%;+ height: 100%;+ --poster-color: transparent;+ background: transparent;+ }+ .stage-state {+ position: absolute;+ inset: 0;+ display: none;+ place-items: center;+ text-align: center;+ padding: var(--space-xl);+ }+ .stage-state.show {+ display: grid;+ }+ .state-inner {+ max-width: 360px;+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 0.7rem;+ color: var(--ink-dim);+ }+ .state-inner h3 {+ margin: 0;+ color: var(--ink);+ font-family: var(--font-display);+ font-size: var(--text-lg);+ }+ .state-inner p {+ margin: 0;+ font-size: var(--text-sm);+ line-height: var(--leading-normal);+ }+ .state-icon {+ width: 46px;+ height: 46px;+ color: var(--ink-dim);+ opacity: 0.8;+ }+ #state-error .state-icon {+ color: var(--warning, #e0a93e);+ }+ /* Loading */+ .loader-ring {+ width: 54px;+ height: 54px;+ border-radius: 50%;+ border: 3px solid rgba(118, 185, 0, 0.18);+ border-top-color: #76b900;+ animation: nim-spin 0.9s linear infinite;+ }+ .elapsed {+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ color: var(--ink-dim);+ }+ .loading-steps {+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ color: var(--ink-faint, #6a6a78);+ min-height: 1.2em;+ }++ /* Result bar -------------------------------------------------- */+ .result-bar {+ display: flex;+ align-items: center;+ gap: var(--space-sm);+ flex-wrap: wrap;+ padding: var(--space-sm) var(--space-md);+ border-top: 1px solid var(--stroke);+ background: var(--surface-1);+ }+ .result-bar .meta {+ display: inline-flex;+ gap: 0.45rem;+ align-items: center;+ flex-wrap: wrap;+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ color: var(--ink-dim);+ }+ .result-bar .chip {+ border: 1px solid var(--stroke);+ border-radius: 999px;+ padding: 0.15rem 0.5rem;+ white-space: nowrap;+ }+ .result-bar .chip.ok {+ color: #76b900;+ border-color: rgba(118, 185, 0, 0.4);+ }+ .result-bar .spacer {+ flex: 1;+ }+ .result-bar.is-hidden {+ display: none;+ }++ /* Reference strip under the stage ----------------------------- */+ .note {+ font-size: var(--text-xs);+ color: var(--ink-dim);+ line-height: var(--leading-normal);+ }+ .note a {+ color: var(--ink);+ }+ .sample-row {+ display: flex;+ gap: 0.5rem;+ flex-wrap: wrap;+ margin-top: 0.5rem;+ }+ .sample-row button {+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-sm);+ color: var(--ink-dim);+ font-family: var(--font-mono);+ font-size: var(--text-2xs, 0.66rem);+ padding: 0.3rem 0.55rem;+ cursor: pointer;+ }+ .sample-row button:hover {+ color: var(--ink);+ border-color: var(--stroke-strong);+ }+ </style>+ </head>+ <body class="forge-page">+ <div id="nav-container"></div>++ <main class="forge-main">+ <header class="forge-head">+ <h1>Forge · NIM</h1>+ <span class="nvbadge">self-hosted TRELLIS</span>+ <p>+ Drive a self-hosted NIM (<code>nvcr.io/nim/microsoft/trellis</code>, <code>large:image</code>)+ directly. A real photo hits <code>/v1/infer</code> and the textured GLB comes back+ <strong>synchronously</strong> as <code>artifacts[0].base64</code> — no async poll.+ </p>+ <span class="nim-status" id="nim-status" data-state="checking" role="status" aria-live="polite">+ <span class="dot"></span><span id="nim-status-text">checking NIM…</span>+ </span>+ </header>++ <div class="forge-workspace">+ <!-- Composer rail -->+ <div class="forge-rail">+ <form class="composer" id="composer" autocomplete="off">+ <div class="mode-switch" role="tablist" aria-label="Generation mode">+ <button type="button" role="tab" id="tab-image" data-mode="image" aria-selected="true">+ From a photo+ </button>+ <button type="button" role="tab" id="tab-text" data-mode="text" aria-selected="false">+ From text+ </button>+ </div>++ <!-- Image pane -->+ <div class="pane active" id="pane-image">+ <div+ class="dropzone"+ id="dropzone"+ role="button"+ tabindex="0"+ aria-label="Drop a reference image, click to choose, or paste"+ >+ <button type="button" class="dz-clear" id="dz-clear" aria-label="Remove image">✕</button>+ <img class="dz-preview" id="dz-preview" alt="" hidden />+ <div class="dz-inner">+ <svg width="34" height="34" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <rect x="3" y="3" width="18" height="18" rx="2" />+ <circle cx="9" cy="9" r="2" />+ <path d="m21 15-3.6-3.6a2 2 0 0 0-2.8 0L6 20" />+ </svg>+ <span class="dz-title">Drop a photo</span>+ <span class="dz-hint">click to browse · or paste · PNG/JPG/WebP, ≤ 10 MB</span>+ </div>+ <input type="file" id="file-input" accept="image/*" hidden />+ </div>+ </div>++ <!-- Text pane -->+ <div class="pane" id="pane-text">+ <label class="field-label" for="prompt">Describe one object</label>+ <textarea+ id="prompt"+ placeholder="a worn brass pocket watch, studio lighting"+ maxlength="120"+ ></textarea>+ </div>++ <div class="composer-row">+ <div>+ <label class="field-label">Quality</label>+ <div class="tier" role="group" aria-label="Sampling quality">+ <button type="button" data-tier="draft" aria-pressed="true">Draft · 15 steps</button>+ <button type="button" data-tier="high" aria-pressed="false">High · 40 steps</button>+ </div>+ </div>+ </div>++ <button class="btn" id="generate" type="submit">+ <span id="generate-label">Reconstruct 3D</span>+ </button>++ <details class="advanced">+ <summary>NIM endpoint & wire contract</summary>+ <input+ type="url"+ id="base-url"+ placeholder="https://your-nim-host (defaults to MODEL_TRELLIS_URL)"+ spellcheck="false"+ autocapitalize="off"+ />+ <div class="contract" aria-hidden="true">POST <span class="k">{baseUrl}</span>/v1/infer+{ <span class="k">mode</span>: "image", <span class="k">image</span>: "data:…",+ ss_sampling_steps, slat_sampling_steps,+ <span class="k">output_format</span>: "glb" }+→ 200 { <span class="k">artifacts</span>: [ { <span class="k">base64</span> } ] }</div>+ </details>+ </form>+ </div>++ <!-- Stage -->+ <div class="forge-stage">+ <div class="stage">+ <div class="stage-view" id="stage-view">+ <model-viewer+ id="viewer"+ camera-controls+ auto-rotate+ auto-rotate-delay="0"+ rotation-per-second="22deg"+ shadow-intensity="1.0"+ shadow-softness="0.9"+ exposure="1.25"+ tone-mapping="aces"+ interaction-prompt="none"+ ar+ ar-modes="webxr scene-viewer quick-look"+ crossorigin="anonymous"+ alt="Reconstructed 3D model"+ style="display: none"+ ></model-viewer>++ <!-- Idle -->+ <div class="stage-state show" id="state-idle">+ <div class="state-inner">+ <svg class="state-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M12 2 2 7l10 5 10-5-10-5Z" />+ <path d="m2 17 10 5 10-5" />+ <path d="m2 12 10 5 10-5" />+ </svg>+ <h3>Drop a photo to begin</h3>+ <p>One clear subject, plain background. The self-hosted NIM reconstructs a textured GLB in a single hop — then orbit, AR, or download it here.</p>+ </div>+ </div>++ <!-- Loading -->+ <div class="stage-state" id="state-loading">+ <div class="state-inner">+ <div class="loader-ring"></div>+ <h3 id="loading-title">Reconstructing…</h3>+ <p class="loading-steps" id="loading-steps">POST /v1/infer</p>+ <div class="elapsed" id="elapsed">0.0s</div>+ <button type="button" class="btn btn-ghost" id="cancel" style="margin-top: 0.4rem">Cancel</button>+ </div>+ </div>++ <!-- Error -->+ <div class="stage-state" id="state-error">+ <div class="state-inner">+ <svg class="state-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" />+ <line x1="12" y1="9" x2="12" y2="13" />+ <line x1="12" y1="17" x2="12.01" y2="17" />+ </svg>+ <h3 id="error-title">Couldn't reconstruct</h3>+ <p id="error-msg">Something went wrong.</p>+ <button type="button" class="btn btn-ghost" id="error-retry" style="margin-top: 0.4rem">Try again</button>+ </div>+ </div>+ </div>++ <div class="result-bar is-hidden" id="result-bar">+ <div class="meta" id="result-meta"></div>+ <span class="spacer"></span>+ <a class="btn btn-ghost" id="download" download="trellis-nim.glb" href="#" style="font-size: var(--text-sm); padding: 0.45rem 0.9rem">Download GLB</a>+ </div>+ </div>++ <p class="note">+ Native image→3D runs only against a self-hosted NIM — NVIDIA's hosted NVCF preview is+ text-only and rejects real photos. This page talks to your NIM through a thin, SSRF-guarded+ proxy (<code>/api/forge-nim</code>); the GLB never leaves your infrastructure except to your own browser.+ Need the production multi-engine forge instead? <a href="/forge">Open Forge</a>.+ <span class="sample-row" id="sample-row">+ <button type="button" data-sample="text" data-prompt="a worn brass pocket watch, studio lighting">Try a text prompt</button>+ </span>+ </p>+ </div>+ </div>+ </main>++ <script src="/nav.js" defer></script>+ <script src="/footer.js" defer></script>+ <script type="module">+ const $ = (id) => document.getElementById(id);++ const els = {+ status: $('nim-status'),+ statusText: $('nim-status-text'),+ composer: $('composer'),+ tabImage: $('tab-image'),+ tabText: $('tab-text'),+ paneImage: $('pane-image'),+ paneText: $('pane-text'),+ dropzone: $('dropzone'),+ fileInput: $('file-input'),+ preview: $('dz-preview'),+ dzClear: $('dz-clear'),+ prompt: $('prompt'),+ baseUrl: $('base-url'),+ generate: $('generate'),+ generateLabel: $('generate-label'),+ viewer: $('viewer'),+ stateIdle: $('state-idle'),+ stateLoading: $('state-loading'),+ stateError: $('state-error'),+ errorTitle: $('error-title'),+ errorMsg: $('error-msg'),+ errorRetry: $('error-retry'),+ loadingSteps: $('loading-steps'),+ elapsed: $('elapsed'),+ cancel: $('cancel'),+ resultBar: $('result-bar'),+ resultMeta: $('result-meta'),+ download: $('download'),+ sampleRow: $('sample-row'),+ };++ const state = {+ mode: 'image',+ tier: 'draft',+ imageDataUri: null,+ objectUrl: null,+ abort: null,+ elapsedTimer: null,+ stepTimer: null,+ };++ // ── Health ────────────────────────────────────────────────────+ async function checkHealth() {+ try {+ const r = await fetch('/api/forge-nim?action=health', { headers: { accept: 'application/json' } });+ const d = await r.json();+ if (!d.configured) {+ setStatus('off', 'no NIM configured');+ } else if (d.reachable) {+ setStatus('live', 'NIM ready');+ } else {+ setStatus('down', 'NIM unreachable');+ }+ } catch {+ setStatus('down', 'status unavailable');+ }+ }+ function setStatus(s, text) {+ els.status.dataset.state = s;+ els.statusText.textContent = text;+ }++ // ── Mode switch ───────────────────────────────────────────────+ function setMode(mode) {+ state.mode = mode;+ const isImage = mode === 'image';+ els.tabImage.setAttribute('aria-selected', String(isImage));+ els.tabText.setAttribute('aria-selected', String(!isImage));+ els.paneImage.classList.toggle('active', isImage);+ els.paneText.classList.toggle('active', !isImage);+ els.generateLabel.textContent = isImage ? 'Reconstruct 3D' : 'Generate 3D';+ updateGenerateEnabled();+ }+ els.tabImage.addEventListener('click', () => setMode('image'));+ els.tabText.addEventListener('click', () => setMode('text'));++ // ── Tier ──────────────────────────────────────────────────────+ document.querySelectorAll('.tier button').forEach((b) => {+ b.addEventListener('click', () => {+ state.tier = b.dataset.tier;+ document.querySelectorAll('.tier button').forEach((x) =>+ x.setAttribute('aria-pressed', String(x === b)),+ );+ });+ });++ // ── Dropzone ──────────────────────────────────────────────────+ function loadFile(file) {+ if (!file || !file.type.startsWith('image/')) return;+ if (file.size > 10 * 1024 * 1024) {+ showError('Image too large', 'Pick an image under 10 MB.');+ return;+ }+ const reader = new FileReader();+ reader.onload = () => {+ state.imageDataUri = reader.result;+ els.preview.src = reader.result;+ els.preview.hidden = false;+ els.dropzone.classList.add('has-image');+ updateGenerateEnabled();+ };+ reader.readAsDataURL(file);+ }+ function clearImage() {+ state.imageDataUri = null;+ els.preview.src = '';+ els.preview.hidden = true;+ els.fileInput.value = '';+ els.dropzone.classList.remove('has-image');+ updateGenerateEnabled();+ }+ els.dropzone.addEventListener('click', (e) => {+ if (e.target === els.dzClear) return;+ els.fileInput.click();+ });+ els.dropzone.addEventListener('keydown', (e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ els.fileInput.click();+ }+ });+ els.fileInput.addEventListener('change', () => loadFile(els.fileInput.files[0]));+ els.dzClear.addEventListener('click', (e) => {+ e.stopPropagation();+ clearImage();+ });+ ['dragenter', 'dragover'].forEach((ev) =>+ els.dropzone.addEventListener(ev, (e) => {+ e.preventDefault();+ els.dropzone.classList.add('dragover');+ }),+ );+ ['dragleave', 'drop'].forEach((ev) =>+ els.dropzone.addEventListener(ev, (e) => {+ e.preventDefault();+ els.dropzone.classList.remove('dragover');+ }),+ );+ els.dropzone.addEventListener('drop', (e) => {+ const file = e.dataTransfer?.files?.[0];+ if (file) loadFile(file);+ });+ window.addEventListener('paste', (e) => {+ if (state.mode !== 'image') return;+ const item = [...(e.clipboardData?.items || [])].find((i) => i.type.startsWith('image/'));+ if (item) loadFile(item.getAsFile());+ });++ els.prompt.addEventListener('input', updateGenerateEnabled);+ function updateGenerateEnabled() {+ const ready =+ state.mode === 'image' ? Boolean(state.imageDataUri) : els.prompt.value.trim().length >= 3;+ els.generate.disabled = !ready;+ }+ updateGenerateEnabled();++ // ── Samples ───────────────────────────────────────────────────+ els.sampleRow.addEventListener('click', (e) => {+ const btn = e.target.closest('button[data-sample]');+ if (!btn) return;+ setMode('text');+ els.prompt.value = btn.dataset.prompt || '';+ updateGenerateEnabled();+ els.prompt.focus();+ });++ // ── Stage states ──────────────────────────────────────────────+ function showState(name) {+ els.stateIdle.classList.toggle('show', name === 'idle');+ els.stateLoading.classList.toggle('show', name === 'loading');+ els.stateError.classList.toggle('show', name === 'error');+ els.viewer.style.display = name === 'result' ? 'block' : 'none';+ if (name !== 'result') els.resultBar.classList.add('is-hidden');+ }+ function showError(title, msg) {+ els.errorTitle.textContent = title;+ els.errorMsg.textContent = msg;+ showState('error');+ stopTimers();+ }++ function startTimers() {+ const t0 = performance.now();+ els.elapsed.textContent = '0.0s';+ state.elapsedTimer = setInterval(() => {+ els.elapsed.textContent = ((performance.now() - t0) / 1000).toFixed(1) + 's';+ }, 100);+ const steps = [+ 'POST /v1/infer',+ 'sparse structure sampling…',+ 'structured latent sampling…',+ 'decoding mesh + baking texture…',+ 'encoding GLB…',+ ];+ let i = 0;+ els.loadingSteps.textContent = steps[0];+ state.stepTimer = setInterval(() => {+ i = Math.min(i + 1, steps.length - 1);+ els.loadingSteps.textContent = steps[i];+ }, 2600);+ }+ function stopTimers() {+ clearInterval(state.elapsedTimer);+ clearInterval(state.stepTimer);+ }++ // ── Generate ──────────────────────────────────────────────────+ els.composer.addEventListener('submit', (e) => {+ e.preventDefault();+ generate();+ });+ els.errorRetry.addEventListener('click', generate);+ els.cancel.addEventListener('click', () => {+ state.abort?.abort();+ stopTimers();+ showState('idle');+ });++ async function generate() {+ if (els.generate.disabled) return;+ const payload = { mode: state.mode, tier: state.tier };+ if (state.mode === 'image') {+ if (!state.imageDataUri) return;+ payload.image = state.imageDataUri;+ } else {+ payload.prompt = els.prompt.value.trim();+ if (payload.prompt.length < 3) return;+ }+ const baseUrl = els.baseUrl.value.trim();+ if (baseUrl) payload.baseUrl = baseUrl;++ state.abort = new AbortController();+ els.generate.disabled = true;+ els.generateLabel.innerHTML = '<span class="spinner"></span>';+ showState('loading');+ startTimers();++ try {+ const r = await fetch('/api/forge-nim', {+ method: 'POST',+ headers: { 'content-type': 'application/json', accept: 'application/json' },+ body: JSON.stringify(payload),+ signal: state.abort.signal,+ });+ const d = await r.json().catch(() => ({}));+ if (!r.ok || !d.ok) {+ throw new Error(d.message || d.error || `Request failed (${r.status})`);+ }+ renderResult(d);+ } catch (err) {+ if (err.name === 'AbortError') return;+ showError('Couldn’t reconstruct', err.message || 'Unexpected error.');+ } finally {+ stopTimers();+ els.generate.disabled = false;+ els.generateLabel.textContent = state.mode === 'image' ? 'Reconstruct 3D' : 'Generate 3D';+ updateGenerateEnabled();+ }+ }++ function renderResult(d) {+ // Decode the synchronous { artifacts:[{ base64 }] } GLB into a Blob and+ // hand it straight to the viewer — the NIM's wire shape, end to end.+ const bytes = base64ToBytes(d.glb_base64);+ const blob = new Blob([bytes], { type: 'model/gltf-binary' });+ if (state.objectUrl) URL.revokeObjectURL(state.objectUrl);+ state.objectUrl = URL.createObjectURL(blob);+ els.viewer.src = state.objectUrl;+ els.download.href = state.objectUrl;+ showState('result');++ const kb = (d.bytes / 1024).toFixed(0);+ const secs = (d.ms / 1000).toFixed(1);+ els.resultMeta.innerHTML = '';+ const chips = [+ { t: `${d.mode} → 3D`, cls: 'chip ok' },+ { t: `${kb} KB`, cls: 'chip' },+ { t: `${secs}s synchronous`, cls: 'chip' },+ { t: d.contract, cls: 'chip' },+ ];+ for (const c of chips) {+ const span = document.createElement('span');+ span.className = c.cls;+ span.textContent = c.t;+ els.resultMeta.appendChild(span);+ }+ els.resultBar.classList.remove('is-hidden');+ }++ function base64ToBytes(b64) {+ const bin = atob(b64);+ const out = new Uint8Array(bin.length);+ for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);+ return out;+ }++ els.viewer.addEventListener('error', () => {+ showError('Model failed to load', 'The GLB came back but the viewer rejected it. Try the download button to inspect it directly.');+ });++ setMode('image');+ checkHealth();+ </script>+ </body>+</html>diff --git a/pages/genesis.html b/pages/genesis.htmlindex 4bf601c7d..1398a436d 100644--- a/pages/genesis.html+++ b/pages/genesis.html@@ -43,7 +43,7 @@<meta name="twitter:site" content="@trythreews"><meta name="twitter:title" content="Instant Agent Genesis · three.ws"><meta name="twitter:description" content="A prompt or a selfie becomes a rigged 3D AI agent with its own custodial Solana + EVM wallet and a verifiable on-chain identity — in under a minute, owned by you.">- <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&amp;t=Instant+Agent+Genesis&amp;d=A+prompt+or+a+selfie+becomes+a+rigged+3D+AI+agent+with+its+own+custodial+Solana+%2B+EVM+wallet+and+a+verifiable+on-chain+identity+%E2%80%94+in+under+a+minute%2C+owned+by+yo&amp;p=%2Fgenesis">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=Instant+Agent+Genesis&d=A+prompt+or+a+selfie+becomes+a+rigged+3D+AI+agent+with+its+own+custodial+Solana+%2B+EVM+wallet+and+a+verifiable+on-chain+identity+%E2%80%94+in+under+a+minute%2C+owned+by+yo&p=%2Fgenesis"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Instant Agent Genesis","description":"A prompt or a selfie becomes a rigged 3D AI agent with its own custodial Solana + EVM wallet and a verifiable on-chain identity — in under a minute, owned by you.","url":"https://three.ws/genesis","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=build&t=Instant+Agent+Genesis&d=A+prompt+or+a+selfie+becomes+a+rigged+3D+AI+agent+with+its+own+custodial+Solana+%2B+EVM+wallet+and+a+verifiable+on-chain+identity+%E2%80%94+in+under+a+minute%2C+owned+by+yo&p=%2Fgenesis"}]}</script></head><body>diff --git a/pages/genome.html b/pages/genome.htmlindex ef0cd26d9..cb644ad96 100644--- a/pages/genome.html+++ b/pages/genome.html@@ -31,7 +31,7 @@<meta name="twitter:site" content="@trythreews"><meta name="twitter:title" content="Agent Genome — breed two agents · three.ws"><meta name="twitter:description" content="Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.">- <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&amp;t=Agent+Genome+%E2%80%94+breed+two+agents&amp;d=Breed+two+AI+agents+into+a+provably-inherited+offspring.+The+child+inherits+a+recombination+of+both+parents%27+brain%2C+voice%2C+body%2C+and+on-chain+skill+licenses+%E2%80%94+e&amp;p=%2Fgenome">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=Agent+Genome+%E2%80%94+breed+two+agents&d=Breed+two+AI+agents+into+a+provably-inherited+offspring.+The+child+inherits+a+recombination+of+both+parents%27+brain%2C+voice%2C+body%2C+and+on-chain+skill+licenses+%E2%80%94+e&p=%2Fgenome"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Agent Genome — breed two agents","description":"Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.","url":"https://three.ws/genome","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=build&t=Agent+Genome+%E2%80%94+breed+two+agents&d=Breed+two+AI+agents+into+a+provably-inherited+offspring.+The+child+inherits+a+recombination+of+both+parents%27+brain%2C+voice%2C+body%2C+and+on-chain+skill+licenses+%E2%80%94+e&p=%2Fgenome"}]}</script></head><body class="gn-body">diff --git a/pages/integrity.html b/pages/integrity.htmlindex dea914002..1f193f622 100644--- a/pages/integrity.html+++ b/pages/integrity.html@@ -82,7 +82,7 @@<meta property="og:locale" content="en_US"><meta property="og:image:alt" content="Custody Integrity — three.ws">- <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Custody+Integrity&amp;d=Provable%2C+on-chain-anchored+custody+for+every+three.ws+agent+wallet.+The+platform+commits+a+Merkle+root+over+every+wallet%27s+on-chain+state+to+Solana+%E2%80%94+verify+th&amp;p=%2Fintegrity">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=Custody+Integrity&d=Provable%2C+on-chain-anchored+custody+for+every+three.ws+agent+wallet.+The+platform+commits+a+Merkle+root+over+every+wallet%27s+on-chain+state+to+Solana+%E2%80%94+verify+th&p=%2Fintegrity"></head><body><header><div id="nav-container"></div></header>diff --git a/pages/nim-forge.html b/pages/nim-forge.htmlnew file mode 100644index 000000000..94c184f78--- /dev/null+++ b/pages/nim-forge.html@@ -0,0 +1,200 @@+<!doctype html>+<html lang="en">+ <head>+ <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>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>TRELLIS NIM · Image → 3D · three.ws</title>+ <meta name="description" content="Drop in a photo, get a textured 3D model — reconstructed natively on a self-hosted Microsoft TRELLIS NIM. Single-hop image → GLB." />+ <meta name="robots" content="noindex" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="stylesheet" href="/style.css" />+ <link rel="preconnect" href="https://ajax.googleapis.com" />+ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw"+ crossorigin="anonymous"+ ></script>+ <style>+ .nf-main { max-width: 1200px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 32px) 64px; }+ .nf-head { margin-bottom: clamp(20px, 3vw, 32px); }+ .nf-eyebrow {+ display: inline-flex; align-items: center; gap: 8px;+ font: 600 12px/1 var(--font-mono, ui-monospace, monospace);+ letter-spacing: 0.08em; text-transform: uppercase;+ color: var(--ink-dim, #9aa0b5); padding: 6px 10px;+ border: 1px solid var(--stroke, rgba(255,255,255,0.1)); border-radius: 999px;+ background: var(--surface-2, rgba(255,255,255,0.03));+ }+ .nf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-dim, #9aa0b5); transition: background 0.3s; }+ .nf-eyebrow[data-state="up"] .nf-dot { background: #36d399; box-shadow: 0 0 10px #36d39988; }+ .nf-eyebrow[data-state="down"] .nf-dot { background: #f87272; }+ .nf-head h1 { font: 700 clamp(28px, 5vw, 44px)/1.05 var(--font-display, system-ui); margin: 14px 0 8px; letter-spacing: -0.02em; }+ .nf-head p { color: var(--ink-dim, #9aa0b5); max-width: 60ch; font-size: 15px; line-height: 1.5; }+ .nf-head code { font-family: var(--font-mono, monospace); font-size: 0.86em; color: var(--accent, #7c9cff); }++ .nf-workspace { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: clamp(16px, 2.5vw, 28px); align-items: start; }+ @media (max-width: 860px) { .nf-workspace { grid-template-columns: 1fr; } }++ .nf-rail { display: flex; flex-direction: column; gap: 18px; }+ .nf-card {+ background: var(--surface-1, rgba(255,255,255,0.02)); border: 1px solid var(--stroke, rgba(255,255,255,0.1));+ border-radius: 16px; padding: 18px;+ }+ .nf-label { font: 600 12px/1 var(--font-mono, monospace); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim, #9aa0b5); margin-bottom: 10px; }++ .nf-drop {+ position: relative; border: 1.5px dashed var(--stroke-strong, rgba(255,255,255,0.18)); border-radius: 14px;+ aspect-ratio: 1 / 1; display: grid; place-items: center; text-align: center; cursor: pointer;+ overflow: hidden; transition: border-color 0.2s, background 0.2s; background: var(--surface-2, rgba(255,255,255,0.03));+ }+ .nf-drop:hover, .nf-drop.is-over { border-color: var(--accent, #7c9cff); background: color-mix(in srgb, var(--accent, #7c9cff) 8%, transparent); }+ .nf-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0a0a12; }+ .nf-drop .nf-drop-hint { padding: 24px; color: var(--ink-dim, #9aa0b5); display: grid; gap: 8px; pointer-events: none; }+ .nf-drop .nf-drop-hint strong { color: var(--ink, #eef0ff); font-weight: 600; }+ .nf-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }+ .nf-clear { position: absolute; top: 8px; right: 8px; z-index: 2; border: none; background: rgba(0,0,0,0.6); color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 16px; display: none; }+ .nf-drop.has-image .nf-clear { display: block; }+ .nf-drop.has-image .nf-drop-hint { display: none; }++ .nf-mode { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2, rgba(255,255,255,0.03)); border: 1px solid var(--stroke, rgba(255,255,255,0.1)); border-radius: 10px; margin-bottom: 12px; }+ .nf-mode button { border: none; background: transparent; color: var(--ink-dim, #9aa0b5); padding: 7px 14px; border-radius: 7px; cursor: pointer; font: 600 13px var(--font-body, system-ui); transition: all 0.15s; }+ .nf-mode button[aria-pressed="true"] { background: var(--surface-3, rgba(255,255,255,0.08)); color: var(--ink, #eef0ff); }++ .nf-textarea { width: 100%; min-height: 84px; resize: vertical; background: var(--surface-2, rgba(255,255,255,0.03)); border: 1px solid var(--stroke, rgba(255,255,255,0.1)); border-radius: 10px; padding: 11px 13px; color: var(--ink, #eef0ff); font: 14px/1.5 var(--font-body, system-ui); }+ .nf-textarea:focus { outline: none; border-color: var(--accent, #7c9cff); }++ .nf-tiers { display: flex; gap: 6px; }+ .nf-tiers button { flex: 1; border: 1px solid var(--stroke, rgba(255,255,255,0.1)); background: var(--surface-2, rgba(255,255,255,0.03)); color: var(--ink-dim, #9aa0b5); padding: 9px; border-radius: 9px; cursor: pointer; font: 600 13px var(--font-body, system-ui); transition: all 0.15s; }+ .nf-tiers button[aria-pressed="true"] { border-color: var(--accent, #7c9cff); color: var(--ink, #eef0ff); background: color-mix(in srgb, var(--accent, #7c9cff) 12%, transparent); }++ .nf-btn { width: 100%; border: none; border-radius: 12px; padding: 14px; font: 700 15px var(--font-body, system-ui); cursor: pointer; background: var(--accent, #7c9cff); color: #08080f; transition: filter 0.15s, transform 0.1s; }+ .nf-btn:hover:not(:disabled) { filter: brightness(1.08); }+ .nf-btn:active:not(:disabled) { transform: translateY(1px); }+ .nf-btn:disabled { opacity: 0.5; cursor: not-allowed; }++ .nf-foot { font: 500 11.5px/1.5 var(--font-mono, monospace); color: var(--ink-dim, #9aa0b5); text-align: center; }++ .nf-stage { position: relative; min-height: 520px; border: 1px solid var(--stroke, rgba(255,255,255,0.1)); border-radius: 18px; background: radial-gradient(120% 120% at 50% 0%, var(--surface-2, rgba(255,255,255,0.03)), var(--surface-1, rgba(0,0,0,0.1))); overflow: hidden; display: grid; }+ .nf-panel { grid-area: 1 / 1; display: grid; place-items: center; padding: 24px; text-align: center; opacity: 0; visibility: hidden; transition: opacity 0.4s; }+ .nf-panel.is-active { opacity: 1; visibility: visible; }+ .nf-empty-art { width: 90px; height: 90px; border-radius: 22px; background: conic-gradient(from 210deg, var(--accent, #7c9cff), #c084fc, #7c9cff); opacity: 0.85; margin: 0 auto 18px; filter: blur(0.3px); animation: nf-float 5s ease-in-out infinite; }+ @keyframes nf-float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(8deg); } }+ .nf-panel h2 { font: 600 20px var(--font-display, system-ui); margin-bottom: 8px; }+ .nf-panel p { color: var(--ink-dim, #9aa0b5); max-width: 42ch; font-size: 14px; line-height: 1.5; }++ .nf-spinner { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--stroke, rgba(255,255,255,0.12)); border-top-color: var(--accent, #7c9cff); animation: nf-spin 0.8s linear infinite; margin: 0 auto 20px; }+ @keyframes nf-spin { to { transform: rotate(360deg); } }+ .nf-elapsed { font: 600 28px var(--font-mono, monospace); color: var(--ink, #eef0ff); }+ .nf-substep { color: var(--ink-dim, #9aa0b5); font-size: 13px; margin-top: 6px; }++ model-viewer { grid-area: 1 / 1; width: 100%; height: 100%; min-height: 520px; --poster-color: transparent; background: transparent; opacity: 0; visibility: hidden; transition: opacity 0.5s; }+ model-viewer.is-active { opacity: 1; visibility: visible; }+ .nf-resultbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: none; align-items: center; gap: 12px; padding: 14px 18px; background: linear-gradient(0deg, rgba(0,0,0,0.55), transparent); }+ .nf-resultbar.is-active { display: flex; }+ .nf-resultmeta { font: 500 12px var(--font-mono, monospace); color: var(--ink, #eef0ff); margin-right: auto; }+ .nf-resultmeta b { color: var(--accent, #7c9cff); }+ .nf-download { border: 1px solid var(--stroke-strong, rgba(255,255,255,0.2)); background: var(--surface-3, rgba(255,255,255,0.08)); color: var(--ink, #eef0ff); padding: 9px 16px; border-radius: 10px; cursor: pointer; font: 600 13px var(--font-body, system-ui); text-decoration: none; }+ .nf-download:hover { background: var(--surface-2, rgba(255,255,255,0.12)); }+ .nf-err { color: #fca5a5; font: 500 13px/1.5 var(--font-mono, monospace); max-width: 50ch; word-break: break-word; }+ </style>+ </head>+ <body>+ <main class="nf-main">+ <header class="nf-head">+ <span class="nf-eyebrow" id="status-badge" data-state="checking"><span class="nf-dot"></span><span id="status-text">checking engine…</span></span>+ <h1>Image → 3D</h1>+ <p>Drop in a photo and get a textured 3D model — reconstructed natively on a self-hosted <strong>Microsoft TRELLIS NIM</strong>. Single-hop <code>image → /v1/infer → GLB</code>, no intermediate step. This is an isolated demo surface; it shares nothing with production Forge.</p>+ </header>++ <div class="nf-workspace">+ <div class="nf-rail">+ <div class="nf-card">+ <div class="nf-mode" role="group" aria-label="Input mode">+ <button type="button" id="mode-image" aria-pressed="true">From a photo</button>+ <button type="button" id="mode-text" aria-pressed="false">Describe it</button>+ </div>++ <div id="pane-image">+ <div class="nf-label">Reference photo</div>+ <label class="nf-drop" id="drop">+ <button type="button" class="nf-clear" id="clear" aria-label="Remove image">✕</button>+ <img id="preview" alt="" hidden />+ <div class="nf-drop-hint">+ <strong>Drop a photo or click</strong>+ <span>One clean object on a simple background works best.</span>+ </div>+ <input type="file" id="file" accept="image/png,image/jpeg,image/webp" />+ </label>+ </div>++ <div id="pane-text" hidden>+ <div class="nf-label">Prompt</div>+ <textarea class="nf-textarea" id="prompt" maxlength="200" placeholder="a worn leather armchair, studio lighting"></textarea>+ </div>+ </div>++ <div class="nf-card">+ <div class="nf-label">Quality</div>+ <div class="nf-tiers" id="tiers" role="group" aria-label="Quality tier">+ <button type="button" data-tier="draft" aria-pressed="false">Draft</button>+ <button type="button" data-tier="standard" aria-pressed="true">Standard</button>+ <button type="button" data-tier="high" aria-pressed="false">High</button>+ </div>+ </div>++ <button class="nf-btn" id="generate" disabled>Add a photo to start</button>+ <div class="nf-foot">Self-hosted NVIDIA TRELLIS NIM · <code>/v1/infer</code></div>+ </div>++ <section class="nf-stage" id="stage">+ <div class="nf-panel is-active" id="panel-empty">+ <div>+ <div class="nf-empty-art"></div>+ <h2>Your model appears here</h2>+ <p>Drop in a photo on the left and hit Generate. The mesh reconstructs in seconds and renders right here — orbit it, inspect it, download the GLB.</p>+ </div>+ </div>++ <div class="nf-panel" id="panel-loading">+ <div>+ <div class="nf-spinner"></div>+ <div class="nf-elapsed" id="elapsed">0.0s</div>+ <div class="nf-substep" id="substep">Reconstructing mesh on the NIM…</div>+ </div>+ </div>++ <div class="nf-panel" id="panel-error">+ <div>+ <h2>That didn't land</h2>+ <p class="nf-err" id="error-msg"></p>+ </div>+ </div>++ <model-viewer+ id="viewer"+ camera-controls+ auto-rotate+ auto-rotate-delay="0"+ rotation-per-second="20deg"+ shadow-intensity="1.0"+ shadow-softness="0.9"+ exposure="1.25"+ tone-mapping="aces"+ interaction-prompt="none"+ alt="Generated 3D model"+ ></model-viewer>++ <div class="nf-resultbar" id="resultbar">+ <span class="nf-resultmeta" id="result-meta"></span>+ <a class="nf-download" id="download" download="trellis-model.glb">Download GLB</a>+ </div>+ </section>+ </div>+ </main>++ <script type="module" src="/src/nim-forge.js"></script>+ </body>+</html>diff --git a/public/changelog.json b/public/changelog.jsonindex 5e7f7ff2a..32dce8ab1 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-23T14:39:43.869Z",+ "generated_at": "2026-06-23T15:05:22.828Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -106,6 +106,16 @@"launch"]},+ {+ "date": "2026-06-23",+ "type": "launch",+ "title": "Forge · NIM — Self-Hosted Image to 3D",+ "summary": "Drive a self-hosted TRELLIS NIM (nvcr.io/nim/microsoft/trellis) directly: drop a photo, hit /v1/infer, and get the textured GLB back synchronously as base64 — rendered live and downloadable.",+ "link": "/forge-nim",+ "tags": [+ "launch"+ ]+ },{"date": "2026-06-23","type": "launch",diff --git a/public/features.json b/public/features.jsonindex 9bd165427..42176f2fa 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-23T14:39:43.840Z",+ "generated_at": "2026-06-23T15:05:22.809Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -322,6 +322,16 @@"tags": [],"showcase": false},+ {+ "path": "/forge-nim",+ "title": "Forge · NIM — Self-Hosted Image to 3D",+ "description": "Drive a self-hosted TRELLIS NIM (nvcr.io/nim/microsoft/trellis) directly: drop a photo, hit /v1/infer, and get the textured GLB back synchronously as base64 — rendered live and downloadable.",+ "added": "2026-06-23",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": false+ },{"path": "/forge-studio","title": "Studio — Object + Avatar from text",diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 49871513f..1444deb3f 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -65,7 +65,7 @@<main class="sm-wrap"><div class="sm-hero"><h1>Sitemap</h1>- <p>All 327 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>+ <p>All 328 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p><div class="sm-formats"><a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a><a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>@@ -77,7 +77,7 @@</div><div class="sm-filter"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>- <input id="sm-filter-input" type="search" placeholder="Filter 327 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />+ <input id="sm-filter-input" type="search" placeholder="Filter 328 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" /><kbd aria-hidden="true">/</kbd></div><p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>@@ -252,7 +252,7 @@<section class="sm-section" id="build"><header>- <h2>Build<span class="sm-count" data-count>37</span></h2>+ <h2>Build<span class="sm-count" data-count>38</span></h2><p class="sm-section-desc">Create and customize an agent.</p></header><ul class="sm-list">@@ -319,6 +319,13 @@<span class="sm-desc">Type a prompt — or drop in photos or a sketch — and get a downloadable textured 3D model (GLB). Pick from multiple generation engines with live health status.</span></a></li>+ <li>+ <a href="/forge-nim">+ <span class="sm-title">Forge · NIM — Self-Hosted Image to 3D</span>+ <span class="sm-path">/forge-nim</span>+ <span class="sm-desc">Drive a self-hosted TRELLIS NIM (nvcr.io/nim/microsoft/trellis) directly: drop a photo, hit /v1/infer, and get the textured GLB back synchronously as base64 — rendered live and downloadable.</span>+ </a>+ </li><li><a href="/forge-studio"><span class="sm-title">Studio — Object + Avatar from text</span>diff --git a/vercel.json b/vercel.jsonindex e6aeac3e9..b0b5838dd 100644--- a/vercel.json+++ b/vercel.json@@ -113,6 +113,9 @@"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 300},+ "api/forge-nim.js": {+ "maxDuration": 300+ },"api/brain/chat.js": {"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 120@@ -840,6 +843,10 @@"src": "/forge-studio/?","dest": "/forge-studio.html"},+ {+ "src": "/forge-nim/?",+ "dest": "/forge-nim.html"+ },{"src": "/scene/?","dest": "/scene.html"