Skip to content

feat(plugin): add tui.prompt.submit hook for footer prompt interception#35557

Open
matchaxnb wants to merge 2 commits into
anomalyco:devfrom
matchaxnb:dev
Open

feat(plugin): add tui.prompt.submit hook for footer prompt interception#35557
matchaxnb wants to merge 2 commits into
anomalyco:devfrom
matchaxnb:dev

Conversation

@matchaxnb

@matchaxnb matchaxnb commented Jul 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #35561

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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:

  • 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

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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

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
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 6, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: hook to intercept footer text events.

1 participant