//! Utility modules for AI API handling
//!
//! These utilities provide robust handling for common AI API edge cases:
//! - Unicode sanitization for safe JSON serialization
//! - JSON parsing with repair for malformed streaming responses
//! - Context overflow detection across providers
//! - Tool call ID normalization for cross-provider compatibility
/// Normalize a tool call ID for cross-provider compatibility.
///
/// OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.
/// Anthropic APIs require IDs matching `^[a-zA-Z0-9_-]+$` (max 64 chars).
///
/// This replaces non-alphanumeric (except `_` and `-`) chars with `_` and
/// truncates to 64 characters.