(mut raw: Value)
| 640 | } |
| 641 | |
| 642 | fn normalize_tool_raw(mut raw: Value) -> Value { |
| 643 | let Some(response) = raw.get("tool_response").cloned() else { |
| 644 | return raw; |
| 645 | }; |
| 646 | |
| 647 | if let Some(output) = extract_tool_output(&response) { |
| 648 | insert_if_missing(&mut raw, "tool_output", Value::String(output)); |
| 649 | } |
| 650 | if let Some(status) = extract_tool_status(&response) { |
| 651 | insert_if_missing(&mut raw, "status", Value::String(status)); |
| 652 | } |
| 653 | if let Some(duration) = extract_duration_ms(&response) { |
| 654 | insert_if_missing(&mut raw, "duration", Value::Number(duration.into())); |
| 655 | } |
| 656 | if let Some(file_path) = extract_file_path(raw.get("tool_input"), &response) { |
| 657 | insert_if_missing(&mut raw, "file_path", Value::String(file_path)); |
| 658 | } |
| 659 | |
| 660 | raw |
| 661 | } |
| 662 | |
| 663 | fn extract_tool_output(response: &Value) -> Option<String> { |
| 664 | if let Some(text) = response.as_str() { |
no test coverage detected