summaryrefslogtreecommitdiffstats
path: root/src/ui.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-18 12:01:38 +0100
committersalmonik <salmonik@tuta.io>2026-11-18 12:01:38 +0100
commit6df7a6403d88a4492ab6ea1c519dcae3a202be96 (patch)
tree216f5d009881c2bccff122a6779397c502fb228b /src/ui.rs
parent0.8.2: comp.sh defaults to this CPU, --portable for travel (diff)
downloadagent686-6df7a6403d88a4492ab6ea1c519dcae3a202be96.tar.gz
agent686-6df7a6403d88a4492ab6ea1c519dcae3a202be96.zip
0.9.0: distinguishable tool errors, separated stderr, configurable limits
From a field report porting a Neovim config to Helix: - validate() now separates 'empty value', 'wrong key (here is what you sent)' and 'no arguments at all, retry' instead of one false message for all four causes - named calls with no arguments are answered rather than dropped silently - bash keeps stdout and stderr in labelled sections when both produce output - bash gains timeout_seconds (1-600) and max_bytes, and says when output was cut - tool lines/results carry [step.call] labels when a step has several calls - invalid JSON errors include a preview of what arrived
Diffstat (limited to '')
-rw-r--r--src/ui.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ui.rs b/src/ui.rs
index 03e8dbe..fe0264b 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, include_detail: bool) { 112pub fn tool_line(label: &str, 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,7 +132,7 @@ pub fn tool_line(step: usize, name: &str, args: &serde_json::Value, include_deta
132 .unwrap_or("") 132 .unwrap_or("")
133 .to_string(), 133 .to_string(),
134 }; 134 };
135 let head = paint("1;36", &format!("● [{step}] {name}")); 135 let head = paint("1;36", &format!("● [{label}] {name}"));
136 if include_detail && !detail.is_empty() { 136 if include_detail && !detail.is_empty() {
137 println!("{head} {detail}"); 137 println!("{head} {detail}");
138 } else { 138 } else {
@@ -141,13 +141,18 @@ pub fn tool_line(step: usize, name: &str, args: &serde_json::Value, include_deta
141 let _ = std::io::stdout().flush(); 141 let _ = std::io::stdout().flush();
142} 142}
143 143
144pub fn tool_result(summary: &str, aborted: bool) { 144pub fn tool_result(label: &str, summary: &str, aborted: bool) {
145 let text = if aborted { 145 let text = if aborted {
146 "aborted".to_string() 146 "aborted".to_string()
147 } else { 147 } else {
148 crate::provider::truncate(summary.trim(), 100) 148 crate::provider::truncate(summary.trim(), 100)
149 }; 149 };
150 println!(" {} {}", paint("2", "└"), paint("2", &text)); 150 println!(
151 " {} {} {}",
152 paint("2", &format!("[{label}] └")),
153 paint("2", &text),
154 ""
155 );
151 let _ = std::io::stdout().flush(); 156 let _ = std::io::stdout().flush();
152} 157}
153 158