From 66b0f6b2d6e1c63c3a7aa0d26cff91cf750232aa Mon Sep 17 00:00:00 2001 From: qer Date: Thu, 4 Jun 2026 18:52:29 +0800 Subject: feat: add kimi code cli integration (#463) * feat: add kimi code cli integration refs #431 * fix: improve kimi code screen detection refs #431 --- src/detect/mod.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/detect/mod.rs') diff --git a/src/detect/mod.rs b/src/detect/mod.rs index 6240d1b2..06536336 100644 --- a/src/detect/mod.rs +++ b/src/detect/mod.rs @@ -2123,6 +2123,26 @@ mod tests { assert_eq!(detect_kimi(screen), AgentState::Blocked); } + #[test] + fn kimi_current_approval_panel_is_visible_blocker() { + let screen = "────────────────────────────────────────────────────\n ▶ Run this command?\n\n $ git status --short\n\n ▶ 1. Approve once\n 2. Approve for this session\n 3. Reject\n 4. Reject with feedback\n\n ↑/↓ select · 1/2/3/4 choose · ↵ confirm\n────────────────────────────────────────────────────"; + let detection = detect_agent(Some(Agent::Kimi), screen); + + assert_eq!(detection.state, AgentState::Blocked); + assert!(detection.visible_blocker); + assert!(!detection.visible_idle); + } + + #[test] + fn kimi_question_panel_is_visible_blocker() { + let screen = "────────────────────────────────────────────────────\n question\n\n (○) Destination Submit\n\n ? Which destination should I use?\n\n → [1] Local checkout\n [2] Remote branch\n [3] Other\n\n ↑↓ select 1-3 / ↵ choose ←/→/tab switch esc cancel\n────────────────────────────────────────────────────"; + let detection = detect_agent(Some(Agent::Kimi), screen); + + assert_eq!(detection.state, AgentState::Blocked); + assert!(detection.visible_blocker); + assert!(!detection.visible_idle); + } + #[test] fn kimi_approval_words_without_prompt_stay_idle() { assert_eq!(detect_kimi("approve?"), AgentState::Idle); @@ -2145,6 +2165,15 @@ mod tests { ); } + #[test] + fn kimi_working_braille_working_status_is_visible_working() { + let detection = detect_agent(Some(Agent::Kimi), "⠋ working..."); + + assert_eq!(detection.state, AgentState::Working); + assert!(detection.visible_working); + assert!(!detection.visible_idle); + } + #[test] fn kimi_working_moon_spinner() { assert_eq!(detect_kimi("🌕"), AgentState::Working); @@ -2175,6 +2204,17 @@ mod tests { assert_eq!(detect_kimi(screen), AgentState::Idle); } + #[test] + fn kimi_current_editor_box_is_visible_idle() { + let screen = "╭──────────────────────────────────────────────────╮\n│ > │\n╰──────────────────────────────────────────────────╯\nk2 ~/Projects/herdr /help: show commands\n context: 0.0%"; + let detection = detect_agent(Some(Agent::Kimi), screen); + + assert_eq!(detection.state, AgentState::Idle); + assert!(detection.visible_idle); + assert!(!detection.visible_working); + assert!(!detection.visible_blocker); + } + // ---- Kiro ---- #[test] -- cgit v1.2.3