The TUI should show enough detail for each live tool call for the user to
understand what is about to run, what is running, and what just finished. A tool
line that only says Tool Bash running or Tool Read completed is not enough
for NL-to-code work because the user cannot audit commands, file paths, search
patterns, URLs, or subagent tasks without scrolling into hidden debug state.
SessionEvent only. It must not call tool handlers, read files,
execute commands, or inspect tool internals.tool_call_scheduled.payload.input. The TUI may
cache a summarized projection by toolCallId so later started, result, and
error events can render the same detail block even when those events do not
repeat the input.tool_call_result.payload.result.display.kind is file_diff, the live TUI may
render a bounded diff preview after the cached input detail block; when the same
session is resumed, the TUI reads part.state.metadata.display from persisted
message + part data and renders the same preview.Every visible tool call transcript line may include a concise title plus a small indented detail block directly below it:
Tool Bash running
command: npm test
cwd: packages/tui
The tool transcript part itself must not add a global left gutter. The title starts at the same content column as adjacent assistant text; only nested details, legacy output, and result display rows use their local semantic indentation.
The block should be stable across pending, running, completed, and
failed lines for the same toolCallId. If no input detail is available, the
TUI falls back to the current tool-name-only line.
Tool events should update one visible transcript part per toolCallId instead
of appending separate pending/running/completed rows. This follows a
message-part model while keeping ZCode's SessionEvent as the only input:
tool_call_scheduled creates or updates a tool part and stores bounded input
details.tool_call_started and tool_call_progress move the same part to running.tool_call_result moves the same part to completed and attaches any bounded
display payload.tool_call_error moves the same part to failed and shows a redacted,
user-facing error summary.message + part
data. Completed tool parts with state.metadata.display.kind = file_diff
attach that payload to the restored TUI tool part. Completed legacy parts
without display metadata continue to show state.output.Errors render directly under the tool title using the TUI error color/style.
The line should contain the human error description itself, not an extra
error: label, because the color and placement already express the type.
Known tools should prefer human audit fields and, where useful, replace the generic lifecycle title with a stable action title:
Bash: command, cwd, timeout, and background mode. If argv exists,
show the executable and arguments as a secondary line.Read: title is Read <path>, where <path> is workspace-relative when the
requested file is inside the current workspace and remains an absolute path
when it is outside the workspace. Do not prefix the title with Tool or append
lifecycle status text. Include offset, limit, or pages as detail lines
when present.Write: file_path; include offset, limit, pages, or replace_all
when present.Edit: title is Edit <path>, where <path> is workspace-relative when the
requested file is inside the current workspace and remains an absolute path
when it is outside the workspace. Do not repeat file_path or replace_all
as default detail lines because the path is already in the title and the diff
is the audit surface.Grep: pattern, path, glob, output_mode, type, and limits.Glob: pattern and path.WebFetch: url and a prompt preview.TodoWrite: todo count and current in-progress item when present.Agent: description, subagent_type, and background mode.Skill: skill name.tool_call_result may append result display lines after the stable input detail
block. The first supported payload is file_diff: render the bounded patch with
OpenTUI diff renderable so code syntax highlighting, line-number gutters,
+/- markers, and red/green full-line backgrounds stay consistent with the
rest of the TUI. Do not render a separate diff: <path> (+n -n) title or raw
@@ ... @@ hunk headers in the compact transcript. On narrow terminals the
preview uses a unified layout with a single line-number column; on wide
terminals it uses a split layout with old and new columns. Fallback plain-text
lines stay bounded and must show a short truncation marker rather than dumping
the full patch.
content,
old_string, new_string, prompt, and nested arrays should be summarized
or previewed with strict width and line limits.token, secret, password, api_key,
and environment variable values. For Bash.env, show names being set or unset,
not values.ZCODE_ environment variables.Malformed input or an unsupported schema must not break rendering. The TUI should skip invalid fields and fall back to a bounded generic preview. If the preview cannot be produced safely, omit the block.
If result/error events arrive without a prior scheduled event, the TUI should
append a minimal fallback tool part using the cached tool name or tool. Missing
input details are acceptable; missing transcript rendering is not.
Bash detail blocks including command and cwd.Read titles including workspace-relative and
workspace-external file paths, plus range detail lines.Edit titles including workspace-relative and
workspace-external file paths, plus omission of duplicated input and hunk
metadata rows.file_diff result display payloads, including path,
fallback hunk lines, renderer props, and red/green background colors.file_diff metadata and old completed tool parts
that only have output.