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