(messages: Message[])
| 154 | } |
| 155 | |
| 156 | function countToolsInMessages(messages: Message[]): number { |
| 157 | const blocks = messages |
| 158 | .filter(isUserMessageWithArrayContent) |
| 159 | .flatMap(m => m.message.content) |
| 160 | .filter( |
| 161 | (b): b is { type: string; is_error?: boolean } => |
| 162 | typeof b === 'object' && b !== null && 'type' in b, |
| 163 | ) |
| 164 | return count(blocks, b => b.type === 'tool_result' && !b.is_error) |
| 165 | } |
| 166 | |
| 167 | function getBoundaryTool( |
| 168 | boundary: CompletionBoundary | null, |
no test coverage detected