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

Abierto Apto para principiantes
#62,362 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Empieza por encontrar el tipo del plugin de servidor SessionDomain y la definición de SessionApi. Después, comprueba cómo se declaran las interfaces existentes de Effect y Promise. Añade background a las selecciones de tipos pertinentes y verifica que ambas interfaces de la API del plugin lo expongan. El issue describe esto como un cambio de dos líneas; se considera hecho cuando un plugin de servidor puede llamar a ctx.session.background({ sessionID }).

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
224k
Forks
30k
Merge medio
4 h 44 min
PR fusionados (30 d)
513

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.