diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-10 15:24:24 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-10 15:33:45 +0300 |
| commit | 36a1b7f86444871f0c38ff36510a6e3c2eec48c6 (patch) | |
| tree | 4a2d100eef7f26af7feaa93ce661423c3994c54e /src/detect/agents/opencode.rs | |
| parent | 8d13492926829c5cf0ea42c8613344cd65ff59fa (diff) | |
feat: distribute agent detection manifests
Diffstat (limited to 'src/detect/agents/opencode.rs')
| -rw-r--r-- | src/detect/agents/opencode.rs | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/detect/agents/opencode.rs b/src/detect/agents/opencode.rs deleted file mode 100644 index ab8a424f..00000000 --- a/src/detect/agents/opencode.rs +++ /dev/null @@ -1,58 +0,0 @@ -use super::super::{has_interrupt_pattern, AgentState}; - -pub(super) fn detect(content: &str) -> AgentState { - // Blocked - if has_visible_blocker(content) { - return AgentState::Blocked; - } - - // Working - if has_interrupt_pattern(&content.to_lowercase()) - || has_opencode_interrupt_footer(content) - || has_opencode_progress_run(content) - { - return AgentState::Working; - } - - AgentState::Idle -} - -pub(super) fn has_visible_blocker(content: &str) -> bool { - content.contains("△ Permission required") || has_opencode_question_prompt(content) -} - -fn has_opencode_question_prompt(content: &str) -> bool { - let lower = content.to_lowercase(); - let has_enter_action = lower.contains("enter confirm") - || lower.contains("enter submit") - || lower.contains("enter toggle"); - let has_question_nav = content.contains("↑↓ select") || content.contains("⇆ tab"); - - 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 -} |
