agent: Rename a number of constructs from Assistant to Agent (#30196)

This PR renames a number of constructs in the `agent` crate from the
"Assistant" terminology to "Agent".

Not comprehensive, but it's a start.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-07 21:18:51 -04:00 committed by GitHub
parent d6c7cdd60f
commit 6cc6e4d4b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 155 additions and 163 deletions

View file

@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
workspace = true workspace = true
[lib] [lib]
path = "src/assistant.rs" path = "src/agent.rs"
doctest = false doctest = false
[features] [features]

View file

@ -1,4 +1,4 @@
use crate::AssistantPanel; use crate::AgentPanel;
use crate::context::{AgentContextHandle, RULES_ICON}; use crate::context::{AgentContextHandle, RULES_ICON};
use crate::context_picker::{ContextPicker, MentionLink}; use crate::context_picker::{ContextPicker, MentionLink};
use crate::context_store::ContextStore; use crate::context_store::ContextStore;
@ -712,7 +712,7 @@ fn open_markdown_link(
.detach_and_log_err(cx); .detach_and_log_err(cx);
} }
Some(MentionLink::Thread(thread_id)) => workspace.update(cx, |workspace, cx| { Some(MentionLink::Thread(thread_id)) => workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel panel
.open_thread_by_id(&thread_id, window, cx) .open_thread_by_id(&thread_id, window, cx)
@ -721,7 +721,7 @@ fn open_markdown_link(
} }
}), }),
Some(MentionLink::TextThread(path)) => workspace.update(cx, |workspace, cx| { Some(MentionLink::TextThread(path)) => workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel panel
.open_saved_prompt_editor(path, window, cx) .open_saved_prompt_editor(path, window, cx)
@ -1211,8 +1211,7 @@ impl ActiveThread {
if let Some(workspace) = workspace_handle.upgrade() { if let Some(workspace) = workspace_handle.upgrade() {
workspace.update(_cx, |workspace, cx| { workspace.update(_cx, |workspace, cx| {
workspace workspace.focus_panel::<AgentPanel>(window, cx);
.focus_panel::<AssistantPanel>(window, cx);
}); });
} }
}) })
@ -3524,7 +3523,7 @@ pub(crate) fn open_context(
} }
AgentContextHandle::Thread(thread_context) => workspace.update(cx, |workspace, cx| { AgentContextHandle::Thread(thread_context) => workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.open_thread(thread_context.thread.clone(), window, cx); panel.open_thread(thread_context.thread.clone(), window, cx);
}); });
@ -3533,7 +3532,7 @@ pub(crate) fn open_context(
AgentContextHandle::TextThread(text_thread_context) => { AgentContextHandle::TextThread(text_thread_context) => {
workspace.update(cx, |workspace, cx| { workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.open_prompt_editor(text_thread_context.context.clone(), window, cx) panel.open_prompt_editor(text_thread_context.context.clone(), window, cx)
}); });

View file

@ -1,8 +1,8 @@
mod active_thread; mod active_thread;
mod agent_configuration;
mod agent_diff; mod agent_diff;
mod assistant_configuration; mod agent_model_selector;
mod assistant_model_selector; mod agent_panel;
mod assistant_panel;
mod buffer_codegen; mod buffer_codegen;
mod context; mod context;
mod context_picker; mod context_picker;
@ -43,8 +43,8 @@ use settings::{Settings as _, SettingsStore};
use thread::ThreadId; use thread::ThreadId;
pub use crate::active_thread::ActiveThread; pub use crate::active_thread::ActiveThread;
use crate::assistant_configuration::{AddContextServerModal, ManageProfilesModal}; use crate::agent_configuration::{AddContextServerModal, ManageProfilesModal};
pub use crate::assistant_panel::{AssistantPanel, ConcreteAssistantPanelDelegate}; pub use crate::agent_panel::{AgentPanel, ConcreteAssistantPanelDelegate};
pub use crate::context::{ContextLoadResult, LoadedContext}; pub use crate::context::{ContextLoadResult, LoadedContext};
pub use crate::inline_assistant::InlineAssistant; pub use crate::inline_assistant::InlineAssistant;
use crate::slash_command_settings::SlashCommandSettings; use crate::slash_command_settings::SlashCommandSettings;
@ -126,7 +126,7 @@ pub fn init(
init_language_model_settings(cx); init_language_model_settings(cx);
assistant_slash_command::init(cx); assistant_slash_command::init(cx);
thread_store::init(cx); thread_store::init(cx);
assistant_panel::init(cx); agent_panel::init(cx);
context_server_configuration::init(language_registry, cx); context_server_configuration::init(language_registry, cx);
register_slash_commands(cx); register_slash_commands(cx);

View file

@ -30,7 +30,7 @@ pub(crate) use manage_profiles_modal::ManageProfilesModal;
use crate::AddContextServer; use crate::AddContextServer;
pub struct AssistantConfiguration { pub struct AgentConfiguration {
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
focus_handle: FocusHandle, focus_handle: FocusHandle,
configuration_views_by_provider: HashMap<LanguageModelProviderId, AnyView>, configuration_views_by_provider: HashMap<LanguageModelProviderId, AnyView>,
@ -42,7 +42,7 @@ pub struct AssistantConfiguration {
scrollbar_state: ScrollbarState, scrollbar_state: ScrollbarState,
} }
impl AssistantConfiguration { impl AgentConfiguration {
pub fn new( pub fn new(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
context_server_store: Entity<ContextServerStore>, context_server_store: Entity<ContextServerStore>,
@ -110,7 +110,7 @@ impl AssistantConfiguration {
} }
} }
impl Focusable for AssistantConfiguration { impl Focusable for AgentConfiguration {
fn focus_handle(&self, _: &App) -> FocusHandle { fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus_handle.clone() self.focus_handle.clone()
} }
@ -120,9 +120,9 @@ pub enum AssistantConfigurationEvent {
NewThread(Arc<dyn LanguageModelProvider>), NewThread(Arc<dyn LanguageModelProvider>),
} }
impl EventEmitter<AssistantConfigurationEvent> for AssistantConfiguration {} impl EventEmitter<AssistantConfigurationEvent> for AgentConfiguration {}
impl AssistantConfiguration { impl AgentConfiguration {
fn render_provider_configuration_block( fn render_provider_configuration_block(
&mut self, &mut self,
provider: &Arc<dyn LanguageModelProvider>, provider: &Arc<dyn LanguageModelProvider>,
@ -571,7 +571,7 @@ impl AssistantConfiguration {
} }
} }
impl Render for AssistantConfiguration { impl Render for AgentConfiguration {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
v_flex() v_flex()
.id("assistant-configuration") .id("assistant-configuration")

View file

@ -18,9 +18,9 @@ use ui::{
use util::ResultExt as _; use util::ResultExt as _;
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
use crate::assistant_configuration::manage_profiles_modal::profile_modal_header::ProfileModalHeader; use crate::agent_configuration::manage_profiles_modal::profile_modal_header::ProfileModalHeader;
use crate::assistant_configuration::tool_picker::{ToolPicker, ToolPickerDelegate}; use crate::agent_configuration::tool_picker::{ToolPicker, ToolPickerDelegate};
use crate::{AssistantPanel, ManageProfiles, ThreadStore}; use crate::{AgentPanel, ManageProfiles, ThreadStore};
use super::tool_picker::ToolPickerMode; use super::tool_picker::ToolPickerMode;
@ -115,7 +115,7 @@ impl ManageProfilesModal {
_cx: &mut Context<Workspace>, _cx: &mut Context<Workspace>,
) { ) {
workspace.register_action(|workspace, action: &ManageProfiles, window, cx| { workspace.register_action(|workspace, action: &ManageProfiles, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
let fs = workspace.app_state().fs.clone(); let fs = workspace.app_state().fs.clone();
let thread_store = panel.read(cx).thread_store(); let thread_store = panel.read(cx).thread_store();
let tools = thread_store.read(cx).tools(); let tools = thread_store.read(cx).tools();

View file

@ -17,13 +17,13 @@ pub enum ModelType {
InlineAssistant, InlineAssistant,
} }
pub struct AssistantModelSelector { pub struct AgentModelSelector {
selector: Entity<LanguageModelSelector>, selector: Entity<LanguageModelSelector>,
menu_handle: PopoverMenuHandle<LanguageModelSelector>, menu_handle: PopoverMenuHandle<LanguageModelSelector>,
focus_handle: FocusHandle, focus_handle: FocusHandle,
} }
impl AssistantModelSelector { impl AgentModelSelector {
pub(crate) fn new( pub(crate) fn new(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
menu_handle: PopoverMenuHandle<LanguageModelSelector>, menu_handle: PopoverMenuHandle<LanguageModelSelector>,
@ -99,7 +99,7 @@ impl AssistantModelSelector {
} }
} }
impl Render for AssistantModelSelector { impl Render for AgentModelSelector {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let focus_handle = self.focus_handle.clone(); let focus_handle = self.focus_handle.clone();

View file

@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use anyhow::{Result, anyhow}; use anyhow::{Result, anyhow};
use assistant_context_editor::{ use assistant_context_editor::{
AssistantContext, AssistantPanelDelegate, ConfigurationError, ContextEditor, ContextEvent, AgentPanelDelegate, AssistantContext, ConfigurationError, ContextEditor, ContextEvent,
SlashCommandCompletionProvider, humanize_token_count, make_lsp_adapter_delegate, SlashCommandCompletionProvider, humanize_token_count, make_lsp_adapter_delegate,
render_remaining_tokens, render_remaining_tokens,
}; };
@ -53,8 +53,8 @@ use zed_actions::{DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFon
use zed_llm_client::UsageLimit; use zed_llm_client::UsageLimit;
use crate::active_thread::{self, ActiveThread, ActiveThreadEvent}; use crate::active_thread::{self, ActiveThread, ActiveThreadEvent};
use crate::agent_configuration::{AgentConfiguration, AssistantConfigurationEvent};
use crate::agent_diff::AgentDiff; use crate::agent_diff::AgentDiff;
use crate::assistant_configuration::{AssistantConfiguration, AssistantConfigurationEvent};
use crate::history_store::{HistoryEntry, HistoryStore, RecentEntry}; use crate::history_store::{HistoryEntry, HistoryStore, RecentEntry};
use crate::message_editor::{MessageEditor, MessageEditorEvent}; use crate::message_editor::{MessageEditor, MessageEditorEvent};
use crate::thread::{Thread, ThreadError, ThreadId, TokenUsageRatio}; use crate::thread::{Thread, ThreadError, ThreadId, TokenUsageRatio};
@ -71,7 +71,7 @@ use crate::{
const AGENT_PANEL_KEY: &str = "agent_panel"; const AGENT_PANEL_KEY: &str = "agent_panel";
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct SerializedAssistantPanel { struct SerializedAgentPanel {
width: Option<Pixels>, width: Option<Pixels>,
} }
@ -80,40 +80,40 @@ pub fn init(cx: &mut App) {
|workspace: &mut Workspace, _window, _cx: &mut Context<Workspace>| { |workspace: &mut Workspace, _window, _cx: &mut Context<Workspace>| {
workspace workspace
.register_action(|workspace, action: &NewThread, window, cx| { .register_action(|workspace, action: &NewThread, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| panel.new_thread(action, window, cx)); panel.update(cx, |panel, cx| panel.new_thread(action, window, cx));
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
} }
}) })
.register_action(|workspace, _: &OpenHistory, window, cx| { .register_action(|workspace, _: &OpenHistory, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.open_history(window, cx)); panel.update(cx, |panel, cx| panel.open_history(window, cx));
} }
}) })
.register_action(|workspace, _: &OpenConfiguration, window, cx| { .register_action(|workspace, _: &OpenConfiguration, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.open_configuration(window, cx)); panel.update(cx, |panel, cx| panel.open_configuration(window, cx));
} }
}) })
.register_action(|workspace, _: &NewTextThread, window, cx| { .register_action(|workspace, _: &NewTextThread, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.new_prompt_editor(window, cx)); panel.update(cx, |panel, cx| panel.new_prompt_editor(window, cx));
} }
}) })
.register_action(|workspace, action: &OpenRulesLibrary, window, cx| { .register_action(|workspace, action: &OpenRulesLibrary, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.deploy_rules_library(action, window, cx) panel.deploy_rules_library(action, window, cx)
}); });
} }
}) })
.register_action(|workspace, _: &OpenAgentDiff, window, cx| { .register_action(|workspace, _: &OpenAgentDiff, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
let thread = panel.read(cx).thread.read(cx).thread().clone(); let thread = panel.read(cx).thread.read(cx).thread().clone();
AgentDiffPane::deploy_in_workspace(thread, workspace, window, cx); AgentDiffPane::deploy_in_workspace(thread, workspace, window, cx);
} }
@ -122,8 +122,8 @@ pub fn init(cx: &mut App) {
workspace.follow(CollaboratorId::Agent, window, cx); workspace.follow(CollaboratorId::Agent, window, cx);
}) })
.register_action(|workspace, _: &ExpandMessageEditor, window, cx| { .register_action(|workspace, _: &ExpandMessageEditor, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.message_editor.update(cx, |editor, cx| { panel.message_editor.update(cx, |editor, cx| {
editor.expand_message_editor(&ExpandMessageEditor, window, cx); editor.expand_message_editor(&ExpandMessageEditor, window, cx);
@ -132,16 +132,16 @@ pub fn init(cx: &mut App) {
} }
}) })
.register_action(|workspace, _: &ToggleNavigationMenu, window, cx| { .register_action(|workspace, _: &ToggleNavigationMenu, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.toggle_navigation_menu(&ToggleNavigationMenu, window, cx); panel.toggle_navigation_menu(&ToggleNavigationMenu, window, cx);
}); });
} }
}) })
.register_action(|workspace, _: &ToggleOptionsMenu, window, cx| { .register_action(|workspace, _: &ToggleOptionsMenu, window, cx| {
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) { if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| { panel.update(cx, |panel, cx| {
panel.toggle_options_menu(&ToggleOptionsMenu, window, cx); panel.toggle_options_menu(&ToggleOptionsMenu, window, cx);
}); });
@ -335,7 +335,7 @@ impl ActiveView {
} }
} }
pub struct AssistantPanel { pub struct AgentPanel {
workspace: WeakEntity<Workspace>, workspace: WeakEntity<Workspace>,
user_store: Entity<UserStore>, user_store: Entity<UserStore>,
project: Entity<Project>, project: Entity<Project>,
@ -349,7 +349,7 @@ pub struct AssistantPanel {
context_store: Entity<TextThreadStore>, context_store: Entity<TextThreadStore>,
prompt_store: Option<Entity<PromptStore>>, prompt_store: Option<Entity<PromptStore>>,
inline_assist_context_store: Entity<crate::context_store::ContextStore>, inline_assist_context_store: Entity<crate::context_store::ContextStore>,
configuration: Option<Entity<AssistantConfiguration>>, configuration: Option<Entity<AgentConfiguration>>,
configuration_subscription: Option<Subscription>, configuration_subscription: Option<Subscription>,
local_timezone: UtcOffset, local_timezone: UtcOffset,
active_view: ActiveView, active_view: ActiveView,
@ -366,14 +366,14 @@ pub struct AssistantPanel {
_trial_markdown: Entity<Markdown>, _trial_markdown: Entity<Markdown>,
} }
impl AssistantPanel { impl AgentPanel {
fn serialize(&mut self, cx: &mut Context<Self>) { fn serialize(&mut self, cx: &mut Context<Self>) {
let width = self.width; let width = self.width;
self.pending_serialization = Some(cx.background_spawn(async move { self.pending_serialization = Some(cx.background_spawn(async move {
KEY_VALUE_STORE KEY_VALUE_STORE
.write_kvp( .write_kvp(
AGENT_PANEL_KEY.into(), AGENT_PANEL_KEY.into(),
serde_json::to_string(&SerializedAssistantPanel { width })?, serde_json::to_string(&SerializedAgentPanel { width })?,
) )
.await?; .await?;
anyhow::Ok(()) anyhow::Ok(())
@ -423,7 +423,7 @@ impl AssistantPanel {
.log_err() .log_err()
.flatten() .flatten()
{ {
Some(serde_json::from_str::<SerializedAssistantPanel>(&panel)?) Some(serde_json::from_str::<SerializedAgentPanel>(&panel)?)
} else { } else {
None None
}; };
@ -1163,15 +1163,13 @@ impl AssistantPanel {
self.set_active_view(ActiveView::Configuration, window, cx); self.set_active_view(ActiveView::Configuration, window, cx);
self.configuration = self.configuration =
Some(cx.new(|cx| { Some(cx.new(|cx| AgentConfiguration::new(fs, context_server_store, tools, window, cx)));
AssistantConfiguration::new(fs, context_server_store, tools, window, cx)
}));
if let Some(configuration) = self.configuration.as_ref() { if let Some(configuration) = self.configuration.as_ref() {
self.configuration_subscription = Some(cx.subscribe_in( self.configuration_subscription = Some(cx.subscribe_in(
configuration, configuration,
window, window,
Self::handle_assistant_configuration_event, Self::handle_agent_configuration_event,
)); ));
configuration.focus_handle(cx).focus(window); configuration.focus_handle(cx).focus(window);
@ -1201,9 +1199,9 @@ impl AssistantPanel {
.detach_and_log_err(cx); .detach_and_log_err(cx);
} }
fn handle_assistant_configuration_event( fn handle_agent_configuration_event(
&mut self, &mut self,
_entity: &Entity<AssistantConfiguration>, _entity: &Entity<AgentConfiguration>,
event: &AssistantConfigurationEvent, event: &AssistantConfigurationEvent,
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
@ -1316,7 +1314,7 @@ impl AssistantPanel {
} }
} }
impl Focusable for AssistantPanel { impl Focusable for AgentPanel {
fn focus_handle(&self, cx: &App) -> FocusHandle { fn focus_handle(&self, cx: &App) -> FocusHandle {
match &self.active_view { match &self.active_view {
ActiveView::Thread { .. } => self.message_editor.focus_handle(cx), ActiveView::Thread { .. } => self.message_editor.focus_handle(cx),
@ -1341,9 +1339,9 @@ fn agent_panel_dock_position(cx: &App) -> DockPosition {
} }
} }
impl EventEmitter<PanelEvent> for AssistantPanel {} impl EventEmitter<PanelEvent> for AgentPanel {}
impl Panel for AssistantPanel { impl Panel for AgentPanel {
fn persistent_name() -> &'static str { fn persistent_name() -> &'static str {
"AgentPanel" "AgentPanel"
} }
@ -1418,7 +1416,7 @@ impl Panel for AssistantPanel {
} }
} }
impl AssistantPanel { impl AgentPanel {
fn render_title_view(&self, _window: &mut Window, cx: &Context<Self>) -> AnyElement { fn render_title_view(&self, _window: &mut Window, cx: &Context<Self>) -> AnyElement {
const LOADING_SUMMARY_PLACEHOLDER: &str = "Loading Summary…"; const LOADING_SUMMARY_PLACEHOLDER: &str = "Loading Summary…";
@ -1977,9 +1975,9 @@ impl AssistantPanel {
.style(ButtonStyle::Transparent) .style(ButtonStyle::Transparent)
.color(Color::Muted) .color(Color::Muted)
.on_click({ .on_click({
let assistant_panel = cx.entity(); let agent_panel = cx.entity();
move |_, _, cx| { move |_, _, cx| {
assistant_panel.update( agent_panel.update(
cx, cx,
|this, cx| { |this, cx| {
let hidden = let hidden =
@ -2744,7 +2742,7 @@ impl AssistantPanel {
} }
} }
impl Render for AssistantPanel { impl Render for AgentPanel {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let content = match &self.active_view { let content = match &self.active_view {
ActiveView::Thread { .. } => v_flex() ActiveView::Thread { .. } => v_flex()
@ -2855,28 +2853,26 @@ impl rules_library::InlineAssistDelegate for PromptLibraryInlineAssist {
}) })
} }
fn focus_assistant_panel( fn focus_agent_panel(
&self, &self,
workspace: &mut Workspace, workspace: &mut Workspace,
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) -> bool { ) -> bool {
workspace workspace.focus_panel::<AgentPanel>(window, cx).is_some()
.focus_panel::<AssistantPanel>(window, cx)
.is_some()
} }
} }
pub struct ConcreteAssistantPanelDelegate; pub struct ConcreteAssistantPanelDelegate;
impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate { impl AgentPanelDelegate for ConcreteAssistantPanelDelegate {
fn active_context_editor( fn active_context_editor(
&self, &self,
workspace: &mut Workspace, workspace: &mut Workspace,
_window: &mut Window, _window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) -> Option<Entity<ContextEditor>> { ) -> Option<Entity<ContextEditor>> {
let panel = workspace.panel::<AssistantPanel>(cx)?; let panel = workspace.panel::<AgentPanel>(cx)?;
panel.read(cx).active_context_editor() panel.read(cx).active_context_editor()
} }
@ -2887,7 +2883,7 @@ impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) -> Task<Result<()>> { ) -> Task<Result<()>> {
let Some(panel) = workspace.panel::<AssistantPanel>(cx) else { let Some(panel) = workspace.panel::<AgentPanel>(cx) else {
return Task::ready(Err(anyhow!("Agent panel not found"))); return Task::ready(Err(anyhow!("Agent panel not found")));
}; };
@ -2914,12 +2910,12 @@ impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let Some(panel) = workspace.panel::<AssistantPanel>(cx) else { let Some(panel) = workspace.panel::<AgentPanel>(cx) else {
return; return;
}; };
if !panel.focus_handle(cx).contains_focused(window, cx) { if !panel.focus_handle(cx).contains_focused(window, cx) {
workspace.toggle_panel_focus::<AssistantPanel>(window, cx); workspace.toggle_panel_focus::<AgentPanel>(window, cx);
} }
panel.update(cx, |_, cx| { panel.update(cx, |_, cx| {

View file

@ -36,7 +36,7 @@ use ui::{
use uuid::Uuid; use uuid::Uuid;
use workspace::{Workspace, notifications::NotifyResultExt}; use workspace::{Workspace, notifications::NotifyResultExt};
use crate::AssistantPanel; use crate::AgentPanel;
use crate::context::RULES_ICON; use crate::context::RULES_ICON;
use crate::context_store::ContextStore; use crate::context_store::ContextStore;
use crate::thread::ThreadId; use crate::thread::ThreadId;
@ -648,7 +648,7 @@ fn recent_context_picker_entries(
let current_threads = context_store.read(cx).thread_ids(); let current_threads = context_store.read(cx).thread_ids();
let active_thread_id = workspace let active_thread_id = workspace
.panel::<AssistantPanel>(cx) .panel::<AgentPanel>(cx)
.and_then(|panel| Some(panel.read(cx).active_thread()?.read(cx).id())); .and_then(|panel| Some(panel.read(cx).active_thread()?.read(cx).id()));
if let Some((thread_store, text_thread_store)) = thread_store if let Some((thread_store, text_thread_store)) = thread_store

View file

@ -10,7 +10,7 @@ use ui::prelude::*;
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;
use crate::assistant_configuration::ConfigureContextServerModal; use crate::agent_configuration::ConfigureContextServerModal;
pub(crate) fn init(language_registry: Arc<LanguageRegistry>, cx: &mut App) { pub(crate) fn init(language_registry: Arc<LanguageRegistry>, cx: &mut App) {
cx.observe_new(move |_: &mut Workspace, window, cx| { cx.observe_new(move |_: &mut Workspace, window, cx| {

View file

@ -22,7 +22,7 @@ use crate::thread::Thread;
use crate::thread_store::{TextThreadStore, ThreadStore}; use crate::thread_store::{TextThreadStore, ThreadStore};
use crate::ui::{AddedContext, ContextPill}; use crate::ui::{AddedContext, ContextPill};
use crate::{ use crate::{
AcceptSuggestedContext, AssistantPanel, FocusDown, FocusLeft, FocusRight, FocusUp, AcceptSuggestedContext, AgentPanel, FocusDown, FocusLeft, FocusRight, FocusUp,
RemoveAllContext, RemoveFocusedContext, ToggleContextPicker, RemoveAllContext, RemoveFocusedContext, ToggleContextPicker,
}; };
@ -144,7 +144,7 @@ impl ContextStrip {
} }
let workspace = self.workspace.upgrade()?; let workspace = self.workspace.upgrade()?;
let panel = workspace.read(cx).panel::<AssistantPanel>(cx)?.read(cx); let panel = workspace.read(cx).panel::<AgentPanel>(cx)?.read(cx);
if let Some(active_thread) = panel.active_thread() { if let Some(active_thread) = panel.active_thread() {
let weak_active_thread = active_thread.downgrade(); let weak_active_thread = active_thread.downgrade();

View file

@ -43,7 +43,7 @@ use util::ResultExt;
use workspace::{ItemHandle, Toast, Workspace, dock::Panel, notifications::NotificationId}; use workspace::{ItemHandle, Toast, Workspace, dock::Panel, notifications::NotificationId};
use zed_actions::agent::OpenConfiguration; use zed_actions::agent::OpenConfiguration;
use crate::AssistantPanel; use crate::AgentPanel;
use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent}; use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent};
use crate::context_store::ContextStore; use crate::context_store::ContextStore;
use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent}; use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent};
@ -182,13 +182,12 @@ impl InlineAssistant {
if let Some(editor) = item.act_as::<Editor>(cx) { if let Some(editor) = item.act_as::<Editor>(cx) {
editor.update(cx, |editor, cx| { editor.update(cx, |editor, cx| {
if is_assistant2_enabled { if is_assistant2_enabled {
let panel = workspace.read(cx).panel::<AssistantPanel>(cx); let panel = workspace.read(cx).panel::<AgentPanel>(cx);
let thread_store = panel let thread_store = panel
.as_ref() .as_ref()
.map(|assistant_panel| assistant_panel.read(cx).thread_store().downgrade()); .map(|agent_panel| agent_panel.read(cx).thread_store().downgrade());
let text_thread_store = panel.map(|assistant_panel| { let text_thread_store = panel
assistant_panel.read(cx).text_thread_store().downgrade() .map(|agent_panel| agent_panel.read(cx).text_thread_store().downgrade());
});
editor.add_code_action_provider( editor.add_code_action_provider(
Rc::new(AssistantCodeActionProvider { Rc::new(AssistantCodeActionProvider {
@ -227,7 +226,7 @@ impl InlineAssistant {
let Some(inline_assist_target) = Self::resolve_inline_assist_target( let Some(inline_assist_target) = Self::resolve_inline_assist_target(
workspace, workspace,
workspace.panel::<AssistantPanel>(cx), workspace.panel::<AgentPanel>(cx),
window, window,
cx, cx,
) else { ) else {
@ -240,15 +239,15 @@ impl InlineAssistant {
.map_or(false, |model| model.provider.is_authenticated(cx)) .map_or(false, |model| model.provider.is_authenticated(cx))
}; };
let Some(assistant_panel) = workspace.panel::<AssistantPanel>(cx) else { let Some(agent_panel) = workspace.panel::<AgentPanel>(cx) else {
return; return;
}; };
let assistant_panel = assistant_panel.read(cx); let agent_panel = agent_panel.read(cx);
let prompt_store = assistant_panel.prompt_store().as_ref().cloned(); let prompt_store = agent_panel.prompt_store().as_ref().cloned();
let thread_store = Some(assistant_panel.thread_store().downgrade()); let thread_store = Some(agent_panel.thread_store().downgrade());
let text_thread_store = Some(assistant_panel.text_thread_store().downgrade()); let text_thread_store = Some(agent_panel.text_thread_store().downgrade());
let context_store = assistant_panel.inline_assist_context_store().clone(); let context_store = agent_panel.inline_assist_context_store().clone();
let handle_assist = let handle_assist =
|window: &mut Window, cx: &mut Context<Workspace>| match inline_assist_target { |window: &mut Window, cx: &mut Context<Workspace>| match inline_assist_target {
@ -1454,7 +1453,7 @@ impl InlineAssistant {
fn resolve_inline_assist_target( fn resolve_inline_assist_target(
workspace: &mut Workspace, workspace: &mut Workspace,
assistant_panel: Option<Entity<AssistantPanel>>, agent_panel: Option<Entity<AgentPanel>>,
window: &mut Window, window: &mut Window,
cx: &mut App, cx: &mut App,
) -> Option<InlineAssistTarget> { ) -> Option<InlineAssistTarget> {
@ -1474,7 +1473,7 @@ impl InlineAssistant {
} }
} }
let context_editor = assistant_panel let context_editor = agent_panel
.and_then(|panel| panel.read(cx).active_context_editor()) .and_then(|panel| panel.read(cx).active_context_editor())
.and_then(|editor| { .and_then(|editor| {
let editor = &editor.read(cx).editor().clone(); let editor = &editor.read(cx).editor().clone();

View file

@ -1,4 +1,4 @@
use crate::assistant_model_selector::{AssistantModelSelector, ModelType}; use crate::agent_model_selector::{AgentModelSelector, ModelType};
use crate::buffer_codegen::BufferCodegen; use crate::buffer_codegen::BufferCodegen;
use crate::context::ContextCreasesAddon; use crate::context::ContextCreasesAddon;
use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider}; use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider};
@ -42,7 +42,7 @@ pub struct PromptEditor<T> {
context_store: Entity<ContextStore>, context_store: Entity<ContextStore>,
context_strip: Entity<ContextStrip>, context_strip: Entity<ContextStrip>,
context_picker_menu_handle: PopoverMenuHandle<ContextPicker>, context_picker_menu_handle: PopoverMenuHandle<ContextPicker>,
model_selector: Entity<AssistantModelSelector>, model_selector: Entity<AgentModelSelector>,
edited_since_done: bool, edited_since_done: bool,
prompt_history: VecDeque<String>, prompt_history: VecDeque<String>,
prompt_history_ix: Option<usize>, prompt_history_ix: Option<usize>,
@ -290,12 +290,12 @@ impl<T: 'static> PromptEditor<T> {
PromptEditorMode::Terminal { .. } => "Generate", PromptEditorMode::Terminal { .. } => "Generate",
}; };
let assistant_panel_keybinding = let agent_panel_keybinding =
ui::text_for_action(&zed_actions::assistant::ToggleFocus, window, cx) ui::text_for_action(&zed_actions::assistant::ToggleFocus, window, cx)
.map(|keybinding| format!("{keybinding} to chat ― ")) .map(|keybinding| format!("{keybinding} to chat ― "))
.unwrap_or_default(); .unwrap_or_default();
format!("{action}… ({assistant_panel_keybinding}↓↑ for history)") format!("{action}… ({agent_panel_keybinding}↓↑ for history)")
} }
pub fn prompt(&self, cx: &App) -> String { pub fn prompt(&self, cx: &App) -> String {
@ -927,7 +927,7 @@ impl PromptEditor<BufferCodegen> {
context_strip, context_strip,
context_picker_menu_handle, context_picker_menu_handle,
model_selector: cx.new(|cx| { model_selector: cx.new(|cx| {
AssistantModelSelector::new( AgentModelSelector::new(
fs, fs,
model_selector_menu_handle, model_selector_menu_handle,
prompt_editor.focus_handle(cx), prompt_editor.focus_handle(cx),
@ -1098,7 +1098,7 @@ impl PromptEditor<TerminalCodegen> {
context_strip, context_strip,
context_picker_menu_handle, context_picker_menu_handle,
model_selector: cx.new(|cx| { model_selector: cx.new(|cx| {
AssistantModelSelector::new( AgentModelSelector::new(
fs, fs,
model_selector_menu_handle.clone(), model_selector_menu_handle.clone(),
prompt_editor.focus_handle(cx), prompt_editor.focus_handle(cx),

View file

@ -1,7 +1,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::Arc; use std::sync::Arc;
use crate::assistant_model_selector::{AssistantModelSelector, ModelType}; use crate::agent_model_selector::{AgentModelSelector, ModelType};
use crate::context::{AgentContextKey, ContextCreasesAddon, ContextLoadResult, load_context}; use crate::context::{AgentContextKey, ContextCreasesAddon, ContextLoadResult, load_context};
use crate::tool_compatibility::{IncompatibleToolsState, IncompatibleToolsTooltip}; use crate::tool_compatibility::{IncompatibleToolsState, IncompatibleToolsTooltip};
use crate::ui::{ use crate::ui::{
@ -65,7 +65,7 @@ pub struct MessageEditor {
prompt_store: Option<Entity<PromptStore>>, prompt_store: Option<Entity<PromptStore>>,
context_strip: Entity<ContextStrip>, context_strip: Entity<ContextStrip>,
context_picker_menu_handle: PopoverMenuHandle<ContextPicker>, context_picker_menu_handle: PopoverMenuHandle<ContextPicker>,
model_selector: Entity<AssistantModelSelector>, model_selector: Entity<AgentModelSelector>,
last_loaded_context: Option<ContextLoadResult>, last_loaded_context: Option<ContextLoadResult>,
load_context_task: Option<Shared<Task<()>>>, load_context_task: Option<Shared<Task<()>>>,
profile_selector: Entity<ProfileSelector>, profile_selector: Entity<ProfileSelector>,
@ -189,7 +189,7 @@ impl MessageEditor {
]; ];
let model_selector = cx.new(|cx| { let model_selector = cx.new(|cx| {
AssistantModelSelector::new( AgentModelSelector::new(
fs.clone(), fs.clone(),
model_selector_menu_handle, model_selector_menu_handle,
editor.focus_handle(cx), editor.focus_handle(cx),

View file

@ -19,10 +19,10 @@ use util::ResultExt;
use crate::history_store::{HistoryEntry, HistoryStore}; use crate::history_store::{HistoryEntry, HistoryStore};
use crate::thread_store::SerializedThreadMetadata; use crate::thread_store::SerializedThreadMetadata;
use crate::{AssistantPanel, RemoveSelectedThread}; use crate::{AgentPanel, RemoveSelectedThread};
pub struct ThreadHistory { pub struct ThreadHistory {
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
history_store: Entity<HistoryStore>, history_store: Entity<HistoryStore>,
scroll_handle: UniformListScrollHandle, scroll_handle: UniformListScrollHandle,
selected_index: usize, selected_index: usize,
@ -69,7 +69,7 @@ impl HistoryListItem {
impl ThreadHistory { impl ThreadHistory {
pub(crate) fn new( pub(crate) fn new(
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
history_store: Entity<HistoryStore>, history_store: Entity<HistoryStore>,
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
@ -96,7 +96,7 @@ impl ThreadHistory {
let scrollbar_state = ScrollbarState::new(scroll_handle.clone()); let scrollbar_state = ScrollbarState::new(scroll_handle.clone());
let mut this = Self { let mut this = Self {
assistant_panel, agent_panel,
history_store, history_store,
scroll_handle, scroll_handle,
selected_index: 0, selected_index: 0,
@ -380,14 +380,12 @@ impl ThreadHistory {
fn confirm(&mut self, _: &menu::Confirm, window: &mut Window, cx: &mut Context<Self>) { fn confirm(&mut self, _: &menu::Confirm, window: &mut Window, cx: &mut Context<Self>) {
if let Some(entry) = self.get_match(self.selected_index) { if let Some(entry) = self.get_match(self.selected_index) {
let task_result = match entry { let task_result = match entry {
HistoryEntry::Thread(thread) => self.assistant_panel.update(cx, move |this, cx| { HistoryEntry::Thread(thread) => self.agent_panel.update(cx, move |this, cx| {
this.open_thread_by_id(&thread.id, window, cx) this.open_thread_by_id(&thread.id, window, cx)
}), }),
HistoryEntry::Context(context) => { HistoryEntry::Context(context) => self.agent_panel.update(cx, move |this, cx| {
self.assistant_panel.update(cx, move |this, cx| { this.open_saved_prompt_editor(context.path.clone(), window, cx)
this.open_saved_prompt_editor(context.path.clone(), window, cx) }),
})
}
}; };
if let Some(task) = task_result.log_err() { if let Some(task) = task_result.log_err() {
@ -407,10 +405,10 @@ impl ThreadHistory {
if let Some(entry) = self.get_match(self.selected_index) { if let Some(entry) = self.get_match(self.selected_index) {
let task_result = match entry { let task_result = match entry {
HistoryEntry::Thread(thread) => self HistoryEntry::Thread(thread) => self
.assistant_panel .agent_panel
.update(cx, |this, cx| this.delete_thread(&thread.id, cx)), .update(cx, |this, cx| this.delete_thread(&thread.id, cx)),
HistoryEntry::Context(context) => self HistoryEntry::Context(context) => self
.assistant_panel .agent_panel
.update(cx, |this, cx| this.delete_context(context.path.clone(), cx)), .update(cx, |this, cx| this.delete_context(context.path.clone(), cx)),
}; };
@ -506,7 +504,7 @@ impl ThreadHistory {
match entry { match entry {
HistoryEntry::Thread(thread) => PastThread::new( HistoryEntry::Thread(thread) => PastThread::new(
thread.clone(), thread.clone(),
self.assistant_panel.clone(), self.agent_panel.clone(),
is_active, is_active,
highlight_positions, highlight_positions,
format, format,
@ -514,7 +512,7 @@ impl ThreadHistory {
.into_any_element(), .into_any_element(),
HistoryEntry::Context(context) => PastContext::new( HistoryEntry::Context(context) => PastContext::new(
context.clone(), context.clone(),
self.assistant_panel.clone(), self.agent_panel.clone(),
is_active, is_active,
highlight_positions, highlight_positions,
format, format,
@ -605,7 +603,7 @@ impl Render for ThreadHistory {
#[derive(IntoElement)] #[derive(IntoElement)]
pub struct PastThread { pub struct PastThread {
thread: SerializedThreadMetadata, thread: SerializedThreadMetadata,
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
selected: bool, selected: bool,
highlight_positions: Vec<usize>, highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat, timestamp_format: EntryTimeFormat,
@ -614,14 +612,14 @@ pub struct PastThread {
impl PastThread { impl PastThread {
pub fn new( pub fn new(
thread: SerializedThreadMetadata, thread: SerializedThreadMetadata,
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
selected: bool, selected: bool,
highlight_positions: Vec<usize>, highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat, timestamp_format: EntryTimeFormat,
) -> Self { ) -> Self {
Self { Self {
thread, thread,
assistant_panel, agent_panel,
selected, selected,
highlight_positions, highlight_positions,
timestamp_format, timestamp_format,
@ -634,7 +632,7 @@ impl RenderOnce for PastThread {
let summary = self.thread.summary; let summary = self.thread.summary;
let thread_timestamp = self.timestamp_format.format_timestamp( let thread_timestamp = self.timestamp_format.format_timestamp(
&self.assistant_panel, &self.agent_panel,
self.thread.updated_at.timestamp(), self.thread.updated_at.timestamp(),
cx, cx,
); );
@ -667,10 +665,10 @@ impl RenderOnce for PastThread {
Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx) Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx)
}) })
.on_click({ .on_click({
let assistant_panel = self.assistant_panel.clone(); let agent_panel = self.agent_panel.clone();
let id = self.thread.id.clone(); let id = self.thread.id.clone();
move |_event, _window, cx| { move |_event, _window, cx| {
assistant_panel agent_panel
.update(cx, |this, cx| { .update(cx, |this, cx| {
this.delete_thread(&id, cx).detach_and_log_err(cx); this.delete_thread(&id, cx).detach_and_log_err(cx);
}) })
@ -680,10 +678,10 @@ impl RenderOnce for PastThread {
), ),
) )
.on_click({ .on_click({
let assistant_panel = self.assistant_panel.clone(); let agent_panel = self.agent_panel.clone();
let id = self.thread.id.clone(); let id = self.thread.id.clone();
move |_event, window, cx| { move |_event, window, cx| {
assistant_panel agent_panel
.update(cx, |this, cx| { .update(cx, |this, cx| {
this.open_thread_by_id(&id, window, cx) this.open_thread_by_id(&id, window, cx)
.detach_and_log_err(cx); .detach_and_log_err(cx);
@ -697,7 +695,7 @@ impl RenderOnce for PastThread {
#[derive(IntoElement)] #[derive(IntoElement)]
pub struct PastContext { pub struct PastContext {
context: SavedContextMetadata, context: SavedContextMetadata,
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
selected: bool, selected: bool,
highlight_positions: Vec<usize>, highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat, timestamp_format: EntryTimeFormat,
@ -706,14 +704,14 @@ pub struct PastContext {
impl PastContext { impl PastContext {
pub fn new( pub fn new(
context: SavedContextMetadata, context: SavedContextMetadata,
assistant_panel: WeakEntity<AssistantPanel>, agent_panel: WeakEntity<AgentPanel>,
selected: bool, selected: bool,
highlight_positions: Vec<usize>, highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat, timestamp_format: EntryTimeFormat,
) -> Self { ) -> Self {
Self { Self {
context, context,
assistant_panel, agent_panel,
selected, selected,
highlight_positions, highlight_positions,
timestamp_format, timestamp_format,
@ -725,7 +723,7 @@ impl RenderOnce for PastContext {
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement { fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
let summary = self.context.title; let summary = self.context.title;
let context_timestamp = self.timestamp_format.format_timestamp( let context_timestamp = self.timestamp_format.format_timestamp(
&self.assistant_panel, &self.agent_panel,
self.context.mtime.timestamp(), self.context.mtime.timestamp(),
cx, cx,
); );
@ -760,10 +758,10 @@ impl RenderOnce for PastContext {
Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx) Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx)
}) })
.on_click({ .on_click({
let assistant_panel = self.assistant_panel.clone(); let agent_panel = self.agent_panel.clone();
let path = self.context.path.clone(); let path = self.context.path.clone();
move |_event, _window, cx| { move |_event, _window, cx| {
assistant_panel agent_panel
.update(cx, |this, cx| { .update(cx, |this, cx| {
this.delete_context(path.clone(), cx) this.delete_context(path.clone(), cx)
.detach_and_log_err(cx); .detach_and_log_err(cx);
@ -774,10 +772,10 @@ impl RenderOnce for PastContext {
), ),
) )
.on_click({ .on_click({
let assistant_panel = self.assistant_panel.clone(); let agent_panel = self.agent_panel.clone();
let path = self.context.path.clone(); let path = self.context.path.clone();
move |_event, window, cx| { move |_event, window, cx| {
assistant_panel agent_panel
.update(cx, |this, cx| { .update(cx, |this, cx| {
this.open_saved_prompt_editor(path.clone(), window, cx) this.open_saved_prompt_editor(path.clone(), window, cx)
.detach_and_log_err(cx); .detach_and_log_err(cx);
@ -797,12 +795,12 @@ pub enum EntryTimeFormat {
impl EntryTimeFormat { impl EntryTimeFormat {
fn format_timestamp( fn format_timestamp(
&self, &self,
assistant_panel: &WeakEntity<AssistantPanel>, agent_panel: &WeakEntity<AgentPanel>,
timestamp: i64, timestamp: i64,
cx: &App, cx: &App,
) -> String { ) -> String {
let timestamp = OffsetDateTime::from_unix_timestamp(timestamp).unwrap(); let timestamp = OffsetDateTime::from_unix_timestamp(timestamp).unwrap();
let timezone = assistant_panel let timezone = agent_panel
.read_with(cx, |this, _cx| this.local_timezone()) .read_with(cx, |this, _cx| this.local_timezone())
.unwrap_or(UtcOffset::UTC); .unwrap_or(UtcOffset::UTC);

View file

@ -4,7 +4,7 @@ use gpui::{
use ui::{TintColor, Vector, VectorName, prelude::*}; use ui::{TintColor, Vector, VectorName, prelude::*};
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
use crate::assistant_panel::AssistantPanel; use crate::agent_panel::AgentPanel;
macro_rules! agent_onboarding_event { macro_rules! agent_onboarding_event {
($name:expr) => { ($name:expr) => {
@ -31,7 +31,7 @@ impl AgentOnboardingModal {
fn open_panel(&mut self, _: &ClickEvent, window: &mut Window, cx: &mut Context<Self>) { fn open_panel(&mut self, _: &ClickEvent, window: &mut Window, cx: &mut Context<Self>) {
self.workspace.update(cx, |workspace, cx| { self.workspace.update(cx, |workspace, cx| {
workspace.focus_panel::<AssistantPanel>(window, cx); workspace.focus_panel::<AgentPanel>(window, cx);
}); });
cx.emit(DismissEvent); cx.emit(DismissEvent);

View file

@ -137,7 +137,7 @@ pub enum ThoughtProcessStatus {
Completed, Completed,
} }
pub trait AssistantPanelDelegate { pub trait AgentPanelDelegate {
fn active_context_editor( fn active_context_editor(
&self, &self,
workspace: &mut Workspace, workspace: &mut Workspace,
@ -171,7 +171,7 @@ pub trait AssistantPanelDelegate {
); );
} }
impl dyn AssistantPanelDelegate { impl dyn AgentPanelDelegate {
/// Returns the global [`AssistantPanelDelegate`], if it exists. /// Returns the global [`AssistantPanelDelegate`], if it exists.
pub fn try_global(cx: &App) -> Option<Arc<Self>> { pub fn try_global(cx: &App) -> Option<Arc<Self>> {
cx.try_global::<GlobalAssistantPanelDelegate>() cx.try_global::<GlobalAssistantPanelDelegate>()
@ -184,7 +184,7 @@ impl dyn AssistantPanelDelegate {
} }
} }
struct GlobalAssistantPanelDelegate(Arc<dyn AssistantPanelDelegate>); struct GlobalAssistantPanelDelegate(Arc<dyn AgentPanelDelegate>);
impl Global for GlobalAssistantPanelDelegate {} impl Global for GlobalAssistantPanelDelegate {}
@ -1666,11 +1666,11 @@ impl ContextEditor {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else { let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return; return;
}; };
let Some(context_editor_view) = let Some(context_editor_view) =
assistant_panel_delegate.active_context_editor(workspace, window, cx) agent_panel_delegate.active_context_editor(workspace, window, cx)
else { else {
return; return;
}; };
@ -1696,9 +1696,9 @@ impl ContextEditor {
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let result = maybe!({ let result = maybe!({
let assistant_panel_delegate = <dyn AssistantPanelDelegate>::try_global(cx)?; let agent_panel_delegate = <dyn AgentPanelDelegate>::try_global(cx)?;
let context_editor_view = let context_editor_view =
assistant_panel_delegate.active_context_editor(workspace, window, cx)?; agent_panel_delegate.active_context_editor(workspace, window, cx)?;
Self::get_selection_or_code_block(&context_editor_view, cx) Self::get_selection_or_code_block(&context_editor_view, cx)
}); });
let Some((text, is_code_block)) = result else { let Some((text, is_code_block)) = result else {
@ -1731,11 +1731,11 @@ impl ContextEditor {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else { let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return; return;
}; };
let Some(context_editor_view) = let Some(context_editor_view) =
assistant_panel_delegate.active_context_editor(workspace, window, cx) agent_panel_delegate.active_context_editor(workspace, window, cx)
else { else {
return; return;
}; };
@ -1821,7 +1821,7 @@ impl ContextEditor {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else { let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return; return;
}; };
@ -1852,7 +1852,7 @@ impl ContextEditor {
return; return;
} }
assistant_panel_delegate.quote_selection(workspace, selections, buffer, window, cx); agent_panel_delegate.quote_selection(workspace, selections, buffer, window, cx);
} }
pub fn quote_ranges( pub fn quote_ranges(
@ -3361,10 +3361,10 @@ impl FollowableItem for ContextEditor {
let editor_state = state.editor?; let editor_state = state.editor?;
let project = workspace.read(cx).project().clone(); let project = workspace.read(cx).project().clone();
let assistant_panel_delegate = <dyn AssistantPanelDelegate>::try_global(cx)?; let agent_panel_delegate = <dyn AgentPanelDelegate>::try_global(cx)?;
let context_editor_task = workspace.update(cx, |workspace, cx| { let context_editor_task = workspace.update(cx, |workspace, cx| {
assistant_panel_delegate.open_remote_context(workspace, context_id, window, cx) agent_panel_delegate.open_remote_context(workspace, context_id, window, cx)
}); });
Some(window.spawn(cx, async move |cx| { Some(window.spawn(cx, async move |cx| {

View file

@ -8,7 +8,7 @@ use ui::{Avatar, ListItem, ListItemSpacing, prelude::*};
use workspace::{Item, Workspace}; use workspace::{Item, Workspace};
use crate::{ use crate::{
AssistantPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata, AgentPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata,
SavedContextMetadata, SavedContextMetadata,
}; };
@ -70,19 +70,19 @@ impl ContextHistory {
) { ) {
let SavedContextPickerEvent::Confirmed(context) = event; let SavedContextPickerEvent::Confirmed(context) = event;
let Some(assistant_panel_delegate) = <dyn AssistantPanelDelegate>::try_global(cx) else { let Some(agent_panel_delegate) = <dyn AgentPanelDelegate>::try_global(cx) else {
return; return;
}; };
self.workspace self.workspace
.update(cx, |workspace, cx| match context { .update(cx, |workspace, cx| match context {
ContextMetadata::Remote(metadata) => { ContextMetadata::Remote(metadata) => {
assistant_panel_delegate agent_panel_delegate
.open_remote_context(workspace, metadata.id.clone(), window, cx) .open_remote_context(workspace, metadata.id.clone(), window, cx)
.detach_and_log_err(cx); .detach_and_log_err(cx);
} }
ContextMetadata::Saved(metadata) => { ContextMetadata::Saved(metadata) => {
assistant_panel_delegate agent_panel_delegate
.open_saved_context(workspace, metadata.path.clone(), window, cx) .open_saved_context(workspace, metadata.path.clone(), window, cx)
.detach_and_log_err(cx); .detach_and_log_err(cx);
} }

View file

@ -52,8 +52,8 @@ pub trait InlineAssistDelegate {
cx: &mut Context<RulesLibrary>, cx: &mut Context<RulesLibrary>,
); );
/// Returns whether the Assistant panel was focused. /// Returns whether the Agent panel was focused.
fn focus_assistant_panel( fn focus_agent_panel(
&self, &self,
workspace: &mut Workspace, workspace: &mut Workspace,
window: &mut Window, window: &mut Window,
@ -814,7 +814,7 @@ impl RulesLibrary {
.update(cx, |workspace, window, cx| { .update(cx, |workspace, window, cx| {
window.activate_window(); window.activate_window();
self.inline_assist_delegate self.inline_assist_delegate
.focus_assistant_panel(workspace, window, cx) .focus_agent_panel(workspace, window, cx)
}) })
.ok(); .ok();
if panel == Some(true) { if panel == Some(true) {

View file

@ -12,7 +12,7 @@ use agent::AgentDiffToolbar;
use anyhow::Context as _; use anyhow::Context as _;
pub use app_menus::*; pub use app_menus::*;
use assets::Assets; use assets::Assets;
use assistant_context_editor::AssistantPanelDelegate; use assistant_context_editor::AgentPanelDelegate;
use breadcrumbs::Breadcrumbs; use breadcrumbs::Breadcrumbs;
use client::zed_urls; use client::zed_urls;
use collections::VecDeque; use collections::VecDeque;
@ -435,7 +435,7 @@ fn initialize_panels(
let is_assistant2_enabled = !cfg!(test); let is_assistant2_enabled = !cfg!(test);
let agent_panel = if is_assistant2_enabled { let agent_panel = if is_assistant2_enabled {
let agent_panel = let agent_panel =
agent::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone()) agent::AgentPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
.await?; .await?;
Some(agent_panel) Some(agent_panel)
@ -453,15 +453,15 @@ fn initialize_panels(
// We need to do this here instead of within the individual `init` // We need to do this here instead of within the individual `init`
// functions so that we only register the actions once. // functions so that we only register the actions once.
// //
// Once we ship `assistant2` we can push this back down into `agent::assistant_panel::init`. // Once we ship `assistant2` we can push this back down into `agent::agent_panel::init`.
if is_assistant2_enabled { if is_assistant2_enabled {
<dyn AssistantPanelDelegate>::set_global( <dyn AgentPanelDelegate>::set_global(
Arc::new(agent::ConcreteAssistantPanelDelegate), Arc::new(agent::ConcreteAssistantPanelDelegate),
cx, cx,
); );
workspace workspace
.register_action(agent::AssistantPanel::toggle_focus) .register_action(agent::AgentPanel::toggle_focus)
.register_action(agent::InlineAssistant::inline_assist); .register_action(agent::InlineAssistant::inline_assist);
} }
})?; })?;