Whether a chunk is the terminal error event the chat engine emits.
( chunk: StreamChunk, )
| 16 | |
| 17 | /** Whether a chunk is the terminal error event the chat engine emits. */ |
| 18 | function isRunErrorChunk( |
| 19 | chunk: StreamChunk, |
| 20 | ): chunk is StreamChunk & { message: string; code?: string } { |
| 21 | return chunk.type === EventType.RUN_ERROR |
| 22 | } |
| 23 | |
| 24 | /** Pull `{ message, code }` off a RUN_ERROR chunk for the run record. */ |
| 25 | function runErrorFromChunk( |