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/kimi.rs | |
| parent | 8d13492926829c5cf0ea42c8613344cd65ff59fa (diff) | |
feat: distribute agent detection manifests
Diffstat (limited to 'src/detect/agents/kimi.rs')
| -rw-r--r-- | src/detect/agents/kimi.rs | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/detect/agents/kimi.rs b/src/detect/agents/kimi.rs deleted file mode 100644 index 9d3821ed..00000000 --- a/src/detect/agents/kimi.rs +++ /dev/null @@ -1,97 +0,0 @@ -use super::super::AgentState; - -pub(super) fn detect(content: &str) -> AgentState { - if has_kimi_blocked_prompt(content) { - return AgentState::Blocked; - } - - if has_kimi_working_status(content) { - return AgentState::Working; - } - - AgentState::Idle -} - -pub(super) fn has_visible_blocker(content: &str) -> bool { - has_current_approval_panel(content) || has_question_panel(content) -} - -pub(super) fn has_visible_working(content: &str) -> bool { - has_kimi_working_status(content) -} - -fn has_kimi_blocked_prompt(content: &str) -> bool { - if has_visible_blocker(content) { - return true; - } - - let lower = content.to_lowercase(); - lower.contains("requesting approval") - && (lower.contains("approve once") || lower.contains("approve for this session")) - && lower.contains("reject") - && (lower.contains("1/2/3/4 choose") || lower.contains("↵ confirm")) -} - -fn has_kimi_working_status(content: &str) -> bool { - content.lines().any(|line| { - let trimmed = line.trim(); - if matches!( - trimmed, - "🌕" | "🌖" | "🌗" | "🌘" | "🌑" | "🌒" | "🌓" | "🌔" - ) { - return true; - } - - let mut chars = trimmed.chars(); - let Some(first) = chars.next() else { - return false; - }; - if !('\u{2800}'..='\u{28FF}').contains(&first) { - return false; - } - - let rest = chars - .as_str() - .trim_start_matches(|c| ('\u{2800}'..='\u{28FF}').contains(&c)) - .trim_start() - .to_lowercase(); - rest.starts_with("thinking...") - || rest.starts_with("working...") - || rest.starts_with("using ") - }) -} - -fn has_current_approval_panel(content: &str) -> bool { - let lower = content.to_lowercase(); - has_approval_title(&lower) - && has_numeric_choose_hint(&lower) - && lower.contains("↵ confirm") - && (lower.contains("approve") || lower.contains("reject") || lower.contains("revise")) -} - -fn has_approval_title(lower_content: &str) -> bool { - lower_content.contains("run this command?") - || lower_content.contains("write this file?") - || lower_content.contains("apply these edits?") - || lower_content.contains("stop this task?") - || lower_content.contains("ready to build with this plan?") - || lower_content.lines().any(|line| { - let trimmed = line.trim_start_matches(|c: char| c == '▶' || c.is_whitespace()); - trimmed.starts_with("approve ") && trimmed.ends_with('?') - }) -} - -fn has_question_panel(content: &str) -> bool { - let lower = content.to_lowercase(); - content.lines().any(|line| line.trim() == "question") - && content - .lines() - .any(|line| line.trim_start().starts_with("? ")) - && lower.contains("↑↓ select") - && (lower.contains("↵ choose") || lower.contains("↵ toggle") || lower.contains("↵ save")) - && lower.contains("esc cancel") -} - -fn has_numeric_choose_hint(lower_content: &str) -> bool { - lower_content.contains(" choose") && lower_content.contains('1') && lower_content.contains('2') -} |
