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.

chore: sync working tree

nirholas7225e0bb69eb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c47c6d9fe..04e552edf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,8 +12,10 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Docs · Overlay audit** (`/docs/overlay-audit`): The measured report on every UI overlay surface: which pages draw what over the content, what the audit sweep checks, and how to read a finding before fixing it.
- **Docs · The solved economy** (`/docs/economy-solver`): The closed-form model behind /play/solver: expected cash, XP and yield per hour for every gatherable node at every level, the optimal fish-and-cook split, store payback, and the exact assumptions the arithmetic rests on.
- **Docs search now lands on the exact section you typed**: Typing a heading you saw in the docs did not always take you to it. A short section carries few words, so a long page that happened to reuse the same common words could outrank the section actually titled that. Search now recognises when what you typed IS a section's heading and sends you there first. Measured across the whole documentation corpus, a heading finding its own section went from 80 to 83 percent, and queries like "cost per asset" that previously returned three unrelated pages now open the right one. (`/docs`) `[improvement, docs]`
+- **Editing an avatar in the Avatar Studio no longer strips the clothes off it**: An avatar on three.ws is stored as a plain body plus a record of everything it is wearing: skin and hair colours, face shape, accessories, a preset outfit, and any garments picked from the wardrobe. The platform reads that record and builds the dressed model from it. The Avatar Studio only shows some of those things, because the wardrobe lives in the avatar editor rather than in the Studio. Until now, saving from the Studio wrote back only what the Studio itself could see, which quietly deleted the rest: open a garment-wearing avatar in the Studio, change nothing but the hair colour, hit save, and the garments were gone with no warning and no way to get them back. The same save also replaced the avatar's plain body with a copy of what was on screen, which already had the colours and accessories applied, and the platform would then apply them a second time on top, so colours came back darker than chosen and hats could appear twice. Both are fixed. The Studio now carries the parts of the outfit it cannot show through a save untouched, and an edit saves the description of the avatar rather than overwriting the body it was built from, so the original is always still there and everything is applied exactly once. Reset clears what the Studio controls and leaves the wardrobe alone. Renaming an avatar in the Studio now counts as a change worth saving, which it previously did not. (`/avatar-studio`) `[fix]`
- **Pick animations by what they do: the motion of every clip is now measured and queryable**: Every animation clip in the library has been measured from its keyframes: how energetic it is, its tempo, which part of the body leads, whether it loops without a visible snap, and whether it survives as an upper-body overlay. The measurements power a new public API (GET /api/animations/signatures) with filters, slot-fit verdicts and a similar-clips ranking, plus two free MCP tools (animation_signature, find_similar_animations) so agents can pick clips the same way. The gestures page and the runtime defaults already run on the same numbers, so what you preview is what agents get. (`/gestures`) `[feature, sdk]`
- **The docs now tell you when a 3D model needs the CORS proxy and when it does not**: Loading an avatar into a viewer on your own site is a cross-origin fetch, and whether it works depends on which host serves the file. Our docs treated that as one rule and got it wrong in both directions: they told you to route every model through the /api/glb proxy, including the built-in library avatars on three.ws, which already load from anywhere. The media API reference and both embed tutorials now show the actual split, measured rather than assumed. Files served from three.ws load directly. Files on the media CDN, which is where every avatar you generate lives, need the proxy on any origin outside the bucket's allowlist. The proxy stays safe to use when you cannot tell the two apart. Alongside it, the script that manages the bucket policy gained a probe mode that measures what the bucket actually enforces, so this class of drift gets caught by a command instead of by a broken embed. (`/docs/media-api`) `[docs, improvement]`
+- **The payment rail stopped doing 85,000 pieces of work a day it already knew it would throw away**: Every payment on three.ws costs a small amount of SOL in network fees, and the platform gives the wallet that pays those fees a daily budget so it can never drain itself in one burst. That budget was being checked at the very last moment, after the work was already done. A payment would be quoted, a transaction would be built and signed, and the blockchain would be asked to simulate it, and only then would the platform notice the budget was spent and refuse. Measured on 2026-08-01, that happened 85,264 times in a day against 4,142 payments that actually went through, so the rail was doing roughly twenty times more work than it could ever use, and each refusal came back to the caller looking like a server error rather than a budget decision. The budget check now happens first, before anything is built or signed and before the blockchain is contacted at all. Payments that cannot be funded are skipped in one step instead of after five, which removes around 170,000 wasted calls to Solana every day and takes that load off the same connections the rest of the platform shares. The number of payments that settle is unchanged, because it was never the wasted work that limited it. What changes is that the platform stops burning capacity to be told no, and the health board can now tell the difference between a rail that is broken and a rail that is deliberately pacing itself. `[fix, infra]`
- **The wallet that pays for every payment now warns us days before it runs out**: Every payment settled on three.ws costs a small amount of SOL, paid by one wallet on the platform's side. When that wallet gets low, payments do not fail loudly: the platform quietly stops offering Solana as a way to pay, so nothing is attempted and nothing is rejected. Payments simply stop, and every error counter stays flat, which is the opposite of what anyone debugging would expect. The runway on that wallet was already being calculated and shown on an internal board, but nothing acted on it. Now it alerts, by default when there are fewer than three days left, and the alert carries the real numbers: what the wallet holds, what it spends per day measured from actual settlement fees over the past week rather than from a remembered figure, and how long that leaves. It also names the misleading symptom up front so nobody spends a shift looking at the wrong system. Alongside it, the automatic recovery step that pulls idle funds back from platform wallets now records every attempt, so a recovery that could not run is visible instead of looking identical to one that had nothing to do. `[infra, improvement]`
- **Your own avatar can sign now, not just the two that shipped with the page**: Sign language ran on two fixed rigs. You could watch the platform's avatars sign, but never your own, which is backwards for a feature whose whole point is that an avatar communicates. The Avatar setting on the sign language page and the ASL alphabet page now has a third option that opens the avatar gallery: pick any avatar you own, or any public one, and it takes over the signing on the spot, keeping the speed and signing hand you already chose. Your pick is remembered and carries between both pages. It works because a sign is described anatomically, an index fingertip on the chin rather than a fixed coordinate, so the same vocabulary is measured onto your avatar's own skeleton, whatever its proportions. An avatar that genuinely cannot sign, a model with no skeleton or no finger bones, is not left standing there mute: the page says which avatar it is and puts the working one back. (`/sign-language`) `[feature, improvement]`
diff --git a/api/cron/forge-seed-cron.js b/api/cron/forge-seed-cron.js
index 226177b29..0f39a69da 100644
--- a/api/cron/forge-seed-cron.js
+++ b/api/cron/forge-seed-cron.js
@@ -791,20 +791,56 @@ export default wrapCron(async (req, res) => {
if (!requireCron(req, res)) return;
const origin = ORIGIN();
- const [polled, started] = await Promise.all([
+ // Every phase advances a different set of rows, so they are safe to run
+ // together and the tick costs one phase's wall-clock, not four in series.
+ const [polled, gated, rigged, started] = await Promise.all([
pollPending(origin),
- startNextJob(origin),
+ advanceGates(origin),
+ advanceRigs(origin),
+ startBatch(origin),
]);
- const finalized = polled.filter(j => j.status === 'done').length;
+ const advanced = [...gated, ...rigged];
+ const published = advanced.filter(j => j.status === 'published').length;
+ const rejected = advanced.filter(j => j.status === 'rejected').length;
const failed = polled.filter(j => j.status === 'failed').length;
return json(res, 200, {
ok: true,
polled: polled.length,
- finalized,
+ published,
+ rejected,
failed,
+ accept_rate: await recentAcceptRate(),
poll_results: polled,
- new_job: started,
+ gate_results: gated,
+ rig_results: rigged,
+ new_jobs: started,
});
});
+
+// Rolling accept rate over the last 24 h of gated seed jobs. Published vs
+// rejected only: a generation that never reached the gate (failed upstream) and
+// a gate that could not run (gate_error) are infrastructure, not curation, and
+// counting them would understate how good the prompts actually are.
+async function recentAcceptRate() {
+ try {
+ const [row] = await sql`
+ select
+ count(*) filter (where status = 'done')::int as accepted,
+ count(*) filter (where status = 'rejected')::int as rejected
+ from forge_seed_jobs
+ where started_at > now() - interval '24 hours'
+ and status in ('done', 'rejected')
+ `;
+ const total = (row?.accepted || 0) + (row?.rejected || 0);
+ return {
+ window: '24h',
+ accepted: row?.accepted || 0,
+ rejected: row?.rejected || 0,
+ rate: total > 0 ? Number(((row.accepted / total) * 100).toFixed(1)) : null,
+ };
+ } catch {
+ return null;
+ }
+}
diff --git a/data/_generated/fact-check-benchmark.json b/data/_generated/fact-check-benchmark.json
new file mode 100644
index 000000000..ecbf7809c
--- /dev/null
+++ b/data/_generated/fact-check-benchmark.json
@@ -0,0 +1,68 @@
+{
+ "generated_at": "2026-08-01T21:59:04.168Z",
+ "endpoint": "https://three.ws/api/x402/fact-check",
+ "fixture_version": "1.0.0",
+ "claim_count": 40,
+ "total": 40,
+ "correct": 18,
+ "errors": 0,
+ "accuracy_pct": 45,
+ "by_class": {
+ "supported": {
+ "total": 10,
+ "correct": 7,
+ "accuracy_pct": 70
+ },
+ "contradicted": {
+ "total": 10,
+ "correct": 6,
+ "accuracy_pct": 60
+ },
+ "mixed": {
+ "total": 10,
+ "correct": 0,
+ "accuracy_pct": 0
+ },
+ "insufficient": {
+ "total": 10,
+ "correct": 5,
+ "accuracy_pct": 50
+ }
+ },
+ "by_difficulty": {
+ "easy": {
+ "total": 13,
+ "correct": 8,
+ "accuracy_pct": 61.5
+ },
+ "medium": {
+ "total": 20,
+ "correct": 8,
+ "accuracy_pct": 40
+ },
+ "hard": {
+ "total": 7,
+ "correct": 2,
+ "accuracy_pct": 28.6
+ }
+ },
+ "confusion": {
+ "supported": {
+ "supported": 7,
+ "insufficient": 3
+ },
+ "contradicted": {
+ "contradicted": 6,
+ "insufficient": 4
+ },
+ "mixed": {
+ "insufficient": 4,
+ "contradicted": 6
+ },
+ "insufficient": {
+ "insufficient": 5,
+ "contradicted": 4,
+ "supported": 1
+ }
+ }
+}
diff --git a/data/changelog.json b/data/changelog.json
index dd4f2eccf..ba58bc462 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,24 @@
{
"$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-08-01",
+ "title": "Editing an avatar in the Avatar Studio no longer strips the clothes off it",
+ "summary": "An avatar on three.ws is stored as a plain body plus a record of everything it is wearing: skin and hair colours, face shape, accessories, a preset outfit, and any garments picked from the wardrobe. The platform reads that record and builds the dressed model from it. The Avatar Studio only shows some of those things, because the wardrobe lives in the avatar editor rather than in the Studio. Until now, saving from the Studio wrote back only what the Studio itself could see, which quietly deleted the rest: open a garment-wearing avatar in the Studio, change nothing but the hair colour, hit save, and the garments were gone with no warning and no way to get them back. The same save also replaced the avatar's plain body with a copy of what was on screen, which already had the colours and accessories applied, and the platform would then apply them a second time on top, so colours came back darker than chosen and hats could appear twice. Both are fixed. The Studio now carries the parts of the outfit it cannot show through a save untouched, and an edit saves the description of the avatar rather than overwriting the body it was built from, so the original is always still there and everything is applied exactly once. Reset clears what the Studio controls and leaves the wardrobe alone. Renaming an avatar in the Studio now counts as a change worth saving, which it previously did not.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/avatar-studio"
+ },
+ {
+ "date": "2026-08-01",
+ "title": "The payment rail stopped doing 85,000 pieces of work a day it already knew it would throw away",
+ "summary": "Every payment on three.ws costs a small amount of SOL in network fees, and the platform gives the wallet that pays those fees a daily budget so it can never drain itself in one burst. That budget was being checked at the very last moment, after the work was already done. A payment would be quoted, a transaction would be built and signed, and the blockchain would be asked to simulate it, and only then would the platform notice the budget was spent and refuse. Measured on 2026-08-01, that happened 85,264 times in a day against 4,142 payments that actually went through, so the rail was doing roughly twenty times more work than it could ever use, and each refusal came back to the caller looking like a server error rather than a budget decision. The budget check now happens first, before anything is built or signed and before the blockchain is contacted at all. Payments that cannot be funded are skipped in one step instead of after five, which removes around 170,000 wasted calls to Solana every day and takes that load off the same connections the rest of the platform shares. The number of payments that settle is unchanged, because it was never the wasted work that limited it. What changes is that the platform stops burning capacity to be told no, and the health board can now tell the difference between a rail that is broken and a rail that is deliberately pacing itself.",
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-08-01",
"title": "The wallet that pays for every payment now warns us days before it runs out",
diff --git a/public/changelog.json b/public/changelog.json
index 20712922b..7ee4d6519 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-01T21:50:29.816Z",
+ "generated_at": "2026-08-01T22:00:03.046Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -67,6 +67,16 @@
"docs"
]
},
+ {
+ "date": "2026-08-01",
+ "type": "update",
+ "title": "Editing an avatar in the Avatar Studio no longer strips the clothes off it",
+ "summary": "An avatar on three.ws is stored as a plain body plus a record of everything it is wearing: skin and hair colours, face shape, accessories, a preset outfit, and any garments picked from the wardrobe. The platform reads that record and builds the dressed model from it. The Avatar Studio only shows some of those things, because the wardrobe lives in the avatar editor rather than in the Studio. Until now, saving from the Studio wrote back only what the Studio itself could see, which quietly deleted the rest: open a garment-wearing avatar in the Studio, change nothing but the hair colour, hit save, and the garments were gone with no warning and no way to get them back. The same save also replaced the avatar's plain body with a copy of what was on screen, which already had the colours and accessories applied, and the platform would then apply them a second time on top, so colours came back darker than chosen and hats could appear twice. Both are fixed. The Studio now carries the parts of the outfit it cannot show through a save untouched, and an edit saves the description of the avatar rather than overwriting the body it was built from, so the original is always still there and everything is applied exactly once. Reset clears what the Studio controls and leaves the wardrobe alone. Renaming an avatar in the Studio now counts as a change worth saving, which it previously did not.",
+ "link": "/avatar-studio",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-08-01",
"type": "update",
@@ -89,6 +99,17 @@
"improvement"
]
},
+ {
+ "date": "2026-08-01",
+ "type": "update",
+ "title": "The payment rail stopped doing 85,000 pieces of work a day it already knew it would throw away",
+ "summary": "Every payment on three.ws costs a small amount of SOL in network fees, and the platform gives the wallet that pays those fees a daily budget so it can never drain itself in one burst. That budget was being checked at the very last moment, after the work was already done. A payment would be quoted, a transaction would be built and signed, and the blockchain would be asked to simulate it, and only then would the platform notice the budget was spent and refuse. Measured on 2026-08-01, that happened 85,264 times in a day against 4,142 payments that actually went through, so the rail was doing roughly twenty times more work than it could ever use, and each refusal came back to the caller looking like a server error rather than a budget decision. The budget check now happens first, before anything is built or signed and before the blockchain is contacted at all. Payments that cannot be funded are skipped in one step instead of after five, which removes around 170,000 wasted calls to Solana every day and takes that load off the same connections the rest of the platform shares. The number of payments that settle is unchanged, because it was never the wasted work that limited it. What changes is that the platform stops burning capacity to be told no, and the health board can now tell the difference between a rail that is broken and a rail that is deliberately pacing itself.",
+ "link": null,
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-08-01",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 69b1e1f8a..b8fadf59f 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -54,6 +54,14 @@
<category>improvement</category>
<description>Typing a heading you saw in the docs did not always take you to it. A short section carries few words, so a long page that happened to reuse the same common words could outrank the section actually titled that. Search now recognises when what you typed IS a section's heading and sends you there first. Measured across the whole documentation corpus, a heading finding its own section went from 80 to 83 percent, and queries like &quot;cost per asset&quot; that previously returned three unrelated pages now open the right one.</description>
</item>
+ <item>
+ <title>Editing an avatar in the Avatar Studio no longer strips the clothes off it</title>
+ <link>https://three.ws/avatar-studio</link>
+ <guid isPermaLink="false">2026-08-01:Editing an avatar in the Avatar Studio no longer strips the clothes off it</guid>
+ <pubDate>Sat, 01 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>An avatar on three.ws is stored as a plain body plus a record of everything it is wearing: skin and hair colours, face shape, accessories, a preset outfit, and any garments picked from the wardrobe. The platform reads that record and builds the dressed model from it. The Avatar Studio only shows some of those things, because the wardrobe lives in the avatar editor rather than in the Studio. Until now, saving from the Studio wrote back only what the Studio itself could see, which quietly deleted the rest: open a garment-wearing avatar in the Studio, change nothing but the hair colour, hit save, and the garments were gone with no warning and no way to get them back. The same save also replaced the avatar's plain body with a copy of what was on screen, which already had the colours and accessories applied, and the platform would then apply them a second time on top, so colours came back darker than chosen and hats could appear twice. Both are fixed. The Studio now carries the parts of the outfit it cannot show through a save untouched, and an edit saves the description of the avatar rather than overwriting the body it was built from, so the original is always still there and everything is applied exactly once. Reset clears what the Studio controls and leaves the wardrobe alone. Renaming an avatar in the Studio now counts as a change worth saving, which it previously did not.</description>
+ </item>
<item>
<title>Pick animations by what they do: the motion of every clip is now measured and queryable</title>
<link>https://three.ws/gestures</link>
@@ -70,6 +78,14 @@
<category>docs</category>
<description>Loading an avatar into a viewer on your own site is a cross-origin fetch, and whether it works depends on which host serves the file. Our docs treated that as one rule and got it wrong in both directions: they told you to route every model through the /api/glb proxy, including the built-in library avatars on three.ws, which already load from anywhere. The media API reference and both embed tutorials now show the actual split, measured rather than assumed. Files served from three.ws load directly. Files on the media CDN, which is where every avatar you generate lives, need the proxy on any origin outside the bucket's allowlist. The proxy stays safe to use when you cannot tell the two apart. Alongside it, the script that manages the bucket policy gained a probe mode that measures what the bucket actually enforces, so this class of drift gets caught by a command instead of by a broken embed.</description>
</item>
+ <item>
+ <title>The payment rail stopped doing 85,000 pieces of work a day it already knew it would throw away</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-08-01:The payment rail stopped doing 85,000 pieces of work a day it already knew it would throw away</guid>
+ <pubDate>Sat, 01 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Every payment on three.ws costs a small amount of SOL in network fees, and the platform gives the wallet that pays those fees a daily budget so it can never drain itself in one burst. That budget was being checked at the very last moment, after the work was already done. A payment would be quoted, a transaction would be built and signed, and the blockchain would be asked to simulate it, and only then would the platform notice the budget was spent and refuse. Measured on 2026-08-01, that happened 85,264 times in a day against 4,142 payments that actually went through, so the rail was doing roughly twenty times more work than it could ever use, and each refusal came back to the caller looking like a server error rather than a budget decision. The budget check now happens first, before anything is built or signed and before the blockchain is contacted at all. Payments that cannot be funded are skipped in one step instead of after five, which removes around 170,000 wasted calls to Solana every day and takes that load off the same connections the rest of the platform shares. The number of payments that settle is unchanged, because it was never the wasted work that limited it. What changes is that the platform stops burning capacity to be told no, and the health board can now tell the difference between a rail that is broken and a rail that is deliberately pacing itself.</description>
+ </item>
<item>
<title>The wallet that pays for every payment now warns us days before it runs out</title>
<link>https://three.ws/changelog</link>
diff --git a/public/features.json b/public/features.json
index 453e4f54b..9089d4fd5 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-01T21:50:29.650Z",
+ "generated_at": "2026-08-01T22:00:03.026Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/scripts/export-satellites.mjs b/scripts/export-satellites.mjs
index 3f3460e68..d632fe034 100644
--- a/scripts/export-satellites.mjs
+++ b/scripts/export-satellites.mjs
@@ -132,6 +132,8 @@ const REF_PATTERNS = [
/((?:src|href)=')([^']+)(')/g, // html attribute (single)
/((?:from|import)\s*\(?\s*['"])([^'"]+)(['"])/g, // esm import / dynamic import
/((?:require)\(\s*['"])([^'"]+)(['"])/g, // cjs require
+ /(:\s*")(\.{1,2}\/[^"]*)(")/g, // json value path (agent manifest skill uri)
+ /(`)(\.{1,2}\/[^`\s]*)(`)/g, // markdown code span naming a path
];
function routeRef(ref, fromRel, toRel) {
@@ -265,14 +267,18 @@ function listFiles(dir, acc = []) {
//
// Exclusion policy: an example whose code, fixtures, or docs reference a crypto
// project other than $THREE stays OUT of this manifest until the owner approves
-// that specific content (CLAUDE.md commit gate). `examples/agenc-task-roundtrip`
-// is held out on exactly that basis: it depends on a third-party agent-commerce
-// SDK and pins that project's on-chain program id.
+// that specific content (CLAUDE.md commit gate). Three examples are held out on
+// exactly that basis, and each is one line away from being re-included:
+// examples/agenc-task-roundtrip depends on a third-party agent-commerce SDK
+// and pins that project's on-chain program id
+// examples/pump-fun-agent installs pump-fun-skills/, whose SKILL.md and
+// examples/three-concierge lib carry third-party program ids, a sample
+// third-party mint, and a bundler integration
+// An agent may only ship here if every skill its manifest installs ships too: a
+// public agent with a dangling skill uri is broken for the reader who tries it.
// ---------------------------------------------------------------------------
const AGENTS = [
{ dir: 'coach-leo', title: 'Coach Leo', shows: 'A full character agent: system prompt, manifest, and skill wiring.', run: 'Load into the three.ws agent builder (instructions.md + manifest.json).', docs: `${HOST}/docs/agents` },
- { dir: 'pump-fun-agent', title: 'pump.fun agent', shows: 'An agent wired to the live pump.fun feed for buys, sells, launches, and creator fees.', run: 'Load instructions.md + manifest.json into an agent runtime with the pump.fun skills.', docs: `${HOST}/docs/agent-skills` },
- { dir: 'three-concierge', title: 'Three Concierge (Trinity)', shows: 'An embedded concierge agent with an agent-card and on-chain identity.', run: 'Load instructions.md + manifest.json; embed via the agent-card.json.', docs: `${HOST}/docs/agent-protocol` },
{ dir: 'metamask-agent-wallet', title: 'MetaMask agent wallet', shows: 'A wallet-connected agent: a localhost bridge exposing the MetaMask Agentic CLI to a demo page.', run: 'node server.mjs, then open index.html at http://localhost:4280', docs: `${HOST}/docs/wallet` },
];
@@ -540,24 +546,35 @@ const failures = [];
const fail = (stage, detail) => failures.push(`[${stage}] ${detail}`);
// Stage 1: structure (offline).
-console.log('\nSmoke 1/4 structure: monorepo references, relative links, package manifests');
-const MONOREPO_REF = /(\.\.\/)+(src|docs|sdk|packages|solana-agent-sdk|agent-payments-sdk|mcp-server)\//;
+console.log('\nSmoke 1/4 structure: dangling references, escaped paths, package manifests');
const staged = listFiles(OUT);
+// Every `../`-prefixed path, whether it sits in a link, an import, or prose. The
+// test is the same for all of them: does it resolve to something we shipped? A
+// reference that escapes the export is a monorepo leak; one that resolves is an
+// example referring to its own files, which is correct and must not be rewritten.
+const ESCAPING_REF = /(?:\.\.\/)+[A-Za-z0-9_.@-]+(?:\/[A-Za-z0-9_.@-]+)*\/?/g;
+const IN_LINK = /(?:\]\(|(?:src|href)=["']|(?:from|import|require)\s*\(?\s*['"])(?!https?:|mailto:|data:|#|\/)([^"')#\s]+)/g;
for (const file of staged) {
if (!REWRITE_EXT.has(extname(file))) continue;
const rel = relative(OUT, file);
const text = readFileSync(file, 'utf8');
- const leak = text.match(MONOREPO_REF);
- if (leak) fail('structure', `${rel} still points into the monorepo: ${leak[0]}`);
if (/["']file:/.test(text)) fail('structure', `${rel} still declares a file: dependency`);
if (basename(file) === 'package.json') {
try { JSON.parse(text); } catch (e) { fail('structure', `${rel} is not valid JSON: ${e.message}`); }
+ continue;
}
- // Relative links inside the export must resolve to something we shipped.
- const linkRe = /(?:\]\(|(?:src|href)=["'])(?!https?:|mailto:|data:|#|\/)([^"')#\s]+)/g;
- for (const m of text.matchAll(linkRe)) {
+ for (const m of text.matchAll(ESCAPING_REF)) {
+ const target = resolve(dirname(file), m[0]);
+ if (!target.startsWith(OUT + '/')) {
+ fail('structure', `${rel} escapes the export: ${m[0]}`);
+ } else if (!existsSync(target)) {
+ fail('structure', `${rel} references missing ${m[0]}`);
+ }
+ }
+ for (const m of text.matchAll(IN_LINK)) {
const target = m[1];
if (!target || target.startsWith('$') || target.includes('${')) continue;
+ if (!target.startsWith('.')) continue;
if (!existsSync(resolve(dirname(file), target))) {
fail('structure', `${rel} links to missing ${target}`);
}
diff --git a/scripts/tmp/probe-create.mjs b/scripts/tmp/probe-create.mjs
new file mode 100644
index 000000000..810c3d858
--- /dev/null
+++ b/scripts/tmp/probe-create.mjs
@@ -0,0 +1,21 @@
+import { chromium } from 'playwright';
+const b = await chromium.launch();
+const p = await b.newPage({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
+await p.goto('http://localhost:3000/create', { waitUntil: 'domcontentloaded' });
+await p.waitForTimeout(3500);
+const out = await p.evaluate(() => {
+ const chip = document.querySelector('.brand-mark-chip');
+ const nav = document.querySelector('header.nav');
+ const r = (e) => e ? (({x,y,width,height}) => ({x,y,width,height}))(e.getBoundingClientRect()) : null;
+ const brandSel = '.brand-mark,.wordmark-logo,.header-logo,.dn-rail-full,.nxt-brand-mark,.agent-header-logo,.pg-header-logo,[data-brand-mark]';
+ const named = [...document.querySelectorAll(brandSel)].filter(e => !e.closest('.brand-mark-chip'));
+ return {
+ chip: r(chip),
+ chipZ: chip && getComputedStyle(chip).zIndex,
+ nav: r(nav),
+ navZ: nav && getComputedStyle(nav).zIndex,
+ namedBrands: named.map(e => ({ cls: e.className && String(e.className).slice(0,60), rect: r(e), disp: getComputedStyle(e).display, vis: getComputedStyle(e).visibility })),
+ };
+});
+console.log(JSON.stringify(out, null, 2));
+await b.close();
diff --git a/tests/api/x402-settle-health.test.js b/tests/api/x402-settle-health.test.js
index 563fa99a0..7a315d9b0 100644
--- a/tests/api/x402-settle-health.test.js
+++ b/tests/api/x402-settle-health.test.js
@@ -208,3 +208,96 @@ describe('classifySettleBuckets — verdict from real bucket shapes', () => {
expect(degraded.status).toBe('degraded');
});
});
+
+// ── The 2026-08-01 fee_runway_exhausted wave ────────────────────────────────
+// The shape: the wallet fee governor spends the fee wallet's daily SOL budget,
+// then refuses every remaining settle of the day. Measured on production that
+// morning: 85,265 governed refusals against 562 rail-shaped failures, a settle
+// rate of 25.9%, and a `rail` verdict whose hint sent the reader to the
+// facilitator to debug duplicate signatures. The money answer (fund the fee
+// wallet) was nowhere in the output.
+//
+// Both regimes below are the SAME condition and want the SAME action, so both
+// must name it. Before the caller-side admission check the refusal came back as
+// an http_502 and inflated the fault count; after it, the ring skips the call
+// and the counts collapse toward zero instead. A sensor that only understood the
+// first regime would go quiet exactly when the fix landed.
+describe('classifySettleBuckets: a governed throttle is not a rail fault', () => {
+ it('names the fee governor when its skips outnumber the rail faults', () => {
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 60 },
+ { success: false, paid: false, reason: 'fee_runway_exhausted', n: 900 },
+ { success: false, paid: true, reason: 'http_502', n: 40 },
+ ]);
+ expect(v.cause).toBe('fee_governor');
+ expect(v.governorSkips).toBe(900);
+ // The skips stay out of the rate: they are not attempts that failed, they
+ // are calls we chose not to make.
+ expect(v.settled).toBe(60);
+ expect(v.faults).toBe(40);
+ expect(v.detail).toMatch(/900 call\(s\) paced by the fee governor/);
+ expect(v.hint).toMatch(/GOVERNED THROTTLE/);
+ expect(v.hint).toMatch(/runway-lab/);
+ // It must not send anyone at the facilitator or at the sponsor floor knob.
+ expect(v.hint).not.toMatch(/Payments are being rejected at settle/);
+ expect(v.hint).toMatch(/do NOT lower the sponsor floor/i);
+ });
+
+ it('reports DEGRADED, not UNKNOWN, when pacing is why there is nothing to judge', () => {
+ // The post-fix regime: the caller-side admission check skips the calls, so
+ // attempts fall under MIN_ATTEMPTS. `unknown` here would hide a rail that
+ // is 100% paced shut behind the same verdict a sleeping ring gets.
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 4 },
+ { success: false, paid: false, reason: 'fee_runway_exhausted', n: 1200 },
+ ]);
+ expect(v.status).toBe('degraded');
+ expect(v.cause).toBe('fee_governor');
+ expect(v.rate).toBeNull();
+ expect(v.detail).toMatch(/1200 call\(s\) skipped by the wallet fee governor/);
+ });
+
+ it('a genuinely idle ring still reads UNKNOWN, a few skips are the governor working', () => {
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 3 },
+ { success: false, paid: false, reason: 'fee_runway_exhausted', n: 6 },
+ ]);
+ expect(v.status).toBe('unknown');
+ expect(v.governorSkips).toBe(6);
+ });
+
+ it('the hard SOL floor outranks the governor when both are lit', () => {
+ // Both want SOL in the same wallet, but under the floor every settle fails
+ // closed while a spent budget still settles at the paced rate. Report the
+ // harder stop.
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 20 },
+ { success: false, paid: false, reason: 'http_502', n: 40 },
+ { success: false, paid: false, reason: 'fee_wallet_below_floor', n: 2 },
+ { success: false, paid: false, reason: 'fee_runway_exhausted', n: 500 },
+ ]);
+ expect(v.cause).toBe('sponsor_floor');
+ expect(v.governorSkips).toBe(500);
+ });
+
+ it('pacing under a healthy rate stays OK and still reports the skip count', () => {
+ // The steady state this fix is aiming for: a small, funded budget paced
+ // across the day, everything it admits settling cleanly.
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 248 },
+ { success: false, paid: true, reason: 'http_502', n: 6 },
+ { success: false, paid: false, reason: 'fee_runway_exhausted', n: 3100 },
+ ]);
+ expect(v.status).toBe('ok');
+ expect(v.rate).toBeGreaterThan(0.9);
+ expect(v.governorSkips).toBe(3100);
+ expect(v.detail).toMatch(/3100 paced by the fee governor/);
+ });
+
+ it('the governor reason is never counted as a rail fault, in any variant', () => {
+ // pay.js records the reason with its arithmetic appended; the SQL bucket
+ // splits on ':' so the sensor sees the bare token. Cover both.
+ expect(isRailFault('fee_runway_exhausted')).toBe(false);
+ expect(isRailFault('fee_runway_exhausted:10022298+10000>10000000')).toBe(false);
+ });
+});