ticket: plan worker runtime transition

This commit is contained in:
Keisuke Hirata 2026-06-25 23:09:25 +09:00
parent 193c868146
commit b367abd76a
No known key found for this signature in database
12 changed files with 682 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVZ9JGK0",
"kind": "depends_on",
"target": "00001KVZBCQH4",
"note": "Backend internal Companion should run on the embeddable Runtime API.",
"author": "yoi ticket",
"at": "2026-06-25T13:25:34Z"
}
]
}

View File

@ -0,0 +1,123 @@
---
title: 'Backend内蔵Companion RuntimeとWeb Console MVP'
state: 'planning'
created_at: '2026-06-25T11:45:17Z'
updated_at: '2026-06-25T13:25:34Z'
assignee: null
---
## 背景
Workspace backend は Worker runtime registry / Backend internal runtime を control plane として扱う方向に進んでいる。Orchestrator については Backend internal runtime 上の Worker として Kanban / Ticket event を routing する設計が固まりつつある。同じ考え方で、Companion も local Pod / TUI 専用ではなく、Backend internal runtime 上の lightweight Worker として起動し、Web frontend から接続できるようにしたい。
この Ticket では、TUI Console の Web 移植版に向けた MVP として、Backend internal Companion Worker にメッセージを送り、LLM 応答を Web frontend で受け取るところまでを実装する。Companion は v0 では filesystem / shell / ticket mutation / runtime operation tools を持たなくてよい。まずは tools なしの conversational Worker として、Backend internal runtime、Web API、Web console UI、stream / transcript projection の最小経路を作る。
## 目的
- Backend internal runtime 上で Companion Worker を起動・保持できる。
- Workspace web frontend から Companion に接続できる。
- Web console UI から message を送信し、Companion の応答を表示できる。
- TUI Console の基本体験を Web に移植するための最小 transcript / run status / input path を作る。
- v0 では tool authority を持たせず、Backend internal conversational Worker として安全に始める。
## 要件
### Backend internal Companion runtime
- Backend internal runtime 上に Companion Worker を表現する。
- Companion は local Pod process / Unix socket / `.yoi/pods` metadata に依存しない。
- Worker identity は runtime scoped に扱う。
- `runtime_id`
- `worker_id`
- `display_name`
- `display_ref` 例: `companion@backend-internal`
- Runtime registry / Worker list/detail から Backend internal Companion が見える。
- v0 Companion は tools なし、または明示的に empty tool registry / minimal safe tool registry とする。
- Workspace filesystem、shell、git、Ticket mutation、raw session path、raw socket path を Companion authority にしない。
### Conversation / transcript model
- Backend internal Companion に user message を送れる API を追加する。
- Assistant response を Web frontend が受け取れるようにする。
- v0 は以下のどちらかの方式でよい。
- request / response 完了後に transcript を返す。
- SSE / streaming endpoint で delta / final response を返す。
- 実装方式は実装時に選んでよいが、UI が「送る -> 返る」を確認できること。
- Backend は raw provider trace を durable authority にしない。
- Web console 用 transcript は bounded projection とし、将来 prune / overview 化できる形にする。
- usage aggregate / run status は取れる範囲で残す。v0 で詳細 dashboard は不要。
### Web API
- Workspace server に Companion connection / message API を追加する。
- API は browser から raw runtime path / socket path / session path を受け取らない。
- API は current workspace の Backend internal Companion を解決する。
- 最低限以下を扱う。
- Companion status / detail 取得。
- Transcript / conversation projection 取得。
- User message 送信。
- Assistant response 取得または stream。
- Error は typed response として扱う。
- companion unavailable
- already running / busy
- invalid input
- provider error
- response timeout / cancelled
### Web Console UI
- Workspace web に Companion Console 画面または panel を追加する。
- TUI Console の基本 UI を Web 向けに移植する。
- transcript 表示。
- user message composer。
- sending / generating / idle / error 状態表示。
- assistant response の表示。
- v0 は message round-trip が主目的であり、TUI Console の全機能移植は不要。
- tool call UI、file viewer、diff viewer、thinking block grouping、multi Pod attach は scope 外でよい。
- Web UI は Backend API response / stream を authority とし、local session file / Pod socket を直接読まない。
### Runtime / LLM integration
- Backend internal Companion は existing LLM worker / provider config / profile selection のどれを使うか実装時に決める。
- v0 では project/default Companion profile の完全継承は必須ではないが、model / provider / language / prompt selection の最小方針を明確にする。
- Companion prompt は Rust 直書きではなく prompt resource boundary を使う。
- tools なし Companion でも system prompt / conversation history / current workspace identity は最小限渡せるようにする。
- Long-running provider request 中に複数 message を送った場合の扱いを決める。
- v0 は single-flight / busy reject でよい。
### Safety / authority
- Browser は raw provider credential、socket path、session path、runtime file path を知らない。
- Backend internal Companion は workspace filesystem / shell / git / Ticket mutation authority を持たない。
- 将来 tool を追加する場合も、domain-specific backend operation / explicit grant 経由にする。
- User message / assistant response は normal conversation history として扱い、hidden context injection にしない。
- Provider error / cancellation / timeout は Web UI に明示する。
## Non-goals
- Full TUI Console parity。
- Tool call execution UI。
- Filesystem / shell / git / Ticket mutation tools を Companion に渡すこと。
- Local Pod Companion の廃止。
- Remote runtime implementation。
- Multi-user auth / permission model の完成。
- Persistent raw session DB ingest。
- Usage dashboard の完成。
- Orchestrator routing / Kanban integration。
## 受け入れ条件
- Backend internal runtime 上に Companion Worker が存在し、runtime / worker API から確認できる。
- Web frontend から Backend internal Companion の status / transcript projection を取得できる。
- Web frontend の Console UI から user message を送信できる。
- Companion が LLM response を生成し、Web UI に表示される。
- v0 Companion は filesystem / shell / git / Ticket mutation tools を持たない。
- Browser が raw socket path / session path / runtime path / provider credential を扱わない。
- Provider request 中の busy / error / timeout が typed error または UI state として扱われる。
- Prompt prose は resource boundary に置かれている。
- Focused backend / frontend tests が追加されている、または E2E 不足の場合はテスト可能範囲と手動確認手順が記録されている。
- `cargo test -p yoi-workspace-server` が通る。
- `cargo check -p yoi` が通る。
- `cd web/workspace && deno task check && deno task build` が通る。
- `git diff --check` が通る。
- `nix build .#yoi --no-link` が通る。

View File

@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-25T11:45:17Z -->
## 作成
LocalTicketBackend によって作成されました。
---

View File

@ -0,0 +1,21 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVZBCQH4",
"kind": "depends_on",
"target": "00001KVZD10ED",
"note": "Runtime crate API should use llm-engine naming for the turn engine before defining Worker types.",
"author": "yoi ticket",
"at": "2026-06-25T13:25:34Z"
},
{
"ticket_id": "00001KVZBCQH4",
"kind": "depends_on",
"target": "00001KVZG9BMS",
"note": "Worker Runtime should be created after the former pod crate is renamed to worker as the single Worker host.",
"author": "yoi ticket",
"at": "2026-06-25T13:43:31Z"
}
]
}

View File

@ -0,0 +1,147 @@
---
title: '組み込み/ネットワーク対応Worker Runtime crateを作る'
state: 'planning'
created_at: '2026-06-25T12:17:05Z'
updated_at: '2026-06-25T13:43:31Z'
assignee: null
---
## 背景
Yoi は現在、Worker 的な実行単位を主に `yoi pod` process / Unix socket / pod metadata / session jsonl として扱っている。一方で今後は、Companion や routing-only Orchestrator を Backend process 内に組み込んだ Runtime 上の Worker として動かし、Coder / Reviewer などは local / remote host 上の Runtime process で動かしたい。
このため、Backend が持つ `RuntimeRegistry` や Workspace API の都合ではなく、**Worker を動かす環境そのものとしての Runtime** を独立した crate / library API として定義する必要がある。`RuntimeRegistry` は Backend が embedded Runtime と remote Runtime をまとめて同じようにアクセスするための集約境界であり、Runtime 自体の実装主体ではない。
この Ticket では、まず要件だけを整理する。実装前に、現在の `pod`、`llm-worker`、Panel / Workspace backend における Pod / Worker 扱いを調査し、既存構造から Runtime crate へ移すべき責務と adapter として残すべき責務を把握する。
## 要件
### Runtime crate の位置付け
- `crates/worker-runtime` を Worker を動かす実行環境の正体として設計する。
- `worker-runtime/lib.rs` は Backend などに組み込める embeddable Runtime API を公開する。
- `worker-runtime/main.rs` は同じ Runtime を network API で公開する Runtime process を起動する。
- Runtime process と embedded Runtime は Worker semantics を二重実装しない。
- Worker lifecycle / input / output / event / transcript projection は lib 側を正とする。
- main binary は config / API server / transport / shutdown wrapper に留める。
### Runtime / Worker model
- Runtime は Worker を動かす環境であり、trait object ではなく domain entity / concrete runtime implementation として扱う。
- Runtime は複数 Worker を保持・起動・停止・操作できる。
- Worker identity は Runtime scoped とする。
- `runtime_id`
- `worker_id`
- UI 用 `display_name` / `display_ref`
- Browser / API / Backend は `runtime_id + worker_id` を authority とし、`pod_name` / socket path / session path を authority にしない。
- Runtime は capability / status / diagnostics を返す。
- backend internal
- local process capable
- future remote host capable
- filesystem / shell / git / worktree capability
- tools availability
### Embeddable Runtime API
- Backend は `Runtime` を process 内に直接組み込める。
- Embedded Runtime は tools なし Companion のような Worker を local process / socket なしで動かせる。
- API は少なくとも以下の操作を表現できる。
- runtime summary / status
- worker list / detail
- create worker
- send input
- stop / cancel worker
- bounded transcript projection
- event subscription または event cursor
- usage / overview projection
- v0 は single-flight / busy reject でよい。
- raw provider trace / raw session full log を Backend durable authority にしない。
### Networked Runtime process API
- `worker-runtime/main.rs` は Runtime を network API として公開する。
- 将来、別ホストの Runtime process に Backend が接続し、remote Worker を local / internal Worker と同じ概念で扱えるようにする。
- Network API は command と observation を分ける。
- command: create / input / stop / cancel
- observation: worker status / transcript projection / events
- v0 transport は実装時に選ぶが、HTTP command + SSE/WebSocket event stream を想定可能な shape にする。
- Browser が remote Runtime へ直接 authority-bearing request を送るのではなく、Backend registry / policy 経由にする。
### Backend RuntimeRegistry との関係
- Workspace backend の `RuntimeRegistry` は、embedded Runtime と remote Runtime client をまとめる集約境界とする。
- Registry は Worker を実行しない。
- Registry は runtime lookup / policy / visibility / API projection / current workspace filtering を担う。
- Backend internal Companion は embedded Runtime に載る Worker として扱う。
- Existing local Pod / process-based Worker は Runtime の adapter または移行対象として扱う。
### Existing Worker / LLM engine migration boundary
- `llm-worker` は先に `llm-engine` へ改名し、LLM turn engine と実行単位としての Worker を名前上分離する。
- 既存 `pod` crate は先に `worker` crate へ rename し、single Worker host として扱う。
- 既存 `yoi pod` process は当面 compatibility / process-backed Worker adapter として扱えるようにする。
- 最終的には process boundary を Worker ではなく Runtime に寄せる。
- Runtime process が複数 Worker を保持できる。
- Worker ごとに subprocess を持つかどうかは Runtime implementation detail とする。
- `llm-engine` の provider streaming / tool execution / history integration のうち、Runtime crate に移すべきものと Worker-specific に残すものを調査して整理する。
- `worker` crate の Unix socket protocol / metadata / session persistence / TUI attach semantics は、Runtime API との対応を調査してから移行方針を決める。
### Pod-named store / registry migration boundary
- `pod-store` / `pod-registry` は standalone crate として rename せず、`worker-runtime` 作成時に Runtime 内部 module へ直接統合する。
- `pod-store` 相当は Runtime 内部の Worker metadata / transcript projection / config snapshot persistence module とする。
- `pod-registry` 相当は Backend RuntimeRegistry ではなく、Runtime 内部の live Worker allocation / scope conflict / stale reclaim module とする。
- Backend `RuntimeRegistry` は embedded / remote Runtime を束ねる集約境界であり、Worker store / live allocation authority を直接持たない。
- 後方互換 alias / standalone `worker-store` / standalone `worker-registry` / old crate compatibility / old on-disk migration は設けない。
### Safety / authority
- Runtime API は raw socket path / session path / local metadata path を公開 API authority にしない。
- Worker tool authority は Runtime / Worker config / explicit grant で決める。
- Backend internal Companion v0 は filesystem / shell / git / Ticket mutation tools を持たない。
- Remote Runtime との接続では将来 auth / permission / network safety を挟める境界を残す。
## 調査事項
実装前に以下を調査する。
- `crates/pod` が現在担っている責務。
- process entrypoint
- socket protocol
- session persistence
- metadata / runtime dir
- in-flight snapshot / attach behavior
- tool registry / workflow / profile integration
- `crates/llm-worker` が現在担っている責務。
- provider request / streaming
- history / callback / tool-call loop
- reasoning / usage / continuation / retry
- Worker として再利用できる boundary
- Panel / TUI / Workspace backend が現在 Pod をどう扱っているか。
- Companion send path
- Worker/host list API
- Pod metadata reader
- spawn / stop / attach / event handling
- Existing `client` crate の process spawn / PodClient / socket protocol を Runtime adapter でどう扱うか。
## Non-goals
- Backend internal Companion Web Console の完成。
- Remote Runtime protocol の完成。
- Existing Pod process model の即時削除。
- Full session storage migration。
- Full tool authority redesign。
- Multi-user auth / permission model の完成。
## 受け入れ条件
この Ticket は要件整理と現状把握から開始する。ready に進める前に以下を満たす。
- `worker-runtime/lib.rs``worker-runtime/main.rs` の責務境界が整理されている。
- Runtime / Worker / RuntimeRegistry / Backend service の責務境界が整理されている。
- Runtime は Worker を動かす環境、Registry は Backend の集約境界であることが明確になっている。
- Embedded Runtime と networked Runtime process が同じ Runtime API に基づく方針が整理されている。
- Existing `worker` / `llm-engine` / Panel / Workspace backend の Worker 扱いの調査結果が記録されている。
- `pod-store` / `pod-registry` は standalone rename を挟まず、`worker-runtime` 内部 module へ直接統合する方針が整理されている。
- Backend `RuntimeRegistry` と Runtime internal store / allocation registry の責務境界が整理されている。
- 既存 Worker process model から Runtime model へ移行するための初期 implementation split が提案されている。

View File

@ -0,0 +1,246 @@
<!-- event: create author: "yoi ticket" at: 2026-06-25T12:17:05Z -->
## 作成
LocalTicketBackend によって作成されました。
---
<!-- event: comment author: hare at: 2026-06-25T12:21:06Z -->
## Comment
## 現状調査メモ: Pod / llm-worker / Panel / Workspace backend の Worker 扱い
### crates/pod
`pod` crate は現在、Worker 実行環境というより `yoi pod` process そのものの runtime を担っている。
主な責務:
- `entrypoint.rs`
- `yoi pod` CLI entrypoint。
- workspace / profile / manifest / project / store / pod name / session resume / hidden ticket-role marker を解決する。
- Profile launch policy、ticket role policy、workflow selection、resource prompt loading、tool feature install の起点を持つ。
- `pod.rs`
- `Pod` 構造体が session store、metadata、current state、scope、tool registry、workflow registry、in-flight events、LLM Worker を束ねる。
- `Method::Run` を受けて history に user input を commit し、`llm_worker::Worker::run_with_callbacks` を起動する。
- assistant/tool/reasoning/usage/error/turn_end を session log と event broadcast に反映する。
- session persistence / snapshots / compaction / workflow invocation / pod metadata 更新が同居している。
- `controller.rs` / `ipc/server.rs`
- Unix socket server。
- connect 時に `Event::Snapshot` を送る。
- JSON line method を読み、Pod controller に渡す。
- broadcaster 経由で append / status / alert / snapshot events を client に流す。
- `in_flight.rs`
- attach mid-stream 用の transient text / thinking / tool-call block accumulator。
- session log authority ではなく socket snapshot/event 用の live projection。
Runtime crate へ移す候補:
- Worker lifecycle state / busy handling / input dispatch / event projection。
- in-flight / transcript projection の汎用概念。
- Worker event / method / status の domain model。
Pod-specific に残す候補:
- `yoi pod` CLI entrypoint。
- Unix socket protocol compatibility。
- pod metadata / runtime dir / stderr ready handshake。
- session jsonl layout compatibility。
- Profile / manifest discovery の既存 startup path。
### crates/llm-worker
`llm-worker` は Pod process とは独立した LLM turn executor に近い。
主な責務:
- `Worker` が model/provider config、history、tool registry、workflow registry、memory config、prompt config、retry/continuation policy を保持する。
- `run_with_callbacks` が 1 user turn を LLM provider に投げ、stream events を callbacks に渡す。
- tool-call loop、tool execution、reasoning / usage / continuation / retry / compaction safety など、実際の LLM turn semantics を持つ。
- `CallbackHandler` / `RunCallbacks` により、Pod 側が session persistence / event broadcast / in-flight tracking を差し込む。
Runtime crate へ移す候補:
- 「Worker に input を送り response/events を得る」上位 lifecycle。
- usage / overview projection。
そのまま再利用する候補:
- provider transport / request serialization / streaming event parsing。
- tool-call loop / history-aware retry / continuation。
- callbacks abstraction。
注意点:
- `llm-worker::Worker` は既に比較的 embeddable だが、現在は `pod::Pod` が session store・event・metadata・scope と強く結合して使っている。
- Backend internal Runtime は、Pod を経由せず `llm-worker::Worker` を直接持てる可能性がある。
### crates/client
`client` crate は既存 Pod process / socket client の adapter 部分を持つ。
主な責務:
- `spawn.rs`
- `PodProcessLaunchConfig` / `PodProcessLaunchOptions`
- `yoi pod` process を起動し、stderr の `YOI-READY` と socket connectability を acceptance evidence とする。
- `pod_client.rs`
- Unix socket に接続し、connect-time snapshot / alert を drain してから method を送る。
- one-shot Pod client。
Runtime model 上の位置付け:
- `LocalProcess` / legacy Pod adapter が使う process-backed compatibility layer。
- `worker-runtime` lib の core semantics ではなく、process transport adapter 側。
### Panel / TUI
Panel / TUI は現在 Pod を socket / metadata ベースで扱う。
例:
- dashboard companion send path は Companion Pod の socket path に `UnixStream::connect` し、connect-time Snapshot/Alert を読んでから `Method::Run` を送る。
- `UserMessage` event を acceptance evidence とする。
- Panel の role/session claim や ticket row 操作は既存 Pod / role launch helper に寄っている。
Runtime model への移行方向:
- TUI/Panel は直接 socket path を authority とせず、Backend / Runtime API 経由で `runtime_id + worker_id` に input を送る方向へ移す。
- 既存 local Pod attach は compatibility path として残す。
### Workspace backend
Workspace backend は現在 `WorkerRuntimeRegistry` / `LocalPodRuntime` 相当を持つが、実行 Runtime ではなく local Pod metadata projection が中心。
主な現状:
- `crates/workspace-server/src/hosts.rs`
- `WorkspaceWorkerRuntime` trait、`WorkerRuntimeRegistry`、`LocalPodRuntime` が存在する。
- `LocalRuntimeBridge = LocalPodRuntime` alias が残る。
- `/api/hosts`, `/api/workers`, `/api/hosts/{host_id}/workers` は registry 経由で worker summaries を返す。
- LocalPodRuntime は `.yoi/pods/*/metadata.json` を読み、runtime/worker projection を作る。
- `spawn_worker` 等の typed shape はあるが、実 operation は unsupported / pending に近い。
- Backend internal LLM Worker runtime はまだ存在しない。
Runtime model への移行方向:
- Workspace backend の Registry は `worker-runtime::Runtime` または network Runtime client を束ねる集約境界にする。
- `LocalPodRuntime` は本来の Runtime ではなく、既存 Pod metadata/socket を Worker projection に見せる compatibility adapter として扱う。
- Backend internal Companion は `worker-runtime::Runtime` を embedded に持ち、その Runtime 内の Worker として作る。
### 初期 implementation split 案
1. `worker-runtime` crate skeleton。
- `RuntimeId` / `WorkerId` / `WorkerRef` / status / summary / input / event / transcript projection / error 型。
- `Runtime` concrete struct の最小 shell。
- worker list/detail/send_input の mock or no-op capable core。
2. Backend に embedded Runtime を組み込む。
- Workspace backend の Registry に embedded Runtime handle を登録。
- まだ LLM は mock でもよい。
3. `llm-worker` を使った tools なし in-process Worker。
- single-flight。
- transcript projection。
- usage/error projection。
4. Existing LocalPodRuntime を compatibility adapter として明示化。
- metadata reader / socket send は adapter 側。
- PodProcessLaunchConfig は process-backed path に閉じる。
5. `worker-runtime` binary / network API。
- 同じ Runtime lib を起動して HTTP command + event observation API を公開する。
6. Web Companion Console MVP。
- Backend embedded Runtime 上の companion Worker に message round-trip。
---
<!-- event: decision author: hare at: 2026-06-25T13:14:10Z -->
## Decision
## 追加調査メモ: pod-store / pod-registry の役割と移行方針
### pod-store
`pod-store``{data_dir}/pods/{pod_name}/metadata.json` を扱う name-keyed metadata store である。主な内容は active session/segment pointer、workspace_root、spawned/reclaimed children、peers、resolved_manifest_snapshot。
これは正規 Worker Runtime の永続化層としては粒度と authority が古い。
- identity が `pod_name` 中心。
- socket/process/session restore を前提にした metadata が混ざる。
- child/peer relation は Runtime/Worker records と orchestration records に分解すべき。
- session pointer は Runtime-local transcript/run projection として扱うべき。
短期対応として `worker-store` に rename するが、最終的には `worker-runtime` 内部の persistence module に統合する。
### pod-registry
`pod-registry``<runtime_dir>/pods.json` の flock-protected live allocation table である。主な内容は pod_name、pid、socket path、scope allow/deny、delegated_from、segment_id。
これは Backend の RuntimeRegistry とは別物で、旧 local Pod process 群の machine-wide scope lock / delegation / stale reclaim である。Runtime model では、Worker allocation は Runtime 内部の責務になる。
- 同一 Runtime 内 Worker の scope conflict は Runtime の allocation manager が扱う。
- remote Runtime の allocation は remote Runtime 側の authority。
- host-level conflict が必要な場合も Pod registry ではなく Runtime/host allocation model として設計する。
短期対応として `worker-registry` に rename するが、最終的には `worker-runtime` 内部の allocation / scope_registry module に統合する。
### 決定
- `pod-store` / `pod-registry` は正規 architecture では役目を終える。
- ただし即削除ではなく、まず `worker-store` / `worker-registry` へ rename し、Pod terminology を active API から外す。
- 後続 Ticket で standalone crates を削除し、`worker-runtime` 内部 module に統合する。
- 後方互換 alias / old path migration は設けない。
---
<!-- event: decision author: hare at: 2026-06-25T13:25:49Z -->
## Decision
Implementation order is now recorded with depends_on relations:
1. 00001KVZD10ED llm-worker crateをllm-engineへ改名する
2. 00001KVZEHJG1 pod-store/pod-registry crateをWorker用語へ改名する
3. 00001KVZBCQH4 組み込み/ネットワーク対応Worker Runtime crateを作る
4. 00001KVZEHJGT worker store/registryをworker-runtimeへ統合する
5. 00001KVZ9JGK0 Backend内蔵Companion RuntimeとWeb Console MVP
The key boundary is that Backend RuntimeRegistry aggregates Runtime instances, while worker store/allocation belongs inside worker-runtime after the transitional rename step.
---
<!-- event: decision author: hare at: 2026-06-25T13:30:09Z -->
## Decision
Decision update: skip the standalone worker-store / worker-registry rename step.
The implementation order is now:
1. 00001KVZD10ED llm-worker crateをllm-engineへ改名する
2. 00001KVZBCQH4 組み込み/ネットワーク対応Worker Runtime crateを作る
3. 00001KVZ9JGK0 Backend内蔵Companion RuntimeとWeb Console MVP
`pod-store` and `pod-registry` should be handled during the worker-runtime implementation itself: do not create standalone `worker-store` / `worker-registry` transitional crates. Move their relevant responsibilities directly into worker-runtime internal persistence/allocation modules, and leave Pod-specific compatibility as adapter detail only where still needed.
---
<!-- event: decision author: hare at: 2026-06-25T13:43:31Z -->
## Decision
Implementation order update:
1. 00001KVZD10ED llm-worker crateをllm-engineへ改名する
2. 00001KVZG9BMS pod crateをworker crateへ改名する
3. 00001KVZBCQH4 組み込み/ネットワーク対応Worker Runtime crateを作る
4. 00001KVZ9JGK0 Backend内蔵Companion RuntimeとWeb Console MVP
The pod -> worker step is a rename, not a rewrite. Runtime creation absorbs the former pod-store / pod-registry responsibilities directly into worker-runtime internal persistence/allocation modules; do not create standalone worker-store / worker-registry crates.
---

View File

@ -0,0 +1,13 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVZG9BMS",
"kind": "depends_on",
"target": "00001KVZD10ED",
"note": "Rename llm-worker to llm-engine first so Worker naming is available for the former pod crate.",
"author": "yoi ticket",
"at": "2026-06-25T13:43:31Z"
}
]
}

View File

@ -0,0 +1,88 @@
---
title: 'pod crateをworker crateへ改名する'
state: 'ready'
created_at: '2026-06-25T13:42:37Z'
updated_at: '2026-06-25T14:08:22Z'
assignee: null
---
## 背景
Yoi は旧 `Pod` 相当の実行単位を今後 `Worker` として扱い、`Runtime` が複数 Worker を保持・操作する構造へ移行する。既存の `crates/pod` は、現在の `yoi pod` process / Unix socket / session persistence / tool registry / workflow / `llm-engine` turn execution host を束ねる実行単位の本体であり、実質的には「single Worker host」である。
`llm-worker``llm-engine` に改名して LLM turn engine から `Worker` 名を空ける。その後、`pod` crate を rewrite ではなく rename として `worker` crate に寄せる。大規模な責務移動はこの Ticket では行わず、名前と公開 API を今後の Runtime/Worker model に合わせる。`pod-store` / `pod-registry` 相当の責務は、この rename Ticket では直接扱わず、後続の `worker-runtime` 作成時に Runtime 内部 persistence / allocation module として吸収する。
## 目的
- 旧 `Pod` 実行単位を `Worker` として命名し直す。
- `worker-runtime` 導入前に、`Worker` が実行単位、`llm-engine` が turn engine、`Runtime` が Worker を動かす環境、という命名を揃える。
- 既存 `pod` crate の実装は基本 rewrite せず、rename / import path / type name / docs / tests を整理する。
- 後続の `worker-runtime` crate が `worker` crate を single Worker host として扱える状態にする。
## 要件
### Crate / package rename
- `crates/pod``crates/worker` に rename する。
- Cargo package name を `pod` から `worker` に変更する。
- Rust import path を `pod` から `worker` に変更する。
- Workspace `Cargo.toml`、crate dependencies、tests、docs、Nix packaging references を更新する。
- 旧 crate name / import path の compatibility alias は作らない。
### Type / module rename
- Public type / module / doc comment の `Pod` terminology を Worker terminology に更新する。
- `Pod` -> `Worker`
- `PodConfig` / `PodController` / `PodState` / `PodEvent` 相当があれば Worker terminology に寄せる。
- `pod_name``worker_name` または `worker_id` 相当へ寄せる。
- ただし、既存 socket protocol / session file / on-disk compatibility の詳細に残る `pod` 文字列については、後続 Runtime 移行で消すべき legacy detail として明示的に扱う。
- `llm-engine` 内部の `Engine` と、実行単位としての `worker::Worker` が名前上衝突しないようにする。
### CLI / process surface
- 現在の `yoi pod` CLI surface をどう rename するかを実装時に決める。
- 後方互換は設けなくてよいが、dogfooding runtime / spawn path / scripts / tests への影響を明示的に処理する。
- Low-level process launch path は、後続の `worker-runtime` では compatibility / process-backed Worker host として扱えるようにする。
### Responsibility boundary
- この Ticket は rename が主目的であり、大規模な responsibility rewrite はしない。
- `worker` crate は当面 single Worker host として以下を保持する。
- input handling
- `llm-engine` integration
- event emission
- session / transcript compatibility
- tool registry / workflow integration
- legacy socket compatibility
- Runtime に属する責務は後続 Ticket へ残す。
- 複数 Worker 管理
- embedded / networked Runtime API
- worker store / allocation integration
- remote runtime support
- `pod-store` / `pod-registry` の standalone rename は行わず、後続 `worker-runtime` 作成時に直接内部 module へ吸収する。
## Non-goals
- `worker-runtime` crate の実装。
- Backend internal Companion Web Console の実装。
- `pod-store` / `pod-registry``worker-store` / `worker-registry` への中間 rename。
- Runtime 内部 persistence / allocation module の完成。
- Existing process/socket/session model の完全削除。
- `llm-engine` rename の実装。
- Provider request / tool-call loop / history semantics の変更。
## 受け入れ条件
- `crates/worker` が存在し、`crates/pod` は残っていない。
- Cargo package name and Rust import path are `worker`.
- Public execution-unit type is `worker::Worker`, not `pod::Pod`.
- Repository-wide active references to `pod` crate / `pod::` import / `crates/pod` are gone except intentionally documented legacy context.
- Dependent crates compile against `worker` crate.
- `llm-engine::Engine``worker::Worker` の責務境界が code/docs/comments 上で明確になっている。
- Existing process/socket/session compatibility path still works or is explicitly updated without old-name alias.
- `pod-store` / `pod-registry` are not renamed to standalone `worker-store` / `worker-registry` in this Ticket.
- `cargo test -p worker` passes.
- `cargo test -p yoi` or relevant CLI tests covering process launch pass.
- `cargo check -p yoi` passes.
- `git diff --check` passes.
- `nix build .#yoi --no-link` passes.

View File

@ -0,0 +1,24 @@
<!-- event: create author: "yoi ticket" at: 2026-06-25T13:42:37Z -->
## 作成
LocalTicketBackend によって作成されました。
---
<!-- event: intake_summary author: hare at: 2026-06-25T14:08:22Z -->
## Intake summary
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-25T14:08:22Z from: planning to: ready reason: cli_state field: state -->
## State changed
Marked ready by `yoi ticket state`.
---