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

Open Beginner friendly
#62,362 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start by finding the server plugin SessionDomain type and the SessionApi definition, then check how the existing Effect and Promise faces are declared. Add background to the relevant type selections and verify both plugin API faces expose it. The issue describes this as a two-line change; done means a server plugin can call ctx.session.background({ sessionID }).

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
224k
Forks
30k
Avg merge
4h 44m
Merged PRs (30d)
513

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.