diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-30 23:54:41 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-30 23:54:41 +0300 |
| commit | d477341e6af816ff4396042b084a0378ef437b4a (patch) | |
| tree | e332b6f7a0d23d9effd21c3ca8ab27698ed83444 /src/detect/agents/opencode.rs | |
| parent | 8df1639048529b383358000879b5ee078a90b9f9 (diff) | |
refactor: split agent detection by agent
Move screen detection into per-agent modules and keep visible-state arbitration centralized in terminal state.
Tighten Codex prompt-scoped working detection and Claude hook/screen recovery for stale blocked and idle reports.
Add a focused just recipe for single-test runs.
refs #349
refs #352
Diffstat (limited to 'src/detect/agents/opencode.rs')
| -rw-r--r-- | src/detect/agents/opencode.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/detect/agents/opencode.rs b/src/detect/agents/opencode.rs new file mode 100644 index 00000000..5badcad9 --- /dev/null +++ b/src/detect/agents/opencode.rs @@ -0,0 +1,25 @@ +use super::super::{has_interrupt_pattern, AgentState}; + +pub(super) fn detect(content: &str) -> AgentState { + // Blocked + if content.contains("△ Permission required") || has_opencode_question_prompt(content) { + return AgentState::Blocked; + } + + // Working + if has_interrupt_pattern(&content.to_lowercase()) { + return AgentState::Working; + } + + AgentState::Idle +} + +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 +} |
