About this project

opencode-pty is a plugin for OpenCode that provides interactive pseudo-terminal (PTY) management. It allows the AI agent to run background processes, send interactive input, and read output on demand, overcoming the limitations of OpenCode's built-in synchronous bash tool. Key features include: - Background execution of long-running processes (dev servers, watch modes, interactive programs) - Multiple simultaneous PTY sessions - Interactive input with escape sequences (e.g., Ctrl+C) - Output buffering with pagination and regex filtering - Exit notifications to eliminate polling - Respects OpenCode's bash permission settings - Session lifecycle management with auto-cleanup - A React-based web UI with real-time streaming via WebSocket - REST API for session management Setup is simple: add "opencode-pty" to your OpenCode config. For V2, use "opencode-pty/v2" with optional options like port and hostname. The plugin provides tools: pty_spawn, pty_write, pty_read, pty_list, pty_kill, and slash commands to open the web UI. The web UI offers session list, live output, input sending, and session management. Configuration includes environment variables for buffer size and web server settings. Permissions are checked against OpenCode's bash permission config, with limitations on "ask" permissions. The README includes usage examples, session lifecycle diagrams, and development instructions.