{"version":31,"agent":"pinch","message":"status lists the newest tells and who has heard each: every recipient, with the time its client handed the tell over (or not yet). It's read from the news and heard entries the log already keeps, so nothing new is recorded. Unlike announcements, which lists only what is still undelivered, a tell stays listed once heard, and two tells with the same words stay two. The last 50 are kept. A sync's reset hears no tell. Tests in worker/project/test/tells.test.ts.","time":1791541278538,"timeIso":"2026-10-09T10:21:18.538Z","changes":5,"change":371,"files":["worker/project/apply-entry.ts","worker/project/project-status.ts","worker/project/project-types.ts","worker/project/project.ts","worker/project/test/tells.test.ts"],"draft":null,"diff":[{"path":"worker/project/apply-entry.ts","added":44,"removed":4,"diff":"--- a/worker/project/apply-entry.ts\n+++ b/worker/project/apply-entry.ts\n@@ -4,7 +4,15 @@\n \n import type { AtomId, Graph } from \"../../src/engine/index.ts\";\n import { ProjectError } from \"./project-error.ts\";\n-import type { AgentState, ChangeRecord, Entry, NoteRecord, QueuedPublish, Refusal } from \"./project-types.ts\";\n+import type {\n+\tAgentState,\n+\tChangeRecord,\n+\tEntry,\n+\tNoteRecord,\n+\tQueuedPublish,\n+\tRefusal,\n+\tTellRecord,\n+} from \"./project-types.ts\";\n import { SHARED, type Space } from \"./spaces.ts\";\n \n /** What applying one log entry needs from a project. */\n@@ -17,6 +25,8 @@\n \treadonly changes: Map<number, ChangeRecord>;\n \treadonly labels: Map<string, number[]>;\n \treadonly refusals: Refusal[];\n+\t/** The newest tells, by id in the order sent, at most TELLS_KEPT. */\n+\treadonly tells: Map<number, TellRecord>;\n \tuncheck(id: number): void;\n \tstamp(time: number | undefined): void;\n \tapplyMembership(entry: Entry, at: number): void;\n@@ -173,10 +183,13 @@\n \t\t\tconst agent = host.agentOf(entry.agent);\n \t\t\tagent.news.push(...entry.text);\n \t\t\tagent.newsAt.push(...entry.text.map(() => time));\n-\t\t\tfor (const p of entry.pairs) {\n+\t\t\tentry.pairs.forEach((p, i) => {\n \t\t\t\tagent.told.add(p);\n-\t\t\t\tif (p.startsWith(\"announce \")) host.setAnnounced(Math.max(host.announced(), Number(p.slice(9)) || 0));\n-\t\t\t}\n+\t\t\t\tif (!p.startsWith(\"announce \")) return;\n+\t\t\t\tconst id = Number(p.slice(9)) || 0;\n+\t\t\t\thost.setAnnounced(Math.max(host.announced(), id));\n+\t\t\t\ttellSent(host.tells, id, entry.text[i] ?? entry.text[0] ?? \"\", agent.name, time);\n+\t\t\t});\n \t\t\tbreak;\n \t\t}\n \t\tcase \"discard\": {\n@@ -188,6 +201,10 @@\n \t\t}\n \t\tcase \"heard\": {\n \t\t\tconst agent = host.agentOf(entry.agent);\n+\t\t\t// A sync's stale heard keeps announcements, so it hears no tell.\n+\t\t\tif (entry.stale !== true)\n+\t\t\t\tfor (const tell of host.tells.values())\n+\t\t\t\t\tif (tell.heard.get(agent.name) === null) tell.heard.set(agent.name, { at: time });\n \t\t\tconst keep = agent.news.map((t) => entry.stale === true && t.startsWith(\"Announcement from \"));\n \t\t\tagent.news = agent.news.filter((_, i) => keep[i]);\n \t\t\tagent.newsAt = agent.newsAt.filter((_, i) => keep[i]);\n@@ -272,3 +289,26 @@\n \t\t}\n \t}\n }\n+\n+/** How many tells the project keeps who-heard-what for (status's tells). */\n+export const TELLS_KEPT = 50;\n+\n+/** A tell's news reached one recipient's queue: the tell is kept, the oldest dropped past TELLS_KEPT. */\n+function tellSent(\n+\ttells: Map<number, TellRecord>,\n+\tid: number,\n+\ttext: string,\n+\tagent: string,\n+\ttime: number | undefined,\n+): void {\n+\tlet tell = tells.get(id);\n+\tif (tell === undefined) {\n+\t\ttell = { id, text, at: time, heard: new Map() };\n+\t\ttells.set(id, tell);\n+\t\tfor (const old of tells.keys()) {\n+\t\t\tif (tells.size <= TELLS_KEPT) break;\n+\t\t\ttells.delete(old);\n+\t\t}\n+\t}\n+\tif (!tell.heard.has(agent)) tell.heard.set(agent, null);\n+}"},{"path":"worker/project/project-status.ts","added":21,"removed":1,"diff":"--- a/worker/project/project-status.ts\n+++ b/worker/project/project-status.ts\n@@ -4,7 +4,16 @@\n import type { AtomId, View } from \"../../src/engine/index.ts\";\n import { ProjectError } from \"./project-error.ts\";\n import { countRefusals, type projectFileIn } from \"./project-helpers.ts\";\n-import type { AgentState, AgentStatus, EditsVia, Refusal, Starting, StatusAnswer } from \"./project-types.ts\";\n+import type {\n+\tAgentState,\n+\tAgentStatus,\n+\tEditsVia,\n+\tRefusal,\n+\tStarting,\n+\tStatusAnswer,\n+\tTellRecord,\n+\tTellStatus,\n+} from \"./project-types.ts\";\n import { last, SHARED, type Space, sharedBaseOf } from \"./spaces.ts\";\n \n /** What the snapshot reads need from a project. */\n@@ -14,6 +23,7 @@\n \tqueue(): readonly { readonly agent: string; readonly id: number }[];\n \treadonly refusals: readonly Refusal[];\n \treadonly labels: ReadonlyMap<string, readonly number[]>;\n+\treadonly tells: ReadonlyMap<number, TellRecord>;\n \tneedInit(): void;\n \tshared(): Space;\n \tdraft(agent: AgentState): AtomId[];\n@@ -145,6 +155,15 @@\n \t\t}\n \t}\n \tconst announcements = [...waiting].map(([text, names]) => ({ text, waiting: names }));\n+\t// Who has heard each of the newest tells, and when (277): the news and heard entries' times.\n+\tconst tells: TellStatus[] = [...host.tells.values()].toReversed().map((t) => ({\n+\t\tid: t.id,\n+\t\ttext: t.text,\n+\t\tat: t.at ?? null,\n+\t\tto: [...t.heard]\n+\t\t\t.toSorted(([a], [b]) => (a < b ? -1 : 1))\n+\t\t\t.map(([agent, h]) => ({ agent, heard: h !== null, at: h?.at ?? null })),\n+\t}));\n \t// Both project files in shared (224): say which one counts, never quietly.\n \tconst file = host.projectFile();\n \treturn {\n@@ -153,6 +172,7 @@\n \t\tdrafts,\n \t\trefusals: countRefusals(host.refusals),\n \t\tannouncements,\n+\t\ttells,\n \t\t...(file?.ignored ? { projectFile: { used: \"abso.json\" as const, ignored: file.ignored } } : {}),\n \t};\n }"},{"path":"worker/project/project-types.ts","added":18,"removed":0,"diff":"--- a/worker/project/project-types.ts\n+++ b/worker/project/project-types.ts\n@@ -504,6 +504,22 @@\n \tchanges: number;\n \tagents: string[];\n }\n+/**\n+ * One tell as the log has it: the sentence its recipients get, when it was sent, and for each recipient when its\n+ * client handed it over (a heard entry), null until then. A time is undefined for entries from before they had one.\n+ */\n+export interface TellRecord {\n+\treadonly id: number;\n+\ttext: string;\n+\tat: number | undefined;\n+\treadonly heard: Map<string, { at: number | undefined } | null>;\n+}\n+export interface TellStatus {\n+\tid: number;\n+\ttext: string;\n+\tat: number | null;\n+\tto: { agent: string; heard: boolean; at: number | null }[];\n+}\n export type StatusAnswer = {\n \tversion: number;\n \tagents: AgentStatus[];\n@@ -511,6 +527,8 @@\n \trefusals: RefusalCounts;\n \t/** Announcements some agent hasn't received yet, oldest first. */\n \tannouncements: { text: string; waiting: string[] }[];\n+\t/** The newest tells (TELLS_KEPT), newest first: each recipient, and when it heard (null: not yet). */\n+\ttells: TellStatus[];\n \t/** Only when shared has both abso.json and avcs.json (224): abso.json counts and avcs.json is ignored. */\n \tprojectFile?: { used: \"abso.json\"; ignored: \"avcs.json\" };\n };"},{"path":"worker/project/project.ts","added":5,"removed":0,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -157,6 +157,7 @@\n \tStarting,\n \tSwitchAnswer,\n \tTail,\n+\tTellRecord,\n } from \"./project-types.ts\";\n import { publish as hostedPublish, publishDraft as hostedPublishDraft, type PublishHost } from \"./publish.ts\";\n import { publishOf as hostedPublishOf, type PublishOfHost } from \"./publish-of.ts\";\n@@ -237,6 +238,8 @@\n \treadonly #refusals: Refusal[] = [];\n \t/** Labels on shared's versions: name -> versions, ascending. */\n \treadonly #labels = new Map<string, number[]>();\n+\t/** The newest tells and who has heard each (apply-entry.ts). */\n+\treadonly #tells = new Map<number, TellRecord>();\n \t/**\n \t * Entries applied but not stored yet, in order. Every applied entry is\n \t * stored at the next flush, even when the call that applied it threw\n@@ -1738,6 +1741,7 @@\n \t\t\tchanges: this.#changes,\n \t\t\tlabels: this.#labels,\n \t\t\trefusals: this.#refusals,\n+\t\t\ttells: this.#tells,\n \t\t\tuncheck: (id) => {\n \t\t\t\tthis.#checking.delete(id);\n \t\t\t},\n@@ -2137,6 +2141,7 @@\n \t\t\tqueue: () => this.#queue,\n \t\t\trefusals: this.#refusals,\n \t\t\tlabels: this.#labels,\n+\t\t\ttells: this.#tells,\n \t\t\tneedInit: () => this.#needInit(),\n \t\t\tshared: () => this.#shared,\n \t\t\tdraft: (agent) => this.#draft(agent),"},{"path":"worker/project/test/tells.test.ts","added":73,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/tells.test.ts\n@@ -0,0 +1,73 @@\n+// Who has heard a tell, and when: status's tells, read from the news and heard\n+// entries the log already keeps, so a page can show each recipient's mark fill.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { TELLS_KEPT } from \"../apply-entry.ts\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+function setup() {\n+\tconst store = new MemoryStore();\n+\tconst project = new Project(store);\n+\tproject.init({ \"a.ts\": \"x\\n\" }, 0);\n+\tfor (const a of [\"lead\", \"b1\", \"b2\"]) project.sync(a);\n+\treturn { project, store };\n+}\n+\n+test(\"a tell lists each recipient, and marks one heard when its news is handed over, with the time\", () => {\n+\tconst { project, store } = setup();\n+\tconst before = Date.now();\n+\tconst sent = project.announce(\"lead\", \"Stand-up soon.\", [\"b1\", \"b2\"], 1);\n+\tlet tell = project.status().tells[0]!;\n+\tassert.equal(tell.id, sent.id);\n+\tassert.equal(tell.text, \"Announcement from lead (as claimed): Stand-up soon.\");\n+\tassert.ok(tell.at !== null && tell.at >= before);\n+\tassert.deepEqual(\n+\t\ttell.to.map((t) => [t.agent, t.heard]),\n+\t\t[\n+\t\t\t[\"b1\", false],\n+\t\t\t[\"b2\", false],\n+\t\t],\n+\t);\n+\tassert.deepEqual(project.news(\"b1\").news, [\"Announcement from lead (as claimed): Stand-up soon.\"]);\n+\ttell = project.status().tells[0]!;\n+\tconst b1 = tell.to.find((t) => t.agent === \"b1\")!;\n+\tassert.equal(b1.heard, true);\n+\tassert.ok(b1.at !== null && b1.at >= tell.at!);\n+\tassert.deepEqual(\n+\t\ttell.to.find((t) => t.agent === \"b2\"),\n+\t\t{ agent: \"b2\", heard: false, at: null },\n+\t);\n+\t// Heard tells stay listed (announcements lists only what's undelivered), and the log loads back the same.\n+\tassert.deepEqual(project.status().announcements[0]!.waiting, [\"b2\"]);\n+\tassert.deepEqual(Project.load(store.entries, new MemoryStore()).status().tells, project.status().tells);\n+});\n+\n+test(\"a sync's reset hears no tell, two tells with the same words stay two, and only the newest are kept\", () => {\n+\tconst { project } = setup();\n+\tproject.announce(\"lead\", \"Same words.\", [\"b1\"], 1);\n+\tproject.announce(\"lead\", \"Same words.\", [\"b1\"], 2);\n+\tproject.sync(\"b1\");\n+\tconst tells = project.status().tells;\n+\tassert.equal(tells.length, 2);\n+\tassert.ok(tells[0]!.id > tells[1]!.id, \"newest first\");\n+\tassert.ok(\n+\t\ttells.every((t) => !t.to[0]!.heard),\n+\t\t\"a sync keeps announcements, so nothing is heard\",\n+\t);\n+\tfor (let i = 0; i < TELLS_KEPT + 3; i++) project.announce(\"lead\", `Tell ${i}.`, [\"b2\"], 3 + i);\n+\tconst kept = project.status().tells;\n+\tassert.equal(kept.length, TELLS_KEPT);\n+\tassert.match(kept[0]!.text, new RegExp(`Tell ${TELLS_KEPT + 2}\\.$`));\n+});\n+\n+test(\"a person's tell is kept like an agent's\", () => {\n+\tconst { project } = setup();\n+\tproject.announcePerson({ id: \"cf-1\", name: \"Robin\" }, \"From the website.\", [\"b2\"], 5);\n+\tconst tell = project.status().tells[0]!;\n+\tassert.equal(tell.at, 5);\n+\tassert.deepEqual(\n+\t\ttell.to.map((t) => t.agent),\n+\t\t[\"b2\"],\n+\t);\n+});"}],"ci":null}