aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-15 18:31:16 +0100
committersalmonik <salmonik@tuta.io>2026-11-15 18:31:16 +0100
commit0ef2b709b5ec2d44fc947a8b96572f66ee8b3bc9 (patch)
treee0ee8b2824281eb9f672b9cb46f7d50ad3857b3d /src/ui.rs
parent0.7.0: resume shows where you left off; no approval for unparsable calls (diff)
downloadagent686-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/ui.rs')
-rw-r--r--src/ui.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ui.rs b/src/ui.rs
index 2fdda1a..03e8dbe 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -109,7 +109,7 @@ impl<W: Write> Sink for Renderer<W> {
109 } 109 }
110} 110}
111 111
112pub fn tool_line(step: usize, name: &str, args: &serde_json::Value) { 112pub fn tool_line(step: usize, name: &str, args: &serde_json::Value, include_detail: bool) {
113 let detail = match name { 113 let detail = match name {
114 "bash" => args 114 "bash" => args
115 .get("cmd") 115 .get("cmd")
@@ -132,11 +132,12 @@ pub fn tool_line(step: usize, name: &str, args: &serde_json::Value) {
132 .unwrap_or("") 132 .unwrap_or("")
133 .to_string(), 133 .to_string(),
134 }; 134 };
135 println!( 135 let head = paint("1;36", &format!("● [{step}] {name}"));
136 "{} {}", 136 if include_detail && !detail.is_empty() {
137 paint("1;36", &format!("● [{step}] {name}")), 137 println!("{head} {detail}");
138 detail 138 } else {
139 ); 139 println!("{head}");
140 }
140 let _ = std::io::stdout().flush(); 141 let _ = std::io::stdout().flush();
141} 142}
142 143
@@ -264,7 +265,9 @@ impl Approver {
264 return true; 265 return true;
265 } 266 }
266 println!("{preview}"); 267 println!("{preview}");
267 match self.ask(&format!("apply this change to {path}?"), true) { 268 // The path is already on the tool line above.
269 let _ = path;
270 match self.ask("apply this change?", true) {
268 Answer::Yes => true, 271 Answer::Yes => true,
269 Answer::Always => { 272 Answer::Always => {
270 self.edits_allowed = true; 273 self.edits_allowed = true;
@@ -274,6 +277,13 @@ impl Approver {
274 } 277 }
275 } 278 }
276 279
280 /// True when the next bash call will actually be shown to a human, which is
281 /// the only case where the command appears in the prompt rather than the
282 /// tool line.
283 pub fn will_prompt_bash(&self) -> bool {
284 !self.yolo && self.interactive
285 }
286
277 /// Every call, no memory: the point is seeing the command. 287 /// Every call, no memory: the point is seeing the command.
278 pub fn allow_bash(&mut self, cmd: &str) -> bool { 288 pub fn allow_bash(&mut self, cmd: &str) -> bool {
279 if self.yolo { 289 if self.yolo {