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/mod.rs | |
| parent | 8d13492926829c5cf0ea42c8613344cd65ff59fa (diff) | |
feat: distribute agent detection manifests
Diffstat (limited to 'src/detect/agents/mod.rs')
| -rw-r--r-- | src/detect/agents/mod.rs | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/detect/agents/mod.rs b/src/detect/agents/mod.rs deleted file mode 100644 index 72aaf674..00000000 --- a/src/detect/agents/mod.rs +++ /dev/null @@ -1,105 +0,0 @@ -pub(super) mod amp; -pub(super) mod antigravity; -pub(super) mod claude_code; -pub(super) mod cline; -pub(super) mod codex; -pub(super) mod cursor; -pub(super) mod droid; -pub(super) mod gemini; -pub(super) mod github_copilot; -pub(super) mod grok; -pub(super) mod hermes; -pub(super) mod kilo; -pub(super) mod kimi; -pub(super) mod kiro; -pub(super) mod opencode; -pub(super) mod pi; -pub(super) mod qodercli; - -use super::{Agent, AgentDetection, AgentState}; - -pub(super) fn detect(agent: Agent, screen_content: &str) -> AgentDetection { - let state = match agent { - Agent::Pi => pi::detect(screen_content), - Agent::Claude => claude_code::detect(screen_content), - Agent::Codex => codex::detect(screen_content), - Agent::Gemini => gemini::detect(screen_content), - Agent::Cursor => cursor::detect(screen_content), - Agent::Antigravity => antigravity::detect(screen_content), - Agent::Cline => cline::detect(screen_content), - Agent::OpenCode => opencode::detect(screen_content), - Agent::GithubCopilot => github_copilot::detect(screen_content), - Agent::Kimi => kimi::detect(screen_content), - Agent::Kiro => kiro::detect(screen_content), - Agent::Droid => droid::detect(screen_content), - Agent::Amp => amp::detect(screen_content), - Agent::Grok => grok::detect(screen_content), - Agent::Hermes => hermes::detect(screen_content), - Agent::Kilo => kilo::detect(screen_content), - Agent::Qodercli => qodercli::detect(screen_content), - }; - - let skip_state_update = should_skip_state_update(agent, screen_content); - if skip_state_update { - return AgentDetection { - state, - skip_state_update: true, - visible_blocker: false, - visible_working: false, - }; - } - - AgentDetection { - state, - skip_state_update: false, - visible_blocker: has_visible_blocker(agent, screen_content), - visible_working: has_visible_working(agent, screen_content, state), - } -} - -pub(super) fn should_skip_state_update(agent: Agent, content: &str) -> bool { - match agent { - Agent::Claude => claude_code::is_transcript_viewer(content), - Agent::Codex => codex::is_transcript_viewer(content), - _ => false, - } -} - -fn has_visible_blocker(agent: Agent, content: &str) -> bool { - match agent { - // Strong visible blockers are opt-in because this flag can override - // hook authority. Plain blocked heuristics remain valid fallback state, - // but they must not become hook overrides unless the current UI chrome - // is known to be structural and live. - Agent::Claude => claude_code::has_visible_blocker(content), - Agent::Codex => codex::has_visible_blocker(content), - Agent::Gemini => gemini::has_visible_blocker(content), - Agent::Cursor => cursor::has_visible_blocker(content), - Agent::Antigravity => antigravity::has_visible_blocker(content), - Agent::Cline => cline::has_visible_blocker(content), - Agent::OpenCode => opencode::has_visible_blocker(content), - Agent::GithubCopilot => github_copilot::has_visible_blocker(content), - Agent::Kimi => kimi::has_visible_blocker(content), - Agent::Kiro => kiro::has_visible_blocker(content), - Agent::Droid => droid::has_visible_blocker(content), - Agent::Amp => amp::has_visible_blocker(content), - Agent::Grok => grok::has_visible_blocker(content), - Agent::Hermes => hermes::has_visible_blocker(content), - Agent::Kilo => kilo::has_visible_blocker(content), - Agent::Qodercli => qodercli::has_visible_blocker(content), - _ => false, - } -} - -fn has_visible_working(agent: Agent, content: &str, state: AgentState) -> bool { - if state != AgentState::Working { - return false; - } - - match agent { - Agent::Claude => claude_code::has_working_chrome(content), - Agent::Codex => codex::has_visible_working(content), - Agent::Kimi => kimi::has_visible_working(content), - _ => false, - } -} |
