fix: 内存优化 — FileReadTool 100KB 上限、lookups 缓存、microcompact 替换清理

- FileReadTool maxResultSizeChars 从 Infinity 改为 100KB,大文件持久化到磁盘
- Messages.tsx 新增 computeMessageStructureKey 缓存,流式 delta 时跳过 8 个 Map/Set 重建
- microcompact 返回 clearedToolUseIds,query.ts 消费后清理 replacements Map 释放原始字符串
- 更新内存分析报告 Round 5 和 file-operations 文档

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-02 11:21:22 +08:00
parent 3eba5ade1a
commit f724300079
8 changed files with 205 additions and 32 deletions

View File

@@ -217,6 +217,10 @@ export type MicrocompactResult = {
compactionInfo?: {
pendingCacheEdits?: PendingCacheEdits
}
// Tool use IDs whose content was replaced with the cleared message.
// Callers should remove these from contentReplacementState.replacements
// to release the original strings from memory.
clearedToolUseIds?: string[]
}
/**
@@ -528,5 +532,5 @@ function maybeTimeBasedMicrocompact(
notifyCacheDeletion(querySource)
}
return { messages: result }
return { messages: result, clearedToolUseIds: [...clearSet] }
}