feat: implement SDK/HTTP pruning for deduplication and tool-output truncation on SQLite

- executeDeduplication: now async, reads messages from SDK on SQLite via
  client.session.messages() instead of JSON file reads
- truncateToolOutputsByCallId: now async, uses truncateToolResultAsync()
  HTTP PATCH on SQLite instead of file-based truncateToolResult()
- deduplication-recovery: passes client through to both functions
- recovery-hook: passes ctx.client to attemptDeduplicationRecovery

Removes the last intentional feature gap on SQLite backend — dynamic
context pruning (dedup + tool-output truncation) now works on both
JSON and SQLite storage backends.
This commit is contained in:
YeonGyu-Kim
2026-02-15 19:06:57 +09:00
parent a25b35c380
commit 3bbe0cbb1d
4 changed files with 93 additions and 22 deletions
@@ -64,7 +64,7 @@ export function createAnthropicContextWindowLimitRecoveryHook(
autoCompactState.errorDataBySession.set(sessionID, parsed)
if (autoCompactState.compactionInProgress.has(sessionID)) {
await attemptDeduplicationRecovery(sessionID, parsed, experimental)
await attemptDeduplicationRecovery(sessionID, parsed, experimental, ctx.client)
return
}