{"draft":null,"from":175,"to":318,"files":[{"path":"worker/project/project.ts","added":356,"removed":17,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -12,11 +12,21 @@\n // agents publish into under the same rules, and that lands in shared as one\n // unit. Every agent works in one space at a time.\n \n-import { type Atom, type AtomId, EngineError, Graph, type LineId, type ReadView } from \"../../src/engine/index.ts\";\n import {\n+\ttype Atom,\n+\ttype AtomId,\n+\tEngineError,\n+\tGraph,\n+\ttype LineId,\n+\ttype ReadView,\n+\tView,\n+} from \"../../src/engine/index.ts\";\n+import {\n \tCachedStateStorage,\n \tdifferenceSet,\n \ttype GraphStateStorage,\n+\tisClosedSet,\n+\tmarkClosed,\n \tStableOverlaySet,\n \tStableSet,\n \tStableUnionSet,\n@@ -26,7 +36,12 @@\n } from \"../../src/engine/state-source.ts\";\n import { type AddDraftHost, addDraft as hostedAddDraft } from \"./add-draft.ts\";\n import { type AmendHost, amend as hostedAmend } from \"./amend.ts\";\n-import { type AnnounceHost, announce as hostedAnnounce, announcePerson as hostedAnnouncePerson } from \"./announce.ts\";\n+import {\n+\ttype AnnounceHost,\n+\tannounce as hostedAnnounce,\n+\tannouncePerson as hostedAnnouncePerson,\n+\tseatNotice as hostedSeatNotice,\n+} from \"./announce.ts\";\n import { type ApplyEntryHost, applyEntry as hostedApplyEntry } from \"./apply-entry.ts\";\n import {\n \ttype ChangeHost,\n@@ -48,6 +63,7 @@\n \ttype Pair,\n \tpairsIn,\n \tstrandedFiles,\n+\ttouchedBeyond,\n \ttouchedFiles,\n } from \"./collisions.ts\";\n import { type DefinitionCollision, DefinitionRule } from \"./definition-rule.ts\";\n@@ -65,6 +81,7 @@\n } from \"./history.ts\";\n import { ingest as hostedIngest, type IngestHost } from \"./ingest.ts\";\n import { init as hostedInit, type InitHost } from \"./init.ts\";\n+import { KeptParts } from \"./kept-parts.ts\";\n import { label as hostedLabel, type LabelHost } from \"./label.ts\";\n import {\n \tland as hostedLand,\n@@ -88,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@@ -140,6 +161,7 @@\n \tLandAnswer,\n \tMergedLine,\n \tModes,\n+\tNewsWritten,\n \tNoteAnswer,\n \tNoteBody,\n \tNoteRecord,\n@@ -174,15 +196,33 @@\n import { recordFile as hostedRecordFile, type RecordFileHost } from \"./record-file.ts\";\n import { refusals as hostedRefusals, refuse as hostedRefuse, type RefuseHost } from \"./refuse.ts\";\n import { restore as hostedRestore, type RestoreHost } from \"./restore.ts\";\n-import { last, Membership, SHARED, SharedAdditions, type Space, sharedBaseOf } from \"./spaces.ts\";\n+import {\n+\tclosureChangedAt,\n+\tindexClosure,\n+\tlast,\n+\tMembership,\n+\tSHARED,\n+\tSharedAdditions,\n+\ttype Space,\n+\tsharedBaseOf,\n+} from \"./spaces.ts\";\n import { starting as hostedStarting, type StartingHost } from \"./start.ts\";\n import { switchTo as hostedSwitchTo, type SwitchHost } from \"./switch-to.ts\";\n import { sync as hostedSync, type SyncHost } from \"./sync.ts\";\n import { treeHash } from \"./tree.ts\";\n import {\n+\tauthoredVersion,\n+\tauthorTotalsAt,\n+\ttype FileTotals,\n+\tversionFiles as keptVersionFiles,\n+\ttype VersionFilesHost,\n+} from \"./version-files.ts\";\n+import {\n \ttype LogHost,\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@@ -202,6 +242,7 @@\n \twholeRules as hostedWholeRules,\n \ttype WholeHost,\n } from \"./whole-files.ts\";\n+import { without as hostedWithout, type WithoutHost } from \"./without.ts\";\n import { WriterAgents } from \"./writer-agents.ts\";\n \n export { MemoryStore } from \"./memory-store.ts\";\n@@ -217,6 +258,16 @@\n /** A start note lasts this long after the agent's last activity (#44). */\n const NOTE_IDLE = 2 * 60 * 60 * 1000;\n const WRITER_REOPEN = Symbol(\"verified writer checkpoint\");\n+/**\n+ * The stored writer's read cache (abso Capacity). An agent's diff on typescript-rs touches more rows than the old\n+ * 4,096 held, so it read many of them again: 59,000 reads cold, against 22,000 at this size.\n+ */\n+const WRITER_CACHE_BYTES = 4 * 1_048_576;\n+const WRITER_CACHE_ROWS = 16_384;\n+/** The biggest row the writer cache keeps (abso Capacity): an agent and all the news it was told can be 100 KB. */\n+const WRITER_CACHE_ROW_BYTES = 16_384;\n+/** Old-form agent rows moved to told buckets at each write (abso Capacity): abso's 109 take about 28 writes. */\n+const OLD_TOLD_PER_WRITE = 4;\n export interface WriterSource {\n \treadonly generation: number;\n \treadonly logLength: number;\n@@ -241,12 +292,19 @@\n \treturn \"json\" in frame ? (JSON.parse(frame.json) as Entry) : frame.entry;\n }\n \n+/** Where a view and its base place moved lines differently (View.placedDifferently), when both are Views. */\n+function placedBetween(view: ReadView, base: ReadView): ReadonlySet<string> | undefined {\n+\treturn view instanceof View && base instanceof View ? view.placedDifferently(base) : undefined;\n+}\n+\n export class Project {\n \treadonly #store: ProjectStore;\n \treadonly #writerStorage?: GraphStateStorage;\n \treadonly #graph: Graph;\n \t/** Views laid out from atom sets, cached under a byte budget (views.ts). */\n \treadonly #views: ViewCache;\n+\t/** What draft collisions keep between calls, under its own byte budget (kept-parts.ts). */\n+\t#keptParts: KeptParts | undefined;\n \t/** Each agent's draft files, under the key they were worked out for (#draftFiles). */\n \treadonly #draftFilesKept = new Map<string, { key: string; files: Set<string> }>();\n \t/** Each version's files and each path's history (pathindex.ts). */\n@@ -277,9 +335,17 @@\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 \t/** For each log position, the newest time up to it (#41): time to position in one search. */\n \treadonly #timeAt: number[] = [];\n \t/** For each version of shared, the log position of the entry that made it (#41). */\n@@ -364,7 +430,9 @@\n \t\tif (options.indexAcceptedAtom && !options.writerStorage)\n \t\t\tthrow Error(\"accepted atom indexing requires writer storage\");\n \t\tthis.#store = store;\n-\t\tthis.#writerStorage = options.writerStorage ? new CachedStateStorage(options.writerStorage) : undefined;\n+\t\tthis.#writerStorage = options.writerStorage\n+\t\t\t? new CachedStateStorage(options.writerStorage, WRITER_CACHE_BYTES, WRITER_CACHE_ROWS, WRITER_CACHE_ROW_BYTES)\n+\t\t\t: undefined;\n \t\tif (this.#writerStorage) {\n \t\t\tconst storage = this.#writerStorage;\n \t\t\t// A stored Graph cannot be replayed over itself. Check before any\n@@ -397,8 +465,10 @@\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 \t\t// For tests (#46): AVCS_TEXT_FROM_LOG=1 runs a project on a MemoryStore with its text read back from the store.\n \t\tconst testing =\n \t\t\t(globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env?.AVCS_TEXT_FROM_LOG ===\n@@ -804,6 +874,12 @@\n \t\treturn p && { agent: p.agent, message: p.message, time: p.time };\n \t}\n \n+\t/** The atoms a version of shared, or of a named draft, added to its space: what was pushed together (blame's trail). */\n+\tversionAtoms(version: number, draft: string | null = null): readonly AtomId[] {\n+\t\tconst space = draft === null ? this.#shared : this.#spaces.get(draft);\n+\t\treturn space?.versions[version]?.atoms ?? [];\n+\t}\n+\n \t/** The graph, for reading (blame, history). Don't add to it. */\n \tget graph(): Graph {\n \t\treturn this.#graph;\n@@ -1272,6 +1348,49 @@\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+\t}\n+\n \t/**\n \t * Say what the agent is starting on (#37, #13), before any edit lands:\n \t * `text`, and the files it expects to change if it knows them. Nothing is\n@@ -1373,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@@ -1583,6 +1713,27 @@\n \t\tconst versionsBefore = this.#spaces.get(SHARED)?.versions.length ?? 0;\n \t\ttry {\n \t\t\tthis.#applyEntry(entry, at, keptTime);\n+\t\t\t// Shared's closure, kept per version on disk (abso Capacity): after the entry, since its atoms join the graph after\n+\t\t\t// its membership.\n+\t\t\tif (this.#writerStorage && (this.#spaces.get(SHARED)?.versions.length ?? 0) > versionsBefore) {\n+\t\t\t\tconst shared = this.#spaces.get(SHARED)!;\n+\t\t\t\tconst storage = this.#writerStorage;\n+\t\t\t\tindexClosure(storage, shared, this.#graph);\n+\t\t\t\t// Each new version's changed files, from what it touched (version-files.ts): kept in the shapes table when\n+\t\t\t\t// the host gives one, so the log, a path's history and the tree never lay versions out to find them.\n+\t\t\t\tconst host: VersionFilesHost = {\n+\t\t\t\t\tstorage,\n+\t\t\t\t\tgraph: this.#graph,\n+\t\t\t\t\tat: (v) => this.#at(shared, v),\n+\t\t\t\t\tviewAt: (v) => this.#viewAt(shared, v),\n+\t\t\t\t\tempty: () => new View(this.#graph, []),\n+\t\t\t\t\tclosureChangedAt: (v) => closureChangedAt(storage, v),\n+\t\t\t\t};\n+\t\t\t\tfor (let v = versionsBefore; v < shared.versions.length; v++) {\n+\t\t\t\t\tconst { files, exists } = keptVersionFiles(host, shared.versions[v]!);\n+\t\t\t\t\tthis.#paths.keep(shared, v, files, v === 0 ? host.empty() : host.viewAt(v - 1), host.viewAt(v), exists);\n+\t\t\t\t}\n+\t\t\t}\n \t\t} finally {\n \t\t\t// Positions by version: where each version of shared was made.\n \t\t\tconst versionsAfter = this.#spaces.get(SHARED)?.versions.length ?? 0;\n@@ -1631,7 +1782,18 @@\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 \t\tthis.#pending = [];\n \t\tthis.#stored += out.length;\n \t\tthis.#writeCheckpoint();\n@@ -1725,6 +1887,9 @@\n \t\t\tspaceNamed: (name) => this.#spaceNamed(name),\n \t\t\tcheckVersion: (space, version) => this.#checkVersion(space, version),\n \t\t\tviewAt: (space, version) => this.#viewAt(space, version),\n+\t\t\tkeptPaths: (space, version) => this.#keptPaths(space, version),\n+\t\t\tauthorTotals: (space, version, agent) => this.#authorTotals(space, version, agent as AgentState | undefined),\n+\t\t\tagentTouched: (agent) => this.#agentTouched(agent as AgentState),\n \t\t\tagentView: (agent) => this.#agentView(agent as AgentState),\n \t\t\tspellingIn: (view, asked) => this.spellingIn(view, asked),\n \t\t\tpathsOf: (space) => this.#paths.pathsOf(space),\n@@ -1735,6 +1900,57 @@\n \t\treturn this.#host;\n \t}\n \n+\t/** Shared's file list from kept shapes on a stored writer, where a version's layout reads its files from disk. */\n+\t#keptPaths(space: Space, version: number): string[] | undefined {\n+\t\treturn this.#writerStorage && space.name === SHARED ? this.#paths.keptPaths(space, version) : undefined;\n+\t}\n+\n+\t/**\n+\t * Each file's kept author totals for tree with authors (version-files.ts), on a stored writer and for shared only. An\n+\t * agent's view takes its base's totals for every file its draft doesn't touch, as its layout does (touchedBeyond),\n+\t * and lays out the rest; a draft that moves lines lays out everything.\n+\t */\n+\t#authorTotals(\n+\t\tspace: Space,\n+\t\tversion: number,\n+\t\tagent?: AgentState,\n+\t): ((path: string) => FileTotals | undefined) | undefined {\n+\t\tconst storage = this.#writerStorage;\n+\t\tif (!storage || space.name !== SHARED || authoredVersion(storage) === undefined) return undefined;\n+\t\tif (!agent) return (path) => authorTotalsAt(storage, path, version);\n+\t\tconst except = this.#agentTouched(agent);\n+\t\tif (!except) return undefined;\n+\t\treturn (path) => (except.has(path) ? undefined : authorTotalsAt(storage, path, version));\n+\t}\n+\n+\t/**\n+\t * The files an agent's draft, and whatever it depends on beyond its base, can make differ from its base\n+\t * (touchedBeyond); every other file is the same in both. Undefined when the draft moves lines.\n+\t */\n+\t#agentTouched(agent: AgentState): ReadonlySet<string> | undefined {\n+\t\tif (agent.mine.length === 0) return new Set();\n+\t\tconst base = this.#viewAt(this.#spaceOf(agent), agent.base);\n+\t\tconst view = this.#agentView(agent);\n+\t\treturn touchedBeyond(this.#graph, base.set, agent.mine, [base, view], () => placedBetween(view, base));\n+\t}\n+\n+\t/**\n+\t * Kept author totals for a folder's blame (blame.ts), where blame reads: shared at a version (the newest by default) or\n+\t * an agent's view. A named draft has none. Undefined when none are kept.\n+\t */\n+\tauthorTotalsFor(where: {\n+\t\tversion?: number;\n+\t\tdraft?: string;\n+\t\tagent?: string;\n+\t}): ((path: string) => FileTotals | undefined) | undefined {\n+\t\tif (where.draft !== undefined) return undefined;\n+\t\tif (where.agent !== undefined) {\n+\t\t\tconst agent = this.#agents.get(where.agent);\n+\t\t\treturn agent ? this.#authorTotals(this.#spaceOf(agent), agent.base, agent) : undefined;\n+\t\t}\n+\t\treturn this.#authorTotals(this.#shared, where.version ?? last(this.#shared));\n+\t}\n+\n \t/** One folder at a version (history.ts). */\n \ttree(...args: Tail<Parameters<typeof historyTree>>): ReturnType<typeof historyTree> {\n \t\treturn historyTree(this.#history, ...args);\n@@ -1793,11 +2009,36 @@\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 \t}\n \n+\t/** compare as each file's size and SHA-256, not its texts (version-log.ts, abso issue 680). */\n+\tcompareSummary(...args: Tail<Parameters<typeof versionCompareSummary>>): ReturnType<typeof versionCompareSummary> {\n+\t\treturn versionCompareSummary(this.#logHost, ...args);\n+\t}\n+\n+\t/** A version of shared without some earlier versions, or the refusal naming what builds on them (without.ts). */\n+\twithout(version: number, versions: readonly number[]): ReturnType<typeof hostedWithout> {\n+\t\tconst host: WithoutHost = {\n+\t\t\tgraph: this.#graph,\n+\t\t\tshared: () => this.#shared,\n+\t\t\tneedInit: () => this.#needInit(),\n+\t\t\tcheckVersion: (space, v) => this.#checkVersion(space, v),\n+\t\t\tviewAt: (space, v) => this.#viewAt(space, v),\n+\t\t\tat: (space, v) => this.#at(space, v),\n+\t\t\tclosed: (set) => this.#closed(set),\n+\t\t\ttouchedFiles: (ids, views) => this.#touchedFiles(ids, views),\n+\t\t};\n+\t\treturn hostedWithout(host, version, versions);\n+\t}\n+\n \t/** A version of shared (or of a named draft) as a ReadView (version-log.ts). */\n \tviewAt(...args: Tail<Parameters<typeof versionViewAt>>): ReturnType<typeof versionViewAt> {\n \t\treturn versionViewAt(this.#logHost, ...args);\n@@ -1816,13 +2057,43 @@\n \t\t\tdefinitionRule: () => this.#definitionRule,\n \t\t\tdraft: (agent) => this.#draft(agent as AgentState),\n \t\t\tagentView: (agent) => this.#agentView(agent as AgentState),\n-\t\t\tview: (set) => this.#view(set),\n-\t\t\tpairs: (draft, against, settled) => this.#pairs(draft, against, settled),\n+\t\t\tdraftsView: (agents) => this.#draftsView(agents as readonly AgentState[]),\n \t\t\ttouchedFiles: (ids, views) => this.#touchedFiles(ids, views),\n+\t\t\t// On a stored writer only, as a reader kept between calls is (abso Capacity).\n+\t\t\tkeptParts: () => (this.#writerStorage ? (this.#keptParts ??= new KeptParts()) : undefined),\n+\t\t\tdraftKey: (agent) => {\n+\t\t\t\tconst a = agent as AgentState;\n+\t\t\t\treturn `${last(this.#shared)} ${a.space}@${a.base} ${this.#draft(a).join(\",\")}`;\n+\t\t\t},\n \t\t};\n \t\treturn this.#draftCollisionHost;\n \t}\n \n+\t/**\n+\t * Shared now with some agents' drafts on top, for draft collisions (abso Capacity). Kept under the drafts' atoms and\n+\t * shared's version, so a second ask with nothing changed lays nothing out again, and laid out as shared is for every\n+\t * file the drafts don't touch, as an agent's view is. One agent based on shared's newest version is its own view.\n+\t */\n+\t#draftsView(agents: readonly AgentState[]): ReadView {\n+\t\tconst shared = this.#shared;\n+\t\tconst version = last(shared);\n+\t\tconst only = agents.length === 1 ? agents[0]! : undefined;\n+\t\tif (only && only.space === SHARED && only.base === version) return this.#agentView(only);\n+\t\tconst drafts = agents.map((agent) => this.#draft(agent));\n+\t\tconst mine = drafts.flat();\n+\t\tconst base = this.#sharedView();\n+\t\tconst view = this.#viewKeyed(`d ${SHARED}@${version}+${drafts.map((d) => d.join(\",\")).join(\"+\")}`, () =>\n+\t\t\tunionOverlay(base.set, mine),\n+\t\t);\n+\t\tif (this.#writerStorage && mine.length > 0 && view instanceof View && base instanceof View) {\n+\t\t\tview.shareMoves(base);\n+\t\t\tview.shareFiles(base, () =>\n+\t\t\t\ttouchedBeyond(this.#graph, base.set, mine, [base, view], () => placedBetween(view, base)),\n+\t\t\t);\n+\t\t}\n+\t\treturn view;\n+\t}\n+\n \t/** Whether agents' unpublished changes would collide, by the publish rule (draft-collisions.ts). */\n \tcollisions(...args: Tail<Parameters<typeof draftCollisions>>): ReturnType<typeof draftCollisions> {\n \t\treturn draftCollisions(this.#draftCollisions, ...args);\n@@ -1913,8 +2184,18 @@\n \t\t\tviewAt: (space, version) => this.#viewAt(space, version),\n \t\t\torigin: (atom, spaceName) => this.#origin(atom, spaceName),\n \t\t\tcollision: (agent, pair) => this.#collision(agent, pair),\n-\t\t\tdefinitionCollisions: (agent, newer) => this.#definitionCollisions(agent, newer),\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@@ -2218,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@@ -2587,6 +2871,7 @@\n \t\t\tspaceNamed: (name) => this.#spaceNamed(name),\n \t\t\tcheckVersion: (space, version) => this.#checkVersion(space, version),\n \t\t\tviewAt: (space, version) => this.#viewAt(space, version),\n+\t\t\tkeptPaths: (space, version) => this.#keptPaths(space, version),\n \t\t\tagentView: (agent) => this.#agentView(agent),\n \t\t\tversion: () => this.version,\n \t\t\tprojectFile: () => (this.initialized ? projectFileIn(this.#sharedView()) : undefined),\n@@ -2662,12 +2947,27 @@\n \t}\n \n \t#agentView(agent: AgentState): ReadView {\n-\t\treturn this.#viewKeyed(this.#agentViewKey(agent), () => {\n+\t\tconst view = this.#viewKeyed(this.#agentViewKey(agent), () => {\n \t\t\tconst base = this.#at(this.#spaceOf(agent), agent.base);\n \t\t\treturn base instanceof StableSet\n \t\t\t\t? new StableUnionSet(base, new StableOverlaySet(agent.mine))\n \t\t\t\t: new Set([...base, ...agent.mine]);\n \t\t});\n+\t\t// A draft that moves nothing resolves its moves as its base does (abso Capacity): take them from the base's view.\n+\t\tif (this.#writerStorage && agent.mine.length > 0 && view instanceof View) {\n+\t\t\tconst base = this.#viewAt(this.#spaceOf(agent), agent.base);\n+\t\t\tif (base instanceof View) {\n+\t\t\t\tview.shareMoves(base);\n+\t\t\t\t// And its layout of every file the draft doesn't touch, when the draft moves nothing (abso Capacity). What the\n+\t\t\t\t// view holds beyond its base is the draft and whatever the draft depends on that the base lacks (the view's\n+\t\t\t\t// set is closed): each of those can change a file, so all of them count.\n+\t\t\t\tconst mine = agent.mine;\n+\t\t\t\tview.shareFiles(base, () =>\n+\t\t\t\t\ttouchedBeyond(this.#graph, base.set, mine, [base, view], () => placedBetween(view, base)),\n+\t\t\t\t);\n+\t\t\t}\n+\t\t}\n+\t\treturn view;\n \t}\n \n \t/** An agent's view, keyed by what the set is made of, not by sorting every atom in it (#46): that cost more than the work. */\n@@ -2680,13 +2980,28 @@\n \n \t/** A space at a version: published versions never change, so the key is just their names (#46). */\n \t#viewAt(space: Space, version: number): ReadView {\n-\t\treturn this.#viewKeyed(`v ${space.name}@${version}`, () => this.#at(space, version));\n+\t\tconst view = this.#viewKeyed(`v ${space.name}@${version}`, () => this.#at(space, version));\n+\t\t// Which files it has from the kept path list (abso Capacity, View.knowPaths), as pathsAt answers.\n+\t\tif (view instanceof View && this.#writerStorage && space.name === SHARED)\n+\t\t\tview.knowPaths(() => this.#paths.keptPathSet(space, version));\n+\t\treturn view;\n \t}\n \n \t#sharedView(): ReadView {\n \t\treturn this.#viewAt(this.#shared, last(this.#shared));\n \t}\n \n+\t/**\n+\t * After each read of a reader kept between calls, one that changed nothing (abso Capacity): the cached views back\n+\t * under their budget, since views grow while a call lays files out and the cache weighs them only when they are\n+\t * asked for again (on abso, a tree with authors left 38 MB of views held against the 24 MB budget), and the agents\n+\t * the read decoded let go, read again from storage by the next call (7 MB on abso, every agent's news told).\n+\t */\n+\tafterRead(): void {\n+\t\tthis.#views.trim();\n+\t\tif (this.#agents instanceof WriterAgents) this.#agents.release();\n+\t}\n+\n \t/** A view of a set, cached by the set's exact contents (views.ts). */\n \t#view(set: ReadonlySet<AtomId>): ReadView {\n \t\tthis.#views.assertUnkeyedAllowed();\n@@ -2703,9 +3018,20 @@\n \t * (abso issue 80). A closed set is unchanged.\n \t */\n \t#closed(set: Iterable<AtomId>): ReadonlySet<AtomId> {\n+\t\tif (isClosedSet(set)) return set as ReadonlySet<AtomId>;\n \t\tif (set instanceof StableSet) {\n \t\t\t// Keep indexed membership external. Only dependencies absent from\n-\t\t\t// that snapshot belong in the operation's closure overlay.\n+\t\t\t// that snapshot belong in the operation's closure overlay. Over a stored closed base (abso Capacity),\n+\t\t\t// only the atoms outside it can reach outside it: unions are opened down to their closed parts.\n+\t\t\tconst walk: Iterable<AtomId>[] = [];\n+\t\t\tconst open = (part: ReadonlySet<AtomId>): void => {\n+\t\t\t\tif (isClosedSet(part)) return;\n+\t\t\t\tif (part instanceof StableUnionSet) {\n+\t\t\t\t\topen(part.left);\n+\t\t\t\t\topen(part.right);\n+\t\t\t\t} else walk.push(part);\n+\t\t\t};\n+\t\t\topen(set);\n \t\t\tconst missing = new Set<AtomId>();\n \t\t\tconst visit = (id: AtomId) => {\n \t\t\t\tconst stack = [id];\n@@ -2718,8 +3044,8 @@\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t};\n-\t\t\tfor (const id of set) visit(id);\n-\t\t\treturn missing.size ? new StableUnionSet(set, new StableOverlaySet(missing)) : set;\n+\t\t\tfor (const part of walk) for (const id of part) visit(id);\n+\t\t\treturn markClosed(missing.size ? new StableUnionSet(set, new StableOverlaySet(missing)) : set);\n \t\t}\n \t\treturn this.#graph.closureOf(set);\n \t}\n@@ -2735,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@@ -2877,7 +3204,13 @@\n \t// The changed-definition rule (#11) -------------------------------------------\n \n \t/** The rule for an agent's draft in its space. */\n-\t#definitionCollisions(agent: AgentState, newer: ReadonlySet<AtomId>): DefinitionCollision[] {\n+\t#definitionCollisions(\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 \t\tconst space = this.#spaceOf(agent);\n@@ -2885,13 +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 }"}],"unmatched":[]}