Detailed changes
@@ -1,14 +0,0 @@
-mod config_options;
-mod entry_view_state;
-mod message_editor;
-mod mode_selector;
-mod model_selector;
-mod model_selector_popover;
-mod thread_history;
-pub(crate) mod thread_view;
-
-pub use mode_selector::ModeSelector;
-pub use model_selector::AcpModelSelector;
-pub use model_selector_popover::AcpModelSelectorPopover;
-pub use thread_history::*;
-pub use thread_view::AcpServerView;
@@ -26,11 +26,10 @@ use zed_actions::agent::{OpenClaudeAgentOnboardingModal, ReauthenticateAgent, Re
use crate::ui::{AcpOnboardingModal, ClaudeCodeOnboardingModal};
use crate::{
- AddContextServer, AgentDiffPane, CopyThreadToClipboard, Follow, InlineAssistant,
- LoadThreadFromClipboard, NewTextThread, NewThread, OpenActiveThreadAsMarkdown, OpenAgentDiff,
- OpenHistory, ResetTrialEndUpsell, ResetTrialUpsell, ToggleNavigationMenu, ToggleNewThreadMenu,
- ToggleOptionsMenu,
- acp::AcpServerView,
+ AddContextServer, AgentDiffPane, ConnectionView, CopyThreadToClipboard, Follow,
+ InlineAssistant, LoadThreadFromClipboard, NewTextThread, NewThread, OpenActiveThreadAsMarkdown,
+ OpenAgentDiff, OpenHistory, ResetTrialEndUpsell, ResetTrialUpsell, ToggleNavigationMenu,
+ ToggleNewThreadMenu, ToggleOptionsMenu,
agent_configuration::{AgentConfiguration, AssistantConfigurationEvent},
slash_command::SlashCommandCompletionProvider,
text_thread_editor::{AgentPanelDelegate, TextThreadEditor, make_lsp_adapter_delegate},
@@ -40,11 +39,10 @@ use crate::{
AgentInitialContent, ExternalAgent, NewExternalAgentThread, NewNativeAgentThreadFromSummary,
};
use crate::{
- ExpandMessageEditor,
- acp::{AcpThreadHistory, ThreadHistoryEvent},
+ ExpandMessageEditor, ThreadHistory, ThreadHistoryEvent,
text_thread_history::{TextThreadHistory, TextThreadHistoryEvent},
};
-use crate::{ManageProfiles, acp::thread_view::AcpThreadView};
+use crate::{ManageProfiles, connection_view::ThreadView};
use agent_settings::AgentSettings;
use ai_onboarding::AgentPanelOnboarding;
use anyhow::{Result, anyhow};
@@ -341,7 +339,7 @@ enum HistoryKind {
enum ActiveView {
Uninitialized,
AgentThread {
- server_view: Entity<AcpServerView>,
+ server_view: Entity<ConnectionView>,
},
TextThread {
text_thread_editor: Entity<TextThreadEditor>,
@@ -504,7 +502,7 @@ pub struct AgentPanel {
project: Entity<Project>,
fs: Arc<dyn Fs>,
language_registry: Arc<LanguageRegistry>,
- acp_history: Entity<AcpThreadHistory>,
+ acp_history: Entity<ThreadHistory>,
text_thread_history: Entity<TextThreadHistory>,
thread_store: Entity<ThreadStore>,
text_thread_store: Entity<assistant_text_thread::TextThreadStore>,
@@ -679,7 +677,7 @@ impl AgentPanel {
cx.new(|cx| ContextServerRegistry::new(project.read(cx).context_server_store(), cx));
let thread_store = ThreadStore::global(cx);
- let acp_history = cx.new(|cx| AcpThreadHistory::new(None, window, cx));
+ let acp_history = cx.new(|cx| ThreadHistory::new(None, window, cx));
let text_thread_history =
cx.new(|cx| TextThreadHistory::new(text_thread_store.clone(), window, cx));
cx.subscribe_in(
@@ -863,7 +861,7 @@ impl AgentPanel {
&self.thread_store
}
- pub fn history(&self) -> &Entity<AcpThreadHistory> {
+ pub fn history(&self) -> &Entity<ThreadHistory> {
&self.acp_history
}
@@ -903,7 +901,7 @@ impl AgentPanel {
.unwrap_or(false)
}
- pub(crate) fn active_thread_view(&self) -> Option<&Entity<AcpServerView>> {
+ pub(crate) fn active_thread_view(&self) -> Option<&Entity<ConnectionView>> {
match &self.active_view {
ActiveView::AgentThread { server_view, .. } => Some(server_view),
ActiveView::Uninitialized
@@ -1546,14 +1544,14 @@ impl AgentPanel {
}
}
- pub fn as_active_server_view(&self) -> Option<&Entity<AcpServerView>> {
+ pub fn as_active_server_view(&self) -> Option<&Entity<ConnectionView>> {
match &self.active_view {
ActiveView::AgentThread { server_view } => Some(server_view),
_ => None,
}
}
- pub fn as_active_thread_view(&self, cx: &App) -> Option<Entity<AcpThreadView>> {
+ pub fn as_active_thread_view(&self, cx: &App) -> Option<Entity<ThreadView>> {
let server_view = self.as_active_server_view()?;
server_view.read(cx).active_thread().cloned()
}
@@ -1855,7 +1853,7 @@ impl AgentPanel {
.then(|| self.thread_store.clone());
let server_view = cx.new(|cx| {
- crate::acp::AcpServerView::new(
+ crate::ConnectionView::new(
server,
resume_thread,
initial_content,
@@ -2128,7 +2126,7 @@ impl AgentPanel {
.into_any()
}
- fn handle_regenerate_thread_title(thread_view: Entity<AcpServerView>, cx: &mut App) {
+ fn handle_regenerate_thread_title(thread_view: Entity<ConnectionView>, cx: &mut App) {
thread_view.update(cx, |thread_view, cx| {
if let Some(thread) = thread_view.as_native_thread(cx) {
thread.update(cx, |thread, cx| {
@@ -3467,7 +3465,7 @@ impl AgentPanel {
///
/// This is a test-only accessor that exposes the private `active_thread_view()`
/// method for test assertions. Not compiled into production builds.
- pub fn active_thread_view_for_tests(&self) -> Option<&Entity<AcpServerView>> {
+ pub fn active_thread_view_for_tests(&self) -> Option<&Entity<ConnectionView>> {
self.active_thread_view()
}
}
@@ -3475,7 +3473,7 @@ impl AgentPanel {
#[cfg(test)]
mod tests {
use super::*;
- use crate::acp::thread_view::tests::{StubAgentServer, init_test};
+ use crate::connection_view::tests::{StubAgentServer, init_test};
use assistant_text_thread::TextThreadStore;
use feature_flags::FeatureFlagAppExt;
use fs::FakeFs;
@@ -1,4 +1,3 @@
-pub mod acp;
mod agent_configuration;
mod agent_diff;
mod agent_model_selector;
@@ -6,13 +5,20 @@ mod agent_panel;
mod agent_registry_ui;
mod buffer_codegen;
mod completion_provider;
+mod config_options;
+pub(crate) mod connection_view;
mod context;
mod context_server_configuration;
+mod entry_view_state;
mod favorite_models;
mod inline_assistant;
mod inline_prompt_editor;
mod language_model_selector;
mod mention_set;
+mod message_editor;
+mod mode_selector;
+mod model_selector;
+mod model_selector_popover;
mod profile_selector;
mod slash_command;
mod slash_command_picker;
@@ -20,6 +26,7 @@ mod terminal_codegen;
mod terminal_inline_assistant;
mod text_thread_editor;
mod text_thread_history;
+mod thread_history;
mod ui;
use std::rc::Rc;
@@ -52,7 +59,12 @@ pub use crate::agent_panel::{AgentPanel, AgentPanelEvent, ConcreteAssistantPanel
use crate::agent_registry_ui::AgentRegistryPage;
pub use crate::inline_assistant::InlineAssistant;
pub use agent_diff::{AgentDiffPane, AgentDiffToolbar};
+pub(crate) use connection_view::ConnectionView;
+pub(crate) use mode_selector::ModeSelector;
+pub(crate) use model_selector::ModelSelector;
+pub(crate) use model_selector_popover::ModelSelectorPopover;
pub use text_thread_editor::{AgentPanelDelegate, TextThreadEditor};
+pub(crate) use thread_history::*;
use zed_actions;
actions!(
@@ -4,7 +4,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
-use crate::acp::AcpThreadHistory;
+use crate::ThreadHistory;
use acp_thread::{AgentSessionInfo, MentionUri};
use anyhow::Result;
use editor::{
@@ -206,7 +206,7 @@ pub struct PromptCompletionProvider<T: PromptCompletionProviderDelegate> {
source: Arc<T>,
editor: WeakEntity<Editor>,
mention_set: Entity<MentionSet>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
workspace: WeakEntity<Workspace>,
}
@@ -216,7 +216,7 @@ impl<T: PromptCompletionProviderDelegate> PromptCompletionProvider<T> {
source: T,
editor: WeakEntity<Editor>,
mention_set: Entity<MentionSet>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
workspace: WeakEntity<Workspace>,
) -> Self {
@@ -62,12 +62,12 @@ use zed_actions::assistant::OpenRulesLibrary;
use super::config_options::ConfigOptionsView;
use super::entry_view_state::EntryViewState;
-use super::thread_history::AcpThreadHistory;
-use crate::acp::AcpModelSelectorPopover;
-use crate::acp::ModeSelector;
-use crate::acp::entry_view_state::{EntryViewEvent, ViewEvent};
-use crate::acp::message_editor::{MessageEditor, MessageEditorEvent};
+use super::thread_history::ThreadHistory;
+use crate::ModeSelector;
+use crate::ModelSelectorPopover;
use crate::agent_diff::AgentDiff;
+use crate::entry_view_state::{EntryViewEvent, ViewEvent};
+use crate::message_editor::{MessageEditor, MessageEditorEvent};
use crate::profile_selector::{ProfileProvider, ProfileSelector};
use crate::ui::{AgentNotification, AgentNotificationEvent};
use crate::{
@@ -82,8 +82,8 @@ use crate::{
const STOPWATCH_THRESHOLD: Duration = Duration::from_secs(30);
const TOKEN_THRESHOLD: u64 = 250;
-mod active_thread;
-pub use active_thread::*;
+mod thread_view;
+pub use thread_view::*;
pub struct QueuedMessage {
pub content: Vec<acp::ContentBlock>,
@@ -269,7 +269,7 @@ impl Conversation {
}
}
-pub struct AcpServerView {
+pub struct ConnectionView {
agent: Rc<dyn AgentServer>,
agent_server_store: Entity<AgentServerStore>,
workspace: WeakEntity<Workspace>,
@@ -277,7 +277,7 @@ pub struct AcpServerView {
thread_store: Option<Entity<ThreadStore>>,
prompt_store: Option<Entity<PromptStore>>,
server_state: ServerState,
- history: Entity<AcpThreadHistory>,
+ history: Entity<ThreadHistory>,
focus_handle: FocusHandle,
notifications: Vec<WindowHandle<AgentNotification>>,
notification_subscriptions: HashMap<WindowHandle<AgentNotification>, Vec<Subscription>>,
@@ -285,14 +285,14 @@ pub struct AcpServerView {
_subscriptions: Vec<Subscription>,
}
-impl AcpServerView {
+impl ConnectionView {
pub fn has_auth_methods(&self) -> bool {
self.as_connected().map_or(false, |connected| {
!connected.connection.auth_methods().is_empty()
})
}
- pub fn active_thread(&self) -> Option<&Entity<AcpThreadView>> {
+ pub fn active_thread(&self) -> Option<&Entity<ThreadView>> {
match &self.server_state {
ServerState::Connected(connected) => connected.active_view(),
_ => None,
@@ -310,7 +310,7 @@ impl AcpServerView {
.pending_tool_call(id, cx)
}
- pub fn parent_thread(&self, cx: &App) -> Option<Entity<AcpThreadView>> {
+ pub fn parent_thread(&self, cx: &App) -> Option<Entity<ThreadView>> {
match &self.server_state {
ServerState::Connected(connected) => {
let mut current = connected.active_view()?;
@@ -327,7 +327,7 @@ impl AcpServerView {
}
}
- pub fn thread_view(&self, session_id: &acp::SessionId) -> Option<Entity<AcpThreadView>> {
+ pub fn thread_view(&self, session_id: &acp::SessionId) -> Option<Entity<ThreadView>> {
let connected = self.as_connected()?;
connected.threads.get(session_id).cloned()
}
@@ -375,7 +375,7 @@ enum ServerState {
pub struct ConnectedServerState {
auth_state: AuthState,
active_id: Option<acp::SessionId>,
- threads: HashMap<acp::SessionId, Entity<AcpThreadView>>,
+ threads: HashMap<acp::SessionId, Entity<ThreadView>>,
connection: Rc<dyn AgentConnection>,
conversation: Entity<Conversation>,
}
@@ -403,7 +403,7 @@ struct LoadingView {
}
impl ConnectedServerState {
- pub fn active_view(&self) -> Option<&Entity<AcpThreadView>> {
+ pub fn active_view(&self) -> Option<&Entity<ThreadView>> {
self.active_id.as_ref().and_then(|id| self.threads.get(id))
}
@@ -430,7 +430,7 @@ impl ConnectedServerState {
}
}
-impl AcpServerView {
+impl ConnectionView {
pub fn new(
agent: Rc<dyn AgentServer>,
resume_thread: Option<AgentSessionInfo>,
@@ -439,7 +439,7 @@ impl AcpServerView {
project: Entity<Project>,
thread_store: Option<Entity<ThreadStore>>,
prompt_store: Option<Entity<PromptStore>>,
- history: Entity<AcpThreadHistory>,
+ history: Entity<ThreadHistory>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Self {
@@ -761,7 +761,7 @@ impl AcpServerView {
initial_content: Option<AgentInitialContent>,
window: &mut Window,
cx: &mut Context<Self>,
- ) -> Entity<AcpThreadView> {
+ ) -> Entity<ThreadView> {
let agent_name = self.agent.name();
let prompt_capabilities = Rc::new(RefCell::new(acp::PromptCapabilities::default()));
let available_commands = Rc::new(RefCell::new(vec![]));
@@ -833,7 +833,7 @@ impl AcpServerView {
let agent_server = self.agent.clone();
let fs = self.project.read(cx).fs().clone();
cx.new(|cx| {
- AcpModelSelectorPopover::new(
+ ModelSelectorPopover::new(
selector,
agent_server,
fs,
@@ -910,7 +910,7 @@ impl AcpServerView {
let weak = cx.weak_entity();
cx.new(|cx| {
- AcpThreadView::new(
+ ThreadView::new(
parent_id,
thread,
conversation,
@@ -2190,7 +2190,7 @@ impl AcpServerView {
fn render_markdown(&self, markdown: Entity<Markdown>, style: MarkdownStyle) -> MarkdownElement {
let workspace = self.workspace.clone();
MarkdownElement::new(markdown, style).on_url_click(move |text, window, cx| {
- crate::acp::thread_view::active_thread::open_link(text, &workspace, window, cx);
+ crate::connection_view::thread_view::open_link(text, &workspace, window, cx);
})
}
@@ -2513,7 +2513,7 @@ fn placeholder_text(agent_name: &str, has_commands: bool) -> String {
}
}
-impl Focusable for AcpServerView {
+impl Focusable for ConnectionView {
fn focus_handle(&self, cx: &App) -> FocusHandle {
match self.active_thread() {
Some(thread) => thread.read(cx).focus_handle(cx),
@@ -2523,7 +2523,7 @@ impl Focusable for AcpServerView {
}
#[cfg(any(test, feature = "test-support"))]
-impl AcpServerView {
+impl ConnectionView {
/// Expands a tool call so its content is visible.
/// This is primarily useful for visual testing.
pub fn expand_tool_call(&mut self, tool_call_id: acp::ToolCallId, cx: &mut Context<Self>) {
@@ -2536,7 +2536,7 @@ impl AcpServerView {
}
}
-impl Render for AcpServerView {
+impl Render for ConnectionView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
self.sync_queued_message_editors(window, cx);
@@ -2715,11 +2715,11 @@ pub(crate) mod tests {
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
// Create history without an initial session list - it will be set after connection
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::default_response()),
None,
None,
@@ -2787,11 +2787,11 @@ pub(crate) mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::new(ResumeOnlyAgentConnection)),
Some(session),
None,
@@ -2841,11 +2841,11 @@ pub(crate) mod tests {
session.cwd = Some(PathBuf::from("/project/subdir"));
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let _thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::new(connection)),
Some(session),
None,
@@ -2893,11 +2893,11 @@ pub(crate) mod tests {
session.cwd = Some(PathBuf::from("/some/other/path"));
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let _thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::new(connection)),
Some(session),
None,
@@ -2945,11 +2945,11 @@ pub(crate) mod tests {
session.cwd = Some(PathBuf::from("/project/../outside"));
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let _thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::new(connection)),
Some(session),
None,
@@ -3065,7 +3065,7 @@ pub(crate) mod tests {
);
});
- // Authenticate using the real authenticate flow on AcpServerView.
+ // Authenticate using the real authenticate flow on ConnectionView.
// This calls connection.authenticate(), which flips the internal flag,
// then on success triggers reset() -> new_session() which now succeeds.
thread_view.update_in(cx, |view, window, cx| {
@@ -3252,12 +3252,12 @@ pub(crate) mod tests {
// Set up thread view in workspace 1
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let agent = StubAgentServer::default_response();
let thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(agent),
None,
None,
@@ -3421,7 +3421,7 @@ pub(crate) mod tests {
async fn setup_thread_view(
agent: impl AgentServer + 'static,
cx: &mut TestAppContext,
- ) -> (Entity<AcpServerView>, &mut VisualTestContext) {
+ ) -> (Entity<ConnectionView>, &mut VisualTestContext) {
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, [], cx).await;
let (multi_workspace, cx) =
@@ -3429,11 +3429,11 @@ pub(crate) mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(agent),
None,
None,
@@ -3451,7 +3451,7 @@ pub(crate) mod tests {
(thread_view, cx)
}
- fn add_to_workspace(thread_view: Entity<AcpServerView>, cx: &mut VisualTestContext) {
+ fn add_to_workspace(thread_view: Entity<ConnectionView>, cx: &mut VisualTestContext) {
let workspace = thread_view.read_with(cx, |thread_view, _cx| thread_view.workspace.clone());
workspace
@@ -3467,7 +3467,7 @@ pub(crate) mod tests {
.unwrap();
}
- struct ThreadViewItem(Entity<AcpServerView>);
+ struct ThreadViewItem(Entity<ConnectionView>);
impl Item for ThreadViewItem {
type Event = ();
@@ -4030,9 +4030,9 @@ pub(crate) mod tests {
}
fn active_thread(
- thread_view: &Entity<AcpServerView>,
+ thread_view: &Entity<ConnectionView>,
cx: &TestAppContext,
- ) -> Entity<AcpThreadView> {
+ ) -> Entity<ThreadView> {
cx.read(|cx| {
thread_view
.read(cx)
@@ -4043,7 +4043,7 @@ pub(crate) mod tests {
}
fn message_editor(
- thread_view: &Entity<AcpServerView>,
+ thread_view: &Entity<ConnectionView>,
cx: &TestAppContext,
) -> Entity<MessageEditor> {
let thread = active_thread(thread_view, cx);
@@ -4069,12 +4069,12 @@ pub(crate) mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = cx.update(|_window, cx| cx.new(|cx| ThreadStore::new(cx)));
- let history = cx.update(|window, cx| cx.new(|cx| AcpThreadHistory::new(None, window, cx)));
+ let history = cx.update(|window, cx| cx.new(|cx| ThreadHistory::new(None, window, cx)));
let connection = Rc::new(StubAgentConnection::new());
let thread_view = cx.update(|window, cx| {
cx.new(|cx| {
- AcpServerView::new(
+ ConnectionView::new(
Rc::new(StubAgentServer::new(connection.as_ref().clone())),
None,
None,
@@ -4601,7 +4601,7 @@ pub(crate) mod tests {
}
struct GeneratingThreadSetup {
- thread_view: Entity<AcpServerView>,
+ thread_view: Entity<ConnectionView>,
thread: Entity<AcpThread>,
message_editor: Entity<MessageEditor>,
}
@@ -186,12 +186,12 @@ impl DiffStats {
}
}
-pub struct AcpThreadView {
+pub struct ThreadView {
pub id: acp::SessionId,
pub parent_id: Option<acp::SessionId>,
pub thread: Entity<AcpThread>,
pub(crate) conversation: Entity<super::Conversation>,
- pub server_view: WeakEntity<AcpServerView>,
+ pub server_view: WeakEntity<ConnectionView>,
pub agent_icon: IconName,
pub agent_name: SharedString,
pub focus_handle: FocusHandle,
@@ -200,7 +200,7 @@ pub struct AcpThreadView {
pub title_editor: Entity<Editor>,
pub config_options_view: Option<Entity<ConfigOptionsView>>,
pub mode_selector: Option<Entity<ModeSelector>>,
- pub model_selector: Option<Entity<AcpModelSelectorPopover>>,
+ pub model_selector: Option<Entity<ModelSelectorPopover>>,
pub profile_selector: Option<Entity<ProfileSelector>>,
pub permission_dropdown_handle: PopoverMenuHandle<ContextMenu>,
pub thread_retry_status: Option<RetryStatus>,
@@ -252,10 +252,10 @@ pub struct AcpThreadView {
pub recent_history_entries: Vec<AgentSessionInfo>,
pub hovered_recent_history_item: Option<usize>,
pub show_codex_windows_warning: bool,
- pub history: Entity<AcpThreadHistory>,
+ pub history: Entity<ThreadHistory>,
pub _history_subscription: Subscription,
}
-impl Focusable for AcpThreadView {
+impl Focusable for ThreadView {
fn focus_handle(&self, cx: &App) -> FocusHandle {
if self.parent_id.is_some() {
self.focus_handle.clone()
@@ -275,12 +275,12 @@ pub struct TurnFields {
pub turn_tokens: Option<u64>,
}
-impl AcpThreadView {
+impl ThreadView {
pub(crate) fn new(
parent_id: Option<acp::SessionId>,
thread: Entity<AcpThread>,
conversation: Entity<super::Conversation>,
- server_view: WeakEntity<AcpServerView>,
+ server_view: WeakEntity<ConnectionView>,
agent_icon: IconName,
agent_name: SharedString,
agent_display_name: SharedString,
@@ -288,7 +288,7 @@ impl AcpThreadView {
entry_view_state: Entity<EntryViewState>,
config_options_view: Option<Entity<ConfigOptionsView>>,
mode_selector: Option<Entity<ModeSelector>>,
- model_selector: Option<Entity<AcpModelSelectorPopover>>,
+ model_selector: Option<Entity<ModelSelectorPopover>>,
profile_selector: Option<Entity<ProfileSelector>>,
list_state: ListState,
prompt_capabilities: Rc<RefCell<PromptCapabilities>>,
@@ -297,7 +297,7 @@ impl AcpThreadView {
resume_thread_metadata: Option<AgentSessionInfo>,
project: WeakEntity<Project>,
thread_store: Option<Entity<ThreadStore>>,
- history: Entity<AcpThreadHistory>,
+ history: Entity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
initial_content: Option<AgentInitialContent>,
mut subscriptions: Vec<Subscription>,
@@ -671,7 +671,7 @@ impl AcpThreadView {
let agent_name = self.agent_name.clone();
let server_view = self.server_view.clone();
move |window, cx| {
- AcpServerView::handle_auth_required(
+ ConnectionView::handle_auth_required(
server_view.clone(),
AuthRequired::new(),
agent_name,
@@ -1504,7 +1504,7 @@ impl AcpThreadView {
pub fn sync_thread(
&mut self,
project: Entity<Project>,
- server_view: Entity<AcpServerView>,
+ server_view: Entity<ConnectionView>,
window: &mut Window,
cx: &mut Context<Self>,
) {
@@ -3429,7 +3429,7 @@ impl AcpThreadView {
}
}
-impl AcpThreadView {
+impl ThreadView {
pub(crate) fn render_entries(&mut self, cx: &mut Context<Self>) -> List {
list(
self.list_state.clone(),
@@ -6130,7 +6130,7 @@ impl AcpThreadView {
&self,
active_session_id: &acp::SessionId,
entry_ix: usize,
- thread_view: Option<&Entity<AcpThreadView>>,
+ thread_view: Option<&Entity<ThreadView>>,
tool_call: &ToolCall,
focus_handle: &FocusHandle,
window: &Window,
@@ -6400,7 +6400,7 @@ impl AcpThreadView {
&self,
active_session_id: &acp::SessionId,
entry_ix: usize,
- thread_view: &Entity<AcpThreadView>,
+ thread_view: &Entity<ThreadView>,
is_running: bool,
tool_call: &ToolCall,
focus_handle: &FocusHandle,
@@ -6734,7 +6734,7 @@ impl AcpThreadView {
}
let connection = this.thread.read(cx).connection().clone();
window.defer(cx, |window, cx| {
- AcpServerView::handle_auth_required(
+ ConnectionView::handle_auth_required(
server_view,
AuthRequired::new(),
agent_name,
@@ -6853,7 +6853,7 @@ impl AcpThreadView {
fn update_recent_history_from_cache(
&mut self,
- history: &Entity<AcpThreadHistory>,
+ history: &Entity<ThreadHistory>,
cx: &mut Context<Self>,
) {
self.recent_history_entries = history.read(cx).get_recent_sessions(3);
@@ -6926,7 +6926,7 @@ impl AcpThreadView {
// TODO: Add keyboard navigation.
let is_hovered =
self.hovered_recent_history_item == Some(index);
- crate::acp::thread_history::AcpHistoryEntryElement::new(
+ crate::thread_history::HistoryEntryElement::new(
entry,
self.server_view.clone(),
)
@@ -7148,7 +7148,7 @@ impl AcpThreadView {
}
}
-impl Render for AcpThreadView {
+impl Render for ThreadView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let has_messages = self.list_state.item_count() > 0;
@@ -1,6 +1,6 @@
use std::{cell::RefCell, ops::Range, rc::Rc};
-use super::thread_history::AcpThreadHistory;
+use super::thread_history::ThreadHistory;
use acp_thread::{AcpThread, AgentThreadEntry};
use agent::ThreadStore;
use agent_client_protocol::{self as acp, ToolCallId};
@@ -19,13 +19,13 @@ use theme::ThemeSettings;
use ui::{Context, TextSize};
use workspace::Workspace;
-use crate::acp::message_editor::{MessageEditor, MessageEditorEvent};
+use crate::message_editor::{MessageEditor, MessageEditorEvent};
pub struct EntryViewState {
workspace: WeakEntity<Workspace>,
project: WeakEntity<Project>,
thread_store: Option<Entity<ThreadStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
entries: Vec<Entry>,
prompt_capabilities: Rc<RefCell<acp::PromptCapabilities>>,
@@ -38,7 +38,7 @@ impl EntryViewState {
workspace: WeakEntity<Workspace>,
project: WeakEntity<Project>,
thread_store: Option<Entity<ThreadStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
prompt_capabilities: Rc<RefCell<acp::PromptCapabilities>>,
available_commands: Rc<RefCell<Vec<acp::AvailableCommand>>>,
@@ -412,7 +412,7 @@ mod tests {
use fs::FakeFs;
use gpui::{AppContext as _, TestAppContext};
- use crate::acp::entry_view_state::EntryViewState;
+ use crate::entry_view_state::EntryViewState;
use multi_buffer::MultiBufferRow;
use pretty_assertions::assert_matches;
use project::Project;
@@ -459,8 +459,8 @@ mod tests {
});
let thread_store = None;
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let view_state = cx.new(|_cx| {
EntryViewState::new(
@@ -7,7 +7,7 @@ use std::rc::Rc;
use std::sync::Arc;
use uuid::Uuid;
-use crate::acp::AcpThreadHistory;
+use crate::ThreadHistory;
use crate::context::load_context;
use crate::mention_set::MentionSet;
use crate::{
@@ -487,7 +487,7 @@ impl InlineAssistant {
project: WeakEntity<Project>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
initial_prompt: Option<String>,
window: &mut Window,
codegen_ranges: &[Range<Anchor>],
@@ -626,7 +626,7 @@ impl InlineAssistant {
project: WeakEntity<Project>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
initial_prompt: Option<String>,
window: &mut Window,
cx: &mut App,
@@ -671,7 +671,7 @@ impl InlineAssistant {
workspace: Entity<Workspace>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
window: &mut Window,
cx: &mut App,
) -> InlineAssistId {
@@ -2154,7 +2154,7 @@ pub mod test {
});
let thread_store = cx.new(|cx| ThreadStore::new(cx));
- let history = cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx));
+ let history = cx.new(|cx| crate::ThreadHistory::new(None, window, cx));
// Add editor to workspace
workspace.update(cx, |workspace, cx| {
@@ -1,4 +1,4 @@
-use crate::acp::AcpThreadHistory;
+use crate::ThreadHistory;
use agent::ThreadStore;
use agent_settings::AgentSettings;
use collections::{HashMap, VecDeque};
@@ -64,7 +64,7 @@ pub struct PromptEditor<T> {
pub editor: Entity<Editor>,
mode: PromptEditorMode,
mention_set: Entity<MentionSet>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
workspace: WeakEntity<Workspace>,
model_selector: Entity<AgentModelSelector>,
@@ -1225,7 +1225,7 @@ impl PromptEditor<BufferCodegen> {
fs: Arc<dyn Fs>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
project: WeakEntity<Project>,
workspace: WeakEntity<Workspace>,
window: &mut Window,
@@ -1384,7 +1384,7 @@ impl PromptEditor<TerminalCodegen> {
fs: Arc<dyn Fs>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
project: WeakEntity<Project>,
workspace: WeakEntity<Workspace>,
window: &mut Window,
@@ -1,5 +1,5 @@
use crate::SendImmediately;
-use crate::acp::AcpThreadHistory;
+use crate::ThreadHistory;
use crate::{
ChatWithFollow,
completion_provider::{
@@ -107,7 +107,7 @@ impl MessageEditor {
workspace: WeakEntity<Workspace>,
project: WeakEntity<Project>,
thread_store: Option<Entity<ThreadStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
prompt_store: Option<Entity<PromptStore>>,
prompt_capabilities: Rc<RefCell<acp::PromptCapabilities>>,
available_commands: Rc<RefCell<Vec<acp::AvailableCommand>>>,
@@ -1490,11 +1490,11 @@ mod tests {
use util::{path, paths::PathStyle, rel_path::rel_path};
use workspace::{AppState, Item, MultiWorkspace};
- use crate::acp::{
+ use crate::completion_provider::{PromptCompletionProviderDelegate, PromptContextType};
+ use crate::{
+ connection_view::tests::init_test,
message_editor::{Mention, MessageEditor, parse_mention_links},
- thread_view::tests::init_test,
};
- use crate::completion_provider::{PromptCompletionProviderDelegate, PromptContextType};
#[test]
fn test_parse_mention_links() {
@@ -1601,8 +1601,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = None;
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let message_editor = cx.update(|window, cx| {
cx.new(|cx| {
@@ -1715,8 +1715,8 @@ mod tests {
let (multi_workspace, cx) =
cx.add_window_view(|window, cx| MultiWorkspace::test_new(project.clone(), window, cx));
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let workspace_handle = workspace.downgrade();
let message_editor = workspace.update_in(cx, |_, window, cx| {
cx.new(|cx| {
@@ -1871,8 +1871,8 @@ mod tests {
let mut cx = VisualTestContext::from_window(window.into(), cx);
let thread_store = None;
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let prompt_capabilities = Rc::new(RefCell::new(acp::PromptCapabilities::default()));
let available_commands = Rc::new(RefCell::new(vec![
acp::AvailableCommand::new("quick-math", "2 + 2 = 4 - 1 = 3"),
@@ -2106,8 +2106,8 @@ mod tests {
}
let thread_store = cx.new(|cx| ThreadStore::new(cx));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let prompt_capabilities = Rc::new(RefCell::new(acp::PromptCapabilities::default()));
let (message_editor, editor) = workspace.update_in(&mut cx, |workspace, window, cx| {
@@ -2602,8 +2602,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let message_editor = cx.update(|window, cx| {
cx.new(|cx| {
@@ -2703,8 +2703,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
// Create a thread metadata to insert as summary
let thread_metadata = AgentSessionInfo {
@@ -2785,8 +2785,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = None;
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let thread_metadata = AgentSessionInfo {
session_id: acp::SessionId::new("thread-123"),
@@ -2845,8 +2845,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = None;
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let message_editor = cx.update(|window, cx| {
cx.new(|cx| {
@@ -2900,8 +2900,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let message_editor = cx.update(|window, cx| {
cx.new(|cx| {
@@ -2956,8 +2956,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let message_editor = cx.update(|window, cx| {
cx.new(|cx| {
@@ -3021,8 +3021,8 @@ mod tests {
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let (message_editor, editor) = workspace.update_in(cx, |workspace, window, cx| {
let workspace_handle = cx.weak_entity();
@@ -3181,8 +3181,8 @@ mod tests {
});
let thread_store = Some(cx.new(|cx| ThreadStore::new(cx)));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
// Create a new `MessageEditor`. The `EditorMode::full()` has to be used
// to ensure we have a fixed viewport, so we can eventually actually
@@ -3302,8 +3302,8 @@ mod tests {
let mut cx = VisualTestContext::from_window(window.into(), cx);
let thread_store = cx.new(|cx| ThreadStore::new(cx));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let (message_editor, editor) = workspace.update_in(&mut cx, |workspace, window, cx| {
let workspace_handle = cx.weak_entity();
@@ -3385,8 +3385,8 @@ mod tests {
let mut cx = VisualTestContext::from_window(window.into(), cx);
let thread_store = cx.new(|cx| ThreadStore::new(cx));
- let history = cx
- .update(|window, cx| cx.new(|cx| crate::acp::AcpThreadHistory::new(None, window, cx)));
+ let history =
+ cx.update(|window, cx| cx.new(|cx| crate::ThreadHistory::new(None, window, cx)));
let (message_editor, editor) = workspace.update_in(&mut cx, |workspace, window, cx| {
let workspace_handle = cx.weak_entity();
@@ -23,7 +23,7 @@ use zed_actions::agent::OpenSettings;
use crate::ui::{HoldForDefault, ModelSelectorFooter, ModelSelectorHeader, ModelSelectorListItem};
-pub type AcpModelSelector = Picker<AcpModelPickerDelegate>;
+pub type ModelSelector = Picker<ModelPickerDelegate>;
pub fn acp_model_selector(
selector: Rc<dyn AgentModelSelector>,
@@ -31,26 +31,25 @@ pub fn acp_model_selector(
fs: Arc<dyn Fs>,
focus_handle: FocusHandle,
window: &mut Window,
- cx: &mut Context<AcpModelSelector>,
-) -> AcpModelSelector {
- let delegate =
- AcpModelPickerDelegate::new(selector, agent_server, fs, focus_handle, window, cx);
+ cx: &mut Context<ModelSelector>,
+) -> ModelSelector {
+ let delegate = ModelPickerDelegate::new(selector, agent_server, fs, focus_handle, window, cx);
Picker::list(delegate, window, cx)
.show_scrollbar(true)
.width(rems(20.))
.max_height(Some(rems(20.).into()))
}
-enum AcpModelPickerEntry {
+enum ModelPickerEntry {
Separator(SharedString),
Model(AgentModelInfo, bool),
}
-pub struct AcpModelPickerDelegate {
+pub struct ModelPickerDelegate {
selector: Rc<dyn AgentModelSelector>,
agent_server: Rc<dyn AgentServer>,
fs: Arc<dyn Fs>,
- filtered_entries: Vec<AcpModelPickerEntry>,
+ filtered_entries: Vec<ModelPickerEntry>,
models: Option<AgentModelList>,
selected_index: usize,
selected_description: Option<(usize, SharedString, bool)>,
@@ -61,21 +60,21 @@ pub struct AcpModelPickerDelegate {
focus_handle: FocusHandle,
}
-impl AcpModelPickerDelegate {
+impl ModelPickerDelegate {
fn new(
selector: Rc<dyn AgentModelSelector>,
agent_server: Rc<dyn AgentServer>,
fs: Arc<dyn Fs>,
focus_handle: FocusHandle,
window: &mut Window,
- cx: &mut Context<AcpModelSelector>,
+ cx: &mut Context<ModelSelector>,
) -> Self {
let rx = selector.watch(cx);
let refresh_models_task = {
cx.spawn_in(window, {
async move |this, cx| {
async fn refresh(
- this: &WeakEntity<Picker<AcpModelPickerDelegate>>,
+ this: &WeakEntity<Picker<ModelPickerDelegate>>,
cx: &mut AsyncWindowContext,
) -> Result<()> {
let (models_task, selected_model_task) = this.update(cx, |this, cx| {
@@ -188,7 +187,7 @@ impl AcpModelPickerDelegate {
// Keep the picker selection aligned with the newly-selected model
if let Some(new_index) = self.filtered_entries.iter().position(|entry| {
- matches!(entry, AcpModelPickerEntry::Model(model_info, _) if self.selected_model.as_ref().is_some_and(|selected| model_info.id == selected.id))
+ matches!(entry, ModelPickerEntry::Model(model_info, _) if self.selected_model.as_ref().is_some_and(|selected| model_info.id == selected.id))
}) {
self.set_selected_index(new_index, window, cx);
} else {
@@ -197,7 +196,7 @@ impl AcpModelPickerDelegate {
}
}
-impl PickerDelegate for AcpModelPickerDelegate {
+impl PickerDelegate for ModelPickerDelegate {
type ListItem = AnyElement;
fn match_count(&self) -> usize {
@@ -220,8 +219,8 @@ impl PickerDelegate for AcpModelPickerDelegate {
_cx: &mut Context<Picker<Self>>,
) -> bool {
match self.filtered_entries.get(ix) {
- Some(AcpModelPickerEntry::Model(_, _)) => true,
- Some(AcpModelPickerEntry::Separator(_)) | None => false,
+ Some(ModelPickerEntry::Model(_, _)) => true,
+ Some(ModelPickerEntry::Separator(_)) | None => false,
}
}
@@ -261,7 +260,7 @@ impl PickerDelegate for AcpModelPickerDelegate {
.as_ref()
.and_then(|selected| {
this.delegate.filtered_entries.iter().position(|entry| {
- if let AcpModelPickerEntry::Model(model_info, _) = entry {
+ if let ModelPickerEntry::Model(model_info, _) = entry {
model_info.id == selected.id
} else {
false
@@ -277,7 +276,7 @@ impl PickerDelegate for AcpModelPickerDelegate {
}
fn confirm(&mut self, _secondary: bool, window: &mut Window, cx: &mut Context<Picker<Self>>) {
- if let Some(AcpModelPickerEntry::Model(model_info, _)) =
+ if let Some(ModelPickerEntry::Model(model_info, _)) =
self.filtered_entries.get(self.selected_index)
{
if window.modifiers().secondary() {
@@ -320,10 +319,10 @@ impl PickerDelegate for AcpModelPickerDelegate {
cx: &mut Context<Picker<Self>>,
) -> Option<Self::ListItem> {
match self.filtered_entries.get(ix)? {
- AcpModelPickerEntry::Separator(title) => {
+ ModelPickerEntry::Separator(title) => {
Some(ModelSelectorHeader::new(title, ix > 1).into_any_element())
}
- AcpModelPickerEntry::Model(model_info, is_favorite) => {
+ ModelPickerEntry::Model(model_info, is_favorite) => {
let is_selected = Some(model_info) == self.selected_model.as_ref();
let default_model = self.agent_server.default_model(cx);
let is_default = default_model.as_ref() == Some(&model_info.id);
@@ -434,7 +433,7 @@ impl PickerDelegate for AcpModelPickerDelegate {
fn info_list_to_picker_entries(
model_list: AgentModelList,
favorites: &HashSet<ModelId>,
-) -> Vec<AcpModelPickerEntry> {
+) -> Vec<ModelPickerEntry> {
let mut entries = Vec::new();
let all_models: Vec<_> = match &model_list {
@@ -450,28 +449,28 @@ fn info_list_to_picker_entries(
let has_favorites = !favorite_models.is_empty();
if has_favorites {
- entries.push(AcpModelPickerEntry::Separator("Favorite".into()));
+ entries.push(ModelPickerEntry::Separator("Favorite".into()));
for model in favorite_models {
- entries.push(AcpModelPickerEntry::Model((*model).clone(), true));
+ entries.push(ModelPickerEntry::Model((*model).clone(), true));
}
}
match model_list {
AgentModelList::Flat(list) => {
if has_favorites {
- entries.push(AcpModelPickerEntry::Separator("All".into()));
+ entries.push(ModelPickerEntry::Separator("All".into()));
}
for model in list {
let is_favorite = favorites.contains(&model.id);
- entries.push(AcpModelPickerEntry::Model(model, is_favorite));
+ entries.push(ModelPickerEntry::Model(model, is_favorite));
}
}
AgentModelList::Grouped(index_map) => {
for (group_name, models) in index_map {
- entries.push(AcpModelPickerEntry::Separator(group_name.0));
+ entries.push(ModelPickerEntry::Separator(group_name.0));
for model in models {
let is_favorite = favorites.contains(&model.id);
- entries.push(AcpModelPickerEntry::Model(model, is_favorite));
+ entries.push(ModelPickerEntry::Model(model, is_favorite));
}
}
}
@@ -608,22 +607,22 @@ mod tests {
.collect()
}
- fn get_entry_model_ids(entries: &[AcpModelPickerEntry]) -> Vec<&str> {
+ fn get_entry_model_ids(entries: &[ModelPickerEntry]) -> Vec<&str> {
entries
.iter()
.filter_map(|entry| match entry {
- AcpModelPickerEntry::Model(info, _) => Some(info.id.0.as_ref()),
+ ModelPickerEntry::Model(info, _) => Some(info.id.0.as_ref()),
_ => None,
})
.collect()
}
- fn get_entry_labels(entries: &[AcpModelPickerEntry]) -> Vec<&str> {
+ fn get_entry_labels(entries: &[ModelPickerEntry]) -> Vec<&str> {
entries
.iter()
.map(|entry| match entry {
- AcpModelPickerEntry::Model(info, _) => info.id.0.as_ref(),
- AcpModelPickerEntry::Separator(s) => &s,
+ ModelPickerEntry::Model(info, _) => info.id.0.as_ref(),
+ ModelPickerEntry::Separator(s) => &s,
})
.collect()
}
@@ -671,7 +670,7 @@ mod tests {
assert!(matches!(
entries.first(),
- Some(AcpModelPickerEntry::Separator(s)) if s == "Favorite"
+ Some(ModelPickerEntry::Separator(s)) if s == "Favorite"
));
let model_ids = get_entry_model_ids(&entries);
@@ -687,7 +686,7 @@ mod tests {
assert!(matches!(
entries.first(),
- Some(AcpModelPickerEntry::Separator(s)) if s == "zed"
+ Some(ModelPickerEntry::Separator(s)) if s == "zed"
));
}
@@ -702,7 +701,7 @@ mod tests {
let entries = info_list_to_picker_entries(models, &favorites);
for entry in &entries {
- if let AcpModelPickerEntry::Model(info, is_favorite) = entry {
+ if let ModelPickerEntry::Model(info, is_favorite) = entry {
if info.id.0.as_ref() == "zed/claude" {
assert!(is_favorite, "zed/claude should be a favorite");
} else {
@@ -789,12 +788,12 @@ mod tests {
assert!(matches!(
entries.first(),
- Some(AcpModelPickerEntry::Separator(s)) if s == "Favorite"
+ Some(ModelPickerEntry::Separator(s)) if s == "Favorite"
));
assert!(entries.iter().any(|e| matches!(
e,
- AcpModelPickerEntry::Separator(s) if s == "All"
+ ModelPickerEntry::Separator(s) if s == "All"
)));
}
@@ -838,7 +837,7 @@ mod tests {
let entries = info_list_to_picker_entries(models, &favorites);
for entry in &entries {
- if let AcpModelPickerEntry::Model(info, is_favorite) = entry {
+ if let ModelPickerEntry::Model(info, is_favorite) = entry {
if info.id.0.as_ref() == "favorite-model" {
assert!(*is_favorite, "favorite-model should have is_favorite=true");
} else if info.id.0.as_ref() == "regular-model" {
@@ -7,20 +7,20 @@ use gpui::{Entity, FocusHandle};
use picker::popover_menu::PickerPopoverMenu;
use ui::{ButtonLike, PopoverMenuHandle, TintColor, Tooltip, prelude::*};
-use crate::acp::{AcpModelSelector, model_selector::acp_model_selector};
use crate::ui::ModelSelectorTooltip;
+use crate::{ModelSelector, model_selector::acp_model_selector};
-pub struct AcpModelSelectorPopover {
- selector: Entity<AcpModelSelector>,
- menu_handle: PopoverMenuHandle<AcpModelSelector>,
+pub struct ModelSelectorPopover {
+ selector: Entity<ModelSelector>,
+ menu_handle: PopoverMenuHandle<ModelSelector>,
}
-impl AcpModelSelectorPopover {
+impl ModelSelectorPopover {
pub(crate) fn new(
selector: Rc<dyn AgentModelSelector>,
agent_server: Rc<dyn agent_servers::AgentServer>,
fs: Arc<dyn Fs>,
- menu_handle: PopoverMenuHandle<AcpModelSelector>,
+ menu_handle: PopoverMenuHandle<ModelSelector>,
focus_handle: FocusHandle,
window: &mut Window,
cx: &mut Context<Self>,
@@ -48,7 +48,7 @@ impl AcpModelSelectorPopover {
}
}
-impl Render for AcpModelSelectorPopover {
+impl Render for ModelSelectorPopover {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let selector = self.selector.read(cx);
let model = selector.delegate.active_model();
@@ -1,5 +1,5 @@
use crate::{
- acp::AcpThreadHistory,
+ ThreadHistory,
context::load_context,
inline_prompt_editor::{
CodegenStatus, PromptEditor, PromptEditorEvent, TerminalInlineAssistId,
@@ -64,7 +64,7 @@ impl TerminalInlineAssistant {
project: WeakEntity<Project>,
thread_store: Entity<ThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
- history: WeakEntity<AcpThreadHistory>,
+ history: WeakEntity<ThreadHistory>,
initial_prompt: Option<String>,
window: &mut Window,
cx: &mut App,
@@ -1495,7 +1495,7 @@ impl TextThreadEditor {
return;
};
- // Get buffer info for the delegate call (even if empty, AcpThreadView ignores these
+ // Get buffer info for the delegate call (even if empty, ThreadView ignores these
// params and calls insert_selections which handles both terminal and buffer)
if let Some((selections, buffer)) = maybe!({
let editor = workspace
@@ -1,4 +1,4 @@
-use crate::acp::AcpServerView;
+use crate::ConnectionView;
use crate::{AgentPanel, RemoveHistory, RemoveSelectedThread};
use acp_thread::{AgentSessionInfo, AgentSessionList, AgentSessionListRequest, SessionListUpdate};
use agent_client_protocol as acp;
@@ -27,7 +27,7 @@ fn thread_title(entry: &AgentSessionInfo) -> &SharedString {
.unwrap_or(DEFAULT_TITLE)
}
-pub struct AcpThreadHistory {
+pub struct ThreadHistory {
session_list: Option<Rc<dyn AgentSessionList>>,
sessions: Vec<AgentSessionInfo>,
scroll_handle: UniformListScrollHandle,
@@ -70,9 +70,9 @@ pub enum ThreadHistoryEvent {
Open(AgentSessionInfo),
}
-impl EventEmitter<ThreadHistoryEvent> for AcpThreadHistory {}
+impl EventEmitter<ThreadHistoryEvent> for ThreadHistory {}
-impl AcpThreadHistory {
+impl ThreadHistory {
pub fn new(
session_list: Option<Rc<dyn AgentSessionList>>,
window: &mut Window,
@@ -720,13 +720,13 @@ impl AcpThreadHistory {
}
}
-impl Focusable for AcpThreadHistory {
+impl Focusable for ThreadHistory {
fn focus_handle(&self, cx: &App) -> FocusHandle {
self.search_editor.focus_handle(cx)
}
}
-impl Render for AcpThreadHistory {
+impl Render for ThreadHistory {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let has_no_history = self.is_empty();
@@ -860,17 +860,17 @@ impl Render for AcpThreadHistory {
}
#[derive(IntoElement)]
-pub struct AcpHistoryEntryElement {
+pub struct HistoryEntryElement {
entry: AgentSessionInfo,
- thread_view: WeakEntity<AcpServerView>,
+ thread_view: WeakEntity<ConnectionView>,
selected: bool,
hovered: bool,
supports_delete: bool,
on_hover: Box<dyn Fn(&bool, &mut Window, &mut App) + 'static>,
}
-impl AcpHistoryEntryElement {
- pub fn new(entry: AgentSessionInfo, thread_view: WeakEntity<AcpServerView>) -> Self {
+impl HistoryEntryElement {
+ pub fn new(entry: AgentSessionInfo, thread_view: WeakEntity<ConnectionView>) -> Self {
Self {
entry,
thread_view,
@@ -897,7 +897,7 @@ impl AcpHistoryEntryElement {
}
}
-impl RenderOnce for AcpHistoryEntryElement {
+impl RenderOnce for HistoryEntryElement {
fn render(self, _window: &mut Window, _cx: &mut App) -> impl IntoElement {
let id = ElementId::Name(self.entry.session_id.0.clone().into());
let title = thread_title(&self.entry).clone();
@@ -1240,7 +1240,7 @@ mod tests {
));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1264,7 +1264,7 @@ mod tests {
));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
session_list.clear_requested_cursors();
@@ -1301,7 +1301,7 @@ mod tests {
));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1334,7 +1334,7 @@ mod tests {
));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1365,7 +1365,7 @@ mod tests {
));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1410,7 +1410,7 @@ mod tests {
);
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
session_list.clear_requested_cursors();
@@ -1442,7 +1442,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1478,7 +1478,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1511,7 +1511,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1547,7 +1547,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1587,7 +1587,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();
@@ -1624,7 +1624,7 @@ mod tests {
let session_list = Rc::new(TestSessionList::new(sessions));
let (history, cx) = cx.add_window_view(|window, cx| {
- AcpThreadHistory::new(Some(session_list.clone()), window, cx)
+ ThreadHistory::new(Some(session_list.clone()), window, cx)
});
cx.run_until_parked();