import type { Observation } from "../types.js"; import type { TurnSummary } from "./types.js"; /** * ObservationSummarizer records events during an agent "turn" and produces * structured TurnSummary objects for LLM context management. * * Lifecycle: * 1. startTurn() — begins recording * 2. recordToolStart / recordToolEnd / recordFile* / recordObservation — accumulate data * 3. endTurn(turnId) — finalizes and returns the TurnSummary * * After multiple turns, use getHistory() or compactHistory() for context retrieval. */ export declare class ObservationSummarizer { private history; private activeTurn; private turnCounter; /** Maximum number of turns retained in history before eviction. */ private static readonly MAX_HISTORY_SIZE; /** Maximum length for result previews in tool call summaries. */ private static readonly MAX_PREVIEW_LENGTH; /** Approximate characters per token for estimation. */ private static readonly CHARS_PER_TOKEN; /** Start recording a new turn. Returns the turnId. */ startTurn(): string; /** Record that a tool call started. */ recordToolStart(callId: string, name: string, args: Record): void; /** Record that a tool call completed. */ recordToolEnd(callId: string, result: unknown, exitCode: number): void; /** Record a file read event. */ recordFileRead(path: string): void; /** Record a file modification event. */ recordFileModified(path: string): void; /** Record an observation (from the Observation type). */ recordObservation(obs: Observation): void; /** End the current turn and produce a summary. */ endTurn(turnId: string): TurnSummary; /** Get the last N turn summaries. Returns a copy. */ getHistory(count?: number): TurnSummary[]; /** Compact old summaries into a single digest string for context retention. */ compactHistory(maxTokens: number): string; /** Build a human-readable digest from turn activity. */ private buildDigest; }