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
Economy master self-heal trigger, vertex-anchor refinements, changelog
nirholas6879eaff99f2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 09b1395e5..97ab7cb32 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,11 +9,13 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Animation preview plays again on every clip page** — Opening an animation from the marketplace (Arm Flex, Facepalm, Superhero Jump, and the rest) showed an empty black stage where the moving avatar should be. Two things were wrong: the preview was pointed at a skeleton-only file with no body to draw, and the 3D canvas was collapsing to zero height inside its frame. Both are fixed, so every clip page now shows a real avatar performing the animation, framed and lit, with Replay to watch it again. (`/marketplace?tab=animations`) `[fix]`- **Animation Studio asks before restoring unsaved work** — The Studio keeps a local backup of an in-progress animation so a refresh or accidental tab close never loses it. Until now it silently reapplied that backup the instant you opened /pose, which could drop a pose made on one avatar straight onto the plain mannequin and show a contorted figure with no obvious way back to a clean start. Now it greets you with the default figure and a small prompt: 'Unsaved animation found, N keyframes, Restore or Discard.' Restore reloads the exact avatar the pose was made on before applying your keyframes; Discard clears the backup; and if you just start posing, the prompt steps aside and your new work takes over. The backup is protected the whole time, so nothing is lost while you decide. (`/pose`) `[fix]`- **Animation Studio toolbar cleanup** — The Animation Studio (/pose) got a UI pass: toolbar buttons no longer render as oversized circles behind FK and Save, the toolbar fits on laptop screens with pose import/export and screenshots collected under a new overflow menu, the language picker moved into the footer so it stops covering the timeline, error messages show their warning color again, and on phones the animation library and pose presets are reachable instead of hidden. (`/pose`) `[improvement, fix]`+- **Avatar render API: poses now apply and portraits keep the head in frame** — The public avatar image API (GET /api/avatar/render) now actually strikes the pose you ask for: pose presets are applied through the same retargeting engine as the Animation Studio, so wave, sit, flex and the rest land correctly on any humanoid rig instead of silently rendering the default stance. Camera framing was rebuilt too: portrait and headshot crops always keep the full head in frame with proper headroom, at every image size and aspect ratio. Existing cached renders refresh automatically. (`/api/avatar/render`) `[fix, improvement]`- **Avatar Studio: a Parametric base with 120+ face and body sliders** — The Avatar Studio has a second base body: Parametric. Built on the open-source MakeHuman body (CC0, fully licensed), it turns the Sculpt tab into a real character creator with over 120 sliders: nose width and hump, lip volume, pointed elf ears, eye tilt, jawline, head shape, plus whole-body controls for feminine or masculine build, muscle, weight, age, height, waist, hips, shoulders, arms, and legs. Mirror left/right or unlock them for asymmetry. Every combination stays fully rigged and walks, dances, and emotes with the entire animation library, and hats, glasses, and skin tones work like on any avatar. Pick Parametric in the Base switcher at the top of the studio. (`/avatar-studio`) `[feature]`- **Coin detail pages stay up when market data is throttled** — Coin profile pages (the /coin/:id view with price, market cap, links, and developer stats) were returning an error whenever the upstream market-data provider hit its rate limit, which happens under heavy crawling. Now the page serves the most recent good data through those throttling windows instead of failing, and only shows an error for a coin that genuinely has no data. Prices refresh as soon as the provider recovers. (`/coins`) `[fix]`- **Coin pages stay live through market-data outages** — Every coin page (prices, markets, exchanges, charts) now keeps a shared last-good copy of its market data. When the upstream data provider rate-limits or goes down, pages serve slightly older numbers instead of an error, even right after a fresh server starts. The exchanges directory was the last surface that could still show an error during a data-provider storm; now it rides through. (`/exchanges`) `[fix, improvement]`- **Commit feed posts now render a branded three.ws card** — The automatic commit feed (every change that lands on the main branch) used to post to Telegram as bare text: a scope, the raw commit subject, and a GitHub link. It now previews the same designed three.ws poster the changelog feed uses, so each commit reads as a proper card with the change, the date, and the author. Engineering shorthand in the title is translated too, so 'feat' shows as 'Feature', 'fix' as 'Fix', and so on, while real scopes like 'Avatar Studio' pass through unchanged. Clicking the card still opens the exact commit on GitHub. `[improvement]`- **Database storage now heals itself** — The platform database reclaimed 770 MB of dead space and learned to do this on its own: when storage runs tight, the retention job now compacts its own bloated tables instead of waiting for an operator. Background jobs that pause under storage pressure resume automatically. Intel model training also got a memory bound so it keeps learning from the freshest coins without ever outgrowing its worker. `[infra, fix]`+- **Every AI surface now falls back to a funded reserve model** — Chat already had it; now the Brain page, embedded avatar widgets, the Trading Copilot, image understanding, and embedded agent brains share the same safety net. When every free AI lane is rate-limited at the same time, these features now roll over to the platform's own reserve model on Google Cloud instead of returning an error. Fewer failed replies during traffic spikes, with no change to which model answers first. `[fix, infra]`- **Menus no longer show raw translation codes** — A few navigation entries (Daily Match, Character Library, Object Library, and others added recently) could render as internal translation codes like "nav.c3spxn" instead of their real names. Fixed at both ends: the translation runtime now leaves the original English text in place whenever a string is missing from the language catalogs, and the missing menu strings were added and localized into all 11 languages. `[fix]`- **Take the wheel: drive your agent's computer** — Every agent already had a live screen you could watch. Now, if you own the agent, you can grab the wheel of its real browser and drive it yourself: mouse, click and drag, scroll, keyboard, and a URL bar to go anywhere. Open your agent's screen, wait for it to go live, and click Take control. Your agent steps aside while you drive and picks its task back up the moment you let go. It is owner-only, and the browser you drive holds no wallet or keys, so control can never sign a transaction or move funds. This is the first step toward giving every agent its own computer that you and the agent can both operate. (`/agent-screen`) `[feature]`- **What's new, at a glance: newest features on /features and /sitemap** — You no longer have to scroll the changelog to see what just shipped. The Features page opens with a 'New on three.ws' strip: the six latest features and page launches, each card linking straight to the live page. The sitemap gained a matching 'Newest' section listing the most recently launched pages with their dates. Both update themselves with every release. (`/features`) `[improvement]`diff --git a/api/_lib/vertex-gemini.js b/api/_lib/vertex-gemini.jsindex ea549c218..c852267f2 100644--- a/api/_lib/vertex-gemini.js+++ b/api/_lib/vertex-gemini.js@@ -1,4 +1,4 @@-// Vertex Gemini — the platform's credits-funded LLM reliability anchor.+// Vertex Gemini: the platform's credits-funded LLM reliability anchor.//// One shared definition of the rung that api/chat.js proved out (commit// 2b3d00254, "chat anchor eviction"): Gemini on Vertex AI through its@@ -10,10 +10,10 @@// billing_not_active; the OpenRouter host key must never route to paid models).//// Semantics every consumer must preserve (mirroring api/chat.js exactly):-// • The anchor is appended at the TAIL of the chain — never auto-selected as+// • The anchor is appended at the TAIL of the chain: never auto-selected as// a primary route, always present as the last-resort rung.// • Presence of other provider keys (OPENAI_API_KEY etc.) must never evict-// it — no chain cap, cooldown, or anon filter may drop the anchor.+// it: no chain cap, cooldown, or anon filter may drop the anchor.// • Anonymous/keyless callers keep it: it is GCP-credit funded, so it is not// a paid-key drain vector (see ANON_PROVIDER_LIST in chat-models.js).// • Availability is gated ONLY by GOOGLE_CLOUD_PROJECT (set on every Cloud@@ -21,9 +21,9 @@// failure falls through the chain like any other provider error.//// Env knobs (same as the api/chat.js and api/_lib/llm.js rungs):-// GOOGLE_CLOUD_PROJECT — GCP project id (required; gates the rung)-// GOOGLE_CLOUD_LOCATION_GEMINI — region or "global" (default: "global")-// VERTEX_GEMINI_MODEL — model id (default: google/gemini-2.5-flash)+// GOOGLE_CLOUD_PROJECT : GCP project id (required; gates the rung)+// GOOGLE_CLOUD_LOCATION_GEMINI : region or "global" (default: "global")+// VERTEX_GEMINI_MODEL : model id (default: google/gemini-2.5-flash)import { getGcpAccessToken } from './gcp-auth.js';@@ -34,7 +34,7 @@ export function vertexGeminiAvailable() {}// The anchor's model id. Full Flash by default (platform credits, standing-// owner-approved spend) — env-tunable without a code change.+// owner-approved spend): env-tunable without a code change.export function vertexGeminiModel() {return process.env.VERTEX_GEMINI_MODEL || 'google/gemini-2.5-flash';}@@ -47,14 +47,14 @@ function vertexGeminiTarget() {return { project, location, host };}-// OpenAI-compatible base URL (no trailing /chat/completions) — for SDK clients+// OpenAI-compatible base URL (no trailing /chat/completions): for SDK clients// that append the path themselves (e.g. @ai-sdk/openai's baseURL).export function vertexGeminiOpenAIBase() {const { project, location, host } = vertexGeminiTarget();return `https://${host}/v1beta1/projects/${project}/locations/${location}/endpoints/openapi`;}-// Full chat-completions URL — for hand-rolled fetch transports.+// Full chat-completions URL: for hand-rolled fetch transports.export function vertexGeminiChatUrl() {return `${vertexGeminiOpenAIBase()}/chat/completions`;}diff --git a/api/_lib/vision.js b/api/_lib/vision.jsindex bbf8a0ffd..8a66d62d8 100644--- a/api/_lib/vision.js+++ b/api/_lib/vision.js@@ -101,7 +101,7 @@ export function visionChain() {}));}}- // Vertex Gemini credits anchor — multimodal (Gemini Flash reads image_url+ // Vertex Gemini credits anchor: multimodal (Gemini Flash reads image_url// parts, data URIs included, through the same OpenAI-compatible endpoint),// keyless (OAuth token minted per request), billed to GCP credits. Sits// after the free NIM lanes and ahead of the paid tail, exactly like the@@ -313,7 +313,7 @@ export async function describeImage({let upstream;try {// Keyless lanes (the Vertex Gemini credits anchor) mint their auth per- // attempt via getHeaders — a token-exchange failure lands in the catch+ // attempt via getHeaders; a token-exchange failure lands in the catch// below and fails over to the next lane like any transport error.upstream = await fetch(p.url, {method: 'POST',diff --git a/api/agents/copilot.js b/api/agents/copilot.jsindex 02de8d989..7d7710135 100644--- a/api/agents/copilot.js+++ b/api/agents/copilot.js@@ -88,7 +88,7 @@ export function providerChain() {if (env.OPENAI_API_KEY) {chain.push({ name: 'openai', url: 'https://api.openai.com/v1/chat/completions', key: env.OPENAI_API_KEY, model: 'gpt-5.4-nano' });}- // Vertex Gemini credits anchor — keyless (GCP OAuth token minted per request+ // Vertex Gemini credits anchor: keyless (GCP OAuth token minted per request// via getHeaders; see api/_lib/vertex-gemini.js), OpenAI-compatible including// tools + streamed tool_calls, billed to platform credits. Appended at the// tail unconditionally when available so no present provider key can evict it.@@ -117,7 +117,7 @@ async function streamRound(provider, { messages, tools, onContent }) {};if (Array.isArray(tools) && tools.length) { body.tools = tools; body.tool_choice = 'auto'; }// Keyless lanes (the Vertex Gemini credits anchor) mint their auth per request- // via getHeaders — a token-exchange failure throws here and fails over to the+ // via getHeaders; a token-exchange failure throws here and fails over to the// next provider exactly like a transport error.const headers = provider.getHeaders? { ...(await provider.getHeaders()), ...(provider.extraHeaders || {}) }diff --git a/api/brain/chat.js b/api/brain/chat.jsindex 1fd823156..4f4e96037 100644--- a/api/brain/chat.js+++ b/api/brain/chat.js@@ -491,12 +491,12 @@ export function freeFallbackChain(providerKey, spec, primary) {chain.push({ label: 'nvidia/llama-3.3-70b-instruct', model: nvidia('meta/llama-3.3-70b-instruct') });}// Credits-funded Vertex Gemini anchor, ALWAYS at the tail when the GCP- // project is set (api/chat.js semantics — see api/_lib/vertex-gemini.js). No+ // project is set (api/chat.js semantics, see api/_lib/vertex-gemini.js). No// key gates it and nothing may evict it: it is the rung that keeps /brain// streaming when groq/openrouter/nvidia all throttle at once and the paid// backstops are dead. The AI SDK model is built lazily in streamBrain's// attempt loop (vertexGemini flag) because its bearer token is minted per- // request — a token failure falls through like any other provider error.+ // request; a token failure falls through like any other provider error.if (vertexGeminiAvailable()) {chain.push({ label: `vertex-gemini/${vertexGeminiModel()}`, vertexGemini: true });}diff --git a/api/cron/treasury-topup.js b/api/cron/treasury-topup.jsindex c4f98f3c0..7bc4c9e9d 100644--- a/api/cron/treasury-topup.js+++ b/api/cron/treasury-topup.js@@ -113,7 +113,30 @@ export default wrapCron(async (req, res) => {// without a source the funding root drains to zero and /pulse goes quiet —// this keeps the tank full from revenue instead of waiting on a human. No-op// unless there is a genuine shortage AND spare USDC (see economy-fuel.js).- const totalDeficitSol = targets.reduce((s, t) => s + Math.max(0, t.refillToSol - t.currentSol), 0);+ const engineDeficitSol = targets.reduce((s, t) => s + Math.max(0, t.refillToSol - t.currentSol), 0);++ // The master is ALSO the x402 sponsor fee wallet: below the sponsor SOL floor+ // (0.02) the self-facilitator fail-closes every settle and the autonomous+ // economy flat-lines. The master can never be a top-up TARGET (it is the+ // funding root), so its own shortfall must count as deficit here or the+ // reclaim/refuel self-healing below never fires for it — the July 2026+ // recurrences all stalled exactly this way, with the master a few thousand+ // lamports under the settle floor while the deficit read as engines-only.+ // Operating floor = reserve + working headroom for sponsor co-sign fees;+ // the headroom default clears economy-fuel's minimum-gap trigger (0.1 SOL).+ const masterOperatingSol = (() => {+ const n = Number(process.env.ECONOMY_MASTER_OPERATING_SOL);+ return Number.isFinite(n) && n >= 0 ? n : 0.15;+ })();+ let masterDeficitSol = 0;+ let masterSolBefore = null;+ try {+ masterSolBefore = (await connection.getBalance(new PublicKey(ECONOMY_MASTER_ADDRESS), 'confirmed')) / 1e9;+ masterDeficitSol = Math.max(0, RESERVE_SOL + masterOperatingSol - masterSolBefore);+ } catch {+ /* balance read failed — engines-only deficit this tick, next tick retries */+ }+ const totalDeficitSol = engineDeficitSol + masterDeficitSol;// Self-healing, step 1 (free SOL first): when there is a real deficit, reclaim// idle SOL sitting above other engines' operating floors back to the master@@ -124,7 +147,7 @@ export default wrapCron(async (req, res) => {let reclaim = { reclaimedSol: 0, moves: [], skipped: [], failed: [] };if (totalDeficitSol > 0) {try {- const masterSolNow = (await connection.getBalance(new PublicKey(ECONOMY_MASTER_ADDRESS), 'confirmed')) / 1e9;+ const masterSolNow = masterSolBefore ?? (await connection.getBalance(new PublicKey(ECONOMY_MASTER_ADDRESS), 'confirmed')) / 1e9;if (Math.max(0, masterSolNow - RESERVE_SOL) < totalDeficitSol) {reclaim = await reclaimIdleSol({ connection, network: 'mainnet', dryRun });}@@ -175,6 +198,8 @@ export default wrapCron(async (req, res) => {rejected: result.rejected || [],master_sol: result.masterSol ?? null,spendable_sol: result.spendableSol ?? null,+ master_deficit_sol: Number(masterDeficitSol.toFixed(6)),+ master_operating_sol: masterOperatingSol,reclaim,fuel,read_errors: errors,@@ -256,6 +281,7 @@ export default wrapCron(async (req, res) => {rejected: result.rejected || [],spent_sol: result.spentSol,master_sol: result.masterSol ?? null,+ master_deficit_sol: Number(masterDeficitSol.toFixed(6)),reclaim,fuel,read_errors: errors,diff --git a/api/llm/anthropic.js b/api/llm/anthropic.jsindex 7f7181a28..17be02afa 100644--- a/api/llm/anthropic.js+++ b/api/llm/anthropic.js@@ -118,7 +118,7 @@ const UPSTREAM_URL = {// Resolve a model id to its upstream route. Static allowlist first; the Vertex// Gemini credits anchor resolves dynamically because its model id is env-tunable// (VERTEX_GEMINI_MODEL) and its availability is gated by GOOGLE_CLOUD_PROJECT,-// not an API key. It shares the 'openai' branch — the Vertex OpenAI-compatible+// not an API key. It shares the 'openai' branch: the Vertex OpenAI-compatible// endpoint speaks the same wire format (tools included), so request translation// and the Anthropic-shape response/SSE conversion below work verbatim.// Exported for the anchor regression tests (tests/api/llm-vertex-anchor-surfaces).@@ -132,11 +132,11 @@ export function resolveModelRoute(modelId) {// Ordered model fallback chain for a request. Free lanes degrade in-order; the// credits-funded Vertex Gemini anchor is ALWAYS the final rung when the GCP-// project is set (api/chat.js semantics — see api/_lib/vertex-gemini.js): it is+// project is set (api/chat.js semantics, see api/_lib/vertex-gemini.js): it is// keyless, has no third-party quota, and no present provider key may evict it,// so an embedded agent's brain cannot 5xx while GCP credits can still answer.-// The paid Anthropic rung stays ahead of it — when that key works it is the-// caller-visible model family — but a dead paid key degrades to the anchor+// The paid Anthropic rung stays ahead of it (when that key works it is the+// caller-visible model family), but a dead paid key degrades to the anchor// instead of surfacing an error. Exported for the anchor regression tests.export function modelFallbackChain(requestedModel) {const chain = [@@ -476,7 +476,7 @@ export default wrap(async (req, res) => {});}} else if (route.provider === 'vertex-gemini') {- // Credits anchor: keyless — the GCP OAuth bearer token is minted in+ // Credits anchor: keyless; the GCP OAuth bearer token is minted in// build() per attempt, and a token-exchange failure degrades through// the chain exactly like an unreachable upstream (upstream_prepare_failed).// Same OpenAI wire shape as the other non-Anthropic lanes, so thediff --git a/api/widgets/[id]/[action].js b/api/widgets/[id]/[action].jsindex c2f053c8f..2875e538c 100644--- a/api/widgets/[id]/[action].js+++ b/api/widgets/[id]/[action].js@@ -416,7 +416,7 @@ export function pickProviderChain(requested, requestedModel) {chain.push({ name, cfg, apiKey, model });}// Credits-funded Vertex Gemini anchor, ALWAYS the final rung when the GCP- // project is set (api/chat.js semantics — see api/_lib/vertex-gemini.js).+ // project is set (api/chat.js semantics, see api/_lib/vertex-gemini.js).// Keyless: the OAuth bearer token is minted per request via resolveHeaders,// so no env key gates it and no present paid key can evict it. This is what// keeps embedded widget chat answering when groq/openrouter/nvidia throttle@@ -573,7 +573,7 @@ async function callOpenAICompatible({}// Keyless routes (the Vertex Gemini credits anchor) mint their auth per- // request via resolveHeaders — a token-exchange failure throws here and fails+ // request via resolveHeaders; a token-exchange failure throws here and fails// over to the next route exactly like a transport error.const headers = route.cfg.resolveHeaders? { ...(await route.cfg.resolveHeaders()), ...(route.cfg.extraHeaders || {}) }diff --git a/data/changelog.json b/data/changelog.jsonindex 1ab9dc339..15ed165e2 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-07-22",+ "title": "Every AI surface now falls back to a funded reserve model",+ "summary": "Chat already had it; now the Brain page, embedded avatar widgets, the Trading Copilot, image understanding, and embedded agent brains share the same safety net. When every free AI lane is rate-limited at the same time, these features now roll over to the platform's own reserve model on Google Cloud instead of returning an error. Fewer failed replies during traffic spikes, with no change to which model answers first.",+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-07-22","title": "What's new, at a glance: newest features on /features and /sitemap",@@ -15454,6 +15463,16 @@"fix"],"link": "/pose"+ },+ {+ "date": "2026-07-22",+ "title": "Avatar render API: poses now apply and portraits keep the head in frame",+ "summary": "The public avatar image API (GET /api/avatar/render) now actually strikes the pose you ask for: pose presets are applied through the same retargeting engine as the Animation Studio, so wave, sit, flex and the rest land correctly on any humanoid rig instead of silently rendering the default stance. Camera framing was rebuilt too: portrait and headshot crops always keep the full head in frame with proper headroom, at every image size and aspect ratio. Existing cached renders refresh automatically.",+ "tags": [+ "fix",+ "improvement"+ ],+ "link": "/api/avatar/render"}]}diff --git a/docs/economy-master.md b/docs/economy-master.mdindex b94ee4f28..78ac7b8d6 100644--- a/docs/economy-master.md+++ b/docs/economy-master.md@@ -115,8 +115,16 @@ shuffle the remaining SOL, and when it hits zero the Money Pulse([`/pulse`](../pages/pulse.html)) goes quiet. Historically the only cure was ahuman moving SOL in.-When the master can't cover the engines' real deficit, the topup cron self-heals-in two automatic steps before it ever pages a human, in cheapest-first order:+When the master can't cover the real deficit, the topup cron self-heals in two+automatic steps before it ever pages a human, in cheapest-first order. The+deficit counts the engines under floor **plus the master's own shortfall**: the+master doubles as the x402 sponsor fee wallet, and below the sponsor SOL floor+(0.02) every autonomous settle fail-closes — but the master can never be a topup+target (it is the funding root), so without this term the self-healing never+fired for it and the economy stalled with the master a hair under the settle+floor (the July 2026 recurrences). The master's operating floor is+`ECONOMY_MASTER_RESERVE_SOL` plus `ECONOMY_MASTER_OPERATING_SOL` (default 0.15,+sized to clear the fuel step's minimum-gap trigger).**Step 1: reclaim idle SOL (free).** `reclaimIdleSol`([`api/_lib/economy-sweepback.js`](../api/_lib/economy-sweepback.js)) pulls SOL@@ -183,6 +191,7 @@ congestion, clamped to a hard ceiling.| `ECONOMY_MASTER_ADDRESS` | no | Override the expected pubkey if the master is ever rotated. Defaults to the address above. || `ECONOMY_MASTER_RESERVE_SOL` / `_PER_TOPUP_MAX_SOL` / `_RUN_CAP_SOL` | no | Guard caps (see table). || `ECONOMY_FUEL_ENABLED` | no | `0` disables the USDC→SOL auto-refuel (default on). |+| `ECONOMY_MASTER_OPERATING_SOL` | no | Working headroom above the reserve the master keeps for sponsor co-sign fees; its shortfall below reserve + this counts toward the self-heal deficit. Default 0.15. || `ECONOMY_FUEL_PER_RUN_USDC` / `_DAILY_USDC` | no | Fuel caps: max USDC per swap (default 25) and per UTC day (default 100). || `ECONOMY_FUEL_USDC_KEEP` | no | USDC the refuel never spends below (revenue reserve). Default 0. || `ECONOMY_FUEL_MIN_GAP_SOL` / `_TARGET_SOL` | no | Only refuel when the SOL gap is at least this (default 0.1); buy toward this spendable-SOL buffer (default 1.0). |diff --git a/public/changelog.json b/public/changelog.jsonindex 97a92ed39..5634ef817 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-22T22:12:49.151Z",+ "generated_at": "2026-07-22T22:19:23.092Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -37,6 +37,17 @@"fix"]},+ {+ "date": "2026-07-22",+ "type": "update",+ "title": "Avatar render API: poses now apply and portraits keep the head in frame",+ "summary": "The public avatar image API (GET /api/avatar/render) now actually strikes the pose you ask for: pose presets are applied through the same retargeting engine as the Animation Studio, so wave, sit, flex and the rest land correctly on any humanoid rig instead of silently rendering the default stance. Camera framing was rebuilt too: portrait and headshot crops always keep the full head in frame with proper headroom, at every image size and aspect ratio. Existing cached renders refresh automatically.",+ "link": "/api/avatar/render",+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-07-22","type": "update",@@ -89,6 +100,17 @@"fix"]},+ {+ "date": "2026-07-22",+ "type": "update",+ "title": "Every AI surface now falls back to a funded reserve model",+ "summary": "Chat already had it; now the Brain page, embedded avatar widgets, the Trading Copilot, image understanding, and embedded agent brains share the same safety net. When every free AI lane is rate-limited at the same time, these features now roll over to the platform's own reserve model on Google Cloud instead of returning an error. Fewer failed replies during traffic spikes, with no change to which model answers first.",+ "link": null,+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-07-22","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 77cdee1ea..494a7c181 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -30,6 +30,14 @@<category>improvement</category><description>The Animation Studio (/pose) got a UI pass: toolbar buttons no longer render as oversized circles behind FK and Save, the toolbar fits on laptop screens with pose import/export and screenshots collected under a new overflow menu, the language picker moved into the footer so it stops covering the timeline, error messages show their warning color again, and on phones the animation library and pose presets are reachable instead of hidden.</description></item>+ <item>+ <title>Avatar render API: poses now apply and portraits keep the head in frame</title>+ <link>https://three.ws/api/avatar/render</link>+ <guid isPermaLink="false">2026-07-22:Avatar render API: poses now apply and portraits keep the head in frame</guid>+ <pubDate>Wed, 22 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The public avatar image API (GET /api/avatar/render) now actually strikes the pose you ask for: pose presets are applied through the same retargeting engine as the Animation Studio, so wave, sit, flex and the rest land correctly on any humanoid rig instead of silently rendering the default stance. Camera framing was rebuilt too: portrait and headshot crops always keep the full head in frame with proper headroom, at every image size and aspect ratio. Existing cached renders refresh automatically.</description>+ </item><item><title>Avatar Studio: a Parametric base with 120+ face and body sliders</title><link>https://three.ws/avatar-studio</link>@@ -70,6 +78,14 @@<category>infra</category><description>The platform database reclaimed 770 MB of dead space and learned to do this on its own: when storage runs tight, the retention job now compacts its own bloated tables instead of waiting for an operator. Background jobs that pause under storage pressure resume automatically. Intel model training also got a memory bound so it keeps learning from the freshest coins without ever outgrowing its worker.</description></item>+ <item>+ <title>Every AI surface now falls back to a funded reserve model</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-22:Every AI surface now falls back to a funded reserve model</guid>+ <pubDate>Wed, 22 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Chat already had it; now the Brain page, embedded avatar widgets, the Trading Copilot, image understanding, and embedded agent brains share the same safety net. When every free AI lane is rate-limited at the same time, these features now roll over to the platform's own reserve model on Google Cloud instead of returning an error. Fewer failed replies during traffic spikes, with no change to which model answers first.</description>+ </item><item><title>Menus no longer show raw translation codes</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex be23ac75d..c6f36b932 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-22T22:12:49.139Z",+ "generated_at": "2026-07-22T22:19:23.082Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/llm-anthropic.test.js b/tests/api/llm-anthropic.test.jsindex 44f918914..c32efce00 100644--- a/tests/api/llm-anthropic.test.js+++ b/tests/api/llm-anthropic.test.js@@ -75,6 +75,14 @@ class FakeRedis {vi.mock('@upstash/redis', () => ({ Redis: FakeRedis }));+// The Vertex Gemini credits anchor mints a GCP OAuth token per request; stub+// the token exchange so anchor-lane tests need no real GCP credentials.+vi.mock('../../api/_lib/gcp-auth.js', () => ({+ getGcpAccessToken: vi.fn(async () => 'gcp-test-token'),+ gcpAuthConfigured: () => true,+ parseServiceAccount: vi.fn(),+}));+// Default upstream mock — overridden per-test as needed.const fetchState = {response: () => upstreamOk({ ok: true, usage: { input_tokens: 10, output_tokens: 20 } }),@@ -204,6 +212,11 @@ const DEFAULT_POLICY = {// ── Reset between tests ───────────────────────────────────────────────────beforeEach(() => {+ // The Vertex Gemini credits anchor joins the fallback chain whenever+ // GOOGLE_CLOUD_PROJECT is set; clear it so chain-shape assertions here are+ // deterministic on GCP-configured machines. The anchor's own coverage lives+ // in tests/api/llm-vertex-anchor-surfaces.test.js.+ delete process.env.GOOGLE_CLOUD_PROJECT;policyState.policy = JSON.parse(JSON.stringify(WE_PAY_POLICY));avatarPolicyState.policy = null;avatarState.avatar = null;@@ -570,6 +583,34 @@ describe('/api/llm/anthropic — free-provider routing', () => {}});+ it('serves from the Vertex Gemini credits anchor when every keyed lane is unconfigured', async () => {+ // Prod repro of the 2026-07-21 diagnosis: free keys dead/absent, paid keys+ // dead/absent; the keyless GCP-credits anchor must answer instead of 503.+ delete process.env.OPENROUTER_API_KEY;+ delete process.env.GROQ_API_KEY;+ delete process.env.NVIDIA_API_KEY;+ const savedAnthropic = process.env.ANTHROPIC_API_KEY;+ delete process.env.ANTHROPIC_API_KEY;+ process.env.GOOGLE_CLOUD_PROJECT = 'test-project';+ try {+ const { status, body } = await invoke({+ body: { ...VALID_BODY, model: 'meta-llama/llama-3.3-70b-instruct:free' },+ });+ expect(status).toBe(200);+ const call = fetchState.calls[0];+ expect(call.url).toContain('aiplatform.googleapis.com');+ expect(call.url).toContain('test-project');+ expect(call.init.headers.authorization).toBe('Bearer gcp-test-token');+ // OpenAI-shape upstream translated back to the Anthropic shape the+ // embed client parses.+ expect(body.role).toBe('assistant');+ expect(body.content?.[0]?.text).toBe('hi from free model');+ } finally {+ process.env.ANTHROPIC_API_KEY = savedAnthropic;+ delete process.env.GOOGLE_CLOUD_PROJECT;+ }+ });+it('translates Anthropic body shape → OpenAI body shape', async () => {await invoke({body: {diff --git a/tests/api/llm-vertex-anchor-surfaces.test.js b/tests/api/llm-vertex-anchor-surfaces.test.jsindex 7d5db3085..a8e401d87 100644--- a/tests/api/llm-vertex-anchor-surfaces.test.js+++ b/tests/api/llm-vertex-anchor-surfaces.test.js@@ -4,7 +4,7 @@// The 2026-07-21 production diagnosis: brain, widgets, copilot, vision, and the// anthropic-proxy each hand-rolled their model fallback chains WITHOUT the// keyless Vertex Gemini rung, so a simultaneous throttle of the free lanes-// (groq/openrouter/nvidia) surfaced 5xx even though GCP credits could answer —+// (groq/openrouter/nvidia) surfaced 5xx even though GCP credits could answer -// the prod OPENAI_API_KEY is billing-dead (429 billing_not_active) and the// OpenRouter host key must never route to paid models. These tests lock the// chat.js semantics onto every surface, via the shared api/_lib/vertex-gemini.js:@@ -99,7 +99,7 @@ describe('shared vertex-gemini helper (api/_lib/vertex-gemini.js)', () => {});});-describe('brain (api/brain/chat.js) — freeFallbackChain anchor', () => {+describe('brain (api/brain/chat.js): freeFallbackChain anchor', () => {const spec = { openrouterModel: 'openai/gpt-oss-120b:free' };it('appends the anchor at the tail when a GCP project is set', () => {@@ -110,7 +110,7 @@ describe('brain (api/brain/chat.js) — freeFallbackChain anchor', () => {const last = chain[chain.length - 1];expect(last.vertexGemini).toBe(true);expect(last.label).toBe('vertex-gemini/google/gemini-2.5-flash');- // Exactly one anchor entry — never doubled.+ // Exactly one anchor entry: never doubled.expect(chain.filter((a) => a.vertexGemini)).toHaveLength(1);});@@ -128,7 +128,7 @@ describe('brain (api/brain/chat.js) — freeFallbackChain anchor', () => {});});-describe('copilot (api/agents/copilot.js) — providerChain anchor', () => {+describe('copilot (api/agents/copilot.js): providerChain anchor', () => {it('keeps the keyless anchor as the final rung past every present provider key', () => {process.env.GOOGLE_CLOUD_PROJECT = 'test-project';setAllProviderKeys();@@ -146,7 +146,7 @@ describe('copilot (api/agents/copilot.js) — providerChain anchor', () => {);});- it('serves a non-empty chain with zero provider keys — the 503 gate opens on credits alone', () => {+ it('serves a non-empty chain with zero provider keys: the 503 gate opens on credits alone', () => {process.env.GOOGLE_CLOUD_PROJECT = 'test-project';const chain = copilotProviderChain();expect(chain).toHaveLength(1);@@ -160,7 +160,7 @@ describe('copilot (api/agents/copilot.js) — providerChain anchor', () => {});});-describe('widgets (api/widgets/[id]/[action].js) — pickProviderChain anchor', () => {+describe('widgets (api/widgets/[id]/[action].js): pickProviderChain anchor', () => {it('appends the anchor after every configured route and never as the primary', () => {process.env.GOOGLE_CLOUD_PROJECT = 'test-project';setAllProviderKeys();@@ -196,7 +196,7 @@ describe('widgets (api/widgets/[id]/[action].js) — pickProviderChain anchor',});});-describe('vision (api/_lib/vision.js) — visionChain anchor', () => {+describe('vision (api/_lib/vision.js): visionChain anchor', () => {it('sits after the free NIM lanes and ahead of the paid OpenAI backstop', () => {process.env.GOOGLE_CLOUD_PROJECT = 'test-project';process.env.NVIDIA_API_KEY = 'nv-test';@@ -214,7 +214,7 @@ describe('vision (api/_lib/vision.js) — visionChain anchor', () => {expect(anchor.headers).toBeUndefined(); // keyless: no static bearer header});- it('visionConfigured() is true on a GCP project alone — the multimodal anchor serves', () => {+ it('visionConfigured() is true on a GCP project alone: the multimodal anchor serves', () => {expect(visionConfigured()).toBe(false);process.env.GOOGLE_CLOUD_PROJECT = 'test-project';expect(visionConfigured()).toBe(true);@@ -242,7 +242,7 @@ describe('vision (api/_lib/vision.js) — visionChain anchor', () => {});});-describe('anthropic-proxy (api/llm/anthropic.js) — model fallback anchor', () => {+describe('anthropic-proxy (api/llm/anthropic.js): model fallback anchor', () => {it('appends the anchor model as the final fallback when a GCP project is set', () => {process.env.GOOGLE_CLOUD_PROJECT = 'test-project';setAllProviderKeys();diff --git a/tests/api/vision.test.js b/tests/api/vision.test.jsindex 5582e6452..1a41794ec 100644--- a/tests/api/vision.test.js+++ b/tests/api/vision.test.js@@ -33,7 +33,9 @@ import { imageEvidence } from '../../agents/fact-checker/src/image-evidence.js';import { generateAltText, cleanAltText } from '../../api/_lib/avatar-alt-text.js';const ORIGINAL_FETCH = globalThis.fetch;-const ENV_KEYS = ['NVIDIA_API_KEY', 'OPENAI_API_KEY'];+// GOOGLE_CLOUD_PROJECT gates the Vertex Gemini credits anchor in visionChain;+// isolate it too so these tests are deterministic on GCP-configured machines.+const ENV_KEYS = ['NVIDIA_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_CLOUD_PROJECT'];const ORIGINAL_ENV = Object.fromEntries(ENV_KEYS.map((k) => [k, process.env[k]]));// Route a mocked fetch by URL substring so one test can exercise the full@@ -65,6 +67,7 @@ beforeEach(() => {usageState.events = [];process.env.NVIDIA_API_KEY = 'nvapi-test';delete process.env.OPENAI_API_KEY;+ delete process.env.GOOGLE_CLOUD_PROJECT;// Default: our own image fetch fails, so describeImage falls back to handing// the raw URL to the provider (the pre-inline behavior). Tests that exercise// the inline path override this.