feat(plugin): add tui.prompt.submit hook for footer prompt interception#35557
Open
matchaxnb wants to merge 2 commits into
Open
feat(plugin): add tui.prompt.submit hook for footer prompt interception#35557matchaxnb wants to merge 2 commits into
matchaxnb wants to merge 2 commits into
Conversation
Adds a new plugin hook that fires when the user submits a prompt in the TUI footer, before the prompt enters the queue. Handlers receive the prompt text, session ID, active turn status, mode, and command context. They can transform the text or set output.consumed to skip queuing entirely — enabling mid-generation steering and other prompt interception use cases from plugins. Handlers run in FIFO registration order. Initially CLI-only; a server-mode RPC bridge can be added as a follow-up. Changes: - plugin/src/index.ts: add tui.prompt.submit to Hooks interface - opencode/src/cli/cmd/run/runtime.queue.ts: footerSubmit registry, sessionID field, invocation in submit() - opencode/src/plugin/index.ts: wire plugin hooks into footerSubmit
1 task
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #35561
Type of change
What does this PR do?
Adds a new plugin hook that fires when the user submits a prompt in the TUI footer, before the prompt enters the queue. Handlers receive the prompt text, session ID, active turn status, mode, and command context. They can transform the text or set output.consumed to skip queuing entirely - enabling mid-generation steering and other prompt interception use cases from plugins.
Handlers run in FIFO registration order. Initially CLI-only; a server-mode RPC bridge can be added as a follow-up.
Changes:
How did you verify your code works?
Wrote this plug-in: https://github.com/matchaxnb/opencode-soft-steering/blob/main/INSTALL.md
The plug-in is experimental, it uses a dirty temp file to write the steers, but it works. I plan to make it better later on. For now, the behavioral feedback works. This hook is absolutely needed because I need to intercept the text input in the footer to process it before it gets tossed on the QUEUED list. The goal's to let the agent have long turns but to be able to interrupt it casually without heavily stopping the generation.
Checklist
If you do not follow this template your PR will be automatically rejected.