/** * In-context auto-compaction (agent-loop-capability-port sprint 7). * * A pure, testable helper that summarizes the older ("head") messages of a * conversation into a single replacement message via ONE extra `client.chat` * call, so `runAgenticLoop` can keep long runs inside the context window * without the coarse sprint-boundary reset (`summarizeOlderSprints` / * `contextReset` — a different, unrelated layer; see `context-handoff.ts`). * * Fails open: any error from the summarization call is caught, logged, and * surfaced as `undefined` so the caller can skip compaction for that turn * and continue uncompacted (sc-7-4). Never throws. */ import type { LLMClient, Message } from "../providers/types.js"; export interface CompactionParams { /** Provider-agnostic LLM client — the SAME client the run is using. */ client: LLMClient; /** Model ID — the SAME model the run is using. */ model: string; /** The HEAD messages being summarized away (older, completed turns). */ head: Message[]; /** Optional caller steering appended to the base summarization prompt. */ instructions?: string; /** Bounded output cap for the summary call. Default 4096. */ maxTokens?: number; } export interface CompactionOutcome { /** The single replacement message: { role:"user", content:"[Conversation summary] ..." }. */ summaryMessage: Message; /** Token usage of the summarization call itself (to be charged by the caller). */ usage: { inputTokens: number; outputTokens: number; }; /** USD cost of the summarization call, when the provider reports one. */ costUsd?: number; } /** * Summarize `head` into a single replacement message via ONE `client.chat` * call. Passes NO `tools` and a bounded `maxTokens` — mirrors the existing * one-shot `coerceJsonOutput` precedent (`agentic-loop.ts`). * * @returns `undefined` on any failure (fail-open, sc-7-4) — the caller must * skip compaction for that turn and continue uncompacted, never throw. */ export declare function summarizeMessages(params: CompactionParams): Promise; //# sourceMappingURL=compaction.d.ts.map