fix: detect npm-installed omp on windows

refs #4313
This commit is contained in:
Jonathan Liebig
2026-09-22 22:17:43 +02:00
parent 621e6b73c4
commit 3a098c23c4
+34 -8
View File
@@ -648,6 +648,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",
"@oh-my-pi",
"pi-coding-agent",
"dist",
"cli.js",
]) {
return Some(agent_label(Agent::Omp).to_string());
}
if ends_with(&[
"node_modules",
"@moonshot-ai",
@@ -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]