ticket: split worker runtime implementation
This commit is contained in:
parent
d93dbc0533
commit
befbabe13a
|
|
@ -4,10 +4,10 @@
|
|||
{
|
||||
"ticket_id": "00001KVZ9JGK0",
|
||||
"kind": "depends_on",
|
||||
"target": "00001KVZBCQH4",
|
||||
"note": "Backend internal Companion should run on the embeddable Runtime API.",
|
||||
"target": "00001KVZKSV6C",
|
||||
"note": "Backend internal Companion Web Console should build on Backend RuntimeRegistry integration with worker-runtime.",
|
||||
"author": "yoi ticket",
|
||||
"at": "2026-06-25T13:25:34Z"
|
||||
"at": "2026-06-25T14:45:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,147 +1,96 @@
|
|||
---
|
||||
title: '組み込み/ネットワーク対応Worker Runtime crateを作る'
|
||||
title: 'worker-runtime core crateと組み込みRuntime APIを作る'
|
||||
state: 'planning'
|
||||
created_at: '2026-06-25T12:17:05Z'
|
||||
updated_at: '2026-06-25T13:43:31Z'
|
||||
updated_at: '2026-06-25T14:48:23Z'
|
||||
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 で動かしたい。
|
||||
Yoi は旧 `Pod` 相当の実行単位を今後 `Worker` として扱い、`Runtime` が複数 Worker を保持・操作する構造へ移行する。`llm-worker` は `llm-engine` へ改名し、既存 `pod` crate は `worker` crate へ改名する。次に必要なのは、Backend が持つ `RuntimeRegistry` ではなく、**Worker を実際に動かす環境そのものとしての Runtime** を library として定義することである。
|
||||
|
||||
このため、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 として残すべき責務を把握する。
|
||||
この Ticket は `worker-runtime` 全体を一括実装する umbrella ではない。最初の実装 slice として、HTTP server、WebSocket/SSE server、FS 永続化、remote client は含めず、Backend などに組み込める `worker-runtime` core crate と memory-backed embedded Runtime API を作る。
|
||||
|
||||
## 要件
|
||||
|
||||
### Runtime crate の位置付け
|
||||
### Crate / feature boundary
|
||||
|
||||
- `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 に留める。
|
||||
- `crates/worker-runtime` を追加する。
|
||||
- `worker-runtime/lib.rs` は embeddable Runtime core API を公開する。
|
||||
- この Ticket では `worker-runtime/main.rs` / standalone Runtime process は実装しない。
|
||||
- Core crate は HTTP server / WebSocket server / filesystem store dependency を強制しない。
|
||||
- Cargo feature の土台だけは切ってよい。
|
||||
- `memory-store` or core default。
|
||||
- 将来の `fs-store`。
|
||||
- 将来の `http-server`。
|
||||
- 将来の `event-stream` / `ws-server`。
|
||||
- 将来の `http-client`。
|
||||
|
||||
### Runtime / Worker model
|
||||
|
||||
- Runtime は Worker を動かす環境であり、trait object ではなく domain entity / concrete runtime implementation として扱う。
|
||||
- Runtime は複数 Worker を保持・起動・停止・操作できる。
|
||||
- Worker identity は Runtime scoped とする。
|
||||
- Runtime は Worker を動かす環境であり、trait object ではなく concrete runtime domain entity として扱う。
|
||||
- Runtime は Runtime-scoped Worker identity を使う。
|
||||
- `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
|
||||
- `display_name`
|
||||
- `display_ref`
|
||||
- Browser / Backend / API が `pod_name` / socket path / session path を authority にしない model を定義する。
|
||||
- Runtime / Worker の summary / detail / state / capability / diagnostics 型を定義する。
|
||||
- UI 表示用 `worker-name@runtime-name` と API authority `runtime_id + worker_id` を分ける。
|
||||
|
||||
### Embeddable Runtime API
|
||||
### Embedded 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
|
||||
- Backend などの Rust process に `Runtime` を直接組み込める。
|
||||
- v0 は memory store でよい。
|
||||
- API は少なくとも以下を表現する。
|
||||
- runtime summary / status。
|
||||
- worker list / detail。
|
||||
- create worker。
|
||||
- send input。
|
||||
- stop / cancel worker。
|
||||
- bounded transcript projection。
|
||||
- event subscription または event cursor。
|
||||
- usage / overview projection placeholder。
|
||||
- v0 は tools なし Worker / mock or minimal engine を許容する。
|
||||
- v0 は single-flight / busy reject でよい。
|
||||
- raw provider trace / raw session full log を Backend durable authority にしない。
|
||||
- raw provider trace / raw full session log を Runtime public authority にしない。
|
||||
|
||||
### Networked Runtime process API
|
||||
### Store / allocation core
|
||||
|
||||
- `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 経由にする。
|
||||
- Memory-backed store を core に含める。
|
||||
- Store API は将来 `fs-store` feature や Backend-provided store に差し替えられる境界を持つ。
|
||||
- `pod-store` 相当の責務は standalone `worker-store` にせず、Runtime internal persistence abstraction として設計する。
|
||||
- `pod-registry` 相当の責務は standalone `worker-registry` にせず、Runtime internal allocation / scope abstraction として設計する。
|
||||
- この Ticket では full FS persistence / host-level stale reclaim は実装しない。
|
||||
|
||||
### Backend RuntimeRegistry との関係
|
||||
### Existing Worker / LLM engine boundary
|
||||
|
||||
- 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 でどう扱うか。
|
||||
- `llm-engine` は LLM turn engine として扱い、Runtime / Worker identity は持たせない。
|
||||
- `worker` crate は当面 single Worker host として残り、Runtime core から直接大規模移植しない。
|
||||
- Existing process/socket/session compatibility は後続 adapter / integration で扱う。
|
||||
|
||||
## 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 の完成。
|
||||
- `fs-store` implementation。
|
||||
- REST command server。
|
||||
- SSE / WebSocket observation server。
|
||||
- HTTP client / Backend RuntimeRegistry remote integration。
|
||||
- Backend internal Companion Web Console。
|
||||
- Existing `pod-store` / `pod-registry` crate の即時削除。
|
||||
- Existing Worker process/socket/session model の削除。
|
||||
- Full remote Runtime protocol。
|
||||
|
||||
## 受け入れ条件
|
||||
|
||||
この 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 が提案されている。
|
||||
- `crates/worker-runtime` が追加されている。
|
||||
- `worker-runtime` core は HTTP / WS / FS store dependency なしで library として使える。
|
||||
- `Runtime` concrete struct と Runtime/Worker domain types が公開されている。
|
||||
- Memory-backed embedded Runtime が worker list/detail/create/send input/stop/transcript projection の最小 API を持つ。
|
||||
- `runtime_id + worker_id` が authority であり、`pod_name` / socket path / session path を authority にしない。
|
||||
- Store / allocation abstraction が Runtime internal responsibility として定義されている。
|
||||
- `worker-store` / `worker-registry` standalone crate は作られていない。
|
||||
- `cargo test -p worker-runtime` が通る。
|
||||
- `cargo check -p yoi` が通る。
|
||||
- `git diff --check` が通る。
|
||||
- `nix build .#yoi --no-link` が通る。
|
||||
|
|
|
|||
|
|
@ -243,4 +243,43 @@ Implementation order update:
|
|||
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.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: decision author: hare at: 2026-06-25T14:41:12Z -->
|
||||
|
||||
## Decision
|
||||
|
||||
Decision update: worker-runtime should separate the embeddable Runtime core from optional persistence and network transports.
|
||||
|
||||
- `worker-runtime/lib.rs` owns Runtime semantics and can be embedded by Backend.
|
||||
- `worker-runtime/main.rs` is only a Runtime process wrapper around the same Runtime.
|
||||
- Use features so embedding the library does not force FS store / HTTP server / WebSocket server dependencies.
|
||||
- v0 persistence should support memory store for embedded use and fs-store for standalone Runtime process use.
|
||||
- Backend <-> remote Runtime should be Backend-initiated: Browser -> Backend -> Runtime. Browser must not talk to Runtime directly.
|
||||
- Commands should be REST/HTTP. Observation should be REST polling, SSE, or WebSocket; REST server and WS/SSE server implementation may be split from core crate creation.
|
||||
- Runtime-initiated persistent connection back to Backend is not a v0 requirement because it complicates session, auth, reconnect, and delivery semantics.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: decision author: hare at: 2026-06-25T14:48:23Z -->
|
||||
|
||||
## Decision
|
||||
|
||||
Decision update: split the former broad worker-runtime ticket into implementation-sized tickets.
|
||||
|
||||
Current order:
|
||||
|
||||
1. 00001KVZD10ED llm-worker crateをllm-engineへ改名する
|
||||
2. 00001KVZG9BMS pod crateをworker crateへ改名する
|
||||
3. 00001KVZBCQH4 worker-runtime core crateと組み込みRuntime APIを作る
|
||||
4. 00001KVZKST83 worker-runtimeにFS永続化featureを追加する
|
||||
5. 00001KVZKSTE2 worker-runtimeにREST command serverを追加する
|
||||
6. 00001KVZKSTJT worker-runtimeにevent stream serverを追加する
|
||||
7. 00001KVZKSV6C Backend RuntimeRegistryをworker-runtimeへ接続する
|
||||
8. 00001KVZ9JGK0 Backend内蔵Companion RuntimeとWeb Console MVP
|
||||
|
||||
The core ticket must not absorb FS persistence, REST server, event stream server, or Backend remote client integration. Those are separate implementation tickets.
|
||||
|
||||
|
||||
---
|
||||
|
|
|
|||
0
.yoi/tickets/00001KVZKST83/artifacts/.gitkeep
Normal file
0
.yoi/tickets/00001KVZKST83/artifacts/.gitkeep
Normal file
13
.yoi/tickets/00001KVZKST83/artifacts/relations.json
Normal file
13
.yoi/tickets/00001KVZKST83/artifacts/relations.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": 1,
|
||||
"relations": [
|
||||
{
|
||||
"ticket_id": "00001KVZKST83",
|
||||
"kind": "depends_on",
|
||||
"target": "00001KVZBCQH4",
|
||||
"note": "FS persistence is an optional feature on top of the worker-runtime core API.",
|
||||
"author": "yoi ticket",
|
||||
"at": "2026-06-25T14:47:43Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
53
.yoi/tickets/00001KVZKST83/item.md
Normal file
53
.yoi/tickets/00001KVZKST83/item.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: 'worker-runtimeにFS永続化featureを追加する'
|
||||
state: 'planning'
|
||||
created_at: '2026-06-25T14:44:02Z'
|
||||
updated_at: '2026-06-25T14:47:43Z'
|
||||
assignee: null
|
||||
---
|
||||
|
||||
## 背景
|
||||
|
||||
`worker-runtime` core は embedded use のため memory store を持つが、独立 Runtime process では process restart に耐える local persistence が必要になる。Backend は SQLite control plane / projection を持つが、remote Runtime process が Backend SQLite を直接 authority とする設計にはしない。Runtime execution store は Runtime 側の local filesystem に置くのが v0 では最も単純で、既存 `pod-store` / session jsonl / runtime dir の知見も活用できる。
|
||||
|
||||
この Ticket では `worker-runtime` の `fs-store` feature と filesystem persistence backend を実装する。HTTP server / event stream server は別 Ticket とする。
|
||||
|
||||
## 要件
|
||||
|
||||
- `worker-runtime` に `fs-store` feature を追加する。
|
||||
- Feature disabled 時、core library は FS store dependency を強制しない。
|
||||
- `FsRuntimeStore` 相当を追加し、Runtime の store backend として選択できる。
|
||||
- Filesystem layout は Runtime scoped / Worker scoped にする。
|
||||
- runtime record / config snapshot。
|
||||
- worker record。
|
||||
- worker state。
|
||||
- event log JSONL。
|
||||
- transcript projection JSONL。
|
||||
- overview / usage projection。
|
||||
- Store は `runtime_id + worker_id` を authority とし、`pod_name` / socket path / legacy session path を authority にしない。
|
||||
- Atomic write / directory creation / corrupt record diagnostics / bounded read を扱う。
|
||||
- 旧 `pod-store` の metadata JSON / active segment pointer / atomic write pattern は参考にするが、standalone `worker-store` crate は作らない。
|
||||
- Memory store tests と FS store tests の両方が通る。
|
||||
|
||||
## Non-goals
|
||||
|
||||
- REST command server。
|
||||
- SSE / WebSocket event stream server。
|
||||
- Backend RuntimeRegistry integration。
|
||||
- Full legacy Pod session migration。
|
||||
- SQLite Runtime store。
|
||||
- Standalone `worker-store` crate。
|
||||
|
||||
## 受け入れ条件
|
||||
|
||||
- `worker-runtime` に optional `fs-store` feature がある。
|
||||
- `fs-store` disabled でも `worker-runtime` core が compile できる。
|
||||
- `FsRuntimeStore` が Runtime の persistence backend として使える。
|
||||
- Worker create / state update / event append / transcript append / bounded read が FS store で動く。
|
||||
- FS layout が Runtime/Worker scoped であり、legacy Pod path を public authority にしていない。
|
||||
- Corrupt/missing files are surfaced as typed diagnostics/errors.
|
||||
- `cargo test -p worker-runtime --no-default-features` が通る。
|
||||
- `cargo test -p worker-runtime --features fs-store` が通る。
|
||||
- `cargo check -p yoi` が通る。
|
||||
- `git diff --check` が通る。
|
||||
- `nix build .#yoi --no-link` が通る。
|
||||
7
.yoi/tickets/00001KVZKST83/thread.md
Normal file
7
.yoi/tickets/00001KVZKST83/thread.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!-- event: create author: "yoi ticket" at: 2026-06-25T14:44:02Z -->
|
||||
|
||||
## 作成
|
||||
|
||||
LocalTicketBackend によって作成されました。
|
||||
|
||||
---
|
||||
0
.yoi/tickets/00001KVZKSTE2/artifacts/.gitkeep
Normal file
0
.yoi/tickets/00001KVZKSTE2/artifacts/.gitkeep
Normal file
13
.yoi/tickets/00001KVZKSTE2/artifacts/relations.json
Normal file
13
.yoi/tickets/00001KVZKSTE2/artifacts/relations.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": 1,
|
||||
"relations": [
|
||||
{
|
||||
"ticket_id": "00001KVZKSTE2",
|
||||
"kind": "depends_on",
|
||||
"target": "00001KVZBCQH4",
|
||||
"note": "REST command server wraps the worker-runtime core API.",
|
||||
"author": "yoi ticket",
|
||||
"at": "2026-06-25T14:47:43Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
56
.yoi/tickets/00001KVZKSTE2/item.md
Normal file
56
.yoi/tickets/00001KVZKSTE2/item.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
title: 'worker-runtimeにREST command serverを追加する'
|
||||
state: 'planning'
|
||||
created_at: '2026-06-25T14:44:02Z'
|
||||
updated_at: '2026-06-25T14:47:43Z'
|
||||
assignee: null
|
||||
---
|
||||
|
||||
## 背景
|
||||
|
||||
`worker-runtime` は library として Backend に組み込めるだけでなく、別ホスト上の独立 Runtime process としても動かしたい。独立 process の Runtime は、Backend が client として接続できる command API を公開する必要がある。Browser は Runtime process に直接接続せず、常に Backend を経由する。
|
||||
|
||||
この Ticket では observation stream ではなく、Worker 操作 command 用の REST/HTTP server と `worker-runtime/main.rs` の最小 process wrapper を実装する。
|
||||
|
||||
## 要件
|
||||
|
||||
- `worker-runtime` に `http-server` feature を追加する。
|
||||
- `http-server` disabled 時、core library は HTTP server dependency を強制しない。
|
||||
- `worker-runtime/main.rs` または binary entrypoint が Runtime を起動し、HTTP command API を公開する。
|
||||
- Command API は少なくとも以下を扱う。
|
||||
- `GET /v1/runtime`
|
||||
- `GET /v1/workers`
|
||||
- `GET /v1/workers/{worker_id}`
|
||||
- `POST /v1/workers`
|
||||
- `POST /v1/workers/{worker_id}/input`
|
||||
- `POST /v1/workers/{worker_id}/stop`
|
||||
- `POST /v1/workers/{worker_id}/cancel`
|
||||
- `GET /v1/workers/{worker_id}/transcript`
|
||||
- API は Runtime lib の methods を呼ぶ wrapper とし、Worker semantics を二重実装しない。
|
||||
- Command response は typed JSON shape とする。
|
||||
- Busy / unknown worker / invalid input / unsupported operation / runtime unavailable を typed error にする。
|
||||
- Runtime process config は v0 で最小限でよいが、runtime id / bind address / store selection を扱えるようにする。
|
||||
- v0 auth は minimal local token placeholder でもよいが、Browser に Runtime credential を渡さない前提を崩さない。
|
||||
|
||||
## Non-goals
|
||||
|
||||
- SSE / WebSocket event stream server。
|
||||
- Backend HTTP client integration。
|
||||
- Dynamic Runtime registration。
|
||||
- Browser direct Runtime access。
|
||||
- Full auth / permission model。
|
||||
- FS store implementation beyond using existing `fs-store` if available。
|
||||
|
||||
## 受け入れ条件
|
||||
|
||||
- `worker-runtime` に optional `http-server` feature がある。
|
||||
- `http-server` disabled でも `worker-runtime` core が compile できる。
|
||||
- Runtime process binary starts and exposes REST command endpoints.
|
||||
- REST handlers delegate to `Runtime` lib API rather than duplicating Worker semantics.
|
||||
- Worker create / input / stop / cancel / detail / transcript endpoints have typed request/response/error shapes.
|
||||
- Browser-facing docs/comments state that Browser must go through Backend, not Runtime directly.
|
||||
- Focused HTTP handler tests are added.
|
||||
- `cargo test -p worker-runtime --features http-server` が通る。
|
||||
- `cargo check -p yoi` が通る。
|
||||
- `git diff --check` が通る。
|
||||
- `nix build .#yoi --no-link` が通る。
|
||||
7
.yoi/tickets/00001KVZKSTE2/thread.md
Normal file
7
.yoi/tickets/00001KVZKSTE2/thread.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!-- event: create author: "yoi ticket" at: 2026-06-25T14:44:02Z -->
|
||||
|
||||
## 作成
|
||||
|
||||
LocalTicketBackend によって作成されました。
|
||||
|
||||
---
|
||||
0
.yoi/tickets/00001KVZKSTJT/artifacts/.gitkeep
Normal file
0
.yoi/tickets/00001KVZKSTJT/artifacts/.gitkeep
Normal file
21
.yoi/tickets/00001KVZKSTJT/artifacts/relations.json
Normal file
21
.yoi/tickets/00001KVZKSTJT/artifacts/relations.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"version": 1,
|
||||
"relations": [
|
||||
{
|
||||
"ticket_id": "00001KVZKSTJT",
|
||||
"kind": "depends_on",
|
||||
"target": "00001KVZBCQH4",
|
||||
"note": "Event stream server exposes the worker-runtime core event bus/log.",
|
||||
"author": "yoi ticket",
|
||||
"at": "2026-06-25T14:47:43Z"
|
||||
},
|
||||
{
|
||||
"ticket_id": "00001KVZKSTJT",
|
||||
"kind": "depends_on",
|
||||
"target": "00001KVZKSTE2",
|
||||
"note": "Observation endpoints share the Runtime process server surface with the REST command server.",
|
||||
"author": "yoi ticket",
|
||||
"at": "2026-06-25T14:47:43Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
48
.yoi/tickets/00001KVZKSTJT/item.md
Normal file
48
.yoi/tickets/00001KVZKSTJT/item.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
title: 'worker-runtimeにevent stream serverを追加する'
|
||||
state: 'planning'
|
||||
created_at: '2026-06-25T14:44:02Z'
|
||||
updated_at: '2026-06-25T14:47:43Z'
|
||||
assignee: null
|
||||
---
|
||||
|
||||
## 背景
|
||||
|
||||
Runtime command は REST/HTTP でよいが、Worker output / status / transcript update を Backend が追うには observation transport が必要になる。Runtime から Backend へ能動接続する相互型は v0 では採用せず、Backend が Runtime の event stream に接続する形にする。Browser は Runtime event stream に直接接続せず、Backend が proxy / projection する。
|
||||
|
||||
この Ticket では `worker-runtime` process に SSE または WebSocket based observation server を追加する。実装時に SSE / WebSocket のどちらを v0 にするか決めてよいが、command API とは分離する。
|
||||
|
||||
## 要件
|
||||
|
||||
- `worker-runtime` に `event-stream` または `ws-server` feature を追加する。
|
||||
- Feature disabled 時、core library は stream server dependency を強制しない。
|
||||
- Runtime process が Worker / Runtime events を observation endpoint で公開できる。
|
||||
- Endpoint は少なくとも以下のどちらかを扱う。
|
||||
- `GET /v1/events?cursor=...`
|
||||
- `GET /v1/workers/{worker_id}/events?cursor=...`
|
||||
- Event stream は Runtime lib の event bus / event log を元にする。
|
||||
- Event cursor / event id は Runtime local opaque id とする。
|
||||
- Reconnect / cursor resume / bounded backlog / unknown cursor の扱いを typed にする。
|
||||
- Transcript projection polling endpoint と event stream の責務を分ける。
|
||||
- Browser direct Runtime access は想定せず、Backend client が購読する。
|
||||
|
||||
## Non-goals
|
||||
|
||||
- REST command server implementation。
|
||||
- Backend event proxy UI implementation。
|
||||
- Runtime-initiated Backend push connection。
|
||||
- Full exactly-once delivery。
|
||||
- Browser-facing WebSocket protocol。
|
||||
|
||||
## 受け入れ条件
|
||||
|
||||
- `worker-runtime` に optional observation transport feature がある。
|
||||
- Feature disabled でも `worker-runtime` core が compile できる。
|
||||
- Runtime process exposes worker/runtime event stream endpoint.
|
||||
- Backend client can reconnect with cursor / last event id semantics at the protocol level.
|
||||
- Unknown cursor / expired cursor / worker not found are typed errors or stream diagnostics.
|
||||
- Event stream tests cover at least connect, event delivery, cursor resume, and worker-scoped filtering.
|
||||
- `cargo test -p worker-runtime --features event-stream` または該当 feature が通る。
|
||||
- `cargo check -p yoi` が通る。
|
||||
- `git diff --check` が通る。
|
||||
- `nix build .#yoi --no-link` が通る。
|
||||
7
.yoi/tickets/00001KVZKSTJT/thread.md
Normal file
7
.yoi/tickets/00001KVZKSTJT/thread.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!-- event: create author: "yoi ticket" at: 2026-06-25T14:44:02Z -->
|
||||
|
||||
## 作成
|
||||
|
||||
LocalTicketBackend によって作成されました。
|
||||
|
||||
---
|
||||
0
.yoi/tickets/00001KVZKSV6C/artifacts/.gitkeep
Normal file
0
.yoi/tickets/00001KVZKSV6C/artifacts/.gitkeep
Normal file
29
.yoi/tickets/00001KVZKSV6C/artifacts/relations.json
Normal file
29
.yoi/tickets/00001KVZKSV6C/artifacts/relations.json
Normal file
|
|
@ -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
.yoi/tickets/00001KVZKSV6C/item.md
Normal file
52
.yoi/tickets/00001KVZKSV6C/item.md
Normal 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
.yoi/tickets/00001KVZKSV6C/thread.md
Normal file
7
.yoi/tickets/00001KVZKSV6C/thread.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!-- event: create author: "yoi ticket" at: 2026-06-25T14:44:03Z -->
|
||||
|
||||
## 作成
|
||||
|
||||
LocalTicketBackend によって作成されました。
|
||||
|
||||
---
|
||||
Loading…
Reference in New Issue
Block a user