* Wraps a chat stream so every chunk that leaves `chat()` (post-middleware) * is recorded into the per-testId phase capture as a yielded chunk. Used by * `phase-recorder` mode to let the spec assert what the consumer actually * sees — distinct from what `onChunk` observes inside the middleware ch
( source: AsyncIterable<StreamChunk>, captureId: string, )
| 156 | * sees — distinct from what `onChunk` observes inside the middleware chain. |
| 157 | */ |
| 158 | async function* teeForPhaseCapture( |
| 159 | source: AsyncIterable<StreamChunk>, |
| 160 | captureId: string, |
| 161 | ): AsyncIterable<StreamChunk> { |
| 162 | for await (const chunk of source) { |
| 163 | recordYieldedChunk(captureId, { type: chunk.type }) |
| 164 | yield chunk |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | // Minimal in-memory tracer/meter. Captures into a per-testId bucket so that |
| 169 | // the Playwright spec can fetch the recorded state via GET after the stream |
no test coverage detected