acp: Alphabetize the external agents list (#39363)

Ben Brandt created

Makes it a bit easier to find what you are looking for.
Also makes sure all of them are available in the settings bar.

Release Notes:

- N/A

Change summary

crates/agent_ui/src/agent_configuration.rs | 17 ++++++-
crates/agent_ui/src/agent_panel.rs         | 52 ++++++++++++------------
2 files changed, 39 insertions(+), 30 deletions(-)

Detailed changes

crates/agent_ui/src/agent_configuration.rs 🔗

@@ -15,6 +15,7 @@ use context_server::ContextServerId;
 use editor::{Editor, SelectionEffects, scroll::Autoscroll};
 use extension::ExtensionManifest;
 use extension_host::ExtensionStore;
+use feature_flags::{CodexAcpFeatureFlag, FeatureFlagAppExt as _};
 use fs::Fs;
 use gpui::{
     Action, AnyView, App, AsyncWindowContext, Corner, Entity, EventEmitter, FocusHandle, Focusable,
@@ -1080,13 +1081,21 @@ impl AgentConfiguration {
                             ),
                     )
                     .child(self.render_agent_server(
-                        IconName::AiGemini,
-                        "Gemini CLI",
+                        IconName::AiClaude,
+                        "Claude Code",
                     ))
                     .child(Divider::horizontal().color(DividerColor::BorderFaded))
+                    .when(cx.has_flag::<CodexAcpFeatureFlag>(), |this| {
+                        this
+                            .child(self.render_agent_server(
+                                IconName::AiOpenAi,
+                                "Codex",
+                            ))
+                            .child(Divider::horizontal().color(DividerColor::BorderFaded))
+                    })
                     .child(self.render_agent_server(
-                        IconName::AiClaude,
-                        "Claude Code",
+                        IconName::AiGemini,
+                        "Gemini CLI",
                     ))
                     .map(|mut parent| {
                         for agent in user_defined_agents {

crates/agent_ui/src/agent_panel.rs 🔗

@@ -1949,32 +1949,6 @@ impl AgentPanel {
                             )
                             .separator()
                             .header("External Agents")
-                            .item(
-                                ContextMenuEntry::new("New Gemini CLI Thread")
-                                    .icon(IconName::AiGemini)
-                                    .icon_color(Color::Muted)
-                                    .disabled(is_via_collab)
-                                    .handler({
-                                        let workspace = workspace.clone();
-                                        move |window, cx| {
-                                            if let Some(workspace) = workspace.upgrade() {
-                                                workspace.update(cx, |workspace, cx| {
-                                                    if let Some(panel) =
-                                                        workspace.panel::<AgentPanel>(cx)
-                                                    {
-                                                        panel.update(cx, |panel, cx| {
-                                                            panel.new_agent_thread(
-                                                                AgentType::Gemini,
-                                                                window,
-                                                                cx,
-                                                            );
-                                                        });
-                                                    }
-                                                });
-                                            }
-                                        }
-                                    }),
-                            )
                             .item(
                                 ContextMenuEntry::new("New Claude Code Thread")
                                     .icon(IconName::AiClaude)
@@ -2029,6 +2003,32 @@ impl AgentPanel {
                                         }),
                                 )
                             })
+                            .item(
+                                ContextMenuEntry::new("New Gemini CLI Thread")
+                                    .icon(IconName::AiGemini)
+                                    .icon_color(Color::Muted)
+                                    .disabled(is_via_collab)
+                                    .handler({
+                                        let workspace = workspace.clone();
+                                        move |window, cx| {
+                                            if let Some(workspace) = workspace.upgrade() {
+                                                workspace.update(cx, |workspace, cx| {
+                                                    if let Some(panel) =
+                                                        workspace.panel::<AgentPanel>(cx)
+                                                    {
+                                                        panel.update(cx, |panel, cx| {
+                                                            panel.new_agent_thread(
+                                                                AgentType::Gemini,
+                                                                window,
+                                                                cx,
+                                                            );
+                                                        });
+                                                    }
+                                                });
+                                            }
+                                        }
+                                    }),
+                            )
                             .map(|mut menu| {
                                 let agent_names = agent_server_store
                                     .read(cx)