(messages: T[])
| 100 | * @returns The transformed messages with tool blocks converted to text |
| 101 | */ |
| 102 | export function transformMessagesForCondensing< |
| 103 | T extends { role: string; content: string | Anthropic.Messages.ContentBlockParam[] }, |
| 104 | >(messages: T[]): T[] { |
| 105 | return messages.map((msg) => ({ |
| 106 | ...msg, |
| 107 | content: convertToolBlocksToText(msg.content), |
| 108 | })) |
| 109 | } |
| 110 | |
| 111 | export const MIN_CONDENSE_THRESHOLD = 5 // Minimum percentage of context window to trigger condensing |
| 112 | export const MAX_CONDENSE_THRESHOLD = 100 // Maximum percentage of context window to trigger condensing |
no test coverage detected