diff --git a/lib/core/janitor.ts b/lib/core/janitor.ts index 55772ac..27bbd85 100644 --- a/lib/core/janitor.ts +++ b/lib/core/janitor.ts @@ -116,7 +116,9 @@ async function runWithStrategies( const { toolCallIds, toolOutputs, toolMetadata } = parseMessages(messages, state.toolParameters) const alreadyPrunedIds = state.prunedIds.get(sessionID) ?? [] - const unprunedToolCallIds = toolCallIds.filter(id => !alreadyPrunedIds.includes(id)) + // Normalized set for filtering to avoid re-processing already pruned tools with different casing + const alreadyPrunedLower = new Set(alreadyPrunedIds.map(id => id.toLowerCase())) + const unprunedToolCallIds = toolCallIds.filter(id => !alreadyPrunedLower.has(id)) const gcPending = state.gcPending.get(sessionID) ?? null @@ -145,7 +147,7 @@ async function runWithStrategies( ) } - const finalNewlyPrunedIds = llmPrunedIds.filter(id => !alreadyPrunedIds.includes(id)) + const finalNewlyPrunedIds = llmPrunedIds.filter(id => !alreadyPrunedLower.has(id.toLowerCase())) if (finalNewlyPrunedIds.length === 0 && !gcPending) { return null diff --git a/package-lock.json b/package-lock.json index cb2d1dc..a6c3dcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tarquinen/opencode-dcp", - "version": "0.4.16", + "version": "0.4.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tarquinen/opencode-dcp", - "version": "0.4.16", + "version": "0.4.17", "license": "MIT", "dependencies": { "@ai-sdk/openai-compatible": "^1.0.28", diff --git a/package.json b/package.json index 0606f04..ffb7bb1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@tarquinen/opencode-dcp", - "version": "0.4.16", + "version": "0.4.17", "type": "module", "description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context", "main": "./dist/index.js",