From d6c240af35574c4323a8df6d53353f7701895917 Mon Sep 17 00:00:00 2001 From: Hare Date: Fri, 26 Jun 2026 01:30:43 +0900 Subject: [PATCH] ticket: split backend runtime registry integration --- .../00001KVZ9JGK0/artifacts/relations.json | 6 +- .../00001KVZKSV6C/artifacts/relations.json | 30 +------ .yoi/tickets/00001KVZKSV6C/item.md | 90 +++++++++++++------ .yoi/tickets/00001KVZKSV6C/thread.md | 37 ++++++++ .yoi/tickets/00001KVZSGT0Q/artifacts/.gitkeep | 0 .../00001KVZSGT0Q/artifacts/relations.json | 13 +++ .yoi/tickets/00001KVZSGT0Q/item.md | 65 ++++++++++++++ .yoi/tickets/00001KVZSGT0Q/thread.md | 24 +++++ .yoi/tickets/00001KVZSGT14/artifacts/.gitkeep | 0 .../00001KVZSGT14/artifacts/relations.json | 45 ++++++++++ .yoi/tickets/00001KVZSGT14/item.md | 71 +++++++++++++++ .yoi/tickets/00001KVZSGT14/thread.md | 24 +++++ 12 files changed, 347 insertions(+), 58 deletions(-) create mode 100644 .yoi/tickets/00001KVZSGT0Q/artifacts/.gitkeep create mode 100644 .yoi/tickets/00001KVZSGT0Q/artifacts/relations.json create mode 100644 .yoi/tickets/00001KVZSGT0Q/item.md create mode 100644 .yoi/tickets/00001KVZSGT0Q/thread.md create mode 100644 .yoi/tickets/00001KVZSGT14/artifacts/.gitkeep create mode 100644 .yoi/tickets/00001KVZSGT14/artifacts/relations.json create mode 100644 .yoi/tickets/00001KVZSGT14/item.md create mode 100644 .yoi/tickets/00001KVZSGT14/thread.md diff --git a/.yoi/tickets/00001KVZ9JGK0/artifacts/relations.json b/.yoi/tickets/00001KVZ9JGK0/artifacts/relations.json index 75aa00bb..4a2a6038 100644 --- a/.yoi/tickets/00001KVZ9JGK0/artifacts/relations.json +++ b/.yoi/tickets/00001KVZ9JGK0/artifacts/relations.json @@ -4,10 +4,10 @@ { "ticket_id": "00001KVZ9JGK0", "kind": "depends_on", - "target": "00001KVZKSV6C", - "note": "Backend internal Companion Web Console should build on Backend RuntimeRegistry integration with worker-runtime.", + "target": "00001KVZSGT0Q", + "note": "Backend internal Companion Web Console should build on embedded worker-runtime registration in Backend RuntimeRegistry.", "author": "yoi ticket", - "at": "2026-06-25T14:45:00Z" + "at": "2026-06-25T16:30:00Z" } ] } diff --git a/.yoi/tickets/00001KVZKSV6C/artifacts/relations.json b/.yoi/tickets/00001KVZKSV6C/artifacts/relations.json index 69ec6fd7..bf3039d4 100644 --- a/.yoi/tickets/00001KVZKSV6C/artifacts/relations.json +++ b/.yoi/tickets/00001KVZKSV6C/artifacts/relations.json @@ -4,34 +4,10 @@ { "ticket_id": "00001KVZKSV6C", "kind": "depends_on", - "target": "00001KVZKST83", - "note": "Standalone remote Runtime should have FS persistence available before Backend integration.", + "target": "00001KVZBCQH4", + "note": "Backend RuntimeRegistry foundation should use worker-runtime core domain types.", "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" - }, - { - "ticket_id": "00001KVZKSV6C", - "kind": "related", - "target": "00001KVZQHPNY", - "note": "Backend RuntimeRegistry integration will eventually coordinate config bundle sync for remote runtimes, but v0 can use builtin/default fallback.", - "author": "yoi ticket", - "at": "2026-06-25T15:51:07Z" + "at": "2026-06-25T16:30:00Z" } ] } diff --git a/.yoi/tickets/00001KVZKSV6C/item.md b/.yoi/tickets/00001KVZKSV6C/item.md index f70d7e6c..87fff43c 100644 --- a/.yoi/tickets/00001KVZKSV6C/item.md +++ b/.yoi/tickets/00001KVZKSV6C/item.md @@ -1,51 +1,85 @@ --- -title: 'Backend RuntimeRegistryをworker-runtimeへ接続する' -state: 'planning' +title: 'Backend RuntimeRegistryの基盤をworker-runtime向けに整理する' +state: 'ready' created_at: '2026-06-25T14:44:03Z' -updated_at: '2026-06-25T15:51:07Z' +updated_at: '2026-06-25T16:30:31Z' 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 で接続できるようにする必要がある。 +Workspace Backend は複数 Runtime を束ねる `RuntimeRegistry` を持つ。Registry は Worker を実行する主体ではなく、embedded Runtime と remote Runtime process、既存 local Worker compatibility adapter を同じ Backend-facing API から参照・routing するための集約境界である。 -この Ticket では Workspace backend の既存 local Pod metadata projection 寄りの Runtime/Worker handling を、`worker-runtime` の embedded/remote Runtime handles に接続する。 +この Ticket は embedded Runtime 実装や remote HTTP client 実装を含めない。先に Backend 側の Registry 構造、runtime identity、capability/status projection、Browser-facing API の authority 境界を `worker-runtime` の domain model に合わせて整理する。 ## 要件 -- `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 として扱う。 +### Registry responsibility + +- Backend `RuntimeRegistry` は Runtime を実行しない。 +- Backend `RuntimeRegistry` は以下を扱う集約境界とする。 + - Runtime lookup。 + - Runtime summary / capability / status projection。 + - Runtime-scoped Worker identity の routing key。 + - Browser-facing API への safe projection。 + - workspace visibility / policy / audit hook point。 +- Runtime internal store / allocation registry と Backend `RuntimeRegistry` を混同しない。 +- Worker metadata persistence や live allocation authority は Runtime 側の責務とし、Backend Registry は直接所有しない。 + +### Runtime identity / handle model + +- Backend-facing Runtime identity は `runtime_id` を authority とする。 +- Worker authority は `runtime_id + worker_id` とする。 +- UI 表示用 `display_ref` は authority にしない。 +- Registry は将来以下の runtime source を扱える shape にする。 + - embedded `worker_runtime::Runtime`。 + - remote Runtime process client。 + - existing local Worker/Pod compatibility adapter。 +- この Ticket では embedded / remote 実 handle の実装は後続に残す。 +- Existing local metadata projection は必要なら compatibility source として残すが、正規 Runtime authority として扱わない。 + +### Backend API boundary + +- Browser-facing API は Runtime endpoint / token / socket path / session path / local metadata path を受け取らない。 +- Browser-facing API は `runtime_id + worker_id` を authority として扱える shape にする。 +- Existing `/api/workers` / `/api/hosts` / runtime list behavior は、新 Registry model へ段階移行できるよう整理する。 +- v0 では既存 API の behavior を維持しつつ、内部 model を RuntimeRegistry に寄せてよい。 +- New runtime-scoped endpoints を足すか、既存 endpoints を拡張するかは実装時に決めてよいが、ticket内で選んだ方針を記録する。 + +### Implementation target + +- 主な対象は `crates/workspace-server/src/hosts.rs` と `crates/workspace-server/src/server.rs` とする。 +- 既存 `WorkerRuntimeRegistry` / `LocalPodRuntime` / `LocalRuntimeBridge` 相当を、Backend Registry foundation と local compatibility source の境界に整理する。 +- `LocalPodRuntime` という名前が正規 Runtime 実装に見える場合は、`LocalPodCompatibilitySource` / `LocalWorkerCompatibilityAdapter` 相当の名前へ寄せる。 +- 既存 local metadata reader の behavior は維持してよいが、Runtime authority ではなく compatibility projection として diagnostics / implementation kind に表す。 +- 既存 `/api/hosts` / `/api/workers` / `/api/hosts/{host_id}/workers` の outward behavior は原則維持する。 +- runtime-scoped endpoint を新設する場合は、既存 endpoint を壊さず追加する。 +- この Ticket では Worker create / send input / remote HTTP call / embedded direct call の実処理は実装しない。後続 handle が差し込める型・routing境界までに留める。 + +### Error / diagnostics + +- Unknown runtime、unknown worker、runtime unavailable、operation unsupported、worker not visible を typed に分けられるようにする。 +- Compatibility local source 由来の stale metadata / invalid metadata は diagnostic として扱い、Runtime authority を歪めない。 ## Non-goals -- `worker-runtime` core crate implementation。 -- REST command server implementation。 -- Event stream server implementation。 +- Embedded `worker_runtime::Runtime` の登録・routing 実装。 +- Remote HTTP Runtime client 実装。 +- REST command server / event stream server implementation。 - Backend internal Companion Web Console completion。 - Dynamic Runtime registration。 - Full auth / permission model。 -- Removing local Pod compatibility path。 +- Removing local 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. +- Workspace backend に `worker-runtime` domain model と整合した `RuntimeRegistry` 基盤がある。 +- Registry は Runtime identity / Worker routing key / capability / status projection を扱える。 +- Registry の責務が Runtime internal store/allocation と code/docs/tests 上で分離されている。 +- Browser-facing API が Runtime endpoint / token / socket path / session path を authority として受け取らない。 +- Existing local Worker/Pod metadata projection は compatibility source として明示されている。 +- Embedded/remote runtime 実装は後続 Ticket で追加できる handle boundary がある。 +- Focused workspace-server tests cover Registry identity/projection/error mapping and local compatibility source behavior. - `cargo test -p yoi-workspace-server` が通る。 - `cargo check -p yoi` が通る。 - `git diff --check` が通る。 diff --git a/.yoi/tickets/00001KVZKSV6C/thread.md b/.yoi/tickets/00001KVZKSV6C/thread.md index 4de875e9..2327ae33 100644 --- a/.yoi/tickets/00001KVZKSV6C/thread.md +++ b/.yoi/tickets/00001KVZKSV6C/thread.md @@ -4,4 +4,41 @@ LocalTicketBackend によって作成されました。 +--- + + + +## Decision + +Decision update: split Backend Runtime work into three implementation tickets. + +1. 00001KVZKSV6C Backend RuntimeRegistryの基盤をworker-runtime向けに整理する + - Registry identity/projection/error boundary only. + - No embedded Runtime handle implementation. + - No remote Runtime client implementation. +2. 00001KVZSGT0Q Backend RuntimeRegistryにembedded worker-runtimeを接続する + - Direct lib-call integration for backend-internal Runtime. +3. 00001KVZSGT14 Backend RuntimeRegistryにremote worker-runtime processを接続する + - HTTP/event-stream client integration for remote Runtime processes. + +Companion Web Console depends on embedded integration, not remote integration. + + +--- + + + +## Intake summary + +Marked ready by `yoi ticket state`. + +--- + + + +## State changed + +Marked ready by `yoi ticket state`. + + --- diff --git a/.yoi/tickets/00001KVZSGT0Q/artifacts/.gitkeep b/.yoi/tickets/00001KVZSGT0Q/artifacts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.yoi/tickets/00001KVZSGT0Q/artifacts/relations.json b/.yoi/tickets/00001KVZSGT0Q/artifacts/relations.json new file mode 100644 index 00000000..6073ae9f --- /dev/null +++ b/.yoi/tickets/00001KVZSGT0Q/artifacts/relations.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "relations": [ + { + "ticket_id": "00001KVZSGT0Q", + "kind": "depends_on", + "target": "00001KVZKSV6C", + "note": "Embedded Runtime connection builds on the Backend RuntimeRegistry foundation.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + } + ] +} diff --git a/.yoi/tickets/00001KVZSGT0Q/item.md b/.yoi/tickets/00001KVZSGT0Q/item.md new file mode 100644 index 00000000..4333490c --- /dev/null +++ b/.yoi/tickets/00001KVZSGT0Q/item.md @@ -0,0 +1,65 @@ +--- +title: 'Backend RuntimeRegistryにembedded worker-runtimeを接続する' +state: 'ready' +created_at: '2026-06-25T16:23:58Z' +updated_at: '2026-06-25T16:30:31Z' +assignee: null +--- + +## 背景 + +`worker-runtime` core crate と Backend `RuntimeRegistry` 基盤ができたら、Workspace Backend process 内に embedded `worker_runtime::Runtime` を組み込み、`backend-internal` Runtime として Registry から扱えるようにしたい。これは Backend internal Companion Web Console の前提であり、remote Runtime process / HTTP client / FS store / event stream server を待たずに進められる。 + +この Ticket では embedded Runtime handle を Backend Registry に接続する。Runtime は memory store / builtin/default Profile fallback / toolsなし Worker でよい。 + +## 要件 + +### Embedded Runtime registration + +- Workspace Backend が `worker_runtime::Runtime` を process 内に生成・保持できる。 +- Embedded Runtime を `backend-internal` 相当の runtime id / display name / capabilities で RuntimeRegistry に登録できる。 +- Registry から embedded Runtime の runtime summary / status / capabilities を取得できる。 +- Embedded Runtime は HTTP endpoint / token / socket path を持たない。 + +### Worker operations + +- Backend Registry は embedded Runtime に対して direct lib call で以下を route できる。 + - worker list / detail。 + - create worker。 + - send input。 + - stop / cancel。 + - bounded transcript projection。 + - event cursor / subscription placeholder。 +- v0 は toolsなし Worker / builtin/default Profile fallback / memory store でよい。 +- Busy / unknown worker / runtime unavailable / unsupported operation を typed error に map する。 + +### Backend API exposure + +- Browser-facing API は embedded Runtime を remote Runtime と同じ `runtime_id + worker_id` authority で扱う。 +- Browser は embedded Runtime internals / store path / provider credentials を知らない。 +- Existing `/api/workers` / runtime list に embedded Runtime Worker を含めるか、新 runtime-scoped endpoint に出すかを実装時に決め、方針を記録する。 +- Local compatibility source と embedded Runtime source を diagnostics / implementation kind で区別できる。 + +## Non-goals + +- Remote Runtime process client。 +- FS store。 +- REST command server。 +- Event stream server。 +- Full Companion Web Console UI。 +- Profile/config bundle sync。 +- Local compatibility path の削除。 + +## 受け入れ条件 + +- Workspace Backend が embedded `worker_runtime::Runtime` を生成し、RuntimeRegistry に登録できる。 +- Backend API から `backend-internal` Runtime の summary/status/capabilities を確認できる。 +- Backend Registry が embedded Runtime の worker list/detail/create/send input/transcript projection を direct lib call で扱える。 +- v0 toolsなし Worker が create でき、input acceptance まで確認できる。 +- Browser-facing API に socket path / session path / runtime internal store path / provider credential が露出しない。 +- Local compatibility source と embedded Runtime source が混同されない。 +- Focused workspace-server tests cover embedded runtime registration and routing. +- `cargo test -p yoi-workspace-server` が通る。 +- `cargo check -p yoi` が通る。 +- `git diff --check` が通る。 +- `nix build .#yoi --no-link` が通る。 diff --git a/.yoi/tickets/00001KVZSGT0Q/thread.md b/.yoi/tickets/00001KVZSGT0Q/thread.md new file mode 100644 index 00000000..91caefa6 --- /dev/null +++ b/.yoi/tickets/00001KVZSGT0Q/thread.md @@ -0,0 +1,24 @@ + + +## 作成 + +LocalTicketBackend によって作成されました。 + +--- + + + +## Intake summary + +Marked ready by `yoi ticket state`. + +--- + + + +## State changed + +Marked ready by `yoi ticket state`. + + +--- diff --git a/.yoi/tickets/00001KVZSGT14/artifacts/.gitkeep b/.yoi/tickets/00001KVZSGT14/artifacts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.yoi/tickets/00001KVZSGT14/artifacts/relations.json b/.yoi/tickets/00001KVZSGT14/artifacts/relations.json new file mode 100644 index 00000000..445e8f53 --- /dev/null +++ b/.yoi/tickets/00001KVZSGT14/artifacts/relations.json @@ -0,0 +1,45 @@ +{ + "version": 1, + "relations": [ + { + "ticket_id": "00001KVZSGT14", + "kind": "depends_on", + "target": "00001KVZKSV6C", + "note": "Remote Runtime connection builds on the Backend RuntimeRegistry foundation.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + }, + { + "ticket_id": "00001KVZSGT14", + "kind": "depends_on", + "target": "00001KVZKST83", + "note": "Standalone remote Runtime should have FS persistence available before Backend integration.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + }, + { + "ticket_id": "00001KVZSGT14", + "kind": "depends_on", + "target": "00001KVZKSTE2", + "note": "Remote Runtime routing needs the REST command API.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + }, + { + "ticket_id": "00001KVZSGT14", + "kind": "depends_on", + "target": "00001KVZKSTJT", + "note": "Remote Runtime observation needs the Runtime event stream API.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + }, + { + "ticket_id": "00001KVZSGT14", + "kind": "related", + "target": "00001KVZQHPNY", + "note": "Remote Runtime integration will eventually coordinate Profile/config bundle sync, but v0 can use builtin/default fallback where applicable.", + "author": "yoi ticket", + "at": "2026-06-25T16:30:00Z" + } + ] +} diff --git a/.yoi/tickets/00001KVZSGT14/item.md b/.yoi/tickets/00001KVZSGT14/item.md new file mode 100644 index 00000000..c0cece64 --- /dev/null +++ b/.yoi/tickets/00001KVZSGT14/item.md @@ -0,0 +1,71 @@ +--- +title: 'Backend RuntimeRegistryにremote worker-runtime processを接続する' +state: 'ready' +created_at: '2026-06-25T16:23:58Z' +updated_at: '2026-06-25T16:30:32Z' +assignee: null +--- + +## 背景 + +Standalone `worker-runtime` process が FS store、REST command server、event stream server を持った後、Workspace Backend は remote Runtime process に client として接続できる必要がある。Browser は remote Runtime に直接接続せず、Backend が RuntimeRegistry / policy / visibility / audit / typed error mapping を挟んで proxy / projection する。 + +この Ticket では Backend RuntimeRegistry に remote Runtime client handle を追加する。Embedded Runtime 接続とは別実装粒度とする。 + +## 要件 + +### Remote Runtime client + +- Backend は config-like data から remote Runtime client handle を作成できる。 + - runtime id / display name。 + - base URL。 + - token / secret ref placeholder。 + - capability cache / last seen status。 +- Remote command は `worker-runtime` REST command API に対する Backend-owned client で実行する。 +- Remote observation は Runtime event stream API に対する Backend-owned client で購読または proxy できる。 +- Backend は Runtime endpoint / credential を Browser に渡さない。 + +### Registry routing + +- Backend RuntimeRegistry は remote Runtime handle へ以下を route できる。 + - runtime summary / status / capabilities。 + - worker list / detail。 + - create worker。 + - send input。 + - stop / cancel。 + - bounded transcript projection。 + - event stream/proxy。 +- Embedded Runtime handle と remote Runtime handle は Browser-facing API から同じ `runtime_id + worker_id` authority で扱える。 +- Network failure / auth failure / timeout / remote unsupported / remote worker not found を typed error に map する。 + +### Config / policy boundary + +- Backend がどの remote Runtime に接続してよいかを config / registry data で管理する。 +- Dynamic registration は不要。 +- Config bundle sync は関連するが、この Ticket では remote Runtime connection / routing を主目的とする。 +- Browser は remote Runtime base URL / token / direct endpoint authority を知らない。 + +## Non-goals + +- `worker-runtime` core crate implementation。 +- FS store implementation。 +- REST command server implementation。 +- Event stream server implementation。 +- Embedded Runtime integration。 +- Dynamic Runtime registration。 +- Full auth / permission model。 +- Backend internal Companion Web Console completion。 + +## 受け入れ条件 + +- Workspace Backend が remote Runtime client handle を config-like data から登録できる。 +- Backend RuntimeRegistry が remote Runtime の list/detail/create/input/transcript/event operations を route できる。 +- Remote network/auth/timeout errors が typed Backend errors に map される。 +- Browser-facing API に remote Runtime base URL / credential / direct endpoint が露出しない。 +- Embedded Runtime handle と remote Runtime handle が同じ `runtime_id + worker_id` authority model で扱われる。 +- Event stream client/proxy path が Backend-owned connection として実装されている。 +- Focused workspace-server tests cover mocked remote Runtime routing and error mapping. +- `cargo test -p yoi-workspace-server` が通る。 +- `cargo check -p yoi` が通る。 +- `git diff --check` が通る。 +- `nix build .#yoi --no-link` が通る。 diff --git a/.yoi/tickets/00001KVZSGT14/thread.md b/.yoi/tickets/00001KVZSGT14/thread.md new file mode 100644 index 00000000..00829a17 --- /dev/null +++ b/.yoi/tickets/00001KVZSGT14/thread.md @@ -0,0 +1,24 @@ + + +## 作成 + +LocalTicketBackend によって作成されました。 + +--- + + + +## Intake summary + +Marked ready by `yoi ticket state`. + +--- + + + +## State changed + +Marked ready by `yoi ticket state`. + + +---