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

+49 −10 in 3 places
Lines 346–398 at 131 (were 346–351 at 130)
346346 return out;
347347 }
348348
349+ /** Parent/successor traversal keeps no history-sized ancestry or sibling frontier. */
350+ *#layoutNodes(start: number): IterableIterator<number> {
351+ const graph = this.graph;
352+ if (graph.hasOrderedChildren && !this.#hasMoves) {
353+ const first = (parent: number, after?: number): number | undefined => {
354+ for (const n of graph.orderedChildrenN(parent, after)) if (this.#has(graph.writerSeqOf(n))) return n;
355+ return undefined;
356+ };
357+ let n = first(start);
358+ while (n !== undefined) {
359+ yield n;
360+ const child = first(n);
361+ if (child !== undefined) {
362+ n = child;
363+ continue;
364+ }
365+ let previous = n;
366+ for (;;) {
367+ const parent = graph.parentCodeOf(previous);
368+ const sibling = first(parent, previous);
369+ if (sibling !== undefined) {
370+ n = sibling;
371+ break;
372+ }
373+ if (parent === start) {
374+ n = undefined;
375+ break;
376+ }
377+ if (parent < 0 || parent >= previous) throw new Error("invalid persistent layout ancestry");
378+ previous = parent;
379+ }
380+ }
381+ return;
382+ }
383+ const stack: number[] = [];
384+ const push = (parent: number): void => {
385+ const children = this.#children(parent);
386+ for (let i = children.length - 1; i >= 0; i--) stack.push(children[i]!.n);
387+ };
388+ push(start);
389+ while (stack.length) {
390+ const n = stack.pop()!;
391+ yield n;
392+ push(n);
393+ }
394+ }
349396 /** Lay out one file: its line tree from the set's atoms, linearized. */
350397 #layout(path: string, complete: boolean): FileState {
351398 const graph = this.graph;
Lines 410–419 at 131 (were 363–379 at 130)
363410 const seq: number[] = [];
364411 const vis: number[] = [];
365412 const deletedBy = new Map<number, readonly number[]>();
366− // Depth-first, iteratively (a file of n lines can be a chain n deep).
367− const stack: number[] = [];
368− const pushChildren = (code: number): void => {
369− const list = this.#children(code);
370− for (let i = list.length - 1; i >= 0; i--) stack.push(list[i]!.n);
371− };
372414 const start = graph.startCodeOf(path);
373− if (start !== undefined) pushChildren(start);
374415 const priority = (a: number, b: number) => graph.lamportOfSeq(a) - graph.lamportOfSeq(b) || a - b;
375− while (stack.length > 0) {
376− const n = stack.pop()!;
416+ for (const n of start === undefined ? [] : this.#layoutNodes(start)) {
377417 let deleted = false;
378418 const by: number[] = [];
379419 for (const deleter of graph.eachDeleterSeqOf(n)) {
Lines 426–431 at 131 (were 386–392 at 130)
386426 if (complete) deletedBy.set(seq.length, by.length > 1 ? by.sort(priority) : by);
387427 } else vis.push(n);
388428 if (complete) seq.push(n);
389− pushChildren(n);
390429 }
391430 const attrs: FileAttrs = {
392431 exists: setters.get("exists")?.value === "1",
MCP
compare on this site's /mcp
CLI
abso diff 130 131 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/130..131?file=src%2Fengine%2Fview.ts&format=json