feat(tui): implement agent turn engine for background processing and enhance input handling

This commit is contained in:
asepharyana
2026-07-20 10:55:09 +07:00
parent da2ed6da25
commit 792695b65a
31 changed files with 603 additions and 153 deletions
+20 -3
View File
@@ -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"))
}
}
}