From bbe669412208ea184d1d05b7bcb804ef288ef4a0 Mon Sep 17 00:00:00 2001 From: Hare Date: Wed, 8 Jul 2026 17:35:01 +0900 Subject: [PATCH] ticket: workspace profile settings api --- .yoi/tickets/00001KX0DSMPT/artifacts/.gitkeep | 0 .yoi/tickets/00001KX0DSMPT/item.md | 124 ++++++++++++++++++ .yoi/tickets/00001KX0DSMPT/thread.md | 7 + 3 files changed, 131 insertions(+) create mode 100644 .yoi/tickets/00001KX0DSMPT/artifacts/.gitkeep create mode 100644 .yoi/tickets/00001KX0DSMPT/item.md create mode 100644 .yoi/tickets/00001KX0DSMPT/thread.md diff --git a/.yoi/tickets/00001KX0DSMPT/artifacts/.gitkeep b/.yoi/tickets/00001KX0DSMPT/artifacts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.yoi/tickets/00001KX0DSMPT/item.md b/.yoi/tickets/00001KX0DSMPT/item.md new file mode 100644 index 00000000..a08c9fc8 --- /dev/null +++ b/.yoi/tickets/00001KX0DSMPT/item.md @@ -0,0 +1,124 @@ +--- +title: 'Add Workspace settings API and pages for Workspace/Profile editing' +state: 'planning' +created_at: '2026-07-08T08:34:01Z' +updated_at: '2026-07-08T08:34:01Z' +assignee: null +--- + +## 背景 + +Workspace Backend は Browser/product Workspace の正本側であり、現状の local backend では Workspace 情報や Profile source を filesystem / project records から読んでいる。一方、Browser には Workspace 情報や Profiles を確認・編集するための明示的な API / 操作ページが十分にない。 + +Runtime は Workspace filesystem を直接読まない方向にするため、Workspace metadata、Profile registry、Lua Profile artifact、override snapshot などの Workspace-derived config は Backend が管理・編集・検証し、Frontend は Backend API 経由で操作する必要がある。 + +本 Ticket は、Runtime 連携ではなく、Backend <-> Front の Workspace/Profile 管理面を作る実装 slice とする。 + +## 実装目的 + +- Browser から Workspace 情報を確認・編集できる。 +- Browser から Workspace/Profile source を確認・編集できる。 +- Backend API が Workspace/Profile editing の authority になり、Frontend は filesystem path を直接扱わない。 +- Profile editing 後に、Backend 側の Profile discovery / validation / launch options に反映される。 +- Secret value、Runtime endpoint、host absolute path、runtime-local store path を Browser-facing API に出さない。 + +## 実装内容 + +### 1. Workspace settings API を追加する + +`/api/w//settings` 配下に、Workspace metadata と Profile settings を扱う typed API を追加する。 + +v0 で扱う Workspace metadata: + +- display name。 +- workspace id / read-only identity summary。 +- repository registry summary / read-only configured repositories。 +- Backend local source summary。host absolute path は出さず、safe label / source kind / status だけを出す。 + +v0 で扱う Profile metadata: + +- discovered profile registry entries。 +- builtin profile entries。 +- workspace/project profile entries。 +- selected source kind / profile selector / label / role metadata。 +- validation diagnostics。 + +### 2. Profile source read API を追加する + +Frontend が Profiles を編集するため、Backend が safe Profile source model を返す。 + +実装すること: + +- workspace/project `profiles.toml` 相当の registry を structured model として返す。 +- Lua Profile artifact を safe id で参照して読み出せる。 +- local require module は Profile artifact に紐づく bounded artifact として返す。 +- Browser-facing response は raw absolute path ではなく `profile_source_id` / `artifact_id` / safe display path を使う。 +- artifact size / unsupported source / symlink escape / path escape は typed diagnostic にする。 + +### 3. Profile source write API を追加する + +Browser から Profile registry / Lua Profile artifact を更新できる typed mutation API を追加する。 + +実装すること: + +- registry entry の create / update / delete。 +- Lua Profile artifact の create / update / delete。 +- local require module の create / update / delete は v0 で必要なら bounded module root 内だけ許可する。 +- write 前に syntax / schema / selector uniqueness / path safety を検証する。 +- write 後に Profile discovery を再実行し、diagnostics と effective profile list を返す。 +- concurrent update には revision / etag / updated_at 相当の optimistic check を使う。 + +### 4. Frontend の Workspace settings pages を追加する + +既存 SvelteKit workspace-scoped route 配下に settings pages を追加・拡張する。 + +想定 route: + +- `/w//settings` Workspace overview settings。 +- `/w//settings/profiles` Profile list / validation diagnostics。 +- `/w//settings/profiles/` Profile source editor。 + +UI 要件: + +- Workspace display name を編集できる。 +- Profile list を source kind / selector / label / diagnostics 付きで見られる。 +- Profile registry を編集できる。 +- Lua Profile artifact を textarea/editor で編集できる。 +- 保存前後の validation diagnostics を表示する。 +- raw absolute path、Runtime endpoint、secret value を表示しない。 +- Browser WorkingDirectory / Worker launch の profile candidates と同じ Backend discovery 結果を見られる。 + +### 5. Change notification / invalidation を追加する + +Profile source が更新されたとき、Backend 内の derived Profile state を invalidation する。 + +実装すること: + +- Profile discovery cache がある場合は更新後に破棄・再構築する。 +- Worker launch options API が更新後の Profile candidates を返す。 +- 将来の Runtime profile resolution input builder が、更新後の source snapshot を使える状態にする。 +- Runtime への直接 sync は本 Ticket の非目標とし、必要なら後続 Ticket に委譲する。 + +## 受け入れ条件 + +- Workspace-scoped Browser API で Workspace metadata を read/update できる。 +- Workspace-scoped Browser API で Profile registry / Profile artifact を read/update できる。 +- Frontend に Workspace settings page と Profiles settings page が追加されている。 +- Profile source update 後、Backend の Profile discovery / launch options に変更が反映される。 +- Profile selector duplicate、invalid registry schema、invalid Lua syntax、path escape、symlink escape、artifact too large、concurrent update conflict は typed diagnostic になる。 +- Browser-facing API / UI に host absolute path、secret value、Runtime endpoint、socket/session path、runtime-local store path が露出しない。 +- Browser WorkingDirectory / Worker launch の profile candidates と settings page の profile list が同じ Backend discovery 結果を使う。 +- `cargo test -p yoi-workspace-server` が通る。 +- `cargo check -p yoi` が通る。 +- `cd web/workspace && deno task check && deno task test` が通る。 +- `yoi ticket doctor` が通る。 +- `nix build .#yoi --no-link` が通る。 + +## 非目標 + +- Runtime が Profile resolution input を受け取る経路の実装。 +- Runtime-local plugin / MCP / sandbox artifact sync。 +- Secret value editor。 +- Multi-user auth / RBAC。 +- Monaco 等の heavyweight code editor 導入。 +- Ticket / Objective / Memory の編集画面統合。 diff --git a/.yoi/tickets/00001KX0DSMPT/thread.md b/.yoi/tickets/00001KX0DSMPT/thread.md new file mode 100644 index 00000000..3cf8a03c --- /dev/null +++ b/.yoi/tickets/00001KX0DSMPT/thread.md @@ -0,0 +1,7 @@ + + +## 作成 + +LocalTicketBackend によって作成されました。 + +---