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.

fix(docs-viewer): route cross-doc section links and relative code citations

nirholas81e4dc117ce0
diff --git a/docs/agora.md b/docs/agora.md
index 3b277c8b1..918e6e552 100644
--- a/docs/agora.md
+++ b/docs/agora.md
@@ -190,7 +190,10 @@ Rendered on the City substrate. Citizens are avatars; the economy is legible at
a glance:
- A **job board** building in the square; open tasks glow above it, colored by
- profession, sized by reward.
+ profession, sized by reward. The board is bounded on purpose: the x402 lane is
+ a live catalog of hundreds of services, so the markers go to the highest-value
+ work (on-chain bounties first, then reward order) and the roster states how
+ many more are open rather than silently dropping them.
- A citizen **walking to claim** a job; a **Busy** ring while it works.
- On completion, the **deliverable materializes** — a Sculptor's GLB pops onto a
plinth you can orbit; a **$THREE coin arc** flows from escrow to the worker; a
diff --git a/docs/index.html b/docs/index.html
index 20d4479a6..0c45f48f3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1297,12 +1297,35 @@
a.href = '#' + path + '@' + h.slice(1);
return;
}
- if (h.endsWith('.md')) {
- const abs = new URL(h, location.origin + '/docs/' + path).pathname;
+ // "guide.md#section" is one link, not two: split the heading off so a
+ // cross-doc link that also targets a section routes to the doc AND
+ // scrolls, instead of failing the .md test and rendering unrewritten.
+ const hashAt = h.indexOf('#');
+ const target = hashAt === -1 ? h : h.slice(0, hashAt);
+ const section = hashAt === -1 ? '' : h.slice(hashAt + 1);
+ if (target.endsWith('.md')) {
+ const abs = new URL(target, location.origin + '/docs/' + path).pathname;
if (abs.startsWith('/docs/')) {
- a.href = '#' + abs.slice('/docs/'.length).replace(/\.md$/, '');
+ const doc = abs.slice('/docs/'.length).replace(/\.md$/, '');
+ a.href = '#' + doc + (section ? '@' + section : '');
} else {
- a.href = REPO + abs;
+ a.href = REPO + abs + (section ? '#' + section : '');
+ a.target = '_blank';
+ a.rel = 'noopener';
+ }
+ return;
+ }
+ // A relative link to repo source (../api/_lib/x402-spec.js,
+ // ../../scripts/deploy.mjs). Docs cite code constantly, and the
+ // viewer serves docs, not the tree, so these resolve against
+ // /docs/ into site paths that do not exist and 404 the reader.
+ // Anything landing outside /docs/ goes to the file on GitHub.
+ // Site-absolute links (/forge, /docs/img/x.png) are real routes and
+ // are left alone.
+ if (target.startsWith('.')) {
+ const abs = new URL(target, location.origin + '/docs/' + path).pathname;
+ if (!abs.startsWith('/docs/')) {
+ a.href = REPO + abs + (section ? '#' + section : '');
a.target = '_blank';
a.rel = 'noopener';
}