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 232 to 318

Compare

+64 −3 in 2 places
Lines 23–31 at 318 (were 23–28 at 232)
2323 readonly shapes: ProjectOptions["shapes"];
2424}
2525
26+/** Older versions' file lists kept per space (a few agents' bases): about 1,000 paths each on abso. */
27+const OLDER_PATH_SETS = 8;
2629export class PathIndex {
2730 readonly #deps: PathIndexDeps;
2831
Lines 46–127 at 318 (were 43–66 at 232)
4346
4447 /** The files at the newest version folded so far from kept shapes, per space (keptPaths). */
4548 readonly #keptPaths = new WeakMap<Space, { version: number; files: Set<string> }>();
49+ /** The files at a few older versions, worked back from the newest (agents' bases, mostly), most recent last. */
50+ readonly #olderPaths = new WeakMap<Space, Map<number, Set<string>>>();
4651
4752 /**
53+ * The files at a version older than the newest folded (abso Capacity): the newest's files with each version since
54+ * undone, its made files taken out and its gone ones put back. Folding from version 0 again for an agent's base
55+ * read every version's kept row on each call.
56+ */
57+ #olderPathSet(
58+ space: Space,
59+ fold: { version: number; files: Set<string> },
60+ version: number,
61+ ): ReadonlySet<string> | undefined {
62+ let older = this.#olderPaths.get(space);
63+ if (!older) this.#olderPaths.set(space, (older = new Map()));
64+ const known = older.get(version);
65+ if (known) {
66+ older.delete(version);
67+ older.set(version, known);
68+ return known;
69+ }
70+ const files = new Set(fold.files);
71+ for (let v = fold.version; v > version; v--) {
72+ if (!this.#keptFiles(space, v)) return undefined;
73+ const shape = this.#shapeCache.get(space)?.get(v);
74+ if (!shape) return undefined;
75+ for (const f of shape.made) files.delete(f);
76+ for (const f of shape.gone) files.add(f);
77+ }
78+ older.set(version, files);
79+ if (older.size > OLDER_PATH_SETS) older.delete(older.keys().next().value!);
80+ return files;
81+ }
83+ /**
4884 * The files a space has at a version, from the kept rows of every version up to it: each one's files made and
4985 * taken out, folded from version 0 (abso Capacity). Undefined when a version has no kept row that describes it;
5086 * then the caller lays the version out.
5187 */
5288 keptPaths(space: Space, version: number): string[] | undefined {
89+ const files = this.keptPathSet(space, version);
90+ return files && [...files].sort();
91+ }
93+ /**
94+ * The files the versions after `from`, up to `to`, changed, from each version's kept row (abso 738): undefined when one
95+ * has none, and the caller works them out from the atoms. Every file whose text differs between the two versions is
96+ * in it, since some version between changed it.
97+ */
98+ keptChangesSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined {
99+ const out = new Set<string>();
100+ for (let v = from + 1; v <= to; v++) {
101+ const files = this.#keptFiles(space, v);
102+ if (!files) return undefined;
103+ for (const f of files) out.add(f);
104+ }
105+ return out;
106+ }
108+ /** keptPaths as a set, kept for the newest version asked: never changed once made, so a view can hold it. */
109+ keptPathSet(space: Space, version: number): ReadonlySet<string> | undefined {
53110 let fold = this.#keptPaths.get(space);
54− if (!fold || fold.version > version) fold = { version: -1, files: new Set() };
111+ if (fold?.version === version) return fold.files;
112+ if (fold && fold.version > version) return this.#olderPathSet(space, fold, version);
113+ if (!fold) fold = { version: -1, files: new Set() };
55114 const files = new Set(fold.files);
56115 for (let v = fold.version + 1; v <= version; v++) {
57116 if (!this.#keptFiles(space, v)) return undefined;
58− const shape = this.#shapeCache.get(space)!.get(v)!;
117+ // Not yet when the version is still being kept (keep asks its views which files exist).
118+ const shape = this.#shapeCache.get(space)?.get(v);
119+ if (!shape) return undefined;
59120 for (const f of shape.gone) files.delete(f);
60121 for (const f of shape.made) files.add(f);
61122 }
62123 this.#keptPaths.set(space, { version, files });
63− return [...files].sort();
124+ return files;
64125 }
65126
66127 /** Each space's path index (#41): built the first time it's asked for, then kept up as versions land. */
MCP
compare on this site's /mcp
CLI
abso diff 232 318 worker/project/pathindex.ts --json
JSON
/christopher/abso-core/compare/232..318?file=worker%2Fproject%2Fpathindex.ts&format=json