Collect sessions stamped with `run_id` from the canonical session store.
(dot_dir: &Path, run_id: &str)
| 1109 | |
| 1110 | /// Collect sessions stamped with `run_id` from the canonical session store. |
| 1111 | fn collect_run_sessions(dot_dir: &Path, run_id: &str) -> Vec<RunSessionSummary> { |
| 1112 | let store = match SessionStore::new(dot_dir.join("sessions")) { |
| 1113 | Ok(store) => store, |
| 1114 | Err(e) => { |
| 1115 | log::warn!("could not open session store for run summary: {}", e); |
| 1116 | return Vec::new(); |
| 1117 | } |
| 1118 | }; |
| 1119 | let sessions = match store.list() { |
| 1120 | Ok(sessions) => sessions, |
| 1121 | Err(e) => { |
| 1122 | log::warn!("could not list sessions for run summary: {}", e); |
| 1123 | return Vec::new(); |
| 1124 | } |
| 1125 | }; |
| 1126 | |
| 1127 | sessions |
| 1128 | .into_iter() |
| 1129 | .filter(|s| { |
| 1130 | s.managed_run |
| 1131 | .as_ref() |
| 1132 | .map(|m| m.run_id == run_id) |
| 1133 | .unwrap_or(false) |
| 1134 | }) |
| 1135 | .map(|s| RunSessionSummary { |
| 1136 | session_id: s.session_id.clone(), |
| 1137 | agent_name: s.agent_name.clone(), |
| 1138 | view: s.view_name.clone(), |
| 1139 | turn_count: s.turn_count, |
| 1140 | status: s.status.clone(), |
| 1141 | change_hashes: s |
| 1142 | .recorded_change_hashes |
| 1143 | .iter() |
| 1144 | .map(|h| h.to_base32()) |
| 1145 | .collect(), |
| 1146 | }) |
| 1147 | .collect() |
| 1148 | } |
| 1149 | |
| 1150 | fn print_lifecycle(lifecycle: &ManagedLifecycle, json: bool) -> CliResult<()> { |
| 1151 | if json { |