Skip to content
23 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The artifacts service is services/artifacts, the Worker g1t-artifacts, bound as ARTIFACTS by the API, the site and the agents; its live rooms move to it with a Durable Object transfer from g1t-docs-service, and its database, bucket, indexes and queue keep their names. The git store's binding and settings are GITSTORE, its ops scripts gitstore-*, and workflow run artifacts keep their compatible API under run_artifacts modules. The deploy tool puts a Worker that has never deployed before the Workers in its stage that bind to it, and the deploy guide gives the cutover runbook.1import assert from "node:assert/strict";
2import { readFileSync } from "node:fs";
3import { test } from "node:test";
4
5import { FOLIO_RPC, folioHandler } from "./rpc.ts";
6
7/** FOLIO_RPC_METHODS as the contract lists them (read from the source: Node can't load the contracts package itself). */
8function contractMethods(): string[] {
9 const source = readFileSync(new URL("../../../../packages/contracts/src/folios.ts", import.meta.url), "utf8");
10 const block = source.slice(source.indexOf("export const FOLIO_RPC_METHODS = ["), source.indexOf("] as const;"));
11 return [...block.matchAll(/^\s*"([a-z_]+)",/gm)].map((m) => m[1]!);
12}
13
14test("every folio RPC method in the contract is answered, and nothing else", () => {
15 const methods = contractMethods();
16 assert.ok(methods.length >= 40);
17 assert.deepEqual(Object.keys(FOLIO_RPC).sort(), [...methods].sort());
18 for (const m of methods) assert.equal(typeof folioHandler(m), "function", m);
19});
20
21test("Docs' own methods fall through to the legacy switch", () => {
22 for (const m of ["sidebar", "page", "create_page", "recall_for_agent", "toString", "__proto__", "constructor"]) assert.equal(folioHandler(m), null, m);
23});