tui-use
v1.1.0Drive interactive terminal programs (vim, git rebase -i, ssh, REPLs, htop) from an agent.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
tui_start
Start an interactive program (vim, git rebase -i, npm init, ssh, python, psql, htop, an installer...) in a real terminal and return its screen. Use this instead of the shell tool whenever a command prompts for input, opens an editor or pager, or draws a full-screen UI. The session stays open across calls; drive it with tui_send.
| Parameter | Type | Description |
|---|---|---|
command * | string | Command line, run through your shell. |
cols | integer | Terminal width, default 120. |
cwd | string | Working directory. Defaults to the server's cwd. |
env | object | Extra environment variables. |
name | string | Optional name to refer to the session by. |
rows | integer | Terminal height, default 40. |
wait | object | When to return. Conditions are OR-ed. Without one, the tool waits until the screen stops changing (300 ms quiet), which is fine for most steps; use text/regex/gone for slow programs. |
tui_send
Type into a session, wait for it to respond, and return the new screen (as a diff by default). The screen shows row numbers, the cursor as [x], and highlighted items as «…». text is typed first, then secret_env, then keys. Use input for interleaving, e.g. save and quit vim: input=[{key:'esc'},{text:':wq'},{key:'enter'}]. Edits that depend on where the cursor lands can go wrong when batched; prefer commands that do not (e.g. vim :2,3s/^pick/squash/) or check the screen between steps. Key names: enter, tab, esc, backspace, delete, up, down, left, right, home, end, pageup, pagedown, space, f1…
| Parameter | Type | Description |
|---|---|---|
session * | string | Session id (s1) or the name given to tui_start. |
input | array | Ordered mix of text, keys, secrets and mouse events. When given, text/keys/secret_env are ignored. A mouse event clicks or scrolls at a screen row and column as numbered in the snapshot, e.g. {mouse:{… |
keys | array | Keys pressed after text, in order. |
mode | string | Default diff. |
paste | boolean | Send text as a bracketed paste: use for multi-line input into editors and REPLs. |
secret_env | string | Name of an environment variable of the tui-use server whose value is typed (e.g. a password). The value never appears in responses or recordings. |
text | string | Text typed literally. \n is sent as Enter. |
wait | object | When to return. Conditions are OR-ed. Without one, the tool waits until the screen stops changing (300 ms quiet), which is fine for most steps; use text/regex/gone for slow programs. |
tui_snapshot
Return the current screen of a session without sending input. Use image: true to also get a PNG of the screen with its colours, for when layout or colour matters more than text.
| Parameter | Type | Description |
|---|---|---|
session * | string | Session id (s1) or the name given to tui_start. |
image | boolean | Also return a PNG screenshot of the screen. |
mode | string | Default full. |
styles | string | marks (default) wraps highlighted text such as the selected menu item in «…». |
tui_wait
Wait without sending input, for slow work like builds, installs and downloads, then return the screen. Prefer text/regex/gone conditions with a generous timeout_ms.
| Parameter | Type | Description |
|---|---|---|
session * | string | Session id (s1) or the name given to tui_start. |
wait * | object | When to return. Conditions are OR-ed. Without one, the tool waits until the screen stops changing (300 ms quiet), which is fine for most steps; use text/regex/gone for slow programs. |
mode | string | Default diff. |
tui_scrollback
Read output that scrolled off the screen. Pass lines=[from, to] (1-based, negative counts from the end, e.g. [-50, -1]) or search='text' for matching lines with 2 lines of context. Defaults to the last 40 lines.
| Parameter | Type | Description |
|---|---|---|
session * | string | Session id (s1) or the name given to tui_start. |
lines | array | |
search | string |
tui_manage
Session housekeeping. action=list shows all sessions; kill ends one (signal defaults to SIGTERM, then SIGKILL after 2 s); resize changes its size; recording returns the path of its asciinema recording.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
cols | integer | For resize. |
rows | integer | For resize. |
session | string | Required for kill, resize and recording. |
signal | string | For kill, e.g. SIGINT or SIGKILL. |