Skip to content

Commit 90cf81c

Browse files
authored
agent_ui: Unify ui elements (#50201)
The ACP monikers are left over from when we had two versions of everything. Now that all agents, including our own, use the same UI components, it seems silly to have all of this separation. Flattens files and removes unneeded Acp prefixes Release Notes: - N/A
1 parent f4e65d8 commit 90cf81c

17 files changed

Lines changed: 217 additions & 222 deletions

crates/agent_ui/src/acp.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

crates/agent_ui/src/agent_panel.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ use zed_actions::agent::{OpenClaudeAgentOnboardingModal, ReauthenticateAgent, Re
2626

2727
use crate::ui::{AcpOnboardingModal, ClaudeCodeOnboardingModal};
2828
use crate::{
29-
AddContextServer, AgentDiffPane, CopyThreadToClipboard, Follow, InlineAssistant,
30-
LoadThreadFromClipboard, NewTextThread, NewThread, OpenActiveThreadAsMarkdown, OpenAgentDiff,
31-
OpenHistory, ResetTrialEndUpsell, ResetTrialUpsell, ToggleNavigationMenu, ToggleNewThreadMenu,
32-
ToggleOptionsMenu,
33-
acp::AcpServerView,
29+
AddContextServer, AgentDiffPane, ConnectionView, CopyThreadToClipboard, Follow,
30+
InlineAssistant, LoadThreadFromClipboard, NewTextThread, NewThread, OpenActiveThreadAsMarkdown,
31+
OpenAgentDiff, OpenHistory, ResetTrialEndUpsell, ResetTrialUpsell, ToggleNavigationMenu,
32+
ToggleNewThreadMenu, ToggleOptionsMenu,
3433
agent_configuration::{AgentConfiguration, AssistantConfigurationEvent},
3534
slash_command::SlashCommandCompletionProvider,
3635
text_thread_editor::{AgentPanelDelegate, TextThreadEditor, make_lsp_adapter_delegate},
@@ -40,11 +39,10 @@ use crate::{
4039
AgentInitialContent, ExternalAgent, NewExternalAgentThread, NewNativeAgentThreadFromSummary,
4140
};
4241
use crate::{
43-
ExpandMessageEditor,
44-
acp::{AcpThreadHistory, ThreadHistoryEvent},
42+
ExpandMessageEditor, ThreadHistory, ThreadHistoryEvent,
4543
text_thread_history::{TextThreadHistory, TextThreadHistoryEvent},
4644
};
47-
use crate::{ManageProfiles, acp::thread_view::AcpThreadView};
45+
use crate::{ManageProfiles, connection_view::ThreadView};
4846
use agent_settings::AgentSettings;
4947
use ai_onboarding::AgentPanelOnboarding;
5048
use anyhow::{Result, anyhow};
@@ -341,7 +339,7 @@ enum HistoryKind {
341339
enum ActiveView {
342340
Uninitialized,
343341
AgentThread {
344-
server_view: Entity<AcpServerView>,
342+
server_view: Entity<ConnectionView>,
345343
},
346344
TextThread {
347345
text_thread_editor: Entity<TextThreadEditor>,
@@ -504,7 +502,7 @@ pub struct AgentPanel {
504502
project: Entity<Project>,
505503
fs: Arc<dyn Fs>,
506504
language_registry: Arc<LanguageRegistry>,
507-
acp_history: Entity<AcpThreadHistory>,
505+
acp_history: Entity<ThreadHistory>,
508506
text_thread_history: Entity<TextThreadHistory>,
509507
thread_store: Entity<ThreadStore>,
510508
text_thread_store: Entity<assistant_text_thread::TextThreadStore>,
@@ -679,7 +677,7 @@ impl AgentPanel {
679677
cx.new(|cx| ContextServerRegistry::new(project.read(cx).context_server_store(), cx));
680678

681679
let thread_store = ThreadStore::global(cx);
682-
let acp_history = cx.new(|cx| AcpThreadHistory::new(None, window, cx));
680+
let acp_history = cx.new(|cx| ThreadHistory::new(None, window, cx));
683681
let text_thread_history =
684682
cx.new(|cx| TextThreadHistory::new(text_thread_store.clone(), window, cx));
685683
cx.subscribe_in(
@@ -863,7 +861,7 @@ impl AgentPanel {
863861
&self.thread_store
864862
}
865863

866-
pub fn history(&self) -> &Entity<AcpThreadHistory> {
864+
pub fn history(&self) -> &Entity<ThreadHistory> {
867865
&self.acp_history
868866
}
869867

@@ -903,7 +901,7 @@ impl AgentPanel {
903901
.unwrap_or(false)
904902
}
905903

906-
pub(crate) fn active_thread_view(&self) -> Option<&Entity<AcpServerView>> {
904+
pub(crate) fn active_thread_view(&self) -> Option<&Entity<ConnectionView>> {
907905
match &self.active_view {
908906
ActiveView::AgentThread { server_view, .. } => Some(server_view),
909907
ActiveView::Uninitialized
@@ -1546,14 +1544,14 @@ impl AgentPanel {
15461544
}
15471545
}
15481546

1549-
pub fn as_active_server_view(&self) -> Option<&Entity<AcpServerView>> {
1547+
pub fn as_active_server_view(&self) -> Option<&Entity<ConnectionView>> {
15501548
match &self.active_view {
15511549
ActiveView::AgentThread { server_view } => Some(server_view),
15521550
_ => None,
15531551
}
15541552
}
15551553

1556-
pub fn as_active_thread_view(&self, cx: &App) -> Option<Entity<AcpThreadView>> {
1554+
pub fn as_active_thread_view(&self, cx: &App) -> Option<Entity<ThreadView>> {
15571555
let server_view = self.as_active_server_view()?;
15581556
server_view.read(cx).active_thread().cloned()
15591557
}
@@ -1855,7 +1853,7 @@ impl AgentPanel {
18551853
.then(|| self.thread_store.clone());
18561854

18571855
let server_view = cx.new(|cx| {
1858-
crate::acp::AcpServerView::new(
1856+
crate::ConnectionView::new(
18591857
server,
18601858
resume_thread,
18611859
initial_content,
@@ -2128,7 +2126,7 @@ impl AgentPanel {
21282126
.into_any()
21292127
}
21302128

2131-
fn handle_regenerate_thread_title(thread_view: Entity<AcpServerView>, cx: &mut App) {
2129+
fn handle_regenerate_thread_title(thread_view: Entity<ConnectionView>, cx: &mut App) {
21322130
thread_view.update(cx, |thread_view, cx| {
21332131
if let Some(thread) = thread_view.as_native_thread(cx) {
21342132
thread.update(cx, |thread, cx| {
@@ -3467,15 +3465,15 @@ impl AgentPanel {
34673465
///
34683466
/// This is a test-only accessor that exposes the private `active_thread_view()`
34693467
/// method for test assertions. Not compiled into production builds.
3470-
pub fn active_thread_view_for_tests(&self) -> Option<&Entity<AcpServerView>> {
3468+
pub fn active_thread_view_for_tests(&self) -> Option<&Entity<ConnectionView>> {
34713469
self.active_thread_view()
34723470
}
34733471
}
34743472

34753473
#[cfg(test)]
34763474
mod tests {
34773475
use super::*;
3478-
use crate::acp::thread_view::tests::{StubAgentServer, init_test};
3476+
use crate::connection_view::tests::{StubAgentServer, init_test};
34793477
use assistant_text_thread::TextThreadStore;
34803478
use feature_flags::FeatureFlagAppExt;
34813479
use fs::FakeFs;

crates/agent_ui/src/agent_ui.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
pub mod acp;
21
mod agent_configuration;
32
mod agent_diff;
43
mod agent_model_selector;
54
mod agent_panel;
65
mod agent_registry_ui;
76
mod buffer_codegen;
87
mod completion_provider;
8+
mod config_options;
9+
pub(crate) mod connection_view;
910
mod context;
1011
mod context_server_configuration;
12+
mod entry_view_state;
1113
mod favorite_models;
1214
mod inline_assistant;
1315
mod inline_prompt_editor;
1416
mod language_model_selector;
1517
mod mention_set;
18+
mod message_editor;
19+
mod mode_selector;
20+
mod model_selector;
21+
mod model_selector_popover;
1622
mod profile_selector;
1723
mod slash_command;
1824
mod slash_command_picker;
1925
mod terminal_codegen;
2026
mod terminal_inline_assistant;
2127
mod text_thread_editor;
2228
mod text_thread_history;
29+
mod thread_history;
2330
mod ui;
2431

2532
use std::rc::Rc;
@@ -52,7 +59,12 @@ pub use crate::agent_panel::{AgentPanel, AgentPanelEvent, ConcreteAssistantPanel
5259
use crate::agent_registry_ui::AgentRegistryPage;
5360
pub use crate::inline_assistant::InlineAssistant;
5461
pub use agent_diff::{AgentDiffPane, AgentDiffToolbar};
62+
pub(crate) use connection_view::ConnectionView;
63+
pub(crate) use mode_selector::ModeSelector;
64+
pub(crate) use model_selector::ModelSelector;
65+
pub(crate) use model_selector_popover::ModelSelectorPopover;
5566
pub use text_thread_editor::{AgentPanelDelegate, TextThreadEditor};
67+
pub(crate) use thread_history::*;
5668
use zed_actions;
5769

5870
actions!(

crates/agent_ui/src/completion_provider.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::path::PathBuf;
44
use std::sync::Arc;
55
use std::sync::atomic::AtomicBool;
66

7-
use crate::acp::AcpThreadHistory;
7+
use crate::ThreadHistory;
88
use acp_thread::{AgentSessionInfo, MentionUri};
99
use anyhow::Result;
1010
use editor::{
@@ -206,7 +206,7 @@ pub struct PromptCompletionProvider<T: PromptCompletionProviderDelegate> {
206206
source: Arc<T>,
207207
editor: WeakEntity<Editor>,
208208
mention_set: Entity<MentionSet>,
209-
history: WeakEntity<AcpThreadHistory>,
209+
history: WeakEntity<ThreadHistory>,
210210
prompt_store: Option<Entity<PromptStore>>,
211211
workspace: WeakEntity<Workspace>,
212212
}
@@ -216,7 +216,7 @@ impl<T: PromptCompletionProviderDelegate> PromptCompletionProvider<T> {
216216
source: T,
217217
editor: WeakEntity<Editor>,
218218
mention_set: Entity<MentionSet>,
219-
history: WeakEntity<AcpThreadHistory>,
219+
history: WeakEntity<ThreadHistory>,
220220
prompt_store: Option<Entity<PromptStore>>,
221221
workspace: WeakEntity<Workspace>,
222222
) -> Self {

0 commit comments

Comments
 (0)