Knows when a program asks for a password
On Linux and macOS, InputMode shows when sudo or ssh turns off echo
for a password. An agent or a test script can stop there, ask a person, and keep the password out of its
logs.
MiniPty lets a .NET app run a shell or a CLI tool in a PTY, a terminal without a window. The app types keys and reads the screen, as a person does. Each scene replays a recorded session and shows each call to MiniPty.
To record on this machine, run dotnet playground/Record.cs. Then run
dotnet playground/Serve.cs to serve the site.
Blue names are MiniPty. terminal is your
UI, not part of MiniPty. Code that runs: README_MiniPty.cs
starts, writes, resizes, and reads. WebTerminal.cs
is a browser terminal.
Measured in CI with 1,000 idle shells on the Linux runner and .NET 10, host process only. On Windows the host adds 10.3 MiB. The keystroke figure comes from the CI latency benchmark. How it was measured
On Linux and macOS, InputMode shows when sudo or ssh turns off echo
for a password. An agent or a test script can stop there, ask a person, and keep the password out of its
logs.
CompleteAsync returns the output and the exit code. MiniPty.Capture also gives
the time of each chunk. MaxOutputBytes ends a command that prints too much.
PtyWebSocketBridge.RunAsync connects a shell to xterm.js in one call. When the shells run in a
PTY host of their own, a web server restart does not end them. The page reconnects and gets the output it
missed.
A session that waits for output holds no thread. Reads, writes, and waits allocate nothing after the first call. So a web server or an agent host can keep thousands of shells open.
Start a shell or a CLI in a real PTY, type into it, and read its screen. MiniPty runs on .NET 10 on Windows, Linux, and macOS, and works with NativeAOT.
dotnet add package MiniPty
Samples show a browser terminal with xterm.js, a VS Code terminal, and a desktop terminal window. Other samples run commands and drive programs, as an AI agent does.
scenetake runs a YAML scenario and records it as an
asciinema .cast, an animated SVG, or an MP4. Its pty: true steps run through
MiniPty. It also comes as a .NET tool and as a binary.
npm install -g scenetake