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 175 to 318

Compare

+74 −9 in 4 places
Lines 9–15 at 318 (were 9–15 at 175)
99import { ProjectError } from "./project-error.ts";
1010import type { FileChange, LogAnswer, LogEntry, ShowAnswer } from "./project-types.ts";
1111import { last, SHARED, type Space } from "./spaces.ts";
12−import { changesBetween } from "./view-changes.ts";
12+import { changesBetween, summariesBetween } from "./view-changes.ts";
1313
1414/** What the version list reads need from a project. */
1515export interface LogHost {
Lines 66–83 at 318 (were 66–77 at 175)
6666 const p = space.versions[v]!;
6767 if (![...p.atoms, ...(p.dropped ?? [])].some((id) => g.filesOf(id).some((f) => sources.has(f)))) continue;
6868 }
69+ // With a path: only the versions that changed that file (its history), under its name then. Their files first, and
70+ // the whole entry (every atom of the version read) only for those (abso Capacity): a file's history read every
71+ // version's atoms down to its twentieth change.
72+ if (path !== undefined && !host.paths.versionFiles(space, v, views).includes(nameAt(v))) {
73+ views.delete(v + 1);
74+ continue;
75+ }
6976 const entry = logEntry(host, space, v, views);
7077 // The walk goes down: a view above this version won't be needed again (#46).
7178 views.delete(v + 1);
72− // With a path: only the versions that changed that file (its history), under its name then.
7379 if (path === undefined) versions.push(entry);
74− else if (entry.files.includes(nameAt(v))) versions.push(nameAt(v) === path ? entry : { ...entry, path: nameAt(v) });
80+ else versions.push(nameAt(v) === path ? entry : { ...entry, path: nameAt(v) });
7581 }
7682 const next = v >= 0 && versions.length > 0 ? versions[versions.length - 1]!.version : undefined;
7783 const movedFrom = names.slice(0, -1).map((n, i) => ({ path: names[i + 1]!.path, version: n.since }));
Lines 244–302 at 318 (were 238–259 at 175)
238244 };
239245}
240246
241−/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
242−export function compare(
247+/**
248+ * fileAt for exactly this spelling, from the file's own lines (abso Capacity, 2026-10-17): no spelling lookup and no
249+ * list of the version's files. fileAt's hasFile answers from the version's whole path list, folded from version 0
250+ * when nothing's kept, and a spelling it doesn't find reads every known path. A name nothing ever wrote is one read.
251+ * The pipeline's project files (abso.yml and the like) are read this way on every tick.
252+ */
253+export function fileExactAt(
243254 host: LogHost,
255+ path: string,
256+ version: number,
257+ options: { draft?: string | null; agent?: string } = {},
258+): { path: string; version: number; text: string | null; blob?: string } {
259+ host.needInit();
260+ checkReadPath(path);
261+ const space = host.spaceFor(options);
262+ host.checkVersion(space, version);
263+ if (!host.graph.hasAtomsIn(path)) return { path, version, text: null };
264+ const view = host.viewAt(space, version);
265+ const attrs = view.attrs(path);
266+ // hasFile's own test, without its path list: kept while empty, a link, a binary, or a visible line.
267+ const exists = attrs.exists || attrs.link !== null || attrs.blob !== null || view.lines(path).length > 0;
268+ return {
269+ path,
270+ version,
271+ text: exists ? view.text(path) : null,
272+ ...(attrs.blob !== null ? { blob: attrs.blob } : {}),
273+ };
274+}
276+/** The files that may differ between two versions, and both views: compare's and compareSummary's ground. */
277+function compared(
278+ host: LogHost,
244279 from: number,
245280 to: number,
246− options: { draft?: string | null; agent?: string } = {},
247−): { from: number; to: number; files: FileChange[] } {
281+ options: { draft?: string | null; agent?: string },
282+): { before: ReadView; after: ReadView; files: Set<string> } {
248283 host.needInit();
249284 const space = host.spaceFor(options);
250285 host.checkVersion(space, from);
251286 host.checkVersion(space, to);
252− const a = host.at(space, from);
253− const b = host.at(space, to);
254287 const before = host.viewAt(space, from);
255288 const after = host.viewAt(space, to);
256289 const files = new Set<string>();
290+ // A stored writer keeps each shared version's changed files (version-files.ts, abso Capacity): every file that
291+ // differs between two versions changed in one between them, so those lists are the candidates, not every atom
292+ // either set holds.
293+ if (space.name === SHARED && host.graph.packedFiles) {
294+ for (let v = Math.min(from, to) + 1; v <= Math.max(from, to); v++)
295+ for (const file of host.paths.versionFiles(space, v)) files.add(file);
296+ return { before, after, files };
297+ }
298+ const a = host.at(space, from);
299+ const b = host.at(space, to);
257300 for (const [x, y] of [
258301 [a, b],
259302 [b, a],
Lines 309–339 at 318 (were 266–274 at 175)
266309 ))
267310 files.add(file);
268311 }
312+ return { before, after, files };
313+}
315+/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
316+export function compare(
317+ host: LogHost,
318+ from: number,
319+ to: number,
320+ options: { draft?: string | null; agent?: string } = {},
321+): { from: number; to: number; files: FileChange[] } {
322+ const { before, after, files } = compared(host, from, to, options);
269323 return { from, to, files: changesBetween(before, after, files) };
270324}
271325
326+/** compare's files as each one's size and SHA-256 before and after, not its texts (abso issue 680). */
327+export function compareSummary(
328+ host: LogHost,
329+ from: number,
330+ to: number,
331+ options: { draft?: string | null; agent?: string } = {},
332+): { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } {
333+ const { before, after, files } = compared(host, from, to, options);
334+ return { from, to, summary: true, files: summariesBetween(before, after, files) };
335+}
272337/** A version of shared (or of a named draft) as a ReadView, for reading lines (blame at a version). */
273338export function viewAt(
274339 host: LogHost,
MCP
compare on this site's /mcp
CLI
abso diff 175 318 worker/project/version-log.ts --json
JSON
/christopher/abso-core/compare/175..318?file=worker%2Fproject%2Fversion-log.ts&format=json