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 262 to 263

Compare

+37 −1 in 5 places
Lines 54–61 at 263 (were 54–59 at 262)
5454 | "shareMoves"
5555 | "shareFiles"
5656 | "knowPaths"
57+ | "laidOut"
58+ | "forget"
5759 | "fileOfNumber"
5860 | "lineNumberOf"
5961 | "visibleWriters"
Lines 124–132 at 263 (were 122–127 at 262)
122124const EMPTY_INTS = new Int32Array(0);
123125const NO_FILE: FileState = { attrs: NO_ATTRS, complete: true, seq: EMPTY_INTS, vis: EMPTY_INTS, deletedBy: new Map() };
124126
127+/** A count of file uses shared by every view, so a cache can tell which layout across its views was used longest ago. */
128+let fileUses = 0;
125130// Approximate retained-container costs for View.weight(): reference slots,
126131// object headers, and map/set entries. These are cache-budget units, not V8
127132// heap measurements. Referenced Graph strings and records are not charged.
Lines 919–928 at 263 (were 914–920 at 262)
914919 const paths: string[] = [];
915920 for (const path of this.graph.knownFiles()) {
916921 if (this.hasFile(path)) paths.push(path);
917− else this.#files.delete(path);
922+ else {
923+ this.#files.delete(path);
924+ this.#used.delete(path);
925+ }
918926 }
919927 return paths.sort();
920928 }
Lines 1176–1182 at 263 (were 1168–1173 at 262)
11681176 if (this.#relocs) n += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * this.#relocs.size;
11691177 if (this.#relocsN) n += MAP_HEADER_BYTES + (MAP_ENTRY_BYTES + OBJECT_BYTES) * this.#relocsN.size;
11701178 n += MAP_ENTRY_BYTES * this.#picked.size;
1179+ n += MAP_ENTRY_BYTES * this.#used.size;
11711180 for (const f of this.#files.values()) {
11721181 n += MAP_ENTRY_BYTES;
11731182 if (f !== NO_FILE) {
Lines 1206–1240 at 263 (were 1197–1204 at 262)
11971206 else state = this.graph.hasAtomsIn(path) ? this.#layout(path, complete) : NO_FILE;
11981207 this.#files.set(path, state);
11991208 }
1209+ if (state !== NO_FILE) this.#used.set(path, ++fileUses);
12001210 return state;
12011211 }
1213+ /** When each laid-out file was last used (fileUses). */
1214+ readonly #used = new Map<string, number>();
1216+ /**
1217+ * Each laid-out file: its layout, when it was last used (a count shared by every view) and what it holds, for a
1218+ * cache that trims the least recently used layouts across its views before whole views (views.ts, abso Capacity).
1219+ */
1220+ *laidOut(): IterableIterator<{ path: string; layout: object; used: number; bytes: number }> {
1221+ for (const [path, f] of this.#files) {
1222+ if (f === NO_FILE) continue;
1223+ let bytes = 2 * MAP_ENTRY_BYTES + layoutBytes(f);
1224+ if (f.seqIndex) bytes += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * f.seqIndex.size;
1225+ if (f.visIndex) bytes += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * f.visIndex.size;
1226+ yield { path, layout: f, used: this.#used.get(path) ?? 0, bytes };
1227+ }
1228+ }
1230+ /** Let go of a file's layout: the next ask lays it out again, the same. */
1231+ forget(path: string): void {
1232+ this.#files.delete(path);
1233+ this.#used.delete(path);
1234+ if (this.#linesCache?.path === path) this.#linesCache = undefined;
1235+ if (this.#seqCache?.path === path) this.#seqCache = undefined;
1236+ if (this.#textCache?.path === path) this.#textCache = undefined;
1237+ }
12021238}
12031239
12041240/** The files of a closed set, path -> text. */
MCP
compare on this site's /mcp
CLI
abso diff 262 263 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/262..263?file=src%2Fengine%2Fview.ts&format=json