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 239 to 240

Compare

+28 −5 in 6 places
Lines 267–274 at 240 (were 267–272 at 239)
267267/** A run written in another file under one of a file's lines: [the parent's n, the run's file index]. */
268268export type PackedCrossing = [number, number];
269269const EMPTY_NUMBERS: readonly number[] = Object.freeze([]);
270+/** At most this many path names kept in memory (Graph.#pathName). */
271+const PATH_NAMES = 4096;
270272/** Lines longer than this aren't packed with their file; their text is read on its own. */
271273const PACKED_TEXT = 4096;
272274
Lines 883–889 at 240 (were 881–887 at 239)
881883 id,
882884 atom: this.idOfSeq(seq),
883885 k: n - this.#lineBase[seq]!,
884− file: this.#paths[this.#lineFile.at(n)]!,
886+ file: this.#pathName(this.#lineFile.at(n)),
885887 parent: this.#nodeName(this.#lineParent.at(n)),
886888 text: this.#text(n),
887889 };
Lines 904–910 at 240 (were 902–908 at 239)
902904 /** The file a line was written in, or undefined: line(id).file without making the record. */
903905 lineFile(id: LineId): string | undefined {
904906 const n = this.#lineN(id);
905− return n < 0 ? undefined : this.#paths[this.#lineFile.at(n)];
907+ return n < 0 ? undefined : this.#pathName(this.#lineFile.at(n));
906908 }
907909
908910 /** The node a line was written after, or undefined: line(id).parent without making the record. */
Lines 1016–1022 at 240 (were 1014–1020 at 239)
10141016
10151017 /** The file line n was written in. */
10161018 writtenIn(n: number): string {
1017− return this.#paths[this.#lineFile.at(n)]!;
1019+ return this.#pathName(this.#lineFile.at(n));
10181020 }
10191021
10201022 /** The code of the node line n was written after. */
Lines 1179–1208 at 240 (were 1177–1185 at 239)
11771179 }
11781180
11791181 #nodeName(code: number): NodeId {
1180− return code >= 0 ? this.#lineName(code) : startNode(this.#paths[-1 - code]!);
1182+ return code >= 0 ? this.#lineName(code) : startNode(this.#pathName(-1 - code));
11811183 }
11821184
1185+ /**
1186+ * A path's name by its index, kept in memory once read (abso Capacity): finding a deleted line's file names the file
1187+ * it reaches, and a stored graph read the path list each time. Cleared when the graph accepts an atom, so a name a
1188+ * rolled-back add made never stays.
1189+ */
1190+ #pathName(index: number): string {
1191+ if (this.#pathNamesAt !== this.#accepted) {
1192+ this.#pathNames.clear();
1193+ this.#pathNamesAt = this.#accepted;
1194+ }
1195+ let name = this.#pathNames.get(index);
1196+ if (name === undefined) {
1197+ name = this.#paths[index]!;
1198+ if (this.#pathNames.size >= PATH_NAMES) this.#pathNames.clear();
1199+ this.#pathNames.set(index, name);
1200+ }
1201+ return name;
1202+ }
1203+ readonly #pathNames = new Map<number, string>();
1204+ #pathNamesAt = -1;
11831206 #pathOf(file: string): number {
11841207 let p = this.#pathIndex.get(file);
11851208 if (p === undefined) {
Lines 1712–1718 at 240 (were 1689–1695 at 239)
16891712 }
16901713 const files = new Set<string>();
16911714 for (const run of atom.inserts) files.add(run.file);
1692− for (const n of deletedNumbers(this)) files.add(this.#paths[this.#lineFile.at(n)]!);
1715+ for (const n of deletedNumbers(this)) files.add(this.#pathName(this.#lineFile.at(n)));
16931716 for (const a of frozen.attrs ?? []) files.add(a.file);
16941717 for (const m of frozen.moves ?? []) {
16951718 files.add(this.lineFile(m.line)!);
MCP
compare on this site's /mcp
CLI
abso diff 239 240 src/engine/graph.ts --json
JSON
/christopher/abso-core/compare/239..240?file=src%2Fengine%2Fgraph.ts&format=json