diff --git a/lib/strategies/deduplication.ts b/lib/strategies/deduplication.ts index f58a13a..50b30fa 100644 --- a/lib/strategies/deduplication.ts +++ b/lib/strategies/deduplication.ts @@ -1,7 +1,7 @@ import { PluginConfig } from "../config" import { Logger } from "../logger" import type { SessionState, WithParts } from "../state" -import { calculateTokensSaved } from "../utils" +import { buildToolIdList, calculateTokensSaved } from "../utils" /** * Deduplication strategy - prunes older tool calls that have identical @@ -75,20 +75,6 @@ export const deduplicate = ( } } -function buildToolIdList(messages: WithParts[]): string[] { - const toolIds: string[] = [] - for (const msg of messages) { - if (msg.parts) { - for (const part of msg.parts) { - if (part.type === 'tool' && part.callID && part.tool) { - toolIds.push(part.callID) - } - } - } - } - return toolIds -} - function createToolSignature(tool: string, parameters?: any): string { if (!parameters) { return tool