diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-02 21:20:28 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-02 21:25:32 +0300 |
| commit | 295b09ca25edbccac65401ee84fa420dd3888aad (patch) | |
| tree | d54ed875518e042869ed3f43e95f0b9ee59f5d34 /src/detect/agents/opencode.rs | |
| parent | 48641e253f1aa3886b470cbebec60103247a7622 (diff) | |
feat: make claude codex opencode hooks session-only
Diffstat (limited to 'src/detect/agents/opencode.rs')
| -rw-r--r-- | src/detect/agents/opencode.rs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/detect/agents/opencode.rs b/src/detect/agents/opencode.rs index 5badcad9..219f69ed 100644 --- a/src/detect/agents/opencode.rs +++ b/src/detect/agents/opencode.rs @@ -7,7 +7,10 @@ pub(super) fn detect(content: &str) -> AgentState { } // Working - if has_interrupt_pattern(&content.to_lowercase()) { + if has_interrupt_pattern(&content.to_lowercase()) + || has_opencode_interrupt_footer(content) + || has_opencode_progress_run(content) + { return AgentState::Working; } @@ -23,3 +26,29 @@ fn has_opencode_question_prompt(content: &str) -> bool { lower.contains("esc dismiss") && has_enter_action && has_question_nav } + +fn has_opencode_interrupt_footer(content: &str) -> bool { + content.lines().any(|line| { + let lower = line.to_lowercase(); + if !(lower.contains("esc interrupt") || lower.contains("esc again to interrupt")) { + return false; + } + + lower.contains("opencode") + }) +} + +fn has_opencode_progress_run(line: &str) -> bool { + let mut run = 0usize; + for ch in line.chars() { + if matches!(ch, '■' | '⬝') { + run += 1; + if run >= 4 { + return true; + } + } else { + run = 0; + } + } + false +} |
