codex.rs

 1use project::Project;
 2use std::{path::Path, rc::Rc};
 3
 4use anyhow::Result;
 5use gpui::{App, Entity, Task};
 6
 7use crate::AgentServer;
 8use acp_thread::AgentConnection;
 9
10#[derive(Clone)]
11pub struct Codex;
12
13impl AgentServer for Codex {
14    fn name(&self) -> &'static str {
15        "Codex"
16    }
17
18    fn empty_state_headline(&self) -> &'static str {
19        self.name()
20    }
21
22    fn empty_state_message(&self) -> &'static str {
23        ""
24    }
25
26    fn logo(&self) -> ui::IconName {
27        ui::IconName::AiOpenAi
28    }
29
30    fn connect(
31        &self,
32        _root_dir: &Path,
33        _project: &Entity<Project>,
34        _cx: &mut App,
35    ) -> Task<Result<Rc<dyn AgentConnection>>> {
36        // re-implement using ACP
37        todo!()
38    }
39}
40
41#[cfg(test)]
42pub mod tests {
43    use crate::AgentServerCommand;
44
45    use super::*;
46
47    crate::common_e2e_tests!(Codex);
48
49    pub fn local_command() -> AgentServerCommand {
50        let cli_path =
51            Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../codex/code-rs/target/debug/codex");
52
53        AgentServerCommand {
54            path: cli_path,
55            args: vec!["mcp".into()],
56            env: None,
57        }
58    }
59}