(
action: ServerAction<'response-chunk'>,
)
| 335 | } |
| 336 | |
| 337 | const onResponseChunk = async ( |
| 338 | action: ServerAction<'response-chunk'>, |
| 339 | ): Promise<void> => { |
| 340 | if (signal?.aborted) { |
| 341 | return |
| 342 | } |
| 343 | const { chunk } = action |
| 344 | |
| 345 | if (typeof chunk !== 'string') { |
| 346 | if (chunk.type === 'reasoning_delta') { |
| 347 | handleStreamChunk?.({ |
| 348 | type: 'reasoning_chunk', |
| 349 | chunk: chunk.text, |
| 350 | agentId: chunk.runId, |
| 351 | ancestorRunIds: chunk.ancestorRunIds, |
| 352 | }) |
| 353 | } else { |
| 354 | await handleEvent?.(chunk) |
| 355 | } |
| 356 | return |
| 357 | } |
| 358 | |
| 359 | if (handleStreamChunk) { |
| 360 | await handleStreamChunk(chunk) |
| 361 | } |
| 362 | } |
| 363 | const onSubagentResponseChunk = async ( |
| 364 | action: ServerAction<'subagent-response-chunk'>, |
| 365 | ) => { |
no test coverage detected