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

オープン 初心者向け
#62,362 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

まず、サーバープラグインの型 SessionDomain と SessionApi の定義を見つけ、既存の Effect と Promise のインターフェースがどのように宣言されているか確認してください。関連する型の選択に background を追加し、両方のプラグイン API インターフェースで公開されていることを確認してください。この issue では2行の変更と説明されています。サーバープラグインから ctx.session.background({ sessionID }) を呼び出せれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
224k
フォーク
30k
平均マージ
4時間 44分
マージ済み PR(30日)
513

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。