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 130 to 131

Compare

+58 −0 in 4 places
Lines 15–21 at 131 (were 15–20 at 130)
1515 seqOf,
1616 startNode,
1717} from "./keys.ts";
18+import { OrderedIndex, orderedChildKey } from "./ordered-index.ts";
1819import {
1920 type GraphStateStorage,
2021 type StateMap,
Lines 632–677 at 131 (were 631–636 at 130)
631632 else yield* listOf(this.#runStarts.get(code));
632633 }
633634
635+ get hasOrderedChildren(): boolean {
636+ return this.#storage !== undefined;
637+ }
638+ #childPriority(n: number): string {
639+ const seq = this.writerSeqOf(n);
640+ return orderedChildKey({
641+ n,
642+ replaces: this.replacesN(n) ? 1 : 0,
643+ lamport: this.lamportOfSeq(seq),
644+ seq,
645+ k: this.kOf(n),
646+ });
647+ }
648+ /** Persistent layout order with a strict successor cursor; moves are separate. */
649+ *orderedChildrenN(code: number, after?: number): IterableIterator<number> {
650+ if (!this.#storage) throw new Error("ordered children require indexed storage");
651+ const index = new OrderedIndex(this.#storage, "ordered-children", String(code));
652+ if (this.#storage.read("ordered-children", "format") !== 1)
653+ throw new Error("ordered children require fresh adoption");
654+ if (index.size !== this.#runStartPages!.length(String(code))) throw new Error("ordered child index count mismatch");
655+ const cursor = after === undefined ? undefined : this.#childPriority(after);
656+ let implicit: number | undefined;
657+ if (
658+ code >= 0 &&
659+ code + 1 < this.#lineTotal &&
660+ this.#lineAtom.at(code + 1) === this.#lineAtom.at(code) &&
661+ this.#lineParent.at(code + 1) === code
662+ )
663+ implicit = code + 1;
664+ if (implicit !== undefined && cursor !== undefined && this.#childPriority(implicit) <= cursor) implicit = undefined;
665+ for (const n of index.values(cursor)) {
666+ if (implicit !== undefined && this.#childPriority(implicit) < this.#childPriority(n)) {
667+ yield implicit;
668+ implicit = undefined;
669+ }
670+ yield n;
671+ }
672+ if (implicit !== undefined) yield implicit;
673+ }
634675 replacesN(n: number): boolean {
635676 return this.#replacing.at(n) === 1;
636677 }
Lines 945–955 at 131 (were 904–909 at 130)
904945 }
905946
906947 #add(atom: Atom): void {
948+ if (this.#storage && this.#storage.read("ordered-children", "format") !== 1) {
949+ if (this.#atoms.length !== 0) throw new Error("ordered children require fresh adoption");
950+ this.#storage.write("ordered-children", "format", 1);
951+ }
907953 validateShape(atom);
908954 const seq = this.#atoms.length;
909955 const bad = (why: string): never => {
Lines 1047–1064 at 131 (were 1001–1006 at 130)
10011047 const file = this.#pathOf(run.file);
10021048 let parent = isStartNode(run.parent) ? -1 - file : this.#lineN(run.parent);
10031049 const first = this.#lineTotal;
1050+ if (this.#storage)
1051+ new OrderedIndex(this.#storage, "ordered-children", String(parent)).insert(
1052+ orderedChildKey({
1053+ n: first,
1054+ replaces: deletes?.has(run.parent) ? 1 : 0,
1055+ lamport: lam,
1056+ seq,
1057+ k: first - this.#lineBase[seq]!,
1058+ }),
1059+ first,
1060+ );
10041062 if (this.#runStartPages) this.#runStartPages.append(String(parent), first);
10051063 else pushOne(this.#runStarts, parent, first);
10061064 for (let i = 0; i < run.lines.length; i++) {
MCP
compare on this site's /mcp
CLI
abso diff 130 131 src/engine/graph.ts --json
JSON
/christopher/abso-core/compare/130..131?file=src%2Fengine%2Fgraph.ts&format=json