Collect sessions stamped with `run_id` from the canonical session store.
(dot_dir: &Path, run_id: &str)
| 533 | |
| 534 | /// Collect sessions stamped with `run_id` from the canonical session store. |
| 535 | fn collect_run_sessions(dot_dir: &Path, run_id: &str) -> Vec<RunSessionSummary> { |
| 536 | let store = match SessionStore::new(dot_dir.join("sessions")) { |
| 537 | Ok(store) => store, |
| 538 | Err(e) => { |
| 539 | log::warn!("could not open session store for run summary: {}", e); |
| 540 | return Vec::new(); |
| 541 | } |
| 542 | }; |
| 543 | let sessions = match store.list() { |
| 544 | Ok(sessions) => sessions, |
| 545 | Err(e) => { |
| 546 | log::warn!("could not list sessions for run summary: {}", e); |
| 547 | return Vec::new(); |
| 548 | } |
| 549 | }; |
| 550 | |
| 551 | sessions |
| 552 | .into_iter() |
| 553 | .filter(|s| { |
| 554 | s.managed_run |
| 555 | .as_ref() |
| 556 | .map(|m| m.run_id == run_id) |
| 557 | .unwrap_or(false) |
| 558 | }) |
| 559 | .map(|s| RunSessionSummary { |
| 560 | session_id: s.session_id.clone(), |
| 561 | agent_name: s.agent_name.clone(), |
| 562 | view: s.view_name.clone(), |
| 563 | turn_count: s.turn_count, |
| 564 | change_hashes: s |
| 565 | .recorded_change_hashes |
| 566 | .iter() |
| 567 | .map(|h| h.to_base32()) |
| 568 | .collect(), |
| 569 | }) |
| 570 | .collect() |
| 571 | } |
| 572 | |
| 573 | fn print_lifecycle(lifecycle: &ManagedLifecycle, json: bool) -> CliResult<()> { |
| 574 | if json { |