pub fn sanitize_tool_replacement(replacement: &str) -> StringExpand description
Sanitize an operator-supplied tool-result replacement before it is fed back
to the model: drop control characters (except \n, \r, \t) that could
corrupt rendering or smuggle terminal escapes, and truncate to
MAX_REPLACEMENT_LEN on a char boundary.