(error: unknown)
| 216 | ] as const; |
| 217 | |
| 218 | export function isToolExchangeAdjacencyError(error: unknown): boolean { |
| 219 | if (!(error instanceof APIStatusError)) return false; |
| 220 | if (error instanceof APIContextOverflowError) return false; |
| 221 | if (error.statusCode !== 400 && error.statusCode !== 422) return false; |
| 222 | const lowerMessage = error.message.toLowerCase(); |
| 223 | return TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS.some((pattern) => pattern.test(lowerMessage)); |
| 224 | } |
| 225 | |
| 226 | // The broader family of structural request rejections a strict provider returns |
| 227 | // when the message array itself is malformed — tool_use/tool_result pairing, |
no outgoing calls
no test coverage detected