(error: unknown)
| 89 | } |
| 90 | |
| 91 | export function isRetryableGenerateError(error: unknown): boolean { |
| 92 | if (error instanceof APIConnectionError || error instanceof APITimeoutError) { |
| 93 | return true; |
| 94 | } |
| 95 | if (error instanceof APIEmptyResponseError) { |
| 96 | return true; |
| 97 | } |
| 98 | return error instanceof APIStatusError && [429, 500, 502, 503, 504].includes(error.statusCode); |
| 99 | } |
| 100 | |
| 101 | // `terminated` is the undici signature for an SSE/HTTP body stream that is |
| 102 | // dropped mid-flight (common with Node's native fetch on long reasoning |
no outgoing calls
no test coverage detected