aboutsummaryrefslogtreecommitdiff
path: root/src/detect/agents/gemini.rs
blob: c47355c0e40f17d20da20d5db40e3b66325af3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::super::{has_confirmation_prompt, 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) {
        return AgentState::Blocked;
    }

    // Working
    if lower.contains("esc to cancel") {
        return AgentState::Working;
    }

    AgentState::Idle
}