agent_ui: Organize ACP config options in the agent composer (#67190)

Keep the external agent composer compact and match the Zed Agent's Fast
Mode and Thinking Effort controls. Model and Mode stay next to Send.
Other settings go in Agent Options, where pickers keep their search,
groups, and favorites.

If the agent changes its options while a submenu is open, close the menu
and release the old picker.

<img width="635" height="197" alt="image"
src="https://github.com/user-attachments/assets/2f2ad595-98ea-441e-80c7-f41d9c01bc00"
/>

(Fast mode will use the fast mode toggle in the next adapter release)

Release Notes:

- Aligned External Agent config options with native Zed agent UI for
similar controls.
This commit is contained in:
Ben Brandt
2026-11-19 14:06:49 +00:00
committed by GitHub
parent 4a7d10473a
commit df1ba676f2
5 changed files with 903 additions and 402 deletions
File diff suppressed because it is too large Load Diff
@@ -28,7 +28,7 @@ use crate::completion_provider::{AvailableSkill, PromptLocalCommand, pluralize};
use crate::message_editor::SharedSessionCapabilities;
use crate::ui::{
SandboxGroup, SandboxRow, SandboxSection, SandboxStatusTooltip, TerminalSandboxWarning,
TerminalToolHeader,
TerminalToolHeader, fast_mode_button, thinking_effort_trigger,
};
use crate::unicode_confusables;
@@ -1180,6 +1180,10 @@ impl ThreadView {
Self::handle_message_editor_event,
));
if let Some(config_options_view) = &config_options_view {
subscriptions.push(cx.observe(config_options_view, |_, _, cx| cx.notify()));
}
// If this thread is backed by a NativeAgent, listen for skill loading
// issues so we can surface them as banners. The agent emits a single
// replacement-style event per project refresh, so we overwrite our
@@ -5699,8 +5703,13 @@ impl ThreadView {
.gap_0p5()
.child(self.render_add_context_button(cx))
.child(self.render_follow_toggle(cx))
.children(self.render_fast_mode_control(cx))
.children(self.render_thinking_control(cx)),
.map(|this| match &self.config_options_view {
Some(config_view) => this
.children(config_view.read(cx).response_controls(cx)),
None => this
.children(self.render_fast_mode_control(cx))
.children(self.render_thinking_control(cx)),
}),
)
.child(
h_flex()
@@ -6316,20 +6325,10 @@ impl ThreadView {
.model()
.map(|model| (model.provider_id(), model.id()));
let (tooltip_label, color, icon, new_speed) = if is_fast {
(
"Disable Fast Mode",
Color::Accent,
IconName::FastForward,
Speed::Standard,
)
let (tooltip_label, new_speed) = if is_fast {
("Disable Fast Mode", Speed::Standard)
} else {
(
"Enable Fast Mode",
Color::Custom(cx.theme().colors().icon_disabled.opacity(0.8)),
IconName::FastForwardOff,
Speed::Fast,
)
("Enable Fast Mode", Speed::Fast)
};
let focus_handle = self.message_editor.focus_handle(cx);
@@ -6338,9 +6337,7 @@ impl ThreadView {
.then(|| self.pending_fast_mode_confirmation(cx))
.flatten();
let icon_button = IconButton::new("fast-mode", icon)
.icon_size(IconSize::Small)
.icon_color(color);
let icon_button = fast_mode_button("fast-mode", is_fast, cx);
if let Some((provider_id, model_id, confirmation)) = pending_confirmation {
let weak_self = cx.entity().downgrade();
@@ -6588,12 +6585,6 @@ impl ThreadView {
.or(default_effort_level)
.map_or("Select Effort".into(), |effort| effort.name);
let (label_color, icon) = if self.thinking_effort_menu_handle.is_deployed() {
(Color::Accent, IconName::ChevronUp)
} else {
(Color::Muted, IconName::ChevronDown)
};
let focus_handle = self.message_editor.focus_handle(cx);
let show_cycle_row = supported_effort_levels.len() > 1;
@@ -6632,29 +6623,15 @@ impl ThreadView {
}
});
let trigger = if standalone {
ButtonLike::new("effort-selector-trigger").child(
h_flex()
.gap_1()
.child(
Icon::new(IconName::ThinkingMode)
.size(IconSize::Small)
.color(Color::Accent),
)
.child(Label::new(label).size(LabelSize::Small).color(label_color))
.child(Icon::new(icon).size(IconSize::XSmall).color(Color::Muted)),
)
} else {
ButtonLike::new_rounded_right("effort-selector-trigger")
.child(Label::new(label).size(LabelSize::Small).color(label_color))
.child(Icon::new(icon).size(IconSize::XSmall).color(Color::Muted))
};
let trigger = thinking_effort_trigger(
"effort-selector-trigger",
label,
self.thinking_effort_menu_handle.is_deployed(),
standalone,
);
PopoverMenu::new("effort-selector")
.trigger_with_tooltip(
trigger.selected_style(ButtonStyle::Tinted(TintColor::Accent)),
tooltip,
)
.trigger_with_tooltip(trigger, tooltip)
.menu(move |window, cx| {
Some(ContextMenu::build(window, cx, |mut menu, _window, _cx| {
menu = menu.header("Change Thinking Effort");
@@ -13904,6 +13881,11 @@ impl ThreadView {
}
fn toggle_fast_mode(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if let Some(config_options_view) = self.config_options_view.clone() {
config_options_view.update(cx, |view, cx| view.toggle_fast_mode(window, cx));
return;
}
if !self.fast_mode_available(cx) {
return;
}
@@ -14177,7 +14159,7 @@ impl Render for ThreadView {
});
}
}))
.on_action(cx.listener(|this, _: &CycleThinkingEffort, _window, cx| {
.on_action(cx.listener(|this, _: &CycleThinkingEffort, window, cx| {
if this.thread.read(cx).status() != ThreadStatus::Idle {
return;
}
@@ -14186,6 +14168,7 @@ impl Render for ThreadView {
view.cycle_category_option(
acp_v2::SessionConfigOptionCategory::ThoughtLevel,
false,
window,
cx,
)
});
@@ -14276,6 +14259,7 @@ impl Render for ThreadView {
view.cycle_category_option(
acp_v2::SessionConfigOptionCategory::Mode,
false,
window,
cx,
)
});
@@ -14325,6 +14309,7 @@ impl Render for ThreadView {
view.cycle_category_option(
acp_v2::SessionConfigOptionCategory::Model,
true,
window,
cx,
)
});
+50
View File
@@ -17,6 +17,56 @@ pub use session_notice::*;
pub use terminal_tool_header::*;
pub use undo_reject_toast::*;
use gpui::{App, ElementId, SharedString};
use ui::{ButtonLike, IconButton, TintColor, prelude::*};
pub(crate) fn fast_mode_button(id: impl Into<ElementId>, enabled: bool, cx: &App) -> IconButton {
let (icon, color) = if enabled {
(IconName::FastForward, Color::Accent)
} else {
(
IconName::FastForwardOff,
Color::Custom(cx.theme().colors().icon_disabled.opacity(0.8)),
)
};
IconButton::new(id, icon)
.icon_size(IconSize::Small)
.icon_color(color)
}
pub(crate) fn thinking_effort_trigger(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
menu_open: bool,
standalone: bool,
) -> ButtonLike {
let (label_color, icon) = if menu_open {
(Color::Accent, IconName::ChevronUp)
} else {
(Color::Muted, IconName::ChevronDown)
};
let label = Label::new(label).size(LabelSize::Small).color(label_color);
let chevron = Icon::new(icon).size(IconSize::XSmall).color(Color::Muted);
let trigger = if standalone {
ButtonLike::new(id).child(
h_flex()
.gap_1()
.child(
Icon::new(IconName::ThinkingMode)
.size(IconSize::Small)
.color(Color::Accent),
)
.child(label)
.child(chevron),
)
} else {
ButtonLike::new_rounded_right(id)
.child(label)
.child(chevron)
};
trigger.selected_style(ButtonStyle::Tinted(TintColor::Accent))
}
/// Returns the appropriate [`DocumentationSide`] for documentation asides
/// in the agent panel, based on the current dock position.
pub fn documentation_aside_side(cx: &gpui::App) -> ui::DocumentationSide {
+21 -13
View File
@@ -7,8 +7,8 @@ use crate::{
use gpui::{
Action, Anchor, AnchoredPositionMode, AnyElement, AnyView, App, Bounds, DismissEvent, Entity,
EventEmitter, FocusHandle, Focusable, HoverListenerMode, MouseButton, MouseDownEvent,
MouseUpEvent, Pixels, Point, Role, Size, Subscription, TaskExt, anchored, canvas, deferred,
point, prelude::*, px, relative,
MouseUpEvent, Pixels, Point, Role, Size, Subscription, TaskExt, WeakEntity, anchored, canvas,
deferred, point, prelude::*, px, relative,
};
use menu::{SelectChild, SelectFirst, SelectLast, SelectNext, SelectParent, SelectPrevious};
use std::{
@@ -294,7 +294,9 @@ pub struct ContextMenu {
rebuild_parent_on_confirm: bool,
fixed_width: Option<DefiniteLength>,
spacing: ListItemSpacing,
main_menu: Option<Entity<ContextMenu>>,
// The parent owns the open submenu. A strong back-reference would keep both alive
// when the parent is dismissed without first closing its submenu.
main_menu: Option<WeakEntity<ContextMenu>>,
main_menu_observed_bounds: Rc<Cell<Option<Bounds<Pixels>>>>,
// Docs aide-related fields
documentation_aside: Option<(usize, DocumentationAside)>,
@@ -1141,6 +1143,7 @@ impl ContextMenu {
if let Some(parent) = self
.main_menu
.as_ref()
.and_then(WeakEntity::upgrade)
.filter(|parent| parent.read(cx).builder.is_some())
{
let parent = parent.downgrade();
@@ -1167,7 +1170,7 @@ impl ContextMenu {
cx.emit(DismissEvent);
// Restore keyboard focus to the parent menu so arrow keys / Escape / Enter work again.
if let Some(parent) = &self.main_menu {
if let Some(parent) = self.main_menu.as_ref().and_then(WeakEntity::upgrade) {
let parent_focus = parent.read(cx).focus_handle.clone();
parent.update(cx, |parent, _cx| {
@@ -1329,7 +1332,7 @@ impl ContextMenu {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(parent) = &self.main_menu {
if let Some(parent) = self.main_menu.as_ref().and_then(WeakEntity::upgrade) {
let entity_id = cx.entity_id();
parent.update(cx, |parent, cx| {
let SubmenuState::Open(open) = &parent.submenu_state else {
@@ -1393,7 +1396,7 @@ impl ContextMenu {
fn create_submenu(
builder: Rc<dyn Fn(ContextMenu, &mut Window, &mut Context<ContextMenu>) -> ContextMenu>,
parent_entity: Entity<ContextMenu>,
parent_entity: WeakEntity<ContextMenu>,
parent_depth: usize,
window: &mut Window,
cx: &mut Context<Self>,
@@ -1415,7 +1418,7 @@ impl ContextMenu {
fn build_submenu(
builder: Rc<dyn Fn(ContextMenu, &mut Window, &mut Context<ContextMenu>) -> ContextMenu>,
parent_entity: Entity<ContextMenu>,
parent_entity: WeakEntity<ContextMenu>,
parent_depth: usize,
window: &mut Window,
cx: &mut App,
@@ -1493,7 +1496,7 @@ impl ContextMenu {
}
let (submenu, dismiss_subscription) =
Self::create_submenu(builder, cx.entity(), self.submenu_depth, window, cx);
Self::create_submenu(builder, cx.weak_entity(), self.submenu_depth, window, cx);
self.submenu_bounds.set(None);
self.hover_target = HoverTarget::MainMenu;
@@ -2150,9 +2153,10 @@ impl ContextMenu {
cx.notify();
}
if let Some(parent) = &this.main_menu {
if let Some(parent) =
this.main_menu.as_ref().and_then(WeakEntity::upgrade)
{
let mouse_pos = window.mouse_position();
let parent_clone = parent.clone();
if *hovered {
parent.update(cx, |parent, _| {
@@ -2160,7 +2164,7 @@ impl ContextMenu {
parent.hover_target = HoverTarget::Submenu;
});
} else {
parent_clone.update(cx, |parent, cx| {
parent.update(cx, |parent, cx| {
if matches!(
&parent.submenu_state,
SubmenuState::Open(_)
@@ -2472,7 +2476,9 @@ impl Render for ContextMenu {
.on_hover(cx.listener(|this, hovered: &bool, _, cx| {
if *hovered {
this.hover_target = HoverTarget::MainMenu;
if let Some(parent) = &this.main_menu {
if let Some(parent) =
this.main_menu.as_ref().and_then(WeakEntity::upgrade)
{
parent.update(cx, |parent, _| {
parent.hover_target = HoverTarget::Submenu;
});
@@ -2489,7 +2495,9 @@ impl Render for ContextMenu {
}
}
if let Some(parent) = &this.main_menu {
if let Some(parent) =
this.main_menu.as_ref().and_then(WeakEntity::upgrade)
{
let parent = parent.read(cx);
let overridden_by_parent_trigger = match &parent.submenu_state {
SubmenuState::Open(open_submenu) => parent
+2
View File
@@ -139,6 +139,8 @@ For Zed's native agent configuration, see [Zed Agent](./zed-agent.md).
## Agent-Specific Auth and Config {#agent-auth-config}
When an agent offers model selection, mode, thinking effort, or a Fast Mode toggle, those controls appear in the message composer. Open **Agent Options** for the agent's other settings.
External Agents may have their own sign-in flow, API key setup, subscription behavior, environment variables, and config files.
Examples: