()
| 483 | let streamError: string | null = null; |
| 484 | |
| 485 | const buildOutput = (): DevToolsStepOutput => { |
| 486 | // Streams can end abruptly (abort/cancel/error) before receiving `*-end` |
| 487 | // chunks, so flush in-progress deltas to preserve partial debug output. |
| 488 | for (const [id, text] of currentText) { |
| 489 | textParts.push({ id, text }); |
| 490 | } |
| 491 | currentText.clear(); |
| 492 | |
| 493 | for (const [id, text] of currentReasoning) { |
| 494 | reasoningParts.push({ id, text }); |
| 495 | } |
| 496 | currentReasoning.clear(); |
| 497 | |
| 498 | return { |
| 499 | textParts, |
| 500 | reasoningParts, |
| 501 | toolCalls, |
| 502 | finishReason, |
| 503 | }; |
| 504 | }; |
| 505 | |
| 506 | const finalizeStep = async ( |
| 507 | update: Pick< |
no test coverage detected