* Walk messages and collect tool_use IDs whose tool name is in * COMPACTABLE_TOOLS, in encounter order. Shared by both microcompact paths.
(messages: Message[])
| 224 | * COMPACTABLE_TOOLS, in encounter order. Shared by both microcompact paths. |
| 225 | */ |
| 226 | function collectCompactableToolIds(messages: Message[]): string[] { |
| 227 | const ids: string[] = [] |
| 228 | for (const message of messages) { |
| 229 | if ( |
| 230 | message.type === 'assistant' && |
| 231 | Array.isArray(message.message.content) |
| 232 | ) { |
| 233 | for (const block of message.message.content) { |
| 234 | if (block.type === 'tool_use' && COMPACTABLE_TOOLS.has(block.name)) { |
| 235 | ids.push(block.id) |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | return ids |
| 241 | } |
| 242 | |
| 243 | // Prefix-match because promptCategory.ts sets the querySource to |
| 244 | // 'repl_main_thread:outputStyle:<style>' when a non-default output style |
no test coverage detected