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 206 to 207

Compare

+36 −3 in 5 places
Lines 47–53 at 207 (were 47–53 at 206)
4747}
4848
4949/** Structural read boundary shared by historical and transaction-bound projections. */
50−export type ReadView = Omit<Pick<View, keyof View>, "sameText"> & {
50+export type ReadView = Omit<Pick<View, keyof View>, "sameText" | "visibleCount" | "shareMoves"> & {
5151 sameText(path: string, other: ReadView): boolean;
5252};
5353
Lines 100–107 at 207 (were 100–105 at 206)
100100export const MOVED_LINES_KEPT = 20_000;
101101class TooManyMoves extends Error {}
102102const NO_LINES: readonly number[] = Object.freeze([]);
103+/** Lines whose place views sharing moves remember, at most: about 40 bytes each. */
104+const SHARED_FILE_MEMO = 200_000;
103105
104106/**
105107 * The projection of a closed set. Construct once, then ask for files, lines
Lines 276–300 at 207 (were 274–279 at 206)
274276 return relocs;
275277 }
276278
279+ /** Where lines sit, shared with views that took this one's moves (shareMoves): unbounded up to SHARED_FILE_MEMO. */
280+ #fileOfShared: Map<number, string> | undefined;
282+ /**
283+ * Take another view's resolved moves (abso Capacity). Only for a set that differs from that view's by atoms that
284+ * move nothing, drop nothing and change no closure: its moves resolve the same, and every line it shares with that
285+ * view sits where it sat there.
286+ */
287+ shareMoves(from: View): void {
288+ if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves) return;
289+ if (from.#scratchMoves()) return;
290+ this.#relocs = from.#relocations();
291+ this.#relocsN = from.#relocationsN();
292+ this.#movesOnDisk = false;
293+ this.#movedFrom = from.#movedInFrom();
294+ from.#fileOfShared ??= new Map();
295+ this.#fileOfShared = from.#fileOfShared;
296+ }
277298 /** Whether moves are resolved on disk for each layout: only a stored graph's view with more than MOVED_LINES_KEPT. */
278299 #scratchMoves(): boolean {
279300 if (!this.#hasMoves || !this.graph.hasOrderedChildren) return false;
Lines 370–389 at 207 (were 349–361 at 206)
349370 while (file === undefined) {
350371 if (cur < 0) file = graph.nodeOf(cur).slice(1);
351372 else {
352− file = this.#fileOf.get(cur);
373+ file = (this.#fileOfShared ?? this.#fileOf).get(cur);
353374 if (file === undefined) {
354− path[visited++ % FILE_LOCATION_MEMO_ENTRIES] = cur;
375+ if (this.#fileOfShared) path.push(cur);
376+ else path[visited++ % FILE_LOCATION_MEMO_ENTRIES] = cur;
355377 cur = relocs.get(cur)?.parent ?? graph.parentCodeOf(cur);
356378 }
357379 }
358380 }
381+ const shared = this.#fileOfShared;
382+ if (shared) {
383+ if (shared.size > SHARED_FILE_MEMO) shared.clear();
384+ for (const l of path) shared.set(l, file);
385+ return file;
386+ }
359387 for (const l of path) {
360388 if (!this.#fileOf.has(l) && this.#fileOf.size >= FILE_LOCATION_MEMO_ENTRIES)
361389 this.#fileOf.delete(this.#fileOf.keys().next().value!);
Lines 696–706 at 207 (were 668–673 at 206)
668696 return [...this.#known];
669697 }
670698
699+ /** How many visible lines a file has. */
700+ visibleCount(path: string): number {
701+ return this.#file(path).vis.length;
702+ }
671704 /** Whether the file exists in this projection (has a visible line). */
672705 hasFile(path: string): boolean {
673706 const attrs = this.attrs(path);
MCP
compare on this site's /mcp
CLI
abso diff 206 207 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/206..207?file=src%2Fengine%2Fview.ts&format=json