/** * Oldest-first planner-input trimming for context overflow. * * Port of codex's `history.remove_first_item()` retry on * `ContextWindowExceeded` (`compact.rs:309-343`). Codex can discard trimmed * history because it writes a summary; Atomic promises validated deletion * boundaries over the original numbered lines, so trimming here is a *view* * over the same region: * * - the planner is shown only lines `offset+1..N`, renumbered `1..N-offset`; * - protected spans and prior filtered markers are rebased into that view; * - the returned ranges are rebased back onto the original numbering; * - the withheld head becomes a deterministic deletion range, because the * planner cannot rank what it was not shown and the oldest lines carry the * lowest continuation value. Protected lines inside the head still survive: * `validateDeletedRanges` splits every range around protected lines. */ import type { LineRange, NumberedRegion, RawLineRange } from "./compaction-types.js"; /** * Return the region as seen after withholding its oldest `offset` lines, or * `undefined` when that offset leaves nothing rankable. */ export declare function trimRegionHead(region: NumberedRegion, offset: number): NumberedRegion | undefined; /** * Next withheld-head size after an overflow, halving what remains each time, or * `undefined` when no further trimming is possible. */ export declare function nextTrimOffset(region: NumberedRegion, currentOffset: number): number | undefined; /** * Map ranges validated against a trimmed view back onto the original region, * adding the withheld head as a deterministic deletion. */ export declare function rebaseTrimmedRanges(validated: readonly LineRange[], offset: number): RawLineRange[]; //# sourceMappingURL=region-trimming.d.ts.map