opencode
opencode copied to clipboard
[FEATURE]: Proposal: TUI Input Changed Hook
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
1. Problem Statement
What problem are we solving?
OpenCode plugins currently have no visibility into what users type in the TUI prompt. Plugins can react to messages after submission, but cannot observe or respond to input as it happens. This limits plugin capabilities for features like:
- Real-time input suggestions
- Command detection and auto-completion
- Input validation before submission
- Context-aware UI hints
Who is affected?
Plugin developers who want to build interactive, responsive plugin experiences. End users who could benefit from smarter input handling.
2. Proposed Solution
Add a new tui.input.changed plugin hook that fires whenever the user types in the TUI prompt. The hook receives the current input text and session ID, enabling plugins to observe typing in real-time.
Key components:
- New hook type definition in
packages/plugin/src/index.ts - HTTP endpoint
POST /plugin/input-changedin the server - Fire-and-forget fetch call from TUI prompt component on input change