wait
Block until a running session command produces new output, then return only the unseen lines. Poll repeatedly to stream fresh results and the exit status.
Instructions
Keep waiting for what is running in the session -- what your last call
left running (a run that timed out, settled, or returned at until),
or else a command a human or another agent started -- and return its
region: only the lines not shown before. The interactive form of
sleep 30; tail log: call it as often as needed, with timeout_s up to
the client's patience; each reply is new output only, and the command's
exit status when it ends. Commands of others that finished since your
last call are reported at once (regions lists the session without
waiting). When a human's (or another agent's) unsubmitted text holds
the prompt, waits for it to be erased or submitted, and says which.
After a run into a program (gdb, python), waits for the program's
prompt; after a shell command, for it to finish. show filters the
lines as for run; until returns at a pattern, last_lines and
save_to work as for run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| show | No | regex: reply with only the output lines matching it, in order, plus the last few (like `| grep`, but the command runs unfiltered and the log keeps everything), e.g. "error:|warning:|^FAIL" for a build -- or a program's answer: gdb's `step` under `set debug infrun 1` | |
| until | No | regex: return as soon as output not shown to you before matches it, the command still running (as for `run`); one that never matches is a plain wait | |
| save_to | No | a file to copy the command's output into, as `> FILE 2>&1` would, while the command itself runs unredirected (the reply and the log are as usual): written at once, kept up to date while it runs, written in full when it ends. A relative path is in the session's current directory; the file is on the machine this server runs on, even for a session over ssh. For a later diff or grep by other tools; `read` and `search` need no file | |
| session | Yes | the session's name (from session_create or session_list) | |
| max_lines | No | lines of output shown in the reply; longer output is clipped in the middle, led by its summary lines (test results, compiler errors, make's failure) when the middle holds them; all of it stays readable with `read`/`search` | |
| timeout_s | No | seconds to keep waiting (the command keeps running after; `wait` again); at most 1500 | |
| last_lines | No | reply with only the last N lines of the output (like `| tail -N`, but the command runs unfiltered and the log keeps everything; the reply says where the rest is); with `show`, how many last lines follow the matches (default 3) | |
| show_after | No | with `show`: also this many lines after each match (like `grep -A N`); a match is numbered "N:", a line after one "N-" |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |