Lines 3–9 at 318 (were 3–8 at 71)
33// which space) is applied first, in spaces.ts. 55import type { AtomId, Graph } from "../../src/engine/index.ts"; 6+import { capNews, outlastsSync } from "./news.ts"; 67import { ProjectError } from "./project-error.ts"; Lines 113–119 at 318 (were 112–117 at 71)
113114 host.joinChange(agent, entry, at, space.name === SHARED ? null : space.name); 114115 agent.marked = agent.marked.filter((r) => r.space !== (entry.space ?? SHARED)); 115117 if (entry.queued !== undefined) host.setQueued(host.queued().filter((q) => q.id !== entry.queued)); Lines 143–163 at 318 (were 141–152 at 71)
141143 const { type: _, ...note } = entry; 142144 host.notes.set(entry.id, { ...note, lines: [...entry.lines], at }); 143145 host.setLastNote(Math.max(host.lastNote(), entry.id)); 144− if (entry.change !== undefined && host.changes.has(entry.change)) host.changes.get(entry.change)!.last = at;
146+ if (entry.change !== undefined) { 147+ const change = host.changes.get(entry.change); 150+ host.changes.set(entry.change, change); 147155 case "note-closed": { 148156 const note = host.notes.get(entry.id); 149− if (note) note.closed = { agent: entry.agent, how: entry.how, time: entry.time };
158+ note.closed = { agent: entry.agent, how: entry.how, time: entry.time }; 159+ host.notes.set(entry.id, note); Lines 201–207 at 318 (were 190–195 at 71)
190201 host.setAnnounced(Math.max(host.announced(), id)); 191202 tellSent(host.tells, id, entry.text[i] ?? entry.text[0] ?? "", agent.name, time); Lines 213–223 at 318 (were 201–211 at 71)
203215 const agent = host.agentOf(entry.agent); 204− // A sync's stale heard keeps announcements, so it hears no tell.
216+ // A sync's stale heard keeps announcements and settles' news (outlastsSync), so it hears no tell. 205217 if (entry.stale !== true) 206218 for (const tell of host.tells.values()) 207219 if (tell.heard.get(agent.name) === null) tell.heard.set(agent.name, { at: time }); 208− const keep = agent.news.map((t) => entry.stale === true && t.startsWith("Announcement from "));
220+ const keep = agent.news.map((t) => entry.stale === true && outlastsSync(t)); 209221 agent.news = agent.news.filter((_, i) => keep[i]); 210222 agent.newsAt = agent.newsAt.filter((_, i) => keep[i]); Lines 246–274 at 318 (were 234–255 at 71)
236248 collisions: entry.collisions.map((c) => ({ ...c })), 249+ ...(entry.message ? { message: entry.message } : {}), 239252 // On the change the agent was working on, when there is one (#44). 240253 const agent = host.agentOf(entry.agent); 241254 host.active(agent, entry.time); 242255 const id = host.currentChange(agent, entry.time); 259+ kinds: [...new Set(entry.collisions.map((c) => c.kind))].sort(), 260+ files: [...new Set(entry.collisions.map((c) => c.file))].sort(), 261+ ...(entry.message ? { message: entry.message } : {}), 243263 if (id !== undefined) { 244264 const rec = host.changeRecord(id, agent, entry.time); 245− rec.refusals.push({
246− at,
247− time: entry.time,
248− kinds: [...new Set(entry.collisions.map((c) => c.kind))].sort(),
249− files: [...new Set(entry.collisions.map((c) => c.file))].sort(),
250− });
265+ rec.refusals.push({ ...refusal, files: [...refusal.files], kinds: [...refusal.kinds] }); 267+ host.changes.set(id, rec); 269+ // Kept until it pushes: the settle tells the held push's reason, and its change lists the refusal. 270+ if (entry.via === "publish") 271+ agent.held = [...(agent.held ?? []), { ...refusal, ...(id !== undefined ? { change: id } : {}) }];