()
| 435 | |
| 436 | it('emits synthetic tool results then rethrows when the SDK stream throws mid-run', async () => { |
| 437 | async function* throwing(): AsyncIterable<AgentSdkMessage> { |
| 438 | yield init |
| 439 | yield { |
| 440 | type: 'assistant', |
| 441 | message: { |
| 442 | id: 'msg-1', |
| 443 | content: [ |
| 444 | { type: 'tool_use', id: 'toolu_5', name: 'Bash', input: {} }, |
| 445 | ], |
| 446 | }, |
| 447 | parent_tool_use_id: null, |
| 448 | } |
| 449 | throw new Error('aborted') |
| 450 | } |
| 451 | |
| 452 | const chunks: Array<StreamChunk> = [] |
| 453 | await expect(async () => { |