Build the chunk sequence the mock structured-output stream emits. * Uses typed `ev.*` factories (RunStartedEvent, TextMessage*Event, * RunFinishedEvent) and the typed `structured*Event` helpers above. * No `as X` casts.
( value: Person, usage?: RunFinishedEvent['usage'], )
| 122 | * RunFinishedEvent) and the typed `structured*Event` helpers above. |
| 123 | * No `as X` casts. */ |
| 124 | function buildStructuredStream( |
| 125 | value: Person, |
| 126 | usage?: RunFinishedEvent['usage'], |
| 127 | ): Array<StreamChunk> { |
| 128 | return [ |
| 129 | ev.runStarted('mock-run', 'mock-thread'), |
| 130 | structuredStartEvent('mock-msg'), |
| 131 | ev.textStart('mock-msg'), |
| 132 | ev.textContent(JSON.stringify(value), 'mock-msg'), |
| 133 | ev.textEnd('mock-msg'), |
| 134 | structuredCompleteEvent(value), |
| 135 | ev.runFinished('stop', 'mock-run', usage, 'mock-thread'), |
| 136 | ] |
| 137 | } |
| 138 | |
| 139 | function makeAdapter(opts: { |
| 140 | agentIterations?: Array<Array<StreamChunk>> |
no test coverage detected