Skip to content

Commit 8a95101

Browse files
Prevents compacted tools from appearing in the prunable tools list
1 parent 32bde8d commit 8a95101

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

lib/messages/prune.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const buildPrunableToolsList = (
2424
if (config.strategies.pruneTool.protectedTools.includes(toolParameterEntry.tool)) {
2525
return
2626
}
27+
if (toolParameterEntry.compacted) {
28+
return
29+
}
2730
const numericId = toolIdList.indexOf(toolCallId)
2831
const paramKey = extractParameterKey(toolParameterEntry.tool, toolParameterEntry.parameters)
2932
const description = paramKey ? `${toolParameterEntry.tool}, ${paramKey}` : toolParameterEntry.tool

lib/state/tool-cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function syncToolCache(
3131
parameters: part.state?.input ?? {},
3232
status: part.state.status as ToolStatus | undefined,
3333
error: part.state.status === "error" ? part.state.error : undefined,
34+
compacted: part.state.status === "completed" && !!part.state.time.compacted,
3435
}
3536
)
3637

lib/state/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface ToolParameterEntry {
1212
parameters: any
1313
status?: ToolStatus
1414
error?: string
15+
compacted?: boolean
1516
}
1617

1718
export interface SessionStats {

0 commit comments

Comments
 (0)