aboutsummaryrefslogtreecommitdiff
path: root/src/detect/agents/github_copilot.rs
blob: eed030118cfd1b8e42a8254fd777b7afbd7f7d59 (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
use super::super::AgentState;

pub(super) fn detect(content: &str) -> AgentState {
    let lower = content.to_lowercase();

    // Blocked
    if lower.contains("esc to cancel")
        && (lower.contains("enter to select")
            || lower.contains("enter to confirm")
            || lower.contains("enter to submit"))
    {
        return AgentState::Blocked;
    }

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

    AgentState::Idle
}