pub fn truncate_output(output: String, max_bytes: usize) -> (String, bool)
Truncate output to the given byte limit. Returns the (possibly truncated) string and whether truncation occurred.