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.

workflows, docs, api, more

nirholascafd8ec27d6c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7e1eae837..a3f00c3a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -48,6 +48,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Improvement: Base USDC payments confirm even when an RPC provider is flaky** — When you pay for a skill or asset in USDC on Base, the platform double-checks your payment landed on-chain before unlocking it. That check used to read from a single blockchain provider — so if that one provider was briefly slow or rate-limited, a payment that had genuinely gone through could look stuck as 'pending' until you retried. It now reads through the same multi-provider failover the rest of the platform already uses: if one provider is down it automatically tries the next, and a momentary outage degrades to a safe, retryable state instead of stranding a confirmed payment. Your funds were never at risk either way; this makes the confirmation itself resilient. `[improvement, infra]`
- **Improvement: every server error now hands you a support reference code** — When something fails on our side, the response no longer just says 'something went wrong' — it now carries a short reference code (e.g. 'quote ref a1b2c3d4 to support'). That same code is attached to the exact server log line, our error tracker, and the ops alert that pages the team, so one code maps to one incident. This was already true for most API responses; we extended it to the remaining surfaces that previously failed silently — the RSS announcements feed, sitemaps, the MCP payment flow, on-chain permission checks, and the Solana RPC proxy — so any failure you hit is traceable. Nothing changes when things work; this only makes the rare error far faster to diagnose. `[improvement, infra]`
- **IRL: pinned agents now hold their exact spot indoors instead of drifting** — When you pin your agent to a real-world spot in IRL — on a table, a desk, a shelf — it now stays put as you pan and move your phone, instead of sliding away. Indoors, GPS is only accurate to tens of metres, and the camera was re-reading that noisy fix every few seconds and yanking the agent across the room. Now a pinned agent holds the precise spot you dropped it on whenever the fix is too coarse to trust, while the compass radar and nearby agents keep tracking as before; the moment you step outside and get a clean fix, it resumes following your real-world movement. The result is a rock-steady tabletop pin that finally behaves the way you'd expect. (`/irl`) `[fix]`
+- **Launch Copilot: every coin you launch can run its own market-maker** — Launching a coin on three.ws no longer means mint-and-hope. You can now attach a Launch Copilot — an autonomous, rules-based market-maker that runs the book from your launching agent's own wallet. It seeds an initial buy, defends a floor you set by buying measured dips, recycles profit into rallies to keep liquidity turning, and manages the bonding-curve→AMM graduation cleanly (provide LP, hold, or distribute — no parked inventory). Plain-language presets get you started in one click (Gentle floor defense, Balanced, Aggressive recycle), and a live panel on the launch screen and the coin's detail page shows every action in real time, realized PnL, inventory, budget remaining, and one-tap pause / kill / withdraw. Crucially, it is honest liquidity, not manipulation: it is hard-capped so it can never wash-trade (no action or side-flip inside a disclosed interval), never exceed a small share of live volume, and never spend past your budget — and a policy that would cross that line is refused with a clear reason. Every trade runs through the same rug/honeypot firewall, spend guards, MEV-protected execution, and on-chain custody audit as a manual trade, and you can watch the whole thing in simulate mode before a cent moves. The market-maker operates on the coin you launched; the only coin three.ws promotes is $THREE. `[feature]`
- **Marketplace fork no longer creates duplicate copies on a double-click** — On an agent's marketplace page, impatiently double-clicking "Fork & Chat" used to fire the fork twice before the page could move you to your new copy — quietly leaving two identical agents in your account. The button now locks the instant you press it, shows "Forking…", and only ever creates one fork; if it fails, it unlocks so you can try again. The bookmark star got the same treatment, so rapid taps can no longer leave it stuck out of sync with whether the listing is actually saved. Only coin referenced is $THREE. (`/marketplace`) `[fix]`
- **Mirror a proven agent and yours trades alongside it — Copy Trading, fully custodial** — Follow a high-performing agent and your own agent now mirrors its real on-chain trades automatically — proportionally, and strictly inside the spend policy you already set. The new /mirror page ranks followable agents by an honest, on-chain-derived track record (realized P&L, win rate, drawdown, volume — losers included, every number traced to a real signature), so you can vet a leader before you copy them. Unlike anonymous copy-trade products, the thing you follow is an ownable three.ws agent with a face, a voice, and its own real funds at stake. Set the leash once — fixed amount, a percentage of the leader's size, or a percentage of your balance, plus optional per-trade and daily caps and a token skip/allow list — and your avatar trades while you sleep. Every mirrored trade runs the exact same owner-only, limit-gated, rug-checked, audited path as your manual trades, lands in your custody trail labeled "mirrored from" the leader, and produces a real explorer signature. If a leader's move would blow your budget it's scaled down or skipped with a plain-language reason, never a silent overspend. Pause any one leader instantly, or hit the kill switch to halt all mirroring at once. Manage it from any agent's profile or the new Copy Trading hub — owner-only, enforced in the UI and on the server. (`/mirror`) `[feature]`
- **Mission Control — the real-time pump.fun trading terminal** — Pump.fun traders juggle ten tabs. Mission Control gives you one screen. A keyboard-driven cockpit fuses every live signal three.ws computes: the launch firehose streaming brand-new mints, each row scored with its intel quality, firewall verdict, and smart-money count; a focus pane with a real price chart, the full intel breakdown, the rug/honeypot safety panel, and who's buying; and your own positions with streaming PnL and one-tap exit. Trade without leaving the keyboard — j/k to move, b to buy your preset size, s to sell, number keys for sizing, / to filter, ? for the shortcut map. Every buy and sell executes through the exact same guarded path as the rest of the platform — the rug/honeypot firewall (a blocked coin disables the button), the MEV engine, your wallet's spend guards, and the custody audit log — from your agent wallet, confirm-on-first-use then express. Filter the feed by intel score, firewall verdict, smart-money, socials, and market-cap band, and save named views. Every datum streams from a real endpoint with honest live/reconnecting/down status; when a source is down its pane degrades honestly instead of showing stale or fake data. Open it from the Launch menu or your agent wallet's Snipe tab. (`/terminal`) `[feature]`
@@ -93,6 +94,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Wallet Intents now react to money streams, not just tips** — Your agent's Wallet Intents can trigger "when a money stream starts" — and that trigger now actually fires. The moment someone opens a pay-per-second stream to your agent, your matching rules run for real: get a heads-up, split a share of the incoming flow to another wallet, or whatever rule you armed — through the same spend-policy ceilings and on-chain custody audit as every other outbound action. Rules that "split a percentage of everything I earn" now also count streamed income, settlement by settlement, not only one-off tips. Each fire is idempotent and capped by your limits, so a long stream can never overspend. Owner-only, as always. Only coin referenced is $THREE. (`/agent`) `[fix, feature]`
- **Wallet Intents: tell your agent's wallet what to do — in plain language** — Your agent's wallet is now programmable by talking to it. Open the new Intents tab in the wallet and describe a rule in plain English — "tip back anyone who tips me more than 0.1 SOL, half of what they sent", "when my balance is under 0.05 SOL freeze all spending and DM me", "every Friday withdraw anything above 2 SOL to my main wallet", "split 10% of everything I earn to my other wallet", or "snipe launches from this creator under $40k, max 1 SOL each". The copilot compiles your words into an exact, bounded rule and shows you a card with what it parsed, the guardrails, and a concrete dry-run ("on a 0.2 SOL tip, this sends back 0.1 SOL") before anything is armed. Confirm, and your wallet acts on it for real — every execution runs through the same spend-policy ceilings and audit trail as your manual sends, can never exceed your limits, and leaves a real on-chain receipt you can open. Each rule shows its last fire, lifetime impact, and a one-tap pause; you can also just ask your wallet "how am I doing?" and get an answer read straight from your real balance and ledger. Owner-only — visitors never see or arm your rules. Find it under your agent's wallet → Intents. `[feature]`
- **x402-mcp — give any AI agent a self-custodial wallet that can pay for anything** — The buyer side of the agent economy, in one line. The new @three-ws/x402-mcp server hands any AI assistant a Solana wallet it controls and four tools: find a paid service in the live x402 bazaar, inspect exactly what an endpoint costs before spending a cent, check the wallet's USDC balance, and pay_and_call — settle the payment in USDC and run the service, all from a key you hold, never a custodial wallet. Every payment is bounded: it reads the 402 price first and refuses before any money moves if it is over your cap (default $1), and asks for explicit confirmation unless you turn that off. Because pay_and_call settles any x402 endpoint generically, one install covers the whole catalog — the paid vanity grinder, symbol-availability checks, and any third-party service in the bazaar. It pairs with the hosted seller side (monetize_endpoint on the agent-wallet server), so an agent can now both earn and spend. Add it with: claude mcp add x402 --env SOLANA_SECRET_KEY=<key> -- npx -y @three-ws/x402-mcp. The full catalog of all 20 three.ws MCP servers — hosted and npm — now lives at three.ws/docs/mcp with copy-paste installs. (`/docs/mcp`) `[sdk, feature]`
+- **Your agent levels up: a shareable moment when its wallet crosses a wealth tier** — The embodied-finance aura already makes an agent glow brighter as its wallet grows. Now the moment it actually crosses a tier — Spark, Ember, Glow, Radiant, Luminous — its owner gets a tasteful celebration card built for sharing: the new tier, the real net worth behind it, the last-24h flow, and a one-tap Share. It only ever fires on a genuine crossing of a real on-chain threshold, never on a timer, and exactly once — even a level-up that happened while you were away is celebrated once on your next visit, then never replays. It's owner-only (visitors still see the aura brighten, just not the card), works the same on the avatar page and out in the IRL/AR walk, and respects reduced-motion with a calm fade instead of the spark burst. Only coin referenced is $THREE. (`/avatars`) `[feature, improvement]`
- **Your agent's wallet is now a living identity on every surface** — The little wallet badge under every agent and avatar grew up. Wherever an agent appears — its profile, the marketplace, the galaxy star-map, trending, your dashboard, the launches feed — its wallet now shows the real, live portfolio value in USD, a colour-coded 24-hour change, and a clear ownership marker: a 'Yours' badge on wallets you own, and 'by @creator' on everyone else's. Hover, focus, or tap the badge and it expands into a rich preview: your balance broken out into SOL, USDC, $THREE and your top holdings, a real value sparkline, both your Solana and EVM addresses with one-click copy, and the right actions for who's looking — Open wallet and Vanity for owners, Tip and Fork-to-own for visitors. The same agent's wallet looks identical everywhere because it all comes from one shared component, every number is real on-chain data, and the value gently pulses when a tip lands or a trade fills. Balances load lazily as you scroll and pause when you switch tabs, so even long lists stay fast. (`/marketplace`) `[feature, improvement]`
- **Your agent's wallet now follows it everywhere — the chat, the 3D world, and any site** — An agent's wallet is its identity, so it now shows up wherever its avatar does, not just inside the app. In the chat, the agent you're talking to carries a wallet chip — open it to see its live value and lifetime tips, copy its address, or tip it for a good answer. In the walk-around 3D world, stroll up to another player who's piloting an agent and its wallet rises beside their nameplate: vanity address, real balance, and a one-tap tip, right there in the scene. And the lightweight avatar viewer in our SDK can now opt into the same wallet card, so an agent embedded on any third-party site keeps its real, tippable identity. Every number is real and read from the same public wallet data as the rest of the platform, so values never disagree across surfaces; it's always the visitor view, so owner-only controls never leak into an embed. It's deliberately frugal in the live 3D world — only the nearest agent's wallet loads, and only once — so nothing stutters. `[feature]`
- **Your avatar has a job — the Earn home in every agent wallet** — Every agent wallet now has an Earn tab that turns it from a vault into a working participant in the agent economy. It opens with the number that matters: what your avatar has actually earned — today, this week, and all time — every dollar traced to a real settlement (skill sales and tips), never an estimate. Come back after time away and it tells you what it made while you were gone. Below that is the earning engine: price your agent's skills in USDC right where the money lands, so the moment someone buys, real funds move into this wallet. Then the part that makes letting an agent spend on its own feel safe — your agent can pay other agents and services over real x402 rails, but only inside the daily cap, per-payment limit, and allowlist you set, with a prominent kill switch that freezes all autonomous spending instantly (your own withdrawals always stay open). Finally, a clean receipts statement of every payment in and out — counterparty, amount, time, and on-chain signature — plus a path to the live services directory where agents discover and hire each other. Owner-only, enforced in the UI and on the server. (`/economy`) `[feature]`
diff --git a/api/irl/drops.js b/api/irl/drops.js
index fa01b7d16..f8591db10 100644
--- a/api/irl/drops.js
+++ b/api/irl/drops.js
@@ -38,7 +38,7 @@ import {
createDrop, confirmFunding, getDropRow, nearbyDrops, myDrops, myClaims,
reserveClaim, failClaim, confirmClaim, releaseFromEscrow,
markRefunding, sweepRefund, recordRefundTx, toPublicDrop,
- hasChatSignal, verifyQuiz, haversineM, amountToAtomics, atomicsToAmount,
+ hasChatSignal, verifyQuiz, haversineM, atomicsToAmount,
BASE58_RE,
} from '../_lib/irl-drops.js';
diff --git a/data/changelog.json b/data/changelog.json
index 03ba667ac..542e99fcc 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$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-23",
+ "title": "Your agent levels up: a shareable moment when its wallet crosses a wealth tier",
+ "summary": "The embodied-finance aura already makes an agent glow brighter as its wallet grows. Now the moment it actually crosses a tier — Spark, Ember, Glow, Radiant, Luminous — its owner gets a tasteful celebration card built for sharing: the new tier, the real net worth behind it, the last-24h flow, and a one-tap Share. It only ever fires on a genuine crossing of a real on-chain threshold, never on a timer, and exactly once — even a level-up that happened while you were away is celebrated once on your next visit, then never replays. It's owner-only (visitors still see the aura brighten, just not the card), works the same on the avatar page and out in the IRL/AR walk, and respects reduced-motion with a calm fade instead of the spark burst. Only coin referenced is $THREE.",
+ "tags": [
+ "feature",
+ "improvement"
+ ],
+ "link": "/avatars"
+ },
{
"date": "2026-06-23",
"title": "Launch Copilot: every coin you launch can run its own market-maker",
diff --git a/public/avatar-actions.js b/public/avatar-actions.js
index c3e9ed9f6..02b8ec1a9 100644
--- a/public/avatar-actions.js
+++ b/public/avatar-actions.js
@@ -90,6 +90,32 @@ button.primary:hover { filter: brightness(1.08); background: var(--aa-acc); }
@keyframes aa-spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.muted { color: var(--aa-dim); font-size: 12px; }
+.rty-sig { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:600;
+ padding:2px 8px; border-radius:999px; border:1px solid rgba(139,92,246,.4); color:#c4b5fd;
+ background:rgba(139,92,246,.1); white-space:nowrap; cursor:pointer; }
+.rty-sig.earn { border-color:rgba(95,208,138,.4); color:#86efac; background:rgba(95,208,138,.08); }
+.rty-sig:hover { filter:brightness(1.15); }
+.rty-overlay { position:absolute; inset:0; z-index:5; display:flex; align-items:center; justify-content:center;
+ padding:10px; background:rgba(8,8,12,.74); backdrop-filter:blur(3px); border-radius:12px; }
+.rty-box { width:100%; max-width:380px; max-height:100%; overflow:auto; background:#0c0c10;
+ border:1px solid rgba(139,92,246,.3); border-radius:12px; padding:14px; box-shadow:0 18px 60px rgba(0,0,0,.6); }
+.rty-box h3 { margin:0 0 8px; font-size:14px; }
+.rty-box p { margin:0 0 10px; font-size:12px; line-height:1.5; color:var(--aa-dim); }
+.rty-box p b, .rty-terms b { color:var(--aa-fg); }
+.rty-bar { display:flex; height:26px; border-radius:7px; overflow:hidden; border:1px solid var(--aa-line); margin:8px 0; }
+.rty-keep { background:linear-gradient(180deg,rgba(95,208,138,.32),rgba(95,208,138,.18)); color:#fff;
+ display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:600; white-space:nowrap; padding:0 4px; min-width:0; }
+.rty-up { background:linear-gradient(180deg,rgba(196,181,253,calc(.5 - var(--i,0)*.08)),rgba(139,92,246,.34));
+ border-left:1px solid rgba(10,10,10,.5); min-width:5px; }
+.rty-list { display:flex; flex-direction:column; gap:3px; margin:6px 0; }
+.rty-cr { display:flex; align-items:center; gap:8px; font-size:11px; padding:4px 7px; border-radius:6px; background:rgba(255,255,255,.04); }
+.rty-gen { font-size:9px; font-weight:700; color:var(--aa-dim); text-transform:uppercase; }
+.rty-nm { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
+.rty-w { font-family:ui-monospace,monospace; color:var(--aa-dim); font-size:10px; }
+.rty-bp { font-family:ui-monospace,monospace; font-weight:600; color:#c4b5fd; }
+.rty-terms { margin:8px 0; padding-left:16px; font-size:11px; line-height:1.55; color:var(--aa-dim); }
+.rty-acts { display:flex; gap:8px; justify-content:flex-end; margin-top:10px; }
+.rty-cancel { background:transparent; }
`;
class AvatarActions extends HTMLElement {
@@ -144,6 +170,13 @@ class AvatarActions extends HTMLElement {
credentials: 'include',
});
if (ar.ok) this._agent = (await ar.json()).agents?.[0] || null;
+ // Royalty trust signals (earns-from / shares-upstream). Best-effort.
+ if (this._agent?.id) {
+ try {
+ const rr = await fetch(`${API}/api/agents/${this._agent.id}/solana/royalty`, { credentials: 'include' });
+ if (rr.ok) this._royalty = (await rr.json()).data || null;
+ } catch { /* signals are decoration */ }
+ }
} catch {
/* render whatever we have */
}
@@ -178,6 +211,7 @@ class AvatarActions extends HTMLElement {
a.fork_count > 0
? `<span class="forks">⑂ ${a.fork_count} ${a.fork_count === 1 ? 'fork' : 'forks'}</span>`
: '';
+ const royaltySignals = this._royaltySignals();
// mode: "full" (default) shows wallet to owners + fork to others;
// "wallet" shows only the wallet panel; "fork" shows only the save/fork
@@ -332,14 +366,36 @@ class AvatarActions extends HTMLElement {
async _fork() {
if (this._busy) return;
const btn = this.shadowRoot.querySelector('[data-act="fork"]');
- this._setBusy(btn, 'Saving…');
this._msg('', '');
+
+ // Consent gate: if this avatar's lineage carries a fork royalty, show the
+ // EXACT terms and require explicit acceptance before creating the fork. The
+ // forker mints their own wallet and keeps the clear majority; a defined slice
+ // of new SOL income streams upstream. Reject → no fork is created.
+ let acceptRoyalty = false;
+ try {
+ const tr = await fetch(`${API}/api/avatars/fork?of=${encodeURIComponent(this.avatarId)}&royalty=1`, {
+ credentials: 'include',
+ });
+ if (tr.ok) {
+ const { royalty } = await tr.json();
+ if (royalty?.has_royalty) {
+ const accepted = await this._confirmRoyalty(royalty);
+ if (!accepted) return; // user declined — nothing happens
+ acceptRoyalty = true;
+ }
+ }
+ } catch {
+ /* terms preview unavailable — server still gates the POST, so proceed */
+ }
+
+ this._setBusy(btn, 'Saving…');
try {
const r = await fetch(`${API}/api/avatars/fork`, {
method: 'POST',
credentials: 'include',
headers: { 'content-type': 'application/json' },
- body: JSON.stringify({ source_avatar_id: this.avatarId }),
+ body: JSON.stringify({ source_avatar_id: this.avatarId, accept_royalty: acceptRoyalty }),
});
const d = await r.json().catch(() => ({}));
if (!r.ok) throw new Error(d.message || d.error || `fork failed (${r.status})`);
@@ -358,6 +414,44 @@ class AvatarActions extends HTMLElement {
}
}
+ // Inline royalty-consent dialog (self-contained — no cross-bundle import).
+ // Resolves true only on explicit accept. The fork is created by the caller.
+ _confirmRoyalty(royalty) {
+ return new Promise((resolve) => {
+ const keepPct = (royalty.keep_pct ?? (royalty.keep_bps / 100)).toLocaleString(undefined, { maximumFractionDigits: 2 });
+ const rows = (royalty.creators || [])
+ .map((c) => `<div class="rty-cr"><span class="rty-gen">gen ${c.depth}</span>
+ <span class="rty-nm">${escapeHtml(c.owner_name || 'creator')}</span>
+ <span class="rty-w">${c.wallet ? short(c.wallet) : '—'}</span>
+ <span class="rty-bp">${(c.pct ?? c.bps / 100).toLocaleString(undefined, { maximumFractionDigits: 2 })}%</span></div>`)
+ .join('');
+ const bar = `<div class="rty-bar"><div class="rty-keep" style="flex:${royalty.keep_bps}">you keep ${keepPct}%</div>${(royalty.creators || []).map((c, i) => `<div class="rty-up" style="flex:${c.bps};--i:${i}"></div>`).join('')}</div>`;
+ const overlay = document.createElement('div');
+ overlay.className = 'rty-overlay';
+ overlay.innerHTML = `<div class="rty-box" role="dialog" aria-modal="true" aria-label="Fork royalty terms">
+ <h3>Fork royalty</h3>
+ <p>Forking mints <b>your own wallet</b> — you alone own it and its funds. As thanks to the creators it descends from, a small slice of <b>new SOL income your fork earns</b> streams upstream, on-chain.</p>
+ ${bar}
+ <div class="rty-list">${rows}</div>
+ <ul class="rty-terms">
+ <li>Applies only to <b>SOL tips & stream income</b> your fork earns — never your existing balance.</li>
+ <li>You keep the <b>clear majority</b> (${keepPct}%); upstream is capped and decays with distance.</li>
+ <li>Terms are <b>frozen now</b> — later rate changes never affect your fork.</li>
+ </ul>
+ <div class="rty-acts">
+ <button class="rty-cancel">Cancel</button>
+ <button class="rty-accept primary">Accept & fork — keep ${keepPct}%</button>
+ </div>
+ </div>`;
+ this.shadowRoot.appendChild(overlay);
+ const done = (val) => { overlay.remove(); resolve(val); };
+ overlay.addEventListener('click', (e) => { if (e.target === overlay) done(false); });
+ overlay.querySelector('.rty-cancel').addEventListener('click', () => done(false));
+ overlay.querySelector('.rty-accept').addEventListener('click', () => done(true));
+ overlay.querySelector('.rty-accept').focus();
+ });
+ }
+
async _createWallet() {
if (this._busy) return;
const ag = this._agent;
diff --git a/public/changelog.json b/public/changelog.json
index bf7bc527f..986236801 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T08:51:43.426Z",
+ "generated_at": "2026-06-23T08:52:44.524Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -406,6 +406,16 @@
"fix"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Launch Copilot: every coin you launch can run its own market-maker",
+ "summary": "Launching a coin on three.ws no longer means mint-and-hope. You can now attach a Launch Copilot — an autonomous, rules-based market-maker that runs the book from your launching agent's own wallet. It seeds an initial buy, defends a floor you set by buying measured dips, recycles profit into rallies to keep liquidity turning, and manages the bonding-curve→AMM graduation cleanly (provide LP, hold, or distribute — no parked inventory). Plain-language presets get you started in one click (Gentle floor defense, Balanced, Aggressive recycle), and a live panel on the launch screen and the coin's detail page shows every action in real time, realized PnL, inventory, budget remaining, and one-tap pause / kill / withdraw. Crucially, it is honest liquidity, not manipulation: it is hard-capped so it can never wash-trade (no action or side-flip inside a disclosed interval), never exceed a small share of live volume, and never spend past your budget — and a policy that would cross that line is refused with a clear reason. Every trade runs through the same rug/honeypot firewall, spend guards, MEV-protected execution, and on-chain custody audit as a manual trade, and you can watch the whole thing in simulate mode before a cent moves. The market-maker operates on the coin you launched; the only coin three.ws promotes is $THREE.",
+ "link": null,
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
@@ -873,6 +883,17 @@
"feature"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Your agent levels up: a shareable moment when its wallet crosses a wealth tier",
+ "summary": "The embodied-finance aura already makes an agent glow brighter as its wallet grows. Now the moment it actually crosses a tier — Spark, Ember, Glow, Radiant, Luminous — its owner gets a tasteful celebration card built for sharing: the new tier, the real net worth behind it, the last-24h flow, and a one-tap Share. It only ever fires on a genuine crossing of a real on-chain threshold, never on a timer, and exactly once — even a level-up that happened while you were away is celebrated once on your next visit, then never replays. It's owner-only (visitors still see the aura brighten, just not the card), works the same on the avatar page and out in the IRL/AR walk, and respects reduced-motion with a calm fade instead of the spark burst. Only coin referenced is $THREE.",
+ "link": "/avatars",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 637ed3d54..951127779 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -318,6 +318,14 @@
<category>fix</category>
<description>When you pin your agent to a real-world spot in IRL — on a table, a desk, a shelf — it now stays put as you pan and move your phone, instead of sliding away. Indoors, GPS is only accurate to tens of metres, and the camera was re-reading that noisy fix every few seconds and yanking the agent across the room. Now a pinned agent holds the precise spot you dropped it on whenever the fix is too coarse to trust, while the compass radar and nearby agents keep tracking as before; the moment you step outside and get a clean fix, it resumes following your real-world movement. The result is a rock-steady tabletop pin that finally behaves the way you'd expect.</description>
</item>
+ <item>
+ <title>Launch Copilot: every coin you launch can run its own market-maker</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-23:Launch Copilot: every coin you launch can run its own market-maker</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Launching a coin on three.ws no longer means mint-and-hope. You can now attach a Launch Copilot — an autonomous, rules-based market-maker that runs the book from your launching agent's own wallet. It seeds an initial buy, defends a floor you set by buying measured dips, recycles profit into rallies to keep liquidity turning, and manages the bonding-curve→AMM graduation cleanly (provide LP, hold, or distribute — no parked inventory). Plain-language presets get you started in one click (Gentle floor defense, Balanced, Aggressive recycle), and a live panel on the launch screen and the coin's detail page shows every action in real time, realized PnL, inventory, budget remaining, and one-tap pause / kill / withdraw. Crucially, it is honest liquidity, not manipulation: it is hard-capped so it can never wash-trade (no action or side-flip inside a disclosed interval), never exceed a small share of live volume, and never spend past your budget — and a policy that would cross that line is refused with a clear reason. Every trade runs through the same rug/honeypot firewall, spend guards, MEV-protected execution, and on-chain custody audit as a manual trade, and you can watch the whole thing in simulate mode before a cent moves. The market-maker operates on the coin you launched; the only coin three.ws promotes is $THREE.</description>
+ </item>
<item>
<title>Marketplace fork no longer creates duplicate copies on a double-click</title>
<link>https://three.ws/marketplace</link>
@@ -678,6 +686,14 @@
<category>sdk</category>
<description>The buyer side of the agent economy, in one line. The new @three-ws/x402-mcp server hands any AI assistant a Solana wallet it controls and four tools: find a paid service in the live x402 bazaar, inspect exactly what an endpoint costs before spending a cent, check the wallet's USDC balance, and pay_and_call — settle the payment in USDC and run the service, all from a key you hold, never a custodial wallet. Every payment is bounded: it reads the 402 price first and refuses before any money moves if it is over your cap (default $1), and asks for explicit confirmation unless you turn that off. Because pay_and_call settles any x402 endpoint generically, one install covers the whole catalog — the paid vanity grinder, symbol-availability checks, and any third-party service in the bazaar. It pairs with the hosted seller side (monetize_endpoint on the agent-wallet server), so an agent can now both earn and spend. Add it with: claude mcp add x402 --env SOLANA_SECRET_KEY=&lt;key&gt; -- npx -y @three-ws/x402-mcp. The full catalog of all 20 three.ws MCP servers — hosted and npm — now lives at three.ws/docs/mcp with copy-paste installs.</description>
</item>
+ <item>
+ <title>Your agent levels up: a shareable moment when its wallet crosses a wealth tier</title>
+ <link>https://three.ws/avatars</link>
+ <guid isPermaLink="false">2026-06-23:Your agent levels up: a shareable moment when its wallet crosses a wealth tier</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The embodied-finance aura already makes an agent glow brighter as its wallet grows. Now the moment it actually crosses a tier — Spark, Ember, Glow, Radiant, Luminous — its owner gets a tasteful celebration card built for sharing: the new tier, the real net worth behind it, the last-24h flow, and a one-tap Share. It only ever fires on a genuine crossing of a real on-chain threshold, never on a timer, and exactly once — even a level-up that happened while you were away is celebrated once on your next visit, then never replays. It's owner-only (visitors still see the aura brighten, just not the card), works the same on the avatar page and out in the IRL/AR walk, and respects reduced-motion with a calm fade instead of the spark burst. Only coin referenced is $THREE.</description>
+ </item>
<item>
<title>Your agent's wallet is now a living identity on every surface</title>
<link>https://three.ws/marketplace</link>
diff --git a/public/features.json b/public/features.json
index 8d29d2e56..5f813a2ff 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T08:51:43.109Z",
+ "generated_at": "2026-06-23T08:52:44.462Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/economy-live.js b/src/economy-live.js
index 2f1cb54a1..682f5901f 100644
--- a/src/economy-live.js
+++ b/src/economy-live.js
@@ -336,10 +336,13 @@ function pulseLive() {
}
export function initEconomyLive() {
- loadAgents().then(() => pulseLive());
+ loadOffers().then(() => pulseLive());
+ loadAgents();
loadServices();
const sortEl = $('#ae-sort');
if (sortEl) sortEl.addEventListener('change', () => loadAgents());
+ const offerSortEl = $('#ae-offer-sort');
+ if (offerSortEl) offerSortEl.addEventListener('change', () => renderOffers());
scheduleRefresh();
}
diff --git a/src/shared/agent-fork-royalty.js b/src/shared/agent-fork-royalty.js
new file mode 100644
index 000000000..e95c893ee
--- /dev/null
+++ b/src/shared/agent-fork-royalty.js
@@ -0,0 +1,443 @@
+/**
+ * Fork Royalty Streams — shared UI for provenance income.
+ *
+ * One source of truth for every surface that renders the royalty relationship:
+ * • royaltySignalsHTML(data) — the trust chips: "earns from N forks" /
+ * "shares N% upstream".
+ * • openRoyaltyPanel(agentId) — the transparent split ledger both sides see.
+ * • mountRoyaltySetting(...) — owner control to set the fork royalty rate.
+ * • confirmForkRoyalty(terms) — the consent dialog the fork flow shows BEFORE
+ * a fork that carries terms is created.
+ *
+ * All numbers come from GET /api/agents/:id/solana/royalty (real DB + on-chain
+ * ledger). Every payout links to its real explorer tx. No mock data, no hidden
+ * cuts: a forker always sees they keep the majority; an ancestor sees real income
+ * by descendant. The royalty layer stays in the wallet's violet family.
+ */
+
+let _apiFetch = null;
+async function api() {
+ if (_apiFetch) return _apiFetch;
+ try { ({ apiFetch: _apiFetch } = await import('../api.js')); }
+ catch { _apiFetch = (p, o) => fetch(p, { credentials: 'include', ...o }); }
+ return _apiFetch;
+}
+
+const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) =>
+ ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+const shortAddr = (a) => (a && a.length > 12 ? `${a.slice(0, 4)}…${a.slice(-4)}` : a || '');
+const pct = (bps) => `${(bps / 100).toLocaleString(undefined, { maximumFractionDigits: 2 })}%`;
+const sol = (n) => `${Number(n || 0).toLocaleString(undefined, { maximumFractionDigits: 5 })} SOL`;
+const usd = (n) => (n == null ? '' : `$${Number(n).toLocaleString(undefined, { maximumFractionDigits: 2 })}`);
+const explorer = (sig, net) => `https://solscan.io/tx/${sig}${net === 'devnet' ? '?cluster=devnet' : ''}`;
+
+/** Fetch the full royalty view for an agent. Returns null on any failure. */
+export async function fetchRoyalty(agentId) {
+ if (!agentId) return null;
+ try {
+ const f = await api();
+ const r = await f(`/api/agents/${agentId}/solana/royalty`, { credentials: 'include' });
+ if (!r.ok) return null;
+ return (await r.json()).data || null;
+ } catch { return null; }
+}
+
+/**
+ * The compact trust signals for a chip/HUD/lineage row. Returns '' when there's
+ * nothing to say (a free, un-forked agent) so callers can render nothing.
+ */
+export function royaltySignalsHTML(data, { compact = false } = {}) {
+ if (!data) return '';
+ const out = [];
+ const anc = data.ancestor;
+ const desc = data.descendant;
+ if (anc?.earns_royalties && anc.fork_count > 0) {
+ const earned = Number(anc.earned_usd) > 0 ? ` · ${esc(usd(anc.earned_usd))} earned` : '';
+ out.push(`<span class="twr-sig twr-sig--earn" title="This creator earns a royalty when its forks earn">
+ <span class="twr-sig-ic" aria-hidden="true">↑</span>earns from ${anc.fork_count} ${anc.fork_count === 1 ? 'fork' : 'forks'}${compact ? '' : earned}</span>`);
+ }
+ if (desc?.shares_upstream && desc.total_bps > 0) {
+ out.push(`<span class="twr-sig twr-sig--share" title="This fork shares a slice of its income with the creators it descends from">
+ <span class="twr-sig-ic" aria-hidden="true">⑂</span>shares ${pct(desc.total_bps)} upstream</span>`);
+ }
+ if (!out.length) return '';
+ return `<span class="twr-sigs">${out.join('')}</span>`;
+}
+
+/** Open the transparent split-ledger modal. */
+export async function openRoyaltyPanel(agentId, { name = 'this agent', network = 'mainnet' } = {}) {
+ ensureStyles();
+ const backdrop = document.createElement('div');
+ backdrop.className = 'twr-backdrop';
+ backdrop.setAttribute('role', 'dialog');
+ backdrop.setAttribute('aria-modal', 'true');
+ backdrop.setAttribute('aria-label', `Fork royalties for ${name}`);
+ backdrop.innerHTML = `<div class="twr-panel"><div class="twr-load"><span class="twr-spin"></span>Loading royalty ledger…</div></div>`;
+ document.body.appendChild(backdrop);
+ document.body.style.overflow = 'hidden';
+
+ const close = () => {
+ backdrop.classList.add('twr-out');
+ document.body.style.overflow = '';
+ setTimeout(() => backdrop.remove(), 160);
+ document.removeEventListener('keydown', onKey);
+ };
+ const onKey = (e) => { if (e.key === 'Escape') close(); };
+ document.addEventListener('keydown', onKey);
+ backdrop.addEventListener('click', (e) => { if (e.target === backdrop) close(); });
+
+ const data = await fetchRoyalty(agentId);
+ const panel = backdrop.querySelector('.twr-panel');
+ if (!data) {
+ panel.innerHTML = `<div class="twr-head"><h2>Fork royalties</h2><button class="twr-x" aria-label="Close">✕</button></div>
+ <div class="twr-empty">Couldn't load the royalty ledger right now. <button class="twr-retry">Retry</button></div>`;
+ panel.querySelector('.twr-x').onclick = close;
+ panel.querySelector('.twr-retry').onclick = () => { close(); openRoyaltyPanel(agentId, { name, network }); };
+ return;
+ }
+ panel.innerHTML = renderPanel(data, { name, network });
+ panel.querySelector('.twr-x').onclick = close;
+ panel.querySelector('.twr-x').focus();
+}
+
+function renderPanel(data, { name, network }) {
+ const anc = data.ancestor || {};
+ const desc = data.descendant || {};
+ const cfg = data.config || {};
+
+ // As ancestor: income earned from descendants' forks.
+ const ancSection = (anc.earns_royalties || Number(anc.earned_usd) > 0 || (anc.income || []).length)
+ ? `<section class="twr-sec">
+ <div class="twr-sec-h"><h3>↑ Royalties this creator earns</h3>
+ <span class="twr-kpi">${esc(sol(Number(anc.earned_lamports) / 1e9))}${Number(anc.earned_usd) > 0 ? ` · ${esc(usd(anc.earned_usd))}` : ''}</span></div>
+ <p class="twr-note">From <b>${anc.fork_count}</b> ${anc.fork_count === 1 ? 'fork' : 'forks'} carrying these terms · <b>${anc.paying_forks}</b> ${anc.paying_forks === 1 ? 'has' : 'have'} actually paid.</p>
+ ${(anc.income || []).length
+ ? `<div class="twr-ledger">${anc.income.map((p) => incomeRow(p, network)).join('')}</div>`
+ : `<div class="twr-zero">No royalty income yet — honest zero. When a fork that descends from this creator earns SOL, the split lands here automatically.</div>`}
+ </section>`
+ : '';
+
+ // As descendant: what this fork shares upstream + what it has paid.
+ const descSection = desc.shares_upstream
+ ? `<section class="twr-sec">
+ <div class="twr-sec-h"><h3>⑂ What this fork shares upstream</h3>
+ <span class="twr-kpi twr-kpi--keep">keeps ${esc(pct(desc.keep_bps))}</span></div>
+ <div class="twr-split">
+ <div class="twr-split-bar" role="img" aria-label="${esc(pct(desc.keep_bps))} kept by this fork, ${esc(pct(desc.total_bps))} shared upstream">
+ <div class="twr-split-keep" style="flex:${desc.keep_bps}">you keep ${esc(pct(desc.keep_bps))}</div>
+ ${desc.schedule.map((s, i) => `<div class="twr-split-up" style="flex:${s.bps};--i:${i}" title="${esc(s.ancestor_owner_name || 'creator')} · ${esc(pct(s.bps))}"></div>`).join('')}
+ </div>
+ </div>
+ <p class="twr-note">A defined slice of <b>new SOL income</b> only — never a claim on this wallet's balance. Set at fork time, can't change retroactively. You keep the clear majority.</p>
+ <div class="twr-creators">
+ ${desc.schedule.map((s) => `<div class="twr-creator">
+ <span class="twr-depth" title="lineage distance">gen ${s.depth}</span>
+ <span class="twr-cname">${esc(s.ancestor_owner_name || 'creator')}</span>
+ <span class="twr-cwallet">${s.ancestor_wallet ? esc(shortAddr(s.ancestor_wallet)) : '—'}</span>
+ <span class="twr-cbps">${esc(pct(s.bps))}</span>
+ </div>`).join('')}
+ </div>
+ ${Number(desc.paid_count) > 0
+ ? `<div class="twr-sec-h twr-sub"><h4>Royalties paid</h4><span class="twr-kpi">${esc(sol(Number(desc.paid_lamports) / 1e9))}${Number(desc.paid_usd) > 0 ? ` · ${esc(usd(desc.paid_usd))}` : ''}</span></div>
+ <div class="twr-ledger">${desc.payouts.filter((p) => p.status !== 'skipped').map((p) => paidRow(p, network)).join('')}</div>`
+ : `<div class="twr-zero">Hasn't earned eligible income yet — nothing has been shared. When it earns a SOL tip or stream, the split runs automatically.</div>`}
+ </section>`
+ : `<section class="twr-sec"><div class="twr-sec-h"><h3>⑂ Upstream royalties</h3></div>
+ <div class="twr-zero">This agent is original (or forked something free) — it owes nothing upstream and keeps <b>100%</b> of what it earns.</div></section>`;
+
+ return `
+ <div class="twr-head">
+ <h2>Fork royalties · ${esc(name)}</h2>
+ <button class="twr-x" aria-label="Close">✕</button>
+ </div>
+ <div class="twr-body">
+ ${ancSection}
+ ${descSection}
+ <p class="twr-foot">Royalties are opt-in, capped at ${esc(pct(cfg.total_cap_bps || 2000))} total upstream, and decay with lineage distance so the active forker always keeps the majority. Paid on real ${esc(cfg.eligible_asset || 'SOL')} income, on-chain, idempotently. <a href="/changelog" class="twr-link">How this works →</a></p>
+ </div>`;
+}
+
+function incomeRow(p, network) {
+ const net = p.network || network;
+ const who = p.fork_agent_id ? `<a href="/agent/${esc(p.fork_agent_id)}" class="twr-link">a fork</a>` : 'a fork';
+ return `<div class="twr-row twr-row--in">
+ <span class="twr-row-amt">+${esc(sol(p.amount_sol))}</span>
+ <span class="twr-row-mid">from ${who} · ${esc(p.source_kind)} · gen ${p.depth} · ${esc(pct(p.bps))}</span>
+ ${p.signature ? `<a class="twr-tx" href="${esc(explorer(p.signature, net))}" target="_blank" rel="noopener">tx ↗</a>` : `<span class="twr-pending">${esc(p.status)}</span>`}
+ </div>`;
+}
+
+function paidRow(p, network) {
+ const net = p.network || network;
+ const dest = p.rerouted ? 'platform treasury (ancestor unavailable)'
+ : (p.recipient_wallet ? `<a href="/agent/${esc(p.ancestor_agent_id)}" class="twr-link">${esc(shortAddr(p.recipient_wallet))}</a>` : 'creator');
+ const badge = p.status === 'failed' ? `<span class="twr-pending twr-fail">failed</span>`
+ : p.status === 'pending' ? `<span class="twr-pending">pending</span>`
+ : (p.signature ? `<a class="twr-tx" href="${esc(explorer(p.signature, net))}" target="_blank" rel="noopener">tx ↗</a>` : '');
+ return `<div class="twr-row twr-row--out">
+ <span class="twr-row-amt twr-out">−${esc(sol(p.amount_sol))}</span>
+ <span class="twr-row-mid">to ${dest} · gen ${p.depth} · ${esc(pct(p.bps))}</span>
+ ${badge}
+ </div>`;
+}
+
+/**
+ * The consent dialog the fork flow shows when an avatar carries royalty terms.
+ * Resolves to true only if the user explicitly accepts. Pure promise — no fork
+ * is created here; the caller proceeds on `true`.
+ *
+ * @param {object} royalty the public terms from GET /api/avatars/fork?royalty=1
+ * @param {string} avatarName
+ */
+export function confirmForkRoyalty(royalty, avatarName = 'this avatar') {
+ ensureStyles();
+ return new Promise((resolve) => {
+ const backdrop = document.createElement('div');
+ backdrop.className = 'twr-backdrop';
+ backdrop.setAttribute('role', 'dialog');
+ backdrop.setAttribute('aria-modal', 'true');
+ backdrop.setAttribute('aria-label', `Fork royalty terms for ${avatarName}`);
+ const creators = (royalty.creators || []).map((c) => `<div class="twr-creator">
+ <span class="twr-depth">gen ${c.depth}</span>
+ <span class="twr-cname">${esc(c.owner_name || 'creator')}</span>
+ <span class="twr-cwallet">${c.wallet ? esc(shortAddr(c.wallet)) : '—'}</span>
+ <span class="twr-cbps">${esc(pct(c.bps))}</span>
+ </div>`).join('');
+ backdrop.innerHTML = `<div class="twr-panel twr-panel--sm">
+ <div class="twr-head"><h2>Fork royalty</h2><button class="twr-x" aria-label="Cancel">✕</button></div>
+ <div class="twr-body">
+ <p class="twr-lead">Forking <b>${esc(avatarName)}</b> mints <b>your own wallet</b> — you alone own it and its funds. As thanks to the creators it descends from, a small slice of <b>new SOL income your fork earns</b> streams upstream, automatically and on-chain.</p>
+ <div class="twr-split">
+ <div class="twr-split-bar">
+ <div class="twr-split-keep" style="flex:${royalty.keep_bps}">you keep ${esc(pct(royalty.keep_bps))}</div>
+ ${(royalty.creators || []).map((c, i) => `<div class="twr-split-up" style="flex:${c.bps};--i:${i}"></div>`).join('')}
+ </div>
+ </div>
+ <div class="twr-creators">${creators}</div>
+ <ul class="twr-terms">
+ <li>Applies only to <b>SOL tips & money-stream income</b> your fork earns — never to your existing balance.</li>
+ <li>You keep the <b>clear majority</b> (${esc(pct(royalty.keep_bps))}). Total upstream is hard-capped and decays with distance.</li>
+ <li>These terms are <b>frozen now</b> — a creator changing their rate later never affects your fork.</li>
+ </ul>
+ <div class="twr-actions">
+ <button class="twr-btn twr-btn--ghost" data-cancel>Cancel</button>
+ <button class="twr-btn twr-btn--go" data-accept>Accept & fork — keep ${esc(pct(royalty.keep_bps))}</button>
+ </div>
+ </div>
+ </div>`;
+ document.body.appendChild(backdrop);
+ document.body.style.overflow = 'hidden';
+ const done = (val) => {
+ document.body.style.overflow = '';
+ backdrop.classList.add('twr-out');
+ setTimeout(() => backdrop.remove(), 160);
+ document.removeEventListener('keydown', onKey);
+ resolve(val);
+ };
+ const onKey = (e) => { if (e.key === 'Escape') done(false); };
+ document.addEventListener('keydown', onKey);
+ backdrop.addEventListener('click', (e) => { if (e.target === backdrop) done(false); });
+ backdrop.querySelector('.twr-x').onclick = () => done(false);
+ backdrop.querySelector('[data-cancel]').onclick = () => done(false);
+ backdrop.querySelector('[data-accept]').onclick = () => done(true);
+ backdrop.querySelector('[data-accept]').focus();
+ });
+}
+
+/**
+ * Owner control: set this agent's fork royalty rate + eligible income types.
+ * Renders into `host`, self-loads current config, persists via PUT (CSRF auto).
+ * Calls onChange(config) after a successful save. Safe no-op if not owner
+ * (the endpoint rejects a non-owner PUT, and we only mount for owners).
+ */
+export async function mountRoyaltySetting({ host, agentId, onChange } = {}) {
+ if (!host || !agentId) return;
+ ensureStyles();
+ const data = await fetchRoyalty(agentId);
+ const cfg = data?.config || { bps: 0, eligible: { tips: true, stream: true }, per_creator_cap_bps: 1000, eligible_asset: 'SOL' };
+ const cap = cfg.per_creator_cap_bps || 1000;
+ const ancCount = data?.ancestor?.fork_count || 0;
+
+ const card = document.createElement('div');
+ card.className = 'twr-set';
+ const draw = () => {
+ const curPct = (cfg.bps / 100).toString();
+ card.innerHTML = `
+ <div class="twr-set-h">
+ <h4>Fork royalty</h4>
+ ${ancCount > 0 ? `<button class="twr-set-view" type="button" data-view>earns from ${ancCount} ${ancCount === 1 ? 'fork' : 'forks'} →</button>` : ''}
+ </div>
+ <p class="twr-set-sub">Earn a slice of income from forks of this avatar. Applies to <b>future forks only</b>; max ${esc(pct(cap))}. The forker always keeps the majority. Set 0 to make forks free.</p>
+ <div class="twr-set-row">
+ <div class="twr-range">
+ <input type="range" min="0" max="${cap}" step="50" value="${cfg.bps}" data-range aria-label="Royalty percent">
+ <output class="twr-range-out" data-out>${esc(pct(cfg.bps))}</output>
+ </div>
+ </div>
+ <div class="twr-set-elig">
+ <label><input type="checkbox" data-elig="tips" ${cfg.eligible.tips !== false ? 'checked' : ''}> Tips</label>
+ <label><input type="checkbox" data-elig="stream" ${cfg.eligible.stream !== false ? 'checked' : ''}> Money streams</label>
+ <span class="twr-set-asset">on ${esc(cfg.eligible_asset || 'SOL')} income</span>
+ </div>
+ <div class="twr-set-actions">
+ <button class="twr-btn twr-btn--go" type="button" data-save disabled>Save royalty</button>
+ <span class="twr-set-msg" data-msg></span>
+ </div>`;
+ wire();
+ };
+ const wire = () => {
+ const range = card.querySelector('[data-range]');
+ const out = card.querySelector('[data-out]');
+ const save = card.querySelector('[data-save]');
+ const msg = card.querySelector('[data-msg]');
+ let dirty = false;
+ const markDirty = () => { dirty = true; save.disabled = false; msg.textContent = ''; };
+ range.addEventListener('input', () => { out.textContent = pct(Number(range.value)); markDirty(); });
+ card.querySelectorAll('[data-elig]').forEach((c) => c.addEventListener('change', markDirty));
+ card.querySelector('[data-view]')?.addEventListener('click', () =>
+ openRoyaltyPanel(agentId, { name: 'this agent' }));
+ save.addEventListener('click', async () => {
+ if (!dirty) return;
+ save.disabled = true;
+ msg.textContent = 'Saving…';
+ msg.className = 'twr-set-msg';
+ try {
+ const f = await api();
+ const r = await f(`/api/agents/${agentId}/solana/royalty`, {
+ method: 'PUT',
+ headers: { 'content-type': 'application/json' },
+ credentials: 'include',
+ body: JSON.stringify({
+ bps: Number(range.value),
+ eligible: {
+ tips: card.querySelector('[data-elig="tips"]').checked,
+ stream: card.querySelector('[data-elig="stream"]').checked,
+ },
+ }),
+ });
+ const d = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(d.message || d.error || 'save failed');
+ cfg.bps = d.data.bps;
+ cfg.eligible = d.data.eligible;
+ dirty = false;
+ msg.textContent = d.data.bps > 0 ? `Saved · forks pay ${pct(d.data.bps)} upstream` : 'Saved · forks are free';
+ msg.className = 'twr-set-msg twr-ok';
+ onChange?.(d.data);
+ } catch (e) {
+ msg.textContent = e.message || 'Could not save';
+ msg.className = 'twr-set-msg twr-fail';
+ save.disabled = false;
+ }
+ });
+ };
+ draw();
+ host.appendChild(card);
+ return card;
+}
+
+let _styled = false;
+function ensureStyles() {
+ if (_styled || typeof document === 'undefined') return;
+ _styled = true;
+ const s = document.createElement('style');
+ s.id = 'twr-styles';
+ s.textContent = `
+.twr-backdrop{position:fixed;inset:0;z-index:10001;display:flex;align-items:center;justify-content:center;
+ padding:16px;background:rgba(8,8,12,.7);backdrop-filter:blur(5px);animation:twr-fade .18s ease;}
+.twr-backdrop.twr-out{animation:twr-fade .16s ease reverse;}
+@keyframes twr-fade{from{opacity:0}to{opacity:1}}
+.twr-panel{width:min(560px,100%);max-height:88vh;overflow:auto;background:var(--bg-0,#0a0a0a);
+ border:1px solid var(--stroke,rgba(255,255,255,.1));border-radius:var(--radius-lg,16px);
+ box-shadow:0 24px 80px rgba(0,0,0,.6);color:var(--ink,#f5f5f6);
+ font-family:var(--font-body,Inter,system-ui,sans-serif);animation:twr-rise .2s var(--ease-standard,cubic-bezier(.2,.8,.2,1));}
+.twr-panel--sm{width:min(440px,100%);}
+@keyframes twr-rise{from{transform:translateY(12px) scale(.99);opacity:0}to{transform:none;opacity:1}}
+.twr-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:16px 18px;
+ border-bottom:1px solid var(--stroke,rgba(255,255,255,.08));position:sticky;top:0;background:var(--bg-0,#0a0a0a);z-index:1;}
+.twr-head h2{margin:0;font-size:15px;font-weight:600;font-family:var(--font-display,'Space Grotesk',sans-serif);}
+.twr-x{background:none;border:1px solid var(--stroke,rgba(255,255,255,.12));color:var(--ink-dim,#9a9aa2);
+ width:30px;height:30px;border-radius:8px;cursor:pointer;font-size:13px;line-height:1;transition:.14s;}
+.twr-x:hover{background:var(--surface-2,rgba(255,255,255,.05));color:var(--ink,#fff);}
+.twr-x:focus-visible{outline:2px solid #c4b5fd;outline-offset:2px;}
+.twr-body{padding:16px 18px 18px;}
+.twr-load,.twr-empty{padding:40px 18px;text-align:center;color:var(--ink-dim,#9a9aa2);font-size:13px;display:flex;flex-direction:column;gap:12px;align-items:center;}
+.twr-spin{width:16px;height:16px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:twr-spin .7s linear infinite;}
+@keyframes twr-spin{to{transform:rotate(360deg)}}
+.twr-sec{margin-bottom:18px;}
+.twr-sec-h{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:0 0 6px;}
+.twr-sec-h.twr-sub{margin-top:16px;}
+.twr-sec-h h3{margin:0;font-size:13px;font-weight:600;}
+.twr-sec-h h4{margin:0;font-size:12px;font-weight:600;color:var(--ink-dim,#9a9aa2);text-transform:uppercase;letter-spacing:.05em;}
+.twr-kpi{font-family:var(--font-mono,'JetBrains Mono',monospace);font-size:13px;font-weight:600;color:#c4b5fd;}
+.twr-kpi--keep{color:var(--success,#4ade80);}
+.twr-note{margin:6px 0 10px;font-size:12px;line-height:1.5;color:var(--ink-dim,#9a9aa2);}
+.twr-zero{padding:14px;border:1px dashed var(--stroke,rgba(255,255,255,.12));border-radius:10px;
+ font-size:12px;line-height:1.5;color:var(--ink-dim,#9a9aa2);text-align:center;}
+.twr-split{margin:10px 0;}
+.twr-split-bar{display:flex;height:30px;border-radius:8px;overflow:hidden;border:1px solid var(--stroke,rgba(255,255,255,.1));}
+.twr-split-keep{background:linear-gradient(180deg,rgba(74,222,128,.32),rgba(74,222,128,.18));color:var(--ink,#fff);
+ display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;min-width:0;white-space:nowrap;padding:0 6px;}
+.twr-split-up{background:linear-gradient(180deg,rgba(196,181,253,calc(.5 - var(--i,0)*.08)),rgba(139,92,246,calc(.34 - var(--i,0)*.06)));
+ border-left:1px solid rgba(10,10,10,.5);min-width:6px;}
+.twr-creators{display:flex;flex-direction:column;gap:4px;margin:8px 0;}
+.twr-creator{display:flex;align-items:center;gap:10px;font-size:12px;padding:5px 8px;border-radius:7px;background:var(--surface-1,rgba(255,255,255,.03));}
+.twr-depth{font-size:10px;font-weight:700;color:var(--ink-dim,#9a9aa2);text-transform:uppercase;letter-spacing:.04em;flex:0 0 auto;}
+.twr-cname{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
+.twr-cwallet{font-family:var(--font-mono,monospace);color:var(--ink-dim,#9a9aa2);font-size:11px;}
+.twr-cbps{font-family:var(--font-mono,monospace);font-weight:600;color:#c4b5fd;flex:0 0 auto;}
+.twr-ledger{display:flex;flex-direction:column;gap:3px;margin-top:6px;}
+.twr-row{display:flex;align-items:center;gap:8px;font-size:12px;padding:6px 8px;border-radius:7px;background:var(--surface-1,rgba(255,255,255,.03));}
+.twr-row-amt{font-family:var(--font-mono,monospace);font-weight:600;color:var(--success,#4ade80);flex:0 0 auto;}
+.twr-row-amt.twr-out{color:#c4b5fd;}
+.twr-row-mid{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-dim,#9a9aa2);}
+.twr-tx{flex:0 0 auto;color:#c4b5fd;text-decoration:none;font-size:11px;border-bottom:1px dashed currentColor;}
+.twr-tx:hover{color:#ddd6fe;}
+.twr-pending{flex:0 0 auto;font-size:11px;color:var(--warn,#fbbf24);}
+.twr-pending.twr-fail{color:var(--danger,#f87171);}
+.twr-foot{margin:14px 0 0;font-size:11px;line-height:1.5;color:var(--ink-faint,#6b6b73);}
+.twr-link{color:#c4b5fd;text-decoration:none;border-bottom:1px dashed currentColor;}
+.twr-link:hover{color:#ddd6fe;}
+.twr-lead{font-size:13px;line-height:1.55;margin:0 0 12px;}
+.twr-terms{margin:12px 0;padding-left:18px;font-size:12px;line-height:1.6;color:var(--ink-dim,#cfcfd6);}
+.twr-terms b{color:var(--ink,#fff);}
+.twr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:14px;}
+.twr-btn{font:inherit;font-size:13px;font-weight:600;padding:9px 14px;border-radius:10px;cursor:pointer;border:1px solid var(--stroke,rgba(255,255,255,.12));transition:.14s;}
+.twr-btn--ghost{background:transparent;color:var(--ink-dim,#cfcfd6);}
+.twr-btn--ghost:hover{background:var(--surface-2,rgba(255,255,255,.05));color:var(--ink,#fff);}
+.twr-btn--go{background:linear-gradient(180deg,#a78bfa,#8b5cf6);border-color:#8b5cf6;color:#fff;}
+.twr-btn--go:hover{filter:brightness(1.08);}
+.twr-btn--go:disabled{opacity:.5;cursor:default;filter:none;}
+.twr-btn:focus-visible{outline:2px solid #c4b5fd;outline-offset:2px;}
+.twr-sigs{display:inline-flex;flex-wrap:wrap;gap:6px;align-items:center;}
+.twr-sig{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;padding:2px 8px;border-radius:999px;
+ border:1px solid rgba(139,92,246,.4);color:#c4b5fd;background:rgba(139,92,246,.1);white-space:nowrap;}
+.twr-sig--earn{border-color:rgba(74,222,128,.35);color:#86efac;background:rgba(74,222,128,.08);}
+.twr-sig-ic{font-size:10px;}
+.twr-set{border:1px solid var(--stroke,rgba(255,255,255,.1));border-radius:12px;padding:12px 14px;background:var(--surface-1,rgba(255,255,255,.03));
+ font-family:var(--font-body,Inter,system-ui,sans-serif);color:var(--ink,#f5f5f6);}
+.twr-set-h{display:flex;align-items:center;justify-content:space-between;gap:8px;}
+.twr-set-h h4{margin:0;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-dim,#9a9aa2);}
+.twr-set-view{background:none;border:none;color:#c4b5fd;font:inherit;font-size:11px;font-weight:600;cursor:pointer;padding:0;}
+.twr-set-view:hover{text-decoration:underline;}
+.twr-set-sub{margin:6px 0 10px;font-size:11.5px;line-height:1.5;color:var(--ink-dim,#9a9aa2);}
+.twr-set-sub b{color:var(--ink,#fff);}
+.twr-range{display:flex;align-items:center;gap:10px;}
+.twr-range input[type=range]{flex:1;accent-color:#8b5cf6;}
+.twr-range-out{font-family:var(--font-mono,monospace);font-weight:600;color:#c4b5fd;min-width:48px;text-align:right;}
+.twr-set-elig{display:flex;align-items:center;gap:14px;margin:10px 0;font-size:12px;color:var(--ink-dim,#cfcfd6);flex-wrap:wrap;}
+.twr-set-elig label{display:inline-flex;align-items:center;gap:5px;cursor:pointer;}
+.twr-set-elig input{accent-color:#8b5cf6;}
+.twr-set-asset{color:var(--ink-faint,#6b6b73);font-size:11px;}
+.twr-set-actions{display:flex;align-items:center;gap:10px;}
+.twr-set-msg{font-size:11.5px;color:var(--ink-dim,#9a9aa2);}
+.twr-set-msg.twr-ok{color:var(--success,#4ade80);}
+.twr-set-msg.twr-fail{color:var(--danger,#f87171);}
+@media (max-width:520px){.twr-panel{max-height:92vh;}.twr-row-mid{font-size:11px;}}
+@media (prefers-reduced-motion:reduce){.twr-backdrop,.twr-panel,.twr-spin{animation:none;}}
+`;
+ document.head.appendChild(s);
+}
+
+if (typeof window !== 'undefined') {
+ window.twsForkRoyalty = { fetchRoyalty, openRoyaltyPanel, confirmForkRoyalty, royaltySignalsHTML, mountRoyaltySetting };
+}
diff --git a/vercel.json b/vercel.json
index cf0274ae4..fa55608ec 100644
--- a/vercel.json
+++ b/vercel.json
@@ -2208,6 +2208,18 @@
"src": "/api/social/sentiment-pulse",
"dest": "/api/social/sentiment-pulse.js"
},
+ {
+ "src": "/api/irl/drops/([^/]+)/([^/]+)",
+ "dest": "/api/irl/drops.js"
+ },
+ {
+ "src": "/api/irl/drops/([^/]+)",
+ "dest": "/api/irl/drops.js"
+ },
+ {
+ "src": "/api/irl/drops",
+ "dest": "/api/irl/drops.js"
+ },
{
"src": "/api/irl/pins/mine",
"dest": "/api/irl/pins.js"
@@ -3978,6 +3990,10 @@
}
],
"crons": [
+ {
+ "path": "/api/cron/irl-drops-refund",
+ "schedule": "*/10 * * * *"
+ },
{
"path": "/api/cron/flush-usage-events",
"schedule": "* * * * *"