* Check if all tool calls are complete and we should auto-send. * Requires that there is at least one tool call in the last assistant message; * a text-only response has nothing to auto-send.
()
| 1357 | * a text-only response has nothing to auto-send. |
| 1358 | */ |
| 1359 | private shouldAutoSend(): boolean { |
| 1360 | const messages = this.processor.getMessages() |
| 1361 | const lastAssistant = messages.findLast( |
| 1362 | (m: UIMessage) => m.role === 'assistant', |
| 1363 | ) |
| 1364 | if (!lastAssistant) return false |
| 1365 | const hasToolCalls = lastAssistant.parts.some( |
| 1366 | (p: MessagePart) => p.type === 'tool-call', |
| 1367 | ) |
| 1368 | if (!hasToolCalls) return false |
| 1369 | return this.processor.areAllToolsComplete() |
| 1370 | } |
| 1371 | |
| 1372 | /** |
| 1373 | * Get current messages |
no test coverage detected