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

Aperta Adatta ai principianti
#62,362 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Inizia trovando il tipo del plugin server SessionDomain e la definizione di SessionApi, poi controlla come sono dichiarate le interfacce esistenti Effect e Promise. Aggiungi background alle selezioni di tipo pertinenti e verifica che entrambe le interfacce dell’API del plugin lo espongano. La issue descrive questa modifica come un cambiamento di due righe; il lavoro è completo quando un plugin server può chiamare ctx.session.background({ sessionID }).

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
224k
Fork
30k
Merge medio
4h 44m
PR unite (30g)
513

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.