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
fix(pwa): let the browser fetch hashed chunks itself so modulepreload stops being discarded
ni3afd9e343546be
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6cc83226b..4efd27f6d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -25,6 +25,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Paying the Club cover charge in $THREE works now**: The Club door quotes its cover in USDC or in $THREE, but every attempt to pay in $THREE failed at the last step, and the payment window wrongly said you had cancelled in your wallet when you had just approved. The cause was on our side: $THREE is issued under Solana's newer token standard (Token-2022) and our payment rail only knew how to build and check transfers for the older one, so a $THREE payment could never be verified. The rail now reads which standard a token uses and handles both, in the step that builds your transaction and in the step that verifies it. Nothing was ever charged on a failed attempt. The payment window also now shows the real reason when a payment is refused instead of blaming a cancel. (`/club`) `[fix]`- **Put any token's 3D scene on your own site, keyed by the pair address you already have**: Token in 3D is now embeddable anywhere with a single iframe, and it accepts two identifiers instead of one. Chart terminals, launchpads and wallets name a market by its pair (pool) address, while three.ws keys tokens by mint, so /coin3d now takes ?pair= as well as ?mint= and resolves the rest itself through a new public endpoint, /api/coin/pair. Add ?embed=1 and the scene drops the chrome your own page owns, keeps one attribution link, and sends its links to a new tab instead of navigating your frame. Free, keyless, and no account: paste the iframe and it renders the live medallion, holder galaxy, graduation ring and real trade tape for that market. (`/docs/coin3d-embed`) `[feature, sdk]`- **Queued posts can quote an earlier post**: A post in the @trythreews content queue can now name an earlier post to quote, so a follow-up can add the detail the original left out instead of repeating it. The first use quotes the $THREE token MCP announcement with the numbers behind the MCP Tool Catalog: 321 tools across 42 servers, 293 of them free, and 215 whose read-only label is checked against the source on every build. (`/mcp-tools`) `[improvement]`+- **Repeat visits stop downloading the app's code twice**: Every page tells your browser which code it is about to need so it can start fetching early. On a return visit that head start was being thrown away: our offline helper answered those same requests a second time, Chrome refused to match the two, and each file was requested twice while the developer console filled with a warning per file, well over a hundred on a heavy page like the Club. The offline helper now leaves that code to the browser's own cache, which already keeps it for a year, and clears out the duplicate copy it had stored on your device. Return visits load with one request per file and a quiet console. `[fix, improvement]`- **The @trythreews account now posts three times a day, every day**: The reviewed content queue that runs the @trythreews account moved to three posts a day, eight hours apart, on every day of the week including weekends. It used to hold its flagship slot for weekdays and pack all three posts into an eight-hour afternoon window, which meant a weekend could only ever carry two. Three posts went out under the new cadence today: the $THREE token MCP server, Forge Max, and the free object library. The Forge Max post also gained a check that proves the high-quality tier is a real, gated lane before it can be published, rather than only proving its page loads. (`/changelog`) `[improvement]`- **The $THREE tier cards no longer list unbuilt perks next to real ones**: Each tier on the holder page carries two kinds of line: things the hold turns on today, and things that are registered but not built yet. Further down the same card the unbuilt ones were already flagged Planned, but higher up they also appeared as plain bullets with no flag, so Silver read as though private worlds and priority routing were included and Gold as though branded environments were. They are not. The two lists are now kept apart at the source, the planned lines carry the Planned flag wherever they appear, and the pricing API publishes them as a separate field so anything reading it automatically cannot mistake a roadmap line for a benefit. Nothing about what you actually get has changed. A test now fails the build if an unbuilt feature finds its way back into the delivered list. (`/three`) `[fix, improvement]`- **The flagship post slot now gets flagship material**: The @trythreews account publishes into three slots a day, one owned by each tier: proof of work at 04:00 UTC, a shipped feature at 12:00, a flagship at 20:00. The machine that drafts announcements from the backlog was not filling them that way. It never recorded a tier on anything it wrote, so every draft it produced was treated as a mid-tier feature and the 20:00 slot was left to whatever happened to be ready. It also dated the surfaces that need owner sign-off on their imagery into the best slot of every day, which pushed everything it could publish on its own weeks into the future. Announcements are now planned into the slot their own tier owns, the ones awaiting sign-off are listed separately instead of blocking the calendar, and six new announcements are queued for review. (`/changelog`) `[improvement]`diff --git a/data/changelog.json b/data/changelog.jsonindex 942dc8c87..61779ce34 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$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-09-20",+ "title": "Repeat visits stop downloading the app's code twice",+ "summary": "Every page tells your browser which code it is about to need so it can start fetching early. On a return visit that head start was being thrown away: our offline helper answered those same requests a second time, Chrome refused to match the two, and each file was requested twice while the developer console filled with a warning per file, well over a hundred on a heavy page like the Club. The offline helper now leaves that code to the browser's own cache, which already keeps it for a year, and clears out the duplicate copy it had stored on your device. Return visits load with one request per file and a quiet console.",+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-09-20","title": "Put any token's 3D scene on your own site, keyed by the pair address you already have",diff --git a/public/cache-cleanup-sw.js b/public/cache-cleanup-sw.jsnew file mode 100644index 000000000..8a7e56094--- /dev/null+++ b/public/cache-cleanup-sw.js@@ -0,0 +1,21 @@+//+// Retired-cache cleanup, imported into the VitePWA-generated service worker via+// `workbox.importScripts` (see vite.config.js). Plain classic worker script (no+// imports) so importScripts can pull it in, same as push-sw.js.+//+// Workbox's cleanupOutdatedCaches only removes old PRECACHES. A runtime cache+// whose route is deleted from the config is never touched again: it just sits in+// the visitor's Cache Storage, counted against their quota, forever. Name a+// cache here in the same change that stops writing to it.+//+// app-assets hashed /assets/ chunks. The route was removed because the SW+// answering those fetches made Chrome discard every+// <link rel=modulepreload> for them; the HTTP cache already+// serves them (immutable, max-age=1y).+//++const RETIRED_CACHES = ['app-assets'];++self.addEventListener('activate', (event) => {+ event.waitUntil(Promise.all(RETIRED_CACHES.map((name) => caches.delete(name))));+});diff --git a/public/changelog-recent.json b/public/changelog-recent.jsonindex 747e63595..5c9dec30d 100644--- a/public/changelog-recent.json+++ b/public/changelog-recent.json@@ -1,11 +1,11 @@{- "generated_at": "2026-09-20T20:16:26.999Z",+ "generated_at": "2026-09-20T20:22:32.748Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},- "total": 3734,+ "total": 3735,"complete": false,"full_feed": "/changelog.json","entries": [@@ -209,6 +209,17 @@"improvement"]},+ {+ "date": "2026-09-20",+ "type": "update",+ "title": "Repeat visits stop downloading the app's code twice",+ "summary": "Every page tells your browser which code it is about to need so it can start fetching early. On a return visit that head start was being thrown away: our offline helper answered those same requests a second time, Chrome refused to match the two, and each file was requested twice while the developer console filled with a warning per file, well over a hundred on a heavy page like the Club. The offline helper now leaves that code to the browser's own cache, which already keeps it for a year, and clears out the duplicate copy it had stored on your device. Return visits load with one request per file and a quiet console.",+ "link": null,+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-09-20","type": "update",@@ -1608,16 +1619,6 @@"fix","improvement"]- },- {- "date": "2026-09-09",- "type": "update",- "title": "The trading arena now says who just passed whom",- "summary": "The live leaderboard on the arena told you who was ahead and nothing about what had changed, so a place changing hands, which happens several times a week on its own, went unnoticed. A grudge-match strip now sits under the standings: each trader is paired with the one directly above them, labelled as an overtake, a debut or a standing chase, with the profit or loss both sides settled in the last 24 hours as the reason. It is worked out from the same closed on-chain trades the board is ranked from, by rebuilding what the board actually said 24 hours ago out of the trade timestamps rather than trusting a stored snapshot, so the matchups reach back over history the platform already has and can never disagree with the leaderboard or with either trader's profile. Every line is written from those numbers: it will not call a trader behind when they in fact hold more SOL and rank lower on consistency, and it will not say someone booked nothing when they simply did not trade. Each matchup links to the leader's verified record and to a ghost-copy of them with no money at risk. Also available to agents and scripts at /api/sniper/rivalries.",- "link": "/play/arena",- "tags": [- "feature"- ]}]}diff --git a/public/changelog.json b/public/changelog.jsonindex fe36f8abe..509fac320 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-09-20T20:16:26.856Z",+ "generated_at": "2026-09-20T20:22:32.697Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -206,6 +206,17 @@"improvement"]},+ {+ "date": "2026-09-20",+ "type": "update",+ "title": "Repeat visits stop downloading the app's code twice",+ "summary": "Every page tells your browser which code it is about to need so it can start fetching early. On a return visit that head start was being thrown away: our offline helper answered those same requests a second time, Chrome refused to match the two, and each file was requested twice while the developer console filled with a warning per file, well over a hundred on a heavy page like the Club. The offline helper now leaves that code to the browser's own cache, which already keeps it for a year, and clears out the duplicate copy it had stored on your device. Return visits load with one request per file and a quiet console.",+ "link": null,+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-09-20","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 1ceb54ccf..b480f8505 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -158,6 +158,14 @@<category>improvement</category><description>A post in the @trythreews content queue can now name an earlier post to quote, so a follow-up can add the detail the original left out instead of repeating it. The first use quotes the $THREE token MCP announcement with the numbers behind the MCP Tool Catalog: 321 tools across 42 servers, 293 of them free, and 215 whose read-only label is checked against the source on every build.</description></item>+ <item>+ <title>Repeat visits stop downloading the app's code twice</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-09-20:Repeat visits stop downloading the app's code twice</guid>+ <pubDate>Sun, 20 Sep 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Every page tells your browser which code it is about to need so it can start fetching early. On a return visit that head start was being thrown away: our offline helper answered those same requests a second time, Chrome refused to match the two, and each file was requested twice while the developer console filled with a warning per file, well over a hundred on a heavy page like the Club. The offline helper now leaves that code to the browser's own cache, which already keeps it for a year, and clears out the duplicate copy it had stored on your device. Return visits load with one request per file and a quiet console.</description>+ </item><item><title>The @trythreews account now posts three times a day, every day</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 0558d0f21..86c2978c9 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-09-20T20:16:26.791Z",+ "generated_at": "2026-09-20T20:22:32.671Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/cache-cleanup-sw.test.js b/tests/cache-cleanup-sw.test.jsnew file mode 100644index 000000000..c181ff246--- /dev/null+++ b/tests/cache-cleanup-sw.test.js@@ -0,0 +1,57 @@+// public/cache-cleanup-sw.js evaluated as the service worker would run it, plus+// the two build-config facts it exists to back up.+//+// Hashed /assets/ chunks must never be answered by the service worker: Chrome+// discards a <link rel=modulepreload> for a script whose fetch a worker answers+// ("cross-world service worker resource mismatch"), so every preloaded chunk was+// requested twice and logged a warning on every repeat visit. The route is gone;+// these tests keep it gone and keep the cache it left behind getting deleted.++import { describe, it, expect, vi } from 'vitest';+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';++const SW_SOURCE = readFileSync(resolve(process.cwd(), 'public/cache-cleanup-sw.js'), 'utf8');+const VITE_CONFIG = readFileSync(resolve(process.cwd(), 'vite.config.js'), 'utf8');++function runWorker(existing) {+ const names = new Set(existing);+ const listeners = new Map();+ const scope = {+ addEventListener: (type, fn) => listeners.set(type, fn),+ };+ const caches = {+ delete: vi.fn(async (name) => names.delete(name)),+ };+ new Function('self', 'caches', SW_SOURCE)(scope, caches);+ return { names, listeners, caches };+}++describe('cache-cleanup-sw', () => {+ it('deletes the retired app-assets cache on activate and leaves live caches alone', async () => {+ const { names, listeners } = runWorker(['app-assets', 'app-shell-assets', 'threews-glance']);+ let settled;+ listeners.get('activate')({ waitUntil: (p) => { settled = p; } });+ await settled;+ expect([...names].sort()).toEqual(['app-shell-assets', 'threews-glance']);+ });++ it('does not fail activation when the cache was never there', async () => {+ const { listeners } = runWorker([]);+ let settled;+ listeners.get('activate')({ waitUntil: (p) => { settled = p; } });+ await expect(settled).resolves.toBeDefined();+ });+});++describe('service worker build config', () => {+ it('imports the cleanup script into the generated worker', () => {+ expect(VITE_CONFIG).toMatch(/importScripts:\s*\[[^\]]*'\/cache-cleanup-sw\.js'/);+ });++ it('routes no runtime cache at hashed /assets/ chunks', () => {+ expect(VITE_CONFIG).not.toContain("cacheName: 'app-assets'");+ // The generic script/style rule must exclude /assets/ or it would catch them.+ expect(VITE_CONFIG).toMatch(/!url\.pathname\.startsWith\('\/assets\/'\)\s*&&\s*\(request\.destination === 'script'/);+ });+});diff --git a/vite.config.js b/vite.config.jsindex cc0bfe296..9bd9f722a 100644--- a/vite.config.js+++ b/vite.config.js@@ -3691,7 +3691,7 @@ const appConfig = {// Pull in the Web Push handlers (push + notificationclick). Kept in// public/push-sw.js as a classic script so the generated Workbox SW// importScripts it without switching to an injectManifest build.- importScripts: ['/push-sw.js', '/share-target-sw.js', '/glance-sw.js'],+ importScripts: ['/push-sw.js', '/share-target-sw.js', '/glance-sw.js', '/cache-cleanup-sw.js'],// MPA: every route is a separate HTML file served by the server.// No navigation fallback — uncached navigations go to the network.// HTML is intentionally excluded from globPatterns so it is never@@ -3747,29 +3747,22 @@ const appConfig = {urlPattern: /^https?:\/\/[^/]+\/api\/widgets\//i,handler: 'NetworkOnly',},- // Content-hashed build chunks under /assets/ (e.g.- // assets/marketplace-Cn45GLvE.js, assets/index-<hash>.css).- // These are immutable: the filename changes whenever the bytes- // change, so the cached copy can NEVER be stale for a URL that- // still resolves. StaleWhileRevalidate is correct and fast here —- // serve instantly, refresh in the background; a 404 during a- // deploy rollover is a non-fatal background miss the page's own- // dynamic import handles, never a broken SW install.- {- urlPattern: ({ url, request, sameOrigin }) =>- sameOrigin &&- url.pathname.startsWith('/assets/') &&- (request.destination === 'script' || request.destination === 'style'),- handler: 'StaleWhileRevalidate',- options: {- cacheName: 'app-assets',- expiration: {- maxEntries: 200,- maxAgeSeconds: 60 * 60 * 24 * 30,- },- cacheableResponse: { statuses: [200] },- },- },+ // Content-hashed build chunks under /assets/ are deliberately NOT+ // routed: no rule here may match them, so the SW never calls+ // respondWith and the browser fetches them as if no SW existed.+ // They used to sit behind a StaleWhileRevalidate 'app-assets'+ // cache, which bought nothing and cost a lot. Nothing, because+ // the server already sends them `immutable, max-age=1y` (the HTTP+ // cache serves a repeat visit instantly) and navigations are+ // NetworkOnly, so cached chunks can never boot a page offline.+ // A lot, because Chrome refuses to reuse a <link rel=modulepreload>+ // for a script whose fetch the SW answers ("found, but is not used+ // because it is a cross-world service worker resource mismatch").+ // Every preloaded chunk was therefore requested twice on every+ // repeat visit, and the console filled with one warning per chunk,+ // well over a hundred on a heavy page like /club. Measured against+ // production on /pricing: 0, 4, then 10 warnings across three+ // visits with the route, 0, 0, 0 without it.// Stable-named same-origin scripts & styles served verbatim from// public/ (/style.css, /marketplace.css, /nav.css, /mobile.css,// /nav.js, /footer.js, ...). Unlike the hashed chunks above these@@ -3782,11 +3775,12 @@ const appConfig = {// FOUC users hit "again" after every deploy). NetworkFirst pins// the live deploy's CSS/JS to its HTML — always fetch fresh, fall// back to cache only when offline. A short network timeout keeps- // repeat visits fast. Placed after the /assets/ rule so hashed- // chunks keep their immutable SWR fast path.+ // repeat visits fast. /assets/ is excluded so hashed chunks stay+ // unrouted (see above).{- urlPattern: ({ request, sameOrigin }) =>+ urlPattern: ({ url, request, sameOrigin }) =>sameOrigin &&+ !url.pathname.startsWith('/assets/') &&(request.destination === 'script' || request.destination === 'style'),handler: 'NetworkFirst',options: {