| 229 | } |
| 230 | |
| 231 | fn end_turn(&mut self) -> Pin<Box<dyn Future<Output = AgentResult<TurnChanges>> + Send + '_>> { |
| 232 | Box::pin(async move { |
| 233 | let pre = self |
| 234 | .pre_snapshot |
| 235 | .take() |
| 236 | .ok_or_else(|| AgentError::TurnNotActive { |
| 237 | session_id: self |
| 238 | .active_session |
| 239 | .as_deref() |
| 240 | .unwrap_or("unknown") |
| 241 | .to_string(), |
| 242 | })?; |
| 243 | |
| 244 | let post = take_snapshot(self.config.repo_root(), self.config.ignore_patterns())?; |
| 245 | |
| 246 | let changes = diff_snapshots(&pre, &post); |
| 247 | |
| 248 | self.active_session = None; |
| 249 | Ok(changes) |
| 250 | }) |
| 251 | } |
| 252 | |
| 253 | fn cancel_turn(&mut self) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + '_>> { |
| 254 | Box::pin(async move { |