UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

39 lines • 1.79 kB
import type { PagedNode, PagedRoot } from "./compact-paged-tree.ts"; import type { ValueRef } from "./compact-values.ts"; export interface PagedBatchTree<T> { read(root: PagedRoot): Promise<{ readonly node: PagedNode<T>; readonly name: string; }>; make(node: PagedNode<T>): Promise<PagedRoot>; own(name: string): ValueRef; adjust(root: PagedRoot | undefined, live: number): void; release(key: ValueRef): void; } /** * One compaction round's sorted changes (undefined deletes) merged into the AVL in one descent, with * join-based rebalancing (senpi#4272, RULING-47). Changed nodes stay drafts until the final tree is * made bottom-up, so each node of the result is built, owned and registered for commit exactly once; * a node replaced inside the round is never built at all. */ export declare class CompactPagedBatch<T> { private readonly tree; private changes; constructor(tree: PagedBatchTree<T>); /** Returns an owned root; the caller keeps `root` live until this settles. */ apply(root: PagedRoot | undefined, changes: ReadonlyMap<string, T | undefined>): Promise<PagedRoot | undefined>; private merge; /** A perfectly balanced subtree of the inserts in an empty position; deletes of absent keys are no-ops. */ private fresh; /** AVL join: descends the taller side's spine to a height match, rebalancing once per level. */ private join; private concat; private takeMin; /** One single or double rotation restores a node whose children differ in height by two. */ private balance; private fix; private open; /** Makes each draft once, children first; every result and intermediate is owned exactly once. */ private build; } //# sourceMappingURL=compact-paged-batch.d.ts.map