Integrate asynchronous questions into the TUI (#42891)

## What changed

- Display questions from live agent messages with a collapsed question count and an expandable answer editor.
- Support navigating, answering, queueing, and skipping questions while preserving the main composer draft. Expose question navigation and skip actions in the keymap picker.
- Route answers through existing input delivery and consume them only after an accepted send or queue operation. Keep questions editable while disconnected, with delivery and skipping disabled.

## Testing

Add tests for answer delivery, queued answers, retained drafts, disconnected editing, Vim undo, buffered input, constrained layouts, and question shortcut descriptions.

GitOrigin-RevId: 084b54dceb8c0100aefbf9f0b7897bf8d26eac47
This commit is contained in:
Ian MacLeod authored and copyberry committed 2026-09-05 00:15:42 +00:00
1 parent 6ae8dcf6e1
commit 218e8df926
26 files changed
+765 -34

No files matched your search

+11 -5
View File
@@ -322,6 +322,9 @@ impl ChatWidget {
turn_id: &str,
from_replay: bool,
) {
if !from_replay && let Some(questions) = &item.questions {
self.add_async_questions(&item.id, questions);
}
self.transcript.last_completed_agent_message = Some((turn_id.to_string(), item.id.clone()));
let mut message = String::new();
for content in &item.content {
@@ -378,11 +381,14 @@ impl ChatWidget {
}
});
}
self.status_state.pending_status_indicator_restore = match item.phase {
// Models that don't support preambles only output AgentMessageItems on turn completion.
Some(MessagePhase::FinalAnswer) | None => !self.input_queue.pending_steers.is_empty(),
Some(MessagePhase::Commentary) => true,
};
self.status_state.pending_status_indicator_restore = item.questions.is_some()
|| match item.phase {
// Models that don't support preambles only output AgentMessageItems on turn completion.
Some(MessagePhase::FinalAnswer) | None => {
!self.input_queue.pending_steers.is_empty()
}
Some(MessagePhase::Commentary) => true,
};
self.maybe_restore_status_indicator_after_stream_idle();
}