{"draft":null,"from":263,"to":318,"files":[{"path":"worker/project/project.ts","added":135,"removed":10,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -36,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@@ -100,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@@ -152,6 +161,7 @@\n \tLandAnswer,\n \tMergedLine,\n \tModes,\n+\tNewsWritten,\n \tNoteAnswer,\n \tNoteBody,\n \tNoteRecord,\n@@ -212,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@@ -281,6 +292,11 @@\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@@ -319,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@@ -441,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@@ -1322,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@@ -1423,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@@ -1702,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@@ -1841,7 +1930,8 @@\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\treturn touchedBeyond(this.#graph, base.set, agent.mine, [base, this.#agentView(agent)]);\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@@ -1919,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@@ -1992,7 +2087,9 @@\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, () => touchedBeyond(this.#graph, base.set, mine, [base, view]));\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@@ -2087,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@@ -2392,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@@ -2852,7 +2962,9 @@\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, () => touchedBeyond(this.#graph, base.set, mine, [base, view]));\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@@ -2949,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@@ -3091,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@@ -3099,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":[]}