ticket: target protocol worker controls

This commit is contained in:
Keisuke Hirata 2026-07-21 18:47:17 +09:00
parent c9c1d0bb72
commit bfa9346de2
No known key found for this signature in database
2 changed files with 68 additions and 24 deletions

View File

@ -1,8 +1,8 @@
---
title: 'Backend runtime経由でWorker protocol操作をTUI同等に使えるようにする'
title: 'Backend runtime経由の操作をprotocol transportへ統一しTUI同等にする'
state: 'planning'
created_at: '2026-07-21T09:20:07Z'
updated_at: '2026-07-21T09:42:18Z'
updated_at: '2026-07-21T09:47:10Z'
assignee: null
readiness: 'draft'
---
@ -10,39 +10,75 @@ readiness: 'draft'
Backend runtime worker list / attach 経路が入ったので、次は attach 後の Worker control 操作を TUI 同等に Backend/runtime 経由でも使えるようにする。
現在の local TUI attach は Worker protocol の `Method` を送る操作を持っている。一方、Backend runtime attach client は一部操作を ad-hoc な HTTP endpoint に map し、pause / resume / rewind 系は unsupported diagnostic にしている。ここを、Backend 経由でも TUI と同じ protocol 操作を送れる transport として整える。
現在の local TUI attach は Worker protocol の `Method` を送る操作を持っている。一方、Backend runtime attach client と browser Console は、操作系を ad-hoc な HTTP endpoint に map している。
## 要件
現状例:
- Backend/runtime 経由の Worker protocol transport を定義・実装する。
- 既存 event WebSocket が read-only observation なら、双方向 WS を追加するか、明確な command WS を追加する。
- read/observation: `/events/ws`
- input: `POST /input`
- completions: `POST /completions`
- cancel/stop: 個別 lifecycle endpoint
- pause / resume / rewind: Backend runtime attach では unsupported
この Ticket では、この HTTP 操作系 endpoint の寄せ集めを前提にしない。Backend/runtime 経由でも TUI と同じ `protocol::Method` を送れる protocol transport を作り、TUI Backend attach と browser frontend Console の操作経路をそこへ統一する。
## Target
- 操作系 HTTP endpoint を主経路として使う設計を廃止する。
- 少なくとも frontend/TUI の新しい操作実装は protocol transport を使う。
- 既存 endpoint を一時 compatibility layer として残す場合は、Ticket 内で廃止対象として明示し、frontend/TUI からは使わない。
- Backend/runtime に Worker protocol 操作用 transport を実装する。
- 既存 `/events/ws` が read-only observation なら、双方向 console WS または command WS を追加する。
- transport payload は既存 `protocol::Method` / `protocol::Event` との対応を保つ。
- REST endpoint の増設が必要な場合も、主設計は「個別 HTTP API」ではなく「protocol method を Backend/runtime に中継する経路」として扱う。
- Backend/runtime が以下の Worker protocol 操作を受け付ける。
- cancel
- pause
- resume
- rewind target list
- rewind to target
- TUI Backend Runtime client の unsupported 扱いを解消し、既存 TUI 操作から Backend 経由でも同等に送れるようにする。
- browser/frontend でも TUI と同等の操作ができるようにする。
- attach 中 Worker に対する cancel / pause / resume
- rewind target の取得
- rewind target 選択と rewind 実行
- authority は Backend/runtime 側の Worker identity / event stream / protocol transport とする。
- frontend/TUI が独自 scheduler や duplicate runtime authority を作らない。
- 個別 HTTP API ではなく「protocol method を Backend/runtime に中継する経路」を authority とする。
- TUI Backend Runtime client を protocol transport に寄せる。
- 現在 `backend_runtime.rs` で unsupported になっている pause / resume / rewind 系を解消する。
- local TUI attach と同じ `Method` 操作が Backend runtime attach でも使えるようにする。
- browser frontend Console も protocol transport に寄せる。
- 現在の HTTP `POST /input` / `POST /completions` 依存を廃止対象にする。
- Console UI から TUI と同等の操作ができるようにする。
- Worker event observation と command submission が protocol として整合する。
## 必須操作
Backend/runtime 経由で、TUI 同等に以下を使えるようにする。
- run / notify 相当の入力送信
- completion lookup
- cancel
- pause
- resume
- compact既存 TUI 操作と同等に扱う)
- rewind target list
- rewind to target
## 受け入れ条件
- Backend runtime attach 中の TUI で、local Worker attach と同等の cancel / pause / resume / rewind 操作が使える。
- browser/frontend で、attach 中 Worker に対して cancel / pause / resume / rewind 操作が使える。
- Backend runtime attach 中の TUI で、local Worker attach と同等の操作が使える。
- run / notify
- completion lookup
- cancel
- pause
- resume
- compact
- rewind target list
- rewind to target
- browser frontend Console で、TUI と同等の操作が使える。
- input 送信
- completion lookup
- cancel / pause / resume / compact
- rewind target の取得
- rewind target 選択と rewind 実行
- frontend/TUI の操作系は protocol transport を使い、個別 HTTP operation endpoint を主経路として使わない。
- 既存 HTTP operation endpoint を残す場合は compatibility/deprecation として明記され、frontend/TUI の通常操作からは外れている。
- rewind target list と rewind 実行結果が protocol event stream / diagnostics と整合する。
- unsupported diagnostic のまま残る操作がある場合は、仕様上 follow-up として明示されている。
- unsupported diagnostic のまま残る操作がある場合は、仕様上 follow-up として明示されている。ただし上記必須操作については原則 unsupported のままにしない。
- runtime/backend/frontend/TUI の各変更に対して妥当な cargo check/test または frontend check を実行し、結果を thread に残す。
## 注意
- TUI 側の既存 keybinding / command / UX と揃える。
- browser frontend Console は、TUI と同じ操作概念を UI として持つ。
- Backend/runtime が受け付ける操作と Worker protocol method の対応を明確にする。
- HTTP endpoint を操作ごとに増やすだけの設計にしない。必要なら compatibility layer として扱う。
- HTTP endpoint を操作ごとに増やすだけの設計にしない。
- 既存の Backend Workspace authority 原則を崩さない。Worker/runtime 側に local `.yoi` discovery や client config discovery を再導入しない。

View File

@ -13,3 +13,11 @@ LocalTicketBackend によって作成されました。
Ticket item updated: title, body.
---
<!-- event: item_edit author: assistant at: 2026-07-21T09:47:10Z -->
## 項目更新
Ticket item updated: title, body.
---