docs: reorganize developer documentation

This commit is contained in:
2026-06-01 20:59:32 +09:00
parent e6c458021c
commit 9dcbd4c3e0
83 changed files with 1320 additions and 5649 deletions
+25 -16
View File
@@ -1,23 +1,32 @@
# llm-worker
LLM との対話を管理する低レベル基盤クレート。会話履歴、ツール実行、イベントストリーミング、ライフサイクルフックを統合した `Worker` 抽象を提供する。
## Role
## 公開型
`llm-worker` owns provider-independent model turn orchestration over committed history, tools, callbacks, retries, continuation, pruning, and compaction boundaries.
### コア
## Boundaries
- `Worker<C, S>` — LLM 対話の中央管理(ターン実行、ツール呼び出し、キャンセル)
- `WorkerConfig` / `WorkerResult` / `WorkerError` — 設定・実行結果・エラー
- `Item` / `ContentPart` / `Role` — 会話履歴の構成要素
Owns:
### モジュール
- Worker history mutation and append contracts
- tool-call loop semantics
- pre-stream retry and stream-started continuation policy
- pruning/compaction coordination from the Worker perspective
- provider-neutral events/callbacks/interceptors
- `llm_client` — プロバイダ抽象(`LlmClient` トレイト、`Request`, `RequestConfig`, Anthropic/OpenAI/Gemini/Ollama 実装)
- `tool` — ツール定義・実行(`Tool` トレイト、`ToolDefinition`, `ToolOutput`, サイズ判定による Inline/Stored 切替)
- `tool_server` — ツール登録・ルックアップ(`ToolServer`, `ToolServerHandle`
- `hook` — 実行フローへの介入ポイント(`Hook` トレイト、`PreToolCall`, `PostToolCall`, `OnTurnEnd` など)
- クロージャベースイベント購読(`Worker::on_text_block()`, `on_tool_use_block()`, `on_usage()` 等)
- `timeline` — イベントストリームのディスパッチ(`Handler` トレイト、各ブロックコレクター)。パワーユーザー向けに `timeline_mut()` も提供
- `event` — ストリーミングイベント型(`Event`, `BlockStart`, `BlockDelta` など)
- `state` — 型状態パターンによるキャッシュ保護(`Mutable` / `CacheLocked`
cratesの整理Add READMEsRE to all crates@@
Does not own:
- Pod names, sockets, process lifecycle, or scope delegation (`pod`)
- product CLI shape (`yoi`)
- provider catalog and secret resolution (`provider`, `secrets`)
- durable Pod current state (`pod-store`)
## Design notes
The Worker is where turn lifecycle belongs because it sees history, in-flight usage, partial output, and tool-call state. It should not receive context-only volatile facts; model-affecting inputs must first be appended to history.
## See also
- [`../../docs/design/context-history.md`](../../docs/design/context-history.md)
- [`../../docs/design/compaction.md`](../../docs/design/compaction.md)
- [`../../docs/design/provider-model-boundary.md`](../../docs/design/provider-model-boundary.md)