From 8faeb34367917eb2747cd7bec6a058c3d1ac0132 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 27 May 2025 11:16:55 -0400 Subject: [PATCH] Rename `assistant_settings` to `agent_settings` (#31513) This PR renames the `assistant_settings` crate to `agent_settings`, as well a number of constructs within it. Release Notes: - N/A --- Cargo.lock | 68 +-- Cargo.toml | 4 +- crates/agent/Cargo.toml | 2 +- crates/agent/src/active_thread.rs | 14 +- crates/agent/src/agent.rs | 6 +- crates/agent/src/agent_configuration.rs | 15 +- .../manage_profiles_modal.rs | 18 +- .../src/agent_configuration/tool_picker.rs | 10 +- crates/agent/src/agent_diff.rs | 14 +- crates/agent/src/agent_model_selector.rs | 6 +- crates/agent/src/agent_panel.rs | 41 +- crates/agent/src/buffer_codegen.rs | 4 +- crates/agent/src/inline_assistant.rs | 8 +- crates/agent/src/message_editor.rs | 4 +- crates/agent/src/profile_selector.rs | 24 +- crates/agent/src/terminal_inline_assistant.rs | 4 +- crates/agent/src/thread.rs | 42 +- crates/agent/src/thread_store.rs | 6 +- .../Cargo.toml | 4 +- .../LICENSE-GPL | 0 .../src/agent_profile.rs | 2 +- .../src/agent_settings.rs} | 497 +++++++++--------- crates/assistant_context_editor/Cargo.toml | 2 +- .../assistant_context_editor/src/context.rs | 5 +- .../src/context/context_tests.rs | 2 +- .../src/context_editor.rs | 6 +- crates/assistant_tools/Cargo.toml | 2 +- crates/assistant_tools/src/assistant_tools.rs | 4 +- crates/collab/Cargo.toml | 2 +- crates/collab/src/tests/test_server.rs | 2 +- crates/eval/Cargo.toml | 2 +- crates/eval/src/example.rs | 2 +- .../src/examples/add_arg_to_trait_method.rs | 2 +- .../eval/src/examples/code_block_citations.rs | 2 +- .../eval/src/examples/comment_translation.rs | 2 +- crates/eval/src/examples/file_search.rs | 2 +- crates/eval/src/examples/mod.rs | 2 +- crates/eval/src/examples/overwrite_file.rs | 2 +- crates/eval/src/examples/planets.rs | 2 +- crates/git_ui/Cargo.toml | 4 +- crates/git_ui/src/git_panel.rs | 14 +- crates/zed/Cargo.toml | 10 +- crates/zed/src/zed/quick_action_bar.rs | 5 +- 43 files changed, 418 insertions(+), 451 deletions(-) rename crates/{assistant_settings => agent_settings}/Cargo.toml (94%) rename crates/{assistant_settings => agent_settings}/LICENSE-GPL (100%) rename crates/{assistant_settings => agent_settings}/src/agent_profile.rs (96%) rename crates/{assistant_settings/src/assistant_settings.rs => agent_settings/src/agent_settings.rs} (67%) diff --git a/Cargo.lock b/Cargo.lock index 5ffe87651a..265516111e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ name = "agent" version = "0.1.0" dependencies = [ + "agent_settings", "anyhow", "assistant_context_editor", - "assistant_settings", "assistant_slash_command", "assistant_slash_commands", "assistant_tool", @@ -135,6 +135,33 @@ dependencies = [ "zed_llm_client", ] +[[package]] +name = "agent_settings" +version = "0.1.0" +dependencies = [ + "anthropic", + "anyhow", + "collections", + "deepseek", + "fs", + "gpui", + "indexmap", + "language_model", + "lmstudio", + "log", + "mistral", + "ollama", + "open_ai", + "paths", + "schemars", + "serde", + "serde_json", + "serde_json_lenient", + "settings", + "workspace-hack", + "zed_llm_client", +] + [[package]] name = "ahash" version = "0.7.8" @@ -482,8 +509,8 @@ dependencies = [ name = "assistant_context_editor" version = "0.1.0" dependencies = [ + "agent_settings", "anyhow", - "assistant_settings", "assistant_slash_command", "assistant_slash_commands", "chrono", @@ -534,33 +561,6 @@ dependencies = [ "zed_actions", ] -[[package]] -name = "assistant_settings" -version = "0.1.0" -dependencies = [ - "anthropic", - "anyhow", - "collections", - "deepseek", - "fs", - "gpui", - "indexmap", - "language_model", - "lmstudio", - "log", - "mistral", - "ollama", - "open_ai", - "paths", - "schemars", - "serde", - "serde_json", - "serde_json_lenient", - "settings", - "workspace-hack", - "zed_llm_client", -] - [[package]] name = "assistant_slash_command" version = "0.1.0" @@ -657,9 +657,9 @@ dependencies = [ name = "assistant_tools" version = "0.1.0" dependencies = [ + "agent_settings", "aho-corasick", "anyhow", - "assistant_settings", "assistant_tool", "buffer_diff", "chrono", @@ -2976,9 +2976,9 @@ dependencies = [ name = "collab" version = "0.44.0" dependencies = [ + "agent_settings", "anyhow", "assistant_context_editor", - "assistant_settings", "assistant_slash_command", "assistant_tool", "async-stripe", @@ -4995,8 +4995,8 @@ name = "eval" version = "0.1.0" dependencies = [ "agent", + "agent_settings", "anyhow", - "assistant_settings", "assistant_tool", "assistant_tools", "async-trait", @@ -6097,9 +6097,9 @@ dependencies = [ name = "git_ui" version = "0.1.0" dependencies = [ + "agent_settings", "anyhow", "askpass", - "assistant_settings", "buffer_diff", "chrono", "collections", @@ -19679,12 +19679,12 @@ version = "0.189.0" dependencies = [ "activity_indicator", "agent", + "agent_settings", "anyhow", "ashpd", "askpass", "assets", "assistant_context_editor", - "assistant_settings", "assistant_tool", "assistant_tools", "async-watch", diff --git a/Cargo.toml b/Cargo.toml index 11e203d6b9..5c2d01d43c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,11 @@ resolver = "2" members = [ "crates/activity_indicator", "crates/agent", + "crates/agent_settings", "crates/anthropic", "crates/askpass", "crates/assets", "crates/assistant_context_editor", - "crates/assistant_settings", "crates/assistant_slash_command", "crates/assistant_slash_commands", "crates/assistant_tool", @@ -211,12 +211,12 @@ edition = "2024" activity_indicator = { path = "crates/activity_indicator" } agent = { path = "crates/agent" } +agent_settings = { path = "crates/agent_settings" } ai = { path = "crates/ai" } anthropic = { path = "crates/anthropic" } askpass = { path = "crates/askpass" } assets = { path = "crates/assets" } assistant_context_editor = { path = "crates/assistant_context_editor" } -assistant_settings = { path = "crates/assistant_settings" } assistant_slash_command = { path = "crates/assistant_slash_command" } assistant_slash_commands = { path = "crates/assistant_slash_commands" } assistant_tool = { path = "crates/assistant_tool" } diff --git a/crates/agent/Cargo.toml b/crates/agent/Cargo.toml index ced340fca7..f9c6fcd4e4 100644 --- a/crates/agent/Cargo.toml +++ b/crates/agent/Cargo.toml @@ -19,9 +19,9 @@ test-support = [ ] [dependencies] +agent_settings.workspace = true anyhow.workspace = true assistant_context_editor.workspace = true -assistant_settings.workspace = true assistant_slash_command.workspace = true assistant_slash_commands.workspace = true assistant_tool.workspace = true diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 5f2a532f8e..c749ca8211 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -13,8 +13,8 @@ use crate::tool_use::{PendingToolUseStatus, ToolUse}; use crate::ui::{ AddedContext, AgentNotification, AgentNotificationEvent, AnimatedLabel, ContextPill, }; +use agent_settings::{AgentSettings, NotifyWhenAgentWaiting}; use anyhow::Context as _; -use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting}; use assistant_tool::ToolUseStatus; use audio::{Audio, Sound}; use collections::{HashMap, HashSet}; @@ -1151,7 +1151,7 @@ impl ActiveThread { } fn play_notification_sound(&self, cx: &mut App) { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); if settings.play_sound_when_agent_done { Audio::play_sound(Sound::AgentDone, cx); } @@ -1170,7 +1170,7 @@ impl ActiveThread { let title = self.thread.read(cx).summary().unwrap_or("Agent Panel"); - match AssistantSettings::get_global(cx).notify_when_agent_waiting { + match AgentSettings::get_global(cx).notify_when_agent_waiting { NotifyWhenAgentWaiting::PrimaryScreen => { if let Some(primary) = cx.primary_display() { self.pop_up(icon, caption.into(), title.clone(), window, primary, cx); @@ -1441,7 +1441,7 @@ impl ActiveThread { tools: vec![], tool_choice: None, stop: vec![], - temperature: AssistantSettings::temperature_for_model( + temperature: AgentSettings::temperature_for_model( &configured_model.model, cx, ), @@ -1898,7 +1898,7 @@ impl ActiveThread { .child(open_as_markdown), ) .into_any_element(), - None if AssistantSettings::get_global(cx).enable_feedback => + None if AgentSettings::get_global(cx).enable_feedback => feedback_container .child( div().visible_on_hover("feedback_container").child( @@ -3078,7 +3078,7 @@ impl ActiveThread { .on_click(cx.listener( move |this, event, window, cx| { if let Some(fs) = fs.clone() { - update_settings_file::( + update_settings_file::( fs.clone(), cx, |settings, _| { @@ -3690,7 +3690,7 @@ mod tests { cx.set_global(settings_store); language::init(cx); Project::init_settings(cx); - AssistantSettings::register(cx); + AgentSettings::register(cx); prompt_store::init(cx); thread_store::init(cx); workspace::init_settings(cx); diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rs index bd7f0edddd..b4d1abdea4 100644 --- a/crates/agent/src/agent.rs +++ b/crates/agent/src/agent.rs @@ -28,7 +28,7 @@ mod ui; use std::sync::Arc; -use assistant_settings::{AgentProfileId, AssistantSettings, LanguageModelSelection}; +use agent_settings::{AgentProfileId, AgentSettings, LanguageModelSelection}; use assistant_slash_command::SlashCommandRegistry; use client::Client; use feature_flags::FeatureFlagAppExt as _; @@ -121,7 +121,7 @@ pub fn init( is_eval: bool, cx: &mut App, ) { - AssistantSettings::register(cx); + AgentSettings::register(cx); SlashCommandSettings::register(cx); assistant_context_editor::init(client.clone(), cx); @@ -174,7 +174,7 @@ fn init_language_model_settings(cx: &mut App) { } fn update_active_language_model_from_settings(cx: &mut App) { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); fn to_selected_model(selection: &LanguageModelSelection) -> language_model::SelectedModel { language_model::SelectedModel { diff --git a/crates/agent/src/agent_configuration.rs b/crates/agent/src/agent_configuration.rs index 16c183229e..8f7346c00b 100644 --- a/crates/agent/src/agent_configuration.rs +++ b/crates/agent/src/agent_configuration.rs @@ -5,7 +5,7 @@ mod tool_picker; use std::{sync::Arc, time::Duration}; -use assistant_settings::AssistantSettings; +use agent_settings::AgentSettings; use assistant_tool::{ToolSource, ToolWorkingSet}; use collections::HashMap; use context_server::ContextServerId; @@ -249,7 +249,7 @@ impl AgentConfiguration { } fn render_command_permission(&mut self, cx: &mut Context) -> impl IntoElement { - let always_allow_tool_actions = AssistantSettings::get_global(cx).always_allow_tool_actions; + let always_allow_tool_actions = AgentSettings::get_global(cx).always_allow_tool_actions; h_flex() .gap_4() @@ -277,7 +277,7 @@ impl AgentConfiguration { let fs = self.fs.clone(); move |state, _window, cx| { let allow = state == &ToggleState::Selected; - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _| { @@ -290,7 +290,7 @@ impl AgentConfiguration { } fn render_single_file_review(&mut self, cx: &mut Context) -> impl IntoElement { - let single_file_review = AssistantSettings::get_global(cx).single_file_review; + let single_file_review = AgentSettings::get_global(cx).single_file_review; h_flex() .gap_4() @@ -315,7 +315,7 @@ impl AgentConfiguration { let fs = self.fs.clone(); move |state, _window, cx| { let allow = state == &ToggleState::Selected; - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _| { @@ -328,8 +328,7 @@ impl AgentConfiguration { } fn render_sound_notification(&mut self, cx: &mut Context) -> impl IntoElement { - let play_sound_when_agent_done = - AssistantSettings::get_global(cx).play_sound_when_agent_done; + let play_sound_when_agent_done = AgentSettings::get_global(cx).play_sound_when_agent_done; h_flex() .gap_4() @@ -354,7 +353,7 @@ impl AgentConfiguration { let fs = self.fs.clone(); move |state, _window, cx| { let allow = state == &ToggleState::Selected; - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _| { diff --git a/crates/agent/src/agent_configuration/manage_profiles_modal.rs b/crates/agent/src/agent_configuration/manage_profiles_modal.rs index 6b5008afed..8cb7d4dfe2 100644 --- a/crates/agent/src/agent_configuration/manage_profiles_modal.rs +++ b/crates/agent/src/agent_configuration/manage_profiles_modal.rs @@ -2,7 +2,7 @@ mod profile_modal_header; use std::sync::Arc; -use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings, builtin_profiles}; +use agent_settings::{AgentProfile, AgentProfileId, AgentSettings, builtin_profiles}; use assistant_tool::ToolWorkingSet; use convert_case::{Case, Casing as _}; use editor::Editor; @@ -42,7 +42,7 @@ enum Mode { impl Mode { pub fn choose_profile(_window: &mut Window, cx: &mut Context) -> Self { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let mut builtin_profiles = Vec::new(); let mut custom_profiles = Vec::new(); @@ -196,7 +196,7 @@ impl ManageProfilesModal { window: &mut Window, cx: &mut Context, ) { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let Some(profile) = settings.profiles.get(&profile_id).cloned() else { return; }; @@ -234,7 +234,7 @@ impl ManageProfilesModal { window: &mut Window, cx: &mut Context, ) { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let Some(profile) = settings.profiles.get(&profile_id).cloned() else { return; }; @@ -270,7 +270,7 @@ impl ManageProfilesModal { match &self.mode { Mode::ChooseProfile { .. } => {} Mode::NewProfile(mode) => { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let base_profile = mode .base_profile_id @@ -332,7 +332,7 @@ impl ManageProfilesModal { profile: AgentProfile, cx: &mut Context, ) { - update_settings_file::(self.fs.clone(), cx, { + update_settings_file::(self.fs.clone(), cx, { move |settings, _cx| { settings.create_profile(profile_id, profile).log_err(); } @@ -485,7 +485,7 @@ impl ManageProfilesModal { _window: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let base_profile_name = mode.base_profile_id.as_ref().map(|base_profile_id| { settings @@ -518,7 +518,7 @@ impl ManageProfilesModal { window: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let profile_id = &settings.default_profile; let profile_name = settings @@ -712,7 +712,7 @@ impl ManageProfilesModal { impl Render for ManageProfilesModal { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let go_back_item = div() .id("cancel-item") diff --git a/crates/agent/src/agent_configuration/tool_picker.rs b/crates/agent/src/agent_configuration/tool_picker.rs index 66068031ad..5ac2d4496b 100644 --- a/crates/agent/src/agent_configuration/tool_picker.rs +++ b/crates/agent/src/agent_configuration/tool_picker.rs @@ -1,7 +1,7 @@ use std::{collections::BTreeMap, sync::Arc}; -use assistant_settings::{ - AgentProfile, AgentProfileContent, AgentProfileId, AssistantSettings, AssistantSettingsContent, +use agent_settings::{ + AgentProfile, AgentProfileContent, AgentProfileId, AgentSettings, AgentSettingsContent, ContextServerPresetContent, }; use assistant_tool::{ToolSource, ToolWorkingSet}; @@ -259,7 +259,7 @@ impl PickerDelegate for ToolPickerDelegate { is_enabled }; - let active_profile_id = &AssistantSettings::get_global(cx).default_profile; + let active_profile_id = &AgentSettings::get_global(cx).default_profile; if active_profile_id == &self.profile_id { self.thread_store .update(cx, |this, cx| { @@ -268,12 +268,12 @@ impl PickerDelegate for ToolPickerDelegate { .log_err(); } - update_settings_file::(self.fs.clone(), cx, { + update_settings_file::(self.fs.clone(), cx, { let profile_id = self.profile_id.clone(); let default_profile = self.profile.clone(); let server_id = server_id.clone(); let tool_name = tool_name.clone(); - move |settings: &mut AssistantSettingsContent, _cx| { + move |settings: &mut AgentSettingsContent, _cx| { settings .v2_setting(|v2_settings| { let profiles = v2_settings.profiles.get_or_insert_default(); diff --git a/crates/agent/src/agent_diff.rs b/crates/agent/src/agent_diff.rs index 1ae8eddb15..cb55585326 100644 --- a/crates/agent/src/agent_diff.rs +++ b/crates/agent/src/agent_diff.rs @@ -1,6 +1,6 @@ use crate::{Keep, KeepAll, OpenAgentDiff, Reject, RejectAll, Thread, ThreadEvent}; +use agent_settings::AgentSettings; use anyhow::Result; -use assistant_settings::AssistantSettings; use buffer_diff::DiffHunkStatus; use collections::{HashMap, HashSet}; use editor::{ @@ -1253,9 +1253,9 @@ impl AgentDiff { let settings_subscription = cx.observe_global_in::(window, { let workspace = workspace.clone(); - let mut was_active = AssistantSettings::get_global(cx).single_file_review; + let mut was_active = AgentSettings::get_global(cx).single_file_review; move |this, window, cx| { - let is_active = AssistantSettings::get_global(cx).single_file_review; + let is_active = AgentSettings::get_global(cx).single_file_review; if was_active != is_active { was_active = is_active; this.update_reviewing_editors(&workspace, window, cx); @@ -1461,7 +1461,7 @@ impl AgentDiff { window: &mut Window, cx: &mut Context, ) { - if !AssistantSettings::get_global(cx).single_file_review { + if !AgentSettings::get_global(cx).single_file_review { for (editor, _) in self.reviewing_editors.drain() { editor .update(cx, |editor, cx| editor.end_temporary_diff_override(cx)) @@ -1736,7 +1736,7 @@ impl editor::Addon for EditorAgentDiffAddon { mod tests { use super::*; use crate::{Keep, ThreadStore, thread_store}; - use assistant_settings::AssistantSettings; + use agent_settings::AgentSettings; use assistant_tool::ToolWorkingSet; use editor::EditorSettings; use gpui::{TestAppContext, UpdateGlobal, VisualTestContext}; @@ -1755,7 +1755,7 @@ mod tests { cx.set_global(settings_store); language::init(cx); Project::init_settings(cx); - AssistantSettings::register(cx); + AgentSettings::register(cx); prompt_store::init(cx); thread_store::init(cx); workspace::init_settings(cx); @@ -1911,7 +1911,7 @@ mod tests { cx.set_global(settings_store); language::init(cx); Project::init_settings(cx); - AssistantSettings::register(cx); + AgentSettings::register(cx); prompt_store::init(cx); thread_store::init(cx); workspace::init_settings(cx); diff --git a/crates/agent/src/agent_model_selector.rs b/crates/agent/src/agent_model_selector.rs index 3dcece2c1d..3393d5cb86 100644 --- a/crates/agent/src/agent_model_selector.rs +++ b/crates/agent/src/agent_model_selector.rs @@ -1,4 +1,4 @@ -use assistant_settings::AssistantSettings; +use agent_settings::AgentSettings; use fs::Fs; use gpui::{Entity, FocusHandle, SharedString}; @@ -63,7 +63,7 @@ impl AgentModelSelector { ); } }); - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _cx| { @@ -72,7 +72,7 @@ impl AgentModelSelector { ); } ModelType::InlineAssistant => { - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _cx| { diff --git a/crates/agent/src/agent_panel.rs b/crates/agent/src/agent_panel.rs index 2d7dfea27d..0d59ad9595 100644 --- a/crates/agent/src/agent_panel.rs +++ b/crates/agent/src/agent_panel.rs @@ -7,13 +7,13 @@ use std::time::Duration; use db::kvp::{Dismissable, KEY_VALUE_STORE}; use serde::{Deserialize, Serialize}; +use agent_settings::{AgentDockPosition, AgentSettings, DefaultView}; use anyhow::{Result, anyhow}; use assistant_context_editor::{ AgentPanelDelegate, AssistantContext, ConfigurationError, ContextEditor, ContextEvent, ContextSummary, SlashCommandCompletionProvider, humanize_token_count, make_lsp_adapter_delegate, render_remaining_tokens, }; -use assistant_settings::{AssistantDockPosition, AssistantSettings, DefaultView}; use assistant_slash_command::SlashCommandWorkingSet; use assistant_tool::ToolWorkingSet; @@ -523,7 +523,7 @@ impl AgentPanel { cx.observe(&history_store, |_, _, cx| cx.notify()).detach(); - let panel_type = AssistantSettings::get_global(cx).default_view; + let panel_type = AgentSettings::get_global(cx).default_view; let active_view = match panel_type { DefaultView::Thread => ActiveView::thread(thread.clone(), window, cx), DefaultView::TextThread => { @@ -1250,7 +1250,7 @@ impl AgentPanel { .map_or(true, |model| model.provider.id() != provider.id()) { if let Some(model) = provider.default_model(cx) { - update_settings_file::( + update_settings_file::( self.fs.clone(), cx, move |settings, _| settings.set_model(model), @@ -1381,10 +1381,10 @@ impl Focusable for AgentPanel { } fn agent_panel_dock_position(cx: &App) -> DockPosition { - match AssistantSettings::get_global(cx).dock { - AssistantDockPosition::Left => DockPosition::Left, - AssistantDockPosition::Bottom => DockPosition::Bottom, - AssistantDockPosition::Right => DockPosition::Right, + match AgentSettings::get_global(cx).dock { + AgentDockPosition::Left => DockPosition::Left, + AgentDockPosition::Bottom => DockPosition::Bottom, + AgentDockPosition::Right => DockPosition::Right, } } @@ -1404,22 +1404,18 @@ impl Panel for AgentPanel { } fn set_position(&mut self, position: DockPosition, _: &mut Window, cx: &mut Context) { - settings::update_settings_file::( - self.fs.clone(), - cx, - move |settings, _| { - let dock = match position { - DockPosition::Left => AssistantDockPosition::Left, - DockPosition::Bottom => AssistantDockPosition::Bottom, - DockPosition::Right => AssistantDockPosition::Right, - }; - settings.set_dock(dock); - }, - ); + settings::update_settings_file::(self.fs.clone(), cx, move |settings, _| { + let dock = match position { + DockPosition::Left => AgentDockPosition::Left, + DockPosition::Bottom => AgentDockPosition::Bottom, + DockPosition::Right => AgentDockPosition::Right, + }; + settings.set_dock(dock); + }); } fn size(&self, window: &Window, cx: &App) -> Pixels { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); match self.position(window, cx) { DockPosition::Left | DockPosition::Right => { self.width.unwrap_or(settings.default_width) @@ -1444,8 +1440,7 @@ impl Panel for AgentPanel { } fn icon(&self, _window: &Window, cx: &App) -> Option { - (self.enabled(cx) && AssistantSettings::get_global(cx).button) - .then_some(IconName::ZedAssistant) + (self.enabled(cx) && AgentSettings::get_global(cx).button).then_some(IconName::ZedAssistant) } fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> { @@ -1461,7 +1456,7 @@ impl Panel for AgentPanel { } fn enabled(&self, cx: &App) -> bool { - AssistantSettings::get_global(cx).enabled + AgentSettings::get_global(cx).enabled } fn is_zoomed(&self, _window: &Window, _cx: &App) -> bool { diff --git a/crates/agent/src/buffer_codegen.rs b/crates/agent/src/buffer_codegen.rs index 7c718eac9c..46b0cf4948 100644 --- a/crates/agent/src/buffer_codegen.rs +++ b/crates/agent/src/buffer_codegen.rs @@ -1,8 +1,8 @@ use crate::context::ContextLoadResult; use crate::inline_prompt_editor::CodegenStatus; use crate::{context::load_context, context_store::ContextStore}; +use agent_settings::AgentSettings; use anyhow::{Context as _, Result}; -use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; use collections::HashSet; use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint}; @@ -443,7 +443,7 @@ impl CodegenAlternative { } }); - let temperature = AssistantSettings::temperature_for_model(&model, cx); + let temperature = AgentSettings::temperature_for_model(&model, cx); Ok(cx.spawn(async move |_cx| { let mut request_message = LanguageModelRequestMessage { diff --git a/crates/agent/src/inline_assistant.rs b/crates/agent/src/inline_assistant.rs index 5dfe9630d7..4ce5829a76 100644 --- a/crates/agent/src/inline_assistant.rs +++ b/crates/agent/src/inline_assistant.rs @@ -4,8 +4,8 @@ use std::ops::Range; use std::rc::Rc; use std::sync::Arc; +use agent_settings::AgentSettings; use anyhow::{Context as _, Result}; -use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; use collections::{HashMap, HashSet, VecDeque, hash_map}; use editor::display_map::EditorMargins; @@ -134,7 +134,7 @@ impl InlineAssistant { let Some(terminal_panel) = workspace.read(cx).panel::(cx) else { return; }; - let enabled = AssistantSettings::get_global(cx).enabled; + let enabled = AgentSettings::get_global(cx).enabled; terminal_panel.update(cx, |terminal_panel, cx| { terminal_panel.set_assistant_enabled(enabled, cx) }); @@ -219,7 +219,7 @@ impl InlineAssistant { window: &mut Window, cx: &mut Context, ) { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); if !settings.enabled { return; } @@ -1771,7 +1771,7 @@ impl CodeActionProvider for AssistantCodeActionProvider { _: &mut Window, cx: &mut App, ) -> Task>> { - if !AssistantSettings::get_global(cx).enabled { + if !AgentSettings::get_global(cx).enabled { return Task::ready(Ok(Vec::new())); } diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs index 4741fd2f21..3256299c89 100644 --- a/crates/agent/src/message_editor.rs +++ b/crates/agent/src/message_editor.rs @@ -9,8 +9,8 @@ use crate::ui::{ AnimatedLabel, MaxModeTooltip, preview::{AgentPreview, UsageCallout}, }; +use agent_settings::{AgentSettings, CompletionMode}; use assistant_context_editor::language_model_selector::ToggleModelSelector; -use assistant_settings::{AssistantSettings, CompletionMode}; use buffer_diff::BufferDiff; use client::UserStore; use collections::{HashMap, HashSet}; @@ -1272,7 +1272,7 @@ impl MessageEditor { tools: vec![], tool_choice: None, stop: vec![], - temperature: AssistantSettings::temperature_for_model(&model.model, cx), + temperature: AgentSettings::temperature_for_model(&model.model, cx), }; Some(model.model.count_tokens(request, cx)) diff --git a/crates/agent/src/profile_selector.rs b/crates/agent/src/profile_selector.rs index f976ca94e1..a51440ddb9 100644 --- a/crates/agent/src/profile_selector.rs +++ b/crates/agent/src/profile_selector.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use assistant_settings::{ - AgentProfile, AgentProfileId, AssistantDockPosition, AssistantSettings, GroupedAgentProfiles, +use agent_settings::{ + AgentDockPosition, AgentProfile, AgentProfileId, AgentSettings, GroupedAgentProfiles, builtin_profiles, }; use fs::Fs; @@ -39,7 +39,7 @@ impl ProfileSelector { }); Self { - profiles: GroupedAgentProfiles::from_settings(AssistantSettings::get_global(cx)), + profiles: GroupedAgentProfiles::from_settings(AgentSettings::get_global(cx)), fs, thread, thread_store, @@ -54,7 +54,7 @@ impl ProfileSelector { } fn refresh_profiles(&mut self, cx: &mut Context) { - self.profiles = GroupedAgentProfiles::from_settings(AssistantSettings::get_global(cx)); + self.profiles = GroupedAgentProfiles::from_settings(AgentSettings::get_global(cx)); } fn build_context_menu( @@ -63,7 +63,7 @@ impl ProfileSelector { cx: &mut Context, ) -> Entity { ContextMenu::build(window, cx, |mut menu, _window, cx| { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); for (profile_id, profile) in self.profiles.builtin.iter() { menu = menu.item(self.menu_entry_for_profile( profile_id.clone(), @@ -100,7 +100,7 @@ impl ProfileSelector { &self, profile_id: AgentProfileId, profile: &AgentProfile, - settings: &AssistantSettings, + settings: &AgentSettings, _cx: &App, ) -> ContextMenuEntry { let documentation = match profile.name.to_lowercase().as_str() { @@ -126,7 +126,7 @@ impl ProfileSelector { let thread_store = self.thread_store.clone(); let profile_id = profile_id.clone(); move |_window, cx| { - update_settings_file::(fs.clone(), cx, { + update_settings_file::(fs.clone(), cx, { let profile_id = profile_id.clone(); move |settings, _cx| { settings.set_profile(profile_id.clone()); @@ -145,7 +145,7 @@ impl ProfileSelector { impl Render for ProfileSelector { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { - let settings = AssistantSettings::get_global(cx); + let settings = AgentSettings::get_global(cx); let profile_id = &settings.default_profile; let profile = settings.profiles.get(profile_id); @@ -208,10 +208,10 @@ impl Render for ProfileSelector { } } -fn documentation_side(position: AssistantDockPosition) -> DocumentationSide { +fn documentation_side(position: AgentDockPosition) -> DocumentationSide { match position { - AssistantDockPosition::Left => DocumentationSide::Right, - AssistantDockPosition::Bottom => DocumentationSide::Left, - AssistantDockPosition::Right => DocumentationSide::Left, + AgentDockPosition::Left => DocumentationSide::Right, + AgentDockPosition::Bottom => DocumentationSide::Left, + AgentDockPosition::Right => DocumentationSide::Left, } } diff --git a/crates/agent/src/terminal_inline_assistant.rs b/crates/agent/src/terminal_inline_assistant.rs index 992f32af98..b72f9792fc 100644 --- a/crates/agent/src/terminal_inline_assistant.rs +++ b/crates/agent/src/terminal_inline_assistant.rs @@ -5,8 +5,8 @@ use crate::inline_prompt_editor::{ }; use crate::terminal_codegen::{CLEAR_INPUT, CodegenEvent, TerminalCodegen}; use crate::thread_store::{TextThreadStore, ThreadStore}; +use agent_settings::AgentSettings; use anyhow::{Context as _, Result}; -use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; use collections::{HashMap, VecDeque}; use editor::{MultiBuffer, actions::SelectAll}; @@ -271,7 +271,7 @@ impl TerminalInlineAssistant { .inline_assistant_model() .context("No inline assistant model")?; - let temperature = AssistantSettings::temperature_for_model(&model, cx); + let temperature = AgentSettings::temperature_for_model(&model, cx); Ok(cx.background_spawn(async move { let mut request_message = LanguageModelRequestMessage { diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index d412146aae..d0b63e0157 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -4,8 +4,8 @@ use std::ops::Range; use std::sync::Arc; use std::time::Instant; +use agent_settings::{AgentSettings, CompletionMode}; use anyhow::{Result, anyhow}; -use assistant_settings::{AssistantSettings, CompletionMode}; use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet}; use chrono::{DateTime, Utc}; use collections::HashMap; @@ -329,7 +329,7 @@ pub struct Thread { detailed_summary_task: Task>, detailed_summary_tx: postage::watch::Sender, detailed_summary_rx: postage::watch::Receiver, - completion_mode: assistant_settings::CompletionMode, + completion_mode: agent_settings::CompletionMode, messages: Vec, next_message_id: MessageId, last_prompt_id: PromptId, @@ -415,7 +415,7 @@ impl Thread { detailed_summary_task: Task::ready(None), detailed_summary_tx, detailed_summary_rx, - completion_mode: AssistantSettings::get_global(cx).preferred_completion_mode, + completion_mode: AgentSettings::get_global(cx).preferred_completion_mode, messages: Vec::new(), next_message_id: MessageId(0), last_prompt_id: PromptId::new(), @@ -493,7 +493,7 @@ impl Thread { let completion_mode = serialized .completion_mode - .unwrap_or_else(|| AssistantSettings::get_global(cx).preferred_completion_mode); + .unwrap_or_else(|| AgentSettings::get_global(cx).preferred_completion_mode); Self { id, @@ -1204,7 +1204,7 @@ impl Thread { tools: Vec::new(), tool_choice: None, stop: Vec::new(), - temperature: AssistantSettings::temperature_for_model(&model, cx), + temperature: AgentSettings::temperature_for_model(&model, cx), }; let available_tools = self.available_tools(cx, model.clone()); @@ -1363,7 +1363,7 @@ impl Thread { tools: Vec::new(), tool_choice: None, stop: Vec::new(), - temperature: AssistantSettings::temperature_for_model(model, cx), + temperature: AgentSettings::temperature_for_model(model, cx), }; for message in &self.messages { @@ -2039,7 +2039,7 @@ impl Thread { for tool_use in pending_tool_uses.iter() { if let Some(tool) = self.tools.read(cx).tool(&tool_use.name, cx) { if tool.needs_confirmation(&tool_use.input, cx) - && !AssistantSettings::get_global(cx).always_allow_tool_actions + && !AgentSettings::get_global(cx).always_allow_tool_actions { self.tool_use.confirm_tool_use( tool_use.id.clone(), @@ -2835,7 +2835,7 @@ struct PendingCompletion { mod tests { use super::*; use crate::{ThreadStore, context::load_context, context_store::ContextStore, thread_store}; - use assistant_settings::{AssistantSettings, LanguageModelParameters}; + use agent_settings::{AgentSettings, LanguageModelParameters}; use assistant_tool::ToolRegistry; use editor::EditorSettings; use gpui::TestAppContext; @@ -3263,14 +3263,14 @@ fn main() {{ // Both model and provider cx.update(|cx| { - AssistantSettings::override_global( - AssistantSettings { + AgentSettings::override_global( + AgentSettings { model_parameters: vec![LanguageModelParameters { provider: Some(model.provider_id().0.to_string().into()), model: Some(model.id().0.clone()), temperature: Some(0.66), }], - ..AssistantSettings::get_global(cx).clone() + ..AgentSettings::get_global(cx).clone() }, cx, ); @@ -3283,14 +3283,14 @@ fn main() {{ // Only model cx.update(|cx| { - AssistantSettings::override_global( - AssistantSettings { + AgentSettings::override_global( + AgentSettings { model_parameters: vec![LanguageModelParameters { provider: None, model: Some(model.id().0.clone()), temperature: Some(0.66), }], - ..AssistantSettings::get_global(cx).clone() + ..AgentSettings::get_global(cx).clone() }, cx, ); @@ -3303,14 +3303,14 @@ fn main() {{ // Only provider cx.update(|cx| { - AssistantSettings::override_global( - AssistantSettings { + AgentSettings::override_global( + AgentSettings { model_parameters: vec![LanguageModelParameters { provider: Some(model.provider_id().0.to_string().into()), model: None, temperature: Some(0.66), }], - ..AssistantSettings::get_global(cx).clone() + ..AgentSettings::get_global(cx).clone() }, cx, ); @@ -3323,14 +3323,14 @@ fn main() {{ // Same model name, different provider cx.update(|cx| { - AssistantSettings::override_global( - AssistantSettings { + AgentSettings::override_global( + AgentSettings { model_parameters: vec![LanguageModelParameters { provider: Some("anthropic".into()), model: Some(model.id().0.clone()), temperature: Some(0.66), }], - ..AssistantSettings::get_global(cx).clone() + ..AgentSettings::get_global(cx).clone() }, cx, ); @@ -3538,7 +3538,7 @@ fn main() {{ cx.set_global(settings_store); language::init(cx); Project::init_settings(cx); - AssistantSettings::register(cx); + AgentSettings::register(cx); prompt_store::init(cx); thread_store::init(cx); workspace::init_settings(cx); diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rs index 93d4817120..8cc29e32ab 100644 --- a/crates/agent/src/thread_store.rs +++ b/crates/agent/src/thread_store.rs @@ -4,8 +4,8 @@ use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::Arc; +use agent_settings::{AgentProfile, AgentProfileId, AgentSettings, CompletionMode}; use anyhow::{Context as _, Result, anyhow}; -use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings, CompletionMode}; use assistant_tool::{ToolId, ToolSource, ToolWorkingSet}; use chrono::{DateTime, Utc}; use collections::HashMap; @@ -485,13 +485,13 @@ impl ThreadStore { } fn load_default_profile(&self, cx: &mut Context) { - let assistant_settings = AssistantSettings::get_global(cx); + let assistant_settings = AgentSettings::get_global(cx); self.load_profile_by_id(assistant_settings.default_profile.clone(), cx); } pub fn load_profile_by_id(&self, profile_id: AgentProfileId, cx: &mut Context) { - let assistant_settings = AssistantSettings::get_global(cx); + let assistant_settings = AgentSettings::get_global(cx); if let Some(profile) = assistant_settings.profiles.get(&profile_id) { self.load_profile(profile.clone(), cx); diff --git a/crates/assistant_settings/Cargo.toml b/crates/agent_settings/Cargo.toml similarity index 94% rename from crates/assistant_settings/Cargo.toml rename to crates/agent_settings/Cargo.toml index c46ea64630..200c531c3c 100644 --- a/crates/assistant_settings/Cargo.toml +++ b/crates/agent_settings/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "assistant_settings" +name = "agent_settings" version = "0.1.0" edition.workspace = true publish.workspace = true @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later" workspace = true [lib] -path = "src/assistant_settings.rs" +path = "src/agent_settings.rs" [dependencies] anthropic = { workspace = true, features = ["schemars"] } diff --git a/crates/assistant_settings/LICENSE-GPL b/crates/agent_settings/LICENSE-GPL similarity index 100% rename from crates/assistant_settings/LICENSE-GPL rename to crates/agent_settings/LICENSE-GPL diff --git a/crates/assistant_settings/src/agent_profile.rs b/crates/agent_settings/src/agent_profile.rs similarity index 96% rename from crates/assistant_settings/src/agent_profile.rs rename to crates/agent_settings/src/agent_profile.rs index df6b4b21c2..599932114a 100644 --- a/crates/assistant_settings/src/agent_profile.rs +++ b/crates/agent_settings/src/agent_profile.rs @@ -24,7 +24,7 @@ pub struct GroupedAgentProfiles { } impl GroupedAgentProfiles { - pub fn from_settings(settings: &crate::AssistantSettings) -> Self { + pub fn from_settings(settings: &crate::AgentSettings) -> Self { let mut builtin = IndexMap::default(); let mut custom = IndexMap::default(); diff --git a/crates/assistant_settings/src/assistant_settings.rs b/crates/agent_settings/src/agent_settings.rs similarity index 67% rename from crates/assistant_settings/src/assistant_settings.rs rename to crates/agent_settings/src/agent_settings.rs index 8c0909699b..c4d6d19dd1 100644 --- a/crates/assistant_settings/src/assistant_settings.rs +++ b/crates/agent_settings/src/agent_settings.rs @@ -19,12 +19,12 @@ use settings::{Settings, SettingsSources}; pub use crate::agent_profile::*; pub fn init(cx: &mut App) { - AssistantSettings::register(cx); + AgentSettings::register(cx); } #[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] -pub enum AssistantDockPosition { +pub enum AgentDockPosition { Left, #[default] Right, @@ -51,7 +51,7 @@ pub enum NotifyWhenAgentWaiting { #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)] #[serde(tag = "name", rename_all = "snake_case")] #[schemars(deny_unknown_fields)] -pub enum AssistantProviderContentV1 { +pub enum AgentProviderContentV1 { #[serde(rename = "zed.dev")] ZedDotDev { default_model: Option }, #[serde(rename = "openai")] @@ -88,10 +88,10 @@ pub enum AssistantProviderContentV1 { } #[derive(Default, Clone, Debug)] -pub struct AssistantSettings { +pub struct AgentSettings { pub enabled: bool, pub button: bool, - pub dock: AssistantDockPosition, + pub dock: AgentDockPosition, pub default_width: Pixels, pub default_height: Pixels, pub default_model: LanguageModelSelection, @@ -113,7 +113,7 @@ pub struct AssistantSettings { pub enable_feedback: bool, } -impl AssistantSettings { +impl AgentSettings { pub fn temperature_for_model(model: &Arc, cx: &App) -> Option { let settings = Self::get_global(cx); settings @@ -168,58 +168,56 @@ impl LanguageModelParameters { } } -/// Assistant panel settings +/// Agent panel settings #[derive(Clone, Serialize, Deserialize, Debug, Default)] -pub struct AssistantSettingsContent { +pub struct AgentSettingsContent { #[serde(flatten)] - pub inner: Option, + pub inner: Option, } #[derive(Clone, Serialize, Deserialize, Debug)] #[serde(untagged)] -pub enum AssistantSettingsContentInner { - Versioned(Box), - Legacy(LegacyAssistantSettingsContent), +pub enum AgentSettingsContentInner { + Versioned(Box), + Legacy(LegacyAgentSettingsContent), } -impl AssistantSettingsContentInner { - fn for_v2(content: AssistantSettingsContentV2) -> Self { - AssistantSettingsContentInner::Versioned(Box::new(VersionedAssistantSettingsContent::V2( - content, - ))) +impl AgentSettingsContentInner { + fn for_v2(content: AgentSettingsContentV2) -> Self { + AgentSettingsContentInner::Versioned(Box::new(VersionedAgentSettingsContent::V2(content))) } } -impl JsonSchema for AssistantSettingsContent { +impl JsonSchema for AgentSettingsContent { fn schema_name() -> String { - VersionedAssistantSettingsContent::schema_name() + VersionedAgentSettingsContent::schema_name() } fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> Schema { - VersionedAssistantSettingsContent::json_schema(r#gen) + VersionedAgentSettingsContent::json_schema(r#gen) } fn is_referenceable() -> bool { - VersionedAssistantSettingsContent::is_referenceable() + VersionedAgentSettingsContent::is_referenceable() } } -impl AssistantSettingsContent { +impl AgentSettingsContent { pub fn is_version_outdated(&self) -> bool { match &self.inner { - Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { - VersionedAssistantSettingsContent::V1(_) => true, - VersionedAssistantSettingsContent::V2(_) => false, + Some(AgentSettingsContentInner::Versioned(settings)) => match **settings { + VersionedAgentSettingsContent::V1(_) => true, + VersionedAgentSettingsContent::V2(_) => false, }, - Some(AssistantSettingsContentInner::Legacy(_)) => true, + Some(AgentSettingsContentInner::Legacy(_)) => true, None => false, } } - fn upgrade(&self) -> AssistantSettingsContentV2 { + fn upgrade(&self) -> AgentSettingsContentV2 { match &self.inner { - Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { - VersionedAssistantSettingsContent::V1(ref settings) => AssistantSettingsContentV2 { + Some(AgentSettingsContentInner::Versioned(settings)) => match **settings { + VersionedAgentSettingsContent::V1(ref settings) => AgentSettingsContentV2 { enabled: settings.enabled, button: settings.button, dock: settings.dock, @@ -229,48 +227,42 @@ impl AssistantSettingsContent { .provider .clone() .and_then(|provider| match provider { - AssistantProviderContentV1::ZedDotDev { default_model } => { - default_model.map(|model| LanguageModelSelection { + AgentProviderContentV1::ZedDotDev { default_model } => default_model + .map(|model| LanguageModelSelection { provider: "zed.dev".into(), model, - }) - } - AssistantProviderContentV1::OpenAi { default_model, .. } => { - default_model.map(|model| LanguageModelSelection { + }), + AgentProviderContentV1::OpenAi { default_model, .. } => default_model + .map(|model| LanguageModelSelection { provider: "openai".into(), model: model.id().to_string(), - }) - } - AssistantProviderContentV1::Anthropic { default_model, .. } => { + }), + AgentProviderContentV1::Anthropic { default_model, .. } => { default_model.map(|model| LanguageModelSelection { provider: "anthropic".into(), model: model.id().to_string(), }) } - AssistantProviderContentV1::Ollama { default_model, .. } => { - default_model.map(|model| LanguageModelSelection { + AgentProviderContentV1::Ollama { default_model, .. } => default_model + .map(|model| LanguageModelSelection { provider: "ollama".into(), model: model.id().to_string(), - }) - } - AssistantProviderContentV1::LmStudio { default_model, .. } => { - default_model.map(|model| LanguageModelSelection { + }), + AgentProviderContentV1::LmStudio { default_model, .. } => default_model + .map(|model| LanguageModelSelection { provider: "lmstudio".into(), model: model.id().to_string(), - }) - } - AssistantProviderContentV1::DeepSeek { default_model, .. } => { - default_model.map(|model| LanguageModelSelection { + }), + AgentProviderContentV1::DeepSeek { default_model, .. } => default_model + .map(|model| LanguageModelSelection { provider: "deepseek".into(), model: model.id().to_string(), - }) - } - AssistantProviderContentV1::Mistral { default_model, .. } => { - default_model.map(|model| LanguageModelSelection { + }), + AgentProviderContentV1::Mistral { default_model, .. } => default_model + .map(|model| LanguageModelSelection { provider: "mistral".into(), model: model.id().to_string(), - }) - } + }), }), inline_assistant_model: None, commit_message_model: None, @@ -288,9 +280,9 @@ impl AssistantSettingsContent { enable_feedback: None, play_sound_when_agent_done: None, }, - VersionedAssistantSettingsContent::V2(ref settings) => settings.clone(), + VersionedAgentSettingsContent::V2(ref settings) => settings.clone(), }, - Some(AssistantSettingsContentInner::Legacy(settings)) => AssistantSettingsContentV2 { + Some(AgentSettingsContentInner::Legacy(settings)) => AgentSettingsContentV2 { enabled: None, button: settings.button, dock: settings.dock, @@ -321,30 +313,28 @@ impl AssistantSettingsContent { enable_feedback: None, play_sound_when_agent_done: None, }, - None => AssistantSettingsContentV2::default(), + None => AgentSettingsContentV2::default(), } } - pub fn set_dock(&mut self, dock: AssistantDockPosition) { + pub fn set_dock(&mut self, dock: AgentDockPosition) { match &mut self.inner { - Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { - VersionedAssistantSettingsContent::V1(ref mut settings) => { + Some(AgentSettingsContentInner::Versioned(settings)) => match **settings { + VersionedAgentSettingsContent::V1(ref mut settings) => { settings.dock = Some(dock); } - VersionedAssistantSettingsContent::V2(ref mut settings) => { + VersionedAgentSettingsContent::V2(ref mut settings) => { settings.dock = Some(dock); } }, - Some(AssistantSettingsContentInner::Legacy(settings)) => { + Some(AgentSettingsContentInner::Legacy(settings)) => { settings.dock = Some(dock); } None => { - self.inner = Some(AssistantSettingsContentInner::for_v2( - AssistantSettingsContentV2 { - dock: Some(dock), - ..Default::default() - }, - )) + self.inner = Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { + dock: Some(dock), + ..Default::default() + })) } } } @@ -354,107 +344,99 @@ impl AssistantSettingsContent { let provider = language_model.provider_id().0.to_string(); match &mut self.inner { - Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { - VersionedAssistantSettingsContent::V1(ref mut settings) => { - match provider.as_ref() { - "zed.dev" => { - log::warn!("attempted to set zed.dev model on outdated settings"); - } - "anthropic" => { - let api_url = match &settings.provider { - Some(AssistantProviderContentV1::Anthropic { api_url, .. }) => { - api_url.clone() - } - _ => None, - }; - settings.provider = Some(AssistantProviderContentV1::Anthropic { - default_model: AnthropicModel::from_id(&model).ok(), - api_url, - }); - } - "ollama" => { - let api_url = match &settings.provider { - Some(AssistantProviderContentV1::Ollama { api_url, .. }) => { - api_url.clone() - } - _ => None, - }; - settings.provider = Some(AssistantProviderContentV1::Ollama { - default_model: Some(ollama::Model::new( - &model, - None, - None, - Some(language_model.supports_tools()), - )), - api_url, - }); - } - "lmstudio" => { - let api_url = match &settings.provider { - Some(AssistantProviderContentV1::LmStudio { api_url, .. }) => { - api_url.clone() - } - _ => None, - }; - settings.provider = Some(AssistantProviderContentV1::LmStudio { - default_model: Some(lmstudio::Model::new( - &model, None, None, false, - )), - api_url, - }); - } - "openai" => { - let (api_url, available_models) = match &settings.provider { - Some(AssistantProviderContentV1::OpenAi { - api_url, - available_models, - .. - }) => (api_url.clone(), available_models.clone()), - _ => (None, None), - }; - settings.provider = Some(AssistantProviderContentV1::OpenAi { - default_model: OpenAiModel::from_id(&model).ok(), + Some(AgentSettingsContentInner::Versioned(settings)) => match **settings { + VersionedAgentSettingsContent::V1(ref mut settings) => match provider.as_ref() { + "zed.dev" => { + log::warn!("attempted to set zed.dev model on outdated settings"); + } + "anthropic" => { + let api_url = match &settings.provider { + Some(AgentProviderContentV1::Anthropic { api_url, .. }) => { + api_url.clone() + } + _ => None, + }; + settings.provider = Some(AgentProviderContentV1::Anthropic { + default_model: AnthropicModel::from_id(&model).ok(), + api_url, + }); + } + "ollama" => { + let api_url = match &settings.provider { + Some(AgentProviderContentV1::Ollama { api_url, .. }) => api_url.clone(), + _ => None, + }; + settings.provider = Some(AgentProviderContentV1::Ollama { + default_model: Some(ollama::Model::new( + &model, + None, + None, + Some(language_model.supports_tools()), + )), + api_url, + }); + } + "lmstudio" => { + let api_url = match &settings.provider { + Some(AgentProviderContentV1::LmStudio { api_url, .. }) => { + api_url.clone() + } + _ => None, + }; + settings.provider = Some(AgentProviderContentV1::LmStudio { + default_model: Some(lmstudio::Model::new(&model, None, None, false)), + api_url, + }); + } + "openai" => { + let (api_url, available_models) = match &settings.provider { + Some(AgentProviderContentV1::OpenAi { api_url, available_models, - }); - } - "deepseek" => { - let api_url = match &settings.provider { - Some(AssistantProviderContentV1::DeepSeek { api_url, .. }) => { - api_url.clone() - } - _ => None, - }; - settings.provider = Some(AssistantProviderContentV1::DeepSeek { - default_model: DeepseekModel::from_id(&model).ok(), - api_url, - }); - } - _ => {} + .. + }) => (api_url.clone(), available_models.clone()), + _ => (None, None), + }; + settings.provider = Some(AgentProviderContentV1::OpenAi { + default_model: OpenAiModel::from_id(&model).ok(), + api_url, + available_models, + }); } - } - VersionedAssistantSettingsContent::V2(ref mut settings) => { + "deepseek" => { + let api_url = match &settings.provider { + Some(AgentProviderContentV1::DeepSeek { api_url, .. }) => { + api_url.clone() + } + _ => None, + }; + settings.provider = Some(AgentProviderContentV1::DeepSeek { + default_model: DeepseekModel::from_id(&model).ok(), + api_url, + }); + } + _ => {} + }, + VersionedAgentSettingsContent::V2(ref mut settings) => { settings.default_model = Some(LanguageModelSelection { provider: provider.into(), model, }); } }, - Some(AssistantSettingsContentInner::Legacy(settings)) => { + Some(AgentSettingsContentInner::Legacy(settings)) => { if let Ok(model) = OpenAiModel::from_id(&language_model.id().0) { settings.default_open_ai_model = Some(model); } } None => { - self.inner = Some(AssistantSettingsContentInner::for_v2( - AssistantSettingsContentV2 { - default_model: Some(LanguageModelSelection { - provider: provider.into(), - model, - }), - ..Default::default() - }, - )); + self.inner = Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { + default_model: Some(LanguageModelSelection { + provider: provider.into(), + model, + }), + ..Default::default() + })); } } } @@ -483,15 +465,15 @@ impl AssistantSettingsContent { pub fn v2_setting( &mut self, - f: impl FnOnce(&mut AssistantSettingsContentV2) -> anyhow::Result<()>, + f: impl FnOnce(&mut AgentSettingsContentV2) -> anyhow::Result<()>, ) -> anyhow::Result<()> { match self.inner.get_or_insert_with(|| { - AssistantSettingsContentInner::for_v2(AssistantSettingsContentV2 { + AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { ..Default::default() }) }) { - AssistantSettingsContentInner::Versioned(boxed) => { - if let VersionedAssistantSettingsContent::V2(ref mut settings) = **boxed { + AgentSettingsContentInner::Versioned(boxed) => { + if let VersionedAgentSettingsContent::V2(ref mut settings) = **boxed { f(settings) } else { Ok(()) @@ -584,16 +566,16 @@ impl AssistantSettingsContent { #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[serde(tag = "version")] #[schemars(deny_unknown_fields)] -pub enum VersionedAssistantSettingsContent { +pub enum VersionedAgentSettingsContent { #[serde(rename = "1")] - V1(AssistantSettingsContentV1), + V1(AgentSettingsContentV1), #[serde(rename = "2")] - V2(AssistantSettingsContentV2), + V2(AgentSettingsContentV2), } -impl Default for VersionedAssistantSettingsContent { +impl Default for VersionedAgentSettingsContent { fn default() -> Self { - Self::V2(AssistantSettingsContentV2 { + Self::V2(AgentSettingsContentV2 { enabled: None, button: None, dock: None, @@ -621,8 +603,8 @@ impl Default for VersionedAssistantSettingsContent { #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug, Default)] #[schemars(deny_unknown_fields)] -pub struct AssistantSettingsContentV2 { - /// Whether the Assistant is enabled. +pub struct AgentSettingsContentV2 { + /// Whether the Agent is enabled. /// /// Default: true enabled: Option, @@ -633,7 +615,7 @@ pub struct AssistantSettingsContentV2 { /// Where to dock the agent panel. /// /// Default: right - dock: Option, + dock: Option, /// Default width in pixels when the agent panel is docked to the left or right. /// /// Default: 640 @@ -792,50 +774,50 @@ pub struct ContextServerPresetContent { #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[schemars(deny_unknown_fields)] -pub struct AssistantSettingsContentV1 { - /// Whether the Assistant is enabled. +pub struct AgentSettingsContentV1 { + /// Whether the Agent is enabled. /// /// Default: true enabled: Option, - /// Whether to show the assistant panel button in the status bar. + /// Whether to show the Agent panel button in the status bar. /// /// Default: true button: Option, - /// Where to dock the assistant. + /// Where to dock the Agent. /// /// Default: right - dock: Option, - /// Default width in pixels when the assistant is docked to the left or right. + dock: Option, + /// Default width in pixels when the Agent is docked to the left or right. /// /// Default: 640 default_width: Option, - /// Default height in pixels when the assistant is docked to the bottom. + /// Default height in pixels when the Agent is docked to the bottom. /// /// Default: 320 default_height: Option, - /// The provider of the assistant service. + /// The provider of the Agent service. /// /// This can be "openai", "anthropic", "ollama", "lmstudio", "deepseek", "zed.dev" /// each with their respective default models and configurations. - provider: Option, + provider: Option, } #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[schemars(deny_unknown_fields)] -pub struct LegacyAssistantSettingsContent { - /// Whether to show the assistant panel button in the status bar. +pub struct LegacyAgentSettingsContent { + /// Whether to show the Agent panel button in the status bar. /// /// Default: true pub button: Option, - /// Where to dock the assistant. + /// Where to dock the Agent. /// /// Default: right - pub dock: Option, - /// Default width in pixels when the assistant is docked to the left or right. + pub dock: Option, + /// Default width in pixels when the Agent is docked to the left or right. /// /// Default: 640 pub default_width: Option, - /// Default height in pixels when the assistant is docked to the bottom. + /// Default height in pixels when the Agent is docked to the bottom. /// /// Default: 320 pub default_height: Option, @@ -849,20 +831,20 @@ pub struct LegacyAssistantSettingsContent { pub openai_api_url: Option, } -impl Settings for AssistantSettings { +impl Settings for AgentSettings { const KEY: Option<&'static str> = Some("agent"); const FALLBACK_KEY: Option<&'static str> = Some("assistant"); const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]); - type FileContent = AssistantSettingsContent; + type FileContent = AgentSettingsContent; fn load( sources: SettingsSources, _: &mut gpui::App, ) -> anyhow::Result { - let mut settings = AssistantSettings::default(); + let mut settings = AgentSettings::default(); for value in sources.defaults_and_customizations() { if value.is_version_outdated() { @@ -957,28 +939,25 @@ impl Settings for AssistantSettings { .and_then(|b| b.as_bool()) { match &mut current.inner { - Some(AssistantSettingsContentInner::Versioned(versioned)) => { - match versioned.as_mut() { - VersionedAssistantSettingsContent::V1(setting) => { - setting.enabled = Some(b); - setting.button = Some(b); - } - - VersionedAssistantSettingsContent::V2(setting) => { - setting.enabled = Some(b); - setting.button = Some(b); - } + Some(AgentSettingsContentInner::Versioned(versioned)) => match versioned.as_mut() { + VersionedAgentSettingsContent::V1(setting) => { + setting.enabled = Some(b); + setting.button = Some(b); } - } - Some(AssistantSettingsContentInner::Legacy(setting)) => setting.button = Some(b), + + VersionedAgentSettingsContent::V2(setting) => { + setting.enabled = Some(b); + setting.button = Some(b); + } + }, + Some(AgentSettingsContentInner::Legacy(setting)) => setting.button = Some(b), None => { - current.inner = Some(AssistantSettingsContentInner::for_v2( - AssistantSettingsContentV2 { + current.inner = + Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { enabled: Some(b), button: Some(b), ..Default::default() - }, - )); + })); } } } @@ -1000,7 +979,7 @@ mod tests { use super::*; #[gpui::test] - async fn test_deserialize_assistant_settings_with_version(cx: &mut TestAppContext) { + async fn test_deserialize_agent_settings_with_version(cx: &mut TestAppContext) { let fs = fs::FakeFs::new(cx.executor().clone()); fs.create_dir(paths::settings_file().parent().unwrap()) .await @@ -1009,13 +988,13 @@ mod tests { cx.update(|cx| { let test_settings = settings::SettingsStore::test(cx); cx.set_global(test_settings); - AssistantSettings::register(cx); + AgentSettings::register(cx); }); cx.update(|cx| { - assert!(!AssistantSettings::get_global(cx).using_outdated_settings_version); + assert!(!AgentSettings::get_global(cx).using_outdated_settings_version); assert_eq!( - AssistantSettings::get_global(cx).default_model, + AgentSettings::get_global(cx).default_model, LanguageModelSelection { provider: "zed.dev".into(), model: "claude-sonnet-4".into(), @@ -1024,38 +1003,36 @@ mod tests { }); cx.update(|cx| { - settings::SettingsStore::global(cx).update_settings_file::( + settings::SettingsStore::global(cx).update_settings_file::( fs.clone(), |settings, _| { - *settings = AssistantSettingsContent { - inner: Some(AssistantSettingsContentInner::for_v2( - AssistantSettingsContentV2 { - default_model: Some(LanguageModelSelection { - provider: "test-provider".into(), - model: "gpt-99".into(), - }), - inline_assistant_model: None, - commit_message_model: None, - thread_summary_model: None, - inline_alternatives: None, - enabled: None, - button: None, - dock: None, - default_width: None, - default_height: None, - default_profile: None, - default_view: None, - profiles: None, - always_allow_tool_actions: None, - play_sound_when_agent_done: None, - notify_when_agent_waiting: None, - stream_edits: None, - single_file_review: None, - enable_feedback: None, - model_parameters: Vec::new(), - preferred_completion_mode: None, - }, - )), + *settings = AgentSettingsContent { + inner: Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { + default_model: Some(LanguageModelSelection { + provider: "test-provider".into(), + model: "gpt-99".into(), + }), + inline_assistant_model: None, + commit_message_model: None, + thread_summary_model: None, + inline_alternatives: None, + enabled: None, + button: None, + dock: None, + default_width: None, + default_height: None, + default_profile: None, + default_view: None, + profiles: None, + always_allow_tool_actions: None, + play_sound_when_agent_done: None, + notify_when_agent_waiting: None, + stream_edits: None, + single_file_review: None, + enable_feedback: None, + model_parameters: Vec::new(), + preferred_completion_mode: None, + })), } }, ); @@ -1067,14 +1044,14 @@ mod tests { assert!(raw_settings_value.contains(r#""version": "2""#)); #[derive(Debug, Deserialize)] - struct AssistantSettingsTest { - agent: AssistantSettingsContent, + struct AgentSettingsTest { + agent: AgentSettingsContent, } - let assistant_settings: AssistantSettingsTest = + let agent_settings: AgentSettingsTest = serde_json_lenient::from_str(&raw_settings_value).unwrap(); - assert!(!assistant_settings.agent.is_version_outdated()); + assert!(!agent_settings.agent.is_version_outdated()); } #[gpui::test] @@ -1099,29 +1076,27 @@ mod tests { .set_user_settings(user_settings_content, cx) .unwrap(); cx.set_global(test_settings); - AssistantSettings::register(cx); + AgentSettings::register(cx); }); cx.run_until_parked(); - let assistant_settings = cx.update(|cx| AssistantSettings::get_global(cx).clone()); - assert!(assistant_settings.enabled); - assert!(!assistant_settings.using_outdated_settings_version); - assert_eq!(assistant_settings.default_model.model, "gpt-99"); + let agent_settings = cx.update(|cx| AgentSettings::get_global(cx).clone()); + assert!(agent_settings.enabled); + assert!(!agent_settings.using_outdated_settings_version); + assert_eq!(agent_settings.default_model.model, "gpt-99"); cx.update_global::(|settings_store, cx| { - settings_store.update_user_settings::(cx, |settings| { - *settings = AssistantSettingsContent { - inner: Some(AssistantSettingsContentInner::for_v2( - AssistantSettingsContentV2 { - enabled: Some(false), - default_model: Some(LanguageModelSelection { - provider: "xai".to_owned().into(), - model: "grok".to_owned(), - }), - ..Default::default() - }, - )), + settings_store.update_user_settings::(cx, |settings| { + *settings = AgentSettingsContent { + inner: Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 { + enabled: Some(false), + default_model: Some(LanguageModelSelection { + provider: "xai".to_owned().into(), + model: "grok".to_owned(), + }), + ..Default::default() + })), }; }); }); @@ -1131,12 +1106,12 @@ mod tests { let settings = cx.update(|cx| SettingsStore::global(cx).raw_user_settings().clone()); #[derive(Debug, Deserialize)] - struct AssistantSettingsTest { - assistant: AssistantSettingsContent, + struct AgentSettingsTest { + assistant: AgentSettingsContent, agent: Option, } - let assistant_settings: AssistantSettingsTest = serde_json::from_value(settings).unwrap(); - assert!(assistant_settings.agent.is_none()); + let agent_settings: AgentSettingsTest = serde_json::from_value(settings).unwrap(); + assert!(agent_settings.agent.is_none()); } } diff --git a/crates/assistant_context_editor/Cargo.toml b/crates/assistant_context_editor/Cargo.toml index 8a1f9b1aaa..d0538669f2 100644 --- a/crates/assistant_context_editor/Cargo.toml +++ b/crates/assistant_context_editor/Cargo.toml @@ -12,8 +12,8 @@ workspace = true path = "src/assistant_context_editor.rs" [dependencies] +agent_settings.workspace = true anyhow.workspace = true -assistant_settings.workspace = true assistant_slash_command.workspace = true assistant_slash_commands.workspace = true chrono.workspace = true diff --git a/crates/assistant_context_editor/src/context.rs b/crates/assistant_context_editor/src/context.rs index ce12bd1ce8..fe1a89b0cd 100644 --- a/crates/assistant_context_editor/src/context.rs +++ b/crates/assistant_context_editor/src/context.rs @@ -1,8 +1,8 @@ #[cfg(test)] mod context_tests; +use agent_settings::AgentSettings; use anyhow::{Context as _, Result, bail}; -use assistant_settings::AssistantSettings; use assistant_slash_command::{ SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandResult, SlashCommandWorkingSet, @@ -2266,8 +2266,7 @@ impl AssistantContext { tools: Vec::new(), tool_choice: None, stop: Vec::new(), - temperature: model - .and_then(|model| AssistantSettings::temperature_for_model(model, cx)), + temperature: model.and_then(|model| AgentSettings::temperature_for_model(model, cx)), }; for message in self.messages(cx) { if message.status != MessageStatus::Done { diff --git a/crates/assistant_context_editor/src/context/context_tests.rs b/crates/assistant_context_editor/src/context/context_tests.rs index 3983a90158..2379ec4474 100644 --- a/crates/assistant_context_editor/src/context/context_tests.rs +++ b/crates/assistant_context_editor/src/context/context_tests.rs @@ -1386,7 +1386,7 @@ fn init_test(cx: &mut App) { LanguageModelRegistry::test(cx); cx.set_global(settings_store); language::init(cx); - assistant_settings::init(cx); + agent_settings::init(cx); Project::init_settings(cx); } diff --git a/crates/assistant_context_editor/src/context_editor.rs b/crates/assistant_context_editor/src/context_editor.rs index c643b4b737..27c35058dd 100644 --- a/crates/assistant_context_editor/src/context_editor.rs +++ b/crates/assistant_context_editor/src/context_editor.rs @@ -1,8 +1,8 @@ use crate::language_model_selector::{ LanguageModelSelector, LanguageModelSelectorPopoverMenu, ToggleModelSelector, }; +use agent_settings::AgentSettings; use anyhow::Result; -use assistant_settings::AssistantSettings; use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet}; use assistant_slash_commands::{ DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand, @@ -283,7 +283,7 @@ impl ContextEditor { LanguageModelSelector::new( |cx| LanguageModelRegistry::read_global(cx).default_model(), move |model, cx| { - update_settings_file::( + update_settings_file::( fs.clone(), cx, move |settings, _| settings.set_model(model.clone()), @@ -3366,7 +3366,7 @@ mod tests { LanguageModelRegistry::test(cx); cx.set_global(settings_store); language::init(cx); - assistant_settings::init(cx); + agent_settings::init(cx); Project::init_settings(cx); theme::init(theme::LoadThemes::JustBase, cx); workspace::init_settings(cx); diff --git a/crates/assistant_tools/Cargo.toml b/crates/assistant_tools/Cargo.toml index 6d6baf2d54..8ab8ab67db 100644 --- a/crates/assistant_tools/Cargo.toml +++ b/crates/assistant_tools/Cargo.toml @@ -15,9 +15,9 @@ path = "src/assistant_tools.rs" eval = [] [dependencies] +agent_settings.workspace = true aho-corasick.workspace = true anyhow.workspace = true -assistant_settings.workspace = true assistant_tool.workspace = true buffer_diff.workspace = true chrono.workspace = true diff --git a/crates/assistant_tools/src/assistant_tools.rs b/crates/assistant_tools/src/assistant_tools.rs index f8ba3418b7..6bed4c216b 100644 --- a/crates/assistant_tools/src/assistant_tools.rs +++ b/crates/assistant_tools/src/assistant_tools.rs @@ -96,7 +96,7 @@ fn register_web_search_tool(registry: &Entity, cx: &mut A #[cfg(test)] mod tests { use super::*; - use assistant_settings::AssistantSettings; + use agent_settings::AgentSettings; use client::Client; use clock::FakeSystemClock; use http_client::FakeHttpClient; @@ -133,7 +133,7 @@ mod tests { #[gpui::test] fn test_builtin_tool_schema_compatibility(cx: &mut App) { settings::init(cx); - AssistantSettings::register(cx); + AgentSettings::register(cx); let client = Client::new( Arc::new(FakeSystemClock::new()), diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index 17119a9a95..6ebeb0ced3 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -76,8 +76,8 @@ workspace-hack.workspace = true zed_llm_client.workspace = true [dev-dependencies] +agent_settings.workspace = true assistant_context_editor.workspace = true -assistant_settings.workspace = true assistant_slash_command.workspace = true assistant_tool.workspace = true async-trait.workspace = true diff --git a/crates/collab/src/tests/test_server.rs b/crates/collab/src/tests/test_server.rs index 2397ab1c00..dc71879a75 100644 --- a/crates/collab/src/tests/test_server.rs +++ b/crates/collab/src/tests/test_server.rs @@ -312,7 +312,7 @@ impl TestServer { ); language_model::LanguageModelRegistry::test(cx); assistant_context_editor::init(client.clone(), cx); - assistant_settings::init(cx); + agent_settings::init(cx); }); client diff --git a/crates/eval/Cargo.toml b/crates/eval/Cargo.toml index 408463b1bc..a1426dd026 100644 --- a/crates/eval/Cargo.toml +++ b/crates/eval/Cargo.toml @@ -19,8 +19,8 @@ path = "src/explorer.rs" [dependencies] agent.workspace = true +agent_settings.workspace = true anyhow.workspace = true -assistant_settings.workspace = true assistant_tool.workspace = true assistant_tools.workspace = true async-trait.workspace = true diff --git a/crates/eval/src/example.rs b/crates/eval/src/example.rs index ed7f139d28..cafc5d996f 100644 --- a/crates/eval/src/example.rs +++ b/crates/eval/src/example.rs @@ -11,8 +11,8 @@ use crate::{ assertions::{AssertionsReport, RanAssertion, RanAssertionResult}, }; use agent::{ContextLoadResult, Thread, ThreadEvent}; +use agent_settings::AgentProfileId; use anyhow::{Result, anyhow}; -use assistant_settings::AgentProfileId; use async_trait::async_trait; use buffer_diff::DiffHunkStatus; use collections::HashMap; diff --git a/crates/eval/src/examples/add_arg_to_trait_method.rs b/crates/eval/src/examples/add_arg_to_trait_method.rs index 19cfc44d18..b9f306f841 100644 --- a/crates/eval/src/examples/add_arg_to_trait_method.rs +++ b/crates/eval/src/examples/add_arg_to_trait_method.rs @@ -1,7 +1,7 @@ use std::path::Path; +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use async_trait::async_trait; use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion, LanguageServer}; diff --git a/crates/eval/src/examples/code_block_citations.rs b/crates/eval/src/examples/code_block_citations.rs index 4de69ecaa4..f0c2074ce5 100644 --- a/crates/eval/src/examples/code_block_citations.rs +++ b/crates/eval/src/examples/code_block_citations.rs @@ -1,5 +1,5 @@ +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use async_trait::async_trait; use markdown::PathWithRange; diff --git a/crates/eval/src/examples/comment_translation.rs b/crates/eval/src/examples/comment_translation.rs index f4a7db1f94..3a4999bc85 100644 --- a/crates/eval/src/examples/comment_translation.rs +++ b/crates/eval/src/examples/comment_translation.rs @@ -1,6 +1,6 @@ use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion}; +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use assistant_tools::{EditFileMode, EditFileToolInput}; use async_trait::async_trait; diff --git a/crates/eval/src/examples/file_search.rs b/crates/eval/src/examples/file_search.rs index b6334710c9..9056326db9 100644 --- a/crates/eval/src/examples/file_search.rs +++ b/crates/eval/src/examples/file_search.rs @@ -1,5 +1,5 @@ +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use assistant_tools::FindPathToolInput; use async_trait::async_trait; use regex::Regex; diff --git a/crates/eval/src/examples/mod.rs b/crates/eval/src/examples/mod.rs index b11f62ab76..edf3265186 100644 --- a/crates/eval/src/examples/mod.rs +++ b/crates/eval/src/examples/mod.rs @@ -1,5 +1,5 @@ +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use async_trait::async_trait; use serde::Deserialize; use std::collections::BTreeMap; diff --git a/crates/eval/src/examples/overwrite_file.rs b/crates/eval/src/examples/overwrite_file.rs index 4438f37a06..57c83a40f7 100644 --- a/crates/eval/src/examples/overwrite_file.rs +++ b/crates/eval/src/examples/overwrite_file.rs @@ -1,5 +1,5 @@ +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use assistant_tools::{EditFileMode, EditFileToolInput}; use async_trait::async_trait; diff --git a/crates/eval/src/examples/planets.rs b/crates/eval/src/examples/planets.rs index 53e926332b..9363c4ac9a 100644 --- a/crates/eval/src/examples/planets.rs +++ b/crates/eval/src/examples/planets.rs @@ -1,5 +1,5 @@ +use agent_settings::AgentProfileId; use anyhow::Result; -use assistant_settings::AgentProfileId; use assistant_tool::Tool; use assistant_tools::{OpenTool, TerminalTool}; use async_trait::async_trait; diff --git a/crates/git_ui/Cargo.toml b/crates/git_ui/Cargo.toml index 3447982d92..4aabae1426 100644 --- a/crates/git_ui/Cargo.toml +++ b/crates/git_ui/Cargo.toml @@ -17,9 +17,9 @@ default = [] test-support = ["multi_buffer/test-support"] [dependencies] +agent_settings.workspace = true anyhow.workspace = true askpass.workspace = true -assistant_settings.workspace = true buffer_diff.workspace = true chrono.workspace = true collections.workspace = true @@ -56,9 +56,9 @@ time.workspace = true time_format.workspace = true ui.workspace = true util.workspace = true +workspace-hack.workspace = true workspace.workspace = true zed_actions.workspace = true -workspace-hack.workspace = true [target.'cfg(windows)'.dependencies] windows.workspace = true diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 3b1d7c99a7..c7b15c011e 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -9,9 +9,9 @@ use crate::{branch_picker, picker_prompt, render_remote_button}; use crate::{ git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector, }; +use agent_settings::AgentSettings; use anyhow::Context as _; use askpass::AskPassDelegate; -use assistant_settings::AssistantSettings; use db::kvp::KEY_VALUE_STORE; use editor::{ @@ -481,10 +481,10 @@ impl GitPanel { hide_task: None, }; - let mut assistant_enabled = AssistantSettings::get_global(cx).enabled; + let mut assistant_enabled = AgentSettings::get_global(cx).enabled; let _settings_subscription = cx.observe_global::(move |_, cx| { - if assistant_enabled != AssistantSettings::get_global(cx).enabled { - assistant_enabled = AssistantSettings::get_global(cx).enabled; + if assistant_enabled != AgentSettings::get_global(cx).enabled { + assistant_enabled = AgentSettings::get_global(cx).enabled; cx.notify(); } }); @@ -1747,7 +1747,7 @@ impl GitPanel { } }); - let temperature = AssistantSettings::temperature_for_model(&model, cx); + let temperature = AgentSettings::temperature_for_model(&model, cx); self.generate_commit_message_task = Some(cx.spawn(async move |this, cx| { async move { @@ -4061,7 +4061,7 @@ impl GitPanel { } fn current_language_model(cx: &Context<'_, GitPanel>) -> Option> { - assistant_settings::AssistantSettings::get_global(cx) + agent_settings::AgentSettings::get_global(cx) .enabled .then(|| { let ConfiguredModel { provider, model } = @@ -4784,7 +4784,7 @@ mod tests { cx.update(|cx| { let settings_store = SettingsStore::test(cx); cx.set_global(settings_store); - AssistantSettings::register(cx); + AgentSettings::register(cx); WorktreeSettings::register(cx); workspace::init_settings(cx); theme::init(LoadThemes::JustBase, cx); diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index b89427d5ba..2847df6953 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -17,11 +17,11 @@ path = "src/main.rs" [dependencies] activity_indicator.workspace = true agent.workspace = true +agent_settings.workspace = true anyhow.workspace = true askpass.workspace = true assets.workspace = true assistant_context_editor.workspace = true -assistant_settings.workspace = true assistant_tool.workspace = true assistant_tools.workspace = true async-watch.workspace = true @@ -42,10 +42,10 @@ command_palette.workspace = true component.workspace = true copilot.workspace = true dap_adapters.workspace = true -debugger_ui.workspace = true -debugger_tools.workspace = true db.workspace = true debug_adapter_extension.workspace = true +debugger_tools.workspace = true +debugger_ui.workspace = true diagnostics.workspace = true editor.workspace = true env_logger.workspace = true @@ -80,8 +80,8 @@ language_tools.workspace = true languages = { workspace = true, features = ["load-grammars"] } libc.workspace = true log.workspace = true -markdown_preview.workspace = true markdown.workspace = true +markdown_preview.workspace = true menu.workspace = true migrator.workspace = true mimalloc = { version = "0.1", optional = true } @@ -141,12 +141,12 @@ vim_mode_setting.workspace = true web_search.workspace = true web_search_providers.workspace = true welcome.workspace = true +workspace-hack.workspace = true workspace.workspace = true zed_actions.workspace = true zeta.workspace = true zlog.workspace = true zlog_settings.workspace = true -workspace-hack.workspace = true [target.'cfg(target_os = "windows")'.dependencies] windows.workspace = true diff --git a/crates/zed/src/zed/quick_action_bar.rs b/crates/zed/src/zed/quick_action_bar.rs index 71b17abab4..7bfab92e9a 100644 --- a/crates/zed/src/zed/quick_action_bar.rs +++ b/crates/zed/src/zed/quick_action_bar.rs @@ -1,6 +1,6 @@ mod markdown_preview; mod repl_menu; -use assistant_settings::AssistantSettings; +use agent_settings::AgentSettings; use editor::actions::{ AddSelectionAbove, AddSelectionBelow, CodeActionSource, DuplicateLineDown, GoToDiagnostic, GoToHunk, GoToPreviousDiagnostic, GoToPreviousHunk, MoveLineDown, MoveLineUp, SelectAll, @@ -558,8 +558,7 @@ impl Render for QuickActionBar { .children(self.render_toggle_markdown_preview(self.workspace.clone(), cx)) .children(search_button) .when( - AssistantSettings::get_global(cx).enabled - && AssistantSettings::get_global(cx).button, + AgentSettings::get_global(cx).enabled && AgentSettings::get_global(cx).button, |bar| bar.child(assistant_button), ) .children(code_actions_dropdown)