Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: implement house-ownership guarantee in launcher engine
qrqke5c5d6f83238
diff --git a/.env.example b/.env.exampleindex 51e86c61d..be7a32cce 100644--- a/.env.example+++ b/.env.example@@ -943,6 +943,27 @@ PUMP_DISTRIBUTE_FALLBACK_PAYER=# Generate: openssl rand -base64 32PUMPKIT_WEBHOOK_SECRET=+# ── Autonomous coin launcher (api/_lib/launcher-engine.js + /api/cron/launcher-tick) ─+# The "Memetic Launcher": platform agents mint pump.fun coins on a cadence riding+# live cultural narratives, each agent signing its OWN create. Ships INERT — fully+# off until armed via POST /api/admin/launcher { enabled:true, dry_run:false }+# (use scripts/launcher-ops.mjs). Funding is just-in-time and capped.+#+# Master launch wallet — the ONLY wallet SOL is ever taken from. It never mints;+# it tops up the next agent in the rotation with exactly per_launch_sol, then the+# agent signs its own create. Base64 of a 64-byte Solana secret key. Falls back to+# PUMP_X402_LAUNCHER_SECRET_KEY_B64 so existing infra keeps working.+# Generate: node scripts/gen-solana-signer-key.mjs --var LAUNCHER_MASTER_SECRET_KEY_B64+# Fund the derived pubkey with SOL before arming.+LAUNCHER_MASTER_SECRET_KEY_B64=+#+# House-ownership guarantee (optional but recommended). Comma-separated user uuids+# we control. When set, the GLOBAL rotation is HARD-restricted to agents owned by+# exactly these accounts — only house-owned agents ever launch. Unset = the+# platform circulation pool (also bot accounts, never real users).+# LAUNCHER_OWNER_USER_IDS=11111111-2222-4333-8444-555555555555,...+LAUNCHER_OWNER_USER_IDS=+# ── Mint-mark kill-switch (api/pump/[action].js: launch-prep + launch-agent) ─# Controls whether branded launches must carry the "3ws" mint mark.# Default: ON (any value other than '0' or 'false' enforces fail-closed).diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 425373889..91ca3e3d0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -30,13 +30,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **RSS Feed Health — the platform validates its own changelog XML feed every 5 minutes** — A broken RSS feed is invisible — the feed URL returns 200, but the XML inside is malformed, the item count drifted after a skipped build step, or the latest entry title diverged from the canonical record. The platform now catches all three failure modes automatically. Every five minutes an autonomous agent makes a real on-chain payment to a new /api/x402/feed-health endpoint with body { feed: "changelog_rss" }. The endpoint fetches three.ws/changelog.xml, parses it as RSS 2.0 with fast-xml-parser, counts the <item> elements, and cross-checks the latest item title against the canonical public/changelog.json compiled output. If any of those checks fail — invalid XML, unreachable URL, title mismatch — the { valid: false } verdict is recorded as an actionable signal in x402_autonomous_log.signal_data so the status surface can read feed health in a single lookup. The same endpoint is available on the x402 bazaar for $0.001 per check. `[infra, feature]`- **Selfie → avatar now works on the Tripo engine** — Building an avatar from a selfie could fail with "Avatar engine is having trouble" when the Tripo 3D engine was in use. Your photo is sent to the engine as inline image data, but Tripo only accepts an uploaded image — so every selfie was being rejected. We now upload your photo to the engine first and reference it correctly, so selfie-to-avatar succeeds on Tripo just like it already did on the other engine. (`/create/selfie`) `[fix]`- **Skill Marketplace: most-purchased skills signal** — The autonomous x402 loop now pays every 30 minutes to retrieve the 5 most-purchased agent skills over the past 7 days from the real hire ledger. The top skill and full ranked list land in the autonomous log as actionable signal for featured-listing curation — a shift in the top skill across runs surfaces emerging high-demand capabilities automatically. `[feature, infra]`+- **The "Save to my avatars" button is readable on every theme** — On pages with a white accent color, the "⑂ Save to my avatars" button (shown on any avatar you don't own) rendered white text on a white background — effectively invisible. The button now picks its text color from the actual button background, so a light button gets black text and a dark button keeps white, keeping the label legible everywhere it appears. `[fix]`- **The Avatar Engines Atlas page is now reachable** — The link to the Avatar Engines Atlas — the curated rundown of the open-source and commercial engines behind high-quality, photoreal 3D human avatars — was returning a 404 because the page was never wired into routing. The route is now in place, so the page opens from navigation as intended. (`/avatar-engines`) `[fix]`- **The main menu is now organized — no more walls of links** — The top navigation kept everything but had become hard to scan: the Launch menu alone listed 25 features in one long single-column drop-down, and nearly every item shouted a "New" badge, so the badge meant nothing. Each menu — Build, Discover, Launch, Learn — is now split into clearly labelled columns grouped by what you're trying to do (Launch, for example, splits into Launch / Terminal & trade / Intelligence / Compete & earn). Every feature is still one click away, on desktop and in the mobile drawer; nothing was removed or moved off-platform. The only badge left is the green "Live" dot, which now genuinely means the page is running right now. `[improvement]`- **The Money Pulse now sits on a pure-black canvas** — The Money Pulse page (/pulse) now renders on a true black background in every theme, so the live feed of tips, launches, trades and agent-to-agent payments reads as one calm, high-contrast field. Previously the page could pick up a lighter surface or near-black tone depending on your theme; it's now consistently black with the monochrome ink ramp pinned for readability. (`/pulse`) `[improvement]`- **Trending and the agent directory now actually show agents** — The Trending leaderboard (/trending) and the public agent directory were coming up empty no matter how busy the platform was — every list rendered "No trending agents yet." Both feeds ranked agents by chat activity using a column that doesn't exist in the database, so the query failed silently and returned nothing. They now count real chat activity (LLM usage events) the same way the rest of the site does, so the 24h, 7d, and all-time rankings — and the directory's "popular" sort — populate with the agents people are actually using. (`/trending`) `[fix]`- **User Activity Analytics — DAU, WAU, and top features now tracked every 6 hours via x402** — The platform now monitors its own engagement metrics automatically. Every six hours an autonomous agent pays the /api/x402/analytics endpoint for a live user_activity report — computing DAU, WAU, stickiness (DAU/WAU ratio), the top ten features by event volume, the platform error rate, and session-length distribution (average, median, and p90). All figures are read live from the real metered tables; an empty window returns zeros, never fabricated numbers. The extracted signal — dau, wau, top_feature — is recorded to x402_autonomous_log for the status surface to read, and every snapshot is persisted to a user_activity_snapshots time series for trend alerting and the engagement dashboard. The same report is available to any x402 agent on the bazaar for $0.005 per call. `[feature, infra]`- **x402 Volume Analytics — the platform measures its own payment economy every 30 minutes** — The autonomous loop now pays /api/x402/analytics every 30 minutes with { report: "x402_volume", period: "24h" } for a live read of x402 transaction volume across every paid endpoint. The report comes straight from the settled-payment ledger and returns the totals that prove ecosystem growth — total settled calls, total USDC paid, and unique paying wallets — alongside a per-endpoint breakdown and the least-active ("underused") endpoints, so the platform can see at a glance which services are thriving and which need a push or a rethink. The headline totals and the underused-endpoint list are recorded as an actionable signal, and the same report is available to any x402 agent on the bazaar for $0.005 per call. `[feature, infra]`-- **Your agents now deploy themselves on-chain — no wallet popup** — The On-chain Deployments page (/deployments) tracks every agent that lands on the ERC-8004 Identity Registry. Until now three.ws only read other people's registrations; putting one of your own agents on-chain meant signing a transaction yourself in a browser wallet. Agents now register themselves: every public agent with a 3D body gets deployed to the Base Identity Registry from its own built-in wallet, with the platform covering the few cents of gas. The registration includes the agent's GLB avatar and x402 payment support, so it shows up immediately in the live feed counted as a 3D, payment-ready on-chain identity — no human in the loop. (`/deployments`) `[feature]`+- **Your agents now deploy themselves on-chain on Solana — automatically** — Putting an agent on-chain used to be a manual step. Now it's continuous and hands-off: every undeployed agent is minted as a real Metaplex Core asset inside the three.ws Agents collection and enrolled in the Metaplex Agent Registry, on a recurring schedule, with the platform's collection authority signing and paying the small Solana mint cost. Your agent owns its own on-chain identity through its built-in Solana wallet — and never has to sign or hold SOL to get there. No admin run, no wallet popup, no human in the loop. `[feature]`## 2026-06-27diff --git a/api/_lib/auto-rig.js b/api/_lib/auto-rig.jsindex f624a074a..2d48bd633 100644--- a/api/_lib/auto-rig.js+++ b/api/_lib/auto-rig.js@@ -40,7 +40,7 @@ import { randomUUID, createHash } from 'crypto';import { sql } from './db.js';import { putObject, publicUrl, presignGet } from './r2.js';import { storageKeyFor, createAvatar } from './avatars.js';-import { getRegenProvider } from './regen-provider.js';+import { getRegenProviderForMode } from './regen-provider.js';import { inspectGlb, isValidGlbHeader } from './glb-inspect.js';import { dispatchWebhooks } from './webhook-dispatch.js';import { limits } from './rate-limit.js';@@ -153,15 +153,11 @@ export async function maybeAutoRigAvatar({let provider;try {- provider = await getRegenProvider();+ provider = await getRegenProviderForMode('rerig');} catch {return { queued: false, skipped: 'no_provider' };}- const canRig =- provider?.instance &&- typeof provider.instance.supportsMode === 'function' &&- provider.instance.supportsMode('rerig');- if (!canRig) return { queued: false, skipped: 'no_rig_model' };+ if (!provider?.instance) return { queued: false, skipped: 'no_rig_model' };// Idempotency: never stack a second auto-rig job on the same avatar. A// retry or a double-create would otherwise race two rigged siblings off thediff --git a/api/_lib/erc8004-publish.js b/api/_lib/erc8004-publish.jsdeleted file mode 100644index 3e3265819..000000000--- a/api/_lib/erc8004-publish.js+++ /dev/null@@ -1,368 +0,0 @@-// @ts-check-// Autonomous ERC-8004 deployment — the WRITE side of the on-chain registry.-//-// The crawler (api/cron/erc8004-crawl) READS every Registered event other people-// emit. This module lets three.ws agents land on-chain themselves, with no-// browser, no wallet popup, no human in the loop: each agent already owns a-// custodial EVM wallet (agent_identities.wallet_address + encrypted key), so the-// server signs IdentityRegistry.register(agentURI) AS THE AGENT. The agent ends-// up owning its own ERC-8004 identity from its own address — not a shared relayer-// key. A platform relayer only sponsors the few cents of Base gas.-//-// Pipeline per agent (publishAgentOnchain):-// 1. Build the ERC-8004 registration manifest (avatar GLB service + x402 fields-// so the crawler/feed mark it has_3d + x402-enabled) and pin it.-// 2. Recover the agent's custodial signer; top up gas from the relayer if low.-// 3. register(metadataURI) from the agent wallet, wait for the receipt.-// 4. Decode the Registered event → agentId; persist to agent_identities AND-// upsert erc8004_agents_index so the /deployments feed shows it immediately-// (no wait for the next crawl tick).-// 5. Publish the live-feed "agent-onchain" event.-//-// Every external boundary (pin, RPC, registry) is wrapped; a failure on one agent-// throws a typed PublishError the cron records and moves on — never half-writes.--import { Contract, Interface, Wallet, formatEther, parseEther } from 'ethers';-import { PutObjectCommand } from '@aws-sdk/client-s3';--import { sql } from './db.js';-import { env } from './env.js';-import { r2, publicUrl } from './r2.js';-import { evmFallbackProvider } from './evm/rpc.js';-import { recoverAgentKey } from './agent-wallet.js';-import { erc8004RegistryFields } from './three-brand.js';-import { IDENTITY_REGISTRY_MAINNET } from './erc8004-chains.js';-import { publishFeedEvent } from './feed.js';--export const BASE_CHAIN_ID = 8453;-const BASE_EXPLORER = 'https://basescan.org';--// Only the single-arg overload — naming the exact signature avoids ethers'-// "multiple matching functions" ambiguity on the overloaded register().-const REGISTER_ABI = [- 'function register(string agentURI) external returns (uint256 agentId)',- 'event Registered(uint256 indexed agentId, string agentURI, address indexed owner)',-];-const REGISTRY_IFACE = new Interface(REGISTER_ABI);-const REGISTERED_TOPIC = REGISTRY_IFACE.getEvent('Registered').topicHash;--// Gas the agent wallet needs on hand to land register(). Base fees are a fraction-// of a cent; the stipend is deliberately generous so a fee spike can't strand a-// half-funded wallet, and is swept-once (only sent when the balance is below it).-const GAS_STIPEND_ETH = process.env.ERC8004_GAS_STIPEND_ETH || '0.00006';-// Below this, top the wallet up before registering.-const GAS_FLOOR_ETH = process.env.ERC8004_GAS_FLOOR_ETH || '0.00003';--export class PublishError extends Error {- /** @param {string} code @param {string} message */- constructor(code, message) {- super(message);- this.name = 'PublishError';- this.code = code;- }-}--/**- * Resolve an avatar row's GLB + thumbnail into public HTTPS URLs the on-chain- * metadata can point at. Returns null when the GLB isn't publicly resolvable —- * we never publish an agent whose body 404s for everyone but its owner.- * @param {{ glb_key?: string|null, thumbnail_key?: string|null, visibility?: string|null }} avatar- */-export function resolveAvatarUrls(avatar) {- if (!avatar?.glb_key) return null;- if (avatar.visibility && avatar.visibility !== 'public' && avatar.visibility !== 'unlisted') {- return null;- }- return {- glbUrl: publicUrl(avatar.glb_key),- imageUrl: avatar.thumbnail_key ? publicUrl(avatar.thumbnail_key) : '',- };-}--/**- * Build the ERC-8004 registration manifest for an agent. The `services[avatar]`- * entry is what the crawler reads to set has_3d; erc8004RegistryFields supplies- * the x402 / endpoint block. Pure — unit-testable without a DB or chain.- * @param {{ name: string, description?: string|null }} agent- * @param {{ glbUrl: string, imageUrl?: string }} urls- * @param {string} [origin]- */-export function buildAgentManifest(agent, urls, origin = env.APP_ORIGIN) {- const o = String(origin || 'https://three.ws').replace(/\/$/, '');- return {- $schema: 'https://3d-agent.io/schemas/manifest/0.1.json',- spec: 'agent-manifest/0.1',- name: agent.name,- description: agent.description || '',- image: urls.imageUrl || '',- tags: ['3d', 'avatar'],- body: { uri: urls.glbUrl, format: 'gltf-binary' },- services: [{ name: 'avatar', endpoint: urls.glbUrl, format: 'gltf-binary' }],- ...erc8004RegistryFields(o),- };-}--/**- * Persist the manifest. R2 is always the source of truth (returns a real HTTPS- * metadataURI); IPFS pinning is layered on when a provider token is present.- * Mirrors api/agents/register/[action].js so both registration paths agree.- * @param {object} manifest- * @returns {Promise<{ cid: string|null, metadataURI: string }>}- */-export async function pinManifest(manifest) {- const bytes = Buffer.from(JSON.stringify(manifest), 'utf-8');-- const storeToR2 = async () => {- const key = `agent-registrations/${Date.now()}-${Math.random().toString(36).slice(2)}.json`;- await r2.send(- new PutObjectCommand({- Bucket: env.S3_BUCKET,- Key: key,- Body: bytes,- ContentType: 'application/json',- }),- );- return publicUrl(key);- };-- const web3Token = process.env.WEB3_STORAGE_TOKEN;- if (web3Token) {- try {- const res = await fetch('https://api.web3.storage/upload', {- method: 'POST',- headers: { Authorization: `Bearer ${web3Token}` },- body: bytes,- });- if (res.ok) {- const r = await res.json();- if (r.cid) {- await storeToR2();- return { cid: r.cid, metadataURI: `ipfs://${r.cid}` };- }- }- } catch {- /* fall through to next provider */- }- }-- const pinataJwt = process.env.PINATA_JWT;- if (pinataJwt) {- try {- const form = new FormData();- form.append(- 'file',- new Blob([bytes], { type: 'application/json' }),- 'agent-manifest.json',- );- const res = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {- method: 'POST',- headers: { Authorization: `Bearer ${pinataJwt}` },- body: form,- });- if (res.ok) {- const r = await res.json();- if (r.IpfsHash) {- await storeToR2();- return { cid: r.IpfsHash, metadataURI: `ipfs://${r.IpfsHash}` };- }- }- } catch {- /* fall through to R2-only */- }- }-- const httpsUrl = await storeToR2();- return { cid: null, metadataURI: httpsUrl };-}--/**- * Recover (or lazily provision) the agent's custodial EVM signer, bound to a- * Base provider.- * @param {{ id: string, user_id?: string, wallet_address?: string|null, meta?: any }} agent- * @param {import('ethers').Provider} provider- */-async function agentSigner(agent, provider) {- let encrypted = agent.meta?.encrypted_wallet_key;- if (!encrypted) {- const { getOrCreateAgentEvmWallet } = await import('./agent-wallet.js');- await getOrCreateAgentEvmWallet(agent.id, { chainId: BASE_CHAIN_ID });- const [row] = await sql`select meta from agent_identities where id = ${agent.id} limit 1`;- encrypted = row?.meta?.encrypted_wallet_key;- }- if (!encrypted) throw new PublishError('no_custodial_key', 'agent has no custodial wallet key');- const pk = await recoverAgentKey(encrypted, {- agentId: agent.id,- userId: agent.user_id,- reason: 'erc8004_autopublish',- });- return new Wallet(pk, provider);-}--/**- * Ensure the agent wallet can pay for register(); sponsor gas from the relayer if- * it's below the floor. Returns the sponsoring tx hash, or null if no top-up was- * needed.- * @param {import('ethers').Wallet} relayer- * @param {string} agentAddress- * @param {import('ethers').Provider} provider- */-async function ensureGas(relayer, agentAddress, provider) {- const balance = await provider.getBalance(agentAddress);- if (balance >= parseEther(GAS_FLOOR_ETH)) return null;- const tx = await relayer.sendTransaction({- to: agentAddress,- value: parseEther(GAS_STIPEND_ETH),- });- await tx.wait(1);- return tx.hash;-}--/**- * Deploy one agent to the ERC-8004 Identity Registry on Base. Idempotent at the- * caller level (skip agents that already carry erc8004_agent_id). Throws- * PublishError on any boundary failure without leaving a partial DB write.- *- * @param {object} agent joined agent_identities + avatar row:- * { id, user_id, name, description, wallet_address, meta,- * glb_key, thumbnail_key, visibility }- * @param {object} [opts]- * @param {import('ethers').Wallet} opts.relayer gas sponsor (required)- * @param {import('ethers').Provider} [opts.provider]- * @returns {Promise<{ agentId: string, txHash: string, owner: string, metadataURI: string }>}- */-export async function publishAgentOnchain(agent, { relayer, provider } = {}) {- if (!relayer) throw new PublishError('no_relayer', 'gas relayer is required');- if (!IDENTITY_REGISTRY_MAINNET) throw new PublishError('no_registry', 'registry address unset');-- const urls = resolveAvatarUrls({- glb_key: agent.glb_key,- thumbnail_key: agent.thumbnail_key,- visibility: agent.visibility,- });- if (!urls) throw new PublishError('no_public_glb', 'agent has no publicly resolvable GLB');-- provider = provider || (await evmFallbackProvider(BASE_CHAIN_ID));-- // 1. Manifest + pin.- const manifest = buildAgentManifest(agent, urls);- const { cid, metadataURI } = await pinManifest(manifest);-- // 2. Signer + gas.- const signer = await agentSigner(agent, provider);- await ensureGas(relayer, signer.address, provider);-- // 3. register(metadataURI) AS THE AGENT.- const registry = new Contract(IDENTITY_REGISTRY_MAINNET, REGISTER_ABI, signer);- let receipt;- try {- const tx = await registry.register(metadataURI);- receipt = await tx.wait(1);- } catch (err) {- throw new PublishError('register_failed', err?.shortMessage || err?.message || String(err));- }- if (!receipt || receipt.status !== 1) {- throw new PublishError('register_reverted', 'register() reverted on-chain');- }-- // 4. Decode the Registered event for the assigned agentId.- let agentId = null;- for (const log of receipt.logs) {- if (- log.address.toLowerCase() !== IDENTITY_REGISTRY_MAINNET.toLowerCase() ||- log.topics[0] !== REGISTERED_TOPIC- ) {- continue;- }- try {- const parsed = REGISTRY_IFACE.parseLog({ topics: log.topics, data: log.data });- agentId = parsed.args.agentId.toString();- break;- } catch {- /* keep scanning */- }- }- if (!agentId) throw new PublishError('no_event', 'Registered event missing from receipt');-- const owner = signer.address.toLowerCase();- const registry_addr = IDENTITY_REGISTRY_MAINNET.toLowerCase();- const block = receipt.blockNumber ?? null;- const txHash = receipt.hash;- const registeredAt = new Date().toISOString();-- // 5. Persist: agent_identities (our record) + erc8004_agents_index (the feed).- await sql`- update agent_identities- set chain_id = ${BASE_CHAIN_ID},- erc8004_agent_id = ${agentId},- erc8004_registry = ${registry_addr},- registration_cid = ${cid},- updated_at = now()- where id = ${agent.id}- `;-- await sql`- insert into erc8004_agents_index- (chain_id, agent_id, owner, registry, agent_uri, name, description, image,- glb_url, services, x402_support, has_3d, active,- registered_block, registered_tx, registered_at, last_metadata_at, last_seen_at)- values- (${BASE_CHAIN_ID}, ${agentId}, ${owner}, ${registry_addr}, ${metadataURI},- ${agent.name || null}, ${agent.description || null}, ${urls.imageUrl || null},- ${urls.glbUrl}, ${JSON.stringify(manifest.services)}::jsonb, true, true, true,- ${block}, ${txHash}, ${registeredAt}, now(), now())- on conflict (chain_id, agent_id) do update set- owner = excluded.owner,- agent_uri = excluded.agent_uri,- name = excluded.name,- description = excluded.description,- image = excluded.image,- glb_url = excluded.glb_url,- services = excluded.services,- x402_support = excluded.x402_support,- has_3d = excluded.has_3d,- active = true,- registered_block = excluded.registered_block,- registered_tx = excluded.registered_tx,- registered_at = coalesce(erc8004_agents_index.registered_at, excluded.registered_at),- last_metadata_at = now(),- last_seen_at = now()- `;-- // 6. Live feed — only after the tx is mined and indexed.- publishFeedEvent({- type: 'agent-onchain',- ts: Date.now(),- actor: agent.name || 'An agent',- agentId: agent.id,- name: agent.name || 'An agent',- chain: 'Base',- onchainId: agentId,- txUrl: `${BASE_EXPLORER}/tx/${txHash}`,- autonomous: true,- }).catch(() => {});-- return { agentId, txHash, owner, metadataURI };-}--/**- * Select agents eligible for autonomous deployment: public, not yet on-chain,- * with a publicly resolvable 3D body. Oldest first so the backlog drains FIFO.- * @param {number} limit- */-export async function selectDeployableAgents(limit) {- return sql`- select i.id, i.user_id, i.name, i.description, i.wallet_address, i.meta,- a.storage_key as glb_key, a.thumbnail_key, a.visibility- from agent_identities i- join avatars a on a.id = i.avatar_id and a.deleted_at is null- where i.deleted_at is null- and i.is_public = true- and i.erc8004_agent_id is null- and a.storage_key is not null- and a.visibility in ('public', 'unlisted')- order by i.created_at asc- limit ${limit}- `;-}--export { GAS_STIPEND_ETH, GAS_FLOOR_ETH, formatEther };diff --git a/api/_lib/launcher-engine.js b/api/_lib/launcher-engine.jsindex 9167d9807..4071107a9 100644--- a/api/_lib/launcher-engine.js+++ b/api/_lib/launcher-engine.js@@ -49,6 +49,20 @@ const FAIL_BREAK = 5;// skip (operator tops up the master), never a breaker trip.const MASTER_FEE_BUFFER_SOL = 0.01;+// House-ownership guarantee. When LAUNCHER_OWNER_USER_IDS is set (a comma-separated+// list of user uuids we control), the GLOBAL rotation is HARD-restricted to agents+// owned by exactly those accounts — an auditable promise that only house-owned+// agents ever sign a launch. Unset → the self-growing circulation pool, whose+// agents are themselves platform-created bot accounts (*@agents.three.ws), never+// real end users. Either way the launcher never borrows a user's agent.+const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;+export function ownerAllowlist() {+ return String(process.env.LAUNCHER_OWNER_USER_IDS || '')+ .split(',')+ .map((s) => s.trim())+ .filter((s) => UUID_RE.test(s));+}+// ── schema guard ────────────────────────────────────────────────────────────────// Self-contained so the engine runs whether or not 20260629060000_coin_launcher.sql// has been applied. Mirrors that migration; CREATE … IF NOT EXISTS is idempotent.@@ -192,16 +206,27 @@ async function ensureQueue(cfg) {`;if (c >= MIN_QUEUE) return c;+ const owners = cfg.scope === 'global' ? ownerAllowlist() : [];const candidates = cfg.scope === 'global'- ? await sql`- select ai.id from agent_identities ai- where ai.deleted_at is null and ai.is_public = true- and ai.avatar_id is not null- and (ai.meta->>'circulation') = 'true'- and ai.meta->>'solana_address' is not null- and not exists (select 1 from launcher_queue q where q.agent_id = ai.id)- limit ${ENROLL_BATCH}- `+ ? (owners.length+ ? await sql`+ select ai.id from agent_identities ai+ where ai.deleted_at is null+ and ai.user_id = any(${owners}::uuid[])+ and ai.avatar_id is not null+ and ai.meta->>'solana_address' is not null+ and not exists (select 1 from launcher_queue q where q.agent_id = ai.id)+ limit ${ENROLL_BATCH}+ `+ : await sql`+ select ai.id from agent_identities ai+ where ai.deleted_at is null and ai.is_public = true+ and ai.avatar_id is not null+ and (ai.meta->>'circulation') = 'true'+ and ai.meta->>'solana_address' is not null+ and not exists (select 1 from launcher_queue q where q.agent_id = ai.id)+ limit ${ENROLL_BATCH}+ `): await sql`select ai.id from agent_identities aiwhere ai.deleted_at is null and ai.user_id = ${cfg.user_id}@@ -224,6 +249,8 @@ async function ensureQueue(cfg) {// The next agent up: enabled, avatar-bearing, with a wallet, least-recently-used// first (weighted, with a touch of jitter so ties don't always resolve the same).async function pickAgent(cfg) {+ const owners = cfg.scope === 'global' ? ownerAllowlist() : [];+ const ownerGate = owners.length ? sql`and ai.user_id = any(${owners}::uuid[])` : sql``;const [agent] = await sql`select q.agent_id as id, ai.user_id, ai.name, ai.avatar_id,ai.meta->>'solana_address' as solana_address@@ -232,6 +259,7 @@ async function pickAgent(cfg) {where q.scope = ${cfg.scope} and q.enabled = trueand ai.avatar_id is not nulland ai.meta->>'solana_address' is not null+ ${ownerGate}order by q.last_launched_at asc nulls first, q.weight desc, random()limit 1`;diff --git a/api/_lib/reconstruct-finalize.js b/api/_lib/reconstruct-finalize.jsindex af04e2aeb..53702e428 100644--- a/api/_lib/reconstruct-finalize.js+++ b/api/_lib/reconstruct-finalize.js@@ -20,7 +20,7 @@ import { putObject, publicUrl } from './r2.js';import { storageKeyFor, createAvatar } from './avatars.js';import { inspectGlb, isValidGlbHeader } from './glb-inspect.js';import { dispatchWebhooks } from './webhook-dispatch.js';-import { getRegenProvider } from './regen-provider.js';+import { getRegenProviderForMode } from './regen-provider.js';// Every provider-returned GLB fetched here — the reconstruct output, the rigged// result, and our own stored bare mesh (rig.unriggedUrl) — goes through the// shared guard: host allowlist + IP-pinned SSRF connect + 64 MB ceiling. No bare@@ -140,17 +140,11 @@ export async function finalizeReconstructStage({ userId, jobId, job, glbUrl }) {let provider = null;try {- provider = await getRegenProvider();+ provider = await getRegenProviderForMode('rerig');} catch (_) {provider = null;}- const canRig = !!(- info &&- !info.isRigged &&- provider?.instance &&- typeof provider.instance.supportsMode === 'function' &&- provider.instance.supportsMode('rerig')- );+ const canRig = !!(info && !info.isRigged && provider?.instance);if (!canRig) {const avatar = await materializeReconstructAvatar({ userId, jobId, job, glbBuf, glbInfo: info, storageKey, slug });@@ -219,7 +213,7 @@ export async function pollRiggingStage({ userId, jobId, job }) {let provider = null;try {- provider = await getRegenProvider();+ provider = await getRegenProviderForMode('rerig');} catch (_) {provider = null;}diff --git a/api/_lib/regen-provider.js b/api/_lib/regen-provider.jsindex fbcc3fec5..9e20a841c 100644--- a/api/_lib/regen-provider.js+++ b/api/_lib/regen-provider.js@@ -231,6 +231,26 @@ export async function getRegenProvider() {return loadPlatformProvider(name);}+// Resolve the first configured provider (in paid → free precedence) that+// actually supports `mode`. The plain getRegenProvider() returns only the single+// highest-precedence provider, which breaks rigging on the common production+// setup where Replicate is primary for `reconstruct` (its built-in TRELLIS+// default) but has no rerig model — meanwhile the self-hosted GCP UniRig pipeline+// CAN rig. Without this failover, every forged avatar comes out un-rigged because+// the rig gate asks Replicate (which can't) and gives up. Mirrors the MCP studio+// path's regenProvider(mode). Returns { name, instance } or { name:'none' }.+export async function getRegenProviderForMode(mode) {+ const candidates = await getRegenProviderCandidates();+ for (const candidate of candidates) {+ try {+ if (candidate.instance && candidate.instance.supportsMode(mode)) return candidate;+ } catch {+ // A provider whose supportsMode throws is treated as not-capable.+ }+ }+ return { name: 'none', instance: null };+}+// Enumerate every configured platform provider in priority order so the submit// path can fail over from one to the next. The explicit AVATAR_REGEN_PROVIDER// (if set and credentialed) leads; the credential-inferred order fills in thediff --git a/api/cron/erc8004-autopublish.js b/api/cron/erc8004-autopublish.jsdeleted file mode 100644index 74e525e23..000000000--- a/api/cron/erc8004-autopublish.js+++ /dev/null@@ -1,129 +0,0 @@-// @ts-check-// GET/POST /api/cron/erc8004-autopublish — autonomous ERC-8004 deployment.-//-// The crawl cron READS the registry; this cron WRITES to it. Every public-// three.ws agent that has a 3D body but isn't on-chain yet is registered on the-// Base IdentityRegistry from its OWN custodial wallet, with the platform relayer-// sponsoring a few cents of gas. No browser, no wallet popup — this is what makes-// "Deployed · 24h" tick and the on-chain 3D-avatar share climb.-//-// Gated, by design, so it never spends real mainnet gas until ops opts in:-// • ERC8004_AUTODEPLOY_ENABLED=true — the go-live switch.-// • AGENT_RELAYER_KEY — the gas sponsor (already used elsewhere).-// With either absent it 200s as a no-op with a reason. A relayer-balance floor-// and a small per-tick batch bound total spend; a single agent's failure is-// recorded and the run continues.-//-// Standalone (not [name].js) so the import graph — ethers, custodial keys — stays-// off the shared crawler bundle.--import { Wallet, formatEther } from 'ethers';--import { json, method, wrapCron } from '../_lib/http.js';-import { env } from '../_lib/env.js';-import { constantTimeEquals } from '../_lib/crypto.js';-import { evmFallbackProvider } from '../_lib/evm/rpc.js';-import {- BASE_CHAIN_ID,- publishAgentOnchain,- selectDeployableAgents,-} from '../_lib/erc8004-publish.js';--// Bounds spend per tick. Each register() is a few cents of Base gas; at a 10-min-// cadence this drains hundreds of agents/day without any run going long or-// burning the relayer faster than it can be topped up.-const BATCH = Number.parseInt(process.env.ERC8004_AUTODEPLOY_BATCH || '5', 10);--// Refuse to start a run if the relayer can't comfortably cover the batch — better-// to skip cleanly than strand a half-funded agent mid-deploy.-const RELAYER_FLOOR_ETH = process.env.ERC8004_RELAYER_FLOOR_ETH || '0.0008';--// Stop before Vercel's 300s kill; each agent does a pin + 1-2 mined txs.-const BUDGET_MS = 110_000;--function requireCron(req, res) {- const secret = process.env.CRON_SECRET || env.CRON_SECRET;- if (!secret) {- json(res, 503, { ok: false, reason: 'CRON_SECRET unset' });- return false;- }- const auth = req.headers['authorization'] || '';- const bearer = auth.startsWith('Bearer ') ? auth.slice(7) : '';- const header = req.headers['x-cron-secret'] || '';- if (constantTimeEquals(bearer, secret) || constantTimeEquals(header, secret)) return true;- json(res, 401, { ok: false, error: 'invalid cron secret' });- return false;-}--export default wrapCron(async (req, res) => {- if (!method(req, res, ['GET', 'POST'])) return;- if (!requireCron(req, res)) return;-- if (process.env.ERC8004_AUTODEPLOY_ENABLED !== 'true') {- return json(res, 200, { ok: true, deployed: 0, reason: 'autodeploy disabled' });- }- const relayerKey = process.env.AGENT_RELAYER_KEY;- if (!relayerKey) {- return json(res, 200, { ok: true, deployed: 0, reason: 'AGENT_RELAYER_KEY unset' });- }-- const started = Date.now();- try {- const candidates = await selectDeployableAgents(BATCH);- if (!candidates.length) {- return json(res, 200, { ok: true, deployed: 0, reason: 'no eligible agents' });- }-- const provider = await evmFallbackProvider(BASE_CHAIN_ID);- const relayer = new Wallet(relayerKey, provider);-- const relayerBalance = await provider.getBalance(relayer.address);- if (relayerBalance < BigInt(Math.round(parseFloat(RELAYER_FLOOR_ETH) * 1e18))) {- console.warn(- `[erc8004-autopublish] relayer ${relayer.address} low: ${formatEther(relayerBalance)} ETH < floor ${RELAYER_FLOOR_ETH}`,- );- return json(res, 200, {- ok: true,- deployed: 0,- reason: 'relayer below gas floor',- relayer: relayer.address,- relayer_balance_eth: formatEther(relayerBalance),- });- }-- const deployed = [];- const failed = [];- for (const agent of candidates) {- if (Date.now() - started > BUDGET_MS) break;- try {- const r = await publishAgentOnchain(agent, { relayer, provider });- deployed.push({ id: agent.id, name: agent.name, agentId: r.agentId, tx: r.txHash });- console.log(- `[erc8004-autopublish] deployed ${agent.name} → agent #${r.agentId} (${r.txHash})`,- );- } catch (err) {- failed.push({- id: agent.id,- code: err?.code || 'error',- error: err?.message || String(err),- });- console.error(`[erc8004-autopublish] ${agent.id} failed:`, err?.message || err);- }- }-- return json(res, 200, {- ok: true,- deployed: deployed.length,- failed: failed.length,- batch: candidates.length,- relayer: relayer.address,- deployments: deployed,- failures: failed,- elapsed_ms: Date.now() - started,- });- } catch (err) {- // Never throw: a failed run leaves all prior on-chain state intact.- console.error('[erc8004-autopublish] run failed:', err?.message || err);- return json(res, 200, { ok: false, error: err?.message || String(err) });- }-});diff --git a/api/cron/solana-autodeploy.js b/api/cron/solana-autodeploy.jsnew file mode 100644index 000000000..ef9677f54--- /dev/null+++ b/api/cron/solana-autodeploy.js@@ -0,0 +1,239 @@+// @ts-check+// GET/POST /api/cron/solana-autodeploy — autonomous Solana on-chain deployment.+//+// Mints every undeployed three.ws agent as a real Metaplex Core asset inside the+// "three.ws Agents" collection and enrols it in the Metaplex Agent Registry — the+// same server-custodial path as the admin bulk-launch / register-agents tools,+// but on a schedule with no human in the loop. The collection authority signs and+// pays the ~0.004 SOL mint; agent owners never sign and need no SOL (the owner of+// a Core asset does not sign the mint). This is what makes on-chain agent identity+// happen continuously instead of one manual admin run at a time.+//+// Two phases per tick, sharing one funded-authority balance gate and time budget:+// 1. mint — fetchUndeployedAgents → deployAgentOnce (mints AND auto-enrols+// the freshly minted asset in the registry as its post-mint step).+// 2. register — fetchUnregisteredAgents → registerAgentOnce, back-filling any+// agent minted earlier whose registry enrolment didn't land.+//+// Gated, by design, so it never spends real mainnet SOL until ops opts in:+// • SOLANA_AUTODEPLOY_ENABLED=true — the go-live switch.+// • SOLANA_AGENT_COLLECTION_AUTHORITY_KEY — the funded authority (already+// used by bulk-launch). With either absent it 200s as a no-op with a reason.+// A balance floor and small per-tick batches bound spend; one agent's failure is+// recorded and the run continues — never a partial sweep that strands the rest.+//+// Reuses api/_lib/onchain-deploy.js verbatim (shared with the admin endpoints and+// the CLI runners) so every path mints byte-identical assets.++import { LAMPORTS_PER_SOL } from '@solana/web3.js';++import { json, method, wrapCron } from '../_lib/http.js';+import { env } from '../_lib/env.js';+import { constantTimeEquals } from '../_lib/crypto.js';+import { publishFeedEvent } from '../_lib/feed.js';+import {+ authoritySecret,+ buildAuthorityUmi,+ funderLamports,+ fetchUndeployedAgents,+ fetchUnregisteredAgents,+ resolveAgentCollection,+ loadCollectionAsset,+ deployAgentOnce,+ registerAgentOnce,+ explorerUrl,+ EST_MINT_LAMPORTS,+ EST_REGISTER_LAMPORTS,+} from '../_lib/onchain-deploy.js';++// Per-tick caps. Each mint is ~0.004 SOL + one tx; at a 10-min cadence this lands+// hundreds of agents/day without any run going long or draining the authority+// faster than it can be topped up.+const MINT_BATCH = Number.parseInt(process.env.SOLANA_AUTODEPLOY_MINT_BATCH || '8', 10);+const REGISTER_BATCH = Number.parseInt(process.env.SOLANA_AUTODEPLOY_REGISTER_BATCH || '12', 10);++// Stop before Vercel's 300s kill; each agent is a pin + 1-2 confirmed txs.+const BUDGET_MS = 110_000;++// ~2 ops/sec — stay well within RPC rate limits, matching the admin runners.+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));++function requireCron(req, res) {+ const secret = process.env.CRON_SECRET || env.CRON_SECRET;+ if (!secret) {+ json(res, 503, { ok: false, reason: 'CRON_SECRET unset' });+ return false;+ }+ const auth = req.headers['authorization'] || '';+ const bearer = auth.startsWith('Bearer ') ? auth.slice(7) : '';+ const header = req.headers['x-cron-secret'] || '';+ if (constantTimeEquals(bearer, secret) || constantTimeEquals(header, secret)) return true;+ json(res, 401, { ok: false, error: 'invalid cron secret' });+ return false;+}++export default wrapCron(async (req, res) => {+ if (!method(req, res, ['GET', 'POST'])) return;+ if (!requireCron(req, res)) return;++ if (process.env.SOLANA_AUTODEPLOY_ENABLED !== 'true') {+ return json(res, 200, {+ ok: true,+ deployed: 0,+ registered: 0,+ reason: 'autodeploy disabled',+ });+ }+ if (!authoritySecret()) {+ return json(res, 200, {+ ok: true,+ deployed: 0,+ registered: 0,+ reason: 'SOLANA_AGENT_COLLECTION_AUTHORITY_KEY unset',+ });+ }++ const network = process.env.SOLANA_AUTODEPLOY_NETWORK === 'devnet' ? 'devnet' : 'mainnet';+ const started = Date.now();+ const budgetLeft = () => Date.now() - started < BUDGET_MS;++ let umi, authoritySigner;+ try {+ ({ umi, authoritySigner } = buildAuthorityUmi(network));+ } catch (e) {+ return json(res, 200, { ok: false, error: `config: ${e.message}` });+ }+ const authorityPk = authoritySigner.publicKey;++ // Refuse to start if the authority can't comfortably cover at least one+ // mint+register — better to skip cleanly than strand an agent mid-flow.+ const FLOOR = EST_MINT_LAMPORTS + EST_REGISTER_LAMPORTS + 10_000;+ const startBalance = await funderLamports(umi, authorityPk);+ if (startBalance < FLOOR) {+ console.warn(+ `[solana-autodeploy] authority ${authorityPk} low: ${startBalance / LAMPORTS_PER_SOL} SOL`,+ );+ return json(res, 200, {+ ok: true,+ deployed: 0,+ registered: 0,+ reason: 'authority below SOL floor',+ authority: authorityPk.toString(),+ authority_balance_sol: startBalance / LAMPORTS_PER_SOL,+ });+ }++ const deployed = [];+ const registered = [];+ const failed = [];++ try {+ // ── Phase 1: mint undeployed agents (deployAgentOnce auto-enrols them). ──+ const toMint = await fetchUndeployedAgents(network, MINT_BATCH);+ if (toMint.length && budgetLeft()) {+ const collectionAddr = await resolveAgentCollection({ umi, authoritySigner, network });+ const collectionAsset = await loadCollectionAsset(umi, collectionAddr);++ for (const agent of toMint) {+ if (!budgetLeft()) break;+ if ((await funderLamports(umi, authorityPk)) < FLOOR) break;+ try {+ const r = await deployAgentOnce({+ umi,+ authoritySigner,+ collectionAddr,+ collectionAsset,+ agent,+ network,+ });+ deployed.push({+ id: agent.id,+ name: agent.name,+ asset: r.asset,+ tx: r.signature,+ });+ console.log(+ `[solana-autodeploy] minted ${agent.name} → ${r.asset} (${r.signature})`,+ );+ publishFeedEvent({+ type: 'agent-onchain',+ ts: Date.now(),+ actor: agent.name || 'An agent',+ agentId: agent.id,+ name: agent.name || 'An agent',+ chain: 'Solana',+ asset: r.asset,+ txUrl: explorerUrl(r.asset, network),+ autonomous: true,+ }).catch(() => {});+ } catch (err) {+ failed.push({+ id: agent.id,+ phase: 'mint',+ error: err?.message || String(err),+ });+ console.error(+ `[solana-autodeploy] mint ${agent.id} failed:`,+ err?.message || err,+ );+ }+ await sleep(400);+ }+ }++ // ── Phase 2: back-fill registry for minted-but-unregistered agents. ──+ if (budgetLeft()) {+ const toRegister = await fetchUnregisteredAgents(network, REGISTER_BATCH);+ for (const agent of toRegister) {+ if (!budgetLeft()) break;+ if ((await funderLamports(umi, authorityPk)) < EST_REGISTER_LAMPORTS + 5000) break;+ try {+ const r = await registerAgentOnce({ umi, authoritySigner, agent, network });+ if (!r.alreadyRegistered) {+ registered.push({+ id: agent.id,+ name: agent.name,+ identity_pda: r.identityPda,+ });+ console.log(+ `[solana-autodeploy] registered ${agent.name} → ${r.identityPda}`,+ );+ }+ } catch (err) {+ failed.push({+ id: agent.id,+ phase: 'register',+ error: err?.message || String(err),+ });+ console.error(+ `[solana-autodeploy] register ${agent.id} failed:`,+ err?.message || err,+ );+ }+ await sleep(400);+ }+ }+ } catch (err) {+ // Never throw: a failed run leaves all prior on-chain state intact.+ console.error('[solana-autodeploy] run failed:', err?.message || err);+ return json(res, 200, {+ ok: false,+ error: err?.message || String(err),+ deployed: deployed.length,+ registered: registered.length,+ });+ }++ return json(res, 200, {+ ok: true,+ network,+ deployed: deployed.length,+ registered: registered.length,+ failed: failed.length,+ authority: authorityPk.toString(),+ deployments: deployed,+ registrations: registered,+ failures: failed,+ elapsed_ms: Date.now() - started,+ });+});diff --git a/data/changelog.json b/data/changelog.jsonindex 70694ce4e..6a82411f1 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,14 @@{"$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-28",+ "title": "The \"Save to my avatars\" button is readable on every theme",+ "summary": "On pages with a white accent color, the \"⑂ Save to my avatars\" button (shown on any avatar you don't own) rendered white text on a white background — effectively invisible. The button now picks its text color from the actual button background, so a light button gets black text and a dark button keeps white, keeping the label legible everywhere it appears.",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-28","title": "Trending and the agent directory now actually show agents",@@ -20,12 +28,11 @@},{"date": "2026-06-28",- "title": "Your agents now deploy themselves on-chain — no wallet popup",- "summary": "The On-chain Deployments page (/deployments) tracks every agent that lands on the ERC-8004 Identity Registry. Until now three.ws only read other people's registrations; putting one of your own agents on-chain meant signing a transaction yourself in a browser wallet. Agents now register themselves: every public agent with a 3D body gets deployed to the Base Identity Registry from its own built-in wallet, with the platform covering the few cents of gas. The registration includes the agent's GLB avatar and x402 payment support, so it shows up immediately in the live feed counted as a 3D, payment-ready on-chain identity — no human in the loop.",+ "title": "Your agents now deploy themselves on-chain on Solana — automatically",+ "summary": "Putting an agent on-chain used to be a manual step. Now it's continuous and hands-off: every undeployed agent is minted as a real Metaplex Core asset inside the three.ws Agents collection and enrolled in the Metaplex Agent Registry, on a recurring schedule, with the platform's collection authority signing and paying the small Solana mint cost. Your agent owns its own on-chain identity through its built-in Solana wallet — and never has to sign or hold SOL to get there. No admin run, no wallet popup, no human in the loop.","tags": ["feature"- ],- "link": "/deployments"+ ]},{"date": "2026-06-28",diff --git a/public/changelog.json b/public/changelog.jsonindex 2fa63780c..33734f052 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-28T06:47:38.055Z",+ "generated_at": "2026-06-28T06:56:56.701Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -261,6 +261,16 @@"infra"]},+ {+ "date": "2026-06-28",+ "type": "update",+ "title": "The \"Save to my avatars\" button is readable on every theme",+ "summary": "On pages with a white accent color, the \"⑂ Save to my avatars\" button (shown on any avatar you don't own) rendered white text on a white background — effectively invisible. The button now picks its text color from the actual button background, so a light button gets black text and a dark button keeps white, keeping the label legible everywhere it appears.",+ "link": null,+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-28","type": "update",@@ -326,9 +336,9 @@{"date": "2026-06-28","type": "update",- "title": "Your agents now deploy themselves on-chain — no wallet popup",- "summary": "The On-chain Deployments page (/deployments) tracks every agent that lands on the ERC-8004 Identity Registry. Until now three.ws only read other people's registrations; putting one of your own agents on-chain meant signing a transaction yourself in a browser wallet. Agents now register themselves: every public agent with a 3D body gets deployed to the Base Identity Registry from its own built-in wallet, with the platform covering the few cents of gas. The registration includes the agent's GLB avatar and x402 payment support, so it shows up immediately in the live feed counted as a 3D, payment-ready on-chain identity — no human in the loop.",- "link": "/deployments",+ "title": "Your agents now deploy themselves on-chain on Solana — automatically",+ "summary": "Putting an agent on-chain used to be a manual step. Now it's continuous and hands-off: every undeployed agent is minted as a real Metaplex Core asset inside the three.ws Agents collection and enrolled in the Metaplex Agent Registry, on a recurring schedule, with the platform's collection authority signing and paying the small Solana mint cost. Your agent owns its own on-chain identity through its built-in Solana wallet — and never has to sign or hold SOL to get there. No admin run, no wallet popup, no human in the loop.",+ "link": null,"tags": ["feature"]diff --git a/public/changelog.xml b/public/changelog.xmlindex 0c01cb0a0..af7a7d9c9 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -198,6 +198,14 @@<category>feature</category><description>The autonomous x402 loop now pays every 30 minutes to retrieve the 5 most-purchased agent skills over the past 7 days from the real hire ledger. The top skill and full ranked list land in the autonomous log as actionable signal for featured-listing curation — a shift in the top skill across runs surfaces emerging high-demand capabilities automatically.</description></item>+ <item>+ <title>The "Save to my avatars" button is readable on every theme</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-28:The "Save to my avatars" button is readable on every theme</guid>+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>On pages with a white accent color, the "⑂ Save to my avatars" button (shown on any avatar you don't own) rendered white text on a white background — effectively invisible. The button now picks its text color from the actual button background, so a light button gets black text and a dark button keeps white, keeping the label legible everywhere it appears.</description>+ </item><item><title>The Avatar Engines Atlas page is now reachable</title><link>https://three.ws/avatar-engines</link>@@ -247,12 +255,12 @@<description>The autonomous loop now pays /api/x402/analytics every 30 minutes with { report: "x402_volume", period: "24h" } for a live read of x402 transaction volume across every paid endpoint. The report comes straight from the settled-payment ledger and returns the totals that prove ecosystem growth — total settled calls, total USDC paid, and unique paying wallets — alongside a per-endpoint breakdown and the least-active ("underused") endpoints, so the platform can see at a glance which services are thriving and which need a push or a rethink. The headline totals and the underused-endpoint list are recorded as an actionable signal, and the same report is available to any x402 agent on the bazaar for $0.005 per call.</description></item><item>- <title>Your agents now deploy themselves on-chain — no wallet popup</title>- <link>https://three.ws/deployments</link>- <guid isPermaLink="false">2026-06-28:Your agents now deploy themselves on-chain — no wallet popup</guid>+ <title>Your agents now deploy themselves on-chain on Solana — automatically</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-28:Your agents now deploy themselves on-chain on Solana — automatically</guid><pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate><category>feature</category>- <description>The On-chain Deployments page (/deployments) tracks every agent that lands on the ERC-8004 Identity Registry. Until now three.ws only read other people's registrations; putting one of your own agents on-chain meant signing a transaction yourself in a browser wallet. Agents now register themselves: every public agent with a 3D body gets deployed to the Base Identity Registry from its own built-in wallet, with the platform covering the few cents of gas. The registration includes the agent's GLB avatar and x402 payment support, so it shows up immediately in the live feed counted as a 3D, payment-ready on-chain identity — no human in the loop.</description>+ <description>Putting an agent on-chain used to be a manual step. Now it's continuous and hands-off: every undeployed agent is minted as a real Metaplex Core asset inside the three.ws Agents collection and enrolled in the Metaplex Agent Registry, on a recurring schedule, with the platform's collection authority signing and paying the small Solana mint cost. Your agent owns its own on-chain identity through its built-in Solana wallet — and never has to sign or hold SOL to get there. No admin run, no wallet popup, no human in the loop.</description></item><item><title>Capabilities — Alpha Hunt, Launcher, Auto-Claim & Market Maker</title>diff --git a/public/features.json b/public/features.jsonindex 419e85496..c0830d113 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-28T06:47:38.022Z",+ "generated_at": "2026-06-28T06:56:56.682Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/shared/strategy-forms.js b/src/shared/strategy-forms.jsindex f53a3e337..102ce1ad9 100644--- a/src/shared/strategy-forms.js+++ b/src/shared/strategy-forms.js@@ -122,6 +122,26 @@ export function ensureStrategyStyles() {.so-pick:hover { border-color: var(--wallet-stroke, rgba(139,92,246,.35)); }.so-pick img, .so-pick .so-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2, rgba(255,255,255,.06)); flex: 0 0 auto; }.so-pick .so-pname { font-size: var(--text-sm, .82rem); font-weight: 600; color: var(--ink-bright, #fff); }+.so-compose { max-width: 1040px; margin: 0 auto; }+.so-compose-head { margin-bottom: var(--space-lg, 22px); }+.so-compose-back { background: none; border: none; color: var(--ink-dim, #9a9a9a); font: inherit; font-size: var(--text-sm, .82rem); cursor: pointer; padding: 4px 0; display: inline-flex; align-items: center; gap: 6px; transition: color .16s; }+.so-compose-back:hover { color: var(--ink-bright, #fff); }+.so-compose-back:focus-visible { outline: 2px solid var(--wallet-focus, rgba(139,92,246,.7)); outline-offset: 3px; border-radius: 4px; }+.so-compose-title { font-family: var(--font-display, inherit); font-size: clamp(1.5rem, 4vw, 2.1rem); color: var(--ink-bright, #fff); letter-spacing: -.02em; margin: 10px 0 8px; }+.so-compose-lead { max-width: 620px; color: var(--ink-dim, #9a9a9a); font-size: var(--text-sm, .84rem); line-height: 1.6; margin: 0; }+.so-compose-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-lg, 20px); }+@media (min-width: 880px) { .so-compose-grid { grid-template-columns: minmax(0, 1fr) 296px; align-items: start; } }+@media (min-width: 880px) { .so-compose-side { position: sticky; top: 84px; } }+.so-side-card { border: 1px solid var(--wallet-stroke, rgba(139,92,246,.3)); border-radius: var(--radius-lg, 14px); background: var(--bg-1, #141414); padding: var(--space-lg, 18px); box-shadow: var(--shadow-2, 0 12px 32px rgba(0,0,0,.4)); }+.so-side-h { font-size: var(--text-2xs, .64rem); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim, #9a9a9a); font-weight: 700; margin-bottom: 8px; }+.so-side-card .so-preview { margin-top: 0; }+.so-side-points { list-style: none; padding: 0; margin: 12px 0 4px; display: flex; flex-direction: column; gap: 7px; }+.so-side-points li { font-size: var(--text-2xs, .66rem); color: var(--ink-dim, #999); padding-left: 15px; position: relative; line-height: 1.45; }+.so-side-points li::before { content: ''; position: absolute; left: 0; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: ${VIOLET}; }+.so-side-points b { color: var(--ink, #ccc); font-weight: 600; }+.so-side-save { width: 100%; justify-content: center; margin-top: 14px; }+.so-side-cancel { width: 100%; justify-content: center; margin-top: 7px; background: transparent; border-color: transparent; }+.so-side-cancel:hover { background: var(--surface-2, rgba(255,255,255,.05)); }`;document.head.appendChild(s);}@@ -136,158 +156,239 @@ const DEFAULTS = {const numOrNull = (v) => { const s = String(v ?? '').trim(); if (s === '') return null; const n = Number(s); return Number.isFinite(n) ? n : null; };-// ── the strategy editor ────────────────────────────────────────────────────────-// existing: a strategy object to edit (PATCH); null → create (POST). Resolves the-// saved strategy object, or null if cancelled.-export function openStrategyEditor({ existing = null } = {}) {- ensureStrategyStyles();+// ── shared editor internals ────────────────────────────────────────────────────+// One source of truth for the strategy form, used by both the modal editor+// (openStrategyEditor — in-context editing on an agent profile) and the full-page+// builder (mountStrategyComposer — the /strategies "New strategy" flow). The field+// markup, parsing, live preview, and save all live here so the two surfaces can+// never drift apart.+function makeState(existing) {const cfg = existing?.config ? structuredCloneSafe(existing.config) : structuredCloneSafe(DEFAULTS);- return new Promise((resolve) => {- const back = document.createElement('div');- back.className = 'so-modal-back';- const state = {- name: existing?.name || '',- description: existing?.description || '',- network: cfg.network || 'mainnet',- entry: { ...DEFAULTS.entry, ...(cfg.entry || {}) },- sizing: { ...DEFAULTS.sizing, ...(cfg.sizing || {}) },- exits: { ...DEFAULTS.exits, ...(cfg.exits || {}) },- risk: { ...DEFAULTS.risk, ...(cfg.risk || {}) },- };+ return {+ name: existing?.name || '',+ description: existing?.description || '',+ network: cfg.network || 'mainnet',+ entry: { ...DEFAULTS.entry, ...(cfg.entry || {}) },+ sizing: { ...DEFAULTS.sizing, ...(cfg.sizing || {}) },+ exits: { ...DEFAULTS.exits, ...(cfg.exits || {}) },+ risk: { ...DEFAULTS.risk, ...(cfg.risk || {}) },+ };+}- function num(v) { return v == null ? '' : v; }- function previewText() {- const c = { entry: state.entry, sizing: state.sizing, exits: state.exits, risk: state.risk };- return configSummary(c) || 'Define your rules above.';- }- function render() {- back.innerHTML = `<div class="so-modal" role="dialog" aria-modal="true" aria-label="${existing ? 'Edit' : 'New'} strategy">- <h3>${existing ? 'Edit strategy' : 'New strategy'}</h3>- <p class="so-sub">A strategy is a real, rule-based plan. When equipped, your agent evaluates real launches and executes on-chain — always inside your spend policy.</p>+const numVal = (v) => (v == null ? '' : v);- <div class="so-field"><label>Name</label><input id="so-name" maxlength="80" placeholder="e.g. Fresh-launch sniper" value="${esc(state.name)}"></div>- <div class="so-field"><label>Description <span style="color:var(--ink-faint,#777)">(optional)</span></label><input id="so-desc" maxlength="2000" placeholder="What edge does this capture?" value="${esc(state.description)}"></div>+function previewText(state) {+ const c = { entry: state.entry, sizing: state.sizing, exits: state.exits, risk: state.risk };+ return configSummary(c) || 'Define your rules above.';+}- <fieldset class="so-group"><legend>Entry — when to buy</legend>- <div class="so-grid">- <div class="so-field"><label>Max launch age (min)</label><input type="number" min="1" max="10080" id="so-age" value="${num(state.entry.max_age_minutes)}"><div class="so-hint">only act on launches newer than this</div></div>- <div class="so-field"><label>Min liquidity (◎ SOL)</label><input type="number" min="0" step="0.1" id="so-liq" value="${num(state.entry.min_liquidity_sol)}"></div>- <div class="so-field"><label>Min market cap (USD)</label><input type="number" min="0" id="so-mcmin" value="${num(state.entry.min_market_cap_usd)}"></div>- <div class="so-field"><label>Max market cap (USD)</label><input type="number" min="0" id="so-mcmax" value="${num(state.entry.max_market_cap_usd)}"></div>- <div class="so-field"><label>Max creator launches</label><input type="number" min="0" id="so-claunch" value="${num(state.entry.max_creator_launches)}"><div class="so-hint">skip serial deployers</div></div>- <div class="so-field"><label>Min creator graduations</label><input type="number" min="0" id="so-cgrad" value="${num(state.entry.min_creator_graduated)}"></div>- </div>- <label class="so-checkrow"><input type="checkbox" id="so-socials" ${state.entry.require_socials ? 'checked' : ''}> Require socials (X / Telegram / site)</label>- </fieldset>+// The form fields, without any chrome. `preview` controls whether the inline+// preview/error block is emitted here (the modal wants it inline; the page hosts+// them in its sticky side panel instead).+function strategyFieldsHTML(state, { preview = true } = {}) {+ return `<div class="so-field"><label>Name</label><input id="so-name" maxlength="80" placeholder="e.g. Fresh-launch sniper" value="${esc(state.name)}"></div>+ <div class="so-field"><label>Description <span style="color:var(--ink-faint,#777)">(optional)</span></label><input id="so-desc" maxlength="2000" placeholder="What edge does this capture?" value="${esc(state.description)}"></div>- <fieldset class="so-group"><legend>Sizing</legend>- <div class="so-grid">- <div class="so-field"><label>Per-trade size (◎ SOL)</label><input type="number" min="0.0001" step="0.01" id="so-size" value="${num(state.sizing.amount_sol)}"><div class="so-hint">still capped by your agent's spend policy</div></div>- <div class="so-field"><label>Max slippage (bps)</label><input type="number" min="0" max="10000" id="so-slip" value="${num(state.sizing.max_slippage_bps)}"><div class="so-hint">500 = 5%</div></div>- </div>- </fieldset>+ <fieldset class="so-group"><legend>Entry — when to buy</legend>+ <div class="so-grid">+ <div class="so-field"><label>Max launch age (min)</label><input type="number" min="1" max="10080" id="so-age" value="${numVal(state.entry.max_age_minutes)}"><div class="so-hint">only act on launches newer than this</div></div>+ <div class="so-field"><label>Min liquidity (◎ SOL)</label><input type="number" min="0" step="0.1" id="so-liq" value="${numVal(state.entry.min_liquidity_sol)}"></div>+ <div class="so-field"><label>Min market cap (USD)</label><input type="number" min="0" id="so-mcmin" value="${numVal(state.entry.min_market_cap_usd)}"></div>+ <div class="so-field"><label>Max market cap (USD)</label><input type="number" min="0" id="so-mcmax" value="${numVal(state.entry.max_market_cap_usd)}"></div>+ <div class="so-field"><label>Max creator launches</label><input type="number" min="0" id="so-claunch" value="${numVal(state.entry.max_creator_launches)}"><div class="so-hint">skip serial deployers</div></div>+ <div class="so-field"><label>Min creator graduations</label><input type="number" min="0" id="so-cgrad" value="${numVal(state.entry.min_creator_graduated)}"></div>+ </div>+ <label class="so-checkrow"><input type="checkbox" id="so-socials" ${state.entry.require_socials ? 'checked' : ''}> Require socials (X / Telegram / site)</label>+ </fieldset>- <fieldset class="so-group"><legend>Exits — at least one upside exit + a stop-loss</legend>- <div class="so-grid">- <div class="so-field"><label>Take-profit (%)</label><input type="number" min="1" id="so-tp" value="${num(state.exits.take_profit_pct)}"><div class="so-hint">100 = sell at 2×</div></div>- <div class="so-field"><label>Stop-loss (%) — required</label><input type="number" min="1" max="99" id="so-sl" value="${num(state.exits.stop_loss_pct)}"></div>- <div class="so-field"><label>Trailing stop (%)</label><input type="number" min="1" max="99" id="so-trail" value="${num(state.exits.trailing_stop_pct)}"><div class="so-hint">% drop from peak</div></div>- <div class="so-field"><label>Max hold (min)</label><input type="number" min="1" id="so-hold" value="${num(state.exits.max_hold_minutes)}"></div>- </div>- </fieldset>+ <fieldset class="so-group"><legend>Sizing</legend>+ <div class="so-grid">+ <div class="so-field"><label>Per-trade size (◎ SOL)</label><input type="number" min="0.0001" step="0.01" id="so-size" value="${numVal(state.sizing.amount_sol)}"><div class="so-hint">still capped by your agent's spend policy</div></div>+ <div class="so-field"><label>Max slippage (bps)</label><input type="number" min="0" max="10000" id="so-slip" value="${numVal(state.sizing.max_slippage_bps)}"><div class="so-hint">500 = 5%</div></div>+ </div>+ </fieldset>- <fieldset class="so-group"><legend>Risk</legend>- <div class="so-grid">- <div class="so-field"><label>Max concurrent positions</label><input type="number" min="1" max="50" id="so-conc" value="${num(state.risk.max_concurrent_positions)}"></div>- <div class="so-field"><label>Cooldown between entries (min)</label><input type="number" min="0" id="so-cool" value="${num(state.risk.cooldown_minutes)}"></div>- <div class="so-field"><label>Network</label><select id="so-net"><option value="mainnet" ${state.network === 'mainnet' ? 'selected' : ''}>Mainnet</option><option value="devnet" ${state.network === 'devnet' ? 'selected' : ''}>Devnet</option></select></div>- </div>- </fieldset>+ <fieldset class="so-group"><legend>Exits — at least one upside exit + a stop-loss</legend>+ <div class="so-grid">+ <div class="so-field"><label>Take-profit (%)</label><input type="number" min="1" id="so-tp" value="${numVal(state.exits.take_profit_pct)}"><div class="so-hint">100 = sell at 2×</div></div>+ <div class="so-field"><label>Stop-loss (%) — required</label><input type="number" min="1" max="99" id="so-sl" value="${numVal(state.exits.stop_loss_pct)}"></div>+ <div class="so-field"><label>Trailing stop (%)</label><input type="number" min="1" max="99" id="so-trail" value="${numVal(state.exits.trailing_stop_pct)}"><div class="so-hint">% drop from peak</div></div>+ <div class="so-field"><label>Max hold (min)</label><input type="number" min="1" id="so-hold" value="${numVal(state.exits.max_hold_minutes)}"></div>+ </div>+ </fieldset>- <div class="so-preview" id="so-preview">${previewText()}</div>- <div class="so-err" id="so-err" hidden></div>- <div class="so-actions">- <button type="button" class="so-btn" id="so-cancel">Cancel</button>- <button type="button" class="so-btn so-btn-primary" id="so-save">${existing ? 'Save changes' : 'Create strategy'}</button>- </div>- </div>`;- wire();- }- function readInputs() {- const q = (id) => back.querySelector(id);- state.name = q('#so-name')?.value || '';- state.description = q('#so-desc')?.value || '';- state.network = q('#so-net')?.value || 'mainnet';- state.entry.max_age_minutes = numOrNull(q('#so-age')?.value);- state.entry.min_liquidity_sol = numOrNull(q('#so-liq')?.value);- state.entry.min_market_cap_usd = numOrNull(q('#so-mcmin')?.value);- state.entry.max_market_cap_usd = numOrNull(q('#so-mcmax')?.value);- state.entry.max_creator_launches = numOrNull(q('#so-claunch')?.value);- state.entry.min_creator_graduated = numOrNull(q('#so-cgrad')?.value);- state.entry.require_socials = !!q('#so-socials')?.checked;- state.sizing.amount_sol = numOrNull(q('#so-size')?.value);- state.sizing.max_slippage_bps = numOrNull(q('#so-slip')?.value);- state.exits.take_profit_pct = numOrNull(q('#so-tp')?.value);- state.exits.stop_loss_pct = numOrNull(q('#so-sl')?.value);- state.exits.trailing_stop_pct = numOrNull(q('#so-trail')?.value);- state.exits.max_hold_minutes = numOrNull(q('#so-hold')?.value);- state.risk.max_concurrent_positions = numOrNull(q('#so-conc')?.value);- state.risk.cooldown_minutes = numOrNull(q('#so-cool')?.value);- }- function wire() {- back.querySelectorAll('input,select').forEach((el) => el.addEventListener('input', () => {- readInputs();- const p = back.querySelector('#so-preview'); if (p) p.innerHTML = previewText();- }));- back.querySelector('#so-cancel').addEventListener('click', () => close(null));- back.querySelector('#so-save').addEventListener('click', save);- }- function buildConfig() {- return {- network: state.network,- entry: { trigger: 'new_launch', ...state.entry },- sizing: state.sizing,- exits: state.exits,- risk: state.risk,- };- }- async function save() {- readInputs();- const errEl = back.querySelector('#so-err');- const btn = back.querySelector('#so-save');- if (!state.name.trim()) { showErr('Give your strategy a name.'); return; }+ <fieldset class="so-group"><legend>Risk</legend>+ <div class="so-grid">+ <div class="so-field"><label>Max concurrent positions</label><input type="number" min="1" max="50" id="so-conc" value="${numVal(state.risk.max_concurrent_positions)}"></div>+ <div class="so-field"><label>Cooldown between entries (min)</label><input type="number" min="0" id="so-cool" value="${numVal(state.risk.cooldown_minutes)}"></div>+ <div class="so-field"><label>Network</label><select id="so-net"><option value="mainnet" ${state.network === 'mainnet' ? 'selected' : ''}>Mainnet</option><option value="devnet" ${state.network === 'devnet' ? 'selected' : ''}>Devnet</option></select></div>+ </div>+ </fieldset>${preview ? `++ <div class="so-preview" id="so-preview">${previewText(state)}</div>+ <div class="so-err" id="so-err" hidden></div>` : ''}`;+}++// Read every field in `root` back into `state` (root is the modal or composer).+function readInputs(root, state) {+ const q = (id) => root.querySelector(id);+ state.name = q('#so-name')?.value || '';+ state.description = q('#so-desc')?.value || '';+ state.network = q('#so-net')?.value || 'mainnet';+ state.entry.max_age_minutes = numOrNull(q('#so-age')?.value);+ state.entry.min_liquidity_sol = numOrNull(q('#so-liq')?.value);+ state.entry.min_market_cap_usd = numOrNull(q('#so-mcmin')?.value);+ state.entry.max_market_cap_usd = numOrNull(q('#so-mcmax')?.value);+ state.entry.max_creator_launches = numOrNull(q('#so-claunch')?.value);+ state.entry.min_creator_graduated = numOrNull(q('#so-cgrad')?.value);+ state.entry.require_socials = !!q('#so-socials')?.checked;+ state.sizing.amount_sol = numOrNull(q('#so-size')?.value);+ state.sizing.max_slippage_bps = numOrNull(q('#so-slip')?.value);+ state.exits.take_profit_pct = numOrNull(q('#so-tp')?.value);+ state.exits.stop_loss_pct = numOrNull(q('#so-sl')?.value);+ state.exits.trailing_stop_pct = numOrNull(q('#so-trail')?.value);+ state.exits.max_hold_minutes = numOrNull(q('#so-hold')?.value);+ state.risk.max_concurrent_positions = numOrNull(q('#so-conc')?.value);+ state.risk.cooldown_minutes = numOrNull(q('#so-cool')?.value);+}++// Live-update the preview as any field changes.+function wireFormFields(root, state) {+ root.querySelectorAll('input,select').forEach((el) => el.addEventListener('input', () => {+ readInputs(root, state);+ const p = root.querySelector('#so-preview'); if (p) p.innerHTML = previewText(state);+ }));+}++function buildConfig(state) {+ return {+ network: state.network,+ entry: { trigger: 'new_launch', ...state.entry },+ sizing: state.sizing,+ exits: state.exits,+ risk: state.risk,+ };+}++function showFieldErr(root, m) { const e = root.querySelector('#so-err'); if (e) { e.textContent = m; e.hidden = false; } }++// POST (create) or PATCH (edit). Returns the saved strategy, or throws.+async function submitStrategy(state, existing) {+ const payload = { name: state.name.trim(), description: state.description.trim() || null, config: buildConfig(state) };+ const res = await apiFetch(existing ? `/api/strategies/${existing.id}` : '/api/strategies', {+ method: existing ? 'PATCH' : 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify(payload),+ });+ const j = await res.json().catch(() => ({}));+ if (!res.ok) {+ const fieldErrs = j?.error?.errors || j?.errors;+ if (Array.isArray(fieldErrs) && fieldErrs.length) throw new Error(fieldErrs.map((e) => e.message).join(' '));+ throw new Error(j?.error?.message || j?.message || 'Could not save');+ }+ return j.data;+}++// ── the strategy editor (modal) ────────────────────────────────────────────────+// In-context editing on an agent profile, where navigating to a full page would+// lose the surrounding context. The /strategies library uses the full-page+// builder below instead. existing: a strategy to edit (PATCH); null → create+// (POST). Resolves the saved strategy object, or null if cancelled.+export function openStrategyEditor({ existing = null } = {}) {+ ensureStrategyStyles();+ const state = makeState(existing);+ return new Promise((resolve) => {+ const back = document.createElement('div');+ back.className = 'so-modal-back';+ back.innerHTML = `<div class="so-modal" role="dialog" aria-modal="true" aria-label="${existing ? 'Edit' : 'New'} strategy">+ <h3>${existing ? 'Edit strategy' : 'New strategy'}</h3>+ <p class="so-sub">A strategy is a real, rule-based plan. When equipped, your agent evaluates real launches and executes on-chain — always inside your spend policy.</p>+ ${strategyFieldsHTML(state)}+ <div class="so-actions">+ <button type="button" class="so-btn" id="so-cancel">Cancel</button>+ <button type="button" class="so-btn so-btn-primary" id="so-save">${existing ? 'Save changes' : 'Create strategy'}</button>+ </div>+ </div>`;+ const modal = back.firstElementChild;+ wireFormFields(modal, state);+ modal.querySelector('#so-cancel').addEventListener('click', () => close(null));+ const btn = modal.querySelector('#so-save');+ btn.addEventListener('click', async () => {+ readInputs(modal, state);+ if (!state.name.trim()) { showFieldErr(modal, 'Give your strategy a name.'); return; }btn.disabled = true; btn.textContent = 'Saving…';try {- const payload = { name: state.name.trim(), description: state.description.trim() || null, config: buildConfig() };- const res = await apiFetch(existing ? `/api/strategies/${existing.id}` : '/api/strategies', {- method: existing ? 'PATCH' : 'POST',- headers: { 'content-type': 'application/json' },- body: JSON.stringify(payload),- });- const j = await res.json().catch(() => ({}));- if (!res.ok) {- const fieldErrs = j?.error?.errors || j?.errors;- if (Array.isArray(fieldErrs) && fieldErrs.length) throw new Error(fieldErrs.map((e) => e.message).join(' '));- throw new Error(j?.error?.message || j?.message || 'Could not save');- }+ const saved = await submitStrategy(state, existing);toast(existing ? 'Strategy updated' : 'Strategy created');- close(j.data);+ close(saved);} catch (e) {if (e?.redirected) return;btn.disabled = false; btn.textContent = existing ? 'Save changes' : 'Create strategy';- showErr(e.message || 'Could not save');+ showFieldErr(modal, e.message || 'Could not save');}- function showErr(m) { if (errEl) { errEl.textContent = m; errEl.hidden = false; } }- }- function showErr(m) { const e = back.querySelector('#so-err'); if (e) { e.textContent = m; e.hidden = false; } }+ });function close(result) { document.removeEventListener('keydown', onKey); back.remove(); resolve(result); }function onKey(e) { if (e.key === 'Escape') close(null); }back.addEventListener('click', (e) => { if (e.target === back) close(null); });document.addEventListener('keydown', onKey);- render();document.body.appendChild(back);- back.querySelector('#so-name')?.focus();+ modal.querySelector('#so-name')?.focus();+ });+}++// ── the strategy builder (full page) ───────────────────────────────────────────+// Renders the whole builder into `host` as a page — a two-column workspace with+// the rules on the left and a sticky live summary + Create button on the right.+// This is the /strategies "New strategy" surface: a complex, multi-section form+// deserves room to breathe, not a cramped modal. onSaved(saved) fires after a+// successful create/edit; onCancel() fires on the back link.+export function mountStrategyComposer(host, { existing = null, onSaved, onCancel } = {}) {+ ensureStrategyStyles();+ const state = makeState(existing);+ host.innerHTML = `<div class="so-compose">+ <div class="so-compose-head">+ <button type="button" class="so-compose-back" id="so-back">← Strategies</button>+ <h1 class="so-compose-title">${existing ? 'Edit strategy' : 'New strategy'}</h1>+ <p class="so-compose-lead">A strategy is a real, rule-based plan. When equipped, your agent evaluates real launches and executes on-chain — always inside your spend policy.</p>+ </div>+ <div class="so-compose-grid">+ <div class="so-compose-main">${strategyFieldsHTML(state, { preview: false })}</div>+ <aside class="so-compose-side">+ <div class="so-side-card">+ <div class="so-side-h">Your strategy</div>+ <div class="so-preview" id="so-preview">${previewText(state)}</div>+ <ul class="so-side-points">+ <li><b>Spend-policy gated</b> — every trade is capped by your agent</li>+ <li><b>Real on-chain</b> — no backtested fiction</li>+ <li><b>Kill switch</b> — halt everything at once</li>+ </ul>+ <div class="so-err" id="so-err" hidden></div>+ <button type="button" class="so-btn so-btn-primary so-side-save" id="so-save">${existing ? 'Save changes' : 'Create strategy'}</button>+ <button type="button" class="so-btn so-side-cancel" id="so-cancel">Cancel</button>+ </div>+ </aside>+ </div>+ </div>`;+ const root = host.firstElementChild;+ wireFormFields(root, state);+ root.querySelector('#so-back').addEventListener('click', () => onCancel?.());+ root.querySelector('#so-cancel').addEventListener('click', () => onCancel?.());+ const btn = root.querySelector('#so-save');+ btn.addEventListener('click', async () => {+ readInputs(root, state);+ if (!state.name.trim()) { showFieldErr(root, 'Give your strategy a name.'); root.querySelector('#so-name')?.focus(); return; }+ btn.disabled = true; btn.textContent = 'Saving…';+ try {+ const saved = await submitStrategy(state, existing);+ toast(existing ? 'Strategy updated' : 'Strategy created');+ onSaved?.(saved);+ } catch (e) {+ if (e?.redirected) return;+ btn.disabled = false; btn.textContent = existing ? 'Save changes' : 'Create strategy';+ showFieldErr(root, e.message || 'Could not save');+ }});+ root.querySelector('#so-name')?.focus();}function structuredCloneSafe(o) {diff --git a/tests/erc8004-publish.test.js b/tests/erc8004-publish.test.jsdeleted file mode 100644index 475e04059..000000000--- a/tests/erc8004-publish.test.js+++ /dev/null@@ -1,48 +0,0 @@-// Unit coverage for the pure pieces of autonomous ERC-8004 deployment:-// the manifest builder (what lands on-chain) and the avatar-URL gate (what we-// refuse to publish). The on-chain signing path is exercised through the live-// cron; here we lock the shape the crawler/feed depend on.-import { describe, it, expect } from 'vitest';-import { buildAgentManifest, resolveAvatarUrls } from '../api/_lib/erc8004-publish.js';--describe('buildAgentManifest', () => {- const agent = { name: 'Nova', description: 'a guide' };- const urls = { glbUrl: 'https://cdn.three.ws/a.glb', imageUrl: 'https://cdn.three.ws/a.png' };- const manifest = buildAgentManifest(agent, urls, 'https://three.ws');-- it('carries an avatar service so the crawler marks it has_3d', () => {- const avatar = manifest.services.find((s) => s.name === 'avatar');- expect(avatar).toBeTruthy();- expect(avatar.endpoint).toBe(urls.glbUrl);- });-- it('points the body at the GLB', () => {- expect(manifest.body.uri).toBe(urls.glbUrl);- expect(manifest.body.format).toBe('gltf-binary');- });-- it('declares x402 support via the registry fields', () => {- expect(manifest.x402Support).toBe(true);- });-- it('preserves name, description and image', () => {- expect(manifest.name).toBe('Nova');- expect(manifest.description).toBe('a guide');- expect(manifest.image).toBe(urls.imageUrl);- });-});--describe('resolveAvatarUrls', () => {- it('returns null when there is no GLB body', () => {- expect(resolveAvatarUrls({ glb_key: null, visibility: 'public' })).toBeNull();- });-- it('refuses private avatars — their GLB 404s for everyone else', () => {- expect(resolveAvatarUrls({ glb_key: 'k.glb', visibility: 'private' })).toBeNull();- });-- it('allows public and unlisted bodies', () => {- expect(resolveAvatarUrls({ glb_key: 'k.glb', visibility: 'public' })).not.toBeNull();- expect(resolveAvatarUrls({ glb_key: 'k.glb', visibility: 'unlisted' })).not.toBeNull();- });-});diff --git a/tests/launcher-owner-allowlist.test.js b/tests/launcher-owner-allowlist.test.jsnew file mode 100644index 000000000..862ca301e--- /dev/null+++ b/tests/launcher-owner-allowlist.test.js@@ -0,0 +1,47 @@+import { describe, it, expect, afterEach } from 'vitest';++// The launcher engine pulls in db.js (and transitively env.js) at import time, so+// stub the DB the same lightweight way the engine test does — we only exercise the+// pure env-parsing helper here, never a query.+import { vi } from 'vitest';+vi.mock('../api/_lib/db.js', () => ({ sql: () => Promise.resolve([]), isDbUnavailableError: () => false }));+vi.mock('../api/_lib/launcher-funding.js', () => ({+ masterBalanceSol: vi.fn(), dailySpentSol: vi.fn(), fundAgentForLaunch: vi.fn(),+}));+vi.mock('../api/_lib/launcher-sources.js', () => ({ pickSource: vi.fn() }));+vi.mock('../api/_lib/auth.js', () => ({ createSession: vi.fn() }));+vi.mock('../api/_lib/agent-pumpfun.js', () => ({ solanaConnection: vi.fn() }));++import { ownerAllowlist } from '../api/_lib/launcher-engine.js';++const A = '11111111-2222-4333-8444-555555555555';+const B = 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee';++afterEach(() => { delete process.env.LAUNCHER_OWNER_USER_IDS; });++describe('ownerAllowlist — house-ownership guarantee parsing', () => {+ it('is empty when unset (falls back to the circulation pool)', () => {+ delete process.env.LAUNCHER_OWNER_USER_IDS;+ expect(ownerAllowlist()).toEqual([]);+ });++ it('parses a single uuid', () => {+ process.env.LAUNCHER_OWNER_USER_IDS = A;+ expect(ownerAllowlist()).toEqual([A]);+ });++ it('parses a comma-separated list, trimming whitespace', () => {+ process.env.LAUNCHER_OWNER_USER_IDS = ` ${A} , ${B} `;+ expect(ownerAllowlist()).toEqual([A, B]);+ });++ it('drops malformed entries so the ::uuid[] cast can never throw', () => {+ process.env.LAUNCHER_OWNER_USER_IDS = `${A},not-a-uuid,,123,${B}`;+ expect(ownerAllowlist()).toEqual([A, B]);+ });++ it('is empty when every entry is malformed', () => {+ process.env.LAUNCHER_OWNER_USER_IDS = 'nope, also-nope';+ expect(ownerAllowlist()).toEqual([]);+ });+});diff --git a/vercel.json b/vercel.jsonindex dd3d0c6c1..bdc6ea3cd 100644--- a/vercel.json+++ b/vercel.json@@ -105,7 +105,7 @@"api/cron/recompute-reputation.js": {"maxDuration": 300},- "api/cron/erc8004-autopublish.js": {+ "api/cron/solana-autodeploy.js": {"maxDuration": 120},"api/cron/[name].js": {@@ -4650,7 +4650,7 @@"schedule": "*/15 * * * *"},{- "path": "/api/cron/erc8004-autopublish",+ "path": "/api/cron/solana-autodeploy","schedule": "*/10 * * * *"},{