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:
@@ -56,9 +56,9 @@ export function getPersistenceThreshold(
|
||||
toolName: string,
|
||||
declaredMaxResultSizeChars: number,
|
||||
): number {
|
||||
// Infinity = hard opt-out. Read self-bounds via maxTokens; persisting its
|
||||
// output to a file the model reads back with Read is circular. Checked
|
||||
// before the GB override so tengu_satin_quoll can't force it back on.
|
||||
// Infinity = hard opt-out (reserved for tools that self-bound via other
|
||||
// mechanisms). Checked before the GB override so tengu_satin_quoll can't
|
||||
// force it back on.
|
||||
if (!Number.isFinite(declaredMaxResultSizeChars)) {
|
||||
return declaredMaxResultSizeChars
|
||||
}
|
||||
@@ -813,11 +813,12 @@ export async function enforceToolResultBudget(
|
||||
continue
|
||||
}
|
||||
|
||||
// Tools with maxResultSizeChars: Infinity (Read) — never persist.
|
||||
// Mark as seen (frozen) so the decision sticks across turns. They don't
|
||||
// count toward freshSize; if that lets the group slip under budget and
|
||||
// the wire message is still large, that's the contract — Read's own
|
||||
// maxTokens is the bound, not this wrapper.
|
||||
// Tools with maxResultSizeChars: Infinity — never persist (reserved for
|
||||
// tools that self-bound via other mechanisms). Mark as seen (frozen) so
|
||||
// the decision sticks across turns. They don't count toward freshSize; if
|
||||
// that lets the group slip under budget and the wire message is still
|
||||
// large, that's the contract — the tool's own maxTokens is the bound, not
|
||||
// this wrapper.
|
||||
const skipped = fresh.filter(c => shouldSkip(c.toolUseId))
|
||||
skipped.forEach(c => state.seenIds.add(c.toolUseId))
|
||||
const eligible = fresh.filter(c => !shouldSkip(c.toolUseId))
|
||||
|
||||
Reference in New Issue
Block a user