@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.72 kB
TypeScript
import type { FileEntry } from "./session-manager.ts";
/**
* The part of a loaded session file the resident mirror keeps (senpi#3519).
*
* A reopened session needs only what its context is built from: the latest compaction on the
* leaf's branch and everything from that compaction's first kept entry on. The entries before it
* stay in the session file, where full-history readers (`getEntries`, `getTree`, `getEntry`,
* branching to an old entry) already reload them, exactly as they do after a live compaction.
*/
export interface LoadedTail {
/** The header, the non-message entries of the leaf's path before the kept window, and the window itself. */
readonly retained: FileEntry[];
/** Ids of the entries the mirror leaves out; a new entry must never reuse one. */
readonly trimmedIds: readonly string[];
/** How many entries at the end of `retained` are the file's own tail, in order (senpi#2537). */
readonly windowLength: number;
}
/**
* Returns the retained tail of `entries` as loaded from a session file, or undefined when the whole
* file has to stay resident: no compaction on the leaf's branch, duplicated ids, a first kept entry
* that is not on the leaf's branch, or an entry from the kept window on that branch whose parent is
* outside it (a branch forked from before the window), which a trimmed mirror could not link.
*
* Retained entries are shallow copies: the prefix is relinked into one chain and the window's root
* entries hang off its end, as `_trimMirrorAfterCompaction` links them after a live compaction.
*/
export declare function planLoadedTail(entries: readonly FileEntry[]): LoadedTail | undefined;
//# sourceMappingURL=session-loaded-tail.d.ts.map