Import packages/plugin/src/compact-history.ts
This commit is contained in:
parent
0068d821b6
commit
118547be8f
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue