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