From 118547be8f682176913d1d491d1b69cddd4920bd Mon Sep 17 00:00:00 2001 From: QQ Date: Wed, 18 Nov 2026 08:19:25 +0800 Subject: [PATCH] Import packages/plugin/src/compact-history.ts --- packages/plugin/src/compact-history.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/plugin/src/compact-history.ts b/packages/plugin/src/compact-history.ts index 56592cf..017091c 100644 --- a/packages/plugin/src/compact-history.ts +++ b/packages/plugin/src/compact-history.ts @@ -53,6 +53,10 @@ function toolValue(value: unknown, budget: Budget, keepUiPayload = false): unkno const blocks = child.flatMap(block => { // Keep every tool correlation block, even when several share a message. if (object(block) && (block.type === 'tool-call' || block.type === 'tool-result')) return [toolValue(block, budget)] + // An image/file block carries only an attachment reference: flattening it + // to `{ summary }` text both loses the image and leaks a truncated JSON + // blob into the transcript, so keep the block intact. + if (object(block) && ['image', 'file', 'audio', 'video'].includes(String(block.type))) return [block] const preview = object(block) ? block.text ?? block : block // A recognised group round is conversation content: keep it even when it // would fall outside the two-preview budget. Earlier previews already go