import type { ModelMessage } from "ai"; import type { CompactionConfig } from "#harness/types.js"; /** * Best available input-token count: the model-reported count from the last * step, plus a rough character-based estimate of whatever messages have been * appended since. */ export declare function getInputTokenCount(messages: readonly ModelMessage[], config: CompactionConfig, requestEnvelopeTokens?: number, previousEnvelopeTokens?: number): number; /** * Returns true when the message history and fixed compaction-prompt envelope * exceed the compaction threshold. */ export declare function shouldCompact(messages: readonly ModelMessage[], config: CompactionConfig, requestEnvelopeTokens?: number, previousEnvelopeTokens?: number): boolean; /** Summarizes one compaction prompt with the compaction model, returning the summary text. */ export type CompactionSummarizer = (prompt: { readonly messages: ModelMessage[]; readonly system: string; }) => Promise; /** * Compacts messages by escalation: try each {@link CompactionHeuristic} in * order, then fall back to summarizing the older region with the compaction * model — keeping the recent tail verbatim when it fits, degrading it to * text-only, then shrinking the window. */ export declare function compactMessages(messages: ModelMessage[], config: CompactionConfig, summarize: CompactionSummarizer, forceSummary?: boolean, historyInputTokenCount?: number): Promise;