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.

feat: feature-tour free-roam + narrator upgrades, nav and x402 refinements

nirholasd4aeb677ff94
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 895fbfe02..7c3e614aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Feed** (`/feed`) — Recent activity from the people and agents you follow on three.ws.
- **Walk** (`/walk`) — Your 3D avatar walks anywhere on the web. Live demos across six environments, a Chrome extension, one-tag embeds, and a global distance leaderboard.
- **Walk Leaderboard** (`/walk-leaderboard`) — Global leaderboard for the walking avatar — distance walked, sites visited, and time, ranked daily, weekly, and all-time.
+- **"Made with Forge" showcase on the homepage spins again** — The homepage's community strip — fresh text-to-3D models the moment they're forged — had stopped showing the spinning models, leaving only empty placeholder tiles. The viewer that renders each model was waiting on a script that never loaded because of a too-broad name match, so the meshes never appeared. The strip now loads its viewer correctly: real community creations rotate live again, with a click-through to forge your own. (`/forge`) `[fix]`
- **$THREE buyback commitment is now public and verifiable on the token page** — The $THREE page now leads with the protocol's buyback commitment — the fixed share of all platform revenue routed into buying $THREE on the open market and sending it to the treasury — shown as revenue earned, dollars committed, dollars deployed on-chain, and how much of the commitment has been kept. Every individual buyback is listed with a one-click Solscan receipt, so the promise is provable, not just stated. No burn: supply is never destroyed. (`/three-token`) `[feature]`
- **$THREE holder leaderboard loads faster from a shared snapshot** — The $THREE holder leaderboard, its share card, and the token stats panel used to rescan every holder on-chain on each page view. They now read from a holder snapshot that refreshes every few minutes, so the board and badges load faster and the same numbers stay consistent across all three surfaces. (`/leaderboard`) `[improvement, infra]`
- **Affiliate dashboard now shows who you referred** — The referrals dashboard lists each person you referred with their signup date, the revenue they generated, and the commission you earned — not just totals. (`/dashboard/referrals`) `[improvement]`
@@ -20,6 +21,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Authorize $THREE once, then pay with no wallet popups** — The $THREE page now lets you set a spending allowance: approve a cap once, and paid actions across the platform — forge, skills, names, cosmetics — debit it automatically without asking you to sign every time. It's non-custodial and built on Solana's native, audited Subscriptions & Allowances program: your tokens stay in your own wallet until a charge pulls them, never more than the cap you set, and you can let it expire or revoke it anytime. Set a cap, top it up, or leave it off and keep signing each payment — your choice. (`/three-token`) `[feature]`
- **Avatar Studio: full-spectrum color picker and one-tap Looks** — The Color tab in Avatar Studio is no longer limited to a fixed row of swatches. Tap the rainbow chip on any of skin, hair, or outfit and a real color wheel opens — drag for any hue, slide for brightness, type or paste an exact hex code, or use the eyedropper to sample any color on your screen (where your browser supports it). Every color you pick is remembered in a 'Recent' strip so a palette carries from one part of the avatar to the next, and between sessions. New 'Looks' sit above the colors too: one tap themes skin, hair, and outfit together — Noir, Sunset, Arctic, Cyber, Rosé, Forest, Mono, Ember — and a whole picking session counts as a single undo. The wheel loads only when you open it, so the studio stays fast. (`/avatar-studio`) `[feature, improvement]`
- **Clearer empty state on the $THREE live-trades feed** — Before the next trade lands, the live-trades panel on the $THREE token page now reads in plain language — 'Live trades will appear here' — with a short note on what it shows, and the technical detail tucked behind an info tooltip. Screen readers announce new trades as they stream in. (`/three-token`) `[improvement]`
+- **Club door payment no longer fails when an RPC node blips** — Paying the cover charge to enter the Pole Club builds a Solana transaction the moment you authorize, and that step reads a fresh blockhash from the network. If every Solana node we try is momentarily throttled in that instant, the door used to fail with an opaque "internal error" right after you confirmed the price — even though nothing was charged. The door now keeps a recent blockhash on hand and reuses it through a brief outage, so a transient node hiccup no longer turns you away. It still refuses only when there's genuinely no valid blockhash to build with. `[fix, infra]`
- **Coin pages stay fast when pump.fun is having a moment** — The /launches coin page pulls creator fee-sharing earnings live from pump.fun. We put that call behind a circuit breaker (built on the well-tested cockatiel library rather than home-grown code): if pump.fun slows down or errors, the breaker trips after a few failures and the page instantly skips that one enrichment instead of every visitor waiting out the timeout. The earnings simply show as unavailable until pump.fun recovers, and the rest of the page — registry, intel, outcome, trader record — was never affected. Same approach is now available platform-wide for other third-party data sources. (`/launches`) `[infra, improvement]`
- **Discover and character feeds load faster under heavy traffic** — The Discover grid and the published-agents (Characters) feed now serve from the edge cache, so a surge of visitors is absorbed at the CDN instead of re-running a database scan on every request. Pages stay fast and consistent even during a rush, and a stale-while-revalidate window keeps them warm between refreshes. (`/discover`) `[improvement, infra]`
- **Discover and Marketplace now browse the same way** — Searching, filtering, and sorting agents now work identically on /discover and /marketplace. Both pages share one polished control bar — debounced search, filter chips, and sort — and your choices are saved in the page address, so a filtered view is shareable and the browser back button restores it. Loading, empty, and error states were unified too: a search that matches nothing shows a clear 'no results' panel with a one-click 'Clear filters', and a failed load offers a retry instead of a blank grid. (`/discover`) `[improvement]`
@@ -48,7 +50,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Pay-per-call endpoints accept Solana USDC payments again** — Paying for any x402 endpoint with Solana USDC was failing the moment the wallet tried to build the payment — the platform's receiving address was being published with a stray invisible character, so a correctly-built payment got rejected as going to the wrong recipient. Payment addresses are now cleaned before they're ever advertised, so Solana USDC payments to paid endpoints go through and settle as expected. `[fix]`
- **Pay-what-you-want pricing for skills** — Creators can now price a skill as “pay what you want” with an optional minimum; buyers name their price at checkout and the fee, referral, and revenue math all use the actual amount paid. (`/marketplace`) `[feature]`
- **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 own guide for the product tour** — 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. She also obeys gravity now, just like your character on the Walk pages: she drops in and plants her feet on the ground instead of hovering. `[feature, improvement]`
+- **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]`
- **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]`
@@ -57,7 +59,10 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Solana is now the default payment network** — Solana is now the default everywhere you pick a chain — the dashboard's Default payment network setting, x402 merchant settlement, and the monetization payout wallet all default to Solana for every user, with Solana listed first. Base and Polygon remain available if you prefer an EVM chain. (`/dashboard`) `[improvement]`
- **Solana stays online even if our paid RPC goes dark** — Everything onchain — paying, minting, balances, name lookups — depends on a Solana RPC node answering. When our primary paid node was throttled or its plan lapsed, some of those reads could error out. The platform now falls through a deeper chain: the paid node first, then several backup providers, then five independent public nodes (each verified live), so a request only fails if every one of them is down at the same moment. The embeddable payment widget and Solana name registration were moved onto the same resilient connection. `[fix, infra]`
- **The $THREE page now spells out why to hold — four real utility pillars** — The $THREE page leads with a clear "Why hold $THREE" section: revenue buybacks (a fixed, live share of platform revenue buys $THREE on the open market), holder rewards (every paid action reflects $THREE back to holders pro-rata), hold-to-access (discounts, higher quotas, and pro perks), and real usage (deploying agents, forging avatars, and trading the marketplace all run on $THREE). Each pillar maps to a mechanism that actually exists on the platform, and the buyback figure is wired to the live commitment. The page's market data also now rides a shared cache, so it stays fast and reliable under heavy traffic. (`/three-token`) `[feature, improvement]`
+- **The Forge now fills the whole screen** — The Forge — where you turn text or photos into a textured 3D model — used to sit in a narrow column down the middle of the page, leaving big empty margins on wide monitors and a cramped preview. It now stretches edge to edge with comfortable side gutters, so the 3D preview gets far more room to show off your model while the controls stay put on the left. (`/forge`) `[improvement]`
+- **The guided tour now works on iPhones and phones** — The guided tour — where a 3D avatar walks across the live site and narrates every feature — was effectively broken on phones: mobile browsers block audio unless it starts from a tap, and that permission resets each time the tour moves to a new page, so the guide ran silent. The tour now unlocks its voice on your first tap of each page and shows a clear "tap for the guide's voice" cue while it waits, then re-speaks the current stop so you don't miss anything. The playback controls also got phone-sized tap targets and a layout that fits a small screen, and you can now launch the whole tour straight from the homepage with the new "Take the tour" button. (`/tour`) `[fix, feature]`
- **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]`
- **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/api/x402-checkout.js b/api/x402-checkout.js
index dd2e6f9a5..8156405d0 100644
--- a/api/x402-checkout.js
+++ b/api/x402-checkout.js
@@ -53,6 +53,10 @@ const SOLANA_DEVNET_RPC = env.SOLANA_RPC_URL_DEVNET;
// handing out a stale-enough blockhash for the buyer's signed tx to fail.
const MINT_DECIMALS_TTL_MS = 5 * 60 * 1000;
const BLOCKHASH_TTL_MS = 8 * 1000;
+// Cold-path fail-open window: a Solana blockhash stays valid on-chain for ~60-90s,
+// so if a live fetch fails we may still serve a cached one this much past its fetch
+// time rather than 500'ing the checkout. Conservatively under the cluster floor.
+const BLOCKHASH_STALE_FALLBACK_MS = 60 * 1000;
const mintDecimalsCache = new Map(); // `${rpc}:${mint}` -> { decimals, at }
const blockhashCache = new Map(); // rpc -> { blockhash, at }
@@ -96,12 +100,36 @@ function toPubkey(value, field) {
}
}
-async function getRecentBlockhash(conn, rpc) {
+// Resolve a recent blockhash for the payment tx. The one RPC call on the USDC
+// checkout hot path that isn't already fail-open (getMintDecimals resolves
+// canonical mints from a local map; ataExists fails open to "missing"), so a
+// transient *total* failover outage — every endpoint in solanaConnection's chain
+// failing within this single request — used to throw straight through wrap() as an
+// opaque "internal error — quote ref … to support" 500 at the modal's Authorize
+// step. Match the sibling fail-open posture: if the live fetch fails but we still
+// hold a cached blockhash inside the cluster's ~60-90s validity window, serve it.
+// Safe by construction — a blockhash only bounds how long the buyer has to land the
+// signed tx, never the amount or recipient, and a too-stale one simply fails to
+// confirm and prompts a clean retry, never a double charge. `now` is injectable so
+// the staleness branches are unit-testable without a real clock.
+export async function getRecentBlockhash(conn, rpc, { now = Date.now } = {}) {
const hit = blockhashCache.get(rpc);
- if (hit && Date.now() - hit.at < BLOCKHASH_TTL_MS) return hit.blockhash;
- const { blockhash } = await conn.getLatestBlockhash('confirmed');
- blockhashCache.set(rpc, { blockhash, at: Date.now() });
- return blockhash;
+ if (hit && now() - hit.at < BLOCKHASH_TTL_MS) return hit.blockhash;
+ try {
+ const { blockhash } = await conn.getLatestBlockhash('confirmed');
+ blockhashCache.set(rpc, { blockhash, at: now() });
+ return blockhash;
+ } catch (err) {
+ if (hit && now() - hit.at < BLOCKHASH_STALE_FALLBACK_MS) {
+ console.warn(
+ `[x402-checkout] getLatestBlockhash failed across all RPC endpoints; serving ${Math.round(
+ (now() - hit.at) / 1000,
+ )}s-old cached blockhash so checkout still builds: ${err?.message || err}`,
+ );
+ return hit.blockhash;
+ }
+ throw err;
+ }
}
// Does an ATA already exist on-chain? web3.js decodes getAccountInfo's reply
diff --git a/data/changelog.json b/data/changelog.json
index de09abca1..a7711d352 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,52 @@
{
"$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": "The Forge now fills the whole screen",
+ "summary": "The Forge — where you turn text or photos into a textured 3D model — used to sit in a narrow column down the middle of the page, leaving big empty margins on wide monitors and a cramped preview. It now stretches edge to edge with comfortable side gutters, so the 3D preview gets far more room to show off your model while the controls stay put on the left.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/forge"
+ },
+ {
+ "date": "2026-06-21",
+ "title": "The guided tour now works on iPhones and phones",
+ "summary": "The guided tour — where a 3D avatar walks across the live site and narrates every feature — was effectively broken on phones: mobile browsers block audio unless it starts from a tap, and that permission resets each time the tour moves to a new page, so the guide ran silent. The tour now unlocks its voice on your first tap of each page and shows a clear \"tap for the guide's voice\" cue while it waits, then re-speaks the current stop so you don't miss anything. The playback controls also got phone-sized tap targets and a layout that fits a small screen, and you can now launch the whole tour straight from the homepage with the new \"Take the tour\" button.",
+ "tags": [
+ "fix",
+ "feature"
+ ],
+ "link": "/tour"
+ },
+ {
+ "date": "2026-06-21",
+ "title": "The Walk Companion now works on phones",
+ "summary": "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.",
+ "tags": [
+ "fix",
+ "feature"
+ ]
+ },
+ {
+ "date": "2026-06-21",
+ "title": "\"Made with Forge\" showcase on the homepage spins again",
+ "summary": "The homepage's community strip — fresh text-to-3D models the moment they're forged — had stopped showing the spinning models, leaving only empty placeholder tiles. The viewer that renders each model was waiting on a script that never loaded because of a too-broad name match, so the meshes never appeared. The strip now loads its viewer correctly: real community creations rotate live again, with a click-through to forge your own.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/forge"
+ },
+ {
+ "date": "2026-06-21",
+ "title": "Club door payment no longer fails when an RPC node blips",
+ "summary": "Paying the cover charge to enter the Pole Club builds a Solana transaction the moment you authorize, and that step reads a fresh blockhash from the network. If every Solana node we try is momentarily throttled in that instant, the door used to fail with an opaque \"internal error\" right after you confirmed the price — even though nothing was charged. The door now keeps a recent blockhash on hand and reuses it through a brief outage, so a transient node hiccup no longer turns you away. It still refuses only when there's genuinely no valid blockhash to build with.",
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-06-21",
"title": "Every avatar you create now auto-rigs so it can move",
@@ -12,8 +58,8 @@
},
{
"date": "2026-06-21",
- "title": "Pick your own guide for the product tour",
- "summary": "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. She also obeys gravity now, just like your character on the Walk pages: she drops in and plants her feet on the ground instead of hovering.",
+ "title": "Pick your guide for the product tour — and walk her around yourself",
+ "summary": "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.",
"tags": [
"feature",
"improvement"
diff --git a/pages/forge.html b/pages/forge.html
index 9ebeeecb6..77c96853c 100644
--- a/pages/forge.html
+++ b/pages/forge.html
@@ -47,9 +47,9 @@
/* No per-surface accent override — forge uses the global monochrome tokens. */
.forge-main {
- max-width: 1320px;
- margin: 0 auto;
- padding: var(--space-md) var(--space-md) var(--space-2xl);
+ max-width: none;
+ margin: 0;
+ padding: var(--space-md) clamp(var(--space-md), 4vw, var(--space-2xl)) var(--space-2xl);
}
.forge-head {
/* Reset the global site-nav `header` rule from style.css —
diff --git a/pages/home.html b/pages/home.html
index 654d2d056..007b7eebe 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -2476,6 +2476,7 @@
<a class="btn btn--primary" href="/create" data-cta="build_agent" data-cta-loc="hero">Build your agent <span class="arrow">→</span></a>
<a class="btn btn--forge" href="/forge" data-cta="text_to_3d" data-cta-loc="hero"><span class="btn-forge-dot" aria-hidden="true"></span>Text → 3D</a>
<a class="btn" href="#embed" data-cta="see_embed" data-cta-loc="hero">See the embed</a>
+ <a class="btn" href="/tour" id="hero-tour-start" data-cta="guided_tour" data-cta-loc="hero"><span aria-hidden="true">▶</span>&nbsp;Take the tour</a>
</div>
</div>
<div class="hero-stage" id="hero-stage">
@@ -3035,7 +3036,12 @@
const MV_SRC = 'https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js';
function ensureModelViewer() {
if (customElements.get('model-viewer')) return;
- if (document.querySelector('script[src*="model-viewer"]')) return;
+ // Reuse the library if the hero/mini-forge already injected it, but match
+ // the actual element bundle (model-viewer.min.js) — NOT model-viewer-meshopt.js,
+ // the decoder helper loaded on this page, whose src also contains
+ // "model-viewer". The looser match short-circuited here and left the
+ // community cards permanently un-upgraded (gradient/poster, never a mesh).
+ if (document.querySelector('script[src*="model-viewer.min.js"]')) return;
var s = document.createElement('script');
s.type = 'module';
s.src = MV_SRC;
@@ -6954,6 +6960,26 @@
});
})();
</script>
+ <script>
+ // Hero "Take the tour" launches the guided 3D tour directly from the
+ // homepage — the engine boots on the first stop's page via ?tour=start
+ // (nav.js injects /feature-tour.js when it sees the param). The anchor's
+ // href="/tour" is the no-JS fallback to the track picker.
+ (function () {
+ var btn = document.getElementById('hero-tour-start');
+ if (!btn) return;
+ btn.addEventListener('click', function (e) {
+ e.preventDefault();
+ fetch('/tour/curriculum.json', { cache: 'force-cache' })
+ .then(function (r) { return r.json(); })
+ .then(function (c) {
+ var first = (c.stops && c.stops[0] && c.stops[0].path) || '/';
+ location.href = first + '?tour=start';
+ })
+ .catch(function () { location.href = '/?tour=start'; });
+ });
+ })();
+ </script>
<script type="module">
import { initAcquisitionAnalytics } from '/src/acquisition-analytics.js';
initAcquisitionAnalytics();
diff --git a/public/changelog.json b/public/changelog.json
index 377f55e13..b0d5094ca 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-21T09:59:56.909Z",
+ "generated_at": "2026-06-21T11:00:00.373Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -56,6 +56,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "\"Made with Forge\" showcase on the homepage spins again",
+ "summary": "The homepage's community strip — fresh text-to-3D models the moment they're forged — had stopped showing the spinning models, leaving only empty placeholder tiles. The viewer that renders each model was waiting on a script that never loaded because of a too-broad name match, so the meshes never appeared. The strip now loads its viewer correctly: real community creations rotate live again, with a click-through to forge your own.",
+ "link": "/forge",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-21",
"type": "update",
@@ -150,6 +160,17 @@
"improvement"
]
},
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "Club door payment no longer fails when an RPC node blips",
+ "summary": "Paying the cover charge to enter the Pole Club builds a Solana transaction the moment you authorize, and that step reads a fresh blockhash from the network. If every Solana node we try is momentarily throttled in that instant, the door used to fail with an opaque \"internal error\" right after you confirmed the price — even though nothing was charged. The door now keeps a recent blockhash on hand and reuses it through a brief outage, so a transient node hiccup no longer turns you away. It still refuses only when there's genuinely no valid blockhash to build with.",
+ "link": null,
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-06-21",
"type": "update",
@@ -455,8 +476,8 @@
{
"date": "2026-06-21",
"type": "update",
- "title": "Pick your own guide for the product tour",
- "summary": "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. She also obeys gravity now, just like your character on the Walk pages: she drops in and plants her feet on the ground instead of hovering.",
+ "title": "Pick your guide for the product tour — and walk her around yourself",
+ "summary": "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.",
"link": null,
"tags": [
"feature",
@@ -549,6 +570,27 @@
"improvement"
]
},
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "The Forge now fills the whole screen",
+ "summary": "The Forge — where you turn text or photos into a textured 3D model — used to sit in a narrow column down the middle of the page, leaving big empty margins on wide monitors and a cramped preview. It now stretches edge to edge with comfortable side gutters, so the 3D preview gets far more room to show off your model while the controls stay put on the left.",
+ "link": "/forge",
+ "tags": [
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "The guided tour now works on iPhones and phones",
+ "summary": "The guided tour — where a 3D avatar walks across the live site and narrates every feature — was effectively broken on phones: mobile browsers block audio unless it starts from a tap, and that permission resets each time the tour moves to a new page, so the guide ran silent. The tour now unlocks its voice on your first tap of each page and shows a clear \"tap for the guide's voice\" cue while it waits, then re-speaks the current stop so you don't miss anything. The playback controls also got phone-sized tap targets and a layout that fits a small screen, and you can now launch the whole tour straight from the homepage with the new \"Take the tour\" button.",
+ "link": "/tour",
+ "tags": [
+ "fix",
+ "feature"
+ ]
+ },
{
"date": "2026-06-21",
"type": "update",
@@ -560,6 +602,17 @@
"improvement"
]
},
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "The Walk Companion now works on phones",
+ "summary": "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.",
+ "link": null,
+ "tags": [
+ "fix",
+ "feature"
+ ]
+ },
{
"date": "2026-06-21",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 6a3492025..3ac3de720 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -46,6 +46,14 @@
<category>launch</category>
<description>Global leaderboard for the walking avatar — distance walked, sites visited, and time, ranked daily, weekly, and all-time.</description>
</item>
+ <item>
+ <title>&quot;Made with Forge&quot; showcase on the homepage spins again</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-21:&quot;Made with Forge&quot; showcase on the homepage spins again</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The homepage's community strip — fresh text-to-3D models the moment they're forged — had stopped showing the spinning models, leaving only empty placeholder tiles. The viewer that renders each model was waiting on a script that never loaded because of a too-broad name match, so the meshes never appeared. The strip now loads its viewer correctly: real community creations rotate live again, with a click-through to forge your own.</description>
+ </item>
<item>
<title>$THREE buyback commitment is now public and verifiable on the token page</title>
<link>https://three.ws/three-token</link>
@@ -118,6 +126,14 @@
<category>improvement</category>
<description>Before the next trade lands, the live-trades panel on the $THREE token page now reads in plain language — 'Live trades will appear here' — with a short note on what it shows, and the technical detail tucked behind an info tooltip. Screen readers announce new trades as they stream in.</description>
</item>
+ <item>
+ <title>Club door payment no longer fails when an RPC node blips</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-21:Club door payment no longer fails when an RPC node blips</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Paying the cover charge to enter the Pole Club builds a Solana transaction the moment you authorize, and that step reads a fresh blockhash from the network. If every Solana node we try is momentarily throttled in that instant, the door used to fail with an opaque &quot;internal error&quot; right after you confirmed the price — even though nothing was charged. The door now keeps a recent blockhash on hand and reuses it through a brief outage, so a transient node hiccup no longer turns you away. It still refuses only when there's genuinely no valid blockhash to build with.</description>
+ </item>
<item>
<title>Coin pages stay fast when pump.fun is having a moment</title>
<link>https://three.ws/launches</link>
@@ -343,12 +359,12 @@
<description>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.</description>
</item>
<item>
- <title>Pick your own guide for the product tour</title>
+ <title>Pick your guide for the product tour — and walk her around yourself</title>
<link>https://three.ws/changelog</link>
- <guid isPermaLink="false">2026-06-21:Pick your own guide for the product tour</guid>
+ <guid isPermaLink="false">2026-06-21:Pick your guide for the product tour — and walk her around yourself</guid>
<pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
<category>feature</category>
- <description>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. She also obeys gravity now, just like your character on the Walk pages: she drops in and plants her feet on the ground instead of hovering.</description>
+ <description>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.</description>
</item>
<item>
<title>Platform-wide hardening: payment integrity, security, and scale</title>
@@ -414,6 +430,22 @@
<category>feature</category>
<description>The $THREE page leads with a clear &quot;Why hold $THREE&quot; section: revenue buybacks (a fixed, live share of platform revenue buys $THREE on the open market), holder rewards (every paid action reflects $THREE back to holders pro-rata), hold-to-access (discounts, higher quotas, and pro perks), and real usage (deploying agents, forging avatars, and trading the marketplace all run on $THREE). Each pillar maps to a mechanism that actually exists on the platform, and the buyback figure is wired to the live commitment. The page's market data also now rides a shared cache, so it stays fast and reliable under heavy traffic.</description>
</item>
+ <item>
+ <title>The Forge now fills the whole screen</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-21:The Forge now fills the whole screen</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The Forge — where you turn text or photos into a textured 3D model — used to sit in a narrow column down the middle of the page, leaving big empty margins on wide monitors and a cramped preview. It now stretches edge to edge with comfortable side gutters, so the 3D preview gets far more room to show off your model while the controls stay put on the left.</description>
+ </item>
+ <item>
+ <title>The guided tour now works on iPhones and phones</title>
+ <link>https://three.ws/tour</link>
+ <guid isPermaLink="false">2026-06-21:The guided tour now works on iPhones and phones</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The guided tour — where a 3D avatar walks across the live site and narrates every feature — was effectively broken on phones: mobile browsers block audio unless it starts from a tap, and that permission resets each time the tour moves to a new page, so the guide ran silent. The tour now unlocks its voice on your first tap of each page and shows a clear &quot;tap for the guide's voice&quot; cue while it waits, then re-speaks the current stop so you don't miss anything. The playback controls also got phone-sized tap targets and a layout that fits a small screen, and you can now launch the whole tour straight from the homepage with the new &quot;Take the tour&quot; button.</description>
+ </item>
<item>
<title>The guided tour, now yours to steer</title>
<link>https://three.ws/tour</link>
@@ -422,6 +454,14 @@
<category>feature</category>
<description>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.</description>
</item>
+ <item>
+ <title>The Walk Companion now works on phones</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-21:The Walk Companion now works on phones</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>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 &quot;Walk with me&quot; 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.</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.json
index 728471295..b90ec70ff 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-21T09:59:56.898Z",
+ "generated_at": "2026-06-21T11:00:00.316Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/nav.css b/public/nav.css
index 46d53b4d9..32efe8da4 100644
--- a/public/nav.css
+++ b/public/nav.css
@@ -455,6 +455,35 @@
background: rgba(139,92,246,0.14);
}
.dr-hot-arrow { margin-left: auto; color: var(--nv-text-3); }
+/* Walk Companion switch row — the drawer's counterpart to the desktop nav
+ toggle. Same iris card chrome as a featured row, but it flips an on/off pill
+ in place instead of navigating. */
+.nav-drawer button.dr-walk {
+ display: flex; align-items: center; gap: 10px; width: calc(100% - 24px);
+ margin: 4px 12px 8px; padding: 12px 14px;
+ border: 1px solid rgba(139,92,246,0.35); border-radius: 12px;
+ color: var(--nv-text); font: inherit; font-weight: 500; text-align: left;
+ background: rgba(139,92,246,0.08); cursor: pointer;
+ transition: border-color 0.15s, background 0.15s;
+}
+.nav-drawer button.dr-walk:hover { border-color: rgba(139,92,246,0.5); }
+.nav-drawer button.dr-walk:active {
+ border-color: rgba(139,92,246,0.6); background: rgba(139,92,246,0.14);
+}
+.dr-walk .nav-walk-ico { font-size: 18px; line-height: 1; }
+.dr-walk-label { flex: 1; }
+.dr-walk-state {
+ font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
+ padding: 3px 9px; border-radius: 999px;
+ color: var(--nv-text-3); background: var(--nv-surface-1);
+ border: 1px solid var(--nv-hairline);
+}
+.nav-drawer button.dr-walk.is-on {
+ border-color: rgba(139,92,246,0.6); background: rgba(139,92,246,0.16);
+}
+.dr-walk.is-on .dr-walk-state {
+ color: #fff; background: rgba(139,92,246,0.85); border-color: transparent;
+}
/* Light bar: white-alpha pill chrome washes out — remap to ink tints. */
:root[data-theme='light'] .nav-main > a.nav-hot {
border-color: rgba(15, 18, 28, 0.18);
diff --git a/public/nav.js b/public/nav.js
index 633f53a51..89e533afa 100644
--- a/public/nav.js
+++ b/public/nav.js
@@ -262,6 +262,15 @@ function renderDrawerLink(item) {
function renderDrawer(navData) {
let html = '';
+ // Walk Companion toggle — the desktop nav exposes it in `.nav-end`, which is
+ // hidden on the mobile breakpoint, so without this row touch visitors have no
+ // way to summon the walking avatar. Lead the drawer with it as a switch row;
+ // initWalkToggle wires it (and keeps it in sync with the desktop button).
+ html +=
+ `<button type="button" class="dr-walk" id="home-nav-drawer-walk" aria-pressed="false">` +
+ `<span class="nav-walk-ico" aria-hidden="true">🚶</span>` +
+ `<span class="dr-walk-label">Walk with me</span>` +
+ `<span class="dr-walk-state" aria-hidden="true">Off</span></button>`;
// Highlighted top-level links lead the drawer as featured rows — burying
// the one link the nav spotlights under "More" defeats the spotlight.
navData.NAV_LINKS.filter((l) => l.highlight).forEach((link) => {
@@ -423,7 +432,9 @@ function initDrawer(root) {
}
toggle.addEventListener('click', () => setOpen(!isOpen()));
drawer.addEventListener('click', (e) => {
- if (e.target.closest('a')) setOpen(false);
+ // Links navigate; the Walk toggle stays put but the drawer still closes so
+ // the summoned avatar isn't hidden behind the overlay.
+ if (e.target.closest('a, #home-nav-drawer-walk')) setOpen(false);
});
document.addEventListener('keydown', (e) => {
if (!isOpen()) return;
@@ -518,16 +529,22 @@ function ensureWalkCompanion() {
}
function initWalkToggle(root) {
- const btn = root.querySelector('#home-nav-walk');
- if (!btn) return;
+ // Desktop button (`.nav-end`) + mobile drawer row — both toggle the same
+ // companion and stay mirrored, so the avatar is reachable at every breakpoint.
+ const btns = [...root.querySelectorAll('#home-nav-walk, #home-nav-drawer-walk')];
+ if (!btns.length) return;
const params = new URLSearchParams(location.search);
const override = params.get('walk');
function sync() {
const on = walkIsEnabled();
- btn.setAttribute('aria-pressed', on ? 'true' : 'false');
- btn.classList.toggle('is-on', on);
+ btns.forEach((btn) => {
+ btn.setAttribute('aria-pressed', on ? 'true' : 'false');
+ btn.classList.toggle('is-on', on);
+ const state = btn.querySelector('.dr-walk-state');
+ if (state) state.textContent = on ? 'On' : 'Off';
+ });
}
// An explicit ?walk= override decides the initial state; otherwise restore.
@@ -558,16 +575,18 @@ function initWalkToggle(root) {
ensureWalkCompanion();
}
- btn.addEventListener('click', () => {
- if (window.__walkCompanion) {
- window.__walkCompanion.toggle();
- } else {
- try {
- localStorage.setItem(WALK_ENABLED_KEY, '1');
- } catch (_) {}
- ensureWalkCompanion();
- }
- sync();
+ btns.forEach((btn) => {
+ btn.addEventListener('click', () => {
+ if (window.__walkCompanion) {
+ window.__walkCompanion.toggle();
+ } else {
+ try {
+ localStorage.setItem(WALK_ENABLED_KEY, '1');
+ } catch (_) {}
+ ensureWalkCompanion();
+ }
+ sync();
+ });
});
window.addEventListener('walk-companion:change', sync);
diff --git a/public/x402-pay-core.js b/public/x402-pay-core.js
index a831492c7..1288af66a 100644
--- a/public/x402-pay-core.js
+++ b/public/x402-pay-core.js
@@ -184,11 +184,26 @@ function solanaRpcUrl() {
if (meta?.content) return meta.content;
}
if (typeof window !== 'undefined' && window.SOLANA_RPC_URL) return window.SOLANA_RPC_URL;
- // Last resort: our same-origin proxy, which fails over across Helius → Alchemy →
- // dRPC → five keyless public lanes, so the balance read survives any single
- // provider (an expired Helius plan included) being down. Absolute URL so the
- // widget still resolves a working RPC when embedded on a third-party origin.
- return 'https://three.ws/api/solana-rpc';
+ // Last resort: the /api/solana-rpc proxy co-deployed with this script, which
+ // fails over across Helius → Alchemy → dRPC → five keyless public lanes, so the
+ // balance read survives any single provider (an expired Helius plan included)
+ // being down. Resolved from this module's own serving origin, NOT a hardcoded
+ // host: as a third-party embed the script is loaded from three.ws (resolves to
+ // three.ws); as the first-party app on a preview/dev/tunnel origin it resolves
+ // same-origin, so the read never trips that origin's CORS allowlist.
+ return scriptOrigin() + '/api/solana-rpc';
+}
+
+// Origin that served this module — where its same-deployment /api proxy lives.
+function scriptOrigin() {
+ try {
+ const o = new URL(import.meta.url).origin;
+ if (o && o !== 'null') return o;
+ } catch {}
+ if (typeof location !== 'undefined' && location.origin && location.origin !== 'null') {
+ return location.origin;
+ }
+ return 'https://three.ws';
}
// Sum the owner's SPL balance for `mint`. Returns a BigInt of atomic units, or
diff --git a/public/x402.js b/public/x402.js
index b9ff424cf..5226aecc7 100644
--- a/public/x402.js
+++ b/public/x402.js
@@ -189,11 +189,26 @@ function solanaRpcUrl() {
const meta = typeof document !== 'undefined' && document.querySelector('meta[name="solana-rpc-url"]');
if (meta?.content) return meta.content;
if (typeof window !== 'undefined' && window.SOLANA_RPC_URL) return window.SOLANA_RPC_URL;
- // Last resort: our same-origin proxy, which fails over across Helius → Alchemy →
- // dRPC → five keyless public lanes, so the balance read survives any single
- // provider (an expired Helius plan included) being down. Absolute URL so the
- // widget still resolves a working RPC when embedded on a third-party origin.
- return 'https://three.ws/api/solana-rpc';
+ // Last resort: the /api/solana-rpc proxy co-deployed with this script, which
+ // fails over across Helius → Alchemy → dRPC → five keyless public lanes, so the
+ // balance read survives any single provider (an expired Helius plan included)
+ // being down. Resolved from this module's own serving origin, NOT a hardcoded
+ // host: as a third-party embed the script is loaded from three.ws (resolves to
+ // three.ws); as the first-party app on a preview/dev/tunnel origin it resolves
+ // same-origin, so the read never trips that origin's CORS allowlist.
+ return scriptOrigin() + '/api/solana-rpc';
+}
+
+// Origin that served this module — where its same-deployment /api proxy lives.
+function scriptOrigin() {
+ try {
+ const o = new URL(import.meta.url).origin;
+ if (o && o !== 'null') return o;
+ } catch {}
+ if (typeof location !== 'undefined' && location.origin && location.origin !== 'null') {
+ return location.origin;
+ }
+ return 'https://three.ws';
}
async function readSolanaBalanceAtomic(owner, mint) {
try {
diff --git a/src/feature-tour/controls.js b/src/feature-tour/controls.js
index 1615c74f1..c3f929c8b 100644
--- a/src/feature-tour/controls.js
+++ b/src/feature-tour/controls.js
@@ -131,7 +131,7 @@ function ensureStyles() {
const style = document.createElement('style');
style.id = 'tws-tour-bar-style';
style.textContent = `
-.tws-tour-bar{position:fixed;left:50%;bottom:18px;transform:translateX(-50%) translateY(14px);z-index:${Z_CONTROLS};display:flex;align-items:center;gap:8px;padding:8px 12px;background:rgba(14,16,22,.92);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.1);border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.45);opacity:0;transition:opacity .35s ease,transform .35s ease;font-family:system-ui,-apple-system,'Segoe UI',sans-serif;max-width:min(560px,calc(100vw - 24px))}
+.tws-tour-bar{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + 18px);transform:translateX(-50%) translateY(14px);z-index:${Z_CONTROLS};display:flex;align-items:center;flex-wrap:wrap;justify-content:center;gap:8px;padding:8px 12px;background:rgba(14,16,22,.92);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.1);border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.45);opacity:0;transition:opacity .35s ease,transform .35s ease;font-family:system-ui,-apple-system,'Segoe UI',sans-serif;max-width:min(560px,calc(100vw - 24px))}
.tws-tour-bar.is-in{opacity:1;transform:translateX(-50%) translateY(0)}
.tws-tour-btn{appearance:none;border:none;background:rgba(255,255,255,.06);color:#eef1f6;width:36px;height:36px;border-radius:10px;font-size:15px;line-height:1;cursor:pointer;display:grid;place-items:center;transition:background .18s ease,transform .12s ease}
.tws-tour-btn:hover{background:rgba(122,162,255,.22)}
@@ -149,7 +149,16 @@ function ensureStyles() {
.tws-tour-track{position:relative;height:6px;border-radius:99px;background:rgba(255,255,255,.12);cursor:pointer}
.tws-tour-track:focus-visible{outline:2px solid #7aa2ff;outline-offset:3px}
.tws-tour-track__fill{position:absolute;left:0;top:0;height:100%;border-radius:99px;background:linear-gradient(90deg,#7aa2ff,#9d7bff);transition:width .4s ease}
-@media (max-width:560px){.tws-tour-meta{min-width:96px}.tws-tour-chapter{max-width:120px}}
+@media (max-width:560px){
+ .tws-tour-bar{gap:6px;padding:10px 12px;width:calc(100vw - 20px);max-width:none}
+ /* Progress + chapter take their own full-width row above the buttons. */
+ .tws-tour-meta{order:-1;flex-basis:100%;min-width:0}
+ .tws-tour-chapter{max-width:none}
+ /* Apple HIG: every control is at least a 44×44 tap target. */
+ .tws-tour-btn{width:44px;height:44px;font-size:17px}
+ .tws-tour-btn--speed{width:auto;min-width:48px}
+}
+@media (pointer:coarse){.tws-tour-btn{width:44px;height:44px}.tws-tour-btn--speed{width:auto;min-width:48px}.tws-tour-track{height:10px}}
@media (prefers-reduced-motion:reduce){.tws-tour-bar,.tws-tour-track__fill{transition:opacity .2s ease}}
`;
document.head.appendChild(style);
diff --git a/src/feature-tour/director.js b/src/feature-tour/director.js
index 17fa818d6..f42bb7cb4 100644
--- a/src/feature-tour/director.js
+++ b/src/feature-tour/director.js
@@ -56,7 +56,9 @@ export class TourDirector {
this._seenSections = new Set();
this._beamRaf = 0;
this._beamActive = false;
+ this._soundNudge = null;
this._onKey = this._onKey.bind(this);
+ this._onUnlockGesture = this._onUnlockGesture.bind(this);
}
// ── Entry points ──────────────────────────────────────────────────────────
@@ -145,6 +147,12 @@ export class TourDirector {
this._buildBeam();
this.spotlight = new Spotlight();
this.narrator = new Narrator();
+ // On touch browsers audio is gated behind a gesture (and that permission
+ // dies on every navigation the tour makes). Arm a one-time unlock on the
+ // first tap of this page, and show a "tap for voice" cue if a clip is
+ // blocked before then.
+ this.narrator.onBlocked = () => this._showSoundNudge();
+ this._armAudioUnlock();
this.avatar = new GuideAvatar();
await this.avatar.mount();
this.freeRoam = new FreeRoam(this.avatar);
@@ -237,6 +245,9 @@ export class TourDirector {
// Show caption + speak; resolves when the voice (or timed fallback) ends.
async _present(text, token) {
this.avatar.say(text);
+ // Surface the unlock cue up front (not after a blocked play() round-trip) so
+ // a phone visitor knows one tap brings the voice.
+ if (!this.muted && this.narrator.needsUnlock()) this._showSoundNudge();
await this.narrator.speak(text, { muted: this.muted, voice: this.voice, speed: this.speed });
}
@@ -308,6 +319,56 @@ export class TourDirector {
}
}
+ // ── Mobile audio unlock ─────────────────────────────────────────────────────
+ // iOS/Android gate audio behind a user gesture, and the permission resets on
+ // every page the tour navigates to. We bless the narrator's audio element on
+ // the first tap of each page; until then a clip plays as a timed caption.
+ _armAudioUnlock() {
+ if (!this.narrator?.needsUnlock()) return; // desktop or already unlocked
+ document.addEventListener('pointerdown', this._onUnlockGesture, true);
+ document.addEventListener('touchend', this._onUnlockGesture, true);
+ }
+
+ _disarmAudioUnlock() {
+ document.removeEventListener('pointerdown', this._onUnlockGesture, true);
+ document.removeEventListener('touchend', this._onUnlockGesture, true);
+ }
+
+ async _onUnlockGesture() {
+ const ok = await this.narrator.unlock();
+ if (!ok) return; // that gesture wasn't enough — keep listening for the next
+ this._disarmAudioUnlock();
+ this._hideSoundNudge();
+ // Re-speak the current stop now that we have a voice, so unlocking mid-caption
+ // doesn't cost the visitor this stop's narration.
+ if (this.mounted && !this.paused && !this.offRoute && !this.roam) {
+ const token = ++this._runToken;
+ this._narrateAndMaybeAdvance(token);
+ }
+ }
+
+ _showSoundNudge() {
+ if (this._soundNudge || !this.narrator?.needsUnlock()) return;
+ ensureNudgeStyles();
+ const chip = document.createElement('button');
+ chip.type = 'button';
+ chip.className = 'tws-tour-soundcue';
+ chip.setAttribute('aria-label', "Tap to hear the guide's voice");
+ chip.innerHTML = '<span class="tws-tour-soundcue__icon" aria-hidden="true">🔊</span> Tap for the guide’s voice';
+ chip.addEventListener('click', () => this._onUnlockGesture());
+ document.body.appendChild(chip);
+ requestAnimationFrame(() => chip.classList.add('is-in'));
+ this._soundNudge = chip;
+ }
+
+ _hideSoundNudge() {
+ const chip = this._soundNudge;
+ if (!chip) return;
+ this._soundNudge = null;
+ chip.classList.remove('is-in');
+ setTimeout(() => chip.remove(), 300);
+ }
+
// ── Track / speed / voice ───────────────────────────────────────────────────
_applyTrack(track, { silent = false } = {}) {
if (track === this.track) return;
@@ -507,6 +568,8 @@ export class TourDirector {
clearState();
this._stopBeam();
this._beam?.remove();
+ this._disarmAudioUnlock();
+ this._hideSoundNudge();
document.removeEventListener('keydown', this._onKey);
this.roam = false;
this.freeRoam?.disable();
@@ -605,6 +668,13 @@ export class TourDirector {
_onKey(e) {
if (this.panel?.open) return; // the panel owns the keyboard while it's up
if (isTypingTarget(e.target)) return;
+ // In free roam the visitor steers the guide with WASD / arrows — free-roam
+ // owns those keys; here we only let them toggle roam off or escape it.
+ if (this.roam) {
+ if (e.key === 'r' || e.key === 'R') this._toggleRoam();
+ else if (e.key === 'Escape') this._exitRoam();
+ return;
+ }
if (e.key === ' ' || e.key === 'k') {
e.preventDefault();
this._togglePause();
@@ -646,6 +716,22 @@ function isTypingTarget(el) {
return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || el.isContentEditable;
}
+let _nudgeStyles = false;
+function ensureNudgeStyles() {
+ if (_nudgeStyles) return;
+ _nudgeStyles = true;
+ const style = document.createElement('style');
+ style.textContent = `
+.tws-tour-soundcue{position:fixed;left:50%;top:calc(env(safe-area-inset-top,0px) + 16px);transform:translateX(-50%) translateY(-12px);z-index:2147483450;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:10px 18px;border:1px solid rgba(122,162,255,.45);border-radius:99px;background:rgba(14,16,22,.94);backdrop-filter:blur(10px);color:#eaf0ff;font:700 14px/1 system-ui,-apple-system,'Segoe UI',sans-serif;box-shadow:0 12px 34px rgba(0,0,0,.5);cursor:pointer;opacity:0;transition:opacity .3s ease,transform .3s ease;-webkit-tap-highlight-color:transparent;animation:tws-soundcue-pulse 1.8s ease-in-out infinite}
+.tws-tour-soundcue.is-in{opacity:1;transform:translateX(-50%) translateY(0)}
+.tws-tour-soundcue:active{transform:translateX(-50%) translateY(0) scale(.96)}
+.tws-tour-soundcue__icon{font-size:16px}
+@keyframes tws-soundcue-pulse{0%,100%{box-shadow:0 12px 34px rgba(0,0,0,.5),0 0 0 0 rgba(122,162,255,.45)}50%{box-shadow:0 12px 34px rgba(0,0,0,.5),0 0 0 7px rgba(122,162,255,0)}}
+@media (prefers-reduced-motion:reduce){.tws-tour-soundcue{animation:none;transition:opacity .2s ease}}
+`;
+ document.head.appendChild(style);
+}
+
let _doneStyles = false;
function ensureDoneStyles() {
if (_doneStyles) return;
diff --git a/src/feature-tour/free-roam.js b/src/feature-tour/free-roam.js
index 7e42c69c3..c7277b5ba 100644
--- a/src/feature-tour/free-roam.js
+++ b/src/feature-tour/free-roam.js
@@ -19,6 +19,15 @@ const SCROLL_MAX = 22; // px per frame at the very edge
const RIPPLE_MS = 600;
const Z_FX = 2147483090; // under the spotlight (…100), over the page
+// Keyboard walking — screen-space speeds in px/second, like the Walk playground.
+const WALK_SPEED = 460;
+const RUN_SPEED = 820;
+const MARGIN = 16; // viewport inset the guide stays within (matches GuideAvatar)
+
+function clamp(n, lo, hi) {
+ return Math.min(hi, Math.max(lo, n));
+}
+
// Elements whose clicks belong to the page, never to "walk there".
const INTERACTIVE = 'a,button,input,textarea,select,label,summary,[role="button"],[contenteditable],[contenteditable="true"],canvas,video,iframe,[data-walk-block]';
@@ -26,6 +35,18 @@ export function isInteractiveTarget(el) {
return !!(el && el.closest && el.closest(INTERACTIVE));
}
+// A field the visitor is typing into — never steal its keystrokes for walking.
+function isTypingTarget(el) {
+ if (!el) return false;
+ const tag = el.tagName;
+ return (
+ tag === 'INPUT' ||
+ tag === 'TEXTAREA' ||
+ tag === 'SELECT' ||
+ el.isContentEditable === true
+ );
+}
+
export class FreeRoam {
constructor(avatar) {
this.avatar = avatar;
@@ -35,9 +56,17 @@ export class FreeRoam {
this._ptr = { x: 0, y: 0 };
this._scrollRaf = 0;
this._reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
+ // Keyboard walking state — held directions + the guide's live screen position.
+ this._keys = { up: false, down: false, left: false, right: false, run: false };
+ this._walkRaf = 0;
+ this._walkPos = null;
+ this._walkLast = 0;
this._onDown = this._onDown.bind(this);
this._onMove = this._onMove.bind(this);
this._onUp = this._onUp.bind(this);
+ this._onKeyDown = this._onKeyDown.bind(this);
+ this._onKeyUp = this._onKeyUp.bind(this);
+ this._walkTick = this._walkTick.bind(this);
ensureStyles();
}
@@ -46,6 +75,10 @@ export class FreeRoam {
this.enabled = true;
this.avatar.setInteractive(true);
document.addEventListener('pointerdown', this._onDown, true);
+ // Capture phase so movement keys reach the guide before the director's
+ // stop-navigation handler, which we silence per-key while walking.
+ document.addEventListener('keydown', this._onKeyDown, true);
+ document.addEventListener('keyup', this._onKeyUp, true);
this._hint = makeHint();
}
@@ -53,7 +86,10 @@ export class FreeRoam {
if (!this.enabled) return;
this.enabled = false;
this._endDrag();
+ this._stopWalk();
document.removeEventListener('pointerdown', this._onDown, true);
+ document.removeEventListener('keydown', this._onKeyDown, true);
+ document.removeEventListener('keyup', this._onKeyUp, true);
this.avatar.setInteractive(false);
this.avatar.settle();
this._hint?.remove();
@@ -107,6 +143,118 @@ export class FreeRoam {
this.avatar.settle();
}
+ // ── Keyboard walking ─────────────────────────────────────────────────────────
+ // Drive the guide across the page with WASD / arrow keys (hold Shift to run),
+ // exactly like steering your avatar on the Walk pages. Movement is screen-space
+ // and pins-and-scrolls at the viewport edges, so you can walk the whole document
+ // — not just the current screen. Real page clicks and typing are never touched.
+ _dirFor(key) {
+ switch (key) {
+ case 'ArrowUp':
+ case 'w':
+ case 'W':
+ return 'up';
+ case 'ArrowDown':
+ case 's':
+ case 'S':
+ return 'down';
+ case 'ArrowLeft':
+ case 'a':
+ case 'A':
+ return 'left';
+ case 'ArrowRight':
+ case 'd':
+ case 'D':
+ return 'right';
+ default:
+ return null;
+ }
+ }
+
+ _onKeyDown(e) {
+ if (!this.enabled || this.dragging) return;
+ if (e.ctrlKey || e.metaKey || e.altKey) return;
+ if (isTypingTarget(e.target)) return;
+ const dir = this._dirFor(e.key);
+ if (!dir) return;
+ // Own this key: stop the director from treating arrows as stop-navigation
+ // and the browser from scrolling the page out from under the walk.
+ e.preventDefault();
+ e.stopPropagation();
+ this._keys[dir] = true;
+ this._keys.run = e.shiftKey;
+ this._dismissHint();
+ this._startWalk();
+ }
+
+ _onKeyUp(e) {
+ if (e.key === 'Shift') this._keys.run = false;
+ const dir = this._dirFor(e.key);
+ if (!dir) return;
+ e.stopPropagation();
+ this._keys[dir] = false;
+ if (!this._keys.up && !this._keys.down && !this._keys.left && !this._keys.right) {
+ this._stopWalk();
+ }
+ }
+
+ _startWalk() {
+ if (this._walkRaf) return;
+ const r = this.avatar.host?.getBoundingClientRect();
+ this._walkPos = { x: r?.left ?? this._ptr.x, y: r?.top ?? this._ptr.y };
+ this._walkLast = performance.now();
+ this._walkRaf = requestAnimationFrame(this._walkTick);
+ }
+
+ _stopWalk() {
+ cancelAnimationFrame(this._walkRaf);
+ this._walkRaf = 0;
+ this._walkPos = null;
+ if (this.enabled && !this.dragging) this.avatar.settle();
+ }
+
+ _walkTick(now) {
+ if (!this.enabled || this.dragging) {
+ this._walkRaf = 0;
+ return;
+ }
+ const dt = Math.min((now - this._walkLast) / 1000, 0.05);
+ this._walkLast = now;
+
+ let ix = (this._keys.right ? 1 : 0) - (this._keys.left ? 1 : 0);
+ let iy = (this._keys.down ? 1 : 0) - (this._keys.up ? 1 : 0);
+ if (ix === 0 && iy === 0) {
+ this._stopWalk();
+ return;
+ }
+ if (ix !== 0 && iy !== 0) {
+ const inv = 1 / Math.SQRT2;
+ ix *= inv;
+ iy *= inv;
+ }
+ const speed = this._keys.run ? RUN_SPEED : WALK_SPEED;
+ const s = this.avatar.size();
+ const maxX = window.innerWidth - s.w - MARGIN;
+ const maxY = window.innerHeight - s.h - MARGIN;
+
+ this._walkPos.x = clamp(this._walkPos.x + ix * speed * dt, MARGIN, maxX);
+
+ // Vertical: walk within the viewport; at the top/bottom edge, pin the guide
+ // and scroll the document instead so the walk continues down the whole page.
+ let rawY = this._walkPos.y + iy * speed * dt;
+ if (rawY < MARGIN && iy < 0) {
+ window.scrollBy(0, rawY - MARGIN);
+ rawY = MARGIN;
+ } else if (rawY > maxY && iy > 0) {
+ window.scrollBy(0, rawY - maxY);
+ rawY = maxY;
+ }
+ this._walkPos.y = clamp(rawY, MARGIN, maxY);
+
+ this.avatar.place({ x: this._walkPos.x, y: this._walkPos.y }, { running: this._keys.run });
+ this._walkRaf = requestAnimationFrame(this._walkTick);
+ }
+
// While dragging near the top/bottom edge, scroll the page and keep the guide
// pinned under the pointer so it appears to walk the document up/down.
_startScrollLoop() {
@@ -151,7 +299,7 @@ function makeHint() {
h.className = 'tws-roam-hint';
h.setAttribute('role', 'status');
h.innerHTML =
- '<span class="tws-roam-hint__dot"></span>Free roam — click anywhere to walk me there, or drag me around. Press ▶ to rejoin the tour.';
+ '<span class="tws-roam-hint__dot"></span>Free roam — walk me with WASD / arrow keys (Shift to run), click anywhere to send me there, or drag me. Press ▶ to rejoin the tour.';
document.body.appendChild(h);
requestAnimationFrame(() => h.classList.add('is-in'));
return h;
diff --git a/src/feature-tour/guide-avatar.js b/src/feature-tour/guide-avatar.js
index 1f5ea335d..68cbf9689 100644
--- a/src/feature-tour/guide-avatar.js
+++ b/src/feature-tour/guide-avatar.js
@@ -292,16 +292,17 @@ export class GuideAvatar {
return { w: r?.width || CANVAS_W, h: r?.height || CANVAS_H };
}
- // Instant placement (drag / edge-scroll follow): clamp to the viewport, face
- // the direction of travel, run the walk cycle, and auto-settle to idle shortly
- // after movement stops so a parked guide isn't stuck mid-stride.
- place(pos) {
+ // Instant placement (drag / keyboard / edge-scroll follow): clamp to the
+ // viewport, face the direction of travel, run the walk (or run) cycle, and
+ // auto-settle to idle shortly after movement stops so a parked guide isn't
+ // stuck mid-stride. `running` switches to the run gait for keyboard sprinting.
+ place(pos, { running = false } = {}) {
const s = this.size();
const x = clamp(pos.x, MARGIN, window.innerWidth - s.w - MARGIN);
const y = clamp(pos.y, MARGIN, window.innerHeight - s.h - MARGIN);
const dx = x - this._pos.x;
if (Math.abs(dx) > 1) this._targetYaw = clamp((dx / window.innerWidth) * 2, -0.7, 0.7);
- this.controller?.setState('walk');
+ this.controller?.setState(running ? 'run' : 'walk');
this._walking = true;
clearTimeout(this._settleTimer);
this._settleTimer = setTimeout(() => this.settle(), 180);
diff --git a/src/feature-tour/narrator.js b/src/feature-tour/narrator.js
index 64fb6eaa7..6debe03b6 100644
--- a/src/feature-tour/narrator.js
+++ b/src/feature-tour/narrator.js
@@ -5,16 +5,39 @@
// so captions still pace correctly. Every call is cancelable (skip / pause /
// exit) via a monotonic token — a stale fetch or audio that returns after a
// cancel is ignored.
+//
+// Mobile / iOS audio:
+// Safari (and most touch browsers) refuse audio.play() unless it happens
+// inside a user gesture, and that permission does NOT survive a navigation —
+// which the cross-page tour does constantly. So instead of `new Audio()` per
+// clip (each one a fresh, un-blessed element that iOS blocks), we keep ONE
+// persistent <audio> element and "bless" it once per page via unlock(): a
+// single silent play() driven from a real tap. Every later clip reuses that
+// blessed element, so it plays without a gesture. If a clip is blocked anyway
+// (page not yet unlocked), speak() reports it via onBlocked and paces the
+// caption on a timer instead of advancing instantly — the director re-narrates
+// the stop the moment unlock() succeeds, so nothing is missed.
const WPM = 150;
+// A tiny silent MP3. Playing it during a tap blesses the audio element for all
+// later programmatic play() calls on the same page (the iOS autoplay unlock).
+const SILENT_MP3 =
+ 'data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//sQxAUACAAGkABFCAAggAAAAaAAAAAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';
+
export class Narrator {
constructor() {
this.audio = null;
+ this.onBlocked = null; // director hook: fired when a clip is blocked by autoplay policy
this._token = 0;
this._sleepTimer = 0;
this._sleepResolve = null;
this._finishCurrent = null;
+ this._el = null; // the single, persistent (unlockable) audio element
+ this._unlocked = false;
+ this._blocked = false;
+ this._coarse =
+ typeof matchMedia === 'function' ? matchMedia('(pointer: coarse)').matches : false;
}
estimateMs(text, speed = 1) {
@@ -23,6 +46,56 @@ export class Narrator {
return base / clampSpeed(speed);
}
+ // The one audio element every clip plays through. Created lazily so SSR/import
+ // stays side-effect free; reused forever so the iOS unlock survives between
+ // clips on the same page.
+ _element() {
+ if (this._el) return this._el;
+ const el = new Audio();
+ el.preload = 'auto';
+ el.setAttribute('playsinline', ''); // never go fullscreen on iOS
+ this._el = el;
+ return el;
+ }
+
+ // True when this device gates audio behind a gesture and we haven't been
+ // blessed on this page yet — the director uses it to show a "tap for voice"
+ // affordance instead of letting the first clip silently fail.
+ needsUnlock() {
+ return this._coarse && !this._unlocked;
+ }
+
+ get blocked() {
+ return this._blocked;
+ }
+
+ // Bless the audio element from inside a user gesture by playing a silent clip.
+ // Idempotent and safe to call on every tap — once unlocked it short-circuits.
+ // Returns true if audio is now usable.
+ async unlock() {
+ if (this._unlocked) return true;
+ const el = this._element();
+ const wasSrc = el.src;
+ try {
+ el.src = SILENT_MP3;
+ el.playbackRate = 1;
+ await el.play();
+ el.pause();
+ try {
+ el.currentTime = 0;
+ } catch {
+ /* some engines reject seeking a data URI — harmless */
+ }
+ this._unlocked = true;
+ this._blocked = false;
+ return true;
+ } catch {
+ // Restore whatever was queued; the gesture wasn't enough (rare).
+ if (wasSrc && wasSrc !== SILENT_MP3) el.src = wasSrc;
+ return false;
+ }
+ }
+
// Speak `text`; resolves when playback (or the timed fallback) completes.
async speak(text, { muted = false, voice = 'nova', speed = 1 } = {}) {
this.cancel();
@@ -47,24 +120,51 @@ export class Narrator {
const blob = await res.blob();
if (token !== this._token) return;
url = URL.createObjectURL(blob);
- const audio = new Audio(url);
+ const audio = this._element();
+ audio.src = url;
// The server renders the OpenAI lane at `speed`, but the free Magpie
// lane ignores it — so also nudge playbackRate as a client-side backstop
// that works on whichever lane answered. (1× leaves audio untouched.)
audio.playbackRate = rate;
this.audio = audio;
- await new Promise((resolve) => {
+ const blocked = await new Promise((resolve) => {
let done = false;
- const finish = () => {
+ const finish = (wasBlocked) => {
if (done) return;
done = true;
- resolve();
+ audio.removeEventListener('ended', onEnd);
+ audio.removeEventListener('error', onEnd);
+ resolve(!!wasBlocked);
};
- this._finishCurrent = finish;
- audio.addEventListener('ended', finish);
- audio.addEventListener('error', finish);
- audio.play().catch(finish);
+ const onEnd = () => finish(false);
+ this._finishCurrent = () => finish(false);
+ audio.addEventListener('ended', onEnd);
+ audio.addEventListener('error', onEnd);
+ audio.play().then(
+ () => {
+ this._blocked = false;
+ },
+ (err) => {
+ // Autoplay policy (no gesture on this page yet). Surface it so the
+ // director can prompt for a tap, and pace the caption on a timer
+ // instead of resolving instantly (which would race-advance the tour).
+ if (err && err.name === 'NotAllowedError') {
+ this._blocked = true;
+ try {
+ this.onBlocked?.();
+ } catch {
+ /* hook must never break narration */
+ }
+ finish(true);
+ } else {
+ finish(false);
+ }
+ },
+ );
});
+ if (blocked && token === this._token) {
+ await this._sleep(this.estimateMs(clean, rate), token);
+ }
} catch {
if (token !== this._token) return;
// TTS unavailable — keep the caption on screen for its reading time.
@@ -87,7 +187,8 @@ export class Narrator {
});
}
- // Stop any in-flight speech/sleep and invalidate pending callbacks.
+ // Stop any in-flight speech/sleep and invalidate pending callbacks. Keeps the
+ // persistent (blessed) element alive so the iOS unlock survives the next clip.
cancel() {
this._token++;
clearTimeout(this._sleepTimer);
@@ -97,7 +198,7 @@ export class Narrator {
this._sleepResolve = null;
}
try {
- this.audio?.pause();
+ this._el?.pause();
} catch {
/* ignore */
}
@@ -108,6 +209,17 @@ export class Narrator {
dispose() {
this.cancel();
+ try {
+ if (this._el) {
+ this._el.pause();
+ this._el.removeAttribute('src');
+ this._el.load();
+ }
+ } catch {
+ /* ignore */
+ }
+ this._el = null;
+ this._unlocked = false;
}
}
diff --git a/src/forge-showcase.js b/src/forge-showcase.js
index 6bca8c964..2d8f12d5f 100644
--- a/src/forge-showcase.js
+++ b/src/forge-showcase.js
@@ -58,8 +58,13 @@ async function captureFromGlb(card, glbUrl) {
if (!window.customElements?.get('model-viewer')) return null;
return new Promise((resolve) => {
const viewer = document.createElement('model-viewer');
+ // Render at a real resolution off-screen — model-viewer sizes its WebGL
+ // canvas to the element box, so a 1px element would capture a 1px frame
+ // (a solid block once stretched over the 200px thumb). 384px gives a
+ // crisp, retina-ish thumbnail. position:fixed keeps it out of layout;
+ // opacity:0 + negative z-index keep it invisible while it still paints.
viewer.style.cssText =
- 'position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;overflow:hidden;';
+ 'position:fixed;left:0;top:0;width:384px;height:384px;opacity:0;pointer-events:none;z-index:-1;';
viewer.setAttribute('src', glbUrl);
viewer.setAttribute('shadow-intensity', '0');
viewer.setAttribute('exposure', '0.9');
@@ -84,7 +89,11 @@ async function captureFromGlb(card, glbUrl) {
// Brief settle so the mesh textures are uploaded to GPU.
await new Promise((r) => setTimeout(r, 800));
const url = viewer.toDataURL?.('image/webp') ?? null;
- finish(url && url.length > 100 ? url : null);
+ // A real 384px model render encodes to several KB; a blank or
+ // transparent frame compresses to a few hundred bytes. Reject
+ // the near-empty case so the readable gradient+prompt fallback
+ // wins instead of an invisible card.
+ finish(url && url.length > 1024 ? url : null);
} catch {
finish(null);
}
diff --git a/tests/x402-checkout-prepare.test.js b/tests/x402-checkout-prepare.test.js
index 9afad6acd..92ad9b6e1 100644
--- a/tests/x402-checkout-prepare.test.js
+++ b/tests/x402-checkout-prepare.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { PublicKey } from '@solana/web3.js';
-import { acceptSchema, prepareSchema, ataExists } from '../api/x402-checkout.js';
+import { acceptSchema, prepareSchema, ataExists, getRecentBlockhash } from '../api/x402-checkout.js';
// The 402 challenge's `accept` is built from operator env (X402_PAY_TO_SOLANA /
// X402_FEE_PAYER_SOLANA). Those values are pasted into dashboards and routinely
@@ -90,3 +90,47 @@ describe('x402-checkout ataExists — fail-open on a flaky RPC', () => {
await expect(ataExists(conn, ata)).resolves.toBe(false);
});
});
+
+describe('x402-checkout getRecentBlockhash — fail-open on a total RPC outage', () => {
+ const BH = 'GfVcyD4kkTrj4bKc7Wd9G4nf2k1zk8mF8YQ4i6N2bQrs';
+ const ok = (blockhash) => ({ getLatestBlockhash: async () => ({ blockhash }) });
+ const dead = {
+ getLatestBlockhash: async () => {
+ throw new Error('all solana rpc endpoints failed');
+ },
+ };
+
+ it('serves a fresh blockhash and caches it for reuse', async () => {
+ const rpc = 'https://rpc.test/fresh';
+ const bh = await getRecentBlockhash(ok(BH), rpc, { now: () => 1000 });
+ expect(bh).toBe(BH);
+ // Within the hot TTL, the cached value is returned without touching the RPC.
+ const cached = await getRecentBlockhash(dead, rpc, { now: () => 1000 + 5000 });
+ expect(cached).toBe(BH);
+ });
+
+ it('falls back to a slightly-stale cached blockhash when every RPC endpoint fails — the Authorize-step 500 this guards', async () => {
+ const rpc = 'https://rpc.test/stale-fallback';
+ await getRecentBlockhash(ok(BH), rpc, { now: () => 1000 }); // warm the cache
+ // 20s later: past the 8s freshness TTL but inside the ~60s validity window,
+ // so a dead failover chain must NOT 500 — it serves the cached blockhash.
+ const bh = await getRecentBlockhash(dead, rpc, { now: () => 1000 + 20_000 });
+ expect(bh).toBe(BH);
+ });
+
+ it('propagates the error only when no usable cached blockhash remains', async () => {
+ const rpc = 'https://rpc.test/too-stale';
+ await getRecentBlockhash(ok(BH), rpc, { now: () => 1000 });
+ // 90s later the cached blockhash is past the cluster's validity window —
+ // serving it would just fail to confirm, so we surface the RPC error instead.
+ await expect(
+ getRecentBlockhash(dead, rpc, { now: () => 1000 + 90_000 }),
+ ).rejects.toThrow(/all solana rpc endpoints failed/);
+ });
+
+ it('propagates the error when the cache is cold (first request hits the outage)', async () => {
+ await expect(
+ getRecentBlockhash(dead, 'https://rpc.test/cold', { now: () => 1000 }),
+ ).rejects.toThrow(/all solana rpc endpoints failed/);
+ });
+});
diff --git a/tour-sdk/package.json b/tour-sdk/package.json
index 4a666eab0..e4352784b 100644
--- a/tour-sdk/package.json
+++ b/tour-sdk/package.json
@@ -33,7 +33,7 @@
"module": "./dist/index.mjs",
"types": "./types/index.d.ts",
"bin": {
- "tour-build-curriculum": "./bin/tour-build-curriculum.mjs"
+ "tour-build-curriculum": "bin/tour-build-curriculum.mjs"
},
"exports": {
".": {
@@ -68,6 +68,9 @@
"@three-ws/walk": ">=0.1.0",
"three": ">=0.150.0"
},
+ "devDependencies": {
+ "esbuild": "^0.27.7"
+ },
"engines": {
"node": ">=18"
},