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

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

    // Blocked
    if has_visible_blocker(content) {
        return AgentState::Blocked;
    }

    // Idle
    if lower.contains("cline is ready for your message") {
        return AgentState::Idle;
    }

    // Cline defaults to working (unlike most agents that default to idle)
    AgentState::Working
}

pub(super) fn has_visible_blocker(content: &str) -> bool {
    let lower = content.to_lowercase();
    lower.contains("let cline use this tool")
        || ((lower.contains("[act mode]") || lower.contains("[plan mode]"))
            && (lower.contains("execute command?") || lower.contains("use this tool?"))
            && lower.contains("yes"))
}