(mut raw: Value)
| 654 | } |
| 655 | |
| 656 | fn normalize_tool_raw(mut raw: Value) -> Value { |
| 657 | let Some(response) = raw.get("tool_response").cloned() else { |
| 658 | return raw; |
| 659 | }; |
| 660 | |
| 661 | if let Some(output) = extract_tool_output(&response) { |
| 662 | insert_if_missing(&mut raw, "tool_output", Value::String(output)); |
| 663 | } |
| 664 | if let Some(status) = extract_tool_status(&response) { |
| 665 | insert_if_missing(&mut raw, "status", Value::String(status)); |
| 666 | } |
| 667 | if let Some(duration) = extract_duration_ms(&response) { |
| 668 | insert_if_missing(&mut raw, "duration", Value::Number(duration.into())); |
| 669 | } |
| 670 | if let Some(file_path) = extract_file_path(raw.get("tool_input"), &response) { |
| 671 | insert_if_missing(&mut raw, "file_path", Value::String(file_path)); |
| 672 | } |
| 673 | |
| 674 | raw |
| 675 | } |
| 676 | |
| 677 | fn extract_tool_output(response: &Value) -> Option<String> { |
| 678 | if let Some(text) = response.as_str() { |
no test coverage detected