Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: agent activation tests and circulation refinements
nirholas8481f0e3c1e1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 44a045ca3..1e04caa5f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -33,6 +33,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The launcher now reads Know Your Meme** — The autonomous coin launcher gained a new culture feed: Know Your Meme. It reads the freshly-confirmed meme entries and the live meme newsfeed, fuses them with the platform's on-chain signals, and rides the strongest wave when an agent coins its next launch — so new launches track the memes actually entering culture right now, not stale themes. As always, only the cultural THEME is mined; names and tickers are invented fresh, never copied, and every coin stays avatar-fronted and $THREE-aligned. `[feature, improvement]`- **Top Performers podium on marketplace — oracle-ranked agent leaderboard** — The marketplace now surfaces the top 3 oracle-performing agents in trophy-style cards above the agent grid. Each card shows oracle win rate, W/L record, and realized PnL. Rank 1 gets gold, rank 2 silver, rank 3 bronze. Cards shimmer while loading and disappear cleanly when no oracle data exists. Links directly to each agent's profile. (`/marketplace`) `[feature, improvement]`- **Wallet sign-in fixed and a cleaner, monochrome login** — Restored Ethereum (SIWE) and Solana (SIWS) wallet sign-in and the active-sessions controls, which had been unreachable due to missing API route mappings. Also refined the sign-in and sign-up screens to a crisp monochrome palette — neutral chain icons, calmer focus and hover states — for a faster, more focused first impression. `[fix, improvement]`+- **x402 payments dashboards refined to the monochrome system** — The x402 Checkout dashboard and Merchant Console now use the platform's monochrome design language end to end — the off-system blue accent is gone, replaced by clean white-on-black with crisp focus rings, toggles, and hover states. New checkout storefronts default to a neutral monochrome look while merchants can still pick any brand color. Verified rendering across the payments page, dashboard, and console. (`/dashboard/x402`) `[improvement]`## 2026-06-26diff --git a/api/_lib/agent-activation.js b/api/_lib/agent-activation.jsindex ef5ff5dd8..66ac0b22e 100644--- a/api/_lib/agent-activation.js+++ b/api/_lib/agent-activation.js@@ -25,12 +25,10 @@import { sql } from './db.js';import {- isConfigured,getTreasuryKeypair,transferSol,lamportBalance,treasuryConnection,- treasuryNetwork,FEE_BUFFER,SOL,} from './platform-treasury.js';@@ -50,18 +48,26 @@ function clampNumber(v, dflt, lo, hi) {return Math.min(hi, Math.max(lo, n));}-/** Resolved activation configuration from env. Cheap + side-effect free. */-export function activationConfig() {- const enabledRaw = String(process.env.AGENT_ACTIVATION_ENABLED ?? '').toLowerCase();+/**+ * Resolved activation configuration. Cheap + side-effect free. Reads from `env`+ * (process.env by default) so it can be unit-tested without globals.+ * @param {Record<string, any>} [env]+ */+export function activationConfig(env = process.env) {+ const enabledRaw = String(env.AGENT_ACTIVATION_ENABLED ?? '').toLowerCase();const enabled = enabledRaw === '1' || enabledRaw === 'true' || enabledRaw === 'yes';// Grant size in SOL. Small on purpose: enough to fund a first real action +// fees, not a faucet to farm. 0.0001–0.05 SOL hard-bounded.- const grantSol = clampNumber(process.env.AGENT_ACTIVATION_GRANT_SOL, 0.004, 0.0001, 0.05);- const dailyCap = clampNumber(process.env.AGENT_ACTIVATION_DAILY_CAP, 500, 1, 100_000);+ const grantSol = clampNumber(env.AGENT_ACTIVATION_GRANT_SOL, 0.004, 0.0001, 0.05);+ const dailyCap = clampNumber(env.AGENT_ACTIVATION_DAILY_CAP, 500, 1, 100_000);+ const configured = !!(+ String(env[TREASURY_ENV_OVERRIDE] || '').trim() ||+ String(env.CIRCULATION_TREASURY_SECRET || '').trim()+ );return {enabled,- configured: isConfigured(TREASURY_ENV_OVERRIDE),- network: treasuryNetwork(),+ configured,+ network: env.CIRCULATION_NETWORK === 'devnet' ? 'devnet' : 'mainnet',grantSol,grantLamports: Math.round(grantSol * SOL),dailyCap,diff --git a/api/_lib/circulation.js b/api/_lib/circulation.jsindex 8e0fd8b26..dc3170b00 100644--- a/api/_lib/circulation.js+++ b/api/_lib/circulation.js@@ -98,6 +98,15 @@ export function config() {growthPerTick: clampInt(process.env.CIRCULATION_GROWTH_PER_TICK, 3, 1, 40),actionsPerTick: clampInt(process.env.CIRCULATION_ACTIONS_PER_TICK, 2, 1, 12),origin: env.APP_ORIGIN || 'https://three.ws',+ // Route the platform's manufactured marketplace demand to REAL (user-owned,+ // activated) sellers too — turning the activation funnel into sustained+ // earning wallets. Opt-in and bounded (price band + per-seller daily cap);+ // when off, demand stays entirely within the circulation pool (identical to+ // prior behaviour).+ realSellerDemand: ['1', 'true', 'yes'].includes(+ String(process.env.CIRCULATION_REAL_SELLER_DEMAND ?? '').toLowerCase(),+ ),+ realSellerDailyCap: clampInt(process.env.CIRCULATION_REAL_SELLER_DAILY_CAP, 3, 1, 50),};}@@ -545,12 +554,18 @@ async function transferThreeWithReference(conn, fromKp, toAddress, atomic, referreturn signature;}-// Skills currently listed (active, $THREE-priced) by circulation sellers, joined to-// the seller's owner so the purchase action can exclude self-dealing.-async function listedSkills() {- return sql`+// Skills currently listed (active, $THREE-priced), joined to the seller's owner so+// the purchase action can exclude self-dealing. Circulation sellers are always+// included; when `cfg.realSellerDemand` is on, REAL user-owned sellers are folded+// in too — but only ones that are genuinely onboarded (the owner has activated the+// agent), priced within the normal band, public, and under a per-seller daily cap.+// That makes platform-funded demand reward real, activated wallets without opening+// a treasury-drain vector (overpriced listings, sybil sellers, runaway repeats).+// Each row is tagged seller_kind so callers can reason about it.+async function listedSkills(cfg) {+ const circulation = await sql`select asp.agent_id, asp.skill, asp.amount, asp.currency_mint, asp.trial_uses,- ai.user_id as seller_user_id, ai.name as seller_name+ ai.user_id as seller_user_id, ai.name as seller_name, 'circulation' as seller_kindfrom agent_skill_prices aspjoin agent_identities ai on ai.id = asp.agent_idwhere asp.is_active = true@@ -558,6 +573,41 @@ async function listedSkills() {and (ai.meta->>'circulation') = 'true'and ai.deleted_at is null`;+ if (!cfg?.realSellerDemand) return circulation;++ const minAtomic = threeAtomic(SKILL_PRICE_MIN_THREE).toString();+ const maxAtomic = threeAtomic(SKILL_PRICE_MAX_THREE).toString();+ let real = [];+ try {+ real = await sql`+ select asp.agent_id, asp.skill, asp.amount, asp.currency_mint, asp.trial_uses,+ ai.user_id as seller_user_id, ai.name as seller_name, 'real' as seller_kind+ from agent_skill_prices asp+ join agent_identities ai on ai.id = asp.agent_id+ where asp.is_active = true+ and asp.currency_mint = ${THREE_MINT()}+ and coalesce(ai.meta->>'circulation', '') <> 'true'+ and ai.is_public = true+ and ai.deleted_at is null+ and asp.amount >= ${minAtomic}::numeric+ and asp.amount <= ${maxAtomic}::numeric+ and exists (+ select 1 from agent_activations aa+ where aa.agent_id = ai.id and aa.status = 'confirmed'+ )+ and (+ select count(*) from circulation_actions ca+ where ca.kind = 'buy_skill' and ca.counterparty_agent_id = ai.id+ and ca.status = 'ok' and ca.created_at > now() - interval '24 hours'+ ) < ${cfg.realSellerDailyCap}+ `;+ } catch (e) {+ // agent_activations may not be migrated yet — degrade to circulation-only+ // rather than breaking the tick.+ console.warn('[circulation] real-seller demand query skipped', e?.message);+ real = [];+ }+ return [...circulation, ...real];}// ── actions ───────────────────────────────────────────────────────────────────@@ -841,8 +891,8 @@ async function actionListSkill() {// then confirmSkillPurchase validates on-chain, records the seller's revenue, and// grants persistent access — the identical path a human-owned agent uses.async function actionBuySkill(ctx) {- const { conn, pool, network } = ctx;- const listings = await listedSkills();+ const { conn, pool, network, cfg } = ctx;+ const listings = await listedSkills(cfg);if (!listings.length) throw new Skip('no skills listed yet');const listing = pick(listings);@@ -938,8 +988,8 @@ async function actionBuySkill(ctx) {// A buyer agent starts a free trial on a trial-eligible listed skill. No payment —// a real skill_purchases trial row, exactly like /api/marketplace/start-trial.async function actionTrial(ctx) {- const { pool } = ctx;- const trialable = (await listedSkills()).filter((l) => (l.trial_uses || 0) > 0);+ const { pool, cfg } = ctx;+ const trialable = (await listedSkills(cfg)).filter((l) => (l.trial_uses || 0) > 0);if (!trialable.length) throw new Skip('no trial-eligible skills listed');const listing = pick(trialable);diff --git a/data/changelog.json b/data/changelog.jsonindex 727b8b117..e914c1913 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,13 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-27",+ "title": "x402 payments dashboards refined to the monochrome system",+ "summary": "The x402 Checkout dashboard and Merchant Console now use the platform's monochrome design language end to end — the off-system blue accent is gone, replaced by clean white-on-black with crisp focus rings, toggles, and hover states. New checkout storefronts default to a neutral monochrome look while merchants can still pick any brand color. Verified rendering across the payments page, dashboard, and console.",+ "tags": ["improvement"],+ "link": "/dashboard/x402"+ },{"date": "2026-06-27","title": "Live agent screens restored and refreshed in monochrome",diff --git a/pages/capture.html b/pages/capture.htmlindex 494d3389f..9b95138fc 100644--- a/pages/capture.html+++ b/pages/capture.html@@ -185,7 +185,7 @@<script type="module" src="/nav.js"></script><div class="pc-wrap">- <header class="pc-head">+ <div class="pc-head"><span class="pc-chip"><span class="pc-chip-dot"></span> Streaming reconstruction · LingBot-Map</span><h1>Video → 3D scene.</h1><p>@@ -194,7 +194,7 @@dense world-space geometry from the frames, then streams a coloured <code>.ply</code> youcan orbit right here. Already have a point cloud? Drop it in or paste a URL.</p>- </header>+ </div><div class="pc-layout"><div class="pc-stage" id="pc-stage">diff --git a/pages/pulse.html b/pages/pulse.htmlindex 7db7858a4..b859436d4 100644--- a/pages/pulse.html+++ b/pages/pulse.html@@ -122,7 +122,7 @@<div class="px-kpi"><dt>Avg ticket</dt><dd id="px-mkt-ticket">—</dd><span class="px-kpi-sub">per purchase · 7d</span></div><div class="px-kpi"><dt>Repeat buyers</dt><dd id="px-mkt-repeat">—</dd><span class="px-kpi-sub" id="px-mkt-repeat-sub">of buyers · 7d</span></div><div class="px-kpi"><dt>Trading pairs</dt><dd id="px-mkt-pairs">—</dd><span class="px-kpi-sub">unique buyer→seller · 7d</span></div>- <div class="px-kpi"><dt>Take-rate · 7d</dt><dd id="px-mkt-take">—</dd><span class="px-kpi-sub" id="px-mkt-take-sub">platform fee</span></div>+ <div class="px-kpi px-kpi--take"><dt>Take-rate · 7d</dt><dd id="px-mkt-take">—</dd><span class="px-kpi-sub" id="px-mkt-take-sub">platform fee</span></div></div><div class="px-market-body"><div class="px-market-spark">@@ -133,7 +133,7 @@<div class="px-spark-bars" id="px-mkt-spark" role="img" aria-label="Daily marketplace GMV, last 7 days"></div></div><div class="px-market-skills">- <div class="px-card-h">Top skills <small>GMV · 7d</small></div>+ <div class="px-card-h"><span>Top skills</span><small>GMV · 7d</small></div><div id="px-mkt-skills"><p class="px-lb-empty">Loading…</p></div></div></div>diff --git a/public/changelog.json b/public/changelog.jsonindex 884cce9bd..867ed17bd 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-27T20:29:18.653Z",+ "generated_at": "2026-06-27T20:36:20.394Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -290,6 +290,16 @@"improvement"]},+ {+ "date": "2026-06-27",+ "type": "update",+ "title": "x402 payments dashboards refined to the monochrome system",+ "summary": "The x402 Checkout dashboard and Merchant Console now use the platform's monochrome design language end to end — the off-system blue accent is gone, replaced by clean white-on-black with crisp focus rings, toggles, and hover states. New checkout storefronts default to a neutral monochrome look while merchants can still pick any brand color. Verified rendering across the payments page, dashboard, and console.",+ "link": "/dashboard/x402",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-26","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex add27224e..f40732db6 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -222,6 +222,14 @@<category>fix</category><description>Restored Ethereum (SIWE) and Solana (SIWS) wallet sign-in and the active-sessions controls, which had been unreachable due to missing API route mappings. Also refined the sign-in and sign-up screens to a crisp monochrome palette — neutral chain icons, calmer focus and hover states — for a faster, more focused first impression.</description></item>+ <item>+ <title>x402 payments dashboards refined to the monochrome system</title>+ <link>https://three.ws/dashboard/x402</link>+ <guid isPermaLink="false">2026-06-27:x402 payments dashboards refined to the monochrome system</guid>+ <pubDate>Sat, 27 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The x402 Checkout dashboard and Merchant Console now use the platform's monochrome design language end to end — the off-system blue accent is gone, replaced by clean white-on-black with crisp focus rings, toggles, and hover states. New checkout storefronts default to a neutral monochrome look while merchants can still pick any brand color. Verified rendering across the payments page, dashboard, and console.</description>+ </item><item><title>Agent Payment Sessions</title><link>https://three.ws/payments</link>diff --git a/public/features.json b/public/features.jsonindex 67462b93f..e4bd1c6b3 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-27T20:29:18.629Z",+ "generated_at": "2026-06-27T20:36:20.379Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/pulse.css b/src/pulse.cssindex c1995377b..834cf0cb5 100644--- a/src/pulse.css+++ b/src/pulse.css@@ -99,13 +99,19 @@.px-market-sub { flex: 1 1 100%; font-size: var(--text-2xs, .66rem); color: var(--ink-dim, #888); line-height: 1.4; }.px-market-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-sm, 10px); margin-bottom: var(--space-md, 16px); }.px-kpi { background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.07));- border-radius: var(--radius-md, 10px); padding: 10px 12px; }+ border-radius: var(--radius-md, 10px); padding: 10px 12px; transition: border-color .16s ease, background .16s ease, transform .16s ease; }+.px-kpi:hover { border-color: var(--stroke-strong, rgba(255,255,255,.14)); background: var(--surface-3, rgba(255,255,255,.07)); transform: translateY(-1px); }.px-kpi dt { font-size: var(--text-2xs, .62rem); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-dim, #888); margin-bottom: 5px; }.px-kpi dd { margin: 0; font-family: var(--font-mono, monospace); font-size: clamp(1.05rem, 2.4vw, 1.4rem); font-weight: 700; color: var(--ink-bright, #fff); line-height: 1.05; }.px-kpi-sub { display: block; margin-top: 3px; font-size: var(--text-2xs, .6rem); color: var(--ink-faint, #666); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.px-market-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-md, 16px); align-items: start; }-.px-market-spark .px-spark-bar--mkt { background: rgba(255,255,255,.28); }-.px-market-spark .px-spark-col:hover .px-spark-bar--mkt { background: var(--ink, #e8e8e8); }+/* Take-rate is the revenue KPI — give it a hairline accent so the eye lands on it. */+.px-kpi--take { border-color: var(--stroke-strong, rgba(255,255,255,.16)); background: var(--surface-3, rgba(255,255,255,.07)); }+.px-market-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-sm, 12px); align-items: stretch; }+.px-market-spark, .px-market-skills { background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.07));+ border-radius: var(--radius-md, 10px); padding: var(--space-sm, 12px) var(--space-md, 14px); }+.px-market-spark .px-spark-bar--mkt { background: rgba(255,255,255,.30); }+.px-market-spark .px-spark-col:hover .px-spark-bar--mkt { background: var(--ink-bright, #fff); }+.px-skill-row + .px-skill-row { border-top: 1px solid var(--stroke, rgba(255,255,255,.06)); }/* Trading panel: a touch dimmer than the marketplace bars so the two read distinctin the same monochrome ramp; today's bar still resolves to full ink. */.px-trading .px-spark-bar--trade { background: rgba(255,255,255,.22); }@@ -163,11 +169,13 @@.px-grid { grid-template-columns: 1fr; }.px-rail { position: static; flex-direction: column; }.px-counters { grid-template-columns: repeat(3, 1fr); }+ .px-counter--lead { grid-column: span 3; }.px-market-kpis { grid-template-columns: repeat(3, 1fr); }.px-market-body { grid-template-columns: 1fr; }}@media (max-width: 520px) {.px-counters { grid-template-columns: repeat(2, 1fr); }+ .px-counter--lead { grid-column: span 2; }.px-market-kpis { grid-template-columns: repeat(2, 1fr); }.px-spark-lbl { font-size: 0.55rem; }}diff --git a/tests/agent-activation.test.js b/tests/agent-activation.test.jsnew file mode 100644index 000000000..187b44161--- /dev/null+++ b/tests/agent-activation.test.js@@ -0,0 +1,63 @@+/**+ * Agent activation config — pure-helper unit tests.+ *+ * activationConfig gates a real, treasury-funded on-chain grant, so its env+ * parsing (enable flag, grant clamps, daily cap, treasury detection, network)+ * is pinned down here without a database or RPC. The full activateAgent path is+ * integration-tested against a live treasury; these guard the knobs that decide+ * whether — and how much — it spends.+ */++import { describe, it, expect } from 'vitest';+import { activationConfig } from '../api/_lib/agent-activation.js';++const SOL = 1_000_000_000;++describe('activationConfig', () => {+ it('is disabled and unconfigured for an empty env', () => {+ const c = activationConfig({});+ expect(c.enabled).toBe(false);+ expect(c.configured).toBe(false);+ expect(c.network).toBe('mainnet');+ expect(c.grantSol).toBe(0.004);+ expect(c.grantLamports).toBe(Math.round(0.004 * SOL));+ expect(c.dailyCap).toBe(500);+ });++ it('enables only on an explicit truthy flag', () => {+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: 'true' }).enabled).toBe(true);+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: '1' }).enabled).toBe(true);+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: 'yes' }).enabled).toBe(true);+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: 'false' }).enabled).toBe(false);+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: 'no' }).enabled).toBe(false);+ expect(activationConfig({ AGENT_ACTIVATION_ENABLED: 'maybe' }).enabled).toBe(false);+ });++ it('detects a treasury from either the override or the shared secret', () => {+ expect(activationConfig({ CIRCULATION_TREASURY_SECRET: 'abc' }).configured).toBe(true);+ expect(activationConfig({ AGENT_ACTIVATION_TREASURY_SECRET: 'xyz' }).configured).toBe(true);+ expect(activationConfig({ CIRCULATION_TREASURY_SECRET: ' ' }).configured).toBe(false);+ });++ it('clamps the grant to the safe 0.0001–0.05 SOL band', () => {+ expect(activationConfig({ AGENT_ACTIVATION_GRANT_SOL: '10' }).grantSol).toBe(0.05);+ expect(activationConfig({ AGENT_ACTIVATION_GRANT_SOL: '0' }).grantSol).toBe(0.0001);+ expect(activationConfig({ AGENT_ACTIVATION_GRANT_SOL: '-5' }).grantSol).toBe(0.0001);+ expect(activationConfig({ AGENT_ACTIVATION_GRANT_SOL: '0.01' }).grantSol).toBe(0.01);+ // non-numeric falls back to the default+ expect(activationConfig({ AGENT_ACTIVATION_GRANT_SOL: 'free' }).grantSol).toBe(0.004);+ });++ it('clamps the daily cap and keeps lamports in lockstep with grantSol', () => {+ expect(activationConfig({ AGENT_ACTIVATION_DAILY_CAP: '0' }).dailyCap).toBe(1);+ expect(activationConfig({ AGENT_ACTIVATION_DAILY_CAP: '999999999' }).dailyCap).toBe(100_000);+ const c = activationConfig({ AGENT_ACTIVATION_GRANT_SOL: '0.02' });+ expect(c.grantLamports).toBe(Math.round(0.02 * SOL));+ });++ it('honours the devnet network selector', () => {+ expect(activationConfig({ CIRCULATION_NETWORK: 'devnet' }).network).toBe('devnet');+ expect(activationConfig({ CIRCULATION_NETWORK: 'mainnet' }).network).toBe('mainnet');+ expect(activationConfig({ CIRCULATION_NETWORK: 'whatever' }).network).toBe('mainnet');+ });+});