feat: approval for sub-agent in the TUI (#12995)

<img width="766" height="290" alt="Screenshot 2026-02-27 at 10 50 48"
src="https://github.com/user-attachments/assets/3bc96cd9-ed2c-4d67-a317-8f7b60abbbb1"
/>
This commit is contained in:
jif-oai
2026-02-28 14:07:07 +01:00
committed by GitHub
parent 83177ed7a8
commit 2b38b4e03b
7 changed files with 669 additions and 87 deletions

View File

@@ -2582,6 +2582,8 @@ impl ChatWidget {
let available_decisions = ev.effective_available_decisions();
let request = ApprovalRequest::Exec {
thread_id: self.thread_id.unwrap_or_default(),
thread_label: None,
id: ev.effective_approval_id(),
command: ev.command,
reason: ev.reason,
@@ -2598,6 +2600,8 @@ impl ChatWidget {
self.flush_answer_stream_with_separator();
let request = ApprovalRequest::ApplyPatch {
thread_id: self.thread_id.unwrap_or_default(),
thread_label: None,
id: ev.call_id,
reason: ev.reason,
changes: ev.changes.clone(),
@@ -2620,6 +2624,8 @@ impl ChatWidget {
});
let request = ApprovalRequest::McpElicitation {
thread_id: self.thread_id.unwrap_or_default(),
thread_label: None,
server_name: ev.server_name,
request_id: ev.id,
message: ev.message,
@@ -2629,6 +2635,12 @@ impl ChatWidget {
self.request_redraw();
}
pub(crate) fn push_approval_request(&mut self, request: ApprovalRequest) {
self.bottom_pane
.push_approval_request(request, &self.config.features);
self.request_redraw();
}
pub(crate) fn handle_request_user_input_now(&mut self, ev: RequestUserInputEvent) {
self.flush_answer_stream_with_separator();
self.bottom_pane.push_user_input_request(ev);
@@ -7543,6 +7555,11 @@ impl ChatWidget {
self.bottom_pane.pending_thread_approvals()
}
#[cfg(test)]
pub(crate) fn has_active_view(&self) -> bool {
self.bottom_pane.has_active_view()
}
pub(crate) fn show_esc_backtrack_hint(&mut self) {
self.bottom_pane.show_esc_backtrack_hint();
}