Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 30 to 31

Compare

+44 −4 in 5 places
Lines 4–18 at 31 (were 4–10 at 30)
44
55import type { AtomId, Graph } from "../../src/engine/index.ts";
66import { ProjectError } from "./project-error.ts";
7−import type { AgentState, ChangeRecord, Entry, NoteRecord, QueuedPublish, Refusal } from "./project-types.ts";
7+import type {
8+ AgentState,
9+ ChangeRecord,
10+ Entry,
11+ NoteRecord,
12+ QueuedPublish,
13+ Refusal,
14+ TellRecord,
15+} from "./project-types.ts";
816import { SHARED, type Space } from "./spaces.ts";
1018/** What applying one log entry needs from a project. */
Lines 25–32 at 31 (were 17–22 at 30)
1725 readonly changes: Map<number, ChangeRecord>;
1826 readonly labels: Map<string, number[]>;
1927 readonly refusals: Refusal[];
28+ /** The newest tells, by id in the order sent, at most TELLS_KEPT. */
29+ readonly tells: Map<number, TellRecord>;
2030 uncheck(id: number): void;
2131 stamp(time: number | undefined): void;
2232 applyMembership(entry: Entry, at: number): void;
Lines 183–195 at 31 (were 173–182 at 30)
173183 const agent = host.agentOf(entry.agent);
174184 agent.news.push(...entry.text);
175185 agent.newsAt.push(...entry.text.map(() => time));
176− for (const p of entry.pairs) {
186+ entry.pairs.forEach((p, i) => {
177187 agent.told.add(p);
178− if (p.startsWith("announce ")) host.setAnnounced(Math.max(host.announced(), Number(p.slice(9)) || 0));
179− }
188+ if (!p.startsWith("announce ")) return;
189+ const id = Number(p.slice(9)) || 0;
190+ host.setAnnounced(Math.max(host.announced(), id));
191+ tellSent(host.tells, id, entry.text[i] ?? entry.text[0] ?? "", agent.name, time);
192+ });
180193 break;
181194 }
182195 case "discard": {
Lines 201–210 at 31 (were 188–193 at 30)
188201 }
189202 case "heard": {
190203 const agent = host.agentOf(entry.agent);
204+ // A sync's stale heard keeps announcements, so it hears no tell.
205+ if (entry.stale !== true)
206+ for (const tell of host.tells.values())
207+ if (tell.heard.get(agent.name) === null) tell.heard.set(agent.name, { at: time });
191208 const keep = agent.news.map((t) => entry.stale === true && t.startsWith("Announcement from "));
192209 agent.news = agent.news.filter((_, i) => keep[i]);
193210 agent.newsAt = agent.newsAt.filter((_, i) => keep[i]);
Lines 289–314 at 31 (were 272–274 at 30)
272289 }
273290 }
274291}
293+/** How many tells the project keeps who-heard-what for (status's tells). */
294+export const TELLS_KEPT = 50;
296+/** A tell's news reached one recipient's queue: the tell is kept, the oldest dropped past TELLS_KEPT. */
297+function tellSent(
298+ tells: Map<number, TellRecord>,
299+ id: number,
300+ text: string,
301+ agent: string,
302+ time: number | undefined,
303+): void {
304+ let tell = tells.get(id);
305+ if (tell === undefined) {
306+ tell = { id, text, at: time, heard: new Map() };
307+ tells.set(id, tell);
308+ for (const old of tells.keys()) {
309+ if (tells.size <= TELLS_KEPT) break;
310+ tells.delete(old);
311+ }
312+ }
313+ if (!tell.heard.has(agent)) tell.heard.set(agent, null);
314+}
MCP
compare on this site's /mcp
CLI
abso diff 30 31 worker/project/apply-entry.ts --json
JSON
/christopher/abso-core/compare/30..31?file=worker%2Fproject%2Fapply-entry.ts&format=json