( event: StreamChunkEvent, )
| 17 | } |
| 18 | |
| 19 | export const destinationFromChunkEvent = ( |
| 20 | event: StreamChunkEvent, |
| 21 | ): ChunkDestination | null => { |
| 22 | if (typeof event === 'string') { |
| 23 | return { type: 'root', textType: 'text' } |
| 24 | } |
| 25 | |
| 26 | if (event.type === 'subagent_chunk') { |
| 27 | return { type: 'agent', agentId: event.agentId, textType: 'text' } |
| 28 | } |
| 29 | |
| 30 | if (event.type === 'reasoning_chunk') { |
| 31 | if (event.ancestorRunIds.length === 0) { |
| 32 | return { type: 'root', textType: 'reasoning' } |
| 33 | } |
| 34 | return { type: 'agent', agentId: event.agentId, textType: 'reasoning' } |
| 35 | } |
| 36 | |
| 37 | return null |
| 38 | } |
| 39 | |
| 40 | export const processTextChunk = ( |
| 41 | blocks: ContentBlock[], |
no outgoing calls
no test coverage detected