diff options
| author | JJ Liebig <jonathan.liebig@gmail.com> | 2026-09-22 22:37:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-22 22:37:25 +0200 |
| commit | cd8306d7f35d6329d543944a0257b6bc4b297c8b (patch) | |
| tree | 31454c3f4a61a6948956599ac9d38958365a7503 /src/detect | |
| parent | 621e6b73c4fe4c13562c0906699003d0ca59f0f1 (diff) | |
fix: detect npm-installed omp on windows (#4502)
refs #4313
Diffstat (limited to 'src/detect')
| -rw-r--r-- | src/detect/mod.rs | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/detect/mod.rs b/src/detect/mod.rs index 7fe15d11..3dae571b 100644 --- a/src/detect/mod.rs +++ b/src/detect/mod.rs @@ -650,6 +650,15 @@ fn agent_name_from_known_package_path(path: &str) -> Option<String> { } if ends_with(&[ "node_modules", + "@oh-my-pi", + "pi-coding-agent", + "dist", + "cli.js", + ]) { + return Some(agent_label(Agent::Omp).to_string()); + } + if ends_with(&[ + "node_modules", "@moonshot-ai", "kimi-code", "dist", @@ -1433,19 +1442,36 @@ mod tests { #[test] fn identify_agent_in_job_detects_bun_wrapped_omp() { - let job = crate::platform::ForegroundJob { + for (runtime, script) in [ + ("bun", "/home/can/.bun/bin/omp"), + ( + "bun.exe", + r"C:\Users\herdr\AppData\Roaming\npm\node_modules\@oh-my-pi\pi-coding-agent\dist\cli.js", + ), + ] { + let job = crate::platform::ForegroundJob { + process_group_id: 123, + processes: vec![foreground_process(123, runtime, &[runtime, script])], + }; + assert_eq!( + identify_agent_in_job(&job), + Some((Agent::Omp, "omp".to_string())), + "script: {script}" + ); + } + + let other_script = crate::platform::ForegroundJob { process_group_id: 123, processes: vec![foreground_process( 123, - "bun", - &["bun", "/home/can/.bun/bin/omp"], + "bun.exe", + &[ + "bun.exe", + r"C:\Users\herdr\AppData\Roaming\npm\node_modules\@oh-my-pi\pi-coding-agent\dist\setup.js", + ], )], }; - - assert_eq!( - identify_agent_in_job(&job), - Some((Agent::Omp, "omp".to_string())) - ); + assert_eq!(identify_agent_in_job(&other_script), None); } #[test] |
