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 220 to 221

Compare

+39 −7 in 6 places
Lines 262–269 at 221 (were 262–267 at 220)
262262export type PackedDelete = [number, number];
263263/** An attribute set on a file: [seq, name, value]. */
264264export type PackedAttr = [number, string, string | null];
265+/** A run written in another file under one of a file's lines: [the parent's n, the run's file index]. */
266+export type PackedCrossing = [number, number];
265267const EMPTY_NUMBERS: readonly number[] = Object.freeze([]);
266268/** Lines longer than this aren't packed with their file; their text is read on its own. */
267269const PACKED_TEXT = 4096;
Lines 601–616 at 221 (were 599–611 at 220)
599601 this.#fileTexts = storedLists<string | null>(storage, "file-texts");
600602 this.#fileDeletes = storedLists<PackedDelete>(storage, "file-deletes");
601603 this.#fileAttrs = storedLists<PackedAttr>(storage, "file-attrs");
604+ this.#fileCrossings = storedLists<PackedCrossing>(storage, "file-crossings");
602605 this.#packFiles = options.packFiles ?? true;
603606 }
604607 }
605608
606609 // Each file's line history packed, in pages (abso Capacity) ---------------------------------------------------
607610 // For each file, by its path index: every line written in it ([n, parent code, writer seq, k, replaces]) and its
608− // text, every delete of one of those lines ([n, deleter seq]), and every attribute set on it ([seq, name, value]).
611+ // text, every delete of one of those lines ([n, deleter seq]), every attribute set on it ([seq, name, value]), and
612+ // every run written in another file under one of its lines ([parent n, the run's file]): a line follows its parent,
613+ // so a run written while its parent was moved elsewhere lays out wherever the parent is.
609614 // Appended as atoms are added, so a view lays a file out from a few pages instead of a row read per line. Kept from
610615 // a fresh adoption on; a graph adopted before has none, and views lay out as before.
611616
Lines 618–656 at 221 (were 613–631 at 220)
613618 #fileTexts: ReturnType<typeof storedLists<string | null>> | undefined;
614619 #fileDeletes: ReturnType<typeof storedLists<PackedDelete>> | undefined;
615620 #fileAttrs: ReturnType<typeof storedLists<PackedAttr>> | undefined;
621+ #fileCrossings: ReturnType<typeof storedLists<PackedCrossing>> | undefined;
616622 /** Whether a new stored graph starts packing (GraphOptions.packFiles). */
617623 #packFiles = true;
618− /** Whether this graph's files are packed: read once, when first asked, so opening reads nothing. */
619− #packedKnown: boolean | undefined;
624+ /**
625+ * How this graph's files are packed, read once when first asked so opening reads nothing: 0 not at all, 1 lines,
626+ * deletes and attributes, 2 the runs written across files as well.
627+ */
628+ #formatKnown: number | undefined;
629+ get #format(): number {
630+ if (this.#formatKnown === undefined) {
631+ const format = this.#storage?.read("file-lines:meta", "format");
632+ this.#formatKnown = format === 1 || format === 2 ? format : 0;
633+ }
634+ return this.#formatKnown;
635+ }
620636 get #packed(): boolean {
621− this.#packedKnown ??= !!this.#storage && this.#storage.read("file-lines:meta", "format") === 1;
622− return this.#packedKnown;
637+ return this.#format >= 1;
623638 }
639+ get #crossings(): boolean {
640+ return this.#format >= 2;
641+ }
624642
625643 /** Whether this graph keeps each file's line history packed. */
626644 get packedFiles(): boolean {
627645 return this.#packed;
628646 }
647+ /**
648+ * Whether a file can be laid out from packed history alone: it also keeps the runs written across files. A graph
649+ * packed before those were kept lays files out line by line.
650+ */
651+ get packedLayout(): boolean {
652+ return this.#crossings;
653+ }
629654 /** A path's index, or undefined when nothing was ever written or set in it. */
630655 pathIndexOf(path: string): number | undefined {
631656 return this.#pathIndex.get(path);
Lines 671–679 at 221 (were 646–651 at 220)
646671 *packedAttrs(file: number): IterableIterator<PackedAttr> {
647672 yield* this.#fileAttrs!.values(String(file));
648673 }
674+ *packedCrossings(file: number): IterableIterator<PackedCrossing> {
675+ yield* this.#fileCrossings!.values(String(file));
676+ }
649677
650678 /** Where an atom's key and delete lists are when the graph doesn't keep them (#46): the stored atom. */
651679 #lists: ((seq: number) => AtomLists) | undefined;
Lines 1477–1484 at 221 (were 1449–1456 at 220)
14491477 this.#storage.write("ordered-children", "format", 2);
14501478 }
14511479 if (this.#storage && this.#atoms.length === 0 && this.#packFiles) {
1452− this.#storage.write("file-lines:meta", "format", 1);
1453− this.#packedKnown = true;
1480+ this.#storage.write("file-lines:meta", "format", 2);
1481+ this.#formatKnown = 2;
14541482 }
14551483
14561484 if (this.#storage) this.withProjectionScratch((scratch) => this.#validateAcceptedAtom(atom, scratch));
Lines 1563–1572 at 221 (were 1535–1540 at 220)
15351563 else pushOne(this.#runStarts, parent, first);
15361564 const replacesParent = deletes(run.parent) ? 1 : 0;
15371565 if (this.#packed) {
1566+ if (this.#crossings && parent >= 0) {
1567+ const from = this.#lineFile.at(parent);
1568+ if (from !== file) this.#fileCrossings!.append(String(from), [parent, file]);
1569+ }
15381570 const base = this.#lineBase[seq]!;
15391571 this.#fileLines!.appendAll(
15401572 String(file),
MCP
compare on this site's /mcp
CLI
abso diff 220 221 src/engine/graph.ts --json
JSON
/christopher/abso-core/compare/220..221?file=src%2Fengine%2Fgraph.ts&format=json