aboutsummaryrefslogtreecommitdiff
path: root/src/detect
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 03:50:45 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 04:16:36 +0300
commit1d56cd0e18fc69a85a0889ca6f9a9f3069a4be3a (patch)
treef18bc80137a6dcfbccc7aa3666b94649197dbae5 /src/detect
parent2fcf9b678d0f154b2d41aa5fafa25aaa73ec7f17 (diff)
feat: detect kilo code cli
refs #270
Diffstat (limited to 'src/detect')
-rw-r--r--src/detect/agents/kilo.rs9
-rw-r--r--src/detect/agents/mod.rs2
-rw-r--r--src/detect/mod.rs50
3 files changed, 61 insertions, 0 deletions
diff --git a/src/detect/agents/kilo.rs b/src/detect/agents/kilo.rs
new file mode 100644
index 00000000..1ab3651a
--- /dev/null
+++ b/src/detect/agents/kilo.rs
@@ -0,0 +1,9 @@
+use super::super::AgentState;
+
+pub(super) fn detect(content: &str) -> AgentState {
+ if content.to_lowercase().contains("esc interrupt") {
+ return AgentState::Working;
+ }
+
+ super::opencode::detect(content)
+}
diff --git a/src/detect/agents/mod.rs b/src/detect/agents/mod.rs
index 87b4043f..4597c122 100644
--- a/src/detect/agents/mod.rs
+++ b/src/detect/agents/mod.rs
@@ -9,6 +9,7 @@ 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;
@@ -34,6 +35,7 @@ pub(super) fn detect(agent: Agent, screen_content: &str) -> AgentDetection {
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),
};
diff --git a/src/detect/mod.rs b/src/detect/mod.rs
index cf600f51..b9806b19 100644
--- a/src/detect/mod.rs
+++ b/src/detect/mod.rs
@@ -54,6 +54,7 @@ pub enum Agent {
Amp,
Grok,
Hermes,
+ Kilo,
Qodercli,
}
@@ -74,6 +75,7 @@ pub fn agent_label(agent: Agent) -> &'static str {
Agent::Amp => "amp",
Agent::Grok => "grok",
Agent::Hermes => "hermes",
+ Agent::Kilo => "kilo",
Agent::Qodercli => "qodercli",
}
}
@@ -96,6 +98,7 @@ pub fn parse_agent_label(agent: &str) -> Option<Agent> {
"amp" | "amp-local" => Some(Agent::Amp),
"grok" | "grok-build" => Some(Agent::Grok),
"hermes" | "hermes-agent" => Some(Agent::Hermes),
+ "kilo" | "kilo-code" | "kilo code" => Some(Agent::Kilo),
"qodercli" | "qoderclicn" | "qoder" | "qodercn" => Some(Agent::Qodercli),
_ => None,
}
@@ -122,6 +125,7 @@ pub fn identify_agent(process_name: &str) -> Option<Agent> {
"amp" | "amp-local" => Some(Agent::Amp),
"grok" | "grok-build" => Some(Agent::Grok),
"hermes" | "hermes-agent" => Some(Agent::Hermes),
+ "kilo" | "kilo-code" | "kilo code" => Some(Agent::Kilo),
"qodercli" | "qoderclicn" | "qoder" | "qodercn" => Some(Agent::Qodercli),
_ => None,
}
@@ -255,6 +259,11 @@ fn detect_qodercli(content: &str) -> AgentState {
detect_state(Some(Agent::Qodercli), content)
}
+#[cfg(test)]
+fn detect_kilo(content: &str) -> AgentState {
+ detect_state(Some(Agent::Kilo), content)
+}
+
// ---------------------------------------------------------------------------
// Shared helpers
// ---------------------------------------------------------------------------
@@ -567,6 +576,11 @@ mod tests {
AgentState::Working,
),
(Agent::Hermes, "msg=interrupt", AgentState::Working),
+ (
+ Agent::Kilo,
+ "Ask · DeepSeek V4 Pro\nesc interrupt",
+ AgentState::Working,
+ ),
(Agent::Qodercli, "\u{280B} Thinking...", AgentState::Working),
];
@@ -604,6 +618,8 @@ mod tests {
assert_eq!(identify_agent("grok-build"), Some(Agent::Grok));
assert_eq!(identify_agent("hermes"), Some(Agent::Hermes));
assert_eq!(identify_agent("hermes-agent"), Some(Agent::Hermes));
+ assert_eq!(identify_agent("kilo"), Some(Agent::Kilo));
+ assert_eq!(identify_agent("kilo-code"), Some(Agent::Kilo));
}
#[test]
@@ -623,6 +639,7 @@ mod tests {
assert_eq!(parse_agent_label("kiro-cli"), Some(Agent::Kiro));
assert_eq!(parse_agent_label("grok-build"), Some(Agent::Grok));
assert_eq!(parse_agent_label("hermes-agent"), Some(Agent::Hermes));
+ assert_eq!(parse_agent_label("kilo-code"), Some(Agent::Kilo));
}
#[test]
@@ -634,6 +651,7 @@ mod tests {
assert_eq!(agent_label(Agent::Kiro), "kiro");
assert_eq!(agent_label(Agent::Grok), "grok");
assert_eq!(agent_label(Agent::Hermes), "hermes");
+ assert_eq!(agent_label(Agent::Kilo), "kilo");
}
#[test]
@@ -1581,6 +1599,38 @@ mod tests {
assert_eq!(detect_opencode("> "), AgentState::Idle);
}
+ // ---- Kilo ----
+
+ #[test]
+ fn kilo_waiting_question_prompt() {
+ assert_eq!(
+ detect_kilo(
+ "Write the following joke to ~/joke.md?\n\
+ 1. Yes, write it\n\
+ 2. No, thanks\n\
+ 3. Type your own answer\n\
+ ↑↓ select enter submit esc dismiss",
+ ),
+ AgentState::Blocked
+ );
+ }
+
+ #[test]
+ fn kilo_working() {
+ assert_eq!(
+ detect_kilo("Ask · DeepSeek V4 Pro\nesc interrupt\n12.8K (1%) · $0.01"),
+ AgentState::Working
+ );
+ }
+
+ #[test]
+ fn kilo_idle() {
+ assert_eq!(
+ detect_kilo("Ask anything... \"Fix broken tests\"\nCode · DeepSeek V4 Pro"),
+ AgentState::Idle
+ );
+ }
+
// ---- GitHub Copilot ----
#[test]