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

Compare

+27 −1 in 5 places
Lines 11–17 at 132 (were 11–16 at 131)
1111
1212import type { Graph, RelocationInfo } from "./graph.ts";
1313import { isStartNode } from "./keys.ts";
14+import { resolveScratchMoves, scratchLayoutNodes } from "./relocation-scratch.ts";
1415import { StableSet } from "./state-source.ts";
1516import { joinLines } from "./text.ts";
1617import { type AtomId, type AtomSet, EngineError, type LineId, type NodeId } from "./types.ts";
Lines 265–275 at 132 (were 264–269 at 131)
264265
265266 /** The node a line hangs off in this set: where it was written, or where a move put it. */
266267 parentOf(line: LineId): NodeId {
268+ if (this.graph.lineParent(line) === undefined) throw new EngineError("unknown-line", `no line ${line}`);
269+ if (this.#hasMoves && this.graph.hasOrderedChildren)
270+ return this.graph.withProjectionScratch((scratch) =>
271+ resolveScratchMoves(this.graph, (id) => this.#has(this.graph.atom(id).seq), scratch).parent(line),
272+ );
267273 const r = this.#hasMoves ? this.#relocations().get(line) : undefined;
268274 if (r) return r.parent;
269275 const parent = this.graph.lineParent(line);
Lines 296–308 at 132 (were 290–295 at 131)
290296 #fileOfN(n: number): string {
291297 const graph = this.graph;
292298 if (!this.#hasMoves) return graph.writtenIn(n);
299+ if (graph.hasOrderedChildren)
300+ return graph.withProjectionScratch((scratch) => {
301+ const moves = resolveScratchMoves(graph, (id) => this.#has(graph.atom(id).seq), scratch);
302+ let current = graph.nodeOf(n);
303+ while (!isStartNode(current)) current = moves.parent(current);
304+ return current.slice(1);
305+ });
293306 const relocs = this.#relocationsN();
294307 // Keep only a fixed tail of the walk for path compression. The selected
295308 // relocation graph is acyclic, so traversal needs no history-sized stack.
Lines 409–427 at 132 (were 396–401 at 131)
396409 /** Lay out one file: its line tree from the set's atoms, linearized. */
397410 #layout(path: string, complete: boolean): FileState {
398411 const graph = this.graph;
412+ if (this.#hasMoves && graph.hasOrderedChildren)
413+ return graph.withProjectionScratch((scratch) =>
414+ this.#layoutResolved(
415+ path,
416+ complete,
417+ scratchLayoutNodes(graph, (id) => this.#has(graph.atom(id).seq), scratch, `^${path}`),
418+ ),
419+ );
420+ return this.#layoutResolved(path, complete);
421+ }
423+ #layoutResolved(path: string, complete: boolean, nodes?: Iterable<number>): FileState {
424+ const graph = this.graph;
399425 // For each attribute, the highest-priority setter in the set wins.
400426 const setters = new Map<string, { id: AtomId; value: string | null }>();
401427 for (const id of graph.eachAtomIn(path)) {
Lines 439–445 at 132 (were 413–419 at 131)
413439
414440 const start = graph.startCodeOf(path);
415441 const priority = (a: number, b: number) => graph.lamportOfSeq(a) - graph.lamportOfSeq(b) || a - b;
416− for (const n of start === undefined ? [] : this.#layoutNodes(start)) {
442+ for (const n of nodes ?? (start === undefined ? [] : this.#layoutNodes(start))) {
417443 let deleted = false;
418444 const by: number[] = [];
419445 for (const deleter of graph.eachDeleterSeqOf(n)) {
MCP
compare on this site's /mcp
CLI
abso diff 131 132 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/131..132?file=src%2Fengine%2Fview.ts&format=json