Format AI attestation information for display.
(&self, prov: &Provenance)
| 499 | |
| 500 | /// Format AI attestation information for display. |
| 501 | fn format_attestation(&self, prov: &Provenance) -> String { |
| 502 | let mut output = String::new(); |
| 503 | |
| 504 | output.push_str(&format!("{}\n", emphasis("=== Attestation ==="))); |
| 505 | output.push_str(&format!( |
| 506 | " Vendor: {}\n", |
| 507 | info(&format!("{:?}", prov.vendor)) |
| 508 | )); |
| 509 | output.push_str(&format!(" Model: {}\n", info(&prov.model))); |
| 510 | |
| 511 | if let Some(version) = &prov.model_version { |
| 512 | output.push_str(&format!(" Version: {}\n", hint(version))); |
| 513 | } |
| 514 | |
| 515 | output.push_str(&format!( |
| 516 | " Tool: {}\n", |
| 517 | info(&format!("{:?}", prov.tool)) |
| 518 | )); |
| 519 | output.push_str(&format!( |
| 520 | " Type: {}\n", |
| 521 | hint(&format!("{:?}", prov.suggestion_type)) |
| 522 | )); |
| 523 | |
| 524 | // Token usage |
| 525 | if !prov.tokens.is_empty() { |
| 526 | output.push_str(" Tokens:\n"); |
| 527 | output.push_str(&format!(" Input: {}\n", prov.tokens.input_tokens)); |
| 528 | output.push_str(&format!(" Output: {}\n", prov.tokens.output_tokens)); |
| 529 | output.push_str(&format!(" Total: {}\n", prov.tokens.total_tokens)); |
| 530 | } |
| 531 | |
| 532 | // Cost |
| 533 | if !prov.cost.is_zero() { |
| 534 | output.push_str(&format!(" Cost: ${:.6} USD\n", prov.cost.usd)); |
| 535 | } |
| 536 | |
| 537 | // Temperature |
| 538 | if let Some(temp) = prov.temperature { |
| 539 | let temp_f = temp as f64 / 1000.0; |
| 540 | output.push_str(&format!(" Temp: {:.2}\n", temp_f)); |
| 541 | } |
| 542 | |
| 543 | // Request/Session IDs |
| 544 | if let Some(req_id) = &prov.request_id { |
| 545 | output.push_str(&format!(" Request: {}\n", hint(req_id))); |
| 546 | } |
| 547 | if let Some(sess_id) = &prov.session_id { |
| 548 | output.push_str(&format!(" Session: {}\n", hint(sess_id))); |
| 549 | } |
| 550 | |
| 551 | // Additional metadata (key-value pairs from agent recording) |
| 552 | if !prov.metadata.is_empty() { |
| 553 | output.push_str(" Metadata:\n"); |
| 554 | for (key, value) in &prov.metadata { |
| 555 | // turn_number is recorded as 1-indexed but session ledger |
| 556 | // turns are 0-indexed; display the 0-indexed value. |
| 557 | let display_value = if key == "turn_number" { |
| 558 | value |
no test coverage detected