@cateds/opencode-pty
v0.4.1
Published
OpenCode plugin for interactive PTY management - run background processes, send input, read output with regex filtering
Maintainers
Readme
OpenCode PTY
Interactive PTY management plugin for OpenCode. Run background processes, send input, read output with regex filtering.
This is a fork of opencode-pty by shekohex, rewritten for Node.js compatibility.
Usage
OpenCode Plugin
Add to your opencode.json:
{
"plugin": ["@cateds/opencode-pty"]
}Tools
The plugin provides 7 tools:
| Tool | Description |
| ----------- | ------------------------------------------------------- |
| pty_spawn | Run a shell command as a background task |
| pty_read | Read output with pagination and regex filtering |
| pty_write | Send input to an active task |
| pty_list | List all background tasks |
| pty_kill | Stop a task |
| pty_status| Check if a task is still running |
| pty_await | Wait for a task to finish (blocking) |
Slash Command
/pty-manage-pageOpens the PTY Sessions Web Interface in your browser for real-time monitoring.
How it works
The plugin uses runtime-conditional imports to support both Bun and Node.js:
| Runtime | PTY Library | Environment |
| ------- | ------------------ | ---------------- |
| Bun | bun-pty | CLI/TUI |
| Node.js | @lydell/node-pty | Desktop/Electron |
The web interface is built with React and xterm.js, providing real-time terminal monitoring via WebSocket.
Requirements
- OpenCode >= 1.3.13
- Node.js >= 22.0.0 (for Desktop) or Bun (for CLI/TUI)
License
MIT
