Skip to content

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.

feat: implement autonomous ERC-8004 deployment and related cron jobs

qrqkc0722c44c5b8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 201796cdc..45d2f9c5e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-28
- **$THREE payments ride out brief price-feed blips instead of failing** — Paid actions priced in $THREE (Forge high tier, spins, marketplace) no longer fail when every live price feed happens to miss on the same request. The price layer now keeps a recent last-known-good price and serves it through a momentary simultaneous outage of Jupiter and the backup feeds, so a quote is never rejected over a transient blip. Prices older than five minutes are still refused — a payment is never priced off a stale number. And on the rare moment the payment rail genuinely is catching its breath, you now see a clear "briefly unavailable — try again" message instead of a raw "internal error" support code. (`/three-token`) `[fix]`
+- **A quiet Money Pulse now points you to the live feed instead of a dead end** — When the Money Pulse (/pulse) showed "No money moving — yet," it gave no hint that the silence was just the network you were on — or the filter you'd clicked. The feed has no time limit, so mainnet — where the real tips, launches, trades and payments flow — is effectively never empty; almost every empty view was the devnet test network, or a filter (like Trades or Marketplace) that happened to be quiet while the platform was busy with other money. The empty state now reads the situation honestly: a quiet filter says "No trades yet" instead of "all quiet" and offers a one-click "View all activity" that clears the filter, while a quiet network checks the other one in the background and offers "See live activity on mainnet" — either switch flips the whole page, feed and every stat panel, in lockstep. On devnet the copy now explains it's a test network and most money moves on mainnet, so a quiet feed reads as honest, not broken. (`/pulse`) `[improvement]`
+- **Agent mirror (copy-trading) panel loads again** — Opening an agent's mirror panel — the copy-trading social graph where your agent follows a proven leader within your spend policy — was failing with a 404. The endpoints that power it (your following list, a leader's public track record and follower count, the recent-fills feed, and the follow/unfollow/pause/sync controls) all live under /api/agents/:id/mirror, but our production routing only recognised single-segment agent paths, so every mirror request fell through to the not-found page. We widened the route so the agent dispatcher receives these sub-paths, restoring the mirror panel and its sibling agent endpoints. (`/mirror`) `[fix]`
- **Agent Reputation Leaderboard — top agents promoted in marketplace by on-chain trust score** — The platform now autonomously ranks the top 10 three.ws agents by behavioral trust score every 30 minutes via a real x402 payment to the agent-reputation endpoint. Scores are synthesized from real on-chain pump.fun agent-payments activity, distribution/buyback success, and signed Solana attestations — not a subjective rating. The top 10 are promoted to the front of the marketplace recommended feed and marked with a ◈ Top Trust badge. The ranking is also stored as an oracle signal (topic: agent_reputation_leaderboard) for downstream systems to query. Full snapshot history is written to agent_reputation_leaderboard_snapshots so trust trends are auditable over time. (`/marketplace`) `[feature, improvement]`
- **Agent Studio's Brain editor is now a clean form, not a node graph** — Designing your agent's mind no longer means dragging wires around a flow-chart. The Brain tab is now an ordered stack of cards — Persona, Memory, Skills, Market signals, Model, and Avatar output — that you simply fill in. The wiring happens automatically: a card that's present is part of your agent's reasoning; remove it and it's gone. Templates, the live test chat, the behavior preview, and the 'watch it think' highlight all carry over unchanged, and everything you already built loads straight into the new editor. (`/agent-studio`) `[improvement]`
- **API Key Validity Health — the platform verifies its own access keys every hour** — A lapsed or missing access key for the autonomous loop means every self-call in the pipeline hits the paywall cold — legitimate tool calls start failing, recovery is manual, and the outage is invisible until someone investigates why the spend log went quiet. The platform now detects this automatically. Every hour an autonomous agent makes a real on-chain payment to a new /api/x402/api-key-health endpoint with body { scope: "autonomous_loop" }. The endpoint checks whether any active subscription key covers the requested scope, falling back to the INTERNAL_API_KEY env var, and returns { valid, scopes, expires_at }. The extracted signal surfaces hours_until_expiry in x402_autonomous_log.signal_data. When expiry is within 24 hours the storeValue hook writes a Redis alert (x402:api-key-health:expiry-alert) so the ops surface can surface the warning before the key lapses. `[infra, feature]`
@@ -29,8 +31,11 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **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 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]`
- **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]`
## 2026-06-27
diff --git a/api/_lib/erc8004-publish.js b/api/_lib/erc8004-publish.js
new file mode 100644
index 000000000..3e3265819
--- /dev/null
+++ b/api/_lib/erc8004-publish.js
@@ -0,0 +1,368 @@
+// @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/cron/erc8004-autopublish.js b/api/cron/erc8004-autopublish.js
new file mode 100644
index 000000000..74e525e23
--- /dev/null
+++ b/api/cron/erc8004-autopublish.js
@@ -0,0 +1,129 @@
+// @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/data/changelog.json b/data/changelog.json
index bf2029fa6..d59d5cc9e 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,50 @@
{
"$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 main menu is now organized — no more walls of links",
+ "summary": "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.",
+ "tags": [
+ "improvement"
+ ]
+ },
+ {
+ "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.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/deployments"
+ },
+ {
+ "date": "2026-06-28",
+ "title": "A quiet Money Pulse now points you to the live feed instead of a dead end",
+ "summary": "When the Money Pulse (/pulse) showed \"No money moving — yet,\" it gave no hint that the silence was just the network you were on — or the filter you'd clicked. The feed has no time limit, so mainnet — where the real tips, launches, trades and payments flow — is effectively never empty; almost every empty view was the devnet test network, or a filter (like Trades or Marketplace) that happened to be quiet while the platform was busy with other money. The empty state now reads the situation honestly: a quiet filter says \"No trades yet\" instead of \"all quiet\" and offers a one-click \"View all activity\" that clears the filter, while a quiet network checks the other one in the background and offers \"See live activity on mainnet\" — either switch flips the whole page, feed and every stat panel, in lockstep. On devnet the copy now explains it's a test network and most money moves on mainnet, so a quiet feed reads as honest, not broken.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/pulse"
+ },
+ {
+ "date": "2026-06-28",
+ "title": "Agent mirror (copy-trading) panel loads again",
+ "summary": "Opening an agent's mirror panel — the copy-trading social graph where your agent follows a proven leader within your spend policy — was failing with a 404. The endpoints that power it (your following list, a leader's public track record and follower count, the recent-fills feed, and the follow/unfollow/pause/sync controls) all live under /api/agents/:id/mirror, but our production routing only recognised single-segment agent paths, so every mirror request fell through to the not-found page. We widened the route so the agent dispatcher receives these sub-paths, restoring the mirror panel and its sibling agent endpoints.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/mirror"
+ },
+ {
+ "date": "2026-06-28",
+ "title": "The Money Pulse now sits on a pure-black canvas",
+ "summary": "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.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/pulse"
+ },
{
"date": "2026-06-28",
"title": "Five pages that were returning 404 are reachable again",
diff --git a/public/changelog.json b/public/changelog.json
index aa0ccad80..926641170 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-28T06:12:23.647Z",
+ "generated_at": "2026-06-28T06:38:15.853Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -16,6 +16,26 @@
"fix"
]
},
+ {
+ "date": "2026-06-28",
+ "type": "update",
+ "title": "A quiet Money Pulse now points you to the live feed instead of a dead end",
+ "summary": "When the Money Pulse (/pulse) showed \"No money moving — yet,\" it gave no hint that the silence was just the network you were on — or the filter you'd clicked. The feed has no time limit, so mainnet — where the real tips, launches, trades and payments flow — is effectively never empty; almost every empty view was the devnet test network, or a filter (like Trades or Marketplace) that happened to be quiet while the platform was busy with other money. The empty state now reads the situation honestly: a quiet filter says \"No trades yet\" instead of \"all quiet\" and offers a one-click \"View all activity\" that clears the filter, while a quiet network checks the other one in the background and offers \"See live activity on mainnet\" — either switch flips the whole page, feed and every stat panel, in lockstep. On devnet the copy now explains it's a test network and most money moves on mainnet, so a quiet feed reads as honest, not broken.",
+ "link": "/pulse",
+ "tags": [
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-06-28",
+ "type": "update",
+ "title": "Agent mirror (copy-trading) panel loads again",
+ "summary": "Opening an agent's mirror panel — the copy-trading social graph where your agent follows a proven leader within your spend policy — was failing with a 404. The endpoints that power it (your following list, a leader's public track record and follower count, the recent-fills feed, and the follow/unfollow/pause/sync controls) all live under /api/agents/:id/mirror, but our production routing only recognised single-segment agent paths, so every mirror request fell through to the not-found page. We widened the route so the agent dispatcher receives these sub-paths, restoring the mirror panel and its sibling agent endpoints.",
+ "link": "/mirror",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-28",
"type": "update",
@@ -251,6 +271,26 @@
"fix"
]
},
+ {
+ "date": "2026-06-28",
+ "type": "update",
+ "title": "The main menu is now organized — no more walls of links",
+ "summary": "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.",
+ "link": null,
+ "tags": [
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-06-28",
+ "type": "update",
+ "title": "The Money Pulse now sits on a pure-black canvas",
+ "summary": "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.",
+ "link": "/pulse",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-28",
"type": "update",
@@ -273,6 +313,16 @@
"infra"
]
},
+ {
+ "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",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-27",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index 6f5366638..f28c8965f 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -14,6 +14,22 @@
<category>fix</category>
<description>Paid actions priced in $THREE (Forge high tier, spins, marketplace) no longer fail when every live price feed happens to miss on the same request. The price layer now keeps a recent last-known-good price and serves it through a momentary simultaneous outage of Jupiter and the backup feeds, so a quote is never rejected over a transient blip. Prices older than five minutes are still refused — a payment is never priced off a stale number. And on the rare moment the payment rail genuinely is catching its breath, you now see a clear &quot;briefly unavailable — try again&quot; message instead of a raw &quot;internal error&quot; support code.</description>
</item>
+ <item>
+ <title>A quiet Money Pulse now points you to the live feed instead of a dead end</title>
+ <link>https://three.ws/pulse</link>
+ <guid isPermaLink="false">2026-06-28:A quiet Money Pulse now points you to the live feed instead of a dead end</guid>
+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>When the Money Pulse (/pulse) showed &quot;No money moving — yet,&quot; it gave no hint that the silence was just the network you were on — or the filter you'd clicked. The feed has no time limit, so mainnet — where the real tips, launches, trades and payments flow — is effectively never empty; almost every empty view was the devnet test network, or a filter (like Trades or Marketplace) that happened to be quiet while the platform was busy with other money. The empty state now reads the situation honestly: a quiet filter says &quot;No trades yet&quot; instead of &quot;all quiet&quot; and offers a one-click &quot;View all activity&quot; that clears the filter, while a quiet network checks the other one in the background and offers &quot;See live activity on mainnet&quot; — either switch flips the whole page, feed and every stat panel, in lockstep. On devnet the copy now explains it's a test network and most money moves on mainnet, so a quiet feed reads as honest, not broken.</description>
+ </item>
+ <item>
+ <title>Agent mirror (copy-trading) panel loads again</title>
+ <link>https://three.ws/mirror</link>
+ <guid isPermaLink="false">2026-06-28:Agent mirror (copy-trading) panel loads again</guid>
+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Opening an agent's mirror panel — the copy-trading social graph where your agent follows a proven leader within your spend policy — was failing with a 404. The endpoints that power it (your following list, a leader's public track record and follower count, the recent-fills feed, and the follow/unfollow/pause/sync controls) all live under /api/agents/:id/mirror, but our production routing only recognised single-segment agent paths, so every mirror request fell through to the not-found page. We widened the route so the agent dispatcher receives these sub-paths, restoring the mirror panel and its sibling agent endpoints.</description>
+ </item>
<item>
<title>Agent Reputation Leaderboard — top agents promoted in marketplace by on-chain trust score</title>
<link>https://three.ws/marketplace</link>
@@ -190,6 +206,22 @@
<category>fix</category>
<description>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.</description>
</item>
+ <item>
+ <title>The main menu is now organized — no more walls of links</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-28:The main menu is now organized — no more walls of links</guid>
+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>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 &quot;New&quot; 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 &amp; trade / Intelligence / Compete &amp; 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 &quot;Live&quot; dot, which now genuinely means the page is running right now.</description>
+ </item>
+ <item>
+ <title>The Money Pulse now sits on a pure-black canvas</title>
+ <link>https://three.ws/pulse</link>
+ <guid isPermaLink="false">2026-06-28:The Money Pulse now sits on a pure-black canvas</guid>
+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>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.</description>
+ </item>
<item>
<title>User Activity Analytics — DAU, WAU, and top features now tracked every 6 hours via x402</title>
<link>https://three.ws/changelog</link>
@@ -206,6 +238,14 @@
<category>feature</category>
<description>The autonomous loop now pays /api/x402/analytics every 30 minutes with { report: &quot;x402_volume&quot;, period: &quot;24h&quot; } 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 (&quot;underused&quot;) 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>
+ <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>
+ </item>
<item>
<title>Capabilities — Alpha Hunt, Launcher, Auto-Claim &amp; Market Maker</title>
<link>https://three.ws/dashboard/capabilities</link>
diff --git a/public/features.json b/public/features.json
index aca23a4a5..3c1724b0c 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-28T06:12:23.631Z",
+ "generated_at": "2026-06-28T06:38:15.837Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/nav-data.js b/public/nav-data.js
index 63e007883..857204fd5 100644
--- a/public/nav-data.js
+++ b/public/nav-data.js
@@ -9,350 +9,405 @@
// a page header — that is exactly the drift this module exists to kill.
//
// Shapes:
-// group: { label, badge?, note?, layout?: 'wide' | 'mega',
+// group: { label, badge?, note?, layout?: 'wide' | 'mega', align?: 'right',
// items?: item[], columns?: { label, items: item[] }[] }
// - default layout: single-column dropdown of `items`
// - 'wide': two-column dropdown of `items`
-// - 'mega': right-anchored three-column dropdown of named `columns`
+// - 'mega': multi-column dropdown of named `columns` (column count is read
+// from columns.length; the popover sizes itself to fit)
+// - align: 'right' anchors the popover to the trigger's right edge so the
+// rightmost groups don't overflow the viewport. Left-anchored by default.
// item: { title, href, desc, badge?, badgeTone?, attrs? }
// - badgeTone: 'live' tints the badge green with a pulse dot (running now)
// - attrs: extra HTML attributes, e.g. { 'data-glossary-open': '' }
// top-level link: { label, href, highlight? }
// - highlight: renders as the iridescent "hot" pill (one per nav, max)
+//
+// Information architecture: every group is a categorized `mega` menu. With 60+
+// destinations, a flat list per group was a wall of links nobody could scan —
+// so each group is split into intent-named columns (e.g. Launch → Launch /
+// Terminal & trade / Intelligence / Compete & earn). The only badge that
+// survives is the green "Live" status (data/feature is running right now);
+// "New" was on nearly every item, so it signalled nothing and was removed.
export const NAV_GROUPS = [
{
label: 'Build',
- items: [
- {
- title: 'Instant Agent Genesis',
- href: '/genesis',
- badge: 'New',
- desc: 'Selfie or prompt → 3D agent + funded wallet + on-chain identity in 60s',
- },
- {
- title: 'Text to 3D',
- href: '/forge',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Describe an object → textured GLB, usually in seconds',
- },
- {
- title: 'Describe it to 3D',
- href: '/create/prompt',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Type a description → rigged 3D avatar in about a minute',
- },
- {
- title: 'Create an avatar',
- href: '/create-agent',
- badge: 'New',
- desc: 'Guided wizard: name, 3D body, skills, personality → ship it',
- },
- {
- title: 'Agent Studio',
- href: '/agent-studio',
- badge: 'New',
- desc: "Author brain, memory, body, money & skills with a live avatar",
- },
- {
- title: 'Selfie to avatar',
- href: '/create/selfie',
- desc: 'One photo → rigged 3D avatar',
- },
- {
- title: 'Avatar Studio',
- href: '/avatar-studio',
- desc: 'Sculpt face + body from scratch → export GLB',
- },
- {
- title: 'Animation Studio',
- href: '/pose',
- badge: 'New',
- desc: 'Pose with IK, keyframe a timeline → animated GLB you can sell',
- },
- {
- title: 'Avatar Engines Atlas',
- href: '/avatar-engines',
- badge: 'New',
- desc: 'Every engine for high-quality & photoreal 3D avatars — technique, license & how three.ws uses each',
- },
- {
- title: 'Splat Viewer',
- href: '/splat',
- badge: 'New',
- desc: 'Render photoreal Gaussian-splat avatars in the browser — load a .ply / .splat by URL or upload',
- },
- {
- title: 'Scene Capture',
- href: '/capture',
- badge: 'New',
- desc: 'Video → 3D scene — reconstruct any space into an explorable point cloud, rendered live in the browser',
- },
- {
- title: 'CA → x402',
- href: '/ca2x402',
- badge: 'New',
- desc: 'Paste any token contract address → a live, agent-payable x402 endpoint for its market intel',
+ layout: 'mega',
+ columns: [
+ {
+ label: 'Start here',
+ items: [
+ {
+ title: 'Instant Agent Genesis',
+ href: '/genesis',
+ desc: 'Selfie or prompt → 3D agent + funded wallet + on-chain identity in 60s',
+ },
+ {
+ title: 'Create an avatar',
+ href: '/create-agent',
+ desc: 'Guided wizard: name, 3D body, skills, personality → ship it',
+ },
+ {
+ title: 'Agent Studio',
+ href: '/agent-studio',
+ desc: 'Author brain, memory, body, money & skills with a live avatar',
+ },
+ ],
+ },
+ {
+ label: '3D & avatars',
+ items: [
+ {
+ title: 'Text to 3D',
+ href: '/forge',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Describe an object → textured GLB, usually in seconds',
+ },
+ {
+ title: 'Describe it to 3D',
+ href: '/create/prompt',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Type a description → rigged 3D avatar in about a minute',
+ },
+ {
+ title: 'Selfie to avatar',
+ href: '/create/selfie',
+ desc: 'One photo → rigged 3D avatar',
+ },
+ {
+ title: 'Avatar Studio',
+ href: '/avatar-studio',
+ desc: 'Sculpt face + body from scratch → export GLB',
+ },
+ {
+ title: 'Animation Studio',
+ href: '/pose',
+ desc: 'Pose with IK, keyframe a timeline → animated GLB you can sell',
+ },
+ ],
+ },
+ {
+ label: 'Capture & advanced',
+ items: [
+ {
+ title: 'Splat Viewer',
+ href: '/splat',
+ desc: 'Render photoreal Gaussian-splat avatars in the browser — load a .ply / .splat by URL or upload',
+ },
+ {
+ title: 'Scene Capture',
+ href: '/capture',
+ desc: 'Video → 3D scene — reconstruct any space into an explorable point cloud, rendered live in the browser',
+ },
+ {
+ title: 'Avatar Engines Atlas',
+ href: '/avatar-engines',
+ desc: 'Every engine for high-quality & photoreal 3D avatars — technique, license & how three.ws uses each',
+ },
+ {
+ title: 'CA → x402',
+ href: '/ca2x402',
+ desc: 'Paste any token contract address → a live, agent-payable x402 endpoint for its market intel',
+ },
+ ],
},
],
},
{
label: 'Discover',
- items: [
- {
- title: 'Trending',
- href: '/trending',
- badge: 'New',
- desc: 'Top agents by real activity + top Oracle conviction coins',
- },
- {
- title: 'What is three.ws?',
- href: '/what-is',
- desc: 'Plain-English intro + real use-cases — start here',
- },
- {
- title: 'Take the guided tour',
- href: '/tour',
- badge: 'New',
- desc: 'A 3D guide walks you through every feature, live',
- },
- {
- title: '$THREE Token',
- href: '/three-token',
- desc: 'Live price, bonding-curve chart, streaming trades & one-click buy',
- },
- {
- title: 'Money Pulse',
- href: '/pulse',
- badge: 'New',
- desc: 'Live, platform-wide feed of real agent wallet activity — tips, launches, trades & payments',
- },
- {
- title: 'On-chain Deployments',
- href: '/deployments',
- badge: 'New',
- desc: 'Live cross-chain feed of every agent registered on the ERC-8004 Identity Registry, as it lands on-chain',
- },
- {
- title: 'Copy Trading',
- href: '/mirror',
- badge: 'New',
- desc: 'Follow a proven agent by its honest on-chain track record — your agent mirrors its trades within your spend policy',
- },
- {
- title: 'Strategy Objects',
- href: '/strategies',
- badge: 'New',
- desc: 'Equip an ownable, forkable trade strategy on your agent — ranked by real on-chain results, run inside your spend policy',
- },
- {
- title: 'Trading Swarms',
- href: '/swarms',
- badge: 'New',
- desc: 'Pool capital with other agents into one auditable treasury — it trades on reputation-weighted consensus and pays profit back pro-rata on-chain',
- },
- { title: 'Agents Index', href: '/agents', desc: 'Browse every registered agent' },
- {
- title: 'Live Agents',
- href: '/agents-live',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Watch agents work in real time — live screens + avatar cams as they browse, research, and operate',
- },
- { title: 'Marketplace', href: '/marketplace', desc: 'Buy, sell & remix agents' },
- { title: 'Avatar Gallery', href: '/gallery', desc: 'Every public 3D avatar' },
- { title: 'Animation Gallery', href: '/animations', desc: 'Community animations for avatars' },
- {
- title: 'Worlds',
- href: '/play',
- badge: 'New',
- desc: 'Every coin is a 3D world — drop in & hang out',
- },
- {
- title: 'Coin Clash',
- href: '/clash',
- badge: 'New',
- desc: 'Token-gated community warfare — hold a coin, enlist, and battle other armies live',
- },
- {
- title: 'All pages',
- href: '/sitemap',
- desc: 'The full directory — every page on three.ws, filterable',
+ layout: 'mega',
+ columns: [
+ {
+ label: 'Start here',
+ items: [
+ {
+ title: 'Trending',
+ href: '/trending',
+ desc: 'Top agents by real activity + top Oracle conviction coins',
+ },
+ {
+ title: 'What is three.ws?',
+ href: '/what-is',
+ desc: 'Plain-English intro + real use-cases — start here',
+ },
+ {
+ title: 'Take the guided tour',
+ href: '/tour',
+ desc: 'A 3D guide walks you through every feature, live',
+ },
+ {
+ title: 'All pages',
+ href: '/sitemap',
+ desc: 'The full directory — every page on three.ws, filterable',
+ },
+ ],
+ },
+ {
+ label: 'Agents & worlds',
+ items: [
+ { title: 'Agents Index', href: '/agents', desc: 'Browse every registered agent' },
+ {
+ title: 'Live Agents',
+ href: '/agents-live',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Watch agents work in real time — live screens + avatar cams as they browse, research, and operate',
+ },
+ { title: 'Marketplace', href: '/marketplace', desc: 'Buy, sell & remix agents' },
+ { title: 'Avatar Gallery', href: '/gallery', desc: 'Every public 3D avatar' },
+ { title: 'Animation Gallery', href: '/animations', desc: 'Community animations for avatars' },
+ {
+ title: 'Worlds',
+ href: '/play',
+ desc: 'Every coin is a 3D world — drop in & hang out',
+ },
+ {
+ title: 'Coin Clash',
+ href: '/clash',
+ desc: 'Token-gated community warfare — hold a coin, enlist, and battle other armies live',
+ },
+ ],
+ },
+ {
+ label: 'Money & social',
+ items: [
+ {
+ title: '$THREE Token',
+ href: '/three-token',
+ desc: 'Live price, bonding-curve chart, streaming trades & one-click buy',
+ },
+ {
+ title: 'Money Pulse',
+ href: '/pulse',
+ desc: 'Live, platform-wide feed of real agent wallet activity — tips, launches, trades & payments',
+ },
+ {
+ title: 'On-chain Deployments',
+ href: '/deployments',
+ desc: 'Live cross-chain feed of every agent registered on the ERC-8004 Identity Registry, as it lands on-chain',
+ },
+ {
+ title: 'Copy Trading',
+ href: '/mirror',
+ desc: 'Follow a proven agent by its honest on-chain track record — your agent mirrors its trades within your spend policy',
+ },
+ {
+ title: 'Strategy Objects',
+ href: '/strategies',
+ desc: 'Equip an ownable, forkable trade strategy on your agent — ranked by real on-chain results, run inside your spend policy',
+ },
+ {
+ title: 'Trading Swarms',
+ href: '/swarms',
+ desc: 'Pool capital with other agents into one auditable treasury — it trades on reputation-weighted consensus and pays profit back pro-rata on-chain',
+ },
+ ],
},
],
},
{
label: 'Launch',
- items: [
- {
- title: 'Mission Control',
- href: '/terminal',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Real-time trading terminal — live launches, intel, firewall, smart-money & your positions on one keyboard-driven screen',
- },
- {
- title: 'Launch a Coin',
- href: '/launch',
- desc: 'Mint a coin for your agent on pump.fun',
- },
- {
- title: 'Memetic Launcher',
- href: '/launcher',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Your autonomous launcher — ride live narratives and preview what your agents would mint',
- },
- {
- title: 'Launchpad Studio',
- href: '/launchpad',
- desc: 'Build a white-label hosted launchpad page in minutes',
- },
- {
- title: 'Coin Intelligence',
- href: '/coin-intel',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Every launch classified — organic vs bundle, the wallets, a learning score',
- },
- {
- title: 'Trader Leaderboard',
- href: '/leaderboard',
- badge: 'New',
- desc: 'Top traders ranked by a provable track record',
- },
- {
- title: 'Back-an-Agent Vaults',
- href: '/vaults',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Stake behind a verified trader you can watch — real custody, shared P&L, drawdown-protected',
- },
- {
- title: 'Labor Market',
- href: '/labor-market',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Agents hire, pay & verify each other — a live $THREE machine economy',
- },
- {
- title: 'Alpha Co-pilot',
- href: '/alpha-copilot',
- badge: 'New',
- badgeTone: 'live',
- desc: 'Your agent reads a real launch in character, speaks its verdict aloud & acts within your spend limits',
- },
- {
- title: 'Live Trade Feed',
- href: '/trades',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Every notable pump.fun exit — PnL, hold time, and one-click copy',
- },
- {
- title: 'Claim Your Wallet',
- href: '/claim-wallet',
- badge: 'New',
- desc: 'See your verified pump.fun track record and publish it as a Trader Card',
- },
- {
- title: 'The Arena',
- href: '/arena',
- badge: 'New',
- desc: 'PvP trading tournaments — verified P&L, on-chain results, $THREE prizes',
- },
- {
- title: 'Sniper Arena',
- href: '/play/arena',
- desc: 'Watch AI agents trade pump.fun live',
- },
- {
- title: 'Live Stream',
- href: '/pump-live',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Real-time new launches',
- },
- {
- title: 'Coin Radar',
- href: '/radar',
- badge: 'Live',
- badgeTone: 'live',
- desc: 'Live pump.fun launch intelligence — bundle vs organic, scored',
- },
- {
- title: 'Smart Money Radar',
- href: '/smart-money',
- badge: 'New',
- desc: 'Which wallets actually win — and what the proven money is buying now',
- },
- {
- title: 'Oracle',
- href: '/oracle',
- badge: 'New',
- badgeTone: 'live',
- desc: 'One fused conviction score per launch — and arm your agent to act on it',
- },
- {
- title: 'Arm your agent',
- href: '/oracle/arm',
- badge: 'New',
- desc: 'Set the rules and let your 3D agent trade Oracle conviction — simulate first, then go live',
- },
- {
- title: 'Strategy Lab',
- href: '/strategy-lab',
- badge: 'New',
- desc: 'Backtest Oracle conviction filters and deploy your agent strategy in one click',
- },
- {
- title: 'Watchlist',
- href: '/watchlist',
- desc: 'Your tracked coins — live market caps and graduation status',
- },
- {
- title: 'Agent Activity',
- href: '/activity',
- desc: 'Every agent trade in real time — entries, outcomes, and who to copy',
- },
- {
- title: 'Recording Pipeline',
- href: '/pipeline',
- desc: 'Live health of the data loop: recorder, intel, outcomes, Oracle, learning, trading',
- },
- {
- title: '3D Visualizer',
- href: '/pump-visualizer',
- desc: 'Trending tokens in 3D',
- },
- {
- title: 'All Launches',
- href: '/launches',
- desc: 'Every agent-launched coin — full history',
- },
- {
- title: 'Token in 3D',
- href: '/coin3d',
- desc: 'View any token as a cinematic 3D scene',
+ layout: 'mega',
+ columns: [
+ {
+ label: 'Launch',
+ items: [
+ {
+ title: 'Launch a Coin',
+ href: '/launch',
+ desc: 'Mint a coin for your agent on pump.fun',
+ },
+ {
+ title: 'Memetic Launcher',
+ href: '/launcher',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Your autonomous launcher — ride live narratives and preview what your agents would mint',
+ },
+ {
+ title: 'Launchpad Studio',
+ href: '/launchpad',
+ desc: 'Build a white-label hosted launchpad page in minutes',
+ },
+ {
+ title: 'All Launches',
+ href: '/launches',
+ desc: 'Every agent-launched coin — full history',
+ },
+ {
+ title: 'Token in 3D',
+ href: '/coin3d',
+ desc: 'View any token as a cinematic 3D scene',
+ },
+ {
+ title: '3D Visualizer',
+ href: '/pump-visualizer',
+ desc: 'Trending tokens in 3D',
+ },
+ ],
+ },
+ {
+ label: 'Terminal & trade',
+ items: [
+ {
+ title: 'Mission Control',
+ href: '/terminal',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Real-time trading terminal — live launches, intel, firewall, smart-money & your positions on one keyboard-driven screen',
+ },
+ {
+ title: 'Oracle',
+ href: '/oracle',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'One fused conviction score per launch — and arm your agent to act on it',
+ },
+ {
+ title: 'Arm your agent',
+ href: '/oracle/arm',
+ desc: 'Set the rules and let your 3D agent trade Oracle conviction — simulate first, then go live',
+ },
+ {
+ title: 'Strategy Lab',
+ href: '/strategy-lab',
+ desc: 'Backtest Oracle conviction filters and deploy your agent strategy in one click',
+ },
+ {
+ title: 'Watchlist',
+ href: '/watchlist',
+ desc: 'Your tracked coins — live market caps and graduation status',
+ },
+ {
+ title: 'Alpha Co-pilot',
+ href: '/alpha-copilot',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Your agent reads a real launch in character, speaks its verdict aloud & acts within your spend limits',
+ },
+ ],
+ },
+ {
+ label: 'Intelligence',
+ items: [
+ {
+ title: 'Coin Intelligence',
+ href: '/coin-intel',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Every launch classified — organic vs bundle, the wallets, a learning score',
+ },
+ {
+ title: 'Coin Radar',
+ href: '/radar',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Live pump.fun launch intelligence — bundle vs organic, scored',
+ },
+ {
+ title: 'Smart Money Radar',
+ href: '/smart-money',
+ desc: 'Which wallets actually win — and what the proven money is buying now',
+ },
+ {
+ title: 'Live Stream',
+ href: '/pump-live',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Real-time new launches',
+ },
+ {
+ title: 'Live Trade Feed',
+ href: '/trades',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Every notable pump.fun exit — PnL, hold time, and one-click copy',
+ },
+ {
+ title: 'Agent Activity',
+ href: '/activity',
+ desc: 'Every agent trade in real time — entries, outcomes, and who to copy',
+ },
+ {
+ title: 'Recording Pipeline',
+ href: '/pipeline',
+ desc: 'Live health of the data loop: recorder, intel, outcomes, Oracle, learning, trading',
+ },
+ ],
+ },
+ {
+ label: 'Compete & earn',
+ items: [
+ {
+ title: 'Trader Leaderboard',
+ href: '/leaderboard',
+ desc: 'Top traders ranked by a provable track record',
+ },
+ {
+ title: 'The Arena',
+ href: '/arena',
+ desc: 'PvP trading tournaments — verified P&L, on-chain results, $THREE prizes',
+ },
+ {
+ title: 'Sniper Arena',
+ href: '/play/arena',
+ desc: 'Watch AI agents trade pump.fun live',
+ },
+ {
+ title: 'Back-an-Agent Vaults',
+ href: '/vaults',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Stake behind a verified trader you can watch — real custody, shared P&L, drawdown-protected',
+ },
+ {
+ title: 'Labor Market',
+ href: '/labor-market',
+ badge: 'Live',
+ badgeTone: 'live',
+ desc: 'Agents hire, pay & verify each other — a live $THREE machine economy',
+ },
+ {
+ title: 'Claim Your Wallet',
+ href: '/claim-wallet',
+ desc: 'See your verified pump.fun track record and publish it as a Trader Card',
+ },
+ ],
},
],
},
{
label: 'Learn',
- items: [
- { title: 'Docs', href: '/docs', desc: 'SDKs + API reference' },
- { title: 'Tutorials', href: '/tutorials', desc: 'Step-by-step guides' },
- { title: 'Chat', href: '/chat', desc: 'Talk to your agent' },
- { title: 'Pay', href: '/pay', desc: 'Agent payments — x402 + USDC' },
- { title: 'Payment Sessions', href: '/payments', desc: 'Governed agent spend budgets — no private key needed' },
- { title: 'Credits', href: '/credits', desc: 'Top up & spend — SOL or $THREE' },
- {
- title: 'Avatar SDK',
- href: '/avatar-sdk',
- badge: 'New',
- desc: 'npm · web component · React · GLB upload',
+ layout: 'mega',
+ columns: [
+ {
+ label: 'Learn',
+ items: [
+ { title: 'Docs', href: '/docs', desc: 'SDKs + API reference' },
+ { title: 'Tutorials', href: '/tutorials', desc: 'Step-by-step guides' },
+ { title: 'Chat', href: '/chat', desc: 'Talk to your agent' },
+ ],
+ },
+ {
+ label: 'Payments',
+ items: [
+ { title: 'Pay', href: '/pay', desc: 'Agent payments — x402 + USDC' },
+ { title: 'Payment Sessions', href: '/payments', desc: 'Governed agent spend budgets — no private key needed' },
+ { title: 'Credits', href: '/credits', desc: 'Top up & spend — SOL or $THREE' },
+ ],
+ },
+ {
+ label: 'Developers',
+ items: [
+ {
+ title: 'Avatar SDK',
+ href: '/avatar-sdk',
+ desc: 'npm · web component · React · GLB upload',
+ },
+ ],
},
],
},
diff --git a/public/nav.css b/public/nav.css
index 5effa6045..3fd927052 100644
--- a/public/nav.css
+++ b/public/nav.css
@@ -392,16 +392,22 @@
min-width: 540px;
max-width: calc(100vw - 24px);
}
-/* Labs mega menu — categorized columns, right-anchored (it's the last group).
+/* Categorized mega menu — intent-named columns. Left-anchored by default;
+ add .anchor-right for the rightmost groups so they don't run off the viewport.
+ Column count comes from .cols-N (set by the renderer from columns.length).
The viewport cap + scroll are inherited from .nav-pop. */
.nav-pop.mega {
- left: auto; right: 0;
- transform-origin: top right;
- min-width: 632px;
max-width: calc(100vw - 24px);
grid-template-columns: repeat(3, 1fr);
gap: 2px 6px; padding: 8px;
}
+.nav-pop.mega.cols-2 { grid-template-columns: repeat(2, 1fr); min-width: 460px; }
+.nav-pop.mega.cols-3 { grid-template-columns: repeat(3, 1fr); min-width: 632px; }
+.nav-pop.mega.cols-4 { grid-template-columns: repeat(4, 1fr); min-width: 824px; }
+.nav-pop.mega.anchor-right {
+ left: auto; right: 0;
+ transform-origin: top right;
+}
.nav-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nav-col-h {
font-family: var(--nv-font-mono); font-size: var(--text-xs);
diff --git a/public/nav.js b/public/nav.js
index 52e3e5778..7d9d5054b 100644
--- a/public/nav.js
+++ b/public/nav.js
@@ -251,8 +251,14 @@ function renderGroup(group) {
const badge = group.badge
? `<span class="nav-pill-sm" aria-hidden="true">${escHtml(group.badge)}</span>`
: '';
- const popClass =
- group.layout === 'mega' ? 'nav-pop mega' : group.layout === 'wide' ? 'nav-pop wide' : 'nav-pop';
+ let popClass = 'nav-pop';
+ if (group.layout === 'mega') {
+ popClass += ' mega';
+ if (group.columns) popClass += ` cols-${group.columns.length}`;
+ if (group.align === 'right') popClass += ' anchor-right';
+ } else if (group.layout === 'wide') {
+ popClass += ' wide';
+ }
const note = group.note ? `<div class="nav-pop-note">${escHtml(group.note)}</div>` : '';
const body = group.columns
? group.columns
@@ -350,10 +356,23 @@ function initDropdowns(root) {
if (!groups.length) return;
const hoverCapable = window.matchMedia('(hover: hover)').matches;
+ // Keep a left-anchored popover inside the viewport. The wide mega menus
+ // (Launch is four columns) can extend past the right edge on smaller
+ // desktops; nudge them left by the overflow so the last column stays
+ // clickable. Right-anchored menus already hug the right edge — leave them.
+ function clampPopover(pop, on) {
+ pop.style.marginLeft = '';
+ if (!on || pop.classList.contains('anchor-right')) return;
+ const overflow = pop.getBoundingClientRect().right - (window.innerWidth - 12);
+ if (overflow > 0) pop.style.marginLeft = `-${Math.ceil(overflow)}px`;
+ }
+
function setOpen(grp, on) {
grp.classList.toggle('open', on);
const t = grp.querySelector('.nav-trigger');
if (t) t.setAttribute('aria-expanded', on ? 'true' : 'false');
+ const pop = grp.querySelector('.nav-pop');
+ if (pop) clampPopover(pop, on);
}
function closeAll(except) {
groups.forEach((g) => {
diff --git a/scripts/arm-launcher.mjs b/scripts/arm-launcher.mjs
new file mode 100644
index 000000000..c22b5ad89
--- /dev/null
+++ b/scripts/arm-launcher.mjs
@@ -0,0 +1,188 @@
+#!/usr/bin/env node
+// Arm / observe the autonomous coin launcher (the Memetic Launcher) against a
+// deployment, and print the JSON result — the operator's one-command switch for
+// turning autonomous pump.fun launches on.
+//
+// The launcher engine (api/_lib/launcher-engine.js) is fully inert until a
+// launcher_config row is enabled AND out of dry_run: it ships disabled + dry_run
+// so no SOL ever moves by accident. This is the supported way to flip it live —
+// the same admin endpoint the console uses (api/admin/launcher.js), authed with
+// the Vercel CRON_SECRET (Bearer).
+//
+// Commands:
+// status (default) GET the live config, master-wallet balance, queue size,
+// today's throughput, and the `armed` flag.
+// dry-run enabled=true, dry_run=true — picks a coin + agent every
+// tick and records the run, but moves NO SOL. Prove the loop
+// end-to-end before spending.
+// arm enabled=true, dry_run=false — REAL launches begin on the
+// next cron tick (the tick cron runs every minute).
+// disarm enabled=false — stop launching, keep the config.
+// resume clear a tripped circuit breaker (paused=false).
+// tick force one launcher tick right now (bypasses the schedule).
+//
+// Caps (apply to `arm` / `dry-run`; all overridable via env, conservative by
+// default so a first arming can't run away):
+// CADENCE_SECONDS target seconds between launches (default 300 = 1 / 5 min)
+// MAX_PER_HOUR hourly launch ceiling (default 6)
+// PER_LAUNCH_SOL SOL funded to each launching agent (default 0.02)
+// DAILY_SOL_CAP hard daily SOL ceiling (default 0.25)
+// DEV_BUY_SOL agent's own dev-buy on its coin (default 0)
+// BUYBACK_BPS creator-fee → $THREE buyback share (default 5000 = 50%)
+// MODE off|trend|meme|random|hybrid (default hybrid)
+// NETWORK mainnet|devnet (default mainnet)
+//
+// Usage:
+// CRON_SECRET=… node scripts/arm-launcher.mjs # status
+// CRON_SECRET=… node scripts/arm-launcher.mjs dry-run # prove the loop
+// CRON_SECRET=… node scripts/arm-launcher.mjs arm # go live
+// CRON_SECRET=… node scripts/arm-launcher.mjs tick # launch now
+// BASE_URL=http://localhost:3000 CRON_SECRET=… node scripts/arm-launcher.mjs arm
+// PER_LAUNCH_SOL=0.03 DAILY_SOL_CAP=1 MAX_PER_HOUR=30 … node scripts/arm-launcher.mjs arm
+
+const BASE_URL = (process.env.BASE_URL || 'https://three.ws').replace(/\/$/, '');
+const CRON_SECRET = process.env.CRON_SECRET;
+if (!CRON_SECRET) {
+ console.error('CRON_SECRET is required (the Vercel cron bearer secret used by api/admin/launcher.js)');
+ process.exit(1);
+}
+
+const cmd = (process.argv[2] || 'status').toLowerCase();
+const COMMANDS = new Set(['status', 'dry-run', 'arm', 'disarm', 'resume', 'tick']);
+if (!COMMANDS.has(cmd)) {
+ console.error(`unknown command "${cmd}" — one of: ${[...COMMANDS].join(', ')}`);
+ process.exit(1);
+}
+
+const ENDPOINT = `${BASE_URL}/api/admin/launcher`;
+
+const num = (v, dflt) => {
+ const n = Number(v);
+ return Number.isFinite(n) ? n : dflt;
+};
+
+function armConfig(dryRun) {
+ return {
+ enabled: true,
+ dry_run: dryRun,
+ mode: process.env.MODE || 'hybrid',
+ network: process.env.NETWORK || 'mainnet',
+ target_cadence_seconds: Math.round(num(process.env.CADENCE_SECONDS, 300)),
+ max_per_hour: Math.round(num(process.env.MAX_PER_HOUR, 6)),
+ per_launch_sol: num(process.env.PER_LAUNCH_SOL, 0.02),
+ daily_sol_cap: num(process.env.DAILY_SOL_CAP, 0.25),
+ dev_buy_sol: num(process.env.DEV_BUY_SOL, 0),
+ buyback_bps: Math.round(num(process.env.BUYBACK_BPS, 5000)),
+ };
+}
+
+async function api(method, body) {
+ const r = await fetch(ENDPOINT, {
+ method,
+ headers: {
+ authorization: `Bearer ${CRON_SECRET}`,
+ ...(body ? { 'content-type': 'application/json' } : {}),
+ },
+ ...(body ? { body: JSON.stringify(body) } : {}),
+ });
+ let parsed = null;
+ try { parsed = await r.json(); } catch { /* non-JSON */ }
+ return { status: r.status, body: parsed };
+}
+
+function printState(state) {
+ if (!state) return;
+ const c = state.config || {};
+ console.log(`armed: ${state.armed ? 'YES — real launches active' : 'no'}`);
+ console.log(`mode: ${c.mode} network: ${c.network}`);
+ console.log(`enabled: ${c.enabled} dry_run: ${c.dry_run} paused: ${c.paused}${c.pause_reason ? ` (${c.pause_reason})` : ''}`);
+ console.log(`cadence: every ${c.target_cadence_seconds}s max/hour: ${c.max_per_hour}`);
+ console.log(`per-launch SOL: ${c.per_launch_sol} daily cap: ${c.daily_sol_cap} dev-buy: ${c.dev_buy_sol}`);
+ console.log(`master balance: ${state.master_balance_sol == null ? 'UNCONFIGURED — set LAUNCHER_MASTER_SECRET_KEY_B64' : `◎${state.master_balance_sol}`}`);
+ console.log(`launch-ready agents in queue: ${state.queue_enabled}`);
+ if (state.stats) {
+ const s = state.stats;
+ console.log(`today: ${s.launched_today ?? 0} launched · ${s.dry_runs_today ?? 0} dry · ${s.skipped_today ?? 0} skipped · ${s.failed_today ?? 0} failed · ◎${s.sol_spent_today ?? 0} spent`);
+ }
+ if (Array.isArray(state.console) && state.console.length) {
+ console.log('recent runs:');
+ for (const run of state.console.slice(0, 8)) {
+ const tag = run.mint ? `mint=${run.mint}` : (run.error ? `err=${run.error}` : '');
+ console.log(` · ${run.status.padEnd(9)} ${(run.symbol || '—').padEnd(10)} ${(run.agent_name || '').slice(0, 20).padEnd(20)} ${tag}`);
+ }
+ }
+}
+
+// Pre-flight: refuse to spend if the master can't cover a launch or no agent is
+// ready — better a clear stop than a tick that silently skips forever.
+function preflight(state, planned) {
+ const problems = [];
+ if (state.master_balance_sol == null) {
+ problems.push('master wallet is UNCONFIGURED (LAUNCHER_MASTER_SECRET_KEY_B64 / PUMP_X402_LAUNCHER_SECRET_KEY_B64 not set on the deployment) — funding transfers will be skipped.');
+ } else if (state.master_balance_sol < planned.per_launch_sol + 0.01) {
+ problems.push(`master balance ◎${state.master_balance_sol} is below per-launch ◎${planned.per_launch_sol} + fee buffer — fund the master wallet first.`);
+ }
+ if ((state.queue_enabled ?? 0) < 1) {
+ problems.push('no launch-ready agents in the rotation yet (need a public agent with an avatar + Solana wallet; the global rotation auto-enrolls from the circulation pool — make sure circulation is seeded).');
+ }
+ return problems;
+}
+
+console.log(`── launcher · ${cmd} → ${ENDPOINT} ──\n`);
+
+// Always read current state first.
+const before = await api('GET');
+if (before.status !== 200) {
+ console.error(`GET failed: HTTP ${before.status}`);
+ console.error(JSON.stringify(before.body, null, 2));
+ process.exit(1);
+}
+
+if (cmd === 'status') {
+ printState(before.body);
+ process.exit(0);
+}
+
+if (cmd === 'tick') {
+ const r = await api('POST', { action: 'force_tick' });
+ console.log(`HTTP ${r.status}`);
+ console.log(JSON.stringify(r.body?.tick ?? r.body, null, 2));
+ process.exit(r.status === 200 ? 0 : 1);
+}
+
+if (cmd === 'resume') {
+ const r = await api('POST', { action: 'resume' });
+ console.log(`HTTP ${r.status} — circuit breaker cleared`);
+ printState((await api('GET')).body);
+ process.exit(r.status === 200 ? 0 : 1);
+}
+
+if (cmd === 'disarm') {
+ const r = await api('POST', { enabled: false });
+ console.log(`HTTP ${r.status} — launcher disabled (config preserved)`);
+ process.exit(r.status === 200 ? 0 : 1);
+}
+
+// arm / dry-run
+const planned = armConfig(cmd === 'dry-run');
+const problems = preflight(before.body, planned);
+if (problems.length) {
+ console.log(cmd === 'dry-run' ? 'pre-flight notes (dry-run moves no SOL, proceeding anyway):' : 'pre-flight:');
+ for (const p of problems) console.log(` ⚠ ${p}`);
+ console.log('');
+ // In dry-run these are informational; for a real arm, a hard blocker stops us.
+ if (cmd === 'arm') {
+ console.error('Refusing to arm with real launches until the above is resolved. Run `dry-run` to prove the loop, or fix and re-run `arm`.');
+ process.exit(2);
+ }
+}
+
+const r = await api('POST', planned);
+if (r.status !== 200) {
+ console.error(`arm failed: HTTP ${r.status}`);
+ console.error(JSON.stringify(r.body, null, 2));
+ process.exit(1);
+}
+console.log(`HTTP ${r.status} — ${r.body?.armed ? 'ARMED · real launches will begin on the next tick' : (planned.dry_run ? 'dry-run enabled · loop runs, no SOL moves' : 'updated')}\n`);
+printState((await api('GET')).body);
+console.log('\nTick cron runs every minute. Use `node scripts/arm-launcher.mjs tick` to launch immediately, or `status` to watch.');
diff --git a/scripts/launcher-ops.mjs b/scripts/launcher-ops.mjs
new file mode 100644
index 000000000..9986566b6
--- /dev/null
+++ b/scripts/launcher-ops.mjs
@@ -0,0 +1,148 @@
+// Ops CLI for the autonomous coin launcher (the Memetic Launcher).
+//
+// The engine (api/_lib/launcher-engine.js) + cron (api/cron/launcher-tick, every
+// minute) ship fully wired but INERT: the global launcher_config is seeded
+// enabled=false, dry_run=true so no SOL ever moves until an operator arms it.
+// This is the supported, scriptable way to observe and arm it without the admin UI.
+//
+// Auth: the platform admin endpoint accepts `Authorization: Bearer $CRON_SECRET`.
+// Set CRON_SECRET (and optionally APP_ORIGIN, default https://three.ws) in your env.
+//
+// node scripts/launcher-ops.mjs status # config, armed?, master SOL, queue, last runs
+// node scripts/launcher-ops.mjs dry # rehearse: enabled + dry_run (picks coin+agent, spends nothing)
+// node scripts/launcher-ops.mjs tick # force one tick now (bypasses the cron schedule)
+// node scripts/launcher-ops.mjs arm [flags] # GO LIVE: enabled=true, dry_run=false (moves real SOL)
+// node scripts/launcher-ops.mjs disarm # enabled=false (stops new launches)
+// node scripts/launcher-ops.mjs resume # clear a tripped circuit breaker
+//
+// arm flags (all optional; omitted fields keep their saved value):
+// --network mainnet|devnet --mode hybrid|trend|meme|random|off
+// --cadence <seconds> --max-per-hour <n>
+// --per-launch-sol <sol> --dev-buy-sol <sol>
+// --daily-cap-sol <sol> --buyback-bps <0..10000>
+//
+// node scripts/launcher-ops.mjs arm --network mainnet --cadence 90 --per-launch-sol 0.03 --daily-cap-sol 1
+
+const ORIGIN = (process.env.APP_ORIGIN || process.env.PUBLIC_APP_ORIGIN || 'https://three.ws').replace(/\/$/, '');
+const SECRET = process.env.CRON_SECRET;
+
+if (!SECRET) {
+ console.error('CRON_SECRET is unset. Export it (or run inside the deploy env) before arming.');
+ process.exit(1);
+}
+
+const [cmd = 'status', ...rest] = process.argv.slice(2);
+
+function flag(name, fallback = undefined) {
+ const i = rest.indexOf(`--${name}`);
+ return i >= 0 && rest[i + 1] != null ? rest[i + 1] : fallback;
+}
+
+async function call(method, body) {
+ const res = await fetch(`${ORIGIN}/api/admin/launcher`, {
+ method,
+ headers: { authorization: `Bearer ${SECRET}`, 'content-type': 'application/json' },
+ body: body ? JSON.stringify(body) : undefined,
+ });
+ const json = await res.json().catch(() => null);
+ if (!res.ok) {
+ throw new Error(`HTTP ${res.status}: ${json ? JSON.stringify(json) : '(no body)'}`);
+ }
+ return json;
+}
+
+const sol = (n) => (n == null ? '—' : `${Number(n).toFixed(4)} SOL`);
+
+function printStatus(s) {
+ const c = s.config || {};
+ console.log(`\n Launcher @ ${ORIGIN}`);
+ console.log(` ─────────────────────────────────────────────`);
+ console.log(` armed: ${s.armed ? 'YES — live, moving real SOL' : 'no'}`);
+ console.log(` enabled: ${c.enabled} dry_run: ${c.dry_run} paused: ${c.paused}${c.pause_reason ? ` (${c.pause_reason})` : ''}`);
+ console.log(` mode: ${c.mode} network: ${c.network}`);
+ console.log(` cadence: every ${c.target_cadence_seconds}s max/hr: ${c.max_per_hour}`);
+ console.log(` per launch: ${sol(c.per_launch_sol)} dev buy: ${sol(c.dev_buy_sol)} daily cap: ${sol(c.daily_sol_cap)}`);
+ console.log(` buyback: ${c.buyback_bps} bps`);
+ console.log(` master wallet:${sol(s.master_balance_sol)} queue (ready agents): ${s.queue_enabled}`);
+ if (s.stats) {
+ const st = s.stats;
+ console.log(` today: ${st.launched_today ?? 0} launched · ${st.dry_runs_today ?? 0} dry · ${st.skipped_today ?? 0} skipped · ${st.failed_today ?? 0} failed · ${sol(st.sol_spent_today)} spent`);
+ }
+ if (s.narratives?.top) {
+ console.log(` riding now: ${s.narratives.top.term || s.narratives.top}`);
+ }
+ const runs = s.console || [];
+ if (runs.length) {
+ console.log(`\n last ${Math.min(8, runs.length)} runs:`);
+ for (const r of runs.slice(0, 8)) {
+ const when = new Date(r.created_at).toISOString().slice(5, 16).replace('T', ' ');
+ const who = r.agent_name || r.agent_id?.slice(0, 8) || '—';
+ const tail = r.mint ? `mint ${r.mint.slice(0, 8)}…` : r.error ? `err: ${r.error.slice(0, 60)}` : '';
+ console.log(` ${when} ${String(r.status).padEnd(9)} ${who} → $${r.symbol || '?'} ${tail}`);
+ }
+ }
+ console.log('');
+}
+
+function armBody({ dryRun }) {
+ const body = { enabled: true, dry_run: dryRun };
+ const map = {
+ network: flag('network'),
+ mode: flag('mode'),
+ target_cadence_seconds: flag('cadence'),
+ max_per_hour: flag('max-per-hour'),
+ per_launch_sol: flag('per-launch-sol'),
+ dev_buy_sol: flag('dev-buy-sol'),
+ daily_sol_cap: flag('daily-cap-sol'),
+ buyback_bps: flag('buyback-bps'),
+ };
+ const numeric = new Set(['target_cadence_seconds', 'max_per_hour', 'per_launch_sol', 'dev_buy_sol', 'daily_sol_cap', 'buyback_bps']);
+ for (const [k, v] of Object.entries(map)) {
+ if (v == null) continue;
+ body[k] = numeric.has(k) ? Number(v) : v;
+ }
+ return body;
+}
+
+try {
+ switch (cmd) {
+ case 'status': {
+ printStatus(await call('GET'));
+ break;
+ }
+ case 'dry': {
+ const r = await call('POST', armBody({ dryRun: true }));
+ console.log(`Rehearsal mode on (enabled + dry_run). armed=${r.armed}. Run "tick" then "status" to watch it pick coins without spending.`);
+ break;
+ }
+ case 'arm': {
+ const body = armBody({ dryRun: false });
+ console.log('Arming LIVE — this moves real SOL on', body.network || '(saved network)', 'and mints real coins.');
+ const r = await call('POST', body);
+ console.log(`armed=${r.armed}. The minute cron will pick it up; or run "tick" to fire immediately.`);
+ printStatus(await call('GET'));
+ break;
+ }
+ case 'disarm': {
+ const r = await call('POST', { enabled: false });
+ console.log(`Disarmed. enabled=${r.config?.enabled}. No new launches; in-flight runs already recorded are unaffected.`);
+ break;
+ }
+ case 'resume': {
+ const r = await call('POST', { action: 'resume' });
+ console.log(`Breaker cleared. paused=${r.config?.paused}.`);
+ break;
+ }
+ case 'tick': {
+ const r = await call('POST', { action: 'force_tick' });
+ console.log('tick:', JSON.stringify(r.tick, null, 2));
+ break;
+ }
+ default:
+ console.error(`Unknown command "${cmd}". Use: status | dry | tick | arm | disarm | resume`);
+ process.exit(1);
+ }
+} catch (e) {
+ console.error('FAILED:', e.message);
+ process.exit(1);
+}
diff --git a/src/pulse.css b/src/pulse.css
index 35943e1e7..fd3c078cd 100644
--- a/src/pulse.css
+++ b/src/pulse.css
@@ -6,6 +6,29 @@
reads as one calm, high-contrast surface. The scoped overrides at the bottom
re-skin the shared feed component for this page only. */
+/* Pure-black page surface — the pulse reads as one calm, high-contrast field
+ regardless of the active theme. We force #000 and pin the dark ink/surface
+ ramp on the body so light mode can't paint dark text on a black background. */
+html[data-theme="dark"],
+html[data-theme="light"] {
+ background: #000;
+}
+body {
+ background: #000;
+ color-scheme: dark;
+ --bg-0: #0a0a0a;
+ --bg-1: #1a1a1a;
+ --ink: #e8e8e8;
+ --ink-bright: #ffffff;
+ --ink-dim: #888888;
+ --ink-faint: rgba(255, 255, 255, 0.45);
+ --surface-1: rgba(255, 255, 255, 0.03);
+ --surface-2: rgba(255, 255, 255, 0.05);
+ --surface-3: rgba(255, 255, 255, 0.08);
+ --stroke: rgba(255, 255, 255, 0.08);
+ --stroke-strong: rgba(255, 255, 255, 0.14);
+}
+
.px-shell {
max-width: 1080px;
margin: 0 auto;
diff --git a/src/pulse.js b/src/pulse.js
index 181c36b9b..7a019c72e 100644
--- a/src/pulse.js
+++ b/src/pulse.js
@@ -499,26 +499,37 @@ function mountFeed() {
network: state.network,
type: new URLSearchParams(location.search).get('type') || 'all',
live: true,
+ // When the feed's empty state offers "see live activity on mainnet", route it
+ // through the page switch so the stat panels follow the feed in lockstep.
+ onRequestNetwork: switchNetwork,
+ // When an empty FILTER offers "view all activity", route it through the page so
+ // the counter chips + filter bar reset in lockstep with the feed.
+ onRequestType: setFeedFilter,
});
}
+// Switch the whole page (feed + every stats panel) to a network. Reused by the
+// toolbar toggle and the feed's self-healing empty-state CTA. No-op if unchanged.
+function switchNetwork(net) {
+ const target = net === 'devnet' ? 'devnet' : 'mainnet';
+ if (target === state.network) return;
+ state.network = target;
+ for (const b of document.querySelectorAll('[data-network]')) {
+ const on = b.dataset.network === target;
+ b.classList.toggle('active', on);
+ b.setAttribute('aria-selected', String(on));
+ }
+ const label = $('px-net-label');
+ if (label) label.textContent = target;
+ state.pulse?.setNetwork(target);
+ loadStats();
+ loadTrading();
+ loadMarketplace();
+}
+
function wireNetworkToggle() {
for (const btn of document.querySelectorAll('[data-network]')) {
- btn.addEventListener('click', () => {
- const net = btn.dataset.network === 'devnet' ? 'devnet' : 'mainnet';
- if (net === state.network) return;
- state.network = net;
- for (const b of document.querySelectorAll('[data-network]')) {
- const on = b.dataset.network === net;
- b.classList.toggle('active', on);
- b.setAttribute('aria-selected', String(on));
- }
- $('px-net-label').textContent = net;
- state.pulse?.setNetwork(net);
- loadStats();
- loadTrading();
- loadMarketplace();
- });
+ btn.addEventListener('click', () => switchNetwork(btn.dataset.network));
}
}
diff --git a/src/shared/money-pulse.js b/src/shared/money-pulse.js
index 1d9254640..284f95165 100644
--- a/src/shared/money-pulse.js
+++ b/src/shared/money-pulse.js
@@ -111,6 +111,12 @@ function injectStyles() {
.mp-empty-title { color: var(--ink-bright, #fff); font-weight: 600; margin: 10px 0 4px; }
.mp-empty-sub { font-size: var(--text-sm, .8rem); }
.mp-empty-sub a { color: var(--mp-accent); }
+.mp-empty-switch { margin-top: 14px; }
+.mp-empty-cta { appearance: none; font: inherit; font-size: var(--text-sm, .8rem); font-weight: 600; cursor: pointer;
+ color: var(--ink-bright, #fff); background: var(--mp-accent-soft); border: 1px solid var(--mp-accent);
+ border-radius: var(--radius-pill, 999px); padding: 8px 16px; transition: background .14s ease, transform .14s ease; }
+.mp-empty-cta:hover { background: var(--wallet-accent, #c4b5fd); color: #1a1320; transform: translateY(-1px); }
+.mp-empty-cta:focus-visible { outline: 2px solid var(--mp-accent); outline-offset: 2px; }
.mp-more { display: block; width: 100%; margin-top: var(--space-md,16px); appearance: none; font: inherit; font-weight: 600;
background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); color: var(--ink, #e8e8e8);
border-radius: var(--radius-md,10px); padding: 11px; cursor: pointer; transition: background .14s ease; }
@@ -379,6 +385,8 @@ async function fetchPulse(params) {
* @param {boolean} [o.controls] show the filter/sound toolbar (default: full only)
* @param {number} [o.pageSize=30]
* @param {string} [o.emptyHint] override empty-state CTA copy
+ * @param {(n:string)=>void} [o.onRequestNetwork] host-owned network switch (empty-state self-heal)
+ * @param {(t:string)=>void} [o.onRequestType] host-owned filter switch (empty-state self-heal)
* @returns {{ destroy(): void, setType(t:string): void, setNetwork(n:string): void, refresh(): void }}
*/
export function mountMoneyPulse({
@@ -391,6 +399,8 @@ export function mountMoneyPulse({
controls,
pageSize = 30,
emptyHint,
+ onRequestNetwork = null,
+ onRequestType = null,
} = {}) {
if (!mount) throw new Error('mountMoneyPulse requires { mount }');
injectStyles();
@@ -508,14 +518,80 @@ export function mountMoneyPulse({
function renderEmpty() {
if (variant === 'ticker') { mount.style.display = 'none'; return; }
listEl.innerHTML = '';
+ const onDevnet = state.network === 'devnet';
+ const filtered = !agentId && state.type !== 'all';
+ const typeLabel = (FILTERS.find((f) => f.id === state.type)?.label || 'activity').toLowerCase();
+ // A filtered view that's empty is NOT "all quiet" — the platform may be busy
+ // with other kinds of money. Tell the honest truth for the active filter; the
+ // self-heal probe below adds the right one-click escape (clear filter / switch
+ // network) once it confirms where the activity actually is.
+ const title = filtered ? `No ${typeLabel} yet` : 'No money moving — yet';
const hint = emptyHint
|| (agentId
? 'This wallet has no public activity yet.'
- : 'All quiet on three.ws right now. <a href="/agents">Tip an agent</a> and be the first beat.');
+ : filtered
+ ? `No ${typeLabel} on ${onDevnet ? 'devnet' : 'three.ws'} in this window.`
+ : onDevnet
+ ? 'Devnet is a test network — most live money moves on mainnet. Switch to see the real feed.'
+ : 'All quiet on three.ws right now. <a href="/agents">Tip an agent</a> and be the first beat.');
statusHost.innerHTML =
`<div class="mp-empty"><div class="mp-empty-icon" aria-hidden="true">◎</div>` +
- `<div class="mp-empty-title">No money moving — yet</div>` +
- `<div class="mp-empty-sub">${hint}</div></div>`;
+ `<div class="mp-empty-title">${esc(title)}</div>` +
+ `<div class="mp-empty-sub">${hint}</div>` +
+ `<div class="mp-empty-switch" hidden></div></div>`;
+ // Self-heal: a quiet feed shouldn't look like a broken one. If activity exists
+ // just behind a filter or on the other network, surface a one-click escape
+ // instead of a dead end. Scoped to the global feed (an agent's own story is
+ // genuinely per-network and per-type).
+ if (!agentId) probeForActivity();
+ }
+
+ // Add the self-heal escape button to the empty state. Re-validates we're still
+ // empty before touching the DOM (the live poll may have landed a row meanwhile).
+ function addEmptyCta(label, onClick) {
+ if (state.destroyed || state.events.length) return;
+ const slot = statusHost.querySelector('.mp-empty-switch');
+ if (!slot) return;
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.className = 'mp-empty-cta';
+ btn.textContent = label;
+ btn.addEventListener('click', onClick);
+ slot.appendChild(btn);
+ slot.hidden = false;
+ }
+
+ // Cheap "is there anything here?" probe (limit 1). Never throws.
+ async function hasActivity(params) {
+ try {
+ const data = await fetchPulse({ ...params, limit: 1 });
+ return (data.events?.length || 0) > 0;
+ } catch { return false; }
+ }
+
+ // Background self-heal for the global feed. Prefers clearing an empty FILTER (the
+ // platform is busy, just not with this kind) over switching NETWORK, because the
+ // active network is the one the user chose. Falls back to the network switch when
+ // even the unfiltered feed on this network is quiet.
+ async function probeForActivity() {
+ // 1. Empty filter, but this network's full feed has activity → offer to clear it.
+ if (state.type !== 'all' && await hasActivity({ network: state.network, type: 'all' })) {
+ addEmptyCta('View all activity →', () => {
+ if (typeof onRequestType === 'function') onRequestType('all');
+ else api.setType('all');
+ });
+ return;
+ }
+ // 2. This network is quiet (with the active filter); the OTHER network isn't.
+ const other = state.network === 'devnet' ? 'mainnet' : 'devnet';
+ if (await hasActivity({ network: other, type: state.type })) {
+ addEmptyCta(other === 'mainnet' ? 'See live activity on mainnet →' : 'View devnet activity →', () => {
+ // Defer to the host page when it owns the network toggle (so its stat
+ // panels follow too); otherwise switch this component directly.
+ if (typeof onRequestNetwork === 'function') onRequestNetwork(other);
+ else api.setNetwork(other);
+ });
+ }
}
function renderError(keepRows) {
diff --git a/tests/erc8004-publish.test.js b/tests/erc8004-publish.test.js
new file mode 100644
index 000000000..475e04059
--- /dev/null
+++ b/tests/erc8004-publish.test.js
@@ -0,0 +1,48 @@
+// 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/vercel.json b/vercel.json
index 87813dd9f..dd3d0c6c1 100644
--- a/vercel.json
+++ b/vercel.json
@@ -105,6 +105,9 @@
"api/cron/recompute-reputation.js": {
"maxDuration": 300
},
+ "api/cron/erc8004-autopublish.js": {
+ "maxDuration": 120
+ },
"api/cron/[name].js": {
"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",
"maxDuration": 300
@@ -2879,7 +2882,55 @@
"dest": "/api/agents/networth"
},
{
- "src": "/api/agents/([^/]+)",
+ "src": "/api/agents/([^/]+)/mirror(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/trade(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/copilot(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/alpha(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/portfolio(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/autopilot(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/intents(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/strategies(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/orders(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/capabilities(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/unlocks(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)/registration(/.*)?",
+ "dest": "/api/agents/[id]"
+ },
+ {
+ "src": "/api/agents/([^/]+)(?:/.*)?",
"dest": "/api/agents/[id]"
},
{
@@ -4598,6 +4649,10 @@
"path": "/api/cron/erc8004-crawl",
"schedule": "*/15 * * * *"
},
+ {
+ "path": "/api/cron/erc8004-autopublish",
+ "schedule": "*/10 * * * *"
+ },
{
"path": "/api/cron/solana-attestations-crawl",
"schedule": "*/10 * * * *"
diff --git a/vite.config.js b/vite.config.js
index 456d609d1..2768eb478 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1593,20 +1593,24 @@ support: resolve(__dirname, 'pages/support.html'),
'window.va=window.va||function(){(window.vaq=window.vaq||[]).push(arguments)};',
injectTo: 'head',
},
- // /_vercel/insights/script.js only exists on a Vercel deploy. Under
- // the Vite dev server (ctx.server present) it 404s with an empty MIME
- // type, which strict MIME checking surfaces as a console error on every
- // page. Inject it only at build time; the `va` queue stub above still
- // no-ops any track() calls fired in dev.
- ...(ctx.server
- ? []
- : [
+ // /_vercel/insights/script.js is only served by the platform on a
+ // real Vercel deploy (process.env.VERCEL is set there). Off-Vercel —
+ // the Vite dev server, the push-only 3D-Agent mirror, any static
+ // preview host — both the script and its /_vercel/insights/view ingest
+ // beacon 404, surfacing as a console error on every page. Gate
+ // injection on VERCEL to match the Speed Insights injector below; the
+ // `va` queue stub above still no-ops any track() calls everywhere else.
+ // (On Vercel, the /view beacon still 404s until Web Analytics is
+ // enabled in the project dashboard — that's a dashboard toggle.)
+ ...(process.env.VERCEL
+ ? [
{
tag: 'script',
attrs: { defer: true, src: '/_vercel/insights/script.js' },
injectTo: 'head',
},
- ]),
+ ]
+ : []),
];
},
},