(page: Page)
| 227 | * Check if the last message has tool calls |
| 228 | */ |
| 229 | export async function hasToolCalls(page: Page): Promise<boolean> { |
| 230 | const messages = await getMessages(page) |
| 231 | for (let i = messages.length - 1; i >= 0; i--) { |
| 232 | if (messages[i].role === 'assistant') { |
| 233 | const toolCalls = messages[i].parts?.filter( |
| 234 | (p: any) => p.type === 'tool-call', |
| 235 | ) |
| 236 | return toolCalls?.length > 0 |
| 237 | } |
| 238 | } |
| 239 | return false |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Get tool call names from the last assistant message |
no test coverage detected