Detailed changes
@@ -1112,6 +1112,11 @@
//
// Default: true
"expand_terminal_card": true,
+ // Whether clicking the stop button on a running terminal tool should also cancel the agent's generation.
+ // Note that this only applies to the stop button, not to ctrl+c inside the terminal.
+ //
+ // Default: true
+ "cancel_generation_on_terminal_stop": true,
// Whether to always use cmd-enter (or ctrl-enter on Linux or Windows) to send messages in the agent panel.
//
// Default: false
@@ -46,6 +46,7 @@ pub struct AgentSettings {
pub enable_feedback: bool,
pub expand_edit_card: bool,
pub expand_terminal_card: bool,
+ pub cancel_generation_on_terminal_stop: bool,
pub use_modifier_to_send: bool,
pub message_editor_min_lines: usize,
pub show_turn_stats: bool,
@@ -256,6 +257,7 @@ impl Settings for AgentSettings {
enable_feedback: agent.enable_feedback.unwrap(),
expand_edit_card: agent.expand_edit_card.unwrap(),
expand_terminal_card: agent.expand_terminal_card.unwrap(),
+ cancel_generation_on_terminal_stop: agent.cancel_generation_on_terminal_stop.unwrap(),
use_modifier_to_send: agent.use_modifier_to_send.unwrap(),
message_editor_min_lines: agent.message_editor_min_lines.unwrap(),
show_turn_stats: agent.show_turn_stats.unwrap(),
@@ -4633,7 +4633,9 @@ impl AcpThreadView {
terminal.update(cx, |terminal, cx| {
terminal.stop_by_user(cx);
});
- this.cancel_generation(cx);
+ if AgentSettings::get_global(cx).cancel_generation_on_terminal_stop {
+ this.cancel_generation(cx);
+ }
})
}),
)
@@ -538,6 +538,7 @@ mod tests {
enable_feedback: false,
expand_edit_card: true,
expand_terminal_card: true,
+ cancel_generation_on_terminal_stop: true,
use_modifier_to_send: true,
message_editor_min_lines: 1,
tool_permissions: Default::default(),
@@ -109,6 +109,11 @@ pub struct AgentSettingsContent {
///
/// Default: true
pub expand_terminal_card: Option<bool>,
+ /// Whether clicking the stop button on a running terminal tool should also cancel the agent's generation.
+ /// Note that this only applies to the stop button, not to ctrl+c inside the terminal.
+ ///
+ /// Default: true
+ pub cancel_generation_on_terminal_stop: Option<bool>,
/// Whether to always use cmd-enter (or ctrl-enter on Linux or Windows) to send messages in the agent panel.
///
/// Default: false
@@ -6830,7 +6830,7 @@ fn ai_page() -> SettingsPage {
]
}
- fn agent_configuration_section() -> [SettingsPageItem; 11] {
+ fn agent_configuration_section() -> [SettingsPageItem; 12] {
[
SettingsPageItem::SectionHeader("Agent Configuration"),
SettingsPageItem::SettingItem(SettingItem {
@@ -6975,6 +6975,28 @@ fn ai_page() -> SettingsPage {
metadata: None,
files: USER,
}),
+ SettingsPageItem::SettingItem(SettingItem {
+ title: "Cancel Generation On Terminal Stop",
+ description: "Whether clicking the stop button on a running terminal tool should also cancel the agent's generation. Note that this only applies to the stop button, not to ctrl+c inside the terminal.",
+ field: Box::new(SettingField {
+ json_path: Some("agent.cancel_generation_on_terminal_stop"),
+ pick: |settings_content| {
+ settings_content
+ .agent
+ .as_ref()?
+ .cancel_generation_on_terminal_stop
+ .as_ref()
+ },
+ write: |settings_content, value| {
+ settings_content
+ .agent
+ .get_or_insert_default()
+ .cancel_generation_on_terminal_stop = value;
+ },
+ }),
+ metadata: None,
+ files: USER,
+ }),
SettingsPageItem::SettingItem(SettingItem {
title: "Use Modifier To Send",
description: "Whether to always use cmd-enter (or ctrl-enter on Linux or Windows) to send messages.",