Generated
-1
@@ -12032,7 +12032,6 @@ dependencies = [
|
||||
"dap_adapters",
|
||||
"extension",
|
||||
"fancy-regex 0.14.0",
|
||||
"feature_flags",
|
||||
"fs",
|
||||
"futures 0.3.31",
|
||||
"fuzzy",
|
||||
|
||||
@@ -15,7 +15,6 @@ 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,
|
||||
@@ -1085,14 +1084,11 @@ impl AgentConfiguration {
|
||||
"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::AiOpenAi,
|
||||
"Codex",
|
||||
))
|
||||
.child(Divider::horizontal().color(DividerColor::BorderFaded))
|
||||
.child(self.render_agent_server(
|
||||
IconName::AiGemini,
|
||||
"Gemini CLI",
|
||||
|
||||
@@ -75,7 +75,6 @@ use zed_actions::{
|
||||
assistant::{OpenRulesLibrary, ToggleFocus},
|
||||
};
|
||||
|
||||
use feature_flags::{CodexAcpFeatureFlag, FeatureFlagAppExt as _};
|
||||
const AGENT_PANEL_KEY: &str = "agent_panel";
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -1939,34 +1938,32 @@ impl AgentPanel {
|
||||
}
|
||||
}),
|
||||
)
|
||||
.when(cx.has_flag::<CodexAcpFeatureFlag>(), |this| {
|
||||
this.item(
|
||||
ContextMenuEntry::new("New Codex Thread")
|
||||
.icon(IconName::AiOpenAi)
|
||||
.disabled(is_via_collab)
|
||||
.icon_color(Color::Muted)
|
||||
.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::Codex,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
.item(
|
||||
ContextMenuEntry::new("New Codex Thread")
|
||||
.icon(IconName::AiOpenAi)
|
||||
.disabled(is_via_collab)
|
||||
.icon_color(Color::Muted)
|
||||
.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::Codex,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}),
|
||||
)
|
||||
})
|
||||
}
|
||||
}),
|
||||
)
|
||||
.item(
|
||||
ContextMenuEntry::new("New Gemini CLI Thread")
|
||||
.icon(IconName::AiGemini)
|
||||
|
||||
@@ -17,9 +17,3 @@ pub struct PanicFeatureFlag;
|
||||
impl FeatureFlag for PanicFeatureFlag {
|
||||
const NAME: &'static str = "panic";
|
||||
}
|
||||
|
||||
pub struct CodexAcpFeatureFlag;
|
||||
|
||||
impl FeatureFlag for CodexAcpFeatureFlag {
|
||||
const NAME: &'static str = "codex-acp";
|
||||
}
|
||||
|
||||
@@ -90,7 +90,6 @@ which.workspace = true
|
||||
worktree.workspace = true
|
||||
zeroize.workspace = true
|
||||
zlog.workspace = true
|
||||
feature_flags.workspace = true
|
||||
workspace-hack.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -9,7 +9,6 @@ use std::{
|
||||
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use collections::HashMap;
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
use fs::{Fs, RemoveOptions, RenameOptions};
|
||||
use futures::StreamExt as _;
|
||||
use gpui::{
|
||||
@@ -126,7 +125,6 @@ enum AgentServerStoreState {
|
||||
pub struct AgentServerStore {
|
||||
state: AgentServerStoreState,
|
||||
external_agents: HashMap<ExternalAgentServerName, Box<dyn ExternalAgentServer>>,
|
||||
_feature_flag_subscription: Option<gpui::Subscription>,
|
||||
}
|
||||
|
||||
pub struct AgentServersUpdated;
|
||||
@@ -206,34 +204,19 @@ impl AgentServerStore {
|
||||
.unwrap_or(true),
|
||||
}),
|
||||
);
|
||||
self.external_agents
|
||||
.extend(new_settings.custom.iter().map(|(name, settings)| {
|
||||
(
|
||||
ExternalAgentServerName(name.clone()),
|
||||
Box::new(LocalCustomAgent {
|
||||
command: settings.command.clone(),
|
||||
project_environment: project_environment.clone(),
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
)
|
||||
}));
|
||||
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
if cx.has_flag::<feature_flags::CodexAcpFeatureFlag>() || new_settings.codex.is_some() {
|
||||
self.external_agents.insert(
|
||||
CODEX_NAME.into(),
|
||||
Box::new(LocalCodex {
|
||||
fs: fs.clone(),
|
||||
project_environment: project_environment.clone(),
|
||||
custom_command: new_settings
|
||||
.codex
|
||||
.clone()
|
||||
.and_then(|settings| settings.custom_command()),
|
||||
http_client: http_client.clone(),
|
||||
is_remote: downstream_client.is_some(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
self.external_agents.insert(
|
||||
CODEX_NAME.into(),
|
||||
Box::new(LocalCodex {
|
||||
fs: fs.clone(),
|
||||
project_environment: project_environment.clone(),
|
||||
custom_command: new_settings
|
||||
.codex
|
||||
.clone()
|
||||
.and_then(|settings| settings.custom_command()),
|
||||
http_client: http_client.clone(),
|
||||
is_remote: downstream_client.is_some(),
|
||||
}),
|
||||
);
|
||||
self.external_agents.insert(
|
||||
CLAUDE_CODE_NAME.into(),
|
||||
Box::new(LocalClaudeCode {
|
||||
@@ -246,6 +229,16 @@ impl AgentServerStore {
|
||||
.and_then(|settings| settings.custom_command()),
|
||||
}),
|
||||
);
|
||||
self.external_agents
|
||||
.extend(new_settings.custom.iter().map(|(name, settings)| {
|
||||
(
|
||||
ExternalAgentServerName(name.clone()),
|
||||
Box::new(LocalCustomAgent {
|
||||
command: settings.command.clone(),
|
||||
project_environment: project_environment.clone(),
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
)
|
||||
}));
|
||||
|
||||
*old_settings = Some(new_settings.clone());
|
||||
|
||||
@@ -274,13 +267,6 @@ impl AgentServerStore {
|
||||
let subscription = cx.observe_global::<SettingsStore>(|this, cx| {
|
||||
this.agent_servers_settings_changed(cx);
|
||||
});
|
||||
let this_handle = cx.weak_entity();
|
||||
let feature_flags_subscription =
|
||||
cx.observe_flag::<feature_flags::CodexAcpFeatureFlag, _>(move |_enabled, cx| {
|
||||
let _ = this_handle.update(cx, |this, cx| {
|
||||
this.reregister_agents(cx);
|
||||
});
|
||||
});
|
||||
let mut this = Self {
|
||||
state: AgentServerStoreState::Local {
|
||||
node_runtime,
|
||||
@@ -292,31 +278,16 @@ impl AgentServerStore {
|
||||
_subscriptions: [subscription],
|
||||
},
|
||||
external_agents: Default::default(),
|
||||
_feature_flag_subscription: Some(feature_flags_subscription),
|
||||
};
|
||||
this.agent_servers_settings_changed(cx);
|
||||
this
|
||||
}
|
||||
|
||||
pub(crate) fn remote(
|
||||
project_id: u64,
|
||||
upstream_client: Entity<RemoteClient>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
pub(crate) fn remote(project_id: u64, upstream_client: Entity<RemoteClient>) -> Self {
|
||||
// Set up the builtin agents here so they're immediately available in
|
||||
// remote projects--we know that the HeadlessProject on the other end
|
||||
// will have them.
|
||||
let mut external_agents = [
|
||||
(
|
||||
GEMINI_NAME.into(),
|
||||
Box::new(RemoteExternalAgentServer {
|
||||
project_id,
|
||||
upstream_client: upstream_client.clone(),
|
||||
name: GEMINI_NAME.into(),
|
||||
status_tx: None,
|
||||
new_version_available_tx: None,
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
),
|
||||
let external_agents = [
|
||||
(
|
||||
CLAUDE_CODE_NAME.into(),
|
||||
Box::new(RemoteExternalAgentServer {
|
||||
@@ -327,13 +298,7 @@ impl AgentServerStore {
|
||||
new_version_available_tx: None,
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.collect::<HashMap<ExternalAgentServerName, Box<dyn ExternalAgentServer>>>();
|
||||
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
if cx.has_flag::<feature_flags::CodexAcpFeatureFlag>() {
|
||||
external_agents.insert(
|
||||
(
|
||||
CODEX_NAME.into(),
|
||||
Box::new(RemoteExternalAgentServer {
|
||||
project_id,
|
||||
@@ -342,8 +307,20 @@ impl AgentServerStore {
|
||||
status_tx: None,
|
||||
new_version_available_tx: None,
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
);
|
||||
}
|
||||
),
|
||||
(
|
||||
GEMINI_NAME.into(),
|
||||
Box::new(RemoteExternalAgentServer {
|
||||
project_id,
|
||||
upstream_client: upstream_client.clone(),
|
||||
name: GEMINI_NAME.into(),
|
||||
status_tx: None,
|
||||
new_version_available_tx: None,
|
||||
}) as Box<dyn ExternalAgentServer>,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
||||
Self {
|
||||
state: AgentServerStoreState::Remote {
|
||||
@@ -351,7 +328,6 @@ impl AgentServerStore {
|
||||
upstream_client,
|
||||
},
|
||||
external_agents,
|
||||
_feature_flag_subscription: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +335,6 @@ impl AgentServerStore {
|
||||
Self {
|
||||
state: AgentServerStoreState::Collab,
|
||||
external_agents: Default::default(),
|
||||
_feature_flag_subscription: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1331,7 +1331,7 @@ impl Project {
|
||||
});
|
||||
|
||||
let agent_server_store =
|
||||
cx.new(|cx| AgentServerStore::remote(REMOTE_SERVER_PROJECT_ID, remote.clone(), cx));
|
||||
cx.new(|_| AgentServerStore::remote(REMOTE_SERVER_PROJECT_ID, remote.clone()));
|
||||
|
||||
cx.subscribe(&remote, Self::on_remote_client_event).detach();
|
||||
|
||||
|
||||
@@ -1792,7 +1792,7 @@ async fn test_remote_external_agent_server(
|
||||
.map(|name| name.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
});
|
||||
pretty_assertions::assert_eq!(names, ["gemini", "codex", "claude"]);
|
||||
pretty_assertions::assert_eq!(names, ["codex", "gemini", "claude"]);
|
||||
server_cx.update_global::<SettingsStore, _>(|settings_store, cx| {
|
||||
settings_store
|
||||
.set_server_settings(
|
||||
|
||||
Reference in New Issue
Block a user