From 8ae5bd48cf233315b5f36a7a6b39002a5e77f74b Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 15 Nov 2026 18:00:12 +0100 Subject: 0.7.0: resume shows where you left off; no approval for unparsable calls - --continue prints the last answer, or the last reasoning block if there was none - tool arguments are validated before prompting, so an empty bash call becomes an error for the model instead of a blank approval - empty placeholder tool calls are dropped and reported - sessions tolerate invalid UTF-8 lines from a torn write - AGENT686_DEBUG_STREAM=1 dumps SSE frames --- src/main.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 91d54da..45ca8c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,6 +195,7 @@ fn run(args: Args) { } }; + let resuming = args.session.is_some() || args.continue_last; let (mut session, mut history) = match open_session(&cfg, args.session, args.continue_last) { Ok(pair) => pair, Err(message) => { @@ -205,6 +206,9 @@ fn run(args: Args) { cfg.session = session.id.clone(); warn_if_moved(&session); + if resuming { + print_last_reply(&session.id); + } if !session.version.is_empty() && session.version != env!("CARGO_PKG_VERSION") { eprintln!( "agent686: this session was written by {}; the prompt and tool schemas may \ @@ -647,3 +651,42 @@ fn render_message(message: &Value, color: bool) -> String { other => format!("[{other}]\n"), } } + +/// On resume, show where the conversation left off: the last answer, or the last +/// reasoning when the model never produced content. Only on a terminal, so piped +/// runs stay clean. +fn print_last_reply(id: &str) { + if !std::io::stdout().is_terminal() { + return; + } + let Some(reply) = session::last_reply(id) else { + return; + }; + let text = if reply.content.trim().is_empty() { + reply.reasoning.trim() + } else { + reply.content.trim() + }; + if text.is_empty() { + return; + } + + let lines: Vec<&str> = text.lines().collect(); + let limit = 20; + println!(); + println!("{}", style("2", "── where you left off ──", true)); + for line in lines.iter().take(limit) { + println!("{line}"); + } + if lines.len() > limit { + println!( + "{}", + style( + "2", + &format!("… {} more line(s); `agent686 --show` for the transcript", lines.len() - limit), + true + ) + ); + } + println!(); +} -- cgit v1.2.3