opencode-terminal-guard
v0.1.1
Published
OpenCode TUI compatibility guard that prevents queued mouse reports from leaking into the shell during renderer shutdown.
Maintainers
Readme
opencode-terminal-guard
Temporary OpenCode TUI compatibility plugin for an upstream OpenTUI shutdown-order bug.
OpenTUI currently restores stdin from raw mode before it disables all-event mouse tracking. Mouse reports received in that window can remain queued and appear in the next shell command as text such as 35;56;53M.
The guard wraps the live renderer's normal destroy() path. It disables mouse tracking while raw mode is still active, pauses and drains queued input, then delegates to the original shutdown routine.
Install
opencode plugin opencode-terminal-guard --globalOr add it to the global tui.json:
{
"plugin": ["opencode-terminal-guard"]
}Restart OpenCode after installation.
Limits
This protects normal renderer destruction after TUI plugins load. No in-process cleanup can handle SIGKILL, and very early startup failures can happen before the guard activates.
Remove this plugin after OpenTUI ships and OpenCode bundles an upstream fix for OpenTUI #904 / PR #905.
Development
bun install --frozen-lockfile
bun test
bun run build
npm pack --dry-run --json --ignore-scripts