import type { SessionEntry } from "../session-manager-types.ts"; import { type CompactionSettings } from "./compaction.ts"; import { type VerbatimCompactionParameters, type VerbatimCompactionPreparation } from "./compaction-types.js"; /** * Return the independently estimated cost of the protected tail. * * Only the explicit estimate recorded by `prepareCompactionBoundary` (or a test) * is returned. The old fallback of `tokensBefore - region.tokenEstimate` was * removed because it mixed the authoritative whole-context count with the * heuristic region estimate; when no explicit estimate exists the tail simply * contributes nothing rather than a wrong-numbered value. Whether an estimate is * registered at all is visible through `hasKeptTailTokenEstimate`, which the * fresh rung uses to decide a tail whose size is unknown (P1 #3010). */ export declare function getKeptTailTokenEstimate(preparation: VerbatimCompactionPreparation): number; /** * Whether an independent tail estimate is registered for this preparation. * * A preparation built by `prepareCompactionBoundary` always has one. A directly * constructed preparation may not; the fresh rung treats a kept tail whose size * is unregistered as unknown and drops it conservatively rather than assuming it * fits (P1 #3010). */ export declare function hasKeptTailTokenEstimate(preparation: VerbatimCompactionPreparation): boolean; /** * Record the independent tail estimate for a preparation. * * `prepareCompactionBoundary` does this itself from the kept-tail messages; * this setter is for test preparations built directly and for any other code * that constructs a `VerbatimCompactionPreparation` without the boundary * preparer. The estimate lives in a module-private map and is never persisted. */ export declare function setKeptTailTokenEstimate(preparation: VerbatimCompactionPreparation, estimate: number): void; export declare function autoDetectCompactionQuery(entries: readonly SessionEntry[]): string; /** * Planner eligibility, kept separate from boundary preparation. * * `MIN_COMPACTABLE_REGION_LINES` exists to stop repeated pointless *planned* * compaction. A load-bearing caller has a different problem: one oversized tool * result can blow the context window while producing fewer than 20 compactable * lines, and refusing to prepare a boundary there makes the "always completes" * guarantee hollow — the fresh rung and its tail-drop rule become unreachable. */ export interface CompactionBoundaryControl { /** * Prepare a boundary even when the region is below the planner minimum. * Only `load_bearing` callers set this; the runner routes such a region * straight to the fresh rung without invoking a planner. */ allowSmallRegion?: boolean; } /** Prepare the complete compactable transcript and its exact context-visible message tail. */ export declare function prepareCompactionBoundary(pathEntries: SessionEntry[], settings: CompactionSettings, options?: Partial, control?: CompactionBoundaryControl): VerbatimCompactionPreparation | undefined; //# sourceMappingURL=compaction-boundary.d.ts.map