mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
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:
10
src/query.ts
10
src/query.ts
@@ -529,6 +529,16 @@ async function* queryLoop(
|
||||
querySource,
|
||||
)
|
||||
messagesForQuery = microcompactResult.messages
|
||||
// Release original strings from contentReplacementState.replacements for
|
||||
// tool results whose content was replaced with the cleared message.
|
||||
if (microcompactResult.clearedToolUseIds?.length) {
|
||||
const replacements = toolUseContext?.contentReplacementState?.replacements
|
||||
if (replacements) {
|
||||
for (const id of microcompactResult.clearedToolUseIds) {
|
||||
replacements.delete(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// For cached microcompact (cache editing), defer boundary message until after
|
||||
// the API response so we can use actual cache_deleted_input_tokens.
|
||||
// Gated behind feature() so the string is eliminated from external builds.
|
||||
|
||||
Reference in New Issue
Block a user