Read terminal text
terminal_readRead a window of a terminal session's buffer, including scrollback and visible screen, to inspect recent or earlier output page by page.
Instructions
Read a window of the terminal buffer. The buffer is the full xterm-emulated state (scrollback + visible viewport) in one contiguous index space. The window is paged from the bottom upward in multiples of rows. rows defaults to the current screen height and is capped at 1000. page: 0 is the most recent screen-sized chunk; page: 1 is the screen before that, and so on. Trailing blank rows are trimmed implicitly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | 0 = newest screen-sized window. N = scroll up N pages (each page = `rows` lines). Past-top clamps. | |
| rows | No | Window height. Default = current screen height. Max 1000. | |
| cursor | No | When true (default), mark the cursor inline with "▌". On an empty cell it takes the place of the blank; on a character it is inserted in front of that character, which shifts the rest of that one line right by a column. Nothing is overwritten. Skipped automatically while the program has the cursor hidden. Set to false if you need the unmodified text. | |
| sessionId | Yes | Numeric id of the session to target. Get one by calling terminal_create. Use terminal_list to enumerate currently-known ids. | |
| highlights | No | When true (default), list text on the current screen that is drawn in reverse video or on a background color — how TUIs show the selected menu entry, tab or button — with its screen row and columns. Plain text cannot show this otherwise. | |
| joinWrapped | No | When true (default), rows the terminal soft-wrapped at its right edge are joined back into the single long line the program printed. Set to false to get one line per screen row. |