{"draft":null,"from":287,"to":318,"files":[{"path":"client/avcs.ts","added":21,"removed":3,"diff":"--- a/client/avcs.ts\n+++ b/client/avcs.ts\n@@ -3,15 +3,33 @@\n // `abso help` lists the commands. `abso hook` is the Claude Code hook; it\n // loads only what it needs, since every edit pays for its start-up.\n \n+import { readFileSync } from \"node:fs\";\n import * as nodeModule from \"node:module\";\n+import { dirname, join } from \"node:path\";\n \n+const argv = process.argv.slice(2);\n+\n+/**\n+ * Whether this command opens a local project (abso init --local): --local, or a folder whose config names the server\n+ * \"local\". Those load the open server's code through a module hook, and with the compile cache on Node 24 crashes.\n+ */\n+function opensLocal(): boolean {\n+\tif (argv.includes(\"--local\")) return true;\n+\tfor (let dir = process.cwd(); ; dir = dirname(dir)) {\n+\t\tfor (const state of [\".abso\", \".avcs\"]) {\n+\t\t\ttry {\n+\t\t\t\treturn /\"server\"\\s*:\\s*\"local\"/.test(readFileSync(join(dir, state, \"config.json\"), \"utf8\"));\n+\t\t\t} catch {}\n+\t\t}\n+\t\tif (dirname(dir) === dir) return false;\n+\t}\n+}\n+\n // Node keeps the compiled modules (TypeScript already stripped) in a cache in\n // the temp folder. Loading the hook's modules drops from about 55 ms to 11 ms.\n // Node 20 has no compile cache, and the built client runs there without one.\n-(nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();\n+if (!opensLocal()) (nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();\n \n-const argv = process.argv.slice(2);\n-\n if (argv[0] === \"hook\") {\n \tconst { runHook } = await import(\"./src/hook.ts\");\n \tconst chunks: Buffer[] = [];"},{"path":"client/hooks/register.test.ts","added":38,"removed":2,"diff":"--- a/client/hooks/register.test.ts\n+++ b/client/hooks/register.test.ts\n@@ -3,9 +3,10 @@\n \n import type { On } from \"claude-code\";\n import { expect, mock, test } from \"claude-code/testing\";\n+import { HOOK_COMMAND } from \"./stamp.ts\";\n \n /** The world beneath the mod: a chat in /w/p, an abso folder when `inFolder`, and a server with `news` waiting. */\n-function world(on: On, inFolder: boolean, news: string[][]) {\n+function world(on: On, inFolder: boolean, news: string[][], server = \"https://avcs.test\") {\n \tmock.env(on, { AVCS_TOKEN: \"test-token\" });\n \tconst clock = mock.clock(on, { now: 1_000_000 });\n \tconst asked: string[] = [];\n@@ -21,7 +22,7 @@\n \ton(\"fs.read\", (_$, e) => {\n \t\tconst path = norm(e.path);\n \t\tif (inFolder && path === \"/w/p/.abso/config.json\")\n-\t\t\treturn { value: JSON.stringify({ server: \"https://avcs.test\", project: \"p\", agent: \"bob\" }) };\n+\t\t\treturn { value: JSON.stringify({ server, project: \"p\", agent: \"bob\" }) };\n \t\tif (written.has(path)) return { value: written.get(path)! };\n \t\treturn { deny: `ENOENT: ${path}` };\n \t});\n@@ -114,3 +115,38 @@\n \texpect(w.written.get(\"/w/p/.abso/hook.log\") ?? \"\").toContain(\"not sent: a NUL byte at line 3\");\n \texpect(w.asked.filter((u) => !u.endsWith(\"/news\"))).toEqual([]);\n });\n+\n+test(\"a local project's edit goes to abso hook as Claude Code's command hook would get it, and its news to the chat\", async ($, on) => {\n+\tconst w = world(on, true, [], \"local\");\n+\tw.written.set(\"/w/p/notes.md\", \"hello\\n\");\n+\ton(\"fs.stat\", () => ({ value: { realPath: \"/w/p/notes.md\" } }) as never);\n+\ton(\"session.id\", () => ({ value: \"sess\" }));\n+\tconst ran: { argv: readonly string[]; stdin?: string; env?: Record<string, string> }[] = [];\n+\tconst context = \"abso: Announcement from lead: hold pushes\";\n+\ton(\"process.run\", (_$, e) => {\n+\t\tran.push({ argv: e.argv, stdin: e.init?.stdin, env: e.init?.env });\n+\t\tconst stdout = JSON.stringify({ hookSpecificOutput: { hookEventName: \"PostToolUse\", additionalContext: context } });\n+\t\treturn { value: { exitCode: 0, stdout, stderr: \"\" } } as never;\n+\t});\n+\tawait $.session.start({ cwd: \"/w/p\" });\n+\tawait $.tool.call({ tool: \"Write\", tool_use_id: \"t1\", file_path: \"/w/p/notes.md\", content: \"hello\\n\" } as never);\n+\tawait w.clock.advance(1_000);\n+\t// A local project has no server to call: nothing goes over the network.\n+\texpect(w.asked.filter((u) => !u.endsWith(\"/news\"))).toEqual([]);\n+\tconst log = w.written.get(\"/w/p/.abso/hook.log\") ?? \"\";\n+\tif (HOOK_COMMAND === undefined) {\n+\t\t// Loaded from a checkout, the mod has no client to hand it to.\n+\t\texpect(ran).toEqual([]);\n+\t\texpect(log).toContain(\"skipped: a local project\");\n+\t\treturn;\n+\t}\n+\texpect(ran).toHaveLength(1);\n+\texpect(ran[0]!.argv).toEqual(HOOK_COMMAND);\n+\texpect(ran[0]!.env).toEqual({ ABSO_HOOK_FORCE: \"1\" });\n+\tconst input = JSON.parse(ran[0]!.stdin ?? \"{}\") as Record<string, unknown>;\n+\texpect(input.session_id).toBe(\"sess\");\n+\texpect(input.tool_name).toBe(\"Write\");\n+\texpect((input.tool_input as Record<string, unknown>).file_path).toBe(\"/w/p/notes.md\");\n+\texpect(log).toContain(\"handed to abso hook\");\n+\texpect(w.appended).toEqual([context]);\n+});"},{"path":"client/hooks/register.ts","added":45,"removed":5,"diff":"--- a/client/hooks/register.ts\n+++ b/client/hooks/register.ts\n@@ -33,7 +33,7 @@\n \tuncomposedText,\n \ttype Who,\n } from \"../src/core.ts\";\n-import { STAMP } from \"./stamp.ts\";\n+import { HOOK_COMMAND, STAMP } from \"./stamp.ts\";\n \n const TOOLS = [\"Edit\", \"MultiEdit\", \"Write\", \"NotebookEdit\"];\n /** A known copy holding a NUL byte reads as no known copy (the client treats it as binary). */\n@@ -184,19 +184,22 @@\n \n /** A local project's folder (abso init --local): its config names no server. */\n const LOCAL_FOLDER = /\"server\"\\s*:\\s*\"local\"/;\n+/** How long abso hook may take on a local project's edit: it waits up to two minutes for the store's lock. */\n+const LOCAL_HOOK_MS = 150_000;\n \n async function run($: Engine, job: Job): Promise<void> {\n \tconst started = await $.clock.now().catch(() => job.queuedAt);\n \tlet outcome: string;\n \tlet news: readonly string[] = [];\n+\t/** What abso hook handed back for the agent, on a local project's edit (it keeps the news log itself). */\n+\tlet handed: string | undefined;\n \ttry {\n \t\tif ((await readOr($, `${await stateOf($, job.root)}/paused`)) !== undefined) {\n \t\t\toutcome = \"skipped: recording is paused (abso resume)\";\n \t\t} else if (/\"reader\"\\s*:\\s*true/.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? \"\")) {\n \t\t\toutcome = \"skipped: this folder is a reader\";\n \t\t} else if (LOCAL_FOLDER.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? \"\")) {\n-\t\t\t// A local project's history is in a store on this machine, which only the abso command opens.\n-\t\t\toutcome = \"skipped: a local project; abso record sends its edits\";\n+\t\t\t({ outcome, context: handed } = await handToClient($, job));\n \t\t} else if (await ignored($, job.root, job.rel)) {\n \t\t\toutcome = \"skipped: ignored path\";\n \t\t} else if (await isLink($, job.root, job.rel)) {\n@@ -217,11 +220,11 @@\n \t\tjob.root,\n \t\t`${new Date(job.queuedAt).toISOString()}\\t${job.tool}\\t${job.rel}\\t${outcome}\\t${done - started}ms sending, ${started - job.queuedAt}ms queued (in process, async)\\t${CLIENT}`,\n \t);\n-\tconst context = newsContext(news);\n+\tconst context = handed ?? newsContext(news);\n \tif (context === undefined) return;\n \t// For anything that shows news later (the avcs-view mod reads it).\n \tconst at = new Date(done).toISOString();\n-\tawait log($, job.root, news.map((n) => `${at}\\t${n}`).join(\"\\n\"), \"news.log\");\n+\tif (news.length > 0) await log($, job.root, news.map((n) => `${at}\\t${n}`).join(\"\\n\"), \"news.log\");\n \ttry {\n \t\tawait $.session.append({\n \t\t\tmessage: { type: \"user\", content: [{ type: \"text\", text: context }] },\n@@ -234,6 +237,43 @@\n \t}\n }\n \n+/**\n+ * A local project's history is in a store on this machine that only the abso command opens, so its edits go to\n+ * `abso hook` from the checkout this mod was installed from, as Claude Code's command hook would run it.\n+ */\n+async function handToClient($: Engine, job: Job): Promise<{ outcome: string; context?: string }> {\n+\tif (HOOK_COMMAND === undefined || HOOK_COMMAND.length === 0)\n+\t\treturn {\n+\t\t\toutcome:\n+\t\t\t\t\"skipped: a local project, and this mod has no abso to hand it to (install-mod.ts adds one); abso record sends it\",\n+\t\t};\n+\tconst hookInput = {\n+\t\tsession_id: await $.session.id(),\n+\t\tcwd: slash(await $.session.cwd()),\n+\t\ttool_name: job.tool,\n+\t\ttool_input: job.input,\n+\t\t...(job.agentId ? { agent_id: job.agentId } : {}),\n+\t};\n+\tconst ran = await $.process.run(HOOK_COMMAND, {\n+\t\tcwd: job.root,\n+\t\tenv: { ABSO_HOOK_FORCE: \"1\" },\n+\t\tstdin: JSON.stringify(hookInput),\n+\t\ttimeoutMs: LOCAL_HOOK_MS,\n+\t});\n+\tif (ran.exitCode !== 0) throw new Error(`abso hook exited ${ran.exitCode}: ${ran.stderr.trim().split(\"\\n\").at(-1)}`);\n+\t// It prints Claude Code's JSON when it has news for the agent, and nothing otherwise.\n+\tconst out = ran.stdout.trim();\n+\tconst context =\n+\t\tout === \"\"\n+\t\t\t? undefined\n+\t\t\t: (JSON.parse(out) as { hookSpecificOutput?: { additionalContext?: unknown } }).hookSpecificOutput\n+\t\t\t\t\t?.additionalContext;\n+\treturn {\n+\t\toutcome: \"handed to abso hook (a local project; its own line is just above)\",\n+\t\t...(typeof context === \"string\" ? { context } : {}),\n+\t};\n+}\n+\n /** Ask for the news waiting for this agent (announcements, collisions) and hand it to the model. */\n async function pollNews($: Engine, root: string): Promise<void> {\n \ttry {"},{"path":"client/hooks/stamp.ts","added":6,"removed":0,"diff":"--- a/client/hooks/stamp.ts\n+++ b/client/hooks/stamp.ts\n@@ -3,3 +3,9 @@\n // this file with the version it installs: plugin.json's, plus the commit\n // (0.1.0+702c616). Loaded straight from a checkout, it stays undefined.\n export const STAMP: string | undefined = undefined;\n+\n+// The command that runs `abso hook` from the checkout the mod was installed\n+// from, as [node, client/abso.ts, \"hook\"]; the installer writes it too. A\n+// local project's history is in a store on this machine that only the abso\n+// command opens, so the mod hands those edits to it.\n+export const HOOK_COMMAND: readonly string[] | undefined = undefined;"},{"path":"client/src/announce.ts","added":2,"removed":0,"diff":"--- a/client/src/announce.ts\n+++ b/client/src/announce.ts\n@@ -107,6 +107,8 @@\n \t\ttry {\n \t\t\tconst ended = await follow({\n \t\t\t\tmint: () => api.newsTicket(),\n+\t\t\t\t// A frame is a wake: read the news, which marks it heard, and print that (news-stream.ts).\n+\t\t\t\ttake: async () => newsLines((await api.news()).news),\n \t\t\t\tconnect: (url, protocols) => new WebSocket(url, [...protocols]) as unknown as Socket,\n \t\t\t\twrite: (line) => {\n \t\t\t\t\tlogNews(root, [line]);"},{"path":"client/src/ci.ts","added":50,"removed":4,"diff":"--- a/client/src/ci.ts\n+++ b/client/src/ci.ts\n@@ -80,6 +80,43 @@\n \treturn lines;\n }\n \n+/** A stored pipeline run as runRuns lists it: what the CI lines need of it. */\n+interface StoredRun {\n+\treadonly id: number;\n+\treadonly version: number;\n+\treadonly state: string;\n+\treadonly file: string;\n+}\n+\n+/** The stored pipeline runs, newest first, from the server's `pipelines` read; empty for anything else. */\n+export function storedRuns(raw: unknown): StoredRun[] {\n+\tconst runs = (raw as { runs?: unknown } | null)?.runs;\n+\tif (!Array.isArray(runs)) return [];\n+\treturn runs.filter(\n+\t\t(r): r is StoredRun =>\n+\t\t\ttypeof r === \"object\" &&\n+\t\t\tr !== null &&\n+\t\t\tNumber.isInteger((r as StoredRun).id) &&\n+\t\t\tNumber.isInteger((r as StoredRun).version) &&\n+\t\t\ttypeof (r as StoredRun).state === \"string\" &&\n+\t\t\ttypeof (r as StoredRun).file === \"string\",\n+\t);\n+}\n+\n+/** One stored run in a line, with where its jobs are. */\n+export function runLine(run: StoredRun): string {\n+\tconst how = run.state === \"planned\" ? \"was planned, not run,\" : run.state === \"running\" ? \"is running\" : run.state;\n+\treturn `Pipeline run ${run.id} (${run.file}) ${how} on version ${run.version}. abso pipeline runs ${run.id} shows its jobs.`;\n+}\n+\n+/**\n+ * Whether the built-in check (abso.json's setup, build and check) had nothing of its own to run. With stored runs, that is\n+ * about the built-in check, not the project's CI, so it isn't said as the project's (abso 719).\n+ */\n+export function builtInHasNothing(ci: CiStatus): boolean {\n+\treturn ci.red === null && ci.skipped?.reason.startsWith(\"nothing to run\") === true;\n+}\n+\n /** A shared version's mark in abso log; \"not checked\" says nothing, since most versions in a busy hour are covered by a newer one's job. */\n export function ciMarkText(mark: CiMark | undefined): string {\n \tswitch (mark) {\n@@ -143,11 +180,20 @@\n \t\t}\n \t\tif (typed !== undefined) {\n \t\t\tif (!/^\\d+$/.test(typed)) throw new UsageError(`a version is a number (got ${JSON.stringify(typed)})`);\n-\t\t\tconst job = await api.ci(Number(typed));\n-\t\t\treturn { text: jobText(job).join(\"\\n\"), json: { ...job } };\n+\t\t\tconst [job, raw] = await Promise.all([api.ci(Number(typed)), api.pipelineRuns().catch(() => null)]);\n+\t\t\tconst run = storedRuns(raw).find((r) => r.version === job.version);\n+\t\t\t// A version the built-in check never ran, with a pipeline run of its own: the run is its CI (abso 719).\n+\t\t\tconst text = run !== undefined && job.result === \"none\" ? [runLine(run)] : jobText(job);\n+\t\t\treturn { text: text.join(\"\\n\"), json: { ...job } };\n \t\t}\n-\t\tconst [ci, status] = await Promise.all([api.ci(), api.status()]);\n-\t\tconst lines = ciText(ci, status.version);\n+\t\tconst [ci, status, raw] = await Promise.all([api.ci(), api.status(), api.pipelineRuns().catch(() => null)]);\n+\t\tconst newest = storedRuns(raw)[0];\n+\t\tconst lines =\n+\t\t\tnewest === undefined\n+\t\t\t\t? ciText(ci, status.version)\n+\t\t\t\t: builtInHasNothing(ci)\n+\t\t\t\t\t? [runLine(newest)]\n+\t\t\t\t\t: [...ciText(ci, status.version), runLine(newest)];\n \t\treturn {\n \t\t\ttext: [\n \t\t\t\t`shared is at version ${status.version}.`,"},{"path":"client/src/command-env.ts","added":7,"removed":2,"diff":"--- a/client/src/command-env.ts\n+++ b/client/src/command-env.ts\n@@ -2,7 +2,6 @@\n \n import { createHash } from \"node:crypto\";\n import { hostname } from \"node:os\";\n-import { basename } from \"node:path\";\n import { callerHeader } from \"../../src/caller.ts\";\n import { Api, type News, newsLines, type RunKind, takeSeatNotices } from \"./api.ts\";\n import { UsageError } from \"./args.ts\";\n@@ -60,7 +59,13 @@\n  */\n export function callerFor(session: string | undefined, machine: string, root: string): string | undefined {\n \tconst hashed = session ? createHash(\"sha256\").update(session).digest(\"hex\").slice(0, 16) : undefined;\n-\treturn callerHeader({ session: hashed, machine, folder: basename(root) });\n+\t// The last part on either separator, so a Windows path names its folder on any machine.\n+\tconst folder =\n+\t\troot\n+\t\t\t.split(/[\\\\/]+/)\n+\t\t\t.filter((p) => p !== \"\")\n+\t\t\t.at(-1) ?? \"\";\n+\treturn callerHeader({ session: hashed, machine, folder });\n }\n \n /**"},{"path":"client/src/install.ts","added":20,"removed":4,"diff":"--- a/client/src/install.ts\n+++ b/client/src/install.ts\n@@ -94,6 +94,8 @@\n \t/** For tests: the rename that moves each file into place. */\n \treadonly rename?: (from: string, to: string) => void;\n \treadonly now?: Date;\n+\t/** For tests: the command stamped as HOOK_COMMAND, instead of this client's own `abso hook`. */\n+\treadonly hookCommand?: readonly string[];\n }\n \n const RECORD = \".avcs-install.json\";\n@@ -132,6 +134,15 @@\n \texistsSync(at(skillsFolder(AVCS_MOD.name, env), MANIFEST)) ||\n \texistsSync(at(skillsFolder(OLD_MOD_NAMES[AVCS_MOD.name]!, env), MANIFEST));\n \n+/** Whether the installed abso mod hands a local project's edits to abso hook: it was installed with a HOOK_COMMAND. */\n+export function modHandsLocal(env: Readonly<Record<string, string | undefined>> = process.env): boolean {\n+\ttry {\n+\t\treturn /HOOK_COMMAND[^=\\n]*=\\s*\\[/.test(readFileSync(at(skillsFolder(AVCS_MOD.name, env), STAMP_FILE), \"utf8\"));\n+\t} catch {\n+\t\treturn false;\n+\t}\n+}\n+\n /**\n  * After the new mod is in, the folder it replaces (skills/avcs, skills/avcs-view) would load beside it, so it\n  * is moved, not deleted, to ~/.abso/retired-mods/<name>-<stamp>. Returns where it went, or undefined when there was none.\n@@ -226,8 +237,11 @@\n \treturn commit;\n }\n \n-/** The files to install, stamped with `version`, in install order. */\n-function filesFor(spec: ModSpec, version: string): Map<string, Buffer> {\n+/** The command that runs this checkout's `abso hook`: what the mod hands a local project's edits to. */\n+export const hookCommand = (): readonly string[] => [process.execPath, join(CLIENT_DIR, \"abso.ts\"), \"hook\"];\n+\n+/** The files to install, stamped with `version` (and HOOK_COMMAND, where a stamp.ts has it), in install order. */\n+function filesFor(spec: ModSpec, version: string, hook: readonly string[] = hookCommand()): Map<string, Buffer> {\n \tif (!/^[\\w.+-]+$/.test(version)) throw new Error(`can't stamp the version ${JSON.stringify(version)}`);\n \tconst out = new Map<string, Buffer>();\n \tfor (const rel of spec.files) {\n@@ -239,7 +253,9 @@\n \t\t\tconst text = data.toString(\"utf8\");\n \t\t\tconst stamped = text.replace(/(STAMP[^=\\n]*=\\s*)undefined/, `$1'${version}'`);\n \t\t\tif (stamped === text) throw new Error(`${rel} has no \"STAMP ... = undefined\" line to stamp`);\n-\t\t\tdata = Buffer.from(stamped);\n+\t\t\tdata = Buffer.from(\n+\t\t\t\tstamped.replace(/(HOOK_COMMAND[^=\\n]*=\\s*)undefined/, (_, head: string) => head + JSON.stringify(hook)),\n+\t\t\t);\n \t\t}\n \t\tout.set(rel, data);\n \t}\n@@ -386,7 +402,7 @@\n export function installMod(spec: ModSpec, options: InstallOptions): Installed {\n \tconst target = resolve(options.target);\n \tconst version = versionFor(spec, options.commit);\n-\tconst next = filesFor(spec, version);\n+\tconst next = filesFor(spec, version, options.hookCommand);\n \tconst existed = existsSync(target);\n \tmkdirSync(target, { recursive: true });\n \ttry {"},{"path":"client/src/issues.ts","added":6,"removed":0,"diff":"--- a/client/src/issues.ts\n+++ b/client/src/issues.ts\n@@ -28,6 +28,7 @@\n import { ignoredHere } from \"./fetch.ts\";\n import { loadIgnore, relativeTo } from \"./folder.ts\";\n import type { AskReply } from \"./issues-wire.ts\";\n+import { isLocal, LOCAL_BASE } from \"./local-store.ts\";\n import { queuedLines, standing } from \"./queue.ts\";\n import { seenText, shortWhen } from \"./times.ts\";\n \n@@ -36,6 +37,11 @@\n /** The folder, with its Api pointed at the Issues Worker: the token goes only where tokenGoesTo allows, as for the avcs server. */\n export function openIssues(env: Env): { root: string; config: Config; api: Api } {\n \tconst { root, config, api } = open(env);\n+\t// A local project's issues are in its store, where the open server keeps them: at /issues.\n+\tif (isLocal(config.server)) {\n+\t\tapi.issuesServer = `${LOCAL_BASE}/issues`;\n+\t\treturn { root, config, api };\n+\t}\n \t// An explicit --server goes to that server's own Issues Worker: ABSO_ISSUES_SERVER doesn't redirect it.\n \tconst server =\n \t\t(env.server === undefined ? fromEnv(env.env, \"ISSUES_SERVER\") : undefined) ||"},{"path":"client/src/join-commands.ts","added":14,"removed":3,"diff":"--- a/client/src/join-commands.ts\n+++ b/client/src/join-commands.ts\n@@ -32,7 +32,7 @@\n import { elsewhereText } from \"./doctor.ts\";\n import { fromEnv } from \"./env-names.ts\";\n import { clearKnown, loadIgnore, readFolder, writeKnown } from \"./folder.ts\";\n-import { installerCommand, modInstalled } from \"./install.ts\";\n+import { installerCommand, modHandsLocal, modInstalled } from \"./install.ts\";\n import { LOCAL, NO_STORE, storeDir } from \"./local-store.ts\";\n import { type FullMode, foldModes, writeKnownModes } from \"./modes.ts\";\n import { initInOrg, siteOf } from \"./orgs.ts\";\n@@ -154,6 +154,11 @@\n \tif (findRoot(root) === root) throw new UsageError(`${root} already has .abso/config.json`);\n \tconst project = str(args, \"project\");\n \tif (!project) throw new UsageError(\"give the project a name with --project <name>\");\n+\t// Checked before any call: a name like \"..\" would otherwise go out as part of the request's path.\n+\tif (!NAME.test(project))\n+\t\tthrow new UsageError(\n+\t\t\t`project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,\n+\t\t);\n \tif (bool(args, \"public\") && bool(args, \"private\")) throw new UsageError(\"--public or --private, not both\");\n \tconst local = localFrom(args, env, \"init\");\n \t// A box signed in here, and no other credential asked for: the project is made as the person who approved the box,\n@@ -538,8 +543,14 @@\n }\n \n function hookHint(env: Readonly<Record<string, string | undefined>>, local = false): string {\n-\t// The mod sends each edit to the folder's server itself, and a local project has none.\n-\tif (local) return \"abso record sends the edits made here: the abso mod doesn't record local projects yet.\";\n+\t// A local project has no server: the mod hands its edits to abso hook, when it was installed with one to hand them to.\n+\tif (local) {\n+\t\tif (modHandsLocal(env))\n+\t\t\treturn \"Edits made by Claude Code here are recorded by the abso mod on this machine, through abso hook. Anything else: abso record.\";\n+\t\tif (modInstalled(env) && !builtCopy())\n+\t\t\treturn `abso record sends the edits made here: the abso mod on this machine is older than local projects. ${installerCommand(\"install-mod.ts\")} updates it, and new chats load it.`;\n+\t\treturn \"abso record sends the edits made here, whoever made them.\";\n+\t}\n \tif (modInstalled(env))\n \t\treturn \"Edits made by Claude Code here are recorded by the abso mod on this machine, signed in as this folder. Anything else: abso record.\";\n \t// A built copy (the npm package) has no installer to point at (abso-core 18)."},{"path":"client/src/local-server.d.mts","added":2,"removed":0,"diff":"--- a/client/src/local-server.d.mts\n+++ b/client/src/local-server.d.mts\n@@ -1,3 +1,5 @@\n // The types of local-server.mjs: as much of the open server as the client calls.\n export declare function handle(request: Request, env: unknown, ctx: unknown, issues: unknown): Promise<Response>;\n export declare const ProjectObject: new (ctx: unknown, env: unknown) => object;\n+export declare const IssueProject: new (ctx: unknown, env: unknown) => object;\n+export declare function issuesFetch(request: Request, env: unknown, ctx: unknown, route: unknown): Promise<Response>;"},{"path":"client/src/local-server.mjs","added":3,"removed":2,"diff":"--- a/client/src/local-server.mjs\n+++ b/client/src/local-server.mjs\n@@ -1,6 +1,7 @@\n-// The open server's router and project object, for local projects (local-store.ts). Plain JS, with its types in\n-// local-server.d.mts, so the client's typecheck stops here: server/src is typechecked with the Workers' types\n+// The open server's router, project object and issues, for local projects (local-store.ts). Plain JS, with its types\n+// in local-server.d.mts, so the client's typecheck stops here: server/src is typechecked with the Workers' types\n // (server/tsconfig.json). The build and Node follow these imports as usual.\n \n+export { IssueProject, issuesFetch } from \"../../server/src/issues-entry.ts\";\n export { ProjectObject } from \"../../server/src/project-object.ts\";\n export { handle } from \"../../server/src/router.ts\";"},{"path":"client/src/local-store.ts","added":67,"removed":20,"diff":"--- a/client/src/local-store.ts\n+++ b/client/src/local-store.ts\n@@ -159,7 +159,8 @@\n \n /** Workers' crypto.DigestStream, which the blob store hashes uploads with. */\n async function installDigestStream(): Promise<void> {\n-\tconst c = globalThis.crypto as unknown as { DigestStream?: unknown };\n+\t// Through a cast: abso's worker compiles this file too (tool.lock.json), and its types have no globalThis.crypto.\n+\tconst c = (globalThis as unknown as { crypto: { DigestStream?: unknown } }).crypto;\n \tif (c.DigestStream) return;\n \tconst { createHash } = await import(\"node:crypto\");\n \tclass DigestStream extends WritableStream<Uint8Array> {\n@@ -189,6 +190,8 @@\n \tDatabaseSync: new (path: string) => Db;\n \thandle: (request: Request, env: unknown, ctx: unknown, issues: unknown) => Promise<Response>;\n \tProjectObject: new (ctx: unknown, env: unknown) => object;\n+\tIssueProject: new (ctx: unknown, env: unknown) => object;\n+\tissuesFetch: (request: Request, env: unknown, ctx: unknown, route: unknown) => Promise<Response>;\n };\n let server: Promise<Server> | undefined;\n \n@@ -221,24 +224,32 @@\n \t\t// copy has it already: the build points the import at the same file (scripts/build-client.mjs).\n \t\tconst standIn = new URL(\"./durable-object-stand-in.ts\", import.meta.url).href;\n \t\tconst mod = (await import(\"node:module\")) as unknown as {\n-\t\t\tregisterHooks?: (hooks: unknown) => { deregister(): void };\n+\t\t\tregisterHooks?: (hooks: unknown) => unknown;\n \t\t};\n-\t\tconst hooks = mod.registerHooks?.({\n+\t\t// The hook stays for the rest of the process: deregistering it crashes Node 24 at exit when the compile cache\n+\t\t// is on (client/avcs.ts turns it on). It answers only cloudflare:workers.\n+\t\tmod.registerHooks?.({\n \t\t\tresolve(specifier: string, context: unknown, next: (s: string, c: unknown) => unknown) {\n \t\t\t\tif (specifier === \"cloudflare:workers\") return { url: standIn, shortCircuit: true };\n \t\t\t\treturn next(specifier, context);\n \t\t\t},\n \t\t});\n+\t\tlet loaded: typeof import(\"./local-server.mjs\");\n \t\ttry {\n-\t\t\tconst { handle, ProjectObject } = await import(\"./local-server.mjs\");\n-\t\t\treturn {\n-\t\t\t\tDatabaseSync: sqlite.DatabaseSync,\n-\t\t\t\thandle,\n-\t\t\t\tProjectObject,\n-\t\t\t};\n-\t\t} finally {\n-\t\t\thooks?.deregister();\n+\t\t\tloaded = await import(\"./local-server.mjs\");\n+\t\t} catch (e) {\n+\t\t\t// Nothing is reached for here: a part of the client is missing (its packages not installed, say).\n+\t\t\tthrow new LocalError(\n+\t\t\t\t`local projects couldn't load the server's code: ${e instanceof Error ? e.message : String(e)}`,\n+\t\t\t);\n \t\t}\n+\t\treturn {\n+\t\t\tDatabaseSync: sqlite.DatabaseSync,\n+\t\t\thandle: loaded.handle,\n+\t\t\tProjectObject: loaded.ProjectObject,\n+\t\t\tIssueProject: loaded.IssueProject,\n+\t\t\tissuesFetch: loaded.issuesFetch,\n+\t\t};\n \t})();\n \treturn server;\n }\n@@ -254,6 +265,10 @@\n \tobject: object | undefined;\n \t/** PRAGMA data_version when this process last used the project: it changes when another process writes. */\n \tseen: number | undefined;\n+\t/** The project's issues, asks and news: issues.sqlite beside it, opened when a call first reaches them. */\n+\tissues?: { db: Db; storage: ReturnType<typeof storageOver> };\n+\t/** The issues object for the call under way: made again for each call, as another process may have written. */\n+\tissueObject?: object;\n }\n \n /** Every store file this process has open: closed when its command ends (closeLocalStores). */\n@@ -269,8 +284,10 @@\n \topened.clear();\n }\n \n-const PROJECT_PATH = /^\\/p\\/([^/]+)\\//;\n-const NAME = /^[A-Za-z0-9._-]{1,100}$/;\n+/** A project's calls, and its issues, asks and news, which the open server keeps at /issues/p/<project>/. */\n+const PROJECT_PATH = /^(?:\\/issues)?\\/p\\/([^/]+)\\//;\n+/** A project's name is also its folder in the store, so it never starts with a dot (\".\" and \"..\" would leave it). */\n+const NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]{0,99}$/;\n const json = (status: number, body: unknown) => Response.json(body, { status });\n \n /**\n@@ -310,10 +327,39 @@\n \t\t\t\treturn p.object;\n \t\t\t},\n \t\t},\n-\t\t// Issues, asks and news aren't in local projects yet: a start note's issue hooks find nothing to call.\n-\t\tISSUES_DO: { idFromName: (n: string) => n, get: () => ({}) },\n+\t\tISSUES_DO: {\n+\t\t\tidFromName: (n: string) => n,\n+\t\t\tget: (n: string) => {\n+\t\t\t\tconst p = open.get(n);\n+\t\t\t\tif (!p || n !== name) throw new LocalError(`no local project ${n}`);\n+\t\t\t\tif (p.issues === undefined || !opened.has(p.issues.db)) {\n+\t\t\t\t\tconst db = new opening!.DatabaseSync(join(dir, name, \"issues.sqlite\"));\n+\t\t\t\t\topened.add(db);\n+\t\t\t\t\tdb.exec(\"PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 120000; PRAGMA synchronous = NORMAL\");\n+\t\t\t\t\tp.issues = { db, storage: storageOver(db) };\n+\t\t\t\t}\n+\t\t\t\t// Its writes need no lock of their own: every call holds the project file's (see below).\n+\t\t\t\tp.issueObject ??= new opening!.IssueProject(\n+\t\t\t\t\t{ id: { toString: () => n, name: n }, storage: p.issues.storage },\n+\t\t\t\t\tenv(name),\n+\t\t\t\t);\n+\t\t\t\treturn p.issueObject;\n+\t\t\t},\n+\t\t},\n \t});\n-\treturn async (input, init = {}) => {\n+\t// One call at a time, as a Durable Object takes them: a call holds its project's write transaction across awaits,\n+\t// and the connection can't start a second (two calls at once come from Promise.all in ci and waiting --mine).\n+\tlet last: Promise<unknown> = Promise.resolve();\n+\treturn (input, init) => {\n+\t\tconst next = last.then(\n+\t\t\t() => call(input, init),\n+\t\t\t() => call(input, init),\n+\t\t);\n+\t\tlast = next.catch(() => {});\n+\t\treturn next;\n+\t};\n+\n+\tasync function call(input: string, init: RequestInit = {}): Promise<Response> {\n \t\tconst s = await loadServer();\n \t\topening = s;\n \t\tconst url = new URL(input);\n@@ -327,7 +373,10 @@\n \t\theaders.set(\"authorization\", `Bearer ${LOCAL_TOKEN}`);\n \t\tconst request = new Request(url, { ...init, headers });\n \t\tconst waits: Promise<unknown>[] = [];\n+\t\t// Every call, issues ones too, holds the project file's lock, so local writers of the project and of its\n+\t\t// issues take one lock in one order.\n \t\tp.db.exec(\"BEGIN IMMEDIATE\");\n+\t\tp.issueObject = undefined;\n \t\ttry {\n \t\t\tconst version = (p.db.prepare(\"PRAGMA data_version\").get() as { data_version: number }).data_version;\n \t\t\tif (p.seen !== undefined && version !== p.seen) p.object = undefined;\n@@ -335,7 +384,7 @@\n \t\t\t\trequest,\n \t\t\t\tenv(name),\n \t\t\t\t{ waitUntil: (w: Promise<unknown>) => waits.push(w) },\n-\t\t\t\tissuesNone,\n+\t\t\t\ts.issuesFetch,\n \t\t\t);\n \t\t\tawait Promise.allSettled(waits);\n \t\t\t// The answer is read whole before the write is kept, so a body that fails to arrive keeps nothing either.\n@@ -354,7 +403,5 @@\n \t\t\t// Where the Workers runtime answers a throw with a 500, so does this.\n \t\t\treturn json(500, { error: e instanceof Error ? e.message : String(e) });\n \t\t}\n-\t};\n+\t}\n }\n-\n-const issuesNone = async () => json(404, { error: \"issues, asks and news aren't in local projects yet\" });"},{"path":"client/src/main.ts","added":22,"removed":2,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -79,6 +79,7 @@\n import { runAmend, runDrop, runFollow, runLabel, runLabels, runPluck } from \"./versions.ts\";\n import { runVisibility } from \"./visibility-commands.ts\";\n import { checkVisitor } from \"./visitor.ts\";\n+import { handoffText, patFromFile, webLogin } from \"./web-session.ts\";\n \n interface CommandDef {\n \treadonly flags: FlagSpec;\n@@ -212,13 +213,32 @@\n \t\t\tprojects: \"string\",\n \t\t\trole: \"string\",\n \t\t\tdays: \"string\",\n+\t\t\tweb: \"boolean\",\n+\t\t\tsite: \"string\",\n+\t\t\t\"pat-file\": \"string\",\n \t\t},\n \t\tusage:\n-\t\t\t\"abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]\",\n+\t\t\t\"abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>] | abso login --web [--pat-file <file> [--site http://localhost:<port>]]\",\n \t\tabout:\n-\t\t\t\"Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only.\",\n+\t\t\t\"Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only. --web, on staging only, signs a browser in to the website instead: it prints a link that works once, within a minute, and signs whichever browser opens it in as the person who approved this box, but only to the projects the box was granted and at most as a writer, until the box is revoked or ends (or, with --pat-file, as the test account whose PAT that file holds, at most as a writer). It writes issues, replies, answers, groups and announcements, and changes no members, roles, visibility, keys, boxes or settings. The box's sign-in, the PAT and the session never appear. It goes only to the staging website beside this folder's staging server; any other server, prod included, is refused and nothing is sent. --site, with --pat-file only, points it at a website on this machine (http://localhost or 127.0.0.1).\",\n \t\trun: async (args, env) => {\n \t\t\tconst server = boxServer(args, env);\n+\t\t\tif (bool(args, \"web\")) {\n+\t\t\t\tconst patFile = str(args, \"pat-file\");\n+\t\t\t\tconst { handoff, site } = await webLogin({\n+\t\t\t\t\tserver,\n+\t\t\t\t\tsite: str(args, \"site\"),\n+\t\t\t\t\tkind: patFile === undefined ? \"box\" : \"pat\",\n+\t\t\t\t\tcredential: () => {\n+\t\t\t\t\t\tif (patFile !== undefined) return patFromFile(patFile);\n+\t\t\t\t\t\tconst record = readBox(server);\n+\t\t\t\t\t\tif (record === undefined || record.expiresAt <= Date.now())\n+\t\t\t\t\t\t\tthrow new UsageError(`this box isn't signed in to ${server}: abso login first, or --pat-file <file>`);\n+\t\t\t\t\t\treturn record.credential;\n+\t\t\t\t\t},\n+\t\t\t\t});\n+\t\t\t\treturn { text: handoffText(handoff, site, patFile === undefined), json: { ...handoff } };\n+\t\t\t}\n \t\t\tconst open =\n \t\t\t\tbool(args, \"no-browser\") || browserSkip(env.env, process.platform) !== null\n \t\t\t\t\t? undefined"},{"path":"client/src/news-stream.ts","added":50,"removed":2,"diff":"--- a/client/src/news-stream.ts\n+++ b/client/src/news-stream.ts\n@@ -94,6 +94,8 @@\n \tsleep(ms: number): Promise<void>;\n \tnow(): number;\n \tevery(ms: number, fn: () => void): () => void;\n+\t/** Reads the seat's news, marking it heard (POST news); a frame calls it. Without it, frames are printed as they come. */\n+\ttake?(): Promise<readonly string[]>;\n \t/** Called when a socket opens and at each ping: the stream is held until the next ping is due, and a little more. */\n \theld?(until: number): void;\n \t/** Set when --follow should stop (Ctrl-C, or a test). */\n@@ -107,10 +109,55 @@\n }\n \n /**\n+ * A frame is a wake (abso 690): on one, read the seat's news (which marks it heard) and print what that answers, one\n+ * read at a time, with frames that arrive meanwhile folded into one more read. When the read answers nothing (a server\n+ * that counts a frame as heard already, or another chat on the seat took it first), the frames themselves are printed.\n+ */\n+function frameReads(deps: FollowDeps): { frame(text: string): void; idle(): Promise<void> } {\n+\tlet frames: string[] = [];\n+\t/** The lines printed lately, so a frame a read already printed isn't printed again. */\n+\tconst shown: string[] = [];\n+\tconst show = (line: string) => {\n+\t\tdeps.write(line);\n+\t\tshown.push(line);\n+\t\tif (shown.length > 200) shown.shift();\n+\t};\n+\tlet running: Promise<void> | undefined;\n+\tlet again = false;\n+\tconst pass = async () => {\n+\t\tdo {\n+\t\t\tagain = false;\n+\t\t\tconst these = frames;\n+\t\t\tframes = [];\n+\t\t\tlet items: readonly string[] = [];\n+\t\t\ttry {\n+\t\t\t\titems = await deps.take!();\n+\t\t\t} catch (err) {\n+\t\t\t\tdeps.note(`(abso news --follow: couldn't read the news: ${(err as Error).message}; showing the frames)`);\n+\t\t\t}\n+\t\t\tfor (const line of items) show(line);\n+\t\t\t// A frame the read didn't cover still shows: on a server that counts a frame as heard, its item never comes back\n+\t\t\t// from the read. A catch-up frame names several items, so a frame holding a shown item counts as covered.\n+\t\t\tfor (const frame of these) if (!shown.some((line) => frame.includes(line) || line.includes(frame))) show(frame);\n+\t\t} while (again);\n+\t\trunning = undefined;\n+\t};\n+\treturn {\n+\t\tframe(text) {\n+\t\t\tframes.push(text);\n+\t\t\tif (running !== undefined) again = true;\n+\t\t\telse running = pass();\n+\t\t},\n+\t\tidle: () => running ?? Promise.resolve(),\n+\t};\n+}\n+\n+/**\n  * Holds the seat's stream, printing one line per item, until the key is refused or `stopped()`.\n  * Returns why it ended.\n  */\n export async function follow(deps: FollowDeps): Promise<{ ended: \"refused\" | \"stopped\"; reason: string }> {\n+\tconst reads = frameReads(deps);\n \tlet wait = 1_000;\n \twhile (!deps.stopped()) {\n \t\tlet ticket: NewsTicket;\n@@ -139,12 +186,13 @@\n \t\t\t};\n \t\t\tsocket.onmessage = (e) => {\n \t\t\t\tif (typeof e.data !== \"string\" || e.data === PONG) return;\n-\t\t\t\tdeps.write(e.data);\n+\t\t\t\tif (deps.take === undefined) deps.write(e.data);\n+\t\t\t\telse reads.frame(e.data);\n \t\t\t};\n \t\t\tsocket.onerror = () => {};\n \t\t\tsocket.onclose = (e) => {\n \t\t\t\tstopPing();\n-\t\t\t\tdone({ code: e.code, reason: e.reason });\n+\t\t\t\tvoid reads.idle().then(() => done({ code: e.code, reason: e.reason }));\n \t\t\t};\n \t\t});\n \t\tif (isRefusal(closed.code)) return { ended: \"refused\", reason: closed.reason || `closed ${closed.code}` };"},{"path":"client/src/status-commands.ts","added":5,"removed":2,"diff":"--- a/client/src/status-commands.ts\n+++ b/client/src/status-commands.ts\n@@ -40,6 +40,7 @@\n } from \"./folder.ts\";\n import { fileArg } from \"./history.ts\";\n import { modsBehindText } from \"./install.ts\";\n+import { isLocal } from \"./local-store.ts\";\n import { withFolderLock } from \"./lock.ts\";\n import { readKnownModes, writeKnownModes } from \"./modes.ts\";\n import { queueText } from \"./queue.ts\";\n@@ -325,9 +326,11 @@\n \tconst space = (draft: string | null | undefined): string => (draft ? `draft ${draft}` : \"shared\");\n \tconst parked = (me?.parked ?? []).filter((p) => p.draftChanges > 0);\n \tconst credential = credentialLabel(root, config.server, env.env);\n-\tconst behind = await newerClientNote(config.server);\n+\t// A local project reaches for nothing on the network, npm included.\n+\tconst localProject = isLocal(config.server);\n+\tconst behind = localProject ? undefined : await newerClientNote(config.server);\n \tconst lines = [\n-\t\t`Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? \", a reader (it records and pushes nothing)\" : \"\"}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: pulls take it to the newest version with that label.` : \"\"} Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : \"\"}.`,\n+\t\t`Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? \", a reader (it records and pushes nothing)\" : \"\"}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: pulls take it to the newest version with that label.` : \"\"}${localProject ? ` It's a local project, in ${join(config.localStore ?? \"\", config.project)}.` : ` Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : \"\"}.`}`,\n \t\t...(behind ? [behind] : []),\n \t\t// Is shared green (#39)? Right under the first line, since it decides what to do next.\n \t\t...ciText(status.ci, status.version),"},{"path":"client/src/web-session.ts","added":141,"removed":0,"diff":"--- /dev/null\n+++ b/client/src/web-session.ts\n@@ -0,0 +1,141 @@\n+// abso login --web: a staging website session for the person a box is signed in as, opened in an agent's own browser, with\n+// no secret in the agent's hands. The website's /login/handoff takes this box's sign-in (or a test account's PAT, from a file)\n+// and answers a one-use link that works for a minute; opening it signs that browser in. Only the link is printed: never the\n+// box's sign-in, the PAT or the session cookie, which the website sets in the browser itself.\n+\n+import { readFileSync } from \"node:fs\";\n+import { UsageError } from \"./args.ts\";\n+\n+/** The website beside each staging server. Prod has none here: agents never sign in to the website on prod. */\n+const STAGING_SITES: Readonly<Record<string, string>> = {\n+\t\"https://abso-staging.chrisazy.workers.dev\": \"https://abso-website-staging.chrisazy.workers.dev\",\n+\t\"https://avcs-staging.chrisazy.workers.dev\": \"https://abso-website-staging.chrisazy.workers.dev\",\n+};\n+\n+/** What the website answers: the link, when it stops working, and who and until when it signs in. */\n+export interface Handoff {\n+\treadonly url: string;\n+\treadonly expiresAt: string;\n+\treadonly account: string;\n+\treadonly name: string;\n+\treadonly sessionEnds: string;\n+}\n+\n+/**\n+ * The website a handoff's credential goes to (Security condition 6, Code Review): the staging website beside the folder's own\n+ * staging server, from the fixed list above, and never an origin from a flag. A server that isn't on the list is refused,\n+ * prod included. --site is only for a test account's PAT on this machine (http://localhost or 127.0.0.1); a box's sign-in\n+ * takes no --site at all.\n+ */\n+export function siteFor(server: string, site: string | undefined, kind: \"box\" | \"pat\"): string {\n+\tconst origin = new URL(server).origin;\n+\tconst known = STAGING_SITES[origin];\n+\tif (known === undefined)\n+\t\tthrow new UsageError(\n+\t\t\t`abso login --web is for staging: ${origin} has no staging website beside it that abso knows, and agents never sign in to the website on prod. Nothing was sent.`,\n+\t\t);\n+\tif (site === undefined) return known;\n+\tif (kind === \"box\")\n+\t\tthrow new UsageError(`--site isn't taken with a box's sign-in, which goes only to ${known}. Nothing was sent.`);\n+\tlet url: URL | null = null;\n+\ttry {\n+\t\turl = new URL(site);\n+\t} catch {\n+\t\t// Not an address: refused below.\n+\t}\n+\tif (url === null || url.protocol !== \"http:\" || (url.hostname !== \"localhost\" && url.hostname !== \"127.0.0.1\"))\n+\t\tthrow new UsageError(\n+\t\t\t\"--site, with --pat-file, names this machine only (http://localhost:<port> or http://127.0.0.1:<port>). Nothing was sent.\",\n+\t\t);\n+\treturn url.origin;\n+}\n+\n+/**\n+ * abso login --web: where the credential would go is settled before it is read, so a refusal reads and sends nothing\n+ * (Security). `credential` reads the box's sign-in or the PAT only once the website is one it may go to.\n+ */\n+export async function webLogin(options: {\n+\treadonly server: string;\n+\treadonly site: string | undefined;\n+\t/** A box's sign-in, or a test account's PAT (--pat-file). */\n+\treadonly kind: \"box\" | \"pat\";\n+\treadonly credential: () => string;\n+\treadonly fetcher?: typeof fetch;\n+}): Promise<{ handoff: Handoff; site: string }> {\n+\tconst site = siteFor(options.server, options.site, options.kind);\n+\treturn { handoff: await webHandoff(site, options.credential(), options.fetcher), site };\n+}\n+\n+/** A PAT from the file --pat-file names: read here, never printed. */\n+export function patFromFile(path: string): string {\n+\tlet text: string;\n+\ttry {\n+\t\ttext = readFileSync(path, \"utf8\").trim();\n+\t} catch {\n+\t\tthrow new UsageError(`--pat-file names ${path}, which abso can't read`);\n+\t}\n+\tif (!/^abso_pat_[A-Za-z0-9_-]{16,200}$/.test(text))\n+\t\tthrow new UsageError(`--pat-file names ${path}, which doesn't hold a PAT`);\n+\treturn text;\n+}\n+\n+/** Words from the website, with any secret this call sent taken out. */\n+function scrubbed(text: string, secret: string): string {\n+\treturn text.split(secret).join(\"[the credential]\").slice(0, 300);\n+}\n+\n+/** Asks the website for a handoff link with `credential` (a box sign-in or a PAT) in Authorization. */\n+export async function webHandoff(site: string, credential: string, fetcher: typeof fetch = fetch): Promise<Handoff> {\n+\tlet res: Response;\n+\ttry {\n+\t\tres = await fetcher(`${site}/login/handoff`, {\n+\t\t\tmethod: \"POST\",\n+\t\t\theaders: { authorization: `Bearer ${credential}`, accept: \"application/json\" },\n+\t\t\tredirect: \"error\",\n+\t\t\tsignal: AbortSignal.timeout(30_000),\n+\t\t});\n+\t} catch (err) {\n+\t\tthrow new UsageError(`couldn't reach ${site}: ${scrubbed((err as Error).message, credential)}`);\n+\t}\n+\tconst text = await res.text().catch(() => \"\");\n+\tlet body: Partial<Handoff> & { error?: unknown } = {};\n+\ttry {\n+\t\tbody = JSON.parse(text) as typeof body;\n+\t} catch {\n+\t\t// Not JSON: the status says enough.\n+\t}\n+\tif (!res.ok) {\n+\t\tconst why = typeof body.error === \"string\" ? body.error : `it answered ${res.status}`;\n+\t\tthrow new UsageError(\n+\t\t\tres.status === 404\n+\t\t\t\t? `${site} doesn't hand out sign-in links (its key sign-in is off, or it isn't staging)`\n+\t\t\t\t: `${site} refused: ${scrubbed(why, credential)}`,\n+\t\t);\n+\t}\n+\tif (\n+\t\ttypeof body.url !== \"string\" ||\n+\t\t!body.url.startsWith(`${site}/login/handoff#`) ||\n+\t\ttypeof body.expiresAt !== \"string\" ||\n+\t\ttypeof body.account !== \"string\"\n+\t)\n+\t\tthrow new UsageError(`${site} answered something that isn't a sign-in link`);\n+\treturn {\n+\t\turl: body.url,\n+\t\texpiresAt: body.expiresAt,\n+\t\taccount: body.account,\n+\t\tname: typeof body.name === \"string\" ? body.name : body.account,\n+\t\tsessionEnds: typeof body.sessionEnds === \"string\" ? body.sessionEnds : body.expiresAt,\n+\t};\n+}\n+\n+/** What abso login --web says: the one link, how long it works, who it signs in as, and what it reaches (Security). */\n+export function handoffText(h: Handoff, site: string, boxed = true, now = Date.now()): string {\n+\tconst seconds = Math.max(0, Math.round((Date.parse(h.expiresAt) - now) / 1000));\n+\tconst reach = boxed\n+\t\t? \"only to the projects this box was granted, at most as a writer, until the box is revoked or ends\"\n+\t\t: \"at most as a writer\";\n+\treturn [\n+\t\t`Open this link in your browser within ${seconds} seconds. It signs that browser in to ${site} as ${h.name}, until ${h.sessionEnds}, and works once. It reaches ${reach}:`,\n+\t\th.url,\n+\t].join(\"\\n\");\n+}"},{"path":"client/test/ci-runs.test.ts","added":60,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/ci-runs.test.ts\n@@ -0,0 +1,60 @@\n+// abso ci for a project whose CI is its pipeline file (abso 719): test-byoc on 2026-10-16 had no abso.json, and abso ci\n+// said \"nothing to run\" while its abso.yml's run 8 was going. The stored run is the project's CI there.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { builtInHasNothing, runLine, storedRuns } from \"../src/ci.ts\";\n+\n+const base = { latest: null, checked: null, running: null, red: null, behind: null } as const;\n+const nothing = {\n+\tversion: 6,\n+\tfrom: 6,\n+\treason: \"nothing to run: no abso.json, and package.json has no test, typecheck or vite\",\n+\tat: \"2026-10-16T16:47:00.000Z\",\n+};\n+\n+test(\"the stored runs are read strictly, newest first as the server lists them\", () => {\n+\tconst runs = storedRuns({\n+\t\tblocked: null,\n+\t\truns: [\n+\t\t\t{ id: 8, version: 6, state: \"running\", file: \"abso.yml\", started: 1 },\n+\t\t\t{ id: \"7\", version: 6, state: \"failed\", file: \"abso.yml\" },\n+\t\t\t{ id: 6, version: 5, state: \"failed\", file: \"abso.yml\" },\n+\t\t],\n+\t});\n+\tassert.deepEqual(\n+\t\truns.map((r) => r.id),\n+\t\t[8, 6],\n+\t);\n+\tassert.deepEqual(storedRuns(null), []);\n+\tassert.deepEqual(storedRuns({ runs: \"no\" }), []);\n+});\n+\n+test(\"a run in a line names its file, its state and where its jobs are\", () => {\n+\tassert.equal(\n+\t\trunLine({ id: 8, version: 6, state: \"running\", file: \"abso.yml\" }),\n+\t\t\"Pipeline run 8 (abso.yml) is running on version 6. abso pipeline runs 8 shows its jobs.\",\n+\t);\n+\tassert.equal(\n+\t\trunLine({ id: 7, version: 6, state: \"failed\", file: \"abso.yml\" }),\n+\t\t\"Pipeline run 7 (abso.yml) failed on version 6. abso pipeline runs 7 shows its jobs.\",\n+\t);\n+\tassert.equal(\n+\t\trunLine({ id: 2, version: 1, state: \"planned\", file: \"abso.yml\" }),\n+\t\t\"Pipeline run 2 (abso.yml) was planned, not run, on version 1. abso pipeline runs 2 shows its jobs.\",\n+\t);\n+});\n+\n+test(\"only the built-in check's own nothing to run is set aside, never a red or another skip\", () => {\n+\tassert.equal(builtInHasNothing({ ...base, skipped: nothing }), true);\n+\tassert.equal(builtInHasNothing({ ...base, skipped: { ...nothing, reason: \"CI is off\" } }), false);\n+\tassert.equal(builtInHasNothing({ ...base }), false);\n+\tassert.equal(\n+\t\tbuiltInHasNothing({\n+\t\t\t...base,\n+\t\t\tred: { version: 6, agent: null, message: null, lastGood: null },\n+\t\t\tskipped: nothing,\n+\t\t}),\n+\t\tfalse,\n+\t);\n+});"},{"path":"client/test/install.test.ts","added":23,"removed":0,"diff":"--- a/client/test/install.test.ts\n+++ b/client/test/install.test.ts\n@@ -26,6 +26,7 @@\n import { clientVersion, headCommit } from \"../src/client-version.ts\";\n import {\n \tAVCS_MOD,\n+\thookCommand,\n \tinstallerCommand,\n \tinstallMod,\n \tkeptModCommit,\n@@ -114,6 +115,28 @@\n \t\t);\n \t});\n \n+\tit(\"stamps the command that runs this client's abso hook, where stamp.ts has a HOOK_COMMAND line\", () => {\n+\t\tconst spec = source({\n+\t\t\t\"hooks/stamp.ts\":\n+\t\t\t\t\"export const STAMP: string | undefined = undefined\\nexport const HOOK_COMMAND: readonly string[] | undefined = undefined\\n\",\n+\t\t});\n+\t\tconst target = join(temp(), \"avcs\");\n+\t\tinstallMod(spec, {\n+\t\t\ttarget,\n+\t\t\tcheck: pass,\n+\t\t\tcommit: \"702c616\",\n+\t\t\thookCommand: [\"C:\\\\node.exe\", \"C:\\\\abso\\\\client\\\\abso.ts\", \"hook\"],\n+\t\t});\n+\t\tassert.equal(\n+\t\t\tread(target, \"hooks/stamp.ts\"),\n+\t\t\t\"export const STAMP: string | undefined = '0.1.0+702c616'\\n\" +\n+\t\t\t\t'export const HOOK_COMMAND: readonly string[] | undefined = [\"C:\\\\\\\\node.exe\",\"C:\\\\\\\\abso\\\\\\\\client\\\\\\\\abso.ts\",\"hook\"]\\n',\n+\t\t);\n+\t\t// By default, this checkout's own: the node running it and client/abso.ts.\n+\t\tassert.deepEqual(hookCommand().slice(0, 1), [process.execPath]);\n+\t\tassert.match(hookCommand()[1]!, /client[\\\\/]abso\\.ts$/);\n+\t});\n+\n \tit(\"moves the files in by rename, what the hook imports first and plugin.json last\", () => {\n \t\tconst spec = source();\n \t\tconst target = join(temp(), \"avcs\");"},{"path":"client/test/local.test.ts","added":85,"removed":3,"diff":"--- a/client/test/local.test.ts\n+++ b/client/test/local.test.ts\n@@ -3,10 +3,13 @@\n // call that would leave the machine fails the test.\n \n import assert from \"node:assert/strict\";\n-import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\n+import { spawnSync } from \"node:child_process\";\n+import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\n import { tmpdir } from \"node:os\";\n import { join } from \"node:path\";\n import { after, before, describe, it } from \"node:test\";\n+import { fileURLToPath } from \"node:url\";\n+import { closeLocalStores, LOCAL_BASE, localFetch } from \"../src/local-store.ts\";\n import { main } from \"../src/main.ts\";\n import { stateDir } from \"../src/state-dir.ts\";\n \n@@ -39,7 +42,12 @@\n }\n const text = (dir: string, rel: string) => readFileSync(join(dir, rel), \"utf8\");\n \n-describe(\"a local project, with the network off\", () => {\n+/** A copy of the client without the open server beside it (a platform that pins only client/) has no local projects to test. */\n+const noServer = existsSync(fileURLToPath(new URL(\"../../server/src/router.ts\", import.meta.url)))\n+\t? false\n+\t: \"no server/src beside this client, so no local projects\";\n+\n+describe(\"a local project, with the network off\", { skip: noServer }, () => {\n \tlet alice: string;\n \tlet bob: string;\n \tbefore(() => {\n@@ -102,9 +110,53 @@\n \t\tassert.notEqual(held.exit, 0);\n \t\tassert.match(held.out + held.err, /collision/);\n \t});\n+\n+\tit(\"issues, asks and news work too, kept in issues.sqlite beside the project\", async () => {\n+\t\tconst opened = await run(alice, \"issue\", \"new\", \"Fix the parser\", \"--agent\", \"bob\");\n+\t\tassert.equal(opened.exit, 0, opened.out + opened.err);\n+\t\tassert.ok(existsSync(join(store, \"demo\", \"issues.sqlite\")));\n+\t\tconst listed = await run(bob, \"issues\");\n+\t\tassert.equal(listed.exit, 0, listed.err);\n+\t\tassert.match(listed.out, /Fix the parser/);\n+\t\tconst started = await run(bob, \"start\", \"Parser fix\", \"--issue\", \"1\");\n+\t\tassert.equal(started.exit, 0, started.out + started.err);\n+\t\tconst asked = await run(alice, \"ask\", \"bob\", \"Which grammar?\", \"--issue\", \"1\");\n+\t\tassert.equal(asked.exit, 0, asked.out + asked.err);\n+\t\tconst waiting = await run(bob, \"waiting\", \"--mine\");\n+\t\tassert.equal(waiting.exit, 0, waiting.err);\n+\t\tassert.match(waiting.out, /Which grammar\\?/);\n+\t\tconst answered = await run(bob, \"answer\", \"1\", \"The new one\");\n+\t\tassert.equal(answered.exit, 0, answered.out + answered.err);\n+\t\tconst news = await run(alice, \"news\");\n+\t\tassert.equal(news.exit, 0, news.err);\n+\t\tassert.match(news.out, /The new one/);\n+\t\tconst issue = await run(alice, \"issue\", \"1\");\n+\t\tassert.match(issue.out, /In progress|bob/);\n+\t});\n+\n+\tit(\"two calls at once on one project are both answered, one after the other\", async () => {\n+\t\t// As abso ci and waiting --mine make them, with Promise.all.\n+\t\tconst local = localFetch(store);\n+\t\tconst answers = await Promise.all([local(`${LOCAL_BASE}/p/demo/queue`), local(`${LOCAL_BASE}/p/demo/queue`)]);\n+\t\tcloseLocalStores();\n+\t\tfor (const a of answers) assert.equal(a.status, 200, await a.text());\n+\t});\n+\n+\tit(\"a project's name can't start with a dot, so its folder stays inside the store\", async () => {\n+\t\tconst dir = temp(\"dots\");\n+\t\twriteFileSync(join(dir, \"a.txt\"), \"x\\n\");\n+\t\tfor (const name of [\"..\", \".hidden\"]) {\n+\t\t\tconst r = await run(dir, \"init\", \"--local\", \"--project\", name, \"--agent\", \"a\");\n+\t\t\tassert.equal(r.exit, 1, r.out + r.err);\n+\t\t\t// The name rule says why, before any call is made (a \"..\" would collapse the call's path).\n+\t\t\tassert.match(r.err, /project names are letters, digits, dot, dash and underscore/);\n+\t\t}\n+\t\tassert.ok(!existsSync(join(store, \"..\", \"project.sqlite\")));\n+\t\tassert.deepEqual(readdirSync(dir), [\"a.txt\"], \"init left nothing behind\");\n+\t});\n });\n \n-describe(\"where a local project's store is\", () => {\n+describe(\"where a local project's store is\", { skip: noServer }, () => {\n \tit(\"--store inside the folder is kept in its settings and left out of its files\", async () => {\n \t\tstore = temp(\"unused\");\n \t\tconst dir = temp(\"venv\");\n@@ -138,3 +190,33 @@\n \t\tassert.equal(existsSync(join(dir, \".abso\")) || existsSync(join(dir, \".avcs\")), false);\n \t});\n });\n+\n+describe(\"local commands as their own processes\", { skip: noServer }, () => {\n+\t// The way people and agents run them: client/abso.ts, a process per command, Node's compile cache as it is.\n+\tconst entry = fileURLToPath(new URL(\"../abso.ts\", import.meta.url));\n+\tconst cli = (cwd: string, processStore: string, ...argv: string[]) =>\n+\t\tspawnSync(process.execPath, [entry, ...argv], {\n+\t\t\tcwd,\n+\t\t\tenv: { ...process.env, ABSO_STORE: processStore, ABSO_SERVERS_FILE: \"no-servers.json\" },\n+\t\t\tencoding: \"utf8\",\n+\t\t});\n+\n+\tit(\"init, push, status and log each exit cleanly\", () => {\n+\t\tconst processStore = temp(\"process-store\");\n+\t\tconst dir = temp(\"process\");\n+\t\twriteFileSync(join(dir, \"a.txt\"), \"one\\n\");\n+\t\tconst steps: [string, string[]][] = [\n+\t\t\t[\"init\", [\"init\", \"--local\", \"--project\", \"proc\", \"--agent\", \"p\"]],\n+\t\t\t[\"push\", [\"push\", \"-m\", \"Two\"]],\n+\t\t\t[\"status\", [\"status\"]],\n+\t\t\t[\"log\", [\"log\"]],\n+\t\t];\n+\t\tfor (const [name, argv] of steps) {\n+\t\t\tif (name === \"push\") writeFileSync(join(dir, \"a.txt\"), \"one\\ntwo\\n\");\n+\t\t\tconst r = cli(dir, processStore, ...argv);\n+\t\t\tassert.equal(r.status, 0, `${name}: exit ${r.status} ${r.signal ?? \"\"}\\n${r.stdout}${r.stderr}`);\n+\t\t\tif (name === \"status\") assert.match(r.stdout, /It's a local project, in /);\n+\t\t\tif (name === \"log\") assert.match(r.stdout, /Two/);\n+\t\t}\n+\t});\n+});"},{"path":"client/test/news-stream.test.ts","added":43,"removed":0,"diff":"--- a/client/test/news-stream.test.ts\n+++ b/client/test/news-stream.test.ts\n@@ -134,6 +134,49 @@\n \tassert.equal(w.notes.length, 0);\n });\n \n+test(\"a frame is a wake: --follow reads the news and prints that once; an empty read prints the frames\", async () => {\n+\t// The server's frames don't count as heard (abso 690): the read takes them, so each item prints once.\n+\tconst w = world([{ frames: [\"fe told you: hello\", \"cloud asks: ship it?\"], close: { code: 1006 } }]);\n+\tconst reads: string[][] = [[\"fe told you: hello\", \"cloud asks: ship it?\"], []];\n+\tlet calls = 0;\n+\tw.deps.take = async () => {\n+\t\tcalls++;\n+\t\treturn reads.shift() ?? [];\n+\t};\n+\tawait follow(w.deps);\n+\t// Two frames, one read in flight: the second folds into one more read, which finds nothing new; its frame was\n+\t// already printed by the first read, so nothing prints twice.\n+\tassert.equal(calls, 2);\n+\tassert.deepEqual(w.lines, [\"fe told you: hello\", \"cloud asks: ship it?\"]);\n+\n+\t// A server that counts a frame as heard already (staging 1418): the read is empty, so the frame is what shows.\n+\tconst old = world([{ frames: [\"fe told you: hello\"], close: { code: 1006 } }]);\n+\told.deps.take = async () => [];\n+\tawait follow(old.deps);\n+\tassert.deepEqual(old.lines, [\"fe told you: hello\"]);\n+\n+\t// On that server a read can find other news waiting: the frame's own item still shows (Code Review, 291).\n+\tconst mixed = world([{ frames: [\"fe told you: hello\"], close: { code: 1006 } }]);\n+\tmixed.deps.take = async () => [\"cloud: an older item\"];\n+\tawait follow(mixed.deps);\n+\tassert.deepEqual(mixed.lines, [\"cloud: an older item\", \"fe told you: hello\"]);\n+\n+\t// A catch-up frame names the first few waiting items and how many more: the read shows them all, the frame adds nothing.\n+\tconst catchUp = world([{ frames: [\"fe told you: hello\\ncloud: ship it?\\nand 1 more\"], close: { code: 1006 } }]);\n+\tcatchUp.deps.take = async () => [\"fe told you: hello\", \"cloud: ship it?\", \"desk: a third\"];\n+\tawait follow(catchUp.deps);\n+\tassert.deepEqual(catchUp.lines, [\"fe told you: hello\", \"cloud: ship it?\", \"desk: a third\"]);\n+\n+\t// A read that fails shows the frames and says why.\n+\tconst down = world([{ frames: [\"fe told you: hello\"], close: { code: 1006 } }]);\n+\tdown.deps.take = async () => {\n+\t\tthrow new Error(\"could not reach the server\");\n+\t};\n+\tawait follow(down.deps);\n+\tassert.deepEqual(down.lines, [\"fe told you: hello\"]);\n+\tassert.match(down.notes[0]!, /couldn't read the news: could not reach the server/);\n+});\n+\n test(\"--follow keeps an idle socket open with a ping the object answers without waking\", async () => {\n \tconst w = world([{ frames: [], close: { code: 1006 } }]);\n \tconst held: number[] = [];"},{"path":"client/test/web-session.test.ts","added":106,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/web-session.test.ts\n@@ -0,0 +1,106 @@\n+// abso login --web: a staging website session handed to a browser as a one-use link, with no secret printed.\n+\n+import assert from \"node:assert/strict\";\n+import { mkdtempSync, writeFileSync } from \"node:fs\";\n+import { tmpdir } from \"node:os\";\n+import { join } from \"node:path\";\n+import { test } from \"node:test\";\n+import { handoffText, patFromFile, siteFor, webHandoff, webLogin } from \"../src/web-session.ts\";\n+\n+const SITE = \"https://abso-website-staging.chrisazy.workers.dev\";\n+const STAGING = \"https://abso-staging.chrisazy.workers.dev\";\n+const BOX = `abso_bx_${\"C\".repeat(43)}`;\n+const PAT = `abso_pat_${\"A\".repeat(40)}`;\n+const NOW = Date.UTC(2026, 9, 16, 9, 0, 0);\n+\n+test(\"the credential goes only to the staging website beside the folder's staging server (Security condition 6)\", () => {\n+\tassert.equal(siteFor(STAGING, undefined, \"box\"), SITE);\n+\tassert.equal(siteFor(\"https://avcs-staging.chrisazy.workers.dev/\", undefined, \"pat\"), SITE);\n+\t// A server that isn't staging is refused, prod included, whatever is asked.\n+\tassert.throws(\n+\t\t() => siteFor(\"https://api.abso.dev\", undefined, \"box\"),\n+\t\t/for staging.*never sign in to the website on prod/,\n+\t);\n+\tassert.throws(() => siteFor(\"https://api.abso.dev\", \"http://localhost:8871\", \"pat\"), /for staging/);\n+\t// A box's sign-in takes no --site, not even the staging website's own address.\n+\tassert.throws(() => siteFor(STAGING, SITE, \"box\"), /isn't taken with a box's sign-in/);\n+\tassert.throws(() => siteFor(STAGING, \"http://localhost:8871\", \"box\"), /isn't taken with a box's sign-in/);\n+\t// A PAT may name this machine over http, and nothing else.\n+\tassert.equal(siteFor(STAGING, \"http://localhost:8871/x\", \"pat\"), \"http://localhost:8871\");\n+\tassert.equal(siteFor(STAGING, \"http://127.0.0.1:8871\", \"pat\"), \"http://127.0.0.1:8871\");\n+\tfor (const elsewhere of [\"https://anywhere.example\", SITE, \"https://localhost:8871\", \"not a url\"])\n+\t\tassert.throws(() => siteFor(STAGING, elsewhere, \"pat\"), /names this machine only/, elsewhere);\n+});\n+\n+test(\"a refused handoff reads no credential and sends no request\", async () => {\n+\tconst sent: string[] = [];\n+\tconst fetcher = (async (url: string) => (sent.push(url), Response.json({}))) as unknown as typeof fetch;\n+\tlet read = 0;\n+\tconst credential = () => (read++, BOX);\n+\tfor (const asked of [\n+\t\t{ server: \"https://api.abso.dev\", site: undefined, kind: \"box\" as const },\n+\t\t{ server: STAGING, site: \"https://anywhere.example\", kind: \"box\" as const },\n+\t\t{ server: STAGING, site: SITE, kind: \"box\" as const },\n+\t\t{ server: \"https://api.abso.dev\", site: \"http://localhost:8871\", kind: \"pat\" as const },\n+\t\t{ server: STAGING, site: \"https://anywhere.example\", kind: \"pat\" as const },\n+\t])\n+\t\tawait assert.rejects(webLogin({ ...asked, credential, fetcher }), /Nothing was sent/, JSON.stringify(asked));\n+\tassert.deepEqual(sent, []);\n+\tassert.equal(read, 0);\n+\t// Allowed, it goes to the staging website only.\n+\tawait webLogin({ server: STAGING, site: undefined, kind: \"pat\", credential: () => PAT, fetcher }).catch(() => {});\n+\tassert.deepEqual(sent, [`${SITE}/login/handoff`]);\n+});\n+\n+test(\"the credential goes in Authorization only, and the answer is the one link and who it signs in as\", async () => {\n+\tconst seen: { url: string; authorization: string | null; body: unknown }[] = [];\n+\tconst fetcher = (async (url: string, init: RequestInit) => {\n+\t\tseen.push({ url, authorization: new Headers(init.headers).get(\"authorization\"), body: init.body ?? null });\n+\t\treturn Response.json({\n+\t\t\turl: `${SITE}/login/handoff#${\"t\".repeat(50)}`,\n+\t\t\texpiresAt: new Date(NOW + 60_000).toISOString(),\n+\t\t\taccount: \"acct_person1\",\n+\t\t\tname: \"christopher\",\n+\t\t\tsessionEnds: \"2026-10-16T21:00:00.000Z\",\n+\t\t});\n+\t}) as typeof fetch;\n+\tconst h = await webHandoff(SITE, BOX, fetcher);\n+\tassert.deepEqual(seen, [{ url: `${SITE}/login/handoff`, authorization: `Bearer ${BOX}`, body: null }]);\n+\tconst text = handoffText(h, SITE, true, NOW);\n+\tassert.match(text, /within 60 seconds/);\n+\tassert.match(text, /as christopher, until 2026-10-16T21:00:00.000Z, and works once/);\n+\tassert.match(text, /only to the projects this box was granted, at most as a writer/);\n+\tassert.match(handoffText(h, SITE, false, NOW), /It reaches at most as a writer:/);\n+\tassert.match(text, /\\/login\\/handoff#t{50}$/);\n+\tassert.doesNotMatch(text + JSON.stringify(h), /abso_bx_/);\n+});\n+\n+test(\"a refusal says why without the credential; an answer that isn't the site's own link is refused\", async () => {\n+\tconst echo = (async () =>\n+\t\tResponse.json({ error: `that key was refused: ${BOX}` }, { status: 401 })) as unknown as typeof fetch;\n+\tawait assert.rejects(webHandoff(SITE, BOX, echo), (err: Error) => {\n+\t\tassert.match(err.message, /refused: that key was refused: \\[the credential\\]/);\n+\t\tassert.doesNotMatch(err.message, /abso_bx_/);\n+\t\treturn true;\n+\t});\n+\tconst off = (async () => Response.json({ error: \"not found\" }, { status: 404 })) as unknown as typeof fetch;\n+\tawait assert.rejects(webHandoff(SITE, BOX, off), /doesn't hand out sign-in links/);\n+\tconst elsewhere = (async () =>\n+\t\tResponse.json({\n+\t\t\turl: \"https://elsewhere.example/login/handoff#x\",\n+\t\t\texpiresAt: new Date(NOW).toISOString(),\n+\t\t\taccount: \"acct_x\",\n+\t\t})) as unknown as typeof fetch;\n+\tawait assert.rejects(webHandoff(SITE, BOX, elsewhere), /isn't a sign-in link/);\n+});\n+\n+test(\"--pat-file reads a PAT from its file, and refuses a file that doesn't hold one\", () => {\n+\tconst dir = mkdtempSync(join(tmpdir(), \"abso-web-\"));\n+\tconst good = join(dir, \"pat\");\n+\twriteFileSync(good, `abso_pat_${\"A\".repeat(40)}\\n`);\n+\tassert.equal(patFromFile(good), `abso_pat_${\"A\".repeat(40)}`);\n+\tconst bad = join(dir, \"not\");\n+\twriteFileSync(bad, \"hello\");\n+\tassert.throws(() => patFromFile(bad), /doesn't hold a PAT/);\n+\tassert.throws(() => patFromFile(join(dir, \"missing\")), /can't read/);\n+});"},{"path":"scripts/local-measure.ts","added":123,"removed":0,"diff":"--- /dev/null\n+++ b/scripts/local-measure.ts\n@@ -0,0 +1,123 @@\n+// Time and memory of a local project's commands (abso init --local) on a small and a large history:\n+//\n+//   node scripts/local-measure.ts [versions ...]        (default: 20 1000)\n+//\n+// Each history is built in this process through the client's main(); then every command is run as its own\n+// `node client/abso.ts` process, the way a person or an agent runs it, five times. It prints the median and slowest\n+// wall time, and the largest peak memory (maxRSS) of those runs, with the store's size on disk.\n+\n+import { spawnSync } from \"node:child_process\";\n+import { mkdtempSync, readdirSync, rmSync, statSync, writeFileSync } from \"node:fs\";\n+import { tmpdir } from \"node:os\";\n+import { join, resolve } from \"node:path\";\n+import { fileURLToPath, pathToFileURL } from \"node:url\";\n+import { main } from \"../client/src/main.ts\";\n+\n+const ROOT = resolve(fileURLToPath(new URL(\"..\", import.meta.url)));\n+const ENTRY = join(ROOT, \"client\", \"abso.ts\");\n+const FILES = 40;\n+const RUNS = 5;\n+\n+const sizes = process.argv.slice(2).map(Number);\n+const histories = sizes.length > 0 ? sizes : [20, 1000];\n+\n+function sizeOf(dir: string): number {\n+\tlet total = 0;\n+\tfor (const name of readdirSync(dir)) {\n+\t\tconst path = join(dir, name);\n+\t\tconst s = statSync(path);\n+\t\ttotal += s.isDirectory() ? sizeOf(path) : s.size;\n+\t}\n+\treturn total;\n+}\n+\n+const lines = (file: number, version: number) =>\n+\tArray.from({ length: 30 }, (_, i) =>\n+\t\ti === version % 30 ? `line ${i} of file ${file}, version ${version}` : `line ${i} of file ${file}`,\n+\t)\n+\t\t.join(\"\\n\")\n+\t\t.concat(\"\\n\");\n+\n+async function build(versions: number): Promise<{ store: string; alice: string; bob: string }> {\n+\tconst store = mkdtempSync(join(tmpdir(), \"abso-measure-store-\"));\n+\tconst alice = mkdtempSync(join(tmpdir(), \"abso-measure-alice-\"));\n+\tconst bob = mkdtempSync(join(tmpdir(), \"abso-measure-bob-\"));\n+\tconst env = { ABSO_STORE: store, ABSO_SERVERS_FILE: \"no-servers.json\" };\n+\tconst run = async (cwd: string, ...argv: string[]) => {\n+\t\tconst r = await main(argv, { cwd, env, write: () => {} });\n+\t\tif (r.exit !== 0) throw new Error(`${argv.join(\" \")}: ${r.stdout}${r.stderr}`);\n+\t};\n+\tfor (let f = 0; f < FILES; f++) writeFileSync(join(alice, `f${f}.txt`), lines(f, 0));\n+\tawait run(alice, \"init\", \"--local\", \"--project\", \"measure\", \"--agent\", \"alice\", \"--as-is\");\n+\tfor (let v = 1; v < versions; v++) {\n+\t\t// Each version changes three files, as a small piece of work does.\n+\t\tfor (const f of [v % FILES, (v * 7) % FILES, (v * 13) % FILES])\n+\t\t\twriteFileSync(join(alice, `f${f}.txt`), lines(f, v));\n+\t\tawait run(alice, \"push\", \"-m\", `Version ${v}`);\n+\t}\n+\tawait run(bob, \"join\", \"measure\", \"--local\", \"--agent\", \"bob\", \"--dir\", bob);\n+\treturn { store, alice, bob };\n+}\n+\n+function measure(cwd: string, store: string, argv: string[]): { median: number; slowest: number; rss: number } {\n+\tconst times: number[] = [];\n+\tlet rss = 0;\n+\tconst preload = join(tmpdir(), `abso-measure-rss-${process.pid}.mjs`);\n+\tconst out = join(tmpdir(), `abso-measure-rss-${process.pid}.json`);\n+\twriteFileSync(\n+\t\tpreload,\n+\t\t`import { writeFileSync } from \"node:fs\";\\nprocess.on(\"exit\", () => writeFileSync(${JSON.stringify(out)}, String(process.resourceUsage().maxRSS)));\\n`,\n+\t);\n+\tfor (let i = 0; i < RUNS; i++) {\n+\t\tconst started = performance.now();\n+\t\tconst r = spawnSync(process.execPath, [\"--import\", pathToFileURL(preload).href, ENTRY, ...argv], {\n+\t\t\tcwd,\n+\t\t\tenv: { ...process.env, ABSO_STORE: store, ABSO_SERVERS_FILE: \"no-servers.json\" },\n+\t\t\tencoding: \"utf8\",\n+\t\t});\n+\t\ttimes.push(performance.now() - started);\n+\t\tif (r.status !== 0 && argv[0] !== \"push\") throw new Error(`${argv.join(\" \")}: ${r.stdout}${r.stderr}`);\n+\t\trss = Math.max(\n+\t\t\trss,\n+\t\t\tNumber(\n+\t\t\t\tspawnSync(\n+\t\t\t\t\tprocess.execPath,\n+\t\t\t\t\t[\"-e\", `process.stdout.write(require(\"fs\").readFileSync(${JSON.stringify(out)}, \"utf8\"))`],\n+\t\t\t\t\t{ encoding: \"utf8\" },\n+\t\t\t\t).stdout,\n+\t\t\t),\n+\t\t);\n+\t}\n+\ttimes.sort((a, b) => a - b);\n+\treturn { median: times[Math.floor(RUNS / 2)]!, slowest: times[RUNS - 1]!, rss };\n+}\n+\n+const kb = (n: number) => `${(n / 1024).toFixed(0)} MB`;\n+const ms = (n: number) => `${n.toFixed(0)} ms`;\n+console.log(\n+\t`Node ${process.versions.node}, ${FILES} files of 30 lines, three files changed per version, ${RUNS} runs each.`,\n+);\n+console.log(\"history   | command              | median   | slowest  | peak memory\");\n+for (const versions of histories) {\n+\tconst started = performance.now();\n+\tconst { store, alice, bob } = await build(versions);\n+\tconst built = performance.now() - started;\n+\tconst steps: [string, string, string[]][] = [\n+\t\t[\"status\", alice, [\"status\"]],\n+\t\t[\"log\", alice, [\"log\"]],\n+\t\t[\"blame\", alice, [\"blame\", \"f0.txt\"]],\n+\t\t[\"pull (no change)\", bob, [\"pull\"]],\n+\t\t[\"record + push\", alice, [\"push\", \"-m\", \"One more\"]],\n+\t];\n+\tfor (const [name, cwd, argv] of steps) {\n+\t\tif (argv[0] === \"push\") writeFileSync(join(cwd, \"f1.txt\"), lines(1, versions + Math.random()));\n+\t\tconst m = measure(cwd, store, argv);\n+\t\tconsole.log(\n+\t\t\t`${String(versions).padStart(5)} v   | ${name.padEnd(20)} | ${ms(m.median).padStart(8)} | ${ms(m.slowest).padStart(8)} | ${kb(m.rss)}`,\n+\t\t);\n+\t}\n+\tconsole.log(\n+\t\t`${String(versions).padStart(5)} v   | store on disk ${(sizeOf(store) / 1048576).toFixed(1)} MB, built in-process in ${(built / 1000).toFixed(1)} s`,\n+\t);\n+\tfor (const d of [store, alice, bob]) rmSync(d, { recursive: true, force: true, maxRetries: 5 });\n+}"},{"path":"scripts/local-writers.ts","added":87,"removed":0,"diff":"--- /dev/null\n+++ b/scripts/local-writers.ts\n@@ -0,0 +1,87 @@\n+// A local project's store lock under load: 1, 4 and 16 writers pushing to one local project at once.\n+//\n+//   node scripts/local-writers.ts [writers ...]        (default: 1 4 16; PUSHES=10 pushes per writer)\n+//\n+// Each writer is its own agent, in its own folder, changing its own file, so nothing collides: what's measured is the\n+// store's lock (one SQLite write transaction per call). Every push is its own `node client/abso.ts push` process, as\n+// an agent runs it. It prints each push's wall time (median, 95th percentile, slowest), the pushes per second across\n+// all writers, and any push that failed.\n+\n+import { spawn } from \"node:child_process\";\n+import { mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\n+import { tmpdir } from \"node:os\";\n+import { join, resolve } from \"node:path\";\n+import { fileURLToPath } from \"node:url\";\n+import { main } from \"../client/src/main.ts\";\n+\n+const ROOT = resolve(fileURLToPath(new URL(\"..\", import.meta.url)));\n+const ENTRY = join(ROOT, \"client\", \"abso.ts\");\n+const PUSHES = Number(process.env.PUSHES ?? 10);\n+const counts = process.argv.slice(2).map(Number);\n+\n+function push(cwd: string, store: string, message: string): Promise<{ ms: number; ok: boolean; out: string }> {\n+\tconst started = performance.now();\n+\treturn new Promise((done) => {\n+\t\tconst child = spawn(process.execPath, [ENTRY, \"push\", \"-m\", message], {\n+\t\t\tcwd,\n+\t\t\tenv: { ...process.env, ABSO_STORE: store, ABSO_SERVERS_FILE: \"no-servers.json\" },\n+\t\t});\n+\t\tlet out = \"\";\n+\t\tchild.stdout.on(\"data\", (d) => {\n+\t\t\tout += d;\n+\t\t});\n+\t\tchild.stderr.on(\"data\", (d) => {\n+\t\t\tout += d;\n+\t\t});\n+\t\tchild.on(\"close\", (code) => done({ ms: performance.now() - started, ok: code === 0, out }));\n+\t});\n+}\n+\n+const pct = (sorted: number[], p: number) => sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * p))]!;\n+console.log(`Node ${process.versions.node}, ${PUSHES} pushes per writer, each writer its own agent and file.`);\n+console.log(\"writers | pushes | median   | p95      | slowest  | pushes/s | failed\");\n+for (const writers of counts.length > 0 ? counts : [1, 4, 16]) {\n+\tconst store = mkdtempSync(join(tmpdir(), \"abso-writers-store-\"));\n+\tconst folders: string[] = [];\n+\tconst env = { ABSO_STORE: store, ABSO_SERVERS_FILE: \"no-servers.json\" };\n+\tconst first = mkdtempSync(join(tmpdir(), \"abso-writers-w0-\"));\n+\twriteFileSync(join(first, \"readme.txt\"), \"writers\\n\");\n+\tconst init = await main([\"init\", \"--local\", \"--project\", \"writers\", \"--agent\", \"w0\", \"--as-is\"], {\n+\t\tcwd: first,\n+\t\tenv,\n+\t\twrite: () => {},\n+\t});\n+\tif (init.exit !== 0) throw new Error(init.stdout + init.stderr);\n+\tfolders.push(first);\n+\tfor (let w = 1; w < writers; w++) {\n+\t\tconst dir = mkdtempSync(join(tmpdir(), `abso-writers-w${w}-`));\n+\t\tconst joined = await main([\"join\", \"writers\", \"--local\", \"--agent\", `w${w}`, \"--dir\", dir], {\n+\t\t\tcwd: dir,\n+\t\t\tenv,\n+\t\t\twrite: () => {},\n+\t\t});\n+\t\tif (joined.exit !== 0) throw new Error(joined.stdout + joined.stderr);\n+\t\tfolders.push(dir);\n+\t}\n+\tconst times: number[] = [];\n+\tconst failures: string[] = [];\n+\tconst started = performance.now();\n+\tawait Promise.all(\n+\t\tfolders.map(async (dir, w) => {\n+\t\t\tfor (let i = 0; i < PUSHES; i++) {\n+\t\t\t\twriteFileSync(join(dir, `w${w}.txt`), `writer ${w}, push ${i}\\n`);\n+\t\t\t\tconst r = await push(dir, store, `w${w} push ${i}`);\n+\t\t\t\ttimes.push(r.ms);\n+\t\t\t\tif (!r.ok) failures.push(`w${w} push ${i}: ${r.out.trim().split(\"\\n\").slice(-2).join(\" / \")}`);\n+\t\t\t}\n+\t\t}),\n+\t);\n+\tconst total = (performance.now() - started) / 1000;\n+\ttimes.sort((a, b) => a - b);\n+\tconst ms = (n: number) => `${n.toFixed(0)} ms`.padStart(8);\n+\tconsole.log(\n+\t\t`${String(writers).padStart(7)} | ${String(times.length).padStart(6)} | ${ms(pct(times, 0.5))} | ${ms(pct(times, 0.95))} | ${ms(times.at(-1)!)} | ${(times.length / total).toFixed(1).padStart(8)} | ${failures.length}`,\n+\t);\n+\tfor (const f of failures.slice(0, 5)) console.log(`        ${f}`);\n+\tfor (const d of [store, ...folders]) rmSync(d, { recursive: true, force: true, maxRetries: 5 });\n+}"},{"path":"src/engine/graph.ts","added":53,"removed":52,"diff":"--- a/src/engine/graph.ts\n+++ b/src/engine/graph.ts\n@@ -1524,43 +1524,39 @@\n \t * the search never descends below the target's lamport.\n \t */\n \t#reaches(from: Iterable<AtomId>, target: AtomId): boolean {\n-\t\tconst floor = this.#lamportAt(this.#seq(target));\n-\t\tif (this.#storage) {\n-\t\t\treturn this.withProjectionScratch((scratch) => {\n-\t\t\t\tlet length = 0;\n-\t\t\t\tconst push = (id: AtomId): void => {\n-\t\t\t\t\tif (scratch.read(\"seen\", id)) return;\n-\t\t\t\t\tscratch.write(\"seen\", id, true);\n-\t\t\t\t\tscratch.write(\"stack\", String(length++), id);\n-\t\t\t\t};\n-\t\t\t\tfor (const id of from) {\n-\t\t\t\t\tif (id === target) return true;\n-\t\t\t\t\tif (this.#lamportAt(this.#seq(id)) > floor) push(id);\n-\t\t\t\t}\n-\t\t\t\twhile (length > 0) {\n-\t\t\t\t\tconst key = String(--length);\n-\t\t\t\t\tconst current = scratch.read(\"stack\", key) as AtomId;\n-\t\t\t\t\tscratch.remove(\"stack\", key);\n-\t\t\t\t\tif (this.#lamportAt(this.#seq(current)) <= floor) continue;\n-\t\t\t\t\tfor (const dependency of this.atom(current).deps) {\n-\t\t\t\t\t\tif (dependency === target) return true;\n-\t\t\t\t\t\tpush(dependency);\n-\t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t\treturn false;\n-\t\t\t});\n+\t\treturn this.#reachable(from, new Set([target])).has(target);\n+\t}\n+\n+\t/**\n+\t * Which of `targets` are reachable along deps from any of `from` (themselves included), in one walk: it never\n+\t * descends below the lowest target's lamport, and stops once every target is found (abso 714, piece 4: record\n+\t * walked once per line writer).\n+\t * The walk's seen marks and stack are in memory, by atom number: one byte and four bytes an atom at most, so about\n+\t * 62 KB on abso's 12,454 atoms and 50 MB at 10 million, under a Worker's 128 MB. They were scratch rows in storage\n+\t * (abso-core 139, bounding memory with the graph), which cost a read and a write per atom visited: on abso's Oct 14\n+\t * tables, 41,000 of a 1470-shaped record's 77,767 statements.\n+\t */\n+\t#reachable(from: Iterable<AtomId>, targets: ReadonlySet<AtomId>): Set<AtomId> {\n+\t\tconst found = new Set<AtomId>();\n+\t\tlet floor = Number.POSITIVE_INFINITY;\n+\t\tfor (const target of targets) floor = Math.min(floor, this.#lamportAt(this.#seq(target)));\n+\t\tconst seen = new Uint8Array(this.#atoms.length);\n+\t\tconst stack = new Int32Array(this.#atoms.length);\n+\t\tlet length = 0;\n+\t\tconst visit = (id: AtomId): void => {\n+\t\t\tif (targets.has(id)) found.add(id);\n+\t\t\tconst seq = this.#seq(id);\n+\t\t\tif (seen[seq]) return;\n+\t\t\tseen[seq] = 1;\n+\t\t\tstack[length++] = seq;\n+\t\t};\n+\t\tfor (const id of from) visit(id);\n+\t\twhile (length > 0 && found.size < targets.size) {\n+\t\t\tconst seq = stack[--length]!;\n+\t\t\tif (this.#lamportAt(seq) <= floor) continue;\n+\t\t\tfor (const dependency of this.atom(atomId(seq)).deps) visit(dependency);\n \t\t}\n-\t\tconst seen = new Set<AtomId>();\n-\t\tconst stack = [...from];\n-\t\twhile (stack.length > 0) {\n-\t\t\tconst cur = stack.pop()!;\n-\t\t\tif (cur === target) return true;\n-\t\t\tif (seen.has(cur)) continue;\n-\t\t\tseen.add(cur);\n-\t\t\tif (this.#lamportAt(this.#seq(cur)) <= floor) continue;\n-\t\t\tfor (const d of this.atom(cur).deps) if (!seen.has(d)) stack.push(d);\n-\t\t}\n-\t\treturn false;\n+\t\treturn found;\n \t}\n \n \t/**\n@@ -1610,23 +1606,28 @@\n \t\tfor (const r of atom.reasons) if (!this.has(r.to)) bad(`reason points at unknown atom ${r.to}`);\n \n \t\t// Everything it touches must come from its closure. Derived deps name the\n-\t\t// writers directly, so this is usually one lookup per writer.\n-\t\tconst memoryBelow = scratch ? undefined : new Map<AtomId, boolean>();\n-\t\tconst below = {\n-\t\t\tget: (key: AtomId) => (scratch ? (scratch.read(\"below\", key) as boolean | undefined) : memoryBelow!.get(key)),\n-\t\t\tset: (key: AtomId, value: boolean) => {\n-\t\t\t\tif (scratch) scratch.write(\"below\", key, value);\n-\t\t\t\telse memoryBelow!.set(key, value);\n-\t\t\t},\n-\t\t};\n-\t\tconst inClosure = (writer: AtomId): boolean => {\n-\t\t\tlet hit = below.get(writer);\n-\t\t\tif (hit === undefined) {\n-\t\t\t\thit = deps.has(writer) || this.#reaches(atom.deps, writer);\n-\t\t\t\tbelow.set(writer, hit);\n+\t\t// writers directly, so this is usually one lookup per writer. The writers\n+\t\t// that aren't deps are walked for together, once (abso 714, piece 4).\n+\t\tconst touched: LineId[] = [];\n+\t\tfor (const run of atom.inserts) if (!isStartNode(run.parent)) touched.push(run.parent);\n+\t\tfor (const m of atom.moves ?? []) {\n+\t\t\ttouched.push(m.line);\n+\t\t\tif (!isStartNode(m.parent)) touched.push(m.parent);\n+\t\t}\n+\t\ttouched.push(...atom.deletes);\n+\t\tfor (const list of [atom.writes, atom.reads, atom.holds])\n+\t\t\tfor (const key of list) {\n+\t\t\t\tconst parsed = parseKey(key);\n+\t\t\t\tif (parsed.kind === \"line\" || ((parsed.kind === \"gap\" || parsed.kind === \"pos\") && !isStartNode(parsed.node)))\n+\t\t\t\t\ttouched.push(parsed.node);\n \t\t\t}\n-\t\t\treturn hit;\n-\t\t};\n+\t\tconst beyond = new Set<AtomId>();\n+\t\tfor (const line of touched) {\n+\t\t\tconst writer = this.lineAtom(line);\n+\t\t\tif (writer !== undefined && !deps.has(writer)) beyond.add(writer);\n+\t\t}\n+\t\tconst reached = beyond.size > 0 ? this.#reachable(atom.deps, beyond) : beyond;\n+\t\tconst inClosure = (writer: AtomId): boolean => deps.has(writer) || reached.has(writer);\n \t\tconst checkLine = (line: LineId, what: string): void => {\n \t\t\tconst writer = this.lineAtom(line);\n \t\t\tif (writer === undefined) return bad(`${what} names unknown line ${line}`);"},{"path":"src/engine/view.ts","added":19,"removed":10,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -10,7 +10,7 @@\n // made when a caller asks for them, and the latest asked for is kept.\n \n import type { Graph, RelocationInfo } from \"./graph.ts\";\n-import { isStartNode, lineId, seqOf } from \"./keys.ts\";\n+import { atomId, isStartNode, lineId, seqOf } from \"./keys.ts\";\n import { resolveScratchMoves, scratchLayoutNodes } from \"./relocation-scratch.ts\";\n import { isClosedSet, StableSet } from \"./state-source.ts\";\n import { joinLines } from \"./text.ts\";\n@@ -1095,7 +1095,14 @@\n \t}\n \n \t*lineChunks(path: string): IterableIterator<() => Iterable<string>> {\n-\t\tfor (const n of this.#file(path).vis) yield () => this.graph.textChunks(n);\n+\t\t// The texts the packed layout already holds, read a page at a time (abso Capacity, 714): a record's diff read each\n+\t\t// line's own row, 11,873 statements for abso's index.ts. Only a line too long to pack is read in chunks.\n+\t\tconst { vis, visText } = this.#file(path);\n+\t\tfor (let i = 0; i < vis.length; i++) {\n+\t\t\tconst packed = visText?.[i];\n+\t\t\tif (packed != null) yield () => [packed];\n+\t\t\telse yield () => this.graph.textChunks(vis[i]!);\n+\t\t}\n \t}\n \n \t/** Visible lines without retaining their text in the view cache. */\n@@ -1105,7 +1112,7 @@\n \t\t\tyield {\n \t\t\t\tid: graph.lineIdOf(n),\n \t\t\t\ttext: graph.textOf(n),\n-\t\t\t\tatom: graph.idOfSeq(graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(graph.writerSeqOf(n)),\n \t\t\t};\n \t}\n \n@@ -1119,12 +1126,12 @@\n \t\t\tconst n = vis[i]!;\n \t\t\tconst packed = visText?.[i];\n \t\t\tlines[i] = {\n-\t\t\t\tid: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n \t\t\t\ttextChunks: () => graph.textChunks(n),\n \t\t\t\tget text() {\n \t\t\t\t\treturn packed ?? graph.textOf(n);\n \t\t\t\t},\n-\t\t\t\tatom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n \t\t\t};\n \t\t}\n \t\treturn lines;\n@@ -1136,12 +1143,14 @@\n \t\tconst graph = this.graph;\n \t\tconst { vis, visText, visWriter, visK } = this.#file(path);\n \t\tconst lines: VisibleLine[] = new Array(vis.length);\n+\t\t// Writer seqs come from the graph's own layout, so they're named with atomId, not checked by idOfSeq (abso 738):\n+\t\t// on a stored graph its check read the atom count once a line, about 0.9 s of a warm draft-state on abso.\n \t\tfor (let i = 0; i < vis.length; i++) {\n \t\t\tconst n = vis[i]!;\n \t\t\tlines[i] = {\n-\t\t\t\tid: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n \t\t\t\ttext: visText?.[i] ?? graph.textOf(n),\n-\t\t\t\tatom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n \t\t\t};\n \t\t}\n \t\tthis.#linesCache = { path, lines };\n@@ -1163,13 +1172,13 @@\n \t\t\tconst writer = seqWriter ? seqWriter[i]! : graph.writerSeqOf(n);\n \t\t\tlet text: string | undefined;\n \t\t\tout[i] = {\n-\t\t\t\tid: seqWriter && seqK ? lineId(graph.idOfSeq(writer), seqK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: seqWriter && seqK ? lineId(atomId(writer), seqK[i]!) : graph.lineIdOf(n),\n \t\t\t\tget text() {\n \t\t\t\t\ttext ??= graph.textOf(n);\n \t\t\t\t\treturn text;\n \t\t\t\t},\n-\t\t\t\tatom: graph.idOfSeq(writer),\n-\t\t\t\tdeletedBy: by ? by.map((s) => graph.idOfSeq(s)) : NONE,\n+\t\t\t\tatom: atomId(writer),\n+\t\t\t\tdeletedBy: by ? by.map((s) => atomId(s)) : NONE,\n \t\t\t\tvisible: by === undefined,\n \t\t\t};\n \t\t}"},{"path":"worker/project/collisions.ts","added":7,"removed":5,"diff":"--- a/worker/project/collisions.ts\n+++ b/worker/project/collisions.ts\n@@ -68,7 +68,7 @@\n \t\t}\n \t\tfor (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key));\n \t\tconst theirs: AtomId[] = [];\n-\t\tfor (const id of orderedClaimants(g, streams)) if (against.has(id)) theirs.push(id);\n+\t\tfor (const id of orderedClaimants(streams)) if (against.has(id)) theirs.push(id);\n \t\tout.set(yours, theirs);\n \t}\n \treturn out;\n@@ -136,7 +136,7 @@\n \n /** Claim indexes append in canonical seq order. Merge one cursor per current\n  * atom key, retaining no candidate set proportional to historical claims. */\n-function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {\n+function* orderedClaimants(streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {\n \ttry {\n \t\ttype Head = { id: AtomId; seq: number; stream: number };\n \t\tconst heap: Head[] = [];\n@@ -152,9 +152,11 @@\n \t\t\t}\n \t\t\theap[at] = head;\n \t\t};\n+\t\t// Each claimant's seq from its id, as the graph reads it (abso 738): loading the stored atom for it read a row a\n+\t\t// claimant, most of a warm draft-state's pairing on abso.\n \t\tconst advance = (stream: number) => {\n \t\t\tconst next = streams[stream]!.next();\n-\t\t\tif (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });\n+\t\t\tif (!next.done) push({ id: next.value, seq: seqOf(next.value), stream });\n \t\t};\n \t\tfor (let stream = 0; stream < streams.length; stream++) advance(stream);\n \t\tlet previous = -1;\n@@ -190,8 +192,8 @@\n \t\tlet a = left.next();\n \t\tlet b = right.next();\n \t\twhile (!a.done && !b.done) {\n-\t\t\tconst x = g.atom(a.value).seq;\n-\t\t\tconst y = g.atom(b.value).seq;\n+\t\t\tconst x = seqOf(a.value);\n+\t\t\tconst y = seqOf(b.value);\n \t\t\tif (x === y && settled.has(a.value)) return true;\n \t\t\tif (x <= y) a = left.next();\n \t\t\tif (y <= x) b = right.next();"},{"path":"worker/project/definition-rule.ts","added":68,"removed":35,"diff":"--- a/worker/project/definition-rule.ts\n+++ b/worker/project/definition-rule.ts\n@@ -7,7 +7,7 @@\n import { type AtomId, type Graph, joinLines, type LineId, type ReadView } from \"../../src/engine/index.ts\";\n import { type Origin, touchedFiles } from \"./collisions.ts\";\n import { type Definition, definitionsIn, importsOf, usedNames } from \"./definitions.ts\";\n-import { definitionsBytes, type KeptParts, usesBytes } from \"./kept-parts.ts\";\n+import { definitionsBytes, filesBytes, type KeptParts, usesBytes } from \"./kept-parts.ts\";\n import { codeOfLines, declaredIn, holdsNoCode } from \"./names.ts\";\n import { definitionText } from \"./news.ts\";\n import type { Collision } from \"./project.ts\";\n@@ -37,7 +37,7 @@\n \treadonly parent: string;\n }\n \n-/** Definitions in the files newer work touched, before it and with it. */\n+/** Definitions in one file newer work touched, before it and with it. */\n interface Changed {\n \treadonly baseDefs: ReturnType<typeof definitionsIn>;\n \treadonly nowDefs: ReturnType<typeof definitionsIn>;\n@@ -52,8 +52,11 @@\n \treadonly #replacedCache = new Map<string, ReadonlySet<string>>();\n \t/** A draft's uses, kept while it is asked about with the same views: draft collisions ask once per other agent. */\n \treadonly #usesCache = new WeakMap<ReadonlySet<AtomId>, { view: ReadView; base: ReadView; uses: Uses }>();\n-\t/** The newer work's definitions before and after, kept while it is asked about with the same views. */\n-\treadonly #changedCache = new WeakMap<ReadonlySet<AtomId>, { base: ReadView; now: ReadView; defs: Changed }>();\n+\t/** The files the newer work touched, kept while it is asked about with the same views. */\n+\treadonly #touchedCache = new WeakMap<\n+\t\tReadonlySet<AtomId>,\n+\t\t{ base: ReadView; now: ReadView; files: ReadonlySet<string> }\n+\t>();\n \n \tconstructor(graph: Graph, origin: (atom: AtomId, spaceName: string) => Origin) {\n \t\tthis.#graph = graph;\n@@ -122,6 +125,11 @@\n \t\tspaceName: string,\n \t\tkept?: { parts: KeptParts; uses: string; changed: string },\n \t\tnames?: ReadonlySet<string>,\n+\t\t/**\n+\t\t * The files the newer work changed, when the caller knows them without placing its lines (land and draft-state:\n+\t\t * shared's kept version files, abso 738); undefined, or one that answers undefined, and they're worked out here.\n+\t\t */\n+\t\tchangedFiles?: () => ReadonlySet<string> | undefined,\n \t): DefinitionCollision[] {\n \t\tif (draft.size === 0 || newer.size === 0) return [];\n \t\tconst uses = kept\n@@ -131,31 +139,56 @@\n \t\t// Only these names can collide (a publish's news, news.ts): a draft that uses none of them has none, and the\n \t\t// definitions changed since its base needn't be worked out.\n \t\tif (names && ![...uses.keys()].some((name) => names.has(name))) return [];\n-\t\tconst nowOf = () => (typeof nowView === \"function\" ? nowView() : nowView);\n-\t\tconst { baseDefs, nowDefs } = kept\n-\t\t\t? kept.parts.get(\n-\t\t\t\t\t`changed ${kept.changed}`,\n-\t\t\t\t\t() => this.#changed(newer, baseView, nowOf()),\n-\t\t\t\t\t(c) => definitionsBytes(c.baseDefs) + definitionsBytes(c.nowDefs),\n-\t\t\t\t)\n-\t\t\t: this.#changedFor(newer, baseView, nowOf());\n-\t\tconst out: DefinitionCollision[] = [];\n-\t\tfor (const [name, where] of [...uses].sort(([a], [b]) => (a < b ? -1 : 1))) {\n-\t\t\t// Which definitions the uses mean: the file each use imports the name\n-\t\t\t// from, or its own file when it defines the name at the top level. A\n-\t\t\t// use with neither (a local, a parameter, a global, a name another\n-\t\t\t// language brings in some other way) means none: the rule only speaks\n-\t\t\t// when it knows which definition a use means.\n+\t\t// Which definitions the uses mean: the file each use imports the name\n+\t\t// from, or its own file when it defines the name at the top level. A\n+\t\t// use with neither (a local, a parameter, a global, a name another\n+\t\t// language brings in some other way) means none: the rule only speaks\n+\t\t// when it knows which definition a use means.\n+\t\tconst scopes = new Map<string, ReadonlySet<string>>();\n+\t\tfor (const [name, where] of uses) {\n \t\t\tconst scope = new Set<string>();\n \t\t\tfor (const w of new Set(where.map((x) => x.file))) {\n \t\t\t\tconst from = importsOf(view, w).get(name) ?? (definitionsIn(view, [w]).has(name) ? w : undefined);\n \t\t\t\tif (from !== undefined) scope.add(from);\n \t\t\t}\n-\t\t\tif (scope.size === 0) continue;\n-\t\t\tconst inScope = (d: Definition): boolean => scope.has(d.file);\n-\t\t\tconst before = baseDefs.get(name)?.filter(inScope);\n-\t\t\tif (!before?.length) continue; // not defined in what the drafter saw: nothing it relies on\n-\t\t\tconst after = (nowDefs.get(name) ?? []).filter(inScope);\n+\t\t\tif (scope.size > 0) scopes.set(name, scope);\n+\t\t}\n+\t\tif (scopes.size === 0) return [];\n+\t\tconst nowOf = () => (typeof nowView === \"function\" ? nowView() : nowView);\n+\t\t// Only a file the newer work touched can hold a changed definition, and only one a use means can matter: just those\n+\t\t// files are laid out, before and with the newer work (abso 738). Laying out every file the newer work touched cost\n+\t\t// codex-prose-authorship-610's draft-state 494 files a view where its uses reach 7.\n+\t\tconst touched =\n+\t\t\tchangedFiles?.() ??\n+\t\t\t(kept\n+\t\t\t\t? kept.parts.get(`touched ${kept.changed}`, () => this.#touched(newer, baseView, nowOf()), filesBytes)\n+\t\t\t\t: this.#touchedFor(newer, baseView, nowOf()));\n+\t\tconst changed = new Map<string, Changed>();\n+\t\tconst changedIn = (file: string): Changed => {\n+\t\t\tlet c = changed.get(file);\n+\t\t\tif (!c) {\n+\t\t\t\tconst make = (): Changed => ({\n+\t\t\t\t\tbaseDefs: definitionsIn(baseView, [file]),\n+\t\t\t\t\tnowDefs: definitionsIn(nowOf(), [file]),\n+\t\t\t\t});\n+\t\t\t\tc = kept\n+\t\t\t\t\t? kept.parts.get(\n+\t\t\t\t\t\t\t`changed ${kept.changed} ${file}`,\n+\t\t\t\t\t\t\tmake,\n+\t\t\t\t\t\t\t(d) => definitionsBytes(d.baseDefs) + definitionsBytes(d.nowDefs),\n+\t\t\t\t\t\t)\n+\t\t\t\t\t: make();\n+\t\t\t\tchanged.set(file, c);\n+\t\t\t}\n+\t\t\treturn c;\n+\t\t};\n+\t\tconst out: DefinitionCollision[] = [];\n+\t\tfor (const [name, scope] of [...scopes].sort(([a], [b]) => (a < b ? -1 : 1))) {\n+\t\t\t// In the order the newer work touched its files, as when every touched file was laid out.\n+\t\t\tconst files = [...touched].filter((f) => scope.has(f));\n+\t\t\tconst before = files.flatMap((f) => changedIn(f).baseDefs.get(name) ?? []);\n+\t\t\tif (!before.length) continue; // not defined in what the drafter saw: nothing it relies on\n+\t\t\tconst after = files.flatMap((f) => changedIn(f).nowDefs.get(name) ?? []);\n \t\t\tif (signature(before) === signature(after)) continue;\n \t\t\t// Who changed it: newer writers of the new definition's lines, or newer deleters of the old one's.\n \t\t\tconst by = new Set<AtomId>();\n@@ -166,6 +199,7 @@\n \t\t\tconst first = [...by].sort((p, q) => this.#graph.atom(p).seq - this.#graph.atom(q).seq)[0];\n \t\t\tif (first === undefined) continue;\n \t\t\tconst origin = this.#origin(first, spaceName);\n+\t\t\tconst where = uses.get(name)!;\n \t\t\tconst file = where[0]!.file;\n \t\t\tconst indexes = where.filter((w) => w.file === file).map((w) => w.index);\n \t\t\tconst lo = Math.min(...indexes);\n@@ -205,20 +239,19 @@\n \t\treturn kept.uses;\n \t}\n \n-\t/** The newer work's definitions before and after, kept while it is asked about with the same views. */\n-\t#changedFor(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): Changed {\n-\t\tlet changed = this.#changedCache.get(newer);\n-\t\tif (!changed || changed.base !== baseView || changed.now !== now) {\n-\t\t\tchanged = { base: baseView, now, defs: this.#changed(newer, baseView, now) };\n-\t\t\tthis.#changedCache.set(newer, changed);\n+\t/** The files the newer work touched, kept while it is asked about with the same views. */\n+\t#touchedFor(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): ReadonlySet<string> {\n+\t\tlet kept = this.#touchedCache.get(newer);\n+\t\tif (!kept || kept.base !== baseView || kept.now !== now) {\n+\t\t\tkept = { base: baseView, now, files: this.#touched(newer, baseView, now) };\n+\t\t\tthis.#touchedCache.set(newer, kept);\n \t\t}\n-\t\treturn changed.defs;\n+\t\treturn kept.files;\n \t}\n \n-\t/** Definitions in the files the newer work touched, before it and with it: only there can one have changed. */\n-\t#changed(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): Changed {\n-\t\tconst touched = touchedFiles(this.#graph, newer, [baseView, now]);\n-\t\treturn { baseDefs: definitionsIn(baseView, touched), nowDefs: definitionsIn(now, touched) };\n+\t/** The files the newer work touched, before it and with it: only there can a definition have changed. */\n+\t#touched(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): ReadonlySet<string> {\n+\t\treturn touchedFiles(this.#graph, newer, [baseView, now]);\n \t}\n \n \t/** The names the draft's lines use and don't declare, less those the lines they replaced already used. */"},{"path":"worker/project/express-moves.ts","added":25,"removed":1,"diff":"--- a/worker/project/express-moves.ts\n+++ b/worker/project/express-moves.ts\n@@ -62,6 +62,29 @@\n \tconst g = host.graph;\n \tconst mine = new Set(draft);\n \tconst text = new MoveLineText(g);\n+\t// The draft's own lines first, before laying out any file (abso 714, piece 3): a move needs a written line with\n+\t// real content whose text the draft also deleted. An edit that only changes lines has none, and laying out its\n+\t// files (12k lines twice for one changed line of worker/src/index.ts) cost the whole publish.\n+\tconst goneIds = new Set<LineId>();\n+\tconst goneTexts = new Set<number>();\n+\tfor (const id of draft)\n+\t\tfor (const line of g.deletedLines(id)) {\n+\t\t\tgoneIds.add(line);\n+\t\t\tgoneTexts.add(text.intern(line));\n+\t\t}\n+\tif (goneTexts.size === 0) return;\n+\tlet moved = false;\n+\tfor (const id of draft) {\n+\t\tfor (const line of g.eachInsertedLine(id)) {\n+\t\t\tconst t = text.intern(line);\n+\t\t\tif (!text.plain[t] && goneTexts.has(t)) {\n+\t\t\t\tmoved = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tif (moved) break;\n+\t}\n+\tif (!moved) return;\n \tconst after = host.agentView(agent);\n \tconst before = host.beforeDraft\n \t\t? host.beforeDraft(agent, draft)\n@@ -81,7 +104,8 @@\n \tfor (const file of [...touched].toSorted()) {\n \t\tlet cur: Block | undefined;\n \t\tbefore.buildLines(file).forEach((l, i) => {\n-\t\t\tif (g.deletersOf(l.id).some((d) => mine.has(d))) {\n+\t\t\t// Deleted by the draft: one of its atoms' deleted lines, with no lookup of each line's deleters.\n+\t\t\tif (goneIds.has(l.id)) {\n \t\t\t\tif (!cur) gone.push((cur = { file, start: i, ids: [], texts: [] }));\n \t\t\t\tcur.ids.push(l.id);\n \t\t\t\tcur.texts.push(text.intern(l.id));"},{"path":"worker/project/kept-parts.ts","added":11,"removed":4,"diff":"--- a/worker/project/kept-parts.ts\n+++ b/worker/project/kept-parts.ts\n@@ -1,8 +1,8 @@\n // What draft collisions work out about each draft and each pair of drafts, kept between calls under a hard byte budget\n-// (abso Capacity, issue 664): the names a draft's new lines use, the definitions a draft's changes touch before and\n-// after, and the names a pair of drafts both define in a file. Keys name everything an entry depends on (shared's\n-// version, a draft's base and atoms), and a call drops every entry it didn't use, so a draft that changes, an agent that\n-// leaves and shared moving on all drop theirs at once.\n+// (abso Capacity, issue 664): the names a draft's new lines use, the files a draft's changes touch and the definitions\n+// in each before and after, and the names a pair of drafts both define in a file. Keys name everything an entry depends\n+// on (shared's version, a draft's base and atoms), and a call drops every entry it didn't use, so a draft that changes,\n+// an agent that leaves and shared moving on all drop theirs at once.\n \n import { stringBytes } from \"../../src/engine/view.ts\";\n import type { Definition } from \"./definitions.ts\";\n@@ -100,3 +100,10 @@\n \t\tn += MAP_ENTRY_BYTES + stringBytes(name) + ARRAY_HEADER_BYTES + where.length * (REFERENCE_BYTES + OBJECT_BYTES);\n \treturn n;\n }\n+\n+/** A set of paths (the files some work touched). */\n+export function filesBytes(files: ReadonlySet<string>): number {\n+\tlet n = MAP_HEADER_BYTES;\n+\tfor (const file of files) n += MAP_ENTRY_BYTES + stringBytes(file);\n+\treturn n;\n+}"},{"path":"worker/project/land.ts","added":16,"removed":1,"diff":"--- a/worker/project/land.ts\n+++ b/worker/project/land.ts\n@@ -29,6 +29,8 @@\n \tpairs(draft: readonly AtomId[], against: ReadonlySet<AtomId>, settled: ReadonlySet<AtomId>): Pair[];\n \tdescribe(pair: Pair, yoursView: ReadView, theirsView: ReadView, spaceName: string): Collision;\n \tdefinitionRule(): DefinitionRule;\n+\t/** The files a space's versions after `from`, up to `to`, changed, when each one's are kept; else undefined. */\n+\tchangedSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined;\n \trefuse(\n \t\tagent: AgentState,\n \t\tspace: Space,\n@@ -93,11 +95,24 @@\n \t\t? host.viewAt(shared, sharedBaseOf(space), changes)\n \t\t: host.viewAt(space, space.versions.length - 1);\n \tconst describeLand = (p: Pair): Collision => host.describe(p, draftView, host.sharedView(), SHARED);\n+\t// Where shared changed since the draft's base, from the files each version since kept as it landed (abso 738): working\n+\t// it out from the newer atoms placed every line they wrote or deleted, about 30% of a warm draft-state read.\n+\tconst changed = () => host.changedSince(shared, sharedBaseOf(space), host.version());\n \tconst collisions = [\n \t\t...host.pairs(changes, newer, union).map(describeLand),\n \t\t...host\n \t\t\t.definitionRule()\n-\t\t\t.collisions(own, draftView, host.viewAt(shared, sharedBaseOf(space)), host.sharedView(), newer, SHARED)\n+\t\t\t.collisions(\n+\t\t\t\town,\n+\t\t\t\tdraftView,\n+\t\t\t\thost.viewAt(shared, sharedBaseOf(space)),\n+\t\t\t\thost.sharedView(),\n+\t\t\t\tnewer,\n+\t\t\t\tSHARED,\n+\t\t\t\tundefined,\n+\t\t\t\tundefined,\n+\t\t\t\tchanged,\n+\t\t\t)\n \t\t\t.map((d) => d.collision),\n \t];\n \treturn { collisions, newer, union };"},{"path":"worker/project/news.ts","added":143,"removed":17,"diff":"--- a/worker/project/news.ts\n+++ b/worker/project/news.ts\n@@ -257,8 +257,42 @@\n \tqueueNews(agent: AgentState, items: readonly NewsItem[], entries: Entry[]): void;\n \t/** A line for the host's logs (ProjectOptions.logLine). */\n \tlogLine?(line: Record<string, string | number>): void;\n+\t/**\n+\t * Owed news (abso Capacity, 2026-10-15): when this answers true, a publish leaves its definition news for other\n+\t * agents to be worked out after its write (definitionNewsOwed) and hands it to owe instead.\n+\t */\n+\towesDefinitionNews(): boolean;\n+\towe(owed: OwedDefinitionNews): void;\n+\tspaceNamed(name: string): Space | undefined;\n+\t/** newerFor as it was at `version` of the agent's space. */\n+\tnewerAt(agent: AgentState, version: number): ReadonlySet<AtomId>;\n+\t/** definitionCollisions against the agent's space at `version`, not its newest. */\n+\tdefinitionCollisionsAt(\n+\t\tagent: AgentState,\n+\t\tnewer: ReadonlySet<AtomId>,\n+\t\tnames: ReadonlySet<string>,\n+\t\tversion: number,\n+\t): DefinitionCollision[];\n+\t/** The space's atoms at `version`: setOf as it was then (owed news). */\n+\tsetAt(space: Space, version: number): ReadonlySet<AtomId>;\n+\t/** collision, with theirs described from the agent's space at `version`, not its newest (owed news). */\n+\tcollisionAt(agent: AgentState, pair: Pair, version: number): Collision;\n }\n \n+/**\n+ * A publish's news for other agents, not yet worked out: the version it made, and who made it. `all`: everything the\n+ * publish would have told them (same lines, definitions, moves; abso 714). Without it, as owed before 714, only the\n+ * definition news. `names`: the names its definitions changed, once worked out (owedNewsNames).\n+ */\n+export interface OwedNews {\n+\treadonly version: number;\n+\treadonly space: string;\n+\treadonly publisher: string;\n+\treadonly names?: readonly string[];\n+\treadonly all?: boolean;\n+}\n+export type OwedDefinitionNews = OwedNews;\n+\n function lineNews(host: NewsHost, agent: AgentState, pairs: readonly Pair[]): NewsItem[] {\n \treturn pairs.map((p) => ({ key: pairKey(p), text: linesText(host.collision(agent, p)) }));\n }\n@@ -278,6 +312,8 @@\n \tjust: ReadonlySet<AtomId>,\n \tspace: Space,\n \tversion: number,\n+\t/** The space's version the moved lines' files are read at: its newest, or an owed publish's own. */\n+\tnow = last(space),\n ): NewsItem[] {\n \tconst g = host.graph;\n \tconst movers = [...just].filter((id) => g.atom(id).moves);\n@@ -290,7 +326,7 @@\n \t\t}\n \t}\n \tconst was = host.viewAt(space, version - 1);\n-\tconst now = host.viewAt(space, last(space));\n+\tconst after = host.viewAt(space, now);\n \tconst out: NewsItem[] = [];\n \tfor (const id of movers) {\n \t\tconst moved = g\n@@ -299,7 +335,7 @@\n \t\t\t.filter((k) => k.kind === \"pos\" && claimed.has(k.node))\n \t\t\t.map((k) => k.node);\n \t\tif (moved.length === 0) continue;\n-\t\tout.push(moveItem(id, host.origin(id, space.name), was.fileOf(moved[0]!), now.fileOf(moved[0]!)));\n+\t\tout.push(moveItem(id, host.origin(id, space.name), was.fileOf(moved[0]!), after.fileOf(moved[0]!)));\n \t}\n \treturn out;\n }\n@@ -336,32 +372,37 @@\n \t// For the host's logs (abso 702): a line as the work starts, written before it, and one as it ends, so work that\n \t// outlives its request still shows. No time in them: a Durable Object's clock stands still in synchronous code.\n \tlet drafts = 0;\n-\tlet files = 0;\n \tlet news = 0;\n-\tconst compareDefinitions = (): ReadonlySet<string> => {\n-\t\tconst touched = touchedFiles(host.graph, just, [host.viewAt(space, version - 1), host.viewAt(space, last(space))]);\n-\t\tfiles = touched.size;\n-\t\tconst before = definitionsIn(host.viewAt(space, version - 1), touched);\n-\t\tconst after = definitionsIn(host.viewAt(space, last(space)), touched);\n-\t\treturn new Set(\n-\t\t\t[...new Set([...before.keys(), ...after.keys()])].filter(\n-\t\t\t\t(name) => !before.has(name) || signature(before.get(name)!) !== signature(after.get(name) ?? []),\n-\t\t\t),\n-\t\t);\n-\t};\n+\t// Owed (abso 714, Christopher's base fix): on stored tables this news for other agents was most of a publish's one\n+\t// write transaction (the same-lines pairs, the definitions, the moves, for every draft: about 10 s for a 30-line\n+\t// change to abso's 12k-line index.ts), long enough to time storage out and reset the object (prod abso, 23:32Z\n+\t// 2026-10-16). Owing, the publish only notes what it owes, here, once some other agent has a draft; it's worked out\n+\t// after the commit, one agent at a time, against this version (newsOwed). Asked only then (news-lazy.test.ts: no\n+\t// news work at all otherwise).\n+\tlet owing: boolean | undefined;\n \tfor (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {\n \t\tif (agent === publisher || agent.space !== space.name) continue;\n \t\tconst draft = host.draft(agent);\n \t\tif (draft.length === 0) continue;\n+\t\towing ??= host.owesDefinitionNews();\n+\t\tif (owing) {\n+\t\t\thost.owe({ version, space: space.name, publisher: publisher.name, all: true });\n+\t\t\thost.logLine?.({ work: \"publishNews\", step: \"owed\", space: space.name, version, publisher: publisher.name });\n+\t\t\treturn;\n+\t\t}\n \t\tif (drafts++ === 0)\n \t\t\thost.logLine?.({ work: \"publishNews\", step: \"start\", space: space.name, version, publisher: publisher.name });\n \t\tconst lines = pairsIn(host.graph, draft, just, unionOverlay(host.setOf(space), draft));\n-\t\tchangedNames ??= compareDefinitions();\n+\t\tchangedNames ??= changedNamesAt(host, space, version);\n \t\tconst defs =\n \t\t\tchangedNames.size > 0\n \t\t\t\t? host.definitionCollisions(agent, host.newerFor(agent), changedNames).filter((d) => just.has(d.by))\n \t\t\t\t: [];\n-\t\tconst items = [...lineNews(host, agent, lines), ...definitionNews(defs), ...moveNews(host, draft, just, space, version)];\n+\t\tconst items = [\n+\t\t\t...lineNews(host, agent, lines),\n+\t\t\t...definitionNews(defs),\n+\t\t\t...moveNews(host, draft, just, space, version),\n+\t\t];\n \t\tnews += items.length;\n \t\thost.queueNews(agent, items, entries);\n \t}\n@@ -373,8 +414,93 @@\n \t\t\tversion,\n \t\t\tpublisher: publisher.name,\n \t\t\tdrafts,\n-\t\t\tfiles,\n \t\t\tchangedNames: changedNames?.size ?? 0,\n \t\t\tnews,\n \t\t});\n }\n+\n+/**\n+ * The names whose definitions the publish at `version` changed, in the files it touched: before it against its own\n+ * version. Most publishes change none; then only the same-lines rule can bring news. A definition collision the publish\n+ * brings is one of these, so a draft that uses none of them has none (abso Capacity, prod abso 2026-10-15).\n+ */\n+function changedNamesAt(host: NewsHost, space: Space, version: number): ReadonlySet<string> {\n+\tconst just = new Set(space.versions[version]!.atoms);\n+\tconst touched = touchedFiles(host.graph, just, [host.viewAt(space, version - 1), host.viewAt(space, version)]);\n+\tconst before = definitionsIn(host.viewAt(space, version - 1), touched);\n+\tconst after = definitionsIn(host.viewAt(space, version), touched);\n+\treturn new Set(\n+\t\t[...new Set([...before.keys(), ...after.keys()])].filter(\n+\t\t\t(name) => !before.has(name) || signature(before.get(name)!) !== signature(after.get(name) ?? []),\n+\t\t),\n+\t);\n+}\n+\n+/** owedNews's names, worked out once for a publish (the host keeps them on its row): changedNamesAt its version. */\n+export function owedNewsNames(host: NewsHost, owed: OwedNews): string[] {\n+\tconst space = host.spaceNamed(owed.space);\n+\tif (!space || owed.version > last(space) || !space.versions[owed.version]) return [];\n+\treturn [...changedNamesAt(host, space, owed.version)].sort();\n+}\n+\n+/**\n+ * The definition news a publish owes, worked out as newsForOthers would have at that version: the same agents, the\n+ * same rule against the space at `owed.version` and the work published up to it, the same words and keys. Reads only.\n+ * An agent that has synced past the version since is left out (the version is no longer newer for it), and an item\n+ * an agent was already told (from its own edit since, or this run before) is dropped, as queueNews would.\n+ */\n+export function newsOwed(\n+\thost: NewsHost,\n+\towed: OwedNews,\n+\t/** Only these agents (owedAgents' names), so a host can work the news out one agent at a time (abso 714). */\n+\tonly?: readonly string[],\n+): { agent: string; items: NewsItem[] }[] {\n+\tconst space = host.spaceNamed(owed.space);\n+\tif (!space || owed.version > last(space) || !space.versions[owed.version]) return [];\n+\tconst just = new Set(space.versions[owed.version]!.atoms);\n+\tlet names: ReadonlySet<string> | undefined = owed.names ? new Set(owed.names) : undefined;\n+\tconst out: { agent: string; items: NewsItem[] }[] = [];\n+\tfor (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {\n+\t\tif (only && !only.includes(agent.name)) continue;\n+\t\tif (!owedTo(host, owed, space, agent)) continue;\n+\t\tconst draft = host.draft(agent);\n+\t\tnames ??= changedNamesAt(host, space, owed.version);\n+\t\tconst lines = owed.all\n+\t\t\t? pairsIn(host.graph, draft, just, unionOverlay(host.setAt(space, owed.version), draft)).map((p) => ({\n+\t\t\t\t\tkey: pairKey(p),\n+\t\t\t\t\ttext: linesText(host.collisionAt(agent, p, owed.version)),\n+\t\t\t\t}))\n+\t\t\t: [];\n+\t\tconst defs =\n+\t\t\tnames.size > 0\n+\t\t\t\t? host\n+\t\t\t\t\t\t.definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version)\n+\t\t\t\t\t\t.filter((d) => just.has(d.by))\n+\t\t\t\t: [];\n+\t\tconst moves = owed.all ? moveNews(host, draft, just, space, owed.version, owed.version) : [];\n+\t\tconst items = [...lines, ...definitionNews(defs), ...moves].filter((item) => !agent.told.has(item.key));\n+\t\tif (items.length > 0) out.push({ agent: agent.name, items });\n+\t}\n+\treturn out;\n+}\n+/** newsOwed, under the name tonight's owed definition news had (abso 2341e805). */\n+export const definitionNewsOwed = newsOwed;\n+\n+/**\n+ * The agents a publish's owed news may be for, in the order definitionNewsOwed takes them: every other agent in the\n+ * space, behind the version, with a draft. Cheap (no definition rule), so a host can list them once and then work the\n+ * news out a few at a time, each in its own read (abso 714: one read over every draft reset prod abso's object).\n+ */\n+export function owedAgents(host: NewsHost, owed: OwedDefinitionNews): string[] {\n+\tconst space = host.spaceNamed(owed.space);\n+\tif (!space || owed.version > last(space) || !space.versions[owed.version]) return [];\n+\treturn [...host.agents.values()]\n+\t\t.toSorted((a, b) => (a.name < b.name ? -1 : 1))\n+\t\t.filter((agent) => owedTo(host, owed, space, agent))\n+\t\t.map((agent) => agent.name);\n+}\n+\n+function owedTo(host: NewsHost, owed: OwedDefinitionNews, space: Space, agent: AgentState): boolean {\n+\tif (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) return false;\n+\treturn host.draft(agent).length > 0;\n+}"},{"path":"worker/project/pathindex.ts","added":15,"removed":0,"diff":"--- a/worker/project/pathindex.ts\n+++ b/worker/project/pathindex.ts\n@@ -90,6 +90,21 @@\n \t\treturn files && [...files].sort();\n \t}\n \n+\t/**\n+\t * The files the versions after `from`, up to `to`, changed, from each version's kept row (abso 738): undefined when one\n+\t * has none, and the caller works them out from the atoms. Every file whose text differs between the two versions is\n+\t * in it, since some version between changed it.\n+\t */\n+\tkeptChangesSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined {\n+\t\tconst out = new Set<string>();\n+\t\tfor (let v = from + 1; v <= to; v++) {\n+\t\t\tconst files = this.#keptFiles(space, v);\n+\t\t\tif (!files) return undefined;\n+\t\t\tfor (const f of files) out.add(f);\n+\t\t}\n+\t\treturn out;\n+\t}\n+\n \t/** keptPaths as a set, kept for the newest version asked: never changed once made, so a view can hold it. */\n \tkeptPathSet(space: Space, version: number): ReadonlySet<string> | undefined {\n \t\tlet fold = this.#keptPaths.get(space);"},{"path":"worker/project/project-api.ts","added":2,"removed":0,"diff":"--- a/worker/project/project-api.ts\n+++ b/worker/project/project-api.ts\n@@ -155,6 +155,8 @@\n \trefusals(agent?: string, limit?: number): unknown;\n \t/** A file as it was at a version (#27). */\n \tfileAt(path: string, version: number, draft: string | null, agent?: string): unknown;\n+\t/** fileAt for exactly this spelling, without the version's list of files (version-log.ts fileExactAt). */\n+\tfileExactAt?(path: string, version: number, draft: string | null): unknown;\n \t/** Every file that differs between two versions (#27). */\n \tcompare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean): unknown;\n \t/** Version `version` of shared without the versions in `versions` (without.ts). */"},{"path":"worker/project/project-status.ts","added":14,"removed":2,"diff":"--- a/worker/project/project-status.ts\n+++ b/worker/project/project-status.ts\n@@ -49,6 +49,18 @@\n }\n \n /**\n+ * An agent with nothing of its own sees exactly its base version, so its paths are that version's kept file list\n+ * (pathindex.ts), when there is one: no layout of every known file (abso - Performance, abso 711).\n+ */\n+function viewPaths(host: SnapshotHost, agent: AgentState): string[] {\n+\tconst kept =\n+\t\tagent.mine.length === 0\n+\t\t\t? host.keptPaths?.(host.spaceNamed(agent.space === SHARED ? null : agent.space), agent.base)\n+\t\t\t: undefined;\n+\treturn kept ?? host.agentView(agent).paths();\n+}\n+\n+/**\n  * The paths in an agent's view now (#37): what its folder should hold.\n  * Reading it changes nothing. Binary files are included.\n  */\n@@ -62,7 +74,7 @@\n \treturn {\n \t\tversion: agent.base,\n \t\tdraft: agent.space === SHARED ? null : agent.space,\n-\t\tfiles: host.agentView(agent).paths(),\n+\t\tfiles: viewPaths(host, agent),\n \t};\n }\n \n@@ -94,7 +106,7 @@\n \t\tagent: agent.name,\n \t\tversion: agent.base,\n \t\tdraft: agent.space === SHARED ? null : agent.space,\n-\t\tfiles: host.agentView(agent).paths(),\n+\t\tfiles: viewPaths(host, agent),\n \t};\n }\n "},{"path":"worker/project/project-types.ts","added":15,"removed":0,"diff":"--- a/worker/project/project-types.ts\n+++ b/worker/project/project-types.ts\n@@ -583,7 +583,22 @@\n export type Blobs = Record<string, string | null>;\n \n /** What the project needs from the store of binary files' bytes. */\n+/** One news item a write gave an agent: its text and time, and its entry's place in the log. */\n+export interface NewsWritten {\n+\treadonly agent: string;\n+\treadonly text: string;\n+\treadonly at: number | null;\n+\t/** The news entry's place in the log: later news has a higher one. */\n+\treadonly seq: number;\n+}\n+\n export interface ProjectOptions {\n+\t/**\n+\t * Told after each write that gave agents news, with each item as the write appended it. It runs inside the write,\n+\t * which can still roll back, so a host collects the items and acts on them only once the call has returned. A host\n+\t * can then wake a listener for exactly the agents that got news, without reading the log.\n+\t */\n+\tnewsWritten?: (items: readonly NewsWritten[]) => void;\n \t/** Optional derived atom indexing within persistent graph acceptance. */\n \tindexAcceptedAtom?: (atom: Atom, files: readonly string[], storage: GraphStateStorage) => void;\n \t/** Private experimental reader route; never falls back for unsupported membership. */"},{"path":"worker/project/project.ts","added":100,"removed":4,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -105,9 +105,13 @@\n \taddressedItem,\n \tnewsAboutOwnDraft as hostedNewsAboutOwnDraft,\n \tnewsForOthers as hostedNewsForOthers,\n+\tnewsOwed as hostedNewsOwed,\n+\towedAgents as hostedOwedAgents,\n+\towedNewsNames as hostedOwedNewsNames,\n \tmarkedItem,\n \ttype NewsHost,\n \ttype NewsItem,\n+\ttype OwedDefinitionNews,\n \treviewItem,\n \tsettledItem,\n } from \"./news.ts\";\n@@ -157,6 +161,7 @@\n \tLandAnswer,\n \tMergedLine,\n \tModes,\n+\tNewsWritten,\n \tNoteAnswer,\n \tNoteBody,\n \tNoteRecord,\n@@ -217,6 +222,7 @@\n \tcompare as versionCompare,\n \tcompareSummary as versionCompareSummary,\n \tfileAt as versionFileAt,\n+\tfileExactAt as versionFileExactAt,\n \tlog as versionLog,\n \tribbon as versionRibbon,\n \tshow as versionShow,\n@@ -329,7 +335,14 @@\n \t * doesn't depend on it.\n \t */\n \tcheckerReady = false;\n+\t/**\n+\t * Owed news (abso Capacity, 2026-10-15): a publish's definition news for other agents is left for after its write\n+\t * (takeOwedDefinitionNews, definitionNewsOwed, deliverOwedNews). The disk route sets it; the replay engine doesn't.\n+\t */\n+\towesDefinitionNews = false;\n+\t#owed: OwedDefinitionNews[] = [];\n \treadonly #now: (() => number) | undefined;\n+\treadonly #newsWritten: ((items: readonly NewsWritten[]) => void) | undefined;\n \treadonly #whole: ProjectOptions[\"whole\"];\n \treadonly #shapes: ProjectOptions[\"shapes\"];\n \treadonly #logLine: ProjectOptions[\"logLine\"];\n@@ -452,6 +465,7 @@\n \t\t}\n \t\tthis.#hasBlob = options.hasBlob ?? (() => false);\n \t\tthis.#now = options.now;\n+\t\tthis.#newsWritten = options.newsWritten;\n \t\tthis.#whole = options.whole;\n \t\tthis.#shapes = options.shapes;\n \t\tthis.#logLine = options.logLine;\n@@ -1334,6 +1348,44 @@\n \t\treturn hostedAnnouncePerson(this.#announceHost, ...args);\n \t}\n \n+\t/** The definition news the writes since the last call owe other agents, handed over once (news.ts). */\n+\ttakeOwedDefinitionNews(): OwedDefinitionNews[] {\n+\t\tconst owed = this.#owed;\n+\t\tthis.#owed = [];\n+\t\treturn owed;\n+\t}\n+\n+\t/** What a publish owes, worked out against its version (news.ts newsOwed), for `only` these agents if given. Reads only. */\n+\tnewsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] {\n+\t\treturn hostedNewsOwed(this.#newsHost, owed, only);\n+\t}\n+\n+\t/** newsOwed, under the name owed definition news had before abso 714. */\n+\tdefinitionNewsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] {\n+\t\treturn this.newsOwed(owed, only);\n+\t}\n+\n+\t/** The names a publish's definitions changed (news.ts owedNewsNames), worked out once for its owed news. Reads only. */\n+\towedNewsNames(owed: OwedDefinitionNews): string[] {\n+\t\treturn hostedOwedNewsNames(this.#newsHost, owed);\n+\t}\n+\n+\t/** The agents a publish's owed news may be for (news.ts owedAgents). Reads only. */\n+\towedAgents(owed: OwedDefinitionNews): string[] {\n+\t\treturn hostedOwedAgents(this.#newsHost, owed);\n+\t}\n+\n+\t/** Tells each agent its owed items, as queueNews does: what an agent was already told adds nothing. */\n+\tdeliverOwedNews(found: readonly { agent: string; items: readonly NewsItem[] }[]): number {\n+\t\tconst entries: Entry[] = [];\n+\t\tfor (const { agent: name, items } of found) {\n+\t\t\tconst agent = this.#agents.get(name);\n+\t\t\tif (agent) this.#queueNews(agent, items, entries);\n+\t\t}\n+\t\tthis.#flush(entries);\n+\t\treturn entries.length;\n+\t}\n+\n \t/** A seat's earlier chat hears that another chat just used the seat (announce.ts seatNotice). */\n \tseatNotice(...args: Tail<Parameters<typeof hostedSeatNotice>>): ReturnType<typeof hostedSeatNotice> {\n \t\treturn hostedSeatNotice(this.#announceHost, ...args);\n@@ -1440,6 +1492,17 @@\n \t\treturn hostedOverlapNews(this.#overlapHost, ...args);\n \t}\n \n+\t/** The news waiting for an agent, read only: nothing is taken, heard or written. None for an agent it hasn't got. */\n+\tpeekNews(agentName: string): { text: string; at: number | null }[] {\n+\t\tconst agent = typeof agentName === \"string\" ? this.#agents.get(agentName) : undefined;\n+\t\treturn agent ? agent.news.map((text, i) => ({ text, at: agent.newsAt[i] ?? null })) : [];\n+\t}\n+\n+\t/** Whether the project has this agent. Read only. */\n+\thasAgent(agentName: string): boolean {\n+\t\treturn typeof agentName === \"string\" && this.#agents.get(agentName) !== undefined;\n+\t}\n+\n \t/** Hand over the news waiting for an agent (collisions, definitions, moves, announcements), once. */\n \tnews(agentName: string): { news: string[]; items: { text: string; at: number | null }[] } {\n \t\tconst entries: Entry[] = [];\n@@ -1719,6 +1782,15 @@\n \t\tif (this.#pending.length === 0) return;\n \t\tconst out = this.#pending;\n \t\tthis.#store.append(out);\n+\t\tif (this.#newsWritten) {\n+\t\t\tconst items: NewsWritten[] = [];\n+\t\t\tout.forEach((entry, i) => {\n+\t\t\t\tif (entry.type !== \"news\") return;\n+\t\t\t\tfor (const text of entry.text)\n+\t\t\t\t\titems.push({ agent: entry.agent, text, at: entry.time ?? null, seq: this.#stored + i });\n+\t\t\t});\n+\t\t\tif (items.length > 0) this.#newsWritten(items);\n+\t\t}\n \t\tthis.#persistMutable();\n \t\t// A few more agents' old told lists into their buckets at each write, until every row has moved (writer-agents.ts).\n \t\tif (this.#agents instanceof WriterAgents) this.#agents.moveOldTold(OLD_TOLD_PER_WRITE);\n@@ -1937,6 +2009,11 @@\n \t\treturn versionFileAt(this.#logHost, ...args);\n \t}\n \n+\t/** fileAt for exactly this spelling, from the file's own lines: no list of the version's files (version-log.ts). */\n+\tfileExactAt(...args: Tail<Parameters<typeof versionFileExactAt>>): ReturnType<typeof versionFileExactAt> {\n+\t\treturn versionFileExactAt(this.#logHost, ...args);\n+\t}\n+\n \t/** Every file that differs between two versions of shared (or a named draft) (version-log.ts). */\n \tcompare(...args: Tail<Parameters<typeof versionCompare>>): ReturnType<typeof versionCompare> {\n \t\treturn versionCompare(this.#logHost, ...args);\n@@ -2110,6 +2187,15 @@\n \t\t\tdefinitionCollisions: (agent, newer, names) => this.#definitionCollisions(agent, newer, names),\n \t\t\tqueueNews: (agent, items, entries) => this.#queueNews(agent, items, entries),\n \t\t\tlogLine: (line) => this.#logLine?.(line),\n+\t\t\towesDefinitionNews: () => this.owesDefinitionNews,\n+\t\t\towe: (owed) => void this.#owed.push(owed),\n+\t\t\tspaceNamed: (name) => (name === SHARED ? this.#shared : this.#spaces.get(name)),\n+\t\t\tnewerAt: (agent, version) => this.#newerFor(agent, version),\n+\t\t\tdefinitionCollisionsAt: (agent, newer, names, version) =>\n+\t\t\t\tthis.#definitionCollisions(agent, newer, names, version),\n+\t\t\tsetAt: (space, version) => this.#at(space, version),\n+\t\t\tcollisionAt: (agent, pair, version) =>\n+\t\t\t\tthis.#describe(pair, this.#agentView(agent), this.#viewAt(this.#spaceOf(agent), version), agent.space),\n \t\t};\n \t\treturn this.#news;\n \t}\n@@ -2413,6 +2499,9 @@\n \t\t\tpairs: (draft, against, settled) => this.#pairs(draft, against, settled),\n \t\t\tdescribe: (pair, yoursView, theirsView, spaceName) => this.#describe(pair, yoursView, theirsView, spaceName),\n \t\t\tdefinitionRule: () => this.#definitionRule,\n+\t\t\t// Only from a stored writer's kept rows, as keptPaths: a project in memory keeps none, and works them out.\n+\t\t\tchangedSince: (space, from, to) =>\n+\t\t\t\tthis.#writerStorage ? this.#paths.keptChangesSince(space, from, to) : undefined,\n \t\t\trefuse: (agent, space, via, time, collisions, entries) =>\n \t\t\t\tthis.#refuse(agent, space, via, time, collisions, entries),\n \t\t\trequireClosed: (tie, union) => this.#requireClosed(tie, union),\n@@ -2972,13 +3061,14 @@\n \t}\n \n \t/** The space's atoms published after the agent's base, by others. */\n-\t#newerFor(agent: AgentState): ReadonlySet<AtomId> {\n+\t/** `upTo`: the work published after the agent's base up to that version only (owed news, news.ts). */\n+\t#newerFor(agent: AgentState, upTo?: number): ReadonlySet<AtomId> {\n \t\tconst space = this.#spaceOf(agent);\n \t\tconst base = this.#at(space, agent.base);\n-\t\tconst current = this.#setOf(space);\n+\t\tconst current = upTo === undefined ? this.#setOf(space) : this.#at(space, upTo);\n \t\tconst newer =\n \t\t\tspace.name === SHARED && space.membershipVersion\n-\t\t\t\t? new SharedAdditions(space, agent.base, base, current)\n+\t\t\t\t? new SharedAdditions(space, agent.base, base, current, upTo ?? last(space))\n \t\t\t\t: differenceSet(current, base);\n \t\treturn differenceSet(newer, new StableOverlaySet(agent.mine));\n \t}\n@@ -3118,6 +3208,8 @@\n \t\tagent: AgentState,\n \t\tnewer: ReadonlySet<AtomId>,\n \t\tnames?: ReadonlySet<string>,\n+\t\t/** The space's version to compare against: its newest, or an owed publish's (news.ts). */\n+\t\tversion?: number,\n \t): DefinitionCollision[] {\n \t\tconst draft = new Set(this.#draft(agent));\n \t\tif (draft.size === 0 || newer.size === 0) return [];\n@@ -3126,15 +3218,19 @@\n \t\tconst base = agent.mine.some((id) => at.has(id))\n \t\t\t? this.#view(differenceSet(at, new StableOverlaySet(agent.mine)))\n \t\t\t: this.#viewAt(space, agent.base);\n+\t\tconst to = version ?? last(space);\n \t\treturn this.#definitionRule.collisions(\n \t\t\tdraft,\n \t\t\tthis.#agentView(agent),\n \t\t\tbase,\n-\t\t\tthis.#viewAt(space, last(space)),\n+\t\t\tthis.#viewAt(space, to),\n \t\t\tnewer,\n \t\t\tspace.name,\n \t\t\tundefined,\n \t\t\tnames,\n+\t\t\t// Where the space changed since the agent's base, from each version's kept files on a stored writer, as land's\n+\t\t\t// (abso 714): walking every newer atom for them was 6.5 s of a publish 770 versions behind on abso.\n+\t\t\t() => (this.#writerStorage ? this.#paths.keptChangesSince(space, agent.base, to) : undefined),\n \t\t);\n \t}\n }"},{"path":"worker/project/spaces.ts","added":37,"removed":7,"diff":"--- a/worker/project/spaces.ts\n+++ b/worker/project/spaces.ts\n@@ -40,6 +40,11 @@\n \tindexVersion?: (version: Published) => void;\n \t/** Version of the selected membership event, independent of later publishes. */\n \tmembershipVersion?: (atom: AtomId, version: number) => number | undefined;\n+\t/**\n+\t * membershipVersion reading the membership pages first, each page once (abso - Performance, 714): for a walk over\n+\t * many atoms, such as SharedAdditions. Most atoms have one event, and the page says its version.\n+\t */\n+\tmembershipVersions?: () => (atom: AtomId, version: number) => number | undefined;\n \treadonly name: string;\n \treadonly versions: Published[];\n \t/** Every atom published into this space (for shared, everything in it). */\n@@ -58,6 +63,13 @@\n \t\t\tname,\n \t\t\tindexVersion: (version) => indexMembership(storage, prefix, version),\n \t\t\tmembershipVersion: (atom, version) => membershipEvent(storage, prefix, atom, version)?.version,\n+\t\t\tmembershipVersions: () => {\n+\t\t\t\tconst pages = new PageReader(storage, prefix);\n+\t\t\t\treturn (atom, version) => {\n+\t\t\t\t\tconst known = pages.versionAt(atom, version);\n+\t\t\t\t\treturn known === null ? membershipEvent(storage, prefix, atom, version)?.version : known;\n+\t\t\t\t};\n+\t\t\t},\n \t\t\tversions: storedArray(storage, `${prefix}:versions`),\n \t\t\town: new StoredSet(storage, `${prefix}:own`),\n \t\t\tpublishedIn: new StoredMap(storage, `${prefix}:published`),\n@@ -124,6 +136,19 @@\n \t}\n \t/** Whether atom is present at version, or undefined when its events must be read. */\n \tpresentAt(atom: AtomId, version: number): boolean | undefined {\n+\t\tconst code = this.#code(atom);\n+\t\tif (code === undefined || code === MIXED) return undefined;\n+\t\tif (code === NONE) return false;\n+\t\treturn version >= code;\n+\t}\n+\t/** membershipVersion from the page: the version of its only event, or undefined; null when its events must be read. */\n+\tversionAt(atom: AtomId, version: number): number | undefined | null {\n+\t\tconst code = this.#code(atom);\n+\t\tif (code === undefined || code === MIXED) return null;\n+\t\tif (code === NONE) return undefined;\n+\t\treturn version >= code ? code : undefined;\n+\t}\n+\t#code(atom: AtomId): number | undefined {\n \t\tthis.#kept ??= this.#storage.read(`${this.#prefix}:pages:meta`, \"kept\") === 1;\n \t\tif (!this.#kept) return undefined;\n \t\tconst seq = seqOf(atom);\n@@ -135,10 +160,7 @@\n \t\t\tif (this.#pages.size >= 64) this.#pages.delete(this.#pages.keys().next().value!);\n \t\t\tthis.#pages.set(index, page);\n \t\t}\n-\t\tconst code = page[seq % PAGE] ?? NONE;\n-\t\tif (code === NONE) return false;\n-\t\tif (code === MIXED) return undefined;\n-\t\treturn version >= code;\n+\t\treturn page[seq % PAGE] ?? NONE;\n \t}\n }\n \n@@ -361,10 +383,17 @@\n \treadonly baseVersion: number;\n \treadonly base: ReadonlySet<AtomId>;\n \treadonly current: ReadonlySet<AtomId>;\n-\tconstructor(space: Space, baseVersion: number, base: ReadonlySet<AtomId>, current: ReadonlySet<AtomId>) {\n+\t/** `endVersion`: the version `current` is (the newest by default; an earlier one for owed news, news.ts). */\n+\tconstructor(\n+\t\tspace: Space,\n+\t\tbaseVersion: number,\n+\t\tbase: ReadonlySet<AtomId>,\n+\t\tcurrent: ReadonlySet<AtomId>,\n+\t\tendVersion = last(space),\n+\t) {\n \t\tsuper();\n \t\tif (space.name !== SHARED || !space.membershipVersion) throw Error(\"shared additions require indexed shared space\");\n-\t\tthis.endVersion = last(space);\n+\t\tthis.endVersion = endVersion;\n \t\tthis.space = space;\n \t\tthis.baseVersion = baseVersion;\n \t\tthis.base = base;\n@@ -374,9 +403,10 @@\n \t\treturn this.current.has(id) && !this.base.has(id);\n \t}\n \t*values(): SetIterator<AtomId> {\n+\t\tconst versionOf = this.space.membershipVersions?.() ?? this.space.membershipVersion!;\n \t\tfor (let version = this.baseVersion + 1; version <= this.endVersion; version++) {\n \t\t\tfor (const id of this.space.versions[version]!.atoms) {\n-\t\t\t\tif (this.space.membershipVersion!(id, this.endVersion) === version && this.has(id)) yield id;\n+\t\t\t\tif (versionOf(id, this.endVersion) === version && this.has(id)) yield id;\n \t\t\t}\n \t\t}\n \t}"},{"path":"worker/project/spelling.ts","added":4,"removed":2,"diff":"--- a/worker/project/spelling.ts\n+++ b/worker/project/spelling.ts\n@@ -73,7 +73,9 @@\n export function spellingOf(view: ReadView, path: string): string {\n \tif (view.hasFile(path)) return path;\n \tconst key = pathKey(path);\n-\t// Known paths first, by key, then only those laid out (#46).\n-\tconst twins = view.knownPaths().filter((p) => pathKey(p) === key && view.hasFile(p));\n+\t// Every path the graph has ever had, by key, then only those the view has a file at (#46). Not the view's known paths\n+\t// (abso Capacity, 714): those read every atom's membership and file list, 36,360 statements of a record on abso, as\n+\t// clashIn found. A path the view never had has no file in it, so the answers are the same.\n+\tconst twins = [...view.graph.knownFiles()].filter((p) => pathKey(p) === key && view.hasFile(p));\n \treturn twins.length === 1 ? twins[0]! : path;\n }"},{"path":"worker/project/test/express-moves-early.test.ts","added":55,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/express-moves-early.test.ts\n@@ -0,0 +1,55 @@\n+// Moves before laying out files (abso 714, piece 3): expressMoves looks at the draft's own written and deleted lines\n+// first, and lays out no file when none of its written lines with real content has a deleted line's text. moves.test.ts\n+// covers the moves themselves.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import type { Graph } from \"../../../src/engine/index.ts\";\n+import { type ExpressMovesHost, expressMoves } from \"../express-moves.ts\";\n+import type { AgentState } from \"../project-types.ts\";\n+\n+/** A draft of two atoms: \"del\" deletes one line, \"add\" writes the others. Any view laid out throws. */\n+function host(deleted: string, written: string[]): ExpressMovesHost {\n+\tconst texts = [deleted, ...written];\n+\tconst graph = {\n+\t\tdeletedLines: (id: string) => (id === \"del\" ? [\"line-0\"] : []),\n+\t\t*eachInsertedLine(id: string) {\n+\t\t\tif (id === \"add\") for (let k = 1; k < texts.length; k++) yield `line-${k}`;\n+\t\t},\n+\t\tlineN: (line: string) => Number(line.slice(\"line-\".length)),\n+\t\t*textChunks(n: number) {\n+\t\t\tyield texts[n]!;\n+\t\t},\n+\t\ttextOf: (n: number) => texts[n]!,\n+\t} as unknown as Graph;\n+\tconst laidOut = (): never => {\n+\t\tthrow new Error(\"laid out\");\n+\t};\n+\treturn {\n+\t\tgraph,\n+\t\tdraft: () => [\"del\", \"add\"],\n+\t\tagentView: laidOut,\n+\t\tbeforeDraft: laidOut,\n+\t\tview: laidOut,\n+\t\tapply: laidOut,\n+\t\taddDraft: laidOut,\n+\t\trecordFile: laidOut,\n+\t};\n+}\n+\n+const agent = { name: \"ann\" } as AgentState;\n+\n+test(\"an edit that only changes lines lays out no file\", () => {\n+\texpressMoves(host(\"  return pi * r * r;\", [\"  return Math.PI * r * r;\"]), agent, 1, []);\n+});\n+\n+test(\"a deleted text written again with only brackets or blanks in common lays out no file\", () => {\n+\texpressMoves(host(\"}\", [\"  const tree = parse(p);\", \"}\", \"\"]), agent, 1, []);\n+});\n+\n+test(\"a written line with real content that the draft also deleted goes on to the files\", () => {\n+\tassert.throws(\n+\t\t() => expressMoves(host(\"  return pi * r * r;\", [\"\", \"  return pi * r * r;\"]), agent, 1, []),\n+\t\t/laid out/,\n+\t);\n+});"},{"path":"worker/project/test/file-exact-at.test.ts","added":49,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/file-exact-at.test.ts\n@@ -0,0 +1,49 @@\n+// fileExactAt (version-log.ts, abso Capacity, 2026-10-17): the same answer as fileAt for exactly that spelling, at\n+// every version, read from the file's own lines without the version's list of files. abso's worker/test/\n+// project-files.test.ts checks it on the disk engine, where the list is what costs.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+/** Files added, edited, emptied, made binary and taken out, beside others, over six versions. */\n+function history(): Project {\n+\tconst p = new Project(new MemoryStore(), { hasBlob: () => true });\n+\tp.init({ \"README.md\": \"hi\\n\", \"abso.json\": '{ \"check\": \"true\" }\\n', \"src/a.ts\": \"a\\n\" }, 0);\n+\tp.record(\"ann\", { \"abso.yml\": \"pipelines:\\n  ci:\\n    on: [push]\\n\", \"docs/abso.yml\": \"not this one\\n\" }, 1);\n+\tp.publish(\"ann\", \"a pipeline\", 2);\n+\tp.record(\"ann\", { \"abso.json\": '{ \"check\": \"false\" }\\n', \"empty.txt\": \"\" }, 3, {}, { \"abso.yaml\": \"b\".repeat(64) });\n+\tp.publish(\"ann\", \"a binary, and an empty file\", 4);\n+\tp.record(\"ann\", { \"abso.yml\": null, \"avcs.json\": \"{}\\n\", \"src/a.ts\": \"\" }, 5);\n+\tp.publish(\"ann\", \"the pipeline gone, a file emptied\", 6);\n+\treturn p;\n+}\n+\n+const PATHS = [\n+\t\"abso.yml\",\n+\t\"abso.yaml\",\n+\t\"abso.json\",\n+\t\"avcs.json\",\n+\t\"docs/abso.yml\",\n+\t\"empty.txt\",\n+\t\"src/a.ts\",\n+\t\"README.md\",\n+\t\"never.txt\",\n+];\n+\n+test(\"fileExactAt answers what fileAt answers for the same spelling, at every version\", () => {\n+\tconst p = history();\n+\tconst last = p.version;\n+\tassert.ok(last >= 3);\n+\tfor (let v = 0; v <= last; v++)\n+\t\tfor (const path of PATHS) assert.deepEqual(p.fileExactAt(path, v), p.fileAt(path, v), `${path} at ${v}`);\n+});\n+\n+test(\"a name nothing ever wrote is null, and another spelling is that spelling, not the stored one\", () => {\n+\tconst p = history();\n+\tconst last = p.version;\n+\tassert.deepEqual(p.fileExactAt(\"never.txt\", last), { path: \"never.txt\", version: last, text: null });\n+\t// fileAt reads the stored spelling for any spelling (#41); fileExactAt reads only the one asked.\n+\tassert.equal((p.fileAt(\"ABSO.json\", last) as { text: string | null }).text, '{ \"check\": \"false\" }\\n');\n+\tassert.deepEqual(p.fileExactAt(\"ABSO.json\", last), { path: \"ABSO.json\", version: last, text: null });\n+});"},{"path":"worker/project/test/known-paths.test.ts","added":17,"removed":0,"diff":"--- a/worker/project/test/known-paths.test.ts\n+++ b/worker/project/test/known-paths.test.ts\n@@ -105,3 +105,20 @@\n \t] as const)\n \t\tassert.deepEqual(project.pathsAt(version).files, oracle.draftOf(agent)!.view.paths(), `paths at ${version}`);\n });\n+\n+test(\"an agent's files on a writer, from its base version's kept list when it has nothing of its own, as the in-memory project says\", () => {\n+\t// abso - Performance (abso 711): a status for an agent behind shared listed its files by laying out every known file.\n+\tconst oracle = new Project(new MemoryStore());\n+\tconst project = writer();\n+\thistory(oracle);\n+\thistory(project);\n+\t// v0 and v1 are behind shared with nothing of their own, v2 is at shared, and bob, cy, dee and eve have drafts.\n+\tfor (const agent of [\"v0\", \"v1\", \"v2\", \"bob\", \"cy\", \"dee\", \"eve\"]) {\n+\t\tassert.deepEqual(project.agentPaths(agent), oracle.agentPaths(agent), agent);\n+\t\tassert.deepEqual(project.pathsOf(agent), oracle.pathsOf(agent), `${agent} for a reader`);\n+\t}\n+\tassert.deepEqual(project.agentPaths(\"v0\").files, project.pathsAt(0).files);\n+\tassert.equal(project.agentPaths(\"v0\").files.includes(\"src/gone.ts\"), true);\n+\tassert.equal(project.agentPaths(\"v1\").files.includes(\"src/gone.ts\"), false);\n+\tassert.equal(project.agentPaths(\"eve\").files.includes(\"src/draft-new.ts\"), true);\n+});"},{"path":"worker/project/test/news-lines.test.ts","added":0,"removed":1,"diff":"--- a/worker/project/test/news-lines.test.ts\n+++ b/worker/project/test/news-lines.test.ts\n@@ -37,7 +37,6 @@\n \t);\n \tassert.equal(news[0]!.publisher, \"lib\");\n \tassert.equal(news[1]!.drafts, 1);\n-\tassert.equal(news[1]!.files, 1);\n \tassert.equal(news[1]!.changedNames, 1);\n \tassert.equal(news[1]!.news, 1);\n });"},{"path":"worker/project/test/news-written.test.ts","added":56,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/news-written.test.ts\n@@ -0,0 +1,56 @@\n+// A host learns each write's news as the write appends it (newsWritten), and can read an agent's waiting news without\n+// taking it (peekNews), so a listener can be woken for exactly the agents that got news and caught up on connect.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, type NewsWritten, Project } from \"../project.ts\";\n+\n+function setup() {\n+\tconst store = new MemoryStore();\n+\tconst written: NewsWritten[][] = [];\n+\tconst project = new Project(store, { newsWritten: (items) => written.push([...items]) });\n+\tproject.init({ \"a.txt\": \"a\\n\" }, 0);\n+\tfor (const a of [\"builder1\", \"builder2\", \"builder3\"]) project.sync(a);\n+\twritten.length = 0;\n+\treturn { project, store, written };\n+}\n+\n+test(\"a write's news is told once, per item, with its agent, text and place in the log\", () => {\n+\tconst { project, store, written } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\", \"builder3\"], 1);\n+\tassert.equal(written.length, 1, \"one call for the write\");\n+\tconst items = written[0]!;\n+\tassert.deepEqual(\n+\t\titems.map((i) => i.agent),\n+\t\t[\"builder2\", \"builder3\"],\n+\t);\n+\tfor (const item of items) {\n+\t\tassert.match(item.text, /Announcement from builder1.*Ship it/);\n+\t\tassert.equal(store.entries[item.seq]?.type, \"news\", \"seq is the entry's place in the log\");\n+\t}\n+\tassert.ok(items[1]!.seq > items[0]!.seq);\n+});\n+\n+test(\"writes with no news, and taking news (heard), tell nothing\", () => {\n+\tconst { project, written } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\"], 1);\n+\twritten.length = 0;\n+\tproject.news(\"builder2\");\n+\tproject.sync(\"builder3\");\n+\tassert.deepEqual(written, []);\n+});\n+\n+test(\"peekNews reads waiting news and takes nothing; hasAgent reads only\", () => {\n+\tconst { project, store } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\"], 1);\n+\tconst length = store.entries.length;\n+\tconst peeked = project.peekNews(\"builder2\");\n+\tassert.equal(peeked.length, 1);\n+\tassert.match(peeked[0]!.text, /Ship it/);\n+\tassert.deepEqual(project.peekNews(\"builder2\"), peeked, \"still there\");\n+\tassert.deepEqual(project.peekNews(\"nobody\"), [], \"no agent: none, and none made\");\n+\tassert.equal(project.hasAgent(\"builder2\"), true);\n+\tassert.equal(project.hasAgent(\"nobody\"), false);\n+\tassert.equal(store.entries.length, length, \"nothing written\");\n+\tassert.equal(project.news(\"builder2\").news.length, 1, \"the take still finds it\");\n+});"},{"path":"worker/project/test/owed-definition-news.test.ts","added":190,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/owed-definition-news.test.ts\n@@ -0,0 +1,190 @@\n+// Owed news (abso Capacity, 2026-10-15): with owesDefinitionNews set (abso's disk route sets it), a publish leaves its\n+// definition news for other agents for after its write. The same news, against the publish's version; told once; and\n+// the publisher's own answer as before. abso's worker/test/owed-news.test.ts covers the disk route's marker and alarm.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+// abso-core's changed-definition.test.ts scenario: parse.ts defines parsePattern, match.ts imports it.\n+const START = {\n+\t\"src/parse.ts\": [\n+\t\t\"export function parsePattern(text: string): Node {\",\n+\t\t'  return { kind: \"lit\", text };',\n+\t\t\"}\",\n+\t\t\"\",\n+\t\t\"export interface Node {\",\n+\t\t\"  kind: string;\",\n+\t\t\"  text: string;\",\n+\t\t\"}\",\n+\t].join(\"\\n\"),\n+\t\"src/match.ts\": [\n+\t\t'import { parsePattern } from \"./parse.ts\";',\n+\t\t\"\",\n+\t\t\"export function run(p: string) {\",\n+\t\t\"  return p;\",\n+\t\t\"}\",\n+\t].join(\"\\n\"),\n+\t\"README.md\": \"Uses parsePattern.\\n\",\n+};\n+\n+/** bob's draft calls parsePattern; ann's draft changes its signature; cat's touches something else. Nothing published. */\n+function drafts(project: Project): void {\n+\tproject.init(START, 0);\n+\tproject.sync(\"bob\");\n+\tproject.sync(\"ann\");\n+\tproject.sync(\"cat\");\n+\tproject.edit(\n+\t\t\"bob\",\n+\t\t{ file: \"src/match.ts\", old: \"  return p;\\n\", new: \"  const tree = parsePattern(p);\\n  return tree;\\n\" },\n+\t\t1,\n+\t);\n+\tproject.edit(\n+\t\t\"ann\",\n+\t\t{\n+\t\t\tfile: \"src/parse.ts\",\n+\t\t\told: \"parsePattern(text: string): Node\",\n+\t\t\tnew: \"parsePattern(text: string, flags: string): Node\",\n+\t\t},\n+\t\t2,\n+\t);\n+\tproject.edit(\"cat\", { file: \"README.md\", old: \"Uses parsePattern.\", new: \"Uses parsePattern, twice.\" }, 3);\n+}\n+\n+const definitionNews = (news: readonly string[]) => news.filter((n) => /definition of parsePattern/.test(n)).sort();\n+\n+test(\"the news owed is the news a publish would have told, and the publisher's own answer is the same\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\tconst toldAnswer = told.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst expected = definitionNews(told.news(\"bob\").news);\n+\tassert.equal(expected.length, 1, \"the scenario has a definition collision\");\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\tassert.deepEqual(owing.publish(\"ann\", \"parsePattern takes flags\", 4), toldAnswer, \"the publisher's answer\");\n+\tconst owed = owing.takeOwedDefinitionNews();\n+\tassert.deepEqual(owed, [{ version: owing.version, space: owed[0]!.space, publisher: \"ann\", all: true }]);\n+\tassert.deepEqual(owing.takeOwedDefinitionNews(), [], \"handed over once\");\n+\t// Not told yet: bob's news holds no definition news until it's delivered.\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), []);\n+\tconst found = owing.definitionNewsOwed(owed[0]!);\n+\tassert.deepEqual(\n+\t\tfound.map((f) => f.agent),\n+\t\t[\"bob\"],\n+\t);\n+\tassert.ok(owing.deliverOwedNews(found) > 0);\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), expected);\n+\t// Told twice adds nothing, and a run of the read after delivery finds nothing left.\n+\tassert.equal(owing.deliverOwedNews(found), 0);\n+\tassert.deepEqual(owing.definitionNewsOwed(owed[0]!), []);\n+});\n+\n+test(\"worked out against the publish's version, though more was published before the news went out\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\ttold.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst expected = definitionNews(told.news(\"bob\").news);\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\towing.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst [first] = owing.takeOwedDefinitionNews();\n+\t// Then parsePattern is removed, before the first publish's news is out: against the newest version the news\n+\t// would say \"removes\"; against the first publish's, it says \"changes\", as told at publish time.\n+\towing.sync(\"ann\");\n+\towing.edit(\n+\t\t\"ann\",\n+\t\t{\n+\t\t\tfile: \"src/parse.ts\",\n+\t\t\told: 'export function parsePattern(text: string, flags: string): Node {\\n  return { kind: \"lit\", text };\\n}\\n',\n+\t\t\tnew: \"\",\n+\t\t},\n+\t\t5,\n+\t);\n+\towing.publish(\"ann\", \"parsePattern goes\", 6);\n+\tassert.ok(owing.deliverOwedNews(owing.definitionNewsOwed(first!)) > 0);\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), expected, \"the first publish's news, as it was\");\n+});\n+\n+test(\"an agent that synced past the version since isn't told it\", () => {\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\towing.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst [owed] = owing.takeOwedDefinitionNews();\n+\towing.sync(\"bob\");\n+\tassert.deepEqual(owing.definitionNewsOwed(owed!), []);\n+});\n+\n+test(\"the replay engine tells it at publish time, as before\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\ttold.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tassert.deepEqual(told.takeOwedDefinitionNews(), []);\n+\tassert.equal(definitionNews(told.news(\"bob\").news).length, 1);\n+});\n+\n+test(\"owedAgents lists who may be owed, and the news one agent at a time adds up to the whole (abso 714)\", () => {\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\towing.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst [owed] = owing.takeOwedDefinitionNews();\n+\tassert.deepEqual(owing.owedAgents(owed!), [\"bob\", \"cat\"], \"every other agent behind it with a draft\");\n+\tconst whole = owing.definitionNewsOwed(owed!);\n+\tassert.equal(whole.length, 1);\n+\tassert.deepEqual(\n+\t\towing.owedAgents(owed!).flatMap((agent) => owing.definitionNewsOwed(owed!, [agent])),\n+\t\twhole,\n+\t);\n+\towing.sync(\"bob\");\n+\tassert.deepEqual(owing.owedAgents(owed!), [\"cat\"], \"synced past it\");\n+});\n+\n+test(\"everything a publish tells other agents is owed and told after it, the same news (abso 714)\", () => {\n+\t// bob's draft calls parsePattern (definition news), dee's changes the line ann's publish changes (same-lines news),\n+\t// and cat's touches nothing of it (no news).\n+\tconst scenario = (project: Project) => {\n+\t\tdrafts(project);\n+\t\tproject.sync(\"dee\");\n+\t\tproject.edit(\n+\t\t\t\"dee\",\n+\t\t\t{ file: \"src/parse.ts\", old: \"parsePattern(text: string): Node\", new: \"parsePattern(input: string): Node\" },\n+\t\t\t5,\n+\t\t);\n+\t};\n+\tconst told = new Project(new MemoryStore());\n+\tscenario(told);\n+\tconst toldAnswer = told.publish(\"ann\", \"parsePattern takes flags\", 6);\n+\tconst expected = Object.fromEntries([\"bob\", \"cat\", \"dee\"].map((a) => [a, told.news(a).news.toSorted()]));\n+\tassert.ok(expected.bob!.length > 0 && expected.dee!.length > 0, \"the scenario has both kinds of news\");\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tscenario(owing);\n+\tassert.deepEqual(owing.publish(\"ann\", \"parsePattern takes flags\", 6), toldAnswer, \"the publisher's answer\");\n+\tconst [owed] = owing.takeOwedDefinitionNews();\n+\tassert.equal(owed!.all, true);\n+\tfor (const a of [\"bob\", \"cat\", \"dee\"])\n+\t\tassert.deepEqual(owing.news(a).news, [], `${a} is told nothing in the publish`);\n+\tconst names = owing.owedNewsNames(owed!);\n+\tassert.deepEqual(names, [\"parsePattern\"]);\n+\t// One agent at a time, as the host works it out.\n+\tfor (const agent of owing.owedAgents(owed!)) owing.deliverOwedNews(owing.newsOwed({ ...owed!, names }, [agent]));\n+\tfor (const a of [\"bob\", \"cat\", \"dee\"]) assert.deepEqual(owing.news(a).news.toSorted(), expected[a], a);\n+\t// Twice tells nothing more.\n+\tassert.deepEqual(owing.newsOwed({ ...owed!, names }), []);\n+});\n+\n+test(\"a publish that no other draft can collide with owes nothing\", () => {\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\towing.init({ \"a.txt\": \"one\\n\" }, 0);\n+\towing.sync(\"ann\");\n+\towing.edit(\"ann\", { file: \"a.txt\", old: \"one\", new: \"two\" }, 1);\n+\towing.publish(\"ann\", \"alone\", 2);\n+\tassert.deepEqual(owing.takeOwedDefinitionNews(), []);\n+});"},{"path":"worker/project/test/shared-additions.test.ts","added":49,"removed":0,"diff":"--- a/worker/project/test/shared-additions.test.ts\n+++ b/worker/project/test/shared-additions.test.ts\n@@ -36,3 +36,52 @@\n \t\tstorage.db.close();\n \t}\n });\n+\n+test(\"shared additions read each atom's version from the membership pages, and answer as its events do (abso - Performance, 714)\", (t) => {\n+\tconst storage = new SqlState();\n+\ttry {\n+\t\tconst membership = new Membership(storage),\n+\t\t\tspace = membership.shared;\n+\t\tconst ids = (from: number, to: number) => Array.from({ length: to - from }, (_, i) => `a${from + i}`);\n+\t\tconst add = (atoms: string[], dropped: string[] = []) =>\n+\t\t\taddVersion(space, { version: space.versions.length, agent: \"test\", message: \"version\", time: 0, atoms, dropped });\n+\t\t// Three pages of atoms; a5 and a400 dropped and a5 back, a601 added and dropped: their events are read.\n+\t\tadd(ids(0, 300));\n+\t\tadd(ids(300, 600));\n+\t\tadd([], [\"a5\", \"a400\"]);\n+\t\tadd([\"a5\", \"a600\"]);\n+\t\tadd([\"a601\"]);\n+\t\tadd([], [\"a601\"]);\n+\t\tconst last = space.versions.length - 1;\n+\t\tconst { membershipVersions: _pages, ...eventsOnly } = space;\n+\t\tconst read = storage.read.bind(storage);\n+\t\tlet eventReads = 0;\n+\t\tt.mock.method(storage, \"read\", (collection: string, key: string) => {\n+\t\t\tif (collection.startsWith('membership:\"\":events:')) eventReads++;\n+\t\t\treturn read(collection, key);\n+\t\t});\n+\t\tconst walk = (s: typeof space) => {\n+\t\t\teventReads = 0;\n+\t\t\tconst out: string[][] = [];\n+\t\t\tfor (let from = 0; from < last; from++)\n+\t\t\t\tfor (let to = from + 1; to <= last; to++)\n+\t\t\t\t\tout.push([...new SharedAdditions(s, from, membership.at(s, from), membership.at(s, to), to)]);\n+\t\t\treturn { out, eventReads };\n+\t\t};\n+\t\tconst paged = walk(space);\n+\t\tconst events = walk(eventsOnly);\n+\t\tassert.deepEqual(paged.out, events.out);\n+\t\tassert.ok(\n+\t\t\tpaged.eventReads < events.eventReads / 10,\n+\t\t\t`${paged.eventReads} event reads against ${events.eventReads}`,\n+\t\t);\n+\t\tassert.deepEqual([...new SharedAdditions(space, 1, membership.at(space, 1), membership.at(space, 3), 3)], [\"a600\"]);\n+\t\tassert.deepEqual(\n+\t\t\t[...new SharedAdditions(space, 2, membership.at(space, 2), membership.at(space, 3), 3)],\n+\t\t\t[\"a5\", \"a600\"],\n+\t\t);\n+\t\tassert.deepEqual([...new SharedAdditions(space, 3, membership.at(space, 3), membership.at(space, 5), 5)], []);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});"},{"path":"worker/project/version-log.ts","added":29,"removed":0,"diff":"--- a/worker/project/version-log.ts\n+++ b/worker/project/version-log.ts\n@@ -244,6 +244,35 @@\n \t};\n }\n \n+/**\n+ * fileAt for exactly this spelling, from the file's own lines (abso Capacity, 2026-10-17): no spelling lookup and no\n+ * list of the version's files. fileAt's hasFile answers from the version's whole path list, folded from version 0\n+ * when nothing's kept, and a spelling it doesn't find reads every known path. A name nothing ever wrote is one read.\n+ * The pipeline's project files (abso.yml and the like) are read this way on every tick.\n+ */\n+export function fileExactAt(\n+\thost: LogHost,\n+\tpath: string,\n+\tversion: number,\n+\toptions: { draft?: string | null; agent?: string } = {},\n+): { path: string; version: number; text: string | null; blob?: string } {\n+\thost.needInit();\n+\tcheckReadPath(path);\n+\tconst space = host.spaceFor(options);\n+\thost.checkVersion(space, version);\n+\tif (!host.graph.hasAtomsIn(path)) return { path, version, text: null };\n+\tconst view = host.viewAt(space, version);\n+\tconst attrs = view.attrs(path);\n+\t// hasFile's own test, without its path list: kept while empty, a link, a binary, or a visible line.\n+\tconst exists = attrs.exists || attrs.link !== null || attrs.blob !== null || view.lines(path).length > 0;\n+\treturn {\n+\t\tpath,\n+\t\tversion,\n+\t\ttext: exists ? view.text(path) : null,\n+\t\t...(attrs.blob !== null ? { blob: attrs.blob } : {}),\n+\t};\n+}\n+\n /** The files that may differ between two versions, and both views: compare's and compareSummary's ground. */\n function compared(\n \thost: LogHost,"}],"unmatched":[]}