diff --git a/lib/messages/prune.ts b/lib/messages/prune.ts index cb0ba18..fc97aee 100644 --- a/lib/messages/prune.ts +++ b/lib/messages/prune.ts @@ -24,6 +24,9 @@ const buildPrunableToolsList = ( if (config.strategies.pruneTool.protectedTools.includes(toolParameterEntry.tool)) { return } + if (toolParameterEntry.compacted) { + return + } const numericId = toolIdList.indexOf(toolCallId) const paramKey = extractParameterKey(toolParameterEntry.tool, toolParameterEntry.parameters) const description = paramKey ? `${toolParameterEntry.tool}, ${paramKey}` : toolParameterEntry.tool diff --git a/lib/state/tool-cache.ts b/lib/state/tool-cache.ts index 854aaaa..3325367 100644 --- a/lib/state/tool-cache.ts +++ b/lib/state/tool-cache.ts @@ -31,6 +31,7 @@ export async function syncToolCache( parameters: part.state?.input ?? {}, status: part.state.status as ToolStatus | undefined, error: part.state.status === "error" ? part.state.error : undefined, + compacted: part.state.status === "completed" && !!part.state.time.compacted, } ) diff --git a/lib/state/types.ts b/lib/state/types.ts index 89fc8e7..e1b92a7 100644 --- a/lib/state/types.ts +++ b/lib/state/types.ts @@ -12,6 +12,7 @@ export interface ToolParameterEntry { parameters: any status?: ToolStatus error?: string + compacted?: boolean } export interface SessionStats {