import type { Message } from "@kenkaiiii/gg-ai";
/**
 * Cheap context pruning for stale tool outputs (opencode-style, no LLM call).
 *
 * Two signals, one pass:
 * 1. Superseded reads — an old `read` of a file that was re-read later carries
 *    zero information; the newest read wins.
 * 2. Old tool-output overflow — walking backwards, the most recent
 *    `protectTokens` worth of tool output (plus everything in the last
 *    `protectTurns` user turns) is kept verbatim; anything older is stubbed.
 *
 * Cache stability: pruning mutates history, which invalidates the provider's
 * prompt-cache prefix once. To avoid churning the cache every turn, nothing is
 * pruned unless at least `minimumTokens` would be freed in one batch — so
 * prunes are rare, large, and the stubbed prefix is stable afterwards.
 * Stubs are idempotent (marked with a prefix) and never re-pruned.
 */
export declare const PRUNE_PROTECT_TOKENS = 40000;
export declare const PRUNE_MINIMUM_TOKENS = 20000;
export declare const PRUNE_PROTECT_TURNS = 2;
export interface PruneOptions {
    /** Recent tool-output token budget kept verbatim. Default 40k. */
    protectTokens?: number;
    /** Minimum freed tokens required to apply a prune batch. Default 20k. */
    minimumTokens?: number;
    /** Number of most-recent user turns whose tool outputs are never pruned. Default 2. */
    protectTurns?: number;
}
export interface PruneResult {
    pruned: boolean;
    prunedResults: number;
    freedTokens: number;
}
/** Mutates `messages` in place; message/array identity is preserved so usage
 *  anchors and React refs stay valid. Returns what was freed. */
export declare function pruneStaleToolResults(messages: Message[], opts?: PruneOptions): PruneResult;
//# sourceMappingURL=tool-result-pruner.d.ts.map