Documentation
README
Persistent PTY sessions
PTY sessions are how you talk to interactive programs — programs that detect a terminal (isatty()) and behave differently when they don't see one. Use a session when:
- You need state to persist across calls (
cd, env vars, sourced scripts) - You're driving a REPL (
python -i,mysql,psql,node,irb) - A program demands an interactive prompt (
sudo,ssh,npm login,gh auth login)
For everything else, terminal_exec is simpler. Sessions cost more (per-session bash process, ring buffer, idle-reaping bookkeeping) and have a hard cap (TERMINAL_TOOLS_MAX_PTY, default 8).
Why PTY (and not subprocess pipes)
This is the opening of the README. Read the full README on GitHub.