diff options
| author | t <t@tjp.lol> | 2026-06-10 12:24:35 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-06-10 14:36:05 -0600 |
| commit | fb1b0a96d668686106df84c44b540062e7e546a7 (patch) | |
| tree | 93ac0d82064e606edeabb25b3225202d68206a39 /agent | |
| parent | bb85e867bc938138f29fb45230169af1ba60761c (diff) | |
strip ANSI color sequences from tool output for display
Diffstat (limited to 'agent')
| -rw-r--r-- | agent/tools/shell.lua | 7 |
1 files changed, 5 insertions, 2 deletions
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 |
