summaryrefslogtreecommitdiffstats
path: root/src/tools/mod.rs
diff options
context:
space:
mode:
authorsalmonik <salmon@2137697.xyz>2026-11-22 18:58:26 +0100
committersalmonik <salmon@2137697.xyz>2026-11-22 18:58:26 +0100
commit7c035acc6e282cdbaa3b0060a528660fa0dba0d4 (patch)
tree0998222677041f58b2759adc99d3515b8db2d404 /src/tools/mod.rs
parent0.12.0: provider is a type + URL, plus a config file (diff)
downloadagent686-7c035acc6e282cdbaa3b0060a528660fa0dba0d4.tar.gz
agent686-7c035acc6e282cdbaa3b0060a528660fa0dba0d4.zip
0.12.1: accept `command` as an alias for `cmd` in bash
A field report showed ~40% of bash calls died on a one-word slip (command vs cmd); the alias removes the failure class instead of improving the error for it.
Diffstat (limited to 'src/tools/mod.rs')
-rw-r--r--src/tools/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/mod.rs b/src/tools/mod.rs
index 7c6a921..5d6189f 100644
--- a/src/tools/mod.rs
+++ b/src/tools/mod.rs
@@ -75,7 +75,11 @@ pub fn validate(name: &str, args: &Value) -> Result<(), String> {
75 }; 75 };
76 76
77 match name { 77 match name {
78 "bash" => required_text("cmd"), 78 "bash" => match args.get("cmd").or_else(|| args.get("command")) {
79 Some(value) if !value.as_str().unwrap_or("").trim().is_empty() => Ok(()),
80 Some(_) => Err("`cmd` is present but empty".into()),
81 None => Err(missing("cmd")),
82 },
79 "read" => required_text("path"), 83 "read" => required_text("path"),
80 "write" => { 84 "write" => {
81 required_text("path")?; 85 required_text("path")?;
@@ -177,11 +181,11 @@ pub fn schemas() -> Vec<Value> {
177 "type": "function", 181 "type": "function",
178 "function": { 182 "function": {
179 "name": "bash", 183 "name": "bash",
180 "description": "Run a shell command. Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.", 184 "description": "Run a shell command. The command string is the `cmd` parameter (not `command`). Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.",
181 "parameters": { 185 "parameters": {
182 "type": "object", 186 "type": "object",
183 "properties": { 187 "properties": {
184 "cmd": { "type": "string" }, 188 "cmd": { "type": "string", "description": "the shell command to run" },
185 "cwd": { "type": "string", "description": "working directory (default: project root)" }, 189 "cwd": { "type": "string", "description": "working directory (default: project root)" },
186 "timeout_seconds": { "type": "integer", "description": "1-600, default 120" }, 190 "timeout_seconds": { "type": "integer", "description": "1-600, default 120" },
187 "max_bytes": { "type": "integer", "description": "per-stream output budget, 1024-16777216, default 81920" } 191 "max_bytes": { "type": "integer", "description": "per-stream output budget, 1024-16777216, default 81920" }