You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: TUI plugin API (v2): a way to take text input, including paste #51392
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
v1's TUI plugin API had keymap.intercept("key", handler), so a plugin could run its own text field: every key before the keymap, with the option to consume it. v2's Keymap has layer, dispatch, shortcuts, commands, pending, active and mode, but no intercept.
Pasting is the harder part: it arrives as a single paste event on the renderer's key input, so a field fed by keys never sees it, and the paste lands in the prompt underneath.
opencode-cockpit works around both by calling prependListener on ctx.renderer.keyInput directly, for keypress and paste. That works, but it depends on OpenTUI internals rather than the plugin API.
Proposal: bring back keymap.intercept(handler, { priority }) on v2, and deliver pastes through it (or through a separate onPaste), with consume() keeping them from the prompt.
To restate it: you'd like the v2 TUI plugin API to offer a low-level key interceptor again, like v1's keymap.intercept. Pastes would be delivered through it too, or through a separate paste hook, with a way to consume them so they don't land in the prompt. Then plugins could run their own text fields without reaching into ctx.renderer.keyInput.
You're right that the v2 plugin Keymap only has layer, dispatch, commands, pending, active and mode. The TUI already uses an intercept internally for some of its own components; it just isn't exposed to plugins. Until then, dialog.prompt() is the only supported way for a plugin to read text, and it's modal, so it won't cover an inline field like cockpit's.
Maintainers will consider this. Somewhat related paste issues:
Activity
github-actions commentedon Sep 25, 2026
This issue might be a duplicate of existing issues. Please check:
For keybind-related issues, please also check our pinned keybinds documentation: #4997
opencodejr commentedon Oct 28, 2026
Thanks for the detailed request, @Codestz!
To restate it: you'd like the v2 TUI plugin API to offer a low-level key interceptor again, like v1's
keymap.intercept. Pastes would be delivered through it too, or through a separate paste hook, with a way to consume them so they don't land in the prompt. Then plugins could run their own text fields without reaching intoctx.renderer.keyInput.You're right that the v2 plugin
Keymaponly haslayer,dispatch,commands,pending,activeandmode. The TUI already uses an intercept internally for some of its own components; it just isn't exposed to plugins. Until then,dialog.prompt()is the only supported way for a plugin to read text, and it's modal, so it won't cover an inline field like cockpit's.Maintainers will consider this. Somewhat related paste issues: