ticket: split worker runtime implementation

This commit is contained in:
2026-06-26 00:12:00 +09:00
parent d93dbc0533
commit befbabe13a
19 changed files with 420 additions and 119 deletions
@@ -0,0 +1,29 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKST83",
"note": "Standalone remote Runtime should have FS persistence available before Backend integration.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
},
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKSTE2",
"note": "Backend remote Runtime routing needs the REST command API.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
},
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKSTJT",
"note": "Backend event proxy/observation needs the Runtime event stream API.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
}
]
}
+52
View File
@@ -0,0 +1,52 @@
---
title: 'Backend RuntimeRegistryをworker-runtimeへ接続する'
state: 'planning'
created_at: '2026-06-25T14:44:03Z'
updated_at: '2026-06-25T14:47:43Z'
assignee: null
---
## 背景
Workspace Backend は複数 Runtime を束ねる `RuntimeRegistry` を持つ。Registry は Worker を実行する主体ではなく、embedded Runtime と remote Runtime process を同じ logical operation で扱うための集約境界である。`worker-runtime` core / REST command server / event stream server が揃ったら、Backend は embedded Runtime には direct lib call、remote Runtime には HTTP client / event stream client で接続できるようにする必要がある。
この Ticket では Workspace backend の既存 local Pod metadata projection 寄りの Runtime/Worker handling を、`worker-runtime` の embedded/remote Runtime handles に接続する。
## 要件
- `worker-runtime``http-client` feature または Backend-local remote Runtime client を追加する。
- Backend RuntimeRegistry は少なくとも以下の handle を扱える。
- embedded Runtime handle。
- remote HTTP Runtime client handle。
- existing local Pod compatibility adapter は必要なら別 branch として残す。
- Backend API は Browser から Runtime endpoint / credential / socket path / session path を受け取らない。
- Browser-facing API は `runtime_id + worker_id` を authority とする。
- Backend は Runtime config / endpoint / token secret ref / capability cache を管理する。
- Backend は Runtime の command API を proxy し、policy / visibility / audit / typed error mapping を挟む。
- Backend は Runtime event stream を購読または proxy できる形にする。
- Existing `/api/workers` / `/api/hosts` / runtime list behavior を new Runtime model へ段階移行する。
- Local Pod metadata reader は正規 Runtime ではなく compatibility adapter として扱う。
## Non-goals
- `worker-runtime` core crate implementation。
- REST command server implementation。
- Event stream server implementation。
- Backend internal Companion Web Console completion。
- Dynamic Runtime registration。
- Full auth / permission model。
- Removing local Pod compatibility path。
## 受け入れ条件
- Workspace backend can register an embedded `worker_runtime::Runtime`.
- Workspace backend can register a remote Runtime client from config-like data.
- Backend RuntimeRegistry routes list/detail/input/transcript/event operations to embedded or remote Runtime handles.
- Browser-facing API does not expose Runtime credentials, raw endpoint authority, socket path, or session path.
- Existing worker list/detail endpoints continue to work or are explicitly replaced with new runtime-scoped endpoints.
- Local Pod metadata projection is clearly marked as compatibility adapter, not the Runtime authority.
- Focused workspace-server tests cover embedded Runtime and mocked remote Runtime routing.
- `cargo test -p yoi-workspace-server` が通る。
- `cargo check -p yoi` が通る。
- `git diff --check` が通る。
- `nix build .#yoi --no-link` が通る。
+7
View File
@@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-25T14:44:03Z -->
## 作成
LocalTicketBackend によって作成されました。
---