How to send interactive input to a running session
mainInput can be sent to a running PTY session through two primary paths:
Via Web UI (Human Input)
When a user types or pastes text into the xterm.js terminal in the browser:
- The UI sends a JSON message:
{type: "input", sessionId, data: "<input_text>\n"}. - The WebSocket server calls
manager.write(sessionId, data). - The Manager writes the data to the
bun-ptyprocess.
Via AI Agent (Automated Input)
The AI Agent can programmatically send input (e.g., sending Ctrl+C via \x03):
- The Agent calls
pty_write(id, data)via the plugin. - The Plugin calls
manager.write(id, data). - The Manager writes the data to the process.