/** Minimal structural view of a pi AgentMessage we need for pruning. */ export interface PrunableMessage { role?: string; toolName?: string; toolCallId?: string; isError?: boolean; content?: unknown; } export interface PruneOptions { /** Tool results older than this many assistant turns are age-digested. */ ageDigestTurns: number; /** Tool names eligible for pruning (large/replayable outputs). */ prunableTools: Set; /** Skip results whose text is smaller than this — pointer overhead isn't worth it. */ minPruneChars: number; } export interface PruneResult { messages: PrunableMessage[]; prunedCount: number; savedChars: number; } export declare const DEFAULT_PRUNE_OPTIONS: PruneOptions; /** * Prune stale tool-result history. Pure: returns a new array (pruned messages * shallow-cloned), the count pruned, and chars removed from the request. * * Two rules, both conservative: * 1. Supersession — a tool result is collapsed when a LATER result shares its * `toolName:target` identity (the agent holds the fresher copy). * 2. Age digest — a tool result older than `ageDigestTurns` assistant turns * from the end is collapsed (already consumed by the model in prior turns). * The most-recent result per identity and everything inside the freshness * window are always retained. */ export declare function pruneHistory(messages: PrunableMessage[], opts: PruneOptions): PruneResult;