Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore: Update changelog, x402 wallet detection, guide avatar, and home page
nirholase6a50ff56b3c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2e6f70bfd..9f5745269 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -63,6 +63,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Payment hardening and a steadier holder leaderboard** — Two behind-the-scenes reliability and safety fixes. Agent payment invoices now verify that the wallet paying is actually linked to your account before an invoice is created, closing a gap that let bogus payment requests be generated against any agent. And the $THREE holder leaderboard, its share card, and the token stats panel no longer each kick off a full on-chain holder scan during a traffic spike — one scan now serves everyone and refreshes the shared snapshot, so the leaderboard stays fast and responsive under load. Nothing to do on your end. (`/leaderboard`) `[security, fix, infra]`- **Pick your guide for the product tour — and walk her around yourself** — The 3D guide who walks you through the product tour now starts as Ava, our photoreal full-body character — and you can swap her for anyone in the cast. Open the tour menu and use the new Guide picker to choose any avatar (your own custom ones included); the tour switches on the spot and remembers your pick. In free roam you can now steer the guide with WASD or the arrow keys (hold Shift to run) and walk her across the whole page, just like steering your character on the Walk pages — clicking and dragging still work too. She also obeys gravity now: she drops in and plants her feet on the ground instead of hovering. `[feature, improvement]`- **Platform-wide hardening: payment integrity, security, and scale** — A broad reliability pass across the parts of three.ws that move real money and serve heavy traffic. On the money side: bundle purchases and agent payments are now verified on-chain before anything unlocks, each payment is credited exactly once, withdrawals can't be processed twice, and recurring subscriptions can't be double-billed. On the security side: a set of input-handling and link-safety fixes across pages, stronger protection for custodial keys at rest, and tighter checks on outbound agent payments so funds only ever move in the expected asset. On the scale side: the busiest directory, profile, and feed pages now ride a short cache and run far fewer database queries, so they stay fast as the community grows. Most of this is invisible by design — it's the plumbing that keeps the platform correct and quick under load. `[security, improvement, infra]`+- **Pole Club: tipping now works with the built-in three.ws wallet** — Tipping a dancer in the Pole Club opens an on-chain payment for $0.001 USDC. On Solana Mobile (Seeker), the payment window only recognized browser extensions like Phantom, so anyone using the three.ws wallet saw a checkout that couldn't be completed — the window opened but the pay button was greyed out. The checkout now recognizes the three.ws wallet (and Backpack and Solflare) the same way the rest of the site does, and names whichever wallet you're using throughout the flow, so tips go through. (`/club`) `[fix]`- **Profiles you can edit — and follow** — Your three.ws profile at three.ws/u/<your-username> is now a real social home. Edit it in place: add a bio, a profile picture and banner image, your location, and a website link — all from an Edit button on your own profile. You can now follow other creators and agents, and they can follow you; every profile shows live follower and following counts you can tap to browse the lists, with one-tap follow buttons throughout. And there's a new Feed at three.ws/feed that gathers the latest avatars, agents, and coin launches from everyone you follow, newest first. Find your profile and Feed links from your account page. (`/feed`) `[feature]`- **Provably-fair vanity grinder now listed in the x402 bazaar** — The provably-fair Solana vanity grinder — which returns a signed, independently-verifiable receipt proving the key was ground fresh and never kept — is now published in the x402 discovery catalog, so paying agents and bazaar crawlers can find and call it directly. (`/vanity/verify`) `[feature, sdk]`- **Regrinding an agent's vanity wallet no longer risks its funds** — The compact "Vanity address" card on an agent's page used to replace a wallet by deleting the old one and creating the new one separately — so if the old wallet held SOL or tokens, they could be left behind. It now uses the same money-safe path as the rest of the platform: any balance is automatically swept to the new vanity address first, and the switch only completes once the funds have moved (and only after the server confirms the new address really matches your pattern). Same one-click experience, but your funds follow the wallet. `[fix, security]`@@ -77,6 +78,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The guided tour, now yours to steer** — The 3D guided tour got a major upgrade. Pick how deep to go: a new “Quick highlights” track samples the best of every chapter in a few minutes, or take the full feature-by-feature walk. A new tour map (open it from the ☰ button or press C) lists every chapter and stop, marks where you are, and lets you search and jump anywhere instantly. You can now change the narrator's voice and set the playback speed (0.75×–1.5×) on the fly, and the tour remembers your spot, voice, and pace across sessions — come back later and pick up right where you left off. (`/tour`) `[feature, improvement]`- **The Walk Companion now works on phones** — The walking 3D avatar that strolls along beside you on desktop was unreachable on mobile — the button that summons it lived in the part of the nav bar that collapses on small screens, so there was no way to turn it on from a phone. It's now a switch right inside the mobile menu: tap "Walk with me" and the avatar drops into the corner, wanders on its own without a mouse to follow, and tapping it still opens the full-page playground with on-screen controls. `[fix, feature]`- **three.ws now speaks your language** — The site can now be translated into many languages. A language picker on the homepage switches the copy instantly, starting with Spanish, and your choice is remembered. Translations are produced by an AI pipeline that locks brand and protocol terms — $THREE, the contract address, USDC, x402 — so they are never altered, and English is always the safe fallback. More languages roll out from here. `[feature, improvement]`+- **Tour guide now actually walks when you send it somewhere** — In the guided tour's free-roam mode, clicking an empty spot used to glide the guide across the page faster than its feet could keep up, so it looked like it was sliding rather than walking. It now strides to where you click at a steady walking pace — the same locomotion you get when you steer it with WASD/arrow keys — so its body and footsteps stay in sync. The guide also walks to each stop the same way during the tour itself. `[improvement]`- **USDC checkout no longer fails when an RPC node hiccups** — Paying with USDC at a door (like the Pole Club cover charge) could occasionally fail with an "internal error" right after you connected your wallet, if our Solana RPC briefly returned a malformed reply while building your payment. The checkout now shrugs that off and builds the transaction anyway, so a flaky node no longer turns you away at the door. Nothing was ever charged when this happened. `[fix]`- **Walk picks up where you left off, plus click-to-walk** — The walk now remembers your avatar, environment, camera, and position across visits (synced to your account when signed in, cached locally otherwise) and greets you with a “Welcome back” you can dismiss or reset. Click anywhere on the page and your site-wide companion walks there, routing around blocked elements. The features page also gained a live walking-avatar demo. (`/walk`) `[feature, improvement]`- **Walk with any agent, and leave a trail** — Every agent profile now has a “Walk with this agent” action and a live preview that renders that specific agent walking — the walk embed can now load any agent’s avatar by id. And the walking avatar leaves an aesthetic trail behind it (footprints, a glow, or a fading line, your pick) both in the full walk scene and the site-wide companion. (`/walk`) `[feature, improvement]`diff --git a/data/changelog.json b/data/changelog.jsonindex 25ee606eb..3a3a0c578 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,19 @@{"$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-21",+ "title": "Pole Club: tipping now works with the built-in three.ws wallet",+ "summary": "Tipping a dancer in the Pole Club opens an on-chain payment for $0.001 USDC. On Solana Mobile (Seeker), the payment window only recognized browser extensions like Phantom, so anyone using the three.ws wallet saw a checkout that couldn't be completed — the window opened but the pay button was greyed out. The checkout now recognizes the three.ws wallet (and Backpack and Solflare) the same way the rest of the site does, and names whichever wallet you're using throughout the flow, so tips go through.",+ "tags": ["fix"],+ "link": "/club"+ },+ {+ "date": "2026-06-21",+ "title": "Tour guide now actually walks when you send it somewhere",+ "summary": "In the guided tour's free-roam mode, clicking an empty spot used to glide the guide across the page faster than its feet could keep up, so it looked like it was sliding rather than walking. It now strides to where you click at a steady walking pace — the same locomotion you get when you steer it with WASD/arrow keys — so its body and footsteps stay in sync. The guide also walks to each stop the same way during the tour itself.",+ "tags": ["improvement"]+ },{"date": "2026-06-21","title": "Credits: top up with SOL or $THREE, spend on generation and agents",diff --git a/pages/home.html b/pages/home.htmlindex 51e8e1b07..8ad7986c4 100644--- a/pages/home.html+++ b/pages/home.html@@ -6989,6 +6989,6 @@initAcquisitionAnalytics();</script><!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->- <script type="module" src="/i18n.js"></script>+ <script type="module" src="/src/i18n.js"></script></body></html>diff --git a/public/changelog.json b/public/changelog.jsonindex e68aa3e37..ea1e1922f 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-21T13:16:39.824Z",+ "generated_at": "2026-06-21T14:46:47.265Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -605,6 +605,16 @@"infra"]},+ {+ "date": "2026-06-21",+ "type": "update",+ "title": "Pole Club: tipping now works with the built-in three.ws wallet",+ "summary": "Tipping a dancer in the Pole Club opens an on-chain payment for $0.001 USDC. On Solana Mobile (Seeker), the payment window only recognized browser extensions like Phantom, so anyone using the three.ws wallet saw a checkout that couldn't be completed — the window opened but the pay button was greyed out. The checkout now recognizes the three.ws wallet (and Backpack and Solflare) the same way the rest of the site does, and names whichever wallet you're using throughout the flow, so tips go through.",+ "link": "/club",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-21","type": "update",@@ -754,6 +764,16 @@"improvement"]},+ {+ "date": "2026-06-21",+ "type": "update",+ "title": "Tour guide now actually walks when you send it somewhere",+ "summary": "In the guided tour's free-roam mode, clicking an empty spot used to glide the guide across the page faster than its feet could keep up, so it looked like it was sliding rather than walking. It now strides to where you click at a steady walking pace — the same locomotion you get when you steer it with WASD/arrow keys — so its body and footsteps stay in sync. The guide also walks to each stop the same way during the tour itself.",+ "link": null,+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-21","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 810ac79e9..2175ab10a 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -462,6 +462,14 @@<category>security</category><description>A broad reliability pass across the parts of three.ws that move real money and serve heavy traffic. On the money side: bundle purchases and agent payments are now verified on-chain before anything unlocks, each payment is credited exactly once, withdrawals can't be processed twice, and recurring subscriptions can't be double-billed. On the security side: a set of input-handling and link-safety fixes across pages, stronger protection for custodial keys at rest, and tighter checks on outbound agent payments so funds only ever move in the expected asset. On the scale side: the busiest directory, profile, and feed pages now ride a short cache and run far fewer database queries, so they stay fast as the community grows. Most of this is invisible by design — it's the plumbing that keeps the platform correct and quick under load.</description></item>+ <item>+ <title>Pole Club: tipping now works with the built-in three.ws wallet</title>+ <link>https://three.ws/club</link>+ <guid isPermaLink="false">2026-06-21:Pole Club: tipping now works with the built-in three.ws wallet</guid>+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Tipping a dancer in the Pole Club opens an on-chain payment for $0.001 USDC. On Solana Mobile (Seeker), the payment window only recognized browser extensions like Phantom, so anyone using the three.ws wallet saw a checkout that couldn't be completed — the window opened but the pay button was greyed out. The checkout now recognizes the three.ws wallet (and Backpack and Solflare) the same way the rest of the site does, and names whichever wallet you're using throughout the flow, so tips go through.</description>+ </item><item><title>Profiles you can edit — and follow</title><link>https://three.ws/feed</link>@@ -574,6 +582,14 @@<category>feature</category><description>The site can now be translated into many languages. A language picker on the homepage switches the copy instantly, starting with Spanish, and your choice is remembered. Translations are produced by an AI pipeline that locks brand and protocol terms — $THREE, the contract address, USDC, x402 — so they are never altered, and English is always the safe fallback. More languages roll out from here.</description></item>+ <item>+ <title>Tour guide now actually walks when you send it somewhere</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-21:Tour guide now actually walks when you send it somewhere</guid>+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>In the guided tour's free-roam mode, clicking an empty spot used to glide the guide across the page faster than its feet could keep up, so it looked like it was sliding rather than walking. It now strides to where you click at a steady walking pace — the same locomotion you get when you steer it with WASD/arrow keys — so its body and footsteps stay in sync. The guide also walks to each stop the same way during the tour itself.</description>+ </item><item><title>USDC checkout no longer fails when an RPC node hiccups</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 3180eab3c..17fc6e92d 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-21T13:16:39.652Z",+ "generated_at": "2026-06-21T14:46:47.246Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/x402.js b/public/x402.jsindex 5226aecc7..f496a22ee 100644--- a/public/x402.js+++ b/public/x402.js@@ -84,6 +84,35 @@ function isEvmNetwork(net) {return typeof net === 'string' && net.startsWith('eip155:');}+// Resolve the active injected Solana wallet provider. Priority mirrors+// src/onchain/adapters/solana.js so the drop-in modal recognizes the SAME+// wallets the rest of three.ws does — most importantly the platform's own+// embedded wallet (the Seeker/Saga MWA bridge), which injects with+// isThreeWs=true / isPhantom=false. An isPhantom-only check left those users+// staring at a disabled "Phantom (not detected)" button: the modal opened but+// there was no way to pay (e.g. tipping a club dancer).+export function detectSolanaProvider() {+ if (typeof window === 'undefined') return null;+ if (window.threeWsWallet?.isThreeWs) return window.threeWsWallet;+ if (window.solana?.isThreeWs) return window.solana;+ if (window.phantom?.solana?.isPhantom) return window.phantom.solana;+ if (window.solana?.isPhantom) return window.solana;+ if (window.backpack?.solana) return window.backpack.solana;+ if (window.solflare?.isSolflare) return window.solflare;+ return null;+}++// Human-readable name for whichever Solana provider is connected, so progress+// copy and the wallet button say "three.ws Wallet" / "Backpack" instead of+// always claiming "Phantom".+export function solanaWalletLabel(provider) {+ if (provider?.isThreeWs) return 'three.ws Wallet';+ if (provider?.isPhantom) return 'Phantom';+ if (provider?.isBackpack) return 'Backpack';+ if (provider?.isSolflare) return 'Solflare';+ return 'Solana wallet';+}+// Compute the buyer-facing donation for a Solana `accept` under a merchant's// giving config (charity split + round-up). Returns null when nothing applies:// giving off, cause wallet on a different chain than this checkout, or a zero@@ -1044,7 +1073,8 @@ class CheckoutModal {}renderConnect() {- const phantomDetected = typeof window !== 'undefined' && (window.solana?.isPhantom || window.phantom?.solana);+ const solanaProvider = detectSolanaProvider();+ const phantomDetected = !!solanaProvider;const evmDetected = typeof window !== 'undefined' && window.ethereum;const solanaAccept = this.challenge?.accepts.find((a) => isSolanaNetwork(a.network));const evmAccept = this.challenge?.accepts.find(isEip3009Accept);@@ -1089,8 +1119,8 @@ class CheckoutModal {if (solanaAccept) {buttons.push(`<button class="x402-wallet-btn" data-wallet="phantom" ${phantomDetected ? '' : 'disabled'}>- <div class="x402-wallet-icon x402-phantom">P</div>- <span class="x402-wallet-name">${phantomDetected ? 'Phantom' : 'Phantom (not detected)'}</span>+ <div class="x402-wallet-icon x402-phantom">${solanaProvider?.isThreeWs ? '3' : 'P'}</div>+ <span class="x402-wallet-name">${phantomDetected ? solanaWalletLabel(solanaProvider) : 'No Solana wallet detected'}</span><span class="x402-wallet-meta">${networkLabel(solanaAccept.network, solanaAccept)}</span></button>`);@@ -1150,7 +1180,9 @@ class CheckoutModal {const siwxTarget = siwxSolana? { kind: 'solana', chain: siwxSolana.chain }: { kind: 'evm', chain: siwxEvm.chain };- const siwxLabel = siwxTarget.kind === 'solana' ? 'Sign in with Phantom' : 'Sign in with wallet';+ const siwxLabel = siwxTarget.kind === 'solana'+ ? `Sign in with ${solanaWalletLabel(detectSolanaProvider())}`+ : 'Sign in with wallet';this.bodyEl.innerHTML = `${this.renderSteps('connect', { discover: 'done' })}<button class="x402-pay-btn" data-action="siwx">${siwxLabel}</button>@@ -1329,13 +1361,14 @@ class CheckoutModal {async runSolana(accept) {this.accept = accept;this.setPrice(accept);- this.renderProgress('connect', { text: 'Opening Phantom…' });+ const provider = detectSolanaProvider();+ const walletName = solanaWalletLabel(provider);+ this.renderProgress('connect', { text: `Opening ${walletName}…` });try {- const provider = window.phantom?.solana || window.solana;- if (!provider) throw new Error('Phantom wallet not detected');+ if (!provider) throw new Error('No Solana wallet detected');const conn = await provider.connect();const payerAddress = (conn?.publicKey || provider.publicKey)?.toString();- if (!payerAddress) throw new Error('Phantom did not return a public key');+ if (!payerAddress) throw new Error(`${walletName} did not return a public key`);this.payerAddress = payerAddress;const capCheck = browserEnforceCap({accept,@@ -1362,9 +1395,9 @@ class CheckoutModal {buyer: payerAddress,...(tips ? { tips } : {}),});- this.renderProgress('authorize', { text: 'Confirm in Phantom…' });+ this.renderProgress('authorize', { text: `Confirm in ${walletName}…` });const txBytes = base64ToUint8Array(prep.tx_base64);- // Phantom returns a fully-signed VersionedTransaction with the buyer's+ // The wallet returns a fully-signed VersionedTransaction with the buyer's// signature added. The facilitator's fee-payer signature is added by// PayAI during /settle.const SolanaWeb3 = await loadSolanaWeb3();@@ -1625,14 +1658,15 @@ class CheckoutModal {}async runSiwxSolana(chain) {- this.renderProgress('connect', { text: 'Opening Phantom…' });+ const provider = detectSolanaProvider();+ const walletName = solanaWalletLabel(provider);+ this.renderProgress('connect', { text: `Opening ${walletName}…` });try {- const provider = window.phantom?.solana || window.solana;- if (!provider) throw new Error('Phantom wallet not detected');+ if (!provider) throw new Error('No Solana wallet detected');const conn = await provider.connect();const pubkey = conn?.publicKey || provider.publicKey;const address = pubkey?.toString();- if (!address) throw new Error('Phantom did not return a public key');+ if (!address) throw new Error(`${walletName} did not return a public key`);this.payerAddress = address;this.renderProgress('authorize', { text: `Sign sign-in message as ${address.slice(0, 6)}…${address.slice(-4)}` });@@ -1640,7 +1674,7 @@ class CheckoutModal {const encoded = new TextEncoder().encode(message);const signed = await provider.signMessage(encoded, 'utf8');const sigBytes = signed?.signature instanceof Uint8Array ? signed.signature : new Uint8Array(signed?.signature || signed);- if (!sigBytes || !sigBytes.length) throw new Error('Phantom did not return a signature');+ if (!sigBytes || !sigBytes.length) throw new Error(`${walletName} did not return a signature`);const signature = base58encode(sigBytes);const info = this.siwx.info;diff --git a/src/feature-tour/guide-avatar.js b/src/feature-tour/guide-avatar.jsindex 68cbf9689..c79ef6494 100644--- a/src/feature-tour/guide-avatar.js+++ b/src/feature-tour/guide-avatar.js@@ -27,6 +27,11 @@ const CANVAS_H = 240;const MARGIN = 16;const Z_AVATAR = 2147483300;+// Screen-space walking pace in px/second, matched to free-roam's WALK_SPEED so a+// click-to-walk advances the body in lockstep with the foot cycle — the guide+// reads as genuinely walking there, never gliding/teleporting across the page.+const WALK_SPEED = 460;+// Gravity, mirrored from the walk platformer (src/walk.js GRAVITY = -14) so the// guide obeys the same physics the visitor sees there: it falls onto the ground// plane and stays planted, never floating mid-air. SPAWN_DROP is how far above@@ -60,6 +65,7 @@ export class GuideAvatar {this._yaw = 0;this._targetYaw = 0;this._walking = false;+ this._walkRaf = 0;this._reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;this._pos = { x: 0, y: 0 };// Vertical physics state — height above the ground plane and its velocity.@@ -88,7 +94,7 @@ export class GuideAvatar {}// Park bottom-right until the first stop moves it.const start = { x: window.innerWidth - CANVAS_W - MARGIN, y: window.innerHeight - CANVAS_H - MARGIN };- this._setPos(start, false);+ this._setPos(start);}_buildDom() {@@ -225,33 +231,47 @@ export class GuideAvatar {// ── Public choreography API ───────────────────────────────────────────────// Walk the avatar to a screen position (top-left of its canvas). Resolves- // when it arrives. The CSS transition does the gliding; we just flip the- // controller into its walk cycle for the duration.+ // when it arrives. Rather than gliding via a CSS transition, it steps the+ // guide there frame-by-frame at a constant pace through place() — the exact+ // locomotion the visitor drives in free roam — so the body advances in+ // lockstep with the walk cycle and reads as genuine walking, not a slide.walkTo(pos) {const clamped = {x: clamp(pos.x, MARGIN, window.innerWidth - CANVAS_W - MARGIN),y: clamp(pos.y, MARGIN, window.innerHeight - CANVAS_H - MARGIN),};+ // Supersede any walk already in flight so a fresh click redirects the guide.+ cancelAnimationFrame(this._walkRaf);+ this._walkRaf = 0;const dx = clamped.x - this._pos.x;const dy = clamped.y - this._pos.y;const dist = Math.hypot(dx, dy);- if (dist < 4) {- this._setPos(clamped, false);+ if (dist < 4 || this._reduced) {+ // Already there, or reduced-motion: place without a stride and settle.+ this._setPos(clamped);+ this.settle();return Promise.resolve();}- // Face the direction of travel so the walk reads naturally.- this._targetYaw = clamp((dx / window.innerWidth) * 1.6, -0.7, 0.7);- const durMs = this._reduced ? 0 : clamp(dist * 1.6, 420, 1500);- this.controller?.setState('walk');- this._walking = true;- this._setPos(clamped, !this._reduced, durMs);+ const ux = dx / dist;+ const uy = dy / dist;+ const from = { x: this._pos.x, y: this._pos.y };+ let traveled = 0;+ let last = performance.now();return new Promise((resolve) => {- clearTimeout(this._walkTimer);- this._walkTimer = setTimeout(() => {- this._walking = false;- this.controller?.setState('idle');- resolve();- }, durMs + 30);+ const step = (now) => {+ const dt = Math.min((now - last) / 1000, 0.05);+ last = now;+ traveled = Math.min(dist, traveled + WALK_SPEED * dt);+ this.place({ x: from.x + ux * traveled, y: from.y + uy * traveled });+ if (traveled >= dist) {+ this._walkRaf = 0;+ this.settle();+ resolve();+ return;+ }+ this._walkRaf = requestAnimationFrame(step);+ };+ this._walkRaf = requestAnimationFrame(step);});}@@ -306,7 +326,7 @@ export class GuideAvatar {this._walking = true;clearTimeout(this._settleTimer);this._settleTimer = setTimeout(() => this.settle(), 180);- this._setPos({ x, y }, false);+ this._setPos({ x, y });}settle() {@@ -355,12 +375,12 @@ export class GuideAvatar {}// ── Internals ─────────────────────────────────────────────────────────────- _setPos(pos, animate, durMs = 600) {+ // Snap the host to a screen position. All locomotion is now driven frame-by-+ // frame (walkTo / place / free-roam), so the host never CSS-transitions — its+ // stride and travel stay in sync.+ _setPos(pos) {this._pos = pos;if (!this.host) return;- this.host.style.transition = animate- ? `left ${durMs}ms cubic-bezier(.34,.02,.2,1), top ${durMs}ms cubic-bezier(.34,.02,.2,1)`- : 'none';this.host.style.left = pos.x + 'px';this.host.style.top = pos.y + 'px';}@@ -389,9 +409,10 @@ export class GuideAvatar {dispose() {cancelAnimationFrame(this._raf);- clearTimeout(this._walkTimer);+ cancelAnimationFrame(this._walkRaf);clearTimeout(this._settleTimer);this._raf = 0;+ this._walkRaf = 0;try {this.controller?.dispose();} catch {diff --git a/tests/x402-wallet-detect.test.js b/tests/x402-wallet-detect.test.jsnew file mode 100644index 000000000..43b1494c0--- /dev/null+++ b/tests/x402-wallet-detect.test.js@@ -0,0 +1,85 @@+// @vitest-environment jsdom+// public/x402.js reads location.origin at import time, so this suite runs under+// a DOM environment.+import { describe, it, expect, afterEach } from 'vitest';++import { detectSolanaProvider, solanaWalletLabel } from '../public/x402.js';++// Regression guard: the x402 drop-in modal must recognize the SAME Solana+// wallets the rest of three.ws does (src/onchain/adapters/solana.js). The+// platform's own embedded wallet (Solana Mobile / Seeker MWA bridge) injects at+// window.threeWsWallet — and mirrors onto window.solana — with isThreeWs=true+// and isPhantom=false. An isPhantom-only detector left those users with a+// disabled "Phantom (not detected)" button: the tip modal opened but there was+// no way to pay a club dancer.++const WALLET_KEYS = ['threeWsWallet', 'solana', 'phantom', 'backpack', 'solflare'];++function clearWallets() {+ for (const k of WALLET_KEYS) delete window[k];+}++afterEach(clearWallets);++describe('detectSolanaProvider — wallet recognition', () => {+ it('returns null when no Solana wallet is injected', () => {+ clearWallets();+ expect(detectSolanaProvider()).toBeNull();+ });++ it('recognizes the three.ws embedded wallet on window.threeWsWallet', () => {+ clearWallets();+ const wallet = { isThreeWs: true, isPhantom: false };+ window.threeWsWallet = wallet;+ expect(detectSolanaProvider()).toBe(wallet);+ });++ it('recognizes the three.ws wallet when only mirrored onto window.solana', () => {+ clearWallets();+ const wallet = { isThreeWs: true, isPhantom: false };+ window.solana = wallet;+ expect(detectSolanaProvider()).toBe(wallet);+ });++ it('prefers the three.ws wallet over a co-present Phantom', () => {+ clearWallets();+ const three = { isThreeWs: true };+ const phantom = { isPhantom: true };+ window.threeWsWallet = three;+ window.solana = phantom;+ expect(detectSolanaProvider()).toBe(three);+ });++ it('still recognizes Phantom when it is the only wallet', () => {+ clearWallets();+ const phantom = { isPhantom: true };+ window.solana = phantom;+ expect(detectSolanaProvider()).toBe(phantom);+ });++ it('recognizes Backpack and Solflare', () => {+ clearWallets();+ const backpack = { solana: { isBackpack: true } };+ window.backpack = backpack;+ expect(detectSolanaProvider()).toBe(backpack.solana);++ clearWallets();+ const solflare = { isSolflare: true };+ window.solflare = solflare;+ expect(detectSolanaProvider()).toBe(solflare);+ });+});++describe('solanaWalletLabel — human-readable wallet name', () => {+ it('names each known wallet', () => {+ expect(solanaWalletLabel({ isThreeWs: true })).toBe('three.ws Wallet');+ expect(solanaWalletLabel({ isPhantom: true })).toBe('Phantom');+ expect(solanaWalletLabel({ isBackpack: true })).toBe('Backpack');+ expect(solanaWalletLabel({ isSolflare: true })).toBe('Solflare');+ });++ it('falls back to a generic label for an unknown or missing provider', () => {+ expect(solanaWalletLabel({})).toBe('Solana wallet');+ expect(solanaWalletLabel(null)).toBe('Solana wallet');+ });+});diff --git a/tour-sdk/src/guide-avatar.js b/tour-sdk/src/guide-avatar.jsindex d844b8cf0..022cc2714 100644--- a/tour-sdk/src/guide-avatar.js+++ b/tour-sdk/src/guide-avatar.js@@ -28,6 +28,11 @@ const CANVAS_H = 240;const MARGIN = 16;const Z_AVATAR = 2147483300;+// Screen-space walking pace in px/second, matched to free-roam's WALK_SPEED so a+// click-to-walk advances the body in lockstep with the foot cycle — the guide+// reads as genuinely walking there, never gliding/teleporting across the page.+const WALK_SPEED = 460;+// Gravity, mirrored from the walk platformer so the guide obeys the same physics// the visitor sees there: it falls onto the ground plane and stays planted,// never floating mid-air. SPAWN_DROP is how far above the floor the guide spawns@@ -60,6 +65,7 @@ export class GuideAvatar {this._yaw = 0;this._targetYaw = 0;this._walking = false;+ this._walkRaf = 0;this._reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;this._pos = { x: 0, y: 0 };// Vertical physics state — height above the ground plane and its velocity.@@ -88,7 +94,7 @@ export class GuideAvatar {}// Park bottom-right until the first stop moves it.const start = { x: window.innerWidth - CANVAS_W - MARGIN, y: window.innerHeight - CANVAS_H - MARGIN };- this._setPos(start, false);+ this._setPos(start);}_buildDom() {@@ -164,33 +170,47 @@ export class GuideAvatar {// ── Public choreography API ───────────────────────────────────────────────// Walk the avatar to a screen position (top-left of its canvas). Resolves- // when it arrives. The CSS transition does the gliding; we just flip the- // controller into its walk cycle for the duration.+ // when it arrives. Rather than gliding via a CSS transition, it steps the+ // guide there frame-by-frame at a constant pace through place() — the exact+ // locomotion the visitor drives in free roam — so the body advances in+ // lockstep with the walk cycle and reads as genuine walking, not a slide.walkTo(pos) {const clamped = {x: clamp(pos.x, MARGIN, window.innerWidth - CANVAS_W - MARGIN),y: clamp(pos.y, MARGIN, window.innerHeight - CANVAS_H - MARGIN),};+ // Supersede any walk already in flight so a fresh click redirects the guide.+ cancelAnimationFrame(this._walkRaf);+ this._walkRaf = 0;const dx = clamped.x - this._pos.x;const dy = clamped.y - this._pos.y;const dist = Math.hypot(dx, dy);- if (dist < 4) {- this._setPos(clamped, false);+ if (dist < 4 || this._reduced) {+ // Already there, or reduced-motion: place without a stride and settle.+ this._setPos(clamped);+ this.settle();return Promise.resolve();}- // Face the direction of travel so the walk reads naturally.- this._targetYaw = clamp((dx / window.innerWidth) * 1.6, -0.7, 0.7);- const durMs = this._reduced ? 0 : clamp(dist * 1.6, 420, 1500);- this.controller?.setState('walk');- this._walking = true;- this._setPos(clamped, !this._reduced, durMs);+ const ux = dx / dist;+ const uy = dy / dist;+ const from = { x: this._pos.x, y: this._pos.y };+ let traveled = 0;+ let last = performance.now();return new Promise((resolve) => {- clearTimeout(this._walkTimer);- this._walkTimer = setTimeout(() => {- this._walking = false;- this.controller?.setState('idle');- resolve();- }, durMs + 30);+ const step = (now) => {+ const dt = Math.min((now - last) / 1000, 0.05);+ last = now;+ traveled = Math.min(dist, traveled + WALK_SPEED * dt);+ this.place({ x: from.x + ux * traveled, y: from.y + uy * traveled });+ if (traveled >= dist) {+ this._walkRaf = 0;+ this.settle();+ resolve();+ return;+ }+ this._walkRaf = requestAnimationFrame(step);+ };+ this._walkRaf = requestAnimationFrame(step);});}@@ -244,7 +264,7 @@ export class GuideAvatar {this._walking = true;clearTimeout(this._settleTimer);this._settleTimer = setTimeout(() => this.settle(), 180);- this._setPos({ x, y }, false);+ this._setPos({ x, y });}settle() {@@ -293,12 +313,12 @@ export class GuideAvatar {}// ── Internals ─────────────────────────────────────────────────────────────- _setPos(pos, animate, durMs = 600) {+ // Snap the host to a screen position. All locomotion is now driven frame-by-+ // frame (walkTo / place / free-roam), so the host never CSS-transitions — its+ // stride and travel stay in sync.+ _setPos(pos) {this._pos = pos;if (!this.host) return;- this.host.style.transition = animate- ? `left ${durMs}ms cubic-bezier(.34,.02,.2,1), top ${durMs}ms cubic-bezier(.34,.02,.2,1)`- : 'none';this.host.style.left = pos.x + 'px';this.host.style.top = pos.y + 'px';}@@ -327,9 +347,10 @@ export class GuideAvatar {dispose() {cancelAnimationFrame(this._raf);- clearTimeout(this._walkTimer);+ cancelAnimationFrame(this._walkRaf);clearTimeout(this._settleTimer);this._raf = 0;+ this._walkRaf = 0;try {this.controller?.dispose();} catch {