From 714534475818e6e5dced91ecad100ca9e286ccce Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 15 Nov 2026 15:37:56 +0100 Subject: 0.4.1 + 0.4.2: abort integrity, stream completeness, tool-call indexing - an aborted multi-call step now answers every announced tool call - sessions with unanswered calls are repaired by appending results - a stream without [DONE]/finish_reason is an error, not an answer - tool call deltas keyed by index can no longer vanish or invent empty calls - one-shot exit codes: 130 aborted, 3 denied --- src/ui.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/ui.rs') diff --git a/src/ui.rs b/src/ui.rs index 2ec0821..38546ab 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -104,14 +104,13 @@ pub fn tool_line(name: &str, args: &serde_json::Value) { let _ = std::io::stdout().flush(); } -pub fn tool_result(result: &Result) { - let text = match result { - Ok(output) => output, - Err(error) => error, +pub fn tool_result(summary: &str, aborted: bool) { + let text = if aborted { + "aborted".to_string() + } else { + crate::provider::truncate(summary.trim(), 100) }; - let first = text.lines().find(|l| !l.trim().is_empty()).unwrap_or(""); - let summary = crate::provider::truncate(first.trim(), 100); - println!(" {} {}", paint("2", "└"), paint("2", &summary)); + println!(" {} {}", paint("2", "└"), paint("2", &text)); let _ = std::io::stdout().flush(); } @@ -163,7 +162,7 @@ impl Approver { self.yolo } - fn ask(&self, question: &str) -> Answer { + fn ask(&self, question: &str, allow_always: bool) -> Answer { if self.yolo { return Answer::Yes; } @@ -174,7 +173,8 @@ impl Approver { ); return Answer::No; } - print!("\n{} {} ", question, paint("2", "[y/N/a]")); + let hint = if allow_always { "[y/N/a]" } else { "[y/N]" }; + print!("\n{} {} ", question, paint("2", hint)); let _ = std::io::stdout().flush(); let mut line = String::new(); @@ -183,7 +183,7 @@ impl Approver { } match line.trim().to_ascii_lowercase().as_str() { "y" | "yes" => Answer::Yes, - "a" | "always" => Answer::Always, + "a" | "always" if allow_always => Answer::Always, _ => Answer::No, } } @@ -194,7 +194,7 @@ impl Approver { return true; } println!("{preview}"); - match self.ask(&format!("apply this change to {path}?")) { + match self.ask(&format!("apply this change to {path}?"), true) { Answer::Yes => true, Answer::Always => { self.edits_allowed = true; @@ -209,6 +209,8 @@ impl Approver { if self.yolo { return true; } - self.ask(&format!("run: {}", crate::provider::truncate(cmd, 200))) == Answer::Yes + // Bash prompts every call by design, so "always" is not offered here. + self.ask(&format!("run: {}", crate::provider::truncate(cmd, 200)), false) + == Answer::Yes } } -- cgit v1.2.3