Prompt before running some tools (#27284)

Also includes some fixes for how the Lua tool was being generated.

<img width="644" alt="Screenshot 2025-03-21 at 6 26 18 PM"
src="https://github.com/user-attachments/assets/51bd1685-5b3f-4ed3-b11e-6fa8017847d4"
/>


Release Notes:

- N/A

---------

Co-authored-by: Ben <ben@zed.dev>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
This commit is contained in:
Richard Feldman 2025-03-22 00:05:34 -04:00 committed by GitHub
parent 90649fbc89
commit 4c86cda909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 666 additions and 329 deletions

View file

@ -72,6 +72,7 @@ pub struct AssistantSettings {
pub using_outdated_settings_version: bool,
pub enable_experimental_live_diffs: bool,
pub profiles: IndexMap<Arc<str>, AgentProfile>,
pub always_allow_tool_actions: bool,
}
impl AssistantSettings {
@ -173,6 +174,7 @@ impl AssistantSettingsContent {
inline_alternatives: None,
enable_experimental_live_diffs: None,
profiles: None,
always_allow_tool_actions: None,
},
VersionedAssistantSettingsContent::V2(settings) => settings.clone(),
},
@ -195,6 +197,7 @@ impl AssistantSettingsContent {
inline_alternatives: None,
enable_experimental_live_diffs: None,
profiles: None,
always_allow_tool_actions: None,
},
}
}
@ -325,6 +328,7 @@ impl Default for VersionedAssistantSettingsContent {
inline_alternatives: None,
enable_experimental_live_diffs: None,
profiles: None,
always_allow_tool_actions: None,
})
}
}
@ -363,6 +367,11 @@ pub struct AssistantSettingsContentV2 {
enable_experimental_live_diffs: Option<bool>,
#[schemars(skip)]
profiles: Option<IndexMap<Arc<str>, AgentProfileContent>>,
/// Whenever a tool action would normally wait for your confirmation
/// that you allow it, always choose to allow it.
///
/// Default: false
always_allow_tool_actions: Option<bool>,
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
@ -499,6 +508,10 @@ impl Settings for AssistantSettings {
&mut settings.enable_experimental_live_diffs,
value.enable_experimental_live_diffs,
);
merge(
&mut settings.always_allow_tool_actions,
value.always_allow_tool_actions,
);
if let Some(profiles) = value.profiles {
settings
@ -579,6 +592,7 @@ mod tests {
default_height: None,
enable_experimental_live_diffs: None,
profiles: None,
always_allow_tool_actions: None,
}),
)
},