agent: Show a notice when reaching consecutive tool use limits (#29833)

This PR adds a notice when reaching consecutive tool use limits when
using normal mode.

Here's an example with the limit artificially lowered to 2 consecutive
tool uses:


https://github.com/user-attachments/assets/32da8d38-67de-4d6b-8f24-754d2518e5d4

Release Notes:

- agent: Added a notice when reaching consecutive tool use limits when
using a model in normal mode.
This commit is contained in:
Marshall Bowers 2025-05-02 22:09:54 -04:00 committed by GitHub
parent 10a7f2a972
commit f0515d1c34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 134 additions and 25 deletions

View file

@ -66,15 +66,16 @@ pub struct LanguageModelCacheConfiguration {
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
#[serde(tag = "status", rename_all = "snake_case")]
pub enum QueueState {
pub enum CompletionRequestStatus {
Queued { position: usize },
Started,
ToolUseLimitReached,
}
/// A completion event from a language model.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub enum LanguageModelCompletionEvent {
QueueUpdate(QueueState),
QueueUpdate(CompletionRequestStatus),
Stop(StopReason),
Text(String),
Thinking {