agent: Change loading label if command is waiting on permission (#27955)

If there's a command pending confirmation, the label changes from
"Generating" to "Waiting for confirmation".

<img
src="https://github.com/user-attachments/assets/d804e382-5315-40b0-9588-c257cca2430c"
width="600"/>

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-04-02 17:41:16 -03:00 committed by GitHub
parent d23c2d4b02
commit 0a132779a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -341,6 +341,9 @@ impl Render for MessageEditor {
let is_too_long = thread.is_getting_too_long(cx);
let is_model_selected = self.is_model_selected(cx);
let is_editor_empty = self.is_editor_empty(cx);
let needs_confirmation =
thread.has_pending_tool_uses() && thread.tools_needing_confirmation().next().is_some();
let submit_label_color = if is_editor_empty {
Color::Muted
} else {
@ -432,11 +435,17 @@ impl Render for MessageEditor {
},
),
)
.child(
Label::new("Generating…")
.size(LabelSize::XSmall)
.color(Color::Muted),
)
.child({
Label::new(if needs_confirmation {
"Waiting for confirmation…"
} else {
"Generating…"
})
.size(LabelSize::XSmall)
.color(Color::Muted)
})
.child(ui::Divider::vertical())
.child(
Button::new("cancel-generation", "Cancel")