feat(tui): implement agent turn engine for background processing and enhance input handling
This commit is contained in:
@@ -78,8 +78,25 @@ impl Tool for BashKill {
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let _job_id = crate::tools::arg_str(args, "job_id")?;
|
||||
// In production, look up and kill the job in BashControl
|
||||
Ok(format!("Killed background job '{}'", _job_id))
|
||||
let job_id = crate::tools::arg_str(args, "job_id")?;
|
||||
info!("bash_kill called for job: {job_id}");
|
||||
// Try to kill by PID (if job_id is numeric) or by process name
|
||||
if let Ok(pid) = job_id.parse::<u32>() {
|
||||
use std::process::Command;
|
||||
match Command::new("kill").arg(pid.to_string()).output() {
|
||||
Ok(output) if output.status.success() => {
|
||||
Ok(format!("Killed background job '{job_id}' (PID {pid})"))
|
||||
}
|
||||
Ok(output) => {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
Ok(format!("Failed to kill job '{job_id}': {stderr}"))
|
||||
}
|
||||
Err(e) => {
|
||||
Ok(format!("Failed to kill job '{job_id}': {e}"))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ok(format!("Invalid job ID '{job_id}' — expected numeric PID"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user