diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 18:31:16 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 18:31:16 +0100 |
| commit | 0ef2b709b5ec2d44fc947a8b96572f66ee8b3bc9 (patch) | |
| tree | e0ee8b2824281eb9f672b9cb46f7d50ad3857b3d /src/tools/mod.rs | |
| parent | 0.7.0: resume shows where you left off; no approval for unparsable calls (diff) | |
| download | agent686-0ef2b709b5ec2d44fc947a8b96572f66ee8b3bc9.tar.gz agent686-0ef2b709b5ec2d44fc947a8b96572f66ee8b3bc9.zip | |
0.7.1: drop argument-less tool calls, print each command once
- a name+no-arguments placeholder is removed before the assistant message is
recorded, instead of prompting for an empty command
- the bash prompt shows the command; the tool line shows only the name
- the edit prompt no longer repeats the path already shown above
Diffstat (limited to 'src/tools/mod.rs')
| -rw-r--r-- | src/tools/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 060dd7b..ddb1004 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs | |||
| @@ -24,6 +24,19 @@ pub fn approval(name: &str) -> Approval { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | /// A call with no arguments at all. Every tool here requires at least one, so | ||
| 28 | /// this is a placeholder some backends emit next to a real call, not an attempt. | ||
| 29 | pub fn is_placeholder(arguments: &str) -> bool { | ||
| 30 | let trimmed = arguments.trim(); | ||
| 31 | if trimmed.is_empty() { | ||
| 32 | return true; | ||
| 33 | } | ||
| 34 | matches!( | ||
| 35 | serde_json::from_str::<Value>(trimmed), | ||
| 36 | Ok(Value::Object(map)) if map.is_empty() | ||
| 37 | ) | ||
| 38 | } | ||
| 39 | |||
| 27 | /// Rejects a call that cannot possibly run, before a human is asked to approve | 40 | /// Rejects a call that cannot possibly run, before a human is asked to approve |
| 28 | /// it. An empty `cmd` used to mean an approval prompt for `run: `. | 41 | /// it. An empty `cmd` used to mean an approval prompt for `run: `. |
| 29 | pub fn validate(name: &str, args: &Value) -> Result<(), String> { | 42 | pub fn validate(name: &str, args: &Value) -> Result<(), String> { |
