aboutsummaryrefslogtreecommitdiff
path: root/src/detect/agents/grok.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 23:54:41 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 23:54:41 +0300
commitd477341e6af816ff4396042b084a0378ef437b4a (patch)
treee332b6f7a0d23d9effd21c3ca8ab27698ed83444 /src/detect/agents/grok.rs
parent8df1639048529b383358000879b5ee078a90b9f9 (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/grok.rs')
-rw-r--r--src/detect/agents/grok.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/detect/agents/grok.rs b/src/detect/agents/grok.rs
new file mode 100644
index 00000000..75b5cd35
--- /dev/null
+++ b/src/detect/agents/grok.rs
@@ -0,0 +1,36 @@
+use super::super::{has_braille_spinner, AgentState};
+
+/// Grok Build detection.
+///
+/// Blocked permission prompts display a whitelist scope selector with choices
+/// like "Yes, proceed" and "No, reject". Working turns show a braille spinner
+/// status line such as "⠋ Waiting… 1.8s" plus live controls like
+/// "Ctrl+c:cancel" and "Ctrl+Enter:interject".
+pub(super) fn detect(content: &str) -> AgentState {
+ let lower = content.to_lowercase();
+
+ if lower.contains("use ← → to choose permission whitelist scope")
+ || lower.contains("yes, proceed")
+ || lower.contains("no, reject")
+ || lower.contains("ctrl+o:yolo")
+ || lower.contains(":scope")
+ {
+ return AgentState::Blocked;
+ }
+
+ if has_braille_spinner(content)
+ && (lower.contains("waiting")
+ || lower.contains("run ")
+ || lower.contains("read ")
+ || lower.contains("search ")
+ || lower.contains("list "))
+ {
+ return AgentState::Working;
+ }
+
+ if lower.contains("ctrl+c:cancel") && lower.contains("ctrl+enter:interject") {
+ return AgentState::Working;
+ }
+
+ AgentState::Idle
+}