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(prod): restore agent-3d CDN bundle + /ingest analytics proxy on Cloud Run
fudjia46b5007a7f6f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1c602e72c..74e3261d1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Cleaner 3D models from stylized prompts** — Text-to-3D prompts that name an art style — "a cartoon fox," "a stylized robot" — now reliably produce a single, cleanly-isolated model instead of one baked into a busy background scene. The image step that seeds every 3D generation was skipping its "isolated subject on a plain white background" instruction whenever a prompt mentioned a style, which let the image model paint a whole illustrated scene the 3D reconstructor then struggled with. It now keeps that isolation instruction for stylized subjects (and no longer trips on unrelated words like "lightsaber"), so stylized characters and props reconstruct as sharp standalone assets. (`/forge`) `[improvement, fix]`- **Conversational 3D refinement + a remixable-asset economy with creator royalties** — You can now iterate on a generated model by talking to it — say "make it metallic" or "add wings" and the studio re-generates a new version anchored to the last one, with a version strip you can revert or branch. It is free in the 3D Studio and on the paid MCP server. Creators can also publish a model as remixable: when another agent builds on it, a creator-set royalty (up to 20%) of the remix fee routes back to them on-chain in USDC, with provenance recorded on every derived model. `[feature, sdk]`- **Find the wallet grinder from the contract grinder** — The two EVM vanity tools now point at each other. The CREATE2 grinder — which searches a salt for a vanity smart-contract address, with no private key involved — now carries a note explaining that difference and linking to the EVM Vanity Wallet generator for anyone who actually wants a wallet they hold the key to. The wallet generator already linked back; this closes the loop so you can no longer land on one and miss the other. (`/eth-vanity`) `[improvement]`+- **Fixed the <agent-3d> embed bundle 404ing in production** — The CDN script that powers the <agent-3d> web component (the drop-in embed used on pages like the crypto demo, and by any third-party site embedding a live avatar) was returning 404 after the move to Cloud Run — the deploy pipeline wasn't building and publishing the bundle into the image. Deploys now build and verify it every time, so the embed loads everywhere it's used. `[fix, infra]`- **Forge listing sharpened: clear 3D generation tiers for agents** — Forge — our text→3D and image→3D generation — now reads like the crown jewel it is on the x402 agent marketplaces. The listing leads with what agents actually build (game assets, NFT collections, 3D scenes, product viz), spells out the three quality tiers and their flat USDC prices (draft $0.05 / standard $0.15 / high $0.50), and points newcomers to the free keyless draft lane as an on-ramp. The input and output schemas are now complete enough for an agent to call it blind — the prompt, the reference-image mode, the free job-token poll, and the finished GLB — and it's tagged so it surfaces under 3D, AI, and Utility. Under the hood the discovery listing and the live payment challenge now share one source of truth, so what an agent sees can never drift from what it pays for. (`/docs/3d-api`) `[improvement]`- **Free bonding-curve status API for pump.fun tokens** — A new free, keyless endpoint tells an agent exactly where a pump.fun token sits on its bonding curve: how far along it is toward graduation (%), how much SOL is in the curve, how many tokens are left to buy, and whether it has already graduated and migrated to Raydium or PumpSwap. Timing entries and exits around graduation is a core meme-trading move, and this is the one call that answers it — no account, no key, just GET /api/crypto/bonding?mint=<mint>. It pairs with the live launches feed to watch fresh mints climb their curve. Part of the free three.ws Crypto Data API; full reference with runnable curls at /docs/crypto-api. (`/docs/crypto-api`) `[feature]`- **Free holder distribution / concentration API** — New free endpoint in the Crypto Data API: GET /api/crypto/holders shows who actually holds a Solana token before you size a position — the top wallets with their share of supply, the cumulative top-10 percentage, and a clear low/medium/high concentration verdict on documented thresholds. When the platform's indexer key is available holders are aggregated by wallet with an exact count; without it the endpoint still returns the chain's real top accounts, clearly labeled. No API key, no account, honest nulls for anything unknowable. (`/docs/crypto-api`) `[feature]`diff --git a/data/changelog.json b/data/changelog.jsonindex ad204297a..51037d4b0 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-07",+ "title": "Fixed the <agent-3d> embed bundle 404ing in production",+ "summary": "The CDN script that powers the <agent-3d> web component (the drop-in embed used on pages like the crypto demo, and by any third-party site embedding a live avatar) was returning 404 after the move to Cloud Run — the deploy pipeline wasn't building and publishing the bundle into the image. Deploys now build and verify it every time, so the embed loads everywhere it's used.",+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-07-07","title": "Markets grows a full toolkit — Heatmap, Fear & Greed, Gas Tracker, and Compare",diff --git a/docs/ops/gcp-production.md b/docs/ops/gcp-production.mdindex 262cbdf9c..af3897fca 100644--- a/docs/ops/gcp-production.md+++ b/docs/ops/gcp-production.md@@ -90,9 +90,14 @@ deploys from a human-authed CLI (command below).```bash# Frontend changed? Build first — dist/ ships from the local build.-npm run build--# Build image on Cloud Build (32-vCPU + BuildKit layer cache) + push + deploy:+# build:gcp = site build + agent-3d CDN lib (build:lib:full + publish:lib) ++# check:dist. Plain `npm run build` is NOT enough: it skips the lib publish,+# so /agent-3d/latest/agent-3d.js 404s in prod and the hero avatar dies+# ("agent-3d element never registered").+npm run build:gcp++# Build image on Cloud Build (32-vCPU + BuildKit layer cache) + push + deploy.+# Gated on check:dist so an incomplete dist/ can no longer ship.npm run deploy:gcp```@@ -133,6 +138,17 @@ had). Requires connecting the `nirholas/three.ws` repo in Cloud Build andadding the vite build into the Docker build. This is Cloud Build's own GitHubintegration — not GitHub Actions, which this repo does not use.+**`/ingest/*` (PostHog proxy):** on Vercel, `vercel.json` routes whose `dest`+is an absolute URL (`/ingest/static/*` → `us-assets.i.posthog.com`, `/ingest/*`+→ `us.i.posthog.com`) were proxied by the platform itself. `server/index.mjs`+now replicates this with its own external-dest middleware (mounted before the+body parsers, so POST event bodies stream through unconsumed) — added+2026-07-07 after prod was serving 404s + a MIME-sniffing block on+`/ingest/static/array.js`. If a future `vercel.json` route gets an+`http(s)://` dest and analytics start 404ing again, check that this+middleware's `phase1Routes` walk still matches it before the API/static+phases.+---## Crons (Cloud Scheduler)@@ -200,6 +216,7 @@ by CLI at all. Consequences and current state:|---|---|---|---|| x402 ring signers | `X402_TREASURY_SECRET_BASE58`, `X402_FEE_PAYER_SECRET_BASE58`, `X402_SEED_SOLANA_SECRET_BASE58` | Ring is enabled but cannot sign — no autonomous USDC movement | Owner's gitignored `.x402-ring-secrets.json`, written by `scripts/x402-ring-setup.mjs` on whatever machine ran it. Public halves: fee payer `2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4`, treasury/pay-to `wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU`. These wallets custody funds — do NOT regenerate. || Rate-limiter Redis | `UPSTASH_REDIS_REST_URL`, `UPSTASH_REDIS_REST_TOKEN` | Money-moving limiters **fail closed** (already true on Vercel pre-shutdown) | Owner's Upstash console, or provision fresh Upstash/Memorystore and set both vars. `X402_ALLOW_MEMORY_FALLBACK=1` exists as an explicit single-instance escape hatch. |+| R2/S3 storage creds | `S3_ENDPOINT`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_BUCKET`, `S3_PUBLIC_DOMAIN` | `/api/marketplace`, `/api/explore`, `/api/avatars/:id` — every route that resolves an asset URL — 503 `not_configured` | Real values already sit in the repo's `.env.local` (never committed). Apply with `scripts/gcp/apply-s3-env.sh` (needs a human-authed `gcloud auth login` first — the 89-var apply is still blocked on reauth per above). |---diff --git a/package.json b/package.jsonindex 772582b8e..985cabc7a 100644--- a/package.json+++ b/package.json@@ -204,7 +204,8 @@"lint:fix": "eslint . --fix","check:dist": "node scripts/check-dist.mjs","deploy": "npm run build:all && npm run check:dist && vercel --local-config vercel.json --prod",- "deploy:gcp": "gcloud builds submit --config server/cloudbuild.yaml --region us-central1 --project aerial-vehicle-466722-p5",+ "build:gcp": "npm run build && npm run build:lib:full && npm run publish:lib && npm run check:dist",+ "deploy:gcp": "npm run check:dist && gcloud builds submit --config server/cloudbuild.yaml --region us-central1 --project aerial-vehicle-466722-p5","postversion": "git push && git push --tags","validate:cards": "node scripts/validate-agent-cards.mjs","db:bootstrap": "node scripts/db-bootstrap.mjs",diff --git a/public/changelog.json b/public/changelog.jsonindex 0323904e0..b724da46d 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-07T18:56:28.010Z",+ "generated_at": "2026-07-07T22:24:56.382Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -171,6 +171,17 @@"improvement"]},+ {+ "date": "2026-07-07",+ "type": "update",+ "title": "Fixed the <agent-3d> embed bundle 404ing in production",+ "summary": "The CDN script that powers the <agent-3d> web component (the drop-in embed used on pages like the crypto demo, and by any third-party site embedding a live avatar) was returning 404 after the move to Cloud Run — the deploy pipeline wasn't building and publishing the bundle into the image. Deploys now build and verify it every time, so the embed loads everywhere it's used.",+ "link": null,+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-07-07","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 5008c1322..cab7350ba 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -134,6 +134,14 @@<category>improvement</category><description>The two EVM vanity tools now point at each other. The CREATE2 grinder — which searches a salt for a vanity smart-contract address, with no private key involved — now carries a note explaining that difference and linking to the EVM Vanity Wallet generator for anyone who actually wants a wallet they hold the key to. The wallet generator already linked back; this closes the loop so you can no longer land on one and miss the other.</description></item>+ <item>+ <title>Fixed the <agent-3d> embed bundle 404ing in production</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-07:Fixed the <agent-3d> embed bundle 404ing in production</guid>+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The CDN script that powers the <agent-3d> web component (the drop-in embed used on pages like the crypto demo, and by any third-party site embedding a live avatar) was returning 404 after the move to Cloud Run — the deploy pipeline wasn't building and publishing the bundle into the image. Deploys now build and verify it every time, so the embed loads everywhere it's used.</description>+ </item><item><title>Forge listing sharpened: clear 3D generation tiers for agents</title><link>https://three.ws/docs/3d-api</link>diff --git a/public/features.json b/public/features.jsonindex d33bc226f..f038b8302 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-07T18:56:27.998Z",+ "generated_at": "2026-07-07T22:24:56.370Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/scripts/gcp/apply-s3-env.sh b/scripts/gcp/apply-s3-env.shnew file mode 100755index 000000000..85f12637e--- /dev/null+++ b/scripts/gcp/apply-s3-env.sh@@ -0,0 +1,55 @@+#!/usr/bin/env bash+# scripts/gcp/apply-s3-env.sh — apply the R2/S3 storage credentials to the+# three-ws-api Cloud Run service from a local env file.+#+# Why this exists: the Vercel→Cloud Run migration left the S3_* group unset on+# the service (the 89-var apply was blocked on gcloud reauth). Every endpoint+# that resolves avatar/model asset URLs — /api/avatars/:id, /api/explore,+# /api/marketplace — throws `Missing required env var: S3_*` and returns+# 503 not_configured until these five vars are set.+#+# Usage (needs a human-authed gcloud — run `gcloud auth login` first):+# scripts/gcp/apply-s3-env.sh [path-to-env-file] # default: .env.local+#+# Applying env vars rolls a new Cloud Run revision; traffic shifts when it's+# healthy. Verify afterwards:+# curl -s https://three.ws/api/marketplace | head -c 200+set -euo pipefail++PROJECT=aerial-vehicle-466722-p5+SERVICE=three-ws-api+REGION=us-central1+KEYS=(S3_ENDPOINT S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY S3_BUCKET S3_PUBLIC_DOMAIN)++REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+ENV_FILE="${1:-$REPO_ROOT/.env.local}"++if [[ ! -f "$ENV_FILE" ]]; then+ echo "env file not found: $ENV_FILE" >&2+ exit 1+fi++# Build KEY=value pairs with the ^@^ delimiter so values containing commas+# survive --update-env-vars.+pairs=""+for key in "${KEYS[@]}"; do+ # last occurrence wins; strip optional quotes around the value+ value="$(grep -E "^${key}=" "$ENV_FILE" | tail -1 | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//' -e "s/^'//" -e "s/'$//")"+ if [[ -z "$value" ]]; then+ echo "MISSING in $ENV_FILE: $key" >&2+ exit 1+ fi+ pairs+="${pairs:+@}${key}=${value}"+done++echo "Applying ${#KEYS[@]} vars (${KEYS[*]}) to $SERVICE…"+gcloud run services update "$SERVICE" \+ --project "$PROJECT" --region "$REGION" \+ --update-env-vars "^@^${pairs}"++echo+echo "Verifying the previously-503 endpoints:"+for path in /api/marketplace "/api/explore?source=all&limit=1"; do+ code="$(curl -s -o /dev/null -w '%{http_code}' "https://three.ws${path}")"+ echo " ${path} → ${code}"+donediff --git a/server/index.mjs b/server/index.mjsindex 2655a9ec6..ccdd988e5 100644--- a/server/index.mjs+++ b/server/index.mjs@@ -64,6 +64,61 @@ function substitute(template, match) {return template.replace(/\$(\d+)/g, (_, n) => match[Number(n)] ?? '');}+const isExternalDest = (dest) => /^https?:\/\//.test(dest || '');++// ---------------------------------------------------------------------------+// External-URL dests (reverse proxy), e.g. /ingest/* → PostHog.+// ---------------------------------------------------------------------------+// Vercel proxies any route whose dest is an absolute URL. This middleware+// replicates that, and MUST run before the body parsers so POST bodies stream+// through unconsumed. It walks the same phase-1 rules with the same first-match+// semantics: only when the first non-continue dest for a path is external does+// it proxy; otherwise it falls through untouched.++// Hop-by-hop headers (RFC 9110 §7.6.1) plus fields the proxied hop recomputes.+const PROXY_SKIP_REQ = new Set([+ 'host', 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',+ 'te', 'trailer', 'transfer-encoding', 'upgrade', 'content-length', 'accept-encoding',+]);+const PROXY_SKIP_RES = new Set([+ 'connection', 'keep-alive', 'transfer-encoding', 'content-encoding', 'content-length',+]);++async function proxyExternal(req, res, dest) {+ const headers = {};+ for (const [k, v] of Object.entries(req.headers)) {+ if (!PROXY_SKIP_REQ.has(k)) headers[k] = v;+ }+ const hasBody = req.method !== 'GET' && req.method !== 'HEAD';+ try {+ const upstream = await fetch(dest, {+ method: req.method,+ headers,+ body: hasBody ? req : undefined,+ duplex: hasBody ? 'half' : undefined,+ redirect: 'manual',+ signal: AbortSignal.timeout(30_000),+ });+ res.status(upstream.status);+ for (const [k, v] of upstream.headers) {+ if (!PROXY_SKIP_RES.has(k)) res.setHeader(k, v);+ }+ if (upstream.body) {+ const { Readable } = await import('node:stream');+ Readable.fromWeb(upstream.body).pipe(res);+ } else {+ res.end();+ }+ } catch (err) {+ console.error(`[proxy] ${req.method} ${req.url} → ${new URL(dest).host} failed:`, err.message);+ if (!res.headersSent) {+ res.status(502).json({ error: 'bad_gateway', message: 'Upstream request failed.' });+ } else if (!res.writableEnded) {+ res.end();+ }+ }+}+// ---------------------------------------------------------------------------// API route resolution (Vercel filesystem semantics) with caches.// ---------------------------------------------------------------------------@@ -252,6 +307,21 @@ app.disable('x-powered-by');// images, GLB), so SSE and binary assets pass through untouched.app.use(compression());+// External-dest proxy — before the body parsers (see proxyExternal above).+app.use((req, res, next) => {+ const pathname = new URL(req.url, 'http://internal').pathname;+ for (const route of phase1Routes) {+ const m = route.re.exec(pathname);+ if (!m) continue;+ if (route.continue) continue;+ if (!route.dest || !isExternalDest(route.dest)) break; // a local rule wins — fall through+ const search = req.url.includes('?') ? req.url.slice(req.url.indexOf('?')) : '';+ proxyExternal(req, res, substitute(route.dest, m) + search);+ return;+ }+ next();+});+// Vercel-parity body parsing. Types not listed (multipart, image/*, …) are// left unparsed so handlers can consume the raw request stream.app.use(express.json({ limit: BODY_LIMIT }));