Lines 2–8 at 318 (were 2–8 at 37)
22// reviews which files by avcs.json, the notes list, every agent's start note, and writing or closing 33// a note. Reads go through NoteHost, writes through NoteWriteHost; today the host is Project. 5−import type { AtomId, Graph, LineId, View } from "../../src/engine/index.ts";
5+import type { AtomId, Graph, LineId, ReadView } from "../../src/engine/index.ts"; 66import { matchesPattern } from "./globs.ts"; 77import { type NewsItem, noteClosedItem, noteSaid } from "./news.ts"; 88import { checkReadPath } from "./path-rules.ts"; Lines 27–37 at 318 (were 27–37 at 37)
2727 readonly notes: ReadonlyMap<number, NoteRecord>; 2828 initialized(): boolean; 30− sharedView(): View;
31− spellingIn(view: View, path: string): string;
32− viewAt(space: Space, version: number): View;
33− agentView(agent: AgentState): View;
34− view(set: ReadonlySet<AtomId>): View;
30+ sharedView(): ReadView; 31+ spellingIn(view: ReadView, path: string): string; 32+ viewAt(space: Space, version: number): ReadView; 33+ agentView(agent: AgentState): ReadView; 34+ view(set: ReadonlySet<AtomId>): ReadView; 3535 at(space: Space, version: number): ReadonlySet<AtomId>; 3636 liveNote(agent: AgentState): Starting | undefined; Lines 43–51 at 318 (were 43–51 at 37)
4343 readonly changes: ReadonlyMap<number, ChangeRecord>; 4444 readonly graph: Graph; 46− agentView(agent: AgentState): View;
47− viewAtVersion(version: number): View;
48− sharedView(): View;
46+ agentView(agent: AgentState): ReadView; 47+ viewAtVersion(version: number): ReadView; 48+ sharedView(): ReadView; 4949 changeOfLines(lines: readonly LineId[]): number | undefined; 5050 apply(entry: Entry): void; 5151 flush(entries: Entry[]): void; Lines 99–105 at 318 (were 99–105 at 37)
101101/** A note as reads show it, from the view its lines live in (undefined when no space holds them any more). */ 102−export function noteAnswerIn(n: NoteRecord, view: View | undefined): NoteAnswer {
102+export function noteAnswerIn(n: NoteRecord, view: ReadView | undefined): NoteAnswer { 103103 // Where the lines are now, found by their ids: a move (#49) can have taken them to another file. 104104 let lines: [number, number] | null = null; 105105 let file = n.file; Lines 138–144 at 318 (were 138–144 at 37)
138138 * published into; else their author's draft, where it works now or where it 139139 * parked it. Undefined when no space holds them any more (a discarded draft). 141−export function noteView(host: NoteHost, n: NoteRecord): View | undefined {
141+export function noteView(host: NoteHost, n: NoteRecord): ReadView | undefined { 142142 const writers = new Set(n.lines.map((l) => host.graph.lineAtom(l)).filter((a): a is AtomId => a !== undefined)); 143143 const holds = (set: ReadonlySet<AtomId> | readonly AtomId[]) => 144144 [...writers].some((a) => (set instanceof Set ? set.has(a) : (set as readonly AtomId[]).includes(a))); Lines 218–224 at 318 (were 218–224 at 37)
218218 throw new ProjectError("bad-request", "a note needs {file, from, to}, or {reply}"); 220220 checkReadPath(file); 221− let view: View;
222222 if (typeof body.of === "string") { 223223 const of = host.agents.get(body.of); 224224 if (!of) throw new ProjectError("not-found", `there is no agent ${JSON.stringify(body.of)}`); Lines 321–326 at 318 (were 321–325 at 37)
321321 if (a) host.queueNews(a, [noteClosedItem(agentName, how, id, note)], entries); 323323 host.flush(entries); 324− return host.noteAnswer(note);
324+ // Storage-backed maps return snapshots; apply may replace the stored row. 325+ return host.noteAnswer(host.notes.get(id)!);