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
fix(cosmos): land the provider, coin3d and constellation page work from this worktree
nirholase73c61f53301
diff --git a/api/_providers/nvidia-cosmos.js b/api/_providers/nvidia-cosmos.jsindex 3abf849d6..97e9aef04 100644--- a/api/_providers/nvidia-cosmos.js+++ b/api/_providers/nvidia-cosmos.js@@ -58,6 +58,19 @@ import { env } from '../_lib/env.js';const DEFAULT_COSMOS_INVOKE_URL = 'https://ai.api.nvidia.com/v1/cosmos/nvidia/cosmos-predict1-7b';const NVCF_STATUS_URL = 'https://api.nvcf.nvidia.com/v2/nvcf/pexec/status';+// NVIDIA retires hosted preview functions without retiring the gateway PATH: the+// route keeps answering (401 unauthenticated), but an authenticated submit comes+// back with `Function '<uuid>': Not found for account '<id>'`. That is what the+// live account hit on cosmos-predict1-7b, and one dead function should not take+// the whole lane down, so the submit walks the published cosmos-predict routes in+// order and only reports the lane unavailable when every rung is gone. Pinning+// NVIDIA_COSMOS_INVOKE_URL opts out: an explicit pin is used alone, because the+// operator who set it means that model (or a self-hosted NIM), not a sibling.+const COSMOS_ROUTE_CANDIDATES = [+ DEFAULT_COSMOS_INVOKE_URL,+ 'https://ai.api.nvidia.com/v1/cosmos/nvidia/cosmos-predict1-5b',+];+// Cosmos predict renders a fixed ~5 s 1280×704 @ 24fps clip; the prompt is the// only knob that meaningfully changes the output, so we keep the body minimal.// A long prompt is clamped so the request is honest about what conditions it.@@ -101,6 +114,20 @@ function invokeUrl() {return env.NVIDIA_COSMOS_INVOKE_URL || DEFAULT_COSMOS_INVOKE_URL;}+// Ordered submit targets: an explicit pin alone, otherwise the published route+// chain above.+function invokeCandidates() {+ return env.NVIDIA_COSMOS_INVOKE_URL ? [env.NVIDIA_COSMOS_INVOKE_URL] : [...COSMOS_ROUTE_CANDIDATES];+}++// Does this upstream answer mean "the model behind this route is gone for this+// account" (as opposed to a transient or credential failure)? The gateway says it+// with a 404 or with a `Not found for account` detail on another status.+function isRouteRetired(status, detail) {+ if (status === 404) return true;+ return typeof detail === 'string' && /not found for account/i.test(detail);+}+// Map an upstream HTTP status onto the normalized error callers route on.function providerError(status, message, retryAfter) {let code = 'provider_error';@@ -114,6 +141,12 @@ function providerError(status, message, retryAfter) {} else if (status === 429) {code = 'rate_limited';mapped = 429;+ } else if (isRouteRetired(status, message)) {+ // The model is gone for this account, not broken: the caller should report+ // the lane offline (503) and degrade, never ask the user to retry a route+ // that will keep answering the same way.+ code = 'lane_unavailable';+ mapped = 503;}const err = Object.assign(new Error(message || `NVIDIA Cosmos returned ${status}`), {code,@@ -260,12 +293,12 @@ export function createNvidiaCosmosProvider() {// POST the invoke. Returns { done:true, videoBase64 } on synchronous 200, or// { done:false, reqId } when NVCF accepted it for async processing.- async function postInvoke(body) {+ async function postInvoke(body, url = invokeUrl()) {let lastErr = null;for (let attempt = 1; attempt <= MAX_INVOKE_ATTEMPTS; attempt++) {let res;try {- res = await fetch(invokeUrl(), {+ res = await fetch(url, {method: 'POST',headers: invokeHeaders,body: JSON.stringify(body),@@ -343,7 +376,23 @@ export function createNvidiaCosmosProvider() {// Native text→world video. Returns a poll handle, or a ready R2 MP4 URL when// NVCF completed within the submit request (rare for video).async textToWorld({ prompt, seed } = {}) {- const parsed = await postInvoke(buildWorldBody({ prompt, seed }));+ const body = buildWorldBody({ prompt, seed });+ const candidates = invokeCandidates();+ let retiredErr = null;+ let parsed = null;+ for (const url of candidates) {+ try {+ parsed = await postInvoke(body, url);+ break;+ } catch (err) {+ // Only a retired route is worth stepping past; a key, quota, or+ // gateway failure means the next rung would fail the same way.+ if (err?.code !== 'lane_unavailable') throw err;+ console.warn('[nvidia-cosmos] route retired, trying the next rung — %s', url);+ retiredErr = err;+ }+ }+ if (!parsed) throw retiredErr;if (parsed.done) {const resultVideoUrl = await persistVideo(parsed.videoBase64);return { taskId: null, resultVideoUrl };diff --git a/pages/coin3d.html b/pages/coin3d.htmlindex 9e91fff28..e390a3514 100644--- a/pages/coin3d.html+++ b/pages/coin3d.html@@ -182,19 +182,36 @@position: fixed;inset: 0;display: grid;- place-items: center;+ justify-items: center;+ align-items: center;+ /* Safe centering + a scroll track: the landing card is taller than a+ short mobile viewport, and `body` never scrolls, so without these+ its footer links would be clipped and unreachable. */+ align-content: safe center;+ overflow-y: auto;+ overscroll-behavior: contain;padding: 24px;background: radial-gradient(120% 120% at 50% 0%, var(--bg-1) 0%, var(--bg-0) 70%);z-index: 5;+ scrollbar-width: thin;+ scrollbar-color: rgba(120, 140, 220, 0.4) transparent;+ }+ #status::-webkit-scrollbar {+ width: 6px;+ }+ #status::-webkit-scrollbar-thumb {+ background: rgba(120, 140, 220, 0.32);+ border-radius: 3px;}.status-card {text-align: center;max-width: 380px;animation: rise 0.4s ease both;}- .status-card h2 {+ .status-card h1 {margin: 14px 0 8px;font-size: 19px;+ line-height: 1.25;}.status-card p {color: var(--muted);@@ -224,7 +241,7 @@outline: 2px solid #fff;outline-offset: 3px;}- #status[data-kind='error'] .status-card h2 {+ #status[data-kind='error'] .status-card h1 {color: #ff8f8f;}.spinner {@@ -297,6 +314,17 @@0%, 100% { opacity: 0.4; }50% { opacity: 0.8; }}+ /* Pending stat value: the holder scan is the slowest source, so its+ cell shows a pulsing bar instead of a placeholder dash it might+ never replace. */+ .c3d-dd-sk {+ display: inline-block;+ width: 46px;+ height: 12px;+ border-radius: 4px;+ background: rgba(255, 255, 255, 0.09);+ animation: c3dPulse 1.4s ease-in-out infinite;+ }/* Watch button */.c3d-watch-btn {background: none;@@ -541,7 +569,7 @@width: 100%;animation: rise 0.45s ease both;}- .c3d-landing h2 {+ .c3d-landing h1 {font-size: 26px;margin: 16px 0 8px;letter-spacing: -0.01em;@@ -715,7 +743,7 @@.c3d-recent {grid-template-columns: repeat(3, 1fr);}- .c3d-landing h2 {+ .c3d-landing h1 {font-size: 22px;}}diff --git a/pages/compose.html b/pages/compose.htmlindex 0e86533b1..1e7246ba3 100644--- a/pages/compose.html+++ b/pages/compose.html@@ -196,12 +196,12 @@.gco{position:absolute;inset:0;background:linear-gradient(to top,rgba(0,0,0,.75) 0%,transparent 55%);display:flex;flex-direction:column;justify-content:flex-end;padding:6px;opacity:0;transition:opacity .12s;}.gc:hover .gco,.gc:focus-visible .gco{opacity:1;}.gcp{font-size:10px;color:#fff;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}- .gca{font-size:10px;font-weight:600;color:var(--accent-text);background:rgba(99,102,241,.28);border-radius:4px;padding:2px 6px;margin-top:3px;text-align:center;}+ .gca{display:block;font-size:10px;font-weight:600;color:var(--accent-text);background:rgba(99,102,241,.28);border-radius:4px;padding:2px 6px;margin-top:3px;text-align:center;}.gcg{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10px;color:rgba(255,255,255,.2);text-align:center;padding:8px;}.ge{grid-column:1/-1;text-align:center;padding:20px 8px;font-size:11px;color:var(--ink-mute);line-height:1.6;}.geb{margin-top:8px;padding:4px 12px;border-radius:var(--rs);background:rgba(255,255,255,.05);border:1px solid var(--border);color:var(--ink-dim);font-size:11px;font-family:inherit;cursor:pointer;transition:background .1s,color .1s;}.geb:hover{background:rgba(255,255,255,.1);color:var(--ink);}- #dz{margin:0 8px 8px;border:1px dashed rgba(255,255,255,.09);border-radius:var(--r);padding:9px;text-align:center;font-size:10px;color:var(--ink-mute);cursor:pointer;transition:border-color .12s,background .12s;flex-shrink:0;}+ #dz{position:relative;margin:0 8px 8px;border:1px dashed rgba(255,255,255,.09);border-radius:var(--r);padding:9px;text-align:center;font-size:10px;color:var(--ink-mute);cursor:pointer;transition:border-color .12s,background .12s;flex-shrink:0;}#dz:hover,#dz.dh,#dz:focus-within{border-color:var(--accent-border);background:rgba(99,102,241,.04);color:var(--accent-text);}/* sr-only, not display:none: a hidden file input cannot take keyboard focus. */#dz input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;}diff --git a/pages/constellation.html b/pages/constellation.htmlindex 65e1441bf..dc37b3b7d 100644--- a/pages/constellation.html+++ b/pages/constellation.html@@ -41,10 +41,15 @@body { background: var(--bg); color: var(--text); font: 15px/1.55 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }#c-scene { position: fixed; inset: 0; display: block; }canvas { display: block; }+ /* The canvas is the primary control: it takes keyboard focus so arrow keys+ can walk the stars and Enter can open one. Make that focus visible. */+ #c-scene:focus-visible { outline: 2px solid var(--brand-blue-light); outline-offset: -3px; }+ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }.c-hud { position: fixed; top: 22px; left: 22px; max-width: min(420px, 76vw); z-index: 5; pointer-events: none; }.c-badge { display: inline-flex; align-items: center; gap: 8px; pointer-events: auto; text-decoration: none; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 12px; color: var(--muted); margin-bottom: 16px; transition: border-color .15s, color .15s; }.c-badge:hover { border-color: rgba(120,169,255,.5); color: var(--text); }+ .c-badge:focus-visible, .c-links a:focus-visible, .c-close:focus-visible, .c-retry:focus-visible, .c-status a:focus-visible, .c-notice a:focus-visible { outline: 2px solid var(--brand-blue-light); outline-offset: 2px; }.c-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-blue); box-shadow: 0 0 10px var(--brand-blue); }.c-badge strong { color: var(--text); font-weight: 600; }.c-hud h1 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }@@ -58,7 +63,11 @@.c-status code { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--brand-blue-light); }.c-hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 5; color: var(--muted); font-size: 12.5px; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px; white-space: nowrap; transition: opacity .4s; }- @media (max-width: 640px) { .c-hint { font-size: 11px; padding: 6px 12px; } }+ /* Narrow viewports: the hint wraps instead of overflowing the screen, and+ sits above the language switcher rather than underneath it. */+ @media (max-width: 720px) {+ .c-hint { font-size: 11px; padding: 6px 14px; bottom: 74px; white-space: normal; text-align: center; max-width: calc(100vw - 28px); border-radius: 14px; line-height: 1.45; }+ }.c-tooltip { position: fixed; z-index: 6; pointer-events: none; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; font-size: 12.5px; opacity: 0; transition: opacity .12s; transform: translate(-50%, -130%); white-space: nowrap; }.c-tooltip .sym { color: var(--brand-blue-light); font-weight: 700; }@@ -101,6 +110,9 @@@keyframes spin { to { transform: rotate(360deg); } }.c-overlay .msg { color: var(--muted); font-size: 14px; max-width: 380px; }.c-overlay .msg strong { color: var(--text); }+ .c-retry { background: var(--brand-blue); border: 1px solid var(--brand-blue-2); color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; border-radius: 10px; padding: 9px 20px; cursor: pointer; transition: background .15s, transform .1s; }+ .c-retry:hover { background: var(--brand-blue-2); }+ .c-retry:active { transform: translateY(1px); }</style><meta property="og:site_name" content="three.ws">@@ -112,19 +124,20 @@<meta name="twitter:site" content="@trythreews"></head><body>- <canvas id="c-scene"></canvas>+ <canvas id="c-scene" tabindex="0" aria-label="Token galaxy. Use the arrow keys to move between stars and press Enter to open the selected token's analysis."></canvas>+ <p class="sr-only" id="c-a11y-live" role="status" aria-live="polite"></p><div class="c-hud"><a class="c-badge" href="/galaxy" data-i18n-html="constellation.three_ws_ibm_watsonx"><span class="dot"></span><strong>three.ws</strong> × IBM watsonx</a><h1 data-i18n-html="constellation.watsonx_constellation">watsonx <span class="g">Constellation</span></h1><p data-i18n="constellation.live_solana_tokens_positioned_in_3d_by">Live Solana tokens, positioned in 3D by IBM Granite embeddings on watsonx.ai. Nearby stars are semantically alike.</p>- <div class="c-status" id="c-status"><span class="s-dot"></span><span id="c-status-text" data-i18n="constellation.starting">Starting…</span></div>+ <div class="c-status" id="c-status" role="status" aria-live="polite"><span class="s-dot"></span><span id="c-status-text" data-i18n="constellation.starting">Starting…</span></div></div>- <div class="c-hint" id="c-hint">drag to orbit · scroll to zoom · click a star for a live Granite analysis</div>+ <div class="c-hint" id="c-hint">drag to orbit · scroll to zoom · click a star (or arrow keys + Enter) for a live Granite analysis</div><div class="c-tooltip" id="c-tooltip"><span class="sym" id="c-tip-sym"></span> <span class="nm" id="c-tip-nm"></span></div>- <aside class="c-panel" id="c-panel" aria-hidden="true">+ <aside class="c-panel" id="c-panel" aria-hidden="true" aria-label="Token detail" inert><div class="c-panel-head"><div class="c-panel-top"><img class="c-panel-logo" id="c-panel-logo" alt="" />@@ -142,7 +155,7 @@<div class="c-links" id="c-panel-links"></div></div><div class="c-analysis-wrap">- <div class="c-analysis-head"><span class="dot"></span>Analysis by <strong data-i18n="constellation.ibm_granite">IBM Granite</strong> on watsonx.ai</div>+ <div class="c-analysis-head"><span class="dot"></span><span id="c-analysis-by">Analysis by <strong data-i18n="constellation.ibm_granite">IBM Granite</strong> on watsonx.ai</span></div><div class="c-analysis" id="c-analysis"></div><div class="c-meta" id="c-analysis-meta"></div><p class="c-disclaim" data-i18n="constellation.generated_by_an_ai_model_from_public">Generated by an AI model from public token metadata. Informational only — not financial advice. Tokens shown are live pump.fun / Solana trending data and are not endorsements.</p>diff --git a/src/coin-pages.css b/src/coin-pages.cssindex bba3f1c37..d14a5f30e 100644--- a/src/coin-pages.css+++ b/src/coin-pages.css@@ -24,6 +24,20 @@--cv-max-width: 1280px;--cv-content-padding: 1rem;}++/* Reachable by assistive tech, invisible on screen: table captions and header+ labels that a sighted reader gets from the layout itself. */+.cv-sr-only {+ position: absolute;+ width: 1px;+ height: 1px;+ padding: 0;+ margin: -1px;+ overflow: hidden;+ clip: rect(0, 0, 0, 0);+ white-space: nowrap;+ border: 0;+}@media (min-width: 768px) {:root {--cv-content-padding: 1.5rem;@@ -469,6 +483,16 @@ html.cv-page,gap: 0.5rem;font-size: 0.875rem;}+/* A failure state carries a sentence and its recovery control, so it stacks. */+.cv-chart-state.col {+ flex-direction: column;+ text-align: center;+ padding: 0 1rem;+}+.cv-chart-state.col p {+ margin: 0;+ max-width: 32rem;+}.cv-spinner {width: 1rem;height: 1rem;@@ -1523,6 +1547,102 @@ html.cv-page,.cmp-chip button:hover {color: var(--cv-red);}+.cmp-chip button:focus-visible {+ outline: 2px solid var(--cv-accent);+ outline-offset: 1px;+ color: var(--cv-text);+}+/* A chip whose coin never resolved says so on the chip itself, so the gap in+ the chart and table is never unexplained. */+.cmp-chip .note {+ font-size: 0.6875rem;+ text-transform: uppercase;+ letter-spacing: 0.03em;+ color: var(--cv-text-3);+}+.cmp-chip[data-state='missing'],+.cmp-chip[data-state='failed'] {+ border-color: color-mix(in srgb, var(--cv-red) 45%, transparent) !important;+}+.cmp-chip[data-state='missing'] .note,+.cmp-chip[data-state='failed'] .note {+ color: var(--cv-red);+}+.cmp-chip[data-state='loading'] .note {+ color: var(--cv-text-3);+}++/* Copy-link: the URL is the shareable artifact, so the page needs a control+ that hands it over without a right-click. */+.cmp-share {+ display: inline-flex;+ align-items: center;+ gap: 0.375rem;+ appearance: none;+ background: var(--cv-surface-2);+ border: 1px solid var(--cv-border);+ border-radius: var(--cv-radius-md);+ color: var(--cv-text-2);+ font: inherit;+ font-size: 0.8125rem;+ padding: 0.5rem 0.75rem;+ cursor: pointer;+ transition:+ border-color 0.15s,+ color 0.15s,+ background 0.15s;+}+.cmp-share:hover:not(:disabled) {+ color: var(--cv-text);+ border-color: var(--cv-text-3);+}+.cmp-share:active:not(:disabled) {+ transform: translateY(1px);+}+.cmp-share:focus-visible {+ outline: 2px solid var(--cv-accent);+ outline-offset: 2px;+}+.cmp-share:disabled {+ opacity: 0.45;+ cursor: not-allowed;+}+#cmp-search input:disabled {+ opacity: 0.6;+ cursor: not-allowed;+}+.cmp-hint {+ margin: -0.75rem 0 1.25rem;+ font-size: 0.8125rem;+ color: var(--cv-text-3);+}+.cmp-hint:empty {+ display: none;+}++/* Coins the API could not resolve: named, with the action that clears them. */+.cmp-issues {+ border: 1px solid color-mix(in srgb, var(--cv-red) 35%, var(--cv-border));+ background: color-mix(in srgb, var(--cv-red) 7%, transparent);+ border-radius: var(--cv-radius-lg);+ padding: 0.875rem 1rem;+ margin-bottom: 1rem;+ font-size: 0.875rem;+ color: var(--cv-text-2);+}+.cmp-issues p {+ margin: 0 0 0.25rem;+}+.cmp-issues strong {+ color: var(--cv-text);+ font-weight: 600;+}+.cmp-issues .acts {+ display: flex;+ flex-wrap: wrap;+ gap: 1rem;+ margin-top: 0.5rem;+}.cmp-table-wrap {overflow-x: auto;border: 1px solid var(--cv-border);@@ -1590,6 +1710,18 @@ html.cv-page,height: 3px;border-radius: 2px;}+.cmp-legend .li.na {+ color: var(--cv-text-3);+}+.cmp-legend .li.na .dot {+ opacity: 0.4;+}+.cmp-legend .tag {+ font-size: 0.6875rem;+ text-transform: uppercase;+ letter-spacing: 0.03em;+ color: var(--cv-text-3);+}/* ── Liquidations pulse strip (/coins) ─────────────────────────────────────Real-time long/short liquidation pain across Binance, Bybit, and OKX,diff --git a/src/coin3d/main.js b/src/coin3d/main.jsindex a2e452ad9..e40780c71 100644--- a/src/coin3d/main.js+++ b/src/coin3d/main.js@@ -74,10 +74,14 @@ const isPlausibleMint = (s) => BASE58_RE.test(String(s || '').trim());// ── MCP client (JSON-RPC over the public read-only endpoint) ─────────────────let rpcId = 0;-async function mcpCall(name, args = {}) {+// Every call is bounded. An RPC provider that accepts the socket and then+// stalls used to hang the whole page on the loading spinner forever, because+// nothing downstream could time it out.+async function mcpCall(name, args = {}, timeoutMs = 15_000) {const res = await fetch(MCP_ENDPOINT, {method: 'POST',headers: { 'content-type': 'application/json' },+ signal: AbortSignal.timeout(timeoutMs),body: JSON.stringify({jsonrpc: '2.0',id: ++rpcId,diff --git a/src/scene-compose.js b/src/scene-compose.jsindex b9fc49c7d..428695807 100644--- a/src/scene-compose.js+++ b/src/scene-compose.js@@ -1605,6 +1605,13 @@ async function saveOutfit() {toast(`Save outfit keeps up to ${MAX_SAVED_ATTACHMENTS} attached items; use Export GLB for more`);return;}+ // A dropped local file lives at a blob: URL that dies with this tab, so+ // persisting one would save an outfit that is broken the moment it reloads.+ const local = attached.filter((a) => /^blob:/i.test(a.url));+ if (local.length) {+ toast(`"${local[0].name}" is a local file. Upload it via /forge, or use Export GLB to keep this scene.`, 5000);+ return;+ }if (!avatarRecordId) { toast('Use Export GLB to save this scene'); return; }showLoading('Saving outfit…');try {