Agent chat: queue messages while the agent works, Send now, Stop, New chat, and a model picker (#1566, #1571) (#1566)

Thanks @bherbruck.
This commit is contained in:
bherbruck authored and GitHub committed 2026-10-15 23:58:28 -04:00
1 parent fdb059cfed
commit baf44657c1
16 files changed
+1293 -33

No files matched your search

+7
View File
@@ -40,6 +40,8 @@ pub enum Event {
AuthStatus(String),
/// Its own modes (an ACP agent's `modes`: ask, accept edits, plan, …) and the current one.
Modes { current: String, available: Vec<(String, String)> },
/// Its models (empty `available`: only the current one changed).
Models { current: String, available: Vec<super::acp::ModelInfo> },
/// The message is answered (`reason`: why it stopped, empty for a normal end).
TurnEnded { reason: String },
/// Something failed; the backend is still running unless [`Event::Exited`] follows.
@@ -69,10 +71,15 @@ pub trait ChatBackend {
fn prompt(&mut self, parts: &[PromptPart]);
/// Stop the message being answered; open permission questions count as cancelled.
fn cancel(&mut self);
/// Start a fresh conversation on the running backend (no restart); [`Event::Ready`] follows.
/// A message being answered is cancelled first.
fn new_session(&mut self);
/// Answer an [`Event::Permission`] with one of its options (`None`: cancelled).
fn answer_permission(&mut self, key: u64, option: Option<&str>);
/// Ask the backend to sign in by itself with one of its methods (it opens the browser).
fn authenticate(&mut self, method: &str);
/// Use one of the models it reported in [`Event::Models`].
fn set_model(&mut self, _model: &str) {}
/// Switch to one of the modes it reported in [`Event::Modes`].
fn set_mode(&mut self, _mode: &str) {}
/// Its process, for status and tests.