- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/project-api.ts --json
- JSON
- /christopher/abso-core/blame/worker/project/project-api.ts?format=json
203 linesFirst import 96% · capacity 1% · candidates 1% · groups 1% · infra-split 1% · whytrail 1%Last change capacity in version 313,
203 lines from 7 changes in 7 versions.
2// in http.ts takes a route to one of these. Any server built on the engine
3// implements them; the hosted Worker's is EngineProject (abso issue 141).
5/** An Edit, a Write or a MultiEdit, as the hook sends it. */
6export type EditBody = {
7 file: string;
8 session?: string;
9 subagent?: string;
10} & ({ old: string; new: string } | { content: string } | { edits: { old: string; new: string }[] });
12/** Files that aren't plain: executable, or a symbolic link to `link` (#27). */
13export type FileModes = Record<string, { exec?: boolean; link?: string | null }>;
15export interface Collision {
16 file: string;
17 yours: { lines: [number, number]; text: string };
18 theirs: { agent: string; message: string; version: number; lines: [number, number]; text: string };
19}
21export interface ProjectCalls {
22 /** blobs (#27): binary files, path -> the SHA-256 of bytes already uploaded to PUT /p/:project/blobs/<sha256>. */
23 init(
24 files: Record<string, string>,
25 modes?: Record<string, { exec?: boolean; link?: string | null }>,
26 blobs?: Record<string, string>,
27 ): { version: number; skipped?: string[] };
28 edit(agent: string, body: EditBody): { ok: true; news: string[] } | { ok: false; reason: "out of step" };
29 record(
30 agent: string,
31 files: Record<string, string | null>,
32 modes?: Record<string, { exec?: boolean; link?: string | null }>,
33 blobs?: Record<string, string>,
34 meta?: { session?: string; subagent?: string; client?: string },
35 ): { ok: true; changed: string[]; news: string[] };
36 publish(
37 agent: string,
38 message: string,
39 asIs?: boolean,
40 ):
41 | { ok: true; version: number; changes?: number }
42 | { ok: true; queued: number; position: number; ahead: number; changes: number }
43 | { ok: false; collisions: unknown[] };
44 sync(agent: string): { version: number; files: Record<string, string | null>; collisions: unknown[] };
45 status(): {
46 version: number;
47 agents: {
48 agent: string;
49 draft?: string | null;
50 base: number;
51 draftChanges: number;
52 files: string[];
53 parked?: { draft: string | null; draftChanges: number }[];
54 }[];
55 drafts?: { name: string; version: number; sharedBase: number; changes: number; agents: string[] }[];
56 };
57 /** Named drafts (#10): move to a named draft, or back to shared with null, parking unpublished changes; carry takes them into a new draft. Answers like a sync. */
58 switchTo(
59 agent: string,
60 name: string | null,
61 carry?: boolean,
62 ): { draft: string | null; version: number; files: Record<string, string | null>; collisions: unknown[] };
63 /** Lands the agent's named draft in shared as one unit. Answers like publish. */
64 land(
65 agent: string,
66 message: string,
67 ): { ok: true; version: number; changes?: number } | { ok: false; collisions: unknown[] };
68 /** Moves the agent's named draft onto shared's newest version. */
69 syncDraft(agent: string): { draft: string; version: number; sharedBase: number };
70 /** Commits pushed to the project's repo with plain git (#8). See the engine's ingest. */
71 ingest(
72 input: {
73 author: string;
74 base: number;
75 commits: {
76 sha: string;
77 message: string;
78 files: Record<string, string>;
79 modes?: FileModes;
80 blobs?: Record<string, string>;
81 }[];
82 },
83 time: number,
84 ): { landed: boolean; version: number; draft: string };
85 /** Shared's files now, for the push out to Artifacts. A link's text is "" and its target is in modes. */
86 /** Shared's text files at an earlier version (#31: pinning a reviewed harness). */
87 filesAt(version: number): Record<string, string>;
88 /** Shared's binary files at `version`: path -> SHA-256. */
89 blobsAt(version: number): Record<string, string>;
90 shared(): {
91 version: number;
92 files: Record<string, string>;
93 modes?: FileModes;
94 blobs?: Record<string, string>;
95 last?: { agent: string; message: string };
96 };
97 /** Whether init has run. */
98 exists(): boolean;
99}
101/** Reading shared's history (slice 2): blame for a file, why for one line. See blame.ts. */
102export interface ProjectHistory {
103 /** draft: a named draft's view (at version); agent: an agent's view now, its unpublished changes included. */
104 blame(file: string, from?: number, to?: number, version?: number, draft?: string, agent?: string): unknown;
whytrail193abso why follows a line back past formatting to its reason, and names git commits
why now lists a line's earlier changes, newest first, with what the line read before each. A change that rewrote a line left the line it replaced in the file's history; why pairs the two (same code formatted differently, the same code rewrapped, or the most similar line) and follows the pairs back. A change that only touched formatting (whitespace, line wrapping, quotes, trailing commas, line-end semicolons, parentheses around a lone arrow parameter) is skipped by default, and why names it: 'Skipped 1 formatting change since: version 366'. --all shows those too. --at <version> reads the line as it was at that version.
A push imported from git (client/scripts/import-git.ts, or a plain git push) names its commit and author in why and blame. import-git.ts now also records where the repository's issues are, from origin on GitHub or GitLab or --issues, and why says which issue #N in an imported message or line means. A project imported before this can say it once in abso.json: "gitIssues": "https://github.com/owner/repo/issues".
Closes issues 20 and 21's tool side.Compare105 why(file: string, line: number, draft?: string, agent?: string, version?: number): unknown;
107 folderBlame(folder: string, version?: number, draft?: string, agent?: string): unknown;
108 /** One folder's entries with each one's last change (#41, F2, F34). */
109 tree(folder: string, version?: number, draft?: string | null, agent?: string, authors?: boolean): unknown;
110 /** A path's life: its last change, and the versions that made it and took it out (#41, F10, F30). */
111 pathLife(path: string, version?: number, draft?: string | null): unknown;
112 /** Lines at one version followed by their ids to a later one (#41, F15). */
113 follow(path: string, version: number, from: number, to: number, at?: number, draft?: string | null): unknown;
114 /** An agent's paths for a reader: an unknown agent is not found, and nothing is made (#41, F25). */
115 pathsOf(agent: string): unknown;
116 /** Whether agents' unpublished changes would collide, by the publish rule (#41, F22). */
117 collisions(file?: string, folder?: string): unknown;
118 draftState(name: string): unknown;
119 /** Who is working where: each file, the agents whose drafts touch it, and which lines. */
120 where(): unknown;
121 /** The versions of shared (or a named draft), newest first (#27); follow: a path's history back through abso mv (#41, F27). */
122 log(draft: string | null, limit?: number, path?: string, agent?: string, before?: number, follow?: boolean): unknown;
123 /** The project's events from a log position (#41, the website): reading consumes nothing. */
124 feed(from: number, limit?: number): { next: number; end: number; events: unknown[] };
125 /** How many entries the log holds: what a feed long-poll waits to see grow. */
126 logLength(): number;
127 /** An agent's draft diff for a reader: never creates the agent (#41). */
128 diffOf(agent: string): unknown;
129 /** Every agent with unpublished changes (#41). */
130 drafts(): unknown;
131 /** One change (#44): its start note or draft, versions, files, settles and refusals. */
132 change(id: number): unknown;
133 /** The changes with anything new at or after a log position (#44, "since you last looked"). */
134 changes(since: number, limit: number, before?: number, issue?: number): unknown;
135 /** Move a file in the agent's draft, its lines keeping their ids (#49). */
136 move(agent: string, from: string, to: string): unknown;
137 /** A note on lines, or a reply to one (#44). */
138 note(agent: string, body: Record<string, unknown>): unknown;
139 /** A signed-in person's note from the website (#41); the Worker has checked who it is. No HTTP route. */
140 notePerson(person: { id: string; name: string }, body: Record<string, unknown>): unknown;
141 /** Close a person's own note (#41). No HTTP route. */
142 closeNotePerson(person: { id: string; name: string }, id: number, how: unknown): unknown;
143 /** Close a note; only its writer can (#44). */
144 closeNote(agent: string, id: number, how: unknown): unknown;
145 /** Notes on a file or a change, or only the open ones (#44). */
146 notes(options: { file?: string; change?: number; open?: boolean }): unknown;
147 /** The log position for a time (ms since 1970) or a version of shared (#41). */
148 position(q: { time?: number; version?: number }): { position: number; end: number };
149 /** Shared's versions as authors only, for the website's ribbon (#43). */
150 ribbon(): { version: number; agents: string[]; authors: number[] };
151 /** status and where as they stood with the first `at` log entries (#41, replay). */
152 statusAt(at: number): unknown;
153 whereAt(at: number): unknown;
infra-split37Comments and test names give each reason in plain words, without naming who raised it
Notes like "(#37, Builder 5)" or "(AVCS - Security)" become "(#37)" or go, and a private commit hash after a name goes with it. Issue numbers and references such as git's CVE-2019-1353 stay. Only comments and test names change; no behavior changes.Compare154 /** Refused publishes and lands, newest first, with counts over all of them. */
156 /** A file as it was at a version (#27). */
157 fileAt(path: string, version: number, draft: string | null, agent?: string): unknown;
capacity313fileExactAt: a file at a version by exactly its spelling, from its own lines, without the version's list of files (for abso's pipelines step)
- version-log.ts fileExactAt(path, version): what fileAt answers for that same spelling, with no spelling lookup and no path list. Existence comes from hasFile's own test on the file itself: kept while empty, a link, a binary, or a visible line. A name nothing ever wrote is one hasAtomsIn read.
- Why: fileAt's hasFile answers from the version's whole list of files (the kept path set, folded from version 0 when nothing nearby is kept), and a spelling it doesn't find reads every known path (filesOf over every atom). abso reads its project files (abso.yml and the like) for each green ready marker on every tick, and that grew with history: 2–5 s a tick on prod.
- Project.fileExactAt; and ProjectHistory.fileExactAt, optional, so abso's pin compiles before its engine passes it through.
- Test: worker/project/test/file-exact-at.test.ts. fileExactAt equals fileAt at every version for nine paths (added, edited, emptied, binary, removed, never written), and another spelling isn't resolved to the stored one.
Checks: tsc clean; Biome clean; core tests (worker/project and src) 767 of 768 passed, 1 skipped, none failed.Compare158 /** fileAt for exactly this spelling, without the version's list of files (version-log.ts fileExactAt). */
159 fileExactAt?(path: string, version: number, draft: string | null): unknown;
capacity243compare's summary: each changed file's size and SHA-256 instead of its texts (abso issue 680; disk-first 2; abso Capacity).
compare 612 to 1224 on abso answers 13.2 MB: the full before and after text of about 3,000 changed files. Read Speed's shape lets the site ask for a summary and fetch a file's texts when it opens it.
- view-changes.ts summariesBetween: the files changesBetween would list, each side as {size, sha256} for text (UTF-8 bytes, SHA-256 of the text), {blob} for a binary file (its hash; the Worker adds its size from the blob store), or null when absent; mode and blob as in the full answer. Each text is read, summed up and let go.
- version-log compare takes summary and answers {from, to, summary: true, files}. ProjectHistory.compare and both engine-project.ts implementations take a fifth argument, summary; http.ts passes ?summary=1. The full answer is unchanged.
On abso adopted fresh: the summary for 612 to 1224 is 174 KB instead of 13.2 MB, with heap after at 38 MB. The time is the same (about 20 s cold): it still lays the files out to hash them. Stored per-version sizes and hashes would remove that; they're proposed with the author totals table.
New test compare-summary: on an in-memory and a writer-backed project, the summary lists the files the full compare does, with sizes and SHA-256s of its texts, blob hashes for a binary file, and no text. Every engine test (292 of 292), every worker/project test (342 of 342); tsc (worker and server) and biome clean.Compare161 compare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean): unknown;
candidates186Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.Compare162 /** Version `version` of shared without the versions in `versions` (without.ts). */
163 without(version: number, versions: readonly number[]): unknown;
165 show(version: number, draft: string | null, agent?: string): unknown;
166 /** What an agent's unpublished changes do, file by file (#27). */
167 diff(agent: string): unknown;
168 /** A sync whose answer holds every file in the agent's view, as a first sync's does (#37). */
169 syncFull(agent: string, label?: string): unknown;
170 /** The paths in the agent's view now; changes nothing (#37). */
171 agentPaths(agent: string): unknown;
172 /** The paths in shared (or a named draft) at a version, the newest by default (#37). */
173 pathsAt(version?: number, draft?: string | null): unknown;
174 /** Sync to the newest version of shared with a label (#10). */
175 syncTo(agent: string, label: string): unknown;
176 /** Put a label on a version of shared (the newest by default), or take it off. */
177 label(agent: string, name: string, version?: number, remove?: boolean): unknown;
178 /** Every label, with the versions it marks, newest first. */
179 labels(): unknown;
180 /** Correct the message of the agent's newest publish (#27). */
181 amend(agent: string, message: string): unknown;
182 /** Take some versions of a named draft into shared, checked like a land (#27). */
183 pluck(agent: string, draft: string, versions: number[], message: string, withDependencies?: boolean): unknown;
184 /** Drop published versions of shared (#10): a new version whose set leaves them out, with what built on them. */
185 drop(agent: string, versions: number[], message: string, withDependents?: boolean): unknown;
186 /** News for other agents: "Announcement from <agent>: <text>"; `to` defaults to every other agent. */
187 announce(agent: string, text: string, to?: string[], how?: string): { id: number; to: string[] };
188 /** A signed-in person's announcement from the website (#41): the Worker has checked the sender. */
189 announcePerson(person: { id: string; name: string }, text: string, to?: string[]): { id: number; to: string[] };
groups277Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.
The CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.
The engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.
Tests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.Compare190 /** A seat's earlier chat hears that another chat just used the seat; the Worker says where. Once per key. */
191 seatNotice(agent: string, place: string, key: string): boolean;
init0Start the project192 /** What the agent is starting on (#37, #13), or null to take it back; answers who already works on those files. */
193 starting(
194 agent: string,
195 text: string | null,
196 files?: string[],
197 options?: { issue?: unknown; done?: unknown },
198 ): unknown;
199 /** Hands over the news waiting for an agent, once. */
200 news(agent: string): { news: string[] };
201 /** Discard an agent's unpublished changes to some files, or all (#27). */
202 restore(agent: string, files: string[] | null): unknown;
203}