mirror of
https://github.com/herdrdev/herdr.git
synced 2026-11-06 08:06:30 +00:00
+34
-8
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user