What every repo is checked and tested with lives here, and stdlib stands alone
Misha Kaletsky, 2026-11-25 21:48 UTC · d42dd04cb67704346c29227689a1bcd53677f0c0 · parent 01d459b
9 files changed
- A .gitignore
- M context-descriptions.ts
- A files.d.ts
- M package.json
- A pnpm-lock.yaml
- A testing/mind-loader.mjs
- M tests/context-descriptions.test.mjs
- A tsconfig.base.json
- M tsconfig.json
A .gitignore
@@ -0,0 +1,1 @@ +node_modules/
M context-descriptions.ts
@@ -59,10 +59,10 @@ "The agent, and what the wiring calls at each publish and each event. A push to main publishes the mind.", }, { - path: "/repos/home", - title: "Home repo", + path: "/repos/task-board", + title: "Task board repo", description: - "The folder the other repos are cloned into on a laptop: its README says how they link. Its todo/ holds the Tasks board's files.", + "The Tasks board's files, and nothing else: each markdown file under todo/ is a task. A push changes no code.", }, { path: "/repos/kernel",
A files.d.ts
@@ -0,0 +1,15 @@ +// What a module of the repos gets when it imports a file that is not code: the mind's loader makes +// a file its text, or its bytes when it is not text, and a folder (an import that ends in `/`) +// every file under it, by path. +declare module "*.html" { + const text: string; + export default text; +} +declare module "*.css" { + const text: string; + export default text; +} +declare module "*/" { + const files: Record<string, string | Uint8Array>; + export default files; +}
M package.json
@@ -1,5 +1,15 @@ { "name": "@repos/stdlib", "private": true, - "type": "module" + "type": "module", + "scripts": { + "typecheck": "tsc -p .", + "test": "node --test agent-tests/*.test.mjs agent-kinds/*.test.mjs tests/*.test.mjs" + }, + "devDependencies": { + "@cloudflare/workers-types": "^5.20261103.1", + "iterate": "link:../kernel/core/lib", + "typescript": "^7.0.2", + "zod": "4.6.5" + } }
A pnpm-lock.yaml
@@ -0,0 +1,244 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@cloudflare/workers-types': + specifier: ^5.20261103.1 + version: 5.20261124.2 + iterate: + specifier: link:../kernel/core/lib + version: link:../kernel/core/lib + typescript: + specifier: ^7.0.2 + version: 7.0.2 + zod: + specifier: 4.6.5 + version: 4.6.5 + +packages: + + '@cloudflare/workers-types@5.20261124.2': + resolution: {integrity: sha512-zgpqEeenF5zm6Riayxxt5GQZUPGGxw6OgDEVISnFoojBx/13wR0F14/SXiQpH+vsSlp+sT5jgMgF+7Kfsm253w==} + + '@typescript/typescript-aix-ppc64@7.0.2': + resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==} + engines: {node: '>=16.20.0'} + cpu: [ppc64] + os: [aix] + + '@typescript/typescript-darwin-arm64@7.0.2': + resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [darwin] + + '@typescript/typescript-darwin-x64@7.0.2': + resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [darwin] + + '@typescript/typescript-freebsd-arm64@7.0.2': + resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [freebsd] + + '@typescript/typescript-freebsd-x64@7.0.2': + resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [freebsd] + + '@typescript/typescript-linux-arm64@7.0.2': + resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [linux] + + '@typescript/typescript-linux-arm@7.0.2': + resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==} + engines: {node: '>=16.20.0'} + cpu: [arm] + os: [linux] + + '@typescript/typescript-linux-loong64@7.0.2': + resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==} + engines: {node: '>=16.20.0'} + cpu: [loong64] + os: [linux] + + '@typescript/typescript-linux-mips64el@7.0.2': + resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==} + engines: {node: '>=16.20.0'} + cpu: [mips64el] + os: [linux] + + '@typescript/typescript-linux-ppc64@7.0.2': + resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==} + engines: {node: '>=16.20.0'} + cpu: [ppc64] + os: [linux] + + '@typescript/typescript-linux-riscv64@7.0.2': + resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==} + engines: {node: '>=16.20.0'} + cpu: [riscv64] + os: [linux] + + '@typescript/typescript-linux-s390x@7.0.2': + resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==} + engines: {node: '>=16.20.0'} + cpu: [s390x] + os: [linux] + + '@typescript/typescript-linux-x64@7.0.2': + resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [linux] + + '@typescript/typescript-netbsd-arm64@7.0.2': + resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [netbsd] + + '@typescript/typescript-netbsd-x64@7.0.2': + resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [netbsd] + + '@typescript/typescript-openbsd-arm64@7.0.2': + resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [openbsd] + + '@typescript/typescript-openbsd-x64@7.0.2': + resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [openbsd] + + '@typescript/typescript-sunos-x64@7.0.2': + resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [sunos] + + '@typescript/typescript-win32-arm64@7.0.2': + resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==} + engines: {node: '>=16.20.0'} + cpu: [arm64] + os: [win32] + + '@typescript/typescript-win32-x64@7.0.2': + resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==} + engines: {node: '>=16.20.0'} + cpu: [x64] + os: [win32] + + typescript@7.0.2: + resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} + engines: {node: '>=16.20.0'} + hasBin: true + + zod@4.6.5: + resolution: {integrity: sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==} + +snapshots: + + '@cloudflare/workers-types@5.20261124.2': {} + + '@typescript/typescript-aix-ppc64@7.0.2': + optional: true + + '@typescript/typescript-darwin-arm64@7.0.2': + optional: true + + '@typescript/typescript-darwin-x64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-x64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm@7.0.2': + optional: true + + '@typescript/typescript-linux-loong64@7.0.2': + optional: true + + '@typescript/typescript-linux-mips64el@7.0.2': + optional: true + + '@typescript/typescript-linux-ppc64@7.0.2': + optional: true + + '@typescript/typescript-linux-riscv64@7.0.2': + optional: true + + '@typescript/typescript-linux-s390x@7.0.2': + optional: true + + '@typescript/typescript-linux-x64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-sunos-x64@7.0.2': + optional: true + + '@typescript/typescript-win32-arm64@7.0.2': + optional: true + + '@typescript/typescript-win32-x64@7.0.2': + optional: true + + typescript@7.0.2: + optionalDependencies: + '@typescript/typescript-aix-ppc64': 7.0.2 + '@typescript/typescript-darwin-arm64': 7.0.2 + '@typescript/typescript-darwin-x64': 7.0.2 + '@typescript/typescript-freebsd-arm64': 7.0.2 + '@typescript/typescript-freebsd-x64': 7.0.2 + '@typescript/typescript-linux-arm': 7.0.2 + '@typescript/typescript-linux-arm64': 7.0.2 + '@typescript/typescript-linux-loong64': 7.0.2 + '@typescript/typescript-linux-mips64el': 7.0.2 + '@typescript/typescript-linux-ppc64': 7.0.2 + '@typescript/typescript-linux-riscv64': 7.0.2 + '@typescript/typescript-linux-s390x': 7.0.2 + '@typescript/typescript-linux-x64': 7.0.2 + '@typescript/typescript-netbsd-arm64': 7.0.2 + '@typescript/typescript-netbsd-x64': 7.0.2 + '@typescript/typescript-openbsd-arm64': 7.0.2 + '@typescript/typescript-openbsd-x64': 7.0.2 + '@typescript/typescript-sunos-x64': 7.0.2 + '@typescript/typescript-win32-arm64': 7.0.2 + '@typescript/typescript-win32-x64': 7.0.2 + + zod@4.6.5: {}
A testing/mind-loader.mjs
@@ -0,0 +1,67 @@ +// mind-loader.mjs — WHAT THE MIND'S LOADER GIVES A MODULE, FOR NODE: a test of any repo imports +// this file first (`import "@repos/stdlib/testing/mind-loader.mjs"`) when it loads a module that +// the mind loads (an app.ts, worker.ts). In the mind a file that is not code is imported as its +// text, a folder (an import that ends in `/`) as every file under it by path, and +// `cloudflare:workers` is the runtime's own module. Node has none of the three: the hooks below +// give the first two as the loader does, and for the third the base classes alone, which hold +// what they are given. ../files.d.ts says the same to the type checker. A file of another repo is +// `@repos/<name>/<path>`: Node finds the repo where the importing repo's install linked it. +import { readdirSync, readFileSync } from "node:fs"; +import { registerHooks } from "node:module"; +import { fileURLToPath } from "node:url"; + +const WORKERS = "mind-loader:cloudflare-workers"; + +// Where a file or a folder of a repo is on this disk, as a URL: `./x` and `../x` beside the +// importer, and `@repos/<name>/x` in the folder that an install linked as that package. +// Undefined for any other import. +function fileOf(specifier, context, next) { + if (specifier.startsWith("./") || specifier.startsWith("../")) + return new URL(specifier, context.parentURL).href; + const named = /^(@repos\/[^/]+)\/(.*)$/.exec(specifier); + if (named) return new URL(named[2], next(`${named[1]}/package.json`, context).url).href; +} + +registerHooks({ + resolve(specifier, context, next) { + if (specifier === "cloudflare:workers") return { url: WORKERS, shortCircuit: true }; + const kind = specifier.endsWith("/") ? "folder" : /\.(html|css)$/.test(specifier) ? "text" : ""; + const file = kind && fileOf(specifier, context, next); + if (file) return { url: `${file}?${kind}`, shortCircuit: true }; + return next(specifier, context); + }, + load(url, context, next) { + if (url === WORKERS) + return { + format: "module", + shortCircuit: true, + source: ` + class Held { constructor(ctx, env) { this.ctx = ctx; this.env = env; } } + export class WorkerEntrypoint extends Held {} + export class DurableObject extends Held {} + export class RpcTarget {} + export class RpcStub {} + export const env = {}; + export const waitUntil = () => {}; + `, + }; + if (url.endsWith("?text")) { + const text = readFileSync(fileURLToPath(url.slice(0, -"?text".length)), "utf8"); + return { format: "module", shortCircuit: true, source: `export default ${JSON.stringify(text)};` }; + } + if (url.endsWith("?folder")) { + const dir = fileURLToPath(url.slice(0, -"?folder".length)); + const files = Object.fromEntries( + readdirSync(dir, { recursive: true, withFileTypes: true }) + .filter((entry) => entry.isFile()) + .map((entry) => { + const path = `${entry.parentPath.replace(/\/$/, "")}/${entry.name}`; + return [path.slice(dir.length), readFileSync(path, "utf8")]; + }) + .sort(([a], [b]) => a.localeCompare(b)), + ); + return { format: "module", shortCircuit: true, source: `export default ${JSON.stringify(files)};` }; + } + return next(url, context); + }, +});
M tests/context-descriptions.test.mjs
@@ -53,7 +53,7 @@ "/agents/email", "/repos/config", "/repos/stdlib", - "/repos/home", + "/repos/task-board", "/repos/kernel", "/secrets", "/integrations/email",
A tsconfig.base.json
@@ -0,0 +1,18 @@ +{ + // The settings every repo of a mind is type-checked with: a repo's tsconfig.json extends this + // file by its name, "@repos/stdlib/tsconfig.base.json", and names its own files. They are a + // Worker's settings. A page's script (a .js file under a repo's public/) is a browser's and is + // not checked. + "compilerOptions": { + "target": "es2024", + "lib": ["esnext"], + "module": "esnext", + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "noEmit": true, + "strict": true, + "skipLibCheck": true, + "types": ["@cloudflare/workers-types"] + }, + "files": ["./files.d.ts"] +}
M tsconfig.json
@@ -1,4 +1,4 @@ { - "extends": "../tsconfig.base.json", + "extends": "./tsconfig.base.json", "include": ["**/*.ts"] }