OpenProgram Docs

TUI transcript rendering

Each tool reads as a header and a quantified line, output folds with an accurate count, one key expands everything, edits show a numbered diff, messages typed during a turn wait visibly above the input, images and PDFs attach by path or paste, and every key comes from one table the person can override. Mid-run questions: user input requests.

Transcript

● read(/src/app.py)
  ⎿ Read 52 lines
● edit(/src/app.py)
  ⎿ Added 2 lines, removed 1 line
    12   keep
    13 - old
    13 + new
    14 + added
● bash(pytest -q)
  ⎿ ....F
    1 failed, 4 passed
    … +38 lines (ctrl+o to expand)
● agent(Survey the parser)
  ⎿ Done (2m 10s)
● task_step(next)
  ⎿ Ship the parser 1/3
    ☒ Read code
    ◼ Write tests
    ☐ Ship
ToolWhat it shows
Every toolStatus glyph in the theme's tool colours (◌ running, ● done, ✗ error), bold name, the argument it acted on in parentheses, the body under a ⎿ gutter. Other providers' names (Bash, MultiEdit, TodoWrite, Task) map onto the same renderers
bashOutput folded to 3 lines, then … +N lines (ctrl+o to expand); N comes from the server's whole-output count when the frame is a preview. One hidden line is shown instead of a note about it
read, grep, glob, listOne line: Read 52 lines, Found 8 files, Found 3 matches, No matches; the content only when expanded
edit, apply_patch, writeAdded X lines, removed Y lines and a diff: green additions, red removals, three lines of context, folded runs as ⋮, up to 12 rows before folding. Line numbers come from reading the edited file once when the result arrives; a file not on this machine shows no numbers rather than wrong ones
agentRunning…, then Done (2m 10s) and the head of its reply; a background agent reads Started in the background
task_start, task_stepThe task from the todos_update frame on the newest task call: its title with the steps done out of those counted, then ☒ done or dropped and struck through, ◼ in progress and bold, ☐ pending. No nesting: text and other calls stay flat.
ExpandCtrl+O expands or folds tool output for the whole transcript; the fold note names the active key
MatchingA result finds its call by tool_call_id, so two concurrent calls of one tool finish in the right row; frames without an id fall back to the newest running call of that name
Why this design
TopicReason
Per-tool summariesClaude Code quantifies (Read N lines, Found N files, an edit's counts and diff); Codex prints raw output under └; opencode splits one-line tools (read, search) from block tools (bash, edit, task, todo). Summaries follow Claude Code, since a read's content is noise once the model has it; the split follows opencode, so a mixed run reads two lines per tool
Fold at three, count the restClaude Code folds at 3 with +N lines; Codex keeps head and tail; Pi shows the tail of bash. A head with an accurate total says how much is hidden; the total comes from the server's preview metadata, because a preview counted on its own understates long output
One global expandClaude Code opens Ctrl+O as a separate frozen screen; Pi toggles app.tools.expand in place. The toggle keeps the transcript scrollable and needs no second screen or exit key, and the cell-grid renderer redraws the whole frame anyway
Diff from the edit's own argumentsClaude Code builds its patch from old_string / new_string; Codex from the patch it applied. The TUI has both from the call, so no server change is needed; line numbers come from the file because the arguments lack them, and are left out when the file is elsewhere (an SSH conversation)
Steps from the saved taskClaude Code draws TodoWrite's checklist from its arguments; a task_step call carries no list, so the steps come from the todos_update frame the tools already broadcast, and a TodoWrite-style call is drawn from its arguments

Messages typed during a turn

  ↳ also update the changelog
› and run the linter +2 lines
╭──────────────────────────────────────────────╮
│ >  waiting for response    enter edit · x remove │
╰──────────────────────────────────────────────╯
StepBehaviour
QueueWhile a turn runs the input keeps taking text; Enter adds the message, with its attachments, to the queue shown dim above the input, one ↳ row each
Select↑ on an empty input selects the newest row; ↑ / ↓ move, Esc returns to the input, any other key types again
Edit, removeEnter or e takes the row back into the input (attachments included); Enter queues it again at the end. x, Delete or Backspace removes it
SendWhen the branch is free again — finished, failed or stopped — the oldest row is sent as the next turn, then the next. Esc still stops the turn
Why this design
TopicReason
Visible rows over a hidden bufferCodex shows queued messages as dim ↳ rows and pops the last one back with a key; Claude Code pulls all of them into the input with ↑; Pi restores them with Alt+↑; opencode shows a count. Grok Build's queue pane lets ↑ select any row to edit or remove it. The rows and the selection follow Grok Build because the web composer's queued bubbles are individually editable and removable too, so both surfaces work the same way
Sent after a stopClaude Code sends the queue after a stop; Codex and Pi put it back into the input because their queues cannot be edited. Ours can be edited before and after the stop, so it is sent, matching the web composer
One message per turnClaude Code merges queued prompts into one; each row here becomes its own turn, so a removed or edited row never changes another, and each branch keeps one foreground operation
Queued on the clientA branch runs one foreground operation, so the server refuses a second send; holding the message in the TUI until the branch is free needs no server change

Images and PDFs

Way inWhat happens
Paste or drag a pathA paste whose every token is an existing image (png, jpg, gif, webp) or PDF — quoted, \ -escaped, file:// or ~ forms included — inserts [Image #1] / [PDF #2] instead of the text; anything else stays text
Clipboard imageCtrl+V (Alt+V on Windows), or an empty paste, reads an image from the clipboard: osascript on macOS, wl-paste or xclip on Linux, PowerShell on Windows
@pathA sent @path to an image or PDF attaches it the same way
SendEach placeholder still in the text becomes the web composer's [attachment: name (ext, N KB) @json "path"] marker; a deleted placeholder drops its file. An image goes as bytes with its source path; a PDF goes as its path for the pdf tool. Images over 5 MB and files over 32 MB are refused with a line saying why
Why this design
TopicReason
Placeholders in the textClaude Code and Codex both show [Image #N] where the image goes and drop an image whose placeholder is deleted; a terminal has no chip row, so the text is the only place to show and remove an attachment
Path detection on pasteTerminals deliver a dragged file as its path. Claude Code and Codex turn such a paste into an attachment; requiring every token to be an existing attachable file keeps a pasted sentence that mentions a path as text
The web composer's markersThe server already stores, rewrites and renders that marker for Electron uploads with a source path, so the TUI needs no new protocol and the message shows the same in the web chat
No resizingThe web composer resizes large images in a canvas; the TUI has no image library, so it refuses past the model's 5 MB limit instead of sending a request that fails

Keybindings

// ~/.openprogram/keybindings.json (the profile's state folder)
{
  "app.toolsExpand": "ctrl+t",
  "app.commandPalette": "none",
  "queue.remove": ["d", "delete"]
}
PartDesign
Action tableEvery rebindable key is an action declared once with its context (global, input, queue), default keys and description; handlers ask whether an action matches instead of testing raw keys
OverridesA flat action → key | [keys] | "none" object in keybindings.json in the state folder. A key the person binds is taken from default actions in an overlapping context
ProblemsAn unknown action, an unreadable key, a reserved action or key (Ctrl+C) and two of the person's own bindings on one key each become one line in the transcript at start; the rest of the file still applies and bad JSON leaves the defaults
? help? on an empty input (and /keybindings) opens the shortcut list built from the same table with the keys now in force; the hints on the input and the fold note use the active keys too
Why this design
TopicReason
Flat action mapPi's keybindings.json and opencode's keybinds map action to keys; Claude Code nests key-to-action blocks per context; Codex nests context and action in config.toml; Grok Build cannot remap. The flat map is the shortest file to write, and contexts stay in the table where the person does not have to name them
Warnings, not errorsCodex refuses to start on a conflicting keymap; Claude Code and Pi warn and continue. A typo in a key file should not keep the person out of the TUI
Reserved Ctrl+CClaude Code reserves Ctrl+C and Ctrl+D because their stop and double-press exit are time-based; Ctrl+C here carries the same stop and exit, so it stays fixed
Help from the tableA hand-written list drifted from the handlers; generating it from the table that the handlers read keeps them equal, which is what Claude Code's and Codex's shortcut overlays do

Commands and interaction

ElementDesign
Command registryEach command declared once (name, title, category, keybind, slash-name, enabled); drives Ctrl+K, slash commands and footer hints, so registry and handlers cannot drift
PromptsQuestions and approvals occupy the input slot instead of a modal; the transcript stays scrollable and esc keeps one meaning
DangerDestructive picker actions confirm in the row: press again, the row turns red. No nested confirm layer
PickersMove from the pickerKind enum to the ModalProvider and Form kit, one at a time
SpinnerOne composite line, progressive width gating
Markdownmarked-terminal, memoized by streaming state, text and width per text segment; the cell-grid renderer redraws every frame

The vendored hermes-ink renderer stays: it has mouse tracking and ScrollBox, so OpenTUI buys nothing.

Implementation status

AreaItemState
Basehermes-ink, four themes, BottomBar, Ctrl+K, autosuggest, @file, per-session drafts, account and channel flows, Markdown memoization, mid-run decisions in the input slotBuilt
TranscriptPer-tool rendering, 3-line fold with accurate count, Ctrl+O expand, diff for edit / apply_patch / write, sub-agent and todo views, results matched by tool_call_idBuilt
InputQueued messages (shown, selectable, editable, removable, sent after the turn), image and PDF attachments by path, paste, clipboard and @pathBuilt
KeysAction table, keybindings.json overrides with warnings, ? help from the tableBuilt
Not builtTool blocks in the load_session reply (a resumed conversation shows text only); /diff through the diff view; a sub-agent's call and token counts in its Done line (the stream does not carry them); image resizing; the composite spinner line, registry unification, in-row danger and the picker migrationNot built
Last updated · 2026-11-25