Resource
terminal
A live terminal owned by the client. Construct with
[terminal.constructor] to start a command; consume output()
as a stream of raw bytes; await wait-for-exit() for the exit
status. Drop the resource to kill and release.
resource terminal;F constructor
constructor: func(req: create-terminal-request) -> terminal;Start a command in a fresh terminal. The terminal begins
running immediately; output() and wait-for-exit() may
be called any time after construction.
See: https://agentclientprotocol.com/protocol/terminals#executing-commands
F output
output: async func() -> stream<u8>;Raw byte stream of the terminal's combined output (stdout + stderr in interleaved order). The stream ends when the process exits and any remaining bytes have been flushed.
F wait-for-exit
wait-for-exit: async func() -> result<terminal-exit-status, error>;Resolves once the command has exited. Calling this after drop traps; capture the future before dropping if you need the post-mortem.