aboutsummaryrefslogtreecommitdiff
path: root/src/detect/mod.rs
diff options
context:
space:
mode:
authorqer <wbxl2000@outlook.com>2026-06-04 18:52:29 +0800
committerGitHub <noreply@github.com>2026-06-04 13:52:29 +0300
commit66b0f6b2d6e1c63c3a7aa0d26cff91cf750232aa (patch)
treec114ee4571705357540d7df3ac94349234c77ff3 /src/detect/mod.rs
parentcb18fe52b55f1a627387c829074e9d24b9cefb28 (diff)
feat: add kimi code cli integration (#463)
* feat: add kimi code cli integration refs #431 * fix: improve kimi code screen detection refs #431
Diffstat (limited to 'src/detect/mod.rs')
-rw-r--r--src/detect/mod.rs40
1 files changed, 40 insertions, 0 deletions
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
@@ -2124,6 +2124,26 @@ mod tests {
}
#[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);
assert_eq!(detect_kimi("continue? [y/n]"), AgentState::Idle);
@@ -2146,6 +2166,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);
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]