Skip to content

[FEATURE]: plugin shell domain: list, get, output, wait, kill #62361

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

A server plugin's shell domain has one member, the create.before hook. A plugin that wants to change how the model works with shells (return a handle and let the model check, wait or kill later; show a list of the session's shells) has no way to reach the shells themselves. The built-in shell tool yield*s the internal Shell service, which plugins can't get. Going through the HTTP API isn't an option either, since a server plugin gets no client. Writing its own process manager loses the shell permission parsing, job notices and the TUI shell tab.

Proposal: expose the existing Shell service reads and controls on the plugin shell domain (Effect and Promise faces):

export interface ShellDomain {
  readonly hook: Hooks<ShellHooks>
  readonly list: (input?: { exited?: boolean }) => Effect<Shell.Info[]>
  readonly get: (id: Shell.ID) => Effect<Shell.Info, Shell.NotFoundError>
  readonly output: (id: Shell.ID, input?: Shell.OutputInput) => Effect<Shell.Output, Shell.NotFoundError>
  readonly wait: (id: Shell.ID) => Effect<Shell.Info, Shell.NotFoundError>
  readonly kill: (id: Shell.ID) => Effect<Shell.Info, Shell.NotFoundError>
}

With this, a plugin can wrap the built-in tool with tool.transform(e => e.update("shell", ...)) and add check/wait/kill/list actions on top of it, without forking the tool.

kill needs a core Shell.kill that keeps the record and output (#62363 proposes it with POST /api/shell/:id/kill). With #62362 (session.background for plugins), the same wrapper can also move a long call to the background. On my fork the core side is in cevr@c965f99 (kill, list({ exited })); the plugin domain itself is a thin pass-through I can add in a PR once the shape is OK.

Activity

  1. opencodejr commented on Nov 6, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal, @cevr! In short: you'd like the plugin shell domain to expose the existing Shell service's list, get, output, wait and kill (in both the Effect and Promise APIs), so a plugin can build background-shell controls on top of the built-in shell tool instead of forking it.

    I checked the code: ShellDomain currently exposes only hook (create.before). The core Shell service already has list/get/wait/output, but it has no kill that keeps the record and output, and list has no exited filter. So, as you say, this needs both a small plugin API addition and a core change. A plugin can't do it today.

    Maintainers will look at the proposed shape and decide whether to go ahead. Please wait for their feedback on the API before opening the PR.

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