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
MCP
show on this site's /mcp
CLI
abso show 216 --json
JSON
/christopher/abso-core/versions/216?format=json

Moves picked as walks reach them, and shared's file list from kept shapes (disk-first 2; abso Capacity), for abso's status, drafts and file list.

of shared·capacity··Not checked

  • view.ts: a view picks a moved line's relocation only when a walk to find a line's file reaches that line. That is #relocations' own pick, right whenever the walk goes on to a file's start, since only lines on a loop have their relocation set aside; a walk that comes back to a line it passed resolves every move as before. shareMoves now takes the other view's moves only when this view first needs all of them, such as for a layout, so a view that only finds a few lines' files never resolves them. weight() counts the picks.
  • pathindex.ts keptPaths: shared's files at a version, folded from version 0 over each version's kept files made and taken out, with no file laid out. Only on a stored writer, and only when every version up to it has a kept row that describes it; otherwise the version is laid out as before. pathsAt uses it.

On abso's export (81,855 entries, 1,224 versions), one opened project, answers matching Project.load:

  • status: 104 s to 5.8 s (under the profiler)
  • drafts: over 60 s to 5.7 s
  • files at head: over 60 s to 1.2 s
  • files at 612: 54 s to 0.3 s

version-files.test.ts now also checks the file list at every version against the in-memory project. 124 of 124 related tests pass; tsc clean.

Version 215 · Files at version 216

5 files, 86 lines added, 6 removed.

--- a/src/engine/view.ts
+++ b/src/engine/view.ts
@@ -295,6 +295,8 @@
295295 */
296296 #relocations(): Map<LineId, RelocationInfo> {
297297 if (this.#relocs) return this.#relocs;
298+ this.#takeShared();
299+ if (this.#relocs) return this.#relocs;
298300 const graph = this.graph;
299301 const skeleton = skeletonOf(graph);
300302 const stronger = (a: RelocationInfo, b: RelocationInfo): boolean => graph.comparePriority(a.atom, b.atom) > 0;
@@ -365,13 +367,25 @@
365367 return this.#relocs;
366368 }
367369
370+ /** The view whose moves this one may take, until it needs them all; then the view it took them from. */
371+ #movesFrom: View | undefined;
372+ #movesTaken: View | undefined;
368374 /**
369375 * Take another view's resolved moves (abso Capacity), when both sets hold the very same atoms that move lines: the
370− * moves then resolve the same, and every line sits where it sits there. Checked here, so any caller may ask.
376+ * moves then resolve the same, and every line sits where it sits there. Checked when this view first needs all its
377+ * moves, so any caller may ask, and a view that only finds a few lines' files never resolves them.
371378 */
372379 shareMoves(from: View): void {
373− if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves) return;
374− if (this.#relocs || from.#scratchMoves()) return;
380+ if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves || this.#relocs) return;
381+ this.#movesFrom = from;
382+ }
384+ #takeShared(): void {
385+ const from = this.#movesFrom;
386+ if (!from) return;
387+ this.#movesFrom = undefined;
388+ if (from.#scratchMoves()) return;
375389 for (const id of this.graph.movers()) {
376390 const seq = seqOf(id);
377391 if (this.#has(seq) !== from.#has(seq)) return;
@@ -379,9 +393,29 @@
379393 this.#relocs = from.#relocations();
380394 this.#relocsN = from.#relocationsN();
381395 this.#movesOnDisk = false;
382− this.#movedFrom = from.#movedInFrom();
396+ this.#movesTaken = from;
383397 }
384398
399+ /** Moved lines' relocations picked one at a time, before the view resolves them all (null: not moved here). */
400+ readonly #picked = new Map<number, MoveEntry | null>();
402+ /**
403+ * The relocation of moved line n that counts here, as #relocations picks it before any loop: right whenever the
404+ * walk that reached n goes on to a file's start, since only lines on a loop have their relocation set aside.
405+ */
406+ #pickOne(n: number): MoveEntry | undefined {
407+ let picked = this.#picked.get(n);
408+ if (picked === undefined) {
409+ const graph = this.graph;
410+ let best: MoveEntry | undefined;
411+ for (const e of skeletonOf(graph).byLine.get(n) ?? []) {
412+ if (this.#has(seqOf(e.r.atom)) && (!best || graph.comparePriority(e.r.atom, best.r.atom) > 0)) best = e;
413+ }
414+ this.#picked.set(n, (picked = best ?? null));
415+ }
416+ return picked ?? undefined;
417+ }
385419 /** Whether moves are resolved on disk for each layout: only a stored graph's view with more than MOVED_LINES_KEPT. */
386420 #scratchMoves(): boolean {
387421 if (!this.#hasMoves || !this.graph.hasOrderedChildren) return false;
@@ -453,8 +487,21 @@
453487 /** The file a node sits in, in this set: up by where lines were written, through the moves that count here. */
454488 #fileOfCode(code: number): string {
455489 const graph = this.graph;
456− const relocs = this.#relocationsN();
457490 const skeleton = skeletonOf(graph);
491+ if (!this.#relocsN) {
492+ // One moved line at a time, until a walk comes back to a line it passed: then moves loop, and are resolved whole.
493+ const passed = new Set<number>();
494+ let c = code;
495+ for (;;) {
496+ c = skeleton.climb(c);
497+ if (c < 0) return graph.nodeOf(c).slice(1);
498+ if (passed.has(c)) break;
499+ passed.add(c);
500+ const e = this.#pickOne(c);
501+ c = e ? e.parent : graph.parentCodeOf(c);
502+ }
503+ }
504+ const relocs = this.#relocationsN();
458505 let c = code;
459506 for (;;) {
460507 c = skeleton.climb(c);
@@ -569,6 +616,8 @@
569616 #movedFrom: Map<string, Set<number>> | undefined;
570617 #movedInFrom(): Map<string, Set<number>> {
571618 if (this.#movedFrom) return this.#movedFrom;
619+ this.#relocations();
620+ if (this.#movesTaken) return (this.#movedFrom = this.#movesTaken.#movedInFrom());
572621 const graph = this.graph;
573622 const out = new Map<string, Set<number>>();
574623 if (this.#hasMoves) {
@@ -962,6 +1011,7 @@
9621011 if (this.#knownList) n += ARRAY_HEADER_BYTES + REFERENCE_BYTES * this.#knownList.length;
9631012 if (this.#relocs) n += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * this.#relocs.size;
9641013 if (this.#relocsN) n += MAP_HEADER_BYTES + (MAP_ENTRY_BYTES + OBJECT_BYTES) * this.#relocsN.size;
1014+ n += MAP_ENTRY_BYTES * this.#picked.size;
9651015 for (const f of this.#files.values()) {
9661016 n += MAP_ENTRY_BYTES;
9671017 if (f !== NO_FILE) {
--- a/worker/project/pathindex.ts
+++ b/worker/project/pathindex.ts
@@ -41,6 +41,28 @@
4141 /** Each version's files made and taken out, and moves (#41), worked out with its files. */
4242 readonly #shapeCache = new WeakMap<Space, Map<number, VersionShape>>();
4343
44+ /** The files at the newest version folded so far from kept shapes, per space (keptPaths). */
45+ readonly #keptPaths = new WeakMap<Space, { version: number; files: Set<string> }>();
47+ /**
48+ * The files a space has at a version, from the kept rows of every version up to it: each one's files made and
49+ * taken out, folded from version 0 (abso Capacity). Undefined when a version has no kept row that describes it;
50+ * then the caller lays the version out.
51+ */
52+ keptPaths(space: Space, version: number): string[] | undefined {
53+ let fold = this.#keptPaths.get(space);
54+ if (!fold || fold.version > version) fold = { version: -1, files: new Set() };
55+ const files = new Set(fold.files);
56+ for (let v = fold.version + 1; v <= version; v++) {
57+ if (!this.#keptFiles(space, v)) return undefined;
58+ const shape = this.#shapeCache.get(space)!.get(v)!;
59+ for (const f of shape.gone) files.delete(f);
60+ for (const f of shape.made) files.add(f);
61+ }
62+ this.#keptPaths.set(space, { version, files });
63+ return [...files].sort();
64+ }
4466 /** Each space's path index (#41): built the first time it's asked for, then kept up as versions land. */
4567 readonly #pathIndex = new WeakMap<Space, { upTo: number; paths: Map<string, PathLife> }>();
4668
--- a/worker/project/project-status.ts
+++ b/worker/project/project-status.ts
@@ -40,6 +40,8 @@
4040 spaceNamed(name: string | null): Space;
4141 checkVersion(space: Space, version: number): void;
4242 viewAt(space: Space, version: number): ReadView;
43+ /** A version's file list from kept version shapes, when every version up to it has one (pathindex.ts). */
44+ keptPaths?(space: Space, version: number): string[] | undefined;
4345 agentView(agent: AgentState): ReadView;
4446 version(): number;
4547 /** Shared's project file (224), or undefined before init or without one. */
@@ -74,7 +76,7 @@
7476 const space = host.spaceNamed(draft);
7577 const v = version ?? last(space);
7678 host.checkVersion(space, v);
77− return { version: v, draft, files: host.viewAt(space, v).paths() };
79+ return { version: v, draft, files: host.keptPaths?.(space, v) ?? host.viewAt(space, v).paths() };
7880}
7981
8082/**
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -2643,6 +2643,9 @@
26432643 spaceNamed: (name) => this.#spaceNamed(name),
26442644 checkVersion: (space, version) => this.#checkVersion(space, version),
26452645 viewAt: (space, version) => this.#viewAt(space, version),
2646+ // Shared's lists from kept shapes on a stored writer, where a version's layout reads its files from disk.
2647+ keptPaths: (space, version) =>
2648+ this.#writerStorage && space.name === SHARED ? this.#paths.keptPaths(space, version) : undefined,
26462649 agentView: (agent) => this.#agentView(agent),
26472650 version: () => this.version,
26482651 projectFile: () => (this.initialized ? projectFileIn(this.#sharedView()) : undefined),
--- a/worker/project/test/version-files.test.ts
+++ b/worker/project/test/version-files.test.ts
@@ -52,6 +52,9 @@
5252 for (const path of ["a.txt", "b.txt", "c.txt", "d.txt", "e.txt", "gone.txt"])
5353 assert.deepEqual(project.log({ limit: 100, path }), oracle.log({ limit: 100, path }), path);
5454 for (let v = 0; v <= oracle.version; v++) assert.deepEqual(project.show(v), oracle.show(v), `version ${v}`);
55+ // The file list at each version, folded from the kept shapes' files made and taken out: newest first, then from 0.
56+ assert.deepEqual(project.pathsAt(oracle.version), oracle.pathsAt(oracle.version));
57+ for (let v = 0; v <= oracle.version; v++) assert.deepEqual(project.pathsAt(v), oracle.pathsAt(v), `paths at ${v}`);
5558 // A compare reads the kept lists for the versions between (version-log.ts): both ways, and across the drop.
5659 for (const [from, to] of [
5760 [0, oracle.version],