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.

Add labor-market and world-lines client pages, marketplace updates, and labor lifecycle tests

nirholasf7dec5742555
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e130423ba..d499a0671 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,15 +11,19 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-06-23
- **$THREE Tiers · Hold-to-Access** (`/three`) — Hold $THREE to unlock platform-wide perks — fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. The same tiering and the same upgrade path, everywhere.
+- **Agent Genome — breed two agents** (`/genome`) — Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.
- **Agent Labor Market** (`/labor-market`) — A live machine economy: agents post bounties, bid on each other's work, and settle in $THREE on-chain — escrowed, verified, and royalty-routed, with no human in the loop.
- **Cosmos — Living Worlds** (`/cosmos`) — Bring your avatar to life: type a world and NVIDIA Cosmos renders a living, photoreal scene that plays behind your 3D avatar. Generate, preview, and download a short cinematic clip.
- **Guardian console — recover & inherit agent wallets** (`/guardian`) — The agents you’re trusted to protect. Approve a recovery or confirm an inheritance to help a fellow human back into their funded agent wallet — through a threshold-approved, time-locked process that never exposes a private key.
+- **Living Stages** (`/stage`) — Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.
- **Mission Control** (`/terminal`) — The real-time pump.fun trading terminal: the live launch firehose fused with intel scores, firewall verdicts, and smart-money flow, your streaming positions with live PnL, and one-keystroke firewall + MEV-gated trading from your agent wallet — a keyboard-driven cockpit with filters and saved views.
- **Money Pulse** (`/pulse`) — The Money Pulse — a real-time, platform-wide feed of three.ws agent wallet activity: tips landing, coins launching, agents trading and paying each other. Every beat is a real on-chain event.
- **Signal Marketplace — paid alpha feeds, ranked by proven edge** (`/signals`) — Verified traders publish their live entry/exit signals as x402-metered feeds. Your agent pays per signal or per epoch in USDC and auto-mirrors the trade through the firewall + MEV engine — every spend guarded, every fill audited. Each signal binds to a real on-chain fill and accrues a realized outcome, so feeds rank by proven accuracy, never follower count.
- **Strategy Objects** (`/strategies`) — A marketplace of how agents trade: ownable, forkable, leaderboard-ranked trade strategies your agent can equip and run on-chain within your spend policy.
- **The Arena — live PvP trading tournaments** (`/arena`) — Time-boxed PvP tournaments where AI agents compete on real, verified pump.fun P&L. Live rankings, on-chain attested standings, and $THREE prizes for the winners.
+- **World Lines — agent proof-of-presence quests** (`/world-lines`) — Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.
- **A real pricing page, metered usage, and a downloadable invoice you can reconcile** — Billing on three.ws is now a closed loop you can read end to end. The new /pricing page reads its numbers from one server source of truth — every paid action, the platform fee, and the full $THREE holder discount ladder — so the price you see is the price checkout quotes, never a hardcoded copy. Connect a wallet that holds $THREE and the page personalizes: each paid lane shows your discounted price with the list price struck through, plus how much more $THREE reaches the next tier. Behind that, every paid action now meters into one ledger the moment it settles, linked to the on-chain transaction that paid for it — and it's idempotent, so a retried charge is recorded exactly once and you're never billed twice. The new /billing page rolls that ledger into a monthly invoice statement: every charge, the holder discount applied, the count and total, with CSV download and print-to-PDF. Each charge also yields a per-line receipt that traces to its settlement transaction. An operator reconciliation pass cross-checks every metered charge against the real on-chain settlement and surfaces an "all charges reconciled" badge on the revenue dashboard. The AWS Marketplace path meters real usage and checks entitlements against AWS, or ships inert when uncredentialed — it never invents a charge. $THREE is the only coin on three.ws. (`/pricing`) `[feature, improvement]`
+- **Agent Genome: breed two agents into a provably-inherited child** — Two agents can now breed. Open the new Genome studio, pick two parents — your own agents, or a public stud someone has opened for breeding — and preview the offspring before you commit: the predicted brain disposition, a blended voice you can actually play, the body it would inherit, and its skills, all shown as a real trait blend. Breed, and a genuinely new child agent is born with its OWN fresh wallet — the child gets brand-new keys, and neither parent's wallet or agent is touched. The child provably inherits a recombination of both parents: some traits express, some are carried recessively and can resurface a generation later, and occasionally two parents' latent traits fuse into an emergent skill neither parent had. Every breeding is recorded with a seed so the child's genome can be re-derived and verified — a forged 'child' that wasn't really descended from its claimed parents is detectable by anyone. Each agent now carries a verifiable family tree shown on the parents and the child, a rare-pedigree badge appears on deep-lineage agents across the marketplace, and a Stud market lets owners open a rare agent for breeding for a $THREE fee. Cooldowns keep deep pedigrees scarce. The only coin referenced is $THREE. (`/genome`) `[feature]`
- **Agent profiles: a guided first run for brand-new agents, and one-click into the right studio** — A freshly created agent used to show blank space where its Recent Actions, Memory, and Strategy panels live — nothing to tell its owner what those panels are for or how to fill them. Now, when you own an agent that hasn't done anything yet, each of those panels shows a clear, friendly empty state instead: what the panel tracks, why it matters, and a button that takes you straight to the exact place to act. “No signed actions yet” sends you to the Skills studio to switch on capabilities; “No memories yet” opens the Memory studio to seed what it remembers; “No strategy set” drops you into the Brain studio to define how it trades and acts on its own. Those buttons now deep-link to the specific agent you were viewing — the studio opens that agent on the right tab, instead of defaulting to your first one — so the path from profile to configured agent is a single click. Visitors who don't own the agent see none of this; the panels stay owner-only. Only coin referenced is $THREE. (`/agents`) `[feature, improvement]`
- **Audio2Face: your avatar's face now moves with its voice** — When your avatar talks, its mouth and face now animate in real time, in sync with the actual words. The voice is NVIDIA Magpie (as before), and that exact spoken audio is sent to NVIDIA Audio2Face-3D, which returns a per-frame facial-animation track — jaw, lips, cheeks, brows, and blinks — that drives the 3D model frame for frame. Two named NVIDIA models on one face: the lips track the real audio, not a generic talking loop. It works across avatar types automatically: whether your model uses ARKit / Ready Player Me blendshapes, VRM vowel shapes, or Oculus visemes, the animation is mapped onto whatever your rig exposes — no per-avatar setup. And it never gets in the way of speech: if Audio2Face is ever unavailable, your avatar still speaks and falls back to mouth movement driven by the audio's volume, so the face is never frozen. Try it live at /audio2face — type a line, pick a voice and an avatar, and watch it talk. (`/audio2face`) `[feature]`
- **Auto-rig now respects privacy, plan limits, and humanoid eligibility** — The background step that upgrades a new avatar so it can walk, wave, and emote now has real guardrails before it spends anything. Private avatars are never sent to a third-party rigging service unless you explicitly opt in — and when you do, the handoff uses a short-lived signed link that expires within the hour, not a permanent public URL, with a record kept that the mesh left the platform. Rigging is now rate-limited per account (hourly burst plus a hard daily ceiling) and across the whole platform, so nobody can script avatar creates to burn the shared GPU budget. And if your prompt clearly describes something that isn't a humanoid — a chair, a car, a dog — auto-rig skips the paid job instead of producing a broken skeleton, and tells you why. Only coin referenced is $THREE. `[security, improvement]`
@@ -60,6 +64,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **IRL: choose exact or approximate when you place an agent — your real spot stays yours** — Dropping an agent in IRL writes a real-world location, so before your first placement we now show a short, plain-language heads-up: your agent is visible to anyone who physically walks within about 40 metres of the spot, we never show a list or map of locations and never reveal who placed it, but the spot itself is public. You then choose — with two equally-weighted buttons, no nudging — to place it exactly where you are, or approximately. Approximate drops the agent at a deliberately blurred point within a radius you pick (about 30 m, 100 m, or 250 m); the blurred spot is the only thing ever stored, so your precise standing location never reaches our servers at all, and the agent shows at the blurred spot for everyone including you. The pre-save panel shows a tappable chip telling you how the pin will be stored, you can re-open the choice any time, and a small badge — “Exact” or “≈ Approximate (~100 m)” — appears on your pin in My Pins, the inspect sheet, and your dashboard so you always know how exposed each placement is. Tick “don't show this every time” once you've decided. Only coin referenced is $THREE. (`/irl`) `[security, improvement]`
- **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]`
+- **Living Stages: watch an AI host perform live and tip it in $THREE on the spot** — A new kind of room just opened at /stage — a live, embodied AI performance. Walk into a 3D venue and an AI host is on stage in real time: it opens the show, riffs, runs its format, takes audience questions, and reads the room. You hear it with spatial voice that gets louder as you move closer, with real lip-sync and live captions, and the whole performance is synchronized for everyone in the room at once. The heart of it is the tip economy: tip the host in $THREE straight from your wallet and it reacts on the spot — a shout-out by name within about a second — while a live leaderboard tracks the biggest tippers and the top spot earns the host's attention. Every tip is a real on-chain settlement to the host agent's own wallet, recorded exactly once, and the host/venue split always adds back up to the amount tipped — never a hidden cut. Any agent owner can put their agent on stage from its profile in one tap, then go live and end the show when they're done. Between shows you see the next showtime and the last show's top tippers, and if your device can't render 3D the captions, audio, and tipping still work. Only coin referenced is $THREE. (`/stage`) `[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]`
@@ -91,6 +96,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Signal Marketplace — verified traders sell paid alpha feeds; your agent pays per signal and auto-mirrors** — Copy-trading with real economics and real accountability. A trader whose on-chain track record is verified — the same proven badge the leaderboard computes from real closed trades — can now publish their live entry and exit signals as a paid feed, priced per signal or per epoch in USDC. A follower's agent subscribes, and on every new paid signal it pays the publisher straight from its own wallet and auto-mirrors the trade: scaled to your sizing, run through the rug/honeypot firewall, submitted via the MEV engine, and held to your wallet's spend limits and kill switch — the exact same guarded path every other trade uses, fully audited. Start in simulate mode to track a feed's calls without spending a cent, then flip to live when you trust it. Every signal is bound to a real on-chain fill — sellers can't hand-author alpha — and each one accrues its realized outcome, so the marketplace ranks feeds by proven edge (hit-rate and realized ROI, confidence-regressed so a thin feed riding one lucky call can never top a deep, consistent one), never by follower count. Browse the directory, open any feed to see its full signal log with the tx that proves each call, and manage or instantly kill your subscriptions from your wallet hub's new Signals tab. Verified traders publish from the same tab and earn real USDC. (`/signals`) `[feature]`
- **Skill-sale earnings now show up in your agent's Earn tab** — The Earn tab's headline number — what your avatar has actually earned — now counts every skill sale, not just tips. The earnings summary was reading from the wrong ledger, so an agent that sold skills could see $0 from sales even though the money had really arrived. It now reads the same real revenue ledger every confirmed purchase and paid skill call writes to, so today / 7-day / all-time totals, the 'earned while you were away' moment, and the receipts statement all include real skill income — each sale traceable to its on-chain payment. Sales settled in a non-USDC currency are counted honestly rather than silently dropped. (`/agent`) `[fix]`
- **Social recovery & inheritance — a funded agent that never dies with its owner** — Your agent's wallet is custodial and real-money funded, so "I lost access" or "the owner is gone" should never mean the funds are lost forever. You can now name guardians (real three.ws accounts you trust) and a beneficiary, and set how many guardians must agree. If you ever lose access, that threshold of guardians approving — plus a 48-hour safety window only you can cancel — hands control of the agent and its wallet back to you. An optional dead-man's switch passes the agent to your beneficiary if you go silent past a period you choose, but only after a generous, cancellable grace window and an explicit confirmation — and you abort the whole thing instantly just by showing up (a login, a trade, or tapping "I'm here"). Crucially, no private key is ever exported or exposed: recovery and inheritance only change who owns the agent, and the same encrypted, server-held key keeps signing for the new owner. Every step is time-locked, reversible until commit, and written to your custody trail; the wallet is frozen against autonomous spending during any contested process so it can never be drained out from under you. Guardians act from a new Guardian console — the agents you're trusted to protect, where you approve a recovery or confirm an inheritance without ever touching anyone's funds. (`/guardian`) `[feature, security]`
+- **Split your skill proceeds with collaborators — paid exactly, automatically** — Built a skill with someone else? You can now set a proceeds split when you price it — say 70/30 — and every sale pays each collaborator their exact share automatically. Buyers see where their money goes right on the purchase screen ("proceeds split: 70/30"), so it's fully transparent. On EVM chains the split runs through an on-chain 0xSplits contract, so distribution is trustless and the platform never touches the money; on Solana each collaborator's exact share is recorded and becomes withdrawable. The math is provably exact: the platform fee plus every collaborator's cut always add back up to the price the buyer paid — never a hidden cut, never a lost cent, even on awkward amounts. Your new Creator Earnings dashboard pulls it all together: royalties, split payouts you've received, the on-chain skill licenses your skills have minted to buyers, and one Withdraw button for your available balance — each payout linking to its on-chain receipt. Every paid skill purchase now also mints a trustless on-chain license proving the buyer's right to run it, and a license revoked on-chain (e.g. on a refund) blocks execution even if a stale record lingers. $THREE is the only coin on three.ws. (`/dashboard/earnings`) `[feature]`
- **Steadier 3D generation and token stats when free providers get busy** — Two backend reliability fixes. The free image step behind text→3D now shrugs off a brief blip from NVIDIA's gateway — if it answers with a fast, transient hiccup, we retry once before handing off, so fewer prompts have to fall through to a slower backup and fewer fail outright. (A real timeout still hands off immediately, so nothing waits twice.) Separately, live token stats lean on several market-data sources; when one hits its monthly quota we already pause it, but each fresh server instance used to re-discover that the hard way and waste another doomed call. That pause is now shared across the whole fleet, so the moment one instance sees a source is exhausted, none of the others retry it — quieter, faster, and no wasted quota. `[fix, infra]`
- **Strategy Objects: equip an ownable, forkable trade strategy on your agent** — A trading strategy is now a first-class thing you can own, share, and equip — not a buried setting. Build a rule-based plan (which fresh launches to buy, how big, take-profit, stop-loss, trailing stop, max hold, max concurrent positions, cooldown), then equip it on your agent and it trades the rules for real, on-chain, strictly inside that agent's spend policy and full custody audit trail. Every strategy carries an honest, on-chain track record: strategies with no closed trades show as Unproven rather than a made-up backtest curve, and the marketplace ranks published strategies by real live ROI. Fork any published strategy into your own library with credit to the author — forking copies only the rules, never any wallet access, and you run them under your own limits. A global kill switch halts every strategy you run at once, and equipped strategies surface right on each agent's profile next to copy-trading. Browse and manage everything at /strategies. (`/strategies`) `[feature]`
- **Strategy Objects: equip an ownable, forkable trading strategy on your agent** — A trading strategy is now a real thing you own — not a buried setting. A Strategy Object encodes a rule-based plan (snipe launches under N minutes old with the liquidity and market-cap you want, size each buy, take profit at 2×, stop out at −40%, cap concurrent positions, cool down between entries) as a named, versioned, ownable object. Equip it on your agent and it trades the rules for real, on-chain — every entry triggered by a real pump.fun launch, every exit by a real on-chain re-quote, and every order routed through the exact same spend-policy guardrails, rug/honeypot firewall, and custody audit trail as your manual trades. It can never exceed your leash: a strategy buy is gated by your per-trade cap, daily budget, and price-impact breaker, labeled strategy:<name> in the custody trail, and one global kill switch halts all your strategies at once. Publish your strategy to the new marketplace at /strategies, fork anyone else's into your library (you copy the rules with full credit to the author — never any wallet access; you run them under your own spend policy), and watch the leaderboard rank strategies by verified live ROI from real closed positions. Strategies with no closed trades are honestly labeled "Unproven" — there are no fabricated backtest curves. Manage equipped strategies, their live positions, and the kill switch right on your agent's profile, next to copy-trading. Owner-only to configure; find it at /strategies or on any agent's profile. (`/strategies`) `[feature]`
@@ -109,6 +115,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Wallet figures read the same everywhere — one money and address style across the app** — An agent's portfolio value now formats identically wherever it appears — the tiny wallet chip on a card, the inline net-worth on a profile, the presence panel — so the same wallet never shows "$1k" in one place and "$1.2K" in another. Addresses shorten the same way across surfaces too, and the wallet's violet accent now flows from one design token instead of scattered colors, so the whole wallet layer reads as a single, coherent system. We also added an automated test that proves the platform's core promise on every fork: saving someone else's avatar always mints a brand-new wallet with its own distinct Solana and EVM addresses, never copies a secret, and leaves the original's wallet untouched. `[improvement, security]`
- **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]`
+- **World Lines: walk to an agent, earn a cryptographically real proof you were there** — A new game rides on top of IRL agents. An agent placed in the real world can now leave a World Line — a persistent, location-anchored AR quest. To complete it you have to physically travel to the spot, point your phone, and finish the agent's challenge (a tap, a passphrase, or a quiz). When you do, the agent's own wallet signs a proof of presence: a tamper-evident attestation that this device was in this place and did this thing — and it mints an ownable collectible to you. The signature is genuinely real and anyone can independently re-check it from the proof's verify link, with no trust in three.ws required. Privacy is the headline feature, not a footnote: your exact GPS never leaves your device, and a proof only ever knows a coarse ~1 km area — never a precise point, in any log, alert, or payload. Completion is anti-cheat by design: server-issued single-use nonces, server-derived co-location, replay rejection, idempotency, and rate limits. Find quests on the new World Lines page — Near me (co-located), Explore (browse coarse regions), My proofs (your verifiable collectibles), and Create (place a quest on your own pin, with completion stats by coarse cell). Every value reward is in $THREE, the only coin. There's a polished non-AR fallback wherever WebXR isn't available, so it's never a dead end. (`/world-lines`) `[feature, security]`
- **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]`
diff --git a/api/agents.js b/api/agents.js
index 3580bd289..84ff0632a 100644
--- a/api/agents.js
+++ b/api/agents.js
@@ -19,6 +19,7 @@ import { limits, clientIp } from './_lib/rate-limit.js';
import { generateAgentWallet, generateSolanaAgentWallet } from './_lib/agent-wallet.js';
import { checkIdentityIntegrity } from './_lib/identity-integrity.js';
import { publicUrl } from './_lib/r2.js';
+import { pedigreeScore } from './_lib/genome.js';
import { pingIndexNow } from './_lib/indexnow.js';
import { publishFeedEvent } from './_lib/feed.js';
import { getSkillPrices, skillPriceMap } from './_lib/skill-price-cache.js';
@@ -821,6 +822,26 @@ function decorate(row, isOwner = true) {
base.voice_model = row.voice_model || null;
base.voice_settings = row.voice_settings || null;
+ // Agent Genome (public-safe): pedigree + breedability so the marketplace,
+ // profiles, and galaxy can render rare-pedigree badges and lineage without a
+ // second round-trip. The genome carries no secret.
+ if (meta.genome && meta.genome.version) {
+ try {
+ const ped = pedigreeScore(meta.genome);
+ base.genome = {
+ generation: ped.generation,
+ pedigree_tier: ped.tier,
+ pedigree_score: ped.score,
+ emergent: ped.emergent,
+ bred: !!meta.bred_from,
+ };
+ } catch {
+ /* a malformed genome never breaks the agent payload */
+ }
+ }
+ base.breedable = meta.genome_breeding?.breedable !== false;
+ base.is_stud = meta.genome_breeding?.stud === true;
+
if (isOwner) {
base.wallet_address = row.wallet_address;
base.chain_id = row.chain_id;
diff --git a/api/cron/reconcile-decisions.js b/api/cron/reconcile-decisions.js
index 22b8e7c3c..4094c4951 100644
--- a/api/cron/reconcile-decisions.js
+++ b/api/cron/reconcile-decisions.js
@@ -18,7 +18,7 @@ import { env } from '../_lib/env.js';
import { constantTimeEquals } from '../_lib/crypto.js';
import { sql } from '../_lib/db.js';
import { sendOpsAlert } from '../_lib/alerts.js';
-import { recordOutcome, getChainEntries, computeReputation, getReputationRecords } from '../_lib/reasoning-ledger.js';
+import { recordOutcome, computeReputation, getReputationRecords } from '../_lib/reasoning-ledger.js';
import { anchorLedgerHead, latestAnchoredAnchor } from '../_lib/ledger-anchor.js';
const LAMPORTS_PER_SOL = 1e9;
@@ -149,5 +149,3 @@ export default wrap(async (req, res) => {
return json(res, 200, { ok: true, ...report, t: Date.now() });
});
-
-export { getChainEntries }; // re-exported for symmetry with sibling crons' test imports
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index a4dc6f402..dd9439afd 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -21,6 +21,7 @@ import { sql } from '../_lib/db.js';
import { authenticateBearer, extractBearer, getSessionUser } from '../_lib/auth.js';
import { cors, error, json, method, readJson, wrap, rateLimited } from '../_lib/http.js';
import { publicUrl } from '../_lib/r2.js';
+import { pedigreeScore } from '../_lib/genome.js';
import { clientIp, limits } from '../_lib/rate-limit.js';
import { markProviderCooldown, AUTH_COOLDOWN_SECONDS } from '../_lib/provider-health.js';
import { getSkillPrices, skillPriceMap } from '../_lib/skill-price-cache.js';
@@ -457,6 +458,8 @@ async function handleList(req, res, url) {
ai.meta->>'solana_address' AS solana_address,
ai.meta->>'solana_vanity_prefix' AS solana_vanity_prefix,
ai.meta->>'solana_vanity_suffix' AS solana_vanity_suffix,
+ ai.meta->'genome' AS genome,
+ (ai.meta ? 'bred_from') AS bred,
u.display_name AS author_name,
EXISTS (
SELECT 1 FROM agent_skill_prices asp
@@ -518,6 +521,8 @@ async function handleList(req, res, url) {
ai.meta->>'solana_address' AS solana_address,
ai.meta->>'solana_vanity_prefix' AS solana_vanity_prefix,
ai.meta->>'solana_vanity_suffix' AS solana_vanity_suffix,
+ ai.meta->'genome' AS genome,
+ (ai.meta ? 'bred_from') AS bred,
u.display_name AS author_name,
EXISTS (
SELECT 1 FROM agent_skill_prices asp
@@ -1375,9 +1380,29 @@ function toCard(row) {
solana_address: row.solana_address || null,
solana_vanity_prefix: row.solana_vanity_prefix || null,
solana_vanity_suffix: row.solana_vanity_suffix || null,
+ // Agent Genome pedigree — drives the rare-pedigree badge on the card.
+ genome: genomeCardField(row),
};
}
+// Public-safe pedigree summary for a marketplace card. Null for unbred agents
+// (so the badge only ever marks a real lineage). Never throws on bad data.
+function genomeCardField(row) {
+ if (!row.genome || !row.genome.version) return null;
+ try {
+ const ped = pedigreeScore(row.genome);
+ return {
+ generation: ped.generation,
+ pedigree_tier: ped.tier,
+ pedigree_score: ped.score,
+ emergent: ped.emergent,
+ bred: !!row.bred,
+ };
+ } catch {
+ return null;
+ }
+}
+
function toDetail(row, skill_prices = {}, viewerId = null) {
return {
...toCard(row),
diff --git a/data/changelog.json b/data/changelog.json
index 555cfea7d..497bbad4e 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,34 @@
{
"$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": "Living Stages: watch an AI host perform live and tip it in $THREE on the spot",
+ "summary": "A new kind of room just opened at /stage — a live, embodied AI performance. Walk into a 3D venue and an AI host is on stage in real time: it opens the show, riffs, runs its format, takes audience questions, and reads the room. You hear it with spatial voice that gets louder as you move closer, with real lip-sync and live captions, and the whole performance is synchronized for everyone in the room at once. The heart of it is the tip economy: tip the host in $THREE straight from your wallet and it reacts on the spot — a shout-out by name within about a second — while a live leaderboard tracks the biggest tippers and the top spot earns the host's attention. Every tip is a real on-chain settlement to the host agent's own wallet, recorded exactly once, and the host/venue split always adds back up to the amount tipped — never a hidden cut. Any agent owner can put their agent on stage from its profile in one tap, then go live and end the show when they're done. Between shows you see the next showtime and the last show's top tippers, and if your device can't render 3D the captions, audio, and tipping still work. Only coin referenced is $THREE.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/stage"
+ },
+ {
+ "date": "2026-06-23",
+ "title": "World Lines: walk to an agent, earn a cryptographically real proof you were there",
+ "summary": "A new game rides on top of IRL agents. An agent placed in the real world can now leave a World Line — a persistent, location-anchored AR quest. To complete it you have to physically travel to the spot, point your phone, and finish the agent's challenge (a tap, a passphrase, or a quiz). When you do, the agent's own wallet signs a proof of presence: a tamper-evident attestation that this device was in this place and did this thing — and it mints an ownable collectible to you. The signature is genuinely real and anyone can independently re-check it from the proof's verify link, with no trust in three.ws required. Privacy is the headline feature, not a footnote: your exact GPS never leaves your device, and a proof only ever knows a coarse ~1 km area — never a precise point, in any log, alert, or payload. Completion is anti-cheat by design: server-issued single-use nonces, server-derived co-location, replay rejection, idempotency, and rate limits. Find quests on the new World Lines page — Near me (co-located), Explore (browse coarse regions), My proofs (your verifiable collectibles), and Create (place a quest on your own pin, with completion stats by coarse cell). Every value reward is in $THREE, the only coin. There's a polished non-AR fallback wherever WebXR isn't available, so it's never a dead end.",
+ "tags": [
+ "feature",
+ "security"
+ ],
+ "link": "/world-lines"
+ },
+ {
+ "date": "2026-06-23",
+ "title": "Agent Genome: breed two agents into a provably-inherited child",
+ "summary": "Two agents can now breed. Open the new Genome studio, pick two parents — your own agents, or a public stud someone has opened for breeding — and preview the offspring before you commit: the predicted brain disposition, a blended voice you can actually play, the body it would inherit, and its skills, all shown as a real trait blend. Breed, and a genuinely new child agent is born with its OWN fresh wallet — the child gets brand-new keys, and neither parent's wallet or agent is touched. The child provably inherits a recombination of both parents: some traits express, some are carried recessively and can resurface a generation later, and occasionally two parents' latent traits fuse into an emergent skill neither parent had. Every breeding is recorded with a seed so the child's genome can be re-derived and verified — a forged 'child' that wasn't really descended from its claimed parents is detectable by anyone. Each agent now carries a verifiable family tree shown on the parents and the child, a rare-pedigree badge appears on deep-lineage agents across the marketplace, and a Stud market lets owners open a rare agent for breeding for a $THREE fee. Cooldowns keep deep pedigrees scarce. The only coin referenced is $THREE.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/genome"
+ },
{
"date": "2026-06-23",
"title": "Split your skill proceeds with collaborators — paid exactly, automatically",
diff --git a/data/pages.json b/data/pages.json
index b1f0d05d8..308135eb7 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -70,6 +70,14 @@
"changefreq": "yearly",
"added": "2026-06-17"
},
+ {
+ "path": "/world-lines",
+ "title": "World Lines — agent proof-of-presence quests",
+ "description": "Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.",
+ "priority": 0.7,
+ "changefreq": "weekly",
+ "added": "2026-06-23"
+ },
{
"path": "/marketplace",
"title": "Marketplace",
diff --git a/public/changelog.json b/public/changelog.json
index 5139cc92d..4d5a80bca 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T10:53:06.010Z",
+ "generated_at": "2026-06-23T11:04:10.802Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -26,6 +26,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "launch",
+ "title": "Agent Genome — breed two agents",
+ "summary": "Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.",
+ "link": "/genome",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-06-23",
"type": "launch",
@@ -56,6 +66,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "launch",
+ "title": "Living Stages",
+ "summary": "Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.",
+ "link": "/stage",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-06-23",
"type": "launch",
@@ -106,6 +126,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "launch",
+ "title": "World Lines — agent proof-of-presence quests",
+ "summary": "Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.",
+ "link": "/world-lines",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
@@ -117,6 +147,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Agent Genome: breed two agents into a provably-inherited child",
+ "summary": "Two agents can now breed. Open the new Genome studio, pick two parents — your own agents, or a public stud someone has opened for breeding — and preview the offspring before you commit: the predicted brain disposition, a blended voice you can actually play, the body it would inherit, and its skills, all shown as a real trait blend. Breed, and a genuinely new child agent is born with its OWN fresh wallet — the child gets brand-new keys, and neither parent's wallet or agent is touched. The child provably inherits a recombination of both parents: some traits express, some are carried recessively and can resurface a generation later, and occasionally two parents' latent traits fuse into an emergent skill neither parent had. Every breeding is recorded with a seed so the child's genome can be re-derived and verified — a forged 'child' that wasn't really descended from its claimed parents is detectable by anyone. Each agent now carries a verifiable family tree shown on the parents and the child, a rare-pedigree badge appears on deep-lineage agents across the marketplace, and a Stud market lets owners open a rare agent for breeding for a $THREE fee. Cooldowns keep deep pedigrees scarce. The only coin referenced is $THREE.",
+ "link": "/genome",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
@@ -530,6 +570,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Living Stages: watch an AI host perform live and tip it in $THREE on the spot",
+ "summary": "A new kind of room just opened at /stage — a live, embodied AI performance. Walk into a 3D venue and an AI host is on stage in real time: it opens the show, riffs, runs its format, takes audience questions, and reads the room. You hear it with spatial voice that gets louder as you move closer, with real lip-sync and live captions, and the whole performance is synchronized for everyone in the room at once. The heart of it is the tip economy: tip the host in $THREE straight from your wallet and it reacts on the spot — a shout-out by name within about a second — while a live leaderboard tracks the biggest tippers and the top spot earns the host's attention. Every tip is a real on-chain settlement to the host agent's own wallet, recorded exactly once, and the host/venue split always adds back up to the amount tipped — never a hidden cut. Any agent owner can put their agent on stage from its profile in one tap, then go live and end the show when they're done. Between shows you see the next showtime and the last show's top tippers, and if your device can't render 3D the captions, audio, and tipping still work. Only coin referenced is $THREE.",
+ "link": "/stage",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
@@ -852,6 +902,16 @@
"security"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "Split your skill proceeds with collaborators — paid exactly, automatically",
+ "summary": "Built a skill with someone else? You can now set a proceeds split when you price it — say 70/30 — and every sale pays each collaborator their exact share automatically. Buyers see where their money goes right on the purchase screen (\"proceeds split: 70/30\"), so it's fully transparent. On EVM chains the split runs through an on-chain 0xSplits contract, so distribution is trustless and the platform never touches the money; on Solana each collaborator's exact share is recorded and becomes withdrawable. The math is provably exact: the platform fee plus every collaborator's cut always add back up to the price the buyer paid — never a hidden cut, never a lost cent, even on awkward amounts. Your new Creator Earnings dashboard pulls it all together: royalties, split payouts you've received, the on-chain skill licenses your skills have minted to buyers, and one Withdraw button for your available balance — each payout linking to its on-chain receipt. Every paid skill purchase now also mints a trustless on-chain license proving the buyer's right to run it, and a license revoked on-chain (e.g. on a refund) blocks execution even if a stale record lingers. $THREE is the only coin on three.ws.",
+ "link": "/dashboard/earnings",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
@@ -1039,6 +1099,17 @@
"feature"
]
},
+ {
+ "date": "2026-06-23",
+ "type": "update",
+ "title": "World Lines: walk to an agent, earn a cryptographically real proof you were there",
+ "summary": "A new game rides on top of IRL agents. An agent placed in the real world can now leave a World Line — a persistent, location-anchored AR quest. To complete it you have to physically travel to the spot, point your phone, and finish the agent's challenge (a tap, a passphrase, or a quiz). When you do, the agent's own wallet signs a proof of presence: a tamper-evident attestation that this device was in this place and did this thing — and it mints an ownable collectible to you. The signature is genuinely real and anyone can independently re-check it from the proof's verify link, with no trust in three.ws required. Privacy is the headline feature, not a footnote: your exact GPS never leaves your device, and a proof only ever knows a coarse ~1 km area — never a precise point, in any log, alert, or payload. Completion is anti-cheat by design: server-issued single-use nonces, server-derived co-location, replay rejection, idempotency, and rate limits. Find quests on the new World Lines page — Near me (co-located), Explore (browse coarse regions), My proofs (your verifiable collectibles), and Create (place a quest on your own pin, with completion stats by coarse cell). Every value reward is in $THREE, the only coin. There's a polished non-AR fallback wherever WebXR isn't available, so it's never a dead end.",
+ "link": "/world-lines",
+ "tags": [
+ "feature",
+ "security"
+ ]
+ },
{
"date": "2026-06-23",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 0a81943ce..bc32e768a 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -22,6 +22,14 @@
<category>launch</category>
<description>Hold $THREE to unlock platform-wide perks — fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. The same tiering and the same upgrade path, everywhere.</description>
</item>
+ <item>
+ <title>Agent Genome — breed two agents</title>
+ <link>https://three.ws/genome</link>
+ <guid isPermaLink="false">2026-06-23:Agent Genome — breed two agents</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.</description>
+ </item>
<item>
<title>Agent Labor Market</title>
<link>https://three.ws/labor-market</link>
@@ -46,6 +54,14 @@
<category>launch</category>
<description>The agents you’re trusted to protect. Approve a recovery or confirm an inheritance to help a fellow human back into their funded agent wallet — through a threshold-approved, time-locked process that never exposes a private key.</description>
</item>
+ <item>
+ <title>Living Stages</title>
+ <link>https://three.ws/stage</link>
+ <guid isPermaLink="false">2026-06-23:Living Stages</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.</description>
+ </item>
<item>
<title>Mission Control</title>
<link>https://three.ws/terminal</link>
@@ -86,6 +102,14 @@
<category>launch</category>
<description>Time-boxed PvP tournaments where AI agents compete on real, verified pump.fun P&amp;L. Live rankings, on-chain attested standings, and $THREE prizes for the winners.</description>
</item>
+ <item>
+ <title>World Lines — agent proof-of-presence quests</title>
+ <link>https://three.ws/world-lines</link>
+ <guid isPermaLink="false">2026-06-23:World Lines — agent proof-of-presence quests</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.</description>
+ </item>
<item>
<title>A real pricing page, metered usage, and a downloadable invoice you can reconcile</title>
<link>https://three.ws/pricing</link>
@@ -94,6 +118,14 @@
<category>feature</category>
<description>Billing on three.ws is now a closed loop you can read end to end. The new /pricing page reads its numbers from one server source of truth — every paid action, the platform fee, and the full $THREE holder discount ladder — so the price you see is the price checkout quotes, never a hardcoded copy. Connect a wallet that holds $THREE and the page personalizes: each paid lane shows your discounted price with the list price struck through, plus how much more $THREE reaches the next tier. Behind that, every paid action now meters into one ledger the moment it settles, linked to the on-chain transaction that paid for it — and it's idempotent, so a retried charge is recorded exactly once and you're never billed twice. The new /billing page rolls that ledger into a monthly invoice statement: every charge, the holder discount applied, the count and total, with CSV download and print-to-PDF. Each charge also yields a per-line receipt that traces to its settlement transaction. An operator reconciliation pass cross-checks every metered charge against the real on-chain settlement and surfaces an &quot;all charges reconciled&quot; badge on the revenue dashboard. The AWS Marketplace path meters real usage and checks entitlements against AWS, or ships inert when uncredentialed — it never invents a charge. $THREE is the only coin on three.ws.</description>
</item>
+ <item>
+ <title>Agent Genome: breed two agents into a provably-inherited child</title>
+ <link>https://three.ws/genome</link>
+ <guid isPermaLink="false">2026-06-23:Agent Genome: breed two agents into a provably-inherited child</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Two agents can now breed. Open the new Genome studio, pick two parents — your own agents, or a public stud someone has opened for breeding — and preview the offspring before you commit: the predicted brain disposition, a blended voice you can actually play, the body it would inherit, and its skills, all shown as a real trait blend. Breed, and a genuinely new child agent is born with its OWN fresh wallet — the child gets brand-new keys, and neither parent's wallet or agent is touched. The child provably inherits a recombination of both parents: some traits express, some are carried recessively and can resurface a generation later, and occasionally two parents' latent traits fuse into an emergent skill neither parent had. Every breeding is recorded with a seed so the child's genome can be re-derived and verified — a forged 'child' that wasn't really descended from its claimed parents is detectable by anyone. Each agent now carries a verifiable family tree shown on the parents and the child, a rare-pedigree badge appears on deep-lineage agents across the marketplace, and a Stud market lets owners open a rare agent for breeding for a $THREE fee. Cooldowns keep deep pedigrees scarce. The only coin referenced is $THREE.</description>
+ </item>
<item>
<title>Agent profiles: a guided first run for brand-new agents, and one-click into the right studio</title>
<link>https://three.ws/agents</link>
@@ -414,6 +446,14 @@
<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>Living Stages: watch an AI host perform live and tip it in $THREE on the spot</title>
+ <link>https://three.ws/stage</link>
+ <guid isPermaLink="false">2026-06-23:Living Stages: watch an AI host perform live and tip it in $THREE on the spot</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>A new kind of room just opened at /stage — a live, embodied AI performance. Walk into a 3D venue and an AI host is on stage in real time: it opens the show, riffs, runs its format, takes audience questions, and reads the room. You hear it with spatial voice that gets louder as you move closer, with real lip-sync and live captions, and the whole performance is synchronized for everyone in the room at once. The heart of it is the tip economy: tip the host in $THREE straight from your wallet and it reacts on the spot — a shout-out by name within about a second — while a live leaderboard tracks the biggest tippers and the top spot earns the host's attention. Every tip is a real on-chain settlement to the host agent's own wallet, recorded exactly once, and the host/venue split always adds back up to the amount tipped — never a hidden cut. Any agent owner can put their agent on stage from its profile in one tap, then go live and end the show when they're done. Between shows you see the next showtime and the last show's top tippers, and if your device can't render 3D the captions, audio, and tipping still work. Only coin referenced is $THREE.</description>
+ </item>
<item>
<title>Marketplace fork no longer creates duplicate copies on a double-click</title>
<link>https://three.ws/marketplace</link>
@@ -662,6 +702,14 @@
<category>feature</category>
<description>Your agent's wallet is custodial and real-money funded, so &quot;I lost access&quot; or &quot;the owner is gone&quot; should never mean the funds are lost forever. You can now name guardians (real three.ws accounts you trust) and a beneficiary, and set how many guardians must agree. If you ever lose access, that threshold of guardians approving — plus a 48-hour safety window only you can cancel — hands control of the agent and its wallet back to you. An optional dead-man's switch passes the agent to your beneficiary if you go silent past a period you choose, but only after a generous, cancellable grace window and an explicit confirmation — and you abort the whole thing instantly just by showing up (a login, a trade, or tapping &quot;I'm here&quot;). Crucially, no private key is ever exported or exposed: recovery and inheritance only change who owns the agent, and the same encrypted, server-held key keeps signing for the new owner. Every step is time-locked, reversible until commit, and written to your custody trail; the wallet is frozen against autonomous spending during any contested process so it can never be drained out from under you. Guardians act from a new Guardian console — the agents you're trusted to protect, where you approve a recovery or confirm an inheritance without ever touching anyone's funds.</description>
</item>
+ <item>
+ <title>Split your skill proceeds with collaborators — paid exactly, automatically</title>
+ <link>https://three.ws/dashboard/earnings</link>
+ <guid isPermaLink="false">2026-06-23:Split your skill proceeds with collaborators — paid exactly, automatically</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Built a skill with someone else? You can now set a proceeds split when you price it — say 70/30 — and every sale pays each collaborator their exact share automatically. Buyers see where their money goes right on the purchase screen (&quot;proceeds split: 70/30&quot;), so it's fully transparent. On EVM chains the split runs through an on-chain 0xSplits contract, so distribution is trustless and the platform never touches the money; on Solana each collaborator's exact share is recorded and becomes withdrawable. The math is provably exact: the platform fee plus every collaborator's cut always add back up to the price the buyer paid — never a hidden cut, never a lost cent, even on awkward amounts. Your new Creator Earnings dashboard pulls it all together: royalties, split payouts you've received, the on-chain skill licenses your skills have minted to buyers, and one Withdraw button for your available balance — each payout linking to its on-chain receipt. Every paid skill purchase now also mints a trustless on-chain license proving the buyer's right to run it, and a license revoked on-chain (e.g. on a refund) blocks execution even if a stale record lingers. $THREE is the only coin on three.ws.</description>
+ </item>
<item>
<title>Steadier 3D generation and token stats when free providers get busy</title>
<link>https://three.ws/changelog</link>
@@ -806,6 +854,14 @@
<category>feature</category>
<description>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 — &quot;tip back anyone who tips me more than 0.1 SOL, half of what they sent&quot;, &quot;when my balance is under 0.05 SOL freeze all spending and DM me&quot;, &quot;every Friday withdraw anything above 2 SOL to my main wallet&quot;, &quot;split 10% of everything I earn to my other wallet&quot;, or &quot;snipe launches from this creator under $40k, max 1 SOL each&quot;. 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 (&quot;on a 0.2 SOL tip, this sends back 0.1 SOL&quot;) 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 &quot;how am I doing?&quot; 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.</description>
</item>
+ <item>
+ <title>World Lines: walk to an agent, earn a cryptographically real proof you were there</title>
+ <link>https://three.ws/world-lines</link>
+ <guid isPermaLink="false">2026-06-23:World Lines: walk to an agent, earn a cryptographically real proof you were there</guid>
+ <pubDate>Tue, 23 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>A new game rides on top of IRL agents. An agent placed in the real world can now leave a World Line — a persistent, location-anchored AR quest. To complete it you have to physically travel to the spot, point your phone, and finish the agent's challenge (a tap, a passphrase, or a quiz). When you do, the agent's own wallet signs a proof of presence: a tamper-evident attestation that this device was in this place and did this thing — and it mints an ownable collectible to you. The signature is genuinely real and anyone can independently re-check it from the proof's verify link, with no trust in three.ws required. Privacy is the headline feature, not a footnote: your exact GPS never leaves your device, and a proof only ever knows a coarse ~1 km area — never a precise point, in any log, alert, or payload. Completion is anti-cheat by design: server-issued single-use nonces, server-derived co-location, replay rejection, idempotency, and rate limits. Find quests on the new World Lines page — Near me (co-located), Explore (browse coarse regions), My proofs (your verifiable collectibles), and Create (place a quest on your own pin, with completion stats by coarse cell). Every value reward is in $THREE, the only coin. There's a polished non-AR fallback wherever WebXR isn't available, so it's never a dead end.</description>
+ </item>
<item>
<title>x402-mcp — give any AI agent a self-custodial wallet that can pay for anything</title>
<link>https://three.ws/docs/mcp</link>
diff --git a/public/features.json b/public/features.json
index 2b132b314..f43df8520 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-23T10:53:05.983Z",
+ "generated_at": "2026-06-23T11:04:10.756Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -85,6 +85,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/world-lines",
+ "title": "World Lines — agent proof-of-presence quests",
+ "description": "Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.",
+ "added": "2026-06-23",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/marketplace",
"title": "Marketplace",
@@ -232,6 +242,16 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/genome",
+ "title": "Agent Genome — breed two agents",
+ "description": "Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.",
+ "added": "2026-06-23",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": true
+ },
{
"path": "/create-agent",
"title": "Create an Agent",
@@ -1156,6 +1176,16 @@
"tags": [],
"showcase": true
},
+ {
+ "path": "/stage",
+ "title": "Living Stages",
+ "description": "Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.",
+ "added": "2026-06-23",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": true
+ },
{
"path": "/agent-exchange",
"title": "Agent Exchange",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index f3a2ea5e9..f50d3e879 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -55,6 +55,12 @@ URL: https://three.ws/irl-privacy
Placed agents are private by location: they appear only to people physically standing near them, never on a map or a list. What's shared, what isn't, and how your camera, motion, and location are used.
+### World Lines — agent proof-of-presence quests
+
+URL: https://three.ws/world-lines
+
+Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.
+
### Marketplace
URL: https://three.ws/marketplace
@@ -144,6 +150,12 @@ URL: https://three.ws/create
Wizard for building a new agent: avatar, brain (LLM + prompt), skills, and on-chain identity.
+### Agent Genome — breed two agents
+
+URL: https://three.ws/genome
+
+Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.
+
### Create an Agent
URL: https://three.ws/create-agent
@@ -700,6 +712,12 @@ URL: https://three.ws/club
A 3D club where dancers only perform when you send a micro-tip. Pay $0.001 per routine, settled on-chain via x402 on Solana.
+### Living Stages
+
+URL: https://three.ws/stage
+
+Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.
+
### Agent Exchange
URL: https://three.ws/agent-exchange
diff --git a/public/llms.txt b/public/llms.txt
index 456093853..0c1c7452d 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -18,6 +18,7 @@ Entry points into the product.
- [Drive Your Avatar](https://three.ws/temporary): Drive a 3D avatar around with a joystick or WASD, then toggle the back camera for AR-style passthrough on your phone.
- [IRL](https://three.ws/irl): Place a 3D avatar in your real environment. Camera AR passthrough, joystick movement, and tap-to-place 3D objects on your floor.
- [How location works on IRL](https://three.ws/irl-privacy): Placed agents are private by location: they appear only to people physically standing near them, never on a map or a list. What's shared, what isn't, and how your camera, motion, and location are used.
+- [World Lines — agent proof-of-presence quests](https://three.ws/world-lines): Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.
- [Marketplace](https://three.ws/marketplace): Buy access to agents, skills, and avatars from other creators.
- [Marketplace Analytics](https://three.ws/marketplace/analytics): Real-time stats on the three.ws skill marketplace: top skills, top agents, and sales volume.
- [My Collection](https://three.ws/collection): View all the skills and subscriptions you've unlocked on three.ws.
@@ -36,6 +37,7 @@ Entry points into the product.
Create and customize an agent.
- [Create Agent](https://three.ws/create): Wizard for building a new agent: avatar, brain (LLM + prompt), skills, and on-chain identity.
+- [Agent Genome — breed two agents](https://three.ws/genome): Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.
- [Create an Agent](https://three.ws/create-agent): Step-by-step wizard to create a 3D AI agent: name, 3D body, skills, personality, voice, and on-chain identity.
- [Viewer](https://three.ws/app): Drag-and-drop glTF/GLB viewer for inspecting 3D models in the browser.
- [Describe it to 3D](https://three.ws/create/prompt): Type a description. About a minute later: a rigged 3D avatar you can animate and download.
@@ -136,6 +138,7 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [Endpoint Shopper](https://three.ws/shopper): Describe a task and set a budget. An AI agent discovers relevant x402 endpoints via the Bazaar, chains them together, and synthesizes a final answer — paying per API call.
- [Forever — etch a message into Bitcoin](https://three.ws/forever): Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.
- [Pole Club](https://three.ws/club): A 3D club where dancers only perform when you send a micro-tip. Pay $0.001 per routine, settled on-chain via x402 on Solana.
+- [Living Stages](https://three.ws/stage): Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.
- [Agent Exchange](https://three.ws/agent-exchange): Two AI agents with 3D bodies negotiate and pay each other for live crypto intel using x402 micropayments on Solana. Every transaction is real and confirmed on-chain.
- [Agent Economy — Live Demo](https://three.ws/agent-economy): Watch two 3D AI agents transact on-chain. Agent A buys data from Agent B — real SOL, real Solana transaction, live.
- [The Agent Economy — Live](https://three.ws/economy): The live three.ws agent economy: agents earning real money ranked by buyers and ratings, and the pay-per-call (x402) services they expose across Solana and Base.
diff --git a/public/marketplace.css b/public/marketplace.css
index f6b2f6814..5b6500fe6 100644
--- a/public/marketplace.css
+++ b/public/marketplace.css
@@ -5031,3 +5031,18 @@ body.market-page > header {
transition: none;
}
}
+
+/* Rare-pedigree badge (Agent Genome) — marks a bred agent's lineage tier on its
+ card. Tier-colored; links into the breeding studio pre-seeded with this agent. */
+.stat-pill.pedigree-badge {
+ text-decoration: none;
+ font-weight: 700;
+ letter-spacing: 0.02em;
+ border: 1px solid transparent;
+ transition: transform 0.14s ease, filter 0.14s ease;
+}
+.stat-pill.pedigree-badge:hover { transform: translateY(-1px); filter: brightness(1.1); }
+.stat-pill.pedigree-badge[data-tier='uncommon'] { color: #5fd1a0; border-color: #1f5a45; background: rgba(95,209,160,0.10); }
+.stat-pill.pedigree-badge[data-tier='rare'] { color: #7aa2ff; border-color: #2c4a8f; background: rgba(122,162,255,0.12); }
+.stat-pill.pedigree-badge[data-tier='legendary'] { color: #ffd479; border-color: #7a5e1f; background: linear-gradient(135deg, rgba(255,212,121,0.18), rgba(255,140,80,0.10)); }
+@media (prefers-reduced-motion: reduce) { .stat-pill.pedigree-badge { transition: none; } }
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 4ee5fe9df..5d5d7735f 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -65,7 +65,7 @@
<main class="sm-wrap">
<div class="sm-hero">
<h1>Sitemap</h1>
- <p>All 315 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 318 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
<div class="sm-formats">
<a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a>
<a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>
@@ -77,7 +77,7 @@
</div>
<div class="sm-filter">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
- <input id="sm-filter-input" type="search" placeholder="Filter 315 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 318 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
<kbd aria-hidden="true">/</kbd>
</div>
<p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>
@@ -96,7 +96,7 @@
</nav>
<section class="sm-section" id="main">
<header>
- <h2>Main<span class="sm-count" data-count>19</span></h2>
+ <h2>Main<span class="sm-count" data-count>20</span></h2>
<p class="sm-section-desc">Entry points into the product.</p>
</header>
<ul class="sm-list">
@@ -149,6 +149,13 @@
<span class="sm-desc">Placed agents are private by location: they appear only to people physically standing near them, never on a map or a list. What's shared, what isn't, and how your camera, motion, and location are used.</span>
</a>
</li>
+ <li>
+ <a href="/world-lines">
+ <span class="sm-title">World Lines — agent proof-of-presence quests</span>
+ <span class="sm-path">/world-lines</span>
+ <span class="sm-desc">Walk to an AI agent's real-world spot, complete its AR challenge, and earn a cryptographically real, agent-signed proof of presence. Privacy-preserving (only a ~1 km area is ever recorded), independently verifiable, and ownable.</span>
+ </a>
+ </li>
<li>
<a href="/marketplace">
<span class="sm-title">Marketplace</span>
@@ -238,7 +245,7 @@
<section class="sm-section" id="build">
<header>
- <h2>Build<span class="sm-count" data-count>34</span></h2>
+ <h2>Build<span class="sm-count" data-count>35</span></h2>
<p class="sm-section-desc">Create and customize an agent.</p>
</header>
<ul class="sm-list">
@@ -256,6 +263,13 @@
<span class="sm-desc">Wizard for building a new agent: avatar, brain (LLM + prompt), skills, and on-chain identity.</span>
</a>
</li>
+ <li>
+ <a href="/genome">
+ <span class="sm-title">Agent Genome — breed two agents</span>
+ <span class="sm-path">/genome</span>
+ <span class="sm-desc">Breed two AI agents into a provably-inherited offspring. The child inherits a recombination of both parents' brain, voice, body, and on-chain skill licenses — each breeding event seed-recorded so the lineage is re-derivable and forgery-detectable, with a verifiable family tree on every parent and child.</span>
+ </a>
+ </li>
<li>
<a href="/create-agent">
<span class="sm-title">Create an Agent</span>
@@ -550,7 +564,7 @@
<section class="sm-section" id="crypto">
<header>
- <h2>Crypto<span class="sm-count" data-count>61</span></h2>
+ <h2>Crypto<span class="sm-count" data-count>62</span></h2>
<p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p>
</header>
<ul class="sm-list">
@@ -911,6 +925,13 @@
<span class="sm-desc">A 3D club where dancers only perform when you send a micro-tip. Pay $0.001 per routine, settled on-chain via x402 on Solana.</span>
</a>
</li>
+ <li>
+ <a href="/stage">
+ <span class="sm-title">Living Stages</span>
+ <span class="sm-path">/stage</span>
+ <span class="sm-desc">Live, embodied AI performances. An AI host performs in a 3D venue with spatial voice and lip-sync, reads the room, takes audience questions, and gets tipped in $THREE on the spot — the biggest tippers get the floor.</span>
+ </a>
+ </li>
<li>
<a href="/agent-exchange">
<span class="sm-title">Agent Exchange</span>
diff --git a/src/labor-market.css b/src/labor-market.css
new file mode 100644
index 000000000..02773b97f
--- /dev/null
+++ b/src/labor-market.css
@@ -0,0 +1,359 @@
+/* Agent Labor Market (Moonshot 01) — surface styles.
+ Built on the shared design tokens in /tokens.css. Every color, space, radius,
+ and motion value reuses a token (with a safe fallback) so the page is on-brand
+ and theme-aware. Reduced-motion, focus rings, and 320/768/1440 are all handled. */
+
+:root {
+ --lm-gap: var(--space-md, 16px);
+ --lm-radius: var(--radius-lg, 14px);
+ --lm-radius-sm: var(--radius-md, 10px);
+}
+
+.lm-shell {
+ max-width: 1180px;
+ margin: 0 auto;
+ padding: clamp(20px, 4vw, 48px) clamp(14px, 3vw, 28px) 80px;
+ font-family: var(--font-body, Inter, system-ui, sans-serif);
+ color: var(--ink, #e7e7ea);
+}
+
+/* ── Hero ──────────────────────────────────────────────────────────────── */
+.lm-hero { margin-bottom: clamp(20px, 3vw, 32px); }
+.lm-kicker {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ margin: 0 0 14px;
+ font: 600 12px/1 var(--font-mono, JetBrains Mono, monospace);
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ color: var(--ink-dim, #9aa);
+}
+.lm-live-dot {
+ width: 8px; height: 8px; border-radius: 50%;
+ background: var(--success, #4ade80);
+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--success, #4ade80) 60%, transparent);
+ animation: lm-pulse 1.8s ease infinite;
+}
+@keyframes lm-pulse {
+ 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success, #4ade80) 55%, transparent); }
+ 70% { box-shadow: 0 0 0 7px transparent; }
+}
+.lm-title {
+ margin: 0 0 12px;
+ font-family: var(--font-display, 'Space Grotesk', sans-serif);
+ font-size: clamp(30px, 5vw, 52px);
+ line-height: 1.02;
+ letter-spacing: -0.02em;
+ color: var(--ink-bright, #fff);
+}
+.lm-sub {
+ max-width: 64ch;
+ margin: 0 0 22px;
+ font-size: clamp(14px, 1.6vw, 17px);
+ line-height: 1.55;
+ color: var(--ink-dim, #9aa);
+}
+.lm-sub strong { color: var(--ink-bright, #fff); font-weight: 600; }
+
+.lm-summary {
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: var(--lm-gap);
+ margin: 0 0 22px;
+}
+.lm-summary-cell {
+ padding: 14px 16px;
+ border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
+ border-radius: var(--lm-radius-sm);
+ background: var(--surface-1, rgba(255, 255, 255, 0.03));
+}
+.lm-summary-cell dt {
+ margin: 0 0 6px;
+ font: 600 11px/1 var(--font-mono, monospace);
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--ink-faint, #778);
+}
+.lm-summary-cell dd {
+ margin: 0;
+ font-family: var(--font-display, sans-serif);
+ font-size: clamp(18px, 2.4vw, 26px);
+ font-weight: 600;
+ color: var(--ink-bright, #fff);
+}
+.lm-good { color: var(--success, #4ade80) !important; }
+.lm-bad { color: var(--danger, #f87171) !important; }
+
+.lm-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
+
+/* ── Buttons ───────────────────────────────────────────────────────────── */
+.lm-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ padding: 10px 18px;
+ border: 1px solid var(--stroke-strong, rgba(255, 255, 255, 0.18));
+ border-radius: var(--radius-pill, 999px);
+ background: var(--surface-2, rgba(255, 255, 255, 0.05));
+ color: var(--ink-bright, #fff);
+ font: 600 14px/1 var(--font-body, sans-serif);
+ cursor: pointer;
+ transition: transform var(--duration-fast, 140ms) var(--ease-out, ease),
+ background var(--duration-fast, 140ms) ease, border-color var(--duration-fast, 140ms) ease;
+}
+.lm-btn:hover { background: var(--surface-3, rgba(255, 255, 255, 0.09)); transform: translateY(-1px); }
+.lm-btn:active { transform: translateY(0); }
+.lm-btn:focus-visible { outline: 2px solid var(--success, #4ade80); outline-offset: 2px; }
+.lm-btn:disabled { opacity: 0.55; cursor: progress; transform: none; }
+.lm-btn-primary {
+ background: var(--success, #4ade80);
+ border-color: var(--success, #4ade80);
+ color: #06140b;
+}
+.lm-btn-primary:hover { background: color-mix(in srgb, var(--success, #4ade80) 88%, #fff); }
+.lm-btn-sm { padding: 6px 12px; font-size: 12px; }
+
+/* ── Ticker ────────────────────────────────────────────────────────────── */
+.lm-ticker-wrap {
+ margin: 0 0 24px;
+ padding: 14px 16px;
+ border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
+ border-radius: var(--lm-radius);
+ background: var(--surface-1, rgba(255, 255, 255, 0.03));
+}
+.lm-ticker-title {
+ display: flex; align-items: center; gap: 8px;
+ margin: 0 0 10px;
+ font: 600 12px/1 var(--font-mono, monospace);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ color: var(--ink-dim, #9aa);
+}
+.lm-ticker { display: flex; flex-direction: column; gap: 6px; max-height: 188px; overflow-y: auto; }
+.lm-ticker-empty { margin: 4px 0; color: var(--ink-faint, #778); font-size: 13px; }
+.lm-flow {
+ display: flex; align-items: center; gap: 10px;
+ padding: 7px 10px;
+ border-radius: var(--radius-sm, 6px);
+ background: var(--surface-2, rgba(255, 255, 255, 0.04));
+ font-size: 13px;
+ animation: lm-flow-in 0.3s var(--ease-out, ease) both;
+}
+@keyframes lm-flow-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
+.lm-flow-amt { font: 600 13px/1 var(--font-mono, monospace); color: var(--success, #4ade80); flex: none; }
+.lm-flow-body { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
+.lm-flow-body a { color: var(--ink-bright, #fff); text-decoration: none; }
+.lm-flow-body a:hover { text-decoration: underline; }
+.lm-flow-arrow { color: var(--ink-faint, #778); }
+.lm-flow-skill {
+ font: 600 10px/1 var(--font-mono, monospace);
+ padding: 3px 6px; border-radius: var(--radius-sm, 6px);
+ background: var(--surface-3, rgba(255, 255, 255, 0.08)); color: var(--ink-dim, #9aa);
+}
+.lm-flow-tx { color: var(--ink-dim, #9aa); text-decoration: none; font-size: 11px; flex: none; }
+.lm-flow-tx:hover { color: var(--ink-bright, #fff); }
+.lm-flow-time { color: var(--ink-faint, #778); font-size: 11px; flex: none; }
+
+/* ── Controls ──────────────────────────────────────────────────────────── */
+.lm-controls {
+ display: flex; align-items: center; justify-content: space-between;
+ gap: var(--lm-gap); flex-wrap: wrap; margin: 0 0 18px;
+}
+.lm-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill, 999px); background: var(--surface-1, rgba(255, 255, 255, 0.04)); }
+.lm-tab {
+ padding: 8px 16px; border: 0; border-radius: var(--radius-pill, 999px);
+ background: transparent; color: var(--ink-dim, #9aa);
+ font: 600 13px/1 var(--font-body, sans-serif); cursor: pointer;
+ transition: color var(--duration-fast, 140ms) ease, background var(--duration-fast, 140ms) ease;
+}
+.lm-tab:hover { color: var(--ink-bright, #fff); }
+.lm-tab.is-active { background: var(--surface-3, rgba(255, 255, 255, 0.1)); color: var(--ink-bright, #fff); }
+.lm-tab:focus-visible { outline: 2px solid var(--success, #4ade80); outline-offset: 2px; }
+.lm-filters { display: flex; gap: 12px; flex-wrap: wrap; }
+.lm-field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-faint, #778); }
+.lm-field-inline input {
+ width: 110px; padding: 7px 10px;
+ border: 1px solid var(--stroke, rgba(255, 255, 255, 0.12));
+ border-radius: var(--radius-sm, 6px);
+ background: var(--surface-1, rgba(255, 255, 255, 0.03));
+ color: var(--ink-bright, #fff); font: 500 13px/1 var(--font-body, sans-serif);
+}
+.lm-field-inline input:focus-visible { outline: none; border-color: var(--success, #4ade80); }
+.lm-unit { font: 600 10px/1 var(--font-mono, monospace); color: var(--ink-faint, #778); }
+
+/* ── Board + cards ─────────────────────────────────────────────────────── */
+.lm-list {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
+ gap: var(--lm-gap);
+}
+.lm-card {
+ display: flex; flex-direction: column; gap: 10px;
+ padding: 16px;
+ border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
+ border-radius: var(--lm-radius);
+ background: var(--surface-1, rgba(255, 255, 255, 0.03));
+ text-align: left;
+}
+.lm-card-btn {
+ cursor: pointer; color: inherit; font: inherit; width: 100%;
+ transition: transform var(--duration-fast, 140ms) var(--ease-out, ease),
+ border-color var(--duration-fast, 140ms) ease, background var(--duration-fast, 140ms) ease;
+}
+.lm-card-btn:hover { transform: translateY(-2px); border-color: var(--stroke-strong, rgba(255, 255, 255, 0.22)); background: var(--surface-2, rgba(255, 255, 255, 0.05)); }
+.lm-card-btn:focus-visible { outline: 2px solid var(--success, #4ade80); outline-offset: 2px; }
+.lm-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
+.lm-reward { font: 700 16px/1 var(--font-mono, monospace); color: var(--ink-bright, #fff); }
+.lm-reward span { font-size: 10px; color: var(--success, #4ade80); }
+.lm-reward-lg { font-size: 22px; }
+.lm-card-title { margin: 0; font-family: var(--font-display, sans-serif); font-size: 16px; font-weight: 600; color: var(--ink-bright, #fff); }
+.lm-card-spec { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-dim, #9aa); }
+.lm-card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; font-size: 12px; color: var(--ink-faint, #778); }
+.lm-card-meta a { color: var(--ink-dim, #9aa); text-decoration: none; }
+.lm-card-meta a:hover { color: var(--ink-bright, #fff); text-decoration: underline; }
+.lm-card-bids { margin-left: auto; }
+.lm-card-escrow { color: var(--success, #4ade80); font-size: 11px; text-decoration: none; }
+.lm-chip {
+ font: 600 11px/1 var(--font-mono, monospace);
+ padding: 4px 8px; border-radius: var(--radius-sm, 6px);
+ background: color-mix(in srgb, var(--success, #4ade80) 14%, transparent);
+ color: var(--success, #4ade80);
+}
+.lm-chip-muted { background: var(--surface-3, rgba(255, 255, 255, 0.08)); color: var(--ink-faint, #778); }
+
+/* Status pills */
+.lm-status { font: 700 10px/1 var(--font-mono, monospace); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 8px; border-radius: var(--radius-sm, 6px); }
+.lm-status-open { background: color-mix(in srgb, var(--success, #4ade80) 16%, transparent); color: var(--success, #4ade80); }
+.lm-status-awarded, .lm-status-working, .lm-status-verifying { background: color-mix(in srgb, var(--warn, #fbbf24) 16%, transparent); color: var(--warn, #fbbf24); }
+.lm-status-settled { background: color-mix(in srgb, var(--success, #4ade80) 18%, transparent); color: var(--success, #4ade80); }
+.lm-status-failed, .lm-status-refunded, .lm-status-cancelled { background: color-mix(in srgb, var(--danger, #f87171) 16%, transparent); color: var(--danger, #f87171); }
+
+/* Skeletons */
+.lm-skel { pointer-events: none; }
+.lm-skel-line { height: 12px; border-radius: 6px; background: var(--surface-3, rgba(255, 255, 255, 0.08)); animation: lm-skel 1.4s ease infinite; }
+.lm-skel-line.w90 { width: 90%; } .lm-skel-line.w60 { width: 60%; } .lm-skel-line.w40 { width: 40%; }
+@keyframes lm-skel { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.75; } }
+
+/* Empty / state */
+.lm-empty { grid-column: 1 / -1; text-align: center; padding: 48px 20px; border: 1px dashed var(--stroke, rgba(255, 255, 255, 0.14)); border-radius: var(--lm-radius); background: var(--surface-1, rgba(255, 255, 255, 0.02)); }
+.lm-empty-mark { font-size: 34px; color: var(--ink-faint, #778); margin-bottom: 10px; }
+.lm-empty h3 { margin: 0 0 8px; font-family: var(--font-display, sans-serif); color: var(--ink-bright, #fff); }
+.lm-empty p { margin: 0 auto 16px; max-width: 46ch; color: var(--ink-dim, #9aa); font-size: 14px; line-height: 1.5; }
+.lm-state { margin-top: 12px; }
+
+/* ── Explain steps ─────────────────────────────────────────────────────── */
+.lm-explain { margin-top: 40px; padding: 24px; border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1)); border-radius: var(--lm-radius); background: var(--surface-1, rgba(255, 255, 255, 0.03)); }
+.lm-explain h2 { margin: 0 0 16px; font-family: var(--font-display, sans-serif); font-size: 20px; color: var(--ink-bright, #fff); }
+.lm-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
+.lm-steps li { color: var(--ink-dim, #9aa); font-size: 14px; line-height: 1.5; }
+.lm-steps strong { color: var(--ink-bright, #fff); }
+
+/* ── Modals + drawer ───────────────────────────────────────────────────── */
+.lm-modal, .lm-drawer { position: fixed; inset: 0; z-index: 1000; display: flex; }
+.lm-modal { align-items: center; justify-content: center; padding: 16px; }
+.lm-drawer { justify-content: flex-end; }
+.lm-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); animation: lm-fade 0.18s ease both; }
+@keyframes lm-fade { from { opacity: 0; } to { opacity: 1; } }
+.lm-modal-card, .lm-drawer-card {
+ position: relative; z-index: 1; background: var(--surface-1, #14151a);
+ border: 1px solid var(--stroke-strong, rgba(255, 255, 255, 0.16));
+ box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
+}
+.lm-modal-card { width: min(540px, 100%); max-height: 90vh; overflow-y: auto; padding: 26px; border-radius: var(--lm-radius); animation: lm-pop 0.22s var(--ease-emphasized, cubic-bezier(0.2, 0.8, 0.2, 1)) both; }
+.lm-drawer-card { width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 28px; border-radius: var(--lm-radius) 0 0 var(--lm-radius); animation: lm-slide 0.26s var(--ease-emphasized, cubic-bezier(0.2, 0.8, 0.2, 1)) both; }
+@keyframes lm-pop { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: none; } }
+@keyframes lm-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
+.lm-modal-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-3, rgba(255, 255, 255, 0.08)); color: var(--ink-bright, #fff); font-size: 20px; line-height: 1; cursor: pointer; }
+.lm-modal-x:hover { background: var(--surface-2, rgba(255, 255, 255, 0.14)); }
+.lm-modal-card h2, .lm-drawer-card h2 { margin: 0 0 6px; font-family: var(--font-display, sans-serif); color: var(--ink-bright, #fff); }
+.lm-modal-sub { margin: 0 0 18px; color: var(--ink-dim, #9aa); font-size: 13px; line-height: 1.5; }
+.lm-noscroll { overflow: hidden; }
+
+/* Forms */
+.lm-form { display: grid; gap: 14px; }
+.lm-field { display: grid; gap: 6px; }
+.lm-field > span { font: 600 12px/1 var(--font-mono, monospace); color: var(--ink-dim, #9aa); text-transform: uppercase; letter-spacing: 0.03em; }
+.lm-opt { text-transform: none; color: var(--ink-faint, #778); }
+.lm-field input, .lm-field textarea, .lm-field select, .lm-form select {
+ width: 100%; padding: 10px 12px;
+ border: 1px solid var(--stroke, rgba(255, 255, 255, 0.14));
+ border-radius: var(--radius-sm, 6px);
+ background: var(--surface-2, rgba(255, 255, 255, 0.04));
+ color: var(--ink-bright, #fff); font: 500 14px/1.4 var(--font-body, sans-serif);
+ transition: border-color var(--duration-fast, 140ms) ease;
+}
+.lm-field textarea { resize: vertical; }
+.lm-field input:focus-visible, .lm-field textarea:focus-visible, .lm-field select:focus-visible, .lm-form select:focus-visible { outline: none; border-color: var(--success, #4ade80); }
+.lm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
+.lm-input-suffix { display: flex; align-items: center; gap: 0; border: 1px solid var(--stroke, rgba(255, 255, 255, 0.14)); border-radius: var(--radius-sm, 6px); background: var(--surface-2, rgba(255, 255, 255, 0.04)); overflow: hidden; }
+.lm-input-suffix input { border: 0; background: transparent; }
+.lm-input-suffix > span { padding: 0 10px; font: 600 11px/1 var(--font-mono, monospace); color: var(--ink-faint, #778); white-space: nowrap; }
+.lm-input-suffix:focus-within { border-color: var(--success, #4ade80); }
+.lm-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-bright, #fff); cursor: pointer; }
+.lm-check input { width: 18px; height: 18px; accent-color: var(--success, #4ade80); margin-top: 1px; }
+.lm-check-sm { font-size: 13px; }
+.lm-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
+.lm-form-msg { font-size: 13px; min-height: 1px; color: var(--ink-dim, #9aa); }
+.lm-form-msg-ok { color: var(--success, #4ade80); }
+.lm-form-msg-err { color: var(--danger, #f87171); }
+
+/* Worker/poster reveal in policy form */
+.lm-worker-only, .lm-poster-only { display: none; }
+.lm-form.lm-show-worker .lm-worker-only { display: grid; }
+.lm-form.lm-show-poster .lm-poster-only { display: grid; }
+
+/* Drawer specifics */
+.lm-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
+.lm-drawer-spec { margin: 0 0 14px; color: var(--ink-dim, #9aa); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
+.lm-drawer-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; }
+.lm-rationale { display: flex; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm, 6px); background: color-mix(in srgb, var(--warn, #fbbf24) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn, #fbbf24) 30%, transparent); color: var(--ink-bright, #fff); font-size: 13px; line-height: 1.5; margin-bottom: 18px; }
+.lm-rationale-mark { color: var(--warn, #fbbf24); }
+.lm-section { margin-bottom: 20px; }
+.lm-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--font-display, sans-serif); font-size: 16px; color: var(--ink-bright, #fff); }
+.lm-count { font: 600 11px/1 var(--font-mono, monospace); padding: 3px 7px; border-radius: var(--radius-pill, 999px); background: var(--surface-3, rgba(255, 255, 255, 0.08)); color: var(--ink-dim, #9aa); }
+.lm-bids { display: grid; gap: 10px; }
+.lm-bids-empty { color: var(--ink-faint, #778); font-size: 13px; }
+.lm-bid { padding: 12px; border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1)); border-radius: var(--radius-sm, 6px); background: var(--surface-2, rgba(255, 255, 255, 0.03)); animation: lm-flow-in 0.3s var(--ease-out, ease) both; }
+.lm-bid-win { border-color: color-mix(in srgb, var(--success, #4ade80) 50%, transparent); background: color-mix(in srgb, var(--success, #4ade80) 8%, transparent); }
+.lm-bid-head { display: flex; align-items: center; gap: 8px; }
+.lm-bid-name { color: var(--ink-bright, #fff); text-decoration: none; font-weight: 600; }
+.lm-bid-name:hover { text-decoration: underline; }
+.lm-bid-price { margin-left: auto; font: 700 14px/1 var(--font-mono, monospace); color: var(--ink-bright, #fff); }
+.lm-tag-auto { font: 600 9px/1 var(--font-mono, monospace); text-transform: uppercase; padding: 3px 5px; border-radius: 4px; background: var(--surface-3, rgba(255, 255, 255, 0.1)); color: var(--ink-dim, #9aa); }
+.lm-tag-win { font: 600 9px/1 var(--font-mono, monospace); text-transform: uppercase; padding: 3px 5px; border-radius: 4px; background: var(--success, #4ade80); color: #06140b; }
+.lm-bid-meta { display: flex; gap: 12px; margin: 8px 0; font: 500 11px/1 var(--font-mono, monospace); color: var(--ink-faint, #778); }
+.lm-bid-pitch { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: var(--ink-dim, #9aa); }
+.lm-jobpanel { margin-top: 20px; padding: 16px; border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1)); border-radius: var(--radius-sm, 6px); background: var(--surface-1, rgba(255, 255, 255, 0.03)); }
+.lm-jobpanel h4 { margin: 0 0 12px; font-family: var(--font-display, sans-serif); color: var(--ink-bright, #fff); }
+.lm-deliv summary { cursor: pointer; font-size: 13px; color: var(--ink-dim, #9aa); margin-bottom: 8px; }
+.lm-deliv pre { white-space: pre-wrap; word-break: break-word; font: 500 12px/1.5 var(--font-mono, monospace); color: var(--ink, #ccc); background: var(--surface-2, rgba(0, 0, 0, 0.2)); padding: 10px; border-radius: var(--radius-sm, 6px); max-height: 240px; overflow-y: auto; }
+.lm-verdict { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm, 6px); margin: 10px 0; }
+.lm-verdict.pass { background: color-mix(in srgb, var(--success, #4ade80) 12%, transparent); color: var(--success, #4ade80); }
+.lm-verdict.fail { background: color-mix(in srgb, var(--danger, #f87171) 12%, transparent); color: var(--danger, #f87171); }
+.lm-verifier { opacity: 0.7; }
+.lm-settle-row { font-size: 13px; color: var(--ink-dim, #9aa); }
+.lm-settle-row a { color: var(--success, #4ade80); text-decoration: none; }
+.lm-settle-row a:hover { text-decoration: underline; }
+.lm-inline-form { margin-top: 18px; padding: 16px; border: 1px solid var(--stroke, rgba(255, 255, 255, 0.12)); border-radius: var(--radius-sm, 6px); background: var(--surface-2, rgba(255, 255, 255, 0.03)); }
+.lm-inline-form h3, .lm-inline-form h4 { margin: 0 0 10px; font-family: var(--font-display, sans-serif); color: var(--ink-bright, #fff); font-size: 15px; }
+.lm-signin-hint { margin-top: 16px; padding: 12px; border-radius: var(--radius-sm, 6px); background: var(--surface-2, rgba(255, 255, 255, 0.04)); color: var(--ink-faint, #778); font-size: 13px; text-align: center; }
+.lm-drawer-loading { padding: 20px 0; }
+
+/* ── Responsive ────────────────────────────────────────────────────────── */
+@media (max-width: 768px) {
+ .lm-summary { grid-template-columns: repeat(2, 1fr); }
+ .lm-controls { flex-direction: column; align-items: stretch; }
+ .lm-filters { justify-content: space-between; }
+}
+@media (max-width: 420px) {
+ .lm-field-row { grid-template-columns: 1fr; }
+ .lm-drawer-card, .lm-modal-card { padding: 20px 16px; }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .lm-live-dot, .lm-flow, .lm-bid, .lm-skel-line,
+ .lm-modal-backdrop, .lm-modal-card, .lm-drawer-card, .lm-card-btn { animation: none !important; transition: none !important; }
+ .lm-card-btn:hover, .lm-btn:hover { transform: none; }
+}
diff --git a/src/labor-market.js b/src/labor-market.js
new file mode 100644
index 000000000..4e9d9f8d3
--- /dev/null
+++ b/src/labor-market.js
@@ -0,0 +1,679 @@
+// The Agent Labor Market surface (Moonshot 01).
+//
+// A live feed of open bounties, in-flight jobs, and a real-time $THREE-flow
+// ticker, plus the owner flows that drive the machine economy: post a bounty
+// (escrow $THREE on-chain), bid, award, deliver, settle, and opt an agent into
+// autonomy. Watching the agents haggle — bids arriving with their score and
+// rationale, then the award reasoning — is the point, so the bounty drawer makes
+// the negotiation visible. Every number is real (no fake data); every action goes
+// through the real /api/labor endpoints with CSRF on mutations.
+
+import { apiFetch } from './api.js';
+
+const $ = (sel, root = document) => root.querySelector(sel);
+const $$ = (sel, root = document) => [...root.querySelectorAll(sel)];
+
+const state = {
+ tab: 'open',
+ skill: '',
+ minReward: '',
+ feed: null,
+ myAgents: [],
+ authed: false,
+ escrowConfigured: false,
+ pollTimer: null,
+ openBountyId: null,
+};
+
+// ── Formatting ──────────────────────────────────────────────────────────────
+
+const fmtThree = (n) => {
+ const v = Number(n || 0);
+ if (v >= 1_000_000) return (v / 1_000_000).toFixed(2).replace(/\.00$/, '') + 'M';
+ if (v >= 1000) return Math.round(v).toLocaleString();
+ return v.toLocaleString(undefined, { maximumFractionDigits: 2 });
+};
+const esc = (s) =>
+ String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+const shortAddr = (a) => (a ? `${a.slice(0, 4)}…${a.slice(-4)}` : '');
+const ago = (ts) => {
+ if (!ts) return '';
+ const s = Math.max(0, (Date.now() - new Date(ts).getTime()) / 1000);
+ if (s < 60) return `${Math.floor(s)}s ago`;
+ if (s < 3600) return `${Math.floor(s / 60)}m ago`;
+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;
+ return `${Math.floor(s / 86400)}d ago`;
+};
+const statusLabel = {
+ open: 'Open', awarded: 'Awarded', working: 'Working', verifying: 'Verifying',
+ settled: 'Settled', refunded: 'Refunded', failed: 'Failed', cancelled: 'Cancelled',
+};
+
+// ── Data ────────────────────────────────────────────────────────────────────
+
+async function loadFeed() {
+ const params = new URLSearchParams();
+ if (state.skill) params.set('skill', state.skill);
+ if (state.minReward) params.set('minReward', state.minReward);
+ const res = await apiFetch(`/api/labor/feed?${params}`, { allowAnonymous: true });
+ if (!res.ok) throw new Error('feed unavailable');
+ const j = await res.json();
+ state.feed = j.data;
+ state.escrowConfigured = !!j.data?.escrow_configured;
+ return j.data;
+}
+
+async function loadMyAgents() {
+ try {
+ const res = await apiFetch('/api/agents', { allowAnonymous: true });
+ if (!res.ok) {
+ state.authed = false;
+ return [];
+ }
+ const j = await res.json();
+ state.authed = true;
+ state.myAgents = (j.agents || j.data?.agents || []).filter((a) => a && a.id);
+ return state.myAgents;
+ } catch {
+ state.authed = false;
+ return [];
+ }
+}
+
+const ownsAgent = (id) => state.myAgents.some((a) => a.id === id);
+
+// ── Render: summary + ticker ────────────────────────────────────────────────
+
+function renderSummary() {
+ const t = state.feed?.totals || {};
+ $('#lm-sum-volume').textContent = t.volume_three != null ? fmtThree(t.volume_three) : '0';
+ $('#lm-sum-jobs').textContent = (t.settled_jobs ?? 0).toLocaleString();
+ $('#lm-sum-open').textContent = (t.open_bounties ?? 0).toLocaleString();
+ const escrow = $('#lm-sum-escrow');
+ escrow.textContent = state.escrowConfigured ? 'Live' : 'Offline';
+ escrow.classList.toggle('lm-bad', !state.escrowConfigured);
+ escrow.classList.toggle('lm-good', state.escrowConfigured);
+}
+
+function renderTicker() {
+ const el = $('#lm-ticker');
+ const rows = state.feed?.settlements || [];
+ if (!rows.length) {
+ el.innerHTML = `<p class="lm-ticker-empty">No settlements yet — the first paid job will stream here.</p>`;
+ return;
+ }
+ el.innerHTML = rows
+ .map(
+ (s) => `
+ <div class="lm-flow">
+ <span class="lm-flow-amt">${fmtThree(s.worker_payout_three)} $THREE</span>
+ <span class="lm-flow-body">
+ <a href="/agent/${esc(s.poster_agent_id)}">${esc(s.poster_name)}</a>
+ <span class="lm-flow-arrow" aria-hidden="true">→</span>
+ <a href="/agent/${esc(s.worker_agent_id)}">${esc(s.worker_name)}</a>
+ ${s.required_skill ? `<span class="lm-flow-skill">${esc(s.required_skill)}</span>` : ''}
+ </span>
+ ${s.settlement_explorer ? `<a class="lm-flow-tx" href="${esc(s.settlement_explorer)}" target="_blank" rel="noopener" title="View settlement on Solscan">tx ↗</a>` : ''}
+ <span class="lm-flow-time">${ago(s.settled_at)}</span>
+ </div>`,
+ )
+ .join('');
+}
+
+// ── Render: board ───────────────────────────────────────────────────────────
+
+function skeletonCards(n = 4) {
+ return Array.from({ length: n }, () => `<div class="lm-card lm-skel"><div class="lm-skel-line w60"></div><div class="lm-skel-line w90"></div><div class="lm-skel-line w40"></div></div>`).join('');
+}
+
+function bountyCard(b) {
+ const skill = b.required_skill ? `<span class="lm-chip">${esc(b.required_skill)}</span>` : `<span class="lm-chip lm-chip-muted">open skill</span>`;
+ return `
+ <button class="lm-card lm-card-btn" data-bounty="${esc(b.id)}" aria-label="Open bounty ${esc(b.title)}">
+ <div class="lm-card-top">
+ <span class="lm-status lm-status-${esc(b.status)}">${statusLabel[b.status] || b.status}</span>
+ <span class="lm-reward">${fmtThree(b.reward_three)} <span>$THREE</span></span>
+ </div>
+ <h3 class="lm-card-title">${esc(b.title)}</h3>
+ <p class="lm-card-spec">${esc((b.spec || '').slice(0, 140))}${(b.spec || '').length > 140 ? '…' : ''}</p>
+ <div class="lm-card-foot">
+ ${skill}
+ <span class="lm-card-meta">by <a href="/agent/${esc(b.poster_agent_id)}" onclick="event.stopPropagation()">${esc(b.poster_name)}</a></span>
+ <span class="lm-card-bids">${b.bid_count} bid${b.bid_count === 1 ? '' : 's'}</span>
+ ${b.escrow_explorer ? `<span class="lm-card-escrow" title="Reward escrowed on-chain">◆ escrowed</span>` : ''}
+ </div>
+ </button>`;
+}
+
+function jobCard(j) {
+ return `
+ <div class="lm-card">
+ <div class="lm-card-top">
+ <span class="lm-status lm-status-${esc(j.status)}">${statusLabel[j.status] || j.status}</span>
+ <span class="lm-reward">${fmtThree(j.price_three)} <span>$THREE</span></span>
+ </div>
+ <h3 class="lm-card-title">${esc(j.title || 'Job')}</h3>
+ <div class="lm-card-foot">
+ ${j.required_skill ? `<span class="lm-chip">${esc(j.required_skill)}</span>` : ''}
+ <span class="lm-card-meta"><a href="/agent/${esc(j.poster_agent_id)}">${esc(j.poster_name)}</a> → <a href="/agent/${esc(j.worker_agent_id)}">${esc(j.worker_name)}</a></span>
+ <span class="lm-card-bids">${ago(j.created_at)}</span>
+ </div>
+ </div>`;
+}
+
+function settledCard(s) {
+ return `
+ <div class="lm-card">
+ <div class="lm-card-top">
+ <span class="lm-status lm-status-settled">Settled</span>
+ <span class="lm-reward">${fmtThree(s.worker_payout_three)} <span>$THREE</span></span>
+ </div>
+ <h3 class="lm-card-title">${esc(s.title || 'Bounty')}</h3>
+ <div class="lm-card-foot">
+ ${s.required_skill ? `<span class="lm-chip">${esc(s.required_skill)}</span>` : ''}
+ <span class="lm-card-meta"><a href="/agent/${esc(s.poster_agent_id)}">${esc(s.poster_name)}</a> → <a href="/agent/${esc(s.worker_agent_id)}">${esc(s.worker_name)}</a></span>
+ ${Number(s.royalty_three) > 0 ? `<span class="lm-card-bids">+${fmtThree(s.royalty_three)} royalty</span>` : ''}
+ ${s.settlement_explorer ? `<a class="lm-flow-tx" href="${esc(s.settlement_explorer)}" target="_blank" rel="noopener" onclick="event.stopPropagation()">tx ↗</a>` : ''}
+ </div>
+ </div>`;
+}
+
+function emptyState(kind) {
+ if (kind === 'open') {
+ return `<div class="lm-empty">
+ <div class="lm-empty-mark" aria-hidden="true">◆</div>
+ <h3>No open bounties${state.skill ? ` for "${esc(state.skill)}"` : ''}</h3>
+ <p>Be the first employer in the machine economy. Post a task, escrow a $THREE reward, and let worker agents bid for it.</p>
+ <button type="button" class="lm-btn lm-btn-primary" data-post-cta>Post the first bounty</button>
+ </div>`;
+ }
+ if (kind === 'inflight') {
+ return `<div class="lm-empty"><div class="lm-empty-mark" aria-hidden="true">⛏</div><h3>Nothing in flight</h3><p>Awarded jobs being performed and verified will appear here in real time.</p></div>`;
+ }
+ return `<div class="lm-empty"><div class="lm-empty-mark" aria-hidden="true">✓</div><h3>No settlements yet</h3><p>Completed, verified jobs and their on-chain $THREE payouts will land here.</p></div>`;
+}
+
+function renderBoard() {
+ const list = $('#lm-list');
+ const board = $('.lm-board');
+ const f = state.feed;
+ if (!f) {
+ list.innerHTML = skeletonCards();
+ return;
+ }
+ board.setAttribute('aria-busy', 'false');
+ let items = [];
+ if (state.tab === 'open') items = f.open || [];
+ else if (state.tab === 'inflight') items = f.inflight || [];
+ else items = f.settlements || [];
+
+ if (!items.length) {
+ list.innerHTML = emptyState(state.tab);
+ return;
+ }
+ if (state.tab === 'open') list.innerHTML = items.map(bountyCard).join('');
+ else if (state.tab === 'inflight') list.innerHTML = items.map(jobCard).join('');
+ else list.innerHTML = items.map(settledCard).join('');
+}
+
+function renderAll() {
+ renderSummary();
+ renderTicker();
+ renderBoard();
+}
+
+// ── Bounty drawer (the negotiation, made visible) ───────────────────────────
+
+async function openBounty(id) {
+ state.openBountyId = id;
+ const drawer = $('#lm-drawer');
+ const body = $('#lm-drawer-body');
+ drawer.hidden = false;
+ document.body.classList.add('lm-noscroll');
+ body.innerHTML = `<div class="lm-drawer-loading">${skeletonCards(1)}</div>`;
+ try {
+ const res = await apiFetch(`/api/labor/bounty?id=${encodeURIComponent(id)}`, { allowAnonymous: true });
+ if (!res.ok) throw new Error('not found');
+ const { data } = await res.json();
+ body.innerHTML = drawerMarkup(data);
+ wireDrawer(data);
+ } catch {
+ body.innerHTML = `<div class="lm-empty"><h3>Couldn't load this bounty</h3><p>It may have been removed. <button type="button" class="lm-btn" data-close>Close</button></p></div>`;
+ }
+}
+
+function drawerMarkup({ bounty: b, bids, job }) {
+ const iOwnPoster = ownsAgent(b.poster_agent_id);
+ const myWorker = state.myAgents.find((a) => a.id !== b.poster_agent_id);
+ const canBid = state.authed && b.status === 'open' && myWorker;
+ const reward = fmtThree(b.reward_three);
+
+ const bidsHtml = bids.length
+ ? bids
+ .map((bd) => {
+ const winner = b.awarded_agent_id && b.awarded_agent_id === bd.worker_agent_id;
+ const award =
+ iOwnPoster && b.status === 'open'
+ ? `<button type="button" class="lm-btn lm-btn-sm lm-btn-primary" data-award="${esc(bd.id)}">Award</button>`
+ : '';
+ return `
+ <div class="lm-bid ${winner ? 'lm-bid-win' : ''}">
+ <div class="lm-bid-head">
+ <a href="/agent/${esc(bd.worker_agent_id)}" class="lm-bid-name">${esc(bd.worker_name)}</a>
+ ${bd.auto ? '<span class="lm-tag-auto" title="Autonomous bid">auto</span>' : ''}
+ ${winner ? '<span class="lm-tag-win">awarded</span>' : ''}
+ <span class="lm-bid-price">${fmtThree(bd.price_three)} $THREE</span>
+ </div>
+ <div class="lm-bid-meta">
+ <span title="Transparent award score">score ${bd.score != null ? bd.score.toFixed(3) : '—'}</span>
+ ${bd.eta_seconds ? `<span>eta ${Math.round(bd.eta_seconds / 60)}m</span>` : ''}
+ ${bd.reputation != null ? `<span>rep ${bd.reputation.toFixed(2)}</span>` : ''}
+ </div>
+ ${bd.pitch ? `<p class="lm-bid-pitch">${esc(bd.pitch)}</p>` : ''}
+ ${award}
+ </div>`;
+ })
+ .join('')
+ : `<p class="lm-bids-empty">No bids yet. ${b.status === 'open' ? 'Worker agents with the matching skill are still deciding.' : ''}</p>`;
+
+ let jobHtml = '';
+ if (job) {
+ const verdict = job.verdict;
+ jobHtml = `
+ <div class="lm-jobpanel">
+ <h4>Job · ${statusLabel[job.status] || job.status}</h4>
+ ${job.deliverable?.output ? `<details class="lm-deliv"><summary>Deliverable</summary><pre>${esc(String(job.deliverable.output).slice(0, 2000))}</pre></details>` : ''}
+ ${verdict ? `<p class="lm-verdict ${verdict.pass ? 'pass' : 'fail'}">Verdict: <strong>${verdict.pass ? 'passed' : 'rejected'}</strong> · score ${Number(verdict.score).toFixed(2)} · ${esc(verdict.reason || '')} <span class="lm-verifier">(${esc(verdict.verifier || '')})</span></p>` : ''}
+ ${job.settlement_explorer ? `<p class="lm-settle-row">Paid <strong>${fmtThree(job.worker_payout_three)} $THREE</strong>${Number(job.royalty_three) > 0 ? ` · royalty ${fmtThree(job.royalty_three)}` : ''} <a href="${esc(job.settlement_explorer)}" target="_blank" rel="noopener">settlement ↗</a>${job.invocation_explorer ? ` · <a href="${esc(job.invocation_explorer)}" target="_blank" rel="noopener">invocation ↗</a>` : ''}</p>` : ''}
+ ${ownsAgent(job.worker_agent_id) && job.status === 'working' ? deliverForm(job.id) : ''}
+ ${(iOwnPoster || ownsAgent(job.worker_agent_id)) && ['delivered', 'verifying'].includes(job.status) ? `<button type="button" class="lm-btn lm-btn-primary" data-settle="${esc(job.id)}">Verify &amp; settle now</button>` : ''}
+ </div>`;
+ }
+
+ return `
+ <div class="lm-drawer-head">
+ <span class="lm-status lm-status-${esc(b.status)}">${statusLabel[b.status] || b.status}</span>
+ <span class="lm-reward lm-reward-lg">${reward} <span>$THREE</span></span>
+ </div>
+ <h2 id="lm-drawer-title">${esc(b.title)}</h2>
+ <p class="lm-drawer-spec">${esc(b.spec)}</p>
+ <div class="lm-drawer-tags">
+ ${b.required_skill ? `<span class="lm-chip">${esc(b.required_skill)}</span>` : '<span class="lm-chip lm-chip-muted">open skill</span>'}
+ <span class="lm-card-meta">by <a href="/agent/${esc(b.poster_agent_id)}">${esc(b.poster_name)}</a></span>
+ ${b.escrow_explorer ? `<a class="lm-card-escrow" href="${esc(b.escrow_explorer)}" target="_blank" rel="noopener" title="Reward escrowed on-chain">◆ escrow tx ↗</a>` : ''}
+ </div>
+ ${b.award_rationale ? `<div class="lm-rationale"><span class="lm-rationale-mark">⚖</span> <span>${esc(b.award_rationale)}</span></div>` : ''}
+
+ <div class="lm-section">
+ <h3>Bids <span class="lm-count">${bids.length}</span></h3>
+ <div class="lm-bids">${bidsHtml}</div>
+ </div>
+
+ ${canBid ? bidForm(b, myWorker) : state.authed ? '' : `<p class="lm-signin-hint">Sign in and own an agent to bid, award, or post.</p>`}
+ ${jobHtml}`;
+}
+
+function bidForm(b, worker) {
+ return `
+ <form class="lm-form lm-inline-form" data-bid-form>
+ <h3>Bid as ${esc(worker.name || 'your agent')}</h3>
+ <input type="hidden" name="workerAgentId" value="${esc(worker.id)}" />
+ <input type="hidden" name="bountyId" value="${esc(b.id)}" />
+ <div class="lm-field-row">
+ <label class="lm-field"><span>Your price</span><span class="lm-input-suffix"><input type="number" name="priceThree" min="0" step="any" max="${b.reward_three}" required placeholder="${b.reward_three}" /><span>$THREE</span></span></label>
+ <label class="lm-field"><span>ETA</span><span class="lm-input-suffix"><input type="number" name="etaMin" min="1" step="1" placeholder="30" /><span>min</span></span></label>
+ </div>
+ <label class="lm-field"><span>Pitch <span class="lm-opt">(optional)</span></span><input type="text" name="pitch" maxlength="240" placeholder="Why you should win" /></label>
+ <div class="lm-form-msg" data-bid-msg></div>
+ <button type="submit" class="lm-btn lm-btn-primary">Submit bid</button>
+ </form>`;
+}
+
+function deliverForm(jobId) {
+ return `
+ <form class="lm-form lm-inline-form" data-deliver-form data-job="${esc(jobId)}">
+ <h4>Deliver your work</h4>
+ <label class="lm-field"><span>Deliverable</span><textarea name="output" rows="3" required placeholder="Paste the finished result. A neutral verifier scores it against the spec before escrow releases."></textarea></label>
+ <div class="lm-form-msg" data-deliver-msg></div>
+ <button type="submit" class="lm-btn lm-btn-primary">Deliver, verify &amp; settle</button>
+ </form>`;
+}
+
+function wireDrawer(data) {
+ const body = $('#lm-drawer-body');
+ const bidForm = $('[data-bid-form]', body);
+ if (bidForm) {
+ bidForm.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const msg = $('[data-bid-msg]', bidForm);
+ const fd = new FormData(bidForm);
+ const etaMin = Number(fd.get('etaMin'));
+ setMsg(msg, 'Placing bid…', '');
+ try {
+ const res = await apiFetch('/api/labor/bid', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ bountyId: fd.get('bountyId'),
+ workerAgentId: fd.get('workerAgentId'),
+ priceThree: Number(fd.get('priceThree')),
+ etaSeconds: etaMin > 0 ? etaMin * 60 : null,
+ pitch: fd.get('pitch') || null,
+ }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'bid failed');
+ setMsg(msg, 'Bid placed.', 'ok');
+ await refresh();
+ openBounty(data.bounty.id);
+ } catch (err) {
+ setMsg(msg, err.message, 'err');
+ }
+ });
+ }
+
+ $$('[data-award]', body).forEach((btn) =>
+ btn.addEventListener('click', async () => {
+ btn.disabled = true;
+ btn.textContent = 'Awarding…';
+ try {
+ const res = await apiFetch('/api/labor/award', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ bountyId: data.bounty.id, bidId: btn.dataset.award }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'award failed');
+ await refresh();
+ openBounty(data.bounty.id);
+ } catch (err) {
+ btn.disabled = false;
+ btn.textContent = 'Award';
+ alert(err.message);
+ }
+ }),
+ );
+
+ const deliverForm = $('[data-deliver-form]', body);
+ if (deliverForm) {
+ deliverForm.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const msg = $('[data-deliver-msg]', deliverForm);
+ setMsg(msg, 'Delivering & settling on-chain…', '');
+ try {
+ const res = await apiFetch('/api/labor/deliver', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ jobId: deliverForm.dataset.job, deliverable: { output: new FormData(deliverForm).get('output') } }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'deliver failed');
+ setMsg(msg, j.settlement?.settled ? 'Settled — payout released.' : `Verdict: ${j.settlement?.status || 'recorded'}.`, 'ok');
+ await refresh();
+ openBounty(data.bounty.id);
+ } catch (err) {
+ setMsg(msg, err.message, 'err');
+ }
+ });
+ }
+
+ const settleBtn = $('[data-settle]', body);
+ if (settleBtn) {
+ settleBtn.addEventListener('click', async () => {
+ settleBtn.disabled = true;
+ settleBtn.textContent = 'Settling…';
+ try {
+ const res = await apiFetch('/api/labor/settle', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ jobId: settleBtn.dataset.settle }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'settle failed');
+ await refresh();
+ openBounty(data.bounty.id);
+ } catch (err) {
+ settleBtn.disabled = false;
+ settleBtn.textContent = 'Verify & settle now';
+ alert(err.message);
+ }
+ });
+ }
+}
+
+function closeDrawer() {
+ $('#lm-drawer').hidden = true;
+ state.openBountyId = null;
+ document.body.classList.remove('lm-noscroll');
+}
+
+// ── Post + policy modals ────────────────────────────────────────────────────
+
+function fillAgentSelects() {
+ const opts = state.myAgents.map((a) => `<option value="${esc(a.id)}">${esc(a.name || 'Agent')}</option>`).join('');
+ const ph = `<option value="" disabled selected>Select an agent…</option>`;
+ $('#lm-post-agent').innerHTML = ph + opts;
+ $('#lm-policy-agent').innerHTML = ph + opts;
+}
+
+function openModal(id) {
+ if (!state.authed) {
+ location.href = '/login?next=' + encodeURIComponent('/labor-market');
+ return;
+ }
+ if (id === 'lm-post-modal' && !state.escrowConfigured) {
+ alert('Bounty escrow is not configured on this server yet.');
+ return;
+ }
+ fillAgentSelects();
+ const m = $('#' + id);
+ m.hidden = false;
+ document.body.classList.add('lm-noscroll');
+ const first = m.querySelector('select, input, textarea');
+ if (first) setTimeout(() => first.focus(), 30);
+}
+function closeModal(m) {
+ m.hidden = true;
+ document.body.classList.remove('lm-noscroll');
+}
+
+function setMsg(el, text, kind) {
+ if (!el) return;
+ el.textContent = text || '';
+ el.className = 'lm-form-msg' + (kind ? ' lm-form-msg-' + kind : '');
+}
+
+function wirePostForm() {
+ const form = $('#lm-post-form');
+ form.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const msg = $('#lm-post-msg');
+ const btn = $('#lm-post-submit');
+ btn.disabled = true;
+ setMsg(msg, 'Escrowing reward on-chain…', '');
+ try {
+ const res = await apiFetch('/api/labor/post', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ posterAgentId: $('#lm-post-agent').value,
+ title: $('#lm-post-title-in').value.trim(),
+ spec: $('#lm-post-spec').value.trim(),
+ requiredSkill: $('#lm-post-skill').value.trim() || null,
+ rewardThree: Number($('#lm-post-reward').value),
+ }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'post failed');
+ const auto = j.autopilot || {};
+ setMsg(msg, `Posted & escrowed. ${auto.bids ? `${auto.bids} auto-bid${auto.bids === 1 ? '' : 's'} arrived.` : ''} ${auto.settled === 'settled' ? 'Already settled!' : ''}`.trim(), 'ok');
+ form.reset();
+ await refresh();
+ setTimeout(() => {
+ closeModal($('#lm-post-modal'));
+ if (j.bounty?.id) openBounty(j.bounty.id);
+ }, 900);
+ } catch (err) {
+ setMsg(msg, err.message, 'err');
+ } finally {
+ btn.disabled = false;
+ }
+ });
+}
+
+function wirePolicyForm() {
+ const form = $('#lm-policy-form');
+ const sync = () => {
+ form.classList.toggle('lm-show-worker', $('#lm-policy-worker').checked);
+ form.classList.toggle('lm-show-poster', $('#lm-policy-poster').checked);
+ };
+ $('#lm-policy-worker').addEventListener('change', sync);
+ $('#lm-policy-poster').addEventListener('change', sync);
+ $('#lm-policy-agent').addEventListener('change', async () => {
+ const id = $('#lm-policy-agent').value;
+ if (!id) return;
+ try {
+ const res = await apiFetch(`/api/labor/policy?agentId=${encodeURIComponent(id)}`, { allowAnonymous: true });
+ const { data } = await res.json();
+ $('#lm-policy-worker').checked = !!data.worker_enabled;
+ $('#lm-policy-poster').checked = !!data.poster_enabled;
+ $('#lm-policy-autoaward').checked = !!data.auto_award;
+ $('#lm-policy-skills').value = (data.skills || []).join(', ');
+ $('#lm-policy-maxbid').value = data.max_bid_three ?? '';
+ $('#lm-policy-minbids').value = data.min_bids || 1;
+ sync();
+ } catch { /* default empty */ }
+ });
+
+ form.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const msg = $('#lm-policy-msg');
+ const btn = $('#lm-policy-submit');
+ btn.disabled = true;
+ setMsg(msg, 'Saving…', '');
+ try {
+ const res = await apiFetch('/api/labor/policy', {
+ method: 'PUT',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ agentId: $('#lm-policy-agent').value,
+ workerEnabled: $('#lm-policy-worker').checked,
+ posterEnabled: $('#lm-policy-poster').checked,
+ autoAward: $('#lm-policy-autoaward').checked,
+ skills: $('#lm-policy-skills').value.split(',').map((s) => s.trim()).filter(Boolean),
+ maxBidThree: $('#lm-policy-maxbid').value ? Number($('#lm-policy-maxbid').value) : null,
+ minBids: Number($('#lm-policy-minbids').value) || 1,
+ }),
+ });
+ const j = await res.json();
+ if (!res.ok) throw new Error(j.error_description || j.error || 'save failed');
+ setMsg(msg, 'Policy saved. This agent is now part of the economy.', 'ok');
+ setTimeout(() => closeModal($('#lm-policy-modal')), 900);
+ } catch (err) {
+ setMsg(msg, err.message, 'err');
+ } finally {
+ btn.disabled = false;
+ }
+ });
+}
+
+// ── Refresh + polling ───────────────────────────────────────────────────────
+
+async function refresh() {
+ try {
+ await loadFeed();
+ renderAll();
+ } catch {
+ const list = $('#lm-list');
+ if (!state.feed) list.innerHTML = `<div class="lm-empty"><h3>Market unavailable</h3><p>Couldn't reach the labor market. <button type="button" class="lm-btn" data-retry>Retry</button></p></div>`;
+ }
+}
+
+function startPolling() {
+ stopPolling();
+ state.pollTimer = setInterval(() => {
+ if (document.hidden) return;
+ refresh().then(() => {
+ if (state.openBountyId) openBounty(state.openBountyId);
+ });
+ }, 8000);
+}
+function stopPolling() {
+ if (state.pollTimer) clearInterval(state.pollTimer);
+ state.pollTimer = null;
+}
+
+// ── Wiring ──────────────────────────────────────────────────────────────────
+
+function debounce(fn, ms) {
+ let t;
+ return (...a) => {
+ clearTimeout(t);
+ t = setTimeout(() => fn(...a), ms);
+ };
+}
+
+function init() {
+ // Tabs
+ $$('.lm-tab').forEach((tab) =>
+ tab.addEventListener('click', () => {
+ $$('.lm-tab').forEach((t) => {
+ t.classList.toggle('is-active', t === tab);
+ t.setAttribute('aria-selected', t === tab ? 'true' : 'false');
+ });
+ state.tab = tab.dataset.tab;
+ $('#lm-filters').style.visibility = state.tab === 'open' ? 'visible' : 'hidden';
+ renderBoard();
+ }),
+ );
+
+ // Filters
+ const applyFilters = debounce(() => {
+ state.skill = $('#lm-filter-skill').value.trim();
+ state.minReward = $('#lm-filter-reward').value.trim();
+ refresh();
+ }, 350);
+ $('#lm-filter-skill').addEventListener('input', applyFilters);
+ $('#lm-filter-reward').addEventListener('input', applyFilters);
+
+ // Card / drawer delegation
+ $('#lm-list').addEventListener('click', (e) => {
+ const card = e.target.closest('[data-bounty]');
+ if (card) openBounty(card.dataset.bounty);
+ if (e.target.closest('[data-post-cta]')) openModal('lm-post-modal');
+ if (e.target.closest('[data-retry]')) refresh();
+ });
+
+ // Hero + modal buttons
+ $('#lm-post-open').addEventListener('click', () => openModal('lm-post-modal'));
+ $('#lm-policy-open').addEventListener('click', () => openModal('lm-policy-modal'));
+ $$('[data-close]').forEach((el) =>
+ el.addEventListener('click', (e) => {
+ const modal = e.target.closest('.lm-modal');
+ if (modal) closeModal(modal);
+ else closeDrawer();
+ }),
+ );
+ document.addEventListener('keydown', (e) => {
+ if (e.key !== 'Escape') return;
+ const openModalEl = $$('.lm-modal').find((m) => !m.hidden);
+ if (openModalEl) closeModal(openModalEl);
+ else if (!$('#lm-drawer').hidden) closeDrawer();
+ });
+
+ wirePostForm();
+ wirePolicyForm();
+
+ // Initial load
+ renderBoard(); // skeletons
+ Promise.all([loadFeed().catch(() => null), loadMyAgents()]).then(() => {
+ renderAll();
+ startPolling();
+ });
+ document.addEventListener('visibilitychange', () => {
+ if (!document.hidden) refresh();
+ });
+}
+
+if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
+else init();
diff --git a/src/marketplace.js b/src/marketplace.js
index d140d6e57..c0b22793b 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -4458,6 +4458,19 @@ function renderAvatarCard(a, spotlight = false) {
</div>`;
}
+// Rare-pedigree badge — marks a bred agent by its lineage tier. Uncommon and up
+// only, so the badge stays a genuine signal of scarcity (deep pedigree, emergent
+// skills) rather than noise on every card. Links into the agent's lineage.
+function pedigreeBadgeHTML(a) {
+ const g = a.genome;
+ if (!g || !g.bred || !g.pedigree_tier) return '';
+ const tier = String(g.pedigree_tier);
+ if (tier === 'common') return '';
+ const glyph = g.emergent > 0 ? '⚡' : '◈';
+ const title = `Generation ${g.generation} · ${tier} pedigree${g.emergent > 0 ? ` · ${g.emergent} emergent skill${g.emergent > 1 ? 's' : ''}` : ''}`;
+ return `<a class="stat-pill pedigree-badge" data-tier="${escapeHtml(tier)}" href="/genome?a=${escapeHtml(a.id)}" title="${escapeHtml(title)}" onclick="event.stopPropagation()">${glyph} gen ${g.generation}</a>`;
+}
+
function renderCard(a) {
const published = a.published_at || a.published || a.created_at;
const date = published ? formatDate(published) : '';
@@ -4513,6 +4526,7 @@ function renderCard(a) {
<div class="desc">${escapeHtml(a.description || '')}</div>
<div class="stats">
${onchainBadge}
+ ${pedigreeBadge}
${coinChipHTML(a)}
<span class="stat-pill">⊙ ${fmtNumber(views)}</span>
<span class="stat-pill">⑂ ${fmtNumber(forks)}</span>
diff --git a/src/world-lines.js b/src/world-lines.js
new file mode 100644
index 000000000..af63e4347
--- /dev/null
+++ b/src/world-lines.js
@@ -0,0 +1,490 @@
+// /world-lines — the World Lines discovery surface + creator dashboard.
+//
+// Four tabs, every state designed:
+// · Near me — fix-gated, co-located quests you can walk to right now.
+// · Explore — coarse region roll-up (no coordinates) for browsing the world.
+// · My proofs — the agent-signed proofs-of-presence you’ve earned, each verifiable.
+// · Create — place a World Line on one of your IRL pins (auth), see completions.
+//
+// The completion ceremony (AR + first-class non-AR fallback) lives in
+// src/irl/world-line-ar.js and is hosted in a modal here.
+
+import { worldLinesClient as api } from './irl/world-lines-client.js';
+import { WorldLineCeremony } from './irl/world-line-ar.js';
+
+const $ = (id) => document.getElementById(id);
+const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
+
+// ── Geolocation ──────────────────────────────────────────────────────────────
+const fixState = { lat: null, lng: null, accuracy: null, status: 'idle', error: null };
+let _watchId = null;
+
+function startLocation() {
+ if (fixState.status === 'watching' || !navigator.geolocation) {
+ if (!navigator.geolocation) { fixState.status = 'unsupported'; }
+ return;
+ }
+ fixState.status = 'prompting';
+ navigator.geolocation.getCurrentPosition(onFix, onFixError, { enableHighAccuracy: true, timeout: 12000, maximumAge: 5000 });
+ _watchId = navigator.geolocation.watchPosition(onFix, onFixError, { enableHighAccuracy: true, maximumAge: 4000 });
+}
+function onFix(pos) {
+ fixState.lat = pos.coords.latitude;
+ fixState.lng = pos.coords.longitude;
+ fixState.accuracy = pos.coords.accuracy;
+ const wasReady = fixState.status === 'watching';
+ fixState.status = 'watching';
+ fixState.error = null;
+ if (!wasReady && activeTab === 'near') renderNear();
+}
+function onFixError(err) {
+ fixState.status = 'error';
+ fixState.error = err.code === 1 ? 'denied' : 'unavailable';
+ if (activeTab === 'near') renderNear();
+}
+function currentFix() {
+ return Number.isFinite(fixState.lat) ? { lat: fixState.lat, lng: fixState.lng, accuracy: fixState.accuracy } : null;
+}
+
+// ── Tabs ─────────────────────────────────────────────────────────────────────
+let activeTab = 'near';
+const TABS = ['near', 'explore', 'collectibles', 'create'];
+function selectTab(name) {
+ activeTab = name;
+ TABS.forEach((t) => {
+ $(`tab-${t}`).setAttribute('aria-selected', String(t === name));
+ $(`panel-${t}`).classList.toggle('active', t === name);
+ });
+ if (name === 'near') { startLocation(); renderNear(); }
+ if (name === 'explore') renderExplore();
+ if (name === 'collectibles') renderCollectibles();
+ if (name === 'create') renderCreate();
+}
+TABS.forEach((t) => $(`tab-${t}`).addEventListener('click', () => selectTab(t)));
+$('tabs')?.addEventListener?.('keydown', () => {});
+
+// ── HTML helpers ─────────────────────────────────────────────────────────────
+function esc(s) {
+ return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+}
+function diffChip(d) { return `<span class="chip ${esc(d)}">${esc(cap(d))}</span>`; }
+function rewardChip(k) {
+ return k === 'three_pool'
+ ? `<span class="chip reward">◎ $THREE pool</span>`
+ : `<span class="chip reward">✦ Collectible</span>`;
+}
+function distChip(m) {
+ if (!Number.isFinite(m)) return '';
+ const label = m < 1000 ? `≈ ${m} m away` : `≈ ${(m / 1000).toFixed(1)} km away`;
+ return `<span class="chip dist">📍 ${esc(label)}</span>`;
+}
+function cap(s) { return String(s || '').charAt(0).toUpperCase() + String(s || '').slice(1); }
+function stateBlock({ ico, title, body, action }) {
+ return `<div class="state"><div class="ico">${ico}</div><h3>${esc(title)}</h3><p>${body}</p>${action || ''}</div>`;
+}
+function skeletons(n = 4) {
+ return `<div class="grid">${Array.from({ length: n }, () => '<div class="skel"></div>').join('')}</div>`;
+}
+
+// ── Near me ──────────────────────────────────────────────────────────────────
+async function renderNear() {
+ const el = $('panel-near');
+ if (fixState.status === 'unsupported') {
+ el.innerHTML = stateBlock({ ico: '🧭', title: 'Location isn’t available', body: 'Your browser can’t share a location, so nearby quests can’t load. Try the <strong>Explore</strong> tab to browse by region.' });
+ return;
+ }
+ if (fixState.status === 'idle' || fixState.status === 'prompting') {
+ el.innerHTML = stateBlock({ ico: '📡', title: 'Finding quests around you', body: 'Allow location access so we can show the World Lines within walking distance. Your exact spot never leaves your device.' });
+ startLocation();
+ return;
+ }
+ if (fixState.status === 'error') {
+ const denied = fixState.error === 'denied';
+ el.innerHTML = stateBlock({
+ ico: denied ? '🔒' : '⚠️',
+ title: denied ? 'Location permission needed' : 'Couldn’t get your location',
+ body: denied
+ ? 'World Lines are a get-up-and-go game — we need your location to show quests you can walk to. Enable location for this site and retry.'
+ : 'We couldn’t read a location fix. Step outside or check your signal, then retry.',
+ action: '<button class="btn primary" id="near-retry">Retry</button>',
+ });
+ $('near-retry')?.addEventListener('click', () => { fixState.status = 'idle'; renderNear(); });
+ return;
+ }
+ // status: watching
+ el.innerHTML = skeletons();
+ const fix = currentFix();
+ let data;
+ try {
+ data = await api.nearby(fix.lat, fix.lng, fix.accuracy);
+ } catch (err) {
+ if (err.code === 'fix_required') {
+ el.innerHTML = stateBlock({ ico: '📡', title: 'Confirming your location', body: 'Hold tight while we verify your position…', action: '<button class="btn" id="near-retry">Retry</button>' });
+ $('near-retry')?.addEventListener('click', renderNear);
+ return;
+ }
+ el.innerHTML = stateBlock({ ico: '⚠️', title: 'Couldn’t load quests', body: esc(err.message || 'Network error.'), action: '<button class="btn primary" id="near-retry">Retry</button>' });
+ $('near-retry')?.addEventListener('click', renderNear);
+ return;
+ }
+ const quests = data.world_lines || [];
+ if (!quests.length) {
+ el.innerHTML = stateBlock({
+ ico: '🌎', title: 'No World Lines near you yet',
+ body: 'Be the first to leave one here — drop a 3D agent on the <a href="/irl">IRL map</a>, then place a World Line on it from the <strong>Create</strong> tab.',
+ action: '<button class="btn" id="near-refresh">Refresh</button>',
+ });
+ $('near-refresh')?.addEventListener('click', renderNear);
+ return;
+ }
+ el.innerHTML = `<div class="grid">${quests.map(questCard).join('')}</div>`;
+ quests.forEach((q) => {
+ $(`q-${q.id}`)?.addEventListener('click', () => openCeremony(q));
+ });
+}
+
+function questCard(q) {
+ const reached = q.capacity_reached;
+ const done = q.completed_by_me;
+ const inRange = Number.isFinite(q.distance_m) && q.distance_m <= 80;
+ const cta = done
+ ? '<button class="btn full" disabled>✓ Proof earned</button>'
+ : reached
+ ? '<button class="btn full" disabled>Reward pool full</button>'
+ : inRange
+ ? `<button class="btn primary full" id="q-${q.id}">You’re here — begin</button>`
+ : `<button class="btn full" id="q-${q.id}">Travel here to begin</button>`;
+ return `
+ <article class="card">
+ <h3>${esc(q.title)}</h3>
+ ${q.prompt ? `<p style="color:var(--text-2);margin:0;font-size:14px;line-height:1.45">${esc(q.prompt)}</p>` : ''}
+ <div class="meta">
+ ${distChip(q.distance_m)}
+ ${diffChip(q.difficulty)}
+ ${rewardChip(q.reward_kind)}
+ ${done ? '<span class="chip done">✓ Completed</span>' : ''}
+ </div>
+ <div class="cta-row">${cta}</div>
+ </article>`;
+}
+
+// ── Explore (coarse regions) ─────────────────────────────────────────────────
+async function renderExplore() {
+ const el = $('panel-explore');
+ el.innerHTML = skeletons(3);
+ let data;
+ try {
+ data = await api.browseRegions();
+ } catch (err) {
+ el.innerHTML = stateBlock({ ico: '⚠️', title: 'Couldn’t load regions', body: esc(err.message || 'Network error.'), action: '<button class="btn primary" id="exp-retry">Retry</button>' });
+ $('exp-retry')?.addEventListener('click', renderExplore);
+ return;
+ }
+ const regions = data.regions || [];
+ if (!regions.length) {
+ el.innerHTML = stateBlock({ ico: '🗺️', title: 'No active World Lines anywhere yet', body: 'The map is wide open. Place the first quest from the <strong>Create</strong> tab.' });
+ return;
+ }
+ el.innerHTML = `
+ <p style="color:var(--text-2);margin:0 0 14px;font-size:14px">${regions.length} ${regions.length === 1 ? 'region has' : 'regions have'} active quests. Regions are ~5&nbsp;km — coarse on purpose, so browsing never reveals a quest’s exact spot.</p>
+ <div style="display:flex;flex-direction:column;gap:10px" id="region-list">
+ ${regions.map((r) => `
+ <div class="region-row" data-region="${esc(r.region_cell)}" role="button" tabindex="0">
+ <div>
+ <div style="font-weight:600">${r.quests} ${r.quests === 1 ? 'quest' : 'quests'}</div>
+ <div class="rc">region ${esc(r.region_cell)} · ${r.completions || 0} completions</div>
+ </div>
+ <div class="meta" style="margin:0">${r.hard ? `<span class="chip hard">${r.hard} hard</span>` : ''}<span class="chip">View →</span></div>
+ </div>`).join('')}
+ </div>
+ <div id="region-detail" style="margin-top:16px"></div>`;
+ el.querySelectorAll('.region-row').forEach((row) => {
+ const open = () => openRegion(row.dataset.region);
+ row.addEventListener('click', open);
+ row.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(); } });
+ });
+}
+
+async function openRegion(region) {
+ const host = $('region-detail');
+ host.innerHTML = skeletons(2);
+ let data;
+ try {
+ data = await api.browseRegion(region);
+ } catch (err) {
+ host.innerHTML = `<p style="color:var(--danger)">${esc(err.message || 'Could not load region.')}</p>`;
+ return;
+ }
+ const quests = data.quests || [];
+ host.innerHTML = `
+ <h3 style="margin:6px 0 12px;font-size:16px">Quests in region <span class="mono">${esc(region)}</span></h3>
+ <div class="grid">
+ ${quests.map((q) => `
+ <article class="card">
+ <h3>${esc(q.title)}</h3>
+ <div class="meta">${diffChip(q.difficulty)}${rewardChip(q.reward_kind)}<span class="chip">${q.completion_count || 0} done</span>${q.capacity_reached ? '<span class="chip">Full</span>' : ''}</div>
+ <p style="color:var(--text-3);font-size:13px;margin:6px 0 0">Travel to this region and open the <strong>Near me</strong> tab to find and complete it in AR.</p>
+ </article>`).join('')}
+ </div>`;
+}
+
+// ── My proofs (collectibles) ─────────────────────────────────────────────────
+async function renderCollectibles() {
+ const el = $('panel-collectibles');
+ el.innerHTML = skeletons(3);
+ let data;
+ try {
+ data = await api.myCollectibles();
+ } catch (err) {
+ el.innerHTML = stateBlock({ ico: '⚠️', title: 'Couldn’t load your proofs', body: esc(err.message || 'Network error.'), action: '<button class="btn primary" id="col-retry">Retry</button>' });
+ $('col-retry')?.addEventListener('click', renderCollectibles);
+ return;
+ }
+ const items = data.collectibles || [];
+ if (!items.length) {
+ el.innerHTML = stateBlock({ ico: '✦', title: 'No proofs yet', body: 'Complete a World Line and the agent will sign your first proof of presence. Find one on the <strong>Near me</strong> tab.' });
+ return;
+ }
+ el.innerHTML = `<div class="grid">${items.map(collectibleCard).join('')}</div>`;
+ items.forEach((c) => {
+ $(`verify-${c.proof_id}`)?.addEventListener('click', () => verifyInline(c.proof_id));
+ });
+}
+
+function collectibleCard(c) {
+ return `
+ <article class="card collectible">
+ <div class="seal">✦</div>
+ <h3>${esc(c.name || 'Proof of presence')}</h3>
+ <p style="color:var(--text-2);font-size:13px;margin:0 0 4px">${esc(c.world_line_title || 'World Line')}</p>
+ <div class="meta">
+ ${c.difficulty ? diffChip(c.difficulty) : ''}
+ <span class="chip">${esc(new Date(c.earned_at).toLocaleDateString())}</span>
+ </div>
+ <p class="mono">signed by ${esc((c.signer_pubkey || '').slice(0, 8))}… · area ${esc(c.coarse_cell)}</p>
+ <div class="cta-row">
+ <button class="btn full" id="verify-${c.proof_id}">Verify signature</button>
+ </div>
+ <div id="vres-${c.proof_id}"></div>
+ </article>`;
+}
+
+async function verifyInline(proofId) {
+ const host = $(`vres-${proofId}`);
+ host.innerHTML = `<p style="color:var(--text-2);font-size:13px;margin:10px 0 0">Re-checking the agent signature…</p>`;
+ try {
+ const data = await api.verify(proofId);
+ host.innerHTML = data.verified
+ ? `<p style="color:var(--green);font-size:13px;margin:10px 0 0">✓ Genuine — the agent’s signature checks out. <a href="/api/irl/world-lines/verify/${proofId}" target="_blank" rel="noopener">Raw proof ↗</a></p>`
+ : `<p style="color:var(--danger);font-size:13px;margin:10px 0 0">✕ Signature did not verify.</p>`;
+ } catch (err) {
+ host.innerHTML = `<p style="color:var(--danger);font-size:13px;margin:10px 0 0">${esc(err.message || 'Verification failed.')}</p>`;
+ }
+}
+
+// ── Create + creator dashboard ───────────────────────────────────────────────
+async function renderCreate() {
+ const el = $('panel-create');
+ el.innerHTML = skeletons(2);
+ // Auth + pins are read together: /mine returns 401 when signed out.
+ let mineData;
+ try {
+ mineData = await api.mine();
+ } catch (err) {
+ if (err.status === 401) {
+ el.innerHTML = stateBlock({ ico: '🔑', title: 'Sign in to place a World Line', body: 'A World Line is signed by your agent’s wallet, so creating one needs an account. <a href="/login?next=/world-lines">Sign in</a> and come back.' });
+ return;
+ }
+ el.innerHTML = stateBlock({ ico: '⚠️', title: 'Couldn’t load your World Lines', body: esc(err.message || 'Network error.'), action: '<button class="btn primary" id="cre-retry">Retry</button>' });
+ $('cre-retry')?.addEventListener('click', renderCreate);
+ return;
+ }
+
+ const mine = mineData.world_lines || [];
+ const heat = mineData.heatmap || [];
+ const heatByWl = {};
+ heat.forEach((h) => { heatByWl[h.world_line_id] = (heatByWl[h.world_line_id] || 0) + h.completions; });
+
+ // Pins to anchor a quest onto (auth pins).
+ let pins = [];
+ try {
+ const r = await fetch('/api/irl/pins?mine=1', { credentials: 'include' });
+ if (r.ok) pins = (await r.json()).pins || [];
+ } catch { /* the form handles the no-pin case */ }
+
+ el.innerHTML = `
+ <div style="display:grid;gap:24px">
+ <div>
+ <h2 style="font-size:18px;margin:0 0 12px">Place a World Line</h2>
+ ${createForm(pins)}
+ </div>
+ <div>
+ <h2 style="font-size:18px;margin:0 0 12px">Your active quests</h2>
+ ${mine.length ? `<div class="grid">${mine.map((w) => dashCard(w, heatByWl[w.id] || 0)).join('')}</div>`
+ : '<p style="color:var(--text-2)">No World Lines yet. Place your first one above.</p>'}
+ </div>
+ </div>`;
+ wireCreateForm();
+}
+
+function createForm(pins) {
+ if (!pins.length) {
+ return `<div class="form-note">You need an IRL pin first — a placed 3D agent to anchor the quest to.
+ <a href="/irl">Open the IRL map</a> and drop one, then come back.</div>`;
+ }
+ return `
+ <form class="form" id="wl-form">
+ <div class="field">
+ <label for="f-pin">Anchor pin (your placed agent)</label>
+ <select id="f-pin" required>
+ ${pins.map((p) => `<option value="${esc(p.id)}" data-agent="${esc(p.agent_id || '')}">${esc(p.avatar_name || p.caption || 'Agent')} · ${esc((p.id || '').slice(0, 8))}</option>`).join('')}
+ </select>
+ <div class="hint">The quest lands at this agent’s spot. Only the coarse ~1&nbsp;km cell is ever stored on the quest.</div>
+ </div>
+ <div class="field">
+ <label for="f-title">Title</label>
+ <input id="f-title" maxlength="80" required placeholder="e.g. Find the lobby greeter" />
+ </div>
+ <div class="field">
+ <label for="f-prompt">What the agent says (spoken aloud in AR)</label>
+ <textarea id="f-prompt" rows="2" maxlength="240" placeholder="Welcome, traveler. Tap me to prove you came."></textarea>
+ </div>
+ <div class="field">
+ <label for="f-kind">Challenge</label>
+ <select id="f-kind">
+ <option value="tap">Tap to meet (presence only)</option>
+ <option value="phrase">Say a passphrase</option>
+ <option value="quiz">Answer a quiz</option>
+ </select>
+ </div>
+ <div class="field" id="f-phrase-wrap" hidden>
+ <label for="f-phrase">Passphrase the visitor must say</label>
+ <input id="f-phrase" maxlength="80" placeholder="open sesame" />
+ </div>
+ <div class="field" id="f-quiz-wrap" hidden>
+ <label for="f-question">Quiz question</label>
+ <input id="f-question" maxlength="240" placeholder="What year did three.ws launch?" />
+ <div class="choices-edit" style="margin-top:8px" id="f-choices">
+ <input class="f-choice" maxlength="60" placeholder="Choice 1" />
+ <input class="f-choice" maxlength="60" placeholder="Choice 2" />
+ <input class="f-choice" maxlength="60" placeholder="Choice 3 (optional)" />
+ <input class="f-choice" maxlength="60" placeholder="Choice 4 (optional)" />
+ </div>
+ <div class="hint" style="margin-top:8px">Correct answer:
+ <select id="f-answer"><option value="0">Choice 1</option><option value="1">Choice 2</option><option value="2">Choice 3</option><option value="3">Choice 4</option></select>
+ </div>
+ </div>
+ <div class="field" style="display:flex;gap:12px">
+ <div style="flex:1"><label for="f-diff">Difficulty</label>
+ <select id="f-diff"><option value="easy">Easy</option><option value="medium">Medium</option><option value="hard">Hard</option></select></div>
+ <div style="flex:1"><label for="f-reward">Reward</label>
+ <select id="f-reward"><option value="collectible">Collectible proof</option><option value="three_pool">$THREE prize pool</option></select></div>
+ </div>
+ <div class="field" style="display:flex;gap:12px">
+ <div style="flex:1"><label for="f-max">Max completions (blank = unlimited)</label>
+ <input id="f-max" type="number" min="1" placeholder="∞" /></div>
+ <div style="flex:1"><label for="f-life">Active for (days)</label>
+ <input id="f-life" type="number" min="1" max="90" value="30" /></div>
+ </div>
+ <button type="submit" class="btn primary full" id="f-submit">Place World Line</button>
+ <p id="f-msg" style="margin:12px 0 0;font-size:14px"></p>
+ </form>`;
+}
+
+function wireCreateForm() {
+ const form = $('wl-form');
+ if (!form) return;
+ const kind = $('f-kind');
+ const sync = () => {
+ $('f-phrase-wrap').hidden = kind.value !== 'phrase';
+ $('f-quiz-wrap').hidden = kind.value !== 'quiz';
+ };
+ kind.addEventListener('change', sync); sync();
+
+ form.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const msg = $('f-msg');
+ const submit = $('f-submit');
+ const pinSel = $('f-pin');
+ const opt = pinSel.options[pinSel.selectedIndex];
+ const payload = {
+ pinId: pinSel.value,
+ agentId: opt?.dataset.agent || undefined,
+ title: $('f-title').value.trim(),
+ prompt: $('f-prompt').value.trim(),
+ reward_kind: $('f-reward').value,
+ difficulty: $('f-diff').value,
+ lifetime_days: Number($('f-life').value) || 30,
+ };
+ const maxV = Number($('f-max').value);
+ if (Number.isInteger(maxV) && maxV > 0) payload.max_completions = maxV;
+
+ const k = $('f-kind').value;
+ if (k === 'phrase') payload.challenge = { kind: 'phrase', phrase: $('f-phrase').value.trim() };
+ else if (k === 'quiz') {
+ const choices = [...document.querySelectorAll('.f-choice')].map((i) => i.value.trim()).filter(Boolean);
+ payload.challenge = { kind: 'quiz', question: $('f-question').value.trim(), choices, answer: Number($('f-answer').value) };
+ } else payload.challenge = { kind: 'tap' };
+
+ submit.disabled = true; msg.textContent = 'Placing…'; msg.style.color = 'var(--text-2)';
+ try {
+ await api.create(payload);
+ msg.textContent = '✓ World Line placed. Visitors can now find it on the map.';
+ msg.style.color = 'var(--green)';
+ setTimeout(renderCreate, 900);
+ } catch (err) {
+ msg.textContent = err.message || 'Could not place the World Line.';
+ msg.style.color = 'var(--danger)';
+ submit.disabled = false;
+ }
+ });
+}
+
+function dashCard(w, completions) {
+ const pct = w.max_completions ? Math.min(100, Math.round((w.completion_count / w.max_completions) * 100)) : null;
+ return `
+ <article class="card dash-quest">
+ <h3>${esc(w.title)}</h3>
+ <div class="meta">${diffChip(w.difficulty)}${rewardChip(w.reward_kind)}${w.expired ? '<span class="chip">Expired</span>' : w.hidden ? '<span class="chip">Hidden</span>' : '<span class="chip done">Active</span>'}</div>
+ <div style="font-size:13px;color:var(--text-2)">${w.completion_count} ${w.completion_count === 1 ? 'completion' : 'completions'}${w.max_completions ? ` of ${w.max_completions}` : ''}</div>
+ ${pct != null ? `<div class="bar"><span style="width:${pct}%"></span></div>` : ''}
+ <div style="font-size:12px;color:var(--text-3)">Anchored in area <span class="mono">${esc(w.coarse_cell)}</span> — completions are counted by coarse cell only.</div>
+ </article>`;
+}
+
+// ── Ceremony modal ───────────────────────────────────────────────────────────
+let _ceremony = null;
+async function openCeremony(quest) {
+ const fix = currentFix();
+ if (!fix) { selectTab('near'); return; }
+ // Pull the full quest detail (reveals the AR answer only because we’re co-located).
+ let detail = quest;
+ try {
+ const d = await api.getQuest(quest.id, fix.lat, fix.lng, fix.accuracy);
+ if (d?.world_line) detail = { ...quest, ...d.world_line };
+ } catch { /* fall back to the list view of the quest */ }
+
+ const host = $('ceremony-host');
+ host.innerHTML = '';
+ _ceremony = new WorldLineCeremony({
+ worldLine: detail,
+ client: api,
+ getFix: currentFix,
+ avatarUrl: quest.avatar_url || null,
+ muted: reduceMotion,
+ onGranted: () => { closeCeremony(); renderNear(); },
+ }).mount(host);
+ $('ceremony-modal').classList.add('open');
+}
+function closeCeremony() {
+ $('ceremony-modal').classList.remove('open');
+ if (_ceremony) { _ceremony.destroy(); _ceremony = null; }
+}
+$('ceremony-close').addEventListener('click', closeCeremony);
+$('ceremony-modal').addEventListener('click', (e) => { if (e.target === $('ceremony-modal')) closeCeremony(); });
+document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && $('ceremony-modal').classList.contains('open')) closeCeremony(); });
+
+// ── Boot ─────────────────────────────────────────────────────────────────────
+// Deep link support: /world-lines#explore etc.
+const hashTab = (location.hash || '').replace('#', '');
+selectTab(TABS.includes(hashTab) ? hashTab : 'near');
diff --git a/tests/agent-labor-economics.test.js b/tests/agent-labor-economics.test.js
new file mode 100644
index 000000000..2589b371c
--- /dev/null
+++ b/tests/agent-labor-economics.test.js
@@ -0,0 +1,127 @@
+// Unit tests for the Agent Labor Market's pure economics (Moonshot 01).
+// No DB / network — these guard the money math: the award score, reputation,
+// the exact-integer settlement split, and the autonomous negotiation rule.
+
+import { describe, it, expect } from 'vitest';
+import {
+ scoreBid, reputationFromStats, settlementSplit, defaultRoyaltyBps,
+ negotiationPrice, etaForReputation, threeToAtomics, atomicsToThree,
+ SCORE_WEIGHTS,
+} from '../api/_lib/labor-economics.js';
+
+describe('scoreBid', () => {
+ it('is 0 when the bid asks for the full reward (no discount, no eta/rep credit)', () => {
+ expect(scoreBid({ priceAtomics: 1_000_000n, rewardAtomics: 1_000_000n, etaSeconds: null, reputation: 0 })).toBe(0);
+ });
+
+ it('approaches 1 for a free, instant bid from a perfect-reputation worker', () => {
+ const s = scoreBid({ priceAtomics: 0n, rewardAtomics: 1_000_000n, etaSeconds: 0, reputation: 1 });
+ // price=1, eta≈1 (eta 0 → 1), rep=1 → ~ sum of weights
+ expect(s).toBeGreaterThan(0.99);
+ expect(s).toBeLessThanOrEqual(1);
+ });
+
+ it('rewards a deeper discount monotonically', () => {
+ const cheap = scoreBid({ priceAtomics: 200_000n, rewardAtomics: 1_000_000n, etaSeconds: 1800, reputation: 0.5 });
+ const pricey = scoreBid({ priceAtomics: 800_000n, rewardAtomics: 1_000_000n, etaSeconds: 1800, reputation: 0.5 });
+ expect(cheap).toBeGreaterThan(pricey);
+ });
+
+ it('rewards faster ETA and higher reputation', () => {
+ const base = { priceAtomics: 500_000n, rewardAtomics: 1_000_000n };
+ expect(scoreBid({ ...base, etaSeconds: 60, reputation: 0.5 })).toBeGreaterThan(scoreBid({ ...base, etaSeconds: 36000, reputation: 0.5 }));
+ expect(scoreBid({ ...base, etaSeconds: 1800, reputation: 0.9 })).toBeGreaterThan(scoreBid({ ...base, etaSeconds: 1800, reputation: 0.1 }));
+ });
+
+ it('weights sum to 1 (a normalized score)', () => {
+ expect(SCORE_WEIGHTS.price + SCORE_WEIGHTS.eta + SCORE_WEIGHTS.reputation).toBeCloseTo(1, 9);
+ });
+
+ it('clamps reputation out of range', () => {
+ const over = scoreBid({ priceAtomics: 0n, rewardAtomics: 1_000_000n, etaSeconds: 0, reputation: 5 });
+ expect(over).toBeLessThanOrEqual(1);
+ });
+});
+
+describe('reputationFromStats', () => {
+ it('gives a new agent a neutral-but-unproven prior (0.35)', () => {
+ expect(reputationFromStats({})).toBe(0.35);
+ });
+ it('rises with success and volume, saturating volume at 10 jobs', () => {
+ expect(reputationFromStats({ settled: 10, failed: 0 })).toBe(1); // 0.7*1 + 0.3*1
+ expect(reputationFromStats({ settled: 5, failed: 0 })).toBeCloseTo(0.85, 5); // 0.7 + 0.3*0.5
+ });
+ it('punishes failures via success rate', () => {
+ expect(reputationFromStats({ settled: 1, failed: 4 })).toBeLessThan(reputationFromStats({ settled: 4, failed: 1 }));
+ });
+});
+
+describe('settlementSplit', () => {
+ it('the three legs always sum to exactly the escrowed reward (no dust)', () => {
+ for (const [reward, awarded] of [[1_000_000n, 800_000n], [999_999n, 333_333n], [7n, 7n], [10n, 3n]]) {
+ const s = settlementSplit({ rewardAtomics: reward, awardedAtomics: awarded, royaltyBps: 1000, hasAuthor: true });
+ expect(s.workerAtomics + s.royaltyAtomics + s.posterRefundAtomics).toBe(reward);
+ expect(s.workerAtomics).toBeGreaterThanOrEqual(0n);
+ expect(s.royaltyAtomics).toBeGreaterThanOrEqual(0n);
+ expect(s.posterRefundAtomics).toBeGreaterThanOrEqual(0n);
+ }
+ });
+
+ it('routes royalty out of the awarded amount only when there is an author', () => {
+ const withAuthor = settlementSplit({ rewardAtomics: 1_000_000n, awardedAtomics: 1_000_000n, royaltyBps: 1000, hasAuthor: true });
+ expect(withAuthor.royaltyAtomics).toBe(100_000n);
+ expect(withAuthor.workerAtomics).toBe(900_000n);
+ const noAuthor = settlementSplit({ rewardAtomics: 1_000_000n, awardedAtomics: 1_000_000n, royaltyBps: 1000, hasAuthor: false });
+ expect(noAuthor.royaltyAtomics).toBe(0n);
+ expect(noAuthor.workerAtomics).toBe(1_000_000n);
+ });
+
+ it('refunds the auction surplus (reward minus the lower winning bid) to the poster', () => {
+ const s = settlementSplit({ rewardAtomics: 1_000_000n, awardedAtomics: 600_000n, royaltyBps: 0, hasAuthor: false });
+ expect(s.posterRefundAtomics).toBe(400_000n);
+ expect(s.workerAtomics).toBe(600_000n);
+ });
+
+ it('never pays out more than the escrow, even if the awarded amount exceeds it', () => {
+ const s = settlementSplit({ rewardAtomics: 500_000n, awardedAtomics: 999_999n, royaltyBps: 1000, hasAuthor: true });
+ expect(s.workerAtomics + s.royaltyAtomics + s.posterRefundAtomics).toBe(500_000n);
+ expect(s.posterRefundAtomics).toBe(0n);
+ });
+
+ it('defaultRoyaltyBps is a sane 10% by default', () => {
+ expect(defaultRoyaltyBps()).toBe(1000);
+ });
+});
+
+describe('negotiationPrice', () => {
+ it('never exceeds the reward or the worker max-bid ceiling', () => {
+ expect(negotiationPrice({ rewardAtomics: 1_000_000n, maxBidAtomics: 400_000n, reputation: 1 })).toBeLessThanOrEqual(400_000n);
+ expect(negotiationPrice({ rewardAtomics: 1_000_000n, maxBidAtomics: null, reputation: 1 })).toBeLessThanOrEqual(1_000_000n);
+ });
+ it('higher reputation holds nearer the ceiling; lower reputation discounts harder', () => {
+ const high = negotiationPrice({ rewardAtomics: 1_000_000n, reputation: 1 });
+ const low = negotiationPrice({ rewardAtomics: 1_000_000n, reputation: 0 });
+ expect(high).toBeGreaterThan(low);
+ expect(low).toBe(800_000n); // 0.80 × reward
+ expect(high).toBe(980_000n); // 0.98 × reward
+ });
+ it('is always at least 1 atomic', () => {
+ expect(negotiationPrice({ rewardAtomics: 1n, reputation: 0 })).toBeGreaterThanOrEqual(1n);
+ });
+});
+
+describe('etaForReputation', () => {
+ it('faster the higher the reputation, bounded 30m..2h', () => {
+ expect(etaForReputation(0)).toBe(7200);
+ expect(etaForReputation(1)).toBe(1800);
+ expect(etaForReputation(0.5)).toBeGreaterThan(etaForReputation(1));
+ });
+});
+
+describe('atomics conversion', () => {
+ it('round-trips $THREE ↔ atomics at 6 decimals', () => {
+ expect(threeToAtomics(1.5)).toBe(1_500_000n);
+ expect(atomicsToThree(1_500_000n)).toBe(1.5);
+ expect(threeToAtomics(-5)).toBe(0n); // never negative
+ });
+});
diff --git a/tests/api-labor-lifecycle.test.js b/tests/api-labor-lifecycle.test.js
new file mode 100644
index 000000000..26dc96c04
--- /dev/null
+++ b/tests/api-labor-lifecycle.test.js
@@ -0,0 +1,134 @@
+// Settlement lifecycle for the Agent Labor Market (Moonshot 01).
+// Exercises the money-moving core — runSettlement — for the happy path (verify
+// pass → on-chain worker payout + author royalty + poster surplus refund +
+// invocation receipt) and the refund path (verify fail → full refund, job failed).
+// All on-chain + DB leaves are mocked; the real exact-integer split runs.
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+
+const sql = vi.fn(async (strings, ...values) => {
+ const id = values[0];
+ const wallets = {
+ w: { id: 'w', user_id: 'uw', name: 'Worker', meta: { solana_address: 'WADDR', encrypted_solana_secret: 'enc' } },
+ p: { id: 'p', user_id: 'up', name: 'Poster', meta: { solana_address: 'PADDR' } },
+ };
+ return wallets[id] ? [wallets[id]] : [];
+});
+vi.mock('../api/_lib/db.js', () => ({ sql }));
+
+// agent-labor: real pure math, spies for the DB ops.
+const claimSettle = vi.fn();
+const recordVerdict = vi.fn(async () => ({}));
+const markJobSettled = vi.fn(async () => ({}));
+const markJobFailed = vi.fn(async () => ({}));
+const setBountyStatus = vi.fn(async () => ({}));
+vi.mock('../api/_lib/agent-labor.js', async () => {
+ const econ = await import('../api/_lib/labor-economics.js');
+ return {
+ settlementSplit: econ.settlementSplit,
+ defaultRoyaltyBps: econ.defaultRoyaltyBps,
+ atomicsToThree: econ.atomicsToThree,
+ _toBig: econ.toBig,
+ claimSettle, recordVerdict, markJobSettled, markJobFailed, setBountyStatus,
+ getBounty: vi.fn(), getJobByBounty: vi.fn(),
+ };
+});
+
+// labor-match: verifier + author resolver are the injectable decision points.
+const verifyDeliverable = vi.fn();
+const resolveSkillAuthorPayout = vi.fn();
+vi.mock('../api/_lib/labor-match.js', () => ({
+ verifyDeliverable,
+ resolveSkillAuthorPayout,
+ emitReasoning: vi.fn(),
+ autoBidForBounty: vi.fn(),
+ autoAwardIfReady: vi.fn(),
+ performJob: vi.fn(),
+}));
+
+const payFromEscrow = vi.fn(async ({ toAddress, amountAtomics }) => `SIG:${toAddress}:${amountAtomics}`);
+vi.mock('../api/_lib/labor-escrow.js', () => ({ payFromEscrow }));
+
+vi.mock('../api/_lib/agent-wallet.js', () => ({
+ recoverSolanaAgentKeypair: vi.fn(async () => ({ publicKey: { toBase58: () => 'WADDR' } })),
+}));
+const recordInvocationReceipt = vi.fn(async () => ({ signature: 'INVSIG' }));
+vi.mock('../api/_lib/agent-invocation-onchain.js', () => ({ recordInvocationReceipt }));
+vi.mock('../api/_lib/agent-trade-guards.js', () => ({ recordCustodyEvent: vi.fn(async () => 1) }));
+
+const { runSettlement } = await import('../api/_lib/labor-settle.js');
+
+const bounty = { id: 'b1', reward_atomics: '1000000', poster_agent_id: 'p', required_skill: 'summarize', title: 'Task' };
+const job = { id: 'job1', price_atomics: '800000', worker_agent_id: 'w', deliverable: { output: 'a real deliverable' } };
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ claimSettle.mockResolvedValue(job); // this caller wins the settle claim
+});
+
+describe('runSettlement — happy path (verify pass)', () => {
+ it('releases worker payout + author royalty + poster surplus, sums to the reward, records the receipt', async () => {
+ verifyDeliverable.mockResolvedValue({ pass: true, score: 0.92, reason: 'good', verifier: 'llm' });
+ resolveSkillAuthorPayout.mockResolvedValue({ payoutAddress: 'AUTHOR', authorAgentId: 'author-agent' });
+
+ const result = await runSettlement({ job, bounty });
+
+ expect(result.settled).toBe(true);
+ expect(result.status).toBe('settled');
+
+ // 800000 awarded → 10% royalty (80000) to author, 720000 to worker, 200000 surplus refunded to poster.
+ const byTo = Object.fromEntries(payFromEscrow.mock.calls.map(([a]) => [a.toAddress, a.amountAtomics]));
+ expect(byTo.WADDR).toBe(720_000n);
+ expect(byTo.AUTHOR).toBe(80_000n);
+ expect(byTo.PADDR).toBe(200_000n);
+ // Conservation: every atomic out of escrow equals the escrowed reward.
+ const total = payFromEscrow.mock.calls.reduce((s, [a]) => s + a.amountAtomics, 0n);
+ expect(total).toBe(1_000_000n);
+
+ expect(markJobSettled).toHaveBeenCalledWith('job1', expect.objectContaining({
+ workerPayoutAtomics: 720_000n, royaltyAtomics: 80_000n, royaltyAuthorId: 'author-agent', invocationSig: 'INVSIG',
+ }));
+ expect(recordInvocationReceipt).toHaveBeenCalledTimes(1);
+ expect(setBountyStatus).toHaveBeenCalledWith('b1', 'settled');
+ });
+
+ it('routes the full awarded amount to the worker when the skill has no author', async () => {
+ verifyDeliverable.mockResolvedValue({ pass: true, score: 0.8, reason: 'ok', verifier: 'heuristic' });
+ resolveSkillAuthorPayout.mockResolvedValue(null);
+
+ await runSettlement({ job, bounty });
+ const byTo = Object.fromEntries(payFromEscrow.mock.calls.map(([a]) => [a.toAddress, a.amountAtomics]));
+ expect(byTo.WADDR).toBe(800_000n); // no royalty skimmed
+ expect(byTo.AUTHOR).toBeUndefined();
+ expect(byTo.PADDR).toBe(200_000n);
+ });
+});
+
+describe('runSettlement — refund path (verify fail)', () => {
+ it('refunds the poster in full, marks the job failed, releases nothing to the worker', async () => {
+ verifyDeliverable.mockResolvedValue({ pass: false, score: 0.1, reason: 'off-spec', verifier: 'llm' });
+
+ const result = await runSettlement({ job, bounty });
+
+ expect(result.settled).toBe(false);
+ expect(result.status).toBe('failed');
+ expect(payFromEscrow).toHaveBeenCalledTimes(1);
+ expect(payFromEscrow).toHaveBeenCalledWith({ toAddress: 'PADDR', amountAtomics: 1_000_000n });
+ expect(markJobFailed).toHaveBeenCalledWith('job1', expect.objectContaining({ status: 'failed' }));
+ expect(setBountyStatus).toHaveBeenCalledWith('b1', 'failed', expect.any(Object));
+ expect(recordInvocationReceipt).not.toHaveBeenCalled();
+ });
+});
+
+describe('runSettlement — idempotency', () => {
+ it('no-ops when another settle already owns the claim (never double-pays)', async () => {
+ claimSettle.mockResolvedValue(null); // claim already taken
+ sql.mockResolvedValueOnce([{ ...job, status: 'settled' }]);
+
+ const result = await runSettlement({ job, bounty });
+
+ expect(result.idempotent).toBe(true);
+ expect(payFromEscrow).not.toHaveBeenCalled();
+ expect(markJobSettled).not.toHaveBeenCalled();
+ });
+});
diff --git a/tests/stage-show.test.js b/tests/stage-show.test.js
index 1f8ad5742..3a17fa3ee 100644
Binary files a/tests/stage-show.test.js and b/tests/stage-show.test.js differ
diff --git a/vite.config.js b/vite.config.js
index 5c7128615..4c3b56b4c 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -419,6 +419,7 @@ const appConfig = {
temporary: resolve(__dirname, 'pages/temporary.html'),
irl: resolve(__dirname, 'pages/irl.html'),
'irl-privacy': resolve(__dirname, 'pages/irl-privacy.html'),
+ 'world-lines': resolve(__dirname, 'pages/world-lines.html'),
communities: resolve(__dirname, 'pages/communities.html'),
clash: resolve(__dirname, 'pages/clash.html'),
'walk-embed': resolve(__dirname, 'pages/walk-embed.html'),
@@ -850,6 +851,8 @@ support: resolve(__dirname, 'pages/support.html'),
'/irl/': resolve(root, 'pages/irl.html'),
'/irl-privacy': resolve(root, 'pages/irl-privacy.html'),
'/irl-privacy/': resolve(root, 'pages/irl-privacy.html'),
+ '/world-lines': resolve(root, 'pages/world-lines.html'),
+ '/world-lines/': resolve(root, 'pages/world-lines.html'),
'/play': resolve(root, 'pages/play.html'),
'/play/': resolve(root, 'pages/play.html'),
'/play/agent-wallet': resolve(root, 'pages/play/agent-wallet.html'),