Skip to content

[FEATURE]: session.background on the server plugin session API #62362

Open

Description

@cevr

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

POST /api/session/:id/background moves a session's blocking shell or subagent call to the background, and the TUI binds it to a key. A server plugin can't call it: the plugin SessionDomain is a Pick of the session API that leaves background out, and a server plugin has no HTTP client.

That blocks a plugin from auto-backgrounding long calls, e.g. a wrapper around the built-in shell tool that races a timer and moves the call to the background after N seconds, so the model gets the output so far and a notice when it ends. The background path matters because it keeps the built-in's job notices, wake-ups and permissions; a plugin can't rebuild those.

Proposal: add background to the Pick, on the Effect and Promise faces:

export type SessionDomain = Pick<
  SessionApi<unknown>,
  "list" | "create" | /* … */ | "context" | "background"
> & /* … */
const timer = Effect.sleep("2 minutes").pipe(Effect.andThen(ctx.session.background({ sessionID })))

Today background moves every blocking job of the session. If that's too coarse for plugins, an optional type (or a per-shell ctx.shell.background(id) on the domain proposed in #62361) would let a plugin move only its own call; the core BackgroundAllInput already has a type field.

This is a two-line change; I can open a PR once the shape is OK.

Activity

  1. opencodejr commented on Nov 6, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal! You're asking for background to be exposed on the server plugin ctx.session API, possibly with a type filter or a per-shell variant, so a plugin can move a long blocking shell or subagent call to the background itself and keep the built-in job notices and wake-ups. You're right that SessionDomain currently picks the session API without background, so a server plugin has no way to do this today. Maintainers will consider it.

    Related items:

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

Metadata

Metadata

Assignees

No one assigned

    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