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 IRL logo, log-redaction guards, agent-detail polish, IBM x402 demo

nirholasab1f6baf33b0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba5a1f930..3d6820a82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,12 +18,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **IRL agents now materialize as you walk up to them** — On three.ws/irl, a 3D agent placed further away first appears as a glowing beacon to keep things light. Previously it stayed a beacon even after you walked right up to it; now it upgrades to the full 3D avatar the moment you come within range, so approaching an agent in real life actually reveals it. Distance to each nearby agent is also recalculated live as you move instead of being frozen at the moment you arrived. Long AR sessions are smoother too: agents that leave the area now fully release their 3D model from memory instead of quietly accumulating, which keeps the camera view fast when you're somewhere busy with lots of agents coming and going. (`/irl`) `[fix, improvement]`
- **IRL agents now visibly react when someone engages them** — Walk past an agent placed in the real world and it now feels alive: the moment anyone standing nearby taps it, leaves it a message, or pays it, the agent does a little perk-up and a reaction floats up off its head — a 💜 for a glance, a ✨ 'paid' burst for a real on-chain payment, a 💬 for a message — and everyone viewing that spot sees it at once, not just the person who acted. A busy agent looks busy, which is the whole point of putting one somewhere public. Rapid taps are smoothed so the same person can't spam the reaction, while payments and messages always come through. The reaction is purely a visual flourish — it carries no one's location or wallet — and if your connection drops to the slower fallback the interaction is still recorded for the owner; only the live animation is skipped. (`/irl`) `[feature]`
- **IRL agents turn to look at you as you move around them** — On three.ws/irl, a placed 3D agent now notices the viewer. As you move your phone around it, it eases its body toward your camera and layers on a natural head turn so it appears to look right at you — the real-world version of a desktop avatar that follows your cursor. The head movement is clamped to a realistic neck range so it never over-rotates, and an avatar with no head bone falls back to a clean whole-body turn. Back away and the agent eases home to the heading it was placed at. When nobody is close it shows a subtle idle gaze drift instead of a frozen stare, and the first time you step within a few metres it gives a brief notice reaction. Motion is eased throughout and only the nearest on-screen agents are tracked each frame, so it stays smooth even with several agents around you. (`/irl`) `[improvement]`
+- **IRL has its own logo** — The /irl world now carries a proper mark of its own: the three.ws crystal cube floating above an augmented-reality ground reticle, connected by a placement beam — a tiny picture of exactly what IRL does, anchor a 3D agent to a real spot. It replaces the plain text tag at the top of the camera view and shows up on the welcome screen too, and the cube's anchor glows green the moment Camera AR goes live. A full-resolution app-icon version ships alongside it. (`/irl`) `[improvement]`
- **IRL never shows a blank screen — every state is now designed** — Every corner of three.ws/irl now tells you what's going on instead of leaving a blank space. The radar minimap reads 'No agents in range' when an area is quiet, and 'Can't refresh' if the nearby feed briefly drops — then recovers on its own. The nearby count, when GPS is live but nobody's pinned around you yet, invites you to be the first to drop an agent there rather than simply disappearing. Tap an agent's Pay or Use button without a wallet connected and you now get a clear, lasting card explaining how to connect one — instead of a message that flashes away before you can read it. And your IRL Placements dashboard now has a proper loading skeleton, a friendly empty state when you haven't placed anything, and a retry button if the list can't load — never a spinner that hangs or a void. (`/irl`) `[improvement]`
- **IRL now fails gracefully — clear states instead of blank screens** — Every part of three.ws/irl now shows a designed state when something isn't right, instead of a blank screen or a message that flashes for three seconds and disappears. On a device or browser that can't run the AR view, IRL now says so up front and points you to browse agents and the marketplace on the web. If an agent's 3D avatar fails to load, you get a clear card with a Retry button instead of the scene just sitting empty. Your My pins list now tells the difference between 'you haven't placed any yet' and 'we couldn't load them right now' — the latter offers a retry instead of pretending the list is empty. When the nearby-agents view can't refresh, the count now says so and keeps retrying rather than silently looking deserted. And camera issues — no access granted, or a browser with no camera at all — now show a recoverable card explaining what to do, noting the 3D scene still works without the camera. (`/irl`) `[improvement, fix]`
- **IRL placements now have guardrails: report a pin, content checks, and area limits** — Now that anyone at a location can see anyone's placed agent on three.ws/irl, we've added the safety layer that makes a public shared space work. Tap any agent that isn't yours and you'll find a Report option — pick a reason (spam, hate, impersonation, scam, sexual content, or something else) and once enough different people flag the same pin it's automatically hidden from everyone, with the reporter seeing it disappear right away. One person can't hide someone else's agent, and repeat reports from the same device don't stack, so the system can't be gamed to silence a legitimate pin. At placement time, captions and agent names are screened for slurs and hateful content and rejected with a clear, fixable message, and a pin can only ever reference $THREE — no other coin can be advertised. Pay buttons are locked to three.ws payment endpoints so a pin can't point you at an off-platform drain. To stop one person from carpet-bombing a plaza, each small area caps how many agents it holds and each person has an active-pin limit — and if you hit a limit you get a plain-language nudge (shorten the text, move, wait a moment, or remove an old pin) instead of a silent failure. Abandoned anonymous pins are now cleaned up automatically; your signed-in permanent pins are never touched. (`/irl`) `[security, feature]`
- **IRL stays smooth at crowded locations** — three.ws/irl now holds a steady frame rate even when a busy spot is packed with placed agents. Only the nearest few load as full 3D avatars; agents further out render as lightweight cardboard-style billboards that cost almost nothing, and ones far past that fade out entirely until you walk closer. As you move, avatars load nearest-first and the ones you leave behind are freed from memory, so a long walk past dozens of agents never piles up. IRL also reads your device on startup and picks a matching quality level — turning down resolution and shadows on lower-end phones — and if the frame rate dips under load it steps quality down on the fly and back up when there's room, so the camera view degrades gracefully instead of stuttering. (`/irl`) `[improvement, infra]`
- **IRL walks you through camera, motion & location — and never dead-ends on a blocked permission** — The first time you open three.ws/irl, a quick setup card explains why each sensor matters and asks for one at a time: the camera to see your agents in the real world, motion to look around, and location to place agents and discover the ones others left nearby. Every outcome is designed — you see why we’re asking, a green check when access is granted, and if you decline you get the exact steps to switch it back on (the precise iOS Settings path on iPhone) with a Try again button, not a toast that vanishes. Sensors your device doesn’t have are handled honestly, with a note on what still works. Block something later and a one-tap ‘Enable camera’ or ‘Enable location’ chip stays in the top bar so recovery is always within reach — and turning on the camera or pinning an agent re-asks through the same clear cards instead of failing silently. Your choices are remembered, so you’re never nagged twice. (`/irl`) `[feature, improvement]`
- **IRL world: placed agents are private by location — discovered only in person** — We changed how the /irl world reveals where agents are placed, for safety. There is no list, map, or feed of agent locations anywhere: an agent's spot is shared with your device only when you are physically within a short distance of it, so you come across one by walking up and pointing your camera — never by browsing locations from afar. The live realtime server no longer broadcasts a neighborhood's placements to everyone connected; it now carries only presence (how many people are viewing nearby) and ambient reactions, both kept coarse and anonymous. The 'nearby' read is hard-capped to a tight radius and rate-limited so it can't be swept to rebuild a map. Placing agents and the multiplayer presence layer keep working as before. (`/irl`) `[security, improvement]`
+- **IRL: extra guards so your location never leaks into our logs** — Two privacy hardening passes on the /irl world. First, when you look for nearby agents your device sends its position in the request — if that request ever hit a server error, your exact coordinates and your device's anonymous token could have been written into our internal error logs and alerts. We now scrub location and device tokens out of anything that gets logged, so a hiccup can never spill where you are. Second, the coordinates the 'nearby' feed hands back are now rounded to roughly a metre instead of full satellite precision: still exact enough to see an agent as you walk up to it, but no longer carrying a pinpoint-precise reading that could fingerprint a spot. Placing and discovering agents works exactly as before. (`/irl`) `[security]`
+- **IRL: pinned agents now stay put in your room instead of following the camera** — When you turned on Camera AR and tapped Pin here, the agent was supposed to stay anchored to a real spot so you'd only see it by pointing your phone at it — but unless a precise GPS fix had already landed (or if location was off), it stayed glued to the center of the screen and panned around with you. The world-lock that rotates the view with your phone only ran in full GPS mode; without it the camera silently fell back to an orbit that kept the agent centered. Pinning now world-locks immediately using your phone's motion sensors: the agent holds the exact spot where you placed it, the view rotates as you turn, and it slides off-screen and back as you pan — with no wait for GPS. When a location fix does arrive it upgrades to the shared, cross-user anchor as before. (`/irl`) `[fix]`
- **Jump straight from an agent's profile into IRL or XR** — Every agent profile now has View in IRL and View in XR buttons next to See in 3D. View in IRL drops you into three.ws/irl already wearing that agent's body, and if the same agent is placed nearby it flashes its pin and opens its card so you land right on it. View in XR opens the immersive AR/VR viewer with that agent loaded. Both are real links, so you can open them in a new tab, and every agent has a body to show — its own 3D model or the shared mannequin — so the buttons are never dead ends. This matches the Walk IRL / View in XR buttons avatars already had, so the whole platform now routes into the immersive layer from one surface to the next. (`/irl`) `[feature]`
- **Live trade feed: the time-window filters work on first load** — On the Live Trade Feed, the 1h / 24h / 7d window buttons threw an error as the page set up its controls, which could leave the feed stuck before it finished loading. The control-syncing code was treating a group of buttons as a single element. It now handles the whole group, so the window and min-PnL filters initialize and switch cleanly every time. (`/trades`) `[fix]`
- **Minting an agent's on-chain collectible is reliable under load** — Preparing an agent's on-chain mint sometimes failed when the shared public Solana RPC was rate-limited — the request to fetch a recent blockhash came back 'too many requests' and the whole prep errored out. Minting now builds the transaction through the same multi-endpoint failover the rest of the platform uses, rotating to a healthy Solana provider instead of giving up, so a busy public endpoint no longer blocks a mint. Solana name (.sol) lookups and the signer-balance watchdog were moved onto the same resilient connection. (`/create`) `[fix, improvement]`
diff --git a/api/_lib/http.js b/api/_lib/http.js
index 8423a8489..25f8e23b9 100644
--- a/api/_lib/http.js
+++ b/api/_lib/http.js
@@ -40,6 +40,45 @@ export function error(res, status, code, message, extra = {}) {
return json(res, status, { error: code, error_description: message, ...extra });
}
+// Query params that can carry a user's real-world position or a bearer-style
+// device credential. These must never reach a log line, Sentry event, or ops
+// alert — all off-box sinks — so they are stripped from any request URL we log.
+// Matched on the lower-cased key so camelCase / snake_case variants are covered.
+const SENSITIVE_QUERY_KEYS = new Set([
+ 'lat', 'lng', 'latitude', 'longitude', 'll', 'coords', 'coord',
+ 'originlat', 'originlng', 'origin_lat', 'origin_lng',
+ 'devicetoken', 'device_token', 'token',
+]);
+
+// Reduce a request URL to a log-safe form: keep the path and any benign params,
+// but redact values that reveal a location or a credential. A geolocated read
+// such as /api/irl/pins?lat=…&lng=…&deviceToken=… would otherwise spill the
+// caller's exact position AND their device token into console / Sentry / Telegram
+// on any 5xx — so every place req.url flows to a log sink routes through here.
+export function redactUrl(rawUrl) {
+ const url = String(rawUrl ?? '');
+ const qIdx = url.indexOf('?');
+ if (qIdx < 0) return url;
+ const path = url.slice(0, qIdx);
+ let params;
+ try {
+ params = new URLSearchParams(url.slice(qIdx + 1));
+ } catch {
+ // Unparseable query → don't risk logging the raw (possibly sensitive) tail.
+ return `${path}?REDACTED`;
+ }
+ let touched = false;
+ for (const key of [...params.keys()]) {
+ if (SENSITIVE_QUERY_KEYS.has(key.toLowerCase())) {
+ params.set(key, 'REDACTED');
+ touched = true;
+ }
+ }
+ if (!touched) return url;
+ const qs = params.toString();
+ return qs ? `${path}?${qs}` : path;
+}
+
// Short, URL-safe correlation id for tying a sanitized 5xx response back to the
// full server-side log line. Not security-sensitive — just needs to be unique.
function correlationId() {
@@ -230,10 +269,12 @@ export function wrap(handler) {
} catch (err) {
const status = err.status || 500;
if (status >= 500) {
+ // Redact coordinates / device tokens so a 5xx on a geolocated read never
+ // spills the caller's position or credential to an off-box sink.
console.error('[api] unhandled', err);
- captureException(err, { url: req.url, method: req.method });
- sendOpsAlert(`unhandled 5xx in ${req.method} ${req.url}`, err?.message || String(err), {
- signature: `unhandled:${req.url}:${err?.message}`,
+ captureException(err, { url: redactUrl(req.url), method: req.method });
+ sendOpsAlert(`unhandled 5xx in ${req.method} ${redactUrl(req.url)}`, err?.message || String(err), {
+ signature: `unhandled:${redactUrl(req.url)}:${err?.message}`,
});
}
if (!res.headersSent && !res.writableEnded) {
diff --git a/api/irl/pins.js b/api/irl/pins.js
index b3aa2f82a..0d033c691 100644
--- a/api/irl/pins.js
+++ b/api/irl/pins.js
@@ -151,6 +151,22 @@ function safeRemoteUrl(raw, { allowRelative = true } = {}) {
return { ok: true, value: u.toString() };
}
+// Coarsen a coordinate before it leaves the server in the PUBLIC nearby feed.
+// A phone GPS fix is accurate to ~5 m, so the sub-millimetre tail of a float64
+// degree is both useless for AR placement and a privacy hazard: an exact
+// 9-decimal reading is precise enough to fingerprint one device/fix and exposes
+// more than "an agent stands roughly here." 5 decimals ≈ 1.1 m — finer than GPS
+// error, ample to render the agent as you walk up — and the room frame
+// (rel_east_m / rel_north_m) still carries the exact intra-room layout untouched.
+// Distance is computed from the RAW coordinates before rounding, so proximity
+// filtering and the surfaced distance_m stay accurate.
+const PUBLIC_COORD_DP = 5;
+function roundCoord(v) {
+ if (typeof v !== 'number' || !Number.isFinite(v)) return v;
+ const f = 10 ** PUBLIC_COORD_DP;
+ return Math.round(v * f) / f;
+}
+
// Haversine distance in meters between two GPS points
function haversineDist(lat1, lng1, lat2, lng2) {
const R = 6371000;
@@ -508,8 +524,10 @@ export default wrap(async (req, res) => {
.map(r => ({
id: r.id,
agent_id: r.agent_id,
- lat: r.lat,
- lng: r.lng,
+ // Coarsened to ~1.1 m (PUBLIC_COORD_DP) — strips false precision a
+ // co-located reader could harvest while staying finer than GPS error.
+ lat: roundCoord(r.lat),
+ lng: roundCoord(r.lng),
heading: r.heading,
avatar_url: r.avatar_url,
avatar_name: r.avatar_name,
@@ -530,8 +548,10 @@ export default wrap(async (req, res) => {
room_id: r.room_id ?? null,
rel_east_m: r.rel_east_m,
rel_north_m: r.rel_north_m,
- origin_lat: r.origin_lat,
- origin_lng: r.origin_lng,
+ // The room origin is a GPS index too — coarsen it like lat/lng; the
+ // exact intra-room layout rides the relative offsets above, not the origin.
+ origin_lat: roundCoord(r.origin_lat),
+ origin_lng: roundCoord(r.origin_lng),
origin_yaw_deg: r.origin_yaw_deg,
// C6 — cheap re-skin signal: the viewer diffs this against its loaded
// pin and swaps the GLB when it bumps. (The editable manifest/base URL
diff --git a/data/changelog.json b/data/changelog.json
index 6f6edf7c1..65fc1e83c 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,27 @@
{
"$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-17",
+ "title": "IRL has its own logo",
+ "summary": "The /irl world now carries a proper mark of its own: the three.ws crystal cube floating above an augmented-reality ground reticle, connected by a placement beam — a tiny picture of exactly what IRL does, anchor a 3D agent to a real spot. It replaces the plain text tag at the top of the camera view and shows up on the welcome screen too, and the cube's anchor glows green the moment Camera AR goes live. A full-resolution app-icon version ships alongside it.",
+ "tags": ["improvement"],
+ "link": "/irl"
+ },
+ {
+ "date": "2026-06-17",
+ "title": "IRL: extra guards so your location never leaks into our logs",
+ "summary": "Two privacy hardening passes on the /irl world. First, when you look for nearby agents your device sends its position in the request — if that request ever hit a server error, your exact coordinates and your device's anonymous token could have been written into our internal error logs and alerts. We now scrub location and device tokens out of anything that gets logged, so a hiccup can never spill where you are. Second, the coordinates the 'nearby' feed hands back are now rounded to roughly a metre instead of full satellite precision: still exact enough to see an agent as you walk up to it, but no longer carrying a pinpoint-precise reading that could fingerprint a spot. Placing and discovering agents works exactly as before.",
+ "tags": ["security"],
+ "link": "/irl"
+ },
+ {
+ "date": "2026-06-17",
+ "title": "IRL: pinned agents now stay put in your room instead of following the camera",
+ "summary": "When you turned on Camera AR and tapped Pin here, the agent was supposed to stay anchored to a real spot so you'd only see it by pointing your phone at it — but unless a precise GPS fix had already landed (or if location was off), it stayed glued to the center of the screen and panned around with you. The world-lock that rotates the view with your phone only ran in full GPS mode; without it the camera silently fell back to an orbit that kept the agent centered. Pinning now world-locks immediately using your phone's motion sensors: the agent holds the exact spot where you placed it, the view rotates as you turn, and it slides off-screen and back as you pan — with no wait for GPS. When a location fix does arrive it upgrades to the shared, cross-user anchor as before.",
+ "tags": ["fix"],
+ "link": "/irl"
+ },
{
"date": "2026-06-17",
"title": "Mixamo-rigged avatars no longer lie down when they animate",
diff --git a/pages/ibm/x402-demo.html b/pages/ibm/x402-demo.html
new file mode 100644
index 000000000..d33a489a3
--- /dev/null
+++ b/pages/ibm/x402-demo.html
@@ -0,0 +1,564 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<title>x402 live demo — three.ws × IBM</title>
+<meta name="description" content="A live, self-contained x402 demo: pay $0.001 in USDC from your own wallet to call a real three.ws data API. Settled on-chain on Base or Solana. No backend, no account.">
+<link rel="preconnect" href="https://fonts.googleapis.com">
+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
+<style>
+*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+
+:root{
+ --ibm-blue:#0f62fe;
+ --ibm-blue-hover:#0353e9;
+ --ibm-ink:#161616;
+ --ibm-muted:#525252;
+ --ibm-subtle:#6f6f6f;
+ --ibm-border:#e0e0e0;
+ --ibm-divider:#c6c6c6;
+ --ibm-field:#f4f4f4;
+ --ibm-green:#198038;
+ --ibm-red:#da1e28;
+ --ibm-amber:#8e6a00;
+}
+
+html,body{
+ background:transparent;
+ font-family:'IBM Plex Sans',sans-serif;
+ color:var(--ibm-ink);
+ font-size:16px;line-height:1.5;
+ -webkit-font-smoothing:antialiased;
+}
+a{color:var(--ibm-blue);text-decoration:none}
+a:hover{text-decoration:underline}
+.mono{font-family:'IBM Plex Mono',monospace}
+
+.inner{max-width:880px;margin:0 auto;padding:0 16px}
+.section{padding:40px 0;border-bottom:1px solid var(--ibm-border)}
+.section:last-child{border-bottom:none}
+
+/* ── Hero ── */
+.hero{padding:56px 0 36px}
+.partner-label{
+ display:inline-flex;align-items:center;gap:12px;
+ border:1px solid var(--ibm-border);padding:6px 14px;
+ font-size:12px;letter-spacing:.08em;text-transform:uppercase;
+ color:var(--ibm-muted);margin-bottom:28px;
+}
+.hero h1{font-size:clamp(30px,5vw,46px);font-weight:300;line-height:1.1;margin-bottom:18px;max-width:680px}
+.hero h1 strong{font-weight:600}
+.hero-sub{font-size:18px;color:var(--ibm-muted);max-width:620px;font-weight:300;line-height:1.6}
+
+/* ── How-it-works strip ── */
+.steps{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:var(--ibm-border);border:1px solid var(--ibm-border)}
+.step{background:#fff;padding:24px 22px}
+.step-n{font-family:'IBM Plex Mono',monospace;font-size:12px;color:var(--ibm-blue);font-weight:500;margin-bottom:10px}
+.step h3{font-size:15px;font-weight:600;margin-bottom:6px}
+.step p{font-size:13px;color:var(--ibm-muted);font-weight:300;line-height:1.55}
+.step code{font-family:'IBM Plex Mono',monospace;font-size:12px;background:var(--ibm-field);padding:1px 5px;color:var(--ibm-ink)}
+
+/* ── Section heads ── */
+.section-tag{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--ibm-blue);margin-bottom:8px;font-weight:500}
+.section h2{font-size:clamp(22px,4vw,32px);font-weight:300}
+.section h2 strong{font-weight:600}
+.section-lead{font-size:15px;color:var(--ibm-muted);max-width:620px;margin-top:10px;font-weight:300;line-height:1.6}
+
+/* ── Demo card ── */
+.demo{border:1px solid var(--ibm-divider);margin-top:28px;background:#fff}
+.demo-head{padding:22px 24px 18px;border-bottom:1px solid var(--ibm-border);display:flex;flex-wrap:wrap;gap:16px;align-items:flex-end;justify-content:space-between}
+.demo-title{font-size:20px;font-weight:600}
+.demo-title span{color:var(--ibm-blue)}
+.demo-desc{font-size:13px;color:var(--ibm-muted);font-weight:300;max-width:460px;margin-top:4px;line-height:1.55}
+.price-tag{text-align:right;flex:0 0 auto}
+.price-tag .amt{font-size:30px;font-weight:300;line-height:1;font-variant-numeric:tabular-nums}
+.price-tag .amt strong{font-weight:600;color:var(--ibm-blue)}
+.price-tag .net{font-size:12px;color:var(--ibm-muted);margin-top:6px}
+
+.demo-body{padding:22px 24px}
+
+/* 402 preview */
+.preview{
+ border:1px solid var(--ibm-border);background:var(--ibm-field);
+ padding:14px 16px;margin-bottom:22px;font-family:'IBM Plex Mono',monospace;font-size:12px;
+}
+.preview-label{font-family:'IBM Plex Sans',sans-serif;font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--ibm-subtle);margin-bottom:10px;display:flex;align-items:center;gap:8px}
+.preview-label .dot{width:7px;height:7px;border-radius:50%;background:var(--ibm-subtle);flex:0 0 auto}
+.preview-label.ok .dot{background:var(--ibm-green)}
+.preview-label.err .dot{background:var(--ibm-red)}
+.preview-row{display:flex;gap:12px;padding:3px 0;flex-wrap:wrap}
+.preview-row .k{color:var(--ibm-subtle);min-width:84px}
+.preview-row .v{color:var(--ibm-ink);word-break:break-all}
+.badge{display:inline-block;font-family:'IBM Plex Sans',sans-serif;font-size:11px;font-weight:500;padding:1px 8px;border:1px solid var(--ibm-divider);margin-right:6px;border-radius:2px}
+
+/* input row */
+.field-row{display:flex;gap:0;flex-wrap:wrap;align-items:stretch;margin-bottom:18px}
+.field-wrap{flex:1 1 240px;min-width:0}
+.field-wrap label{display:block;font-size:12px;color:var(--ibm-muted);margin-bottom:6px;font-weight:500}
+.field{
+ width:100%;height:48px;padding:0 14px;border:none;border-bottom:1px solid var(--ibm-divider);
+ background:var(--ibm-field);font-family:'IBM Plex Mono',monospace;font-size:15px;color:var(--ibm-ink);
+ letter-spacing:.04em;outline:none;transition:border-color .12s,background .12s;
+}
+.field:focus{border-bottom:2px solid var(--ibm-blue);background:#fff}
+.field-hint{font-size:11px;color:var(--ibm-subtle);margin-top:6px}
+
+.btn{
+ display:inline-flex;align-items:center;justify-content:center;gap:10px;
+ background:var(--ibm-blue);color:#fff;border:none;cursor:pointer;
+ font-family:'IBM Plex Sans',sans-serif;font-size:15px;font-weight:500;letter-spacing:.01em;
+ padding:0 24px;height:48px;min-width:200px;align-self:flex-end;
+ transition:background .12s,transform .04s;
+}
+.btn:hover:not(:disabled){background:var(--ibm-blue-hover)}
+.btn:active:not(:disabled){transform:translateY(1px)}
+.btn:disabled{background:#c6c6c6;cursor:not-allowed}
+.btn .arrow{font-size:17px;line-height:1}
+@media(min-width:560px){.btn{margin-left:1px}}
+
+/* result panel */
+.result{border:1px solid var(--ibm-border);min-height:96px;padding:18px 20px;background:#fff;transition:border-color .15s}
+.result.is-empty{display:flex;align-items:center;justify-content:center;color:var(--ibm-subtle);font-size:13px;text-align:center;font-weight:300;border-style:dashed}
+.result.is-loading{border-color:var(--ibm-blue)}
+.result.is-error{border-color:var(--ibm-red)}
+.result.is-done{border-color:var(--ibm-green)}
+
+.r-status{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:500;margin-bottom:0}
+.r-status .spin{width:14px;height:14px;border:2px solid var(--ibm-divider);border-top-color:var(--ibm-blue);border-radius:50%;animation:spin .8s linear infinite;flex:0 0 auto}
+@keyframes spin{to{transform:rotate(360deg)}}
+.r-status.err{color:var(--ibm-red)}
+
+.r-headline{font-size:18px;font-weight:300;margin:2px 0 4px}
+.r-headline strong{font-weight:600}
+.r-reco{font-size:14px;color:var(--ibm-ink);margin-bottom:14px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
+.pill{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;padding:2px 9px;border-radius:2px}
+.pill.ok{background:#defbe6;color:var(--ibm-green)}
+.pill.warn{background:#fff8e1;color:var(--ibm-amber)}
+.pill.bad{background:#fff1f1;color:var(--ibm-red)}
+
+.matches{border-top:1px solid var(--ibm-border);margin-top:6px;padding-top:12px}
+.matches h4{font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--ibm-subtle);margin-bottom:8px;font-weight:600}
+.match{display:flex;justify-content:space-between;gap:12px;padding:5px 0;font-size:13px;border-bottom:1px solid var(--ibm-field)}
+.match:last-child{border-bottom:none}
+.match .m-name{color:var(--ibm-ink)}
+.match .m-name b{font-weight:600}
+.match .m-sim{font-family:'IBM Plex Mono',monospace;color:var(--ibm-muted);font-size:12px;flex:0 0 auto}
+
+.receipt{margin-top:14px;padding-top:12px;border-top:1px solid var(--ibm-border);display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 20px}
+.receipt .rk{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--ibm-subtle);margin-bottom:2px}
+.receipt .rv{font-family:'IBM Plex Mono',monospace;font-size:12px;color:var(--ibm-ink);word-break:break-all}
+
+.raw{margin-top:14px}
+.raw summary{cursor:pointer;font-size:12px;color:var(--ibm-muted);font-weight:500;user-select:none}
+.raw summary:hover{color:var(--ibm-blue)}
+.raw pre{margin-top:10px;background:#161616;color:#e0e0e0;padding:14px 16px;overflow:auto;max-height:300px;font-family:'IBM Plex Mono',monospace;font-size:12px;line-height:1.5}
+
+.retry{margin-top:14px;background:none;border:1px solid var(--ibm-divider);color:var(--ibm-ink);padding:9px 16px;font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:border-color .12s,color .12s}
+.retry:hover{border-color:var(--ibm-blue);color:var(--ibm-blue)}
+
+/* requirements note */
+.note{display:flex;gap:14px;margin-top:22px;padding:16px 18px;border:1px solid var(--ibm-border);background:var(--ibm-field)}
+.note svg{flex:0 0 auto;width:20px;height:20px;color:var(--ibm-blue);margin-top:1px}
+.note p{font-size:13px;color:var(--ibm-muted);line-height:1.6;font-weight:300}
+.note p b{color:var(--ibm-ink);font-weight:600}
+
+/* embed snippet */
+.embed-block{background:#161616;color:#e0e0e0;border:1px solid #393939;padding:18px 20px;overflow:auto;margin-top:24px;font-family:'IBM Plex Mono',monospace;font-size:13px;line-height:1.6}
+.embed-block .c-tag{color:#82cfff}
+.embed-block .c-attr{color:#a6c8ff}
+.embed-block .c-str{color:#a7f0ba}
+.embed-block .c-com{color:#8d8d8d}
+.copy-row{display:flex;justify-content:flex-end;margin-top:10px}
+.copy-btn{background:none;border:1px solid var(--ibm-divider);color:var(--ibm-muted);font-family:inherit;font-size:12px;font-weight:500;padding:7px 14px;cursor:pointer;transition:border-color .12s,color .12s}
+.copy-btn:hover{border-color:var(--ibm-blue);color:var(--ibm-blue)}
+
+/* footer */
+.footer{padding:40px 0;color:var(--ibm-subtle);font-size:12px}
+.footer-nav{display:flex;flex-wrap:wrap;gap:20px;margin-bottom:18px}
+.footer-nav a{color:var(--ibm-muted);font-weight:500;font-size:13px}
+.footer-nav a:hover{color:var(--ibm-blue)}
+.footer-legal{padding-top:16px;border-top:1px solid var(--ibm-border);line-height:1.6}
+
+@media(max-width:640px){
+ .steps{grid-template-columns:1fr}
+ .demo-head{flex-direction:column;align-items:flex-start}
+ .price-tag{text-align:left}
+ .btn{width:100%;align-self:stretch}
+}
+</style>
+</head>
+<body>
+
+<!-- ══ HERO ══ -->
+<div class="hero">
+ <div class="inner">
+ <div class="partner-label">
+ <svg width="40" height="16" viewBox="0 0 48 19" fill="none" aria-hidden="true"><rect width="48" height="19" fill="#1F70C1"/><text x="4" y="14" font-family="Arial" font-size="11" font-weight="700" fill="white">IBM</text></svg>
+ <span>Business Partner</span>
+ <span style="color:var(--ibm-border)">|</span>
+ <span class="mono">three.ws</span>
+ </div>
+ <h1>See <strong>x402</strong> work — pay a fraction of a cent for a real API call</h1>
+ <p class="hero-sub">x402 turns the dormant HTTP <span class="mono">402 Payment Required</span> status into a payment rail. A normal request comes back with machine-readable payment terms; your wallet signs a stablecoin authorization and retries; the call settles on-chain in about a second. No keys, no account, no invoice. Try it below with your own wallet.</p>
+ </div>
+</div>
+
+<!-- ══ HOW IT WORKS ══ -->
+<div class="section">
+ <div class="inner">
+ <div class="section-tag">The protocol in three moves</div>
+ <h2>How <strong>x402</strong> works</h2>
+ <div class="steps" style="margin-top:24px">
+ <div class="step">
+ <div class="step-n">01 · REQUEST</div>
+ <h3>You ask normally</h3>
+ <p>A plain <code>GET</code> to a paid endpoint — no payment attached yet.</p>
+ </div>
+ <div class="step">
+ <div class="step-n">02 · 402 CHALLENGE</div>
+ <h3>Server quotes a price</h3>
+ <p>It replies <code>402</code> with exactly what it wants: amount, asset, network, and the address to pay.</p>
+ </div>
+ <div class="step">
+ <div class="step-n">03 · PAY &amp; RETRY</div>
+ <h3>Wallet signs, call settles</h3>
+ <p>You sign a gasless USDC authorization, resend with an <code>X-PAYMENT</code> header, and get your data.</p>
+ </div>
+ </div>
+ </div>
+</div>
+
+<!-- ══ LIVE DEMO ══ -->
+<div class="section">
+ <div class="inner">
+ <div class="section-tag">Live · production endpoint</div>
+ <h2>Buy a <strong>data call</strong> for $0.001</h2>
+ <p class="section-lead">This calls a real three.ws API — a token-symbol availability check — for one tenth of a cent in USDC, settled on Base or Solana mainnet. Nothing here is mocked: the price below is read live from the server's own 402 response.</p>
+
+ <div class="demo">
+ <div class="demo-head">
+ <div>
+ <div class="demo-title">three<span>.ws</span> Symbol Check</div>
+ <div class="demo-desc">Is a ticker already taken? Returns exact and look-alike matches across symbols indexed by three.ws.</div>
+ </div>
+ <div class="price-tag">
+ <div class="amt" id="priceAmt">$<strong>0.001</strong></div>
+ <div class="net">USDC · per call</div>
+ </div>
+ </div>
+
+ <div class="demo-body">
+ <!-- live 402 preview -->
+ <div class="preview" aria-live="polite">
+ <div class="preview-label" id="pvLabel"><span class="dot"></span><span id="pvLabelText">Reading the server's 402 challenge…</span></div>
+ <div id="pvRows"></div>
+ </div>
+
+ <!-- input -->
+ <div class="field-row">
+ <div class="field-wrap">
+ <label for="ticker">Ticker to check</label>
+ <input id="ticker" class="field" value="GRANITE" maxlength="32" autocomplete="off" spellcheck="false" aria-describedby="tickerHint">
+ <div class="field-hint" id="tickerHint">A–Z and 0–9, up to 32 characters.</div>
+ </div>
+ <button id="payBtn" class="btn">Pay $0.001 &amp; run <span class="arrow">→</span></button>
+ </div>
+
+ <!-- result -->
+ <div id="result" class="result is-empty" role="status" aria-live="polite">
+ Run the call to see live, on-chain-paid data appear here.
+ </div>
+
+ <!-- requirements -->
+ <div class="note">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>
+ <p>You'll need a browser wallet — <b>MetaMask</b> (for Base) or <b>Phantom</b> (for Solana) — holding at least <b>$0.001 USDC</b> on mainnet. This spends real funds, but only a tenth of a cent. The payment is a gasless signature; the network fee is sponsored. Don't have a wallet? You can still watch the 402 challenge above and read the <a href="https://three.ws/docs/x402" target="_blank" rel="noopener">protocol docs</a>.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<!-- ══ EMBED ══ -->
+<div class="section">
+ <div class="inner">
+ <div class="section-tag">For developers</div>
+ <h2>Add a paywall in <strong>eight lines</strong></h2>
+ <p class="section-lead">The button above is powered by one drop-in script. Any element with a <span class="mono">data-x402-endpoint</span> opens the wallet flow on click — no framework, no build step, no SDK.</p>
+ <div class="embed-block" id="embedCode"><span class="c-com">&lt;!-- one script tag, served from three.ws --&gt;</span>
+<span class="c-tag">&lt;script</span> <span class="c-attr">type</span>=<span class="c-str">"module"</span> <span class="c-attr">src</span>=<span class="c-str">"https://three.ws/x402.js"</span><span class="c-tag">&gt;&lt;/script&gt;</span>
+
+<span class="c-com">&lt;!-- any element with data-x402-endpoint becomes payable --&gt;</span>
+<span class="c-tag">&lt;button</span>
+ <span class="c-attr">data-x402-endpoint</span>=<span class="c-str">"https://three.ws/api/x402/symbol-availability?ticker=GRANITE"</span>
+ <span class="c-attr">data-x402-merchant</span>=<span class="c-str">"three.ws"</span>
+ <span class="c-attr">data-x402-action</span>=<span class="c-str">"Check symbol"</span><span class="c-tag">&gt;</span>
+ Pay $0.001 &amp; run
+<span class="c-tag">&lt;/button&gt;</span></div>
+ <div class="copy-row"><button class="copy-btn" id="copyBtn">Copy snippet</button></div>
+ </div>
+</div>
+
+<!-- ══ FOOTER ══ -->
+<div class="footer">
+ <div class="inner">
+ <nav class="footer-nav">
+ <a href="https://three.ws" target="_blank" rel="noopener">Platform</a>
+ <a href="https://three.ws/docs/x402" target="_blank" rel="noopener">x402 Protocol</a>
+ <a href="https://three.ws/docs/ibm-x402" target="_blank" rel="noopener">IBM × x402 Docs</a>
+ <a href="https://three.ws/bazaar" target="_blank" rel="noopener">Endpoint Bazaar</a>
+ <a href="https://three.ws/changelog" target="_blank" rel="noopener">Changelog</a>
+ </nav>
+ <div class="footer-legal">
+ Live x402 demo · three.ws, an IBM Business Partner. Payments settle in USDC on Base or Solana mainnet via the x402 protocol. The only coin this platform issues is $THREE (FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump).
+ </div>
+ </div>
+</div>
+
+<!-- x402 drop-in payment modal (Phantom/MetaMask wallet flow + 402 retry) -->
+<script type="module" src="https://three.ws/x402.js"></script>
+
+<script>
+(function () {
+ 'use strict';
+
+ // The paid endpoint this demo calls. Swap to any three.ws x402 GET endpoint
+ // (e.g. /api/x402/skill-marketplace) and the page adapts automatically.
+ var ENDPOINT = 'https://three.ws/api/x402/symbol-availability';
+ // Per-call spend ceiling (micro-USD) handed to the widget as a safety rail:
+ // $0.01, so a $0.001 call always clears but a misconfigured price can't drain.
+ var MAX_PER_CALL_MICRO_USD = 10000;
+
+ var $ = function (id) { return document.getElementById(id); };
+
+ function escapeHtml(s) {
+ return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
+ return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c];
+ });
+ }
+ function sanitizeTicker(raw) {
+ return String(raw || '').toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 32);
+ }
+ function shortAddr(a) {
+ if (!a) return '—';
+ return a.length > 16 ? a.slice(0, 6) + '…' + a.slice(-4) : a;
+ }
+ function fmtUsd(atomics, decimals) {
+ var n = Number(atomics) / Math.pow(10, decimals == null ? 6 : decimals);
+ if (n < 0.01) return '$' + n.toFixed(6).replace(/0+$/, '').replace(/\.$/, '');
+ return '$' + n.toFixed(2);
+ }
+ function networkLabel(net) {
+ if (!net) return net;
+ if (net.indexOf('solana') === 0) return 'Solana';
+ if (net === 'eip155:8453') return 'Base';
+ if (net.indexOf('eip155:') === 0) return 'EVM ' + net.split(':')[1];
+ return net;
+ }
+ function explorerUrl(net, tx) {
+ if (!tx || !net) return null;
+ if (net.indexOf('solana') === 0) return 'https://solscan.io/tx/' + tx;
+ if (net === 'eip155:8453') return 'https://basescan.org/tx/' + tx;
+ return null;
+ }
+
+ // ── 1. Read the live 402 challenge so visitors see the real, current terms ──
+ function loadChallengePreview() {
+ var ticker = sanitizeTicker($('ticker').value) || 'GRANITE';
+ fetch(ENDPOINT + '?ticker=' + encodeURIComponent(ticker), { method: 'GET' })
+ .then(function (res) {
+ // Standard x402: 402 with the envelope in the body (and PAYMENT-REQUIRED header).
+ if (res.status !== 402 && res.status !== 401) {
+ throw new Error('Expected 402, got ' + res.status);
+ }
+ return res.json().catch(function () { return null; });
+ })
+ .then(function (body) {
+ var accepts = (body && body.accepts) || [];
+ if (!accepts.length) throw new Error('No payment terms in challenge');
+ renderChallengePreview(accepts);
+ })
+ .catch(function (err) {
+ var label = $('pvLabel'); label.className = 'preview-label err';
+ $('pvLabelText').textContent = 'Could not reach the endpoint (' + err.message + '). The demo still works once it is back.';
+ $('pvRows').innerHTML = '';
+ });
+ }
+
+ function renderChallengePreview(accepts) {
+ // Dedupe to one entry per network (the server advertises a Permit2 sibling
+ // on Base that the browser modal doesn't use — collapse it for clarity).
+ var byNet = {};
+ accepts.forEach(function (a) {
+ var key = a.network;
+ if (!byNet[key] || (a.extra && a.extra.assetTransferMethod === 'permit2' && byNet[key].extra && byNet[key].extra.assetTransferMethod === 'permit2')) {
+ if (!byNet[key]) byNet[key] = a;
+ }
+ });
+ var nets = Object.keys(byNet).map(function (k) { return byNet[k]; });
+ var first = nets[0];
+ var decimals = (first.extra && first.extra.decimals) || 6;
+
+ $('priceAmt').innerHTML = first.amount === '1000'
+ ? '$<strong>0.001</strong>'
+ : fmtUsd(first.amount, decimals).replace(/^\$/, '$<strong>') + '</strong>';
+
+ var label = $('pvLabel'); label.className = 'preview-label ok';
+ $('pvLabelText').innerHTML = '<span class="mono">HTTP 402 Payment Required</span> — the server is quoting these terms right now';
+
+ var rows = '';
+ rows += '<div class="preview-row"><span class="k">price</span><span class="v">' + escapeHtml(fmtUsd(first.amount, decimals)) + ' USDC</span></div>';
+ var badges = nets.map(function (a) { return '<span class="badge">' + escapeHtml(networkLabel(a.network)) + '</span>'; }).join('');
+ rows += '<div class="preview-row"><span class="k">networks</span><span class="v">' + badges + '</span></div>';
+ nets.forEach(function (a) {
+ rows += '<div class="preview-row"><span class="k">pay&nbsp;to</span><span class="v">' + escapeHtml(shortAddr(a.payTo)) + ' <span style="color:var(--ibm-subtle)">(' + escapeHtml(networkLabel(a.network)) + ')</span></span></div>';
+ });
+ rows += '<div class="preview-row"><span class="k">scheme</span><span class="v">' + escapeHtml(first.scheme || 'exact') + ' · gasless authorization</span></div>';
+ $('pvRows').innerHTML = rows;
+ }
+
+ // ── 2. Result rendering states ───────────────────────────────────────────
+ function setResultEmpty() {
+ var el = $('result');
+ el.className = 'result is-empty';
+ el.innerHTML = 'Run the call to see live, on-chain-paid data appear here.';
+ }
+ function setResultLoading(msg) {
+ var el = $('result');
+ el.className = 'result is-loading';
+ el.innerHTML = '<div class="r-status"><span class="spin"></span><span>' + escapeHtml(msg || 'Waiting for your wallet…') + '</span></div>';
+ }
+ function setResultError(msg) {
+ var el = $('result');
+ el.className = 'result is-error';
+ el.innerHTML =
+ '<div class="r-status err">✕ <span>' + escapeHtml(msg || 'Something went wrong.') + '</span></div>' +
+ '<button class="retry" id="retryBtn">Try again</button>';
+ var rb = $('retryBtn'); if (rb) rb.addEventListener('click', runPayment);
+ }
+
+ function recoPill(result) {
+ if (result.exact_collision) return '<span class="pill bad">taken</span>';
+ var sim = result.similar && result.similar[0];
+ if (sim && sim.similarity >= 0.8) return '<span class="pill warn">close match</span>';
+ return '<span class="pill ok">available</span>';
+ }
+
+ function setResultDone(out) {
+ var result = out.result || {};
+ var payment = out.payment || {};
+ var el = $('result');
+ el.className = 'result is-done';
+
+ var html = '';
+ html += '<div class="r-status" style="color:var(--ibm-green)">✓ <span>Payment settled — response delivered</span></div>';
+ html += '<div class="r-headline" style="margin-top:12px">Ticker <strong>$' + escapeHtml(result.ticker || '') + '</strong></div>';
+ html += '<div class="r-reco">' + recoPill(result) + '<span>' + escapeHtml(result.recommendation || '') + '</span></div>';
+
+ var exact = result.exact_matches || [];
+ var similar = result.similar || [];
+ if (exact.length || similar.length) {
+ html += '<div class="matches">';
+ if (exact.length) {
+ html += '<h4>Exact matches</h4>';
+ exact.forEach(function (m) {
+ html += '<div class="match"><span class="m-name"><b>' + escapeHtml(m.ticker) + '</b> · ' + escapeHtml(m.name || '') + '</span><span class="m-sim">' + escapeHtml(shortAddr(m.mint)) + '</span></div>';
+ });
+ }
+ if (similar.length) {
+ html += '<h4' + (exact.length ? ' style="margin-top:12px"' : '') + '>Look-alike symbols</h4>';
+ similar.forEach(function (m) {
+ html += '<div class="match"><span class="m-name"><b>' + escapeHtml(m.ticker) + '</b> · ' + escapeHtml(m.name || '') + '</span><span class="m-sim">sim ' + escapeHtml(String(m.similarity)) + '</span></div>';
+ });
+ }
+ html += '</div>';
+ }
+
+ // on-chain receipt
+ var explorer = explorerUrl(payment.network, payment.transaction);
+ html += '<div class="receipt">';
+ html += '<div><div class="rk">Network</div><div class="rv">' + escapeHtml(networkLabel(payment.network) || '—') + '</div></div>';
+ html += '<div><div class="rk">Payer</div><div class="rv">' + escapeHtml(shortAddr(payment.payer)) + '</div></div>';
+ html += '<div><div class="rk">Transaction</div><div class="rv">' +
+ (payment.transaction
+ ? (explorer ? '<a href="' + explorer + '" target="_blank" rel="noopener">' + escapeHtml(shortAddr(payment.transaction)) + ' ↗</a>' : escapeHtml(shortAddr(payment.transaction)))
+ : '—') +
+ '</div></div>';
+ html += '</div>';
+
+ // raw payload for the curious
+ html += '<details class="raw"><summary>View raw response &amp; settlement</summary><pre>' +
+ escapeHtml(JSON.stringify({ response: result, payment: payment }, null, 2)).slice(0, 6000) +
+ '</pre></details>';
+
+ el.innerHTML = html;
+ }
+
+ // ── 3. Drive the payment via the drop-in widget ──────────────────────────
+ function runPayment() {
+ var ticker = sanitizeTicker($('ticker').value);
+ if (!ticker) {
+ setResultError('Enter a ticker (A–Z, 0–9) to check.');
+ return;
+ }
+ $('ticker').value = ticker;
+
+ if (!window.X402 || typeof window.X402.pay !== 'function') {
+ setResultError('Payment widget is still loading — give it a second and try again.');
+ return;
+ }
+
+ setResultLoading('Opening wallet… approve the $0.001 USDC payment to continue.');
+ var endpoint = ENDPOINT + '?ticker=' + encodeURIComponent(ticker);
+
+ window.X402.pay({
+ endpoint: endpoint,
+ method: 'GET',
+ merchant: 'three.ws',
+ action: 'Check $' + ticker + ' availability',
+ caps: { maxPerCall: MAX_PER_CALL_MICRO_USD }
+ }).then(function (out) {
+ if (out && out.ok) setResultDone(out);
+ else setResultError('The call did not complete. Please try again.');
+ }).catch(function (err) {
+ if (err && err.code === 'cancelled') { setResultEmpty(); return; }
+ setResultError((err && err.message) || 'Payment failed.');
+ });
+ }
+
+ // ── wiring ───────────────────────────────────────────────────────────────
+ $('payBtn').addEventListener('click', runPayment);
+ $('ticker').addEventListener('keydown', function (e) { if (e.key === 'Enter') runPayment(); });
+ // Refresh the live 402 preview when the ticker changes (debounced).
+ var pvTimer;
+ $('ticker').addEventListener('input', function () {
+ clearTimeout(pvTimer);
+ pvTimer = setTimeout(loadChallengePreview, 400);
+ });
+
+ $('copyBtn').addEventListener('click', function () {
+ var snippet =
+ '<script type="module" src="https://three.ws/x402.js"><\/script>\n\n' +
+ '<button\n' +
+ ' data-x402-endpoint="https://three.ws/api/x402/symbol-availability?ticker=GRANITE"\n' +
+ ' data-x402-merchant="three.ws"\n' +
+ ' data-x402-action="Check symbol">\n' +
+ ' Pay $0.001 & run\n' +
+ '</button>';
+ navigator.clipboard.writeText(snippet).then(function () {
+ var b = $('copyBtn'); var t = b.textContent;
+ b.textContent = 'Copied ✓';
+ setTimeout(function () { b.textContent = t; }, 1600);
+ }).catch(function () {
+ var b = $('copyBtn'); b.textContent = 'Copy failed';
+ setTimeout(function () { b.textContent = 'Copy snippet'; }, 1600);
+ });
+ });
+
+ loadChallengePreview();
+})();
+</script>
+</body>
+</html>
diff --git a/pages/irl.html b/pages/irl.html
index 69a83d96c..53bf0b673 100644
--- a/pages/irl.html
+++ b/pages/irl.html
@@ -173,6 +173,29 @@
50% { opacity: 0.5; transform: scale(0.7); }
}
+ /* IRL logo mark — the three.ws crystal cube anchored to an AR ground
+ reticle. Drawn in currentColor so it inherits the badge ink (white),
+ and re-tinted green when AR is live to echo the status dot. */
+ .irl-badge-mark {
+ width: 16px;
+ height: 17px;
+ flex-shrink: 0;
+ margin-right: 1px;
+ overflow: visible;
+ stroke: currentColor;
+ stroke-width: 1.5;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ }
+ .irl-badge-mark .irl-mark-cube { opacity: 0.95; }
+ .irl-badge-mark .irl-mark-beam { opacity: 0.45; }
+ .irl-badge-mark .irl-mark-anchor { opacity: 0.6; transition: stroke 0.3s, opacity 0.3s; }
+ .irl-badge-mark .irl-mark-dot { fill: currentColor; opacity: 0.75; transition: fill 0.3s, opacity 0.3s; }
+ .irl-badge-word { line-height: 1; }
+ /* AR live: the ground anchor lights up green, the same signal as the dot */
+ body.is-ar .irl-badge-mark .irl-mark-anchor { stroke: var(--green); opacity: 0.95; }
+ body.is-ar .irl-badge-mark .irl-mark-dot { fill: var(--green); opacity: 1; }
+
.irl-share-btn {
background: transparent;
border: 1px solid var(--border);
@@ -1518,9 +1541,16 @@
Back
</a>
<div class="irl-topbar-center">
- <span class="irl-badge">
+ <span class="irl-badge" role="img" aria-label="three.ws IRL — augmented reality">
+ <svg class="irl-badge-mark" viewBox="0 0 26 28" fill="none" aria-hidden="true">
+ <path class="irl-mark-cube" d="M13 2.5 4 7v9l9 4.5 9-4.5V7Z"/>
+ <path class="irl-mark-cube" d="M13 2.5v9M4 7l9 4.5M22 7l-9 4.5"/>
+ <path class="irl-mark-beam" d="M13 20.5v1.9"/>
+ <ellipse class="irl-mark-anchor" cx="13" cy="24.3" rx="7.4" ry="1.9"/>
+ <circle class="irl-mark-dot" cx="13" cy="24.3" r="1" stroke="none"/>
+ </svg>
+ <span class="irl-badge-word">IRL</span>
<span class="irl-badge-dot"></span>
- IRL
</span>
<span id="irl-nearby-badge" hidden aria-live="polite"></span>
<span id="irl-net-pill" class="irl-net-pill" hidden role="status" aria-live="polite"></span>
diff --git a/public/changelog.json b/public/changelog.json
index 943af4f40..f37f2f42a 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-17T08:27:45.049Z",
+ "generated_at": "2026-06-17T11:04:20.491Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -130,6 +130,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-17",
+ "type": "update",
+ "title": "IRL has its own logo",
+ "summary": "The /irl world now carries a proper mark of its own: the three.ws crystal cube floating above an augmented-reality ground reticle, connected by a placement beam — a tiny picture of exactly what IRL does, anchor a 3D agent to a real spot. It replaces the plain text tag at the top of the camera view and shows up on the welcome screen too, and the cube's anchor glows green the moment Camera AR goes live. A full-resolution app-icon version ships alongside it.",
+ "link": "/irl",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-17",
"type": "update",
@@ -195,6 +205,26 @@
"improvement"
]
},
+ {
+ "date": "2026-06-17",
+ "type": "update",
+ "title": "IRL: extra guards so your location never leaks into our logs",
+ "summary": "Two privacy hardening passes on the /irl world. First, when you look for nearby agents your device sends its position in the request — if that request ever hit a server error, your exact coordinates and your device's anonymous token could have been written into our internal error logs and alerts. We now scrub location and device tokens out of anything that gets logged, so a hiccup can never spill where you are. Second, the coordinates the 'nearby' feed hands back are now rounded to roughly a metre instead of full satellite precision: still exact enough to see an agent as you walk up to it, but no longer carrying a pinpoint-precise reading that could fingerprint a spot. Placing and discovering agents works exactly as before.",
+ "link": "/irl",
+ "tags": [
+ "security"
+ ]
+ },
+ {
+ "date": "2026-06-17",
+ "type": "update",
+ "title": "IRL: pinned agents now stay put in your room instead of following the camera",
+ "summary": "When you turned on Camera AR and tapped Pin here, the agent was supposed to stay anchored to a real spot so you'd only see it by pointing your phone at it — but unless a precise GPS fix had already landed (or if location was off), it stayed glued to the center of the screen and panned around with you. The world-lock that rotates the view with your phone only ran in full GPS mode; without it the camera silently fell back to an orbit that kept the agent centered. Pinning now world-locks immediately using your phone's motion sensors: the agent holds the exact spot where you placed it, the view rotates as you turn, and it slides off-screen and back as you pan — with no wait for GPS. When a location fix does arrive it upgrades to the shared, cross-user anchor as before.",
+ "link": "/irl",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-17",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index ea6ac3e6c..9210e9607 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -102,6 +102,14 @@
<category>improvement</category>
<description>On three.ws/irl, a placed 3D agent now notices the viewer. As you move your phone around it, it eases its body toward your camera and layers on a natural head turn so it appears to look right at you — the real-world version of a desktop avatar that follows your cursor. The head movement is clamped to a realistic neck range so it never over-rotates, and an avatar with no head bone falls back to a clean whole-body turn. Back away and the agent eases home to the heading it was placed at. When nobody is close it shows a subtle idle gaze drift instead of a frozen stare, and the first time you step within a few metres it gives a brief notice reaction. Motion is eased throughout and only the nearest on-screen agents are tracked each frame, so it stays smooth even with several agents around you.</description>
</item>
+ <item>
+ <title>IRL has its own logo</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-17:IRL has its own logo</guid>
+ <pubDate>Wed, 17 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The /irl world now carries a proper mark of its own: the three.ws crystal cube floating above an augmented-reality ground reticle, connected by a placement beam — a tiny picture of exactly what IRL does, anchor a 3D agent to a real spot. It replaces the plain text tag at the top of the camera view and shows up on the welcome screen too, and the cube's anchor glows green the moment Camera AR goes live. A full-resolution app-icon version ships alongside it.</description>
+ </item>
<item>
<title>IRL never shows a blank screen — every state is now designed</title>
<link>https://three.ws/irl</link>
@@ -150,6 +158,22 @@
<category>security</category>
<description>We changed how the /irl world reveals where agents are placed, for safety. There is no list, map, or feed of agent locations anywhere: an agent's spot is shared with your device only when you are physically within a short distance of it, so you come across one by walking up and pointing your camera — never by browsing locations from afar. The live realtime server no longer broadcasts a neighborhood's placements to everyone connected; it now carries only presence (how many people are viewing nearby) and ambient reactions, both kept coarse and anonymous. The 'nearby' read is hard-capped to a tight radius and rate-limited so it can't be swept to rebuild a map. Placing agents and the multiplayer presence layer keep working as before.</description>
</item>
+ <item>
+ <title>IRL: extra guards so your location never leaks into our logs</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-17:IRL: extra guards so your location never leaks into our logs</guid>
+ <pubDate>Wed, 17 Jun 2026 12:00:00 GMT</pubDate>
+ <category>security</category>
+ <description>Two privacy hardening passes on the /irl world. First, when you look for nearby agents your device sends its position in the request — if that request ever hit a server error, your exact coordinates and your device's anonymous token could have been written into our internal error logs and alerts. We now scrub location and device tokens out of anything that gets logged, so a hiccup can never spill where you are. Second, the coordinates the 'nearby' feed hands back are now rounded to roughly a metre instead of full satellite precision: still exact enough to see an agent as you walk up to it, but no longer carrying a pinpoint-precise reading that could fingerprint a spot. Placing and discovering agents works exactly as before.</description>
+ </item>
+ <item>
+ <title>IRL: pinned agents now stay put in your room instead of following the camera</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-17:IRL: pinned agents now stay put in your room instead of following the camera</guid>
+ <pubDate>Wed, 17 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>When you turned on Camera AR and tapped Pin here, the agent was supposed to stay anchored to a real spot so you'd only see it by pointing your phone at it — but unless a precise GPS fix had already landed (or if location was off), it stayed glued to the center of the screen and panned around with you. The world-lock that rotates the view with your phone only ran in full GPS mode; without it the camera silently fell back to an orbit that kept the agent centered. Pinning now world-locks immediately using your phone's motion sensors: the agent holds the exact spot where you placed it, the view rotates as you turn, and it slides off-screen and back as you pan — with no wait for GPS. When a location fix does arrive it upgrades to the shared, cross-user anchor as before.</description>
+ </item>
<item>
<title>Jump straight from an agent's profile into IRL or XR</title>
<link>https://three.ws/irl</link>
diff --git a/public/features.json b/public/features.json
index d68c38210..73da0d336 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-17T08:27:45.038Z",
+ "generated_at": "2026-06-17T11:04:20.456Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/irl-logo.svg b/public/irl-logo.svg
new file mode 100644
index 000000000..5c9e98528
--- /dev/null
+++ b/public/irl-logo.svg
@@ -0,0 +1,106 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512" role="img" aria-label="three.ws IRL">
+ <defs>
+ <!-- Vertex glow -->
+ <radialGradient id="irlVglow" cx="50%" cy="50%" r="50%">
+ <stop offset="0%" stop-color="#ffffff" stop-opacity="0.95"/>
+ <stop offset="30%" stop-color="#b8e8ff" stop-opacity="0.5"/>
+ <stop offset="100%" stop-color="#b8e8ff" stop-opacity="0"/>
+ </radialGradient>
+ <!-- Ground-anchor glow -->
+ <radialGradient id="irlGround" cx="50%" cy="50%" r="50%">
+ <stop offset="0%" stop-color="#7ec8e3" stop-opacity="0.35"/>
+ <stop offset="60%" stop-color="#3a8fb5" stop-opacity="0.12"/>
+ <stop offset="100%" stop-color="#3a8fb5" stop-opacity="0"/>
+ </radialGradient>
+ <!-- Anchor beam -->
+ <linearGradient id="irlBeam" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stop-color="#b8e8ff" stop-opacity="0.7"/>
+ <stop offset="100%" stop-color="#7ec8e3" stop-opacity="0"/>
+ </linearGradient>
+ <!-- Edge glow filter -->
+ <filter id="irlEdge" x="-20%" y="-20%" width="140%" height="140%">
+ <feGaussianBlur stdDeviation="3" result="b"/>
+ <feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
+ </filter>
+ <!-- Strong vertex glow filter -->
+ <filter id="irlVtx" x="-100%" y="-100%" width="300%" height="300%">
+ <feGaussianBlur stdDeviation="8" result="b"/>
+ <feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
+ </filter>
+ <!-- Cube face gradients -->
+ <linearGradient id="irlFaceTop" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stop-color="#1a2a3a" stop-opacity="0.7"/>
+ <stop offset="100%" stop-color="#0a1520" stop-opacity="0.85"/>
+ </linearGradient>
+ <linearGradient id="irlFaceRight" x1="0" y1="0" x2="1" y2="1">
+ <stop offset="0%" stop-color="#0f1e2e" stop-opacity="0.8"/>
+ <stop offset="100%" stop-color="#060e18" stop-opacity="0.9"/>
+ </linearGradient>
+ <linearGradient id="irlFaceLeft" x1="1" y1="0" x2="0" y2="1">
+ <stop offset="0%" stop-color="#0d1a28" stop-opacity="0.75"/>
+ <stop offset="100%" stop-color="#080f1a" stop-opacity="0.9"/>
+ </linearGradient>
+ </defs>
+
+ <!-- Background -->
+ <rect width="512" height="512" rx="96" fill="#080814"/>
+
+ <!-- Ground glow pooled under the anchor -->
+ <ellipse cx="256" cy="392" rx="168" ry="48" fill="url(#irlGround)"/>
+
+ <!-- ── Floating crystal cube (the three.ws primitive) ──
+ Vertices: top 256,92 · back-L 150,150 · back-R 362,150
+ center 256,208 · side-L 150,266 · side-R 362,266 · front-bottom 256,324 -->
+
+ <!-- Faces -->
+ <polygon points="256,92 150,150 150,266 256,324" fill="url(#irlFaceLeft)"/>
+ <polygon points="256,92 362,150 362,266 256,324" fill="url(#irlFaceRight)"/>
+ <polygon points="256,92 150,150 256,208 362,150" fill="url(#irlFaceTop)"/>
+
+ <!-- Inner face grid -->
+ <line x1="203" y1="121" x2="203" y2="295" stroke="#1a3a5a" stroke-width="0.6" opacity="0.3"/>
+ <line x1="150" y1="208" x2="256" y2="208" stroke="#1a3a5a" stroke-width="0.6" opacity="0.3"/>
+ <line x1="309" y1="121" x2="309" y2="295" stroke="#1a3a5a" stroke-width="0.6" opacity="0.3"/>
+ <line x1="256" y1="208" x2="362" y2="208" stroke="#1a3a5a" stroke-width="0.6" opacity="0.3"/>
+ <line x1="203" y1="121" x2="309" y2="121" stroke="#1a3a5a" stroke-width="0.6" opacity="0.25"/>
+ <line x1="256" y1="92" x2="256" y2="208" stroke="#1a3a5a" stroke-width="0.6" opacity="0.25"/>
+
+ <!-- Anchor beam: cube → ground -->
+ <line x1="256" y1="324" x2="256" y2="390" stroke="url(#irlBeam)" stroke-width="3" stroke-dasharray="2 9" stroke-linecap="round"/>
+
+ <!-- Edges -->
+ <g filter="url(#irlEdge)" stroke-linecap="round">
+ <line x1="256" y1="92" x2="150" y2="150" stroke="#7ec8e3" stroke-width="2.4" opacity="0.75"/>
+ <line x1="256" y1="92" x2="362" y2="150" stroke="#7ec8e3" stroke-width="2.4" opacity="0.75"/>
+ <line x1="150" y1="150" x2="256" y2="208" stroke="#5aadcf" stroke-width="1.6" opacity="0.5"/>
+ <line x1="362" y1="150" x2="256" y2="208" stroke="#5aadcf" stroke-width="1.6" opacity="0.5"/>
+ <line x1="150" y1="150" x2="150" y2="266" stroke="#5aadcf" stroke-width="2" opacity="0.55"/>
+ <line x1="362" y1="150" x2="362" y2="266" stroke="#5aadcf" stroke-width="2" opacity="0.55"/>
+ <line x1="256" y1="208" x2="256" y2="324" stroke="#4a9abf" stroke-width="1.6" opacity="0.42"/>
+ <line x1="150" y1="266" x2="256" y2="324" stroke="#5aadcf" stroke-width="2" opacity="0.6"/>
+ <line x1="362" y1="266" x2="256" y2="324" stroke="#5aadcf" stroke-width="2" opacity="0.6"/>
+ </g>
+
+ <!-- Vertex glows -->
+ <circle cx="256" cy="92" r="15" fill="url(#irlVglow)" filter="url(#irlVtx)"/>
+ <circle cx="150" cy="150" r="10" fill="url(#irlVglow)" opacity="0.6" filter="url(#irlVtx)"/>
+ <circle cx="362" cy="150" r="10" fill="url(#irlVglow)" opacity="0.6" filter="url(#irlVtx)"/>
+ <circle cx="256" cy="208" r="7" fill="url(#irlVglow)" opacity="0.32" filter="url(#irlVtx)"/>
+ <circle cx="150" cy="266" r="7" fill="url(#irlVglow)" opacity="0.32" filter="url(#irlVtx)"/>
+ <circle cx="362" cy="266" r="7" fill="url(#irlVglow)" opacity="0.42" filter="url(#irlVtx)"/>
+ <circle cx="256" cy="324" r="8" fill="url(#irlVglow)" opacity="0.45" filter="url(#irlVtx)"/>
+
+ <!-- ── AR ground-anchor reticle ── -->
+ <g filter="url(#irlEdge)">
+ <ellipse cx="256" cy="392" rx="140" ry="34" fill="none" stroke="#7ec8e3" stroke-width="2.2" opacity="0.7"/>
+ <ellipse cx="256" cy="392" rx="88" ry="21" fill="none" stroke="#5aadcf" stroke-width="1.6" opacity="0.5"/>
+ <!-- cardinal ticks -->
+ <line x1="256" y1="350" x2="256" y2="364" stroke="#b8e8ff" stroke-width="2.4" stroke-linecap="round" opacity="0.85"/>
+ <line x1="256" y1="420" x2="256" y2="434" stroke="#7ec8e3" stroke-width="2.4" stroke-linecap="round" opacity="0.7"/>
+ <line x1="106" y1="392" x2="120" y2="392" stroke="#7ec8e3" stroke-width="2.4" stroke-linecap="round" opacity="0.7"/>
+ <line x1="392" y1="392" x2="406" y2="392" stroke="#7ec8e3" stroke-width="2.4" stroke-linecap="round" opacity="0.7"/>
+ </g>
+ <!-- Anchor point -->
+ <circle cx="256" cy="392" r="6" fill="#b8e8ff" filter="url(#irlVtx)"/>
+ <circle cx="256" cy="392" r="2.6" fill="#ffffff"/>
+</svg>
diff --git a/scripts/shot-agent-detail.mjs b/scripts/shot-agent-detail.mjs
new file mode 100644
index 000000000..c5356f768
--- /dev/null
+++ b/scripts/shot-agent-detail.mjs
@@ -0,0 +1,43 @@
+import { chromium } from 'playwright';
+
+const id = process.argv[2] || '6bf40884-35af-432e-b432-8ba73fb5ba15';
+const wait = Number(process.argv[3] || 15000);
+const url = `http://localhost:3000/agents/${id}`;
+const browser = await chromium.launch();
+const page = await browser.newPage({ viewport: { width: 1280, height: 1600 } });
+const errs = [];
+page.on('console', (m) => { if (m.type() === 'error') errs.push(m.text()); });
+page.on('pageerror', (e) => errs.push('PAGEERROR ' + e.message));
+await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 45000 }).catch((e) => console.log('nav:', e.message));
+await page.waitForTimeout(wait);
+
+const info = await page.evaluate(() => {
+ const out = [];
+ const walk = (root, path) => {
+ for (const el of root.querySelectorAll('*')) {
+ if (el.tagName === 'MODEL-VIEWER' || el.tagName === 'CANVAS') {
+ const r = el.getBoundingClientRect();
+ const cs = getComputedStyle(el);
+ out.push({
+ path: path + ' > ' + el.tagName.toLowerCase() + (el.id ? '#' + el.id : ''),
+ src: (el.getAttribute && el.getAttribute('src') || '').slice(-44),
+ box: { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) },
+ pos: cs.position, z: cs.zIndex, disp: cs.display, vis: cs.visibility, op: cs.opacity, overflow: cs.overflow,
+ });
+ }
+ if (el.shadowRoot) walk(el.shadowRoot, path + ' > ' + el.tagName.toLowerCase() + (el.id ? '#' + el.id : '') + '::shadow');
+ }
+ };
+ walk(document, 'doc');
+ // Also: avatar-actions host box + its display
+ const aa = document.getElementById('ad-avatar-actions');
+ const aaInfo = aa ? (() => { const r = aa.getBoundingClientRect(); const cs = getComputedStyle(aa); return { box: { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) }, disp: cs.display, hasShadow: !!aa.shadowRoot, html: aa.shadowRoot ? aa.shadowRoot.innerHTML.slice(0, 300) : aa.outerHTML.slice(0, 200) }; })() : null;
+ return { viewers: out, avatarActions: aaInfo };
+});
+console.log(JSON.stringify(info, null, 1));
+
+await page.screenshot({ path: `/tmp/hero-${id.slice(0, 8)}.png`, clip: { x: 0, y: 130, width: 1280, height: 560 } });
+console.log('saved /tmp/hero-' + id.slice(0, 8) + '.png');
+console.log('CONSOLE ERRORS:', errs.length);
+errs.slice(0, 10).forEach((e) => console.log(' ', e.slice(0, 160)));
+await browser.close();
diff --git a/src/agent-detail-market.js b/src/agent-detail-market.js
index 90aa264fc..493a14e77 100644
--- a/src/agent-detail-market.js
+++ b/src/agent-detail-market.js
@@ -149,29 +149,30 @@ async function reloadPurchases(agentId) {
// ── 3D avatar ────────────────────────────────────────────────────────────────
-function render3DAvatar(a) {
+export function render3DAvatar(a) {
if (!a.avatar_glb_url) return;
+
+ // The hero and the fullscreen modal already host <model-viewer> elements,
+ // seeded with the base mannequin during the first render. Swap their source
+ // to the agent's own GLB in place. An older revision built a fresh viewer
+ // here and replaced the flat <img> fallback with it — but the markup now
+ // ships a dedicated <model-viewer id="ad-avatar-3d">, so that path duplicated
+ // the id and stacked a second, unsized 240×280 canvas below the avatar wrap,
+ // bleeding the model over the agent's name. Updating in place keeps a single
+ // viewer with its intended hero behaviour (auto-rotate, click-to-expand).
+ const setSrc = (mv, alt) => {
+ if (!mv || mv.getAttribute('src') === a.avatar_glb_url) return;
+ mv.setAttribute('src', a.avatar_glb_url);
+ mv.setAttribute('alt', alt);
+ if (a.thumbnail_url) mv.setAttribute('poster', a.thumbnail_url);
+ };
+ setSrc($('ad-avatar-3d'), a.name || 'Agent avatar');
+ setSrc($('ad-avatar-modal-3d'), `${a.name || 'Agent'} avatar — fullscreen`);
+
+ // The flat <img> only surfaces if the GLB fails to load; keep it hidden while
+ // the model is authoritative.
const img = $('ad-avatar');
- if (!img || img.dataset.mv === '1') return;
-
- const mv = document.createElement('model-viewer');
- mv.id = 'ad-avatar-3d';
- mv.className = 'ad-hero-avatar ad-hero-avatar-3d';
- mv.setAttribute('src', a.avatar_glb_url);
- mv.setAttribute('alt', a.name || 'Agent avatar');
- mv.setAttribute('auto-rotate', '');
- mv.setAttribute('rotation-per-second', '20deg');
- mv.setAttribute('interaction-prompt', 'none');
- mv.setAttribute('camera-controls', '');
- mv.setAttribute('disable-zoom', '');
- mv.setAttribute('disable-pan', '');
- mv.setAttribute('exposure', '1');
- mv.setAttribute('shadow-intensity', '0.4');
- mv.setAttribute('tone-mapping', 'aces');
- mv.setAttribute('loading', 'eager');
- if (a.thumbnail_url) mv.setAttribute('poster', a.thumbnail_url);
- img.dataset.mv = '1';
- img.replaceWith(mv);
+ if (img) img.style.display = 'none';
}
// Upgrade the always-present "See in 3D" link once the marketplace record (with
diff --git a/src/agent-detail.css b/src/agent-detail.css
index ac33d5e59..7fc57ffc8 100644
--- a/src/agent-detail.css
+++ b/src/agent-detail.css
@@ -1143,17 +1143,6 @@ model-viewer.ad-hero-avatar {
Tokens mirror :root above; monochrome surface, no chroma accents.
─────────────────────────────────────────────────────────────────────────── */
-/* 3D avatar in the hero — match the static avatar footprint. */
-.ad-hero-avatar-3d {
- width: 120px;
- height: 120px;
- border-radius: 16px;
- background: var(--ad-bg-2);
- border: 1px solid var(--ad-line);
- --poster-color: transparent;
- overflow: hidden;
-}
-
/* Hero metadata row */
.ad-market-meta {
display: flex;
diff --git a/src/irl.js b/src/irl.js
index 748171805..7a8ef0601 100644
--- a/src/irl.js
+++ b/src/irl.js
@@ -253,6 +253,7 @@ scene.add(avatarRig);
const camDesired = new Vector3();
const camLookTarget = new Vector3();
const camLookCurrent = new Vector3();
+const lockForward = new Vector3(); // scratch — derives lock yaw/pitch at pin time
let cameraYaw = 0;
let cameraPitch = 0.05;
const PITCH_MIN = -0.5;
@@ -275,6 +276,10 @@ let arActive = false;
let mediaStream = null;
let arFrozenCamPos = null;
let arFrozenCamLook = null;
+// Pivot for the local (no-GPS) gyro world-lock: once set, the camera holds this
+// fixed point and only rotates with the phone, so a pinned avatar stays anchored
+// in the room and is only visible when the camera points at it. null = inactive.
+let gyroLockCamPos = null;
async function enableAR() {
if (!navigator.mediaDevices?.getUserMedia) {
@@ -380,6 +385,7 @@ function disableAR() {
sun.intensity = 1.4;
arFrozenCamPos = null;
arFrozenCamLook = null;
+ gyroLockCamPos = null;
setStatus('Camera off');
}
@@ -864,12 +870,17 @@ function onDeviceOrientation(e) {
if (compass !== null) { lastCompassHeading = compass; prefersAbsOrientation = true; }
else if (hasAbsoluteEventStream) { prefersAbsOrientation = true; }
if (!avatarLocked || !arActive || devOrientBaseAlpha === null) return;
- if (lastCompassHeading !== null) {
- // Absolute frame (iOS compass): yaw tracks the real bearing, so panning the
- // phone leaves the avatar planted on its real-world direction for everyone.
+ if (lastCompassHeading !== null && gpsModeActive) {
+ // Absolute frame (iOS compass + a GPS world-anchor): yaw tracks the real
+ // bearing, so panning the phone leaves the avatar planted on its real-world
+ // direction for everyone. Only meaningful once a GPS pin gives the scene an
+ // absolute origin — a local-only lock (below) must stay relative or the
+ // avatar would jump off-frame to its compass bearing the instant it locks.
cameraYaw = compassToYaw(lastCompassHeading);
} else {
- // Page-relative fallback: integrate alpha deltas from the lock baseline.
+ // Page-relative fallback (no compass) AND local no-GPS lock: integrate alpha
+ // deltas from the lock baseline so the view rotates with the phone while the
+ // avatar holds the exact spot it was pinned at.
let dAlpha = a - devOrientBaseAlpha;
if (dAlpha > 180) dAlpha -= 360;
if (dAlpha < -180) dAlpha += 360;
@@ -954,6 +965,18 @@ async function setLocked(next) {
}
if (arActive) {
if (next) {
+ // Pin the camera pivot to its current spot. From here the camera only
+ // *rotates* with the phone (gyro), so the avatar stays planted in the room
+ // instead of orbiting with the view. Derive the lock yaw/pitch from where
+ // the camera is actually looking right now so the lock is seamless (no
+ // jump) wherever the avatar happens to sit on screen.
+ gyroLockCamPos = camera.position.clone();
+ // Read the camera's true facing (the frozen-AR branch points it with
+ // lookAt, so camLookCurrent can be stale — getWorldDirection never is).
+ const fwd = camera.getWorldDirection(lockForward);
+ cameraYaw = Math.atan2(fwd.x, -fwd.z);
+ cameraPitch = Math.max(PITCH_MIN, Math.min(PITCH_MAX,
+ Math.asin(Math.max(-1, Math.min(1, -fwd.y)))));
// Capture baseline orientation — gyro deltas from here drive the camera
// on the page-relative fallback path. The pitch baseline is used by both
// paths; the yaw baseline only by the delta fallback.
@@ -961,10 +984,11 @@ async function setLocked(next) {
devOrientBaseBeta = lastDevBeta;
devOrientBaseCamYaw = cameraYaw;
devOrientBaseCamPitch = cameraPitch;
- // iOS compass available: snap the very first locked frame to the true
- // bearing so the view is north-aligned before the next orientation event
- // (which keeps it live). No-op on page-relative devices.
- if (lastCompassHeading !== null) cameraYaw = compassToYaw(lastCompassHeading);
+ // iOS compass + a live GPS fix: snap the first locked frame to the true
+ // bearing so the scene is north-aligned before the next orientation event.
+ // A local-only lock (no GPS yet) stays on the seamless relative yaw above,
+ // otherwise the avatar would snap off-frame to its absolute bearing.
+ if (gpsState.ready && lastCompassHeading !== null) cameraYaw = compassToYaw(lastCompassHeading);
arFrozenCamPos = null;
arFrozenCamLook = null;
document.body.classList.add('is-locked');
@@ -983,6 +1007,7 @@ async function setLocked(next) {
}
} else {
devOrientBaseAlpha = null;
+ gyroLockCamPos = null;
_pendingGpsLock = false;
arFrozenCamPos = camera.position.clone();
arFrozenCamLook = camLookCurrent.clone();
@@ -3962,6 +3987,22 @@ function tick() {
Math.sin(-cameraPitch),
-Math.cos(cameraYaw) * Math.cos(cameraPitch),
).add(camera.position);
+ } else if (avatarLocked && arActive && gyroLockCamPos) {
+ // Local gyro world-lock (A4 without a GPS anchor — location off, no fix yet,
+ // or a compass-only device). The camera holds the captured pivot and only
+ // rotates with the phone, so the pinned avatar stays where it was placed and
+ // is only visible when the camera points at it. Identical rotation math to
+ // the GPS branch above, minus the absolute world origin.
+ camera.position.copy(gyroLockCamPos);
+ camera.rotation.order = 'YXZ';
+ camera.rotation.y = cameraYaw;
+ camera.rotation.x = -cameraPitch;
+ camera.rotation.z = 0;
+ camLookCurrent.set(
+ Math.sin(cameraYaw) * Math.cos(cameraPitch),
+ Math.sin(-cameraPitch),
+ -Math.cos(cameraYaw) * Math.cos(cameraPitch),
+ ).add(camera.position);
} else if (arFrozenCamPos) {
// Plain AR mode: background stays anchored, avatar walks freely
camera.position.copy(arFrozenCamPos);
diff --git a/src/irl/onboarding.js b/src/irl/onboarding.js
index 5da8b5788..a6a500cc7 100644
--- a/src/irl/onboarding.js
+++ b/src/irl/onboarding.js
@@ -237,7 +237,7 @@ function buildShell(opts) {
<div class="irl-ob-scrim"></div>
<div class="irl-ob-panel" role="document">
<div class="irl-ob-head">
- <span class="irl-ob-badge"><span class="irl-ob-badge-dot"></span> IRL</span>
+ <span class="irl-ob-badge"><svg class="irl-ob-badge-mark" viewBox="0 0 26 28" fill="none" aria-hidden="true"><path class="irl-mark-cube" d="M13 2.5 4 7v9l9 4.5 9-4.5V7Z"/><path class="irl-mark-cube" d="M13 2.5v9M4 7l9 4.5M22 7l-9 4.5"/><path class="irl-mark-beam" d="M13 20.5v1.9"/><ellipse class="irl-mark-anchor" cx="13" cy="24.3" rx="7.4" ry="1.9"/><circle class="irl-mark-dot" cx="13" cy="24.3" r="1" stroke="none"/></svg> IRL</span>
<h2 class="irl-ob-title">${multi ? 'Bring your agents into the real world' : 'Permission needed'}</h2>
<p class="irl-ob-sub">${multi ? 'Three quick permissions power the camera, look-around, and real-world pins. You stay in control.' : 'Grant access to continue — you can change this anytime.'}</p>
</div>
@@ -542,7 +542,14 @@ const ONBOARD_CSS = `
border: 1px solid rgba(125,211,252,0.28);
border-radius: 999px; padding: 5px 10px; margin-bottom: 12px;
}
-.irl-ob-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #7dd3fc; box-shadow: 0 0 8px #7dd3fc; }
+.irl-ob-badge-mark {
+ width: 15px; height: 16px; flex-shrink: 0; overflow: visible;
+ stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
+}
+.irl-ob-badge-mark .irl-mark-cube { opacity: .95; }
+.irl-ob-badge-mark .irl-mark-beam { opacity: .45; }
+.irl-ob-badge-mark .irl-mark-anchor { opacity: .6; }
+.irl-ob-badge-mark .irl-mark-dot { fill: currentColor; opacity: .8; }
.irl-ob-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.015em; color: #f1f4fa; line-height: 1.25; }
.irl-ob-sub { margin: 0; font-size: 13px; line-height: 1.5; color: #93a1b5; }
.irl-ob-card .tws-es { padding: 22px 8px 6px; }
diff --git a/tests/agent-detail-avatar.test.js b/tests/agent-detail-avatar.test.js
new file mode 100644
index 000000000..e2c683434
--- /dev/null
+++ b/tests/agent-detail-avatar.test.js
@@ -0,0 +1,65 @@
+// @vitest-environment jsdom
+//
+// Regression guard for the hero avatar on every /agents/:id (and /agent/:id)
+// detail page. The page markup ships a dedicated <model-viewer id="ad-avatar-3d">
+// for the hero plus a hidden flat <img id="ad-avatar"> fallback. Marketplace
+// enrichment then upgrades the hero to the agent's own GLB.
+//
+// A prior revision of render3DAvatar built a *new* <model-viewer>, gave it the
+// same `ad-avatar-3d` id, and swapped it in for the <img>. With the dedicated
+// hero viewer already present that produced TWO elements sharing one id: a
+// second, unsized 240×280 canvas stacked below the avatar wrap, bleeding the
+// model over the agent's name on every custom-avatar page. These tests lock the
+// invariant that there is always exactly one hero viewer, updated in place.
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { render3DAvatar } from '../src/agent-detail-market.js';
+
+const GLB = 'https://three.ws/cdn/u/abc/draft-x/model.glb';
+const THUMB = 'https://three.ws/cdn/thumb/abc.png';
+
+beforeEach(() => {
+ document.body.innerHTML = `
+ <div class="ad-hero-avatar-wrap" id="ad-avatar-wrap">
+ <model-viewer id="ad-avatar-3d" class="ad-hero-avatar" src="/avatars/mannequin.glb"></model-viewer>
+ <img class="ad-hero-avatar" id="ad-avatar" alt="" style="display:none" />
+ </div>
+ <div class="ad-3d-modal hidden" id="ad-3d-modal">
+ <model-viewer id="ad-avatar-modal-3d" src="/avatars/mannequin.glb"></model-viewer>
+ </div>`;
+});
+
+describe('render3DAvatar', () => {
+ it('updates the existing hero viewer in place — never duplicates the id', () => {
+ render3DAvatar({ name: 'hexagon_dance', avatar_glb_url: GLB, thumbnail_url: THUMB });
+
+ const viewers = document.querySelectorAll('#ad-avatar-3d');
+ expect(viewers.length).toBe(1);
+ expect(viewers[0].getAttribute('src')).toBe(GLB);
+ expect(viewers[0].getAttribute('poster')).toBe(THUMB);
+ // The flat fallback stays in the DOM but hidden behind the live model.
+ expect(document.getElementById('ad-avatar').style.display).toBe('none');
+ });
+
+ it('upgrades the fullscreen modal viewer to the same GLB', () => {
+ render3DAvatar({ name: 'hexagon_dance', avatar_glb_url: GLB, thumbnail_url: THUMB });
+
+ const modal = document.getElementById('ad-avatar-modal-3d');
+ expect(modal.getAttribute('src')).toBe(GLB);
+ expect(modal.getAttribute('alt')).toContain('hexagon_dance');
+ });
+
+ it('is idempotent — a second call leaves a single hero viewer', () => {
+ render3DAvatar({ name: 'a', avatar_glb_url: GLB });
+ render3DAvatar({ name: 'a', avatar_glb_url: GLB });
+ expect(document.querySelectorAll('#ad-avatar-3d').length).toBe(1);
+ expect(document.querySelectorAll('model-viewer').length).toBe(2); // hero + modal
+ });
+
+ it('leaves the mannequin untouched when the agent ships no custom GLB', () => {
+ render3DAvatar({ name: 'plain', avatar_glb_url: null });
+ const hero = document.getElementById('ad-avatar-3d');
+ expect(hero.getAttribute('src')).toBe('/avatars/mannequin.glb');
+ expect(document.getElementById('ad-avatar').style.display).toBe('none');
+ });
+});
diff --git a/tests/api/http-redact-url.test.js b/tests/api/http-redact-url.test.js
new file mode 100644
index 000000000..c02936063
--- /dev/null
+++ b/tests/api/http-redact-url.test.js
@@ -0,0 +1,50 @@
+// Unit tests for redactUrl() in api/_lib/http.js — the log-sink scrubber that
+// keeps a request's coordinates and device-token credential out of console /
+// Sentry / ops-alert lines on a 5xx. The /irl nearby read carries the caller's
+// exact position AND their device token in the query string, so a leak here
+// would put a user's real-world location into off-box logging on any error.
+
+import { describe, it, expect } from 'vitest';
+import { redactUrl } from '../../api/_lib/http.js';
+
+describe('redactUrl', () => {
+ it('redacts a geolocated read while keeping the path and benign params', () => {
+ const out = redactUrl('/api/irl/pins?lat=37.7749295&lng=-122.4194155&radius=40&deviceToken=abc123');
+ // Position is gone.
+ expect(out).not.toContain('37.7749295');
+ expect(out).not.toContain('-122.4194155');
+ // Credential is gone.
+ expect(out).not.toContain('abc123');
+ // The benign param and path survive, so the log stays useful.
+ expect(out).toContain('/api/irl/pins');
+ expect(out).toContain('radius=40');
+ expect(out).toContain('REDACTED');
+ });
+
+ it('covers camelCase, snake_case, and origin coordinate variants', () => {
+ const out = redactUrl(
+ '/x?latitude=1.23456&longitude=6.54321&origin_lat=9.9&originLng=8.8&device_token=t&token=k',
+ );
+ for (const leak of ['1.23456', '6.54321', '9.9', '8.8', '=t', '=k']) {
+ expect(out).not.toContain(leak);
+ }
+ });
+
+ it('passes through a URL with no query string untouched', () => {
+ expect(redactUrl('/api/irl/pins')).toBe('/api/irl/pins');
+ expect(redactUrl('')).toBe('');
+ expect(redactUrl(undefined)).toBe('');
+ });
+
+ it('leaves a query with no sensitive keys exactly as-is', () => {
+ const url = '/api/agents?page=2&sort=recent';
+ expect(redactUrl(url)).toBe(url);
+ });
+
+ it('never echoes a value when the key matches, regardless of casing', () => {
+ const out = redactUrl('/p?LAT=51.5&Lng=0.12&DeviceToken=secret');
+ expect(out).not.toContain('51.5');
+ expect(out).not.toContain('0.12');
+ expect(out).not.toContain('secret');
+ });
+});
diff --git a/tests/api/irl-pins-room.test.js b/tests/api/irl-pins-room.test.js
index a28cae2c6..7ad75e2f0 100644
--- a/tests/api/irl-pins-room.test.js
+++ b/tests/api/irl-pins-room.test.js
@@ -172,4 +172,33 @@ describe('GET /api/irl/pins — room frame projection', () => {
expect(p.user_id).toBeUndefined();
expect(p.device_token).toBeUndefined();
});
+
+ it('coarsens outbound coordinates to ~1.1 m so the public feed carries no false precision', async () => {
+ // A pin stored at full float64 precision (sub-millimetre tail).
+ const preciseLat = 40.71280123456;
+ const preciseLng = -74.00609987654;
+ nearbyRow = {
+ id: 'pin-precise', user_id: 'owner-uuid', device_token: 'device-A', agent_id: null,
+ lat: preciseLat, lng: preciseLng, heading: 0,
+ avatar_url: '/a.glb', avatar_name: 'Scout', caption: '', x402_endpoint: null,
+ placed_at: '2026-06-17T00:00:00Z', view_count: 0,
+ anchor_height_m: null, anchor_yaw_deg: 0, anchor_quat: null,
+ gps_accuracy_m: 10, altitude_m: null, anchor_source: 'gyro-gps', avatar_version: 0,
+ room_id: 'living-room-7', rel_east_m: 2, rel_north_m: 1,
+ origin_lat: preciseLat, origin_lng: preciseLng, origin_yaw_deg: 0,
+ };
+ const { body } = await getNearby({ lat: String(preciseLat), lng: String(preciseLng), radius: '60' });
+ const p = body.pins[0];
+ // Rounded to 5 decimals (PUBLIC_COORD_DP) — the sub-mm tail is gone.
+ expect(p.lat).toBe(40.7128);
+ expect(p.lng).toBe(-74.0061);
+ expect(p.origin_lat).toBe(40.7128);
+ expect(p.origin_lng).toBe(-74.0061);
+ // The exact stored values must NOT leave the server.
+ expect(p.lat).not.toBe(preciseLat);
+ expect(p.lng).not.toBe(preciseLng);
+ // The room's exact intra-room layout (relative offsets) is untouched.
+ expect(p.rel_east_m).toBe(2);
+ expect(p.rel_north_m).toBe(1);
+ });
});