Owed news can be worked out a few agents at a time: owedAgents lists who may be owed, and definitionNewsOwed takes only those named (abso 714; Cloud's (b), Capacity) Version 308 of shared· capacity· Oct 16 (2026-10-16 23:51 UTC) · Not checked
On prod abso at 6:31 PM CT, one owed-news read over every draft ran as one storage transaction and reset the object. Core 307 cut that read about ninefold; this lets the host bound it outright. owedAgents(owed): every other agent in the space, behind the version, with a draft, in the order definitionNewsOwed takes them. Cheap: no definition rule. definitionNewsOwed(owed, only?): the same news, for only those agents when named. Per agent it's the same work and the same items as before, so the news one agent at a time adds up to the whole. abso's DiskRoute (worker side, with Cloud) lists them once per owed row, then works out and tells up to four a tick, each in its own read and write, keeping the rest on the row. Checks: core tsc clean; Biome clean; node --test worker/project/test/owed-definition-news (new: owedAgents lists bob and cat, one agent at a time equals the whole, a synced agent drops out), changed-definition, news-lazy, news-cap, news-lines, news-written, news-times, shared-additions, project: 46 of 46 pass.
Version 307 · Files at version 308
3 files, 53 lines added, 6 removed.
--- a/worker/project/news.ts
+++ b/worker/project/news.ts
@@ -424,15 +424,20 @@
424 424 * An agent that has synced past the version since is left out (the version is no longer newer for it), and an item 425 425 * an agent was already told (from its own edit since, or this run before) is dropped, as queueNews would. 427 − export function definitionNewsOwed(host: NewsHost, owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {
427 + export function definitionNewsOwed( 429 + owed: OwedDefinitionNews, 430 + /** Only these agents (owedAgents' names), so a host can work the news out a few agents at a time (abso 714). */ 431 + only?: readonly string[], 432 + ): { agent: string; items: NewsItem[] }[] { 428 433 const space = host.spaceNamed(owed.space); 429 434 if (!space || owed.version > last(space) || !space.versions[owed.version]) return []; 430 435 const just = new Set(space.versions[owed.version]!.atoms); 431 436 const names = new Set(owed.names); 432 437 const out: { agent: string; items: NewsItem[] }[] = []; 433 438 for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) { 434 − if (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) continue;
435 − if (host.draft(agent).length === 0) continue;
439 + if (only && !only.includes(agent.name)) continue; 440 + if (!owedTo(host, owed, space, agent)) continue; 437 442 .definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version) 438 443 .filter((d) => just.has(d.by)); @@ -441,3 +446,22 @@
451 + * The agents a publish's owed news may be for, in the order definitionNewsOwed takes them: every other agent in the 452 + * space, behind the version, with a draft. Cheap (no definition rule), so a host can list them once and then work the 453 + * news out a few at a time, each in its own read (abso 714: one read over every draft reset prod abso's object). 455 + export function owedAgents(host: NewsHost, owed: OwedDefinitionNews): string[] { 456 + const space = host.spaceNamed(owed.space); 457 + if (!space || owed.version > last(space) || !space.versions[owed.version]) return []; 458 + return [...host.agents.values()] 459 + .toSorted((a, b) => (a.name < b.name ? -1 : 1)) 460 + .filter((agent) => owedTo(host, owed, space, agent)) 461 + .map((agent) => agent.name); 464 + function owedTo(host: NewsHost, owed: OwedDefinitionNews, space: Space, agent: AgentState): boolean { 465 + if (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) return false; 466 + return host.draft(agent).length > 0; --- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -106,6 +106,7 @@
106 106 definitionNewsOwed as hostedDefinitionNewsOwed, 107 107 newsAboutOwnDraft as hostedNewsAboutOwnDraft, 108 108 newsForOthers as hostedNewsForOthers, 109 + owedAgents as hostedOwedAgents, @@ -1352,11 +1353,16 @@
1355 − /** What a publish owes, worked out against its version (news.ts definitionNewsOwed). Reads only. */
1356 − definitionNewsOwed(owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {
1357 − return hostedDefinitionNewsOwed(this.#newsHost, owed);
1356 + /** What a publish owes, worked out against its version (news.ts definitionNewsOwed), for `only` these agents if given. Reads only. */ 1357 + definitionNewsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] { 1358 + return hostedDefinitionNewsOwed(this.#newsHost, owed, only); 1361 + /** The agents a publish's owed news may be for (news.ts owedAgents). Reads only. */ 1362 + owedAgents(owed: OwedDefinitionNews): string[] { 1363 + return hostedOwedAgents(this.#newsHost, owed); 1360 1366 /** Tells each agent its owed items, as queueNews does: what an agent was already told adds nothing. */ 1361 1367 deliverOwedNews(found: readonly { agent: string; items: readonly NewsItem[] }[]): number { 1362 1368 const entries: Entry[] = []; --- a/worker/project/test/owed-definition-news.test.ts
+++ b/worker/project/test/owed-definition-news.test.ts
@@ -128,3 +128,20 @@
128 128 assert.deepEqual(told.takeOwedDefinitionNews(), []); 129 129 assert.equal(definitionNews(told.news("bob").news).length, 1); 132 + test("owedAgents lists who may be owed, and the news one agent at a time adds up to the whole (abso 714)", () => { 133 + const owing = new Project(new MemoryStore()); 134 + owing.owesDefinitionNews = true; 136 + owing.publish("ann", "parsePattern takes flags", 4); 137 + const [owed] = owing.takeOwedDefinitionNews(); 138 + assert.deepEqual(owing.owedAgents(owed!), ["bob", "cat"], "every other agent behind it with a draft"); 139 + const whole = owing.definitionNewsOwed(owed!); 140 + assert.equal(whole.length, 1); 142 + owing.owedAgents(owed!).flatMap((agent) => owing.definitionNewsOwed(owed!, [agent])), 146 + assert.deepEqual(owing.owedAgents(owed!), ["cat"], "synced past it");