diff options
| author | JJ Liebig <jonathan.liebig@gmail.com> | 2026-09-13 18:41:51 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-13 16:41:51 +0200 |
| commit | 63ea2314b2b90c42f2bf5707d00de7a8ab622a10 (patch) | |
| tree | 00b7986441b7820b04d855f500816033fe5b37f1 /src/detect/mod.rs | |
| parent | 5c0ecc6aa5fed5d23f5c982d34357e2c8c2fdf5c (diff) | |
fix: detect kimi npm shim on windows (#4053)
refs #3317
Diffstat (limited to 'src/detect/mod.rs')
| -rw-r--r-- | src/detect/mod.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/detect/mod.rs b/src/detect/mod.rs index 0248d5ce..7326ec32 100644 --- a/src/detect/mod.rs +++ b/src/detect/mod.rs @@ -634,6 +634,15 @@ fn agent_name_from_known_package_path(path: &str) -> Option<String> { ]) { return Some(agent_label(Agent::Pi).to_string()); } + if ends_with(&[ + "node_modules", + "@moonshot-ai", + "kimi-code", + "dist", + "main.mjs", + ]) { + return Some(agent_label(Agent::Kimi).to_string()); + } let components: Vec<String> = raw_components .into_iter() @@ -1304,6 +1313,26 @@ mod tests { } #[test] + fn identify_agent_in_job_detects_node_wrapped_kimi_package_cli() { + let job = crate::platform::ForegroundJob { + process_group_id: 123, + processes: vec![foreground_process( + 123, + "node.exe", + &[ + r"C:\Program Files\nodejs\node.exe", + r"C:\repro-3317-kimi-prefix\node_modules\@moonshot-ai\kimi-code\dist\main.mjs", + ], + )], + }; + + assert_eq!( + identify_agent_in_job(&job), + Some((Agent::Kimi, "kimi".to_string())) + ); + } + + #[test] fn identify_agent_in_job_ignores_non_cli_pi_package_scripts() { for script in [ r"C:\Users\herdr\AppData\Roaming\npm\node_modules\@earendil-works\pi-coding-agent\scripts\build.js", |
