fix(terminal): take only a hook's word that the agent is asking

The box stands aside and sends nothing while the pane's agent is waiting,
since whatever it sent would answer the question on screen. For an agent
without hooks — Amp, or Crush before its first tool — the pane is marked
waiting by any desktop notification, "Agent is ready" at the end of a turn
among them, and it stays marked. From the first finished turn on the box
stood aside for good, and messages went into the agent's own input
instead.

Waiting now holds the box back only when hooks reported it. Those agents'
own dialogs take their input's place on screen, and the box steps aside
for them off the screen as for any other.
This commit is contained in:
l0ng-ai
2026-10-01 15:28:01 +08:00
parent fde8a6304e
commit 8a7fd8e04a
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -1929,9 +1929,16 @@ impl TerminalView {
/// The agent is asking a question only its TUI can put — a permission
/// prompt, a choice. Whatever the box sent would be taken as the answer,
/// so nothing is sent until the question is gone.
///
/// Only a hook can say so. An agent without them — Amp — is marked
/// waiting by any desktop notification it raises, "Agent is ready" when
/// a turn ends included, and stays so; read as a question, that kept the
/// box aside, with nothing sendable, from the first finished turn on.
/// Its own dialogs it puts in its input's place, and the box steps aside
/// for those off the screen.
fn agent_is_asking(&self) -> bool {
self.agent_session()
.is_some_and(|s| s.status == AgentStatus::Waiting)
.is_some_and(|s| s.rich && s.status == AgentStatus::Waiting)
}
fn composer_can_send(&self, cx: &gpui::App) -> bool {
+1
View File
@@ -15888,6 +15888,7 @@ mod gpui_tests {
// the box is sent as the answer.
DaemonMsg::AgentStatus(Some(AgentSessionState {
status: AgentStatus::Waiting,
rich: true,
..Default::default()
}))
.encode(&mut daemon)