| 9 | import type { Tools } from './Tool.js' |
| 10 | |
| 11 | async function collectTurnEvents<TTerminal>( |
| 12 | stream: AsyncGenerator<QueryEngineReplEvent, TTerminal>, |
| 13 | ): Promise<{ |
| 14 | events: QueryEngineReplEvent[] |
| 15 | terminal: TTerminal |
| 16 | }> { |
| 17 | const events: QueryEngineReplEvent[] = [] |
| 18 | |
| 19 | while (true) { |
| 20 | const next = await stream.next() |
| 21 | if (next.done) { |
| 22 | return { |
| 23 | events, |
| 24 | terminal: next.value, |
| 25 | } |
| 26 | } |
| 27 | events.push(next.value) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | describe('QueryEngine prepared turn seams', () => { |
| 32 | it('runPreparedTurn forwards the prepared params, events, and terminal value', async () => { |