Function
collectQuery
(
stream: AsyncGenerator<unknown, unknown>,
)
Source from the content-addressed store, hash-verified
| 159 | } |
| 160 | |
| 161 | async function collectQuery( |
| 162 | stream: AsyncGenerator<unknown, unknown>, |
| 163 | ): Promise<{ |
| 164 | events: unknown[] |
| 165 | terminal: unknown |
| 166 | }> { |
| 167 | const events: unknown[] = [] |
| 168 | |
| 169 | while (true) { |
| 170 | const next = await stream.next() |
| 171 | if (next.done) { |
| 172 | return { |
| 173 | events, |
| 174 | terminal: next.value, |
| 175 | } |
| 176 | } |
| 177 | events.push(next.value) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | function expectMetaUserMessage(events: unknown[], content: string) { |
| 182 | const userMessage = (events as Array<Record<string, unknown>>).find( |
Tested by
no test coverage detected