Skip to content

[FEATURE]: expose more v2 session APIs to plugins #35443

Closed as not planned
Closed as not planned

Description

@mirsella

Feature hasn't been suggested before.

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.

Activity

  1. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to an existing issue. Please check:

    • v2: internal tool plugins expose gaps in the public plugin API #34957: "v2: internal tool plugins expose gaps in the public plugin API" — this issue also discusses the gap between PluginRuntime.Service (which exposes session.{get,create,messages,prompt,resume,interrupt,synthetic}, job.{start,wait,block,background,cancel}) and the public ctx.session domain, noting that capabilities needed to coordinate work around a session live on the internal service rather than the public plugin context.
  2. mirsella commented on Jul 5, 2026

    @mirsella
    ContributorAuthor

    #34957 is related, but broader.

    This issue is only about exposing four existing session methods to external v2 plugins: shell, compact, wait, and active. If maintainers want all public PluginRuntime gaps tracked in #34957, I am fine closing this as a duplicate.

  3. github-actions commented on Sep 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions