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
feat: realistic avatar assets, forge/tts/a2a hardening, page-wide updates + brand refinements
nirholas1bb3e6261ff6
diff --git a/api/_lib/a2a/mandate.js b/api/_lib/a2a/mandate.jsindex 61a4454d3..32ddc7e61 100644--- a/api/_lib/a2a/mandate.js+++ b/api/_lib/a2a/mandate.js@@ -26,9 +26,14 @@ import { env } from '../env.js';export const MANDATE_TYPE = 'a2a-intent-mandate';export const MANDATE_VERSION = 1;-// Networks an agent may be authorized to pay over. Mirrors the EVM `exact`-// schemes the A2A x402 client supports (see api/_lib/x402/a2a-client.js).+// Networks an agent may be authorized to pay over, in preference order. Solana+// is the primary A2A settlement rail — USDC SPL TransferChecked, sub-cent fees,+// sub-second finality — and is what the client picks first (see+// api/_lib/x402/a2a-client.js). The EVM `exact` schemes remain authorizable for+// peers that only accept Base/Ethereum.export const SUPPORTED_NETWORKS = [+ 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana mainnet (CAIP-2)+ 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1', // Solana devnet (CAIP-2)'eip155:8453', // Base mainnet'eip155:84532', // Base Sepolia'eip155:1', // Ethereum mainnet@@ -36,6 +41,10 @@ export const SUPPORTED_NETWORKS = ['eip155:42161', // Arbitrum One];+// Default rail when a mandate is issued without an explicit network list:+// Solana mainnet.+export const DEFAULT_NETWORK = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';+// Upper bound on mandate lifetime — a budgeted authorization should be// short-lived; 90 days is the ceiling, callers pick shorter.export const MAX_TTL_SECONDS = 90 * 24 * 60 * 60;@@ -111,7 +120,7 @@ export async function issueIntentMandate({throw new MandateError('invalid_amount', 'perCallAtomics cannot exceed maxAtomics');}- const nets = Array.isArray(networks) && networks.length ? networks : ['eip155:8453'];+ const nets = Array.isArray(networks) && networks.length ? networks : [DEFAULT_NETWORK];const unsupported = nets.filter((n) => !SUPPORTED_NETWORKS.includes(n));if (unsupported.length) {throw new MandateError('unsupported_network', `unsupported network(s): ${unsupported.join(', ')}`);diff --git a/api/_lib/crypto.js b/api/_lib/crypto.jsindex 342ebd18c..71fef8796 100644--- a/api/_lib/crypto.js+++ b/api/_lib/crypto.js@@ -13,6 +13,21 @@ export function randomToken(bytes = 32) {return base64url(randomBytes(bytes));}+// Cryptographically-secure zero-padded numeric code (e.g. for email+// verification). Uses rejection sampling over the CSPRNG so the distribution is+// uniform (no modulo bias) and unpredictable — never Math.random(), whose output+// is guessable and reduces the effective keyspace well below 10**digits.+export function randomDigits(digits = 6) {+ const max = 10 ** digits;+ const limit = Math.floor(0xffffffff / max) * max; // reject above to kill bias+ let n;+ do {+ const b = randomBytes(4);+ n = ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]) >>> 0;+ } while (n >= limit);+ return (n % max).toString().padStart(digits, '0');+}+export async function sha256(input) {const data = typeof input === 'string' ? new TextEncoder().encode(input) : input;const hash = await subtle.digest('SHA-256', data);diff --git a/api/_lib/env.js b/api/_lib/env.jsindex f17c9a1a1..c9e447df4 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -94,6 +94,16 @@ export const env = {get A2A_PAYER_PRIVATE_KEY() {return opt('A2A_PAYER_PRIVATE_KEY');},+ // Solana secret key for the autonomous payer wallet that signs SPL+ // TransferChecked payments when an agent pays a peer under a mandate on+ // Solana — the primary A2A settlement rail. Accepts the same encodings as+ // every other Solana secret in this codebase: base58 (Phantom export),+ // base64, or a JSON byte array. MUST be a platform-funded wallet holding+ // USDC, never a payment-receiving X402_PAY_TO_* key. Unset → the a2a-call+ // endpoint returns a designed 501 for Solana payments instead of paying.+ get A2A_PAYER_SOLANA_SECRET() {+ return opt('A2A_PAYER_SOLANA_SECRET') || opt('A2A_PAYER_SOLANA_PRIVATE_KEY');+ },// RPC URL used for read-only ERC-8004 reputation lookups when gating which// peers an agent is allowed to pay. Optional — reputation gating is opt-in// per call and skipped when no RPC is configured and no threshold is set.diff --git a/api/_lib/r2.js b/api/_lib/r2.jsindex cb56da808..95e91289d 100644--- a/api/_lib/r2.js+++ b/api/_lib/r2.js@@ -58,11 +58,13 @@ export async function presignUpload({ key, contentType, checksumSha256 }) {// Signed URL for GET (used for private avatars or temporary shares).export async function presignGet({ key, expiresIn = 600 }) {+ if (isAbsoluteUrl(key)) return key; // first-party/externally-hosted: already a public URLconst cmd = new GetObjectCommand({ Bucket: env.S3_BUCKET, Key: key });return getSignedUrl(r2, cmd, { expiresIn });}export async function headObject(key) {+ if (isAbsoluteUrl(key)) return null; // not a bucket objecttry {return await r2.send(new HeadObjectCommand({ Bucket: env.S3_BUCKET, Key: key }));} catch (err) {@@ -72,6 +74,7 @@ export async function headObject(key) {}export async function deleteObject(key) {+ if (isAbsoluteUrl(key)) return; // externally-hosted asset — nothing in our bucket to deleteawait r2.send(new DeleteObjectCommand({ Bucket: env.S3_BUCKET, Key: key }));}@@ -95,10 +98,22 @@ export async function getObjectBuffer(key) {}// Public CDN URL for objects served via R2 custom domain / r2.dev.+//+// First-party / externally-hosted avatars store an absolute URL in their+// `storage_key` (e.g. https://three.ws/avatars/realistic-male.glb) rather than+// an R2 object key — these models live outside the bucket and are already+// fully-qualified, so they pass through untouched. Every bucket-backed key+// (the `u/{ownerId}/…` form) resolves against the CDN domain exactly as before,+// so existing avatars are unaffected.export function publicUrl(key) {+ if (isAbsoluteUrl(key)) return key;return `${env.S3_PUBLIC_DOMAIN}/${encodeR2Key(key)}`;}+function isAbsoluteUrl(key) {+ return typeof key === 'string' && /^https?:\/\//i.test(key);+}+function encodeR2Key(key) {return key.split('/').map(encodeURIComponent).join('/');}diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex 9010af672..716c15e4f 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -225,6 +225,13 @@ export const limits = {// without Redis in prod rather than allowing unbounded paid inference.bountyJudge: (userId) =>getLimiter('bounty:judge:user', { limit: 30, window: '1 h', critical: true }).limit(userId),+ // Bounty creation + submission. Both are authenticated writes to public,+ // everyone-reads tables, so cap per user to stop one account scripting spam+ // that pollutes the feed and bloats storage.+ bountyCreate: (userId) =>+ getLimiter('bounty:create', { limit: 15, window: '1 h' }).limit(userId),+ bountySubmit: (userId) =>+ getLimiter('bounty:submit', { limit: 40, window: '1 h' }).limit(userId),// Direct messages between friends — its own bucket so DM spam can't starve// world-chat posting and vice versa. Mirrors world chat's order of magnitude.dmSend: (userId) => getLimiter('dm:send', { limit: 30, window: '1 m' }).limit(userId),@@ -348,6 +355,22 @@ export const limits = {memorySeed: (agentId) => getLimiter('memory:seed', { limit: 1, window: '1 d' }).limit(agentId),// Edge TTS: free upstream but cached in R2 — limit unique synthesis requests per user/min.ttsEdge: (userId) => getLimiter('tts:edge', { limit: 20, window: '1 m' }).limit(userId),+ // OpenAI TTS (api/tts/speak) — paid per-character against the server key. Per+ // user, and critical so it fails closed in prod without Redis rather than+ // allowing unbounded paid synthesis. Anonymous callers (keyed by IP) get a+ // much tighter bucket since they share no accountable identity.+ ttsSpeakUser: (userId) =>+ getLimiter('tts:speak:user', { limit: 40, window: '1 h', critical: true }).limit(userId),+ ttsSpeakIp: (ip) =>+ getLimiter('tts:speak:ip', { limit: 10, window: '1 h', critical: true }).limit(ip),+ // /brain multi-LLM proxy. Paid flagship models (Claude/GPT-4o) run on the+ // server keys, so meter per principal: authenticated users get a generous+ // per-user bucket, anonymous callers a tighter per-IP one. Both critical so a+ // missing Redis in prod fails closed instead of opening the paid floodgate.+ brainChatUser: (userId) =>+ getLimiter('brain:chat:user', { limit: 60, window: '1 m', critical: true }).limit(userId),+ brainChatIp: (ip) =>+ getLimiter('brain:chat:ip', { limit: 20, window: '1 m', critical: true }).limit(ip),// X (Twitter) memory seeding: 1 seed per agent per 6 hours.xSeed: (agentId) => getLimiter('memory:seed:x', { limit: 1, window: '6 h' }).limit(agentId),// Withdrawal requests: 5 per user per day to prevent spam.diff --git a/api/_lib/three-brand.js b/api/_lib/three-brand.jsindex b1800253f..c945b1183 100644--- a/api/_lib/three-brand.js+++ b/api/_lib/three-brand.js@@ -233,13 +233,20 @@ export function buildAgentOnchainAttributes(a) {* @param {string} a.name* @param {string} [a.description]* @param {string} [a.agentUrl] public agent profile page+ * @param {string} [a.image] resolvable avatar thumbnail (https/ipfs)+ * @param {string} [a.modelUri] the agent's 3D avatar GLB (https/ipfs)+ * @param {string} [a.modelFormat] defaults to 'gltf-binary'+ * @param {string} [a.origin] public origin override (defaults to env.APP_ORIGIN)+ * @param {boolean} [a.active] defaults true; pass false to mark inactive+ * @param {{chainId:string|number,agentId:string|number,registry?:string}} [a.erc8004]* @param {string[]} [a.skills]*/export function buildAgentRegistrationMetadata(a) {+ const origin = (a.origin || env.APP_ORIGIN).replace(/\/$/, '');const home = a.agentUrl || agentHomeUrl(a.agentId);const description =a.description?.trim() || `${a.name} — an autonomous agent on ${THREE_WS.name}.`;- const origin = env.APP_ORIGIN;+ const image = a.image || THREE_WS.ogImage;const cardUrl = `${origin}/.well-known/agent-card.json`;// Real, reachable endpoints. `endpoint` is the SDK's field; the extra `version`@@ -257,7 +264,11 @@ export function buildAgentRegistrationMetadata(a) {],name: a.name,description,- active: true,+ image,+ active: a.active === false ? false : true,+ // The 3D avatar is the three.ws differentiator — surface it so the registry+ // can render the agent's body, not just a flat thumbnail.+ ...(a.modelUri ? { model: { uri: a.modelUri, format: a.modelFormat || 'gltf-binary' } } : {}),services,x402Support: true,x402Endpoints: [@@ -271,9 +282,18 @@ export function buildAgentRegistrationMetadata(a) {priceUsdc: '0.001',},],- // Cross-link back to the three.ws registry so the two identities resolve to+ // Cross-link to other registries this agent lives in so identities resolve to// each other — Metaplex's `AgentRegistration` shape: { agentId, agentRegistry }.- registrations: [{ agentId: String(a.agentId), agentRegistry: THREE_WS.website }],+ // Always the three.ws handle; plus an ERC-8004 entry when the agent has one.+ registrations: [+ { agentId: String(a.agentId), agentRegistry: THREE_WS.website },+ ...(a.erc8004?.chainId && a.erc8004?.agentId+ ? [{+ agentRegistry: `eip155:${a.erc8004.chainId}:${a.erc8004.registry || ''}`.replace(/:$/, ''),+ agentId: String(a.erc8004.agentId),+ }]+ : []),+ ],supportedTrust: ['reputation'],agentMetadataUri: cardUrl,};diff --git a/api/_lib/x402/a2a-client.js b/api/_lib/x402/a2a-client.jsindex f652c81d1..719145866 100644--- a/api/_lib/x402/a2a-client.js+++ b/api/_lib/x402/a2a-client.js@@ -18,6 +18,8 @@import { randomBytes, randomUUID } from 'node:crypto';+import bs58 from 'bs58';+import {A2A_EXTENSIONS_HEADER,A2A_X402_EXTENSION_URI,@@ -25,6 +27,23 @@ import {export { A2A_EXTENSIONS_HEADER, A2A_X402_EXTENSION_URI };+// Solana is the primary A2A settlement rail. CAIP-2 ids must match what the+// server advertises (api/_lib/x402/a2a-server.js → NETWORK_SOLANA_*).+export const NETWORK_SOLANA_MAINNET = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';+export const NETWORK_SOLANA_DEVNET = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1';++export function isSolanaNetwork(network) {+ return (+ network === NETWORK_SOLANA_MAINNET ||+ network === NETWORK_SOLANA_DEVNET ||+ network === 'solana'+ );+}++function isEvmExactNetwork(network) {+ return /^eip155:\d+$/.test(network);+}+// ── Errors ────────────────────────────────────────────────────────────────export class A2AClientError extends Error {@@ -72,12 +91,92 @@ export async function createPrivateKeySigner(privateKey) {};}+// Decode a Solana secret key from any of the encodings used across this+// codebase: a JSON byte array (solana-keygen), base58 (Phantom export), or+// base64. Returns the 64-byte expanded secret key.+function decodeSolanaSecret(secret) {+ const trimmed = String(secret).trim();+ if (trimmed.startsWith('[')) {+ try {+ const bytes = Uint8Array.from(JSON.parse(trimmed));+ if (bytes.length === 64) return bytes;+ } catch {+ /* fall through to the error below */+ }+ throw new A2AClientError('invalid_signer', 'Solana secret: malformed 64-byte JSON array');+ }+ for (const decode of [() => bs58.decode(trimmed), () => new Uint8Array(Buffer.from(trimmed, 'base64'))]) {+ try {+ const bytes = decode();+ if (bytes.length === 64) return bytes;+ } catch {+ /* try the next encoding */+ }+ }+ throw new A2AClientError(+ 'invalid_signer',+ 'Solana secret must be a 64-byte key encoded as base58, base64, or a JSON array',+ );+}++// Build a Solana @solana/kit signer from a platform-funded payer secret. The+// returned signer carries `.address` (the payer's base58 pubkey) and signs the+// SPL TransferChecked payment built by buildSolanaExactPayload().+export async function createSolanaSigner(secret) {+ if (!secret || typeof secret !== 'string') {+ throw new A2AClientError('invalid_signer', 'createSolanaSigner: secret key string required');+ }+ const { createKeyPairSignerFromBytes } = await import('@solana/kit');+ return createKeyPairSignerFromBytes(decodeSolanaSecret(secret));+}+// ── Payload builders ──────────────────────────────────────────────────────function randomHex32() {return `0x${randomBytes(32).toString('hex')}`;}+// Build a Solana `exact` PaymentPayload for a Solana `accepts` entry, using the+// official @x402/svm scheme. It constructs an SPL TransferChecked from the+// payer's USDC ATA to the peer's, with the peer-advertised `extra.feePayer` as+// the transaction fee payer (co-signed by the facilitator on /settle), and+// partially signs it with `signer`. The base64 wire transaction lands in+// `payload.transaction` — exactly what the server's confirmSolanaPayment decodes+// and PayAI settles. Shape mirrors buildEvmExactPayload so the A2A submit leg is+// rail-agnostic.+export async function buildSolanaExactPayload({ accept, signer, resource, rpcUrl }) {+ if (accept.scheme !== 'exact') {+ throw new A2AClientError(+ 'unsupported_scheme',+ `a2a-client: only exact scheme supported on Solana, got ${accept.scheme}`,+ );+ }+ if (!accept.extra?.feePayer) {+ throw new A2AClientError(+ 'missing_fee_payer',+ 'a2a-client: Solana accept entry is missing extra.feePayer (facilitator co-signer)',+ { network: accept.network },+ );+ }+ if (!signer || typeof signer.address !== 'string') {+ throw new A2AClientError(+ 'invalid_signer',+ 'buildSolanaExactPayload: a @solana/kit signer is required (try createSolanaSigner)',+ );+ }+ const { ExactSvmScheme } = await import('@x402/svm');+ const scheme = new ExactSvmScheme(signer, rpcUrl ? { rpcUrl } : undefined);+ const built = await scheme.createPaymentPayload(2, accept);+ return {+ x402Version: built.x402Version || 2,+ scheme: 'exact',+ network: accept.network,+ resource,+ accepted: accept,+ payload: built.payload,+ };+}+const CHAIN_ID_BY_NETWORK = {'eip155:8453': 8453, // Base mainnet'eip155:84532': 84532, // Base sepolia@@ -218,9 +317,14 @@ function readReceipts(task) {};}-// Default network preference list. Callers can override by passing-// `networkPreference` to `payA2A`.-const DEFAULT_NETWORK_PREFERENCE = ['eip155:8453', 'eip155:84532', 'eip155:1'];+// Default network preference list — Solana first, EVM fallback. Callers can+// override by passing `networkPreference` to `payA2A`.+const DEFAULT_NETWORK_PREFERENCE = [+ NETWORK_SOLANA_MAINNET,+ 'eip155:8453',+ 'eip155:84532',+ 'eip155:1',+];function pickAccept(accepts, preference) {const order = preference?.length ? preference : DEFAULT_NETWORK_PREFERENCE;@@ -228,13 +332,15 @@ function pickAccept(accepts, preference) {const match = accepts.find((a) => a.network === net && a.scheme === 'exact');if (match) return match;}- // Fall back to the first `exact` EVM accept on a chain we recognise.- for (const a of accepts) {- if (a.scheme === 'exact' && /^eip155:\d+$/.test(a.network)) return a;- }+ // Fall back to the first `exact` accept on any rail we can settle — Solana+ // preferred over EVM when both are offered without an explicit preference.+ const solana = accepts.find((a) => a.scheme === 'exact' && isSolanaNetwork(a.network));+ if (solana) return solana;+ const evm = accepts.find((a) => a.scheme === 'exact' && isEvmExactNetwork(a.network));+ if (evm) return evm;throw new A2AClientError('no_supported_accept',- 'a2a-client: peer offered no supported (scheme=exact, EVM) accept',+ 'a2a-client: peer offered no supported scheme=exact accept on Solana or EVM',{ accepts: accepts.map(({ network, scheme }) => ({ network, scheme })) },);}diff --git a/api/agent-delegate.js b/api/agent-delegate.jsindex 547488490..d57412dda 100644--- a/api/agent-delegate.js+++ b/api/agent-delegate.js@@ -18,15 +18,21 @@ export default wrap(async (req, res) => {if (depth > 0)return error(res, 400, 'recursion_denied', 'nested agent delegation is not allowed');- const body = await readJson(req);- const { fromAgentId, toAgentId, message } = body || {};+ const body = await readJson(req, 32_000);+ const { toAgentId, message } = body || {};if (!toAgentId || typeof toAgentId !== 'string')return error(res, 400, 'validation_error', 'toAgentId required');if (!message || typeof message !== 'string')return error(res, 400, 'validation_error', 'message required');+ // Each delegation runs a real LLM completion on the platform key — cap the+ // prompt so one call can't carry a maximal payload into paid inference.+ if (message.length > 8000)+ return error(res, 400, 'validation_error', 'message exceeds 8000 characters');- // Rate limit per calling agent (or user session as fallback)- const rl = await limits.agentDelegate(fromAgentId || userId || 'anon');+ // Rate limit by the AUTHENTICATED principal, never a client-supplied id. Keying+ // on body.fromAgentId let a caller mint a fresh bucket per request (rotating the+ // id) and bypass the cap entirely — an unbounded LLM-cost amplification vector.+ const rl = await limits.agentDelegate(userId);if (!rl.success) return rateLimited(res, rl, 'delegate rate limit exceeded');try {diff --git a/api/agents/_id/_sub.js b/api/agents/_id/_sub.jsindex 94d91e6af..be7637eeb 100644--- a/api/agents/_id/_sub.js+++ b/api/agents/_id/_sub.js@@ -12,6 +12,8 @@ import { parse } from '../../_lib/validate.js';import { recoverAgentKey } from '../../_lib/agent-wallet.js';import { readEmbedPolicy, validateEmbedPolicy } from '../../_lib/embed-policy.js';import { resolveAvatarUrl } from '../../_lib/avatars.js';+import { buildAgentRegistrationMetadata } from '../../_lib/three-brand.js';+import { publicUrl as r2PublicUrl } from '../../_lib/r2.js';async function resolveAuth(req) {const session = await getSessionUser(req);diff --git a/api/auth/[action].js b/api/auth/[action].jsindex a668e4448..5258990e7 100644--- a/api/auth/[action].js+++ b/api/auth/[action].js@@ -9,7 +9,7 @@ import {verifyPassword, hashPassword, createSession, destroySession, sessionCookie,getSessionUser, hasSessionCookie, revokeRefreshToken,} from '../_lib/auth.js';-import { randomToken, sha256 } from '../_lib/crypto.js';+import { randomToken, randomDigits, sha256 } from '../_lib/crypto.js';import { cors, json, method, readJson, wrap, error, rateLimited } from '../_lib/http.js';import { limits, clientIp } from '../_lib/rate-limit.js';import { parse, loginBody, registerBody, usernameRegisterBody, username as usernameValidator, displayName, email, password } from '../_lib/validate.js';@@ -286,7 +286,7 @@ async function handleResendVerification(req, res) {if (!rows[0]) return error(res, 401, 'unauthorized', 'sign in required');if (rows[0].email_verified) return json(res, 200, { success: true, already_verified: true });await sql`update email_verifications set consumed_at = now() where user_id = ${session.id} and consumed_at is null`;- const code = Math.floor(Math.random() * 1_000_000).toString().padStart(6, '0');+ const code = randomDigits(6);const codeHash = await sha256(code);const expiresAt = new Date(Date.now() + 30 * 60_000);await sql`insert into email_verifications (user_id, code_hash, expires_at) values (${session.id}, ${codeHash}, ${expiresAt.toISOString()})`;diff --git a/api/bounties.js b/api/bounties.jsindex 1cbbbec90..cdae2ca96 100644--- a/api/bounties.js+++ b/api/bounties.js@@ -1,6 +1,7 @@import { sql } from './_lib/db.js';-import { cors, json, error, readJson, wrap, method } from './_lib/http.js';+import { cors, json, error, readJson, wrap, method, rateLimited } from './_lib/http.js';import { getSessionUser } from './_lib/auth.js';+import { limits } from './_lib/rate-limit.js';import { enrichLikes } from './_lib/bounty-likes.js';const SOL_USD_FALLBACK = 160;@@ -111,8 +112,12 @@ export default wrap(async (req, res) => {} catch {return error(res, 401, 'unauthorized', 'sign in to post a bounty');}+ if (!user) return error(res, 401, 'unauthorized', 'sign in to post a bounty');- const body = await readJson(req);+ const rl = await limits.bountyCreate(user.id);+ if (!rl.success) return rateLimited(res, rl, 'too many bounties, slow down');++ const body = await readJson(req, 16_000);const {title,description,@@ -124,6 +129,15 @@ export default wrap(async (req, res) => {} = body;if (!title?.trim()) return error(res, 400, 'bad_request', 'title is required');+ // Bound the free-text and identifier fields so a single bounty can't carry a+ // near-1MB payload into a public, everyone-reads table.+ if (title.trim().length > 200) return error(res, 400, 'bad_request', 'title too long (max 200)');+ if (typeof description === 'string' && description.length > 4000)+ return error(res, 400, 'bad_request', 'description too long (max 4000)');+ if (typeof coin_symbol === 'string' && coin_symbol.length > 32)+ return error(res, 400, 'bad_request', 'coin_symbol too long');+ if (typeof coin_mint === 'string' && coin_mint.length > 64)+ return error(res, 400, 'bad_request', 'coin_mint too long');if (!reward_sol && !reward_tokens)return error(res, 400, 'bad_request', 'set a reward (SOL or tokens)');diff --git a/api/brain/chat.js b/api/brain/chat.jsindex 632410a95..efb067cdc 100644--- a/api/brain/chat.js+++ b/api/brain/chat.js@@ -15,9 +15,27 @@ import { createAnthropic } from '@ai-sdk/anthropic';import { createOpenAI } from '@ai-sdk/openai';import { createQwen } from 'qwen-ai-provider';import { env } from '../_lib/env.js';-import { cors, method, readJson, error, wrap } from '../_lib/http.js';+import { cors, method, readJson, error, wrap, rateLimited } from '../_lib/http.js';+import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';+import { limits, clientIp } from '../_lib/rate-limit.js';import { watsonxConfig, watsonxChatRequest } from '../_lib/watsonx.js';+// Providers an anonymous (signed-out) caller may use: only the genuinely free+// tiers — the OpenRouter-routed open-weight default and the free NVIDIA NIM+// models. Every paid first-party model (Claude, GPT-4o, o3, DashScope, DeepSeek)+// requires sign-in so an unauthenticated script can't drain the server's billed+// API keys. Mirrors the anon-provider gate in api/chat.js.+const ANON_BRAIN_PROVIDERS = new Set([+ 'gpt-oss-120b',+ 'nvidia-nemotron-120b',+ 'nvidia-nemotron-super-49b',+ 'nvidia-nemotron-nano',+ 'nvidia-deepseek-v4',+ 'nvidia-kimi-k2',+ 'nvidia-llama4-maverick',+ 'nvidia-minimax-m2',+]);+export const maxDuration = 120;// Each spec declares its *native* provider model (built from a first-party key,@@ -373,6 +391,21 @@ export default wrap(async function handler(req, res) {if (!method(req, res, ['POST'])) return;+ // Auth + rate limiting. The paid flagship models run on the server's billed+ // API keys, so an unmetered, unauthenticated proxy is a direct financial-drain+ // vector. Authenticated callers get a generous per-user budget; anonymous+ // callers a tight per-IP one and access only to the free-tier providers.+ const session = await getSessionUser(req);+ const bearer = session ? null : await authenticateBearer(extractBearer(req));+ const userId = session?.id ?? bearer?.userId ?? null;+ if (userId) {+ const rl = await limits.brainChatUser(userId);+ if (!rl.success) return rateLimited(res, rl, 'too many chat requests, slow down');+ } else {+ const rl = await limits.brainChatIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl, 'too many anonymous chat requests, try again shortly');+ }+let body;try {body = await readJson(req, 200_000);@@ -387,6 +420,11 @@ export default wrap(async function handler(req, res) {available: Object.keys(PROVIDERS),});}+ // Paid first-party models are sign-in only — anonymous callers are clamped to+ // the free tiers so they can't burn the server's billed Anthropic/OpenAI keys.+ if (!userId && !ANON_BRAIN_PROVIDERS.has(providerKey)) {+ return error(res, 401, 'unauthorized', 'sign in to use this model');+ }const primary = buildPrimary(spec);if (!primary) {diff --git a/api/forge-rembg.js b/api/forge-rembg.jsindex f0ccbee9f..9aad8b509 100644--- a/api/forge-rembg.js+++ b/api/forge-rembg.js@@ -15,6 +15,7 @@import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';+import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';const JOB_ID_RE = /^[A-Za-z0-9_-]{20,64}$/;@@ -37,9 +38,18 @@ async function startJob(req, res) {}const body = await readJson(req, 4_000).catch(() => null);- const imageUrl = typeof body?.image_url === 'string' ? body.image_url.trim() : '';- if (!imageUrl.startsWith('https://')) {- return json(res, 400, { error: 'invalid_image_url', message: 'image_url must be a public https URL.' });+ const rawImageUrl = typeof body?.image_url === 'string' ? body.image_url.trim() : '';+ // Resolve + validate the host our side (rejects private/loopback/metadata IPs)+ // before handing the URL to the worker — defense in depth against SSRF rather+ // than trusting the worker's egress posture.+ let imageUrl;+ try {+ imageUrl = await assertPublicHttpsUrl(rawImageUrl);+ } catch (err) {+ return json(res, 400, {+ error: 'invalid_image_url',+ message: err instanceof SsrfError ? `image_url rejected: ${err.message}` : 'image_url must be a public https URL.',+ });}const model = VALID_MODELS.has(body?.model) ? body.model : 'rmbg2';diff --git a/api/forge-remesh.js b/api/forge-remesh.jsindex f165b98bf..371ede837 100644--- a/api/forge-remesh.js+++ b/api/forge-remesh.js@@ -18,6 +18,7 @@import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';+import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';const JOB_ID_RE = /^[A-Za-z0-9_-]{20,64}$/;@@ -43,9 +44,17 @@ async function startJob(req, res) {}const body = await readJson(req, 4_000).catch(() => null);- const meshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';- if (!meshUrl.startsWith('https://')) {- return json(res, 400, { error: 'invalid_mesh_url', message: 'mesh_url must be a public https URL.' });+ const rawMeshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';+ // Resolve + validate the host our side (rejects private/loopback/metadata IPs)+ // before handing the URL to the worker — SSRF defense in depth.+ let meshUrl;+ try {+ meshUrl = await assertPublicHttpsUrl(rawMeshUrl);+ } catch (err) {+ return json(res, 400, {+ error: 'invalid_mesh_url',+ message: err instanceof SsrfError ? `mesh_url rejected: ${err.message}` : 'mesh_url must be a public https URL.',+ });}const remeshMode = VALID_MODES.has(body?.remesh_mode) ? body.remesh_mode : 'triangle';diff --git a/api/forge-segment.js b/api/forge-segment.jsindex 313284384..4c3a744ce 100644--- a/api/forge-segment.js+++ b/api/forge-segment.js@@ -19,6 +19,7 @@import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';+import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';const JOB_ID_RE = /^[A-Za-z0-9_-]{20,64}$/;@@ -42,9 +43,17 @@ async function startJob(req, res) {}const body = await readJson(req, 4_000).catch(() => null);- const meshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';- if (!meshUrl.startsWith('https://')) {- return json(res, 400, { error: 'invalid_mesh_url', message: 'mesh_url must be a public https URL.' });+ const rawMeshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';+ // Resolve + validate the host our side (rejects private/loopback/metadata IPs)+ // before handing the URL to the worker — SSRF defense in depth.+ let meshUrl;+ try {+ meshUrl = await assertPublicHttpsUrl(rawMeshUrl);+ } catch (err) {+ return json(res, 400, {+ error: 'invalid_mesh_url',+ message: err instanceof SsrfError ? `mesh_url rejected: ${err.message}` : 'mesh_url must be a public https URL.',+ });}const segMethod = VALID_METHODS.has(body?.method) ? body.method : 'auto';diff --git a/api/forge-stylize.js b/api/forge-stylize.jsindex 223b0e669..927a164ca 100644--- a/api/forge-stylize.js+++ b/api/forge-stylize.js@@ -18,6 +18,7 @@import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';+import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';const JOB_ID_RE = /^[A-Za-z0-9_-]{20,64}$/;@@ -50,9 +51,17 @@ async function startJob(req, res) {}const body = await readJson(req, 4_000).catch(() => null);- const meshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';- if (!meshUrl.startsWith('https://')) {- return json(res, 400, { error: 'invalid_mesh_url', message: 'mesh_url must be a public https URL.' });+ const rawMeshUrl = typeof body?.mesh_url === 'string' ? body.mesh_url.trim() : '';+ // Resolve + validate the host our side (rejects private/loopback/metadata IPs)+ // before handing the URL to the worker — SSRF defense in depth.+ let meshUrl;+ try {+ meshUrl = await assertPublicHttpsUrl(rawMeshUrl);+ } catch (err) {+ return json(res, 400, {+ error: 'invalid_mesh_url',+ message: err instanceof SsrfError ? `mesh_url rejected: ${err.message}` : 'mesh_url must be a public https URL.',+ });}const style = STYLE_BOUNDS[body?.style] ? body.style : 'voxel';diff --git a/api/tts/speak.js b/api/tts/speak.jsindex 864082c83..d6f5faaee 100644--- a/api/tts/speak.js+++ b/api/tts/speak.js@@ -8,7 +8,9 @@// audio analysis required.import { env } from '../_lib/env.js';-import { cors, method, readJson, error, wrap } from '../_lib/http.js';+import { cors, method, readJson, error, wrap, rateLimited } from '../_lib/http.js';+import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';+import { limits, clientIp } from '../_lib/rate-limit.js';export const maxDuration = 60;@@ -33,6 +35,20 @@ export default wrap(async function handler(req, res) {const key = env.OPENAI_API_KEY;if (!key) return error(res, 503, 'not_configured', 'OPENAI_API_KEY not set');+ // OpenAI TTS bills per character against the server key, so meter every call.+ // Authenticated callers get a per-user budget; anonymous callers a tight+ // per-IP one. Without this the endpoint is an open, unbounded paid-API drain.+ const session = await getSessionUser(req);+ const bearer = session ? null : await authenticateBearer(extractBearer(req));+ const userId = session?.id ?? bearer?.userId ?? null;+ if (userId) {+ const rl = await limits.ttsSpeakUser(userId);+ if (!rl.success) return rateLimited(res, rl, 'TTS rate limit exceeded, try again later');+ } else {+ const rl = await limits.ttsSpeakIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl, 'TTS rate limit exceeded, sign in for a higher limit');+ }+let body;try {body = await readJson(req, 50_000);diff --git a/character-studio/index.html b/character-studio/index.htmlindex 3721afcb2..488ea2d3b 100644--- a/character-studio/index.html+++ b/character-studio/index.html@@ -2,10 +2,28 @@<html lang="en"><head><meta charset="UTF-8" />- <link rel="icon" type="image/svg+xml" href="src/favicon.ico" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /><meta name="HandheldFriendly" content="true" /><title>Avatar Studio · three.ws</title>+ <meta name="description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories. No third-party dependency." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/avatar-studio" />+ <meta property="og:title" content="Avatar Studio · three.ws" />+ <meta property="og:description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Avatar Studio · three.ws" />+ <meta name="twitter:description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/site.webmanifest" /></head><body>diff --git a/docs/internal/PROGRESS.md b/docs/internal/PROGRESS.mdindex 20c3e37bb..51f6d5a26 100644--- a/docs/internal/PROGRESS.md+++ b/docs/internal/PROGRESS.md@@ -168,7 +168,7 @@ Rails:- Only the platform image pipeline (FLUX→TRELLIS) is sold via x402; the BYOK geometry backends (Meshy/Tripo) bill through the caller's own key on the free `/api/forge` and are intentionally not monetized here.- The polled `glb_url` is the provider delivery URL (short-lived) when no durable store row exists — documented as "fetch promptly". Parity with the free endpoint's store-unavailable behavior.-## Item 8 — Text-to-animation (generate motion from a prompt) ✅ (core; UI button is the remaining surface)+## Item 8 — Text-to-animation (generate motion from a prompt) ✅**What:** Generate a brand-new animation from a natural-language prompt ("waving confidently", "a slow tai-chi sweep") and retarget it onto any rigged avatar. The capability Tripo and the rest of the field lack — they only *apply preset* clips; this *synthesizes* motion that doesn't pre-exist. Reuses every downstream piece we already own: the Wolf3D rig, the retarget engine, and the animation library format.@@ -195,4 +195,4 @@ Rails:- *Verified here:* the SMPL→clip conversion (the keystone), the provider mode, the REST endpoint, and the MCP tool registration — all with tests.- *Deploy-validated (GPU, like every other `model-*` worker — none run in-repo/CI):* MDM inference. Specifically `mdm_sampler._decode_to_smpl()` (HumanML3D representation → SMPL axis-angle) is the integration point to confirm against the deployed checkpoint, and the SMPL→Wolf3D **rest-pose offset** defaults to identity and should be calibrated on first deploy for best fidelity (bone-name + hip-scale alignment already handled by the retarget engine).-**Remaining surface:** a browser "Generate from text" button in the pose/animation studio (the REST + MCP agent surfaces are wired and tested now; the in-browser button is the one consumer not yet added — it would call `/api/forge-motion`, poll, then apply the returned clip via the existing `animation-library` retarget path, exactly like selecting a preset).+**Browser surface (shipped):** the pose-studio animation library (`src/animation-library.js`) gained a "✨ Generate" input above the preset gallery. `generateFromText()` POSTs `/api/forge-motion`, polls with a token-based abort + elapsed counter (mirrors forge-stylize), fetches the returned clip JSON, and plays it through the **same** apply path as a preset — `preview()` was refactored to share a new `_playClip(clip, def)` core, so a generated motion gets the identical transport/speed/loop/export behavior. Busy/error/unconfigured states designed; the control + cyan-accented styles live in `pages/pose.html` and only show once a rigged avatar is loaded. In-flight generations abort on rig change / dispose. `npx vite build` ✓; `tests/animations.test.js` (manifest/clip invariants) stays green.diff --git a/pages/agent-detail.html b/pages/agent-detail.htmlindex 02549f548..9c16c2f1c 100644--- a/pages/agent-detail.html+++ b/pages/agent-detail.html@@ -4,6 +4,19 @@<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Agent · three.ws</title>+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/agent" />+ <meta property="og:title" content="Agent · three.ws" />+ <meta property="og:description" content="Meet your 3D AI agent — voice, memory, payments, and an on-chain identity. Built on three.ws." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Agent · three.ws" />+ <meta name="twitter:description" content="Meet your 3D AI agent — voice, memory, payments, and an on-chain identity. Built on three.ws." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#0a0a0a" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/agent-economy.html b/pages/agent-economy.htmlindex 96047fe90..0522fefc3 100644--- a/pages/agent-economy.html+++ b/pages/agent-economy.html@@ -5,6 +5,19 @@<meta name="viewport" content="width=device-width, initial-scale=1" /><title>Agent Economy — three.ws live demo</title><meta name="description" content="Watch two 3D AI agents transact on-chain. Agent A buys data from Agent B. Real SOL. Real Solana transaction. Live now." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/agent-economy" />+ <meta property="og:title" content="Agent Economy — three.ws live demo" />+ <meta property="og:description" content="Watch two 3D AI agents transact on-chain. Agent A buys data from Agent B. Real SOL. Real Solana transaction. Live now." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Agent Economy — three.ws live demo" />+ <meta name="twitter:description" content="Watch two 3D AI agents transact on-chain. Agent A buys data from Agent B. Real SOL. Real Solana transaction. Live now." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />diff --git a/pages/agent-trade.html b/pages/agent-trade.htmlindex 5d5b41329..d52e68a30 100644--- a/pages/agent-trade.html+++ b/pages/agent-trade.html@@ -11,6 +11,19 @@<meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Agent Commerce · three.ws</title><meta name="description" content="Watch two AI agents pay each other on-chain using x402 — a live Solana transaction, in 3D.">+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/agent-trade" />+ <meta property="og:title" content="Agent Commerce · three.ws" />+ <meta property="og:description" content="Watch two AI agents pay each other on-chain using x402 — a live Solana transaction, in 3D." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Agent Commerce · three.ws" />+ <meta name="twitter:description" content="Watch two AI agents pay each other on-chain using x402 — a live Solana transaction, in 3D." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="stylesheet" href="/fonts/fonts.css"><style>:root {diff --git a/pages/avatar-studio-demo.html b/pages/avatar-studio-demo.htmlindex 15ab31066..566902f4e 100644--- a/pages/avatar-studio-demo.html+++ b/pages/avatar-studio-demo.html@@ -5,6 +5,19 @@<title>Avatar Studio · three.ws</title><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories. No third-party dependency." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/avatar-studio" />+ <meta property="og:title" content="Avatar Studio · three.ws" />+ <meta property="og:description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Avatar Studio · three.ws" />+ <meta name="twitter:description" content="Create and customize 3D avatars — face sculpting, body morphs, outfits, and accessories." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#000000" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/bounty.html b/pages/bounty.htmlindex 281c9b618..b46a402f2 100644--- a/pages/bounty.html+++ b/pages/bounty.html@@ -18,6 +18,19 @@<meta property="og:type" content="website" /><meta property="og:site_name" content="three.ws" /><meta property="og:title" content="Bounty · three.ws" />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/bounty" />+ <meta property="og:title" content="Bounty · three.ws" />+ <meta property="og:description" content="Complete this three.ws bounty, submit proof, and earn rewards paid on-chain." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Bounty · three.ws" />+ <meta name="twitter:description" content="Complete this three.ws bounty, submit proof, and earn rewards paid on-chain." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="stylesheet" href="/pump-bounties.css" /></head><body>diff --git a/pages/city.html b/pages/city.htmlindex d8fc32b82..1c8784e8b 100644--- a/pages/city.html+++ b/pages/city.html@@ -5,6 +5,19 @@<title>City · three.ws</title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" /><meta name="description" content="City — an open world on three.ws. Walk, explore, drive." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/city" />+ <meta property="og:title" content="City · three.ws" />+ <meta property="og:description" content="City — an open world on three.ws. Walk, explore, and discover other agents." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="City · three.ws" />+ <meta name="twitter:description" content="City — an open world on three.ws. Walk, explore, and discover other agents." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#060607" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/coin3d.html b/pages/coin3d.htmlindex 07d7403c5..e1978119a 100644--- a/pages/coin3d.html+++ b/pages/coin3d.html@@ -20,6 +20,16 @@content="See any pump.fun token as a live 3D scene — coin, holders, and graduation progress."/><meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/coin3d" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Token in 3D · three.ws" />+ <meta name="twitter:description" content="View any token in 3D — bonding curves, holder bubbles, and live trades rendered as an interactive 3D scene." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><style>:root {--bg-0: #060606;diff --git a/pages/communities.html b/pages/communities.htmlindex 3f57bea7e..cbc46ccee 100644--- a/pages/communities.html+++ b/pages/communities.html@@ -18,6 +18,13 @@<meta property="og:description" content="Each coin is its own live 3D world. Drop in your avatar and hang out with the community." /><meta property="og:url" content="https://three.ws/communities" /><meta name="twitter:card" content="summary_large_image" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Coin Communities · three.ws" />+ <meta name="twitter:description" content="Pick a coin, drop in an avatar, and walk around its world with everyone else holding it. Each coin is its own live 3D community." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><style>* { margin: 0; padding: 0; box-sizing: border-box; }:root {diff --git a/pages/demo-economy.html b/pages/demo-economy.htmlindex 18a637d87..d40909966 100644--- a/pages/demo-economy.html+++ b/pages/demo-economy.html@@ -5,6 +5,19 @@<meta name="viewport" content="width=device-width,initial-scale=1" /><title>Agent Economy — two AI agents pay each other on-chain · three.ws</title><meta name="description" content="Watch NOVA and ORACLE — two three.ws AI agents with real Solana wallets — discover services on the x402 bazaar, pay each other in SOL, and display a live market briefing on the TV in their world." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/demo-economy" />+ <meta property="og:title" content="Agent Economy Demo — two AI agents pay each other on-chain · three.ws" />+ <meta property="og:description" content="Watch NOVA and ORACLE — two three.ws AI agents with real Solana wallets — discover services, pay each other in SOL, and display a live market briefing." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Agent Economy Demo — two AI agents pay each other on-chain · three.ws" />+ <meta name="twitter:description" content="Watch NOVA and ORACLE — two three.ws AI agents with real Solana wallets — discover services, pay each other in SOL, and display a live market briefing." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />diff --git a/pages/embed-walk.html b/pages/embed-walk.htmlindex fba8c42a8..b3813b74c 100644--- a/pages/embed-walk.html+++ b/pages/embed-walk.html@@ -5,6 +5,19 @@<meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Walk Avatar Embed Generator · three.ws</title><meta name="description" content="Generate an embed snippet for your three.ws walking avatar — iframe or one-line JS tag." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/embed-walk" />+ <meta property="og:title" content="Walk Avatar Embed Generator · three.ws" />+ <meta property="og:description" content="Generate an embed snippet for the three.ws walking avatar. One HTML tag, any website." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Walk Avatar Embed Generator · three.ws" />+ <meta name="twitter:description" content="Generate an embed snippet for the three.ws walking avatar. One HTML tag, any website." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />diff --git a/pages/embed.html b/pages/embed.htmlindex 5eb46ff31..a859a5536 100644--- a/pages/embed.html+++ b/pages/embed.html@@ -11,6 +11,19 @@<meta name="viewport" content="width=device-width, initial-scale=1" /><title>Embed editor — three.ws</title><meta name="description" content="Embed a live 3D avatar on any website — static, idle, walking, or chat. Configure, preview, and copy the snippet." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/embed" />+ <meta property="og:title" content="Embed editor — three.ws" />+ <meta property="og:description" content="Embed a live 3D avatar on any website — static, idle, walking, or chat. Configure, preview, and copy the snippet." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Embed editor — three.ws" />+ <meta name="twitter:description" content="Embed a live 3D avatar on any website — static, idle, walking, or chat. Configure, preview, and copy the snippet." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><style>html,body {diff --git a/pages/forge.html b/pages/forge.htmlindex 2afe86b6d..194fa6299 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -14,6 +14,16 @@content="Describe an object, watch it become an interactive 3D model. Real generation, real GLB, downloadable."/><meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/forge" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Forge · Text → 3D · three.ws" />+ <meta name="twitter:description" content="Type a description, get a textured 3D model. Forge turns a text prompt into an interactive GLB you can orbit, inspect in AR, and download." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#080814" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/live.html b/pages/live.htmlindex cd8091f0a..31823aa50 100644--- a/pages/live.html+++ b/pages/live.html@@ -5,6 +5,19 @@<meta name="viewport" content="width=device-width,initial-scale=1" /><title>Agent Economy — Live · three.ws</title><meta name="description" content="Two AI agents in a virtual world paying each other for live Solana market data. Real on-chain transactions, real blockchain, real 3D." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/live" />+ <meta property="og:title" content="Agent Economy — Live · three.ws" />+ <meta property="og:description" content="Two AI agents in a virtual world paying each other for live Solana market data. Real on-chain transactions, real blockchain, real 3D." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Agent Economy — Live · three.ws" />+ <meta name="twitter:description" content="Two AI agents in a virtual world paying each other for live Solana market data. Real on-chain transactions, real blockchain, real 3D." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />diff --git a/pages/mocap-studio.html b/pages/mocap-studio.htmlindex ca1185f54..58182d437 100644--- a/pages/mocap-studio.html+++ b/pages/mocap-studio.html@@ -5,6 +5,19 @@<title>Mocap Studio · three.ws</title><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="description" content="Record your face, save the clip, replay it on any three.ws avatar." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/mocap-studio" />+ <meta property="og:title" content="Mocap Studio · three.ws" />+ <meta property="og:description" content="Record your face, save the clip, replay it on any three.ws avatar." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Mocap Studio · three.ws" />+ <meta name="twitter:description" content="Record your face, save the clip, replay it on any three.ws avatar." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#050505" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/overlay-control.html b/pages/overlay-control.htmlindex afb532b58..cfedd73c5 100644--- a/pages/overlay-control.html+++ b/pages/overlay-control.html@@ -6,6 +6,19 @@<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="description" content="Stream Deck for your three.ws OBS overlay — emote hotkeys, expression mixer, mic threshold." /><meta name="theme-color" content="#0d0d0d" />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/overlay-control" />+ <meta property="og:title" content="Overlay Control · three.ws" />+ <meta property="og:description" content="Stream Deck for your three.ws OBS overlay — emote hotkeys, expression mixer, mic threshold." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Overlay Control · three.ws" />+ <meta name="twitter:description" content="Stream Deck for your three.ws OBS overlay — emote hotkeys, expression mixer, mic threshold." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />diff --git a/pages/play.html b/pages/play.htmlindex a8b74a596..7e088e688 100644--- a/pages/play.html+++ b/pages/play.html@@ -33,6 +33,14 @@<meta property="og:title" content="Play · Coin Communities" /><meta property="og:description" content="A browser isometric MMO on three.ws — join coin communities, gather, fight, trade, explore." /><meta property="og:url" content="https://three.ws/play" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Play · Coin Communities — three.ws" />+ <meta name="twitter:description" content="Play in your coin's 3D community world. Walk, chat, and hang out with fellow holders." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="stylesheet" href="/src/game/coincommunities.css" /></head>diff --git a/pages/pose.html b/pages/pose.htmlindex 9598d53f5..f8faa3ec0 100644--- a/pages/pose.html+++ b/pages/pose.html@@ -34,6 +34,14 @@content="Free 3D pose-reference studio. Click body parts to pose them, pick from preset poses, export PNG."/><meta property="og:url" content="https://three.ws/pose" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Pose Studio · three.ws" />+ <meta name="twitter:description" content="Create and save custom poses for any three.ws avatar. Export as animation clips or share with your community." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><style>:root {@@ -553,6 +561,61 @@line-height: 1.45;margin: -2px 0 10px;}+ .al-gen {+ display: flex;+ gap: 6px;+ margin-bottom: 9px;+ }+ .al-gen-input {+ flex: 1 1 auto;+ min-width: 0;+ box-sizing: border-box;+ background: rgba(34, 211, 238, 0.06);+ border: 1px solid rgba(34, 211, 238, 0.4);+ color: var(--text);+ font: inherit;+ font-size: 12px;+ padding: 7px 10px;+ border-radius: 8px;+ }+ .al-gen-input::placeholder {+ color: var(--text-3);+ }+ .al-gen-input:focus {+ outline: none;+ border-color: rgba(34, 211, 238, 0.75);+ }+ .al-gen-btn {+ flex: 0 0 auto;+ appearance: none;+ border: 1px solid rgba(34, 211, 238, 0.4);+ background: rgba(34, 211, 238, 0.14);+ color: #cffafe;+ font: inherit;+ font-size: 12px;+ font-weight: 600;+ padding: 7px 12px;+ border-radius: 8px;+ cursor: pointer;+ white-space: nowrap;+ transition: background 0.12s ease, border-color 0.12s ease;+ }+ .al-gen-btn:hover:not(:disabled) {+ background: rgba(34, 211, 238, 0.24);+ border-color: rgba(34, 211, 238, 0.7);+ }+ .al-gen-btn:focus-visible {+ outline: none;+ border-color: rgba(34, 211, 238, 0.85);+ box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.3);+ }+ .al-gen-btn:disabled {+ opacity: 0.6;+ cursor: default;+ }+ .al-gen[data-busy='true'] .al-gen-input {+ opacity: 0.6;+ }.al-search {width: 100%;box-sizing: border-box;@@ -1745,9 +1808,10 @@<!-- RIGHT PANEL --><aside id="pose-right"><section class="pose-section pose-section-anim">- <h2>Animation presets</h2>+ <h2>Animation</h2><p class="pose-section-sub">- Load a rigged avatar, click a motion to preview it live, then export an+ Load a rigged avatar, then <strong>generate a motion from a text+ prompt</strong> or pick a preset — preview it live and export ananimated GLB.</p><div id="pose-anim-library"></div>diff --git a/pages/segment.html b/pages/segment.htmlindex eccc267ca..977767196 100644--- a/pages/segment.html+++ b/pages/segment.html@@ -20,6 +20,16 @@content="Turn a single mesh into addressable, named parts you can hide, recolour, replace, and export individually."/><meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/segment" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Parts Studio · Segment a 3D model · three.ws" />+ <meta name="twitter:description" content="Segment and isolate parts of any 3D model. Extract, label, and export components for use in your avatar or world." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="stylesheet" href="/style.css" /><style>.seg-main {diff --git a/pages/three-token.html b/pages/three-token.htmlindex 915582038..0aa22a020 100644--- a/pages/three-token.html+++ b/pages/three-token.html@@ -7,6 +7,17 @@<meta name="description" content="The $THREE protocol token — live price, bonding-curve chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." /><meta property="og:title" content="$THREE · three.ws protocol token" /><meta property="og:description" content="Live price, bonding-curve chart, and streaming trades for $THREE." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/three-token" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="$THREE · Live price, chart & trades · three.ws" />+ <meta name="twitter:description" content="The $THREE protocol token — live price, bonding-curve chart, streaming trades, and one-click buy. The only coin powering the three.ws agent economy." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#0a0a0d" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/pages/three-ws-launch-week.html b/pages/three-ws-launch-week.htmlindex 97538a46b..ec7d14f64 100644--- a/pages/three-ws-launch-week.html+++ b/pages/three-ws-launch-week.html@@ -12,6 +12,17 @@<title>three.ws — Launch Week Recap</title><meta property="og:title" content="three.ws — Launch Week Recap"><meta property="og:description" content="Open-source 3D AI agent platform for the browser. Week one in numbers and what we shipped.">+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/three-ws-launch-week" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="three.ws — Launch Week Recap" />+ <meta name="twitter:description" content="Everything three.ws shipped during launch week — 3D avatars, agent payments, the x402 bazaar, and more." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="stylesheet" href="/fonts/fonts.css" /><style>:root {diff --git a/pages/walk-embed.html b/pages/walk-embed.htmlindex 786b8de1f..ab92effa2 100644--- a/pages/walk-embed.html+++ b/pages/walk-embed.html@@ -13,6 +13,19 @@name="description"content="Embeddable walking 3D avatar — drop into any page via iframe."/>+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/walk-embed" />+ <meta property="og:title" content="Walk Embed Generator · three.ws" />+ <meta property="og:description" content="Generate embed code for the three.ws walk avatar — drop a walking 3D avatar on any website with one HTML tag." />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Walk Embed Generator · three.ws" />+ <meta name="twitter:description" content="Generate embed code for the three.ws walk avatar — drop a walking 3D avatar on any website with one HTML tag." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><meta name="theme-color" content="#000000" /><!--diff --git a/pages/worlds.html b/pages/worlds.htmlindex 0f0348e6d..874b21684 100644--- a/pages/worlds.html+++ b/pages/worlds.html@@ -31,6 +31,13 @@/><meta property="og:url" content="https://three.ws/worlds" /><meta name="twitter:card" content="summary_large_image" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="Worlds · Coin Communities — three.ws" />+ <meta name="twitter:description" content="Explore 3D worlds built around coin communities on three.ws." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><!-- model-viewer powers the live avatar preview in the onboarding panel. --><script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js"></script>diff --git a/pages/xr.html b/pages/xr.htmlindex d012e764d..5dc60fa12 100644--- a/pages/xr.html+++ b/pages/xr.html@@ -16,6 +16,14 @@<meta property="og:title" content="XR · three.ws" /><meta property="og:description" content="Your AI avatar in augmented reality — place it on any real surface." /><meta property="og:url" content="https://three.ws/xr" />+ <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:site" content="@trythreews" />+ <meta name="twitter:title" content="XR · three.ws" />+ <meta name="twitter:description" content="See your 3D avatar in AR — full body or half body, on any real surface. WebXR, ARCore, and camera passthrough supported." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />diff --git a/public/avatars/realistic-female.glb b/public/avatars/realistic-female.glbnew file mode 100644index 000000000..da2c17f73Binary files /dev/null and b/public/avatars/realistic-female.glb differdiff --git a/public/avatars/realistic-halfbody.glb b/public/avatars/realistic-halfbody.glbnew file mode 100644index 000000000..f4e3a3c96Binary files /dev/null and b/public/avatars/realistic-halfbody.glb differdiff --git a/public/avatars/realistic-male.glb b/public/avatars/realistic-male.glbnew file mode 100644index 000000000..a51f42a4dBinary files /dev/null and b/public/avatars/realistic-male.glb differdiff --git a/public/login.html b/public/login.htmlindex 07889b7fa..9fc76fe73 100644--- a/public/login.html+++ b/public/login.html@@ -994,13 +994,41 @@},});- agent.standOn(avatarWrap, { anchor: 'bottom-center', offsetY: -50 });+ const AVATAR_ANCHOR = { anchor: 'bottom-center', offsetY: -50 };++ // Park him on his mark in the idle pose for the initial frame.+ agent.standOn(avatarWrap, AVATAR_ANCHOR);avatarWrap?.classList.remove('loading');- window.__agent = agent; /* TEMP probe */- window.addEventListener('resize', () => {- agent.standOn(avatarWrap, { anchor: 'bottom-center', offsetY: -50 });- });+ // The avatar lives on a viewport-fixed overlay canvas, so left alone he+ // would stay glued to the screen and trail the viewport down into the+ // footer as you scroll. Re-pin him to his anchor in the panel on every+ // scroll/resize so he holds his place in the login card and slides away+ // with it instead. Only his position is updated — the active clip is left+ // untouched so idle / cover-eyes / facepalm / celebrate keep playing.+ function repinAvatar() {+ if (!agent.avatar) return;+ // When the panel is collapsed (short-viewport breakpoint hides it)+ // the wrap has no layout box — leave him where he is rather than+ // snapping to the corner.+ if (!avatarWrap.offsetParent) return;+ const target = agent.worldOfElement(avatarWrap, AVATAR_ANCHOR);+ agent.avatar.position.x = target.x;+ agent.avatar.position.y = target.y;+ }++ let repinQueued = false;+ function scheduleRepin() {+ if (repinQueued) return;+ repinQueued = true;+ requestAnimationFrame(() => {+ repinQueued = false;+ repinAvatar();+ });+ }++ window.addEventListener('scroll', scheduleRepin, { passive: true });+ window.addEventListener('resize', scheduleRepin);// The avatar shields its eyes whenever the user is typing a// credential — email or password — so it never "peeks" at whatdiff --git a/public/site.webmanifest b/public/site.webmanifestindex 20eaf3635..57445e8f9 100644--- a/public/site.webmanifest+++ b/public/site.webmanifest@@ -4,8 +4,8 @@"description": "The 3D agent layer of the internet — living 3D AI agents you can embed anywhere.","start_url": "/","display": "standalone",- "background_color": "#050510",- "theme_color": "#050510",+ "background_color": "#050505",+ "theme_color": "#050505","icons": [{"src": "/favicon.svg",@@ -16,13 +16,25 @@"src": "/pwa-192x192.png","type": "image/png","sizes": "192x192",- "purpose": "any maskable"+ "purpose": "any"+ },+ {+ "src": "/pwa-192x192.png",+ "type": "image/png",+ "sizes": "192x192",+ "purpose": "maskable"+ },+ {+ "src": "/pwa-512x512.png",+ "type": "image/png",+ "sizes": "512x512",+ "purpose": "any"},{"src": "/pwa-512x512.png","type": "image/png","sizes": "512x512",- "purpose": "any maskable"+ "purpose": "maskable"}]}diff --git a/scripts/seed-firstparty-avatars.mjs b/scripts/seed-firstparty-avatars.mjsnew file mode 100644index 000000000..df638122b--- /dev/null+++ b/scripts/seed-firstparty-avatars.mjs@@ -0,0 +1,194 @@+/**+ * seed-firstparty-avatars.mjs+ * ───────────────────────────+ * Publish curated, realistic rigged avatars into the public gallery+ * (/api/avatars/public) without needing R2 write credentials.+ *+ * These GLBs ship in the repo under public/avatars/ and are served first-party+ * from https://three.ws/avatars/<file>. The avatar row stores that absolute URL+ * directly in `storage_key`; publicUrl() (api/_lib/r2.js) passes absolute URLs+ * through untouched, so model_url resolves to the first-party file instead of+ * the R2 bucket. Bucket-backed avatars (u/…) are unaffected.+ *+ * Idempotent on (owner_id, slug): re-running updates metadata in place and+ * never duplicates rows. New rows get created_at = now() so they surface at the+ * top of the newest-first gallery.+ *+ * Usage:+ * DATABASE_URL=... node scripts/seed-firstparty-avatars.mjs # apply+ * DATABASE_URL=... node scripts/seed-firstparty-avatars.mjs --dry-run # plan only+ * [email protected] # override seed owner (default [email protected])+ *+ * Required env: DATABASE_URL.+ */++import { neon } from '@neondatabase/serverless';+import { createHash } from 'node:crypto';+import { readFile, stat } from 'node:fs/promises';+import { resolve, dirname } from 'node:path';+import { fileURLToPath } from 'node:url';++const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');+const ORIGIN = 'https://three.ws';++const args = Object.fromEntries(+ process.argv.slice(2).map((a) => {+ const [k, v] = a.replace(/^--/, '').split('=');+ return [k, v ?? true];+ }),+);+const DRY_RUN = !!args['dry-run'];+const OWNER_EMAIL = args.email || '[email protected]';+const SEED_DISPLAY_NAME = 'Three.ws Showcase';++if (!process.env.DATABASE_URL) {+ console.error('Missing DATABASE_URL');+ process.exit(1);+}++const sql = neon(process.env.DATABASE_URL);++// Curated realistic / photorealistic rigged avatars shipped under public/avatars.+// `file` is relative to the repo root; the served URL is ${ORIGIN}/avatars/<basename>.+const CATALOG = [+ {+ slug: 'selfie-girl', name: 'Selfie Girl',+ file: 'public/avatars/selfie-girl.glb',+ description: 'High-detail photorealistic female avatar with an expressive, scan-style face. Rigged and ready for streams and overlays.',+ tags: ['humanoid', 'realistic', 'photorealistic', 'rigged', 'female', 'avatar'],+ license: 'three.js example (MIT)',+ },+ {+ slug: 'aria-realistic', name: 'Aria',+ file: 'public/avatars/realistic-female.glb',+ description: 'Realistic full-body feminine avatar with PBR skin, hair, and outfit. Fully rigged for animation retargeting.',+ tags: ['humanoid', 'realistic', 'photorealistic', 'rigged', 'female', 'avatar'],+ license: 'infosia/readyplayerme-Tpose (MIT)',+ },+ {+ slug: 'kai-realistic', name: 'Kai',+ file: 'public/avatars/realistic-male.glb',+ description: 'Realistic full-body masculine avatar in a clean T-pose with PBR materials. Fully rigged and retarget-ready.',+ tags: ['humanoid', 'realistic', 'photorealistic', 'rigged', 'male', 'avatar'],+ license: 'infosia/readyplayerme-Tpose (MIT)',+ },+ {+ slug: 'vox-presenter', name: 'Vox',+ file: 'public/avatars/realistic-halfbody.glb',+ description: 'Realistic half-body presenter avatar with 18 baked facial and gesture animations — built for talking-head and assistant UIs.',+ tags: ['humanoid', 'realistic', 'rigged', 'animated', 'presenter', 'avatar'],+ license: 'readyplayerme/visage (MIT)',+ },+ {+ slug: 'riven-rpm', name: 'Riven',+ file: 'public/avatars/readyplayerme.glb',+ description: 'Realistic full-body ready-player avatar with PBR skin and apparel. Rigged humanoid, retarget-ready.',+ tags: ['humanoid', 'realistic', 'rigged', 'avatar'],+ license: 'three.js example (MIT)',+ },+ {+ slug: 'michelle-dancer', name: 'Michelle',+ file: 'public/avatars/michelle.glb',+ description: 'Realistic rigged dancer with a Mixamo-compatible skeleton and baked idle/dance clips.',+ tags: ['humanoid', 'realistic', 'rigged', 'animated', 'dancer', 'avatar'],+ license: 'three.js example (CC-BY, Mixamo)',+ },+];++const owner = await ensureOwner(OWNER_EMAIL, SEED_DISPLAY_NAME);+console.log(`\nseed-firstparty-avatars — owner=${OWNER_EMAIL} (${owner.id}) dry-run=${DRY_RUN}`);+console.log(`${CATALOG.length} candidates\n`);++const results = { created: 0, updated: 0, failed: 0 };++for (const entry of CATALOG) {+ try {+ const path = resolve(REPO_ROOT, entry.file);+ const s = await stat(path);+ if (!s.isFile()) throw new Error(`not a file: ${entry.file}`);+ const bytes = await readFile(path);+ if (bytes.slice(0, 4).toString() !== 'glTF') throw new Error(`not a GLB: ${entry.file}`);+ const checksum = createHash('sha256').update(bytes).digest('base64');+ const storageKey = `${ORIGIN}/avatars/${path.split('/').pop()}`;+ const sourceMeta = JSON.stringify({ seed: 'firstparty', license: entry.license, origin: storageKey });++ // Never publish an avatar whose model 404s. If the GLB isn't deployed to+ // the origin yet, stage it as `unlisted` (kept out of the public gallery);+ // re-running after deploy promotes it to public automatically.+ const live = await urlResolves(storageKey);+ const visibility = live ? 'public' : 'unlisted';++ const existing = await sql`+ select id from avatars where owner_id = ${owner.id} and slug = ${entry.slug} and deleted_at is null limit 1+ `;++ if (DRY_RUN) {+ console.log(` ${existing.length ? '~' : '+'} ${entry.slug.padEnd(18)} ${formatBytes(bytes.byteLength)} ${visibility === 'public' ? 'PUBLIC' : 'unlisted (not live yet)'} -> ${storageKey}`);+ existing.length ? results.updated++ : results.created++;+ continue;+ }++ const [row] = await sql`+ insert into avatars (+ owner_id, slug, name, description, storage_key, size_bytes, content_type,+ source, source_meta, visibility, tags, checksum_sha256, featured+ ) values (+ ${owner.id}, ${entry.slug}, ${entry.name}, ${entry.description},+ ${storageKey}, ${bytes.byteLength}, 'model/gltf-binary',+ 'import', ${sourceMeta}::jsonb, ${visibility}, ${entry.tags}, ${checksum}, true+ )+ on conflict (owner_id, slug) do update set+ name = excluded.name,+ description = excluded.description,+ storage_key = excluded.storage_key,+ size_bytes = excluded.size_bytes,+ source_meta = excluded.source_meta,+ visibility = excluded.visibility,+ tags = excluded.tags,+ checksum_sha256 = excluded.checksum_sha256,+ featured = true,+ deleted_at = null,+ updated_at = now()+ returning (xmax = 0) as inserted+ `;+ const tag = visibility === 'public' ? 'PUBLIC' : 'unlisted (deploy then re-run to publish)';+ if (row.inserted) {+ console.log(` + ${entry.slug.padEnd(18)} ${formatBytes(bytes.byteLength)} created — ${tag}`);+ results.created++;+ } else {+ console.log(` ~ ${entry.slug.padEnd(18)} ${formatBytes(bytes.byteLength)} updated — ${tag}`);+ results.updated++;+ }+ } catch (e) {+ console.error(` ✗ ${entry.slug}: ${e.message}`);+ results.failed++;+ }+}++console.log(`\ndone — created=${results.created} updated=${results.updated} failed=${results.failed}\n`);++async function ensureOwner(email, displayName) {+ const existing = await sql`select id from users where email = ${email} limit 1`;+ if (existing.length) return existing[0];+ const [row] = await sql`+ insert into users (email, display_name, email_verified, plan)+ values (${email}, ${displayName}, true, 'pro')+ returning id+ `;+ return row;+}++async function urlResolves(url) {+ try {+ const r = await fetch(url, { method: 'HEAD', redirect: 'follow' });+ return r.ok;+ } catch {+ return false;+ }+}++function formatBytes(n) {+ if (n < 1024) return `${n}B`;+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)}KB`;+ return `${(n / 1024 / 1024).toFixed(1)}MB`;+}diff --git a/src/animation-library.js b/src/animation-library.jsindex 17f8d5129..00b30d29b 100644--- a/src/animation-library.js+++ b/src/animation-library.js@@ -29,6 +29,12 @@ const MANIFEST_URL = '/animations/manifest.json';// performances rather than twitches. Mirrors AnimationManager's bar.const MIN_RIG_BONES = 8;+// Text-to-animation job polling (POST /api/forge-motion → poll until the clip+// is ready). The motion model runs ~10–30s on a warm GPU container.+const GEN_POLL_INTERVAL_MS = 2500;+const GEN_MAX_POLL_MS = 90 * 1000;+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));+const el = (tag, attrs = {}, children = []) => {const node = document.createElement(tag);for (const [k, v] of Object.entries(attrs)) {@@ -80,6 +86,10 @@ export class AnimationLibrary {this._previewing = false;this._state = 'loading';+ // Text-to-animation job state (token-based abort like the forge panels).+ this._genToken = 0;+ this._genTimer = null;+// Resolved DOM refs (built in _renderShell).this._refs = {};}@@ -109,6 +119,9 @@ export class AnimationLibrary {/** Called by the host when the active rig changes (avatar load / mannequin). */onRigChanged() {+ this._genToken++; // a generation in flight was for the previous rig+ this._stopGenTimer();+ this._setGenBusy(false);this.stopPreview({ silent: true });this._disposeMixer();if (this._defs.length) this._evaluateRig();@@ -124,6 +137,8 @@ export class AnimationLibrary {}dispose() {+ this._genToken++; // abort any in-flight generation poll+ this._stopGenTimer();this.stopPreview({ silent: true });this._disposeMixer();this._clipCache.clear();@@ -149,6 +164,33 @@ export class AnimationLibrary {// ── Shell + states ──────────────────────────────────────────────────────_renderShell() {this.host.innerHTML = '';++ // Generate-from-text: synthesize a brand-new motion from a prompt and play+ // it on the rig exactly like a preset. The capability the preset library+ // can't offer — motion that doesn't pre-exist.+ const genInput = el('input', {+ type: 'text',+ class: 'al-gen-input',+ placeholder: 'Generate a motion — “waving confidently”',+ 'aria-label': 'Generate an animation from a text description',+ autocomplete: 'off',+ maxlength: '200',+ });+ const genBtn = el(+ 'button',+ { class: 'al-gen-btn', type: 'button', title: 'Generate a motion from your description' },+ ['✨ Generate'],+ );+ const submitGen = () => this.generateFromText(genInput.value);+ genBtn.addEventListener('click', submitGen);+ genInput.addEventListener('keydown', (e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ submitGen();+ }+ });+ const gen = el('div', { class: 'al-gen' }, [genInput, genBtn]);+const search = el('input', {type: 'search',class: 'al-search',@@ -171,10 +213,11 @@ export class AnimationLibrary {// Shell refs first; _renderTransport() merges its own sub-refs (label,// speed, export button) into this._refs, so it must run after this assign.- this._refs = { search, chips, grid, empty };+ this._refs = { gen, genInput, genBtn, search, chips, grid, empty };const transport = this._renderTransport();this._refs.transport = transport;+ this.host.appendChild(gen);this.host.appendChild(search);this.host.appendChild(chips);this.host.appendChild(empty);@@ -184,8 +227,9 @@ export class AnimationLibrary {_setState(state) {this._state = state;- const { search, chips, grid, empty, transport } = this._refs;+ const { gen, search, chips, grid, empty, transport } = this._refs;const ready = state === 'ready';+ if (gen) gen.style.display = ready ? '' : 'none';search.style.display = ready ? '' : 'none';chips.style.display = ready ? '' : 'none';grid.style.display = ready ? '' : 'none';@@ -375,6 +419,21 @@ export class AnimationLibrary {this.setStatus(`Couldn’t load “${def.label || def.name}”: ${err.message}`, 'error');return;}+ this._playClip(clip, def);+ }++ /**+ * Retarget an already-resolved canonical clip onto the current rig and play+ * it. Shared by preset preview() and text-to-animation generateFromText() —+ * one apply path, so a generated motion behaves exactly like a preset+ * (transport, speed, loop, export all work identically). Returns true on play.+ */+ _playClip(clip, def) {+ const rig = this.getRig();+ if (!rig || rig.kind === 'mannequin') {+ this.setStatus('Load a rigged avatar to apply animations.', 'error');+ return false;+ }const {clip: retargeted,@@ -388,7 +447,7 @@ export class AnimationLibrary {`“${def.label || def.name}” can’t retarget to this rig — only ${matched}/${total} tracks mapped (need ${Math.round(MIN_COVERAGE * 100)}%).`,'error',);- return;+ return false;}const mixer = this._ensureMixer(rig);@@ -417,6 +476,112 @@ export class AnimationLibrary {? ` (${matched}/${total} bones · ${dropped.length} not on this rig)`: ` (${matched}/${total} bones matched)`;this.setStatus(`Playing “${def.label || def.name}” — ${pct}% retargeted${note}.`);+ return true;+ }++ // ── Generate from text ──────────────────────────────────────────────────+ /**+ * Synthesize a brand-new motion from a prompt (workers/model-text2motion via+ * /api/forge-motion), then retarget + play it through the same path as a+ * preset. Token-based abort so a newer request supersedes an in-flight one.+ */+ async generateFromText(prompt) {+ prompt = (prompt || '').trim();+ if (prompt.length < 3) {+ this.setStatus('Describe the motion in a few words first.', 'error');+ return;+ }+ const rig = this.getRig();+ if (!rig || rig.kind === 'mannequin') {+ this.setStatus('Load a rigged avatar before generating a motion.', 'error');+ return;+ }++ const token = ++this._genToken;+ this._setGenBusy(true);+ const t0 = performance.now();+ const tick = () => {+ if (token !== this._genToken) return;+ const s = Math.floor((performance.now() - t0) / 1000);+ this.setStatus(`Generating “${prompt}” — ${s}s`, 'busy');+ };+ tick();+ this._genTimer = setInterval(tick, 1000);++ try {+ const clipJSON = await this._runMotionJob(prompt, token);+ if (token !== this._genToken || !clipJSON) return; // superseded / aborted+ this._stopGenTimer();+ const name = `gen_${Date.now().toString(36)}`;+ const clip = parseClipJSON(clipJSON, name);+ this._clipCache.set(name, clip);+ const def = {+ name,+ label: prompt.length > 28 ? `${prompt.slice(0, 27)}…` : prompt,+ icon: '✨',+ loop: true,+ generated: true,+ };+ this._playClip(clip, def);+ } catch (err) {+ if (token !== this._genToken) return;+ this._stopGenTimer();+ const msg =+ err?.kind === 'unconfigured'+ ? 'Text-to-animation isn’t enabled on this deployment yet.'+ : err?.message || 'Generation failed.';+ this.setStatus(msg, 'error');+ } finally {+ if (token === this._genToken) this._setGenBusy(false);+ }+ }++ /** Submit a motion job and poll until the clip JSON is ready. */+ async _runMotionJob(prompt, token) {+ const submit = await fetch('/api/forge-motion', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ prompt }),+ });+ const sub = await submit.json().catch(() => ({}));+ if (submit.status === 503 || sub.error === 'unconfigured') {+ throw Object.assign(new Error(sub.message || 'unconfigured'), { kind: 'unconfigured' });+ }+ if (submit.status === 429) throw new Error('The motion generator is busy. Try again shortly.');+ if (!submit.ok || !sub.job_id) throw new Error(sub.message || `Generator returned ${submit.status}.`);++ const deadline = performance.now() + GEN_MAX_POLL_MS;+ while (token === this._genToken && performance.now() < deadline) {+ await sleep(GEN_POLL_INTERVAL_MS);+ if (token !== this._genToken) return null;+ const res = await fetch(`/api/forge-motion?job=${encodeURIComponent(sub.job_id)}`);+ const data = await res.json().catch(() => ({}));+ if (data.status === 'done' && data.clip_url) {+ const cr = await fetch(data.clip_url);+ if (!cr.ok) throw new Error(`Couldn’t fetch the generated clip (HTTP ${cr.status}).`);+ return cr.json();+ }+ if (data.status === 'failed') throw new Error(data.error || 'Generation failed.');+ }+ if (token !== this._genToken) return null;+ throw new Error('Generation timed out. Try a shorter prompt.');+ }++ _stopGenTimer() {+ if (this._genTimer) {+ clearInterval(this._genTimer);+ this._genTimer = null;+ }+ }++ _setGenBusy(busy) {+ const { gen, genInput, genBtn } = this._refs;+ if (genInput) genInput.disabled = busy;+ if (genBtn) {+ genBtn.disabled = busy;+ genBtn.textContent = busy ? '✨ Generating…' : '✨ Generate';+ }+ if (gen) gen.dataset.busy = busy ? 'true' : 'false';}stopPreview({ silent = false } = {}) {