(chunk, controller)
| 286 | const stream = result.stream.pipeThrough( |
| 287 | new TransformStream({ |
| 288 | transform(chunk, controller) { |
| 289 | if (chunk.type === 'tool-call') { |
| 290 | pendingToolCalls.push(chunk); |
| 291 | return; |
| 292 | } |
| 293 | if (chunk.type === 'finish') { |
| 294 | const details = reasoningDetailsFromMetadata(chunk.providerMetadata); |
| 295 | for (const toolCall of pendingToolCalls) { |
| 296 | controller.enqueue( |
| 297 | details ? withReasoningDetails([toolCall], details)[0] : toolCall, |
| 298 | ); |
| 299 | } |
| 300 | pendingToolCalls = []; |
| 301 | } |
| 302 | controller.enqueue(chunk); |
| 303 | }, |
| 304 | flush(controller) { |
| 305 | for (const toolCall of pendingToolCalls) controller.enqueue(toolCall); |
| 306 | }, |
nothing calls this directly
no test coverage detected