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 241 to 242

Compare

+32 −0 in 5 places
Lines 612–618 at 242 (were 612–617 at 241)
612612 this.#dependentsPages = storedLists<AtomId>(storage, "dependents");
613613 this.#resolversPages = storedLists<AtomId>(storage, "resolvers");
614614 this.#togetherPages = storedLists<TogetherLink>(storage, "together");
615+ this.#reasonsInPages = storedLists<AtomId>(storage, "reasons-in");
615616 this.#fileAtomPages = storedLists<AtomId>(storage, "file-atoms");
616617 this.#runStartPages = storedLists<number>(storage, "run-starts", (key) =>
617618 JSON.stringify(["number", Number(key)]),
Lines 804–819 at 242 (were 803–808 at 241)
803804 #resolversPages: ReturnType<typeof storedLists<AtomId>> | undefined;
804805 #together: StateMap<AtomId, TogetherLink[]> = new Map();
805806 #togetherPages: ReturnType<typeof storedLists<TogetherLink>> | undefined;
807+ /** The atoms whose reasons point at each atom, in seq order, once each (abso Capacity). */
808+ #reasonsIn = new Map<AtomId, AtomId[]>();
809+ #reasonsInPages: ReturnType<typeof storedLists<AtomId>> | undefined;
810+ /** Whether a stored graph keeps reasons-in: from a fresh graph on, worked out when first needed. */
811+ #reasonsInKnown: boolean | undefined;
812+ get #reasonsInKept(): boolean {
813+ if (!this.#storage) return true;
814+ this.#reasonsInKnown ??= this.#storage.read("reasons-in:meta", "kept") === 1;
815+ return this.#reasonsInKnown;
816+ }
806817 #fileAtoms: StateMap<string, AtomId[]> = new Map();
807818 #fileAtomPages: ReturnType<typeof storedLists<AtomId>> | undefined;
808819 /** First lines of runs (their n), by the node they were written after: a line's n, or -1 - a path's index. */
Lines 1356–1371 at 242 (were 1345–1350 at 241)
13451356 else yield* listOf(this.#resolvers.get(id));
13461357 }
13471358
1359+ /**
1360+ * The atoms whose reasons point at this one, in seq order, once each; or undefined when a stored graph made before
1361+ * this index keeps none, and the caller looks at every atom (abso Capacity).
1362+ */
1363+ reasonsTo(id: AtomId): readonly AtomId[] | undefined {
1364+ if (!this.#reasonsInKept) return undefined;
1365+ if (this.#reasonsInPages) return [...this.#reasonsInPages.values(id)];
1366+ return this.#reasonsIn.get(id) ?? [];
1367+ }
13481369 /** `together` reasons touching this atom, in either direction. */
13491370 togetherLinks(id: AtomId): readonly TogetherLink[] {
13501371 return [...this.eachTogetherLink(id)];
Lines 1567–1574 at 242 (were 1546–1551 at 241)
15461567 }
15471568 if (this.#storage && this.#atoms.length === 0 && this.#packFiles) {
15481569 this.#storage.write("file-lines:meta", "format", 2);
1570+ this.#storage.write("reasons-in:meta", "kept", 1);
1571+ this.#reasonsInKnown = true;
15491572 this.#formatKnown = 2;
15501573 }
15511574
Lines 1746–1760 at 242 (were 1723–1728 at 241)
17231746 if (this.#fileAtomPages) this.#fileAtomPages.append(file, frozen.id);
17241747 else pushIndex(this.#fileAtoms, file, frozen.id);
17251748 }
1749+ if (this.#reasonsInKept) {
1750+ const pointed = new Set<AtomId>();
1751+ for (const r of frozen.reasons) {
1752+ if (pointed.has(r.to)) continue;
1753+ pointed.add(r.to);
1754+ if (this.#reasonsInPages) this.#reasonsInPages.append(r.to, frozen.id);
1755+ else pushIndex(this.#reasonsIn, r.to, frozen.id);
1756+ }
1757+ }
17261758 for (const r of frozen.reasons) {
17271759 if (r.kind !== "together" || r.to === frozen.id) continue;
17281760
MCP
compare on this site's /mcp
CLI
abso diff 241 242 src/engine/graph.ts --json
JSON
/christopher/abso-core/compare/241..242?file=src%2Fengine%2Fgraph.ts&format=json