(mut raw: Value)
| 517 | } |
| 518 | |
| 519 | fn normalize_tool_raw(mut raw: Value) -> Value { |
| 520 | let Some(response) = raw.get("tool_response").cloned() else { |
| 521 | return raw; |
| 522 | }; |
| 523 | |
| 524 | if let Some(output) = extract_tool_output(&response) { |
| 525 | insert_if_missing(&mut raw, "tool_output", Value::String(output)); |
| 526 | } |
| 527 | if let Some(status) = extract_tool_status(&response) { |
| 528 | insert_if_missing(&mut raw, "status", Value::String(status)); |
| 529 | } |
| 530 | if let Some(duration) = extract_duration_ms(&response) { |
| 531 | insert_if_missing(&mut raw, "duration", Value::Number(duration.into())); |
| 532 | } |
| 533 | if let Some(file_path) = extract_file_path(raw.get("tool_input"), &response) { |
| 534 | insert_if_missing(&mut raw, "file_path", Value::String(file_path)); |
| 535 | } |
| 536 | |
| 537 | raw |
| 538 | } |
| 539 | |
| 540 | fn extract_tool_output(response: &Value) -> Option<String> { |
| 541 | if let Some(text) = response.as_str() { |
no test coverage detected