(config: CodeConfig)
| 51 | } |
| 52 | |
| 53 | pub(super) async fn build_agent_from_config(config: CodeConfig) -> Result<Agent> { |
| 54 | config |
| 55 | .default_llm_config() |
| 56 | .context("default_model must be set in 'provider/model' format with a valid API key")?; |
| 57 | |
| 58 | let mut agent_config = base_agent_config(&config); |
| 59 | install_global_skill_registry(&mut agent_config, &config); |
| 60 | let (global_mcp, global_mcp_tools) = connect_global_mcp(&config).await; |
| 61 | |
| 62 | Ok(Agent { |
| 63 | code_config: config, |
| 64 | config: agent_config, |
| 65 | global_mcp, |
| 66 | global_mcp_tools: std::sync::Mutex::new(global_mcp_tools), |
| 67 | sessions: Arc::new(std::sync::Mutex::new(std::collections::HashMap::new())), |
| 68 | closed: Arc::new(std::sync::atomic::AtomicBool::new(false)), |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | fn expand_home(source: &str) -> String { |
| 73 | let Some(rest) = source.strip_prefix("~/") else { |
no test coverage detected