aboutsummaryrefslogtreecommitdiffstats
path: root/src/agent.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-15 15:40:13 +0100
committersalmonik <salmonik@tuta.io>2026-11-15 15:40:13 +0100
commita39ea052deff856ff9d27cdebecbbea1837d5a69 (patch)
tree6bc0743615aa4f183bc8c2027d9d70ec3c85ed40 /src/agent.rs
parent0.4.3: kill process groups, bound bash output, keep the key out of tool env (diff)
downloadagent686-a39ea052deff856ff9d27cdebecbbea1837d5a69.tar.gz
agent686-a39ea052deff856ff9d27cdebecbbea1837d5a69.zip
0.4.4: file-tool correctness
- read: regular files only, checked offset conversion on 32-bit - write/edit: atomic rename, re-read before apply, preserve mode - edit: CRLF files match and keep their line endings - grep: missing path is an error, skipped files are reported - glob: follows file symlinks
Diffstat (limited to 'src/agent.rs')
-rw-r--r--src/agent.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/agent.rs b/src/agent.rs
index 9e2a431..77807ae 100644
--- a/src/agent.rs
+++ b/src/agent.rs
@@ -302,16 +302,19 @@ fn execute(
302 Err(error) => ToolOutcome::Failed(error), 302 Err(error) => ToolOutcome::Failed(error),
303 }, 303 },
304 Approval::Once => match tools::plan(&call.name, &args) { 304 Approval::Once => match tools::plan(&call.name, &args) {
305 Ok(change) => { 305 Ok(change) => match change.preview() {
306 if approver.allow_edit(change.path(), &change.preview()) { 306 Ok(preview) => {
307 match change.apply() { 307 if approver.allow_edit(change.path(), &preview) {
308 Ok(output) => ToolOutcome::Ok(output), 308 match change.apply() {
309 Err(error) => ToolOutcome::Failed(error), 309 Ok(output) => ToolOutcome::Ok(output),
310 Err(error) => ToolOutcome::Failed(error),
311 }
312 } else {
313 ToolOutcome::Denied
310 } 314 }
311 } else {
312 ToolOutcome::Denied
313 } 315 }
314 } 316 Err(error) => ToolOutcome::Failed(error),
317 },
315 Err(error) => ToolOutcome::Failed(error), 318 Err(error) => ToolOutcome::Failed(error),
316 }, 319 },
317 Approval::EveryCall => { 320 Approval::EveryCall => {