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.

docs(guards): register the API import sweep in the guard registry with a proof that it catches a load-time throw

nirholasd7b204ea6264
diff --git a/data/guards.json b/data/guards.json
index 8d1426f9e..0857d8b33 100644
--- a/data/guards.json
+++ b/data/guards.json
@@ -129,6 +129,27 @@
"expect": "guard-proof-link.md"
}
},
+ {
+ "id": "check-api-imports",
+ "script": "scripts/check-api-imports.mjs",
+ "npm": "check:api-imports",
+ "title": "Every API module loads",
+ "protects": "Every handler and shared module under api/ importing without throwing.",
+ "why": "The server imports a handler the first time its route is hit, so a module that throws while loading is not a build error or a boot error. It is a 500 on every request to that route. On 2026-09-18 two merged dependency bumps did exactly that to the paid x402 surface while the build and a stale local test tree both stayed green.",
+ "stages": [
+ "deploy:submit"
+ ],
+ "needs": "none",
+ "proof": {
+ "summary": "A shared API module that throws at load time, the way a dependency with a changed constructor does.",
+ "violation": {
+ "write": {
+ "api/_lib/guard-proof-throws-on-load.js": "throw new Error('guard proof: this module throws while loading');\n"
+ }
+ },
+ "expect": "guard-proof-throws-on-load.js"
+ }
+ },
{
"id": "audit-docs",
"script": "scripts/audit-docs.mjs",
diff --git a/docs/guards.md b/docs/guards.md
index 93bc33341..2ac6675ff 100644
--- a/docs/guards.md
+++ b/docs/guards.md
@@ -163,6 +163,7 @@ Run `npm run audit:guards` to print the current count and per-stage breakdown. T
| Bootstrap ordering | `npm run check:tdz-bootstrap` | No page calls its own entry point above the state that entry point writes, which renders fine in Chrome and throws in every Safari. |
| Build output shape | `npm run check:dist` | `dist/` contains every artifact the deploy expects. |
| Deploy artifact preflight | `npm run audit:deploy` | The artifact failure classes that have taken production down. |
+| Every API module loads | `npm run check:api-imports` | Every handler and shared module under `api/` importing without throwing, since a load-time throw is a 500 on every request to that route rather than a build error. |
| Cloud Build upload | `npm run check:gcloudignore` | What `gcloud builds submit` would actually upload. |
### Runtime, assets, and money
diff --git a/public/guards.json b/public/guards.json
index 8d1426f9e..0857d8b33 100644
--- a/public/guards.json
+++ b/public/guards.json
@@ -129,6 +129,27 @@
"expect": "guard-proof-link.md"
}
},
+ {
+ "id": "check-api-imports",
+ "script": "scripts/check-api-imports.mjs",
+ "npm": "check:api-imports",
+ "title": "Every API module loads",
+ "protects": "Every handler and shared module under api/ importing without throwing.",
+ "why": "The server imports a handler the first time its route is hit, so a module that throws while loading is not a build error or a boot error. It is a 500 on every request to that route. On 2026-09-18 two merged dependency bumps did exactly that to the paid x402 surface while the build and a stale local test tree both stayed green.",
+ "stages": [
+ "deploy:submit"
+ ],
+ "needs": "none",
+ "proof": {
+ "summary": "A shared API module that throws at load time, the way a dependency with a changed constructor does.",
+ "violation": {
+ "write": {
+ "api/_lib/guard-proof-throws-on-load.js": "throw new Error('guard proof: this module throws while loading');\n"
+ }
+ },
+ "expect": "guard-proof-throws-on-load.js"
+ }
+ },
{
"id": "audit-docs",
"script": "scripts/audit-docs.mjs",
diff --git a/scripts/check-api-imports.mjs b/scripts/check-api-imports.mjs
index 0ac13ac03..16344f792 100644
--- a/scripts/check-api-imports.mjs
+++ b/scripts/check-api-imports.mjs
@@ -106,7 +106,7 @@ if (isMain) {
if (failed.length > 8) console.error(` ... and ${failed.length - 8} more`);
}
console.error(
- `\n[check:api-imports] failed in ${elapsed}s. A dependency error usually means node_modules is behind package-lock.json (run \`npm install\`) or a bump changed an API.`,
+ `\n[check:api-imports] failed in ${elapsed}s. A dependency error usually means node_modules is behind package-lock.json (run \`npm install\`) or a bump changed an API. An ENOENT under data/_generated/ means the build has not run in this tree: that directory is written by \`prebuild\`, which is why this gate sits after build:gcp.`,
);
process.exit(1);
}