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