aboutsummaryrefslogtreecommitdiff
path: root/src/detect/agents/gemini.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/detect/agents/gemini.rs')
-rw-r--r--src/detect/agents/gemini.rs35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/detect/agents/gemini.rs b/src/detect/agents/gemini.rs
index c47355c0..86cf3bca 100644
--- a/src/detect/agents/gemini.rs
+++ b/src/detect/agents/gemini.rs
@@ -1,24 +1,11 @@
-use super::super::{has_confirmation_prompt, AgentState};
+use super::super::AgentState;
pub(super) fn detect(content: &str) -> AgentState {
- let lower = content.to_lowercase();
-
- // Blocked — explicit confirmation
- if lower.contains("waiting for user confirmation") {
- return AgentState::Blocked;
- }
-
- // Blocked — box-drawing confirmation prompts
- if content.contains("│ Apply this change")
- || content.contains("│ Allow execution")
- || content.contains("│ Do you want to proceed")
- {
- return AgentState::Blocked;
- }
- if has_confirmation_prompt(&lower) {
+ if has_visible_blocker(content) {
return AgentState::Blocked;
}
+ let lower = content.to_lowercase();
// Working
if lower.contains("esc to cancel") {
return AgentState::Working;
@@ -26,3 +13,19 @@ pub(super) fn detect(content: &str) -> AgentState {
AgentState::Idle
}
+
+pub(super) fn has_visible_blocker(content: &str) -> bool {
+ let lower = content.to_lowercase();
+ let has_choice = lower.contains("yes") || lower.contains("no");
+
+ content.contains("│ Apply this change")
+ || content.contains("│ Allow execution")
+ || (has_choice
+ && (lower.contains("waiting for user confirmation")
+ || content.contains("│ Do you want to proceed")
+ || lower.contains("do you want to proceed?")))
+ || content.lines().any(|line| {
+ let line = line.trim().to_ascii_lowercase();
+ line.starts_with("❯") && (line.contains("yes") || line.contains("allow"))
+ })
+}