crates/agent/Cargo.toml π
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
workspace = true
[lib]
-path = "src/assistant.rs"
+path = "src/agent.rs"
doctest = false
[features]
Marshall Bowers created
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
crates/agent/Cargo.toml | 2
crates/agent/src/active_thread.rs | 13
crates/agent/src/agent.rs | 12
crates/agent/src/agent_configuration.rs | 12
crates/agent/src/agent_configuration/add_context_server_modal.rs | 0
crates/agent/src/agent_configuration/configure_context_server_modal.rs | 0
crates/agent/src/agent_configuration/manage_profiles_modal.rs | 8
crates/agent/src/agent_configuration/manage_profiles_modal/profile_modal_header.rs | 0
crates/agent/src/agent_configuration/tool_picker.rs | 0
crates/agent/src/agent_model_selector.rs | 6
crates/agent/src/agent_panel.rs | 92
crates/agent/src/context_picker.rs | 4
crates/agent/src/context_server_configuration.rs | 2
crates/agent/src/context_strip.rs | 4
crates/agent/src/inline_assistant.rs | 29
crates/agent/src/inline_prompt_editor.rs | 12
crates/agent/src/message_editor.rs | 6
crates/agent/src/thread_history.rs | 62
crates/agent/src/ui/onboarding_modal.rs | 4
crates/assistant_context_editor/src/context_editor.rs | 26
crates/assistant_context_editor/src/context_history.rs | 8
crates/rules_library/src/rules_library.rs | 6
crates/zed/src/zed.rs | 10
23 files changed, 155 insertions(+), 163 deletions(-)
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
workspace = true
[lib]
-path = "src/assistant.rs"
+path = "src/agent.rs"
doctest = false
[features]
@@ -1,4 +1,4 @@
-use crate::AssistantPanel;
+use crate::AgentPanel;
use crate::context::{AgentContextHandle, RULES_ICON};
use crate::context_picker::{ContextPicker, MentionLink};
use crate::context_store::ContextStore;
@@ -712,7 +712,7 @@ fn open_markdown_link(
.detach_and_log_err(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
.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| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.update(cx, |panel, cx| {
panel
.open_saved_prompt_editor(path, window, cx)
@@ -1211,8 +1211,7 @@ impl ActiveThread {
if let Some(workspace) = workspace_handle.upgrade() {
workspace.update(_cx, |workspace, cx| {
- workspace
- .focus_panel::<AssistantPanel>(window, cx);
+ workspace.focus_panel::<AgentPanel>(window, cx);
});
}
})
@@ -3524,7 +3523,7 @@ pub(crate) fn open_context(
}
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.open_thread(thread_context.thread.clone(), window, cx);
});
@@ -3533,7 +3532,7 @@ pub(crate) fn open_context(
AgentContextHandle::TextThread(text_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.open_prompt_editor(text_thread_context.context.clone(), window, cx)
});
@@ -1,8 +1,8 @@
mod active_thread;
+mod agent_configuration;
mod agent_diff;
-mod assistant_configuration;
-mod assistant_model_selector;
-mod assistant_panel;
+mod agent_model_selector;
+mod agent_panel;
mod buffer_codegen;
mod context;
mod context_picker;
@@ -43,8 +43,8 @@ use settings::{Settings as _, SettingsStore};
use thread::ThreadId;
pub use crate::active_thread::ActiveThread;
-use crate::assistant_configuration::{AddContextServerModal, ManageProfilesModal};
-pub use crate::assistant_panel::{AssistantPanel, ConcreteAssistantPanelDelegate};
+use crate::agent_configuration::{AddContextServerModal, ManageProfilesModal};
+pub use crate::agent_panel::{AgentPanel, ConcreteAssistantPanelDelegate};
pub use crate::context::{ContextLoadResult, LoadedContext};
pub use crate::inline_assistant::InlineAssistant;
use crate::slash_command_settings::SlashCommandSettings;
@@ -126,7 +126,7 @@ pub fn init(
init_language_model_settings(cx);
assistant_slash_command::init(cx);
thread_store::init(cx);
- assistant_panel::init(cx);
+ agent_panel::init(cx);
context_server_configuration::init(language_registry, cx);
register_slash_commands(cx);
@@ -30,7 +30,7 @@ pub(crate) use manage_profiles_modal::ManageProfilesModal;
use crate::AddContextServer;
-pub struct AssistantConfiguration {
+pub struct AgentConfiguration {
fs: Arc<dyn Fs>,
focus_handle: FocusHandle,
configuration_views_by_provider: HashMap<LanguageModelProviderId, AnyView>,
@@ -42,7 +42,7 @@ pub struct AssistantConfiguration {
scrollbar_state: ScrollbarState,
}
-impl AssistantConfiguration {
+impl AgentConfiguration {
pub fn new(
fs: Arc<dyn Fs>,
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 {
self.focus_handle.clone()
}
@@ -120,9 +120,9 @@ pub enum AssistantConfigurationEvent {
NewThread(Arc<dyn LanguageModelProvider>),
}
-impl EventEmitter<AssistantConfigurationEvent> for AssistantConfiguration {}
+impl EventEmitter<AssistantConfigurationEvent> for AgentConfiguration {}
-impl AssistantConfiguration {
+impl AgentConfiguration {
fn render_provider_configuration_block(
&mut self,
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 {
v_flex()
.id("assistant-configuration")
@@ -18,9 +18,9 @@ use ui::{
use util::ResultExt as _;
use workspace::{ModalView, Workspace};
-use crate::assistant_configuration::manage_profiles_modal::profile_modal_header::ProfileModalHeader;
-use crate::assistant_configuration::tool_picker::{ToolPicker, ToolPickerDelegate};
-use crate::{AssistantPanel, ManageProfiles, ThreadStore};
+use crate::agent_configuration::manage_profiles_modal::profile_modal_header::ProfileModalHeader;
+use crate::agent_configuration::tool_picker::{ToolPicker, ToolPickerDelegate};
+use crate::{AgentPanel, ManageProfiles, ThreadStore};
use super::tool_picker::ToolPickerMode;
@@ -115,7 +115,7 @@ impl ManageProfilesModal {
_cx: &mut Context<Workspace>,
) {
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 thread_store = panel.read(cx).thread_store();
let tools = thread_store.read(cx).tools();
@@ -17,13 +17,13 @@ pub enum ModelType {
InlineAssistant,
}
-pub struct AssistantModelSelector {
+pub struct AgentModelSelector {
selector: Entity<LanguageModelSelector>,
menu_handle: PopoverMenuHandle<LanguageModelSelector>,
focus_handle: FocusHandle,
}
-impl AssistantModelSelector {
+impl AgentModelSelector {
pub(crate) fn new(
fs: Arc<dyn Fs>,
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 {
let focus_handle = self.focus_handle.clone();
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use anyhow::{Result, anyhow};
use assistant_context_editor::{
- AssistantContext, AssistantPanelDelegate, ConfigurationError, ContextEditor, ContextEvent,
+ AgentPanelDelegate, AssistantContext, ConfigurationError, ContextEditor, ContextEvent,
SlashCommandCompletionProvider, humanize_token_count, make_lsp_adapter_delegate,
render_remaining_tokens,
};
@@ -53,8 +53,8 @@ use zed_actions::{DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFon
use zed_llm_client::UsageLimit;
use crate::active_thread::{self, ActiveThread, ActiveThreadEvent};
+use crate::agent_configuration::{AgentConfiguration, AssistantConfigurationEvent};
use crate::agent_diff::AgentDiff;
-use crate::assistant_configuration::{AssistantConfiguration, AssistantConfigurationEvent};
use crate::history_store::{HistoryEntry, HistoryStore, RecentEntry};
use crate::message_editor::{MessageEditor, MessageEditorEvent};
use crate::thread::{Thread, ThreadError, ThreadId, TokenUsageRatio};
@@ -71,7 +71,7 @@ use crate::{
const AGENT_PANEL_KEY: &str = "agent_panel";
#[derive(Serialize, Deserialize)]
-struct SerializedAssistantPanel {
+struct SerializedAgentPanel {
width: Option<Pixels>,
}
@@ -80,40 +80,40 @@ pub fn init(cx: &mut App) {
|workspace: &mut Workspace, _window, _cx: &mut Context<Workspace>| {
workspace
.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));
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ workspace.focus_panel::<AgentPanel>(window, cx);
}
})
.register_action(|workspace, _: &OpenHistory, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.open_history(window, cx));
}
})
.register_action(|workspace, _: &OpenConfiguration, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.open_configuration(window, cx));
}
})
.register_action(|workspace, _: &NewTextThread, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| panel.new_prompt_editor(window, cx));
}
})
.register_action(|workspace, action: &OpenRulesLibrary, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| {
panel.deploy_rules_library(action, window, cx)
});
}
})
.register_action(|workspace, _: &OpenAgentDiff, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
let thread = panel.read(cx).thread.read(cx).thread().clone();
AgentDiffPane::deploy_in_workspace(thread, workspace, window, cx);
}
@@ -122,8 +122,8 @@ pub fn init(cx: &mut App) {
workspace.follow(CollaboratorId::Agent, window, cx);
})
.register_action(|workspace, _: &ExpandMessageEditor, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| {
panel.message_editor.update(cx, |editor, cx| {
editor.expand_message_editor(&ExpandMessageEditor, window, cx);
@@ -132,16 +132,16 @@ pub fn init(cx: &mut App) {
}
})
.register_action(|workspace, _: &ToggleNavigationMenu, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| {
panel.toggle_navigation_menu(&ToggleNavigationMenu, window, cx);
});
}
})
.register_action(|workspace, _: &ToggleOptionsMenu, window, cx| {
- if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
+ workspace.focus_panel::<AgentPanel>(window, cx);
panel.update(cx, |panel, cx| {
panel.toggle_options_menu(&ToggleOptionsMenu, window, cx);
});
@@ -335,7 +335,7 @@ impl ActiveView {
}
}
-pub struct AssistantPanel {
+pub struct AgentPanel {
workspace: WeakEntity<Workspace>,
user_store: Entity<UserStore>,
project: Entity<Project>,
@@ -349,7 +349,7 @@ pub struct AssistantPanel {
context_store: Entity<TextThreadStore>,
prompt_store: Option<Entity<PromptStore>>,
inline_assist_context_store: Entity<crate::context_store::ContextStore>,
- configuration: Option<Entity<AssistantConfiguration>>,
+ configuration: Option<Entity<AgentConfiguration>>,
configuration_subscription: Option<Subscription>,
local_timezone: UtcOffset,
active_view: ActiveView,
@@ -366,14 +366,14 @@ pub struct AssistantPanel {
_trial_markdown: Entity<Markdown>,
}
-impl AssistantPanel {
+impl AgentPanel {
fn serialize(&mut self, cx: &mut Context<Self>) {
let width = self.width;
self.pending_serialization = Some(cx.background_spawn(async move {
KEY_VALUE_STORE
.write_kvp(
AGENT_PANEL_KEY.into(),
- serde_json::to_string(&SerializedAssistantPanel { width })?,
+ serde_json::to_string(&SerializedAgentPanel { width })?,
)
.await?;
anyhow::Ok(())
@@ -423,7 +423,7 @@ impl AssistantPanel {
.log_err()
.flatten()
{
- Some(serde_json::from_str::<SerializedAssistantPanel>(&panel)?)
+ Some(serde_json::from_str::<SerializedAgentPanel>(&panel)?)
} else {
None
};
@@ -1163,15 +1163,13 @@ impl AssistantPanel {
self.set_active_view(ActiveView::Configuration, window, cx);
self.configuration =
- Some(cx.new(|cx| {
- AssistantConfiguration::new(fs, context_server_store, tools, window, cx)
- }));
+ Some(cx.new(|cx| AgentConfiguration::new(fs, context_server_store, tools, window, cx)));
if let Some(configuration) = self.configuration.as_ref() {
self.configuration_subscription = Some(cx.subscribe_in(
configuration,
window,
- Self::handle_assistant_configuration_event,
+ Self::handle_agent_configuration_event,
));
configuration.focus_handle(cx).focus(window);
@@ -1201,9 +1199,9 @@ impl AssistantPanel {
.detach_and_log_err(cx);
}
- fn handle_assistant_configuration_event(
+ fn handle_agent_configuration_event(
&mut self,
- _entity: &Entity<AssistantConfiguration>,
+ _entity: &Entity<AgentConfiguration>,
event: &AssistantConfigurationEvent,
window: &mut Window,
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 {
match &self.active_view {
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 {
"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 {
const LOADING_SUMMARY_PLACEHOLDER: &str = "Loading Summaryβ¦";
@@ -1977,9 +1975,9 @@ impl AssistantPanel {
.style(ButtonStyle::Transparent)
.color(Color::Muted)
.on_click({
- let assistant_panel = cx.entity();
+ let agent_panel = cx.entity();
move |_, _, cx| {
- assistant_panel.update(
+ agent_panel.update(
cx,
|this, cx| {
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 {
let content = match &self.active_view {
ActiveView::Thread { .. } => v_flex()
@@ -2855,28 +2853,26 @@ impl rules_library::InlineAssistDelegate for PromptLibraryInlineAssist {
})
}
- fn focus_assistant_panel(
+ fn focus_agent_panel(
&self,
workspace: &mut Workspace,
window: &mut Window,
cx: &mut Context<Workspace>,
) -> bool {
- workspace
- .focus_panel::<AssistantPanel>(window, cx)
- .is_some()
+ workspace.focus_panel::<AgentPanel>(window, cx).is_some()
}
}
pub struct ConcreteAssistantPanelDelegate;
-impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
+impl AgentPanelDelegate for ConcreteAssistantPanelDelegate {
fn active_context_editor(
&self,
workspace: &mut Workspace,
_window: &mut Window,
cx: &mut Context<Workspace>,
) -> Option<Entity<ContextEditor>> {
- let panel = workspace.panel::<AssistantPanel>(cx)?;
+ let panel = workspace.panel::<AgentPanel>(cx)?;
panel.read(cx).active_context_editor()
}
@@ -2887,7 +2883,7 @@ impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
window: &mut Window,
cx: &mut Context<Workspace>,
) -> 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")));
};
@@ -2914,12 +2910,12 @@ impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
window: &mut Window,
cx: &mut Context<Workspace>,
) {
- let Some(panel) = workspace.panel::<AssistantPanel>(cx) else {
+ let Some(panel) = workspace.panel::<AgentPanel>(cx) else {
return;
};
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| {
@@ -36,7 +36,7 @@ use ui::{
use uuid::Uuid;
use workspace::{Workspace, notifications::NotifyResultExt};
-use crate::AssistantPanel;
+use crate::AgentPanel;
use crate::context::RULES_ICON;
use crate::context_store::ContextStore;
use crate::thread::ThreadId;
@@ -648,7 +648,7 @@ fn recent_context_picker_entries(
let current_threads = context_store.read(cx).thread_ids();
let active_thread_id = workspace
- .panel::<AssistantPanel>(cx)
+ .panel::<AgentPanel>(cx)
.and_then(|panel| Some(panel.read(cx).active_thread()?.read(cx).id()));
if let Some((thread_store, text_thread_store)) = thread_store
@@ -10,7 +10,7 @@ use ui::prelude::*;
use util::ResultExt;
use workspace::Workspace;
-use crate::assistant_configuration::ConfigureContextServerModal;
+use crate::agent_configuration::ConfigureContextServerModal;
pub(crate) fn init(language_registry: Arc<LanguageRegistry>, cx: &mut App) {
cx.observe_new(move |_: &mut Workspace, window, cx| {
@@ -22,7 +22,7 @@ use crate::thread::Thread;
use crate::thread_store::{TextThreadStore, ThreadStore};
use crate::ui::{AddedContext, ContextPill};
use crate::{
- AcceptSuggestedContext, AssistantPanel, FocusDown, FocusLeft, FocusRight, FocusUp,
+ AcceptSuggestedContext, AgentPanel, FocusDown, FocusLeft, FocusRight, FocusUp,
RemoveAllContext, RemoveFocusedContext, ToggleContextPicker,
};
@@ -144,7 +144,7 @@ impl ContextStrip {
}
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() {
let weak_active_thread = active_thread.downgrade();
@@ -43,7 +43,7 @@ use util::ResultExt;
use workspace::{ItemHandle, Toast, Workspace, dock::Panel, notifications::NotificationId};
use zed_actions::agent::OpenConfiguration;
-use crate::AssistantPanel;
+use crate::AgentPanel;
use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent};
use crate::context_store::ContextStore;
use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent};
@@ -182,13 +182,12 @@ impl InlineAssistant {
if let Some(editor) = item.act_as::<Editor>(cx) {
editor.update(cx, |editor, cx| {
if is_assistant2_enabled {
- let panel = workspace.read(cx).panel::<AssistantPanel>(cx);
+ let panel = workspace.read(cx).panel::<AgentPanel>(cx);
let thread_store = panel
.as_ref()
- .map(|assistant_panel| assistant_panel.read(cx).thread_store().downgrade());
- let text_thread_store = panel.map(|assistant_panel| {
- assistant_panel.read(cx).text_thread_store().downgrade()
- });
+ .map(|agent_panel| agent_panel.read(cx).thread_store().downgrade());
+ let text_thread_store = panel
+ .map(|agent_panel| agent_panel.read(cx).text_thread_store().downgrade());
editor.add_code_action_provider(
Rc::new(AssistantCodeActionProvider {
@@ -227,7 +226,7 @@ impl InlineAssistant {
let Some(inline_assist_target) = Self::resolve_inline_assist_target(
workspace,
- workspace.panel::<AssistantPanel>(cx),
+ workspace.panel::<AgentPanel>(cx),
window,
cx,
) else {
@@ -240,15 +239,15 @@ impl InlineAssistant {
.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;
};
- 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 thread_store = Some(assistant_panel.thread_store().downgrade());
- let text_thread_store = Some(assistant_panel.text_thread_store().downgrade());
- let context_store = assistant_panel.inline_assist_context_store().clone();
+ let prompt_store = agent_panel.prompt_store().as_ref().cloned();
+ let thread_store = Some(agent_panel.thread_store().downgrade());
+ let text_thread_store = Some(agent_panel.text_thread_store().downgrade());
+ let context_store = agent_panel.inline_assist_context_store().clone();
let handle_assist =
|window: &mut Window, cx: &mut Context<Workspace>| match inline_assist_target {
@@ -1454,7 +1453,7 @@ impl InlineAssistant {
fn resolve_inline_assist_target(
workspace: &mut Workspace,
- assistant_panel: Option<Entity<AssistantPanel>>,
+ agent_panel: Option<Entity<AgentPanel>>,
window: &mut Window,
cx: &mut App,
) -> 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(|editor| {
let editor = &editor.read(cx).editor().clone();
@@ -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::context::ContextCreasesAddon;
use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider};
@@ -42,7 +42,7 @@ pub struct PromptEditor<T> {
context_store: Entity<ContextStore>,
context_strip: Entity<ContextStrip>,
context_picker_menu_handle: PopoverMenuHandle<ContextPicker>,
- model_selector: Entity<AssistantModelSelector>,
+ model_selector: Entity<AgentModelSelector>,
edited_since_done: bool,
prompt_history: VecDeque<String>,
prompt_history_ix: Option<usize>,
@@ -290,12 +290,12 @@ impl<T: 'static> PromptEditor<T> {
PromptEditorMode::Terminal { .. } => "Generate",
};
- let assistant_panel_keybinding =
+ let agent_panel_keybinding =
ui::text_for_action(&zed_actions::assistant::ToggleFocus, window, cx)
.map(|keybinding| format!("{keybinding} to chat β "))
.unwrap_or_default();
- format!("{action}β¦ ({assistant_panel_keybinding}ββ for history)")
+ format!("{action}β¦ ({agent_panel_keybinding}ββ for history)")
}
pub fn prompt(&self, cx: &App) -> String {
@@ -927,7 +927,7 @@ impl PromptEditor<BufferCodegen> {
context_strip,
context_picker_menu_handle,
model_selector: cx.new(|cx| {
- AssistantModelSelector::new(
+ AgentModelSelector::new(
fs,
model_selector_menu_handle,
prompt_editor.focus_handle(cx),
@@ -1098,7 +1098,7 @@ impl PromptEditor<TerminalCodegen> {
context_strip,
context_picker_menu_handle,
model_selector: cx.new(|cx| {
- AssistantModelSelector::new(
+ AgentModelSelector::new(
fs,
model_selector_menu_handle.clone(),
prompt_editor.focus_handle(cx),
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
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::tool_compatibility::{IncompatibleToolsState, IncompatibleToolsTooltip};
use crate::ui::{
@@ -65,7 +65,7 @@ pub struct MessageEditor {
prompt_store: Option<Entity<PromptStore>>,
context_strip: Entity<ContextStrip>,
context_picker_menu_handle: PopoverMenuHandle<ContextPicker>,
- model_selector: Entity<AssistantModelSelector>,
+ model_selector: Entity<AgentModelSelector>,
last_loaded_context: Option<ContextLoadResult>,
load_context_task: Option<Shared<Task<()>>>,
profile_selector: Entity<ProfileSelector>,
@@ -189,7 +189,7 @@ impl MessageEditor {
];
let model_selector = cx.new(|cx| {
- AssistantModelSelector::new(
+ AgentModelSelector::new(
fs.clone(),
model_selector_menu_handle,
editor.focus_handle(cx),
@@ -19,10 +19,10 @@ use util::ResultExt;
use crate::history_store::{HistoryEntry, HistoryStore};
use crate::thread_store::SerializedThreadMetadata;
-use crate::{AssistantPanel, RemoveSelectedThread};
+use crate::{AgentPanel, RemoveSelectedThread};
pub struct ThreadHistory {
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
history_store: Entity<HistoryStore>,
scroll_handle: UniformListScrollHandle,
selected_index: usize,
@@ -69,7 +69,7 @@ impl HistoryListItem {
impl ThreadHistory {
pub(crate) fn new(
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
history_store: Entity<HistoryStore>,
window: &mut Window,
cx: &mut Context<Self>,
@@ -96,7 +96,7 @@ impl ThreadHistory {
let scrollbar_state = ScrollbarState::new(scroll_handle.clone());
let mut this = Self {
- assistant_panel,
+ agent_panel,
history_store,
scroll_handle,
selected_index: 0,
@@ -380,14 +380,12 @@ impl ThreadHistory {
fn confirm(&mut self, _: &menu::Confirm, window: &mut Window, cx: &mut Context<Self>) {
if let Some(entry) = self.get_match(self.selected_index) {
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)
}),
- HistoryEntry::Context(context) => {
- self.assistant_panel.update(cx, move |this, cx| {
- this.open_saved_prompt_editor(context.path.clone(), window, cx)
- })
- }
+ HistoryEntry::Context(context) => self.agent_panel.update(cx, move |this, cx| {
+ this.open_saved_prompt_editor(context.path.clone(), window, cx)
+ }),
};
if let Some(task) = task_result.log_err() {
@@ -407,10 +405,10 @@ impl ThreadHistory {
if let Some(entry) = self.get_match(self.selected_index) {
let task_result = match entry {
HistoryEntry::Thread(thread) => self
- .assistant_panel
+ .agent_panel
.update(cx, |this, cx| this.delete_thread(&thread.id, cx)),
HistoryEntry::Context(context) => self
- .assistant_panel
+ .agent_panel
.update(cx, |this, cx| this.delete_context(context.path.clone(), cx)),
};
@@ -506,7 +504,7 @@ impl ThreadHistory {
match entry {
HistoryEntry::Thread(thread) => PastThread::new(
thread.clone(),
- self.assistant_panel.clone(),
+ self.agent_panel.clone(),
is_active,
highlight_positions,
format,
@@ -514,7 +512,7 @@ impl ThreadHistory {
.into_any_element(),
HistoryEntry::Context(context) => PastContext::new(
context.clone(),
- self.assistant_panel.clone(),
+ self.agent_panel.clone(),
is_active,
highlight_positions,
format,
@@ -605,7 +603,7 @@ impl Render for ThreadHistory {
#[derive(IntoElement)]
pub struct PastThread {
thread: SerializedThreadMetadata,
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
selected: bool,
highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat,
@@ -614,14 +612,14 @@ pub struct PastThread {
impl PastThread {
pub fn new(
thread: SerializedThreadMetadata,
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
selected: bool,
highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat,
) -> Self {
Self {
thread,
- assistant_panel,
+ agent_panel,
selected,
highlight_positions,
timestamp_format,
@@ -634,7 +632,7 @@ impl RenderOnce for PastThread {
let summary = self.thread.summary;
let thread_timestamp = self.timestamp_format.format_timestamp(
- &self.assistant_panel,
+ &self.agent_panel,
self.thread.updated_at.timestamp(),
cx,
);
@@ -667,10 +665,10 @@ impl RenderOnce for PastThread {
Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx)
})
.on_click({
- let assistant_panel = self.assistant_panel.clone();
+ let agent_panel = self.agent_panel.clone();
let id = self.thread.id.clone();
move |_event, _window, cx| {
- assistant_panel
+ agent_panel
.update(cx, |this, cx| {
this.delete_thread(&id, cx).detach_and_log_err(cx);
})
@@ -680,10 +678,10 @@ impl RenderOnce for PastThread {
),
)
.on_click({
- let assistant_panel = self.assistant_panel.clone();
+ let agent_panel = self.agent_panel.clone();
let id = self.thread.id.clone();
move |_event, window, cx| {
- assistant_panel
+ agent_panel
.update(cx, |this, cx| {
this.open_thread_by_id(&id, window, cx)
.detach_and_log_err(cx);
@@ -697,7 +695,7 @@ impl RenderOnce for PastThread {
#[derive(IntoElement)]
pub struct PastContext {
context: SavedContextMetadata,
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
selected: bool,
highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat,
@@ -706,14 +704,14 @@ pub struct PastContext {
impl PastContext {
pub fn new(
context: SavedContextMetadata,
- assistant_panel: WeakEntity<AssistantPanel>,
+ agent_panel: WeakEntity<AgentPanel>,
selected: bool,
highlight_positions: Vec<usize>,
timestamp_format: EntryTimeFormat,
) -> Self {
Self {
context,
- assistant_panel,
+ agent_panel,
selected,
highlight_positions,
timestamp_format,
@@ -725,7 +723,7 @@ impl RenderOnce for PastContext {
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
let summary = self.context.title;
let context_timestamp = self.timestamp_format.format_timestamp(
- &self.assistant_panel,
+ &self.agent_panel,
self.context.mtime.timestamp(),
cx,
);
@@ -760,10 +758,10 @@ impl RenderOnce for PastContext {
Tooltip::for_action("Delete", &RemoveSelectedThread, window, cx)
})
.on_click({
- let assistant_panel = self.assistant_panel.clone();
+ let agent_panel = self.agent_panel.clone();
let path = self.context.path.clone();
move |_event, _window, cx| {
- assistant_panel
+ agent_panel
.update(cx, |this, cx| {
this.delete_context(path.clone(), cx)
.detach_and_log_err(cx);
@@ -774,10 +772,10 @@ impl RenderOnce for PastContext {
),
)
.on_click({
- let assistant_panel = self.assistant_panel.clone();
+ let agent_panel = self.agent_panel.clone();
let path = self.context.path.clone();
move |_event, window, cx| {
- assistant_panel
+ agent_panel
.update(cx, |this, cx| {
this.open_saved_prompt_editor(path.clone(), window, cx)
.detach_and_log_err(cx);
@@ -797,12 +795,12 @@ pub enum EntryTimeFormat {
impl EntryTimeFormat {
fn format_timestamp(
&self,
- assistant_panel: &WeakEntity<AssistantPanel>,
+ agent_panel: &WeakEntity<AgentPanel>,
timestamp: i64,
cx: &App,
) -> String {
let timestamp = OffsetDateTime::from_unix_timestamp(timestamp).unwrap();
- let timezone = assistant_panel
+ let timezone = agent_panel
.read_with(cx, |this, _cx| this.local_timezone())
.unwrap_or(UtcOffset::UTC);
@@ -4,7 +4,7 @@ use gpui::{
use ui::{TintColor, Vector, VectorName, prelude::*};
use workspace::{ModalView, Workspace};
-use crate::assistant_panel::AssistantPanel;
+use crate::agent_panel::AgentPanel;
macro_rules! agent_onboarding_event {
($name:expr) => {
@@ -31,7 +31,7 @@ impl AgentOnboardingModal {
fn open_panel(&mut self, _: &ClickEvent, window: &mut Window, cx: &mut Context<Self>) {
self.workspace.update(cx, |workspace, cx| {
- workspace.focus_panel::<AssistantPanel>(window, cx);
+ workspace.focus_panel::<AgentPanel>(window, cx);
});
cx.emit(DismissEvent);
@@ -137,7 +137,7 @@ pub enum ThoughtProcessStatus {
Completed,
}
-pub trait AssistantPanelDelegate {
+pub trait AgentPanelDelegate {
fn active_context_editor(
&self,
workspace: &mut Workspace,
@@ -171,7 +171,7 @@ pub trait AssistantPanelDelegate {
);
}
-impl dyn AssistantPanelDelegate {
+impl dyn AgentPanelDelegate {
/// Returns the global [`AssistantPanelDelegate`], if it exists.
pub fn try_global(cx: &App) -> Option<Arc<Self>> {
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 {}
@@ -1666,11 +1666,11 @@ impl ContextEditor {
window: &mut Window,
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;
};
let Some(context_editor_view) =
- assistant_panel_delegate.active_context_editor(workspace, window, cx)
+ agent_panel_delegate.active_context_editor(workspace, window, cx)
else {
return;
};
@@ -1696,9 +1696,9 @@ impl ContextEditor {
cx: &mut Context<Workspace>,
) {
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 =
- 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)
});
let Some((text, is_code_block)) = result else {
@@ -1731,11 +1731,11 @@ impl ContextEditor {
window: &mut Window,
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;
};
let Some(context_editor_view) =
- assistant_panel_delegate.active_context_editor(workspace, window, cx)
+ agent_panel_delegate.active_context_editor(workspace, window, cx)
else {
return;
};
@@ -1821,7 +1821,7 @@ impl ContextEditor {
window: &mut Window,
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;
};
@@ -1852,7 +1852,7 @@ impl ContextEditor {
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(
@@ -3361,10 +3361,10 @@ impl FollowableItem for ContextEditor {
let editor_state = state.editor?;
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| {
- 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| {
@@ -8,7 +8,7 @@ use ui::{Avatar, ListItem, ListItemSpacing, prelude::*};
use workspace::{Item, Workspace};
use crate::{
- AssistantPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata,
+ AgentPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata,
SavedContextMetadata,
};
@@ -70,19 +70,19 @@ impl ContextHistory {
) {
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;
};
self.workspace
.update(cx, |workspace, cx| match context {
ContextMetadata::Remote(metadata) => {
- assistant_panel_delegate
+ agent_panel_delegate
.open_remote_context(workspace, metadata.id.clone(), window, cx)
.detach_and_log_err(cx);
}
ContextMetadata::Saved(metadata) => {
- assistant_panel_delegate
+ agent_panel_delegate
.open_saved_context(workspace, metadata.path.clone(), window, cx)
.detach_and_log_err(cx);
}
@@ -52,8 +52,8 @@ pub trait InlineAssistDelegate {
cx: &mut Context<RulesLibrary>,
);
- /// Returns whether the Assistant panel was focused.
- fn focus_assistant_panel(
+ /// Returns whether the Agent panel was focused.
+ fn focus_agent_panel(
&self,
workspace: &mut Workspace,
window: &mut Window,
@@ -814,7 +814,7 @@ impl RulesLibrary {
.update(cx, |workspace, window, cx| {
window.activate_window();
self.inline_assist_delegate
- .focus_assistant_panel(workspace, window, cx)
+ .focus_agent_panel(workspace, window, cx)
})
.ok();
if panel == Some(true) {
@@ -12,7 +12,7 @@ use agent::AgentDiffToolbar;
use anyhow::Context as _;
pub use app_menus::*;
use assets::Assets;
-use assistant_context_editor::AssistantPanelDelegate;
+use assistant_context_editor::AgentPanelDelegate;
use breadcrumbs::Breadcrumbs;
use client::zed_urls;
use collections::VecDeque;
@@ -435,7 +435,7 @@ fn initialize_panels(
let is_assistant2_enabled = !cfg!(test);
let agent_panel = if is_assistant2_enabled {
let agent_panel =
- agent::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
+ agent::AgentPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
.await?;
Some(agent_panel)
@@ -453,15 +453,15 @@ fn initialize_panels(
// We need to do this here instead of within the individual `init`
// 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 {
- <dyn AssistantPanelDelegate>::set_global(
+ <dyn AgentPanelDelegate>::set_global(
Arc::new(agent::ConcreteAssistantPanelDelegate),
cx,
);
workspace
- .register_action(agent::AssistantPanel::toggle_focus)
+ .register_action(agent::AgentPanel::toggle_focus)
.register_action(agent::InlineAssistant::inline_assist);
}
})?;