The acp view shows a tool call's input as it was sent: line breaks kept, a timestamp per entry, optional highlighting #73

Merged
city-root merged 1 commit from worker/rexcity-n2ass into main 2026-11-12 07:39:48 +00:00
Contributor

Closes the request in rexcity-n2ass: the acp log shows a tool call's input as it was sent, stamps every entry, and can be highlighted.

Decisions

  • Entry and time. An entry is a tool call, a run of agent text or thinking, a plan update, a permission request, gc's answer, a cancel, a mode change, a stderr line, a wrapper note, a turn's end, the end of a run. Each begins with HH:MM:SS. A run of text is stamped once, on its first line, however long. The time is when the box saw the message (taken when the line is queued, so a lagging log stays right), or a _meta.timestamp (RFC 3339) in the message if it carries one; claudeacp sends none. gc's prompt and the run header keep their own place for the time.
  • Running calls. The log is only appended to, so a call is written once, at its final status, stamped with the time it ended (which keeps the log in time order). A call still without a status when its turn or the run ends is written as … Bash (no final status) with its input, as before. Cost: a call that runs for minutes is not in the log until it ends. Writing a start record and an end record would show it, at two lines per call and a different shape from your example; say so if you want that.
  • Input. A shell command is its text, line breaks and indentation kept. Any other input is its JSON, indented, keys in the order sent, strings as sent (Go's \u003c/\u003e/\u0026 shown as < > &); description and the other fields of a Bash input are not shown. The head line is the tool's name and status, as in your example; a call whose adapter sent no input is the one line it was.
  • Bound. The first 30 lines of an input, each cut at 240 characters. A cut line ends in …; lines left out are counted (… 12 more lines). A file written in one call is one JSON string, so the width cuts it. Control characters are shown as their pictures (␛), since a pane writes the log to a terminal.
  • Highlighting setting. REXCITY_ACP_HIGHLIGHT in the agent's env (like REXCITY_PANE): 1, true, yes or on turns it on; off by default. The wrapper passes --highlight to rexcity acp follow, which also takes it by hand. Shell for a Bash call, JSON for any other input.
  • Colour is applied by follow, not written to the log. The log stays plain text for cat, grep and tail, and a pane can be switched without touching a log that is appended to. The follower works on whole lines and holds back only a partial line that may still be a body line, so streamed text shows as it arrives. (The dim of thinking and of stderr was in the log already and stays.)
  • Unchanged: gc's prompts, thinking dimmed, permissions and answers, the header per start, stderr.

Before and after, one recorded turn

testdata/tools.stream, built to the shape claudeacp v0.5.0 emits (rawInput as an empty object at the call's start, then whole; the Bash title is the command). The two recorded streams are in the golden test too, with their goldens updated. The after log uses the test's fixed clock, so every time is the same.

Before (cut at 110 columns, as the pane cuts it):

The tools first, then the changelog.
I will run the three test scripts,
then add the changelog note.
✓ Bash: for t in worktree-setup worktree gnu-tools; do   printf '%s: ' $t   bash tests/$t.sh 2>&1 | tail -1 do
✓ Edit CHANGELOG.md
✗ Read /work/nope.txt — File does not exist.
✓ Write notes.txt
✓ Bash: cat <<'EOF' > list.txt item 1 item 2 item 3 item 4 item 5 item 6 item 7 item 8 item 9 item 10 item 11 
☰ plan
  [x] Run the scripts
  [x] Note the change
Both done.
… Bash: sleep 600 (no final status)

After (tools.golden, the first 25 lines):

17:42:05 The tools first, then the changelog.
17:42:05 I will run the three test scripts,
then add the changelog note.
17:42:05 ✓ Bash
  for t in worktree-setup worktree gnu-tools; do
    printf '%s: ' $t
    bash tests/$t.sh 2>&1 | tail -1
  done
  git add -A && git commit -q -m "docs: ..."
17:42:05 ✓ Edit
  {
    "file_path": "CHANGELOG.md",
    "old_string": "## [Unreleased]\n",
    "new_string": "## [Unreleased]\n\n### Changed\n\n- The acp view shows a tool call's input as it was sent.\
  }
17:42:05 ✗ Read — File does not exist.
  {
    "file_path": "/work/nope.txt"
  }
17:42:05 ✓ Write
  {
    "file_path": "notes.txt",
    "content": "line 1 of the file\nline 2 of the file\nline 3 of the file\nline 4 of the file\nline 5 of the 
  }
17:42:05 ✓ Bash

Verification

  • go vet and go test over cmd, internal and packs pass, with a stub rex first on PATH (the whole of packs too); go test -race over internal/acpbox passes; the v1 changelog check is valid.
  • New: renderer cases for shell and JSON inputs, key order and escapes, non-object inputs, the last input of a call, failed and unfinished calls, the bound, control characters, one stamp per run of text, the seen time, a message's own time; highlighter cases for JSON, shell, non-bodies, split writes, partial lines and a dead pane; follow --highlight; the env setting reaching the pane's argv.
  • Not run against a live claudeacp or Rex, per the bead.

Bead: rexcity-n2ass

Closes the request in rexcity-n2ass: the acp log shows a tool call's input as it was sent, stamps every entry, and can be highlighted. ## Decisions - **Entry and time.** An entry is a tool call, a run of agent text or thinking, a plan update, a permission request, gc's answer, a cancel, a mode change, a stderr line, a wrapper note, a turn's end, the end of a run. Each begins with `HH:MM:SS`. A run of text is stamped once, on its first line, however long. The time is when the box *saw* the message (taken when the line is queued, so a lagging log stays right), or a `_meta.timestamp` (RFC 3339) in the message if it carries one; claudeacp sends none. gc's prompt and the run header keep their own place for the time. - **Running calls.** The log is only appended to, so a call is written once, at its final status, stamped with the time it ended (which keeps the log in time order). A call still without a status when its turn or the run ends is written as `… Bash (no final status)` with its input, as before. Cost: a call that runs for minutes is not in the log until it ends. Writing a start record and an end record would show it, at two lines per call and a different shape from your example; say so if you want that. - **Input.** A shell command is its text, line breaks and indentation kept. Any other input is its JSON, indented, keys in the order sent, strings as sent (Go's `\u003c`/`\u003e`/`\u0026` shown as `<` `>` `&`); `description` and the other fields of a Bash input are not shown. The head line is the tool's name and status, as in your example; a call whose adapter sent no input is the one line it was. - **Bound.** The first **30 lines** of an input, each cut at **240 characters**. A cut line ends in `…`; lines left out are counted (`… 12 more lines`). A file written in one call is one JSON string, so the width cuts it. Control characters are shown as their pictures (`␛`), since a pane writes the log to a terminal. - **Highlighting setting.** `REXCITY_ACP_HIGHLIGHT` in the agent's env (like `REXCITY_PANE`): `1`, `true`, `yes` or `on` turns it on; **off by default**. The wrapper passes `--highlight` to `rexcity acp follow`, which also takes it by hand. Shell for a `Bash` call, JSON for any other input. - **Colour is applied by `follow`, not written to the log.** The log stays plain text for cat, grep and tail, and a pane can be switched without touching a log that is appended to. The follower works on whole lines and holds back only a partial line that may still be a body line, so streamed text shows as it arrives. (The dim of thinking and of stderr was in the log already and stays.) - Unchanged: gc's prompts, thinking dimmed, permissions and answers, the header per start, stderr. ## Before and after, one recorded turn `testdata/tools.stream`, built to the shape claudeacp v0.5.0 emits (rawInput as an empty object at the call's start, then whole; the Bash title is the command). The two recorded streams are in the golden test too, with their goldens updated. The after log uses the test's fixed clock, so every time is the same. Before (cut at 110 columns, as the pane cuts it): ``` The tools first, then the changelog. I will run the three test scripts, then add the changelog note. ✓ Bash: for t in worktree-setup worktree gnu-tools; do printf '%s: ' $t bash tests/$t.sh 2>&1 | tail -1 do ✓ Edit CHANGELOG.md ✗ Read /work/nope.txt — File does not exist. ✓ Write notes.txt ✓ Bash: cat <<'EOF' > list.txt item 1 item 2 item 3 item 4 item 5 item 6 item 7 item 8 item 9 item 10 item 11 ☰ plan [x] Run the scripts [x] Note the change Both done. … Bash: sleep 600 (no final status) ``` After (`tools.golden`, the first 25 lines): ``` 17:42:05 The tools first, then the changelog. 17:42:05 I will run the three test scripts, then add the changelog note. 17:42:05 ✓ Bash for t in worktree-setup worktree gnu-tools; do printf '%s: ' $t bash tests/$t.sh 2>&1 | tail -1 done git add -A && git commit -q -m "docs: ..." 17:42:05 ✓ Edit { "file_path": "CHANGELOG.md", "old_string": "## [Unreleased]\n", "new_string": "## [Unreleased]\n\n### Changed\n\n- The acp view shows a tool call's input as it was sent.\ } 17:42:05 ✗ Read — File does not exist. { "file_path": "/work/nope.txt" } 17:42:05 ✓ Write { "file_path": "notes.txt", "content": "line 1 of the file\nline 2 of the file\nline 3 of the file\nline 4 of the file\nline 5 of the } 17:42:05 ✓ Bash ``` ## Verification - `go vet` and `go test` over cmd, internal and packs pass, with a stub `rex` first on PATH (the whole of packs too); `go test -race` over internal/acpbox passes; the v1 changelog check is valid. - New: renderer cases for shell and JSON inputs, key order and escapes, non-object inputs, the last input of a call, failed and unfinished calls, the bound, control characters, one stamp per run of text, the seen time, a message's own time; highlighter cases for JSON, shell, non-bodies, split writes, partial lines and a dead pane; `follow --highlight`; the env setting reaching the pane's argv. - Not run against a live claudeacp or Rex, per the bead. Bead: rexcity-n2ass
feat(acpbox): the acp log shows a tool call's input as sent, and stamps every entry (rexcity-n2ass)
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 10s
test / go (pull_request) Successful in 2m3s
5edbbe1d05
The pane of an acp agent follows the log rexcity acp renders, and it joined a
tool call's multi-line input into one line cut at the pane's width: a heredoc,
a loop or a Python script read as a run-on line, and only gc's prompts carried
a time. The user asked for the input as it was sent, optional syntax
highlighting, and a time on every entry.

The renderer now keeps the last rawInput the adapter sends for a call. A shell
command is written under the head line with its line breaks and indentation,
any other input as the JSON the adapter sent (json.Indent keeps key order and
escapes; the escapes Go's encoder writes for <, > and & are shown as the characters). The head
line is "HH:MM:SS ✓ Bash": the name and the final status, no longer the title,
which said the command again. An input is cut at 30 lines of 240 characters,
and the cut is marked. Control characters of an input are shown as their
pictures, since a pane writes the log to a terminal. A call with no input is
one line as before. A call is written once, at its final status; one that has
none by the end of its turn or run is written with its input as "no final
status", as before.

Every entry begins with its time: the time the box saw the message (taken when
the line is queued, not when the renderer gets to it), or the time the message
carries in a _meta timestamp, which claudeacp does not send. A run of agent
text is one entry and is stamped once.

Highlighting is applied by rexcity acp follow --highlight, not written to the
log, so the log stays plain text for cat, grep and tail. The wrapper passes
the flag when the agent's env sets REXCITY_ACP_HIGHLIGHT to 1, true, yes or
on; the default is off. The highlighter works on whole lines and holds back
only a partial line that may still be a body line, so streamed text shows as
it arrives.

Validation: go vet and go test over cmd, internal and packs, with a stub rex
first on PATH; go test -race over internal/acpbox; the v1 changelog check. A
new recorded-shape stream (testdata/tools.stream, built to the shape of what
claudeacp v0.5.0 emits) joins the two recorded ones in the golden test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Contributor

Reviewed at 5edbbe1d05 against main 7776036 (Release 0.31.0).

What was checked:

  • Passthrough: the diff touches no relay path. Lines are still forwarded byte for byte, session/new is not rewritten, no permission is answered, stderr, exit status and signals are as before. The only change on the relay goroutines is that push reads the clock (cfg.Now, defaulting to time.Now) before it queues; rendering stays on the renderer goroutine behind the capped queue. The box tests (passthrough both ways, held-up renderer, hanging pane) pass.
  • Robustness, in a scratch test that was not committed: a 10 MB Write input, a command with 100000 line breaks, invalid UTF-8, ESC/BEL in a command, a non-object rawInput (number, nested array, string), a bad _meta.timestamp, and params of null or 7. None panicked; the output stayed bounded (500 bytes, 0.12 s); control characters showed as their pictures.
  • Memory: a call that has not finished holds one copy of the last whole rawInput it sent, replaced on each update, never added to, and freed when the call ends or at the turn's end or the run's end. The adapter's own line, which ReadBytes already reads whole, bounds it. The 30-line, 240-character bound applies when the call is written.
  • Before and after of testdata/tools.stream: the main renderer joins the Bash loop into one line. The new one writes HH:MM:SS ✓ Bash with the loop under it, keeps the Edit JSON indented, and ends the heredoc with … 12 more lines. This matches the bead's example.
  • follow: when highlighting is off it writes the log's bytes unchanged. With highlighting on, ANSI-stripped output equalled the input over 300 random write splits, including partial and held-back lines and Flush at the end. --highlight reaches the pane's argv only when REXCITY_ACP_HIGHLIGHT is set.
  • Tests: the new render tests do not build on main (they need seen, maxInputLines and inputIndent), and the goldens differ. go vet ./..., GOOS=darwin GOARCH=arm64 go vet ./..., go test ./... and go test -race ./internal/acpbox pass on the merge result. The changelog check, built from mikluko/changelog v1 (1.6.0), reports valid. CI is green. README and CHANGELOG describe the code accurately. The next release would be 0.32.0 (Added).

Minor, not blocking: an empty line inside a command is written as two trailing spaces. The highlighter keeps a whole log line in memory even after it has written that line, which matters only for a very long run of agent text without a line break.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

Reviewed at 5edbbe1d05b584d5210ee625c7efe2ab71b8aadb against main 7776036 (Release 0.31.0). What was checked: - Passthrough: the diff touches no relay path. Lines are still forwarded byte for byte, `session/new` is not rewritten, no permission is answered, stderr, exit status and signals are as before. The only change on the relay goroutines is that `push` reads the clock (`cfg.Now`, defaulting to `time.Now`) before it queues; rendering stays on the renderer goroutine behind the capped queue. The box tests (passthrough both ways, held-up renderer, hanging pane) pass. - Robustness, in a scratch test that was not committed: a 10 MB Write input, a command with 100000 line breaks, invalid UTF-8, ESC/BEL in a command, a non-object `rawInput` (number, nested array, string), a bad `_meta.timestamp`, and `params` of null or 7. None panicked; the output stayed bounded (500 bytes, 0.12 s); control characters showed as their pictures. - Memory: a call that has not finished holds one copy of the last whole `rawInput` it sent, replaced on each update, never added to, and freed when the call ends or at the turn's end or the run's end. The adapter's own line, which `ReadBytes` already reads whole, bounds it. The 30-line, 240-character bound applies when the call is written. - Before and after of `testdata/tools.stream`: the main renderer joins the Bash loop into one line. The new one writes `HH:MM:SS ✓ Bash` with the loop under it, keeps the Edit JSON indented, and ends the heredoc with `… 12 more lines`. This matches the bead's example. - follow: when highlighting is off it writes the log's bytes unchanged. With highlighting on, ANSI-stripped output equalled the input over 300 random write splits, including partial and held-back lines and Flush at the end. `--highlight` reaches the pane's argv only when `REXCITY_ACP_HIGHLIGHT` is set. - Tests: the new render tests do not build on main (they need `seen`, `maxInputLines` and `inputIndent`), and the goldens differ. `go vet ./...`, `GOOS=darwin GOARCH=arm64 go vet ./...`, `go test ./...` and `go test -race ./internal/acpbox` pass on the merge result. The changelog check, built from mikluko/changelog `v1` (1.6.0), reports valid. CI is green. README and CHANGELOG describe the code accurately. The next release would be 0.32.0 (Added). Minor, not blocking: an empty line inside a command is written as two trailing spaces. The highlighter keeps a whole log line in memory even after it has written that line, which matters only for a very long run of agent text without a line break. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/rexcity!73
No description provided.