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