- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/project-status.ts --json
- JSON
- /christopher/abso-core/blame/worker/project/project-status.ts?format=json
192 linesFirst import 72% · pinch 11% · capacity 9% · engine 7% · codex-capacity-chair 2%Last change capacity in version 303,
192 lines from 8 changes in 6 versions.
init0Start the project1// What the project looks like now: status, the paths in a folder, and the labels. They read through
2// SnapshotHost; today the host is the project in memory.
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare4import type { AtomId, ReadView } from "../../src/engine/index.ts";
engine25Read abso.json first, then avcs.json (abso 224, ask 238): one helper (projectFileIn) for the queue, files kept whole, reviewers and init; publish, init and git intake check both files the same way; when shared has both, abso.json counts and status says avcs.json is ignored (status answer projectFile, printed by abso status). .abso/ is kept out of projects like .avcs/. Old projects with only avcs.json work as before.Compare6import { countRefusals, type projectFileIn } from "./project-helpers.ts";
pinch31status 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.Compare7import type {
8 AgentState,
9 AgentStatus,
10 EditsVia,
11 Refusal,
12 Starting,
13 StatusAnswer,
14 TellRecord,
15 TellStatus,
16} from "./project-types.ts";
19/** What the snapshot reads need from a project. */
20export interface SnapshotHost {
21 readonly agents: ReadonlyMap<string, AgentState>;
22 readonly spaces: ReadonlyMap<string, Space>;
23 queue(): readonly { readonly agent: string; readonly id: number }[];
24 readonly refusals: readonly Refusal[];
25 readonly labels: ReadonlyMap<string, readonly number[]>;
pinch31status 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.Compare26 readonly tells: ReadonlyMap<number, TellRecord>;
28 shared(): Space;
29 draft(agent: AgentState): AtomId[];
30 draftFiles(agent: AgentState): Set<string>;
31 liveNote(agent: AgentState): Starting | undefined;
32 openCollisions(agent: AgentState): { collisions?: AgentStatus["collisions"] };
33 editsOf(agent: AgentState): {
34 edits: EditsVia;
35 modCurrent: boolean | null;
36 lastEdit: number | null;
37 joined: number | null;
38 };
39 setOf(space: Space): ReadonlySet<AtomId>;
40 spaceNamed(name: string | null): Space;
41 checkVersion(space: Space, version: number): void;
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare42 viewAt(space: Space, version: number): ReadView;
capacity216Moves picked as walks reach them, and shared's file list from kept shapes (disk-first 2; abso Capacity), for abso's status, drafts and file list.
- view.ts: a view picks a moved line's relocation only when a walk to find a line's file reaches that line. That is #relocations' own pick, right whenever the walk goes on to a file's start, since only lines on a loop have their relocation set aside; a walk that comes back to a line it passed resolves every move as before. shareMoves now takes the other view's moves only when this view first needs all of them, such as for a layout, so a view that only finds a few lines' files never resolves them. weight() counts the picks.
- pathindex.ts keptPaths: shared's files at a version, folded from version 0 over each version's kept files made and taken out, with no file laid out. Only on a stored writer, and only when every version up to it has a kept row that describes it; otherwise the version is laid out as before. pathsAt uses it.
On abso's export (81,855 entries, 1,224 versions), one opened project, answers matching Project.load:
- status: 104 s to 5.8 s (under the profiler)
- drafts: over 60 s to 5.7 s
- files at head: over 60 s to 1.2 s
- files at 612: 54 s to 0.3 s
version-files.test.ts now also checks the file list at every version against the in-memory project. 124 of 124 related tests pass; tsc clean.Compare43 /** A version's file list from kept version shapes, when every version up to it has one (pathindex.ts). */
44 keptPaths?(space: Space, version: number): string[] | undefined;
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare45 agentView(agent: AgentState): ReadView;
engine25Read abso.json first, then avcs.json (abso 224, ask 238): one helper (projectFileIn) for the queue, files kept whole, reviewers and init; publish, init and git intake check both files the same way; when shared has both, abso.json counts and status says avcs.json is ignored (status answer projectFile, printed by abso status). .abso/ is kept out of projects like .avcs/. Old projects with only avcs.json work as before.Compare47 /** Shared's project file (224), or undefined before init or without one. */
48 projectFile(): ReturnType<typeof projectFileIn>;
51/**
capacity303Status for an agent behind shared lists its base version's kept paths, not a layout of every known file (abso 711, abso - Performance's fix; Capacity ships it)
- agentPaths and pathsOf listed an agent's files with agentView(agent).paths(). For an agent behind shared on a stored writer, that lays out every known file's history: 21,939-28,410 statements the first time, 11,330-26,075 each repeat, nothing kept. On prod abso this afternoon, 28 status calls ran 29,000-40,000 statements each while the object reset (Observability).
- An agent with nothing of its own (agent.mine empty) sees exactly its base version, so its paths are that version's kept file list (keptPaths, as pathsAt already uses: about 30 statements). An agent with a draft, or a store without kept paths, is laid out as before.
- Performance's measurement on a copy of abso's tables, first status of 12 agents: median 26,040 statements before, 203 after (max 4,686, the three with drafts); 44.2 s in all before, 4.8 s after; every status body byte for byte the same.
Checks: core tsc clean; Biome clean; node --test worker/project/test/known-paths (new: agentPaths and pathsOf on a writer match the in-memory project, for agents behind shared, at shared and with drafts), files-reads, project, reviewers: 33 of 33 pass.Compare52 * An agent with nothing of its own sees exactly its base version, so its paths are that version's kept file list
53 * (pathindex.ts), when there is one: no layout of every known file (abso - Performance, abso 711).
54 */
55function viewPaths(host: SnapshotHost, agent: AgentState): string[] {
56 const kept =
57 agent.mine.length === 0
58 ? host.keptPaths?.(host.spaceNamed(agent.space === SHARED ? null : agent.space), agent.base)
59 : undefined;
60 return kept ?? host.agentView(agent).paths();
61}
63/**
65 * Reading it changes nothing. Binary files are included.
66 */
67export function agentPaths(
68 host: SnapshotHost,
69 agentName: string,
70): { version: number; draft: string | null; files: string[] } {
71 host.needInit();
72 const agent = host.agents.get(agentName);
73 if (!agent) throw new ProjectError("bad-request", `there is no agent ${JSON.stringify(agentName)}; join first`);
74 return {
75 version: agent.base,
76 draft: agent.space === SHARED ? null : agent.space,
capacity303Status for an agent behind shared lists its base version's kept paths, not a layout of every known file (abso 711, abso - Performance's fix; Capacity ships it)
- agentPaths and pathsOf listed an agent's files with agentView(agent).paths(). For an agent behind shared on a stored writer, that lays out every known file's history: 21,939-28,410 statements the first time, 11,330-26,075 each repeat, nothing kept. On prod abso this afternoon, 28 status calls ran 29,000-40,000 statements each while the object reset (Observability).
- An agent with nothing of its own (agent.mine empty) sees exactly its base version, so its paths are that version's kept file list (keptPaths, as pathsAt already uses: about 30 statements). An agent with a draft, or a store without kept paths, is laid out as before.
- Performance's measurement on a copy of abso's tables, first status of 12 agents: median 26,040 statements before, 203 after (max 4,686, the three with drafts); 44.2 s in all before, 4.8 s after; every status body byte for byte the same.
Checks: core tsc clean; Biome clean; node --test worker/project/test/known-paths (new: agentPaths and pathsOf on a writer match the in-memory project, for agents behind shared, at shared and with drafts), files-reads, project, reviewers: 33 of 33 pass.Compare77 files: viewPaths(host, agent),
79}
81/** The paths in shared, or a named draft, at a version (the newest by default). */
82export function pathsAt(
83 host: SnapshotHost,
84 version?: number,
85 draft: string | null = null,
86): { version: number; draft: string | null; files: string[] } {
87 host.needInit();
88 const space = host.spaceNamed(draft);
89 const v = version ?? last(space);
90 host.checkVersion(space, v);
capacity216Moves picked as walks reach them, and shared's file list from kept shapes (disk-first 2; abso Capacity), for abso's status, drafts and file list.
- view.ts: a view picks a moved line's relocation only when a walk to find a line's file reaches that line. That is #relocations' own pick, right whenever the walk goes on to a file's start, since only lines on a loop have their relocation set aside; a walk that comes back to a line it passed resolves every move as before. shareMoves now takes the other view's moves only when this view first needs all of them, such as for a layout, so a view that only finds a few lines' files never resolves them. weight() counts the picks.
- pathindex.ts keptPaths: shared's files at a version, folded from version 0 over each version's kept files made and taken out, with no file laid out. Only on a stored writer, and only when every version up to it has a kept row that describes it; otherwise the version is laid out as before. pathsAt uses it.
On abso's export (81,855 entries, 1,224 versions), one opened project, answers matching Project.load:
- status: 104 s to 5.8 s (under the profiler)
- drafts: over 60 s to 5.7 s
- files at head: over 60 s to 1.2 s
- files at 612: 54 s to 0.3 s
version-files.test.ts now also checks the file list at every version against the in-memory project. 124 of 124 related tests pass; tsc clean.Compare91 return { version: v, draft, files: host.keptPaths?.(space, v) ?? host.viewAt(space, v).paths() };
94/**
95 * The paths in an agent's view now, for a reader (#41, F25): like
96 * agentPaths, but an unknown agent is not found, and nothing is made.
97 */
98export function pathsOf(
99 host: SnapshotHost,
100 agentName: string,
101): { agent: string; version: number; draft: string | null; files: string[] } {
102 host.needInit();
103 const agent = host.agents.get(agentName);
104 if (!agent) throw new ProjectError("not-found", `there is no agent ${JSON.stringify(agentName)}`);
105 return {
106 agent: agent.name,
107 version: agent.base,
108 draft: agent.space === SHARED ? null : agent.space,
capacity303Status for an agent behind shared lists its base version's kept paths, not a layout of every known file (abso 711, abso - Performance's fix; Capacity ships it)
- agentPaths and pathsOf listed an agent's files with agentView(agent).paths(). For an agent behind shared on a stored writer, that lays out every known file's history: 21,939-28,410 statements the first time, 11,330-26,075 each repeat, nothing kept. On prod abso this afternoon, 28 status calls ran 29,000-40,000 statements each while the object reset (Observability).
- An agent with nothing of its own (agent.mine empty) sees exactly its base version, so its paths are that version's kept file list (keptPaths, as pathsAt already uses: about 30 statements). An agent with a draft, or a store without kept paths, is laid out as before.
- Performance's measurement on a copy of abso's tables, first status of 12 agents: median 26,040 statements before, 203 after (max 4,686, the three with drafts); 44.2 s in all before, 4.8 s after; every status body byte for byte the same.
Checks: core tsc clean; Biome clean; node --test worker/project/test/known-paths (new: agentPaths and pathsOf on a writer match the in-memory project, for agents behind shared, at shared and with drafts), files-reads, project, reviewers: 33 of 33 pass.Compare109 files: viewPaths(host, agent),
111}
113/** Every label, with the versions it marks, newest first. */
114export function labels(host: SnapshotHost): { labels: Record<string, number[]> } {
115 const out: Record<string, number[]> = {};
116 for (const name of [...host.labels.keys()].toSorted()) out[name] = [...host.labels.get(name)!].toReversed();
117 return { labels: out };
118}
120export function status(host: SnapshotHost): StatusAnswer {
121 const agents = [...host.agents.values()]
122 .toSorted((a, b) => (a.name < b.name ? -1 : 1))
123 .map((agent) => {
124 const draft = host.draft(agent);
125 const files = host.draftFiles(agent);
126 const queued = host.queue();
127 const parked = [...agent.parked]
128 .map(([space, p]) => {
129 const set = host.setOf(host.spaces.get(space)!);
130 return { draft: space === SHARED ? null : space, draftChanges: p.mine.filter((id) => !set.has(id)).length };
131 })
132 .filter((p) => p.draftChanges > 0)
133 .toSorted((a, b) => ((a.draft ?? "") < (b.draft ?? "") ? -1 : 1));
134 return {
135 agent: agent.name,
136 draft: agent.space === SHARED ? null : agent.space,
137 base: agent.base,
138 draftChanges: draft.length,
139 files: [...files].toSorted(),
140 parked,
141 ...(host.liveNote(agent)
142 ? { starting: { ...host.liveNote(agent)!, files: [...host.liveNote(agent)!.files] } }
143 : {}),
144 ...host.openCollisions(agent),
145 ...(queued.some((q) => q.agent === agent.name)
146 ? { queued: queued.filter((q) => q.agent === agent.name).map((q) => q.id) }
147 : {}),
148 ...host.editsOf(agent),
149 };
150 });
151 const drafts = [...host.spaces.values()]
152 .filter((s) => s.name !== SHARED)
153 .toSorted((a, b) => (a.name < b.name ? -1 : 1))
154 .map((s) => ({
155 name: s.name,
156 version: last(s),
157 sharedBase: sharedBaseOf(s),
158 changes: [...s.own].filter((id) => !host.shared().own.has(id)).length,
159 agents: agents.filter((a) => a.draft === s.name).map((a) => a.agent),
160 }));
161 // Waiting announcements: the sentences still in agents' undelivered news.
162 const waiting = new Map<string, string[]>();
163 for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {
164 for (const text of agent.news) {
165 if (!text.startsWith("Announcement from ")) continue;
166 const list = waiting.get(text);
167 if (list) list.push(agent.name);
168 else waiting.set(text, [agent.name]);
169 }
170 }
171 const announcements = [...waiting].map(([text, names]) => ({ text, waiting: names }));
pinch31status 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.Compare172 // Who has heard each of the newest tells, and when (277): the news and heard entries' times.
173 const tells: TellStatus[] = [...host.tells.values()].toReversed().map((t) => ({
174 id: t.id,
175 text: t.text,
176 at: t.at ?? null,
177 to: [...t.heard]
178 .toSorted(([a], [b]) => (a < b ? -1 : 1))
179 .map(([agent, h]) => ({ agent, heard: h !== null, at: h?.at ?? null })),
180 }));
engine25Read abso.json first, then avcs.json (abso 224, ask 238): one helper (projectFileIn) for the queue, files kept whole, reviewers and init; publish, init and git intake check both files the same way; when shared has both, abso.json counts and status says avcs.json is ignored (status answer projectFile, printed by abso status). .abso/ is kept out of projects like .avcs/. Old projects with only avcs.json work as before.Compare181 // Both project files in shared (224): say which one counts, never quietly.
182 const file = host.projectFile();
183 return {
184 version: host.version(),
185 agents,
186 drafts,
187 refusals: countRefusals(host.refusals),
188 announcements,
pinch31status 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.Compare189 tells,
engine25Read abso.json first, then avcs.json (abso 224, ask 238): one helper (projectFileIn) for the queue, files kept whole, reviewers and init; publish, init and git intake check both files the same way; when shared has both, abso.json counts and status says avcs.json is ignored (status answer projectFile, printed by abso status). .abso/ is kept out of projects like .avcs/. Old projects with only avcs.json work as before.Compare190 ...(file?.ignored ? { projectFile: { used: "abso.json" as const, ignored: file.ignored } } : {}),
191 };