pub fn compact_text( text: &str, limit: usize, cache_json: Option<&str>, ) -> (String, bool, Option<String>)
Collapse code blocks then truncate if over limit. Returns (text, was_truncated, cache_json).