import type { AiMessage, EffectiveConfig, JsonValue, LlmClient, RunLimits, Tokenizer } from '../core/types'; /** AICC alias of the summary model. */ export declare const SUMMARIZE_MODEL_ALIAS = "llm.summarize"; /** Model-written fields (assistant text, tool call arguments) reach the summarizer up to this many chars each. */ export declare const REPORT_CHARS = 4096; /** Rendered history one summary call takes at most; a larger range is folded chunk by chunk. */ export declare const DEFAULT_SUMMARY_CHUNK_TOKENS = 100000; /** `max_completion_tokens` of one summary call; also what a rewrite reserves for the summary block. */ export declare const SUMMARY_MAX_TOKENS = 6144; /** Upper bound of the rendered keep_exact block. */ export declare const KEEP_EXACT_MAX_TOKENS = 2048; export declare const MAX_FOLD_PASSES = 4; /** A behavior step's results message (user role) belongs to the step's round. */ export declare const STEP_RESULTS_PREFIX = "<; /** * Compress `history` into `system + head + [summary] + keep_exact + note + * raw tail` within `opts.target_token_budget` (`compress_history`). * * Returned as is: an empty history, one within the target, or one with * nothing between head and tail to summarize (`no_range`). A summarizer * failure (provider error, empty summary) rejects with its `LLMComputeException`. */ export declare function compressHistory(history: AiMessage[], deps: CompressDeps, opts: CompressOptions): Promise; /** The summary block as one user message (`summary_message`). */ export declare function summaryMessage(summary: CompressedSummary, note?: string): AiMessage; /** The summary block of a message rendered by `summaryMessage` (`parse_summary_message`). */ export declare function parseSummaryMessage(message: AiMessage): CompressedSummary | undefined; /** A user message whose first text block opens a summary block (`is_summary_message`). */ export declare function isSummaryMessage(message: AiMessage): boolean; /** `render_keep_exact`. */ export declare function renderKeepExact(entries: string[]): string; /** * Rounds and summary messages of `history` from `start` (after the system * prefix). A round is an assistant message with its tool results (or a * behavior step with its results message) and the user input right after * them; leading user messages (the opening input) join the first round, and * a user message after an assistant's final reply opens a new round. */ export declare function segment(history: AiMessage[], start: number): Unit[]; /** * Append new verbatim entries to `keep` (whitespace normalized, exact * duplicates skipped); the oldest entries beyond the cap become memory * candidates (`merge_keep_exact`). */ export declare function mergeKeepExact(keep: string[], entries: Iterable, tokenizer: Tokenizer, candidates: JsonValue[]): void; /** * The run's compactor (`LlmSummarizeCompressor`): summarizes with the run's * client and appends the note that the run's files are intact. A failure * rejects with an `XllmError` of kind `compressor`. */ export declare class LlmSummarizeCompressor { readonly llm: LlmClient; readonly modelAlias: string; readonly targetTokenBudget: number; readonly tokenizer: Tokenizer; /** The run's workdir, named in the note (Rust: the `dir` of `Compressor::compress`). */ readonly workdir: string; readonly signal?: AbortSignal | undefined; constructor(llm: LlmClient, modelAlias: string, targetTokenBudget: number, tokenizer: Tokenizer, /** The run's workdir, named in the note (Rust: the `dir` of `Compressor::compress`). */ workdir: string, signal?: AbortSignal | undefined); compress(history: AiMessage[]): Promise; } /** * Compaction target of a run (`compaction_target_tokens`): 30% of the * window, at most `DEFAULT_AUTO_COMPRESS_TARGET_TOKENS` and at most half the * yield threshold, so a compaction lands well below the line that triggered * it. The ratios are f32 in Rust; `Math.fround` reproduces the rounding. */ export declare function compactionTargetTokens(limits: Pick): number; /** The summary model of a run (`EffectiveConfig::summary_model`): `llm.summarize` via AICC, the run's model for OpenAI. */ export declare function summaryModel(config: Pick): string; //# sourceMappingURL=compress.d.ts.map