Update assistant to agent in settings and keymaps (#29943)

Closes #ISSUE

Release Notes:

- Agent Beta: Renamed the top-level `assistant` settings key to `agent`.
A migration for existing settings files is included.
- Agent Beta: Moved the `assistant::ToggleFocus`,
`assistant::ToggleModelSelector`, and `assistant::OpenRulesLibrary`
actions to the `agent` namespace. Existing keymaps that mention these
actions by their old names will continue to work.

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Cole Miller 2025-05-05 21:02:56 -04:00 committed by Joseph T. Lyons
parent cd96a084c8
commit ebb04b0411
17 changed files with 191 additions and 58 deletions

View File

@ -220,9 +220,9 @@
"ctrl-shift-e": "project_panel::ToggleFocus",
"ctrl-g": "search::SelectNextMatch",
"ctrl-shift-g": "search::SelectPreviousMatch",
"ctrl-alt-/": "assistant::ToggleModelSelector",
"ctrl-alt-/": "agent::ToggleModelSelector",
"ctrl-k h": "assistant::DeployHistory",
"ctrl-k l": "assistant::OpenRulesLibrary",
"ctrl-k l": "agent::OpenRulesLibrary",
"new": "assistant::NewChat",
"ctrl-t": "assistant::NewChat",
"ctrl-n": "assistant::NewChat"
@ -237,7 +237,7 @@
"save": "workspace::Save",
"ctrl->": "assistant::QuoteSelection",
"ctrl-<": "assistant::InsertIntoEditor",
"ctrl-alt-/": "assistant::ToggleModelSelector",
"ctrl-alt-/": "agent::ToggleModelSelector",
"shift-enter": "assistant::Split",
"ctrl-r": "assistant::CycleMessageRole",
"enter": "assistant::ConfirmCommand",
@ -251,9 +251,9 @@
"ctrl-alt-n": "agent::NewTextThread",
"ctrl-shift-h": "agent::OpenHistory",
"ctrl-alt-c": "agent::OpenConfiguration",
"ctrl-alt-p": "assistant::OpenRulesLibrary",
"ctrl-alt-p": "agent::OpenRulesLibrary",
"ctrl-i": "agent::ToggleProfileSelector",
"ctrl-alt-/": "assistant::ToggleModelSelector",
"ctrl-alt-/": "agent::ToggleModelSelector",
"ctrl-shift-a": "agent::ToggleContextPicker",
"ctrl-shift-o": "agent::ToggleNavigationMenu",
"ctrl-shift-i": "agent::ToggleOptionsMenu",
@ -568,7 +568,7 @@
"ctrl-shift-e": "project_panel::ToggleFocus",
"ctrl-shift-b": "outline_panel::ToggleFocus",
"ctrl-shift-g": "git_panel::ToggleFocus",
"ctrl-?": "assistant::ToggleFocus",
"ctrl-?": "agent::ToggleFocus",
"alt-save": "workspace::SaveAll",
"ctrl-alt-s": "workspace::SaveAll",
"ctrl-k m": "language_selector::Toggle",

View File

@ -266,9 +266,9 @@
"cmd-shift-e": "project_panel::ToggleFocus",
"cmd-g": "search::SelectNextMatch",
"cmd-shift-g": "search::SelectPreviousMatch",
"cmd-alt-/": "assistant::ToggleModelSelector",
"cmd-alt-/": "agent::ToggleModelSelector",
"cmd-k h": "assistant::DeployHistory",
"cmd-k l": "assistant::OpenRulesLibrary",
"cmd-k l": "agent::OpenRulesLibrary",
"cmd-t": "assistant::NewChat",
"cmd-n": "assistant::NewChat"
}
@ -282,11 +282,14 @@
"cmd-s": "workspace::Save",
"cmd->": "assistant::QuoteSelection",
"cmd-<": "assistant::InsertIntoEditor",
"cmd-alt-/": "assistant::ToggleModelSelector",
"shift-enter": "assistant::Split",
"ctrl-r": "assistant::CycleMessageRole",
"enter": "assistant::ConfirmCommand",
"alt-enter": "editor::Newline"
"alt-enter": "editor::Newline",
"cmd-k c": "assistant::CopyCode",
"cmd-g": "search::SelectNextMatch",
"cmd-shift-g": "search::SelectPreviousMatch",
"cmd-k l": "agent::OpenRulesLibrary"
}
},
{
@ -297,14 +300,15 @@
"cmd-alt-n": "agent::NewTextThread",
"cmd-shift-h": "agent::OpenHistory",
"cmd-alt-c": "agent::OpenConfiguration",
"cmd-alt-p": "assistant::OpenRulesLibrary",
"cmd-alt-p": "agent::OpenRulesLibrary",
"cmd-i": "agent::ToggleProfileSelector",
"cmd-alt-/": "assistant::ToggleModelSelector",
"cmd-alt-/": "agent::ToggleModelSelector",
"cmd-shift-a": "agent::ToggleContextPicker",
"cmd-shift-o": "agent::ToggleNavigationMenu",
"cmd-shift-i": "agent::ToggleOptionsMenu",
"shift-escape": "agent::ExpandMessageEditor",
"cmd-alt-e": "agent::RemoveAllContext"
"cmd-alt-e": "agent::RemoveAllContext",
"cmd-shift-e": "project_panel::ToggleFocus"
}
},
{
@ -635,7 +639,7 @@
"cmd-shift-e": "project_panel::ToggleFocus",
"cmd-shift-b": "outline_panel::ToggleFocus",
"ctrl-shift-g": "git_panel::ToggleFocus",
"cmd-?": "assistant::ToggleFocus",
"cmd-?": "agent::ToggleFocus",
"cmd-alt-s": "workspace::SaveAll",
"cmd-k m": "language_selector::Toggle",
"escape": "workspace::Unfollow",
@ -774,7 +778,7 @@
"use_key_equivalents": true,
"bindings": {
"cmd-shift-a": "agent::ToggleContextPicker",
"cmd-alt-/": "assistant::ToggleModelSelector",
"cmd-alt-/": "agent::ToggleModelSelector",
"cmd-alt-e": "agent::RemoveAllContext",
"ctrl-[": "assistant::CyclePreviousInlineAssist",
"ctrl-]": "assistant::CycleNextInlineAssist"

View File

@ -632,27 +632,27 @@
// Default width of the notification panel.
"default_width": 380
},
"assistant": {
"agent": {
// Version of this setting.
"version": "2",
// Whether the assistant is enabled.
// Whether the agent is enabled.
"enabled": true,
// Whether to show the assistant panel button in the status bar.
// Whether to show the agent panel button in the status bar.
"button": true,
// Where to dock the assistant panel. Can be 'left', 'right' or 'bottom'.
// Where to dock the agent panel. Can be 'left', 'right' or 'bottom'.
"dock": "right",
// Default width when the assistant is docked to the left or right.
// Default width when the agent panel is docked to the left or right.
"default_width": 640,
// Default height when the assistant is docked to the bottom.
// Default height when the agent panel is docked to the bottom.
"default_height": 320,
// The default model to use when creating new chats.
// The default model to use when creating new threads.
"default_model": {
// The provider to use.
"provider": "zed.dev",
// The model to use.
"model": "claude-3-7-sonnet-latest"
},
// The model to use when applying edits from the assistant.
// The model to use when applying edits from the agent.
"editor_model": {
// The provider to use.
"provider": "zed.dev",
@ -713,7 +713,7 @@
"tools": {}
}
},
// Where to show notifications when an agent has either completed
// Where to show notifications when the agent has either completed
// its response, or else needs confirmation before it can run a
// tool action.
// "primary_screen" - Show the notification only on your primary screen (default)
@ -1000,9 +1000,9 @@
// 2. Display predictions inline only when holding a modifier key (alt by default).
// "mode": "subtle"
"mode": "eager",
// Whether edit predictions are enabled in the assistant panel.
// Whether edit predictions are enabled when editing text threads.
// This setting has no effect if globally disabled.
"enabled_in_assistant": true
"enabled_in_text_threads": true
},
// Settings specific to journaling
"journal": {
@ -1596,7 +1596,7 @@
// }
// ]
"ssh_connections": [],
// Configures context servers for use in the Assistant.
// Configures context servers for use by the agent.
"context_servers": {},
"debugger": {
"stepping_granularity": "line",

View File

@ -219,7 +219,7 @@ impl AgentDiffPane {
.thread
.read(cx)
.summary()
.unwrap_or("Assistant Changes".into());
.unwrap_or("Agent Changes".into());
if new_title != self.title {
self.title = new_title;
cx.emit(EditorEvent::TitleChanged);
@ -473,7 +473,7 @@ impl Item for AgentDiffPane {
.thread
.read(cx)
.summary()
.unwrap_or("Assistant Changes".into());
.unwrap_or("Agent Changes".into());
Label::new(format!("Review: {}", summary))
.color(if params.selected {
Color::Default

View File

@ -772,7 +772,7 @@ impl CodegenAlternative {
cx: &mut Context<CodegenAlternative>,
) {
let transaction = self.buffer.update(cx, |buffer, cx| {
// Avoid grouping assistant edits with user edits.
// Avoid grouping agent edits with user edits.
buffer.finalize_last_transaction(cx);
buffer.start_transaction(cx);
buffer.edit(edits, None, cx);
@ -781,7 +781,7 @@ impl CodegenAlternative {
if let Some(transaction) = transaction {
if let Some(first_transaction) = self.transformation_transaction_id {
// Group all assistant edits into the first transaction.
// Group all agent edits into the first transaction.
self.buffer.update(cx, |buffer, cx| {
buffer.merge_transactions(transaction, first_transaction, cx)
});

View File

@ -998,7 +998,7 @@ impl Thread {
for message in &self.messages {
text.push_str(match message.role {
language_model::Role::User => "User:",
language_model::Role::Assistant => "Assistant:",
language_model::Role::Assistant => "Agent:",
language_model::Role::System => "System:",
});
text.push('\n');
@ -2360,7 +2360,7 @@ impl Thread {
"## {role}\n",
role = match message.role {
Role::User => "User",
Role::Assistant => "Assistant",
Role::Assistant => "Agent",
Role::System => "System",
}
)?;

View File

@ -258,7 +258,7 @@ impl ContextEditor {
let show_edit_predictions = all_language_settings(None, cx)
.edit_predictions
.enabled_in_assistant;
.enabled_in_text_threads;
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
@ -333,7 +333,7 @@ impl ContextEditor {
self.editor.update(cx, |editor, cx| {
let show_edit_predictions = all_language_settings(None, cx)
.edit_predictions
.enabled_in_assistant;
.enabled_in_text_threads;
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
});
@ -1406,7 +1406,7 @@ impl ContextEditor {
None,
),
Role::Assistant => {
let base_label = Label::new("Assistant").color(Color::Info);
let base_label = Label::new("Agent").color(Color::Info);
let mut spinner = None;
let mut note = None;
let animated_label = if llm_loading {
@ -1468,7 +1468,7 @@ impl ContextEditor {
Tooltip::with_meta(
"Toggle message role",
None,
"Available roles: You (User), Assistant, System",
"Available roles: You (User), Agent, System",
window,
cx,
)

View File

@ -693,7 +693,7 @@ pub struct LegacyAssistantSettingsContent {
}
impl Settings for AssistantSettings {
const KEY: Option<&'static str> = Some("assistant");
const KEY: Option<&'static str> = Some("agent");
const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]);
@ -894,12 +894,12 @@ mod tests {
#[derive(Debug, Deserialize)]
struct AssistantSettingsTest {
assistant: AssistantSettingsContent,
agent: AssistantSettingsContent,
}
let assistant_settings: AssistantSettingsTest =
serde_json_lenient::from_str(&raw_settings_value).unwrap();
assert!(!assistant_settings.assistant.is_version_outdated());
assert!(!assistant_settings.agent.is_version_outdated());
}
}

View File

@ -242,7 +242,7 @@ pub struct EditPredictionSettings {
pub copilot: CopilotSettings,
/// Whether edit predictions are enabled in the assistant panel.
/// This setting has no effect if globally disabled.
pub enabled_in_assistant: bool,
pub enabled_in_text_threads: bool,
}
impl EditPredictionSettings {
@ -584,7 +584,7 @@ pub struct EditPredictionSettingsContent {
/// Whether edit predictions are enabled in the assistant prompt editor.
/// This has no effect if globally disabled.
#[serde(default = "default_true")]
pub enabled_in_assistant: bool,
pub enabled_in_text_threads: bool,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
@ -1216,10 +1216,10 @@ impl settings::Settings for AllLanguageSettings {
})
.unwrap_or_default();
let mut edit_predictions_enabled_in_assistant = default_value
let mut enabled_in_text_threads = default_value
.edit_predictions
.as_ref()
.map(|settings| settings.enabled_in_assistant)
.map(|settings| settings.enabled_in_text_threads)
.unwrap_or(true);
let mut file_types: FxHashMap<Arc<str>, GlobSet> = FxHashMap::default();
@ -1245,7 +1245,7 @@ impl settings::Settings for AllLanguageSettings {
if let Some(edit_predictions) = user_settings.edit_predictions.as_ref() {
edit_predictions_mode = edit_predictions.mode;
edit_predictions_enabled_in_assistant = edit_predictions.enabled_in_assistant;
enabled_in_text_threads = edit_predictions.enabled_in_text_threads;
if let Some(disabled_globs) = edit_predictions.disabled_globs.as_ref() {
completion_globs.extend(disabled_globs.iter());
@ -1323,7 +1323,7 @@ impl settings::Settings for AllLanguageSettings {
.collect(),
mode: edit_predictions_mode,
copilot: copilot_settings,
enabled_in_assistant: edit_predictions_enabled_in_assistant,
enabled_in_text_threads,
},
defaults,
languages,

View File

@ -15,9 +15,12 @@ use proto::Plan;
use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*};
action_with_deprecated_aliases!(
assistant,
agent,
ToggleModelSelector,
["assistant2::ToggleModelSelector"]
[
"assistant::ToggleModelSelector",
"assistant2::ToggleModelSelector"
]
);
const TRY_ZED_PRO_URL: &str = "https://zed.dev/pro";

View File

@ -57,3 +57,9 @@ pub(crate) mod m_2025_04_23 {
pub(crate) use settings::SETTINGS_PATTERNS;
}
pub(crate) mod m_2025_05_05 {
mod settings;
pub(crate) use settings::SETTINGS_PATTERNS;
}

View File

@ -0,0 +1,41 @@
use std::ops::Range;
use tree_sitter::{Query, QueryMatch};
use crate::{
MigrationPatterns, patterns::SETTINGS_ASSISTANT_PATTERN,
patterns::SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN,
};
pub const SETTINGS_PATTERNS: MigrationPatterns = &[
(SETTINGS_ASSISTANT_PATTERN, rename_assistant),
(
SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN,
rename_edit_prediction_assistant,
),
];
fn rename_assistant(
_contents: &str,
mat: &QueryMatch,
query: &Query,
) -> Option<(Range<usize>, String)> {
let key_capture_ix = query.capture_index_for_name("key")?;
let key_range = mat
.nodes_for_capture_index(key_capture_ix)
.next()?
.byte_range();
return Some((key_range, "agent".to_string()));
}
fn rename_edit_prediction_assistant(
_contents: &str,
mat: &QueryMatch,
query: &Query,
) -> Option<(Range<usize>, String)> {
let key_capture_ix = query.capture_index_for_name("enabled_in_assistant")?;
let key_range = mat
.nodes_for_capture_index(key_capture_ix)
.next()?
.byte_range();
return Some((key_range, "enabled_in_text_threads".to_string()));
}

View File

@ -136,6 +136,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
migrations::m_2025_04_23::SETTINGS_PATTERNS,
&SETTINGS_QUERY_2025_04_23,
),
(
migrations::m_2025_05_05::SETTINGS_PATTERNS,
&SETTINGS_QUERY_2025_05_05,
),
];
run_migrations(text, migrations)
}
@ -222,6 +226,10 @@ define_query!(
SETTINGS_QUERY_2025_04_23,
migrations::m_2025_04_23::SETTINGS_PATTERNS
);
define_query!(
SETTINGS_QUERY_2025_05_05,
migrations::m_2025_05_05::SETTINGS_PATTERNS
);
// custom query
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {
@ -581,7 +589,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"custom": {
"name": "Custom",
@ -619,7 +627,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"custom": {
"name": "Custom",
@ -655,7 +663,24 @@ mod tests {
}
}
"#,
None,
Some(
r#"
{
"agent": {
"profiles": {
"custom": {
"name": "Custom",
"tools": {
"diagnostics": true,
"find_path": true,
"read_file": true
}
}
}
}
}
"#,
),
)
}
@ -679,7 +704,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"default": {
"tools": {
@ -694,4 +719,28 @@ mod tests {
),
);
}
#[test]
fn test_rename_assistant() {
assert_migrate_settings(
r#"{
"assistant": {
"foo": "bar"
},
"edit_predictions": {
"enabled_in_assistant": false,
}
}"#,
Some(
r#"{
"agent": {
"foo": "bar"
},
"edit_predictions": {
"enabled_in_text_threads": false,
}
}"#,
),
);
}
}

View File

@ -7,6 +7,7 @@ pub(crate) use keymap::{
};
pub(crate) use settings::{
SETTINGS_ASSISTANT_TOOLS_PATTERN, SETTINGS_LANGUAGES_PATTERN,
SETTINGS_ASSISTANT_PATTERN, SETTINGS_ASSISTANT_TOOLS_PATTERN,
SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN, SETTINGS_LANGUAGES_PATTERN,
SETTINGS_NESTED_KEY_VALUE_PATTERN, SETTINGS_ROOT_KEY_VALUE_PATTERN,
};

View File

@ -71,3 +71,25 @@ pub const SETTINGS_ASSISTANT_TOOLS_PATTERN: &str = r#"(document
(#eq? @profiles "profiles")
(#eq? @tools_key "tools")
)"#;
pub const SETTINGS_ASSISTANT_PATTERN: &str = r#"(document
(object
(pair
key: (string (string_content) @key)
)
)
(#eq? @key "assistant")
)"#;
pub const SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN: &str = r#"(document
(object
(pair
key: (string (string_content) @edit_predictions)
value: (object
(pair key: (string (string_content) @enabled_in_assistant))
)
)
)
(#eq? @edit_predictions "edit_predictions")
(#eq? @enabled_in_assistant "enabled_in_assistant")
)"#;

View File

@ -876,7 +876,7 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
VimCommand::str(("C", "ollab"), "collab_panel::ToggleFocus"),
VimCommand::str(("Ch", "at"), "chat_panel::ToggleFocus"),
VimCommand::str(("No", "tifications"), "notification_panel::ToggleFocus"),
VimCommand::str(("A", "I"), "assistant::ToggleFocus"),
VimCommand::str(("A", "I"), "agent::ToggleFocus"),
VimCommand::str(("G", "it"), "git_panel::ToggleFocus"),
VimCommand::new(("noh", "lsearch"), search::buffer_search::Dismiss),
VimCommand::new(("$", ""), EndOfDocument),

View File

@ -190,12 +190,16 @@ pub mod agent {
}
pub mod assistant {
use gpui::{actions, impl_action_with_deprecated_aliases, impl_actions};
use gpui::{
action_with_deprecated_aliases, actions, impl_action_with_deprecated_aliases, impl_actions,
};
use schemars::JsonSchema;
use serde::Deserialize;
use uuid::Uuid;
actions!(assistant, [ToggleFocus, ShowConfiguration]);
action_with_deprecated_aliases!(agent, ToggleFocus, ["assistant::ToggleFocus"]);
actions!(assistant, [ShowConfiguration]);
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
@ -205,9 +209,12 @@ pub mod assistant {
}
impl_action_with_deprecated_aliases!(
assistant,
agent,
OpenRulesLibrary,
["assistant::DeployPromptLibrary"]
[
"assistant::OpenRulesLibrary",
"assistant::DeployPromptLibrary"
]
);
#[derive(Clone, Default, Deserialize, PartialEq, JsonSchema)]