(&self, agent_type: &str)
| 180 | #[async_trait::async_trait] |
| 181 | impl Agent for CoreAgentAdapter { |
| 182 | async fn ensure_session(&self, agent_type: &str) -> Result<String> { |
| 183 | let mut session_id_guard = self.session_id.lock().await; |
| 184 | |
| 185 | if let Some(ref id) = *session_id_guard { |
| 186 | self.ensure_backend_session_alive(id, agent_type).await?; |
| 187 | return Ok(id.clone()); |
| 188 | } |
| 189 | |
| 190 | let session = self |
| 191 | .coordinator |
| 192 | .create_session( |
| 193 | Self::build_default_session_name(), |
| 194 | agent_type.to_string(), |
| 195 | SessionConfig { |
| 196 | workspace_path: Some(self.workspace_path_string()), |
| 197 | ..Default::default() |
| 198 | }, |
| 199 | ) |
| 200 | .await?; |
| 201 | |
| 202 | let id = session.session_id.clone(); |
| 203 | |
| 204 | *session_id_guard = Some(id.clone()); |
| 205 | tracing::info!("Created core session: {}", id); |
| 206 | |
| 207 | Ok(id) |
| 208 | } |
| 209 | |
| 210 | async fn send_message(&self, message: String, agent_type: &str) -> Result<String> { |
| 211 | let session_id = self.ensure_session(agent_type).await?; |
no test coverage detected