/** * Tool call deduplication for compaction. * * Removes repeated tool calls from message arrays before summarization. */ import type { AgentMessage } from "../../../agent-core/index.js"; /** * Deduplicate repeated tool calls in a message array by keeping only the * most recent occurrence of each (tool, args) pair. * * Strategy: * - **Idempotent-read tools** (read, grep, glob): same (name, args) → keep last only. * These tools return the same content for the same arguments. * - **Output-dependent tools** (bash): same (name, args, output) → keep last only. * Two bash calls with same command but different output are NOT duplicates. * - **Mutating tools** (edit, write): never deduplicated. Chronological ordering * of mutations matters for correctness. * - **Unknown tools** (extensions, MCP, custom): never deduplicated. Conservative * by default — only tools in the known sets above participate. * * Deduplication removes both the ToolCall block from the assistant message * and the corresponding ToolResultMessage from the array. * * Recalculated each time compaction runs — prompt cache is only impacted * alongside compression, not on every turn. */ export declare function deduplicateToolCalls(messages: AgentMessage[]): AgentMessage[]; //# sourceMappingURL=dedupe.d.ts.map