anomalyco / anomalyco/opencode
[FEATURE]: expose more v2 session APIs to plugins
@neriousy is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I checked existing issues first. #34957 is related, but broader. This issue is only about exposing a few existing session APIs to external v2 plugins.
This recreates #35443, which was automatically closed after 60 days of inactivity.
Describe the enhancement you want to request
While porting a plugin from the v1 plugin API to the v2 plugin API, I ran into a small gap in the public session runtime.
The v2 plugin context exposes prompt, command, and interrupt, but a few session APIs already exist elsewhere in opencode and are not available to plugins:
context.session.shell(...)
context.session.compact(...)
context.session.wait(...)
context.session.active(...)
These are useful for plugins that coordinate work around the current session. For example, a queue plugin may need to send a prompt, run a slash command, run a shell command, compact the session, or wait until the current run is idle before sending the next item.
Without these APIs, plugins have to drop features that worked in v1, rely on private APIs, or rebuild session state by watching events.
This is not a request for native queue behavior. That is already covered in #5408 and #32157. This is just the smaller API gap: make the existing session operations available through the public v2 plugin context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.