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/agent.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/agent.rs')
| -rw-r--r-- | src/agent.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/agent.rs b/src/agent.rs index f0e1292..7d4c4ef 100644 --- a/src/agent.rs +++ b/src/agent.rs | |||
| @@ -217,6 +217,16 @@ pub fn run_turn( | |||
| 217 | Err(error) => return Err(error), | 217 | Err(error) => return Err(error), |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | // Placeholders are dropped before the assistant message is written: | ||
| 221 | // recording a call we refuse to run would leave it unanswered. | ||
| 222 | let before = outcome.tool_calls.len(); | ||
| 223 | outcome | ||
| 224 | .tool_calls | ||
| 225 | .retain(|call| !tools::is_placeholder(&call.arguments)); | ||
| 226 | if outcome.tool_calls.len() < before { | ||
| 227 | eprintln!("agent686: ignored {} empty tool call(s) from the model", before - outcome.tool_calls.len()); | ||
| 228 | } | ||
| 229 | |||
| 220 | // A missing id would make the tool result unattachable. | 230 | // A missing id would make the tool result unattachable. |
| 221 | for (index, call) in outcome.tool_calls.iter_mut().enumerate() { | 231 | for (index, call) in outcome.tool_calls.iter_mut().enumerate() { |
| 222 | if call.id.is_empty() { | 232 | if call.id.is_empty() { |
| @@ -351,7 +361,10 @@ fn execute( | |||
| 351 | )) | 361 | )) |
| 352 | } | 362 | } |
| 353 | }; | 363 | }; |
| 354 | ui::tool_line(step, &call.name, &args); | 364 | // The bash approval prompt prints the command; do not print it here too. |
| 365 | let repeat_detail = !(tools::approval(&call.name) == Approval::EveryCall | ||
| 366 | && approver.will_prompt_bash()); | ||
| 367 | ui::tool_line(step, &call.name, &args, repeat_detail); | ||
| 355 | if let Err(error) = tools::validate(&call.name, &args) { | 368 | if let Err(error) = tools::validate(&call.name, &args) { |
| 356 | return ToolOutcome::Failed(format!("{error}; the call was not run")); | 369 | return ToolOutcome::Failed(format!("{error}; the call was not run")); |
| 357 | } | 370 | } |
