| 368 | } |
| 369 | |
| 370 | fn inspect_turn(record: &SessionRecord, turn: &SessionTurn) -> CliResult<TurnInspection> { |
| 371 | let mut hashes: Vec<_> = turn.change_hashes.iter().map(Hash::to_base32).collect(); |
| 372 | hashes.sort(); |
| 373 | hashes.dedup(); |
| 374 | Ok(TurnInspection { |
| 375 | session_id: record.session_id.clone(), |
| 376 | view_name: record.view_name.clone(), |
| 377 | turn_number: turn.turn_number, |
| 378 | status: if hashes.is_empty() { |
| 379 | "no_recorded_changes" |
| 380 | } else { |
| 381 | "recorded" |
| 382 | } |
| 383 | .into(), |
| 384 | session_status: record.status.label().into(), |
| 385 | plan_id: turn.plan_id.clone(), |
| 386 | provenance_hash: Some(turn.provenance_hash.to_base32()), |
| 387 | change_hashes: hashes, |
| 388 | outcome: encode(&turn.outcome)?, |
| 389 | }) |
| 390 | } |
| 391 | |
| 392 | fn pending_turn(store: &SessionStore, session: &AgentSession) -> CliResult<Option<TurnInspection>> { |
| 393 | if !session.is_turn_active() { |