From fb1b0a96d668686106df84c44b540062e7e546a7 Mon Sep 17 00:00:00 2001 From: t Date: Wed, 10 Jun 2026 12:24:35 -0600 Subject: strip ANSI color sequences from tool output for display --- agent/tools/shell.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'agent') diff --git a/agent/tools/shell.lua b/agent/tools/shell.lua index 815a8b9..f9be58b 100644 --- a/agent/tools/shell.lua +++ b/agent/tools/shell.lua @@ -407,18 +407,21 @@ return { end local body = buffer_to_string() + -- Strip a single trailing newline so the notice (when appended) is + -- separated by exactly one blank line, not two. + body = body:gsub("\n$", "") local parts = { header, "", body } if overflowed then if spill_path and not spill_error then parts[#parts + 1] = string.format( - "\n[truncated: kept last %d bytes; full %d-byte transcript " .. + "[truncated: kept last %d bytes; full %d-byte transcript " .. "saved to %s. Use `read` with `start_line`/`end_line` " .. "to inspect specific regions.]", MAX_BYTES, total_written_to_spill, spill_path ) else parts[#parts + 1] = string.format( - "\n[truncated: kept last %d bytes; could NOT spill to disk: %s]", + "[truncated: kept last %d bytes; could NOT spill to disk: %s]", MAX_BYTES, spill_error or "unknown error" ) end -- cgit v1.3