8.8 KiB
| title | state | created_at | updated_at | assignee |
|---|---|---|---|---|
| Workspace Backend Runtime接続の管理画面と永続configを追加する | planning | 2026-07-02T13:54:52Z | 2026-07-02T14:00:49Z | null |
背景
Workspace Backend は embedded Runtime を process 内に持ち、remote Runtime は ServerConfig.remote_runtime_sources から RuntimeRegistry に登録する構造になっている。Runtime が Backend へ接続しに来るのではなく、Backend が Runtime source を registry に登録して呼び出す。
現状、remote Runtime 接続の永続化は .yoi/workspace-backend.local.toml の [[runtimes.remote]] schema として存在する。ただし、これを Browser から追加・削除・確認する管理画面/API はまだ無い。また token_ref は field としてあるが secret ref resolution は未実装で、raw token 値を config に保存する schema は無い。
手動 Coding Worker 作成フォームで Runtime を選ぶには、先に Runtime connection を Workspace Backend の設定として管理できる必要がある。この Ticket では Runtime 接続管理 UI/API と config 永続化を追加する。
目的
- Workspace Browser から Runtime connection を確認・追加・削除できるようにする。
- Runtime connection config を
.yoi/workspace-backend.local.tomlに永続化する。 - raw token 値、Runtime internal store path、socket path、event cursor などを保存・表示しない。
- RuntimeRegistry の live state と config の境界を明確にする。
- 手動 Worker 作成 UI が選択できる Runtime 候補の基盤を作る。
依存関係
00001KWHJ0XH6 Workspace BrowserにSettings/Admin画面のshellとnavigationを追加する- Settings/Admin entry point / route / shell / section navigation は先行 Ticket で用意する。
- この Ticket はその Settings shell 上に Runtime Connections section と Backend API / config persistence を追加する。
現状整理
embedded Runtime
- Backend process 内で作られる built-in Runtime。
RuntimeRegistry::for_workspace(EmbeddedWorkerRuntime::...)で登録される。- config file で追加・削除する対象ではない。
- 管理画面では built-in として表示する。
remote Runtime
.yoi/workspace-backend.local.tomlの[[runtimes.remote]]から読み込まれる。ServerConfig.remote_runtime_sourcesを経由してRuntimeRegistryに登録される。- 現状は起動時登録だけで、UI/API からの追加・削除は無い。
token_refは schema にあるが secret resolution は未実装なので、v0 では fail closed か未対応表示にする。
Config schema
既存 schema を使う。
[[runtimes.remote]]
id = "example"
endpoint = "http://127.0.0.1:8790"
display_name = "Example Runtime"
# token_ref = "local:example-runtime-token"
保存するもの:
idendpointdisplay_nametoken_ref(secret ref resolution が実装されるまで v0 では UI から設定不可でもよい)
保存しないもの:
- bearer token 値。
- connection health result。
- Runtime worker list。
- Runtime event cursor。
- socket path / session path。
- Runtime fs-store path。
- live connection handle。
Backend API 設計
Workspace Backend に Runtime connection settings API を追加する。
候補:
GET /api/settings/runtime-connections
POST /api/settings/runtime-connections
DELETE /api/settings/runtime-connections/{id}
POST /api/settings/runtime-connections/{id}/test
GET
返すもの:
- embedded Runtime summary。
- persisted remote Runtime connection configs。
- live RuntimeRegistry projection との対応。
- sanitized diagnostics。
返さないもの:
- config file path。
- secret 値。
- Runtime endpoint credential。
- raw socket / session / store path。
POST
request v0:
{
"id": "remote-dev",
"endpoint": "http://127.0.0.1:8790",
"display_name": "Remote Dev Runtime"
}
v0 では token_ref は未対応でもよい。対応する場合も raw token 値は受け取らず、secret ref だけにする。
挙動:
- id / endpoint / display_name を validate する。
- duplicate id は拒否する。
.yoi/workspace-backend.local.tomlを read-modify-write する。- unknown TOML fields を壊さない方針が必要。実装が難しい場合は typed schema 全体を parse/serialize し、comments が失われることを diagnostic / docs に明記する。
DELETE
- 指定 id の remote Runtime connection を config から削除する。
- embedded Runtime は削除不可。
- 存在しない id は typed diagnostic。
TEST
- config を保存せず、endpoint に接続可能か確認する。
- v0 では lightweight
GET /health相当または Runtime HTTP summary endpoint を使う。 - secret / token が必要な Runtime は v0 では未対応 diagnostic でもよい。
Live反映方針
v0 は config persistence を優先し、live RuntimeRegistry への hot register/unregister は必須にしない。
選択肢:
- config 更新後に
restart_required = trueを返す。 - 追加だけ live register し、削除は restart required にする。
- 追加・削除とも live反映する。
この Ticket の v0 は 1 を基本とする。UI は「保存後、Backend restart で有効化」と表示する。
理由:
- RuntimeRegistry の unregister は worker selection / observation / console subscription への影響がある。
- live health と persisted config を混ぜると責務が増える。
- まずは永続 config 管理を作り、live反映は別 Ticket に分けられる。
UI 設計
Settings / Runtime Connections 画面を追加する。
表示:
- Embedded Runtime
- id
- display name
- built-in badge
- status / diagnostics
- delete不可
- Remote Runtime connections
- id
- display name
- endpoint
- persisted / active / restart required status
- Test
- Delete
追加 form:
- id
- display name
- endpoint
v0 では token / secret input は出さない。secret ref 対応を入れる場合は separate field とし、raw token 値を入力・保存しない。
Config read/write boundary
.yoi/workspace-backend.local.toml は既に WorkspaceBackendConfigFile として parse される。Runtime connection management はこの file を read-modify-write する。
要確認:
- comments を維持するか。
- formatting を維持するか。
- unknown fields の扱い。
v0 は typed TOML serialize で comments が失われてもよいが、その場合は実装 report と docs に明記する。comments を維持したい場合は TOML document editing crate の導入を検討する。
実装要件
- Runtime connection settings API を追加する。
.yoi/workspace-backend.local.tomlの[[runtimes.remote]]を read-modify-write できる。- embedded Runtime は built-in connection として表示され、削除不可。
- remote Runtime connection の add/delete/test ができる。
- v0 では config 更新後
restart_required = trueを返す。 - raw token 値を request / response / config file に持たない。
- RuntimeRegistry live state と persisted config を混同しない。
- Settings / Runtime Connections UI を追加する。
- Manual Coding Worker 作成 UI で使う Runtime candidate 情報に接続できる projection を用意する。
受け入れ条件
- Runtime Connections 管理画面がある。
- embedded Runtime が built-in / delete不可として表示される。
- remote Runtime connection を追加でき、
.yoi/workspace-backend.local.tomlに保存される。 - remote Runtime connection を削除でき、config から消える。
- remote Runtime connection の test ができる、または v0 未対応条件では typed diagnostic が返る。
- config 更新 response が
restart_required = trueを返す。 - raw token 値を UI/API/config に保存・表示しない。
- Runtime endpoint credential / socket path / session path / Runtime store path が Browser-facing API に漏れない。
- duplicate id / invalid endpoint / embedded delete attempt が typed diagnostic になる。
- Focused tests が API list/add/delete/test、config persistence、sanitization、restart_required、UI render/submit path を確認する。
cd web/workspace && deno task testが通る。cd web/workspace && deno task checkが通る。cargo test -p yoi-workspace-serverが通る。cargo check -p yoiが通る。git diff --checkが通る。nix build .#yoi --no-linkが通る。
対象外
- RuntimeRegistry の live unregister 完成。
- Remote Runtime workspace provisioning。
- Secret store UI。
- raw bearer token の保存。
- Manual Coding Worker 作成 form の実装。
- Runtime health monitoring daemon。
- Runtime event cursor 永続化。