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
Consolidate vision endpoint and wallet chip presence
nirholas7da13b131e7d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2cbee3d43..8c6a72d83 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -28,6 +28,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Improvement: every server error now hands you a support reference code** — When something fails on our side, the response no longer just says 'something went wrong' — it now carries a short reference code (e.g. 'quote ref a1b2c3d4 to support'). That same code is attached to the exact server log line, our error tracker, and the ops alert that pages the team, so one code maps to one incident. This was already true for most API responses; we extended it to the remaining surfaces that previously failed silently — the RSS announcements feed, sitemaps, the MCP payment flow, on-chain permission checks, and the Solana RPC proxy — so any failure you hit is traceable. Nothing changes when things work; this only makes the rare error far faster to diagnose. `[improvement, infra]`- **IRL: pinned agents now hold their exact spot indoors instead of drifting** — When you pin your agent to a real-world spot in IRL — on a table, a desk, a shelf — it now stays put as you pan and move your phone, instead of sliding away. Indoors, GPS is only accurate to tens of metres, and the camera was re-reading that noisy fix every few seconds and yanking the agent across the room. Now a pinned agent holds the precise spot you dropped it on whenever the fix is too coarse to trust, while the compass radar and nearby agents keep tracking as before; the moment you step outside and get a clean fix, it resumes following your real-world movement. The result is a rock-steady tabletop pin that finally behaves the way you'd expect. (`/irl`) `[fix]`- **Mirror a proven agent and yours trades alongside it — Copy Trading, fully custodial** — Follow a high-performing agent and your own agent now mirrors its real on-chain trades automatically — proportionally, and strictly inside the spend policy you already set. The new /mirror page ranks followable agents by an honest, on-chain-derived track record (realized P&L, win rate, drawdown, volume — losers included, every number traced to a real signature), so you can vet a leader before you copy them. Unlike anonymous copy-trade products, the thing you follow is an ownable three.ws agent with a face, a voice, and its own real funds at stake. Set the leash once — fixed amount, a percentage of the leader's size, or a percentage of your balance, plus optional per-trade and daily caps and a token skip/allow list — and your avatar trades while you sleep. Every mirrored trade runs the exact same owner-only, limit-gated, rug-checked, audited path as your manual trades, lands in your custody trail labeled "mirrored from" the leader, and produces a real explorer signature. If a leader's move would blow your budget it's scaled down or skipped with a plain-language reason, never a silent overspend. Pause any one leader instantly, or hit the kill switch to halt all mirroring at once. Manage it from any agent's profile or the new Copy Trading hub — owner-only, enforced in the UI and on the server. (`/mirror`) `[feature]`+- **Mocap Studio: saving a face-capture clip just works** — Record your face on any avatar in Mocap Studio and hit Save — it now saves reliably for everyone. Before, if you were previewing the default avatar or someone else's public avatar, saving could fail with an error because the clip tried to attach an avatar that wasn't yours. Now a clip is always tied to your own avatar when you're recording on it, and simply saved on its own otherwise — so the capture-to-save flow never dead-ends. Your saved clips show up in the library to replay, share, or download. (`/mocap-studio`) `[fix]`- **More uploaded avatars animate out of the box — no more accidental T-poses** — Avatars exported from Reallusion Character Creator 3/4 and 3ds Max (Biped) used to import frozen in a stiff T-pose because the platform didn't recognize their skeleton naming. Both are now mapped to the universal rig, so a CC or Biped avatar walks, idles, and emotes like any other — legs included — the moment you bring it in. A batch of generic side-labelled rigs from auto-riggers now animate too. No setup, no allowlist; it just moves. `[fix, improvement]`- **New: a server error now lands you on a real page — with your support code ready to copy** — On the rare occasion something breaks on our side, you used to get the host's blank error screen — a dead end. Now you land on a proper three.ws page: your agent facepalms at the glitch, the page tells you plainly it's on us (and that the team was alerted the instant it happened), and it shows a one-tap 'Copy' support reference. 'Try again' retries the exact page that failed, not a generic home redirect. Real API and agent callers still receive the precise JSON error they expect with that same reference — only humans get routed to the friendly page. It's keyboard-accessible, fully responsive, and respects reduced-motion settings. `[feature, improvement]`- **New: pin an agent to a real place indoors with a QR marker — your friend finds it standing there** — IRL agents could be dropped at a GPS spot, but GPS is useless inside a home — it's off by whole rooms and never agrees between two phones, so a friend could never find the agent you placed in your living room. Marker mode fixes that. Open /irl on Android Chrome, tap Marker, and point your camera at a QR — your own, or one you generate right there to print or show on another screen. Once it locks, the QR becomes a shared anchor both phones agree on with no GPS and no compass: walk to a spot, tap 'Place here', and the agent stands exactly where you are. Anyone who opens /irl and scans the same marker sees that agent standing in the same physical place — point at the bathroom and it's not there, sweep back to the middle of the living room and there it is. It reuses the same exact room-frame math the platform already trusts, hides the agent honestly when the marker isn't in view (there's no guessing where it went), and only appears on phones that can actually scan, so it's never a dead button. (`/irl`) `[feature]`@@ -36,6 +37,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **New: your avatar comes alive in iOS AR — it breathes and idles in your room** — Placing an avatar in AR on iPhone or iPad used to drop a frozen mannequin into your space. Now it arrives animated — a gentle idle/breathing loop plays and repeats on its own, so the figure standing on your table actually feels alive. We do this without any extra app or converter: the avatar is driven through a real animation, sampled frame by frame, and written straight into the AR file that Apple's Quick Look plays. If a particular avatar can't be animated, it still places perfectly as a clean static pose — animation is a bonus, never a blocker. `[feature, improvement]`- **Prompt-to-avatar: a live progress bar you can cancel, plus motion and screen-reader polish** — Building an avatar from a text prompt now shows a progress bar that actually moves second-to-second (tied to real elapsed time) instead of sitting frozen between stages, a real elapsed clock, and a Cancel button (or Escape) so you're never stuck watching a spinner. Across the creator we now respect your 'reduce motion' setting (spinners and auto-spin previews hold still), the camera flow tells you exactly what to do if you deny permission instead of silently doing nothing, and progress, errors, and the bring-your-own-key form are announced properly to screen readers. Character Studio shows a loading silhouette and an actionable Retry if something fails to load. (`/create/prompt`) `[improvement]`- **Security: CSRF protection extended to sniper arming and trade limits** — Arming an autonomous sniper strategy and changing an agent's discretionary trade limits both commit or unlock real custodial funds, so both writes now require the same one-time CSRF token every other money-moving action already enforced (withdraw, vanity grind, spend limits, trade execution). Ownership was always re-checked server-side on these endpoints; this closes the remaining gap so a forged cross-site request can't arm a sniper or loosen a trade cap. No change to how you use them — the dashboard already sends the token. `[security]`+- **See the agent economy move, live, on the home page** — The home page now carries a live readout of real value moving between agents — every tip, payment, trade, and token launch as it happens on-chain. It calls out the hottest-earning agent right now as a discovery hook, shows running totals for the window, and lists the most recent flows; each one links straight to the agent and to its real transaction on Solscan. Nothing is simulated — when the market is quiet, it says so honestly instead of inventing activity. It's the compact face of the Agent Galaxy's Money-Cam, and the whole widget is a doorway into the full 3D money map. (`/galaxy`) `[feature]`- **See who mirrors an agent — the copy-trade follower graph, with faces** — Copy Trading is a social graph, so now you can see it. Every agent's profile shows the real avatars of the agents that mirror it: a live pile of follower faces, each linking straight to that follower's own profile, plus a count of how many are actively copying. On your own agent you see exactly who is trading alongside you; on any leader you're vetting, you see its real following before you commit. Every face is a real three.ws agent with a wallet at stake — drawn from live follow records, never a placeholder. (`/mirror`) `[improvement]`- **Skill-sale earnings now show up in your agent's Earn tab** — The Earn tab's headline number — what your avatar has actually earned — now counts every skill sale, not just tips. The earnings summary was reading from the wrong ledger, so an agent that sold skills could see $0 from sales even though the money had really arrived. It now reads the same real revenue ledger every confirmed purchase and paid skill call writes to, so today / 7-day / all-time totals, the 'earned while you were away' moment, and the receipts statement all include real skill income — each sale traceable to its on-chain payment. Sales settled in a non-USDC currency are counted honestly rather than silently dropped. (`/agent`) `[fix]`- **Social recovery & inheritance — a funded agent that never dies with its owner** — Your agent's wallet is custodial and real-money funded, so "I lost access" or "the owner is gone" should never mean the funds are lost forever. You can now name guardians (real three.ws accounts you trust) and a beneficiary, and set how many guardians must agree. If you ever lose access, that threshold of guardians approving — plus a 48-hour safety window only you can cancel — hands control of the agent and its wallet back to you. An optional dead-man's switch passes the agent to your beneficiary if you go silent past a period you choose, but only after a generous, cancellable grace window and an explicit confirmation — and you abort the whole thing instantly just by showing up (a login, a trade, or tapping "I'm here"). Crucially, no private key is ever exported or exposed: recovery and inheritance only change who owns the agent, and the same encrypted, server-held key keeps signing for the new owner. Every step is time-locked, reversible until commit, and written to your custody trail; the wallet is frozen against autonomous spending during any contested process so it can never be drained out from under you. Guardians act from a new Guardian console — the agents you're trusted to protect, where you approve a recovery or confirm an inheritance without ever touching anyone's funds. (`/guardian`) `[feature, security]`diff --git a/api/_lib/vision-nvidia.js b/api/_lib/vision-nvidia.jsdeleted file mode 100644index 07dfa002f..000000000--- a/api/_lib/vision-nvidia.js+++ /dev/null@@ -1,209 +0,0 @@-// Free NVIDIA NIM vision lane — multimodal VLM understanding over the same-// OpenAI-compatible REST surface (integrate.api.nvidia.com) and the same free-// nvapi key already used by api/chat.js. Net-new capability: hand the model an-// image (a viewer screenshot, an uploaded reference, a launch thumbnail) and a-// question, get back text — "describe this 3D model", "write alt text", "is this-// thumbnail readable", "what style is this avatar".-//-// ── Image transport (the contract that makes this non-trivial) ───────────────-// NVIDIA's hosted VLMs accept an image two ways, and which one is legal depends-// on size:-// • Inline: embed a data URI in the message content as an HTML <img> tag,-// <img src="data:image/jpeg;base64,…" />-// This is REJECTED for payloads at/above ~180 KB (the documented inline cap).-// • Asset reference: for anything larger, upload the bytes to the NVCF Assets-// API first, then reference the returned asset id in the SAME <img> tag with-// the `asset_id` scheme and list it in the NVCF-INPUT-ASSET-REFERENCES header:-// <img src="data:image/jpeg;asset_id,<id>" /> + header: NVCF-INPUT-ASSET-REFERENCES: <id>-// This module picks the right path by size so callers never have to. The-// asset-id `;asset_id,` + NVCF-INPUT-ASSET-REFERENCES handshake is the same one-// documented for the TRELLIS provider (api/_providers/nvidia.js).-//-// Error codes match the provider contract used elsewhere (tts-nvidia.js):-// not_configured | invalid_key | rate_limited | invalid_argument |-// timeout | provider_unreachable | provider_error.--import { env } from './env.js';--const CHAT_URL = 'https://integrate.api.nvidia.com/v1/chat/completions';-const ASSETS_URL = 'https://api.nvcf.nvidia.com/v2/nvcf/assets';--// Inline data-URI images must stay under the hosted cap. NVIDIA documents ~180 KB-// on the encoded payload; measure the base64 string length (what actually rides-// in the JSON) and switch to the asset upload below this with margin.-const INLINE_B64_LIMIT = 180_000;-const DEFAULT_TIMEOUT_MS = 45_000;--// Hosted free VLMs. Default is the strongest general model; the 11B is a lighter,-// faster option. Callers may pass any of these; anything else falls back to the-// default so a typo never reaches the upstream as an invalid model.-export const VISION_MODELS = new Set([- 'meta/llama-3.2-90b-vision-instruct',- 'meta/llama-3.2-11b-vision-instruct',- 'microsoft/phi-3.5-vision-instruct',- 'nvidia/vila',-]);-export const DEFAULT_VISION_MODEL = 'meta/llama-3.2-90b-vision-instruct';--// A useful default task when the caller supplies only an image: a tight,-// platform-relevant description rather than an open-ended ramble.-export const DEFAULT_VISION_PROMPT =- 'Describe this 3D model or avatar render in two sentences: subject, style, and notable details. Be concrete and concise.';--export function visionConfigured() {- return Boolean(env.NVIDIA_API_KEY);-}--export function resolveVisionModel(model) {- return VISION_MODELS.has(model) ? model : DEFAULT_VISION_MODEL;-}--function providerError(status, detail) {- let code = 'provider_error';- if (status === 401 || status === 403) code = 'invalid_key';- else if (status === 429) code = 'rate_limited';- else if (status === 400 || status === 422) code = 'invalid_argument';- const err = new Error(`NVIDIA vision returned ${status}${detail ? `: ${String(detail).slice(0, 300)}` : ''}`);- err.code = code;- err.providerStatus = status;- return err;-}--// Upload image bytes to the NVCF Assets API and return the asset id. Two steps:-// register the asset (get a presigned PUT url + id), then PUT the bytes. The-// description is echoed into the required x-amz-meta header on the PUT.-async function uploadAsset({ bytes, contentType, apiKey, timeoutMs }) {- const description = 'three.ws vision input';- let reg;- try {- reg = await fetch(ASSETS_URL, {- method: 'POST',- headers: {- authorization: `Bearer ${apiKey}`,- 'content-type': 'application/json',- accept: 'application/json',- },- body: JSON.stringify({ contentType, description }),- signal: AbortSignal.timeout(timeoutMs),- });- } catch (e) {- throw Object.assign(new Error(`NVCF asset registration unreachable: ${e?.message}`), { code: 'provider_unreachable' });- }- if (!reg.ok) {- const detail = await reg.text().catch(() => '');- throw providerError(reg.status, detail);- }- const { uploadUrl, assetId } = await reg.json();- if (!uploadUrl || !assetId) {- throw Object.assign(new Error('NVCF asset registration returned no uploadUrl/assetId'), { code: 'provider_error' });- }-- let put;- try {- put = await fetch(uploadUrl, {- method: 'PUT',- headers: {- 'content-type': contentType,- 'x-amz-meta-nvcf-asset-description': description,- },- body: bytes,- signal: AbortSignal.timeout(timeoutMs),- });- } catch (e) {- throw Object.assign(new Error(`NVCF asset upload unreachable: ${e?.message}`), { code: 'provider_unreachable' });- }- if (!put.ok) {- const detail = await put.text().catch(() => '');- throw providerError(put.status, detail);- }- return assetId;-}--// Ask a hosted VLM about an image.-//-// { imageBytes: Buffer, contentType?, prompt?, model?, maxTokens?, temperature?,-// timeoutMs?, apiKey? }-// → { text, model, assetId|null }-//-// Throws Error with .code ∈ not_configured | invalid_key | rate_limited |-// invalid_argument | timeout | provider_unreachable | provider_error.-export async function describeImage({- imageBytes,- contentType = 'image/jpeg',- prompt = DEFAULT_VISION_PROMPT,- model = DEFAULT_VISION_MODEL,- maxTokens = 512,- temperature = 0.2,- timeoutMs = DEFAULT_TIMEOUT_MS,- apiKey,-} = {}) {- const key = apiKey || env.NVIDIA_API_KEY;- if (!key) {- throw Object.assign(new Error('NVIDIA_API_KEY not set'), { code: 'not_configured' });- }- const bytes = Buffer.isBuffer(imageBytes) ? imageBytes : Buffer.from(imageBytes || []);- if (!bytes.length) {- throw Object.assign(new Error('no image bytes to analyze'), { code: 'invalid_argument' });- }-- const resolvedModel = resolveVisionModel(model);- const base64 = bytes.toString('base64');- const extraHeaders = {};- let assetId = null;- let imgTag;-- if (base64.length < INLINE_B64_LIMIT) {- imgTag = `<img src="data:${contentType};base64,${base64}" />`;- } else {- assetId = await uploadAsset({ bytes, contentType, apiKey: key, timeoutMs });- imgTag = `<img src="data:${contentType};asset_id,${assetId}" />`;- extraHeaders['NVCF-INPUT-ASSET-REFERENCES'] = assetId;- }-- const userPrompt = String(prompt || DEFAULT_VISION_PROMPT).slice(0, 2000);- const body = {- model: resolvedModel,- messages: [{ role: 'user', content: `${userPrompt} ${imgTag}` }],- max_tokens: Math.min(Math.max(Number(maxTokens) || 512, 16), 2048),- temperature: Math.min(Math.max(Number(temperature) || 0, 0), 1),- stream: false,- };-- let res;- try {- res = await fetch(CHAT_URL, {- method: 'POST',- headers: {- authorization: `Bearer ${key}`,- 'content-type': 'application/json',- accept: 'application/json',- ...extraHeaders,- },- body: JSON.stringify(body),- signal: AbortSignal.timeout(timeoutMs),- });- } catch (e) {- const timedOut = e?.name === 'TimeoutError' || e?.name === 'AbortError';- throw Object.assign(new Error(`NVIDIA vision unreachable: ${e?.message}`), {- code: timedOut ? 'timeout' : 'provider_unreachable',- });- }-- if (!res.ok) {- let detail = '';- try {- const j = await res.json();- detail = j?.detail || j?.message || j?.error?.message || JSON.stringify(j);- } catch {- detail = await res.text().catch(() => '');- }- throw providerError(res.status, detail);- }-- const data = await res.json().catch(() => null);- const text = data?.choices?.[0]?.message?.content?.trim?.() || '';- if (!text) {- throw Object.assign(new Error('NVIDIA vision returned an empty completion'), { code: 'provider_error' });- }- return { text, model: resolvedModel, assetId };-}diff --git a/api/vision.js b/api/vision.jsindex 93318ad91..6fd092311 100644--- a/api/vision.js+++ b/api/vision.js@@ -1,42 +1,34 @@-// POST /api/vision — free multimodal image understanding for the platform.+// POST /api/vision — public image-understanding endpoint.//-// Hand a hosted NVIDIA VLM an image and a question, get back text. Net-new,-// purely additive capability on the same free nvapi key that already powers-// chat, embeddings, TTS, and 3D generation. Product uses: describe / critique a-// 3D-model render, write alt text for a launch thumbnail, auto-tag an avatar's-// style, sanity-check a generated texture.-//-// Lane: NVIDIA NIM VLM over the OpenAI-compatible REST surface-// (api/_lib/vision-nvidia.js). Small images ride inline; large ones are uploaded-// to the NVCF asset store and referenced — the lib handles the switch.+// A thin HTTP surface over the canonical vision lib (api/_lib/vision.js): the+// free-first NIM VLM chain, paid backstop, SSRF guard, and spend-ledger all live+// there and are inherited here — this file does not re-implement provider policy.+// The capability already powers Forge upload checks, the Fact Checker, and+// gallery alt text internally; exposing it over HTTP is the additive part, so+// external agents and the client can ask a free model about an image too.//// Request: raw image bytes as the body (Content-Type sets the image type), or a-// JSON body { image: <base64 or data URI>, prompt?, model?, maxTokens? }.-// Query/JSON params: prompt (the question; defaults to a concise describe),-// model (a VISION_MODELS id), maxTokens.-// Response: { text, model, usedAssetUpload }.+// JSON body { image: <base64 or data URI>, imageUrl?, prompt?, maxTokens? }.+// `imageUrl` must be a public https URL (the model server fetches it — the lib+// SSRF-guards it). Query/JSON: prompt (the question; defaults to a concise+// describe), maxTokens.+// Response: { text, provider, model }.import { cors, method, readBody, readJson, error, json, wrap, rateLimited } from './_lib/http.js';import { getSessionUser, authenticateBearer, extractBearer } from './_lib/auth.js';import { limits, clientIp } from './_lib/rate-limit.js';-import {- describeImage,- visionConfigured,- resolveVisionModel,- VISION_MODELS,- DEFAULT_VISION_MODEL,- DEFAULT_VISION_PROMPT,-} from './_lib/vision-nvidia.js';+import { describeImage, visionConfigured, VisionUnavailableError } from './_lib/vision.js';export const maxDuration = 60;// 12 MiB — comfortably covers a high-res viewer screenshot or photo while-// bounding the in-memory buffer. Larger images route through the NVCF asset-// store inside the lib, but the request body itself is still capped here.+// bounding the in-memory buffer per request.const MAX_IMAGE_BYTES = 12 * 1024 * 1024;-const VISION_TIMEOUT_MS = 50_000;+const VISION_TIMEOUT_MS = 20_000;const ACCEPTED_TYPES = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];+const DEFAULT_PROMPT =+ 'Describe this 3D model or avatar render in two sentences: subject, style, and notable details. Be concrete and concise.';function isAcceptedImageType(ct) {const type = String(ct || '').split(';')[0].trim().toLowerCase();@@ -53,18 +45,13 @@ export default wrap(async function handler(req, res) {return json(res,200,- {- configured: visionConfigured(),- models: [...VISION_MODELS],- defaultModel: DEFAULT_VISION_MODEL,- imageTypes: ACCEPTED_TYPES,- },+ { configured: visionConfigured(), imageTypes: ACCEPTED_TYPES },{ 'cache-control': 'public, max-age=60' },);}if (!visionConfigured()) {- return error(res, 503, 'not_configured', 'Vision is not configured (set NVIDIA_API_KEY)');+ return error(res, 503, 'not_configured', 'Vision is not configured (set NVIDIA_API_KEY, or OPENAI_API_KEY for the paid backstop)');}// Metered like the other free NVIDIA lanes.@@ -84,24 +71,25 @@ export default wrap(async function handler(req, res) {const contentType = req.headers['content-type'] || '';const isJson = contentType.split(';')[0].trim().toLowerCase() === 'application/json';- let imageBytes;- let imageType = 'image/jpeg';- let prompt = q.get('prompt') || DEFAULT_VISION_PROMPT;- let model = resolveVisionModel(q.get('model') || DEFAULT_VISION_MODEL);+ let imageBase64 = null;+ let imageUrl = null;+ let mimeType = 'image/jpeg';+ let prompt = q.get('prompt') || DEFAULT_PROMPT;let maxTokens = Number(q.get('maxTokens')) || 512;try {if (isJson) {const body = await readJson(req, Math.ceil(MAX_IMAGE_BYTES * 1.4)); // base64 inflates ~33%- const raw = typeof body.image === 'string' ? body.image : '';- if (!raw) return error(res, 400, 'bad_request', 'image (base64 or data URI) is required');- // Honor the data-URI mime if present; otherwise default to jpeg.- const dataUri = raw.match(/^data:(image\/[a-z+]+);base64,(.*)$/i);- const b64 = dataUri ? dataUri[2] : raw.replace(/^data:[^,]*,/, '');- imageType = dataUri ? dataUri[1].toLowerCase() : (isAcceptedImageType(body.imageType) || 'image/jpeg');- imageBytes = Buffer.from(b64, 'base64');+ if (typeof body.imageUrl === 'string' && body.imageUrl.trim()) {+ imageUrl = body.imageUrl.trim();+ } else if (typeof body.image === 'string' && body.image) {+ const dataUri = body.image.match(/^data:(image\/[a-z+]+);base64,(.*)$/i);+ imageBase64 = dataUri ? dataUri[2] : body.image.replace(/^data:[^,]*,/, '');+ mimeType = dataUri ? dataUri[1].toLowerCase() : (isAcceptedImageType(body.imageType) || 'image/jpeg');+ } else {+ return error(res, 400, 'bad_request', 'image (base64/data URI) or imageUrl is required');+ }if (typeof body.prompt === 'string' && body.prompt.trim()) prompt = body.prompt;- if (typeof body.model === 'string') model = resolveVisionModel(body.model);if (Number(body.maxTokens)) maxTokens = Number(body.maxTokens);} else {const t = isAcceptedImageType(contentType);@@ -110,41 +98,40 @@ export default wrap(async function handler(req, res) {res,415,'unsupported_media_type',- `Unsupported image Content-Type "${contentType.split(';')[0] || 'none'}". Send image/jpeg, image/png, image/webp, or image/gif (or a JSON body with a base64 image).`,+ `Unsupported image Content-Type "${contentType.split(';')[0] || 'none'}". Send image/jpeg, image/png, image/webp, or image/gif (or a JSON body with a base64 image / imageUrl).`,);}- imageType = t;- imageBytes = await readBody(req, MAX_IMAGE_BYTES);+ mimeType = t;+ imageBase64 = (await readBody(req, MAX_IMAGE_BYTES)).toString('base64');}} catch (e) {if (e?.status === 413) return error(res, 413, 'payload_too_large', 'image exceeds the 12 MB limit');return error(res, e?.status || 400, 'bad_request', e?.message || 'could not read request body');}- if (!imageBytes?.length) return error(res, 400, 'bad_request', 'no image bytes received');-try {const out = await describeImage({- imageBytes,- contentType: imageType,- prompt,- model,- maxTokens,+ prompt: String(prompt).slice(0, 2000),+ imageUrl,+ imageBase64,+ mimeType,+ maxTokens: Math.min(Math.max(maxTokens, 16), 2048),timeoutMs: VISION_TIMEOUT_MS,+ track: { userId, tool: 'api/vision' },});return json(res,200,- { text: out.text, model: out.model, usedAssetUpload: Boolean(out.assetId) },+ { text: out.text, provider: out.provider, model: out.model },{ 'cache-control': 'no-store' },);} catch (e) {- const code = e?.code || 'provider_error';- const status =- code === 'rate_limited' ? 429 :- code === 'invalid_argument' ? 400 :- code === 'not_configured' ? 503 :- 502;- return error(res, status, code, `Image understanding failed: ${e?.message || 'unknown error'}`);+ if (e instanceof VisionUnavailableError) {+ return error(res, 503, 'not_configured', e.message);+ }+ // invalid_image_url / no_image are caller errors (400); everything else is+ // an upstream failure surfaced as 502.+ const status = e?.code === 'invalid_image_url' || e?.code === 'no_image' ? 400 : (e?.status || 502);+ return error(res, status, e?.code || 'upstream_error', `Image understanding failed: ${e?.message || 'unknown error'}`);}});diff --git a/data/changelog.json b/data/changelog.jsonindex abcebb0f3..4c42c4cdf 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-23",+ "title": "Mocap Studio: saving a face-capture clip just works",+ "summary": "Record your face on any avatar in Mocap Studio and hit Save — it now saves reliably for everyone. Before, if you were previewing the default avatar or someone else's public avatar, saving could fail with an error because the clip tried to attach an avatar that wasn't yours. Now a clip is always tied to your own avatar when you're recording on it, and simply saved on its own otherwise — so the capture-to-save flow never dead-ends. Your saved clips show up in the library to replay, share, or download.",+ "tags": [+ "fix"+ ],+ "link": "/mocap-studio"+ },{"date": "2026-06-23","title": "See the agent economy move, live, on the home page",diff --git a/pages/agent-detail.html b/pages/agent-detail.htmlindex 9dd07924d..2c16d9576 100644--- a/pages/agent-detail.html+++ b/pages/agent-detail.html@@ -577,6 +577,15 @@<div class="flex space-x-2 mt-4 justify-start" id="ad-holdings-actions"></div></section>+ <section class="ad-card" id="ad-stream-card" hidden>+ <div class="ad-card-head">+ <span class="ad-bullet"></span>+ <h2 id="ad-stream-title">MONEY STREAM</h2>+ <span id="ad-stream-sub" style="margin-left:auto;font-size:.7rem;color:var(--ink-dim,#888)">pay by the second</span>+ </div>+ <div id="ad-stream-mount"></div>+ </section>+<section class="ad-card" id="ad-pulse-card" hidden><div class="ad-card-head"><span class="ad-bullet"></span>diff --git a/pages/home.html b/pages/home.htmlindex 1c45f5b57..59338cc42 100644--- a/pages/home.html+++ b/pages/home.html@@ -4446,7 +4446,7 @@<section class="block"><div class="wrap-1280"><div class="block-head reveal">- <p class="block-eyebrow"><span class="num">05</span>Developer platform</p>+ <p class="block-eyebrow"><span class="num">06</span>Developer platform</p><h2 class="block-h">Headless API. <em>Full power.</em></h2><p class="block-lede">Everything available through a REST API, SDK, and MCP server. Build custom agents, automate workflows, and connect to any AI tool.@@ -4600,7 +4600,7 @@<section class="block"><div class="wrap-1280"><div class="block-head reveal">- <p class="block-eyebrow"><span class="num">06</span>How it works</p>+ <p class="block-eyebrow"><span class="num">07</span>How it works</p><h2 class="block-h">Three steps. <em>One living character.</em></h2></div><div class="steps reveal reveal-d1">@@ -4627,7 +4627,7 @@<section class="block"><div class="wrap-1280"><div class="block-head reveal">- <p class="block-eyebrow"><span class="num">07</span>The stack</p>+ <p class="block-eyebrow"><span class="num">08</span>The stack</p><h2 class="block-h">Six pieces. <em>One layer.</em></h2><p class="block-lede">Every component is open, real, and shipping today. Use one. Use all. They compose.</p></div>@@ -4678,7 +4678,7 @@<section class="block" id="showcase-3d-section"><div class="wrap-1280"><div class="block-head reveal">- <p class="block-eyebrow"><span class="num">08</span>Discover</p>+ <p class="block-eyebrow"><span class="num">09</span>Discover</p><h2 class="block-h">Living agents, <em>right now.</em></h2><p class="block-lede">A taste of what's running across the web today. Click any agent to talk, remix, or grab their embed code.</p></div>@@ -4694,7 +4694,7 @@<section class="block body-drop" id="body-drop"><div class="wrap-1280"><div class="body-drop-content reveal">- <p class="block-eyebrow"><span class="num">09</span>See it in action</p>+ <p class="block-eyebrow"><span class="num">10</span>See it in action</p><h2 class="body-drop-title"><span id="drop-sit-line">Your agent</span><br/>lives <em>here.</em>diff --git a/public/changelog.json b/public/changelog.jsonindex 3e99b22bd..83125fdaa 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-23T05:30:50.227Z",+ "generated_at": "2026-06-23T05:35:52.601Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -230,6 +230,16 @@"feature"]},+ {+ "date": "2026-06-23",+ "type": "update",+ "title": "Mocap Studio: saving a face-capture clip just works",+ "summary": "Record your face on any avatar in Mocap Studio and hit Save — it now saves reliably for everyone. Before, if you were previewing the default avatar or someone else's public avatar, saving could fail with an error because the clip tried to attach an avatar that wasn't yours. Now a clip is always tied to your own avatar when you're recording on it, and simply saved on its own otherwise — so the capture-to-save flow never dead-ends. Your saved clips show up in the library to replay, share, or download.",+ "link": "/mocap-studio",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-23","type": "update",@@ -314,6 +324,16 @@"security"]},+ {+ "date": "2026-06-23",+ "type": "update",+ "title": "See the agent economy move, live, on the home page",+ "summary": "The home page now carries a live readout of real value moving between agents — every tip, payment, trade, and token launch as it happens on-chain. It calls out the hottest-earning agent right now as a discovery hook, shows running totals for the window, and lists the most recent flows; each one links straight to the agent and to its real transaction on Solscan. Nothing is simulated — when the market is quiet, it says so honestly instead of inventing activity. It's the compact face of the Agent Galaxy's Money-Cam, and the whole widget is a doorway into the full 3D money map.",+ "link": "/galaxy",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-23","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex fe0864dd4..de7d37f30 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -182,6 +182,14 @@<category>feature</category><description>Follow a high-performing agent and your own agent now mirrors its real on-chain trades automatically — proportionally, and strictly inside the spend policy you already set. The new /mirror page ranks followable agents by an honest, on-chain-derived track record (realized P&L, win rate, drawdown, volume — losers included, every number traced to a real signature), so you can vet a leader before you copy them. Unlike anonymous copy-trade products, the thing you follow is an ownable three.ws agent with a face, a voice, and its own real funds at stake. Set the leash once — fixed amount, a percentage of the leader's size, or a percentage of your balance, plus optional per-trade and daily caps and a token skip/allow list — and your avatar trades while you sleep. Every mirrored trade runs the exact same owner-only, limit-gated, rug-checked, audited path as your manual trades, lands in your custody trail labeled "mirrored from" the leader, and produces a real explorer signature. If a leader's move would blow your budget it's scaled down or skipped with a plain-language reason, never a silent overspend. Pause any one leader instantly, or hit the kill switch to halt all mirroring at once. Manage it from any agent's profile or the new Copy Trading hub — owner-only, enforced in the UI and on the server.</description></item>+ <item>+ <title>Mocap Studio: saving a face-capture clip just works</title>+ <link>https://three.ws/mocap-studio</link>+ <guid isPermaLink="false">2026-06-23:Mocap Studio: saving a face-capture clip just works</guid>+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Record your face on any avatar in Mocap Studio and hit Save — it now saves reliably for everyone. Before, if you were previewing the default avatar or someone else's public avatar, saving could fail with an error because the clip tried to attach an avatar that wasn't yours. Now a clip is always tied to your own avatar when you're recording on it, and simply saved on its own otherwise — so the capture-to-save flow never dead-ends. Your saved clips show up in the library to replay, share, or download.</description>+ </item><item><title>More uploaded avatars animate out of the box — no more accidental T-poses</title><link>https://three.ws/changelog</link>@@ -246,6 +254,14 @@<category>security</category><description>Arming an autonomous sniper strategy and changing an agent's discretionary trade limits both commit or unlock real custodial funds, so both writes now require the same one-time CSRF token every other money-moving action already enforced (withdraw, vanity grind, spend limits, trade execution). Ownership was always re-checked server-side on these endpoints; this closes the remaining gap so a forged cross-site request can't arm a sniper or loosen a trade cap. No change to how you use them — the dashboard already sends the token.</description></item>+ <item>+ <title>See the agent economy move, live, on the home page</title>+ <link>https://three.ws/galaxy</link>+ <guid isPermaLink="false">2026-06-23:See the agent economy move, live, on the home page</guid>+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The home page now carries a live readout of real value moving between agents — every tip, payment, trade, and token launch as it happens on-chain. It calls out the hottest-earning agent right now as a discovery hook, shows running totals for the window, and lists the most recent flows; each one links straight to the agent and to its real transaction on Solscan. Nothing is simulated — when the market is quiet, it says so honestly instead of inventing activity. It's the compact face of the Agent Galaxy's Money-Cam, and the whole widget is a doorway into the full 3D money map.</description>+ </item><item><title>See who mirrors an agent — the copy-trade follower graph, with faces</title><link>https://three.ws/mirror</link>diff --git a/public/features.json b/public/features.jsonindex c9c4f6c75..2083d3b4c 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-23T05:30:50.215Z",+ "generated_at": "2026-06-23T05:35:52.581Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/scripts/verify-nvidia-vision.mjs b/scripts/verify-nvidia-vision.mjsdeleted file mode 100644index dae66de93..000000000--- a/scripts/verify-nvidia-vision.mjs+++ /dev/null@@ -1,89 +0,0 @@-#!/usr/bin/env node-// Live verification for the free NVIDIA NIM vision lane.-//-// node scripts/verify-nvidia-vision.mjs # describe a synthetic image (needs NVIDIA_API_KEY)-// node scripts/verify-nvidia-vision.mjs --model meta/llama-3.2-11b-vision-instruct-//-// Builds a real PNG in memory (a solid-color square — proper IHDR/IDAT/IEND-// chunks with CRCs, zlib-deflated scanlines), asks the hosted VLM what color it-// is, and asserts a non-empty answer that names the color. No fixture files are-// written; the whole check stays in memory.--import { config as dotenv } from 'dotenv';-import { deflateSync } from 'node:zlib';--dotenv({ path: new URL('../.env.local', import.meta.url) });-delete process.env.NODE_ENV;-delete process.env.VERCEL_ENV;--if (!process.env.NVIDIA_API_KEY) {- console.error('[vision] NVIDIA_API_KEY missing from environment/.env.local — cannot verify');- process.exit(1);-}--const modelArg = process.argv.indexOf('--model');-const model = modelArg !== -1 ? process.argv[modelArg + 1] : undefined;--// ── minimal PNG encoder (solid RGB square) ──────────────────────────────────-const CRC_TABLE = (() => {- const t = new Uint32Array(256);- for (let n = 0; n < 256; n++) {- let c = n;- for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;- t[n] = c >>> 0;- }- return t;-})();-function crc32(buf) {- let c = 0xffffffff;- for (let i = 0; i < buf.length; i++) c = CRC_TABLE[(c ^ buf[i]) & 0xff] ^ (c >>> 8);- return (c ^ 0xffffffff) >>> 0;-}-function chunk(type, data) {- const len = Buffer.alloc(4);- len.writeUInt32BE(data.length, 0);- const typeBuf = Buffer.from(type, 'ascii');- const crc = Buffer.alloc(4);- crc.writeUInt32BE(crc32(Buffer.concat([typeBuf, data])), 0);- return Buffer.concat([len, typeBuf, data, crc]);-}-function solidPng(size, [r, g, b]) {- const ihdr = Buffer.alloc(13);- ihdr.writeUInt32BE(size, 0);- ihdr.writeUInt32BE(size, 4);- ihdr[8] = 8; // bit depth- ihdr[9] = 2; // color type: truecolor RGB- // rows: a leading filter byte (0 = none) then size*3 color bytes- const row = Buffer.concat([Buffer.from([0]), Buffer.concat(Array.from({ length: size }, () => Buffer.from([r, g, b])))]);- const raw = Buffer.concat(Array.from({ length: size }, () => row));- const idat = deflateSync(raw);- const sig = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);- return Buffer.concat([sig, chunk('IHDR', ihdr), chunk('IDAT', idat), chunk('IEND', Buffer.alloc(0))]);-}--const { describeImage } = await import('../api/_lib/vision-nvidia.js');--try {- // A 128px solid red square — small enough to ride inline, unambiguous to name.- const png = solidPng(128, [220, 20, 20]);- console.log(`[vision] built a ${png.length}-byte synthetic red PNG; asking the model…`);- const t0 = Date.now();- const out = await describeImage({- imageBytes: png,- contentType: 'image/png',- prompt: 'What is the single dominant color of this image? Answer with just the color name.',- model,- maxTokens: 32,- });- console.log(`[vision] model=${out.model} assetUpload=${Boolean(out.assetId)} in ${Date.now() - t0} ms`);- console.log(`[vision] answer: "${out.text}"`);- if (!out.text.trim()) throw new Error('empty completion');- if (!/red|crimson|scarlet/i.test(out.text)) {- console.warn('[vision] WARN — answer did not name red; the lane responded but recognition is suspect.');- } else {- console.log('[vision] PASS — the VLM correctly identified the color. Vision lane works.');- }-} catch (e) {- console.error(`[vision] FAIL — ${e?.code ? `${e.code}: ` : ''}${e?.message || e}`);- process.exit(1);-}diff --git a/src/shared/agent-wallet-chip.js b/src/shared/agent-wallet-chip.jsindex 8e3e5769b..fbcdf2ae9 100644--- a/src/shared/agent-wallet-chip.js+++ b/src/shared/agent-wallet-chip.js@@ -919,8 +919,10 @@ function renderPopoverBody(el, entry, meta) {acts.push(`<button type="button" class="twc-btn twc-btn-primary" data-twc-open-hud title="Open the full wallet">${WALLET_SVG}<span>Open wallet</span></button>`);if (owned) {if (!meta.isVanity && meta.hubUrl) acts.push(`<a class="twc-btn" href="${esc(meta.hubUrl)}#vanity">✦ Vanity</a>`);+ acts.push(`<button type="button" class="twc-btn" data-twc-stream-earn title="See ${esc(meta.name || 'this agent')}'s streaming income">◎ Earnings</button>`);acts.push(`<button type="button" class="twc-btn" data-twc-share>↗ Share</button>`);} else {+ acts.push(`<button type="button" class="twc-btn twc-stream" data-twc-stream title="Stream ${esc(meta.name || 'this agent')} by the second">◎ Stream</button>`);acts.push(`<button type="button" class="twc-btn twc-tip" ${tipAttrs({ meta: { payments: { accepted_tokens: meta.accepted || [] } } }, { address: meta.address, name: meta.name, avatarUrl: meta.avatar })} title="Tip ${esc(meta.name || 'this agent')}">◎ Tip</button>`);acts.push(`<button type="button" class="twc-btn" data-twc-fork>⑂ Fork to own</button>`);}@@ -965,6 +967,27 @@ function wirePopoverActions(el, meta) {openTipModal({ solana_address: meta.address, name: meta.name, avatar_thumbnail_url: meta.avatar || '', meta: { payments: { accepted_tokens: meta.accepted || [] } } });} catch { /* address still copyable */ }});+ // Money Stream — pay-per-second (visitor) or live earnings (owner). Both open+ // the shared panel; the panel renders the role-appropriate view.+ const streamAgent = () => ({+ id: meta.agentId, solana_address: meta.address, name: meta.name,+ avatar_thumbnail_url: meta.avatar || '', isOwner: meta.isOwner,+ meta: { payments: { accepted_tokens: meta.accepted || [] } },+ });+ const stream = el.querySelector('[data-twc-stream]');+ if (stream) stream.addEventListener('click', async () => {+ try {+ const { openStreamPanel } = await import('./agent-money-stream.js');+ openStreamPanel(streamAgent(), { network: meta.network || 'mainnet', mode: 'stream' });+ } catch { /* address still copyable */ }+ });+ const streamEarn = el.querySelector('[data-twc-stream-earn]');+ if (streamEarn) streamEarn.addEventListener('click', async () => {+ try {+ const { openStreamPanel } = await import('./agent-money-stream.js');+ openStreamPanel(streamAgent(), { network: meta.network || 'mainnet', mode: 'earnings' });+ } catch { /* noop */ }+ });const fork = el.querySelector('[data-twc-fork]');if (fork) fork.addEventListener('click', async () => {const dest = `/agent/${meta.agentId}`;diff --git a/src/shared/networth-presence.js b/src/shared/networth-presence.jsindex 970799908..aab6cecda 100644--- a/src/shared/networth-presence.js+++ b/src/shared/networth-presence.js@@ -160,6 +160,34 @@ export function createPresencePanel({ agentId, onPrefsSaved } = {}) {if (isOwner) wireControls(prefs);}+ // Real-data flow chips. Returns '' for a flat, idle wallet (no clutter). Every+ // value is the server's custody-derived `flow` block — never invented.+ function renderFlow(flow, isOwner) {+ const f = flow || {};+ const m = Number(f.momentum_usd_24h) || 0;+ const streaming = Math.max(0, Number(f.streaming_now) || 0);+ const tipAt = f.last_tip_at ? Date.parse(f.last_tip_at) : NaN;+ const recentTip = Number.isFinite(tipAt) && Date.now() - tipAt >= 0 && Date.now() - tipAt < 120_000;+ const bits = [];+ if (m !== 0) {+ const up = m > 0;+ if (isOwner) {+ const a = Math.abs(m);+ const num = a < 1 ? a.toFixed(2) : a < 1000 ? String(Math.round(a)) : `${(a / 1000).toFixed(1)}k`;+ bits.push(`<span class="nwp-flow-item ${up ? 'is-up' : 'is-down'}">${up ? '▲' : '▼'} ${up ? '+' : '−'}$${num} <span class="nwp-flow-cap">24h</span></span>`);+ } else {+ bits.push(`<span class="nwp-flow-item ${up ? 'is-up' : 'is-down'}">${up ? '▲ earning' : '▼ cooling'} <span class="nwp-flow-cap">24h</span></span>`);+ }+ }+ if (streaming > 0) bits.push(`<span class="nwp-flow-item is-stream">⇆ streaming${streaming > 1 ? ` ×${streaming}` : ''}</span>`);+ if (recentTip) bits.push(`<span class="nwp-flow-item is-tip">◎ just tipped</span>`);+ if (!bits.length) return '';+ const title = isOwner+ ? `Last 24h — in ${esc(fmtUsd(Number(f.inflow_usd_24h) || 0))}, out ${esc(fmtUsd(Number(f.outflow_usd_24h) || 0))}`+ : 'Real 24h wallet flow';+ return `<div class="nwp-flow" title="${esc(title)}">${bits.join('')}</div>`;+ }+function renderControls(prefs) {const seg = REACTIVITY_LEVELS.map((lv) =>`<button type="button" data-rx="${lv}" aria-pressed="${prefs.reactivity === lv}">${lv}</button>`,