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
chore: sync workspace — launches page, three-intel kiosk, zauth reposcan, agent-wallet x402 bridge, world deploy patches
nirholase95686bc7f44
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9774de287..5fd7eaa70 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,12 +4,22 @@Public history for [three.ws](https://three.ws), newest first. New pages come from `added` dates in data/pages.json; everything else is curated in data/changelog.json. Also available as [JSON](https://three.ws/changelog.json) and [RSS](https://three.ws/changelog.xml), live at [three.ws/changelog](https://three.ws/changelog).+## 2026-06-12++- **Agent Launches** (`/launches`) — Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.+- **Cosmetics shop purchases now work** — Buying a premium skin or emote in the /play Cosmetics shop actually opens the payment flow now. Previously the Buy buttons failed because the in-world shop never loaded the payment widget — now it loads on demand the moment you tap Buy, the USDC checkout opens with the item priced by rarity, and a sale made inside a coin's world still credits that coin's creator. Pay once on Base or Solana and the item is yours forever. (`/play`) `[fix]`+- **New /launches page: every agent-launched coin in one live feed** — There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches. (`/launches`) `[feature]`+- **Pay a real x402 oracle inside the $THREE town** — The $THREE town in /play now has an Intel Kiosk by the plaza: walk up, press E, and buy live $THREE market intel — price, 24 h change, market cap, and a bullish/bearish/neutral signal — for $0.01 USDC paid from your own wallet over x402, settled on-chain on Solana. The oracle behind it (/api/x402/three-intel) is also listed in the bazaar, so any agent can buy the same feed. The Agent Wallet demo is now linked from the /play menu too. (`/play`) `[feature]`+- **Reliability sweep: faster galleries, working voices, sturdier pages** — A pass over every error in the production logs. Avatar thumbnails and 3D models now load through three.ws itself instead of a rate-limited storage domain, so gallery pages stop dropping images under load. Text-to-speech voices are back (the upstream voice service had changed its protocol). Leaving a world on /play no longer hits a crash that could leave the session connected in the background. The homepage 3D demos politely step aside on devices without WebGL instead of breaking, payment demo requests get more time to settle on-chain, and the $THREE market stats failover stops hammering an exhausted data provider. `[fix, improvement, infra]`+- **zauth's security agent moves into the $THREE town** — A new character stands in the $THREE town plaza on /play: the security agent from zauth, the x402 trust company. Walk up and it calls zauth's live paid API on the spot, quoting the real on-chain price for a RepoScan — name any GitHub repository and for $0.05 USDC, paid from your own wallet straight to zauth on Solana or Base, it scans the code for provenance, contributor verification, and vulnerabilities, then hands back a 0–100 trust score with a full written report. Scans keep running while you play; the agent calls out when your report is ready. (`/play`) `[feature]`+## 2026-06-11-- **Agent Wallet (MetaMask × x402)** (`/play/agent-wallet`) — Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.+- **Agent Wallet (x402 on Solana)** (`/play/agent-wallet`) — Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.- **Status** (`/status`) — Live operational status and 90-day uptime history for the platform, API, and x402 surfaces — probed every 5 minutes.- **A safety net on open, sign-in-free chat — without blocking real conversations** — Anyone can chat with our agents without signing in, and that openness now has a quiet safety net. Messages from anonymous visitors pass through a fast content check before they reach the model, so genuinely harmful asks get a short, friendly redirect instead of an answer. It runs on a free safety model and is built to stay out of the way: if the check is ever slow or unavailable, your message goes straight through rather than being held up — the filter can never take chat down. Signed-in conversations are unaffected, and there's an instant off switch if it ever needs to step aside. `[feature, security]`- **Accurate uptime on the x402 Provider Hub** — The payment directory was counting every unpaid x402 discovery request (the protocol's standard 402 challenge) as a failed call, dragging three.ws endpoint success rates down even when every endpoint was healthy. Telemetry now reports only real payment attempts, so the published uptime reflects actual service health. `[fix, infra]`+- **Agent Wallet demo now settles on Solana** — The Agent Wallet playground (/play/agent-wallet) now pays in USDC on Solana mainnet instead of Base. Your avatar's agent wallet partially signs an SPL USDC transfer, the x402 facilitator co-signs as fee payer, and the settlement lands on Solana — with a Solscan link on the receipt. Same real micropayment, now on the chain three.ws lives on. (`/play/agent-wallet`) `[improvement]`- **Agents dashboard renders reliably again** — Fixed a crash that could blank out the agent list on your dashboard while it built each agent's card. The page now renders every agent — on-chain, Pump.fun, and off-chain — without errors, including the Deploy onchain and registry links. (`/dashboard/agents`) `[fix]`- **Avatar pages back online after image-engine outage** — Fetching an individual avatar was failing with a server error, which also broke the walking avatar on the home page. The image-processing engine the avatar dress-up baker relies on failed to load in production and took the whole endpoint down with it. Avatar lookups now load independently of the baker, and the missing image libraries ship with the deployment, so avatar pages and the home hero are back. `[fix, infra]`- **Avatar preview images load reliably** — Fixed a bug where some community avatars — including the pinned home-town cast — showed a broken preview image in the /play lobby and gallery instead of their portrait. The shareable social-card image for those avatars now generates and serves correctly too, so links posted to X and Discord render a proper preview. (`/play`) `[fix]`diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex 27e9d0e75..00f6020a1 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -199,6 +199,10 @@ export const limits = {cohortsIp: (ip) => getLimiter('cohorts:ip', { limit: 45, window: '5 m' }).limit(ip),oauthRegisterIp: (ip) =>getLimiter('oauth:register:ip', { limit: 10, window: '1 h' }).limit(ip),+ // zauth RepoScan pass-through (api/zauth-reposcan). Each POST forwards to+ // zauth's paid x402 endpoint and each GET polls a scan session; cap per IP+ // so one caller can't use the proxy as a relay to hammer their upstream.+ zauthScanIp: (ip) => getLimiter('zauthscan:ip', { limit: 30, window: '1 m' }).limit(ip),// aixbt intelligence bridge (api/aixbt/*). Each call may fall through to the// upstream aixbt REST API, which is rate-limited per key — cap per IP so one// caller can't drain the shared key's budget. Reads are cached, so this isdiff --git a/api/openapi-json.js b/api/openapi-json.jsindex 347985c97..a9ea1c9cd 100644--- a/api/openapi-json.js+++ b/api/openapi-json.js@@ -643,6 +643,25 @@ export default wrap(async (req, res) => {},},},+ '/api/x402/three-intel': {+ get: {+ operationId: 'x402_three_intel',+ summary: 'Paid: Live $THREE market intel from the Town Oracle',+ description:+ 'Pay $0.01 USDC for live $THREE market intel: price, 24 h change, market cap, ' ++ 'liquidity, 24 h volume, and a bullish / bearish / neutral signal with a ' ++ 'two-sentence rationale. Powered by live DexScreener data — the same oracle ' ++ 'behind the paid intel kiosk in the $THREE town on three.ws/play.',+ responses: {+ 200: { description: '$THREE market intel JSON' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': {+ price: { mode: 'fixed', currency: 'USD', amount: '0.01' },+ protocols: X402_PROTOCOLS,+ },+ },+ },'/api/x402/dance-tip': {get: {operationId: 'x402_dance_tip',diff --git a/api/pump/[action].js b/api/pump/[action].jsindex 1e7ed5683..9366f7135 100644--- a/api/pump/[action].js+++ b/api/pump/[action].js@@ -19,6 +19,7 @@// payments-list -> handlePaymentsList// portfolio -> handlePortfolio// by-agent -> handleByAgent+// launches -> handleLaunches (public cross-agent launch feed)// quote -> handleQuote// governance-prep -> handleGovernancePrep// withdraw-prep -> handleWithdrawPrep@@ -148,6 +149,8 @@ const wrapped = wrap(async (req, res) => {return handlePortfolio(req, res);case 'by-agent':return handleByAgent(req, res);+ case 'launches':+ return handleLaunches(req, res);case 'quote':return handleQuote(req, res);case 'governance-prep':@@ -2297,6 +2300,105 @@ async function handlePortfolio(req, res) {});}+// ── launches ─────────────────────────────────────────────────────────────────+// Public, paginated feed of every coin launched through three.ws, joined with+// the agent that launched it. Powers the /launches page and the agent-detail+// "launched coins" card. Anonymous-readable; avatar thumbnails respect the+// same public/unlisted visibility gate as api/agents.js.++const LAUNCHES_CACHE = new Map(); // cacheKey → { at, body }+const LAUNCHES_TTL_MS = 15_000;++async function handleLaunches(req, res) {+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;+ if (!method(req, res, ['GET'])) return;++ const rl = await limits.mcpIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const url = new URL(req.url, `http://${req.headers.host}`);+ const limit = Math.min(Math.max(1, Number(url.searchParams.get('limit')) || 24), 100);+ const offset = Math.max(0, Number(url.searchParams.get('offset')) || 0);+ const network = url.searchParams.get('network') === 'devnet' ? 'devnet' : 'mainnet';+ const agentId = url.searchParams.get('agent_id');+ if (agentId && !isUuid(agentId))+ return error(res, 400, 'validation_error', 'agent_id must be a uuid');++ const cacheKey = `${network}:${agentId || ''}:${offset}:${limit}`;+ const now = Date.now();+ const hit = LAUNCHES_CACHE.get(cacheKey);+ if (hit && now - hit.at < LAUNCHES_TTL_MS) {+ res.setHeader('cache-control', 'public, max-age=15');+ return json(res, 200, hit.body);+ }++ // Over-fetch by one row to compute has_more without a count(*) round trip.+ const rows = agentId+ ? await sql`+ select pam.mint, pam.network, pam.name, pam.symbol, pam.buyback_bps,+ pam.metadata_uri, pam.quote_mint, pam.created_at,+ ai.id as agent_id, ai.name as agent_name,+ a.thumbnail_key as avatar_thumbnail_key,+ a.visibility as avatar_visibility+ from pump_agent_mints pam+ left join agent_identities ai on ai.id = pam.agent_id and ai.deleted_at is null+ left join avatars a on a.id = ai.avatar_id and a.deleted_at is null+ where pam.network=${network} and pam.agent_id=${agentId}+ order by pam.created_at desc+ limit ${limit + 1} offset ${offset}+ `+ : await sql`+ select pam.mint, pam.network, pam.name, pam.symbol, pam.buyback_bps,+ pam.metadata_uri, pam.quote_mint, pam.created_at,+ ai.id as agent_id, ai.name as agent_name,+ a.thumbnail_key as avatar_thumbnail_key,+ a.visibility as avatar_visibility+ from pump_agent_mints pam+ left join agent_identities ai on ai.id = pam.agent_id and ai.deleted_at is null+ left join avatars a on a.id = ai.avatar_id and a.deleted_at is null+ where pam.network=${network}+ order by pam.created_at desc+ limit ${limit + 1} offset ${offset}+ `;++ const hasMore = rows.length > limit;+ const launches = rows.slice(0, limit).map((r) => {+ const avatarPublic =+ r.avatar_visibility === 'public' || r.avatar_visibility === 'unlisted';+ return {+ mint: r.mint,+ network: r.network,+ name: r.name,+ symbol: r.symbol,+ buyback_bps: r.buyback_bps,+ metadata_uri: normalizeGatewayURL(r.metadata_uri) || r.metadata_uri,+ quote_mint: r.quote_mint,+ created_at: r.created_at,+ agent: r.agent_id+ ? {+ id: r.agent_id,+ name: r.agent_name,+ url: `/agents/${r.agent_id}`,+ avatar_thumbnail_url:+ r.avatar_thumbnail_key && avatarPublic+ ? r2PublicUrl(r.avatar_thumbnail_key)+ : null,+ }+ : null,+ };+ });++ const body = { data: { launches, has_more: hasMore, offset, limit, network } };+ LAUNCHES_CACHE.set(cacheKey, { at: now, body });+ // Keep the per-instance cache bounded — feed pages only ever walk forward.+ if (LAUNCHES_CACHE.size > 200) {+ const oldest = LAUNCHES_CACHE.keys().next().value;+ LAUNCHES_CACHE.delete(oldest);+ }+ res.setHeader('cache-control', 'public, max-age=15');+ return json(res, 200, body);+}+// ── by-agent ───────────────────────────────────────────────────────────────async function handleByAgent(req, res) {@@ -2314,18 +2416,21 @@ async function handleByAgent(req, res) {if (agentId && !isUuid(agentId)) return error(res, 404, 'not_found', 'agent not found');if (avatarId && !isUuid(avatarId)) return error(res, 404, 'not_found', 'agent not found');- let row;+ // All coins this agent has launched, newest first. The newest one stays the+ // canonical `data` payload (stats, burns) for existing consumers; the full+ // list ships alongside as `coins` for the agent-page launch history.+ let rows;if (agentId) {- [row] = await sql`+ rows = await sql`select pam.id, pam.mint, pam.network, pam.name, pam.symbol,pam.buyback_bps, pam.agent_authority, pam.metadata_uri,pam.sharing_config, pam.created_atfrom pump_agent_mints pamwhere pam.agent_id=${agentId}- order by pam.created_at desc limit 1+ order by pam.created_at desc limit 50`;} else {- [row] = await sql`+ rows = await sql`select pam.id, pam.mint, pam.network, pam.name, pam.symbol,pam.buyback_bps, pam.agent_authority, pam.metadata_uri,pam.sharing_config, pam.created_at@@ -2333,10 +2438,19 @@ async function handleByAgent(req, res) {join agent_identities aion ai.id = pam.agent_id and ai.deleted_at is nullwhere ai.avatar_id=${avatarId}- order by pam.created_at desc limit 1+ order by pam.created_at desc limit 50`;}- if (!row) return json(res, 200, { data: null });+ const [row] = rows;+ if (!row) return json(res, 200, { data: null, coins: [] });+ const coins = rows.map((r) => ({+ mint: r.mint,+ network: r.network,+ name: r.name,+ symbol: r.symbol,+ buyback_bps: r.buyback_bps,+ created_at: r.created_at,+ }));const [stats] = await sql`select@@ -2372,6 +2486,7 @@ async function handleByAgent(req, res) {burns: burnRow || { runs: 0, total_burned: '0' },burns_feed: burnsFeed,},+ coins,});}diff --git a/api/wk.js b/api/wk.jsindex 72ba4091a..d529d0799 100644--- a/api/wk.js+++ b/api/wk.js@@ -629,6 +629,10 @@ async function handleX402Discovery(req, res) {serviceName: 'three.ws Crypto Intel',tags: ['crypto', 'market', 'signal', 'agent-exchange', 'solana'],}),+ threeIntel: withService({+ serviceName: '$THREE Town Oracle',+ tags: ['three', 'market', 'signal', 'play', 'solana'],+ }),avatarShop: withService({serviceName: 'three.ws Avatar Shop',tags: ['3d', 'avatar', 'cosmetic', 'shop', 'wearable'],@@ -1411,6 +1415,28 @@ async function handleX402Discovery(req, res) {}),};})(),+ (() => {+ const url = `${origin}/api/x402/three-intel`;+ const accepts = acceptsForPrice('10000', url);+ return {+ path: '/api/x402/three-intel',+ url,+ method: 'GET',+ description:+ '$THREE Town Oracle — pay $0.01 USDC per call for live $THREE market intel: price, 24 h change, market cap, liquidity, 24 h volume, and a bullish / bearish / neutral signal with a two-sentence rationale. Powered by live DexScreener data. This is the oracle behind the paid intel kiosk in the $THREE town on three.ws/play.',+ mimeType: 'application/json',+ serviceName: routeMeta.threeIntel.serviceName,+ tags: routeMeta.threeIntel.tags,+ iconUrl: routeMeta.threeIntel.iconUrl,+ accepts,+ extensions: extensionsForAccepts(accepts, {+ method: 'GET',+ discoverable: true,+ input: {},+ inputSchema: { type: 'object', properties: {} },+ }),+ };+ })(),(() => {// Avatar Shop pricing is per-rarity ($0.25 common → $3.00// legendary). The catalog advertises the rare tier ('500000' =diff --git a/api/x402/three-intel.js b/api/x402/three-intel.jsnew file mode 100644index 000000000..e632d6217--- /dev/null+++ b/api/x402/three-intel.js@@ -0,0 +1,187 @@+// GET /api/x402/three-intel+//+// $THREE Town Oracle — $0.01 USDC per call on Solana or Base.+//+// The paid intel kiosk in the $THREE town (/play) buys from this endpoint:+// live $THREE market intel — price, 24 h change, market cap, liquidity,+// volume, and a bullish/bearish/neutral signal with a short rationale.+// Agents can call it directly too (it's cataloged in the bazaar), so the+// same oracle the town kiosk sells from is buyable by any x402 client.+//+// Response: { mint, symbol, price_usd, change_24h, market_cap_usd,+// liquidity_usd, volume_24h_usd, signal, headline, rationale,+// confidence, ts }+//+// Data is live: DexScreener public API (no key required). No mock path.++import { paidEndpoint } from '../_lib/x402-paid-endpoint.js';+import { buildBazaarSchema } from '../_lib/x402-spec.js';+import { installAccessControl } from '../_lib/x402/access-control.js';+import { withService } from '../_lib/x402/bazaar-helpers.js';+import { priceFor } from '../_lib/x402-prices.js';+import { env } from '../_lib/env.js';++const ROUTE = '/api/x402/three-intel';++const DESCRIPTION =+ '$THREE Town Oracle — pay $0.01 USDC per call for live $THREE market intel: ' ++ 'price, 24 h change, market cap, liquidity, 24 h volume, and a ' ++ 'bullish / bearish / neutral signal with a two-sentence rationale. ' ++ 'Powered by live DexScreener data. This is the oracle behind the paid ' ++ 'intel kiosk in the $THREE town on three.ws/play.';++const INPUT_SCHEMA = {+ $schema: 'https://json-schema.org/draft/2020-12/schema',+ type: 'object',+ properties: {},+};++const OUTPUT_SCHEMA = {+ $schema: 'https://json-schema.org/draft/2020-12/schema',+ type: 'object',+ required: ['mint', 'symbol', 'signal', 'headline', 'rationale', 'confidence', 'ts'],+ properties: {+ mint: { type: 'string' },+ symbol: { type: 'string' },+ price_usd: { type: ['number', 'null'] },+ change_24h: { type: ['number', 'null'] },+ market_cap_usd: { type: ['number', 'null'] },+ liquidity_usd: { type: ['number', 'null'] },+ volume_24h_usd: { type: ['number', 'null'] },+ signal: { type: 'string', enum: ['bullish', 'bearish', 'neutral'] },+ headline: { type: 'string' },+ rationale: { type: 'string' },+ confidence: { type: 'number', minimum: 0, maximum: 1 },+ ts: { type: 'string', format: 'date-time' },+ },+};++export const BAZAAR = {+ description: DESCRIPTION,+ useCases: ['$THREE market signal', 'in-world paid oracle', 'token intel'],+ input: { type: 'query', example: {}, schema: INPUT_SCHEMA },+ output: {+ type: 'json',+ example: {+ mint: 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump',+ symbol: 'THREE',+ price_usd: 0.003685, change_24h: 12.4, market_cap_usd: 3685000,+ liquidity_usd: 412000, volume_24h_usd: 1268079,+ signal: 'bullish',+ headline: 'THREE climbs +12.40% — moderate upside',+ rationale: 'THREE gained +12.40% over 24 h with price at $0.003685. Volume is healthy against liquidity; momentum favors the upside.',+ confidence: 0.86, ts: '2026-06-12T10:00:00Z',+ },+ },+ schema: buildBazaarSchema({+ method: 'GET',+ queryParamsSchema: INPUT_SCHEMA,+ outputSchema: OUTPUT_SCHEMA,+ }),+};++export async function fetchThreeMarket(mint) {+ const r = await fetch(`https://api.dexscreener.com/latest/dex/tokens/${mint}`, {+ headers: { Accept: 'application/json' },+ signal: AbortSignal.timeout(6000),+ });+ if (!r.ok) return null;+ const data = await r.json();+ const pairs = (data.pairs || []).filter((p) => p.chainId === 'solana');+ if (!pairs.length) return null;+ pairs.sort((a, b) => (b.liquidity?.usd ?? 0) - (a.liquidity?.usd ?? 0));+ const p = pairs[0];+ return {+ price_usd: parseFloat(p.priceUsd) || null,+ change_24h: p.priceChange?.h24 ?? null,+ market_cap_usd: p.marketCap ?? p.fdv ?? null,+ liquidity_usd: p.liquidity?.usd ?? null,+ volume_24h_usd: p.volume?.h24 ?? null,+ };+}++export function buildSignal({ price_usd, change_24h, volume_24h_usd, liquidity_usd }) {+ const fmt = (n) => (n >= 100 ? n.toFixed(2) : n >= 1 ? n.toFixed(3) : n.toFixed(6));+ const pStr = price_usd != null ? `$${fmt(price_usd)}` : '?';+ const sign = change_24h >= 0 ? '+' : '';+ const cStr = `${sign}${change_24h.toFixed(2)}%`;+ // Volume/liquidity turnover colors the rationale: high turnover = conviction.+ const turnover =+ volume_24h_usd != null && liquidity_usd ? volume_24h_usd / liquidity_usd : null;+ const flowLine =+ turnover == null ? 'Flow data is thin; weigh the move accordingly.'+ : turnover > 3 ? 'Volume is running hot against liquidity — high conviction behind the move.'+ : turnover > 1 ? 'Volume is healthy against liquidity; participation is real.'+ : 'Volume is light against liquidity; the move has limited backing so far.';+ let signal, headline;+ if (change_24h > 5) {+ signal = 'bullish';+ headline = `THREE surges ${cStr} in 24 h — strong momentum`;+ } else if (change_24h > 1) {+ signal = 'bullish';+ headline = `THREE climbs ${cStr} — moderate upside`;+ } else if (change_24h < -5) {+ signal = 'bearish';+ headline = `THREE drops ${Math.abs(change_24h).toFixed(2)}% — sellers in control`;+ } else if (change_24h < -1) {+ signal = 'bearish';+ headline = `THREE slips ${cStr} — mild weakness`;+ } else {+ signal = 'neutral';+ headline = `THREE flat at ${cStr} — consolidating at ${pStr}`;+ }+ const rationale = `THREE is ${change_24h >= 0 ? 'up' : 'down'} ${cStr} over 24 h, trading at ${pStr}. ${flowLine}`;+ const confidence = Math.min(0.93, 0.64 + Math.min(Math.abs(change_24h) / 20, 0.29));+ return { signal, headline, rationale, confidence };+}++export default paidEndpoint({+ route: ROUTE,+ method: 'GET',+ priceAtomics: priceFor('three-intel', '10000'), // $0.01 USDC+ networks: ['solana', 'base'],+ description: DESCRIPTION,+ bazaar: BAZAAR,+ service: withService({+ serviceName: '$THREE Town Oracle',+ tags: ['three', 'market', 'signal', 'play', 'solana'],+ }),+ accessControl: installAccessControl({ requiredScope: 'x402:bypass' }),++ async handler() {+ const mint = env.THREE_TOKEN_MINT;+ let live = null;+ try { live = await fetchThreeMarket(mint); } catch { /* upstream hiccup */ }++ if (!live || live.change_24h == null) {+ return {+ mint,+ symbol: 'THREE',+ price_usd: live?.price_usd ?? null,+ change_24h: null,+ market_cap_usd: live?.market_cap_usd ?? null,+ liquidity_usd: live?.liquidity_usd ?? null,+ volume_24h_usd: live?.volume_24h_usd ?? null,+ signal: 'neutral',+ headline: 'THREE — live data unavailable, signal estimated',+ rationale:+ 'DexScreener rate-limited this request. ' ++ 'Signal is estimated from trend memory; retry in 60 s for a live quote.',+ confidence: 0.4,+ ts: new Date().toISOString(),+ };+ }++ const { signal, headline, rationale, confidence } = buildSignal(live);+ return {+ mint,+ symbol: 'THREE',+ ...live,+ signal,+ headline,+ rationale,+ confidence,+ ts: new Date().toISOString(),+ };+ },+});diff --git a/api/zauth-reposcan.js b/api/zauth-reposcan.jsnew file mode 100644index 000000000..13473fce5--- /dev/null+++ b/api/zauth-reposcan.js@@ -0,0 +1,132 @@+// /api/zauth-reposcan — same-origin pass-through to zauth's paid RepoScan+// x402 endpoint (https://api.zauth.inc/x402/reposcan, $0.05 USDC on Base or+// Solana).+//+// The zauth security agent in the $THREE town (/play) sells repo scans from+// this route. The browser cannot pay zauth directly: their CORS policy does+// not allow any payment request header and does not expose the+// payment-required response header, so both legs of the x402 handshake die+// cross-origin. This route forwards the request and re-emits the response so+// window.X402.pay can run the full flow same-origin. The player signs with+// their OWN wallet, the USDC transfer goes straight to zauth's payTo+// address, and zauth's facilitator settles it; no platform key touches the+// payment and no funds pass through this server.+//+// Wire-format notes (verified with a real settled payment, 2026-06-12):+// • zauth reads the payment envelope from the `payment-signature` header —+// an envelope sent as X-PAYMENT is ignored and re-402'd. Our modal sends+// X-PAYMENT, so the proxy translates the header name.+// • zauth's verifier wants the envelope shaped {x402Version, payload,+// resource, accepted} with resource.url = THEIR endpoint URL. The modal+// builds resource.url from the same-origin route it called, so the proxy+// normalizes the envelope and rewrites resource.url before forwarding.+// • Upstream's input field is `repoUrl` (full GitHub URL), validated only+// AFTER the payment middleware. The public surface here takes+// { repo: "owner/repo" } and expands it, so a malformed repo can never+// burn a payment on a post-settle 400.+//+// POST /api/zauth-reposcan { repo: "owner/repo" } (+ X-PAYMENT)+// → POST https://api.zauth.inc/x402/reposcan { repoUrl } (+ payment-signature)+// paid 200 → { status: "scanning", scanId, sessionToken }+// GET /api/zauth-reposcan?session=… free progress poll for a paid scan+// → GET https://api.zauth.inc/x402/reposcan/:session+// 200 → { status: "scanning" } … { status: "completed", zauthScore, analysisMarkdown }++import { cors, error, method, rateLimited, readJson, wrap } from './_lib/http.js';+import { clientIp, limits } from './_lib/rate-limit.js';++const UPSTREAM = 'https://api.zauth.inc/x402/reposcan';++// owner/repo — GitHub's own constraint set, tight enough to keep the proxy+// from forwarding arbitrary strings upstream.+export const REPO_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;+export const SESSION_RE = /^[A-Za-z0-9._-]{8,1024}$/;++// Response headers the x402 modal needs to read: the 402 challenge and (if+// upstream ever adds one) the settlement receipt. Same-origin, so no+// expose-headers dance is required.+const PASS_HEADERS = ['payment-required', 'x-payment-response', 'content-type'];++function passThrough(res, upstream, bodyText) {+ res.statusCode = upstream.status;+ for (const name of PASS_HEADERS) {+ const value = upstream.headers.get(name);+ if (value) res.setHeader(name, value);+ }+ if (!upstream.headers.get('content-type')) {+ res.setHeader('content-type', 'application/json; charset=utf-8');+ }+ res.end(bodyText);+}++// Normalize a payment envelope from our modal into the shape zauth's+// facilitator verifies: official-client field set only, resource.url+// rewritten to the upstream URL. The envelope is metadata around the signed+// transfer — the signature itself (Solana tx / EIP-3009 typed data) is+// untouched, so this cannot redirect funds, only make the wrapper legible.+export function normalizeEnvelope(headerValue) {+ let envelope;+ try {+ envelope = JSON.parse(Buffer.from(headerValue, 'base64').toString('utf8'));+ } catch {+ return headerValue; // not base64-JSON — forward untouched+ }+ if (!envelope || typeof envelope !== 'object' || !envelope.payload) return headerValue;+ const normalized = {+ x402Version: envelope.x402Version || 2,+ payload: envelope.payload,+ resource: {+ url: UPSTREAM,+ mimeType: envelope.resource?.mimeType || 'application/json',+ },+ ...(envelope.accepted ? { accepted: envelope.accepted } : {}),+ };+ return Buffer.from(JSON.stringify(normalized)).toString('base64');+}++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;+ if (!method(req, res, ['GET', 'POST'])) return;++ const rl = await limits.zauthScanIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ if (req.method === 'GET') {+ const url = new URL(req.url, 'http://x');+ const session = url.searchParams.get('session') || '';+ if (!SESSION_RE.test(session)) {+ return error(res, 400, 'invalid_session', 'session must be a token from a paid scan');+ }+ const upstream = await fetch(`${UPSTREAM}/${encodeURIComponent(session)}`, {+ headers: { accept: 'application/json' },+ signal: AbortSignal.timeout(25_000),+ });+ return passThrough(res, upstream, await upstream.text());+ }++ const body = await readJson(req);+ const repo = typeof body?.repo === 'string' ? body.repo.trim() : '';+ if (!REPO_RE.test(repo)) {+ return error(res, 400, 'invalid_repo', 'repo must look like "owner/repo"');+ }++ const headers = { 'content-type': 'application/json', accept: 'application/json' };+ const payment = req.headers['x-payment'] || req.headers['payment-signature'];+ if (typeof payment === 'string' && payment) {+ headers['payment-signature'] = normalizeEnvelope(payment);+ }+ // zauth offers free access to ZAUTH holders via a sign-in-with-x wallet+ // signature (advertised in their 402 challenge); pass that leg through too.+ const siwx = req.headers['sign-in-with-x'];+ if (typeof siwx === 'string' && siwx) headers['sign-in-with-x'] = siwx;++ const upstream = await fetch(UPSTREAM, {+ method: 'POST',+ headers,+ body: JSON.stringify({ repoUrl: `https://github.com/${repo}` }),+ // Paid calls block on on-chain settlement; give them most of the+ // function budget. Unpaid probes return the 402 immediately.+ signal: AbortSignal.timeout(payment ? 55_000 : 15_000),+ });+ return passThrough(res, upstream, await upstream.text());+});diff --git a/data/changelog.json b/data/changelog.jsonindex 4f4f089b7..71abd83f3 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,42 @@{"$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-12",+ "title": "Cosmetics shop purchases now work",+ "summary": "Buying a premium skin or emote in the /play Cosmetics shop actually opens the payment flow now. Previously the Buy buttons failed because the in-world shop never loaded the payment widget — now it loads on demand the moment you tap Buy, the USDC checkout opens with the item priced by rarity, and a sale made inside a coin's world still credits that coin's creator. Pay once on Base or Solana and the item is yours forever.",+ "tags": [+ "fix"+ ],+ "link": "/play"+ },+ {+ "date": "2026-06-12",+ "title": "New /launches page: every agent-launched coin in one live feed",+ "summary": "There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches.",+ "tags": [+ "feature"+ ],+ "link": "/launches"+ },+ {+ "date": "2026-06-12",+ "title": "Pay a real x402 oracle inside the $THREE town",+ "summary": "The $THREE town in /play now has an Intel Kiosk by the plaza: walk up, press E, and buy live $THREE market intel — price, 24 h change, market cap, and a bullish/bearish/neutral signal — for $0.01 USDC paid from your own wallet over x402, settled on-chain on Solana. The oracle behind it (/api/x402/three-intel) is also listed in the bazaar, so any agent can buy the same feed. The Agent Wallet demo is now linked from the /play menu too.",+ "tags": [+ "feature"+ ],+ "link": "/play"+ },+ {+ "date": "2026-06-11",+ "title": "Agent Wallet demo now settles on Solana",+ "summary": "The Agent Wallet playground (/play/agent-wallet) now pays in USDC on Solana mainnet instead of Base. Your avatar's agent wallet partially signs an SPL USDC transfer, the x402 facilitator co-signs as fee payer, and the settlement lands on Solana — with a Solscan link on the receipt. Same real micropayment, now on the chain three.ws lives on.",+ "tags": [+ "improvement"+ ],+ "link": "/play/agent-wallet"+ },{"date": "2026-06-11","title": "Forge and Parts Studio headers display correctly again",@@ -1015,6 +1051,15 @@"security"]},+ {+ "date": "2026-06-12",+ "title": "zauth's security agent moves into the $THREE town",+ "summary": "A new character stands in the $THREE town plaza on /play: the security agent from zauth, the x402 trust company. Walk up and it calls zauth's live paid API on the spot, quoting the real on-chain price for a RepoScan — name any GitHub repository and for $0.05 USDC, paid from your own wallet straight to zauth on Solana or Base, it scans the code for provenance, contributor verification, and vulnerabilities, then hands back a 0–100 trust score with a full written report. Scans keep running while you play; the agent calls out when your report is ready.",+ "tags": [+ "feature"+ ],+ "link": "/play"+ },{"date": "2026-06-12","title": "Reliability sweep: faster galleries, working voices, sturdier pages",diff --git a/data/pages.json b/data/pages.jsonindex 40be09dbd..f430fc6d8 100644--- a/data/pages.json+++ b/data/pages.json@@ -342,6 +342,14 @@"title": "Crypto","description": "On-chain features: pay-per-call, token launches, vanity wallets.","pages": [+ {+ "path": "/launches",+ "title": "Agent Launches",+ "description": "Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.",+ "priority": 0.8,+ "changefreq": "daily",+ "added": "2026-06-12"+ },{"path": "/pay","title": "Pay (x402)",@@ -351,8 +359,8 @@},{"path": "/play/agent-wallet",- "title": "Agent Wallet (MetaMask × x402)",- "description": "Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.",+ "title": "Agent Wallet (x402 on Solana)",+ "description": "Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.","priority": 0.7,"changefreq": "monthly","added": "2026-06-11"diff --git a/deploy/world/Dockerfile b/deploy/world/Dockerfileindex 9eecac615..681bb3549 100644--- a/deploy/world/Dockerfile+++ b/deploy/world/Dockerfile@@ -6,10 +6,18 @@FROM node:22-alpine AS sourceWORKDIR /appRUN apk add --no-cache git python3 make g++-# Pin to a specific commit hash so upstream changes never surprise a redeploy.-# Update this hash deliberately when pulling in upstream improvements.-ARG HYPERFY_REF=main-RUN git clone --depth 1 --branch ${HYPERFY_REF} https://github.com/hyperfy-xyz/hyperfy.git .+# Pinned upstream commit so a rebuild never silently pulls new Hyperfy code.+# Update this hash deliberately when pulling in upstream improvements, and+# re-verify the patches in patches/ still apply.+ARG HYPERFY_REF=5d20037435a1d86cda088382bb12737e9f18d5f6+RUN git init -q . \+ && git remote add origin https://github.com/hyperfy-xyz/hyperfy.git \+ && git fetch --depth 1 origin ${HYPERFY_REF} \+ && git checkout -q FETCH_HEAD+# Server-side hardening: enforce PUBLIC_MAX_UPLOAD_SIZE on /api/upload itself+# (upstream hard-codes a 200MB multipart cap on an unauthenticated route).+COPY patches/ /tmp/patches/+RUN git apply --verbose /tmp/patches/*.patchFROM source AS builderRUN npm cidiff --git a/deploy/world/cloudrun.yaml b/deploy/world/cloudrun.yamlindex 8985a59f0..8a7882c66 100644--- a/deploy/world/cloudrun.yaml+++ b/deploy/world/cloudrun.yaml@@ -1,8 +1,18 @@# Cloud Run service — world.three.ws (Hyperfy multiplayer world)#+# One-time: create the admin-code secret and let the service account read it.+# Without ADMIN_CODE, Hyperfy gives EVERY visitor admin/build rights — anyone+# can delete the ground or fill the world with broken GLBs.+# printf '%s' "<code>" | gcloud secrets create hyperfy-admin-code --data-file=-+# gcloud secrets add-iam-policy-binding hyperfy-admin-code \+# --member=serviceAccount:hyperfy-world-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com \+# --role=roles/secretmanager.secretAccessor+## Apply with:# gcloud run services replace deploy/world/cloudrun.yaml --region=us-central1#+# In-world, an admin claims build rights with the chat command: /admin <code>+## After deploy, map the custom domain:# gcloud run domain-mappings create --service=hyperfy-world \# --domain=world.three.ws --region=us-central1@@ -58,8 +68,10 @@ spec:# Save world state to disk every 30 seconds.- name: SAVE_INTERVALvalue: "30000"+ # Megabytes. Enforced client-side by Hyperfy and server-side on+ # /api/upload via patches/0001-upload-limit-from-env.patch.- name: PUBLIC_MAX_UPLOAD_SIZE- value: "100"+ value: "16"# Store assets locally (in the world dir, served via PUBLIC_API_URL).- name: ASSETSvalue: local@@ -70,6 +82,13 @@ spec:secretKeyRef:name: hyperfy-jwt-secretkey: latest+ # Gates building: with this set, visitors join as rank VISITOR and+ # cannot add/move/delete world content; admins unlock via /admin.+ - name: ADMIN_CODE+ valueFrom:+ secretKeyRef:+ name: hyperfy-admin-code+ key: latestresources:limits:cpu: "2"diff --git a/deploy/world/patches/0001-upload-limit-from-env.patch b/deploy/world/patches/0001-upload-limit-from-env.patchnew file mode 100644index 000000000..de2b7d905--- /dev/null+++ b/deploy/world/patches/0001-upload-limit-from-env.patch@@ -0,0 +1,17 @@+diff --git a/src/server/index.js b/src/server/index.js+index 67d7345..8730fc8 100644+--- a/src/server/index.js++++ b/src/server/index.js+@@ -128,9 +128,11 @@ if (world.assetsDir) {+ },+ })+ }++const maxUploadBytes = (parseInt(process.env.PUBLIC_MAX_UPLOAD_SIZE, 10) || 16) * 1024 * 1024+ fastify.register(multipart, {+ limits: {+- fileSize: 200 * 1024 * 1024, // 200MB++ fileSize: maxUploadBytes,++ files: 1,+ },+ })+ fastify.register(ws)diff --git a/package.json b/package.jsonindex 9cc47fd9c..c0d21b728 100644--- a/package.json+++ b/package.json@@ -57,7 +57,7 @@"dev": "vite --port 3000","dev:multi": "npm run dev --prefix multiplayer","dev:walk-all": "node scripts/dev-walk-all.mjs",- "demo:agent-wallet-bridge": "node scripts/mm-x402-bridge.mjs",+ "demo:agent-wallet-bridge": "node scripts/agent-wallet-x402-bridge.mjs","dev:lib": "TARGET=lib vite","presence": "node scripts/three-ws-presence.mjs","build:pages": "node scripts/build-page-index.mjs",diff --git a/pages/launches.html b/pages/launches.htmlnew file mode 100644index 000000000..c9b84944e--- /dev/null+++ b/pages/launches.html@@ -0,0 +1,97 @@+<!doctype html>+<html lang="en">+ <head>+ <script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Agent Launches · three.ws</title>+ <meta+ name="description"+ content="Every coin launched by a three.ws agent — a live public feed with market caps, graduation status, and the agent behind each launch."+ />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/launches" />+ <meta property="og:title" content="Agent Launches · three.ws" />+ <meta+ property="og:description"+ content="Every coin launched by a three.ws agent — a live public feed with market caps, graduation status, and the agent behind each launch."+ />+ <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 Launches · three.ws" />+ <meta+ name="twitter:description"+ content="Every coin launched by a three.ws agent — a live public feed with market caps, graduation status, and the agent behind each launch."+ />+ <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" />+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/site.webmanifest" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/launches.css" />+ <link rel="stylesheet" href="/footer.css" />+ <script defer src="/footer-newsletter.js"></script>+ </head>+ <body>+ <header><div id="nav-container"></div></header>+ <script src="/nav.js"></script>++ <main class="lx-shell" aria-labelledby="lx-title">+ <section class="lx-hero">+ <p class="lx-kicker">Live from the chain</p>+ <h1 id="lx-title">Agent Launches</h1>+ <p class="lx-sub">+ Every coin launched by a three.ws agent, newest first — with live market caps,+ graduation status, and a direct line to the agent behind it.+ </p>+ <div class="lx-hero-ctas">+ <a class="lx-btn lx-btn-primary" href="/create-agent">Create an agent</a>+ <a class="lx-btn" href="/agents">Browse agents</a>+ </div>+ </section>++ <section class="lx-toolbar" aria-label="Feed filters">+ <div class="lx-net-toggle" role="tablist" aria-label="Network">+ <button+ type="button"+ class="lx-net-btn active"+ data-network="mainnet"+ role="tab"+ aria-selected="true"+ >+ Mainnet+ </button>+ <button+ type="button"+ class="lx-net-btn"+ data-network="devnet"+ role="tab"+ aria-selected="false"+ >+ Devnet+ </button>+ </div>+ <div id="lx-agent-filter" class="lx-agent-filter" hidden></div>+ <span id="lx-count" class="lx-count" aria-live="polite"></span>+ </section>++ <section id="lx-feed" class="lx-grid" aria-label="Launched coins" aria-busy="true"></section>++ <div id="lx-footer-state" class="lx-footer-state"></div>+ </main>++ <script type="module" src="/src/launches.js"></script>+ <script defer src="/brand.js"></script>+ <div id="footer-container"></div>+ <script src="/footer.js"></script>+ </body>+</html>diff --git a/pages/play/agent-wallet.html b/pages/play/agent-wallet.htmlindex 9dcef6458..1360dd2e3 100644--- a/pages/play/agent-wallet.html+++ b/pages/play/agent-wallet.html@@ -4,17 +4,17 @@<script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />- <title>Agent Wallet — your avatar pays for an endpoint with MetaMask · three.ws</title>- <meta name="description" content="Watch your 3D avatar walk up to a paid x402 endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base." />+ <title>Agent Wallet — your avatar pays for an endpoint on Solana · three.ws</title>+ <meta name="description" content="Watch your 3D avatar walk up to a paid x402 endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana." /><link rel="canonical" href="https://three.ws/play/agent-wallet" /><meta property="og:type" content="website" />- <meta property="og:title" content="Agent Wallet — your avatar pays for an endpoint with MetaMask" />- <meta property="og:description" content="A 3D avatar pays for live crypto intel with the MetaMask agent wallet. Real x402 micropayment, real USDC, settled on Base." />+ <meta property="og:title" content="Agent Wallet — your avatar pays for an endpoint on Solana" />+ <meta property="og:description" content="A 3D avatar pays for live crypto intel with its agent wallet. Real x402 micropayment, real USDC, settled on Solana." /><meta property="og:url" content="https://three.ws/play/agent-wallet" /><meta property="og:image" content="https://three.ws/og-image.png" /><meta name="twitter:card" content="summary_large_image" />- <meta name="twitter:title" content="Agent Wallet — your avatar pays for an endpoint with MetaMask" />- <meta name="twitter:description" content="A 3D avatar pays for a live API with the MetaMask agent wallet. Real USDC on Base, on-chain." />+ <meta name="twitter:title" content="Agent Wallet — your avatar pays for an endpoint on Solana" />+ <meta name="twitter:description" content="A 3D avatar pays for a live API with its agent wallet. Real USDC on Solana, on-chain." /><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" />@@ -33,8 +33,8 @@--text: #eceef8;--muted: #7c85a2;--faint: #484f64;- --mm: #f6851b;- --mm-lt: #ffa04d;+ --acc: #9945ff;+ --acc-lt: #b88aff;--usdc: #2775ca;--usdc-lt: #6db0f7;--green: #22d77a;@@ -46,7 +46,7 @@*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }html,body { height:100%; background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased; }body { font:15px/1.6 -apple-system,system-ui,"Segoe UI",sans-serif; overflow:hidden; }- :focus-visible { outline:2px solid var(--mm-lt); outline-offset:3px; }+ :focus-visible { outline:2px solid var(--acc-lt); outline-offset:3px; }a { color:var(--usdc-lt); }#app { display:grid; grid-template-rows:52px 1fr; height:100%; }@@ -64,11 +64,11 @@.brand .sep { color:var(--faint); }.badge {display:inline-flex; align-items:center; gap:7px;- background:rgba(246,133,27,0.10); border:1px solid rgba(246,133,27,0.32);- border-radius:99px; padding:4px 11px; font-size:12px; color:var(--mm-lt); font-weight:600;+ background:rgba(153,69,255,0.10); border:1px solid rgba(153,69,255,0.32);+ border-radius:99px; padding:4px 11px; font-size:12px; color:var(--acc-lt); font-weight:600;white-space:nowrap;}- .badge .dot { width:6px; height:6px; border-radius:50%; background:var(--mm); box-shadow:0 0 8px var(--mm); }+ .badge .dot { width:6px; height:6px; border-radius:50%; background:var(--acc); box-shadow:0 0 8px var(--acc); }.tb-btn {display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:9px;background:rgba(255,255,255,0.05); border:1px solid var(--border); color:var(--muted);@@ -106,7 +106,7 @@font-size:11px; font-weight:700; letter-spacing:0.09em; text-transform:uppercase;color:var(--faint); margin-bottom:10px; display:flex; align-items:center; gap:7px;}- .card h2 .fox { width:15px; height:15px; flex:none; }+ .card h2 .w-ico { width:15px; height:15px; flex:none; }/* Wallet card */.w-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:7px; }@@ -124,7 +124,7 @@.mode-pill {font-size:10px; font-weight:700; letter-spacing:0.05em; text-transform:uppercase;padding:2px 8px; border-radius:99px;- background:rgba(246,133,27,0.14); color:var(--mm-lt); border:1px solid rgba(246,133,27,0.3);+ background:rgba(153,69,255,0.14); color:var(--acc-lt); border:1px solid rgba(153,69,255,0.3);}.bal { font-size:20px; font-weight:750; letter-spacing:-0.01em; }.bal small { font-size:11px; font-weight:600; color:var(--muted); margin-left:5px; }@@ -169,15 +169,15 @@transition:all .15s;}.t-chip:hover { border-color:var(--border-hi); color:var(--text); }- .t-chip.active { background:rgba(246,133,27,0.14); border-color:rgba(246,133,27,0.45); color:var(--mm-lt); }+ .t-chip.active { background:rgba(153,69,255,0.14); border-color:rgba(153,69,255,0.45); color:var(--acc-lt); }.pay-btn {width:100%; margin-top:12px; display:inline-flex; align-items:center; justify-content:center; gap:9px;- background:linear-gradient(135deg, var(--mm) 0%, #d96a07 100%);+ background:linear-gradient(135deg, var(--acc) 0%, #d96a07 100%);color:#fff; border:0; border-radius:11px; padding:12px 22px;font:14px/1 inherit; font-weight:700; cursor:pointer; letter-spacing:0.01em;transition:filter .15s, transform .1s, box-shadow .15s;}- .pay-btn:hover:not(:disabled) { filter:brightness(1.1); box-shadow:0 0 28px rgba(246,133,27,0.35); }+ .pay-btn:hover:not(:disabled) { filter:brightness(1.1); box-shadow:0 0 28px rgba(153,69,255,0.35); }.pay-btn:active:not(:disabled) { transform:translateY(1px); }.pay-btn:disabled { opacity:.5; cursor:default; box-shadow:none; filter:none; }.pay-btn .spin { width:14px; height:14px; border:2px solid rgba(255,255,255,0.35); border-top-color:#fff; border-radius:50%; animation:spin .65s linear infinite; display:none; }@@ -190,7 +190,7 @@.stage { display:flex; align-items:center; gap:10px; padding:7px 4px; font-size:13px; color:var(--faint); transition:color .25s; }.stage .si { width:17px; height:17px; border-radius:50%; border:2px solid var(--faint); flex:none; display:flex; align-items:center; justify-content:center; transition:all .3s; }.stage.active { color:var(--text); }- .stage.active .si { border-color:var(--mm-lt); box-shadow:0 0 8px rgba(246,133,27,0.6); animation:pulse .9s ease-in-out infinite; }+ .stage.active .si { border-color:var(--acc-lt); box-shadow:0 0 8px rgba(153,69,255,0.6); animation:pulse .9s ease-in-out infinite; }.stage.done { color:var(--green); }.stage.done .si { background:var(--green); border-color:var(--green); }.stage.done .si::after { content:"✓"; font-size:9px; color:#000; font-weight:900; }@@ -253,7 +253,7 @@<span class="sep">/</span><a class="crumb" href="/play">play</a><span class="sep">/</span>- <span class="badge"><span class="dot"></span>MetaMask Agent Wallet × x402</span>+ <span class="badge"><span class="dot"></span>Agent Wallet × x402 on Solana</span></div><div style="display:flex;gap:10px;align-items:center;"><a class="tb-btn" href="/agent-exchange" title="Two agents paying each other">Agent Exchange</a>@@ -270,8 +270,8 @@<!-- Agent wallet --><div class="card" id="walletCard"><h2>- <svg class="fox" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M21.5 3 13.7 8.8l1.5-3.4L21.5 3Z" fill="#E2761B"/><path d="m2.5 3 7.7 5.9-1.4-3.5L2.5 3Zm15.8 13.2-2.1 3.2 4.5 1.2 1.3-4.3-3.7-.1Zm-15.8.1 1.3 4.3 4.5-1.2-2.1-3.2-3.7.1Z" fill="#E4761B"/><path d="m8 10.5-1.3 1.9 4.4.2-.1-4.8L8 10.5Zm8 0-3-2.8-.1 4.9 4.4-.2L16 10.5Zm-7.7 9 2.7-1.3-2.3-1.8-.4 3.1Zm5.7-1.3 2.7 1.3-.4-3.1-2.3 1.8Z" fill="#E4761B"/><path d="m16.7 19.5-2.7-1.3.2 1.7v.7l2.5-1.1Zm-9.4 0 2.5 1.1v-.7l.2-1.7-2.7 1.3Z" fill="#D7C1B3"/><path d="M9.9 15.3 7.7 14.6l1.6-.7.6 1.4Zm4.2 0 .6-1.4 1.6.7-2.2.7Z" fill="#233447"/><path d="m7.3 19.5.4-3.2-2.5.1 2.1 3.1Zm9-3.2.4 3.2 2.1-3.1-2.5-.1Zm1.8-3.9-4.4.2.4 2.7.6-1.4 1.6.7 1.8-2.2Zm-10.4 2.2 1.6-.7.6 1.4.4-2.7-4.4-.2 1.8 2.2Z" fill="#CD6116"/><path d="m6.7 12.4 1.9 3.6-.1-1.8-1.8-1.8Zm10.6 0-1.8 1.8-.1 1.8 1.9-3.6Zm-6.2.2-.4 2.7.5 2.6.1-3.4-.2-1.9Zm1.8 0-.2 1.9.1 3.4.5-2.6-.4-2.7Z" fill="#E4751F"/><path d="m12.9 15.3-.5 2.6.4.3 2.3-1.8.1-1.8-2.3.7Zm-5.2-.7.1 1.8 2.3 1.8.4-.3-.5-2.6-2.3-.7Z" fill="#F6851B"/><path d="m13 20.6-.1-.7h-1.8l-.1.7-.2 1.7 2.5.1-.3-1.8Z" fill="#C0AD9E"/><path d="m12.8 18.2-.4-.3h-.8l-.4.3-.2 1.7h1.8l-.2-1.7" fill="#161616"/><path d="m21.8 9.2.7-3.2-1-3-7.7 5.7 3 2.5 4.2 1.2.9-1.1-.4-.3.6-.6-.5-.4.6-.5-.4-.3Zm-20.3-3.2.7 3.2-.4.3.6.5-.5.4.6.6-.4.3.9 1.1 4.2-1.2 3-2.5L2.5 3l-1 3Z" fill="#763D16"/><path d="m20.9 12.4-4.2-1.2 1.3 1.9-1.9 3.6 2.5 0h3.7l-1.4-4.3ZM7.3 11.2l-4.2 1.2-1.4 4.3h3.7l2.5 0-1.9-3.6 1.3-1.9Zm5.4 2.1.3-4.6 1.2-3.3H8.8L10 8.7l.3 4.6.1 1.9v3.4h1.8l.1-3.4.1-1.9Z" fill="#F6851B"/></svg>- MetaMask Agent Wallet+ <svg class="w-ico" viewBox="0 0 24 24" fill="none" aria-hidden="true"><rect x="2.5" y="5" width="19" height="14" rx="3" stroke="#9945ff" stroke-width="1.8"/><path d="M2.5 9.2h19" stroke="#9945ff" stroke-width="1.8"/><circle cx="17" cy="14" r="1.4" fill="#b88aff"/></svg>+ Agent Wallet · Solana</h2><div class="w-row"><span class="k">Account</span>@@ -288,27 +288,27 @@<div class="banner offline" id="bridgeOffline" role="alert"><div class="b-head">Bridge offline</div>- The MetaMask Agentic CLI runs in your terminal, so this demo talks to it- through a local bridge. Start it in the repo root:+ The agent wallet key lives in your terminal session, so this demo talks+ to it through a local bridge. Start it in the repo root:<div style="margin-top:6px"><code>npm run demo:agent-wallet-bridge</code></div>- <div style="margin-top:4px">then make sure you're signed in: <code>mm auth status</code></div>+ <div style="margin-top:4px">with <code>A2A_PAYER_SOLANA_SECRET</code> set in <code>.env</code> or the shell.</div><button class="retry" id="retryBridge" type="button">Retry connection</button></div><div class="banner lowbal" id="lowBalance" role="alert">- <div class="b-head">Wallet needs USDC on Base</div>- This payment is real — send a little USDC (Base mainnet) to the agent- wallet address above, or fund it with <code>mm</code>, then retry.+ <div class="b-head">Wallet needs USDC on Solana</div>+ This payment is real — send a little USDC (Solana mainnet) to the agent+ wallet address above, then retry.</div></div><!-- Paid endpoint --><div class="card">- <h2>Paid endpoint · x402 on Base</h2>+ <h2>Paid endpoint · x402 on Solana</h2><div class="ep-name"><span id="epName"><span class="skel">three.ws Crypto Intel</span></span><span class="ep-price" id="epPrice"><span class="skel">$0.01</span></span></div>- <div class="ep-desc" id="epDesc"><span class="skel">Live market signal — pay per call, settled in USDC on Base mainnet.</span></div>+ <div class="ep-desc" id="epDesc"><span class="skel">Live market signal — pay per call, settled in USDC on Solana mainnet.</span></div><div class="ep-meta" id="epTags"></div><div class="topics" id="topics" role="group" aria-label="Intel topic"></div>@@ -317,9 +317,9 @@<span class="spin" aria-hidden="true"></span><span class="lbl">Send avatar to pay</span></button>- <div class="pay-note">Your avatar walks to the kiosk, the MetaMask agent wallet signs a USDC- <span style="font-family:var(--mono);font-size:10px">TransferWithAuthorization</span>, and the- endpoint settles it on Base mainnet. Real money, real API response.</div>+ <div class="pay-note">Your avatar walks to the kiosk, the agent wallet signs an SPL USDC+ <span style="font-family:var(--mono);font-size:10px">TransferChecked</span>, and the+ endpoint settles it on Solana mainnet. Real money, real API response.</div></div><!-- Live payment stages -->@@ -335,10 +335,11 @@<h2>How it works</h2><div class="how"><b>1.</b> The endpoint answers with a <b>402 Payment Required</b> challenge (x402 v2).<br/>- <b>2.</b> The <b>MetaMask Agentic CLI</b> signs an EIP-3009 USDC transfer authorization- (<span style="font-family:var(--mono);font-size:10.5px">mm wallet sign-typed-data</span>).<br/>- <b>3.</b> The request retries with the <b>X-PAYMENT</b> header; a facilitator verifies and- settles the USDC on <b>Base mainnet</b>, then the API does the paid work.+ <b>2.</b> The <b>agent wallet</b> builds and partially signs an SPL USDC+ <span style="font-family:var(--mono);font-size:10.5px">TransferChecked</span> — the+ facilitator co-signs as fee payer, so the agent only signs the transfer.<br/>+ <b>3.</b> The request retries with the <b>X-PAYMENT</b> header; the facilitator verifies and+ settles the USDC on <b>Solana mainnet</b>, then the API does the paid work.</div></div></aside>diff --git a/public/changelog.json b/public/changelog.jsonindex 14241a6b3..0fc91db13 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,16 +1,78 @@{- "generated_at": "2026-06-11T23:14:45.832Z",+ "generated_at": "2026-06-12T01:11:40.430Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-06-12",+ "type": "launch",+ "title": "Agent Launches",+ "summary": "Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.",+ "link": "/launches",+ "tags": [+ "launch"+ ]+ },+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "Cosmetics shop purchases now work",+ "summary": "Buying a premium skin or emote in the /play Cosmetics shop actually opens the payment flow now. Previously the Buy buttons failed because the in-world shop never loaded the payment widget — now it loads on demand the moment you tap Buy, the USDC checkout opens with the item priced by rarity, and a sale made inside a coin's world still credits that coin's creator. Pay once on Base or Solana and the item is yours forever.",+ "link": "/play",+ "tags": [+ "fix"+ ]+ },+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "New /launches page: every agent-launched coin in one live feed",+ "summary": "There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches.",+ "link": "/launches",+ "tags": [+ "feature"+ ]+ },+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "Pay a real x402 oracle inside the $THREE town",+ "summary": "The $THREE town in /play now has an Intel Kiosk by the plaza: walk up, press E, and buy live $THREE market intel — price, 24 h change, market cap, and a bullish/bearish/neutral signal — for $0.01 USDC paid from your own wallet over x402, settled on-chain on Solana. The oracle behind it (/api/x402/three-intel) is also listed in the bazaar, so any agent can buy the same feed. The Agent Wallet demo is now linked from the /play menu too.",+ "link": "/play",+ "tags": [+ "feature"+ ]+ },+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "Reliability sweep: faster galleries, working voices, sturdier pages",+ "summary": "A pass over every error in the production logs. Avatar thumbnails and 3D models now load through three.ws itself instead of a rate-limited storage domain, so gallery pages stop dropping images under load. Text-to-speech voices are back (the upstream voice service had changed its protocol). Leaving a world on /play no longer hits a crash that could leave the session connected in the background. The homepage 3D demos politely step aside on devices without WebGL instead of breaking, payment demo requests get more time to settle on-chain, and the $THREE market stats failover stops hammering an exhausted data provider.",+ "link": null,+ "tags": [+ "fix",+ "improvement",+ "infra"+ ]+ },+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "zauth's security agent moves into the $THREE town",+ "summary": "A new character stands in the $THREE town plaza on /play: the security agent from zauth, the x402 trust company. Walk up and it calls zauth's live paid API on the spot, quoting the real on-chain price for a RepoScan — name any GitHub repository and for $0.05 USDC, paid from your own wallet straight to zauth on Solana or Base, it scans the code for provenance, contributor verification, and vulnerabilities, then hands back a 0–100 trust score with a full written report. Scans keep running while you play; the agent calls out when your report is ready.",+ "link": "/play",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-11","type": "launch",- "title": "Agent Wallet (MetaMask × x402)",- "summary": "Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.",+ "title": "Agent Wallet (x402 on Solana)",+ "summary": "Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.","link": "/play/agent-wallet","tags": ["launch"@@ -48,6 +110,16 @@"infra"]},+ {+ "date": "2026-06-11",+ "type": "update",+ "title": "Agent Wallet demo now settles on Solana",+ "summary": "The Agent Wallet playground (/play/agent-wallet) now pays in USDC on Solana mainnet instead of Base. Your avatar's agent wallet partially signs an SPL USDC transfer, the x402 facilitator co-signs as fee payer, and the settlement lands on Solana — with a Solscan link on the receipt. Same real micropayment, now on the chain three.ws lives on.",+ "link": "/play/agent-wallet",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-11","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex b00c33ccd..2ca36e0d8 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -7,12 +7,60 @@<description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language><item>- <title>Agent Wallet (MetaMask × x402)</title>+ <title>Agent Launches</title>+ <link>https://three.ws/launches</link>+ <guid isPermaLink="false">2026-06-12:Agent Launches</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.</description>+ </item>+ <item>+ <title>Cosmetics shop purchases now work</title>+ <link>https://three.ws/play</link>+ <guid isPermaLink="false">2026-06-12:Cosmetics shop purchases now work</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Buying a premium skin or emote in the /play Cosmetics shop actually opens the payment flow now. Previously the Buy buttons failed because the in-world shop never loaded the payment widget — now it loads on demand the moment you tap Buy, the USDC checkout opens with the item priced by rarity, and a sale made inside a coin's world still credits that coin's creator. Pay once on Base or Solana and the item is yours forever.</description>+ </item>+ <item>+ <title>New /launches page: every agent-launched coin in one live feed</title>+ <link>https://three.ws/launches</link>+ <guid isPermaLink="false">2026-06-12:New /launches page: every agent-launched coin in one live feed</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches.</description>+ </item>+ <item>+ <title>Pay a real x402 oracle inside the $THREE town</title>+ <link>https://three.ws/play</link>+ <guid isPermaLink="false">2026-06-12:Pay a real x402 oracle inside the $THREE town</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The $THREE town in /play now has an Intel Kiosk by the plaza: walk up, press E, and buy live $THREE market intel — price, 24 h change, market cap, and a bullish/bearish/neutral signal — for $0.01 USDC paid from your own wallet over x402, settled on-chain on Solana. The oracle behind it (/api/x402/three-intel) is also listed in the bazaar, so any agent can buy the same feed. The Agent Wallet demo is now linked from the /play menu too.</description>+ </item>+ <item>+ <title>Reliability sweep: faster galleries, working voices, sturdier pages</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-12:Reliability sweep: faster galleries, working voices, sturdier pages</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>A pass over every error in the production logs. Avatar thumbnails and 3D models now load through three.ws itself instead of a rate-limited storage domain, so gallery pages stop dropping images under load. Text-to-speech voices are back (the upstream voice service had changed its protocol). Leaving a world on /play no longer hits a crash that could leave the session connected in the background. The homepage 3D demos politely step aside on devices without WebGL instead of breaking, payment demo requests get more time to settle on-chain, and the $THREE market stats failover stops hammering an exhausted data provider.</description>+ </item>+ <item>+ <title>zauth's security agent moves into the $THREE town</title>+ <link>https://three.ws/play</link>+ <guid isPermaLink="false">2026-06-12:zauth's security agent moves into the $THREE town</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>A new character stands in the $THREE town plaza on /play: the security agent from zauth, the x402 trust company. Walk up and it calls zauth's live paid API on the spot, quoting the real on-chain price for a RepoScan — name any GitHub repository and for $0.05 USDC, paid from your own wallet straight to zauth on Solana or Base, it scans the code for provenance, contributor verification, and vulnerabilities, then hands back a 0–100 trust score with a full written report. Scans keep running while you play; the agent calls out when your report is ready.</description>+ </item>+ <item>+ <title>Agent Wallet (x402 on Solana)</title><link>https://three.ws/play/agent-wallet</link>- <guid isPermaLink="false">2026-06-11:Agent Wallet (MetaMask × x402)</guid>+ <guid isPermaLink="false">2026-06-11:Agent Wallet (x402 on Solana)</guid><pubDate>Thu, 11 Jun 2026 12:00:00 GMT</pubDate><category>launch</category>- <description>Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.</description>+ <description>Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.</description></item><item><title>Status</title>@@ -38,6 +86,14 @@<category>fix</category><description>The payment directory was counting every unpaid x402 discovery request (the protocol's standard 402 challenge) as a failed call, dragging three.ws endpoint success rates down even when every endpoint was healthy. Telemetry now reports only real payment attempts, so the published uptime reflects actual service health.</description></item>+ <item>+ <title>Agent Wallet demo now settles on Solana</title>+ <link>https://three.ws/play/agent-wallet</link>+ <guid isPermaLink="false">2026-06-11:Agent Wallet demo now settles on Solana</guid>+ <pubDate>Thu, 11 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The Agent Wallet playground (/play/agent-wallet) now pays in USDC on Solana mainnet instead of Base. Your avatar's agent wallet partially signs an SPL USDC transfer, the x402 facilitator co-signs as fee payer, and the settlement lands on Solana — with a Solscan link on the receipt. Same real micropayment, now on the chain three.ws lives on.</description>+ </item><item><title>Agents dashboard renders reliably again</title><link>https://three.ws/dashboard/agents</link>diff --git a/public/features.json b/public/features.jsonindex f69b91be9..6481f7719 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-11T23:14:45.823Z",+ "generated_at": "2026-06-12T01:11:40.390Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -436,6 +436,16 @@"title": "Crypto","description": "On-chain features: pay-per-call, token launches, vanity wallets.","pages": [+ {+ "path": "/launches",+ "title": "Agent Launches",+ "description": "Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.",+ "added": "2026-06-12",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": false+ },{"path": "/pay","title": "Pay (x402)",@@ -448,8 +458,8 @@},{"path": "/play/agent-wallet",- "title": "Agent Wallet (MetaMask × x402)",- "description": "Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.",+ "title": "Agent Wallet (x402 on Solana)",+ "description": "Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.","added": "2026-06-11","auth": null,"indexable": true,diff --git a/public/llms-full.txt b/public/llms-full.txtindex 86c1f8541..aaac63862 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -266,17 +266,23 @@ A curated gallery of three.ws's most powerful — and most hidden — features.On-chain features: pay-per-call, token launches, vanity wallets.+### Agent Launches++URL: https://three.ws/launches++Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.+### Pay (x402)URL: https://three.ws/payPay-per-call gateway: invoke any x402-protocol paid API with a USDC micro-transaction.-### Agent Wallet (MetaMask × x402)+### Agent Wallet (x402 on Solana)URL: https://three.ws/play/agent-wallet-Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.+Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.### Pump.fun Streamdiff --git a/public/llms.txt b/public/llms.txtindex 60161e9c3..2baf81937 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -65,8 +65,9 @@ Experimental features actively shipping. Expect fast iteration.On-chain features: pay-per-call, token launches, vanity wallets.+- [Agent Launches](https://three.ws/launches): Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.- [Pay (x402)](https://three.ws/pay): Pay-per-call gateway: invoke any x402-protocol paid API with a USDC micro-transaction.-- [Agent Wallet (MetaMask × x402)](https://three.ws/play/agent-wallet): Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.+- [Agent Wallet (x402 on Solana)](https://three.ws/play/agent-wallet): Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.- [Pump.fun Stream](https://three.ws/pumpfun): Mint and trade pump.fun agent tokens on Solana. Live feed of every launch.- [Pump Live](https://three.ws/pump-live): Real-time SSE feed of every pump.fun launch as it happens.- [Pump Dashboard](https://three.ws/pump-dashboard): Pump.fun trading desk: watchlists, scanner, quotes, portfolio, and live charts.diff --git a/public/nav-data.js b/public/nav-data.jsindex 07d01cc13..6f385617b 100644--- a/public/nav-data.js+++ b/public/nav-data.js@@ -87,6 +87,12 @@ export const NAV_GROUPS = [},{ title: 'ERC-8004 Agents', href: '/discover', desc: 'On-chain agent directory' },{ title: 'Agents Index', href: '/agents', desc: 'Browse every registered agent' },+ {+ title: 'Agent Launches',+ href: '/launches',+ badge: 'New',+ desc: 'Every coin launched by an agent — live public feed',+ },{title: 'Reputation Explorer',href: '/reputation',@@ -233,7 +239,7 @@ export const NAV_GROUPS = [title: 'Agent Wallet',href: '/play/agent-wallet',badge: 'New',- desc: 'Your avatar pays an endpoint via MetaMask — USDC on Base',+ desc: 'Your avatar pays an endpoint with its agent wallet — USDC on Solana',},{ title: 'Pole Club', href: '/club', desc: 'x402 micro-tip demo — $0.001 / dance' },{diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 8ee5acbb8..90a00e62f 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -387,6 +387,13 @@<p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p></header><ul class="sm-list">+ <li>+ <a href="/launches">+ <span class="sm-title">Agent Launches</span>+ <span class="sm-path">/launches</span>+ <span class="sm-desc">Live public feed of every coin launched by a three.ws agent — market caps, graduation status, and the agent behind each launch.</span>+ </a>+ </li><li><a href="/pay"><span class="sm-title">Pay (x402)</span>@@ -396,9 +403,9 @@</li><li><a href="/play/agent-wallet">- <span class="sm-title">Agent Wallet (MetaMask × x402)</span>+ <span class="sm-title">Agent Wallet (x402 on Solana)</span><span class="sm-path">/play/agent-wallet</span>- <span class="sm-desc">Watch your 3D avatar walk up to a paid endpoint and pay for it with the MetaMask agent wallet — a real USDC micropayment signed by the MetaMask Agentic CLI and settled on Base.</span>+ <span class="sm-desc">Watch your 3D avatar walk up to a paid endpoint and pay for it with its agent wallet — a real USDC micropayment signed by the agent and settled on Solana.</span></a></li><li>diff --git a/scripts/mm-x402-bridge.mjs b/scripts/agent-wallet-x402-bridge.mjssimilarity index 57%rename from scripts/mm-x402-bridge.mjsrename to scripts/agent-wallet-x402-bridge.mjsindex 26af2cb79..4cd96ea1d 100644--- a/scripts/mm-x402-bridge.mjs+++ b/scripts/agent-wallet-x402-bridge.mjs@@ -1,43 +1,58 @@#!/usr/bin/env node-// mm-x402-bridge — local bridge between the /play/agent-wallet demo page and-// the MetaMask Agentic CLI (`mm`).+// agent-wallet-x402-bridge — local bridge between the /play/agent-wallet demo+// page and the three.ws agent wallet (a local Solana payer keypair).//-// The MetaMask agent wallet lives in the developer's shell session (server--// wallet mode, authenticated via `mm login`), so a browser page can't reach it+// The payer secret lives in the developer's environment (A2A_PAYER_SOLANA_SECRET,+// the same convention the A2A payer uses), so a browser page can't reach it// directly. This bridge exposes the three operations the demo needs over// localhost HTTP://-// GET /status → wallet address/mode + balances (mm wallet show/balance)+// GET /status → wallet address + live SOL/USDC balances (Solana RPC)// GET /quote?endpoint=<url> → the endpoint's real 402 challenge, parsed// POST /pay {endpoint,method,body} → SSE stream of a REAL x402 payment:// challenge → signing → signed → submitting → done|error//-// The payment is the standard x402 v2 EIP-3009 flow on Base mainnet-// (eip155:8453): the bridge fetches the 402 challenge, asks the mm CLI to sign-// the USDC TransferWithAuthorization typed data (`mm wallet sign-typed-data`),-// then retries the request with the X-PAYMENT header. Settlement happens-// server-side at the paid endpoint via its facilitator — real USDC moves.+// The payment is the standard x402 v2 `exact` scheme on Solana mainnet+// (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp): the bridge fetches the 402+// challenge, builds an SPL TransferChecked via the official @x402/svm scheme+// with the endpoint-advertised facilitator as fee payer, partially signs it+// with the agent wallet, then retries the request with the X-PAYMENT header.+// Settlement happens server-side at the paid endpoint via its facilitator —+// real USDC moves on Solana.//// Safety rails (this listens on localhost, where any local page could reach it):// • Target endpoints must be on an allowlisted origin (three.ws + local dev).-// • Per-payment cap, default $0.10 USDC (MM_BRIDGE_MAX_USDC_MICROS).+// • Per-payment cap, default $0.10 USDC (X402_BRIDGE_MAX_USDC_MICROS).// • CORS restricted to local dev origins + *.app.github.dev.//-// Run: node scripts/mm-x402-bridge.mjs (or: npm run demo:agent-wallet-bridge)+// Run: node scripts/agent-wallet-x402-bridge.mjs (or: npm run demo:agent-wallet-bridge)import { createServer } from 'node:http';-import { execFile } from 'node:child_process';-import { randomBytes } from 'node:crypto';+import { readFileSync } from 'node:fs';-const PORT = Number(process.env.MM_BRIDGE_PORT) || 4402;-const MAX_USDC_MICROS = BigInt(process.env.MM_BRIDGE_MAX_USDC_MICROS || '100000'); // $0.10-const BASE_NETWORK = 'eip155:8453';-const BASE_CHAIN_ID = 8453;+// Pick up A2A_PAYER_SOLANA_SECRET / SOLANA_RPC_URL from the repo .env when+// present, without overriding anything already exported in the shell.+try {+ const raw = readFileSync(new URL('../.env', import.meta.url), 'utf8');+ for (const line of raw.split('\n')) {+ const m = line.match(/^([A-Z0-9_]+)=(.*)$/);+ if (m && !(m[1] in process.env)) process.env[m[1]] = m[2];+ }+} catch {+ /* no .env — rely on the shell environment */+}++const PORT = Number(process.env.X402_BRIDGE_PORT) || 4402;+const MAX_USDC_MICROS = BigInt(process.env.X402_BRIDGE_MAX_USDC_MICROS || '100000'); // $0.10+const SOLANA_RPC_URL = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';+const PAYER_SECRET =+ process.env.A2A_PAYER_SOLANA_SECRET || process.env.A2A_PAYER_SOLANA_PRIVATE_KEY || '';+const USDC_MINT_SOLANA = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';// Origins a target paid endpoint may live on. The demo pays three.ws's own// x402 endpoints; local dev lets you point at `vercel dev`/vite proxies.const ALLOWED_ENDPOINT_ORIGINS = (- process.env.MM_BRIDGE_ALLOWED_ENDPOINT_ORIGINS ||+ process.env.X402_BRIDGE_ALLOWED_ENDPOINT_ORIGINS ||'https://three.ws,http://localhost:3000,http://127.0.0.1:3000').split(',')@@ -58,56 +73,87 @@ function corsOriginAllowed(origin) {}}-// ── mm CLI ────────────────────────────────────────────────────────────────+// ── agent wallet (Solana payer keypair) ────────────────────────────────────-// Run an mm command with --json and parse the JSON object out of stdout.-// The CLI prints human lines (e.g. "Intent: …") before the JSON, so parse-// from the first `{`.-function mm(args, { timeoutMs = 120_000 } = {}) {- return new Promise((resolvePromise, reject) => {- execFile('mm', [...args, '--json'], { timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024 }, (err, stdout, stderr) => {- const raw = String(stdout || '');- const jsonStart = raw.indexOf('{');- if (jsonStart === -1) {- return reject(new Error(`mm ${args[0]} produced no JSON output${err ? `: ${err.message}` : ''}${stderr ? ` — ${String(stderr).slice(0, 300)}` : ''}`));- }- let parsed;- try {- parsed = JSON.parse(raw.slice(jsonStart));- } catch (parseErr) {- return reject(new Error(`mm ${args[0]} output parse failed: ${parseErr.message}`));- }- if (parsed.ok === false) {- return reject(new Error(`mm ${args[0]} failed: ${parsed.error?.message || parsed.error || 'unknown error'}`));- }- resolvePromise(parsed.data ?? parsed);+// 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.+async function decodeSolanaSecret(secret) {+ const trimmed = String(secret).trim();+ if (trimmed.startsWith('[')) {+ const bytes = Uint8Array.from(JSON.parse(trimmed));+ if (bytes.length === 64) return bytes;+ throw new Error('Solana secret: malformed 64-byte JSON array');+ }+ const { default: bs58 } = await import('bs58');+ 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 Error('Solana secret must be a 64-byte key encoded as base58, base64, or a JSON array');+}++let signerPromise = null;+function agentSigner() {+ if (!PAYER_SECRET) {+ return Promise.reject(+ new Error('agent wallet not configured — set A2A_PAYER_SOLANA_SECRET in .env or the shell'),+ );+ }+ if (!signerPromise) {+ signerPromise = (async () => {+ const { createKeyPairSignerFromBytes } = await import('@solana/kit');+ return createKeyPairSignerFromBytes(await decodeSolanaSecret(PAYER_SECRET));+ })();+ signerPromise.catch(() => {+ signerPromise = null; // let a corrected env value retry on next call});- });+ }+ return signerPromise;}let statusCache = null; // { at, payload }async function walletStatus() {if (statusCache && Date.now() - statusCache.at < 10_000) return statusCache.payload;- const [show, balance] = await Promise.all([mm(['wallet', 'show']), mm(['wallet', 'balance'])]);+ const signer = await agentSigner();+ const [{ Connection, PublicKey }, { getAssociatedTokenAddressSync }] = await Promise.all([+ import('@solana/web3.js'),+ import('@solana/spl-token'),+ ]);+ const conn = new Connection(SOLANA_RPC_URL, 'confirmed');+ const owner = new PublicKey(signer.address);+ let sol = null;+ let usdc = 0;+ try {+ sol = (await conn.getBalance(owner)) / 1e9;+ const ata = getAssociatedTokenAddressSync(new PublicKey(USDC_MINT_SOLANA), owner);+ const bal = await conn.getTokenAccountBalance(ata).catch(() => null);+ usdc = bal?.value?.uiAmount ?? 0; // no ATA yet → zero USDC+ } catch {+ // RPC hiccup — report the wallet without live balances rather than fail+ }const payload = {ok: true,wallet: {- address: show.address,- mode: show.mode,- chainNamespace: show.chainNamespace,- policies: show.policies || show['policies[2]'] || null,+ address: signer.address,+ mode: 'solana',+ chainNamespace: 'solana',},balance: {- currency: balance.currency,- totalValue: balance.totalValue,- chains: balance.chains || [],+ currency: 'USD',+ totalValue: usdc.toFixed(2),+ chains: [{ network: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', sol, usdc }],},};statusCache = { at: Date.now(), payload };return payload;}-// ── x402 client flow (mirrors public/x402.js, the platform's browser payer) ──+// ── x402 client flow (Solana exact scheme, official @x402/svm) ─────────────function endpointAllowed(endpoint) {try {@@ -118,13 +164,10 @@ function endpointAllowed(endpoint) {}}-function isEip3009BaseAccept(a) {- return (- a &&- a.scheme === 'exact' &&- a.network === BASE_NETWORK &&- (!a.extra?.assetTransferMethod || a.extra.assetTransferMethod === 'eip3009')- );+// A co-signable Solana accept: exact scheme, Solana CAIP-2 network, and the+// facilitator fee payer the @x402/svm scheme needs to build the transaction.+function isSolanaExactAccept(a) {+ return a && a.scheme === 'exact' && String(a.network || '').startsWith('solana:') && a.extra?.feePayer;}async function fetch402(endpoint, method, body) {@@ -141,9 +184,9 @@ async function fetch402(endpoint, method, body) {if (!Array.isArray(challenge?.accepts) || !challenge.accepts.length) {throw new Error('402 challenge has no accepts[] entries');}- const accept = challenge.accepts.find(isEip3009BaseAccept);+ const accept = challenge.accepts.find(isSolanaExactAccept);if (!accept) {- throw new Error(`endpoint does not accept EIP-3009 USDC on Base (${BASE_NETWORK})`);+ throw new Error('endpoint does not accept exact-scheme USDC on Solana');}return { challenge, accept };}@@ -154,49 +197,7 @@ const BUILDER_CODE_PATTERN = /^[a-z0-9_]{1,32}$/;function builderCodeEcho(challenge) {const declaredA = challenge?.extensions?.['builder-code']?.info?.a;if (!declaredA || !BUILDER_CODE_PATTERN.test(declaredA)) return null;- return { a: declaredA, w: 'metamask_agent', s: ['mm_x402_bridge'] };-}--function buildTypedData({ accept, payerAddress }) {- const validAfter = 0;- const validBefore = Math.floor(Date.now() / 1000) + (accept.maxTimeoutSeconds || 600);- const nonce = '0x' + randomBytes(32).toString('hex');- return {- typedData: {- primaryType: 'TransferWithAuthorization',- types: {- EIP712Domain: [- { name: 'name', type: 'string' },- { name: 'version', type: 'string' },- { name: 'chainId', type: 'uint256' },- { name: 'verifyingContract', type: 'address' },- ],- TransferWithAuthorization: [- { name: 'from', type: 'address' },- { name: 'to', type: 'address' },- { name: 'value', type: 'uint256' },- { name: 'validAfter', type: 'uint256' },- { name: 'validBefore', type: 'uint256' },- { name: 'nonce', type: 'bytes32' },- ],- },- domain: {- name: accept.extra?.name || 'USD Coin',- version: accept.extra?.version || '2',- chainId: BASE_CHAIN_ID,- verifyingContract: accept.asset,- },- message: {- from: payerAddress,- to: accept.payTo,- value: accept.amount,- validAfter,- validBefore,- nonce,- },- },- authorization: { validAfter, validBefore, nonce },- };+ return { a: declaredA, w: 'threews_agent', s: ['agent_wallet_x402_bridge'] };}function fmtUsdc(micros) {@@ -209,7 +210,7 @@ async function executePayment({ endpoint, method, body, emit }) {const amount = BigInt(accept.amount);if (amount > MAX_USDC_MICROS) {throw new Error(- `endpoint asks for ${fmtUsdc(accept.amount)} USDC, above the bridge cap of ${fmtUsdc(MAX_USDC_MICROS.toString())} (raise MM_BRIDGE_MAX_USDC_MICROS to allow)`,+ `endpoint asks for ${fmtUsdc(accept.amount)} USDC, above the bridge cap of ${fmtUsdc(MAX_USDC_MICROS.toString())} (raise X402_BRIDGE_MAX_USDC_MICROS to allow)`,);}emit({@@ -221,44 +222,34 @@ async function executePayment({ endpoint, method, body, emit }) {resource: challenge.resource || null,});- // 2. MetaMask agent wallet signs the USDC TransferWithAuthorization.- const status = await walletStatus();- const payerAddress = status.wallet.address;- const { typedData } = buildTypedData({ accept, payerAddress });+ // 2. The agent wallet builds + partially signs the SPL TransferChecked.+ // The endpoint-advertised extra.feePayer pays the transaction fee and is+ // co-signed by the facilitator on /settle — the agent only signs the+ // transfer authority.+ const signer = await agentSigner();emit({stage: 'signing',- signer: payerAddress,- domain: typedData.domain,- primaryType: typedData.primaryType,+ signer: signer.address,+ network: accept.network,+ mint: accept.asset,to: accept.payTo,value: accept.amount,+ feePayer: accept.extra.feePayer,});- const intent = `Pay ${fmtUsdc(accept.amount)} USDC on Base to ${accept.payTo} for ${endpoint}`;- const signed = await mm([- 'wallet',- 'sign-typed-data',- '--chain-id',- String(BASE_CHAIN_ID),- '--payload',- JSON.stringify(typedData),- '--wait',- '--intent',- intent,- ]);- if (!signed.signature) {- throw new Error(`mm CLI returned no signature (status: ${signed.status || 'unknown'})`);- }- emit({ stage: 'signed', signature: signed.signature, signer: payerAddress });+ const { ExactSvmScheme } = await import('@x402/svm');+ const scheme = new ExactSvmScheme(signer, { rpcUrl: SOLANA_RPC_URL });+ const built = await scheme.createPaymentPayload(2, accept);+ emit({ stage: 'signed', signer: signer.address });// 3. Retry the request with the X-PAYMENT header — the endpoint verifies and// settles via its facilitator, then does the paid work.const paymentPayload = {- x402Version: 2,+ x402Version: built.x402Version || 2,scheme: 'exact',network: accept.network,resource: { url: endpoint, mimeType: 'application/json' },accepted: accept,- payload: { signature: signed.signature, authorization: typedData.message },+ payload: built.payload,};const echo = builderCodeEcho(challenge);if (echo) paymentPayload.extensions = { 'builder-code': echo };@@ -294,10 +285,11 @@ async function executePayment({ endpoint, method, body, emit }) {settlement = null;}}+ statusCache = null; // balance just changedemit({stage: 'done',amount: accept.amount,- payer: payerAddress,+ payer: signer.address,payTo: accept.payTo,settlement,result,@@ -357,9 +349,9 @@ const server = createServer(async (req, res) => {payTo: accept.payTo,asset: accept.asset,network: accept.network,+ feePayer: accept.extra?.feePayer || null,maxTimeoutSeconds: accept.maxTimeoutSeconds,resource: challenge.resource || null,- domainName: accept.extra?.name || 'USD Coin',});}@@ -405,10 +397,15 @@ const server = createServer(async (req, res) => {});server.listen(PORT, '127.0.0.1', () => {- console.log(`mm-x402 bridge listening on http://127.0.0.1:${PORT}`);+ console.log(`agent-wallet x402 bridge listening on http://127.0.0.1:${PORT}`);+ console.log(` settlement rail: USDC on Solana mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp)`);console.log(` allowed endpoint origins: ${ALLOWED_ENDPOINT_ORIGINS.join(', ')}`);console.log(` per-payment cap: ${fmtUsdc(MAX_USDC_MICROS.toString())} USDC`);walletStatus()- .then((s) => console.log(` agent wallet: ${s.wallet.address} (${s.wallet.mode} mode, balance $${s.balance.totalValue})`))- .catch((e) => console.warn(` wallet status unavailable: ${e.message} — run \`mm login\``));+ .then((s) =>+ console.log(+ ` agent wallet: ${s.wallet.address} (${s.balance.chains[0]?.usdc ?? 0} USDC, ${s.balance.chains[0]?.sol ?? '?'} SOL)`,+ ),+ )+ .catch((e) => console.warn(` wallet unavailable: ${e.message}`));});diff --git a/scripts/verify-cosmetics-buy.mjs b/scripts/verify-cosmetics-buy.mjsnew file mode 100644index 000000000..4a8f40be3--- /dev/null+++ b/scripts/verify-cosmetics-buy.mjs@@ -0,0 +1,69 @@+// Browser check for the cosmetics shop x402 wiring: open /play, open the+// Cosmetics shop, click a premium item's Buy button, and assert the x402+// payment widget loads and mounts its modal (the link that was broken — /play+// never shipped /x402.js, so Buy died on "payment widget still loading").+// A real settlement needs a funded wallet; this verifies up to the wallet UI.+//+// Usage: node scripts/verify-cosmetics-buy.mjs [BASE_URL] (default http://localhost:4173)++import { chromium } from 'playwright';++const BASE = process.argv[2] || 'http://localhost:4173';++const browser = await chromium.launch();+const page = await browser.newPage();+const errors = [];+page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); });+page.on('pageerror', (e) => errors.push(String(e)));++const x402Requests = [];+page.on('request', (r) => { if (r.url().includes('x402')) x402Requests.push(r.url()); });++await page.goto(`${BASE}/play`, { waitUntil: 'domcontentloaded', timeout: 60_000 });++// Skip the first-buy wallet explainer so the flow goes straight to the payment+// widget — the link this check exists to exercise.+await page.evaluate(() => localStorage.setItem('tws:onchain-primer:done', '1'));++// The shop is lazy-built on the HUD Shop button — click it once the world's+// HUD mounts. Dismiss the first-join onboarding overlay if it's in the way.+await page.waitForSelector('.cc-shop-btn', { state: 'attached', timeout: 90_000 });+await page.evaluate(() => {+ document.querySelector('.cc-onboard, .cc-onboard-overlay')?.remove();+ // The HUD button may be display:none until the player formally joins a+ // world; the handler itself is wired at construction — invoke it directly.+ document.querySelector('.cc-shop-btn').click();+});+await page.waitForSelector('#cc-shop:not([hidden])', { timeout: 30_000 });++// Wait for the real catalog to render, then click a premium Buy.+await page.waitForSelector('.cc-shop-card .cc-shop-buy', { timeout: 30_000 });+const buyLabel = await page.locator('.cc-shop-buy').first().getAttribute('aria-label');+console.log('clicking:', buyLabel);+await page.locator('.cc-shop-buy').first().click();++// Success = the x402 SDK was fetched and window.X402.pay mounted its modal.+await page.waitForFunction(() => window.X402 && typeof window.X402.pay === 'function', { timeout: 30_000 });+console.log('x402 SDK loaded: window.X402.pay is live');++// The widget mounts a dialog/overlay; give it a beat and look for it.+const modalSelector = '[class*="x402"], [id*="x402"], dialog';+await page.waitForSelector(modalSelector, { state: 'attached', timeout: 30_000 });+const modalInfo = await page.evaluate((sel) => {+ const n = document.querySelector(sel);+ return n ? `${n.tagName.toLowerCase()}.${n.className || n.id}` : null;+}, modalSelector);+console.log('payment UI mounted:', modalInfo);++const fetched402 = x402Requests.filter((u) => u.includes('/x402.js') || u.includes('cosmetic-purchase'));+console.log('x402 network activity:', fetched402.slice(0, 5));++await page.screenshot({ path: '/tmp/cosmetics-buy-check.png', fullPage: false });+console.log('screenshot: /tmp/cosmetics-buy-check.png');++const fatal = errors.filter((e) => !/favicon|404|Failed to load resource/i.test(e));+if (fatal.length) {+ console.error('console errors:', fatal.slice(0, 10));+ process.exitCode = 1;+}+await browser.close();diff --git a/scripts/verify-launches-page.mjs b/scripts/verify-launches-page.mjsnew file mode 100644index 000000000..5e4b95d88--- /dev/null+++ b/scripts/verify-launches-page.mjs@@ -0,0 +1,146 @@+// One-off verification harness for the /launches feed page + agent-detail+// launch history. Stubs only the not-yet-deployed /api/pump/launches action+// (dev proxies /api to prod); everything else hits the real proxy.+// Run: node scripts/verify-launches-page.mjs (expects vite on :4187)+import { chromium } from 'playwright';++const BASE = process.env.BASE_URL || 'http://localhost:4187';++const SYNTH = (n) => `THREEsynthetic${String(n).repeat(28)}`.slice(0, 40);++const STUB_LAUNCHES = {+ data: {+ launches: [+ {+ mint: SYNTH(1),+ network: 'mainnet',+ name: 'Test Coin One',+ symbol: 'TC1',+ buyback_bps: 250,+ metadata_uri: null,+ quote_mint: null,+ created_at: new Date(Date.now() - 3600e3).toISOString(),+ agent: {+ id: '11111111-2222-4333-8444-555555555555',+ name: 'Verifier Agent',+ url: '/agents/11111111-2222-4333-8444-555555555555',+ avatar_thumbnail_url: null,+ },+ },+ {+ mint: SYNTH(2),+ network: 'mainnet',+ name: 'Long Coin Name That Should Ellipsize Gracefully In The Card',+ symbol: 'LONGNAME',+ buyback_bps: 0,+ metadata_uri: null,+ quote_mint: null,+ created_at: new Date(Date.now() - 86400e3 * 3).toISOString(),+ agent: null,+ },+ ],+ has_more: true,+ offset: 0,+ limit: 24,+ network: 'mainnet',+ },+};++const results = [];+const check = (name, ok, extra = '') =>+ results.push(`${ok ? 'PASS' : 'FAIL'} ${name}${extra ? ` — ${extra}` : ''}`);++const browser = await chromium.launch();+const page = await browser.newPage();+const consoleErrors = [];+page.on('console', (m) => {+ if (m.type() === 'error') consoleErrors.push(m.text());+});+page.on('pageerror', (e) => consoleErrors.push(String(e)));++// ── 1. populated feed (stubbed registry, real everything else) ──────────────+await page.route('**/api/pump/launches*', (route) =>+ route.fulfill({ json: STUB_LAUNCHES }),+);+await page.goto(`${BASE}/launches`, { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.lx-card', { timeout: 10000 });+check('feed renders cards', (await page.locator('.lx-card').count()) === 2);+check('coin name shown', await page.locator('.lx-coin-name').first().textContent() === 'Test Coin One');+check('buyback badge', (await page.locator('.lx-badge-buyback').count()) === 1);+check('agent chip links to agent page',+ (await page.locator('.lx-agent-row[href="/agents/11111111-2222-4333-8444-555555555555"]').count()) === 1);+check('unknown agent fallback', (await page.locator('.lx-agent-row[aria-disabled]').count()) === 1);+check('load more button (has_more)', await page.locator('#lx-footer-state button').isVisible());+check('count label', /2\+ launches/.test(await page.locator('#lx-count').textContent()));+check('world link present', (await page.locator(`.lx-action[href="/communities/${SYNTH(1)}"]`).count()) === 1);+check('nav has Agent Launches link', (await page.locator('a[href="/launches"]').count()) >= 1);++// hover/focus states exist (computed style changes are CSS-driven; just assert focusability)+await page.locator('.lx-agent-row').first().focus();+check('agent row focusable', await page.evaluate(() => document.activeElement?.classList.contains('lx-agent-row')));++// ── 2. empty state ───────────────────────────────────────────────────────────+await page.unroute('**/api/pump/launches*');+await page.route('**/api/pump/launches*', (route) =>+ route.fulfill({ json: { data: { launches: [], has_more: false, offset: 0, limit: 24, network: 'mainnet' } } }),+);+await page.goto(`${BASE}/launches`, { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.lx-state', { timeout: 10000 });+check('empty state has CTA', await page.locator('.lx-state a[href="/create-agent"]').isVisible());++// ── 3. error state (real proxy → prod, where action 404s until deploy) ──────+await page.unroute('**/api/pump/launches*');+await page.goto(`${BASE}/launches`, { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.lx-state[role="alert"], .lx-card', { timeout: 15000 });+const errVisible = (await page.locator('.lx-state[role="alert"]').count()) === 1;+const liveCards = await page.locator('.lx-card').count();+check('error state OR live data from prod', errVisible || liveCards > 0,+ errVisible ? 'error state w/ retry (endpoint not deployed yet)' : `${liveCards} live cards`);+if (errVisible) check('retry button present', await page.locator('.lx-state button').isVisible());++// ── 4. devnet toggle + url sync ──────────────────────────────────────────────+await page.route('**/api/pump/launches*', (route) => {+ const url = new URL(route.request().url());+ check('toggle requests devnet', url.searchParams.get('network') === 'devnet');+ route.fulfill({ json: { data: { launches: [], has_more: false, offset: 0, limit: 24, network: 'devnet' } } });+});+await page.locator('.lx-net-btn[data-network="devnet"]').click();+await page.waitForSelector('.lx-state', { timeout: 10000 });+check('url carries network=devnet', page.url().includes('network=devnet'));++// ── 5. agent-detail launch history (stub by-agent) ──────────────────────────+const AGENT_ID = '11111111-2222-4333-8444-555555555555';+await page.route('**/api/agents/**', (route) =>+ route.fulfill({+ json: { agent: { id: AGENT_ID, name: 'Verifier Agent', description: 'test', skills: [], meta: {}, onchain: null, token: null, payments: null, is_registered: false } },+ }),+);+await page.route('**/api/pump/by-agent*', (route) =>+ route.fulfill({+ json: {+ data: { mint: SYNTH(3), network: 'mainnet', name: 'History Coin', symbol: 'HC3', buyback_bps: 0, created_at: new Date().toISOString() },+ coins: [+ { mint: SYNTH(3), network: 'mainnet', name: 'History Coin', symbol: 'HC3', buyback_bps: 0, created_at: new Date().toISOString() },+ { mint: SYNTH(4), network: 'devnet', name: 'Old Coin', symbol: 'OLD4', buyback_bps: 100, created_at: new Date(Date.now() - 86400e3 * 10).toISOString() },+ ],+ },+ }),+);+await page.goto(`${BASE}/agents/${AGENT_ID}`, { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.ad-launch-history', { timeout: 15000 });+check('agent page launch history renders', (await page.locator('.ad-launch-row').count()) === 2);+check('history head shows count', /Launched coins \(2\)/.test(await page.locator('.ad-launch-history-head').textContent()));+check('feed link on agent page',+ (await page.locator(`.ad-launch-feed-link[href="/launches?agent_id=${AGENT_ID}"]`).count()) === 1);+check('devnet row links to explorer',+ (await page.locator('.ad-launch-row[href*="explorer.solana.com"]').count()) === 1);++// ── report ───────────────────────────────────────────────────────────────────+const ownErrors = consoleErrors.filter(+ (e) => !/posthog|client-errors|favicon|x402|third-party|net::ERR|Failed to load resource/i.test(e),+);+check('no console errors from our code', ownErrors.length === 0, ownErrors.slice(0, 3).join(' | '));++console.log(results.join('\n'));+await browser.close();+process.exit(results.some((r) => r.startsWith('FAIL')) ? 1 : 0);diff --git a/scripts/zauth-reposcan-smoke.mjs b/scripts/zauth-reposcan-smoke.mjsnew file mode 100644index 000000000..6ec2bfea5--- /dev/null+++ b/scripts/zauth-reposcan-smoke.mjs@@ -0,0 +1,123 @@+// One real, settled x402 USDC payment to zauth's RepoScan endpoint — the+// upstream behind /api/zauth-reposcan and the zauth security agent in /play.+//+// node scripts/zauth-reposcan-smoke.mjs [--repo owner/repo] [--dry]+// ZAUTH_SCAN_URL=https://three.ws/api/zauth-reposcan node scripts/zauth-reposcan-smoke.mjs+//+// Uses the official @x402 client (hand-rolled envelopes are rejected by+// zauth's facilitator — verified: sweep-style payloads bounce with an+// instant 402). Logs the exact request header + payload shape the official+// client sends so the pass-through route can stay faithful to it. Wallet:+// WALLET_PATH env or .secrets/test-registry-wallet.json (USDC on Solana+// mainnet; the facilitator pays the tx fee).++import { readFileSync } from 'node:fs';+import { createKeyPairSignerFromBytes } from '@solana/kit';+import { wrapFetchWithPayment, x402Client } from '@x402/fetch';+import { registerExactSvmScheme } from '@x402/svm/exact/client';+import bs58 from 'bs58';++const SCAN_URL = process.env.ZAUTH_SCAN_URL || 'https://api.zauth.inc/x402/reposcan';+const WALLET_PATH = process.env.WALLET_PATH || new URL('../.secrets/test-registry-wallet.json', import.meta.url).pathname;+const RPC = process.env.SOLANA_RPC || 'https://api.mainnet-beta.solana.com';++const repoArg = process.argv.indexOf('--repo');+const REPO = repoArg >= 0 ? process.argv[repoArg + 1] : 'nirholas/three.ws';+const DRY = process.argv.includes('--dry');++function loadSecretKeyBytes() {+ const raw = JSON.parse(readFileSync(WALLET_PATH, 'utf8'));+ const dec = bs58.default ? bs58.default.decode : bs58.decode;+ if (Array.isArray(raw)) return Uint8Array.from(raw);+ if (raw.secretKeyArray) return Uint8Array.from(raw.secretKeyArray);+ if (raw.secretKeyBase58) return dec(raw.secretKeyBase58);+ throw new Error('unrecognized wallet file shape');+}++// Log every request the payment client makes — header names and (redacted)+// payment payload — so the wire format is documented for the proxy route.+// The wrapper passes Request objects, so read from those, not init.+function loggingFetch(input, init) {+ const req = typeof input === 'string' ? new Request(input, init) : input;+ const names = [...req.headers.keys()];+ console.error(`→ ${req.method} ${req.url} headers: [${names.join(', ')}]`);+ for (const name of names) {+ if (/payment/i.test(name)) {+ const value = req.headers.get(name);+ try {+ const decoded = JSON.parse(Buffer.from(value, 'base64').toString('utf8'));+ if (decoded?.payload?.transaction) decoded.payload.transaction = `<${decoded.payload.transaction.length} chars>`;+ console.error(` ${name}: ${JSON.stringify(decoded)}`);+ } catch {+ console.error(` ${name}: <unparsed, ${String(value).length} chars>`);+ }+ }+ }+ return fetch(input, init);+}++// Upstream's input field is repoUrl (a paid 400 told us: "repoUrl is+// required" — the `repo` shorthand bounces AFTER payment middleware).+const body = JSON.stringify({ repoUrl: `https://github.com/${REPO}` });+console.error(`scan target: ${REPO}\nendpoint: ${SCAN_URL}`);++if (DRY) {+ const probe = await fetch(SCAN_URL, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body,+ signal: AbortSignal.timeout(30_000),+ });+ const header = probe.headers.get('payment-required');+ const challenge = header ? JSON.parse(Buffer.from(header, 'base64').toString('utf8')) : await probe.json();+ console.error(`probe: HTTP ${probe.status}`);+ console.log(JSON.stringify(challenge, null, 2));+ process.exit(0);+}++const signer = await createKeyPairSignerFromBytes(loadSecretKeyBytes());+console.error(`payer: ${signer.address}`);++const client = new x402Client();+registerExactSvmScheme(client, { signer, config: { rpcUrl: RPC } });+const fetchWithPay = wrapFetchWithPayment(loggingFetch, client);++const t0 = Date.now();+const res = await fetchWithPay(SCAN_URL, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body,+});+const text = await res.text();+console.error(`\npaid call: HTTP ${res.status} in ${Date.now() - t0}ms`);+const settleHeader = res.headers.get('x-payment-response');+if (settleHeader) {+ try { console.error('settle:', Buffer.from(settleHeader, 'base64').toString('utf8')); } catch {}+}+console.log('body:', text.slice(0, 4000));+if (res.status !== 200) process.exit(1);++// If the scan came back as a polling session, follow it so the full response+// shape (the one the in-game panel renders) is captured in one run.+let parsed = null;+try { parsed = JSON.parse(text); } catch {}+const session = parsed?.sessionToken || parsed?.session_token || parsed?.session || parsed?.token;+if (typeof session === 'string') {+ console.error(`\npolling session ${session.slice(0, 12)}…`);+ const pollBase = SCAN_URL.includes('/api/zauth-reposcan')+ ? `${SCAN_URL}?session=${encodeURIComponent(session)}`+ : `${SCAN_URL}/${encodeURIComponent(session)}`;+ for (let i = 0; i < 60; i++) {+ await new Promise((r) => setTimeout(r, 5000));+ const poll = await fetch(pollBase, { headers: { accept: 'application/json' }, signal: AbortSignal.timeout(20_000) });+ const pollText = await poll.text();+ let pollBody = null;+ try { pollBody = JSON.parse(pollText); } catch {}+ const status = pollBody?.status || pollBody?.state || `http_${poll.status}`;+ console.error(` [${i}] ${status}`);+ if (poll.status !== 200 || !pollBody || !/pending|running|processing|queued|scanning|in_progress|analyzing/i.test(String(status))) {+ console.log('final:', pollText.slice(0, 8000));+ break;+ }+ }+}diff --git a/src/agent-detail.css b/src/agent-detail.cssindex 196e5fa35..62a42294a 100644--- a/src/agent-detail.css+++ b/src/agent-detail.css@@ -2064,3 +2064,78 @@ a {transition: none;}}++/* ── Launch history (pump_agent_mints registry) ────────────────────────────── */+.ad-launch-history {+ margin-top: 14px;+ border-top: 1px solid var(--ad-line);+ padding-top: 12px;+ display: flex;+ flex-direction: column;+ gap: 6px;+}+.ad-launch-history-head {+ font-size: 11px;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ color: var(--ad-dim);+ margin-bottom: 2px;+}+.ad-launch-row {+ display: flex;+ align-items: baseline;+ gap: 10px;+ padding: 7px 10px;+ border-radius: 8px;+ border: 1px solid transparent;+ text-decoration: none;+ color: var(--ad-text);+ font-size: 13px;+ transition:+ background 0.15s,+ border-color 0.15s;+}+.ad-launch-row:hover {+ background: rgba(255, 255, 255, 0.04);+ border-color: var(--ad-line);+}+.ad-launch-row:focus-visible {+ outline: 2px solid var(--ad-cyan);+ outline-offset: 2px;+}+.ad-launch-symbol {+ font-weight: 600;+ min-width: 0;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}+.ad-launch-mint {+ color: var(--ad-dim);+ font-size: 12px;+}+.ad-launch-mcap {+ margin-left: auto;+ font-variant-numeric: tabular-nums;+ color: var(--ad-muted);+ font-size: 12px;+}+.ad-launch-time {+ color: var(--ad-dim);+ font-size: 12px;+ white-space: nowrap;+}+.ad-launch-feed-link {+ margin-top: 6px;+ font-size: 12.5px;+ color: var(--ad-muted);+ text-decoration: none;+ transition: color 0.15s;+}+.ad-launch-feed-link:hover {+ color: var(--ad-text);+}+.ad-launch-feed-link:focus-visible {+ outline: 2px solid var(--ad-cyan);+ outline-offset: 2px;+}diff --git a/src/agent-detail.js b/src/agent-detail.jsindex 1a5e526fc..691b8d5ec 100644--- a/src/agent-detail.js+++ b/src/agent-detail.js@@ -95,6 +95,103 @@ function pill(text, accent = '') {return el('span', { class: `ad-pill ${accent ? `ad-pill-${accent}` : ''}`, text });}+// ── Launch history ───────────────────────────────────────────────────────────+// Every coin this agent has launched through the platform, newest first, from+// GET /api/pump/by-agent (pump_agent_mints registry). Live market caps stream+// in per row from /api/pump/coin. Links into the public /launches feed.++function launchTimeAgo(iso) {+ const t = new Date(iso).getTime();+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, (Date.now() - t) / 1000);+ if (s < 3600) return `${Math.max(1, Math.floor(s / 60))}m ago`;+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;+ if (s < 86400 * 30) return `${Math.floor(s / 86400)}d ago`;+ return new Date(t).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });+}++function launchUsdCompact(n) {+ if (!Number.isFinite(n)) return '';+ if (n >= 1e9) return `$${(n / 1e9).toFixed(2)}B`;+ if (n >= 1e6) return `$${(n / 1e6).toFixed(2)}M`;+ if (n >= 1e3) return `$${(n / 1e3).toFixed(1)}K`;+ return `$${n.toFixed(0)}`;+}++async function renderLaunchHistory(container, agent) {+ if (!agent.id) return;+ let coins = [];+ try {+ const r = await fetch(`/api/pump/by-agent?agent_id=${encodeURIComponent(agent.id)}`);+ if (!r.ok) return;+ const body = await r.json();+ coins = Array.isArray(body.coins) ? body.coins : [];+ } catch {+ return; // history is supplementary — the primary token chip still renders+ }+ if (!coins.length) return;++ // A single launch that is already shown as the agent token chip above would+ // be pure duplication — just add the public-feed link in that case.+ const onlyDuplicatesChip =+ coins.length === 1 && agent.token && coins[0].mint === agent.token.mint;++ container.classList.remove('ad-muted');+ if (container.textContent === 'No agent token linked for this agent yet.') {+ container.textContent = '';+ }++ const box = el('div', { class: 'ad-launch-history' });++ if (!onlyDuplicatesChip) {+ box.appendChild(+ el('div', { class: 'ad-launch-history-head', text: `Launched coins (${coins.length})` }),+ );+ for (const coin of coins) {+ const isDevnet = coin.network === 'devnet';+ const href = isDevnet+ ? `https://explorer.solana.com/address/${coin.mint}?cluster=devnet`+ : `https://pump.fun/${coin.mint}`;+ const mcapEl = el('span', { class: 'ad-launch-mcap' });+ const row = el(+ 'a',+ {+ class: 'ad-launch-row',+ href,+ target: '_blank',+ rel: 'noopener noreferrer',+ 'aria-label': `${coin.symbol || coin.name || 'coin'} on ${isDevnet ? 'Solana Explorer' : 'pump.fun'}`,+ },+ [+ el('span', { class: 'ad-launch-symbol', text: coin.symbol ? `$${coin.symbol}` : coin.name || '—' }),+ el('span', { class: 'ad-mono ad-launch-mint', text: shortAddr(coin.mint) }),+ mcapEl,+ el('span', { class: 'ad-launch-time', text: launchTimeAgo(coin.created_at) }),+ ],+ );+ box.appendChild(row);+ if (!isDevnet) {+ fetch(`/api/pump/coin?mint=${encodeURIComponent(coin.mint)}`)+ .then((r) => (r.ok ? r.json() : null))+ .then((c) => {+ const cap = Number(c?.usd_market_cap);+ if (Number.isFinite(cap)) mcapEl.textContent = launchUsdCompact(cap);+ })+ .catch(() => {});+ }+ }+ }++ box.appendChild(+ el('a', {+ class: 'ad-launch-feed-link',+ href: `/launches?agent_id=${encodeURIComponent(agent.id)}`,+ text: 'View in the public launch feed →',+ }),+ );+ container.appendChild(box);+}+// ── Holder cohorts panel ─────────────────────────────────────────────────────// Renders the live holder segmentation for an agent token from// GET /api/coin/:mint/cohorts. Self-manages loading / empty / error / populated@@ -389,6 +486,10 @@ function render(agent) {$('ad-token-body').appendChild(launchBtn);}+ // Full launch history from the pump_agent_mints registry — fire-and-forget;+ // renders nothing extra when the agent has no launches beyond the chip above.+ renderLaunchHistory($('ad-token-body'), agent);+$('ad-rewards').textContent = String(agent.creatorRewards ?? 0);const mechs = $('ad-trust-mechs');diff --git a/src/game/coincommunities-ui.js b/src/game/coincommunities-ui.jsindex 160779745..cad8ff643 100644--- a/src/game/coincommunities-ui.js+++ b/src/game/coincommunities-ui.js@@ -236,6 +236,7 @@ export class CommunityUI {['/three-live', '$THREE Live', 'Protocol pulse — live trades in 3D', 'New'],['/pump-visualizer', 'Pump Visualizer', '3D view of trending tokens'],['/club', 'Pole Club', 'x402 micro-tip demo — $0.001 / dance', 'New'],+ ['/play/agent-wallet', 'Agent Wallet', 'Your avatar pays an endpoint — USDC on Solana', 'New'],], true],];diff --git a/src/game/coincommunities.js b/src/game/coincommunities.jsindex 44fb7374b..67109f0cc 100644--- a/src/game/coincommunities.js+++ b/src/game/coincommunities.js@@ -43,10 +43,12 @@ import { AccessoryManager } from '../agent-accessories.js';import { CosmeticsShop } from './cosmetics-shop.js';import { HOME_TOWN, isHomeTown } from './home-town.js';import { AgentCommerce } from './agent-commerce.js';+import { ThreeIntelKiosk } from './three-intel-kiosk.js';import { WorldLife } from './npc/world-life.js';import { isChatPanelOpen } from './npc/npc-chat.js';import { isServicePanelOpen } from './npc/npc-services.js';import { isAixbtPanelOpen } from './npc/npc-aixbt.js';+import { isZauthPanelOpen } from './npc/npc-zauth.js';import { VoiceChat, voiceSupported } from './voice-chat.js';import { requestHolderPass, signInWithX, ensureSolanaWallet, relinkSolanaWallet, getSession, getWorldGate, setWorldGate } from '../community/town-auth.js';import { ensurePlayAccess } from './play-gate.js';@@ -900,6 +902,15 @@ export class CoinCommunities {getPlayer: () => this.localPos,ui: this.ui,});+ // …and the $THREE Intel Kiosk: the player pays a real x402 endpoint+ // ($0.01 USDC) from their own wallet for live $THREE market intel.+ this.intelKiosk = new ThreeIntelKiosk({+ scene: this.scene,+ camera: this.camera,+ renderer: this.renderer,+ getPlayer: () => this.localPos,+ ui: this.ui,+ });}// Living world (W08): ambient pedestrians + traffic, interactive vendor /// quest / flavor NPCs, and (gated behind W07) hostile mobs — all on a@@ -1140,6 +1151,7 @@ export class CoinCommunities {if (this.net) { this.net.destroy(); this.net = null; }if (this.playSystems) { this.playSystems.dispose(); this.playSystems = null; }if (this.agentCommerce) { this.agentCommerce.dispose(); this.agentCommerce = null; }+ if (this.intelKiosk) { this.intelKiosk.dispose(); this.intelKiosk = null; }if (this.worldLife) { this.worldLife.dispose(); this.worldLife = null; }if (this._onboard) { this._onboard.dispose(); this._onboard = null; }// Close the shop and drop the rig binding — the next world rebuilds both.@@ -1418,10 +1430,11 @@ export class CoinCommunities {e.preventDefault();// A conversation or counter is already open — let it own the moment// instead of reopening on top of itself.- if (isChatPanelOpen() || isServicePanelOpen() || isAixbtPanelOpen()) return;+ if (isChatPanelOpen() || isServicePanelOpen() || isAixbtPanelOpen() || isZauthPanelOpen()) return;// Talk to the nearest townsperson (vendor/quest/flavor); if none is- // in range, fall through to the home town's Agent Exchange.- if (!this.worldLife?.interact()) this.agentCommerce?.interact();+ // in range, try the $THREE Intel Kiosk, then fall through to the+ // home town's Agent Exchange.+ if (!this.worldLife?.interact() && !this.intelKiosk?.interact()) this.agentCommerce?.interact();return;}// F casts a line when standing by a pond (no-op elsewhere). Not while@@ -1470,6 +1483,7 @@ export class CoinCommunities {// touch-native equivalent of pressing E. Checked before the chart screen.if (this.worldLife?.tryActivateAt(e.clientX, e.clientY)) return;if (this.agentCommerce?.tryActivateAt(this._pointerRay(e.clientX, e.clientY))) return;+ if (this.intelKiosk?.tryActivateAt(this._pointerRay(e.clientX, e.clientY))) return;if (this._raycastScreen(e.clientX, e.clientY)) this._chartScreen.openExternal();});// Right-click always breaks the targeted block while building.@@ -2160,6 +2174,7 @@ export class CoinCommunities {this._updateVoice();this.playSystems?.tick(dt);this.agentCommerce?.tick(dt);+ this.intelKiosk?.tick(dt);if (this.worldLife) { this.worldLife.setRealPeers(this.remotes.size); this.worldLife.tick(dt); }if (this.net) this.net.sendMove({ x: this.localPos.x, y: this.localPos.y, z: this.localPos.z, yaw: this.localYaw, motion: this.motion });}diff --git a/src/game/cosmetics-purchase.js b/src/game/cosmetics-purchase.jsindex 49f98ed65..e9233ca6d 100644--- a/src/game/cosmetics-purchase.js+++ b/src/game/cosmetics-purchase.js@@ -18,6 +18,7 @@// the rail charges — never surfaced as a coin to hold.import { loadStoredPass } from './play-auth.js';+import { ensureX402 } from '../shared/x402-loader.js';const PURCHASE_ENDPOINT = '/api/x402/cosmetic-purchase';const OWNED_ENDPOINT = '/api/cosmetics/owned';@@ -40,13 +41,20 @@ export function resolveShopAccount(explicitWallet) {}}+// The coin world the player is currently in, from the /play deep link+// (?coin=<mint> survives navigation). '' outside a coin world.+function currentWorldMint() {+ try {+ return new URLSearchParams(window.location.search).get('coin') || '';+ } catch {+ return '';+ }+}+// Run the x402 USDC payment for one cosmetic. Resolves with the settled ticket// ({ ok, owned, newlyOwned, payer, network, … }); rejects with an Error on// failure or { code:'cancelled' } when the buyer dismisses the wallet.export async function purchaseCosmetic(item, { account, coin } = {}) {- if (!window.X402?.pay) {- throw new Error('Payment widget still loading — try again in a second.');- }if (!item?.id) throw new Error('Pick a cosmetic to buy.');const acct = account || resolveShopAccount();if (!acct) throw new Error('No account to attach this purchase to.');@@ -74,7 +82,11 @@ export async function purchaseCosmetic(item, { account, coin } = {}) {const coinParam = coinMint && /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(coinMint)? `&coin=${encodeURIComponent(coinMint)}` : '';const url = `${PURCHASE_ENDPOINT}?id=${encodeURIComponent(item.id)}&account=${encodeURIComponent(acct)}${coinParam}`;- const out = await window.X402.pay({+ // The /play world page doesn't ship the payment widget in its HTML — load it+ // on demand here (cached after the first buy), same as every other in-world+ // paid surface (NPC services, intel kiosk).+ const X402 = await ensureX402();+ const out = await X402.pay({endpoint: url,method: 'GET',merchant: 'three.ws Avatar Shop',diff --git a/src/game/npc/npc-catalog.js b/src/game/npc/npc-catalog.jsindex 20df59785..97a1395ab 100644--- a/src/game/npc/npc-catalog.js+++ b/src/game/npc/npc-catalog.js@@ -16,10 +16,12 @@import { isHomeTown } from '../home-town.js';import { openChat } from './npc-chat.js';import { openAixbtTerminal } from './npc-aixbt.js';+import { openZauthScanner } from './npc-zauth.js';const AVATAR_A = '/avatars/default.glb';const AVATAR_B = '/avatars/cz.glb';const AVATAR_AIXBT = '/avatars/michelle.glb';+const AVATAR_ZAUTH = '/avatars/xbot.glb';// Bind an NPC to a conversation. On interact the NPC greets in-world, plays a// beat, and opens a real chat: it answers in character, live from the same models@@ -60,6 +62,30 @@ export function npcCatalogFor(world) {},});+ // zauth — the security agent (zauth.inc). Walking up calls their real+ // x402 RepoScan endpoint live (the unpaid 402 probe) and opens the+ // scanner with the price from that challenge; the scan itself is $0.05+ // USDC from the player's wallet, paid straight to zauth (npc-zauth.js).+ list.push({+ id: 'npc-zauth',+ name: 'zauth · Security',+ role: 'vendor',+ avatar: AVATAR_ZAUTH,+ pos: { x: 6, z: 2 },+ yaw: Math.atan2(-6, -2),+ range: 5,+ prompt: 'Run a security scan',+ onApproach: ({ npc, ui }) => {+ npc.say('Hold it — I scan repos before agents trust them. Name one, I tear it apart for five cents.');+ npc.emote('av-call-me');+ openZauthScanner(npc, { ui });+ },+ onInteract: ({ npc, ui }) => {+ npc.say('Provenance, contributors, vulnerabilities. One scan, one score.');+ openZauthScanner(npc, { ui });+ },+ });+// Marisol — the trading desk. Sells live market signals (crypto-intel).list.push({id: 'svc-crypto-intel',diff --git a/src/game/npc/npc-services.js b/src/game/npc/npc-services.jsindex bc857517d..917827bae 100644--- a/src/game/npc/npc-services.js+++ b/src/game/npc/npc-services.js@@ -16,30 +16,10 @@// { ok, result } where `result` is the endpoint's 200 JSON body.//// The x402 SDK (public/x402.js) is not loaded by the world page, so we import-// it on demand the first time a player transacts — one network fetch, cached.+// it on demand the first time a player transacts — one network fetch, cached+// (src/shared/x402-loader.js).-// ── x402 SDK loader ──────────────────────────────────────────────────────────-// public/x402.js is an ES module that freezes window.X402 on evaluation. It-// lives at the site root in dev (Vite serves /public) and prod (copied to /).-let x402Loading = null;-function ensureX402() {- if (typeof window !== 'undefined' && window.X402 && typeof window.X402.pay === 'function') {- return Promise.resolve(window.X402);- }- if (!x402Loading) {- const url = '/x402.js';- x402Loading = import(/* @vite-ignore */ url).catch((err) => {- x402Loading = null; // let a later interaction retry a transient failure- throw err;- });- }- return x402Loading.then(() => {- if (!window.X402 || typeof window.X402.pay !== 'function') {- throw new Error('Payment library failed to load.');- }- return window.X402;- });-}+import { ensureX402 } from '../../shared/x402-loader.js';// ── tiny DOM helper (self-contained; mirrors the app's el() conventions) ──────function el(tag, attrs, kids) {diff --git a/src/game/npc/npc-zauth.js b/src/game/npc/npc-zauth.jsnew file mode 100644index 000000000..00af8ccef--- /dev/null+++ b/src/game/npc/npc-zauth.js@@ -0,0 +1,498 @@+// zauth — the town's security agent.+//+// zauth (zauth.inc) runs RepoScan, a real paid x402 service: $0.05 USDC buys+// a GitHub repository scan for code provenance, contributor verification,+// and vulnerabilities, returning a 0–100 trust score with a full written+// analysis. Their agent stands in the $THREE town plaza; WALKING UP to it+// calls their x402 endpoint live (the unpaid probe that draws the 402+// payment challenge) and opens the scanner with the real price and terms+// from that challenge. Press the scan button and window.X402.pay settles+// $0.05 from YOUR wallet straight to zauth's address — Solana or Base — via+// the same-origin pass-through at /api/zauth-reposcan (their CORS blocks a+// direct browser payment; the proxy forwards your signed payment untouched).+//+// Scans run 3–6 minutes on zauth's side. The scan keeps polling after the+// panel closes: wander off, and the agent shouts when your report is ready.+//+// Self-contained: reuses the .npc-svc-* panel chrome + the shared overlay+// lifecycle, with a small .zauth-* stylesheet injected once.++import { ensureX402 } from '../../shared/x402-loader.js';+import { log } from '../../shared/log.js';++const ENDPOINT = '/api/zauth-reposcan';+const DEFAULT_REPO = 'nirholas/three.ws';+const REPO_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;+const POLL_MS = 5000;+const SCAN_MAX_MS = 15 * 60_000;+const ACCENT = '#46d49a';+const ACCENT_LT = '#8df0c4';++// ── tiny DOM helper (mirrors npc-services.js conventions) ─────────────────────+function el(tag, attrs, kids) {+ const node = document.createElement(tag);+ if (attrs) {+ for (const [k, v] of Object.entries(attrs)) {+ if (v == null || v === false) continue;+ if (k === 'class') node.className = v;+ else if (k === 'text') node.textContent = v;+ else if (k.startsWith('on') && typeof v === 'function')+ node.addEventListener(k.slice(2).toLowerCase(), v);+ else node.setAttribute(k, v === true ? '' : v);+ }+ }+ for (const kid of [].concat(kids || [])) {+ if (kid == null || kid === false) continue;+ node.appendChild(typeof kid === 'string' ? document.createTextNode(kid) : kid);+ }+ return node;+}++function injectStyles() {+ if (document.getElementById('zauth-term-styles')) return;+ const s = document.createElement('style');+ s.id = 'zauth-term-styles';+ s.textContent = `+ .npc-svc-card.is-zauth { max-width: 680px; }+ .zauth-live { display:inline-flex; align-items:center; gap:5px; font-size:10px; font-weight:800; letter-spacing:0.08em; color:${ACCENT}; }+ .zauth-live::before { content:''; width:7px; height:7px; border-radius:50%; background:${ACCENT}; box-shadow:0 0 8px ${ACCENT}; animation:zauth-pulse 1.6s ease-in-out infinite; }+ @keyframes zauth-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }+ .zauth-ask { font-size:13px; color:var(--cc-text,#e9e9ec); margin:2px 0 12px; line-height:1.5; }+ .zauth-meta-row { display:flex; gap:8px; flex-wrap:wrap; margin:0 0 14px; }+ .zauth-chip { font-size:11px; font-weight:700; letter-spacing:0.04em; color:var(--cc-muted,#9a9aa2); border:1px solid var(--cc-edge,rgba(255,255,255,0.14)); border-radius:999px; padding:4px 11px; }+ .zauth-chip.is-price { color:#06241a; background:${ACCENT}; border-color:${ACCENT}; }+ .zauth-form { display:flex; gap:8px; margin:2px 0 6px; }+ .zauth-form .npc-svc-input { margin:0; flex:1 1 auto; }+ .zauth-go { flex:0 0 auto; border:1px solid var(--cc-edge,rgba(255,255,255,0.14)); background:rgba(70,212,154,0.14); color:${ACCENT_LT}; font-weight:800; border-radius:var(--cc-radius,4px); padding:0 16px; cursor:pointer; transition:background .15s ease, transform .12s ease; }+ .zauth-go:hover { background:rgba(70,212,154,0.26); transform:translateY(-1px); }+ .zauth-go:active { transform:translateY(0); }+ .zauth-go:focus-visible { outline:2px solid ${ACCENT}; outline-offset:2px; }+ .zauth-go:disabled { opacity:0.5; cursor:default; transform:none; }+ .zauth-hint { font-size:11.5px; color:var(--cc-muted,#9a9aa2); margin:8px 0 0; line-height:1.45; }+ .zauth-error { color:#ffb4be; font-size:13px; padding:12px 0; line-height:1.45; }+ .zauth-skel { height:46px; border-radius:6px; background:linear-gradient(90deg,rgba(255,255,255,0.05),rgba(255,255,255,0.11),rgba(255,255,255,0.05)); background-size:200% 100%; animation:zauth-shimmer 1.2s linear infinite; margin-bottom:8px; }+ @keyframes zauth-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }+ /* scan progress */+ .zauth-scan-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin:4px 0 10px; }+ .zauth-scan-repo { font-size:13.5px; font-weight:800; color:var(--cc-text,#e9e9ec); overflow-wrap:anywhere; }+ .zauth-scan-clock { font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; color:${ACCENT_LT}; }+ .zauth-bar { height:4px; border-radius:2px; background:rgba(255,255,255,0.08); overflow:hidden; margin-bottom:10px; }+ .zauth-bar-fill { display:block; height:100%; width:38%; border-radius:2px; background:linear-gradient(90deg,${ACCENT},#7aa8ff); animation:zauth-sweep 1.8s ease-in-out infinite; }+ @keyframes zauth-sweep { 0%{transform:translateX(-100%)} 100%{transform:translateX(280%)} }+ /* report */+ .zauth-report-head { display:flex; align-items:center; gap:16px; margin:4px 0 14px; }+ .zauth-score { flex:0 0 auto; width:78px; height:78px; border-radius:50%; display:grid; place-items:center; position:relative; }+ .zauth-score::before { content:''; position:absolute; inset:6px; border-radius:50%; background:var(--cc-panel-solid,#0c0c0e); }+ .zauth-score-n { position:relative; font-size:24px; font-weight:800; font-variant-numeric:tabular-nums; }+ .zauth-score-cap { display:block; position:relative; font-size:9px; font-weight:700; letter-spacing:0.08em; color:var(--cc-muted,#9a9aa2); text-align:center; }+ .zauth-verdict { min-width:0; }+ .zauth-verdict-t { font-size:15px; font-weight:800; margin:0 0 3px; }+ .zauth-verdict-d { font-size:12px; color:var(--cc-muted,#9a9aa2); line-height:1.45; }+ .zauth-md { font-size:13px; line-height:1.55; color:var(--cc-text,#e9e9ec); }+ .zauth-md h3 { font-size:13px; font-weight:800; letter-spacing:0.05em; text-transform:uppercase; color:${ACCENT_LT}; margin:18px 0 7px; }+ .zauth-md h3:first-child { margin-top:2px; }+ .zauth-md h4 { font-size:12.5px; font-weight:800; margin:13px 0 5px; }+ .zauth-md p { margin:0 0 9px; }+ .zauth-md ul { margin:0 0 9px; padding-left:18px; }+ .zauth-md li { margin-bottom:4px; }+ .zauth-md a { color:${ACCENT_LT}; text-decoration:none; border-bottom:1px solid rgba(141,240,196,0.4); overflow-wrap:anywhere; }+ .zauth-md a:hover { border-bottom-color:${ACCENT_LT}; }+ .zauth-md code { font-family:ui-monospace,monospace; font-size:12px; background:rgba(255,255,255,0.07); border-radius:3px; padding:1px 5px; overflow-wrap:anywhere; }+ .zauth-again { margin-top:14px; }`;+ document.head.appendChild(s);+}++// ── safe markdown rendering (zauth returns analysisMarkdown) ──────────────────+// Built with DOM nodes only — upstream text never reaches innerHTML.+const INLINE_RE = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`/g;++function inlineNodes(text) {+ const out = [];+ let last = 0;+ for (const m of text.matchAll(INLINE_RE)) {+ if (m.index > last) out.push(document.createTextNode(text.slice(last, m.index)));+ if (m[2]) out.push(el('a', { href: m[2], target: '_blank', rel: 'noopener noreferrer', text: m[1] }));+ else if (m[3]) out.push(el('strong', { text: m[3] }));+ else out.push(el('code', { text: m[4] }));+ last = m.index + m[0].length;+ }+ if (last < text.length) out.push(document.createTextNode(text.slice(last)));+ return out;+}++function renderMarkdown(md) {+ const root = el('div', { class: 'zauth-md' });+ let list = null;+ let para = [];+ const flushPara = () => {+ if (para.length) {+ root.appendChild(el('p', {}, inlineNodes(para.join(' '))));+ para = [];+ }+ };+ const flushList = () => { list = null; };+ for (const raw of String(md || '').split('\n')) {+ const line = raw.trim();+ if (!line) { flushPara(); flushList(); continue; }+ const h = line.match(/^(#{1,4})\s+(.*)$/);+ if (h) {+ flushPara(); flushList();+ root.appendChild(el(h[1].length <= 2 ? 'h3' : 'h4', {}, inlineNodes(h[2])));+ continue;+ }+ const li = line.match(/^[-*]\s+(.*)$/) || line.match(/^\d+\.\s+(.*)$/);+ if (li) {+ flushPara();+ if (!list) { list = el('ul'); root.appendChild(list); }+ list.appendChild(el('li', {}, inlineNodes(li[1])));+ continue;+ }+ flushList();+ para.push(line);+ }+ flushPara();+ return root;+}++function scoreTone(score) {+ if (score >= 75) return { color: '#43d6a0', label: 'Looks trustworthy' };+ if (score >= 50) return { color: '#f5a623', label: 'Mixed signals' };+ return { color: '#ff7a8a', label: 'Tread carefully' };+}++function scoreBadge(score) {+ const n = Math.max(0, Math.min(100, Math.round(Number(score) || 0)));+ const { color } = scoreTone(n);+ const badge = el('div', { class: 'zauth-score', role: 'img', 'aria-label': `zauth trust score ${n} out of 100` });+ badge.style.background = `conic-gradient(${color} ${n * 3.6}deg, rgba(255,255,255,0.09) 0)`;+ badge.appendChild(el('span', { class: 'zauth-score-n' }, [+ String(n),+ el('span', { class: 'zauth-score-cap', text: '/100' }),+ ]));+ badge.querySelector('.zauth-score-n').style.color = color;+ return badge;+}++// ── live challenge probe — the x402 call made on walk-up ──────────────────────+// An unpaid POST draws the real 402 payment challenge from zauth (via the+// pass-through), so the price, rails, and terms on the counter are theirs,+// live — never hardcoded copy.+let challengePromise = null;++function probeChallenge() {+ if (!challengePromise) {+ challengePromise = (async () => {+ const res = await fetch(ENDPOINT, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ repo: DEFAULT_REPO }),+ });+ const header = res.headers.get('payment-required');+ let envelope = null;+ if (header) {+ try { envelope = JSON.parse(atob(header)); } catch { /* fall through */ }+ }+ if (!envelope?.accepts?.length) {+ envelope = await res.json().catch(() => null);+ }+ if (res.status !== 402 || !envelope?.accepts?.length) {+ throw new Error(`scanner unreachable (HTTP ${res.status})`);+ }+ return envelope;+ })().catch((err) => {+ challengePromise = null; // transient failure — re-probe next open+ throw err;+ });+ }+ return challengePromise;+}++function challengePrice(envelope) {+ const amounts = (envelope?.accepts || [])+ .map((a) => Number(a.amount ?? a.maxAmountRequired))+ .filter((n) => isFinite(n) && n > 0);+ if (!amounts.length) return null;+ return Math.min(...amounts) / 1e6;+}++function challengeNetworks(envelope) {+ const nets = new Set();+ for (const a of envelope?.accepts || []) {+ const n = String(a.network || '');+ if (n.startsWith('solana')) nets.add('Solana');+ else if (n === 'eip155:8453') nets.add('Base');+ else if (n) nets.add(n);+ }+ return [...nets];+}++// ── scan lifecycle — outlives the panel ───────────────────────────────────────+// One scan at a time. Polling continues after the panel closes; the agent+// speaks and the HUD toasts when the report lands.+let activeScan = null;++function startPolling(scan) {+ const poll = async () => {+ if (activeScan !== scan) return;+ if (Date.now() - scan.startedAt > SCAN_MAX_MS) {+ scan.status = 'failed';+ scan.error = 'zauth is taking too long — the scan may still finish on their side.';+ scan.ui?.toast?.(`Security scan of ${scan.repo} timed out`, 'error');+ openPanel?.render?.();+ return;+ }+ try {+ const res = await fetch(`${ENDPOINT}?session=${encodeURIComponent(scan.session)}`, {+ headers: { accept: 'application/json' },+ });+ const body = await res.json().catch(() => null);+ if (!res.ok || !body) throw new Error(body?.error || `poll failed (${res.status})`);+ if (body.status === 'completed') {+ scan.status = 'completed';+ scan.score = Number(body.zauthScore);+ scan.markdown = body.analysisMarkdown || '';+ scan.ui?.toast?.(+ `zauth scan complete — ${scan.repo} scored ${scan.score}/100`,+ scan.score >= 50 ? 'success' : 'warn',+ );+ scan.npc?.say?.(`Report's in: ${scan.repo} scores ${scan.score}/100. ${scoreTone(scan.score).label}.`);+ openPanel?.render?.();+ return;+ }+ if (body.status && !/scanning|pending|queued|processing|analyzing|in_progress/i.test(body.status)) {+ throw new Error(`scan ended with status "${body.status}"`);+ }+ } catch (err) {+ // One bad poll isn't a failed scan — keep going unless time runs out.+ log.warn('[npc-zauth] poll error:', err?.message);+ }+ scan.timer = setTimeout(poll, POLL_MS);+ openPanel?.render?.();+ };+ scan.timer = setTimeout(poll, POLL_MS);+}++// ── panel lifecycle (single instance, ESC, overlay click) ─────────────────────+let openPanel = null;++export function isZauthPanelOpen() {+ return !!openPanel;+}++function closePanel() {+ if (!openPanel) return;+ const { overlay, onKey, opener } = openPanel;+ document.removeEventListener('keydown', onKey, true);+ overlay.classList.remove('is-in');+ setTimeout(() => overlay.remove(), 180);+ openPanel = null;+ if (opener && typeof opener.focus === 'function') opener.focus();+}++// Open zauth's security scanner. Probes the live 402 challenge immediately;+// the scan itself runs only on an explicit click, paid from the player's own+// wallet. Manages its own lifecycle (no return value).+export function openZauthScanner(npc, { ui } = {}) {+ injectStyles();+ if (openPanel) return; // already up — don't stack scanners+ if (document.querySelector('.npc-svc-overlay')) return; // another counter is open++ const titleId = 'zauth-term-title';+ const card = el('div', {+ class: 'npc-svc-card is-zauth',+ role: 'dialog',+ 'aria-modal': 'true',+ 'aria-labelledby': titleId,+ });+ const overlay = el('div', { class: 'npc-svc-overlay' }, [card]);+ overlay.addEventListener('mousedown', (e) => {+ if (e.target === overlay) closePanel();+ });++ card.appendChild(+ el('header', { class: 'npc-svc-head' }, [+ el('div', {}, [+ npc?.def?.name ? el('div', { class: 'npc-svc-who', text: npc.def.name }) : null,+ el('h2', { id: titleId, class: 'npc-svc-title' }, [+ 'RepoScan ',+ el('span', { class: 'zauth-live', text: 'LIVE x402' }),+ ]),+ ]),+ el('button', {+ class: 'npc-svc-close',+ type: 'button',+ 'aria-label': 'Close',+ text: '✕',+ onclick: closePanel,+ }),+ ]),+ );++ const body = el('div', { class: 'npc-svc-result', style: 'display:block' });+ card.appendChild(body);++ let paying = false;++ function fmtElapsed(ms) {+ const s = Math.floor(ms / 1000);+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;+ }++ async function startScan(repo) {+ if (paying || activeScan?.status === 'scanning') return;+ const target = repo.trim();+ if (!REPO_RE.test(target)) {+ ui?.toast?.('Repo must look like owner/repo', 'warn');+ return;+ }+ paying = true;+ render();+ try {+ const X402 = await ensureX402();+ const out = await X402.pay({+ endpoint: ENDPOINT,+ method: 'POST',+ body: { repo: target },+ merchant: 'zauth · RepoScan',+ action: `Security scan of ${target} — provenance, contributors, vulnerabilities`,+ });+ const result = out?.result;+ if (result?.status === 'completed') {+ // Cached report — zauth returns it instantly, no polling needed.+ activeScan = {+ repo: target, status: 'completed', score: Number(result.zauthScore),+ markdown: result.analysisMarkdown || '', startedAt: Date.now(), npc, ui,+ };+ npc?.say?.(`Had that one on file — ${target} scores ${activeScan.score}/100.`);+ } else if (result?.sessionToken) {+ if (activeScan?.timer) clearTimeout(activeScan.timer);+ activeScan = {+ repo: target, session: result.sessionToken, status: 'scanning',+ startedAt: Date.now(), npc, ui,+ };+ startPolling(activeScan);+ npc?.say?.(`Paid and queued. I'm tearing into ${target} — give me a few minutes.`);+ } else {+ throw new Error(result?.error || 'scan did not start');+ }+ } catch (err) {+ const cancelled = /cancel|dismiss|closed|denied/i.test(String(err?.message || ''));+ if (!cancelled) {+ ui?.toast?.(`Scan failed — ${err?.message || 'no funds moved'}`, 'error');+ npc?.say?.('That one bounced — your wallet is untouched.');+ }+ } finally {+ paying = false;+ render();+ }+ }++ function viewOffer() {+ body.appendChild(el('p', {+ class: 'zauth-ask',+ text: 'Name a GitHub repo and I scan it: code provenance, contributor verification, vulnerabilities. One trust score, full report.',+ }));+ const meta = el('div', { class: 'zauth-meta-row' }, [el('div', { class: 'zauth-skel', style: 'width:220px;height:26px;margin:0' })]);+ body.appendChild(meta);++ const input = el('input', {+ class: 'npc-svc-input',+ type: 'text',+ value: activeScan?.repo || DEFAULT_REPO,+ placeholder: 'owner/repo',+ 'aria-label': 'GitHub repository to scan',+ });+ const goBtn = el('button', { class: 'zauth-go', type: 'button', text: paying ? 'Paying…' : 'Scan', disabled: paying || null });+ // Keep typing out of the world's movement handlers.+ input.addEventListener('keydown', (e) => {+ e.stopPropagation();+ if (e.key === 'Enter') { e.preventDefault(); startScan(input.value); }+ });+ input.addEventListener('keyup', (e) => e.stopPropagation());+ goBtn.addEventListener('click', () => startScan(input.value));+ body.appendChild(el('div', { class: 'zauth-form' }, [input, goBtn]));+ body.appendChild(el('p', {+ class: 'zauth-hint',+ text: 'Paid with your wallet, settled on-chain to zauth. Scans take a few minutes — I keep working if you walk away.',+ }));++ probeChallenge().then((envelope) => {+ if (!openPanel || openPanel.overlay !== overlay) return;+ meta.textContent = '';+ const price = challengePrice(envelope);+ meta.appendChild(el('span', { class: 'zauth-chip is-price', text: price != null ? `$${price.toFixed(2)} USDC` : 'paid · x402' }));+ for (const net of challengeNetworks(envelope)) meta.appendChild(el('span', { class: 'zauth-chip', text: net }));+ meta.appendChild(el('span', { class: 'zauth-chip', text: 'pays zauth directly' }));+ }).catch((err) => {+ if (!openPanel || openPanel.overlay !== overlay) return;+ meta.textContent = '';+ meta.appendChild(el('span', { class: 'zauth-chip', text: 'price check failed — retry in a moment' }));+ log.warn('[npc-zauth] challenge probe failed:', err?.message);+ });+ }++ function viewScanning(scan) {+ body.appendChild(el('div', { class: 'zauth-scan-head' }, [+ el('span', { class: 'zauth-scan-repo', text: scan.repo }),+ el('span', { class: 'zauth-scan-clock', text: fmtElapsed(Date.now() - scan.startedAt) }),+ ]));+ body.appendChild(el('div', { class: 'zauth-bar' }, [el('span', { class: 'zauth-bar-fill' })]));+ body.appendChild(el('p', {+ class: 'zauth-ask',+ text: 'Scanning provenance, contributors, and vulnerabilities. This takes a few minutes — close this and keep playing; I will call out when the report lands.',+ }));+ }++ function viewReport(scan) {+ const tone = scoreTone(scan.score);+ body.appendChild(el('div', { class: 'zauth-report-head' }, [+ scoreBadge(scan.score),+ el('div', { class: 'zauth-verdict' }, [+ el('p', { class: 'zauth-verdict-t', text: scan.repo }),+ el('p', { class: 'zauth-verdict-d', text: `${tone.label} — zauth trust score ${Math.round(scan.score)}/100, settled and scanned via x402.` }),+ ]),+ ]));+ body.appendChild(renderMarkdown(scan.markdown));+ body.appendChild(el('button', {+ class: 'zauth-go zauth-again',+ type: 'button',+ text: 'Scan another repo',+ onclick: () => { activeScan = null; render(); },+ }));+ }++ function viewFailed(scan) {+ body.appendChild(el('div', { class: 'zauth-error', text: scan.error || 'The scan failed on zauth’s side.' }));+ body.appendChild(el('button', {+ class: 'zauth-go',+ type: 'button',+ text: 'Start over',+ onclick: () => { activeScan = null; render(); },+ }));+ }++ function render() {+ body.textContent = '';+ if (activeScan?.status === 'scanning') viewScanning(activeScan);+ else if (activeScan?.status === 'completed') viewReport(activeScan);+ else if (activeScan?.status === 'failed') viewFailed(activeScan);+ else viewOffer();+ }++ const onKey = (e) => {+ if (e.key === 'Escape') {+ e.stopPropagation();+ e.preventDefault();+ closePanel();+ }+ };++ const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;+ document.addEventListener('keydown', onKey, true);+ document.body.appendChild(overlay);+ openPanel = { overlay, onKey, opener, render };+ requestAnimationFrame(() => {+ overlay.classList.add('is-in');+ render();+ });+}diff --git a/src/game/npc/world-life.js b/src/game/npc/world-life.jsindex 724ee2c75..811b9b675 100644--- a/src/game/npc/world-life.js+++ b/src/game/npc/world-life.js@@ -170,6 +170,22 @@ export class WorldLife {} else {this.prompt.classList.remove('npc-show');}++ // Walk-up trigger: an NPC with `onApproach` fires it once when the player+ // enters its range, and re-arms only after the player walks away (1 m of+ // hysteresis so boundary jitter can't re-fire it).+ if (player) {+ for (const npc of this.npcs) {+ if (typeof npc.def.onApproach !== 'function') continue;+ if (npc === near && !npc._approached) {+ npc._approached = true;+ try { npc.def.onApproach({ npc, player, ui: this.ui, net: this.net, world: this.world }); }+ catch (e) { log.warn('[world-life] npc onApproach failed:', e?.message); }+ } else if (npc !== near && npc._approached && npc.distanceTo(player) > npc.range + 1) {+ npc._approached = false;+ }+ }+ }}// Player pressed E: talk to / open the nearest interactive NPC. Returns true ifdiff --git a/src/game/play-onboard.js b/src/game/play-onboard.jsindex dc84fddf5..a83261e7c 100644--- a/src/game/play-onboard.js+++ b/src/game/play-onboard.js@@ -126,7 +126,7 @@ export class PlayOnboard {tag: 'Economy',title: 'The economy',body: home- ? 'Two AI agents — ORACLE and NOVA — trade on-chain here. NOVA pays ORACLE in USDC via x402 for access to ORACLE\'s service catalog. Every settlement is a real Solana transaction with a Solscan link. Walk up to the agents by the plaza and press E (or tap them) to watch a live payment round.'+ ? 'Two AI agents — ORACLE and NOVA — trade on-chain here. NOVA pays ORACLE in USDC via x402 for access to ORACLE\'s service catalog. Every settlement is a real Solana transaction with a Solscan link. Walk up to the agents by the plaza and press E (or tap them) to watch a live payment round. Across the plaza, the $THREE Intel Kiosk sells live market intel — pay $0.01 USDC from your own wallet to light up its screen.': 'Real ' + (sym || name) + ' trades drive this world: buys light the boundary ring green, sells ripple red. Volume spins the totem, price momentum shifts the weather. The jumbotron above shows live on-chain market data.',},];diff --git a/src/game/three-intel-kiosk.js b/src/game/three-intel-kiosk.jsnew file mode 100644index 000000000..ef2eb1dac--- /dev/null+++ b/src/game/three-intel-kiosk.js@@ -0,0 +1,304 @@+// $THREE Intel Kiosk — a paid x402 oracle kiosk inside the $THREE town (/play).+//+// This ports the /play/agent-wallet demo into the walkaround world: instead of+// a flat page where your avatar walks to a kiosk, YOU are the avatar. Walk up+// to the kiosk by the plaza and press E (or tap it) — window.X402.pay opens+// the wallet modal, you pay $0.01 USDC (Phantom on Solana, or an EVM wallet on+// Base) to /api/x402/three-intel, and the kiosk's 3D screen lights up with the+// purchased intel: live $THREE price, 24 h change, market cap, and a+// bullish/bearish/neutral signal. Every settlement is real USDC on-chain; the+// payment modal shows the transaction with an explorer link.+//+// Scoped to the home town only (built by coincommunities.js inside its+// isHomeTown block) and torn down in leave(). Payment only fires on an+// explicit player interaction, and the player signs with their OWN wallet —+// no platform key is ever exposed to the page.++import {+ Group, Mesh, MeshBasicMaterial, MeshStandardMaterial, RingGeometry,+ PlaneGeometry, BoxGeometry, CylinderGeometry, CanvasTexture, SRGBColorSpace,+ DoubleSide, Vector3,+} from 'three';+import { log } from '../shared/log.js';+import { ensureX402 } from '../shared/x402-loader.js';++const KIOSK_POS = new Vector3(-8, 0, -7);+const INTERACT_RANGE = 5.5;+const ENDPOINT = '/api/x402/three-intel';+const ACCENT = '#9945ff';+const ACCENT_LT = '#b88aff';++// x402 SDK loaded on demand the first time a player pays (src/shared/x402-loader.js).++function fmtUsd(n) {+ if (n == null || !isFinite(n)) return '—';+ if (n >= 1e9) return `$${(n / 1e9).toFixed(2)}B`;+ if (n >= 1e6) return `$${(n / 1e6).toFixed(2)}M`;+ if (n >= 1e3) return `$${(n / 1e3).toFixed(1)}K`;+ return `$${n >= 1 ? n.toFixed(2) : n.toFixed(6)}`;+}++export class ThreeIntelKiosk {+ constructor({ scene, camera, renderer, getPlayer, ui }) {+ this.scene = scene;+ this.camera = camera;+ this.renderer = renderer;+ this.getPlayer = getPlayer;+ this.ui = ui;++ this.busy = false;+ this.intel = null; // last purchased intel payload+ this.paidTx = null; // settlement tx of the last purchase+ this._inRange = false;+ this._t = 0;+ this._disposed = false;++ this._buildKiosk();+ this._buildPrompt();+ this._drawScreen();+ }++ _buildKiosk() {+ this.group = new Group();+ this.group.position.copy(KIOSK_POS);+ // Face the plaza center so players see the screen as they approach.+ this.group.rotation.y = Math.atan2(-KIOSK_POS.x, -KIOSK_POS.z);++ const shell = new MeshStandardMaterial({ color: 0x17171b, roughness: 0.35, metalness: 0.7 });+ const pedestal = new Mesh(new BoxGeometry(1.1, 1.3, 0.5), shell);+ pedestal.position.y = 0.65;+ pedestal.castShadow = true;+ this.group.add(pedestal);++ this.canvas = document.createElement('canvas');+ this.canvas.width = 512; this.canvas.height = 320;+ this.ctx = this.canvas.getContext('2d');+ this.tex = new CanvasTexture(this.canvas);+ this.tex.colorSpace = SRGBColorSpace;+ const screen = new Mesh(+ new PlaneGeometry(1.5, 0.94),+ new MeshBasicMaterial({ map: this.tex, toneMapped: false }),+ );+ screen.position.set(0, 1.85, 0.08);+ screen.rotation.x = -0.14;+ this.group.add(screen);+ const bezel = new Mesh(new BoxGeometry(1.62, 1.06, 0.06), shell);+ bezel.position.set(0, 1.85, 0.03);+ bezel.rotation.x = -0.14;+ bezel.castShadow = true;+ this.group.add(bezel);++ // Antenna beacon — kiosks broadcast that they're paid x402 services.+ const mast = new Mesh(new CylinderGeometry(0.025, 0.025, 0.6, 8), shell);+ mast.position.set(0.45, 2.6, 0);+ this.group.add(mast);+ this.beacon = new Mesh(+ new CylinderGeometry(0.06, 0.06, 0.08, 10),+ new MeshBasicMaterial({ color: ACCENT }),+ );+ this.beacon.position.set(0.45, 2.93, 0);+ this.group.add(this.beacon);++ // Pay ring on the floor — pulses while a payment runs.+ this.ring = new Mesh(+ new RingGeometry(1.0, 1.3, 56),+ new MeshBasicMaterial({ color: ACCENT, transparent: true, opacity: 0.2, side: DoubleSide }),+ );+ this.ring.rotation.x = -Math.PI / 2;+ this.ring.position.y = 0.02;+ this.group.add(this.ring);++ // Floating sign, billboarded in tick().+ this.sign = this._signMesh('$THREE INTEL', 'paid oracle · $0.01 USDC · x402');+ this.sign.position.set(0, 3.5, 0);+ this.group.add(this.sign);++ this.scene.add(this.group);+ }++ _signMesh(title, sub) {+ const c = document.createElement('canvas'); c.width = 512; c.height = 160;+ const x = c.getContext('2d');+ x.textAlign = 'center';+ x.fillStyle = ACCENT_LT;+ x.font = '800 54px Inter, system-ui, sans-serif';+ x.fillText(title, 256, 62);+ x.fillStyle = 'rgba(255,255,255,0.62)';+ x.font = '600 26px Inter, system-ui, sans-serif';+ x.fillText(sub, 256, 104);+ const tex = new CanvasTexture(c); tex.colorSpace = SRGBColorSpace;+ return new Mesh(+ new PlaneGeometry(4.2, 1.32),+ new MeshBasicMaterial({ map: tex, transparent: true, side: DoubleSide }),+ );+ }++ _buildPrompt() {+ if (!document.getElementById('tik-styles')) {+ const s = document.createElement('style');+ s.id = 'tik-styles';+ s.textContent = `+ .tik-prompt {+ position: fixed; left: 0; top: 0; z-index: 16; pointer-events: none;+ transform: translate(-50%, -100%); white-space: nowrap;+ background: var(--cc-panel-solid, #0c0c0e); border: 1px solid rgba(153,69,255,0.45);+ color: var(--cc-text, #f5f5f6); font-size: 12px; font-weight: 700; letter-spacing: 0.04em;+ padding: 6px 11px; border-radius: var(--cc-radius, 4px); box-shadow: 0 0 14px rgba(153,69,255,0.35);+ text-transform: uppercase; transition: opacity 0.18s ease; opacity: 0;+ }+ .tik-prompt.tik-show { opacity: 1; }+ .tik-prompt .tik-key {+ display: inline-block; min-width: 16px; text-align: center; margin-right: 5px;+ background: ${ACCENT_LT}; color: var(--cc-ink, #060607); border-radius: 3px; padding: 0 4px;+ }`;+ document.head.appendChild(s);+ }+ this.prompt = document.createElement('div');+ this.prompt.className = 'tik-prompt';+ this.prompt.innerHTML = '<span class="tik-key">E</span> Buy $THREE intel — $0.01 USDC';+ document.body.appendChild(this.prompt);+ }++ // ── kiosk screen states: offer → paying → intel ────────────────────────────++ _drawScreen() {+ const c = this.ctx, W = this.canvas.width, H = this.canvas.height;+ const g = c.createLinearGradient(0, 0, 0, H);+ g.addColorStop(0, '#15151a'); g.addColorStop(1, '#0a0a0c');+ c.fillStyle = g; c.fillRect(0, 0, W, H);+ c.strokeStyle = 'rgba(255,255,255,0.07)'; c.strokeRect(1, 1, W - 2, H - 2);+ c.textAlign = 'left';+ c.fillStyle = '#5a5a60';+ c.font = '700 22px Inter, system-ui, sans-serif';+ c.fillText('x402 PAID ORACLE', 28, 46);+ c.fillStyle = ACCENT_LT; c.font = '800 44px Inter, system-ui, sans-serif';+ c.fillText('$THREE INTEL', 28, 100);++ const i = this.intel;+ if (this.busy) {+ c.fillStyle = ACCENT_LT; c.font = '600 24px Inter, system-ui, sans-serif';+ c.fillText('● PAYMENT IN PROGRESS…', 28, 168);+ c.fillStyle = '#8c8c92'; c.font = '600 20px Inter, system-ui, sans-serif';+ c.fillText('Sign in your wallet to settle on-chain.', 28, 204);+ } else if (i) {+ const sigCol = i.signal === 'bullish' ? '#5fd08a' : i.signal === 'bearish' ? '#e06c75' : '#f5a623';+ c.fillStyle = sigCol; c.font = '800 26px Inter, system-ui, sans-serif';+ c.fillText((i.signal || '').toUpperCase(), 28, 150);+ c.fillStyle = '#f5f5f6'; c.font = '700 25px Inter, system-ui, sans-serif';+ c.fillText(String(i.headline || '').slice(0, 38), 28, 188);+ c.fillStyle = '#8c8c92'; c.font = '600 21px Inter, system-ui, sans-serif';+ const px = i.price_usd != null ? `$${i.price_usd >= 1 ? i.price_usd.toFixed(3) : i.price_usd.toFixed(6)}` : '—';+ const chg = i.change_24h != null ? `${i.change_24h >= 0 ? '+' : ''}${i.change_24h.toFixed(2)}%` : '—';+ c.fillText(`price ${px} · 24h ${chg} · mcap ${fmtUsd(i.market_cap_usd)}`, 28, 226);+ c.fillStyle = '#5fd08a'; c.font = '600 20px Inter, system-ui, sans-serif';+ c.fillText(this.paidTx ? `✓ settled · tx ${this.paidTx.slice(0, 8)}…` : '✓ settled on-chain', 28, 272);+ } else {+ c.fillStyle = '#22d77a'; c.font = '800 40px Inter, system-ui, sans-serif';+ c.fillText('$0.01 USDC', 28, 168);+ c.fillStyle = '#8c8c92'; c.font = '600 21px Inter, system-ui, sans-serif';+ c.fillText('Live price · signal · market cap · flow', 28, 208);+ c.fillStyle = '#5a5a60'; c.font = '600 20px Inter, system-ui, sans-serif';+ c.fillText('Walk up and press E to buy', 28, 268);+ }+ this.tex.needsUpdate = true;+ }++ _playerNear() {+ const p = this.getPlayer?.();+ if (!p) return false;+ return Math.hypot(p.x - KIOSK_POS.x, p.z - KIOSK_POS.z) <= INTERACT_RANGE;+ }++ // Project a world point to a screen-space DOM transform (same math as+ // coincommunities._updateLabels / agent-commerce._place).+ _place(node, x, y, z) {+ const w = this.renderer.domElement.clientWidth, h = this.renderer.domElement.clientHeight;+ const v = new Vector3(x, y, z).project(this.camera);+ if (v.z > 1 || v.z < -1) { node.style.display = 'none'; return; }+ node.style.display = '';+ node.style.transform = `translate(-50%, -100%) translate(${(v.x * 0.5 + 0.5) * w}px, ${(-v.y * 0.5 + 0.5) * h}px)`;+ }++ tick(dt) {+ this._t += dt;+ // Billboard the sign; pulse the ring and beacon while paying.+ if (this.sign) {+ const c = this.camera.position;+ this.sign.rotation.y =+ Math.atan2(c.x - KIOSK_POS.x, c.z - KIOSK_POS.z) - this.group.rotation.y;+ }+ this.ring.material.opacity = this.busy+ ? 0.3 + 0.25 * Math.sin(this._t * 5)+ : 0.14 + 0.1 * (0.5 + 0.5 * Math.sin(this._t * 2));++ const near = this._playerNear();+ if (near && !this.busy) {+ this.prompt.classList.add('tik-show');+ this._place(this.prompt, KIOSK_POS.x, 4.3, KIOSK_POS.z);+ } else {+ this.prompt.classList.remove('tik-show');+ }+ this._inRange = near;+ }++ // Tap/click support: returns true (and starts a purchase) if the player+ // tapped the kiosk while in range.+ tryActivateAt(raycaster) {+ if (!this._playerNear()) return false;+ const hit = raycaster.intersectObject(this.group, true).length > 0;+ if (hit) { this.interact(); return true; }+ return false;+ }++ // Player pressed E (or tapped the kiosk): open the real x402 payment modal.+ interact() {+ if (this.busy || !this._playerNear()) return false;+ this._purchase().catch((err) => log.warn('[three-intel-kiosk] purchase failed:', err?.message));+ return true;+ }++ async _purchase() {+ this.busy = true;+ this.prompt.classList.remove('tik-show');+ this._drawScreen();+ try {+ const X402 = await ensureX402();+ const out = await X402.pay({+ endpoint: ENDPOINT,+ method: 'GET',+ merchant: '$THREE Town Oracle',+ action: 'Live $THREE market intel — $0.01 USDC',+ });+ const intel = out?.result;+ if (!intel?.signal) throw new Error(intel?.error || 'purchase did not settle');+ this.intel = intel;+ this.paidTx = out?.payment?.transaction || null;+ this.ui?.toast?.(`$THREE intel purchased — ${intel.signal.toUpperCase()}: ${intel.headline}`, 'success');+ } catch (err) {+ // A dismissed wallet modal is a normal exit, not an error state.+ const cancelled = /cancel|dismiss|closed|denied/i.test(String(err?.message || ''));+ if (!cancelled) {+ this.ui?.toast?.(`Intel purchase failed — ${err?.message || 'no funds moved'}`, 'error');+ }+ } finally {+ this.busy = false;+ this._drawScreen();+ }+ }++ dispose() {+ this._disposed = true;+ this.prompt?.remove();+ if (this.group) {+ this.scene.remove(this.group);+ this.group.traverse((o) => {+ o.geometry?.dispose?.();+ if (o.material) {+ o.material.map?.dispose?.();+ o.material.dispose?.();+ }+ });+ this.group = null;+ }+ }+}diff --git a/src/launches.css b/src/launches.cssnew file mode 100644index 000000000..d7c721486--- /dev/null+++ b/src/launches.css@@ -0,0 +1,514 @@+/* /launches — public feed of coins launched by three.ws agents.+ Token-driven (public/tokens.css via nav.css); no hardcoded palette. */++body {+ margin: 0;+ background: var(--bg-0);+ color: var(--ink);+ font-family: var(--font-body);+}++.lx-shell {+ max-width: 1120px;+ margin: 0 auto;+ padding: calc(var(--header-h) + var(--space-xl)) var(--space-lg) var(--space-2xl);+}++/* ── Hero ─────────────────────────────────────────────────────────────────── */++.lx-hero {+ text-align: center;+ margin-bottom: var(--space-xl);+}++.lx-kicker {+ font-size: var(--text-sm);+ font-weight: var(--weight-semibold);+ letter-spacing: 0.14em;+ text-transform: uppercase;+ color: var(--ink-faint);+ margin: 0 0 var(--space-sm);+}++.lx-hero h1 {+ font-family: var(--font-display);+ font-size: var(--text-2xl);+ font-weight: var(--weight-bold);+ line-height: var(--leading-tight);+ color: var(--ink-bright);+ margin: 0 0 var(--space-sm);+}++.lx-sub {+ max-width: 560px;+ margin: 0 auto var(--space-lg);+ font-size: var(--text-base);+ line-height: var(--leading-normal);+ color: var(--ink-dim);+}++.lx-hero-ctas {+ display: flex;+ gap: var(--space-sm);+ justify-content: center;+ flex-wrap: wrap;+}++.lx-btn {+ display: inline-flex;+ align-items: center;+ gap: var(--space-xs);+ padding: var(--space-sm) var(--space-lg);+ border-radius: var(--radius-md);+ border: 1px solid var(--stroke-strong);+ background: var(--surface-2);+ color: var(--ink);+ font-size: var(--text-ui);+ font-weight: var(--weight-medium);+ text-decoration: none;+ cursor: pointer;+ transition:+ background var(--duration-fast) var(--ease-standard),+ transform var(--duration-fast) var(--ease-standard);+}++.lx-btn:hover {+ background: var(--surface-3);+}++.lx-btn:active {+ transform: translateY(1px);+}++.lx-btn:focus-visible {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: var(--focus-ring-offset);+}++.lx-btn-primary {+ background: var(--accent);+ border-color: var(--accent);+ color: var(--bg-0);+}++[data-theme='light'] .lx-btn-primary {+ color: var(--btn-primary-fg, #ffffff);+}++.lx-btn-primary:hover {+ background: var(--accent);+ opacity: 0.88;+}++/* ── Toolbar ──────────────────────────────────────────────────────────────── */++.lx-toolbar {+ display: flex;+ align-items: center;+ gap: var(--space-md);+ flex-wrap: wrap;+ margin-bottom: var(--space-lg);+}++.lx-net-toggle {+ display: inline-flex;+ padding: var(--space-3xs);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-md);+ background: var(--surface-1);+}++.lx-net-btn {+ padding: var(--space-xs) var(--space-md);+ border: 0;+ border-radius: var(--radius-sm);+ background: transparent;+ color: var(--ink-dim);+ font-size: var(--text-md);+ font-weight: var(--weight-medium);+ font-family: var(--font-body);+ cursor: pointer;+ transition:+ background var(--duration-fast) var(--ease-standard),+ color var(--duration-fast) var(--ease-standard);+}++.lx-net-btn:hover {+ color: var(--ink);+}++.lx-net-btn:focus-visible {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: var(--focus-ring-offset);+}++.lx-net-btn.active {+ background: var(--surface-3);+ color: var(--ink-bright);+}++.lx-agent-filter {+ display: inline-flex;+ align-items: center;+ gap: var(--space-xs);+ padding: var(--space-xs) var(--space-sm);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-pill);+ background: var(--surface-2);+ font-size: var(--text-md);+ color: var(--ink);+}++.lx-agent-filter img {+ width: 18px;+ height: 18px;+ border-radius: 50%;+ object-fit: cover;+}++.lx-agent-filter button {+ border: 0;+ background: transparent;+ color: var(--ink-dim);+ font-size: var(--text-ui);+ line-height: 1;+ cursor: pointer;+ padding: 0 var(--space-2xs);+ border-radius: var(--radius-sm);+}++.lx-agent-filter button:hover {+ color: var(--ink-bright);+}++.lx-agent-filter button:focus-visible {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: var(--focus-ring-offset);+}++.lx-count {+ margin-left: auto;+ font-size: var(--text-sm);+ color: var(--ink-faint);+}++/* ── Feed grid ────────────────────────────────────────────────────────────── */++.lx-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));+ gap: var(--space-md);+}++.lx-card {+ display: flex;+ flex-direction: column;+ gap: var(--space-sm);+ padding: var(--space-md);+ border: 1px solid var(--stroke);+ border-radius: var(--radius-lg);+ background: var(--surface-1);+ box-shadow: var(--shadow-1);+ opacity: 0;+ transform: translateY(6px);+ animation: lx-enter var(--duration-base) var(--ease-emphasized) forwards;+ transition:+ border-color var(--duration-fast) var(--ease-standard),+ background var(--duration-fast) var(--ease-standard),+ box-shadow var(--duration-fast) var(--ease-standard);+}++.lx-card:hover {+ border-color: var(--stroke-strong);+ background: var(--surface-2);+ box-shadow: var(--shadow-2);+}++@keyframes lx-enter {+ to {+ opacity: 1;+ transform: translateY(0);+ }+}++@media (prefers-reduced-motion: reduce) {+ .lx-card {+ animation: none;+ opacity: 1;+ transform: none;+ }+}++.lx-card-top {+ display: flex;+ align-items: center;+ gap: var(--space-sm);+}++.lx-coin-img {+ width: 44px;+ height: 44px;+ border-radius: var(--radius-md);+ object-fit: cover;+ background: var(--surface-3);+ flex-shrink: 0;+}++.lx-coin-id {+ min-width: 0;+}++.lx-coin-name {+ font-family: var(--font-display);+ font-size: var(--text-ui);+ font-weight: var(--weight-semibold);+ color: var(--ink-bright);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ margin: 0;+}++.lx-coin-symbol {+ font-family: var(--font-mono);+ font-size: var(--text-sm);+ color: var(--ink-dim);+}++.lx-badges {+ display: flex;+ gap: var(--space-2xs);+ flex-wrap: wrap;+}++.lx-badge {+ padding: var(--space-3xs) var(--space-xs);+ border-radius: var(--radius-pill);+ border: 1px solid var(--stroke);+ background: var(--surface-2);+ font-size: var(--text-2xs);+ font-weight: var(--weight-medium);+ letter-spacing: 0.04em;+ color: var(--ink-dim);+ text-transform: uppercase;+}++.lx-badge-grad {+ color: var(--success);+ border-color: color-mix(in srgb, var(--success) 35%, transparent);+}++.lx-badge-buyback {+ color: var(--warn);+ border-color: color-mix(in srgb, var(--warn) 35%, transparent);+}++.lx-stats {+ display: flex;+ align-items: baseline;+ justify-content: space-between;+ gap: var(--space-sm);+}++.lx-mcap {+ font-family: var(--font-mono);+ font-size: var(--text-lg);+ font-weight: var(--weight-semibold);+ color: var(--ink-bright);+}++.lx-mcap-label {+ font-size: var(--text-2xs);+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--ink-faint);+ display: block;+}++.lx-time {+ font-size: var(--text-sm);+ color: var(--ink-faint);+ white-space: nowrap;+}++.lx-agent-row {+ display: flex;+ align-items: center;+ gap: var(--space-xs);+ padding: var(--space-xs) var(--space-sm);+ border-radius: var(--radius-md);+ border: 1px solid var(--stroke);+ background: var(--surface-2);+ text-decoration: none;+ color: var(--ink);+ font-size: var(--text-md);+ transition: background var(--duration-fast) var(--ease-standard);+ min-width: 0;+}++.lx-agent-row:hover {+ background: var(--surface-3);+}++.lx-agent-row:focus-visible {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: var(--focus-ring-offset);+}++.lx-agent-row img,+.lx-agent-row .lx-agent-fallback {+ width: 22px;+ height: 22px;+ border-radius: 50%;+ object-fit: cover;+ flex-shrink: 0;+}++.lx-agent-fallback {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ background: var(--surface-3);+ color: var(--ink-dim);+ font-size: var(--text-xs);+ font-weight: var(--weight-semibold);+}++.lx-agent-name {+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}++.lx-agent-hint {+ margin-left: auto;+ color: var(--ink-faint);+ font-size: var(--text-sm);+ flex-shrink: 0;+}++.lx-card-actions {+ display: flex;+ gap: var(--space-xs);+ margin-top: auto;+}++.lx-action {+ flex: 1;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: var(--space-2xs);+ padding: var(--space-xs) var(--space-sm);+ border-radius: var(--radius-md);+ border: 1px solid var(--stroke);+ background: transparent;+ color: var(--ink-dim);+ font-size: var(--text-sm);+ font-weight: var(--weight-medium);+ text-decoration: none;+ transition:+ color var(--duration-fast) var(--ease-standard),+ border-color var(--duration-fast) var(--ease-standard),+ background var(--duration-fast) var(--ease-standard);+}++.lx-action:hover {+ color: var(--ink-bright);+ border-color: var(--stroke-strong);+ background: var(--surface-1);+}++.lx-action:focus-visible {+ outline: var(--focus-ring-width) solid var(--focus-ring-color);+ outline-offset: var(--focus-ring-offset);+}++.lx-mint {+ font-family: var(--font-mono);+ font-size: var(--text-2xs);+ color: var(--ink-faint);+}++/* ── Skeletons ────────────────────────────────────────────────────────────── */++.lx-skel {+ border: 1px solid var(--stroke);+ border-radius: var(--radius-lg);+ background: var(--surface-1);+ padding: var(--space-md);+ display: flex;+ flex-direction: column;+ gap: var(--space-sm);+}++.lx-skel-bar {+ border-radius: var(--radius-sm);+ background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);+ background-size: 200% 100%;+ animation: lx-shimmer 1.4s ease-in-out infinite;+}++@keyframes lx-shimmer {+ 0% {+ background-position: 200% 0;+ }+ 100% {+ background-position: -200% 0;+ }+}++@media (prefers-reduced-motion: reduce) {+ .lx-skel-bar {+ animation: none;+ }+}++/* ── Empty / error / footer states ────────────────────────────────────────── */++.lx-state {+ grid-column: 1 / -1;+ text-align: center;+ padding: var(--space-2xl) var(--space-lg);+ border: 1px dashed var(--stroke-strong);+ border-radius: var(--radius-lg);+ color: var(--ink-dim);+}++.lx-state h2 {+ font-family: var(--font-display);+ font-size: var(--text-lg);+ color: var(--ink-bright);+ margin: 0 0 var(--space-xs);+}++.lx-state p {+ margin: 0 auto var(--space-md);+ max-width: 420px;+ font-size: var(--text-ui);+ line-height: var(--leading-normal);+}++.lx-footer-state {+ display: flex;+ justify-content: center;+ margin-top: var(--space-lg);+}++/* ── Responsive ───────────────────────────────────────────────────────────── */++@media (max-width: 480px) {+ .lx-shell {+ padding-left: var(--space-md);+ padding-right: var(--space-md);+ }++ .lx-hero h1 {+ font-size: var(--text-xl);+ }++ .lx-count {+ width: 100%;+ margin-left: 0;+ }+}diff --git a/src/launches.js b/src/launches.jsnew file mode 100644index 000000000..6956234a7--- /dev/null+++ b/src/launches.js@@ -0,0 +1,443 @@+/**+ * /launches — public feed of every coin launched by a three.ws agent.+ *+ * Data flow:+ * GET /api/pump/launches?network=&offset=&limit=[&agent_id=] registry rows+ * GET /api/pump/coin?mint= live market data+ * GET /api/agents/:id agent-filter chip label+ *+ * Registry rows render immediately; market data (price, image, graduation)+ * streams in per card afterwards so the feed never blocks on pump.fun.+ */++const PAGE_SIZE = 24;+const ENRICH_CONCURRENCY = 4;++const state = {+ network: 'mainnet',+ agentId: null,+ offset: 0,+ hasMore: false,+ loading: false,+ count: 0,+};++const feedEl = document.getElementById('lx-feed');+const footerEl = document.getElementById('lx-footer-state');+const countEl = document.getElementById('lx-count');+const agentFilterEl = document.getElementById('lx-agent-filter');++// ── helpers ──────────────────────────────────────────────────────────────────++function el(tag, props = {}, children = []) {+ const node = document.createElement(tag);+ for (const [k, v] of Object.entries(props)) {+ if (v == null || v === false) continue;+ if (k === 'class') node.className = v;+ else if (k === 'text') node.textContent = v;+ else if (k.startsWith('on')) node.addEventListener(k.slice(2), v);+ else node.setAttribute(k, v);+ }+ for (const c of [].concat(children || [])) {+ if (c == null) continue;+ node.appendChild(typeof c === 'string' ? document.createTextNode(c) : c);+ }+ return node;+}++function shortAddr(s, head = 4, tail = 4) {+ const str = String(s || '');+ if (str.length <= head + tail + 1) return str;+ return `${str.slice(0, head)}…${str.slice(-tail)}`;+}++function timeAgo(iso) {+ const t = new Date(iso).getTime();+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, (Date.now() - t) / 1000);+ if (s < 60) return 'just now';+ if (s < 3600) return `${Math.floor(s / 60)}m ago`;+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;+ if (s < 86400 * 30) return `${Math.floor(s / 86400)}d ago`;+ return new Date(t).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });+}++function usdCompact(n) {+ if (!Number.isFinite(n)) return '—';+ if (n >= 1e9) return `$${(n / 1e9).toFixed(2)}B`;+ if (n >= 1e6) return `$${(n / 1e6).toFixed(2)}M`;+ if (n >= 1e3) return `$${(n / 1e3).toFixed(1)}K`;+ return `$${n.toFixed(0)}`;+}++const GRADIENTS = [+ ['#555577', '#4f46e5'],+ ['#0ea5e9', '#ffffff'],+ ['#10b981', '#0ea5e9'],+ ['#f59e0b', '#ef4444'],+ ['#ec4899', '#ffffff'],+ ['#14b8a6', '#3b82f6'],+];++function coinFallbackUri(symbol) {+ const [c1, c2] = GRADIENTS[(symbol?.charCodeAt(0) || 0) % GRADIENTS.length];+ const letter = (symbol || '?')[0].toUpperCase();+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="88" height="88" viewBox="0 0 88 88"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="${c1}"/><stop offset="1" stop-color="${c2}"/></linearGradient></defs><rect width="88" height="88" rx="14" fill="url(#g)"/><text x="50%" y="56%" text-anchor="middle" font-family="Inter,system-ui,sans-serif" font-size="42" font-weight="600" fill="white">${letter}</text></svg>`;+ return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;+}++// ── market enrichment (mainnet only) ─────────────────────────────────────────+// Small worker pool over /api/pump/coin so a long feed page doesn't fire 100+// concurrent requests; each result patches its card in place.++const enrichQueue = [];+let enrichActive = 0;++function queueEnrich(mint, card) {+ enrichQueue.push({ mint, card });+ pumpEnrichQueue();+}++function pumpEnrichQueue() {+ while (enrichActive < ENRICH_CONCURRENCY && enrichQueue.length) {+ const job = enrichQueue.shift();+ enrichActive++;+ enrichCard(job.mint, job.card).finally(() => {+ enrichActive--;+ pumpEnrichQueue();+ });+ }+}++async function enrichCard(mint, card) {+ let coin;+ try {+ const r = await fetch(`/api/pump/coin?mint=${encodeURIComponent(mint)}`);+ if (!r.ok) return;+ coin = await r.json();+ } catch {+ return; // registry data already on screen; market data is best-effort+ }+ if (!coin || !card.isConnected) return;++ const img = card.querySelector('.lx-coin-img');+ const imgSrc = coin.image_uri || coin.image;+ if (img && imgSrc) img.src = imgSrc;++ const mcap = card.querySelector('.lx-mcap-value');+ const cap = Number(coin.usd_market_cap);+ if (mcap && Number.isFinite(cap)) mcap.textContent = usdCompact(cap);++ if (coin.complete) {+ const badges = card.querySelector('.lx-badges');+ if (badges && !badges.querySelector('.lx-badge-grad')) {+ badges.prepend(el('span', { class: 'lx-badge lx-badge-grad', text: 'Graduated' }));+ }+ }+}++// ── card rendering ───────────────────────────────────────────────────────────++function agentChip(agent) {+ if (!agent) {+ return el('div', { class: 'lx-agent-row', 'aria-disabled': 'true' }, [+ el('span', { class: 'lx-agent-fallback', text: '?' }),+ el('span', { class: 'lx-agent-name', text: 'Unknown agent' }),+ ]);+ }+ const avatar = agent.avatar_thumbnail_url+ ? el('img', { src: agent.avatar_thumbnail_url, alt: '', loading: 'lazy' })+ : el('span', { class: 'lx-agent-fallback', text: (agent.name || '?')[0].toUpperCase() });+ return el(+ 'a',+ {+ class: 'lx-agent-row',+ href: agent.url || `/agents/${agent.id}`,+ 'aria-label': `View agent ${agent.name || shortAddr(agent.id)}`,+ },+ [+ avatar,+ el('span', { class: 'lx-agent-name', text: agent.name || shortAddr(agent.id) }),+ el('span', { class: 'lx-agent-hint', text: 'Agent →' }),+ ],+ );+}++function launchCard(launch, index) {+ const isDevnet = launch.network === 'devnet';+ const tradeHref = isDevnet+ ? `https://explorer.solana.com/address/${launch.mint}?cluster=devnet`+ : `https://pump.fun/${launch.mint}`;++ const badges = el('div', { class: 'lx-badges' });+ if (isDevnet) badges.appendChild(el('span', { class: 'lx-badge', text: 'Devnet' }));+ if (Number(launch.buyback_bps) > 0) {+ badges.appendChild(+ el('span', {+ class: 'lx-badge lx-badge-buyback',+ text: `${(Number(launch.buyback_bps) / 100).toFixed(1)}% buyback`,+ title: 'Share of agent payments auto-bought-back and burned',+ }),+ );+ }++ const actions = [+ el('a', {+ class: 'lx-action',+ href: tradeHref,+ target: '_blank',+ rel: 'noopener noreferrer',+ text: isDevnet ? 'Explorer ↗' : 'pump.fun ↗',+ }),+ ];+ if (!isDevnet) {+ actions.push(+ el('a', {+ class: 'lx-action',+ href: `/communities/${launch.mint}`,+ text: '3D world',+ 'aria-label': `Visit the 3D world for ${launch.symbol || launch.name}`,+ }),+ );+ }++ const card = el('article', { class: 'lx-card', style: `animation-delay:${Math.min(index, 12) * 30}ms` }, [+ el('div', { class: 'lx-card-top' }, [+ el('img', {+ class: 'lx-coin-img',+ src: coinFallbackUri(launch.symbol || launch.name),+ alt: '',+ loading: 'lazy',+ onerror: (e) => {+ e.currentTarget.onerror = null;+ e.currentTarget.src = coinFallbackUri(launch.symbol || launch.name);+ },+ }),+ el('div', { class: 'lx-coin-id' }, [+ el('h3', { class: 'lx-coin-name', text: launch.name || launch.symbol || 'Unnamed coin' }),+ el('span', { class: 'lx-coin-symbol', text: launch.symbol ? `$${launch.symbol}` : shortAddr(launch.mint) }),+ ]),+ ]),+ badges,+ el('div', { class: 'lx-stats' }, [+ el('div', {}, [+ el('span', { class: 'lx-mcap-label', text: 'Market cap' }),+ el('span', { class: 'lx-mcap lx-mcap-value', text: isDevnet ? 'n/a' : '…' }),+ ]),+ el('time', { class: 'lx-time', datetime: launch.created_at, text: timeAgo(launch.created_at) }),+ ]),+ agentChip(launch.agent),+ el('div', { class: 'lx-card-actions' }, actions),+ el('span', { class: 'lx-mint', text: launch.mint, title: launch.mint }),+ ]);++ if (!isDevnet) queueEnrich(launch.mint, card);+ return card;+}++// ── states ───────────────────────────────────────────────────────────────────++function renderSkeletons(n = 8) {+ for (let i = 0; i < n; i++) {+ feedEl.appendChild(+ el('div', { class: 'lx-skel', 'aria-hidden': 'true' }, [+ el('div', { class: 'lx-skel-bar', style: 'width:44px;height:44px;border-radius:10px' }),+ el('div', { class: 'lx-skel-bar', style: 'width:70%;height:14px' }),+ el('div', { class: 'lx-skel-bar', style: 'width:45%;height:22px' }),+ el('div', { class: 'lx-skel-bar', style: 'width:100%;height:34px' }),+ ]),+ );+ }+}++function clearSkeletons() {+ feedEl.querySelectorAll('.lx-skel').forEach((n) => n.remove());+}++function renderEmpty() {+ const filtered = !!state.agentId;+ feedEl.appendChild(+ el('div', { class: 'lx-state' }, [+ el('h2', { text: filtered ? 'No launches by this agent yet' : 'No launches yet' }),+ el('p', {+ text: filtered+ ? 'This agent has not launched a coin on this network. Clear the filter to see the full feed.'+ : state.network === 'devnet'+ ? 'Nothing has been launched on devnet. Switch to mainnet to see live launches.'+ : 'Be the first: create an agent, give it a coin, and it shows up here in real time.',+ }),+ filtered+ ? el('button', {+ class: 'lx-btn',+ type: 'button',+ text: 'Clear filter',+ onclick: () => setAgentFilter(null),+ })+ : el('a', {+ class: 'lx-btn lx-btn-primary',+ href: '/create-agent',+ text: 'Create an agent',+ }),+ ]),+ );+}++function renderError(retry) {+ feedEl.appendChild(+ el('div', { class: 'lx-state', role: 'alert' }, [+ el('h2', { text: 'Could not load the feed' }),+ el('p', { text: 'The launches API did not respond. Check your connection and try again.' }),+ el('button', { class: 'lx-btn', type: 'button', text: 'Retry', onclick: retry }),+ ]),+ );+}++function renderFooter() {+ footerEl.textContent = '';+ if (!state.hasMore) return;+ const btn = el('button', {+ class: 'lx-btn',+ type: 'button',+ text: 'Load more launches',+ onclick: () => loadPage(),+ });+ footerEl.appendChild(btn);+}++function updateCount() {+ countEl.textContent = state.count+ ? `${state.count}${state.hasMore ? '+' : ''} launch${state.count === 1 ? '' : 'es'}`+ : '';+}++// ── data loading ─────────────────────────────────────────────────────────────++async function loadPage({ reset = false } = {}) {+ if (state.loading) return;+ state.loading = true;+ if (reset) {+ state.offset = 0;+ state.count = 0;+ state.hasMore = false;+ feedEl.textContent = '';+ footerEl.textContent = '';+ countEl.textContent = '';+ }+ feedEl.setAttribute('aria-busy', 'true');+ renderSkeletons(reset ? 8 : 4);++ const params = new URLSearchParams({+ network: state.network,+ offset: String(state.offset),+ limit: String(PAGE_SIZE),+ });+ if (state.agentId) params.set('agent_id', state.agentId);++ try {+ const r = await fetch(`/api/pump/launches?${params}`);+ if (!r.ok) throw new Error(`launches api ${r.status}`);+ const body = await r.json();+ const { launches = [], has_more: hasMore = false } = body.data || {};++ clearSkeletons();+ launches.forEach((l, i) => feedEl.appendChild(launchCard(l, i)));+ state.offset += launches.length;+ state.count += launches.length;+ state.hasMore = hasMore;+ if (state.count === 0) renderEmpty();+ renderFooter();+ updateCount();+ } catch (err) {+ console.error('[launches] feed load failed', err);+ clearSkeletons();+ if (state.count === 0) renderError(() => loadPage({ reset: true }));+ else renderFooter();+ } finally {+ state.loading = false;+ feedEl.setAttribute('aria-busy', 'false');+ }+}++// ── filters ──────────────────────────────────────────────────────────────────++function syncUrl() {+ const url = new URL(location.href);+ if (state.network === 'devnet') url.searchParams.set('network', 'devnet');+ else url.searchParams.delete('network');+ if (state.agentId) url.searchParams.set('agent_id', state.agentId);+ else url.searchParams.delete('agent_id');+ history.replaceState(null, '', url);+}++function setNetwork(network) {+ if (state.network === network) return;+ state.network = network;+ document.querySelectorAll('.lx-net-btn').forEach((b) => {+ const active = b.dataset.network === network;+ b.classList.toggle('active', active);+ b.setAttribute('aria-selected', String(active));+ });+ syncUrl();+ loadPage({ reset: true });+}++function setAgentFilter(agentId) {+ state.agentId = agentId;+ agentFilterEl.hidden = !agentId;+ agentFilterEl.textContent = '';+ syncUrl();+ if (agentId) renderAgentFilterChip(agentId);+ loadPage({ reset: true });+}++async function renderAgentFilterChip(agentId) {+ const chip = el('span', {}, [el('span', { text: `Agent ${shortAddr(agentId)}` })]);+ const clear = el('button', {+ type: 'button',+ 'aria-label': 'Clear agent filter',+ text: '✕',+ onclick: () => setAgentFilter(null),+ });+ agentFilterEl.append(chip, clear);++ // Best-effort name + thumbnail; the chip already works without it.+ try {+ const r = await fetch(`/api/agents/${encodeURIComponent(agentId)}`);+ if (!r.ok) return;+ const body = await r.json();+ const agent = body.agent || body;+ if (state.agentId !== agentId || !agent?.name) return;+ chip.textContent = '';+ if (agent.avatar_thumbnail_url) {+ chip.appendChild(el('img', { src: agent.avatar_thumbnail_url, alt: '' }));+ }+ chip.appendChild(el('span', { text: agent.name }));+ } catch {+ /* keep the short-id chip */+ }+}++// ── boot ─────────────────────────────────────────────────────────────────────++function boot() {+ const qs = new URLSearchParams(location.search);+ state.network = qs.get('network') === 'devnet' ? 'devnet' : 'mainnet';+ const agentId = qs.get('agent_id');+ state.agentId = agentId && /^[0-9a-f-]{36}$/i.test(agentId) ? agentId : null;++ document.querySelectorAll('.lx-net-btn').forEach((b) => {+ const active = b.dataset.network === state.network;+ b.classList.toggle('active', active);+ b.setAttribute('aria-selected', String(active));+ b.addEventListener('click', () => setNetwork(b.dataset.network));+ });++ if (state.agentId) {+ agentFilterEl.hidden = false;+ renderAgentFilterChip(state.agentId);+ }++ loadPage({ reset: true });+}++boot();diff --git a/src/play-agent-wallet.js b/src/play-agent-wallet.jsindex 9756d18a0..38b6a37ae 100644--- a/src/play-agent-wallet.js+++ b/src/play-agent-wallet.js@@ -1,14 +1,14 @@// /play/agent-wallet — your avatar pays for a real x402 endpoint with the-// MetaMask agent wallet, visualized in 3D.+// three.ws agent wallet, visualized in 3D.//// The scene: your /play avatar (localStorage `cc-avatar`, same contract as the// coin-communities world) stands on a plaza with a paid-endpoint kiosk and a// big stage board. Press Pay and the avatar walks to the kiosk while the-// MetaMask Agentic CLI — reached through the local bridge in-// scripts/mm-x402-bridge.mjs — signs a USDC TransferWithAuthorization and the-// endpoint settles it on Base mainnet. Every stage the bridge streams-// (402 → sign → submit → settled) animates the board, the kiosk, and the-// side panel in lockstep. No mocks: the $0.01 leaves the wallet for real.+// agent wallet — reached through the local bridge in+// scripts/agent-wallet-x402-bridge.mjs — partially signs an SPL USDC transfer+// and the endpoint settles it on Solana mainnet. Every stage the bridge+// streams (402 → sign → submit → settled) animates the board, the kiosk, and+// the side panel in lockstep. No mocks: the $0.01 leaves the wallet for real.import {Scene, PerspectiveCamera, WebGLRenderer, Group, Clock, Color, FogExp2,@@ -40,7 +40,7 @@ const TOPICS = [const COL = {bg0: '#0a0a0c', bg1: '#15151a',text: '#f5f5f6', dim: '#8c8c92', faint: '#5a5a60',- mm: '#f6851b', mmLt: '#ffa04d',+ acc: '#9945ff', accLt: '#b88aff',good: '#5fd08a', bad: '#e06c75',line: 'rgba(255,255,255,0.07)',};@@ -48,8 +48,8 @@ const COL = {const STAGES = [{ id: 'walk', label: 'Avatar walks to the endpoint' },{ id: 'challenge', label: '402 challenge received' },- { id: 'signing', label: 'MetaMask agent wallet signs' },- { id: 'submitting', label: 'Submit + settle on Base' },+ { id: 'signing', label: 'Agent wallet signs' },+ { id: 'submitting', label: 'Submit + settle on Solana' },{ id: 'done', label: 'Confirmed on-chain' },];const BOARD_STEPS = [@@ -154,10 +154,10 @@ kioskBezel.rotation.x = -0.16;kioskBezel.castShadow = true;kiosk.add(kioskBezel);-// pay ring on the floor — pulses MetaMask orange while a payment runs+// pay ring on the floor — pulses Solana purple while a payment runsconst payRing = new Mesh(new RingGeometry(0.62, 0.72, 48),- new MeshBasicMaterial({ color: COL.mm, transparent: true, opacity: 0.25, side: DoubleSide }),+ new MeshBasicMaterial({ color: COL.acc, transparent: true, opacity: 0.25, side: DoubleSide }),);payRing.rotation.x = -Math.PI / 2;payRing.position.set(KIOSK_POS.x - 0.9, 0.01, KIOSK_POS.z + 0.55);@@ -167,7 +167,7 @@ scene.add(payRing);const mast = new Mesh(new CylinderGeometry(0.02, 0.02, 0.5, 8), kioskMat);mast.position.set(0.34, 1.95, 0);kiosk.add(mast);-const beacon = new Mesh(new CylinderGeometry(0.05, 0.05, 0.07, 10), new MeshBasicMaterial({ color: COL.mm }));+const beacon = new Mesh(new CylinderGeometry(0.05, 0.05, 0.07, 10), new MeshBasicMaterial({ color: COL.acc }));beacon.position.set(0.34, 2.22, 0);kiosk.add(beacon);@@ -299,13 +299,13 @@ function drawKiosk() {c.fillStyle = COL.faint; c.font = '600 22px Inter, system-ui, sans-serif';const pulse = 0.5 + 0.5 * Math.sin(t * 3);if (live.paying) {- c.fillStyle = `rgba(246,133,27,${0.5 + pulse * 0.5})`;+ c.fillStyle = `rgba(153,69,255,${0.5 + pulse * 0.5})`;c.fillText('● PAYMENT IN PROGRESS', 28, 280);} else if (live.receipt) {c.fillStyle = COL.good;c.fillText('✓ PAID — THANK YOU', 28, 280);} else {- c.fillText('AWAITING PAYMENT · BASE MAINNET', 28, 280);+ c.fillText('AWAITING PAYMENT · SOLANA MAINNET', 28, 280);}kioskTex.needsUpdate = true;}@@ -318,10 +318,10 @@ function drawBoard() {// headerc.textAlign = 'left';- c.fillStyle = COL.mm; c.font = '800 34px Inter, system-ui, sans-serif';- c.fillText('METAMASK AGENT WALLET', padX, 62);+ c.fillStyle = COL.acc; c.font = '800 34px Inter, system-ui, sans-serif';+ c.fillText('THREE.WS AGENT WALLET', padX, 62);c.fillStyle = COL.dim; c.font = '600 19px Inter, system-ui, sans-serif';- c.fillText('x402 MICROPAYMENTS · USDC ON BASE MAINNET (eip155:8453)', padX, 92);+ c.fillText('x402 MICROPAYMENTS · USDC ON SOLANA MAINNET', padX, 92);// wallet chip (top-right)c.textAlign = 'right';c.fillStyle = COL.text; c.font = '700 22px ui-monospace, Menlo, monospace';@@ -350,11 +350,11 @@ function drawBoard() {} else if (live.paying) {c.fillStyle = COL.text; c.font = '800 40px Inter, system-ui, sans-serif';c.fillText(`Paying ${live.quote ? fmtUsdc(live.quote.amount) : ''} USDC for live crypto intel`, padX, heroY);- c.fillStyle = COL.mmLt; c.font = '600 25px Inter, system-ui, sans-serif';+ c.fillStyle = COL.accLt; c.font = '600 25px Inter, system-ui, sans-serif';c.fillText(live.stageText || 'Working…', padX, heroY + 44);} else if (live.receipt) {c.fillStyle = COL.good; c.font = '800 40px Inter, system-ui, sans-serif';- c.fillText(`✓ ${fmtUsdc(live.receipt.amount)} USDC settled on Base`, padX, heroY);+ c.fillText(`✓ ${fmtUsdc(live.receipt.amount)} USDC settled on Solana`, padX, heroY);c.fillStyle = COL.dim; c.font = '600 23px ui-monospace, Menlo, monospace';const txLine = live.receipt.tx ? `tx ${shortTx(live.receipt.tx)}` : 'settlement confirmed';c.fillText(`${shortAddr(live.receipt.payer)} → ${shortAddr(live.receipt.payTo)} · ${txLine}`, padX, heroY + 42);@@ -362,7 +362,7 @@ function drawBoard() {c.fillStyle = COL.text; c.font = '800 40px Inter, system-ui, sans-serif';c.fillText('Your avatar. Your agent wallet. A real paid API.', padX, heroY);c.fillStyle = COL.dim; c.font = '600 25px Inter, system-ui, sans-serif';- c.fillText('Press “Send avatar to pay” — the MetaMask CLI signs, Base settles.', padX, heroY + 44);+ c.fillText('Press “Send avatar to pay” — the agent wallet signs, Solana settles.', padX, heroY + 44);}// stepper@@ -377,11 +377,11 @@ function drawBoard() {const errHere = live.error && i === activeIdx;roundRect(c, x, sy, colW - 26, 6, 3);c.fillStyle = errHere ? COL.bad- : done ? COL.mm- : isActive ? `rgba(246,133,27,${0.35 + pulse * 0.6})`+ : done ? COL.acc+ : isActive ? `rgba(153,69,255,${0.35 + pulse * 0.6})`: 'rgba(255,255,255,0.1)';c.fill();- c.fillStyle = errHere ? COL.bad : done ? COL.text : isActive ? COL.mmLt : COL.faint;+ c.fillStyle = errHere ? COL.bad : done ? COL.text : isActive ? COL.accLt : COL.faint;c.font = '700 19px Inter, system-ui, sans-serif';c.fillText(s.label.toUpperCase(), x, sy + 38);});@@ -430,7 +430,7 @@ renderer.setAnimationLoop(() => {t += dt;if (avatarReady) { tickWalk(dt); anim.update(dt); }payRing.material.opacity = live.paying ? 0.35 + 0.3 * Math.sin(t * 5) : 0.18;- beacon.material.color.set(live.paying ? COL.mmLt : live.bridge === 'offline' ? '#5a5a60' : COL.mm);+ beacon.material.color.set(live.paying ? COL.accLt : live.bridge === 'offline' ? '#5a5a60' : COL.acc);redrawAcc += dt;if (redrawAcc > 0.1) { redrawAcc = 0; drawBoard(); drawKiosk(); }controls.update();@@ -496,12 +496,12 @@ function renderReceipt() {const sigClass = res.signal === 'bullish' ? 'signal-bullish' : res.signal === 'bearish' ? 'signal-bearish' : 'signal-neutral';el.innerHTML = `<div class="r-head">- <span class="r-badge">✓ Settled on Base</span>+ <span class="r-badge">✓ Settled on Solana</span><span class="r-amt">${fmtUsdc(r.amount)} USDC</span></div><div class="rf"><span class="k">From (agent wallet)</span><span class="v">${shortAddr(r.payer)}</span></div><div class="rf"><span class="k">To (endpoint)</span><span class="v">${shortAddr(r.payTo)}</span></div>- ${r.tx ? `<div class="rf"><span class="k">Transaction</span><span class="v"><a href="https://basescan.org/tx/${encodeURIComponent(r.tx)}" target="_blank" rel="noopener">${shortTx(r.tx)} ↗</a></span></div>` : ''}+ ${r.tx ? `<div class="rf"><span class="k">Transaction</span><span class="v"><a href="https://solscan.io/tx/${encodeURIComponent(r.tx)}" target="_blank" rel="noopener">${shortTx(r.tx)} ↗</a></span></div>` : ''}${res.headline ? `<div class="r-payload"><span class="r-signal ${sigClass}">${escapeHtml((res.signal || '').toUpperCase())}</span>${escapeHtml(res.headline)}${res.rationale ? `<div style="color:var(--muted);font-size:12.5px;margin-top:4px">${escapeHtml(res.rationale)}</div>` : ''}</div>` : ''}`;el.classList.add('show');@@ -564,10 +564,10 @@ async function loadQuote() {$('epPrice').textContent = `${fmtUsdc(q.amount)} USDC`;$('epDesc').textContent = q.resource?.description? String(q.resource.description).split('. ').slice(0, 2).join('. ') + '.'- : 'Pay-per-call market signal, settled in USDC on Base mainnet.';+ : 'Pay-per-call market signal, settled in USDC on Solana mainnet.';const tags = $('epTags');tags.innerHTML = '';- for (const tag of [`pay to ${shortAddr(q.payTo)}`, 'Base mainnet', 'EIP-3009 USDC', ...(q.resource?.tags || []).slice(0, 2)]) {+ for (const tag of [`pay to ${shortAddr(q.payTo)}`, 'Solana mainnet', 'SPL USDC', ...(q.resource?.tags || []).slice(0, 2)]) {const el = document.createElement('span');el.className = 'ep-tag';el.textContent = tag;@@ -577,7 +577,7 @@ async function loadQuote() {// quote requires the bridge; the bridge-offline banner already explains$('epName').textContent = 'three.ws Crypto Intel';$('epPrice').textContent = '$0.01 USDC';- $('epDesc').textContent = 'Live market signal (bullish / bearish / neutral) — pay per call, settled in USDC on Base mainnet.';+ $('epDesc').textContent = 'Live market signal (bullish / bearish / neutral) — pay per call, settled in USDC on Solana mainnet.';}updatePayButton();}@@ -645,11 +645,11 @@ function handleStageEvent(evt) {break;case 'signing':live.stage = 'signing';- live.stageText = `MetaMask signing TransferWithAuthorization (${evt.domain?.name || 'USD Coin'})…`;+ live.stageText = `Agent wallet ${shortAddr(evt.signer)} signing the USDC transfer…`;break;case 'signed':live.stage = 'submitting';- live.stageText = 'Signature ready — submitting X-PAYMENT…';+ live.stageText = 'Transaction signed — submitting X-PAYMENT…';break;case 'submitting':live.stage = 'submitting';@@ -657,7 +657,7 @@ function handleStageEvent(evt) {break;case 'done': {live.stage = 'done';- live.stageText = 'Settled on Base mainnet';+ live.stageText = 'Settled on Solana mainnet';live.receipt = {amount: evt.amount,payer: evt.payer,diff --git a/src/shared/x402-loader.js b/src/shared/x402-loader.jsnew file mode 100644index 000000000..f47beb023--- /dev/null+++ b/src/shared/x402-loader.js@@ -0,0 +1,43 @@+// Shared x402 SDK loader — load the payment widget on demand, once.+//+// public/x402.js is an ES module that freezes window.X402 on evaluation. It+// lives at the site root in dev (Vite serves /public) and prod (copied to /),+// but most pages don't ship it in their HTML — callers that take payments+// (cosmetics shop, NPC services, intel kiosk) load it the first time a player+// transacts: one network fetch, cached for the session.+//+// Loaded via an injected <script type="module"> rather than a dynamic+// import(): Vite refuses to serve /public assets through the module transform+// pipeline (dev 500s with "can only be referenced via HTML tags"), while a+// script tag works identically in dev and prod. A module script's load event+// fires after evaluation, so window.X402 is frozen by the time we resolve.+//+// Resolves with window.X402 (pay() ready); rejects if the script can't load.+// A failed load clears the in-flight promise so a later interaction retries.++let x402Loading = null;++export function ensureX402() {+ if (typeof window !== 'undefined' && window.X402 && typeof window.X402.pay === 'function') {+ return Promise.resolve(window.X402);+ }+ if (!x402Loading) {+ x402Loading = new Promise((resolve, reject) => {+ const script = document.createElement('script');+ script.type = 'module';+ script.src = '/x402.js';+ script.addEventListener('load', resolve, { once: true });+ script.addEventListener('error', () => reject(new Error('Payment library failed to load.')), { once: true });+ document.head.appendChild(script);+ }).then(() => {+ if (!window.X402 || typeof window.X402.pay !== 'function') {+ throw new Error('Payment library failed to load.');+ }+ return window.X402;+ }).catch((err) => {+ x402Loading = null; // let a later interaction retry a transient failure+ throw err;+ });+ }+ return x402Loading;+}diff --git a/tests/api/three-intel.test.js b/tests/api/three-intel.test.jsnew file mode 100644index 000000000..d1dec73f0--- /dev/null+++ b/tests/api/three-intel.test.js@@ -0,0 +1,95 @@+// Tests for /api/x402/three-intel — the $THREE Town Oracle endpoint.+//+// Pure-logic only — we exercise the exported helpers (buildSignal, BAZAAR)+// rather than the paidEndpoint HTTP wrapper, keeping tests off the network+// while covering everything the wire format and the kiosk depend on.+//+// Coverage:+// • buildSignal thresholds: bullish (>5, >1), bearish (<-5, <-1), neutral+// • turnover (volume/liquidity) shapes the rationale's flow line+// • confidence stays in [0.4, 0.93] and grows with |change|+// • The bazaar block advertises the output fields the kiosk renders++import { describe, it, expect } from 'vitest';+import { buildSignal, BAZAAR } from '../../api/x402/three-intel.js';++const base = { price_usd: 0.0036, volume_24h_usd: 500_000, liquidity_usd: 400_000 };++describe('buildSignal — thresholds', () => {+ it('strong pump reads bullish with a surge headline', () => {+ const s = buildSignal({ ...base, change_24h: 12.4 });+ expect(s.signal).toBe('bullish');+ expect(s.headline).toContain('surges');+ expect(s.headline).toContain('+12.40%');+ });++ it('mild gain reads bullish with a climb headline', () => {+ const s = buildSignal({ ...base, change_24h: 2.1 });+ expect(s.signal).toBe('bullish');+ expect(s.headline).toContain('climbs');+ });++ it('strong dump reads bearish', () => {+ const s = buildSignal({ ...base, change_24h: -9.8 });+ expect(s.signal).toBe('bearish');+ expect(s.headline).toContain('drops');+ expect(s.headline).toContain('9.80%');+ });++ it('mild loss reads bearish with a slip headline', () => {+ const s = buildSignal({ ...base, change_24h: -1.7 });+ expect(s.signal).toBe('bearish');+ expect(s.headline).toContain('slips');+ });++ it('flat tape reads neutral and quotes the price', () => {+ const s = buildSignal({ ...base, change_24h: 0.3 });+ expect(s.signal).toBe('neutral');+ expect(s.headline).toContain('consolidating');+ expect(s.headline).toContain('$0.003600');+ });+});++describe('buildSignal — flow line from volume/liquidity turnover', () => {+ it('high turnover (>3×) reads as high conviction', () => {+ const s = buildSignal({ ...base, change_24h: 6, volume_24h_usd: 2_000_000, liquidity_usd: 400_000 });+ expect(s.rationale).toContain('high conviction');+ });++ it('moderate turnover (1–3×) reads as real participation', () => {+ const s = buildSignal({ ...base, change_24h: 6, volume_24h_usd: 600_000, liquidity_usd: 400_000 });+ expect(s.rationale).toContain('participation is real');+ });++ it('light turnover (<1×) reads as limited backing', () => {+ const s = buildSignal({ ...base, change_24h: 6, volume_24h_usd: 100_000, liquidity_usd: 400_000 });+ expect(s.rationale).toContain('limited backing');+ });++ it('missing flow data degrades to a thin-data caveat', () => {+ const s = buildSignal({ ...base, change_24h: 6, volume_24h_usd: null, liquidity_usd: null });+ expect(s.rationale).toContain('Flow data is thin');+ });+});++describe('buildSignal — confidence', () => {+ it('grows with |change| and stays within [0.64, 0.93]', () => {+ const calm = buildSignal({ ...base, change_24h: 0.2 });+ const wild = buildSignal({ ...base, change_24h: 40 });+ expect(calm.confidence).toBeGreaterThanOrEqual(0.64);+ expect(wild.confidence).toBeLessThanOrEqual(0.93);+ expect(wild.confidence).toBeGreaterThan(calm.confidence);+ });+});++describe('BAZAAR — discovery block', () => {+ it('advertises every field the kiosk renders', () => {+ const props = BAZAAR.schema?.properties?.output?.properties+ ?? BAZAAR.output?.example ?? {};+ for (const key of ['signal', 'headline', 'price_usd', 'change_24h', 'market_cap_usd']) {+ expect(BAZAAR.output.example).toHaveProperty(key);+ }+ expect(props).toBeTruthy();+ expect(BAZAAR.output.example.mint).toBe('FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump');+ });+});diff --git a/tests/api/zauth-reposcan.test.js b/tests/api/zauth-reposcan.test.jsnew file mode 100644index 000000000..cd0a8477a--- /dev/null+++ b/tests/api/zauth-reposcan.test.js@@ -0,0 +1,109 @@+// Tests for /api/zauth-reposcan — the same-origin pass-through that lets the+// in-game wallet modal pay zauth's RepoScan x402 endpoint.+//+// Pure-logic only — we exercise the exported helpers (normalizeEnvelope and+// the input guards) rather than the HTTP wrapper, keeping tests off the+// network while covering the envelope translation a settled payment depends+// on (verified live 2026-06-12: zauth only reads `payment-signature`, with+// resource.url pointing at THEIR endpoint).+//+// Coverage:+// • normalizeEnvelope rewrites resource.url to the upstream URL+// • strips the modal's extra top-level fields (scheme/network/extensions)+// • preserves payload + accepted byte-for-byte (the signed transfer)+// • passes non-base64 / non-envelope values through untouched+// • REPO_RE accepts owner/repo shapes and rejects traversal/URL injection+// • SESSION_RE accepts JWT-style tokens, rejects path metacharacters++import { describe, it, expect } from 'vitest';+import { normalizeEnvelope, REPO_RE, SESSION_RE } from '../../api/zauth-reposcan.js';++const UPSTREAM = 'https://api.zauth.inc/x402/reposcan';++const accepted = {+ scheme: 'exact',+ network: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',+ amount: '50000',+ asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',+ payTo: 'ZAU64eKWAgiGNux8bzvgRn8RvWqFhdMVrpJytF7V1qm',+ maxTimeoutSeconds: 300,+ extra: { feePayer: 'ZAU64eKWAgiGNux8bzvgRn8RvWqFhdMVrpJytF7V1qm' },+};++// What public/x402.js + api/x402-checkout handleEncode actually emit.+const modalEnvelope = {+ x402Version: 2,+ scheme: 'exact',+ network: accepted.network,+ resource: { url: 'https://three.ws/api/zauth-reposcan', mimeType: 'application/json' },+ accepted,+ payload: { transaction: 'AQa1b2c3signedtransferbytes==' },+ extensions: { 'builder-code': { code: 'three' } },+};++const encode = (obj) => Buffer.from(JSON.stringify(obj)).toString('base64');+const decode = (b64) => JSON.parse(Buffer.from(b64, 'base64').toString('utf8'));++describe('normalizeEnvelope — modal → zauth translation', () => {+ it('rewrites resource.url to the upstream endpoint', () => {+ const out = decode(normalizeEnvelope(encode(modalEnvelope)));+ expect(out.resource.url).toBe(UPSTREAM);+ expect(out.resource.mimeType).toBe('application/json');+ });++ it('strips the extra top-level fields the modal adds', () => {+ const out = decode(normalizeEnvelope(encode(modalEnvelope)));+ expect(out).not.toHaveProperty('scheme');+ expect(out).not.toHaveProperty('network');+ expect(out).not.toHaveProperty('extensions');+ expect(Object.keys(out).sort()).toEqual(['accepted', 'payload', 'resource', 'x402Version']);+ });++ it('preserves the signed payload and accepted entry exactly', () => {+ const out = decode(normalizeEnvelope(encode(modalEnvelope)));+ expect(out.payload).toEqual(modalEnvelope.payload);+ expect(out.accepted).toEqual(accepted);+ expect(out.x402Version).toBe(2);+ });++ it('defaults x402Version to 2 and omits accepted when absent', () => {+ const out = decode(normalizeEnvelope(encode({ payload: { transaction: 'x' } })));+ expect(out.x402Version).toBe(2);+ expect(out).not.toHaveProperty('accepted');+ });++ it('passes non-envelope values through untouched', () => {+ expect(normalizeEnvelope('not-base64-json!!')).toBe('not-base64-json!!');+ const noPayload = encode({ hello: 'world' });+ expect(normalizeEnvelope(noPayload)).toBe(noPayload);+ });+});++describe('input guards', () => {+ it('REPO_RE accepts real owner/repo shapes', () => {+ for (const ok of ['nirholas/three.ws', 'a/b', 'octo-cat/Hello.World_2']) {+ expect(ok).toMatch(REPO_RE);+ }+ });++ it('REPO_RE rejects URLs, traversal, and missing parts', () => {+ for (const bad of [+ 'https://github.com/owner/repo',+ 'owner/repo/extra',+ 'owner',+ '../etc/passwd',+ 'owner/repo?x=1',+ '-leadinghyphen/repo',+ 'owner/re po',+ ]) {+ expect(bad).not.toMatch(REPO_RE);+ }+ });++ it('SESSION_RE accepts JWT-style tokens and rejects path injection', () => {+ expect('eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4In0.sig-part_1').toMatch(SESSION_RE);+ expect('short').not.toMatch(SESSION_RE);+ expect('abc/def/../escape').not.toMatch(SESSION_RE);+ expect('token with spaces').not.toMatch(SESSION_RE);+ });+});diff --git a/vercel.json b/vercel.jsonindex 676de2580..0d9ac5a31 100644--- a/vercel.json+++ b/vercel.json@@ -55,6 +55,10 @@"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 60},+ "api/zauth-reposcan.js": {+ "includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",+ "maxDuration": 60+ },"api/x402/forge.js": {"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 60@@ -527,6 +531,10 @@"src": "/pump-live/?","dest": "/pump-live.html"},+ {+ "src": "/launches/?",+ "dest": "/launches.html"+ },{"src": "/admin/bulk-launch/?","dest": "/bulk-launch.html"diff --git a/vite.config.js b/vite.config.jsindex 1001392ef..d9d948675 100644--- a/vite.config.js+++ b/vite.config.js@@ -306,6 +306,7 @@ const appConfig = {'embed-walk': resolve(__dirname, 'pages/embed-walk.html'),'agent-embed': resolve(__dirname, 'pages/agent-embed.html'),'agent-detail': resolve(__dirname, 'pages/agent-detail.html'),+ launches: resolve(__dirname, 'pages/launches.html'),'avatar-embed': resolve(__dirname, 'pages/avatar-embed.html'),'avatar-wallet-chat': resolve(__dirname, 'pages/avatar-wallet-chat.html'),'agent-exchange': resolve(__dirname, 'pages/agent-exchange.html'),@@ -657,6 +658,8 @@ const appConfig = {'/go/': resolve(root, 'pages/go.html'),'/bounties': resolve(root, 'pages/bounties.html'),'/bounties/': resolve(root, 'pages/bounties.html'),+ '/launches': resolve(root, 'pages/launches.html'),+ '/launches/': resolve(root, 'pages/launches.html'),'/pump-live': resolve(root, 'pages/pump-live.html'),'/pump-live/': resolve(root, 'pages/pump-live.html'),'/pump-dashboard': resolve(root, 'pages/pump-dashboard.html'),