(
record: SessionRecord,
turns: Vec<SessionTurn>,
turn_intents: HashMap<u32, String>,
manifest_head: Option<atomic_core::types::Hash>,
parent_manifest: Option<atomic_core::types::H
| 267 | /// share it. |
| 268 | #[allow(clippy::too_many_arguments)] |
| 269 | pub(crate) fn render_session_detail( |
| 270 | record: SessionRecord, |
| 271 | turns: Vec<SessionTurn>, |
| 272 | turn_intents: HashMap<u32, String>, |
| 273 | manifest_head: Option<atomic_core::types::Hash>, |
| 274 | parent_manifest: Option<atomic_core::types::Hash>, |
| 275 | fork_turn: Option<u32>, |
| 276 | json: bool, |
| 277 | ) -> CliResult<()> { |
| 278 | if json { |
| 279 | println!( |
| 280 | "{}", |
| 281 | serde_json::to_string_pretty(&(record, turns)).map_err(|e| { |
| 282 | CliError::Internal(anyhow::anyhow!("failed to encode session ledger: {}", e)) |
| 283 | })? |
| 284 | ); |
| 285 | return Ok(()); |
| 286 | } |
| 287 | |
| 288 | println!("Session {}", record.session_id); |
| 289 | println!(" Status: {}", record.status.label()); |
| 290 | if let Some(incomplete) = record.status.incomplete() { |
| 291 | println!(" Reason: {}", incomplete.reason); |
| 292 | println!(" Origin: {}", incomplete.origin); |
| 293 | println!(" Recovery ref: {}", incomplete.recovery_ref); |
| 294 | if !incomplete.paths.is_empty() { |
| 295 | println!(" Affected paths:"); |
| 296 | for path in &incomplete.paths { |
| 297 | println!(" {}", path); |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | if let Some(view) = &record.view_name { |
| 302 | println!(" View: {}", view); |
| 303 | } |
| 304 | if let Some(parent) = &record.parent_view { |
| 305 | println!(" Parent view: {}", parent); |
| 306 | } |
| 307 | println!(" JSON: {}", record.json_path); |
| 308 | println!(" Turns: {}", record.turn_count); |
| 309 | |
| 310 | // Show all intents linked to this session. |
| 311 | let all_intents: Vec<&str> = { |
| 312 | let mut ids: Vec<&str> = turn_intents.values().map(|s| s.as_str()).collect(); |
| 313 | ids.sort(); |
| 314 | ids.dedup(); |
| 315 | ids |
| 316 | }; |
| 317 | if !all_intents.is_empty() { |
| 318 | println!(" Intents: {}", all_intents.join(", ")); |
| 319 | } |
| 320 | |
| 321 | if let Some(head) = manifest_head { |
| 322 | println!(" Manifest head: {}", head.to_base32()); |
| 323 | if let Some(parent) = parent_manifest { |
| 324 | println!(" Parent manifest: {}", parent.to_base32()); |
| 325 | } |
| 326 | if let Some(fork_turn) = fork_turn { |
no test coverage detected