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(news): stop cutting archived story summaries mid-emoji, which broke their search listing
nirholasbdaee05aa141
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 584dbc98a..88fe2b850 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **My Creations** (`/mine`): Everything you have made on three.ws in one newest-first grid: the agents you built, the 3D avatars you saved, and every model you forged, including models forged in this browser before you had an account. Open, edit, or copy a link to any of them in one click.- **3D generation and the whole site keep working when our asset storage does not**: Early on 2026-09-07 our object storage stopped accepting the platform's credential, and because every generation parks its reference image there, 3D generation stopped on the website and in ChatGPT at the same time, agent registration could not store its manifest, and images loaded through our CDN stopped resolving. Three things changed so that a storage fault is never again a blank page. Avatars, thumbnails and models now fall back to the bucket's public domain automatically, so the site keeps rendering. When generation genuinely cannot run you get a plain message saying storage is recovering and to try again shortly, instead of a raw error from the storage vendor. And our own health checks now watch the storage credential directly and treat a silent forge as an outage rather than a quiet hour, so we hear about this class of failure before you do. `[fix, infra]`- **A payment we cannot read now comes back with the price list, not a bare error**: When an agent pays one of our x402 endpoints and the payment header arrives mangled (truncated in transit, double-encoded, wrapped by a proxy), the answer used to be a plain 400 error with no prices in it, so the agent had nothing left to work from and no way to retry. Every rejected payment now returns the ordinary 402 with the full list of accepted rails, tokens and amounts attached, exactly as it does when a payment is simply missing. That is what the x402 spec and the OKX seller SDK both do, and it means a paying agent can always read the quote again and try once more. Only a real server fault answers without a quote. (`/docs/okx-marketplace`) `[fix, improvement]`+- **Archived news stories with emoji in their summary keep their search listing**: Google Search Console flagged an archived story page for unparsable structured data. The cause: the archive trims a publisher summary to a fixed length before serving it, and the cut landed in the middle of an emoji, leaving half a character in the page data that search engines read. Trimming is now character-aware, so it never splits an emoji, a flag, or an accented letter, and the page data is checked for half characters before it is written. Around one archived story in seven thousand carried the flaw; all of them serve a valid listing now. The same fix covers the story summaries shown in link previews and the shared page descriptions across the site. (`/markets/news`) `[fix, infra]`- **Blender tools now open three.ws avatars, which Blender alone cannot**: Most three.ws avatars are delivered in a compressed form that Blender flatly cannot read: point stock Blender at one and it refuses the file. That made the new Blender tools useless on exactly the models this platform produces. Compressed models are now unpacked automatically before Blender opens them, for both of the common compression schemes, with nothing extra to install and your original file left untouched. The answer tells you when it happened. `[fix, sdk]`- **Keyboard focus is visible again on every /play HUD button, and the AGI filter counts clear AA contrast**: Six buttons on the /play world HUD (friends, jobs, avatar, wardrobe, shop and buy) had lost their keyboard focus ring: the page never defined the shared focus-ring colour those buttons outline with, so the browser dropped the outline entirely and a keyboard player could not see where they were. The ring is back. On /agi, the count inside a selected filter chip measured 4.37:1 against its background at 11px, just under the 4.5:1 AA floor; it now uses the primary ink and clears it comfortably. (`/play`) `[fix, improvement]`- **My Creations: one button that takes you back to everything you made**: A creator told us the making part was intuitive and the finding part was not: they built an agent, closed the tab, and had no obvious way back to it. There is now a My creations button in the header, and it opens a single page holding everything you have made, newest first: your agents, the 3D avatars saved to your account, and every model you forged, with Open, Edit and Copy link on each one. Signed out it still finds the models forged in this browser, so work made before you had an account is not lost. Filter by type, search by name or prompt, and hover any card to spin it in 3D. The create wizard and the Forge now point here too, so you are told where your work lives at the moment you make it. (`/mine`) `[feature, improvement]`@@ -17,7 +18,10 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Shared avatar and agent links now show a real page to Google, not a loading spinner**: Search engines were shown a different version of every /avatars/... and /agents/... page than people were, and that version had nothing on it: the name and description were hidden in a fallback block that a crawler removes before reading, the rest was a spinner, and the last line of the page sent the crawler straight back to the URL it was already on. Tens of thousands of avatar and agent pages therefore looked identical to Google and were filed as duplicates instead of being listed. Crawlers now get the same content a visitor sees: the name, the description, the rendered card, the creator, the tags, the skills, the on-chain identity, and links onward into the gallery and the directory. A link to an avatar or agent that no longer exists now says so honestly instead of quietly bouncing to a listing page, an id that belongs to the other side of the platform redirects to where it actually lives, and a private agent is no longer readable by anything sending a crawler's name. Signed-in surfaces were also unblocked in robots.txt so their existing no-index instruction can finally be read and obeyed. `[fix, infra]`- **The AgenC task embed now loads even when it is inlined or served from a blob**: The <three-ws-agent> element that shows a 3D avatar reacting to an on-chain AgenC task resolves its mesh decoder relative to its own script address. A copy that had been pasted inline, bundled, or loaded from a blob: or data: URL has no address to resolve against, and the element failed to register before it drew anything. It now falls back to the decoder on three.ws in that case and keeps the same-origin path everywhere else, so the embed works wherever the snippet ends up. (`/agenc/embodied`) `[fix]`- **The Blender tools now show you the render instead of describing it**: Asking an assistant to render a 3D model used to hand back a file path, which is useless if the assistant cannot open files on your disk. The rendered image now comes back with the answer, scaled to fit, while the full-resolution PNG still lands on disk. That turns a look at this model into one step, so an assistant can render, spot the problem, fix it and render again. Reading a file also reports its texture budget now: every image with its resolution and byte size, plus the total, which is usually what actually decides whether a model is small enough to ship, and it was previously reported as nothing more than a count. Two reliability fixes came out of real use: several requests at once now queue instead of all starting Blender at the same moment and exhausting the machine, and when Blender is installed but momentarily will not start you get a message saying exactly that, with the details, rather than being told to install software you already have. `[improvement, feature]`+- **The featured agent is one you can actually open**: The agent we spotlight is picked automatically from real activity, but the pick only checked whether an agent was public, not whether its owner had published it. That let a brand new starter agent, the draft every account is given on signup, take the spot, and every panel that tried to read it came back empty with a live feed error. The pick now requires a published agent, so the spotlight lands on one that every part of the site can open. `[fix]`+- **The partner-hosted demo page loads all of its pieces again**: Our partnership page is published once onto a partner's own website, so everything it loads comes from three.ws across origins. Two of its scripts were being refused by the browser there, which quietly cost the page its in-editor map and its iOS handoff. Both are now served with the same cross-origin permission the rest of the page already had, and an audit that loads the page from a foreign origin now passes end to end. `[fix]`- **Turn a photo into a 3D model without leaving your editor**: The Blender tools could already build a model from a written description. They now build one from a picture too: point at an image on your machine or a link to one, add a few words to steer it if you like, and the finished model opens in Blender. It runs on the same free lane as the text version and takes about as long. `[feature, sdk]`+- **World tiles show their artwork again**: The picker that lets you choose a community world was loading each world's artwork straight from a public storage gateway, and browsers now refuse to draw images served that way. Nine tiles on the page failed silently every visit. The artwork is now fetched through our own image service, so tiles paint their real picture, and a world whose artwork has gone missing falls back to its lettered tile instead of an empty square. `[fix]`## 2026-09-05diff --git a/api/_lib/crawler-page.js b/api/_lib/crawler-page.jsindex 050db9da3..7e723b3b8 100644--- a/api/_lib/crawler-page.js+++ b/api/_lib/crawler-page.js@@ -30,6 +30,8 @@* shows, minus the WebGL viewport it cannot run.*/+import { stripLoneSurrogates, scriptJson } from './safe-text.js';+// Crawlers that index (and, for the big three, render JS before indexing).// These must never be handed a self-redirect or a content-free body.const SEARCH_CRAWLERS =@@ -48,7 +50,10 @@ export function isSearchCrawler(ua) {/** HTML-escape a value for use in text or a double-quoted attribute. */export function esc(s) {- return String(s ?? '').replace(+ // Drop unpaired surrogates first: entity names arrive from user input and a+ // half character is served as a replacement glyph in the body and breaks the+ // page's JSON-LD for search crawlers.+ return stripLoneSurrogates(s).replace(/[&<>"']/g,(c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c],);@@ -207,7 +212,7 @@ export function renderCrawlerPage({${noindex ? '' : `<link rel="canonical" href="${esc(pageUrl)}">`}<link rel="shortcut icon" href="/favicon.ico"><style>${STYLES}</style>- <script type="application/ld+json">${JSON.stringify({ '@context': 'https://schema.org', '@graph': graph }).replace(/</g, '\\u003c')}</script>+ <script type="application/ld+json">${scriptJson({ '@context': 'https://schema.org', '@graph': graph })}</script></head><body><main>diff --git a/api/_lib/news-archive-store.js b/api/_lib/news-archive-store.jsindex ce8285660..89d91098c 100644--- a/api/_lib/news-archive-store.js+++ b/api/_lib/news-archive-store.js@@ -13,6 +13,7 @@// meta/stats.json (last_article_date), which the appender keeps current.import { createCache } from './mem-cache.js';+import { truncateChars } from './safe-text.js';import { fetchUpstream, fetchUpstreamJson, lastGood } from './upstream-fetch.js';const GCS_BASE = 'https://storage.googleapis.com/three-ws-news-archive';@@ -20,6 +21,8 @@ const GCS_LIST ='https://storage.googleapis.com/storage/v1/b/three-ws-news-archive/o?prefix=articles/&fields=items(name)&maxResults=500';const MONTH_CACHE_MAX = 5;+// Serving cap on the quoted publisher description carried in a compact record.+const DESCRIPTION_MAX_CHARS = 240;const META_TTL_MS = 3600_000;// The hourly archiver keeps appending to the last two month files; a cached// copy of those must expire or a long-lived instance never sees new stories@@ -42,7 +45,10 @@ export function compact(a) {id: a.id,title: a.title,link: str(a.link) || str(a.canonical_link),- description: str(a.description) ? a.description.slice(0, 240) : null,+ // truncateChars, never slice: a raw cut at 240 code units splits an+ // emoji's surrogate pair, and the half character it leaves behind makes+ // the story page's JSON-LD unparsable for search crawlers.+ description: str(a.description) ? truncateChars(a.description, DESCRIPTION_MAX_CHARS) : null,image: str(a.image),author: str(a.author),source: a.source || a.source_key || 'unknown',diff --git a/api/_lib/news-rights.js b/api/_lib/news-rights.jsindex e963616c1..9aee393cb 100644--- a/api/_lib/news-rights.js+++ b/api/_lib/news-rights.js@@ -20,6 +20,8 @@// Rule 2 is the one that matters long-term. Rule 1 only ever cleans up after// rule 2 was missing.+import { truncateChars } from './safe-text.js';+/*** Articles removed at a rightsholder's demand, keyed by the content-addressed* 16-hex story id (the same id that appears in /markets/news/<month>/<id>).@@ -149,10 +151,13 @@ export function excerptParagraphs(paragraphs) {}if (!out.length) {- const first = all[0].slice(0, EXCERPT_MAX_CHARS);- // Prefer a sentence boundary; fall back to a word boundary.+ const first = truncateChars(all[0], EXCERPT_MAX_CHARS);+ // Prefer a sentence boundary; fall back to a word boundary. A paragraph+ // with no space at all (CJK, a long URL) keeps the whole budget rather+ // than losing its last character to `slice(0, -1)`.const lastStop = Math.max(first.lastIndexOf('. '), first.lastIndexOf('! '), first.lastIndexOf('? '));- const cut = lastStop > EXCERPT_MAX_CHARS * 0.5 ? first.slice(0, lastStop + 1) : first.slice(0, first.lastIndexOf(' '));+ const lastSpace = first.lastIndexOf(' ');+ const cut = lastStop > EXCERPT_MAX_CHARS * 0.5 ? first.slice(0, lastStop + 1) : lastSpace > 0 ? first.slice(0, lastSpace) : first;out.push(`${cut.trim()}…`);}@@ -174,5 +179,5 @@ export function excerptText(text) {const s = String(text || '').trim();if (!s) return '';if (s.length <= EXCERPT_MAX_CHARS) return s;- return excerptParagraphs([s]).paragraphs[0] || s.slice(0, EXCERPT_MAX_CHARS);+ return excerptParagraphs([s]).paragraphs[0] || truncateChars(s, EXCERPT_MAX_CHARS);}diff --git a/api/_lib/news.js b/api/_lib/news.jsindex c3bfeac6d..afa343290 100644--- a/api/_lib/news.js+++ b/api/_lib/news.js@@ -27,6 +27,7 @@ import { XMLParser } from 'fast-xml-parser';import { NEWS_SOURCES, sourcesForCategory, sourcesForLanguage, sourcePriority, isFeaturedSource } from './news-sources.js';import { isSuppressed, excerptText } from './news-rights.js';import { isDisplayable } from './news-curation.js';+import { truncateChars } from './safe-text.js';const FEED_TIMEOUT_MS = 7000;const FRESH_MS = 300_000; // refetch a source after 5 min@@ -103,7 +104,7 @@ export function truncateWords(text, max) {const t = String(text || '').trim();if (!t) return null;if (t.length <= max) return t;- const cut = t.slice(0, max);+ const cut = truncateChars(t, max);const lastSpace = cut.lastIndexOf(' ');return `${(lastSpace > max * 0.6 ? cut.slice(0, lastSpace) : cut).replace(/[\s,;:—–-]+$/, '')}…`;}diff --git a/api/_lib/safe-text.js b/api/_lib/safe-text.jsnew file mode 100644index 000000000..2b89451e2--- /dev/null+++ b/api/_lib/safe-text.js@@ -0,0 +1,114 @@+// Truncation that never splits a character.+//+// A JavaScript string is UTF-16 code units, so `s.slice(0, 240)` can land in+// the middle of a surrogate pair and leave a lone high surrogate behind. That+// half-character survives every downstream step: JSON.stringify escapes it as+// "\ud83d" (well-formed stringify, ES2019), UTF-8 encoding turns it into a+// replacement glyph, and Google Search Console rejects the page's structured+// data outright with "Unparsable structured data: truncated Unicode character".+// An archived story page whose description opens with an emoji lost its rich+// results exactly that way on 2026-09-06.+//+// Grapheme clusters, not just code points: cutting between the two code points+// of a flag, a skin-tone modifier, or a ZWJ family emoji produces a different+// visible character rather than the one the publisher wrote. Intl.Segmenter is+// in the Node and browser platform, so this needs no dependency.++const HIGH_START = 0xd800;+const HIGH_END = 0xdbff;+const LOW_START = 0xdc00;+const LOW_END = 0xdfff;++const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });++// Segmenting a whole 8000-char body to keep its first 240 chars is wasted work.+// Boundaries at or below `max` are decided by nearby context, so a probe a few+// clusters longer than the budget yields the same answer as the full string.+const PROBE_SLACK = 64;++/**+ * Longest prefix of `text` that fits `max` UTF-16 code units and ends on a+ * grapheme boundary.+ *+ * The result is always well-formed Unicode, including when the INPUT already+ * carried a half character from an upstream feed. That guarantee is not+ * decorative: encodeURIComponent() throws `URIError: URI malformed` on a lone+ * surrogate, so one poisoned feed item would turn a story page into a 500+ * rather than a page with an odd glyph.+ *+ * @param {unknown} text+ * @param {number} max budget in UTF-16 code units (what `.length` counts)+ * @returns {string}+ */+export function truncateChars(text, max) {+ const s = String(text ?? '');+ if (!(max > 0)) return '';+ if (s.length <= max) return hasLoneSurrogate(s) ? stripLoneSurrogates(s) : s;++ let out = '';+ for (const { segment } of segmenter.segment(s.slice(0, max + PROBE_SLACK))) {+ if (out.length + segment.length > max) break;+ out += segment;+ }+ // A cluster can be a lone surrogate the caller handed us; the cut never+ // creates one.+ return hasLoneSurrogate(out) ? stripLoneSurrogates(out) : out;+}++/**+ * Drop unpaired surrogates. The last line of defence at a serialization+ * boundary: upstream feeds and already-stored records can carry a half+ * character we did not create, and one of those poisons a whole JSON-LD block.+ *+ * @param {unknown} text+ * @returns {string}+ */+export function stripLoneSurrogates(text) {+ const s = String(text ?? '');+ let out = '';+ for (let i = 0; i < s.length; i++) {+ const code = s.charCodeAt(i);+ if (code >= HIGH_START && code <= HIGH_END) {+ const next = s.charCodeAt(i + 1);+ if (next >= LOW_START && next <= LOW_END) {+ out += s[i] + s[i + 1];+ i++;+ }+ continue;+ }+ if (code >= LOW_START && code <= LOW_END) continue;+ out += s[i];+ }+ return out;+}++/** True when `text` holds a surrogate with no partner. Used by tests and audits. */+export function hasLoneSurrogate(text) {+ const s = String(text ?? '');+ for (let i = 0; i < s.length; i++) {+ const code = s.charCodeAt(i);+ if (code >= HIGH_START && code <= HIGH_END) {+ const next = s.charCodeAt(i + 1);+ if (!(next >= LOW_START && next <= LOW_END)) return true;+ i++;+ } else if (code >= LOW_START && code <= LOW_END) {+ return true;+ }+ }+ return false;+}++/**+ * JSON for embedding in a `<script>` block: well-formed Unicode, and `<`+ * escaped so the payload cannot close its own tag.+ *+ * @param {unknown} value+ * @param {number|string} [space] indent, as JSON.stringify takes it+ * @returns {string}+ */+export function scriptJson(value, space) {+ return JSON.stringify(value, (_k, v) => (typeof v === 'string' ? stripLoneSurrogates(v) : v), space).replace(+ /</g,+ '\\u003c',+ );+}diff --git a/api/news/article.js b/api/news/article.jsindex a350536cc..008411a53 100644--- a/api/news/article.js+++ b/api/news/article.js@@ -32,6 +32,7 @@ import { extractArticle } from '../_lib/article-extract.js';import { enrichTickers } from '../_lib/news-coins.js';import { recordExtraction, getExtraction } from '../_lib/news-knowledge-store.js';import { suppression, excerptParagraphs, excerptText } from '../_lib/news-rights.js';+import { truncateChars } from '../_lib/safe-text.js';const CACHE_TTL_MS = 30 * 60_000;@@ -54,9 +55,9 @@ async function llmAnalyze(content, title, source) {});const parsed = JSON.parse(stripJsonFence(text));if (!parsed.summary) return null;- const list = (v, n, cap) => (Array.isArray(v) ? v : []).map((p) => String(p).slice(0, cap)).filter(Boolean).slice(0, n);+ const list = (v, n, cap) => (Array.isArray(v) ? v : []).map((p) => truncateChars(p, cap)).filter(Boolean).slice(0, n);return {- summary: String(parsed.summary).slice(0, 1200),+ summary: truncateChars(parsed.summary, 1200),key_points: list(parsed.key_points, 5, 300),entities: list(parsed.entities, 12, 80),topics: list(parsed.topics, 8, 40),@@ -98,7 +99,7 @@ function heuristicAnalyze(paragraphs, title) {for (const { s } of scored) {if (key_points.length >= HEURISTIC_KEY_POINTS) break;if (key_points.some((k) => k.slice(0, 60) === s.slice(0, 60))) continue;- key_points.push(s.length > HEURISTIC_POINT_CHARS ? `${s.slice(0, HEURISTIC_POINT_CHARS).trimEnd()}…` : s);+ key_points.push(s.length > HEURISTIC_POINT_CHARS ? `${truncateChars(s, HEURISTIC_POINT_CHARS).trimEnd()}…` : s);}const lex = lexiconSentiment(`${title} ${lead}`);const sentiment = lex.label.includes('positive') ? 'bullish' : lex.label.includes('negative') ? 'bearish' : 'neutral';diff --git a/api/news/story-page.js b/api/news/story-page.jsindex 07944ecf6..8ab9cf604 100644--- a/api/news/story-page.js+++ b/api/news/story-page.js@@ -20,6 +20,7 @@ import { env } from '../_lib/env.js';import { resolveStory, validStoryKey } from '../_lib/news-story.js';import { suppression, excerptParagraphs, excerptText } from '../_lib/news-rights.js';import { storyPath, tickerHref, TICKER_COIN_IDS } from '../../src/shared/news-links.js';+import { truncateChars, stripLoneSurrogates, scriptJson } from '../_lib/safe-text.js';const ORIGIN = env.APP_ORIGIN || 'https://three.ws';const CACHE_TTL_MS = 10 * 60_000;@@ -29,7 +30,10 @@ const _pages = new Map(); // `${month}/${id}` → { html, status, expiresAt }let _shell = null;function esc(s) {- return String(s ?? '')+ // stripLoneSurrogates first: an unpaired surrogate reaching a meta tag is+ // served as a replacement glyph, and the same value in JSON-LD is what+ // Search Console rejects as a truncated Unicode character.+ return stripLoneSurrogates(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')@@ -123,7 +127,7 @@ function jsonLd(a, canonicalAbs, ogImage) {},],};- return JSON.stringify(graph).replace(/</g, '\\u003c');+ return scriptJson(graph);}function marketContextHtml(mc) {@@ -175,8 +179,8 @@ function crawlerBodyHtml(a) {export function renderStoryHtml(shell, a) {const canonical = storyPath(a);const canonicalAbs = `${ORIGIN}${canonical}`;- const description = (a.description || `${a.title}. ${a.source} coverage on the three.ws crypto news reader.`).slice(0, 300);- const ogFallback = `${ORIGIN}/api/page-og?s=crypto&t=${encodeURIComponent(a.title.slice(0, 80))}&d=${encodeURIComponent(description.slice(0, 160))}&p=${encodeURIComponent(canonical)}`;+ const description = truncateChars(a.description || `${a.title}. ${a.source} coverage on the three.ws crypto news reader.`, 300);+ const ogFallback = `${ORIGIN}/api/page-og?s=crypto&t=${encodeURIComponent(truncateChars(a.title, 80))}&d=${encodeURIComponent(truncateChars(description, 160))}&p=${encodeURIComponent(canonical)}`;const ogImage = a.image || ogFallback;const date = fmtDate(a.pub_date);const title = `${a.title} (${a.source}${date ? `, ${date}` : ''}) · three.ws`;@@ -225,7 +229,7 @@ export function renderStoryHtml(shell, a) {html = html.replace(/<article id="art-root"[^>]*>[\s\S]*?<\/article>/,() =>- `<script type="application/json" id="art-seed">${JSON.stringify(seed).replace(/</g, '\\u003c')}</script>\n` ++ `<script type="application/json" id="art-seed">${scriptJson(seed)}</script>\n` +`\t\t\t<article id="art-root" aria-live="polite">${crawlerBodyHtml(a)}</article>`,);return html;diff --git a/data/changelog.json b/data/changelog.jsonindex 6ce479ff5..dabd50d2f 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,13 @@{"$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-07",+ "title": "Archived news stories with emoji in their summary keep their search listing",+ "summary": "Google Search Console flagged an archived story page for unparsable structured data. The cause: the archive trims a publisher summary to a fixed length before serving it, and the cut landed in the middle of an emoji, leaving half a character in the page data that search engines read. Trimming is now character-aware, so it never splits an emoji, a flag, or an accented letter, and the page data is checked for half characters before it is written. Around one archived story in seven thousand carried the flaw; all of them serve a valid listing now. The same fix covers the story summaries shown in link previews and the shared page descriptions across the site.",+ "tags": ["fix", "infra"],+ "link": "/markets/news"+ },{"date": "2026-09-07","title": "Keyboard focus is visible again on every /play HUD button, and the AGI filter counts clear AA contrast",diff --git a/public/changelog.json b/public/changelog.jsonindex a678a50f6..9c0ea1a55 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-09-07T06:40:26.871Z",+ "generated_at": "2026-09-07T15:50:24.725Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -38,6 +38,17 @@"improvement"]},+ {+ "date": "2026-09-07",+ "type": "update",+ "title": "Archived news stories with emoji in their summary keep their search listing",+ "summary": "Google Search Console flagged an archived story page for unparsable structured data. The cause: the archive trims a publisher summary to a fixed length before serving it, and the cut landed in the middle of an emoji, leaving half a character in the page data that search engines read. Trimming is now character-aware, so it never splits an emoji, a flag, or an accented letter, and the page data is checked for half characters before it is written. Around one archived story in seven thousand carried the flaw; all of them serve a valid listing now. The same fix covers the story summaries shown in link previews and the shared page descriptions across the site.",+ "link": "/markets/news",+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-09-07","type": "update",@@ -125,6 +136,26 @@"feature"]},+ {+ "date": "2026-09-07",+ "type": "update",+ "title": "The featured agent is one you can actually open",+ "summary": "The agent we spotlight is picked automatically from real activity, but the pick only checked whether an agent was public, not whether its owner had published it. That let a brand new starter agent, the draft every account is given on signup, take the spot, and every panel that tried to read it came back empty with a live feed error. The pick now requires a published agent, so the spotlight lands on one that every part of the site can open.",+ "link": null,+ "tags": [+ "fix"+ ]+ },+ {+ "date": "2026-09-07",+ "type": "update",+ "title": "The partner-hosted demo page loads all of its pieces again",+ "summary": "Our partnership page is published once onto a partner's own website, so everything it loads comes from three.ws across origins. Two of its scripts were being refused by the browser there, which quietly cost the page its in-editor map and its iOS handoff. Both are now served with the same cross-origin permission the rest of the page already had, and an audit that loads the page from a foreign origin now passes end to end.",+ "link": null,+ "tags": [+ "fix"+ ]+ },{"date": "2026-09-07","type": "update",@@ -136,6 +167,16 @@"sdk"]},+ {+ "date": "2026-09-07",+ "type": "update",+ "title": "World tiles show their artwork again",+ "summary": "The picker that lets you choose a community world was loading each world's artwork straight from a public storage gateway, and browsers now refuse to draw images served that way. Nine tiles on the page failed silently every visit. The artwork is now fetched through our own image service, so tiles paint their real picture, and a world whose artwork has gone missing falls back to its lettered tile instead of an empty square.",+ "link": null,+ "tags": [+ "fix"+ ]+ },{"date": "2026-09-05","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex fd7fb66a5..96caaa72e 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -30,6 +30,14 @@<category>fix</category><description>When an agent pays one of our x402 endpoints and the payment header arrives mangled (truncated in transit, double-encoded, wrapped by a proxy), the answer used to be a plain 400 error with no prices in it, so the agent had nothing left to work from and no way to retry. Every rejected payment now returns the ordinary 402 with the full list of accepted rails, tokens and amounts attached, exactly as it does when a payment is simply missing. That is what the x402 spec and the OKX seller SDK both do, and it means a paying agent can always read the quote again and try once more. Only a real server fault answers without a quote.</description></item>+ <item>+ <title>Archived news stories with emoji in their summary keep their search listing</title>+ <link>https://three.ws/markets/news</link>+ <guid isPermaLink="false">2026-09-07:Archived news stories with emoji in their summary keep their search listing</guid>+ <pubDate>Mon, 07 Sep 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Google Search Console flagged an archived story page for unparsable structured data. The cause: the archive trims a publisher summary to a fixed length before serving it, and the cut landed in the middle of an emoji, leaving half a character in the page data that search engines read. Trimming is now character-aware, so it never splits an emoji, a flag, or an accented letter, and the page data is checked for half characters before it is written. Around one archived story in seven thousand carried the flaw; all of them serve a valid listing now. The same fix covers the story summaries shown in link previews and the shared page descriptions across the site.</description>+ </item><item><title>Blender tools now open three.ws avatars, which Blender alone cannot</title><link>https://three.ws/changelog</link>@@ -94,6 +102,22 @@<category>improvement</category><description>Asking an assistant to render a 3D model used to hand back a file path, which is useless if the assistant cannot open files on your disk. The rendered image now comes back with the answer, scaled to fit, while the full-resolution PNG still lands on disk. That turns a look at this model into one step, so an assistant can render, spot the problem, fix it and render again. Reading a file also reports its texture budget now: every image with its resolution and byte size, plus the total, which is usually what actually decides whether a model is small enough to ship, and it was previously reported as nothing more than a count. Two reliability fixes came out of real use: several requests at once now queue instead of all starting Blender at the same moment and exhausting the machine, and when Blender is installed but momentarily will not start you get a message saying exactly that, with the details, rather than being told to install software you already have.</description></item>+ <item>+ <title>The featured agent is one you can actually open</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-09-07:The featured agent is one you can actually open</guid>+ <pubDate>Mon, 07 Sep 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The agent we spotlight is picked automatically from real activity, but the pick only checked whether an agent was public, not whether its owner had published it. That let a brand new starter agent, the draft every account is given on signup, take the spot, and every panel that tried to read it came back empty with a live feed error. The pick now requires a published agent, so the spotlight lands on one that every part of the site can open.</description>+ </item>+ <item>+ <title>The partner-hosted demo page loads all of its pieces again</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-09-07:The partner-hosted demo page loads all of its pieces again</guid>+ <pubDate>Mon, 07 Sep 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Our partnership page is published once onto a partner's own website, so everything it loads comes from three.ws across origins. Two of its scripts were being refused by the browser there, which quietly cost the page its in-editor map and its iOS handoff. Both are now served with the same cross-origin permission the rest of the page already had, and an audit that loads the page from a foreign origin now passes end to end.</description>+ </item><item><title>Turn a photo into a 3D model without leaving your editor</title><link>https://three.ws/changelog</link>@@ -102,6 +126,14 @@<category>feature</category><description>The Blender tools could already build a model from a written description. They now build one from a picture too: point at an image on your machine or a link to one, add a few words to steer it if you like, and the finished model opens in Blender. It runs on the same free lane as the text version and takes about as long.</description></item>+ <item>+ <title>World tiles show their artwork again</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-09-07:World tiles show their artwork again</guid>+ <pubDate>Mon, 07 Sep 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The picker that lets you choose a community world was loading each world's artwork straight from a public storage gateway, and browsers now refuse to draw images served that way. Nine tiles on the page failed silently every visit. The artwork is now fetched through our own image service, so tiles paint their real picture, and a world whose artwork has gone missing falls back to its lettered tile instead of an empty square.</description>+ </item><item><title>Docs · Pocket Console</title><link>https://three.ws/docs/pocket</link>diff --git a/scripts/build-news.mjs b/scripts/build-news.mjsindex 44c3d1c18..c346019bc 100644--- a/scripts/build-news.mjs+++ b/scripts/build-news.mjs@@ -10,6 +10,7 @@ import { readFile, writeFile, mkdir } from 'node:fs/promises';import path from 'node:path';import { fileURLToPath } from 'node:url';import { loadCuratedItems, SITE_ORIGIN, NEWS_PATH_PREFIX } from '../api/_lib/rss-feed.js';+import { scriptJson } from '../api/_lib/safe-text.js';const ROOT = path.resolve(fileURLToPath(import.meta.url), '..', '..');const OUT_DIR = path.join(ROOT, 'public', 'news');@@ -216,7 +217,7 @@ function jsonLdArticle(item) {if (item.image) ld.image = [absoluteUrl(item.image)];if (item.tags?.length) ld.keywords = item.tags.join(', ');if (item.externalLink) ld.sameAs = [item.externalLink];- return JSON.stringify(ld, null, 2);+ return scriptJson(ld, 2);}function renderArticlePage(item) {diff --git a/scripts/inject-seo-meta.mjs b/scripts/inject-seo-meta.mjsindex d03b69dd5..02add4258 100644--- a/scripts/inject-seo-meta.mjs+++ b/scripts/inject-seo-meta.mjs@@ -23,6 +23,7 @@import { readFile, writeFile } from 'node:fs/promises';import { existsSync } from 'node:fs';import path from 'node:path';+import { truncateChars } from '../api/_lib/safe-text.js';const ROOT = process.cwd();const ORIGIN = 'https://three.ws';@@ -39,7 +40,10 @@ const WRITE = process.argv.includes('--write');// ends mid-word.function truncateAtWord(s, max) {if (s.length <= max) return s;- const cut = s.slice(0, max);+ // truncateChars, not slice: a raw cut at `max` code units can split a+ // surrogate pair and leave half a character in the OG card and the meta+ // description.+ const cut = truncateChars(s, max);const space = cut.lastIndexOf(' ');return (space > max * 0.6 ? cut.slice(0, space) : cut).replace(/[\s,;:]+$/, '');}diff --git a/server/seo-head.mjs b/server/seo-head.mjsindex b688948a6..1d4db18c8 100644--- a/server/seo-head.mjs+++ b/server/seo-head.mjs@@ -23,6 +23,7 @@import { readFileSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';+import { truncateChars } from '../api/_lib/safe-text.js';const __dirname = path.dirname(fileURLToPath(import.meta.url));const ORIGIN = 'https://three.ws';@@ -39,7 +40,10 @@ function htmlEscape(s) {// ends mid-word. Mirrors inject-seo-meta.mjs.function truncateAtWord(s, max) {if (s.length <= max) return s;- const cut = s.slice(0, max);+ // truncateChars, not slice: a raw cut at `max` code units can split a+ // surrogate pair and leave half a character in the OG card and the meta+ // description.+ const cut = truncateChars(s, max);const space = cut.lastIndexOf(' ');return (space > max * 0.6 ? cut.slice(0, space) : cut).replace(/[\s,;:]+$/, '');}diff --git a/tests/safe-text.test.js b/tests/safe-text.test.jsnew file mode 100644index 000000000..1c9a43389--- /dev/null+++ b/tests/safe-text.test.js@@ -0,0 +1,145 @@+// Coverage for api/_lib/safe-text.js and the truncation sites that feed a+// crawler.+//+// The bug this file exists for: Google Search Console reported "Unparsable+// structured data: truncated Unicode character" on an archived story page on+// 2026-09-06. api/_lib/news-archive-store.js cut the publisher description at+// 240 UTF-16 code units with a plain `.slice()`, which landed between the two+// halves of an emoji. JSON.stringify is well-formed since ES2019, so it wrote+// the surviving half into the JSON-LD as a literal "\ud83d" escape and Google+// dropped the page from rich results.+//+// A half character is invisible in every local check (it renders as a+// replacement glyph, the page still returns 200, the JSON still parses in+// Node), so it is asserted here directly.++import { describe, it, expect, vi } from 'vitest';++vi.mock('../api/_lib/http.js', () => ({ wrap: (fn) => fn }));+vi.mock('../api/_lib/env.js', () => ({ env: {} }));++const { truncateChars, stripLoneSurrogates, hasLoneSurrogate, scriptJson } = await import('../api/_lib/safe-text.js');+const { compact } = await import('../api/_lib/news-archive-store.js');+const { excerptText, excerptParagraphs, EXCERPT_MAX_CHARS } = await import('../api/_lib/news-rights.js');+const { renderStoryHtml } = await import('../api/news/story-page.js');++const CHART = String.fromCodePoint(0x1f4ca); // two UTF-16 code units+const FLAG = String.fromCodePoint(0x1f1fa, 0x1f1f8); // two code points, one grapheme+const FAMILY = '\u{1f468}\u{1f469}\u{1f467}'; // ZWJ sequence++describe('truncateChars', () => {+ it('never splits a surrogate pair', () => {+ const s = `chart ${CHART} tail`;+ expect(hasLoneSurrogate(s.slice(0, 7))).toBe(true); // what a plain slice does+ expect(truncateChars(s, 7)).toBe('chart ');+ expect(truncateChars(s, 8)).toBe(`chart ${CHART}`);+ expect(hasLoneSurrogate(truncateChars(s, 7))).toBe(false);+ });++ it('keeps multi-code-point graphemes whole', () => {+ expect(truncateChars(`ab${FLAG}`, 3)).toBe('ab');+ expect(truncateChars(`ab${FLAG}`, 6)).toBe(`ab${FLAG}`);+ expect(truncateChars(FAMILY, 5)).toBe('');+ expect(truncateChars(FAMILY, FAMILY.length)).toBe(FAMILY);+ });++ it('passes through anything already inside the budget', () => {+ expect(truncateChars('short', 240)).toBe('short');+ expect(truncateChars('', 240)).toBe('');+ expect(truncateChars(null, 240)).toBe('');+ expect(truncateChars('anything', 0)).toBe('');+ });+});++describe('stripLoneSurrogates', () => {+ it('drops an unpaired half and keeps whole characters', () => {+ const broken = `chart ${CHART} tail`.slice(0, 7);+ expect(hasLoneSurrogate(broken)).toBe(true);+ expect(stripLoneSurrogates(broken)).toBe('chart ');+ expect(stripLoneSurrogates(`ok ${CHART} ok`)).toBe(`ok ${CHART} ok`);+ });++ it('keeps scriptJson output free of escaped lone surrogates', () => {+ const json = scriptJson({ d: `chart ${CHART} tail`.slice(0, 7), html: '</script>' });+ expect(/\\u[dD][89abAB][0-9a-fA-F]{2}/.test(json)).toBe(false);+ expect(json).not.toContain('</script>');+ expect(JSON.parse(json.replace(/\\u003c/g, '<')).d).toBe('chart ');+ });+});++describe('archive compact()', () => {+ it('cuts an over-long description without leaving half a character', () => {+ const description = `${CHART} Technical analysis. ${'word '.repeat(60)}${CHART} tail`;+ expect(description.length).toBeGreaterThan(240);+ const out = compact({ id: 'a'.repeat(16), title: `${CHART} headline`, description });+ expect(out.description.length).toBeLessThanOrEqual(240);+ expect(hasLoneSurrogate(out.description)).toBe(false);+ });+});++describe('rights excerpts', () => {+ it('bounds an emoji-heavy body without splitting a character', () => {+ const body = `${CHART} ${'analysis '.repeat(80)}${CHART}`;+ const out = excerptText(body);+ expect(out.length).toBeLessThanOrEqual(EXCERPT_MAX_CHARS + 1); // + the ellipsis+ expect(hasLoneSurrogate(out)).toBe(false);+ });++ it('keeps the whole budget for a paragraph with no spaces', () => {+ const runOn = `${CHART}${'x'.repeat(EXCERPT_MAX_CHARS * 2)}`;+ const { paragraphs } = excerptParagraphs([runOn]);+ expect(paragraphs[0].length).toBeGreaterThan(EXCERPT_MAX_CHARS * 0.5);+ expect(hasLoneSurrogate(paragraphs[0])).toBe(false);+ });+});++describe('story page output', () => {+ const shell = `<!doctype html><html><head><title data-i18n="news_article.meta_title">Reader</title>+<meta name="description" content="x" data-i18n-attr="content"><meta name="robots" content="noindex">+<meta property="og:title" content="x"><meta property="og:description" content="x">+<meta property="og:image" content="x"><meta property="og:url" content="x"><meta property="og:image:alt" content="x">+<meta name="twitter:title" content="x"><meta name="twitter:description" content="x"><meta name="twitter:image" content="x">+<link rel="canonical" href="https://three.ws/markets/news">+<script type="application/ld+json">{}</script></head>+<body><article id="art-root"></article></body></html>`;++ const article = {+ id: 'abcdefabcdefabcd',+ title: `${CHART} Technical analysis ${FLAG}`,+ link: 'https://publisher.example/story',+ description: `${CHART} ${'context '.repeat(80)}${CHART}`,+ source: 'Publisher',+ source_key: 'publisher',+ category: 'general',+ pub_date: '2026-08-10T07:46:06.000Z',+ tickers: ['THREE'],+ sentiment: { label: 'neutral', score: 0 },+ };++ it('emits JSON-LD with no truncated character, and it parses', () => {+ const html = renderStoryHtml(shell, article);+ const ld = html.match(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/)[1];+ expect(/\\u[dD][89abAB][0-9a-fA-F]{2}/.test(ld)).toBe(false);+ expect(hasLoneSurrogate(ld)).toBe(false);+ const graph = JSON.parse(ld.replace(/\\u003c/g, '<'))['@graph'];+ expect(graph[0]['@type']).toBe('NewsArticle');+ expect(hasLoneSurrogate(graph[0].description || '')).toBe(false);+ });++ it('emits a clean seed and clean meta tags', () => {+ const html = renderStoryHtml(shell, article);+ const seed = html.match(/id="art-seed">([\s\S]*?)<\/script>/)[1];+ expect(hasLoneSurrogate(seed)).toBe(false);+ expect(hasLoneSurrogate(html)).toBe(false);+ JSON.parse(seed.replace(/\\u003c/g, '<'));+ });++ it('survives a description that already arrived with half a character', () => {+ const poisoned = { ...article, description: `already broken ${CHART}`.slice(0, 16) };+ expect(hasLoneSurrogate(poisoned.description)).toBe(true);+ const html = renderStoryHtml(shell, poisoned);+ expect(hasLoneSurrogate(html)).toBe(false);+ const ld = html.match(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/)[1];+ expect(/\\u[dD][89abAB][0-9a-fA-F]{2}/.test(ld)).toBe(false);+ });+});