Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Add agent-identity bridge, arena SEO tags, clubhouse GLB + compression
nirholasf01ae06c58b8
diff --git a/.gitignore b/.gitignoreindex 014590a73..aa3d3337a 100644--- a/.gitignore+++ b/.gitignore@@ -231,3 +231,4 @@ example.htmlscripts/test-corr.mjs*_tweets_*.jsonscripts/.corr-*+space_smugglers_club_house_-_dark_version.glbdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex e65375a72..e7fe0294f 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- **Rate and vouch for Solana agents from their passport** — Every Solana agent passport already showed its on-chain reputation — now you can add to it. A new "Rate this agent" panel lets anyone with a Solana wallet (Phantom or Solflare) leave a 1–5 score, with an optional public note, written on-chain as a signed attestation — no account needed. You can also back your rating with a SOL stake (from 0.001 SOL) sent to the agent's owner for an economically-weighted vouch. Submitting is guarded the obvious ways: you can't rate your own agent, scores are limited to 1–5, the minimum stake is enforced, and re-rating asks you to confirm before it updates your previous score. The moment your transaction confirms, the passport re-reads the chain on demand instead of waiting for the next indexing pass, so your rating shows up in the reputation summary within seconds. (`/agent-passport.html`) `[feature]`- **Register an existing agent on-chain in one click** — Any agent you already built can now be given an ERC-8004 on-chain identity straight from its profile — no re-entering its name, 3D model, voice, or skills. The new "Register on-chain" control reuses everything the agent already has, automatically assembles and pins a full agent manifest (its persona, voice, installed skills, and memory mode), links that manifest to the on-chain agent card, and mints the identity on the network you pick. Re-running it on the same network is a safe no-op, and your profile shows a live on-chain badge with explorer and agent-card links the moment it's done. (`/agents`) `[feature]`- **Registered agents now carry an on-chain "Validated" badge** — When an agent is registered on-chain, three.ws now automatically runs its 3D model through the platform's glTF validator and records a signed validation attestation on the ERC-8004 ValidationRegistry — so an agent that advertises validation actually carries proof of it. A green "Validated" badge appears on the agent profile, readable by anyone without a wallet, and links straight to the full validation report and the on-chain record. The check is independent of the file's byte-identity (sha256), so both are surfaced on their own: a model that passes schema validation still shows its exact byte fingerprint. If a model has problems, the badge shows "Validation failed" with the specific reason — the agent is still registered, just unvalidated — and owners can re-validate after updating their model to refresh the badge. Validation is best-effort and never blocks or reverts a registration. (`/marketplace`) `[feature, security]`+- **Sell your animations in the marketplace** — Animations you build in the Studio can now be listed for sale. Pose a figure, drop your keyframes, save the clip, then hit Sell — set a price in USDC (or list it free) and three.ws bakes a self-contained animated GLB and publishes it to a new "From creators" shelf in the animation marketplace. Buyers see a poster, the creator, length and price; free clips download in one click, and paid clips are unlocked by paying once in USDC on Base or Solana — re-download free forever from the same wallet. Earnings settle straight to your payout wallet, and your motion data stays gated behind the paywall until someone buys. (`/marketplace?tab=animations`) `[feature]`- **Sniper Arena — watch AI agents trade pump.fun live** — Agents can now trade pump.fun autonomously. A new always-on engine watches every launch in real time, scores it against an agent's strategy (market-cap band, creator track record, socials), and — when it qualifies — buys from the agent's own Solana wallet, then manages the position to a take-profit, stop-loss, trailing stop, or timeout exit. Arming an agent is opt-in and capped: you set a daily budget, a per-trade size, and a mandatory stop-loss, with a kill switch that halts new buys instantly. The new Sniper Arena at three.ws/play/arena shows it all happening live — a P&L leaderboard, a streaming trade ticker where every fill links to its on-chain transaction, and the top agent's 3D avatar reacting to its own wins. Autonomous trading is experimental and you can lose the funds you commit. (`/play/arena`) `[feature]`- **Strategy Lab now catches broken trading strategies before they run** — Validation in the Strategy Lab (three.ws/strategy-lab) went from a basic syntax check to a real soundness check, so a strategy can't quietly pass review and then misbehave with live funds. It now flags the mistakes that used to slip through: a misspelled metric that silently never matches, a threshold that can never be true (like a percentage above 100), filters that contradict each other so the strategy would never buy, a position rule placed where no position exists yet, a per-trade size larger than the session budget, and later exit rules that an earlier rule always triggers first. When you point a strategy at specific coins, it confirms each one actually exists and warns if a SOL-denominated strategy targets a USDC-paired coin. Problems are shown inline, field by field, with a plain-language reason and exactly where to fix them — and the same checks now guard Backtest and Run, so what validates is what executes. (`/strategy-lab`) `[improvement]`- **The Forge always returns a model — the default never dead-ends** — Typing a prompt into the Forge on the default Standard setting now always produces a 3D model, even when our paid reconstruction provider is throttled or over its quota. Previously a busy upstream could leave the default flow stuck on a "generator is busy, try again" message that never cleared. Now, if the paid engine is unavailable, a text prompt transparently falls back to the free NVIDIA lane and still hands you a finished model — and the result clearly shows which engine produced it, so the change is never hidden. Free-first, always a working fallback. (`/forge`) `[fix]`diff --git a/api/_lib/agent-identity.js b/api/_lib/agent-identity.jsnew file mode 100644index 000000000..037ed059f--- /dev/null+++ b/api/_lib/agent-identity.js@@ -0,0 +1,98 @@+// Avatar ↔ agent-identity bridge.+//+// Wallets on this platform are keyed to `agent_identities`, not avatars. An+// avatar is a 3D model; an agent identity is the wallet-owning entity that can+// wear that avatar. Giving an avatar a wallet therefore means: ensure an agent+// identity exists for it, then provision the identity's custodial Solana wallet.+//+// This module is the single source of truth for that resolution so the pump.fun+// launch flow, avatar-creation auto-provisioning, and the avatar wallet endpoint+// all behave identically. Extracted from resolveLaunchAgentId in+// api/pump/[action].js (which now imports resolveOrCreateAgentForAvatar).++import { sql } from './db.js';+import { getOrCreateAgentSolanaWallet } from './agent-wallet.js';++/**+ * Resolve the agent identity for a launch/wallet action, creating one from the+ * avatar if the user has none linked yet.+ *+ * Resolution order:+ * 1. explicit agentId (scoped to the user)+ * 2. the user's agent identity already linked to this avatar+ * 3. a new identity created from the avatar's name/description+ * 4. on the per-user uniqueness constraint, an existing unlinked identity is+ * linked to this avatar; failing that, the user's first identity+ *+ * @returns {Promise<{id: string, name: string}|null>}+ */+export async function resolveOrCreateAgentForAvatar({ userId, agentId, avatarId }) {+ if (agentId) {+ const [row] = await sql`+ select id, name from agent_identities+ where id=${agentId} and user_id=${userId} and deleted_at is null+ limit 1+ `;+ return row || null;+ }+ const [linked] = await sql`+ select id, name from agent_identities+ where user_id=${userId} and avatar_id=${avatarId} and deleted_at is null+ order by created_at asc limit 1+ `;+ if (linked) return linked;++ const [avatar] = await sql`+ select id, name, description from avatars+ where id=${avatarId} and owner_id=${userId} and deleted_at is null+ limit 1+ `;+ if (!avatar) return null;++ const agentName = (avatar.name || 'Agent').slice(0, 100);+ const agentDesc = avatar.description ? String(avatar.description).slice(0, 1000) : null;+ try {+ const [created] = await sql`+ insert into agent_identities (user_id, name, description, avatar_id)+ values (${userId}, ${agentName}, ${agentDesc}, ${avatar.id})+ returning id, name+ `;+ return created;+ } catch (err) {+ if (err?.code !== '23505') throw err;+ // Unique-per-user constraint: reuse the user's existing identity and+ // link it to this avatar if it has none yet.+ const [unlinked] = await sql`+ select id, name from agent_identities+ where user_id=${userId} and avatar_id is null and deleted_at is null+ order by created_at asc limit 1+ `;+ if (unlinked) {+ await sql`+ update agent_identities set avatar_id=${avatar.id}, updated_at=now()+ where id=${unlinked.id}+ `;+ return unlinked;+ }+ const [any] = await sql`+ select id, name from agent_identities+ where user_id=${userId} and deleted_at is null+ order by created_at asc limit 1+ `;+ return any || null;+ }+}++/**+ * Ensure the avatar's agent identity has a custodial Solana wallet, creating+ * both the identity (if needed) and the wallet (idempotently) in one call.+ *+ * @returns {Promise<{ agentId: string, agentName: string, address: string, created: boolean }|null>}+ * null when the avatar can't be resolved to an owned agent identity.+ */+export async function getOrCreateAvatarSolanaWallet({ userId, avatarId, agentId = null }) {+ const agent = await resolveOrCreateAgentForAvatar({ userId, agentId, avatarId });+ if (!agent) return null;+ const wallet = await getOrCreateAgentSolanaWallet(agent.id);+ return { agentId: agent.id, agentName: agent.name, address: wallet.address, created: wallet.created };+}diff --git a/data/changelog.json b/data/changelog.jsonindex 898040851..fad4cf85f 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,13 @@{"$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-15",+ "title": "Sell your animations in the marketplace",+ "summary": "Animations you build in the Studio can now be listed for sale. Pose a figure, drop your keyframes, save the clip, then hit Sell — set a price in USDC (or list it free) and three.ws bakes a self-contained animated GLB and publishes it to a new \"From creators\" shelf in the animation marketplace. Buyers see a poster, the creator, length and price; free clips download in one click, and paid clips are unlocked by paying once in USDC on Base or Solana — re-download free forever from the same wallet. Earnings settle straight to your payout wallet, and your motion data stays gated behind the paywall until someone buys.",+ "tags": ["feature"],+ "link": "/marketplace?tab=animations"+ },{"date": "2026-06-15","title": "Sniper Arena — watch AI agents trade pump.fun live",diff --git a/pages/play/arena.html b/pages/play/arena.htmlindex 03252915e..545eb2f29 100644--- a/pages/play/arena.html+++ b/pages/play/arena.html@@ -85,6 +85,19 @@.section-gap { margin-top: 18px; }</style>++ <link rel="canonical" href="https://three.ws/play/arena">+ <meta property="og:type" content="website">+ <meta property="og:site_name" content="three.ws">+ <meta property="og:url" content="https://three.ws/play/arena">+ <meta property="og:image" content="https://three.ws/og-image.png">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:title" content="Sniper Arena — autonomous AI agents trading live · three.ws">+ <meta name="twitter:description" content="Watch three.ws AI agents trade pump.fun autonomously in real time. Live P&L leaderboard, each trade signed by the agent's own wallet and verifiable on-chain.">+ <meta name="twitter:image" content="https://three.ws/og-image.png">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Sniper Arena — autonomous AI agents trading live","description":"Watch three.ws AI agents trade pump.fun autonomously in real time. Live P&L leaderboard, each trade signed by the agent's own wallet and verifiable on-chain.","url":"https://three.ws/play/arena","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script></head><body><div class="wrap">diff --git a/public/changelog.json b/public/changelog.jsonindex 7d58c3897..52d4172d9 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-15T15:45:28.924Z",+ "generated_at": "2026-06-15T16:05:28.055Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -233,6 +233,16 @@"security"]},+ {+ "date": "2026-06-15",+ "type": "update",+ "title": "Sell your animations in the marketplace",+ "summary": "Animations you build in the Studio can now be listed for sale. Pose a figure, drop your keyframes, save the clip, then hit Sell — set a price in USDC (or list it free) and three.ws bakes a self-contained animated GLB and publishes it to a new \"From creators\" shelf in the animation marketplace. Buyers see a poster, the creator, length and price; free clips download in one click, and paid clips are unlocked by paying once in USDC on Base or Solana — re-download free forever from the same wallet. Earnings settle straight to your payout wallet, and your motion data stays gated behind the paywall until someone buys.",+ "link": "/marketplace?tab=animations",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-15","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex a63d7feee..90c81a86c 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -182,6 +182,14 @@<category>feature</category><description>When an agent is registered on-chain, three.ws now automatically runs its 3D model through the platform's glTF validator and records a signed validation attestation on the ERC-8004 ValidationRegistry — so an agent that advertises validation actually carries proof of it. A green "Validated" badge appears on the agent profile, readable by anyone without a wallet, and links straight to the full validation report and the on-chain record. The check is independent of the file's byte-identity (sha256), so both are surfaced on their own: a model that passes schema validation still shows its exact byte fingerprint. If a model has problems, the badge shows "Validation failed" with the specific reason — the agent is still registered, just unvalidated — and owners can re-validate after updating their model to refresh the badge. Validation is best-effort and never blocks or reverts a registration.</description></item>+ <item>+ <title>Sell your animations in the marketplace</title>+ <link>https://three.ws/marketplace?tab=animations</link>+ <guid isPermaLink="false">2026-06-15:Sell your animations in the marketplace</guid>+ <pubDate>Mon, 15 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Animations you build in the Studio can now be listed for sale. Pose a figure, drop your keyframes, save the clip, then hit Sell — set a price in USDC (or list it free) and three.ws bakes a self-contained animated GLB and publishes it to a new "From creators" shelf in the animation marketplace. Buyers see a poster, the creator, length and price; free clips download in one click, and paid clips are unlocked by paying once in USDC on Base or Solana — re-download free forever from the same wallet. Earnings settle straight to your payout wallet, and your motion data stays gated behind the paywall until someone buys.</description>+ </item><item><title>Sniper Arena — watch AI agents trade pump.fun live</title><link>https://three.ws/play/arena</link>diff --git a/public/club/venue/clubhouse.glb b/public/club/venue/clubhouse.glbnew file mode 100644index 000000000..51358971eBinary files /dev/null and b/public/club/venue/clubhouse.glb differdiff --git a/public/features.json b/public/features.jsonindex 30c28dc9d..28f3f31aa 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-15T15:45:28.873Z",+ "generated_at": "2026-06-15T16:05:28.005Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 214e6cc98..d86babd6b 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -56,6 +56,20 @@.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }.sm-brand:hover { text-decoration: none; }</style>++ <meta property="og:type" content="website">+ <meta property="og:site_name" content="three.ws">+ <meta property="og:title" content="Sitemap · three.ws">+ <meta property="og:description" content="Human-readable index of every page on three.ws.">+ <meta property="og:url" content="https://three.ws/sitemap">+ <meta property="og:image" content="https://three.ws/og-image.png">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:title" content="Sitemap · three.ws">+ <meta name="twitter:description" content="Human-readable index of every page on three.ws.">+ <meta name="twitter:image" content="https://three.ws/og-image.png">+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script></head><body><header class="sm-topbar">diff --git a/scripts/compress-glb.mjs b/scripts/compress-glb.mjsnew file mode 100644index 000000000..65df1711e--- /dev/null+++ b/scripts/compress-glb.mjs@@ -0,0 +1,54 @@+#!/usr/bin/env node+// scripts/compress-glb.mjs — shrink a glTF/GLB for the web.+//+// Sketchfab and DCC exports ship full-res PNG/JPEG textures that dominate the+// file size while the geometry is tiny. This pass:+// • prune + dedup — drop unused accessors/materials/textures, merge dupes+// • textureCompress — resize textures to a max edge and re-encode to WebP+// (alpha-safe, ~4-8× smaller than full-res PNG) via sharp+// • flatten/weld — tidy the scene graph and merge coincident vertices+//+// WebP is read natively by three.js GLTFLoader (EXT_texture_webp). Geometry is+// left uncompressed (no Draco) so the asset loads without a decoder dependency+// — these models are texture-bound, not vertex-bound.+//+// Usage:+// node scripts/compress-glb.mjs <input.glb> <output.glb> [maxTexturePx=1024] [quality=80]++import { NodeIO } from '@gltf-transform/core';+import { ALL_EXTENSIONS } from '@gltf-transform/extensions';+import { prune, dedup, weld, flatten, textureCompress } from '@gltf-transform/functions';+import sharp from 'sharp';+import { statSync } from 'node:fs';++const [input, output, maxPxArg, qualityArg] = process.argv.slice(2);+if (!input || !output) {+ console.error('Usage: node scripts/compress-glb.mjs <input.glb> <output.glb> [maxTexturePx=1024] [quality=80]');+ process.exit(1);+}+const maxPx = Number(maxPxArg) || 1024;+const quality = Number(qualityArg) || 80;++const mb = (bytes) => (bytes / 1024 / 1024).toFixed(2) + ' MB';++const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);++console.log(`[compress-glb] reading ${input} (${mb(statSync(input).size)})`);+const doc = await io.read(input);++await doc.transform(+ prune(),+ dedup(),+ flatten(),+ weld(),+ textureCompress({+ encoder: sharp,+ targetFormat: 'webp',+ resize: [maxPx, maxPx],+ quality,+ }),+ prune(),+);++await io.write(output, doc);+console.log(`[compress-glb] wrote ${output} (${mb(statSync(output).size)}) — textures ≤${maxPx}px webp q${quality}`);diff --git a/tests/api/animations-sell.test.js b/tests/api/animations-sell.test.jsnew file mode 100644index 000000000..e88e74669--- /dev/null+++ b/tests/api/animations-sell.test.js@@ -0,0 +1,84 @@+import { describe, it, expect } from 'vitest';+import { __test__ } from '../../api/animations/sell.js';++const { listSchema, delistSchema, shape, resolvePayto } = __test__;++const UUID = '11111111-2222-3333-4444-555555555555';+const NS_KEY = `u/${UUID}/animations/spin-kick-12.glb`;+const BASE_ADDR = '0x' + 'a'.repeat(40);+const SOL_ADDR = 'So11111111111111111111111111111111111111112';++describe('animations/sell listSchema', () => {+ it('accepts a well-formed paid listing and applies defaults', () => {+ const r = listSchema.safeParse({ id: UUID, price: 2.5, artifact_key: NS_KEY });+ expect(r.success).toBe(true);+ expect(r.data.currency).toBe('USDC');+ expect(r.data.artifact_mime).toBe('model/gltf-binary');+ expect(r.data.listed).toBe(true);+ });++ it('accepts a free listing (price omitted / zero)', () => {+ expect(listSchema.safeParse({ id: UUID, artifact_key: NS_KEY }).success).toBe(true);+ expect(listSchema.safeParse({ id: UUID, price: 0, artifact_key: NS_KEY }).success).toBe(true);+ });++ it('accepts valid payout addresses', () => {+ const r = listSchema.safeParse({ id: UUID, artifact_key: NS_KEY, payto_base: BASE_ADDR, payto_solana: SOL_ADDR });+ expect(r.success).toBe(true);+ });++ it('rejects a non-uuid id and a missing artifact_key', () => {+ expect(listSchema.safeParse({ id: 'nope', artifact_key: NS_KEY }).success).toBe(false);+ expect(listSchema.safeParse({ id: UUID }).success).toBe(false);+ });++ it('rejects a negative price and a price over the ceiling', () => {+ expect(listSchema.safeParse({ id: UUID, price: -1, artifact_key: NS_KEY }).success).toBe(false);+ expect(listSchema.safeParse({ id: UUID, price: 100_001, artifact_key: NS_KEY }).success).toBe(false);+ });++ it('rejects an unsupported currency, bad mime, and malformed payout addresses', () => {+ expect(listSchema.safeParse({ id: UUID, artifact_key: NS_KEY, currency: 'SOL' }).success).toBe(false);+ expect(listSchema.safeParse({ id: UUID, artifact_key: NS_KEY, artifact_mime: 'image/png' }).success).toBe(false);+ expect(listSchema.safeParse({ id: UUID, artifact_key: NS_KEY, payto_base: '0x123' }).success).toBe(false);+ expect(listSchema.safeParse({ id: UUID, artifact_key: NS_KEY, payto_solana: 'not!base58!' }).success).toBe(false);+ });+});++describe('animations/sell delistSchema', () => {+ it('requires the delist action and a uuid', () => {+ expect(delistSchema.safeParse({ id: UUID, action: 'delist' }).success).toBe(true);+ expect(delistSchema.safeParse({ id: UUID, action: 'list' }).success).toBe(false);+ expect(delistSchema.safeParse({ id: 'nope', action: 'delist' }).success).toBe(false);+ });+});++describe('animations/sell shape projection', () => {+ const baseRow = {+ id: UUID, slug: 'spin-kick', name: 'Spin Kick', visibility: 'private', listed: true,+ artifact_bytes: '248400', artifact_mime: 'model/gltf-binary', thumbnail_key: null, purchase_count: '3',+ };+ const payto = { base: BASE_ADDR, solana: SOL_ADDR, bsc: null };++ it('surfaces a price object when priced and coerces numeric fields', () => {+ const out = shape({ ...baseRow, price_amount: '2.5', price_currency: 'USDC' }, payto);+ expect(out.price).toEqual({ amount: '2.5', currency: 'USDC' });+ expect(out.artifact_bytes).toBe(248400);+ expect(out.purchase_count).toBe(3);+ expect(out.payout).toEqual({ base: BASE_ADDR, solana: SOL_ADDR, bsc: null });+ expect(out.thumbnail_url).toBeNull();+ });++ it('returns a null price for a free listing', () => {+ const out = shape({ ...baseRow, price_amount: null, price_currency: null }, payto);+ expect(out.price).toBeNull();+ expect(out.listed).toBe(true);+ });+});++describe('animations/sell resolvePayto', () => {+ it('uses explicit overrides without touching the DB when all are supplied', async () => {+ const out = await resolvePayto(UUID, { payto_base: BASE_ADDR, payto_solana: SOL_ADDR, payto_bsc: BASE_ADDR });+ expect(out).toEqual({ base: BASE_ADDR, solana: SOL_ADDR, bsc: BASE_ADDR });+ });+});