ce038a0e05
Port from anomalyco/opencode#31877: JSON Schema type arrays like ["number","string"] (common in MCP tool schemas) were collapsed to the first non-null type, silently dropping every other branch. Several tool-call backends reject the array form outright — llama.cpp's grammar generator and Gemini via OpenAI-compatible transports (e.g. GitHub Copilot proxying to Gemini) 400 on it. _sanitize_node now mirrors @ai-sdk/google: a single non-null type stays type:X (+nullable if null was present), multiple non-null types become an anyOf of single-type schemas so no branch is lost, and an all-null array becomes type:null. Single-null collapse is unchanged. Verified nested (object props, array items) survive the full sanitize pipeline — combinator stripping is top-level-only and nullable-union collapse only fires on single-survivor unions, so multi-type anyOf is left intact.