crates/session-metrics/src/lib.rs:6://! session-store は payload を不透明な `serde_json::Value` として扱うので、 crates/llm-worker-macros/src/lib.rs:1://! llm-worker-macros - Procedural macros for Tool generation crates/llm-worker-macros/src/lib.rs:3://! Provides `#[tool_registry]` and `#[tool]` macros to crates/llm-worker-macros/src/lib.rs:12:/// Macro applied to an `impl` block that generates tools from methods marked with `#[tool]`. crates/llm-worker-macros/src/lib.rs:20:/// #[tool] crates/llm-worker-macros/src/lib.rs:29:/// - `impl MyApp { fn get_user_tool(&self) -> Tool_get_user }` crates/llm-worker-macros/src/lib.rs:39: // Look for #[tool] attribute crates/llm-worker-macros/src/lib.rs:42: // Iterate through attributes to check for tool and remove it crates/llm-worker-macros/src/lib.rs:312:/// #[tool] crates/memory/src/schema/summary.rs:15: /// Optional pointer to the session-store entry range that drove the crates/memory/src/schema/common.rs:9:/// Reference to a session-store entry range. Stored in `sources` / crates/memory/src/schema/common.rs:14: /// `[start_entry, end_entry]` inclusive range of session-store entry indices. crates/session-store/tests/common/mod.rs:12:/// A mock LLM client that replays pre-defined event sequences. crates/memory/src/schema/mod.rs:1://! Frontmatter schemas for memory records. crates/session-store/src/event_trace.rs:3://! [`TraceEntry`] captures stream lifecycle markers and raw provider stream crates/session-store/src/event_trace.rs:30: /// Normalized provider stream event. crates/session-store/src/event_trace.rs:32: /// Marker for code that runs before/around provider stream events. crates/memory/src/tool/read.rs:1://! `MemoryRead` tool. crates/memory/src/tool/read.rs:3://! Reads a memory or knowledge record by `(kind, slug)`. Returns crates/memory/src/tool/read.rs:4://! line-numbered content (1-based), like the generic Read tool. The crates/provider/src/catalog.rs:3://! - builtin プロバイダ: `resources/providers/builtin.toml` crates/provider/src/catalog.rs:5://! - user override: `/{providers,models}.toml` crates/provider/src/catalog.rs:7://! `` の解決は [`manifest::paths::config_dir`] を参照。 crates/provider/src/catalog.rs:9://! いう一方向の差し替え(マージしない)。providers / models は独立に crates/provider/src/catalog.rs:12://! [`resolve_model_manifest`] が `manifest::ModelManifest`(ref / inline crates/provider/src/catalog.rs:25:/// Conservative fallback used when neither the manifest nor catalogs specify crates/provider/src/catalog.rs:27:/// catalog / manifest metadata can override unknown or inline models. crates/provider/src/catalog.rs:48:/// マニフェスト解決時のエラー。`ModelManifest` がカタログ参照を満たせ crates/provider/src/catalog.rs:94: /// モデルカタログ未登録モデルでこの provider が使われたとき crates/provider/src/catalog.rs:95: /// (ref で provider はあるが model 行は無い等)のフォールバック。 crates/provider/src/catalog.rs:108:/// `id` は **provider 内ユニーク**。同じ `gpt-5` が異なる provider に crates/provider/src/catalog.rs:109:/// 存在するのは OK で、ref が必ず `/` を含むため crates/provider/src/catalog.rs:119: /// モデル単位の context window。省略時は provider default → builtin crates/provider/src/catalog.rs:125:/// 解決済みモデル設定。`build_client` が消費する完成形。 crates/provider/src/catalog.rs:162:// --- providers --------------------------------------------------------------- crates/provider/src/catalog.rs:164:/// builtin + user override を解決して provider カタログを返す。 crates/provider/src/catalog.rs:166:/// user override (`/providers.toml`) が存在すれば builtin crates/provider/src/catalog.rs:180:/// builtin provider カタログのみを返す。 crates/provider/src/catalog.rs:187:/// 指定パスから provider カタログを読む。 crates/provider/src/catalog.rs:235:/// `/` の最初の `/` で 1 回だけ split する。 crates/provider/src/catalog.rs:237:/// model_id に `/` を含むケースは、provider=`openrouter`、 crates/provider/src/catalog.rs:247:/// `ModelManifest` をカタログ込みで解決し、最終 [`ModelConfig`] を返す。 crates/provider/src/catalog.rs:249:/// - **`ref` あり** → provider カタログを引き、未登録なら hard error。 crates/provider/src/catalog.rs:250:/// model カタログは未登録でも warn ログだけに留め、`provider.default_capability` crates/provider/src/catalog.rs:257:/// scheme/base_url は manifest 明示 > provider、model_id は manifest 明示 > ref、 crates/provider/src/catalog.rs:258:/// auth は manifest 明示 > provider.auth_hint 由来、capability は crates/provider/src/catalog.rs:259:/// manifest 明示 > model catalog > provider.default_capability > crates/provider/src/catalog.rs:260:/// (`build_client` 側で)`Scheme::default_capability()`。 crates/provider/src/catalog.rs:261:/// context_window は manifest 明示 > model catalog > provider default > crates/provider/src/catalog.rs:269:/// テスト等で in-memory カタログを差し込む解決経路。 crates/provider/src/catalog.rs:283: // model 行は無くても続行可(warn ログ + provider.default_capability)。 crates/provider/src/catalog.rs:447: // OpenRouter: `//` 形式の model_id を持つ crates/memory/src/tool/write.rs:1://! `MemoryWrite` tool. crates/memory/src/tool/write.rs:3://! Creates or overwrites a memory or knowledge record by `(kind, slug)`. crates/memory/src/tool/write.rs:6://! Linter error the tool returns `ToolError::InvalidArgument` with all crates/memory/src/tool/write.rs:307: // The MemoryToolKind enum doesn't include Workflow, so deserialization fails. crates/llm-worker/tests/reasoning_round_trip_test.rs:148: /// Request を 1 度だけキャプチャして空ストリームを返す client。 crates/llm-worker/tests/transport_retry_test.rs:4://! request を送り、HTTP status / Retry-After を `ClientError` に載せて返す。 crates/llm-worker/tests/transport_retry_test.rs:21:/// stream 消費中で `ClientError::Sse` を返す。 crates/session-store/src/system_item.rs:4://! LLM — they are always inserted by the Pod itself (notifications, crates/session-store/src/system_item.rs:5://! file/knowledge/workflow ref resolutions, child-pod lifecycle events, crates/session-store/src/system_item.rs:7://! typed shape of each such injection so clients can dispatch on crates/session-store/src/system_item.rs:27:/// Each variant carries the kind-specific raw data clients use for crates/session-store/src/system_item.rs:28:/// typed rendering (`Notification.message`, `PodEvent.event`, file crates/session-store/src/system_item.rs:29:/// path / knowledge slug / workflow slug / etc.), plus a pre-rendered crates/session-store/src/system_item.rs:45: /// `body` is the wrapped LLM-context form (Pod renders it via crates/session-store/src/system_item.rs:49: /// Lifecycle event reported by a child Pod via `Method::PodEvent`. crates/session-store/src/system_item.rs:50: /// `event` is the typed payload (so the TUI can render per-child crates/session-store/src/system_item.rs:63: /// rendered text the LLM saw (Pod composes the `[Knowledge: …]` crates/session-store/src/system_item.rs:67: /// `/` Workflow invocation. `body` is the workflow's crates/session-store/src/system_item.rs:111:/// Render a `PodEvent` as the one-line notification text the agent crates/memory/src/tool/query.rs:1://! `MemoryQuery` / `KnowledgeQuery` tools. crates/memory/src/tool/query.rs:9://! - `MemoryQuery` walks `.insomnia/memory/{summary.md,decisions/, crates/memory/src/tool/query.rs:10://! requests/}`. `.insomnia/workflow/`, `.insomnia/memory/_staging/`, crates/memory/src/tool/query.rs:11://! `.insomnia/memory/_usage/`, and `.insomnia/memory/_logs/` are excluded crates/memory/src/tool/query.rs:49:/// Tunables passed in from the manifest. crates/llm-worker/tests/callback_test.rs:214:/// Stub tool returning a fixed [`ToolOutput`] for result-callback tests. crates/llm-worker/tests/callback_test.rs:238:/// Verify that on_tool_result fires once per executed tool with crates/llm-worker/tests/callback_test.rs:239:/// summary/content/is_error matching what the tool returned. crates/llm-worker/tests/callback_test.rs:284:/// Stub tool that always fails, for exercising the error path through crates/memory/src/tool/mod.rs:1://! Memory-scoped tools: Read / Write / Edit / Search. crates/memory/src/tool/mod.rs:29:/// Kinds the memory tools accept as input. `Workflow` is intentionally crates/memory/src/tool/mod.rs:30:/// excluded — workflows are sub-Worker context, not agent-editable. crates/llm-worker/tests/worker_fixtures.rs:22:/// Simple test tool crates/llm-worker/tests/worker_fixtures.rs:79:/// Verify that MockLlmClient can correctly load events from JSONL fixture files crates/llm-worker/tests/worker_fixtures.rs:96:/// Verify that MockLlmClient works correctly with directly specified event lists crates/llm-worker/tests/worker_fixtures.rs:98:/// Creates a client with programmatically constructed events instead of using fixture files. crates/llm-worker/tests/worker_fixtures.rs:120:/// Uses simple_text.jsonl fixture to test scenarios without tool calls. crates/llm-worker/tests/worker_fixtures.rs:140:/// Verify that Worker can correctly process responses containing tool calls crates/llm-worker/tests/worker_fixtures.rs:143:/// Sets max_turns=1 to prevent loop after tool execution. crates/llm-worker/tests/worker_fixtures.rs:156: // Register tool crates/llm-worker/tests/worker_fixtures.rs:164: // Verify tool was called crates/llm-worker/tests/worker_fixtures.rs:165: // Note: max_turns=1 so no request is sent after tool result crates/llm-worker/tests/worker_fixtures.rs:175:/// Constructs event sequence programmatically and passes to MockLlmClient. crates/provider/src/codex_oauth/error.rs:3://! `LlmClient` 境界に渡す際は `to_client_error` で `ClientError` に crates/provider/src/codex_oauth/error.rs:48: /// `LlmClient` トランスポート境界向けに変換する。 crates/memory/src/tool/edit.rs:1://! `MemoryEdit` tool — partial string replacement on an existing memory record. crates/memory/src/tool/edit.rs:5://! current-then-write window is single-tool-call narrow; an external crates/memory/src/tool/edit.rs:6://! tracker is intentionally omitted (memory tools are self-contained, crates/memory/src/tool/edit.rs:7://! no `tools` crate dep). crates/memory/src/tool/edit.rs:363: // Workflow is not exposed via MemoryToolKind, so deserialization fails. crates/session-store/src/segment.rs:4://! The caller (typically Pod) holds the Worker directly and calls these crates/session-store/src/segment.rs:39:/// synchronously but defer the initial log append (e.g. Pod, which crates/session-store/src/segment.rs:105:/// Shim for legacy entry points (`pod-cli --session ` etc.) that crates/session-store/src/segment.rs:138:/// the new segment with the writer's in-memory history (which reflects crates/session-store/src/segment.rs:177:/// Submit-time entry. Pod calls this at the head of a `Run` turn before crates/session-store/src/segment.rs:253:/// for the Pod-side interceptor commit path; mirrors the per-item crates/session-store/src/segment.rs:254:/// commit shape used for assistant / tool result entries. crates/session-store/src/segment.rs:366:/// session-store treats `payload` as an unstructured `serde_json::Value`. crates/session-store/src/segment.rs:388:/// Log the Pod's latest runtime scope snapshot. crates/session-store/src/segment.rs:507:/// it needs the same value for an in-memory mirror + broadcast). crates/memory/src/tool/delete.rs:1://! `MemoryDelete` tool for removing memory / knowledge records with audit logging. crates/provider/src/codex_oauth/mod.rs:7://! - llm-worker は [`AuthProvider`] trait しか知らず、実体である crates/provider/src/codex_oauth/mod.rs:8://! [`CodexAuthProvider`] はこのクレートに置く(feedback_llm_worker_scope) crates/provider/src/codex_oauth/mod.rs:38:/// `~/.codex/auth.json` を読んで Codex 互換のヘッダを返す provider。 crates/llm-worker/tests/common/mod.rs:17:/// A mock LLM client that replays a sequence of events crates/llm-worker/tests/common/mod.rs:117:/// Assert that events in all fixtures for a provider can be deserialized crates/memory/src/scope.rs:2://! memory tree from the generic CRUD tools' write surface. crates/memory/src/scope.rs:4://! Pod is expected to call [`deny_write_rules`] when memory is enabled crates/memory/src/scope.rs:5://! and append the result to the manifest's `scope.deny` list before crates/memory/src/scope.rs:6://! constructing the [`Scope`] passed to `tools::ScopedFs`. The memory crates/memory/src/scope.rs:7://! tools themselves bypass `ScopedFs` and write directly under the crates/memory/src/scope.rs:16:/// Build deny rules that strip Write permission from `/memory/` crates/memory/src/scope.rs:18:/// Read for the generic tools. crates/session-store/src/store.rs:11://! drain task. Keeping the store sync lets the worker callback, Pod commit crates/session-store/src/store.rs:12://! paths, and `PodInterceptor` all share one direct `append_entry` call. crates/session-store/src/store.rs:87: /// Used by Pod's submit-time empty-turn rollback after it has proven crates/memory/src/error.rs:1://! Errors raised by the memory subsystem. crates/memory/src/error.rs:8:/// Top-level error for memory operations that don't fit the lint flow. crates/memory/src/audit.rs:1://! Append-only JSONL audit log for memory workers and tools. crates/memory/src/audit.rs:4://! `.insomnia/memory/_logs/current.log`. It is intentionally separate from crates/memory/src/audit.rs:9://! tail -f .insomnia/memory/_logs/current.log crates/memory/src/audit.rs:263:/// Append one audit event to `.insomnia/memory/_logs/current.log`. crates/provider/src/lib.rs:1://! Pod マニフェストの [`ModelManifest`] を [`Box`] crates/provider/src/lib.rs:5://! 1. `ModelManifest` を [`catalog::resolve_model_manifest`] で crates/provider/src/lib.rs:9://! 4. `ModelCapability` は manifest 明示 > model catalog > provider crates/provider/src/lib.rs:11://! `catalog::resolve_model_manifest` が [`ModelConfig`] に詰め込む) crates/provider/src/lib.rs:13://! llm-worker は低レベル基盤に留める方針なので、高レベル側で必要に crates/provider/src/lib.rs:120: // 1. manifest 明示 crates/provider/src/lib.rs:122: // 3. provider.default_capability crates/provider/src/lib.rs:157:/// [`ModelManifest`] から [`LlmClient`] を構築する。ref / inline の crates/provider/src/lib.rs:164:/// 既に解決済みの [`ModelConfig`] から [`LlmClient`] を構築する。 crates/provider/src/lib.rs:165:/// `ModelManifest` から既に `catalog::resolve_model_manifest` を通した crates/llm-worker/src/interceptor.rs:3://! Defines the [`Interceptor`] trait that upper layers (e.g. Pod) implement crates/llm-worker/src/interceptor.rs:4://! to inject orchestration decisions (approval, skip, pause, abort) crates/llm-worker/src/interceptor.rs:54:/// Action before a tool call. crates/llm-worker/src/interceptor.rs:59: /// Skip this tool call (do not execute). crates/llm-worker/src/interceptor.rs:61: /// Do not execute the tool call; commit this synthetic result instead. crates/llm-worker/src/interceptor.rs:63: /// This preserves provider-visible `tool_use` / `tool_result` pairing crates/llm-worker/src/interceptor.rs:72:/// Action after a tool call. crates/llm-worker/src/interceptor.rs:81:/// Action at the end of a turn (when LLM produces no tool calls). crates/llm-worker/src/interceptor.rs:96:/// Context for pre-tool-call decisions. crates/llm-worker/src/interceptor.rs:106:/// Context for post-tool-call decisions. crates/llm-worker/src/interceptor.rs:108: /// Original tool call. crates/llm-worker/src/interceptor.rs:125:/// proceed without intervention. Upper layers (e.g. Pod) provide crates/llm-worker/src/interceptor.rs:142: /// cross-Pod events, system reminders. Do **not** use crates/llm-worker/src/interceptor.rs:168: /// Called before each tool is executed. crates/llm-worker/src/interceptor.rs:173: /// Called after each tool completes. crates/llm-worker/src/interceptor.rs:178: /// Called when a turn ends with no tool calls. crates/llm-worker/tests/parallel_execution_test.rs:1://! Parallel tool execution tests crates/llm-worker/tests/parallel_execution_test.rs:3://! Verify that Worker executes multiple tools in parallel. crates/llm-worker/tests/parallel_execution_test.rs:73:/// Verify that multiple tools are executed in parallel crates/llm-worker/tests/parallel_execution_test.rs:75:/// If each tool takes 100ms, sequential execution would take 300ms+, crates/llm-worker/tests/parallel_execution_test.rs:79: // Event sequence containing 3 tool calls crates/llm-worker/tests/parallel_execution_test.rs:98: // Each tool waits 100ms crates/llm-worker/tests/parallel_execution_test.rs:116: // Verify all tools were called crates/llm-worker/tests/parallel_execution_test.rs:132:/// Hook: pre_tool_call - verify that skipped tools are not executed crates/llm-worker/tests/parallel_execution_test.rs:159: // Policy to skip "blocked_tool" crates/llm-worker/tests/parallel_execution_test.rs:178: // allowed_tool is called, but blocked_tool is not crates/llm-worker/tests/parallel_execution_test.rs:196: // First request: tool call crates/llm-worker/tests/parallel_execution_test.rs:205: // Second request: text response after receiving tool result crates/llm-worker/tests/parallel_execution_test.rs:272:/// Hook: pre_tool_call synthetic result - skipped tool gets an error result in history. crates/session-store/src/pod_metadata.rs:1://! Pod metadata persistence API. crates/session-store/src/pod_metadata.rs:3://! Pod metadata is a lightweight name-keyed pointer to the Session/Segment crates/session-store/src/pod_metadata.rs:4://! currently active for a Pod. Conversation content remains in the segment log; crates/session-store/src/pod_metadata.rs:5://! this metadata only records references needed by Pod-name resume/attach flows. crates/session-store/src/pod_metadata.rs:12:/// Active Session/Segment pointer for a Pod. crates/session-store/src/pod_metadata.rs:43:/// `session-store` so the persistence crate does not depend on manifest crates/session-store/src/pod_metadata.rs:52:/// One child Pod spawned by this Pod and persisted with the spawner's crates/session-store/src/pod_metadata.rs:53:/// name-keyed Pod state. crates/session-store/src/pod_metadata.rs:62:/// Persistent metadata for a Pod name. crates/session-store/src/pod_metadata.rs:73: /// Create Pod metadata for `pod_name`. crates/session-store/src/pod_metadata.rs:83:/// Sync persistence backend for Pod metadata. crates/session-store/src/pod_metadata.rs:85:/// The key is the Pod name. Missing state is not an error: `read_by_name` crates/session-store/src/pod_metadata.rs:86:/// returns `Ok(None)` for Pods that have never persisted metadata or whose crates/session-store/src/pod_metadata.rs:89: /// Create or replace metadata for its `pod_name` key. crates/session-store/src/pod_metadata.rs:92: /// Read metadata by Pod name. Returns `None` when no metadata exists. crates/session-store/src/pod_metadata.rs:95: /// List persisted Pod metadata keys. Implementations return names only; crates/session-store/src/pod_metadata.rs:105: /// Delete metadata by Pod name. Missing metadata is a successful no-op. crates/memory/src/lib.rs:1://! Memory subsystem: persistence layer for `memory/*` and `knowledge/*` records. crates/memory/src/lib.rs:4://! that target `/memory/` and `/knowledge/` only, crates/memory/src/lib.rs:5://! with a pre-write Linter built in. Generic CRUD tools (in the `tools` crates/memory/src/lib.rs:6://! crate) must not touch these directories — Pod is responsible for crates/memory/src/lib.rs:7://! denying them at the Scope level when memory is enabled. crates/llm-worker/src/event.rs:3://! Re-exports from the canonical event definitions in llm_client. crates/session-store/src/logged_item.rs:1://! Persistence-stable mirror of `llm_worker::Item`. crates/llm-worker/tests/worker_state_test.rs:145:/// Verify that tools can be registered in Mutable state. crates/llm-worker/tests/worker_state_test.rs:152: // register_tool is infallible (factory deferred to run-time flush) crates/llm-worker/tests/worker_state_test.rs:407:/// Verify that tools registered before lock and after unlock remain effective. crates/llm-worker/tests/tool_macro_test.rs:3://! Verify the behavior of `#[tool_registry]` and `#[tool]` macros. crates/session-store/src/segment_log.rs:60: /// actual payload (user text / notify message / pod event body) is crates/session-store/src/segment_log.rs:63: /// Used by `pod-session-fork` style operations: the fork-point seq crates/session-store/src/segment_log.rs:75: /// `Vec` so clients can re-render typed atoms (paste chips, crates/session-store/src/segment_log.rs:76: /// file/knowledge refs, workflow invocations) on segment restore. crates/session-store/src/segment_log.rs:82: /// reasoning, or tool call. Singular: one entry per history item so crates/session-store/src/segment_log.rs:86: /// One tool-execution result appended to history. crates/session-store/src/segment_log.rs:89: /// One typed agent-injected system item: notification, child-Pod crates/session-store/src/segment_log.rs:93: /// item's denormalised `body`), but live clients and replay paths crates/session-store/src/segment_log.rs:143: /// session-store は payload を不透明扱いし、replay 時は crates/session-store/src/segment_log.rs:147: /// 想定用途: memory subsystem の extract 処理境界 pointer 等、 crates/session-store/src/segment_log.rs:148: /// 「session 寿命に縛りたいが session-store の型を汚したくない」 crates/session-store/src/segment_log.rs:169:/// Domain used by Pod to persist its latest effective runtime scope. crates/session-store/src/segment_log.rs:172:/// Payload stored in `LogEntry::Extension { domain: "pod.scope", .. }`. crates/session-store/src/segment_log.rs:200: /// session-store は domain を不透明扱いし、各ドメインが自前で fold する。 crates/session-store/src/segment_log.rs:202: /// Latest runtime scope snapshot persisted by the Pod. `None` means crates/session-store/src/segment_log.rs:209: /// original segments are not preserved). Used by clients to re-render crates/session-store/src/segment_log.rs:710: // Segments survive verbatim for client-side restore. crates/session-store/src/fs_store.rs:6://! - Pod metadata: `{root}/pods/{pod_name}/metadata.json` crates/llm-worker/src/worker.rs:38: /// Client error crates/llm-worker/src/worker.rs:58: /// A tool with the same name is already registered crates/llm-worker/src/worker.rs:98:/// Internal: tool execution result crates/llm-worker/src/worker.rs:109:/// automatically executes tool calls if any, advancing the turn. crates/llm-worker/src/worker.rs:113:/// - [`Mutable`]: Initial state. System prompt, history, and tools can be freely edited. crates/llm-worker/src/worker.rs:121:/// let mut worker = Worker::new(client) crates/llm-worker/src/worker.rs:123:/// worker.register_tool(my_tool); crates/llm-worker/src/worker.rs:156: /// LLM client crates/llm-worker/src/worker.rs:181: /// Once retry (`llm-worker-stream-continuation`) is implemented, an crates/llm-worker/src/worker.rs:205: /// Stream event callbacks. Fired for every normalized provider stream crates/llm-worker/src/worker.rs:208: /// Pre-stream lifecycle callbacks for debugging stalls before provider crates/llm-worker/src/worker.rs:212: /// surface an advisory message to the upper layer (e.g. Pod) so it crates/llm-worker/src/worker.rs:216: /// Tool-result callbacks. Invoked once per completed tool call crates/llm-worker/src/worker.rs:232: /// Byte-size caps applied to tool `content` before it reaches history. crates/llm-worker/src/worker.rs:252: /// [`Request::cache_key`] at request build time. Pod 側では crates/llm-worker/src/worker.rs:307: /// Mirrors `on_text_block`. Some providers don't expose plaintext crates/llm-worker/src/worker.rs:320: /// Register a tool use block observer with scoped callbacks. crates/llm-worker/src/worker.rs:464: /// surfaced to a human (e.g. tool output byte-cap truncation). crates/llm-worker/src/worker.rs:477: /// Register a callback invoked once per completed tool execution. crates/llm-worker/src/worker.rs:482: /// (e.g. Pod) to forward tool results to clients. crates/llm-worker/src/worker.rs:527: /// Get a shared tool server handle. crates/llm-worker/src/worker.rs:587: /// providers (Anthropic) place a long-lived breakpoint there. crates/llm-worker/src/worker.rs:597: /// [`Request`] via [`Request::cache_key`] — caching-aware providers crates/llm-worker/src/worker.rs:609: /// Get a reference to the LLM client. crates/llm-worker/src/worker.rs:724: /// Interrupts currently running streaming or tool execution. crates/llm-worker/src/worker.rs:731: /// let worker = Arc::new(Mutex::new(Worker::new(client))); crates/llm-worker/src/worker.rs:757: /// Generate list of ToolDefinitions for LLM from registered tools crates/llm-worker/src/worker.rs:762: /// Build assistant response items from reasoning items, text blocks, and tool calls. crates/llm-worker/src/worker.rs:799: // Add tool calls as ToolCall items crates/llm-worker/src/worker.rs:823: // Add tool definitions crates/llm-worker/src/worker.rs:861: /// Check for pending tool calls (for resuming from Pause) crates/llm-worker/src/worker.rs:874: // Second pass: find unanswered tool calls crates/llm-worker/src/worker.rs:901: /// Execute tools in parallel crates/llm-worker/src/worker.rs:903: /// After running pre_tool_call hooks on all tools, crates/llm-worker/src/worker.rs:904: /// executes approved tools in parallel and applies post_tool_call hooks to results. crates/llm-worker/src/worker.rs:911: // Map from tool call ID to (ToolCall, Meta, Tool) crates/llm-worker/src/worker.rs:959: // Unknown tools go into approved list as-is (will error at execution) crates/llm-worker/src/worker.rs:964: // Phase 2: Execute approved tools in parallel (cancellable) crates/llm-worker/src/worker.rs:979: // Make tool execution cancellable crates/llm-worker/src/worker.rs:1070: // Resume pending tool calls from a previous Pause crates/llm-worker/src/worker.rs:1097: // history (notifications, cross-Pod events, system crates/llm-worker/src/worker.rs:1193: // 1:1 with AgentTurn, but retry (`llm-worker-stream-continuation`) crates/llm-worker/src/worker.rs:1240: // Do not recover tool calls from an interrupted stream. A completed crates/llm-worker/src/worker.rs:1241: // tool_use is executable only when the provider finishes the stream. crates/llm-worker/src/worker.rs:1268: // Pod-side per-item session-log committer) see each item crates/llm-worker/src/worker.rs:1526: /// Execute tools and push results to history. crates/llm-worker/src/worker.rs:1540: // observers (e.g. the Pod-side per-item session-log crates/llm-worker/src/worker.rs:1541: // committer) see each tool result as it lands. crates/llm-worker/src/worker.rs:1616: /// Register a tool factory for deferred initialization. crates/llm-worker/src/worker.rs:1625: /// Register multiple tool factories for deferred initialization. crates/llm-worker/src/worker.rs:1641: /// Install byte-size caps for tool execution `content`. crates/llm-worker/src/worker.rs:1644: /// (e.g. Pod) translate manifest configuration into a concrete crates/llm-worker/src/worker.rs:1655: /// let worker = Worker::new(client) crates/llm-worker/src/worker.rs:1669: /// let worker = Worker::new(client) crates/llm-worker/src/worker.rs:1704: /// let worker = Worker::new(client) crates/llm-worker/src/worker.rs:1719: /// Validate current configuration against the provider crates/llm-worker/src/worker.rs:1727: /// let worker = Worker::new(client) crates/llm-worker/src/worker.rs:1825: /// Flushes pending tool factories, then fixes the current system prompt crates/llm-worker/src/worker.rs:1835: /// Panics if a pending tool factory produces a duplicate name. crates/llm-worker/src/worker.rs:1886: /// Automatically loops if there are tool calls. crates/llm-worker/src/token_counter.rs:11://! 課金判断には使えないが、compact / prune / memory extract trigger 等の crates/llm-worker/src/llm_client/event.rs:8:// Core Event Types (from llm_client layer) crates/llm-worker/src/llm_client/event.rs:128:/// `data_preview` は provider から受け取った raw SSE data の bounded preview、 crates/memory/src/usage.rs:1://! Workspace-local usage event log for memory / knowledge / workflow records. crates/llm-worker/src/llm_client/capability.rs:85:/// 文字列は provider-native な effort label、数値は provider-native な crates/llm-worker/src/llm_client/scheme/mod.rs:48: /// この scheme が要求する認証形式。`build_client` 時に crates/llm-worker/src/llm_client/scheme/mod.rs:49: /// `manifest::AuthRef` と照合する。 crates/llm-worker/src/llm_client/scheme/mod.rs:81: /// `provider::capability::lookup` 側(高レベル構築層)の責務で、 crates/memory/src/workspace.rs:1://! Workspace-level path layout for the memory subsystem. crates/memory/src/workspace.rs:3://! `WorkspaceLayout` carries the workspace root (typically the Pod's crates/memory/src/workspace.rs:6://! `manifest.toml` and `prompts/`. The trees inside it: crates/memory/src/workspace.rs:8://! - `/.insomnia/workflow/.md` crates/memory/src/workspace.rs:10://! - `/.insomnia/memory/summary.md` crates/memory/src/workspace.rs:11://! - `/.insomnia/memory/decisions/.md` crates/memory/src/workspace.rs:12://! - `/.insomnia/memory/requests/.md` crates/memory/src/workspace.rs:13://! - `/.insomnia/memory/_staging/.json` crates/memory/src/workspace.rs:14://! - `/.insomnia/memory/_logs/current.log` (append-only audit log) crates/memory/src/workspace.rs:16://! `memory/` is reserved for session-derived / generated state; crates/memory/src/workspace.rs:17://! Workflows are human-managed and live one level up under crates/memory/src/workspace.rs:18://! `.insomnia/workflow/`. crates/memory/src/workspace.rs:20://! Configuring `[memory]` with an empty body is therefore sufficient crates/memory/src/workspace.rs:44:/// What kind of record a path under the memory tree represents. crates/memory/src/workspace.rs:84: /// Resolve a layout from a `MemoryConfig`, falling back to crates/memory/src/workspace.rs:85: /// `default_root` (typically the Pod's pwd) when the manifest does crates/memory/src/workspace.rs:102: /// `/.insomnia/`. The base of every other memory path. crates/memory/src/workspace.rs:127: /// Workflow directory: `/.insomnia/workflow/`. crates/memory/src/workspace.rs:148: /// Tail-friendly latest memory audit log path. crates/memory/src/workspace.rs:150: /// Operators can inspect live memory worker and tool events with: crates/memory/src/workspace.rs:151: /// `tail -f .insomnia/memory/_logs/current.log`. crates/memory/src/workspace.rs:172: /// Classify a path under the memory tree. Returns `None` if the crates/memory/src/workspace.rs:173: /// path is not under `.insomnia/memory/` or `.insomnia/knowledge/` crates/memory/src/workspace.rs:178: /// (e.g. `.insomnia/memory/decisions/Foo.md` with an invalid slug), crates/memory/src/consolidate/input.rs:4://! markdown セクション列にしてサブWorker に渡す。`docs/plan/memory.md` crates/memory/src/consolidate/input.rs:8://! 2. 既存 `memory/*` 全文(summary / decisions / requests) crates/memory/src/consolidate/input.rs:13://! 設計(`docs/plan/memory.md` §retrieval 経路 / §Consolidation の Knowledge アクセス)。 crates/memory/src/consolidate/input.rs:77:/// `/.insomnia/memory/{summary.md,decisions/*,requests/*}` を crates/memory/src/consolidate/input.rs:288: // Both staging and tidy show "(none)"; existing memory records too. crates/memory/src/linter/mod.rs:1://! Pre-write Linter for the memory subsystem. crates/memory/src/linter/mod.rs:5://! aggregating every applicable rule violation. The memory tool calls crates/memory/src/linter/mod.rs:10://! cycle detection) walk the whole `memory/` and `knowledge/` trees crates/session-store/src/lib.rs:14://! The caller (typically Pod) holds the Worker directly and calls these crates/session-store/src/lib.rs:23://! use session_store::{create_segment, restore, save_delta, FsStore, SegmentStartState}; crates/memory/src/consolidate/tidy.rs:3://! `docs/plan/memory.md` §整理(GC 相当)の扱い と crates/memory/src/consolidate/tidy.rs:4://! `tickets/memory-consolidation.md` の整理材料リストに従い、 crates/memory/src/consolidate/tidy.rs:11://! 使用頻度メトリクスベースの保護閾値情報は `tickets/memory-usage-metrics.md` crates/memory/src/consolidate/tidy.rs:136:/// `/.insomnia/memory//*.md` (Knowledge は crates/memory/src/linter/existing.rs:1://! Walks `/memory/{decisions,requests}/` and `/knowledge/` to collect crates/llm-worker/src/state.rs:20:/// - Registering tools and hooks crates/llm-worker/src/state.rs:27:/// use llm_worker::Worker; crates/llm-worker/src/state.rs:29:/// let mut worker = Worker::new(client) crates/memory/src/linter/warnings.rs:17:/// warning fires. 3 follows `docs/plan/memory.md` §Linter (`類似 slug crates/memory/src/resident.rs:1://! Workspace memory resident-enumeration helpers. crates/memory/src/resident.rs:3://! Surfaces used by the Pod system-prompt assembler: crates/memory/src/resident.rs:8://! `/.insomnia/memory/summary.md` when it parses as a summary crates/memory/src/resident.rs:11://! of `model_invokation`. Used by the Pod IPC layer to answer TUI `#` crates/memory/src/resident.rs:45:/// Read `/.insomnia/memory/summary.md` for resident prompt crates/llm-worker/src/timeline/event.rs:3://! llm_client層のイベント型をそのまま使用する。 crates/memory/src/consolidate/mod.rs:3://! extract が staging に残した活動ログを `memory/*` / `knowledge/*` に crates/memory/src/consolidate/mod.rs:5://! の観点で整理する disposable Worker を、Pod 側が組み立てるための crates/memory/src/consolidate/mod.rs:6://! ヘルパー群を提供する。Pod は次の手順で sub-Worker を構築する: crates/memory/src/consolidate/mod.rs:9://! - memory 専用 Tool (read / write / edit) と Knowledge / memory 検索ツールを登録 crates/memory/src/consolidate/mod.rs:14://! system prompt は Pod の `PromptCatalog` crates/memory/src/consolidate/mod.rs:15://! (`PodPrompt::MemoryConsolidationSystem`) で管理される。Usage report は crates/memory/src/consolidate/mod.rs:17://! (`docs/plan/memory.md` §Consolidation / 整理材料)。 crates/memory/src/extract/pointer.rs:1://! `LogEntry::Extension { domain: "memory.extract", payload }` の payload 形式と crates/memory/src/extract/pointer.rs:2://! restore 時の fold ヘルパー。memory crate がドメインを所有するので、 crates/memory/src/extract/pointer.rs:3://! session-store / Pod は payload 構造を知らない。 crates/memory/src/extract/pointer.rs:13: /// 直近 extract が処理した最後の session-store LogEntry の index。 crates/llm-worker/src/timeline/timeline.rs:358:/// use llm_worker::{Timeline, Handler, TextBlockKind, TextBlockEvent}; crates/memory/src/consolidate/lock.rs:3://! `docs/plan/memory.md` §並走防止 に従い: crates/memory/src/consolidate/lock.rs:5://! - ファイルが存在し、記録された Pod が動作している間、その Pod が排他占有 crates/memory/src/consolidate/lock.rs:25:/// 占有ファイルの中身。`pid` で stale 判定し、`pod_name` / `started_at` / crates/memory/src/consolidate/lock.rs:151: /// 次回再評価で再処理させる(`docs/plan/memory.md` §並走防止 の crates/memory/src/extract/tool.rs:5://! Pod 側はランループ完了後に `take_payload()` で取り出して crates/memory/src/extract/tool.rs:25: /// 後勝ちで上書きするが、Pod 側で warn を出したい場合に参照する。 crates/memory/src/extract/tool.rs:34: /// sub-Worker 終了後に Pod が呼んで payload を取り出す。 crates/memory/src/extract/payload.rs:3://! LLM は [`ExtractedPayload`] そのもの(source 抜き)を返し、Pod 側 crates/memory/src/extract/payload.rs:5://! source は機械付与する契約 (`docs/plan/memory.md` §Extract)。 crates/memory/src/extract/payload.rs:81:/// `source` は Pod 側ラッパーが segment_id と log entry range を crates/client/src/lib.rs:1://! Pod プロトコルを喋るクライアント。 crates/client/src/lib.rs:3://! - [`PodClient`]: 既存 pod の Unix ソケットへ接続して `Method` を送り、 crates/client/src/lib.rs:5://! - [`spawn`]: pod バイナリをサブプロセスとして起動し、`INSOMNIA-READY` crates/client/src/lib.rs:7://! ない呼び出し側 (=既存 pod に attach する場合) は使わなくてよい。 crates/client/src/lib.rs:9://! TUI / GUI / E2E ハーネスはこの crate に依存して protocol を喋る。 crates/llm-worker/src/handler.rs:35:/// use llm_worker::timeline::{Handler, TextBlockEvent, TextBlockKind}; crates/llm-worker/src/handler.rs:157:/// ToolUseBlock Kind - for tool use blocks crates/llm-worker/src/handler.rs:167: /// JSON substring of tool arguments crates/memory/src/extract/staging.rs:1://! `/.insomnia/memory/_staging/.json` への書き出しヘルパー。 crates/llm-worker/src/llm_client/retry.rs:3://! Worker が `LlmClient::stream` の open error に対して `is_retryable` を見て crates/llm-worker/src/llm_client/retry.rs:4://! retry / backoff / TUI event / cancellation をまとめて管理する。 crates/llm-worker/src/llm_client/retry.rs:11:/// `Default` は llm-worker 全体の固定値を返す。manifest 経由の上書きが crates/llm-worker/src/llm_client/retry.rs:12:/// 必要になったら拡張する(現状は不要 → `tickets/llm-worker-transient-retry.md`)。 crates/llm-worker/src/message.rs:6://! elements: messages, tool calls, tool results, and reasoning. crates/llm-worker/src/message.rs:8:// Re-export all types from llm_client::types crates/llm-worker/src/llm_client/client.rs:53: /// * `Err(ClientError)` - エラー crates/llm-worker/src/llm_client/client.rs:56: /// Clone this client into a new `Box`. crates/llm-worker/src/llm_client/client.rs:58: /// Used when a second client instance is needed (e.g. for context crates/llm-worker/src/llm_client/client.rs:82:/// `Box` に対する `LlmClient` の実装 crates/llm-worker/src/llm_client/mod.rs:15://! - [`LlmClient`] - プロバイダ共通のtrait crates/llm-worker/src/llm_client/mod.rs:16://! - `providers`: プロバイダ固有のクライアント実装 crates/llm-worker/src/llm_client/scheme/openai_responses/mod.rs:8://! - SSE イベントパース → [`Event`](crate::llm_client::event::Event) 変換: [`events`] crates/llm-worker/src/llm_client/scheme/openai_responses/mod.rs:23:/// ように受理パラメータが subset の経路では provider 層で crates/llm-worker/src/llm_client/auth.rs:4://! `crates/manifest` に置き、llm-worker はそれを知らずに済む。 crates/llm-worker/src/llm_client/auth.rs:6://! 期待するか」のランタイム記述で、manifest 側の `AuthRef` との crates/llm-worker/src/llm_client/auth.rs:7://! 照合(`AuthRef → ResolvedAuth` 変換の適否)は `crates/provider` crates/llm-worker/src/llm_client/auth.rs:11://! [`AuthProvider`] trait を `crates/provider` 側で実装し、 crates/llm-worker/src/llm_client/auth.rs:30: /// 複合ヘッダ(Codex OAuth 等、`crates/provider` 側で解決) crates/llm-worker/src/llm_client/auth.rs:38:/// 同時に注入する必要があるケースで使う。実体は `crates/provider` crates/llm-worker/src/llm_client/auth.rs:39:/// 側に置き、llm-worker は trait を知るだけ。 crates/llm-worker/src/llm_client/auth.rs:51: /// transport は provider crate の具象型を知らないため、この hook だけで crates/llm-worker/src/llm_client/scheme/anthropic/request.rs:172:/// Anthropic tool definition crates/llm-worker/src/llm_client/scheme/anthropic/request.rs:246: /// tool result boundary so one logical assistant burst becomes one crates/llm-worker/src/llm_client/scheme/anthropic/request.rs:738: /// Convenience: a turn that ends with one assistant text, one tool crates/llm-worker/src/llm_client/scheme/anthropic/request.rs:1074: // cache_control at the tools-array level. crates/client/src/spawn.rs:1://! pod バイナリをサブプロセスとして立ち上げ、`INSOMNIA-READY` を待つ crates/client/src/spawn.rs:4://! - 親プロセス (TUI / GUI / E2E) は overlay TOML を組み立ててこの関数に crates/client/src/spawn.rs:5://! 渡す。pod はそれを受けて socket を bind し、stderr に crates/client/src/spawn.rs:10://! ライフサイクルから切り離した detached pod を作る。ready 後の lifecycle crates/client/src/spawn.rs:24:/// `spawn_pod` の入力。 crates/client/src/spawn.rs:26: /// `pod.name` として使う識別子。runtime ディレクトリ crates/client/src/spawn.rs:27: /// (`manifest::paths::pod_runtime_dir`) の解決と、ready 行に乗る crates/client/src/spawn.rs:30: /// `--overlay` で pod に渡す TOML 文字列。 crates/client/src/spawn.rs:32: /// pod の current_dir。 crates/client/src/spawn.rs:37: /// true のとき `--pod ` を付与し、pod 側で name-keyed state crates/client/src/spawn.rs:38: /// があれば resume、なければ同名の新規 Pod として起動させる。 crates/client/src/spawn.rs:92:/// pod を spawn し、`INSOMNIA-READY` ハンドシェイクが終わるまで待つ。 crates/client/src/spawn.rs:126: // a detached Pod once startup succeeds: dropping the handle does not crates/client/src/spawn.rs:128: // process group do not hit the Pod. Runtime state/socket files are crates/client/src/spawn.rs:200: // Pod は exit 直前に最終 stderr 行を flush することがある。 crates/client/src/spawn.rs:202: // ぼさず PodExitedEarly に載せる。 crates/client/src/spawn.rs:260:/// Resolves the binary used to launch a child Pod. Must point at a crates/client/src/spawn.rs:261:/// `pod`-compatible executable — the parent reads the child's stderr crates/llm-worker/src/llm_client/scheme/anthropic/capability.rs:4://! (`provider::capability`)の責務。ここでは未知モデルでも「この wire で crates/llm-worker/src/llm_client/transport.rs:4://! 旧 `providers/{anthropic,openai,gemini,ollama}.rs` を置き換える。 crates/llm-worker/src/llm_client/transport.rs:30:/// `AuthRef` を解決したランタイム表現。`crates/provider` が構築する。 crates/llm-worker/src/llm_client/transport.rs:287:/// エラーレスポンスを `ClientError::Api` に変換する。 crates/llm-worker/src/llm_client/scheme/openai_chat/request.rs:86:/// OpenAI tool definition crates/llm-worker/src/llm_client/scheme/openai_chat/request.rs:101:/// OpenAI tool call in message crates/llm-worker/src/llm_client/scheme/openai_chat/request.rs:187: /// - Tool results have role "tool" with tool_call_id crates/llm-worker/src/llm_client/scheme/openai_chat/request.rs:196: // Flush pending tool calls crates/llm-worker/src/llm_client/scheme/openai_chat/request.rs:249: // Flush pending tool calls before tool result crates/pod/build.rs:4://! it bidirectionally against the `PodPrompt` enum's own key list, so crates/pod/build.rs:5://! that a mismatch fails the build (see ticket: pod-prompt-catalog). crates/llm-worker/src/usage_record.rs:4://! 1 件分にまとめたもの。`UsageEvent` (provider stream イベント) を crates/llm-worker/src/usage_record.rs:5://! 受けて呼び出し側 (typically Pod) が組み立て、永続化層 crates/llm-worker/src/usage_record.rs:6://! (session-store) に流したり、token accounting (`token_counter`) で crates/llm-worker/src/llm_client/scheme/gemini/request.rs:84:/// Gemini tool definition crates/llm-worker/src/llm_client/scheme/gemini/request.rs:104:/// Gemini tool config crates/llm-worker/src/llm_client/scheme/anthropic/events.rs:180: /// * `Err(ClientError)` - パースエラー crates/llm-worker/src/llm_client/scheme/openai_chat/capability.rs:4://! (`provider::capability`)の責務。ここでは wire の保守的 default のみ。 crates/llm-worker/src/llm_client/scheme/gemini/capability.rs:4://! 高レベル構築層(`provider::capability`)の責務。ここでは wire の crates/llm-worker/src/llm_client/scheme/openai_chat/events.rs:105: // Start of tool call (has ID) crates/llm-worker/src/llm_client/scheme/openai_chat/events.rs:186: // Start of tool call crates/llm-worker/src/llm_client/scheme/gemini/events.rs:122: /// * `Err(ClientError)` - パースエラー crates/pod/tests/pod_events_test.rs:1://! Integration tests for the `PodEvent` send / receive primitive. crates/pod/tests/pod_events_test.rs:3://! These tests drive `pod_events::fire_and_forget` and crates/pod/tests/pod_events_test.rs:4://! `pod_events::apply_event_side_effects` directly — the full crates/pod/tests/pod_events_test.rs:6://! spawn-pod tests, which rely on the same primitives. crates/pod/tests/pod_events_test.rs:65:/// Point `INSOMNIA_RUNTIME_DIR` at `dir`. The pod-registry then lives at crates/pod/tests/pod_events_test.rs:66:/// `/pods.json` and Pod runtime sub-dirs at `/{pod_name}/`. crates/pod/tests/pod_events_test.rs:97:/// Accept a single connection, send the protocol's connect-time snapshot, crates/pod/tests/pod_events_test.rs:301: // A must see the re-emission with parent_pod set to "B" (the crates/pod/tests/pod_events_test.rs:409: // Allocation is gone from the pod-registry. crates/llm-worker/src/llm_client/scheme/openai_responses/capability.rs:4://! (`provider::capability`)の責務。ここでは wire の保守的 default のみ。 crates/llm-worker/src/callback.rs:104:/// Mirrors `TextBlockScope`. Some providers (or some configurations) crates/llm-worker/src/callback.rs:129: /// the provider didn't emit any plaintext deltas. crates/llm-worker/src/callback.rs:177:/// Callback scope for a tool use block. crates/llm-worker/src/callback.rs:217:/// Per-block state for tool use closure handler. crates/llm-worker/src/lib.rs:1://! llm-worker - LLM Worker Library crates/llm-worker/src/lib.rs:8://! - [`tool::Tool`] - Tools that can be invoked by the LLM crates/llm-worker/src/lib.rs:15://! use llm_worker::{Worker, Item}; crates/llm-worker/src/lib.rs:18://! let mut worker = Worker::new(client) crates/llm-worker/src/lib.rs:21://! // Register tools (optional) crates/llm-worker/src/lib.rs:22://! // worker.register_tool(my_tool_definition)?; crates/llm-worker/examples/record_test_fixtures/main.rs:1://! Test fixture recording tool crates/llm-worker/examples/record_test_fixtures/main.rs:45: /// Client to use crates/llm-worker/examples/record_test_fixtures/main.rs:49: /// Model to use (optional, defaults per client) crates/llm-worker/src/llm_client/types.rs:1://! LLM Client Common Types crates/llm-worker/src/llm_client/types.rs:6://! - ToolCall items (tool invocations) crates/llm-worker/src/llm_client/types.rs:7://! - ToolResult items (tool results) crates/llm-worker/src/llm_client/types.rs:30:/// This is carried on [`Request`] so generic [`crate::llm_client::LlmClient`] crates/llm-worker/src/llm_client/types.rs:65:/// use llm_worker::Item; crates/llm-worker/src/llm_client/types.rs:110: /// Call ID linking to the tool call crates/llm-worker/src/llm_client/types.rs:117: /// Whether the tool result represents an execution error. crates/llm-worker/src/llm_client/types.rs:213: /// Create a tool call item crates/llm-worker/src/llm_client/types.rs:228: /// Create a tool call item from a JSON value crates/llm-worker/src/llm_client/types.rs:237: /// Create a tool result item with summary only (no content). crates/llm-worker/src/llm_client/types.rs:242: /// Create an error tool result item with summary only (no content). crates/llm-worker/src/llm_client/types.rs:247: /// Create a tool result item with summary, optional content, and error flag. crates/llm-worker/src/llm_client/types.rs:263: /// Create a tool result item with summary and content. crates/llm-worker/src/llm_client/types.rs:387: /// Check if this is a tool call crates/llm-worker/src/llm_client/types.rs:392: /// Check if this is a tool result crates/llm-worker/src/llm_client/types.rs:416:/// Tool call arguments must be a JSON object at the provider API level crates/llm-worker/src/llm_client/types.rs:519: /// post-compaction summary) set this so that caching-aware providers crates/llm-worker/src/llm_client/types.rs:526: /// ほぼヒットしないため、pod 側で `SegmentId` を渡す運用を想定。 crates/llm-worker/src/llm_client/types.rs:528: /// 別の概念。`cache_anchor` を読まない provider と同じく、 crates/llm-worker/src/llm_client/types.rs:529: /// `prompt_cache_key` を持たない provider は無視する。 crates/llm-worker/src/llm_client/types.rs:572: /// Add a tool definition crates/llm-worker/src/llm_client/types.rs:648: /// Create a new tool definition crates/llm-worker/examples/record_test_fixtures/scenarios.rs:38:/// Response with tool call crates/pod/examples/pod_cli.rs:1://! Minimal example: Pod running a single prompt with persistence. crates/pod/examples/pod_cli.rs:3://! Demonstrates the core insomnia abstraction — a TOML manifest drives crates/pod/examples/pod_cli.rs:4://! provider selection, model config, and system prompt, while FsStore crates/pod/examples/pod_cli.rs:11://! cargo run -p pod --example pod_cli crates/pod/examples/pod_cli.rs:44: // 1. Build a manifest rooted at the current working directory. crates/pod/examples/pod_cli.rs:45: // All paths in a manifest must be absolute — see the pod-factory ticket. crates/pod/examples/pod_cli.rs:53: // 3. Build the Pod from the single-layer manifest TOML crates/llm-worker/examples/worker_cli.rs:1://! Interactive CLI client using Worker crates/llm-worker/examples/worker_cli.rs:3://! A CLI application for interacting with multiple LLM providers (Anthropic, Gemini, OpenAI, Ollama). crates/llm-worker/examples/worker_cli.rs:4://! Demonstrates tool registration and execution, and streaming response display. crates/llm-worker/examples/worker_cli.rs:18://! cargo run --example worker_cli -- --provider gemini crates/llm-worker/examples/worker_cli.rs:21://! cargo run --example worker_cli -- --provider openai --model gpt-4o crates/llm-worker/examples/worker_cli.rs:24://! cargo run --example worker_cli -- --provider ollama --model llama3.2 crates/llm-worker/examples/worker_cli.rs:27://! cargo run --example worker_cli -- --provider anthropic --model claude-3-haiku-20240307 --system "You are a helpful assistant." crates/llm-worker/examples/worker_cli.rs:65:/// Available LLM providers crates/llm-worker/examples/worker_cli.rs:80: /// Default model for the provider crates/llm-worker/examples/worker_cli.rs:90: /// Display name for the provider crates/llm-worker/examples/worker_cli.rs:115:/// Interactive CLI client supporting multiple LLM providers crates/llm-worker/examples/worker_cli.rs:125: /// Model name to use (defaults to provider's default if not specified) crates/llm-worker/examples/worker_cli.rs:133: /// Disable tools crates/llm-worker/examples/worker_cli.rs:230:/// Handler that displays tool calls crates/llm-worker/examples/worker_cli.rs:274:/// Policy that displays tool execution results. crates/llm-worker/examples/worker_cli.rs:306:// Client Creation crates/llm-worker/examples/worker_cli.rs:309:/// Get API key based on provider crates/llm-worker/examples/worker_cli.rs:316: // Check environment variable based on provider crates/llm-worker/examples/worker_cli.rs:330:/// Create client based on provider crates/llm-worker/examples/worker_cli.rs:447: // Create client crates/llm-worker/examples/worker_cli.rs:466: // Register tools (unless --no-tools) crates/pod/examples/pod_protocol.rs:1://! Pod Protocol example: control a Pod via PodHandle and stream events. crates/pod/examples/pod_protocol.rs:5://! cargo run -p pod --example pod_protocol crates/pod/examples/pod_protocol.rs:38: // All manifest paths must be absolute — see the pod-factory ticket. crates/lint-common/src/lib.rs:1://! Shared record lint primitives for memory and workflow files. crates/lint-common/src/lib.rs:9:/// Common lint errors for Markdown record syntax shared by memory and workflow. crates/tui/src/input.rs:11://! back to their original captured content so the Pod sees the full crates/tui/src/input.rs:36:/// Directories remain valid chips because Pod resolves normal directory refs crates/tui/src/input.rs:61:/// `/` chip — confirmed completion of a Workflow invocation. crates/tui/src/input.rs:100: /// Indivisible chip — paste / file ref / knowledge ref / workflow crates/tui/src/input.rs:147: /// Monotonic counter reused across the TUI process lifetime. crates/tui/src/input.rs:175: /// Replace the whole composer with protocol segments previously emitted crates/tui/src/input.rs:315: /// text (e.g. the `/` in `src/main.rs` is not a workflow trigger). crates/tui/src/input.rs:500: /// Build the typed `Vec` sent over the protocol. Adjacent crates/tui/src/input.rs:502: /// chip atom (`Paste` / `FileRef` / `KnowledgeRef` / `WorkflowInvoke`) crates/tui/src/input.rs:503: /// becomes a standalone `Segment` so that clients re-rendering an crates/pod/src/ipc/interceptor.rs:1://! Pod-owned `Interceptor` implementation. crates/pod/src/ipc/interceptor.rs:3://! Bridges Pod's internal mechanisms (compaction trigger today; crates/pod/src/ipc/interceptor.rs:55: /// `PromptAction::ContinueWith`. Populated by `Pod::run` crates/pod/src/ipc/interceptor.rs:63: /// worker. `None` in tests / `Pod::new` paths where no writer is crates/pod/src/ipc/event.rs:1://! `PodEvent` send / receive helpers. crates/pod/src/ipc/event.rs:4://! (`PodEvent`) that children fire upward on turn-end / error / crates/pod/src/ipc/event.rs:7://! - **Send** a `Method::PodEvent` to the parent socket, fire-and-forget, crates/pod/src/ipc/event.rs:11://! - **Apply side effects** on the parent (registry / pod-registry crates/pod/src/ipc/event.rs:16://! callbacks are an optimisation and `ListPods` + `reclaim_stale` are crates/pod/src/ipc/event.rs:33:/// Connect to `socket`, send a single `Method::PodEvent(event)`, and crates/pod/src/ipc/event.rs:43:/// `socket` is `None`, no send happens (top-level Pods have no parent). crates/pod/src/ipc/event.rs:58:/// Kept deliberately short — the LLM can always call `ReadPodOutput` crates/pod/src/ipc/event.rs:88:/// - `ShutDown`: remove the child from `spawned_pods.json`, Pod state, crates/pod/src/ipc/server.rs:11:/// Unix socket server for Pod Protocol. crates/pod/src/ipc/server.rs:13:/// Listens on the Pod's runtime directory socket path. crates/pod/src/ipc/server.rs:14:/// Each client connection gets bidirectional JSONL: crates/pod/src/ipc/server.rs:15:/// - Client writes Method lines → forwarded to PodController crates/pod/src/ipc/server.rs:16:/// - Pod events → written as Event lines to all connected clients crates/pod/src/ipc/server.rs:23: /// Start listening on the PodHandle's socket path. crates/pod/src/ipc/server.rs:73: // warnings emitted before this client connected are replayed crates/pod/src/ipc/server.rs:143: // Slow client fell behind the broadcast buffer. crates/pod/src/ipc/server.rs:151: // Broadcast events → this client crates/pod/src/ipc/server.rs:162: // Client methods → handle or forward to controller crates/session-store/tests/session_test.rs:31: // 1st response: tool call crates/session-store/tests/session_test.rs:93:/// Run a worker turn and persist via session-store functions. crates/session-store/tests/session_test.rs:102: // Mirror Pod's run-entry contract: log the user input as segments crates/session-store/tests/session_test.rs:273: // First run: tool call with pause policy → Paused crates/session-store/tests/session_test.rs:449: // Simulate another Pod writing to the same segment behind our back. crates/memory/src/extract/input.rs:3://! `crates/pod/src/pod.rs::build_summary_prompt` と同じ方針で crates/memory/src/extract/input.rs:4://! Item 列を flat な行に落とす(reasoning は省く、tool call は名前のみ、 crates/memory/src/extract/input.rs:5://! tool result は summary のみ)。conversation 全体を Markdown の単一 crates/llm-worker/src/llm_client/scheme/openai_responses/events.rs:3://! `response.*` 名前空間の SSE を共通の [`Event`](crate::llm_client::event::Event) crates/llm-worker/src/llm_client/scheme/openai_responses/events.rs:310:/// 必要なフィールドが抜けている等は [`ClientError::Api`] で返す。 crates/llm-worker/src/llm_client/scheme/openai_responses/events.rs:997: // flat index が別々になる(Parallel tool calling の基本)。 crates/llm-worker/src/tool_server.rs:14: /// A tool with the same name already exists. crates/llm-worker/src/tool_server.rs:17: /// Requested tool was not found. crates/llm-worker/src/tool_server.rs:25:/// In-memory tool server. crates/llm-worker/src/tool_server.rs:33: /// Create a new empty tool server. crates/llm-worker/src/tool_server.rs:47:/// Shareable handle to a tool server. crates/llm-worker/src/tool_server.rs:55: /// Queue a tool factory for deferred initialization. crates/llm-worker/src/tool_server.rs:67: /// Queue many tool factories for deferred initialization. crates/llm-worker/src/tool_server.rs:73: /// Execute all pending factories and register the resulting tools. crates/llm-worker/src/tool_server.rs:76: /// Exposed as `pub` so higher layers (e.g. Pod) can force-materialise crates/llm-worker/src/tool_server.rs:77: /// tools earlier — for example when building a system-prompt template crates/llm-worker/src/tool_server.rs:78: /// context that needs the list of registered tool names. Redundant crates/llm-worker/src/tool_server.rs:83: /// Panics if any factory produces a tool whose name collides with crates/llm-worker/src/tool_server.rs:84: /// an already-registered tool. Duplicate names are a programming crates/llm-worker/src/tool_server.rs:107: /// Get a tool by name for hook contexts. crates/llm-worker/src/tool_server.rs:115: /// Execute a tool by name. crates/llm-worker/src/tool_server.rs:133: /// Remove a registered tool by name. crates/llm-worker/src/tool_server.rs:145: /// Replace an existing tool with a new implementation. crates/llm-worker/src/tool_server.rs:147: /// The factory is called immediately and the resulting tool overwrites crates/llm-worker/src/tool_server.rs:149: /// produced by the factory does not match any registered tool. crates/llm-worker/src/tool_server.rs:160: /// Build deterministic tool definitions sorted by tool name. crates/llm-worker/src/tool_server.rs:212: // Before flush, no tools are available crates/llm-worker/src/tool_server.rs:217: // After flush, tools are available crates/llm-worker/src/tool_server.rs:296: // Replace with a tool that returns a fixed string. crates/llm-worker/src/tool_server.rs:389: // Wait until the tool is actually executing. crates/llm-worker/src/tool_server.rs:392: // Unregister while the tool is mid-execution. crates/llm-worker/src/tool_server.rs:442: // Wait until the old tool is mid-execution. crates/llm-worker/src/tool_server.rs:445: // Replace while the old tool is executing. crates/llm-worker/src/llm_client/scheme/openai_responses/request.rs:54: /// 無いとプロンプトキャッシュがほぼ効かない。pod 側は `SegmentId` crates/llm-worker/src/llm_client/scheme/openai_responses/request.rs:85: /// 過去の function tool 呼び出し(assistant 側)。 crates/llm-worker/src/llm_client/scheme/openai_responses/request.rs:92: /// function tool の結果(user 側)。 crates/llm-worker/src/llm_client/scheme/openai_responses/request.rs:138:/// Responses 用 tool 定義。Chat と違い function キーでネストせず crates/pod/tests/controller_test.rs:17:/// log mirror held by the Pod's broadcast sink. Replaces the previous crates/pod/tests/controller_test.rs:18:/// `PodSharedState.history()` test helper now that the mirror lives in crates/pod/tests/controller_test.rs:45:// Mock LLM Client crates/pod/tests/controller_test.rs:172: // Separate tempdir to serve as the Pod's pwd/scope — these tests crates/pod/tests/controller_test.rs:173: // exercise the controller via a mock client and never touch the crates/pod/tests/controller_test.rs:174: // filesystem through tools, so a throwaway writable dir is enough. crates/pod/tests/controller_test.rs:251:/// Mid-turn re-attach: a client connecting while the worker is still crates/pod/tests/controller_test.rs:255:/// view without needing the prior client's diff. crates/pod/tests/controller_test.rs:524: // Mixed input: plain text + a paste chip + trailing text. Pod must crates/pod/tests/controller_test.rs:528: // unchanged so other clients can re-render the chip. crates/pod/tests/controller_test.rs:791: // PodInterceptor::pending_history_appends and cloned into the crates/pod/tests/controller_test.rs:1313: // our hanging tool. The Worker commits the ToolCall to history, crates/pod/tests/controller_test.rs:1314: // then parks inside `execute_tools` waiting on the tool — which is crates/pod/tests/controller_test.rs:1345: // right before the Worker enters tool execution and pends. crates/pod/tests/controller_test.rs:1369: // New user input while Paused → `Pod::run` observes crates/pod/tests/restore_test.rs:1://! Integration tests for `Pod::restore_from_manifest`'s pre-build crates/pod/tests/restore_test.rs:4://! These cases all return before `prepare_pod_common` runs, so they crates/pod/tests/restore_test.rs:5://! do not need a real LLM client or pod-registry environment — only the crates/pod/tests/restore_test.rs:6://! session store needs to be present. crates/pod/tests/restore_test.rs:133: // NotFound, which `Pod::restore_from_manifest` surfaces verbatim crates/pod/tests/restore_test.rs:134: // as `PodError::Store`. crates/pod/tests/restore_test.rs:163: // which `restore_from_manifest` rejects with `SegmentEmpty` *before* crates/pod/tests/restore_test.rs:164: // it gets as far as building the LLM client. crates/memory/src/extract/mod.rs:3://! 通常 Pod の post-run hook で発火する disposable Worker と、その crates/memory/src/extract/mod.rs:4://! 出力を `/.insomnia/memory/_staging/.json` に書き出す crates/memory/src/extract/mod.rs:5://! ヘルパーを提供する。Pod 側はこのモジュールから: crates/memory/src/extract/mod.rs:8://! - [`write_extracted_tool`] を唯一のツールとして crates/memory/src/extract/mod.rs:11://! の順で組み立てる。system prompt は Pod の `PromptCatalog` crates/memory/src/extract/mod.rs:12://! (`PodPrompt::MemoryExtractSystem`) で管理される。pointer 永続化 crates/memory/src/extract/mod.rs:13://! (session-store の `LogEntry::Extension`、domain `"memory.extract"`)は crates/memory/src/extract/mod.rs:14://! Pod 側が責務を持つ。 crates/memory/src/extract/mod.rs:33:/// session-store `LogEntry::Extension` で使う domain 名。 crates/llm-worker/src/tool.rs:3://! Traits for defining tools callable by LLM. crates/llm-worker/src/tool.rs:4://! Usually auto-implemented using the `#[tool]` macro. crates/llm-worker/src/tool.rs:14:/// Error during tool execution crates/llm-worker/src/tool.rs:32:/// Threshold below which tool output is treated as summary-only (no content). crates/llm-worker/src/tool.rs:36:/// Byte-size caps applied to tool execution `content` at the Worker's crates/llm-worker/src/tool.rs:37:/// tool-execution boundary, before results enter conversation history. crates/llm-worker/src/tool.rs:39:/// Exists so a single oversized tool result (e.g. a wide `Glob` scan) crates/llm-worker/src/tool.rs:40:/// cannot blow past the provider's per-minute input-token rate limit. crates/llm-worker/src/tool.rs:41:/// Individual tools are not trusted to self-limit — this is the single crates/llm-worker/src/tool.rs:49: /// Cap applied to any tool not listed in `per_tool`. crates/llm-worker/src/tool.rs:51: /// Per-tool overrides, keyed by tool registration name. crates/llm-worker/src/tool.rs:56: /// Resolve the cap for a given tool name. crates/llm-worker/src/tool.rs:133:/// Used for sending tool definitions to LLM. crates/llm-worker/src/tool.rs:182:/// ToolMeta::new("my_tool") crates/llm-worker/src/tool.rs:183:/// .description("My tool description") crates/llm-worker/src/tool.rs:188:/// worker.register_tool(def)?; crates/llm-worker/src/tool.rs:196:/// Trait for defining tools callable by LLM crates/llm-worker/src/tool.rs:209:/// #[tool] crates/llm-worker/src/tool.rs:216:/// worker.register_tool(app.search_definition())?; crates/llm-worker/src/tool.rs:222:/// use llm_worker::tool::{Tool, ToolError, ToolMeta, ToolDefinition}; crates/llm-worker/src/tool.rs:237:/// ToolMeta::new("my_tool") crates/llm-worker/src/tool.rs:238:/// .description("My custom tool") crates/llm-worker/src/tool.rs:246: /// Execute the tool. crates/llm-worker/src/tool.rs:276:/// Intermediate representation between tool execution and history. crates/llm-worker/src/tool.rs:280: /// Corresponding tool call ID crates/pod/tests/spawn_pod_test.rs:1://! Integration tests for the `SpawnPod` tool. crates/pod/tests/spawn_pod_test.rs:3://! These tests exercise the tool's pod-registry delegation, subprocess crates/pod/tests/spawn_pod_test.rs:4://! launch, socket handoff, and `spawned_pods.json` write without relying crates/pod/tests/spawn_pod_test.rs:5://! on the real `pod` binary. `INSOMNIA_POD_COMMAND` is pointed at crates/pod/tests/spawn_pod_test.rs:7://! listener pre-binds the predicted socket path, so the tool sees the crates/pod/tests/spawn_pod_test.rs:43:/// `pods.json` and per-Pod runtime subdirs both land in the crates/pod/tests/spawn_pod_test.rs:45:/// tool has something to delegate from. Returns the tempdir (keeps it crates/pod/tests/spawn_pod_test.rs:80: // tool call. Dropping it would auto-release the allocation, which crates/pod/tests/spawn_pod_test.rs:87:/// Bind a Unix listener at the path the tool will predict for the crates/pod/tests/spawn_pod_test.rs:88:/// spawned pod. The tool only needs the socket to accept a connection crates/pod/tests/spawn_pod_test.rs:101:/// inside the tool makes a probe connection that carries no data, so the crates/pod/tests/spawn_pod_test.rs:145:/// child via a mock socket — but `spawn_pod_tool` needs a value to crates/pod/tests/spawn_pod_test.rs:146:/// embed in the overlay TOML. Any well-formed `ModelManifest` works. crates/pod/tests/spawn_pod_test.rs:159:/// `setup_spawner`. The tool revokes Write rules from this scope on crates/pod/tests/spawn_pod_test.rs:224: // Verify the tool delivered Method::Run to the socket. crates/pod/tests/spawn_pod_test.rs:234: // Verify pod_registry has the child allocation under `root`. crates/pod/tests/spawn_pod_test.rs:244: // Verify spawned_pods.json was written. crates/pod/tests/spawn_pod_test.rs:336: // tool's wait_for_socket should time out, triggering rollback. crates/pod/tests/spawn_pod_test.rs:342: // As the tool's timeout is internal, we accept the 10s wait here — crates/tui/src/task.rs:1://! In-TUI mirror of the session-lifetime task store. crates/tui/src/task.rs:3://! This deliberately does NOT depend on `tools::TaskStore`. The TUI is a crates/tui/src/task.rs:4://! presentation layer; pulling in `tools` would drag along `llm-worker` crates/tui/src/task.rs:5://! and the whole tool surface. Instead we mirror the small subset we crates/tui/src/task.rs:8://! - `TaskEntry` / `TaskStatus`: shaped to round-trip with `tools`'s JSON crates/tui/src/task.rs:12://! tool-call arguments and the `[Session TaskStore snapshot]` system crates/tui/src/task.rs:15://! The snapshot text format is owned by `tools::render_snapshot`. Since crates/tui/src/task.rs:16://! `tools` itself parses it back on resume, the shape is a stable crates/tui/src/task.rs:92: /// tool names and unparseable JSON are silent no-ops, matching the crates/tui/src/task.rs:93: /// resilience of `tools::TaskStore::replay_history`. crates/tui/src/task.rs:239: /// Snapshot text matches the wrapping `Pod::try_pre_run_compact` / crates/tui/src/task.rs:240: /// `tools::render_snapshot` produce: header line, blank, overview crates/tui/src/task.rs:316:/// Cross-crate contract tests. The TUI deliberately re-implements a crates/tui/src/task.rs:317:/// stripped-down mirror of `tools::TaskStore` instead of depending on crates/tui/src/task.rs:319:/// means a format change on the tools side — a renamed field on crates/tui/src/task.rs:321:/// JSON wrapper — would silently leave the TUI parsing nothing instead crates/tui/src/task.rs:324:/// These tests pull `tools` in as a dev-dependency so the contract is crates/tui/src/task.rs:326:/// changed (update both sides) or the TUI mirror has drifted (re-sync crates/tui/src/task.rs:333: /// Mirrors the envelope `Pod::try_pre_run_compact` wraps the raw crates/tui/src/task.rs:396: // A single `tools::TaskEntry` round-tripped through JSON. Field crates/tui/src/task.rs:398: // the tools side would surface here as a serde failure or a crates/tui/src/task.rs:414: // valid snapshot envelope. The TUI must parse it as "zero crates/tui/src/task.rs:419: // Seed the TUI store with stale state to confirm replacement. crates/pod/tests/compact_events_test.rs:72:/// `single_text_events` + a UsageEvent so the Pod's `usage_history` crates/pod/tests/compact_events_test.rs:122:// `compact_request_threshold` drives the PodInterceptor's mid-turn yield crates/pod/tests/compact_events_test.rs:218:/// Pod metadata starts with a reserved Session and no Segment, then becomes crates/pod/tests/compact_events_test.rs:249:/// Pod's back, the next run's `ensure_segment_head` detects the crates/pod/tests/compact_events_test.rs:289: // the on-disk entry count past the Pod's own append tally without crates/pod/tests/compact_events_test.rs:290: // updating the Pod's `entries_written`. crates/pod/tests/compact_events_test.rs:305: // The Pod moved to a new segment in the same Session. crates/pod/tests/compact_events_test.rs:368: // messages introduced by the compactor. Clients re-seed their view crates/pod/tests/compact_events_test.rs:441: // [1] compact worker emits `write_summary` tool call. crates/pod/tests/compact_events_test.rs:489:/// Regression: `Pod::compact()` must reset the in-memory crates/pod/tests/compact_events_test.rs:546: // [2] extract worker closes after the tool result. crates/pod/tests/compact_events_test.rs:548: // [4] compact worker closes after the tool result. crates/pod/tests/compact_events_test.rs:567: // Compact runs. Without the fix the in-memory pointer would still crates/pod/tests/compact_events_test.rs:580:/// without removing the `[memory]` section. crates/pod/tests/compact_events_test.rs:656:// Detached post-run memory jobs (`spawn_post_run_memory_jobs` / crates/pod/tests/compact_events_test.rs:657:// `wait_for_memory_jobs`). Covers the detach round-trip and the structural crates/pod/tests/compact_events_test.rs:658:// invariant that the cloned memory-task Pod shares `SegmentState` with the crates/pod/tests/compact_events_test.rs:659:// source Pod, so that `save_extension` from the background extract does not crates/pod/tests/compact_events_test.rs:729: // Source pod and the cloned memory-task pod share `SegmentState` via crates/llm-worker/src/prune.rs:1://! Prune — context projection for old tool-result content. crates/llm-worker/src/prune.rs:11://! 射影の適用は上位層(`pod::prune_hook` 等)が LLM に送る一時コンテキスト crates/llm-worker/src/prune.rs:78:/// branch. Pod 等の上位層が install して metrics を発行する。 crates/llm-worker/src/prune.rs:205: /// Helper: build a history with interleaved user messages and tool results. crates/pod/tests/session_metrics_test.rs:3://! Drives a Pod with a scripted mock LLM client and a custom tool that crates/pod/tests/session_metrics_test.rs:8://! unavailable or the protected-token window covers all tool results. crates/pod/tests/session_metrics_test.rs:187:/// Drive Pod through enough runs to exercise both skip-no_candidates and crates/pod/tests/session_metrics_test.rs:192: // Run 1 (request 0): tool_use → triggers tool execution → request 1 crates/pod/tests/session_metrics_test.rs:206: // runs complete — the Pod retains its own copy. crates/pod/tests/session_metrics_test.rs:215: // Run 1 has 2 LLM iterations (tool loop), each evaluates prune with crates/pod/tests/session_metrics_test.rs:421:/// fires on the alerter so the TUI surface picks it up. crates/pod/tests/session_metrics_test.rs:436: // Even with a tool registered, this run will only emit crates/pod/tests/session_metrics_test.rs:460: // The alerter saw at least one Warn from AlertSource::Pod. crates/pod/tests/session_metrics_test.rs:482: // Manifest without any `[compaction]` section → prune (and therefore crates/pod/src/ipc/alerter.rs:1://! User-facing alert channel for Pod → client. crates/pod/src/ipc/alerter.rs:4://! are short human-readable messages the Pod layer wants a client to crates/pod/src/ipc/alerter.rs:5://! see — for example "compaction failed", "tool output truncated". crates/pod/src/ipc/alerter.rs:8://! also appended to an in-memory buffer so that clients connecting crates/pod/src/ipc/alerter.rs:21:/// memory through a pathological loop of recurring alerts crates/pod/src/ipc/alerter.rs:47: /// The broadcast may have no subscribers (e.g. during Pod crates/pod/src/ipc/alerter.rs:48: /// construction before any client has connected); the buffer crates/pod/src/ipc/alerter.rs:49: /// guarantees the message is still delivered once a client crates/pod/src/ipc/alerter.rs:53: /// `subscribe_with_snapshot` race-free — a client that snapshots crates/pod/tests/consolidation_test.rs:1://! consolidation (memory.consolidation) post-run trigger. crates/pod/tests/consolidation_test.rs:4://! full sub-worker tool loop: crates/pod/tests/consolidation_test.rs:6://! - no `[memory]` section → no-op crates/pod/tests/consolidation_test.rs:7://! - `[memory]` present but no thresholds → no-op crates/pod/tests/consolidation_test.rs:385: // tells it to call memory tools; the mock skips those, but `Worker::run` crates/pod/tests/consolidation_test.rs:442: // Sanity: when the flag is cleared, the same pod fires normally and crates/pod/tests/consolidation_test.rs:460: // Coalesce semantics from `docs/plan/memory.md` §並走防止: a single crates/tui/src/cache.rs:3://! Holds `path → content` for every file the TUI has observed via a crates/tui/src/cache.rs:31: /// cache untouched (the TUI can't reliably reconstruct the new crates/tui/src/cache.rs:38: // tool's own precondition and keeps the cache from diverging crates/pod-registry/src/error.rs:1://! Error type for mutating pod-registry operations. crates/pod-registry/src/error.rs:9:/// Errors raised by the mutating pod-registry operations. crates/pod/tests/system_prompt_template_test.rs:16:// Mock LLM Client crates/pod/tests/system_prompt_template_test.rs:64:/// Emit a single `write_summary(text=...)` tool call as one LLM response. crates/pod/tests/system_prompt_template_test.rs:94:/// Build a Pod with a synthetic instruction template. crates/pod/tests/system_prompt_template_test.rs:98:/// a Pod constructed directly via `Pod::new`. crates/tui/src/tool.rs:1://! Per-tool renderers. crates/tui/src/tool.rs:3://! Each tool name has a custom renderer that converts a crates/tui/src/tool.rs:5://! tools fall back to [`render_default`]. Some renderers (notably crates/tui/src/tool.rs:17:/// Maximum body lines in normal mode for tool output previews. crates/tui/src/tool.rs:292: // positions say — Edit never wants to panic the whole TUI just crates/tui/src/tool.rs:550:// Default (unknown tool) crates/tui/src/tool.rs:594: // Detail mode can expose it. Fall back to the summary when the tool crates/pod/tests/pod_comm_tools_test.rs:1://! Integration tests for the pod-comm tools (`SendToPod`, crates/pod/tests/pod_comm_tools_test.rs:2://! `ReadPodOutput`, `StopPod`, `ListPods`). crates/pod/tests/pod_comm_tools_test.rs:4://! The real child Pod binary is not started. Instead each test stands crates/pod/tests/pod_comm_tools_test.rs:5://! up a mock `UnixListener` that speaks the socket protocol directly: crates/pod/tests/pod_comm_tools_test.rs:9://! LLM layer — the tools are exercised for their wire behaviour alone. crates/pod/tests/pod_comm_tools_test.rs:78:/// Create a spawner-owned `RuntimeDir` + `SpawnedPodRegistry` scoped to crates/pod/tests/pod_comm_tools_test.rs:91:/// pods.json. crates/pod/tests/pod_comm_tools_test.rs:136:/// Accept one connection, send the protocol's connect-time snapshot, crates/pod/tests/pod_comm_tools_test.rs:150:/// Accept one connection, send the protocol's connect-time snapshot, crates/pod/tests/pod_comm_tools_test.rs:151:/// read one `Method`, then write `response` back. Used by `SendToPod` crates/pod/tests/pod_comm_tools_test.rs:172:/// Pretend to be a spawned Pod whose connect-time snapshot carries a crates/pod/tests/pod_comm_tools_test.rs:174:/// every accept — the real Pod does the same, so `ReadPodOutput`'s crates/pod/tests/pod_comm_tools_test.rs:251:// SendToPod crates/pod/tests/pod_comm_tools_test.rs:259: // ack with `TurnStart` so `SendToPod`'s confirmation loop succeeds. crates/pod/tests/pod_comm_tools_test.rs:325:// ReadPodOutput crates/pod/tests/pod_comm_tools_test.rs:368: // on. Connect must fail → tool reports "stopped". crates/pod/tests/pod_comm_tools_test.rs:380:// StopPod crates/pod/tests/pod_comm_tools_test.rs:405: // Seed pods.json with a restored top-level `spawner` allocation whose crates/pod/tests/pod_comm_tools_test.rs:407: // allocation — mimics a parent resumed after SpawnPod. crates/pod/tests/pod_comm_tools_test.rs:476: // spawned_pods.json now lists zero children. crates/pod/tests/pod_comm_tools_test.rs:492: // at a dead path. StopPod should still clean up local bookkeeping. crates/pod/tests/pod_comm_tools_test.rs:727:// ListPods crates/tui/src/picker.rs:1://! Inline-viewport "pick a Pod to attach or restore" UX. crates/tui/src/picker.rs:3://! Reads live Pod allocations from the runtime registry and stopped Pod state crates/tui/src/picker.rs:4://! from the session store's name-keyed metadata. Picking a live row attaches to crates/tui/src/picker.rs:5://! its socket; picking a stopped row restores via `pod --pod `. crates/tui/src/picker.rs:65: /// User picked a Pod. `socket_override` is set for live rows when the crates/tui/src/picker.rs:67: /// empty so the caller restores with `pod --pod `. crates/tui/src/picker.rs:102:/// One row in the Pod picker. The primary key is the Pod name; Session/Segment crates/pod-registry/src/lifecycle.rs:15:/// Pod's entry. The guard keeps only the name + lock-file path; it crates/pod-registry/src/lifecycle.rs:16:/// does not hold the `flock` for the Pod's lifetime. crates/pod-registry/src/lifecycle.rs:41:/// Open the default lock file, register a top-level Pod, and return a crates/pod-registry/src/lifecycle.rs:53:/// Open the default lock file, register a top-level Pod with explicit crates/pod-registry/src/lifecycle.rs:82:/// a spawning Pod. crates/pod-registry/src/lifecycle.rs:110:/// Rewrite the `segment_id` recorded for `pod_name` to crates/pod-registry/src/lifecycle.rs:113:/// The Pod's in-memory `segment_id` can change underneath the crates/pod-registry/src/lifecycle.rs:116:/// - `Pod::compact` mints a fresh session and swaps it in. crates/pod-registry/src/lifecycle.rs:117:/// - `session_store::ensure_head_or_fork` auto-forks when another crates/pod-registry/src/lifecycle.rs:122:/// concurrent `restore_from_manifest(new_id)` would see "no live crates/pod-registry/src/lifecycle.rs:124:/// session this Pod just moved into. crates/pod-registry/src/lifecycle.rs:150:/// Information about a Pod that currently holds an allocation for a crates/pod-registry/src/lifecycle.rs:162:/// Used by `Pod::restore_from_manifest` to refuse a resume that would crates/pod/src/ipc/notify_buffer.rs:1://! Pending-notify buffer for `Method::Notify` and `Method::PodEvent`. crates/pod/src/ipc/notify_buffer.rs:5://! `PodInterceptor::pending_history_appends`, which the Worker calls crates/pod/src/ipc/notify_buffer.rs:13://! This is the **single lane** for "system messages produced by Pod crates/pod/src/ipc/notify_buffer.rs:14://! state that should land in the next LLM request": Notify, PodEvent, crates/pod/src/ipc/notify_buffer.rs:49:/// Cloned between the Pod (producer) and PodInterceptor (consumer). crates/pod/src/ipc/notify_buffer.rs:67: /// Push a typed pod-event entry onto the queue. crates/pod/src/ipc/notify_buffer.rs:103:/// `Notify` (raw message) and `PodEvent` (rendered event line). crates/tools/src/task.rs:1://! Session-lifetime TaskStore and builtin task tools. crates/tools/src/task.rs:3://! The store survives compaction and Pod restart — it is reconstructed crates/tools/src/task.rs:4://! on resume by replaying TaskCreate / TaskUpdate tool-call arguments crates/tools/src/task.rs:6://! [`session_store::SessionId`] (the conversation), not the Pod process. crates/tools/src/task.rs:551: /// Wrap snapshot text the way `Pod::try_pre_run_compact` does, so tests crates/tools/src/task.rs:660: // Mirrors `Pod::try_pre_run_compact`'s synthetic insertion: crates/tools/src/task.rs:663: // contract every provider request builder relies on (matched call_id, crates/tools/src/task.rs:664: // tool name, content recoverable to the same TaskStore state). crates/tools/src/task.rs:685: // expected tool name + detailed content. crates/tui/src/markdown.rs:4://! into the rest of the TUI's wrap/scroll pipeline. Scope (which Markdown crates/tui/src/block.rs:1://! History blocks: the unit of the TUI's stored display model. crates/tui/src/block.rs:3://! The TUI holds a flat `Vec` and re-renders it every frame. crates/tui/src/block.rs:5://! queuing a new line, so one logical thing (a tool call, an assistant crates/tui/src/block.rs:23: /// element. File refs, auto-read snippets, workflow bodies, and future crates/tui/src/block.rs:28: /// Echo of `Method::Notify` received by this Pod, surfaced as a log crates/tui/src/block.rs:34: /// Echo of `Method::PodEvent` received by this Pod. Same role as crates/tui/src/block.rs:61: /// Accumulated reasoning body. Empty for providers that emit only crates/tui/src/block.rs:94: /// The TUI stopped observing events before a terminal compact event. crates/tui/src/block.rs:106: /// For Edit tool calls: snapshot of the file content *before* the crates/tui/src/block.rs:118: /// `ToolCallDone` received, waiting on the tool result. crates/workflow/src/skill.rs:7://! it as a Workflow so `/` resolves to it just like an internal crates/workflow/src/skill.rs:8://! Workflow. crates/workflow/src/skill.rs:12://! skills loadable. Internal Workflows (`.insomnia/workflow/.md`) keep crates/workflow/src/skill.rs:34:/// `metadata` are documentary, while `allowed-tools` is recognised and crates/workflow/src/skill.rs:52:/// to a `WorkflowRecord` by the caller via the `Skill → Workflow` crates/workflow/src/skill.rs:53:/// projection in [`crate::WorkflowRecord`]. crates/workflow/src/skill.rs:60: /// register `scripts/` / `references/` / `assets/` against the Pod's crates/workflow/src/skill.rs:64: /// the resulting `WorkflowRecord`. crates/workflow/src/skill.rs:69: /// Project this skill into a [`WorkflowRecord`]. Skill-sourced crates/workflow/src/skill.rs:70: /// Workflows are advertised resident (`model_invokation: true`, crates/workflow/src/skill.rs:392: // allowed-tools triggers a warn, but parse succeeds. crates/pod-registry/src/table.rs:20:/// One Pod's scope allocation. crates/pod-registry/src/table.rs:22:/// `scope_allow` is the full set of allow rules the Pod was granted. crates/pod-registry/src/table.rs:23:/// Portions delegated out to child Pods are **not** subtracted in crates/pod-registry/src/table.rs:25:/// removing rules owned by any Pod whose `delegated_from` points to crates/pod-registry/src/table.rs:30: /// Pod name — also the identity used throughout orchestration. crates/pod-registry/src/table.rs:34: /// Pod's Unix socket path. crates/pod-registry/src/table.rs:36: /// Allow rules granted to this Pod (write + read). crates/pod-registry/src/table.rs:38: /// Deny rules that cap this Pod's effective scope. Normally empty for crates/pod-registry/src/table.rs:39: /// fresh allocations; restored Pods use this to avoid reclaiming crates/pod-registry/src/table.rs:43: /// Name of the Pod that delegated scope to this one, or `None` for crates/pod-registry/src/table.rs:44: /// a top-level Pod started directly by a human. crates/pod-registry/src/table.rs:46: /// Segment ID this Pod is currently writing to. `None` means this crates/pod-registry/src/table.rs:72:/// Default on-disk path: `/pods.json` resolved via crates/pod-registry/src/table.rs:73:/// [`manifest::paths::pod_registry_path`]. Tests should point this crates/tui/src/ui.rs:1://! Full-screen rendering for the TUI. crates/tui/src/ui.rs:39: /// tool blocks stay in detail. crates/tui/src/ui.rs:650: // ToolCall is dispatched in `compute_history` via `tool::render_tool` crates/tui/src/ui.rs:706:/// `#` knowledge = green, `/` workflow = yellow), so the user crates/tui/src/ui.rs:1381: /// External-input echoes (`Method::Notify` / `Method::PodEvent`). crates/tui/src/ui.rs:1383: /// the line came from another Pod or operator, not the local user. crates/tui/src/ui.rs:1416:/// One-line summary of a `PodEvent` for display in the activity log. crates/tui/src/ui.rs:1418:/// in the pod crate) — that path applies prompt-pack wrapping, while crates/pod/src/main.rs:16: /// Manifest TOML to use directly, without loading user, project, or crates/pod/src/main.rs:21: /// Start the project-manifest walk from this directory. When crates/pod/src/main.rs:23: /// directory looking for `.insomnia/manifest.toml`. crates/pod/src/main.rs:28: /// layer. Example: `--overlay 'pod.name = "dbg"'`. crates/pod/src/main.rs:33: /// `/sessions/` (see `manifest::paths`). crates/pod/src/main.rs:37: /// Claim a scope allocation pre-registered by a spawning Pod, rather crates/pod/src/main.rs:39: /// process is launched by `SpawnPod`; end users should never pass it. crates/pod/src/main.rs:43: /// Socket path of the spawning Pod, for delivering `Method::Notify` crates/pod/src/main.rs:48: /// Resume or create a Pod by name. If name-keyed Pod state exists, crates/pod/src/main.rs:50: /// fresh top-level Pod is created with this name. crates/pod/src/main.rs:54: /// Require `--pod` to restore existing Pod state instead of creating a crates/pod/src/main.rs:55: /// fresh Pod when no state exists. Used by Pod discovery restore flows. crates/pod/src/main.rs:59: /// Restore a Pod from an existing session. The Pod re-uses the crates/pod/src/main.rs:61: /// concurrent writers are prevented by the pod-registry. crates/pod/src/main.rs:313: // Machine-readable ready line for parents that spawned this Pod crates/pod/src/main.rs:314: // (e.g. the TUI's interactive `spawn` flow). Tab-separated so a crates/pod/src/main.rs:315: // pod name with spaces still parses cleanly. Emit before the crates/tui/src/main.rs:60: /// `tui ` / `tui --pod `: attach to a live Pod by name if crates/tui/src/main.rs:61: /// possible; otherwise launch `pod --pod ` so the pod process crates/tui/src/main.rs:62: /// resumes from name-keyed state or creates a fresh same-name Pod. crates/tui/src/main.rs:67: /// `tui -r` / `tui --resume`: open the Pod picker, then attach to the crates/tui/src/main.rs:68: /// selected live Pod or restore the selected stopped Pod by name. crates/tui/src/main.rs:235: // duplicate. Other errors (pod-name failures, terminal setup crates/tui/src/main.rs:301: // Pick a Pod in its own inline viewport, dropping the viewport before crates/tui/src/main.rs:355: // The Pod sends `Event::Snapshot` automatically on connect; crates/tui/src/main.rs:890:/// Idle / Paused → 2-tap to quit the TUI (the Pod keeps running). crates/pod/src/permission.rs:12:/// Built-in manifest permission policy for `PreToolCall`. crates/pod/src/permission.rs:14:/// This hook is registered by Pod before user hooks, so manifest-level deny crates/tui/src/app.rs:29: /// Latest candidate set returned by the Pod for `(kind, prefix)`. crates/tui/src/app.rs:72: /// Last controller status reported by the Pod. Drives the status line crates/tui/src/app.rs:75: /// True while the Pod is in `PodStatus::Running`. crates/tui/src/app.rs:77: /// True while the Pod is in `PodStatus::Paused`. crates/tui/src/app.rs:86: /// Latest session context tokens reported by the Pod. This is the raw crates/tui/src/app.rs:94: /// Latest memory extract/consolidation lifecycle event for actionbar observability. crates/tui/src/app.rs:103: /// 2-tap guard for `Ctrl-C` when the Pod is not running. First press crates/tui/src/app.rs:105: /// TUI (the Pod itself stays alive). crates/tui/src/app.rs:119: /// In-TUI mirror of the Pod's session task store, reconstructed crates/tui/src/app.rs:120: /// directly from observed `TaskCreate` / `TaskUpdate` tool calls and crates/tui/src/app.rs:121: /// `[Session TaskStore snapshot]` system messages — no protocol crates/tui/src/app.rs:122: /// surface added on the Pod side. crates/tui/src/app.rs:129: /// TUI-local FIFO of user inputs submitted while the Pod is already running. crates/tui/src/app.rs:130: /// Entries have not been sent to the Pod yet, so they remain editable/cancellable locally. crates/tui/src/app.rs:356: /// Files (and Knowledge / Workflow entries, which have no dir crates/tui/src/app.rs:387: // Empty Enter only does something meaningful when the Pod crates/tui/src/app.rs:408: // client subscribed to the Pod). Locally we only clear the crates/tui/src/app.rs:410: // local state to undo the visible submit if the Pod reports that crates/tui/src/app.rs:476: // Pod attaches the original `Vec` to user crates/tui/src/app.rs:619: // through to subscribers but the TUI currently derives its crates/tui/src/app.rs:677: // for providers that don't stream deltas. crates/tui/src/app.rs:782: // Result for an unknown tool call. Surface it as an crates/tui/src/app.rs:802: // Subtract the cache-hit portion so a tool loop that crates/tui/src/app.rs:997: // tool-call equivalent does, since tool calls finalize in crates/tui/src/app.rs:1052: /// Called on `TurnEnd`: mark any tool call still in an in-progress crates/tui/src/app.rs:1064: // Earlier tool calls in the same list are already crates/tui/src/app.rs:1215: /// because the Pod identity hasn't changed. crates/tui/src/app.rs:1275: /// block (`Block::Notify`, `Block::PodEvent`, …). crates/tui/src/app.rs:1305: /// Sweep all current tool-call blocks: any that never resolved into crates/tui/src/app.rs:1307: /// snapshot replay so dangling in-flight tool calls in the seed crates/tui/src/app.rs:1354:/// Strip the `cat -n` line-number gutter that the Read tool prepends to crates/tui/src/app.rs:1389:/// `Resume` when the Pod is paused. crates/tui/src/app.rs:2290: // Snapshot text injected as a workflow body (kind doesn't matter crates/tui/src/app.rs:2309: // Live tool call before the snapshot lands — restore must wipe crates/tui/src/app.rs:2382:/// Seed / mutate the file-content cache based on a completed tool call. crates/tui/src/app.rs:2384:/// Each built-in file tool has its own rule: Read copies the result body crates/tui/src/app.rs:2401: // The Read tool emits a `cat -n` style display: each crates/workflow/src/schema.rs:1://! Workflow frontmatter schema and frontmatter splitting helpers. crates/workflow/src/schema.rs:13: /// Workflows do not require timestamps in the MVP. Human-authored files crates/manifest/src/paths.rs:5://! - **`config_dir`** — 人が手で書く / 編集する設定。`manifest.toml`, crates/manifest/src/paths.rs:6://! `providers.toml`, `models.toml`, `prompts/`, `prompts.toml` 等 crates/manifest/src/paths.rs:9://! `pods.json`, `pid` ファイル等 crates/manifest/src/paths.rs:29:/// Environment variable that points at an explicit user manifest. crates/manifest/src/paths.rs:31:/// Pod CLI treats a non-empty value as an explicit manifest path. Empty values crates/manifest/src/paths.rs:33:/// auto-discovered user manifest path. crates/manifest/src/paths.rs:36:/// 設定ディレクトリ。`manifest.toml`, `providers.toml`, `models.toml`, crates/manifest/src/paths.rs:63:/// ランタイムディレクトリ。socket, `pods.json`, Pod ごとの `pid` / crates/manifest/src/paths.rs:80:/// `/manifest.toml` — user manifest の既定位置。 crates/manifest/src/paths.rs:83:/// [`user_manifest_path_with_env_override`] when mirroring the Pod CLI cascade crates/manifest/src/paths.rs:89:/// Resolve an explicit user manifest override from an env value. crates/manifest/src/paths.rs:92:/// override, matching the Pod CLI's `INSOMNIA_USER_MANIFEST` handling. crates/manifest/src/paths.rs:103:/// User manifest path using the same env override rule as the Pod CLI cascade. crates/manifest/src/paths.rs:106:/// empty, this falls back to [`user_manifest_path`]. The returned path is not crates/manifest/src/paths.rs:122:/// `/` — providers.toml / models.toml 等の crates/manifest/src/paths.rs:128:/// `/sessions/` — session store のデフォルト位置。 crates/manifest/src/paths.rs:133:/// `/pods.json` — machine-wide Pod allocation registry。 crates/manifest/src/paths.rs:138:/// `//` — Pod ごとのランタイムディレクトリ。 crates/manifest/src/paths.rs:143:/// `//sock` — Pod の Unix socket パス。 crates/manifest/src/paths.rs:145:/// Pod プロセス内で実際に socket を作成するのは `pod` crate の crates/manifest/src/paths.rs:146:/// `RuntimeDir::socket_path()` で、Pod 名が分かっている外部 (TUI の crates/pod/src/discovery.rs:1://! Pod-state-backed discovery and restore/attach tools. crates/pod/src/discovery.rs:3://! This surface deliberately does not enumerate every Pod on the host. The crates/pod/src/discovery.rs:5://! Pods it spawned according to durable Pod state) and only then reads each crates/pod/src/discovery.rs:6://! Pod's own state. Name-targeted operations distinguish missing state from crates/pod/src/discovery.rs:192: // The live in-memory registry covers just-spawned children even if a crates/pod/src/discovery.rs:194: // additive visibility hint, not the source of Pod metadata. crates/pod/src/discovery.rs:594: /// Pod name to inspect, attach, or restore. crates/pod/src/discovery.rs:840: // Pod state when spawned_pods.json is absent. crates/pod-registry/src/lib.rs:1://! Machine-wide Pod allocation registry. crates/pod-registry/src/lib.rs:3://! A single JSON file at `/pods.json` records every live crates/pod-registry/src/lib.rs:4://! Pod's allocation (see [`manifest::paths::pod_registry_path`] for crates/pod-registry/src/lib.rs:6://! across processes so spawn sequences from unrelated Pods can't race. crates/pod-registry/src/lib.rs:8://! Each Pod, when starting, acquires the lock, reclaims stale entries crates/pod-registry/src/lib.rs:9://! (Pods whose PID has died), checks that its requested write scope crates/pod-registry/src/lib.rs:13://! recovery rides on the next Pod that opens the file — no background crates/pod/src/segment_log_sink.rs:1://! Pod-side session-log mirror + broadcast. crates/pod/src/segment_log_sink.rs:3://! Owns the in-memory `Vec` mirror that backs `Event::Snapshot` crates/pod/src/segment_log_sink.rs:4://! delivery to newly connected clients and the crates/pod/src/segment_log_sink.rs:7://! Pod (which still owns the `Store` handle); the sink stays focused on crates/pod/src/segment_log_sink.rs:12://! 1. Pod writes the entry to disk via the `Store`. crates/pod/src/segment_log_sink.rs:13://! 2. Pod calls [`SegmentLogSink::publish`] which acquires the mirror crates/pod/src/segment_log_sink.rs:18://! so the `(snapshot, receiver)` pair returned to a connecting client crates/pod/src/segment_log_sink.rs:36:/// In-memory mirror + broadcast fan-out for the active session log. crates/pod/src/segment_log_sink.rs:38:/// Clone is cheap (`Arc` clone) — the Pod hands one to the IPC layer crates/pod/src/segment_log_sink.rs:86: /// MUST be called only after the Pod has successfully persisted the crates/pod/src/segment_log_sink.rs:101: /// entry would just double-render every block on the client side. crates/pod/src/segment_log_sink.rs:117: /// `true` for entry kinds that the IPC layer forwards to clients crates/tools/tests/integration.rs:1://! Cross-tool integration tests exercising `builtin_tools()` end-to-end. crates/tools/tests/integration.rs:3://! `ToolServerHandle::register_tool` / `flush_pending` are `pub(crate)` in crates/tools/tests/integration.rs:4://! llm-worker, so from here we exercise the factories directly — the same crates/tools/tests/integration.rs:245: // The key invariant: all builtin tools share the same ScopedFs instance, crates/tools/tests/integration.rs:254: // Read via Read tool crates/tools/tests/integration.rs:256: // Write via Write tool — must succeed because the shared ScopedFs has the read crates/tools/tests/integration.rs:292: // Registration order from builtin_tools(): Read, Write, Edit, Glob, Grep, Bash, TaskCreate, TaskList, TaskGet, TaskUpdate crates/tools/tests/integration.rs:311:// Regression: tool name capitalization matches Claude Code reference crates/tools/tests/integration.rs:390: // The Bash tool starts at the ScopedFs's pwd. Without any `cd`, its crates/tools/tests/integration.rs:426: // Read the file via the Read tool — must succeed (in scope). crates/workflow/src/error.rs:1://! Errors raised by Workflow loading and linting. crates/workflow/src/error.rs:8:/// A single Workflow linter violation. crates/tools/src/bash.rs:1://! `Bash` tool — execute shell commands in a one-shot, stateless way. crates/tools/src/bash.rs:8://! mirrors Claude Code's own Bash tool — predictable, no hidden state. crates/tools/src/bash.rs:63:/// Maximum bytes loaded into memory from the spilled output file. The crates/tools/src/bash.rs:114: // full output later; cleanup is deferred to `Drop` on this tool. crates/tools/src/bash.rs:324:/// Factory for the `Bash` tool. crates/tools/src/bash.rs:328:/// invocation starts at `fs.pwd()` — the tool is intentionally stateless crates/pod-registry/src/test_util.rs:1://! Shared test helpers for the pod-registry crate. crates/pod/src/interrupt_prep.rs:1://! Pre-run cleanup that fires when a Pod transitions out of `Paused` crates/pod/src/interrupt_prep.rs:5://! `Item::ToolCall` (tool_use emitted by the LLM but whose tool did not crates/pod/src/interrupt_prep.rs:7://! `Item::ToolResult` so the next request is wire-valid under providers crates/pod/src/interrupt_prep.rs:11://! happen at the front of `Pod::run` when crates/pod/src/interrupt_prep.rs:12://! `worker.last_run_interrupted()` is set; see `Pod::apply_interrupt_prep`. crates/pod/src/interrupt_prep.rs:38:/// Test-only helper to surface the canonical interrupt tool-result crates/pod/src/interrupt_prep.rs:39:/// summary without round-tripping through a Pod — used by tests in crates/workflow/src/lib.rs:1://! Workflow records, loading, Agent Skill ingestion, and human-edit linting. crates/workflow/src/workflow.rs:1://! Workflow loader and registry. crates/workflow/src/workflow.rs:3://! Workflows live under `/.insomnia/workflow/.md`. They are crates/workflow/src/workflow.rs:5://! intentionally strict about malformed records because Pod startup should crates/workflow/src/workflow.rs:21:/// Hard cap on Workflow descriptions that are advertised resident. crates/workflow/src/workflow.rs:25:/// Origin of a [`WorkflowRecord`]. Used to break ties when the same slug crates/workflow/src/workflow.rs:26:/// is provided by multiple sources: workspace-authored Workflows always crates/workflow/src/workflow.rs:30: /// `/.insomnia/workflow/.md`. Authored in-tree by crates/workflow/src/workflow.rs:34: /// manifest. `dir` is the skills root that contained crates/workflow/src/workflow.rs:60: /// when [`WorkflowRegistry::merge_skill`] encounters a slug crates/workflow/src/workflow.rs:65:/// Returned by [`WorkflowRegistry::merge_skill`] when an incoming skill is crates/workflow/src/workflow.rs:66:/// shadowed by an existing record (either an internal Workflow or a crates/workflow/src/workflow.rs:138: /// Workflow or earlier-fed skill) already owns the slug, the crates/workflow/src/workflow.rs:383: // The legacy `.insomnia/memory/workflow/` location is no longer crates/workflow/src/workflow.rs:384: // a Workflow source. Files placed there must be ignored (the crates/workflow/src/workflow.rs:385: // loader is rooted at `.insomnia/workflow/` only). crates/workflow/src/workflow.rs:462: // The kept record is still the workspace workflow. crates/pod/src/factory.rs:1://! Builder that assembles a [`PodManifest`] from cascade layers. crates/pod/src/factory.rs:5://! layers provide everything; `TryFrom` fills in crates/pod/src/factory.rs:7://! 2. **User manifest** — `$XDG_CONFIG_HOME/insomnia/manifest.toml` crates/pod/src/factory.rs:8://! (falling back to `~/.config/insomnia/manifest.toml`). crates/pod/src/factory.rs:9://! 3. **Project manifest** — closest `.insomnia/manifest.toml` found by crates/pod/src/factory.rs:12://! [`PodManifestConfig`] supplied by the caller (CLI flags, GUI, crates/pod/src/factory.rs:13://! spawning Pod, etc.). Highest priority. crates/pod/src/factory.rs:17://! in the project manifest means the project root regardless of how crates/pod/src/factory.rs:20://! - user manifest: base = the directory holding the manifest file crates/pod/src/factory.rs:21://! (which is `manifest::paths::config_dir()` when loaded via the crates/pod/src/factory.rs:23://! - project manifest: base = the **project root** (the parent of crates/pod/src/factory.rs:25://! manifests with `target = "."` cover the whole workspace crates/pod/src/factory.rs:39:/// Errors raised while building a [`PodManifest`] from cascade layers. crates/pod/src/factory.rs:70:/// validated [`PodManifest`]. crates/pod/src/factory.rs:77: /// User layer paired with the directory the manifest lives in crates/pod/src/factory.rs:80: /// Project layer paired with the directory the manifest lives in. crates/pod/src/factory.rs:88: /// the user manifest when loaded. `/prompts/`. crates/pod/src/factory.rs:91: /// project manifest when loaded. crates/pod/src/factory.rs:93: /// `/prompts.toml`, sibling of the user crates/pod/src/factory.rs:106: /// Attempt to load the user manifest from the user's config crates/pod/src/factory.rs:107: /// directory (see [`manifest::paths::config_dir`] for how the path crates/pod/src/factory.rs:109: /// no-op — user manifests are optional. crates/pod/src/factory.rs:123: /// Load the user manifest from an explicit path. The file must crates/pod/src/factory.rs:134: /// Walk up from `cwd` looking for a `.insomnia/manifest.toml` and crates/pod/src/factory.rs:148: /// Walk up from `start` looking for a `.insomnia/manifest.toml`. crates/pod/src/factory.rs:149: /// Explicit variant of [`with_project_manifest_auto`] for tests. crates/pod/src/factory.rs:160: /// Shared setup for `with_project_manifest_auto` / `_from`: record crates/pod/src/factory.rs:161: /// the manifest's project root as the base for relative-path crates/pod/src/factory.rs:163: /// so `target = "."` in a project manifest means the project root. crates/pod/src/factory.rs:196: /// each manifest file: `prompts/`). Missing directories are crates/pod/src/factory.rs:213: // only when a manifest pack explicitly references it. crates/pod/src/factory.rs:228: /// [`PodManifest`], and return it together with a [`PromptLoader`] crates/pod/src/factory.rs:230: /// feeds `{% include "name" %}` references in the Pod's system crates/pod/src/factory.rs:238: /// The base layer is [`PodManifestConfig::builtin_defaults`] so crates/pod/src/factory.rs:240: /// (see [`manifest::defaults`]). crates/pod/src/factory.rs:271: // manifest path. crates/pod/src/factory.rs:515: // user manifest at /cfg/manifest.toml with a relative crates/pod/src/factory.rs:551: // `.insomnia/manifest.toml` is the marker for the project, but crates/pod/src/factory.rs:554: // project manifest should cover the whole workspace, not the crates/pod/src/factory.rs:597: // .insomnia/manifest.toml and .insomnia/prompts/local.md crates/pod/src/factory.rs:666: // pod.name missing — resolver must reject. crates/workflow/src/scope.rs:1://! Scope deny helpers for human-authored Workflow files. crates/workflow/src/scope.rs:9:/// `/.insomnia/workflow/` for generic CRUD tools. crates/pod-registry/src/mutate.rs:14:/// Register a top-level Pod (started directly by a human, no crates/pod-registry/src/mutate.rs:16:/// conflicts so a crashed Pod's allocation doesn't block the new one. crates/pod-registry/src/mutate.rs:19:/// `segment_id`, so two `restore_from_manifest` calls under different crates/pod-registry/src/mutate.rs:20:/// `pod_name`s cannot both grab the same session log. crates/pod-registry/src/mutate.rs:40:/// Register a top-level Pod with explicit deny rules that reduce the crates/pod-registry/src/mutate.rs:43:/// Conflict semantics: if every Pod overlapping a requested allow rule crates/pod-registry/src/mutate.rs:47:/// competitor actually descends from this Pod's prior delegations. crates/pod-registry/src/mutate.rs:108:/// Register a spawned Pod whose scope is delegated from `spawner`. crates/pod-registry/src/mutate.rs:110:/// scope; overlap with any Pod other than `spawner` is a conflict. crates/pod-registry/src/mutate.rs:158:/// Remove a Pod's allocation. Surviving children are reparented to crates/pod-registry/src/mutate.rs:159:/// the removed Pod's own `delegated_from`, so the delegation tree crates/pod-registry/src/mutate.rs:231:/// dead Pod's `delegated_from`. Idempotent and best-effort — I/O crates/pod-registry/src/mutate.rs:232:/// errors on save are swallowed so a crashed Pod's entry never blocks crates/pod-registry/src/mutate.rs:680: // a different pod_name. Without the SegmentConflict check both crates/workflow/src/linter.rs:1://! Human-edit linter for Workflow files. crates/workflow/src/linter.rs:43: /// Validate a human-authored Workflow document. crates/manifest/src/config.rs:1://! Partial-form of [`crate::PodManifest`] used as cascade layers. crates/manifest/src/config.rs:3://! `PodManifestConfig` mirrors `PodManifest` but every field is optional crates/manifest/src/config.rs:4://! so individual layers (builtin defaults, user manifest, project crates/manifest/src/config.rs:5://! manifest, programmatic overlay) can be partial. Layers are combined crates/manifest/src/config.rs:6://! via [`PodManifestConfig::merge`] and the final config is converted to crates/manifest/src/config.rs:7://! a validated [`PodManifest`] via `TryFrom`. crates/manifest/src/config.rs:24:/// Partial-form Pod manifest. Every field is optional; one or more crates/manifest/src/config.rs:25:/// instances merge via [`PodManifestConfig::merge`] before being crates/manifest/src/config.rs:26:/// converted to a validated [`PodManifest`] via `TryFrom`. crates/manifest/src/config.rs:32: /// [`ModelManifest`] を使う。ref / inline の両形を受け入れるための crates/manifest/src/config.rs:49: /// Memory subsystem opt-in. See [`MemoryConfig`]. crates/manifest/src/config.rs:61: /// Optional `PromptCatalog` manifest pack override. See crates/manifest/src/config.rs:62: /// [`crate::PodMeta::prompt_pack`] for semantics. Relative paths crates/manifest/src/config.rs:63: /// are resolved through [`PodManifestConfig::resolve_paths`]. crates/manifest/src/config.rs:160:/// Errors raised when converting a [`PodManifestConfig`] to a validated crates/manifest/src/config.rs:161:/// [`PodManifest`] via `TryFrom`. crates/manifest/src/config.rs:170:/// Reject manifest fields that were intentionally removed and must not be crates/manifest/src/config.rs:197: /// Parse a partial manifest from a TOML string. Unknown top-level or crates/manifest/src/config.rs:211: /// [`crate::defaults`]. Used by [`PodFactory::resolve`] as the crates/manifest/src/config.rs:215: /// `TryFrom` also reads the same constants as a crates/manifest/src/config.rs:457:/// Invariant check: every path in a fully-resolved [`PodManifestConfig`] crates/manifest/src/config.rs:459:/// [`PodManifestConfig::resolve_paths`]; if one reaches `TryFrom` it crates/manifest/src/config.rs:481:/// 揃っているか)の検証はカタログを知る `crates/provider` 側で行う。 crates/manifest/src/config.rs:1070: // `pod.pwd` specifically is silently dropped after the crates/manifest/src/config.rs:1200: // A project-layer manifest with only scope set must parse fine. crates/manifest/src/config.rs:1227: // required fields must resolve to a PodManifest carrying the crates/tools/src/tracker.rs:1://! Pod-lifetime tracker for file operations performed by the builtin crates/tools/src/tracker.rs:2://! file-manipulation tools. crates/tools/src/tracker.rs:12://! files that have been touched by any of the tools, so the Pod crates/tools/src/tracker.rs:21://! A `Tracker` is **Pod-process scoped**: the Pod layer creates a fresh crates/tools/src/tracker.rs:22://! instance at the start of each Pod run (including resume) and discards crates/tools/src/tracker.rs:25://! write boundary is likewise Pod-process scoped (derived from the crates/tools/src/tracker.rs:26://! manifest). The two are orthogonal and the Pod wires them together crates/tools/src/tracker.rs:27://! when registering builtin tools. crates/tools/src/tracker.rs:31://! # use manifest::Scope; crates/tools/src/tracker.rs:32://! # use tools::{ScopedFs, Tracker, builtin_tools}; crates/tools/src/tracker.rs:34://! let fs = ScopedFs::new(scope, PathBuf::from("/workspace")); // pod lifetime crates/tools/src/tracker.rs:37://! let task_store = tools::TaskStore::new(); crates/tools/src/tracker.rs:38://! let defs = builtin_tools(fs, tracker, task_store, bash_outputs); crates/tools/src/tracker.rs:73:/// `Tracker` across every builtin tool in a session is effectively free crates/tools/src/tracker.rs:88: /// Called by the `Read` tool after a successful read, and by the crates/tools/src/tracker.rs:89: /// `Write` / `Edit` tools after a successful modification (so that crates/tools/src/tracker.rs:132: /// Intended for callers like the Pod's context-compaction path, which crates/manifest/src/scope.rs:1://! Runtime representation of a Pod's access scope. crates/manifest/src/scope.rs:5://! resolution runs earlier, inside [`crate::PodManifestConfig::resolve_paths`]. crates/manifest/src/scope.rs:17:/// Parsed, pwd-resolved set of allow/deny rules for a Pod. crates/manifest/src/scope.rs:55: /// [`crate::PodManifestConfig::resolve_paths`] so that cascade merge crates/manifest/src/scope.rs:148: /// Used by the pod-registry, where every Pod's allocation crates/manifest/src/scope.rs:206: /// (e.g. SpawnPod-style delegation that strips Write from the crates/manifest/src/scope.rs:302:/// out to multiple consumers (Pod, ScopedFs, future grant/revoke crates/pod/src/fs_view.rs:1://! Pod 視点のファイルシステム操作。 crates/pod/src/fs_view.rs:3://! `ScopedFs` の上に「Pod が読み取りたい / 列挙したい」操作を集約する軽い wrapper。 crates/pod/src/fs_view.rs:7://! 変換する経路。`Pod::compact` から呼ばれる。 crates/pod/src/fs_view.rs:9://! compact tool 側の `mark_read_required` でも使用。 crates/pod/src/fs_view.rs:10://! - `list_file_completions` — TUI 補完用、prefix マッチでファイル候補を列挙する経路。 crates/pod/src/fs_view.rs:24:/// TUI completion と同じ浅い一覧という意味論に揃えるため、同じ上限を使う。 crates/pod/src/fs_view.rs:38:/// Pod から見えるファイルシステム操作の入口。Clone は cheap(`ScopedFs` 内 `Arc`)。 crates/pod/src/fs_view.rs:53:/// `resolve_file_ref` の失敗理由。Pod 側で Alert に振り分けるために crates/pod/src/controller.rs:30:// PodHandle — client-facing, Clone-able crates/pod/src/controller.rs:55: /// Broadcast an event to all listeners (including socket clients). crates/pod/src/controller.rs:87: // history / user_segments are no longer mirrored on PodSharedState — crates/pod/src/controller.rs:88: // clients reconstruct them from `Event::Snapshot` + live crates/pod/src/controller.rs:90: // only flip the status and kick post-run memory jobs here. crates/pod/src/controller.rs:97:/// `Pod::*` entry point — `RunForNotification` carries none because crates/pod/src/controller.rs:98:/// `pod.run_for_notification()` drains the NotifyBuffer on its own. crates/pod/src/controller.rs:102: /// `InvokeKind` is the trigger that flipped the Pod from IDLE crates/pod/src/controller.rs:103: /// (Notify or PodEvent) and is recorded by the Invoke marker crates/pod/src/controller.rs:104: /// committed at the start of `pod.run_for_notification`. crates/pod/src/controller.rs:112: /// `PodEvent::TurnEnded` / `PodEvent::Errored` reports so the parent crates/pod/src/controller.rs:115: /// notify buffer (Notify / inbound PodEvent) and stays silent. crates/pod/src/controller.rs:125:// PodController — actor that owns a Pod crates/pod/src/controller.rs:141: // === 1. Initialization (channels / RuntimeDir / pod-immutable crates/pod/src/controller.rs:142: // snapshots / SpawnedPodRegistry / alerter attach / crates/pod/src/controller.rs:149: // Runtime directory is created before tool registration because crates/pod/src/controller.rs:150: // the spawn-tool factories need its socket path, and before the crates/pod/src/controller.rs:173: // Hand the alerter to the Pod so internal operations (compaction, crates/pod/src/controller.rs:177: // Also hand the raw broadcast sender so Pod-internal operations crates/pod/src/controller.rs:181: // Bash spills long outputs to a per-pod subdir under the runtime crates/pod/src/controller.rs:183: // Pod's runtime scope so the agent can `Read` saved files crates/pod/src/controller.rs:202: // item / tool result that lands in history. With the sync crates/pod/src/controller.rs:207: // assistant / tool / system items all share one commit path. crates/pod/src/controller.rs:215: // === 3. Tool registration (builtin / memory / spawn-orchestration) === crates/pod/src/controller.rs:224: // Materialise pending tool factories so the greeting reflects crates/pod/src/controller.rs:228: // === 4. Initial runtime files + PodSharedState + PodHandle + crates/pod/src/controller.rs:266: // Clone cancel sender and notification buffer before moving pod crates/pod/src/controller.rs:268: // via these handles while pod itself is borrowed by drive_turn. crates/pod/src/controller.rs:291:/// Wire the per-event broadcast bridges on the Pod's Worker. Each callback crates/pod/src/controller.rs:292:/// re-publishes a worker-level signal as a `protocol::Event` on `event_tx` crates/pod/src/controller.rs:293:/// so subscribers (TUI, socket clients) get a single typed stream. crates/pod/src/controller.rs:295:/// `Pod::wire_history_persistence` is called separately to wire the crates/pod/src/controller.rs:296:/// per-item history commit callback so every assistant / tool item crates/pod/src/controller.rs:382: // Start fires unconditionally so the TUI can show "Thinking..." crates/pod/src/controller.rs:383: // even when the provider doesn't emit plaintext deltas. crates/pod/src/controller.rs:472: // through the session-log sink as a typed `LogEntry`, and clients crates/pod/src/controller.rs:477:/// Register the builtin file-manipulation tools, optional memory tools, crates/pod/src/controller.rs:478:/// and the Pod-orchestration tools (SpawnPod + comm) on the Pod's crates/pod/src/controller.rs:479:/// Worker. Returns the `ScopedFs` clone used to attach a `PodFsView` to crates/pod/src/controller.rs:492: // Pod-immutable snapshots taken before the mutable worker borrow crates/pod/src/controller.rs:493: // below so the worker borrow doesn't conflict with reads on `pod`. crates/pod/src/controller.rs:507: // The Pod's SharedScope (already augmented with the bash-output crates/pod/src/controller.rs:509: // ScopedFs (builtin tools, fs_view, compact worker) reads from it, crates/pod/src/controller.rs:510: // and any future scope mutation (SpawnPod-style revoke, future crates/pod/src/controller.rs:515: // a clone for the FS view we attach below, since the tools consume crates/pod/src/controller.rs:525: // Memory subsystem opt-in. When `[memory]` is present in the crates/pod/src/controller.rs:526: // manifest, register the memory-specific Read/Write/Edit tools that crates/pod/src/controller.rs:527: // target `/memory/` and `/knowledge/` with crates/pod/src/controller.rs:529: // scope were already applied during `Pod::from_manifest`. crates/pod/src/controller.rs:544: // Pod-orchestration tools (SpawnPod + the four comm tools) share crates/pod/src/controller.rs:545: // the Pod-scoped `SpawnedPodRegistry` (also consumed by the main crates/pod/src/controller.rs:546: // loop's `PodEvent` handler). crates/pod/src/controller.rs:697: // `pod` after the run completes, so we don't push crates/pod/src/controller.rs:698: // here. Workflow-invocation validation happens inside crates/pod/src/controller.rs:699: // `Pod::run`; on failure the turn errors out via crates/pod/src/controller.rs:703: // applied inside `Pod::run` itself when the worker's crates/pod/src/controller.rs:712: // Client-side live echo is delivered as `Event::SystemItem` crates/pod/src/controller.rs:749: // Pod is Idle (Running turns go through `drive_turn`, crates/pod/src/controller.rs:856: // typed `SystemItem::PodEvent` lands as a crates/pod/src/controller.rs:858: // to clients as `Event::SystemItem`. crates/pod/src/controller.rs:872: // `SystemItem::PodEvent` via the interceptor drain. crates/pod/src/controller.rs:874: // Auto-kick a turn if the Pod is idle so the crates/pod/src/controller.rs:886: // Background memory jobs own extract/consolidate workers after a crates/pod/src/controller.rs:891: // Report upward that this Pod is stopping before the controller crates/pod/src/controller.rs:912:/// Drives a Pod future (one in-flight turn) while concurrently crates/pod/src/controller.rs:916:/// `parent_socket` / `self_name` drive upward `PodEvent` reports crates/pod/src/controller.rs:918:/// `None` parent skips the send (top-level Pod). Transient method crates/pod/src/controller.rs:924:/// `Method::Notify` / inbound `PodEvent` auto-kicks complete silently crates/pod/src/controller.rs:971: // clients as a normal Paused run-end, and crates/pod/src/controller.rs:972: // intentionally skip `PodEvent::Errored` upward: crates/pod/src/controller.rs:1050: // `SystemItem::PodEvent`. crates/pod/src/controller.rs:1078: // `build_client` がここに到達する前に同じマニフェストで成功している crates/pod/src/controller.rs:1107: // a flush the tool table is empty and this returns an empty vec. crates/pod/src/controller.rs:1219: /// return the first `Method::PodEvent` read from it. Returns `None` crates/pod/src/controller.rs:1220: /// on timeout / EOF / non-PodEvent. crates/tui/src/spawn.rs:1://! Inline-viewport "spawn Pod and attach" UX. crates/tui/src/spawn.rs:4://! with no positional argument. Walks the cwd for a `.insomnia/manifest.toml` crates/tui/src/spawn.rs:5://! to seed defaults, prompts for the Pod's name, and on confirmation crates/tui/src/spawn.rs:6://! launches the `pod` binary as an independent process with a freshly built crates/tui/src/spawn.rs:7://! overlay (name + cwd scope when no project manifest exists). Once crates/tui/src/spawn.rs:92:/// behaviour); `Some(id)` swaps the dialog into "Resume Pod" mode and crates/tui/src/spawn.rs:93:/// passes `--session ` to the spawned `pod` child. crates/tui/src/spawn.rs:146: // Phase 2: launch pod and wait for ready line. Drop the cursor crates/tui/src/spawn.rs:173:/// Launch `pod --pod ` without opening the name dialog. The child Pod crates/tui/src/spawn.rs:174:/// resolves persisted Pod metadata if present, or creates a fresh same-name Pod crates/tui/src/spawn.rs:175:/// with the usual TUI cwd-scope fallback. crates/tui/src/spawn.rs:212: // Run the same merge pod itself uses, then read what's missing off the crates/tui/src/spawn.rs:213: // result. We only look at `scope.allow` here — `pod.name` is an crates/tui/src/spawn.rs:214: // instance-level identifier and is supplied by the dialog or `--pod`. crates/tui/src/spawn.rs:215: // TUI must pre-read the same user manifest path that the pod CLI will use, crates/tui/src/spawn.rs:336: // Filesystem-safe; pod.name becomes a runtime-dir name. crates/tui/src/spawn.rs:435: /// True when at least one cascade layer (user or project manifest) crates/tui/src/spawn.rs:453: /// `Some(id)` flips the dialog into "Resume Pod" mode: the title crates/tui/src/spawn.rs:455: /// child pod is launched with `--session ` so it restores crates/tui/src/spawn.rs:458: /// When true, launch the child with `--pod ` so the pod process crates/tools/src/read.rs:1://! `Read` tool — read a text file with offset/limit, return line-numbered output. crates/tools/src/read.rs:116:/// Factory for the `Read` tool. crates/manifest/src/cascade.rs:3://! Pod manifests are assembled from up to three on-disk layers (see crates/manifest/src/cascade.rs:4://! `pod::PodFactory` for the full cascade story): crates/manifest/src/cascade.rs:6://! 1. **User manifest** — Pod CLI uses crates/manifest/src/cascade.rs:7://! [`crate::paths::user_manifest_path_with_env_override`] crates/manifest/src/cascade.rs:8://! 2. **Project manifest** at the closest `.insomnia/manifest.toml` crates/manifest/src/cascade.rs:16://! that's the data layer's responsibility (`PodManifestConfig::merge` crates/manifest/src/cascade.rs:17://! and `PodManifest::try_from`). This module only handles the I/O and crates/manifest/src/cascade.rs:24:/// Errors returned when reading a single manifest layer from disk. crates/manifest/src/cascade.rs:41:/// Walk up from `start` looking for `.insomnia/manifest.toml`. Returns crates/manifest/src/cascade.rs:60:/// Read a manifest file from `path` and parse it as a partial crates/manifest/src/cascade.rs:61:/// [`PodManifestConfig`]. Path resolution against a base directory and crates/manifest/src/model.rs:3://! Pod マニフェストの `[model]` セクションで記述する型。`ref`(プロバイダ crates/manifest/src/model.rs:6://! 持つ 1 つの型 [`ModelManifest`] に統合している。実解決(ref をプロバイダ crates/manifest/src/model.rs:8://! は `crates/provider` の責務で、本モジュールはデータ表現のみを提供する。 crates/manifest/src/model.rs:17:// `ModelCapability` は `llm-worker` 側に定義される runtime 構造だが、 crates/manifest/src/model.rs:21:/// Pod マニフェストの `[model]` セクション。 crates/manifest/src/model.rs:27:/// どの形が有効かの判定は `provider::resolve_model_manifest` が担う。 crates/manifest/src/model.rs:32: /// `/` 形式のカタログ参照。`/` の crates/manifest/src/model.rs:33: /// 最初の 1 文字目で split し provider カタログを引く。 crates/manifest/src/model.rs:36: /// (provider 側で最初の `/` のみ split するため)。 crates/manifest/src/model.rs:51: /// モデル能力の明示指定。未指定時はモデルカタログ → provider crates/manifest/src/model.rs:94:/// `crates/provider` で行う。ここはあくまで「どこから取るか」の宣言。 crates/pod-registry/src/conflict.rs:83:/// The Pod and rule that actually own a conflicting write scope. crates/pod-registry/src/conflict.rs:90:/// Find the Pod/rule that actually owns a write scope overlapping `rule`. crates/pod-registry/src/conflict.rs:94:/// as the true owner. `exempt` names a Pod whose ownership is crates/pod-registry/src/conflict.rs:215: // A different top-level Pod trying to register /src/core/x crates/manifest/src/defaults.rs:1://! Single source of truth for manifest default values. crates/manifest/src/defaults.rs:4://! `#[serde(default = "...")]` attributes (on [`crate::PodManifest`]) crates/manifest/src/defaults.rs:9:/// Byte-size cap applied to any tool's `content` output when no crates/manifest/src/defaults.rs:10:/// per-tool override is set. See [`crate::ToolOutputLimits`]. crates/manifest/src/defaults.rs:51:/// responses. See [`crate::WorkerManifest::language`]. crates/manifest/src/defaults.rs:72:/// Context reserve preserved for final summary/tool closing turns. crates/manifest/src/defaults.rs:76:/// Optional maximum compact-worker tool-loop depth. `None` means unlimited. crates/manifest/src/defaults.rs:96:/// Optional maximum extract-worker tool-loop depth. `None` means unlimited. crates/manifest/src/defaults.rs:97:/// See [`crate::MemoryConfig::extract_worker_max_turns`]. crates/manifest/src/defaults.rs:100:/// Default language used by memory extraction / consolidation workers for crates/manifest/src/defaults.rs:101:/// durable memory and knowledge text. See [`crate::MemoryConfig::language`]. crates/tools/src/write.rs:1://! `Write` tool — create or overwrite a file. crates/tools/src/write.rs:44: // observed by the Read tool (via the tracker) and its current crates/tools/src/write.rs:77:/// Factory for the `Write` tool. crates/pod/src/spawn/comm_tools.rs:1://! Pod-to-Pod communication tools. crates/pod/src/spawn/comm_tools.rs:3://! Four tools in one module — `SendToPod`, `ReadPodOutput`, `StopPod`, crates/pod/src/spawn/comm_tools.rs:4://! `ListPods` — all built on the same `SpawnedPodRegistry` handed in by crates/pod/src/spawn/comm_tools.rs:8://! These tools only touch Pods listed in the spawner's crates/pod/src/spawn/comm_tools.rs:9://! `SpawnedPodRegistry`; there is no machine-wide directory lookup, so crates/pod/src/spawn/comm_tools.rs:39: /// Name of a previously spawned Pod. crates/pod/src/spawn/comm_tools.rs:44:// SendToPod crates/pod/src/spawn/comm_tools.rs:54: /// Target Pod name. crates/pod/src/spawn/comm_tools.rs:56: /// Text delivered to the Pod as the next user message. crates/pod/src/spawn/comm_tools.rs:109:// ReadPodOutput crates/pod/src/spawn/comm_tools.rs:184:// StopPod crates/pod/src/spawn/comm_tools.rs:244:// ListPods crates/pod/src/spawn/comm_tools.rs:280: // Trigger stale reclaim on unreachable pods so the lock file's crates/pod/src/spawn/comm_tools.rs:324:/// The Pod socket protocol sends replayed alerts and an initial crates/pod/src/spawn/comm_tools.rs:325:/// `Event::Snapshot` before it starts reading client methods. Send-only crates/pod/src/spawn/comm_tools.rs:329:/// surface it to the LLM or treat it as "pod stopped". crates/pod/src/spawn/comm_tools.rs:367:/// Failure modes distinguished by `SendToPod`. crates/pod/src/spawn/comm_tools.rs:370: /// Target Pod responded with `Error { AlreadyRunning }` — the crates/pod/src/spawn/comm_tools.rs:381:/// that precede the response are skipped. Times out per-read so a stuck Pod crates/pod/src/spawn/comm_tools.rs:382:/// doesn't hang the tool. crates/pod/src/spawn/comm_tools.rs:429:/// Connect to a Pod's socket and read the connect-time `Event::Snapshot`. crates/pod/src/spawn/comm_tools.rs:431:/// Pods deliver the session-log mirror as the first non-Alert event on crates/pod/src/spawn/comm_tools.rs:434:/// values; callers deserialize as `session_store::LogEntry` if they crates/pod/src/spawn/comm_tools.rs:471: // The wire payload is the JSON form of `session_store::LogEntry`. crates/pod/src/shared_state.rs:19:/// Shared state between PodController and runtime directory. crates/pod/src/shared_state.rs:21:/// Controller updates this in-memory; RuntimeDir writes the status crates/pod/src/shared_state.rs:35: /// Pod-from-the-inside view of the filesystem. Set once in crates/pod/src/shared_state.rs:36: /// `PodController::start` after the `ScopedFs` is materialised, and crates/pod/src/shared_state.rs:39: /// (only relevant for unit tests that build a `PodSharedState` crates/pod/src/shared_state.rs:65: /// Attach the Pod's filesystem view. Called once during controller crates/pod/src/shared_state.rs:71: /// Borrow the attached `PodFsView`, if any. Returns `None` for unit crates/tools/src/grep.rs:1://! `Grep` tool — recursive regex search powered by ripgrep's component crates. crates/tools/src/grep.rs:105:/// Factory for the `Grep` tool. crates/pod/src/prompt/system.rs:1://! System prompt template machinery for the Pod layer. crates/pod/src/prompt/system.rs:3://! Manifests describe the system prompt body as a reference to a crates/pod/src/prompt/system.rs:4://! prompt asset (`worker.instruction`, see [`manifest::WorkerManifest`]). crates/pod/src/prompt/system.rs:7://! eagerly syntax-checks it at Pod construction. The final system crates/pod/src/prompt/system.rs:10://! the Pod's `Scope` summary and (if present) the project's `AGENTS.md` crates/pod/src/prompt/system.rs:11://! contents plus resident memory sections, and the whole string is handed crates/pod/src/prompt/system.rs:156: /// The body of `/.insomnia/memory/summary.md`, with crates/pod/src/prompt/system.rs:162: /// section entirely (memory disabled, or a consolidation worker that opts crates/pod/src/prompt/system.rs:165: /// Resident workflow descriptions from `/.insomnia/workflow/*` crates/pod/src/prompt/system.rs:209:/// comes from the prompt catalog (`PodPrompt::WorkingBoundariesSection` crates/pod/src/prompt/system.rs:210:/// / `PodPrompt::AgentsMdSection`) so that wording can be overridden crates/pod/src/prompt/system.rs:310:/// Bridge used by [`Pod::ensure_system_prompt_materialized`] so tests crates/pod/src/prompt/system.rs:311:/// can construct a synthetic context without going through a full Pod. crates/pod/src/prompt/system.rs:533: // Pulled in from the builtin tool-usage asset. crates/pod/src/compact/metrics_tracker.rs:5://! Pod drains this buffer in `persist_turn` and writes each metric via crates/pod/src/compact/metrics_tracker.rs:29: /// Drain all queued metrics. Called by Pod after a run completes. crates/pod/src/compact/state.rs:5://! - `PodInterceptor` (reads `request_threshold` — the *safety net* for crates/pod/src/compact/state.rs:7://! - `Pod::try_pre_run_compact` (reads `post_run_threshold` — the crates/pod/src/compact/state.rs:9://! - `Pod::run()` / `resume()` (circuit breaker, thrash detection) crates/pod/src/compact/state.rs:12://! source of truth is `session_store::UsageRecord` (persisted per LLM call) crates/pod/src/compact/state.rs:13://! projected through `Pod::total_tokens()`. Callers pass the current crates/pod/src/spawn/registry.rs:1://! Shared registry of Pods spawned by this Pod. crates/pod/src/spawn/registry.rs:3://! `SpawnPod` writes here; the pod-comm tools (`SendToPod`, crates/pod/src/spawn/registry.rs:4://! `ReadPodOutput`, `StopPod`, `ListPods`) read and mutate the same crates/pod/src/spawn/registry.rs:5://! instance. Runtime write-through still materialises `spawned_pods.json`, crates/pod/src/spawn/registry.rs:6://! but durable state lives in the spawner's Pod metadata. crates/pod/src/spawn/registry.rs:8://! `ReadPodOutput` additionally owns a per-spawned-pod cursor here so crates/pod/src/spawn/registry.rs:67: /// Build a registry from the spawner's durable Pod state, pruning child crates/pod/src/spawn/registry.rs:69: /// written through to both `spawned_pods.json` and Pod state so runtime crates/pod/src/spawn/registry.rs:132: // Runtime spawned-pod records are a live registry for ListPods and crates/pod/src/spawn/registry.rs:133: // cursor/scope cleanup; durable Pod state remains the discovery source crates/pod/src/spawn/registry.rs:135: // Pod state just because their sockets are gone. crates/pod/src/spawn/registry.rs:163: /// error if either persisted write fails; the in-memory state is still crates/pod/src/spawn/registry.rs:171: /// Look up a record by pod name. Cloned so callers can drop the lock. crates/pod/src/spawn/registry.rs:185: /// Remove the record for `pod_name`, persist, clear its cursor, and crates/pod/src/hook.rs:1://! Pod-layer hook infrastructure crates/pod/src/hook.rs:3://! Hooks are the **public** orchestration extension point. They receive crates/pod/src/hook.rs:8://! Hooks intentionally cannot mutate the Worker's context, history, tool crates/pod/src/hook.rs:9://! call, or tool result. Internal mechanisms that need such access (e.g. crates/pod/src/hook.rs:11://! `llm_worker::Interceptor` directly inside Pod, never via this trait. crates/pod/src/hook.rs:64: /// Most recently observed `input_tokens` from the LLM provider. crates/pod/src/hook.rs:65: /// `None` when the Pod has no compaction state attached, or when crates/pod/src/hook.rs:76: /// Provider-assigned tool call id. crates/pod/src/hook.rs:78: /// Registered tool name. crates/pod/src/hook.rs:83: /// is cheap relative to tool execution. Structural access is crates/pod/src/hook.rs:91: /// Provider-assigned tool call id this result corresponds to. crates/pod/src/hook.rs:93: /// Registered tool name. crates/pod/src/hook.rs:95: /// Whether the tool reported an error. crates/pod/src/hook.rs:137:/// Before each tool is executed. crates/pod/src/hook.rs:139:/// After each tool completes. crates/pod/src/hook.rs:141:/// When a turn ends with no tool calls. crates/tools/src/error.rs:1://! Error type shared across the `tools` crate. crates/tools/src/error.rs:4://! builtin tool's internal logic. Tool `execute()` impls convert it to crates/tools/src/error.rs:5://! [`llm_worker::tool::ToolError`] via the `From` impl defined here. crates/pod/src/prompt/agents_md.rs:3://! Reads `AGENTS.md` directly under the Pod cwd and exposes its body crates/pod/src/prompt/agents_md.rs:6://! subproject context is expressed by launching a Pod with that crates/pod/src/prompt/agents_md.rs:23:/// Pod forwards to the user-facing notification channel. The caller crates/pod/src/prompt/loader.rs:8://! | `$user` | `/prompts/` (resolved by `manifest::paths`) | crates/pod/src/prompt/loader.rs:142: /// [`crate::PodFactory`] to surface `/prompts.toml` crates/manifest/src/lib.rs:28:/// Declarative configuration for a Pod. crates/manifest/src/lib.rs:30:/// Parsed from a TOML manifest file. Describes the model, system prompt, crates/manifest/src/lib.rs:31:/// and directory scope (required). The Pod's working directory is **not** crates/manifest/src/lib.rs:32:/// part of the manifest — it is the process's `std::env::current_dir()` crates/manifest/src/lib.rs:43: /// Optional manifest-level tool permission policy. Absent means the crates/manifest/src/lib.rs:44: /// permission layer is disabled and tool calls run as before. crates/manifest/src/lib.rs:49: /// Memory subsystem opt-in. Presence of `[memory]` in TOML enables crates/manifest/src/lib.rs:50: /// the memory tools (MemoryRead / MemoryWrite / MemoryEdit) and crates/manifest/src/lib.rs:51: /// causes Pod to deny generic write access to `/memory/` crates/manifest/src/lib.rs:53: /// memory tools registered. crates/manifest/src/lib.rs:57: /// Workflows. Each entry is a path to a skills *root* (i.e. a crates/manifest/src/lib.rs:59: /// bundles). Paths are resolved against the manifest's base crates/manifest/src/lib.rs:69:/// across manifest layers, so a user-level manifest can declare a crates/manifest/src/lib.rs:70:/// shared skill root once while a project manifest adds its own crates/manifest/src/lib.rs:76: /// Resolved against the manifest base directory before crates/manifest/src/lib.rs:77: /// [`PodManifest`] is materialised. crates/manifest/src/lib.rs:82:/// Memory subsystem configuration. Presence in the manifest enables crates/manifest/src/lib.rs:83:/// memory; the workspace root defaults to the Pod's pwd unless an crates/manifest/src/lib.rs:91: /// Override for the workspace root. When `None`, the Pod's pwd crates/manifest/src/lib.rs:96: /// Maximum number of records returned by `MemoryQuery` / crates/manifest/src/lib.rs:97: /// `KnowledgeQuery` per call. `None` ⇒ tool default (20). crates/manifest/src/lib.rs:101: /// Ignored when the request omits `query`. `None` ⇒ tool default (3). crates/manifest/src/lib.rs:104: /// Whether the body of `memory/summary.md` is exposed in the resident crates/manifest/src/lib.rs:108: /// Language used by memory extraction / consolidation workers for durable crates/manifest/src/lib.rs:109: /// memory and knowledge text. Free-form so workspaces can use names like crates/manifest/src/lib.rs:115: /// the main pod model is cloned via `clone_boxed()`. Lightweight crates/manifest/src/lib.rs:122: /// entirely; memory tools and resident injection still work, only crates/manifest/src/lib.rs:126: /// Optional maximum extract-worker tool-loop depth. `None` leaves crates/manifest/src/lib.rs:133: /// `None`, the main pod model is cloned via `clone_boxed()`. crates/manifest/src/lib.rs:151:/// Pod metadata. crates/manifest/src/lib.rs:156: /// `pod::PromptCatalog`. Subject to the same relative-path crates/manifest/src/lib.rs:157: /// resolution as other manifest paths (joined against the crates/manifest/src/lib.rs:158: /// manifest's base directory). `None` leaves the 4th overlay layer crates/manifest/src/lib.rs:170:/// Worker-level configuration embedded in the manifest. crates/manifest/src/lib.rs:177: /// unset manifests fall through to [`defaults::DEFAULT_INSTRUCTION`]. crates/manifest/src/lib.rs:182: /// locale tags, or a policy phrase. Unset manifests fall through to crates/manifest/src/lib.rs:200: /// Byte-size caps applied to tool `content` before it reaches the crates/manifest/src/lib.rs:203: /// per-tool overrides) is applied so truncation is on by default. crates/manifest/src/lib.rs:209: /// This is intentionally separate from tool-output truncation because crates/manifest/src/lib.rs:215:/// Byte-size caps applied to tool execution `content` before it enters crates/manifest/src/lib.rs:216:/// conversation history. Guards against a single oversized tool result crates/manifest/src/lib.rs:217:/// blowing past the provider's per-minute input-token rate limit. crates/manifest/src/lib.rs:224: /// Cap applied to any tool not listed in `per_tool`. crates/manifest/src/lib.rs:227: /// Per-tool overrides, keyed by tool registration name (e.g. "Glob"). crates/manifest/src/lib.rs:237:/// reference. It does not affect tool result truncation; see crates/manifest/src/lib.rs:280: /// Resolve the cap for a given tool name. crates/manifest/src/lib.rs:291:/// A Pod may only touch paths whose effective permission (computed from crates/manifest/src/lib.rs:308: /// Persist every provider stream event directly to `trace.jsonl` next to the crates/manifest/src/lib.rs:315:/// Manifest-level pattern-based tool permission policy. crates/manifest/src/lib.rs:330: /// manifests may use either `Bash` or `bash`. crates/manifest/src/lib.rs:332: /// Glob-like pattern matched against the tool's permission target crates/manifest/src/lib.rs:333: /// (for built-in tools, commonly `command`, `file_path`, or `pattern`). crates/manifest/src/lib.rs:349:/// Controls Prune (content removal from old tool results) and Compact crates/manifest/src/lib.rs:371: /// Checked by `PodInterceptor::pre_llm_request` inside a turn. When crates/manifest/src/lib.rs:415: /// Context reserve preserved for final summary/tool closing turns. crates/manifest/src/lib.rs:419: /// Optional maximum compact-worker tool-loop depth. `None` leaves the crates/manifest/src/lib.rs:521: /// Parse a manifest from a TOML string. crates/tools/src/glob.rs:1://! `Glob` tool — recursive file search by glob pattern, sorted by mtime. crates/tools/src/glob.rs:153: // Glob is an explicit-pattern tool, so gitignore/hidden are *not* honored. crates/tools/src/glob.rs:195:/// Factory for the `Glob` tool. crates/pod/src/spawn/tool.rs:1://! `SpawnPod` tool — launch a new Pod process as a child of this one. crates/pod/src/spawn/tool.rs:3://! Wires pod-registry delegation, overlay-TOML construction, subprocess crates/pod/src/spawn/tool.rs:5://! the LLM calls `SpawnPod`, a fresh `pod` binary is exec'd in its own crates/pod/src/spawn/tool.rs:6://! process group, the pod-registry is updated atomically, and the child's crates/pod/src/spawn/tool.rs:41:/// How long we will wait for the spawned Pod's socket to become crates/pod/src/spawn/tool.rs:47: /// Identifier for the spawned Pod. Must be unique machine-wide. crates/pod/src/spawn/tool.rs:52: /// First message sent to the spawned Pod via `Method::Run`. crates/pod/src/spawn/tool.rs:54: /// Allow rules delegated to the spawned Pod. Must be a subset of the crates/pod/src/spawn/tool.rs:91:/// Runtime dependencies the `SpawnPod` tool needs in order to launch a crates/pod/src/spawn/tool.rs:92:/// child Pod and record the handoff locally. Constructed by the Pod crates/pod/src/spawn/tool.rs:93:/// controller once per Pod lifetime. crates/pod/src/spawn/tool.rs:95: /// Spawner's own pod name — becomes the spawned Pod's crates/pod/src/spawn/tool.rs:96: /// `delegated_from` in the pod-registry. crates/pod/src/spawn/tool.rs:99: /// `--callback` so its `PodEvent` callbacks have somewhere to land. crates/pod/src/spawn/tool.rs:102: /// the spawned Pod's socket path before the child has bound it. crates/pod/src/spawn/tool.rs:104: /// Directory the spawned Pod should run in when the LLM did not crates/pod/src/spawn/tool.rs:108: /// pod-comm tools (`SendToPod` / `ReadPodOutput` / `StopPod` / crates/pod/src/spawn/tool.rs:109: /// `ListPods`). Writes the list to runtime and durable Pod state on crates/pod/src/spawn/tool.rs:112: /// THIS Pod's own parent-callback socket, if any. After a crates/pod/src/spawn/tool.rs:113: /// successful spawn we fire `PodEvent::ScopeSubDelegated` upward crates/pod/src/spawn/tool.rs:115: /// `None` for top-level Pods — in that case the re-emission is a crates/pod/src/spawn/tool.rs:118: /// Spawner's resolved provider config — copied into every spawned crates/pod/src/spawn/tool.rs:119: /// Pod's overlay TOML so the child does not need its own provider crates/pod/src/spawn/tool.rs:120: /// configuration in the manifest cascade. Per-spawn override is crates/pod/src/spawn/tool.rs:121: /// out of scope here (see `tickets/spawn-inherit-provider.md`). crates/pod/src/spawn/tool.rs:125: /// from the spawner's in-memory view (a `deny(Write, target)` is crates/pod/src/spawn/tool.rs:127: /// those paths to `Read`). Mirrors the pod-registry's crates/pod/src/spawn/tool.rs:129: /// tracked across Pods, so revocation only touches Write. crates/pod/src/spawn/tool.rs:168: // `delegate_scope` catches this too (as `DuplicatePodName`), but crates/pod/src/spawn/tool.rs:237: // Mirror that ownership transfer in the spawner's in-memory crates/pod/src/spawn/tool.rs:239: // is shadowed by a `deny(Write, target)` so subsequent tool crates/pod/src/spawn/tool.rs:271: // Notify this Pod's own parent so the grandparent can register crates/pod/src/spawn/tool.rs:272: // the new grandchild directly. Fire-and-forget; top-level Pods crates/pod/src/spawn/tool.rs:346: // orphans. Lifecycle tracking lives in `spawned_pods.json`. crates/pod/src/spawn/tool.rs:384:/// Serialise the overlay TOML that gets handed to the child `pod` crates/pod/src/spawn/tool.rs:385:/// binary via `--overlay`. `PodManifestConfig`'s `Serialize` impl is crates/pod/src/spawn/tool.rs:386:/// the single source of truth for the on-disk manifest format. crates/pod/src/spawn/tool.rs:389:/// `Command::current_dir` (see [`SpawnPodTool::exec_child`]) — it is crates/pod/src/spawn/tool.rs:390:/// not part of the manifest. crates/pod/src/spawn/tool.rs:418:/// tool-result budget — debugging beyond this should read the file crates/pod/src/spawn/tool.rs:484:/// Factory for the `SpawnPod` tool. crates/pod/src/compact/worker.rs:1://! Compact worker state and the four tools that drive it. crates/pod/src/compact/worker.rs:4://! [`Pod::compact`]. It receives the history to summarise plus a list of crates/pod/src/compact/worker.rs:6://! a tool-driven LLM loop. The tools here let it: crates/pod/src/compact/worker.rs:8://! - `read_file` — inspect referenced files (reuses `tools::read_tool`) crates/pod/src/compact/worker.rs:17://! which `Pod::compact` drains after the loop and turns into the crates/pod/src/compact/worker.rs:107: /// `compact` omits tool arguments/full results; `full` includes message text and tool result content. crates/pod/src/compact/worker.rs:377: // errors surface the same way the regular `read_file` tool does. crates/pod/src/compact/worker.rs:548:/// additional exploratory tool calls once the final reserve is reached. crates/tools/src/lib.rs:1://! Built-in tools for the Insomnia LLM agent. crates/tools/src/lib.rs:4://! `llm-worker` `Tool` infrastructure. Filesystem access is mediated by crates/tools/src/lib.rs:7://! - [`ScopedFs`] — Pod-process lifetime, expresses the write-block crates/tools/src/lib.rs:8://! boundary for the current scope. Derived from the manifest; not crates/tools/src/lib.rs:9://! persisted across Pod restart. crates/tools/src/lib.rs:10://! - [`Tracker`] — Pod-process lifetime, enforces the "read before edit" crates/tools/src/lib.rs:12://! Recreated fresh on each Pod start (including resume). crates/tools/src/lib.rs:14://! The Pod layer owns both instances and passes them to crates/tools/src/lib.rs:15://! [`builtin_tools`] when registering tools on a `Worker`. crates/tools/src/lib.rs:44:/// Register all builtin tools, wiring them to a shared `ScopedFs` crates/tools/src/lib.rs:45:/// (Pod-process lifetime) and `Tracker` (Pod-process lifetime). crates/tools/src/lib.rs:48:/// `Read` / `Write` / `Edit` see a consistent history across tool crates/tools/src/lib.rs:49:/// invocations within a single Pod run. crates/tools/src/lib.rs:51:/// `bash_output_dir` is where the Bash tool spills long outputs. The crates/tools/src/lib.rs:53:/// (see [`manifest::Scope::with_extra_read`]) so the agent can `Read` crates/pod/src/compact/token_counter.rs:4://! [`llm_worker::token_counter`] にあり、`UsageRecord` の列と現在の history から crates/pod/src/compact/token_counter.rs:6://! (`split_for_retained`, `savings_for_prune`)と、Pod 上の公開 API に crates/pod/src/compact/token_counter.rs:109:/// だけで切った `cut` は並列 tool 呼び出しの途中に落ちうるので、retained crates/pod/src/compact/token_counter.rs:191:/// `indices` は [`llm_worker::prune::prunable_indices`] が返す候補列を crates/pod/src/compact/token_counter.rs:243:// ── Pod に生やす公開 API ─────────────────────────────────────────────── crates/pod/src/compact/token_counter.rs:257: /// memory extract trigger が crates/tools/src/edit.rs:1://! `Edit` tool — partial string replacement with uniqueness check. crates/tools/src/edit.rs:136:/// Factory for the `Edit` tool. crates/pod/src/runtime/dir.rs:10:/// One spawned-child record mirrored to `spawned_pods.json`. crates/pod/src/runtime/dir.rs:12:/// Written by the spawner after registry changes so runtime-local tools crates/pod/src/runtime/dir.rs:13:/// have a materialised snapshot. Durable restore uses Pod state metadata; crates/pod/src/runtime/dir.rs:17: /// Spawned Pod's identity. crates/pod/src/runtime/dir.rs:19: /// Spawned Pod's Unix socket path. crates/pod/src/runtime/dir.rs:21: /// Scope allow rules delegated to the spawned Pod. crates/pod/src/runtime/dir.rs:23: /// Socket path the spawned Pod was told to use for callbacks crates/pod/src/runtime/dir.rs:24: /// (= this Pod's own socket when spawn happened). crates/pod/src/runtime/dir.rs:28:/// Manages the Pod's runtime directory on tmpfs. crates/pod/src/runtime/dir.rs:31:/// /{pod_name}/ crates/pod/src/runtime/dir.rs:34:/// ├── manifest.toml crates/pod/src/runtime/dir.rs:39:/// `` is resolved via [`manifest::paths::runtime_dir`]. crates/pod/src/runtime/dir.rs:59: /// [`manifest::paths::runtime_dir`]. crates/pod/src/runtime/dir.rs:71: /// Write manifest.toml (typically once at startup). crates/pod/src/runtime/dir.rs:76: /// Write `spawned_pods.json` atomically. The entries are the full crates/pod/src/runtime/dir.rs:77: /// set of spawned children known to this Pod — callers pass the crates/pod/src/runtime/dir.rs:84: /// Path to this Pod's runtime directory. crates/pod/src/runtime/dir.rs:90: /// that only know the pod name (e.g. the TUI's attach flow) crates/pod/src/runtime/dir.rs:91: /// predict the same path via [`manifest::paths::pod_socket_path`]. crates/pod/src/runtime/dir.rs:113:/// Thin wrapper over [`manifest::paths::runtime_dir`] that converts a crates/tools/src/scoped_fs.rs:3://! `ScopedFs` is the write/read gate layered on top of a [`manifest::Scope`] crates/tools/src/scoped_fs.rs:4://! and a Pod's working directory. The scope decides which paths are crates/tools/src/scoped_fs.rs:30:/// handle (typically the owning Pod). Mutations to that `SharedScope` crates/tools/src/scoped_fs.rs:66: /// holder of the `SharedScope` (typically the Pod). crates/tools/src/scoped_fs.rs:88: /// caller (usually the Pod) hold the same view and push updates crates/tools/src/scoped_fs.rs:94: /// The Pod's working directory. Glob/Grep default their search base crates/pod/src/prompt/catalog.rs:1://! Central catalog of Pod-level prompt strings. crates/pod/src/prompt/catalog.rs:3://! Prompts that Pod injects into a Worker (compaction system prompt, crates/pod/src/prompt/catalog.rs:6://! [`PodPrompt`] and rendered through a single [`PromptCatalog`]. Direct crates/pod/src/prompt/catalog.rs:8://! `crates/pod` is deliberately avoided — new injection points add a crates/pod/src/prompt/catalog.rs:11://! the "Pod tone" editable in one place. crates/pod/src/prompt/catalog.rs:18://! binary. Must cover every [`PodPrompt`] variant (build-time check). crates/pod/src/prompt/catalog.rs:19://! 2. **user** — `/prompts.toml`, auto-discovered by crates/pod/src/prompt/catalog.rs:20://! [`PodFactory`]. Optional. crates/pod/src/prompt/catalog.rs:23://! 4. **manifest pack** — `manifest.pod.prompt_pack`, an explicit path crates/pod/src/prompt/catalog.rs:24://! per-Pod. Optional. crates/pod/src/prompt/catalog.rs:56:/// Pod-level prompt injection point. crates/pod/src/prompt/catalog.rs:64: /// System prompt of the memory extract Worker. crates/pod/src/prompt/catalog.rs:66: /// System prompt of the memory consolidation (integration + tidy) Worker. crates/pod/src/prompt/catalog.rs:72: /// tool calls when a paused turn is interrupted by the user. crates/pod/src/prompt/catalog.rs:82: /// Trailing `## Resident memory summary` section, appended after the crates/pod/src/prompt/catalog.rs:83: /// AGENTS.md section when memory is enabled, summary injection is enabled, crates/pod/src/prompt/catalog.rs:84: /// and `memory/summary.md` has a valid non-empty body. crates/pod/src/prompt/catalog.rs:87: /// resident memory summary when memory is enabled, Knowledge resident crates/pod/src/prompt/catalog.rs:91: /// Trailing `## Resident workflows` section, appended after resident crates/pod/src/prompt/catalog.rs:92: /// knowledge when Workflow resident injection is enabled and at least one crates/pod/src/prompt/catalog.rs:93: /// workflow advertises `model_invokation: true`. crates/pod/src/prompt/catalog.rs:244:/// Merged, compiled pod-prompt catalog. crates/pod/src/prompt/catalog.rs:247:/// [`PodPrompt`] key (after the 4-layer merge). Includes inside templates crates/pod/src/prompt/catalog.rs:272: /// - Layer 4 (manifest): `manifest_pack` as an absolute filesystem crates/pod/src/prompt/catalog.rs:273: /// path (pre-resolved by the manifest cascade). crates/pod/src/prompt/catalog.rs:317: /// Render `PodPrompt::CompactSystem` (no inputs). crates/pod/src/prompt/catalog.rs:322: /// Render `PodPrompt::MemoryExtractSystem` with `{{ language }}`. crates/pod/src/prompt/catalog.rs:327: /// Render `PodPrompt::MemoryConsolidationSystem` with `{{ language }}`. crates/pod/src/prompt/catalog.rs:335: /// Render `PodPrompt::NotifyWrapper` with `{{ message }}`. crates/pod/src/prompt/catalog.rs:340: /// Render `PodPrompt::InterruptToolResultSummary` (no inputs). crates/pod/src/prompt/catalog.rs:345: /// Render `PodPrompt::InterruptSystemNote` (no inputs). crates/pod/src/prompt/catalog.rs:350: /// Render `PodPrompt::WorkingBoundariesSection` with `{{ scope_summary }}`. crates/pod/src/prompt/catalog.rs:358: /// Render `PodPrompt::AgentsMdSection` with `{{ agents_md }}`. crates/pod/src/prompt/catalog.rs:363: /// Render `PodPrompt::ResidentMemorySummarySection` with `{{ summary }}`. crates/pod/src/prompt/catalog.rs:371: /// Render `PodPrompt::ResidentKnowledgeSection` with `{{ entries }}` crates/pod/src/prompt/catalog.rs:380: /// Render `PodPrompt::ResidentWorkflowsSection` with `{{ entries }}` crates/pod/src/workflow/mod.rs:1://! Pod-side Workflow resolver. crates/pod/src/workflow/mod.rs:3://! Turns `Segment::WorkflowInvoke { slug }` into system-message attachments: crates/pod/src/workflow/mod.rs:4://! dependency Knowledge bodies first, then the Workflow body. Resolution is crates/pod/src/workflow/mod.rs:5://! strict for explicit user invocations: missing workflows, non-user-invocable crates/pod/src/workflow/mod.rs:6://! workflows, and missing Knowledge requirements are returned as errors before crates/pod/src/compact/usage_tracker.rs:1://! Tracks per-LLM-request Usage measurements within a Pod run. crates/pod/src/compact/usage_tracker.rs:10://! Pairing the two yields one `UsageRecord` per LLM call. Pod drains them crates/pod/src/compact/usage_tracker.rs:13://! Multiple LLM calls per Pod run (tool loop) are supported: each call crates/pod/src/compact/usage_tracker.rs:32:/// Shared between the pre-request hook, the `on_usage` callback, and Pod. crates/pod/src/compact/usage_tracker.rs:42: /// Records accumulated during the current run; drained by Pod. crates/pod/src/compact/usage_tracker.rs:104: /// projection as Pod persistence while the run is still active. crates/pod/src/compact/usage_tracker.rs:114: /// Drain accumulated records. Called by Pod after a run completes, crates/pod/src/compact/prune.rs:1://! Prune integration — wires the Worker's prune projection to the Pod's crates/pod/src/compact/prune.rs:7://! を組み立てて Worker に差し込むための `impl Pod` を提供する。 crates/pod/src/compact/prune.rs:31: /// The estimators combine persisted [`Pod::usage_history_handle`] records crates/pod/src/compact/prune.rs:32: /// with in-flight `UsageTracker` records so multi-request tool loops can crates/pod/src/compact/prune.rs:33: /// prune before the surrounding Pod run finishes. crates/pod/src/compact/prune.rs:110: /// If the manifest has a `[compaction]` section, build a `PruneConfig` crates/pod/src/compact/prune.rs:112: /// Otherwise no-op. Called from all Pod constructors so prune is crates/pod/src/compact/prune.rs:113: /// active whenever the manifest asks for it. crates/pod/src/pod.rs:47:/// `(SessionId, SegmentId)` pair the Pod is currently writing to. crates/pod/src/pod.rs:72:/// so that the Pod and every `LogWriterHandle` clone see a consistent crates/pod/src/pod.rs:159: /// Append `entry` to the log: disk write → counter bump → in-memory crates/pod/src/pod.rs:221:/// `session-store` functions after each turn. crates/pod/src/pod.rs:227: /// Optional write-through hook for name-keyed Pod metadata. Production crates/pod/src/pod.rs:229: /// logs; low-level `Pod::new` tests leave it absent. crates/pod/src/pod.rs:231: /// Shared session pointer. Source of truth for the Pod's current crates/pod/src/pod.rs:235: /// Absolute working directory of the Pod. crates/pod/src/pod.rs:237: /// Shared, atomically-swappable view of the Pod's resolved scope. crates/pod/src/pod.rs:238: /// Cloned out to `ScopedFs` instances (builtin tools, fs_view, crates/pod/src/pod.rs:257: /// Read by token-accounting APIs (`Pod::total_tokens`, etc.). crates/pod/src/pod.rs:261: /// can share the same view via [`Pod::usage_history_handle`]. crates/pod/src/pod.rs:263: /// Pod-lifetime file-operation tracker from the builtin `tools` crates/pod/src/pod.rs:265: /// tools so that Pod-owned operations (e.g. compaction) can consult crates/pod/src/pod.rs:268: /// Pod-lifetime task store from the builtin `tools` crate. Shared by crates/pod/src/pod.rs:271: /// replaced. Restored Pods reconstruct it by replaying Task* tool calls. crates/pod/src/pod.rs:278: /// spawn time. `None` in tests / direct `Pod::new` usage. crates/pod/src/pod.rs:282: /// notifications, events sent here are NOT replayed to clients that crates/pod/src/pod.rs:286: /// assistant-side execution artifact becomes visible to clients before crates/pod/src/pod.rs:288: /// `Pod::run` uses it to avoid rolling back a turn after the UI has crates/pod/src/pod.rs:293: /// PodInterceptor installed in `ensure_interceptor_installed`. crates/pod/src/pod.rs:296: /// (currently `@` file content). `Pod::run` fills this crates/pod/src/pod.rs:297: /// before handing off to the worker; `PodInterceptor::on_prompt_submit` crates/pod/src/pod.rs:302: /// Pods built via `from_manifest` / `from_manifest_spawned` / crates/pod/src/pod.rs:303: /// `restore_from_manifest` (production paths); `None` for the crates/pod/src/pod.rs:304: /// low-level `Pod::new` constructor used in tests, which bypasses crates/pod/src/pod.rs:306: /// the allocation when the Pod is dropped. crates/pod/src/pod.rs:309: /// Socket path of the spawning Pod. `Some` only for Pods built via crates/pod/src/pod.rs:310: /// `from_manifest_spawned`. Consumed by the controller to fire crates/pod/src/pod.rs:311: /// `Method::PodEvent` reports upward (turn end, error, shutdown, crates/pod/src/pod.rs:314: /// Central catalog of Pod-level prompt strings (compaction system crates/pod/src/pod.rs:317: /// [`Self::from_manifest`], or defaults to the builtin pack when a crates/pod/src/pod.rs:318: /// Pod is constructed through lower-level paths that have no loader. crates/pod/src/pod.rs:320: /// Registry loaded from `/.insomnia/workflow/*.md` when crates/pod/src/pod.rs:321: /// memory is enabled. Missing memory config keeps this empty. crates/pod/src/pod.rs:323: /// Memory workspace layout used by the workflow resolver to load required crates/pod/src/pod.rs:327: /// workspace memory summary (`memory/summary.md`). Internal disposable crates/pod/src/pod.rs:328: /// workers disable this so resident memory exposure is opt-in per Pod. crates/pod/src/pod.rs:332: /// summary and workflow residency: each section has its own gate. crates/pod/src/pod.rs:335: /// Workflow descriptions. This is intentionally independent from crates/pod/src/pod.rs:342: /// extract (memory.extract) reentry guard. `true` while an extract crates/pod/src/pod.rs:344: /// (`docs/plan/memory.md` §Extract 並走防止). `Arc` so crates/pod/src/pod.rs:348: /// consolidation (memory.consolidation) in-process reentry guard. The crates/pod/src/pod.rs:351: /// inside the same Pod from racing on the staging snapshot. crates/pod/src/pod.rs:358: /// extract/consolidation memory job running outside the controller method loop. crates/pod/src/pod.rs:367: /// are not preserved). Populated from log on `restore_from_manifest`, crates/pod/src/pod.rs:369: /// this fed `PodSharedState.user_segments`; the new wire format crates/pod/src/pod.rs:371: /// this remains purely an in-memory tracker for compact alignment. crates/pod/src/pod.rs:373: /// Pod-side session-log mirror + broadcast sink. Populated alongside crates/pod/src/pod.rs:374: /// every successful `session_store::append_entry` write so connected crates/pod/src/pod.rs:375: /// clients see a `(snapshot, live)` stream consistent with what's crates/pod/src/pod.rs:381: /// directly through the writer. Tests that drive `Pod::new` without crates/pod/src/pod.rs:407: // The cloned Pod's worker exists only as a snapshot for the memory crates/pod/src/pod.rs:410: // methods using `worker.client()` as fallback when no override crates/pod/src/pod.rs:452: // The memory-task clone never appends to the session log crates/pod/src/pod.rs:484: /// Pod after the worker is built; tests that drive `Pod::new` may crates/pod/src/pod.rs:491: /// entries by their producers (for example `PodInterceptor` and crates/pod/src/pod.rs:572: /// Create a new Pod from a pre-built Worker and store. crates/pod/src/pod.rs:576: /// manifest, or [`Scope::writable`] in tests. crates/pod/src/pod.rs:578: /// Note: this constructor does **not** parse `manifest.worker.system_prompt` crates/pod/src/pod.rs:579: /// as a template. `Pod::from_manifest` is the production path for crates/pod/src/pod.rs:580: /// templated prompts; callers of `Pod::new` that want a template crates/pod/src/pod.rs:642: /// path used by `Pod::from_manifest` and is exposed for tests and crates/pod/src/pod.rs:643: /// other callers that build a Pod without going through a manifest. crates/pod/src/pod.rs:650: /// Default `true`: normal Pods may expose each resident section according crates/pod/src/pod.rs:651: /// to its own gate and manifest settings. Internal disposable workers set crates/pod/src/pod.rs:652: /// this to `false` so summary, Knowledge, and Workflow residency are all crates/pod/src/pod.rs:653: /// suppressed while explicit tools remain available. crates/pod/src/pod.rs:660: /// Toggle `memory/summary.md` resident injection in the system prompt. crates/pod/src/pod.rs:670: /// Toggle resident Workflow injection in the system prompt. crates/pod/src/pod.rs:686: /// The Session this Pod belongs to. Stable across compaction and crates/pod/src/pod.rs:688: /// Pod-level operation today that moves a running Pod to a different crates/pod/src/pod.rs:694: /// The Pod's manifest. crates/pod/src/pod.rs:699: /// The Pod's working directory. crates/pod/src/pod.rs:704: /// The Pod's directory scope, as a shared atomically-swappable crates/pod/src/pod.rs:706: /// (e.g. a tool that needs to mutate scope dynamically). crates/pod/src/pod.rs:717: /// Apply `extra_allow` to the Pod's runtime scope. Future tool crates/pod/src/pod.rs:719: /// scope; in-flight tool calls keep the snapshot they captured at crates/pod/src/pod.rs:730: /// Strip `revoke` rules from the Pod's runtime scope by adding crates/pod/src/pod.rs:732: /// access at `Read` (mirroring the pod-registry `effective_write` crates/pod/src/pod.rs:733: /// semantics — Write is the only permission tracked across Pods). crates/pod/src/pod.rs:782: /// clients without consulting any other state. crates/pod/src/pod.rs:787: /// Cloneable callback handed to dynamic-scope tools. It cannot append crates/pod/src/pod.rs:788: /// directly to the async store from a sync tool callback, so it records crates/pod/src/pod.rs:789: /// the latest snapshot and the controller flushes it after the tool crates/pod/src/pod.rs:822: /// Use this to register tools, hooks, or subscribers before calling crates/pod/src/pod.rs:856: /// Enable name-keyed Pod metadata write-through for Pods built through crates/pod/src/pod.rs:857: /// the low-level constructor. High-level manifest constructors enable it crates/pod/src/pod.rs:859: /// same persistence behavior without changing `Pod::new`'s minimal bounds. crates/pod/src/pod.rs:886: /// Snapshot of the extract (memory.extract) boundary pointer. crates/pod/src/pod.rs:929: /// non-contended at every Pod lifecycle event. crates/pod/src/pod.rs:946: /// `.push(metric)` into it; Pod drains it in `persist_turn` and crates/pod/src/pod.rs:955: /// `tools` crate. Called by the Controller immediately after it crates/pod/src/pod.rs:956: /// registers the builtin tools on the Worker. Overwrites any crates/pod/src/pod.rs:962: /// Attach the session-scoped TaskStore from the builtin `tools` crate. crates/pod/src/pod.rs:963: /// Called by the Controller before registering builtin tools so the Pod crates/pod/src/pod.rs:982: /// Pod-internal operations (compaction failures, AGENTS.md crates/pod/src/pod.rs:983: /// ingestion warnings) can surface messages to connected clients. crates/pod/src/pod.rs:991: /// Pod-internal operations (currently: compaction) can surface crates/pod/src/pod.rs:992: /// progress to connected clients. crates/pod/src/pod.rs:1030: /// Broadcast a typed `Event` to connected clients. No-op when no crates/pod/src/pod.rs:1031: /// `event_tx` is attached (tests / direct `Pod::new` usage) or when crates/pod/src/pod.rs:1032: /// no clients are currently subscribed. crates/pod/src/pod.rs:1039: /// Push a `Method::Notify` (or rendered `Method::PodEvent`) entry crates/pod/src/pod.rs:1044: /// `PodInterceptor::pending_history_appends`. See [`NotifyBuffer`] crates/pod/src/pod.rs:1050: /// Push a typed `PodEvent` entry onto the pending buffer. crates/pod/src/pod.rs:1053: /// preserves the typed `PodEvent` payload so the IPC layer can crates/pod/src/pod.rs:1054: /// emit `SystemItem::PodEvent { event, body }` with structured crates/pod/src/pod.rs:1055: /// data for clients. crates/pod/src/pod.rs:1063: /// while `pod.run()` is in flight can still reach the interceptor. crates/pod/src/pod.rs:1068: /// Parent callback socket set by `from_manifest_spawned`. crates/pod/src/pod.rs:1070: /// Consumed by the Controller to fire `Method::PodEvent` upward on crates/pod/src/pod.rs:1071: /// lifecycle transitions. `None` for top-level Pods, in which case crates/pod/src/pod.rs:1098: /// Register a hook that runs before each tool call. crates/pod/src/pod.rs:1104: /// Register a hook that runs after each tool call. crates/pod/src/pod.rs:1125: /// `request_threshold`) is configured in the manifest, allocates crates/pod/src/pod.rs:1190: /// Render the manifest-supplied instruction template exactly once, crates/pod/src/pod.rs:1204: // Materialise any pending tool factories so the template sees the crates/pod/src/pod.rs:1205: // full list of tool names. Redundant with the flush inside crates/pod/src/pod.rs:1222: // gate so summary, Knowledge, and Workflow residency remain crates/pod/src/pod.rs:1296: /// Equivalent to `run(vec![Segment::text(s)])`. The dumb-client crates/pod/src/pod.rs:1297: /// counterpart of [`protocol::Method::run_text`]; primarily for crates/pod/src/pod.rs:1298: /// tests and tools that have only a string in hand. crates/pod/src/pod.rs:1303: /// Drop the prior memory_task handle if it has finished. Keep it if crates/pod/src/pod.rs:1311: /// Wait for the in-flight memory task (if any) to finish. Used before crates/pod/src/pod.rs:1323: /// defensive reasons; this is the gate for joining the memory task crates/pod/src/pod.rs:1335: /// store, and runs pre-run compact (joining any in-flight memory task crates/pod/src/pod.rs:1418: /// `input` is a typed segment list (see [`protocol::Segment`]). The crates/pod/src/pod.rs:1419: /// Pod flattens it into a single user-message string for the crates/pod/src/pod.rs:1428: // Validate workflow invocations up front so an invalid slug crates/pod/src/pod.rs:1432: // `workflow_registry`. crates/pod/src/pod.rs:1436: // any `Item::ToolCall` whose tool never produced a matching crates/pod/src/pod.rs:1441: // `last_run_interrupted` flag; `Pod::resume` reuses the prior crates/pod/src/pod.rs:1469: // workflow invocations to system messages stashed for the crates/pod/src/pod.rs:1470: // PodInterceptor to attach right after the user message. File and crates/pod/src/pod.rs:1471: // Knowledge failures are non-fatal alerts; explicit workflow invocation crates/pod/src/pod.rs:1502: /// or shallow `[Dir: ]` system message via `PodFsView`. Resolution crates/pod/src/pod.rs:1702: // `resolve_workflow_invocation` returns Item::system_message crates/pod/src/pod.rs:1704: // bodies). Persist each as a SystemItem::Workflow keyed on crates/pod/src/pod.rs:1721: /// short. Called from `Pod::run` when the worker's crates/pod/src/pod.rs:1722: /// `last_run_interrupted` flag is set (i.e. the Pod just transitioned crates/pod/src/pod.rs:1754: /// Validate explicit workflow invocations without reading dependency crates/pod/src/pod.rs:1755: /// bodies. Called from `Pod::run` entry so an invalid slug aborts crates/pod/src/pod.rs:1793: /// segments that fall through to placeholder (knowledge / workflow crates/pod/src/pod.rs:1794: /// refs without a resolver, or unknown variants from a newer client). crates/pod/src/pod.rs:1829: /// Run a turn triggered by `Method::Notify` while the Pod is idle. crates/pod/src/pod.rs:1832: /// history. The `PodInterceptor::pre_llm_request` drains the crates/pod/src/pod.rs:1853: // IDLE → active marker for the buffered notification / pod-event crates/pod/src/pod.rs:1855: // PodInterceptor) carry the actual payload. crates/pod/src/pod.rs:1889: /// On the first call for a Pod built via `from_manifest`, the session crates/pod/src/pod.rs:1926: // = the writer's current turn (its in-memory history reflects crates/pod/src/pod.rs:2177: // Low-level test paths that build `Pod::new` without wiring crates/pod/src/pod.rs:2231: // One LogEntry::LlmUsage per LLM call (the tool loop may have run crates/pod/src/pod.rs:2232: // many calls within a single Pod::run). Each is also appended to crates/pod/src/pod.rs:2233: // the in-memory `usage_history` so token-accounting APIs see it crates/pod/src/pod.rs:2292: /// - `compaction.model` from the manifest if configured, or crates/pod/src/pod.rs:2293: /// - a clone of the main LlmClient via `clone_boxed()`. crates/pod/src/pod.rs:2315: // Compaction-related knobs. Fall through to manifest defaults when crates/pod/src/pod.rs:2407: // Worker-side state collected by the compact worker's tool calls. crates/pod/src/pod.rs:2413: // with the main Pod (reads go through the same policy) but the crates/pod/src/pod.rs:2429: // UsageRecord counter used by the main Pod thresholds. crates/pod/src/pod.rs:2452: // history exploration, and compact-specific tools that populate `ctx`. crates/pod/src/pod.rs:2524: // Re-read each auto-read target via the Pod FS view. Errors are crates/pod/src/pod.rs:2636: // Keep pods.json pointing at the live segment_id. Without this crates/pod/src/pod.rs:2637: // a concurrent `restore_from_manifest(new_segment_id)` would crates/pod/src/pod.rs:2638: // see no live writer and grab the session this Pod just moved crates/pod/src/pod.rs:2641: // `Pod::new` in tests). crates/pod/src/pod.rs:2661: // SegmentStart's history (broadcast above) — clients derive crates/pod/src/pod.rs:2682: // via fold_pointer. The in-memory pointer must match — otherwise crates/pod/src/pod.rs:2695: /// Build the LlmClient for the compactor Worker. crates/pod/src/pod.rs:2697: /// Uses `compaction.model` from manifest if set, otherwise clones crates/pod/src/pod.rs:2698: /// the main client. crates/pod/src/pod.rs:2710: /// Build the LlmClient for the extract (memory.extract) Worker. crates/pod/src/pod.rs:2712: /// Uses `memory.extract_model` from manifest if set, otherwise clones crates/pod/src/pod.rs:2713: /// the main client. crates/pod/src/pod.rs:2745: /// extract (memory.extract) post-run trigger. crates/pod/src/pod.rs:2747: /// Called by the Controller before spawning the background memory task so crates/pod/src/pod.rs:2752: /// Behaviour follows `docs/plan/memory.md` §Extract 並走防止: crates/pod/src/pod.rs:2755: /// re-evaluation happens naturally because the in-memory pointer crates/pod/src/pod.rs:2788: // an extract for this Pod, skip per spec. crates/pod/src/pod.rs:3133: /// Build the LlmClient for the consolidation (memory.consolidation) Worker. crates/pod/src/pod.rs:3135: /// Uses `memory.consolidation_model` from manifest if set, otherwise crates/pod/src/pod.rs:3136: /// clones the main client. Mirrors [`build_extractor_client`]. crates/pod/src/pod.rs:3149: /// consolidation (memory.consolidation) trigger. crates/pod/src/pod.rs:3151: /// Intended to run from a background memory task after extract may have crates/pod/src/pod.rs:3155: /// Behaviour follows `docs/plan/memory.md` §Consolidation / §並走防止: crates/pod/src/pod.rs:3408: // Memory tools are self-contained — they bypass ScopedFs and write crates/pod/src/pod.rs:3410: // injection is a Pod-level concern; this disposable Worker is built crates/pod/src/pod.rs:3411: // without it by construction, in keeping with `docs/plan/memory.md` crates/pod/src/pod.rs:3413: // the search tool instead of via system-prompt residency). crates/pod/src/pod.rs:3643: /// Either threshold not met, no staging, or another Pod holds the lock. crates/pod/src/pod.rs:3654: /// Create a Pod entirely from a validated manifest. crates/pod/src/pod.rs:3656: /// The Pod's working directory is captured once here from the crates/pod/src/pod.rs:3658: /// different cwd must `cd` before constructing the Pod (e.g. the crates/pod/src/pod.rs:3659: /// `SpawnPod` tool sets `Command::current_dir` on the child). The crates/pod/src/pod.rs:3661: /// `manifest.scope`. crates/pod/src/pod.rs:3678: // session_id + segment_id are allocated here so the pod-registry crates/pod/src/pod.rs:3683: // Register this Pod in the machine-wide pod-registry crates/pod/src/pod.rs:3750: /// Build a Pod spawned by another Pod (sibling process). crates/pod/src/pod.rs:3752: /// Behaves like [`Pod::from_manifest`] but claims the scope crates/pod/src/pod.rs:3754: /// [`pod_registry::delegate_scope`], rather than installing a new crates/pod/src/pod.rs:3756: /// Unix-socket path so the spawned Pod can send `Method::Notify` crates/pod/src/pod.rs:3829: /// Restore a Pod by resolving its name-keyed metadata to an active crates/pod/src/pod.rs:3859: /// Restore a Pod from an existing session log. crates/pod/src/pod.rs:3861: /// Resolves the manifest cascade exactly like [`Self::from_manifest`] crates/pod/src/pod.rs:3862: /// (pwd / scope / pod-registry / client / prompt catalog), seeds a crates/pod/src/pod.rs:3867: /// Concurrent writers are prevented by the pod-registry: crates/pod/src/pod.rs:3869: /// refuses to start when `pod_registry::lookup_segment` already finds crates/pod/src/pod.rs:3870: /// a live Pod writing to `segment_id`. So there is no need to fork — crates/pod/src/pod.rs:3875: /// session keeps a stable cache prefix even when the manifest's crates/pod/src/pod.rs:3909: // Atomic: register_pod inside install_top_level rejects when crates/pod/src/pod.rs:3912: // makes "no two live Pods write to the same session log" crates/pod/src/pod.rs:3927: // Build the worker and apply the manifest defaults first, then crates/pod/src/pod.rs:3936: // (the Pod's one and only write path that prepends a summary at crates/pod/src/pod.rs:3997: // late-attaching client sees the full prefix without an crates/pod/src/pod.rs:4013: /// Convenience: build a Pod from a single-layer TOML manifest string. crates/pod/src/pod.rs:4015: /// Parses the TOML into a [`PodManifestConfig`], converts to a crates/pod/src/pod.rs:4016: /// validated [`PodManifest`] via `TryFrom`, then delegates to crates/pod/src/pod.rs:4017: /// [`Pod::from_manifest`]. Useful for tests, debugging, and any crates/pod/src/pod.rs:4026:/// Apply worker-level manifest settings to a Worker. crates/pod/src/pod.rs:4029:/// minijinja template that is parsed by `Pod::from_manifest` and crates/pod/src/pod.rs:4059:/// Result of a Pod run. crates/pod/src/pod.rs:4087: // Yielded is internal to Pod: it's always caught by crates/pod/src/pod.rs:4088: // handle_worker_result and never converted to PodRunResult. crates/pod/src/pod.rs:4330:/// Pod errors. crates/pod/src/pod.rs:4426:/// Bundle of resources that every high-level Pod constructor needs: crates/pod/src/pod.rs:4427:/// pwd, scope, an LLM client, the prompt catalog, and (optionally) a crates/pod/src/pod.rs:4428:/// parsed system-prompt template. Built once by [`prepare_pod_common`] crates/pod/src/pod.rs:4429:/// from the manifest cascade and then split into Pod fields. crates/pod/src/pod.rs:4438: /// SKILL.md shadow events surfaced during workflow-registry build. crates/pod/src/pod.rs:4439: /// The Pod constructor drains these into the notify buffer right crates/pod/src/pod.rs:4440: /// after the Pod is materialised so the first LLM request observes crates/pod/src/pod.rs:4441: /// any skill ↔ workflow collisions. crates/pod/src/pod.rs:4445:/// Resolve pwd / scope / LLM client / prompt catalog from a validated crates/pod/src/pod.rs:4446:/// manifest cascade. Used by `from_manifest`, `from_manifest_spawned`, crates/pod/src/pod.rs:4447:/// and `restore_from_manifest` so they share one definition of "what crates/pod/src/pod.rs:4448:/// pieces fall out of a manifest". crates/pod/src/pod.rs:4450:/// `parse_template` controls whether the manifest's instruction is crates/pod/src/pod.rs:4451:/// parsed as a system-prompt template. New Pods always parse so the crates/pod/src/pod.rs:4452:/// template is rendered at first turn; restored Pods skip parsing crates/pod/src/pod.rs:4520:/// Ingest external SKILL.md sources into the workflow registry. crates/pod/src/pod.rs:4522:/// Skills come exclusively from the manifest's `[skills] directories` crates/pod/src/pod.rs:4523:/// list (resolved against the manifest base directory). Internal crates/pod/src/pod.rs:4524:/// Workflows already loaded via [`workflow_crate::load_workflows`] take priority crates/pod/src/pod.rs:4526:/// [`workflow_crate::ShadowedSkill`] events that the caller pushes onto the crates/pod/src/pod.rs:4527:/// Pod's notification buffer. crates/pod/src/pod.rs:4548:/// Drain skill-ingest shadow events into the Pod's notify buffer so the crates/pod/src/pod.rs:4560:/// Build the Pod's runtime [`Scope`] from the manifest, layering the crates/pod/src/pod.rs:4561:/// memory subsystem's deny-write rules on top when `[memory]` is crates/pod/src/pod.rs:4563:/// directories ingested. The deny rules cap generic CRUD tools so they crates/pod/src/pod.rs:4564:/// cannot touch `/memory/` or `/knowledge/` while crates/pod/src/pod.rs:4565:/// the memory tools (registered separately) bypass `ScopedFs` and write crates/pod/src/pod.rs:4568:/// / `assets/` referenced by the Workflow body. crates/pod/src/pod.rs:4582:/// Allow-rules granting `Read` access to every skill directory the Pod crates/pod/src/pod.rs:4583:/// will ingest from the manifest's `[skills] directories`. Returned crates/pod/src/pod.rs:4601:/// Snapshot the process's current working directory as the Pod's pwd, crates/pod/src/pod.rs:4602:/// canonicalising symlinks and any `.`/`..` components. The Pod keeps crates/pod/src/pod.rs:5113: // Construct the smallest possible PodManifest that resolves; only crates/pod/src/pod.rs:5194: // No workflow exists to shadow `alpha`, so no shadow event for it. crates/protocol/src/lib.rs:8:// Method (Client → Pod via Unix Socket) crates/protocol/src/lib.rs:17: /// Human-readable text injected into the target Pod's LLM context crates/protocol/src/lib.rs:19: /// context; use `PodEvent` for typed lifecycle reports. crates/protocol/src/lib.rs:23: /// Typed lifecycle report from a child Pod to its direct parent. crates/protocol/src/lib.rs:30: /// Pod can resume the interrupted work via `Resume`, or start a crates/protocol/src/lib.rs:32: /// synthetic tool result before the new user message is appended). crates/protocol/src/lib.rs:34: /// Request an explicit compaction while the Pod is otherwise idle. crates/protocol/src/lib.rs:36: /// This is a typed control method: clients must not send `compact` as a crates/protocol/src/lib.rs:40: /// Request a list of completion candidates from the Pod. crates/protocol/src/lib.rs:46: /// (Knowledge / Workflow). crates/protocol/src/lib.rs:51: /// List Pods visible to this Pod from durable Pod state. This is not a crates/protocol/src/lib.rs:52: /// host-wide Pod universe query. crates/protocol/src/lib.rs:54: /// Inspect one Pod by name if its state exists and it is visible to this Pod. crates/protocol/src/lib.rs:58: /// Attach to a visible live Pod, or restore it from durable Pod state when crates/protocol/src/lib.rs:65:/// Typed lifecycle events sent from a child Pod to its parent. crates/protocol/src/lib.rs:67:/// Delivered as `Method::PodEvent` over the parent's Unix socket. The crates/protocol/src/lib.rs:69:/// pod-registry updates) and renders a human-readable string that is crates/protocol/src/lib.rs:74:/// child Pod). crates/protocol/src/lib.rs:83: /// Limited to worker runtime failures (provider / tool errors) — crates/protocol/src/lib.rs:91: /// Child sub-delegated scope to a grandchild Pod via `SpawnPod`. crates/protocol/src/lib.rs:94: /// `spawned_pods.json` so it can manage the grandchild directly crates/protocol/src/lib.rs:99: /// Sub-delegating Pod (= the sender itself). crates/protocol/src/lib.rs:101: /// Name of the grandchild Pod. crates/protocol/src/lib.rs:117:/// clients (CLI piping, scripts) only need to produce a single crates/protocol/src/lib.rs:118:/// `Segment::Text`; richer clients (TUI / GUI) construct typed atoms crates/protocol/src/lib.rs:119:/// (paste chips, file refs, knowledge refs, workflow invocations) and crates/protocol/src/lib.rs:120:/// send them through directly so the Pod side never has to re-parse a crates/protocol/src/lib.rs:124:/// `Segment::Unknown`. Pod treats this the same as known-but-unresolved crates/protocol/src/lib.rs:131: /// Free-form text. The fallback every client can produce. crates/protocol/src/lib.rs:133: /// Bracketed-paste capture from a TUI-style client. `id`, `chars` crates/protocol/src/lib.rs:143: /// `@` file-system reference. Pod resolves readable files to crates/protocol/src/lib.rs:148: /// `#` Knowledge reference (see `docs/plan/memory.md`). crates/protocol/src/lib.rs:150: /// `/` Workflow invocation (see `docs/plan/workflow.md`). crates/protocol/src/lib.rs:152: /// Unknown variant from a newer client. Pod treats this as an crates/protocol/src/lib.rs:168: /// alongside this call (Pod does so at submit time). crates/protocol/src/lib.rs:170: /// Sigil-prefixed variants (`FileRef` / `KnowledgeRef` / `WorkflowInvoke`) crates/protocol/src/lib.rs:206: /// Used by dumb clients, inter-Pod tools, and tests that only have crates/protocol/src/lib.rs:216:// Event (Pod → Client via Unix Socket broadcast) crates/protocol/src/lib.rs:222: /// A user input message was accepted by the Pod and is about to crates/protocol/src/lib.rs:223: /// start a new turn. Broadcast to every subscribed client so crates/protocol/src/lib.rs:224: /// additional TUI / GUI instances show the same pending user line crates/protocol/src/lib.rs:226: /// submitting clients would see tool calls and assistant text crates/protocol/src/lib.rs:237: /// Carries the JSON form of `session_store::SystemItem`. Covers crates/protocol/src/lib.rs:238: /// `Method::Notify` echoes, child-Pod lifecycle events from crates/protocol/src/lib.rs:239: /// `Method::PodEvent`, `@` / `#` / `/` crates/protocol/src/lib.rs:241: /// Clients dispatch on the `kind` tag for typed rendering instead crates/protocol/src/lib.rs:255: /// `Method::PodEvent` re-injection (kind=`PodEvent`), and any other crates/protocol/src/lib.rs:261: /// pod event body) is delivered separately via the immediately crates/protocol/src/lib.rs:269: /// into the same AgentTurn). When the input changes (a new tool crates/protocol/src/lib.rs:275: /// Currently retry is not yet implemented (`llm-worker-stream-continuation`) crates/protocol/src/lib.rs:303: /// This is operational state for clients to render while the worker is crates/protocol/src/lib.rs:333: /// some providers (or some configurations) emit thinking metadata crates/protocol/src/lib.rs:341: /// (empty string when the provider didn't emit plaintext). crates/protocol/src/lib.rs:360: /// Short human-readable summary. Always present; used by clients crates/protocol/src/lib.rs:363: /// Full tool output. Absent when the tool chose to return crates/protocol/src/lib.rs:375: /// occupancy; subtracting it yields the "net upload" the client crates/protocol/src/lib.rs:377: /// the TUI status line accumulates per turn. crates/protocol/src/lib.rs:391: /// Sent exactly once at the start of every client connection. crates/protocol/src/lib.rs:394: /// as the JSON form of `session_store::LogEntry`. This is the crates/protocol/src/lib.rs:395: /// bulk-reconstruction lane: clients walk the entries to seed their crates/protocol/src/lib.rs:398: /// `greeting` and `status` accompany the snapshot so clients render crates/protocol/src/lib.rs:399: /// pod identity and current controller state without an extra round crates/protocol/src/lib.rs:415: /// from the live writer's cached head. Clients drop their derived crates/protocol/src/lib.rs:419: /// Payload is the JSON form of `session_store::LogEntry::SegmentStart`. crates/protocol/src/lib.rs:423: /// Current Pod controller status. Broadcast on every controller-level crates/protocol/src/lib.rs:436: /// Reply to `Method::ListVisiblePods`. Payload is a stable JSON value so crates/protocol/src/lib.rs:437: /// the Pod crate can evolve discovery fields without introducing a protocol crates/protocol/src/lib.rs:438: /// dependency on session-store. crates/protocol/src/lib.rs:442: /// Reply to `Method::InspectPod`. crates/protocol/src/lib.rs:446: /// Reply to `Method::AttachOrRestorePod`. crates/protocol/src/lib.rs:451: /// Latest memory extract/consolidation lifecycle event for UI observability. crates/protocol/src/lib.rs:453: /// This is not part of LLM history or prompt context; clients may display it crates/protocol/src/lib.rs:456: /// Pod has started compacting the current session. crates/protocol/src/lib.rs:460: /// Broadcast to all clients; not replayed to late subscribers. crates/protocol/src/lib.rs:476:/// User-facing alert emitted from the Pod layer. crates/protocol/src/lib.rs:479:/// here are assembled explicitly by the Pod when a condition should be crates/protocol/src/lib.rs:480:/// surfaced to the person driving the client. Keep messages short and crates/protocol/src/lib.rs:522:/// Mirrors the TUI prefix sigils: `@` → `File`, `#` → `Knowledge`, crates/protocol/src/lib.rs:523:/// `/` → `Workflow`. Knowledge and Workflow resolvers are currently crates/protocol/src/lib.rs:525:/// nailed down here so the TUI side can ship without waiting for crates/protocol/src/lib.rs:526:/// the memory / workflow tickets. crates/protocol/src/lib.rs:537:/// `value` is a path (file kind) or a slug (knowledge / workflow). crates/protocol/src/lib.rs:538:/// `is_dir` is meaningful only for the file kind — it lets the TUI crates/protocol/src/lib.rs:548:/// Pod self-description rendered by the TUI when a session starts empty. crates/protocol/src/lib.rs:550:/// Built once in the Pod controller from the resolved manifest and crates/protocol/src/lib.rs:551:/// transmitted alongside `Event::Snapshot` so clients don't need crates/protocol/src/lib.rs:552:/// their own view of the manifest. crates/protocol/src/lib.rs:561: /// Model context window in tokens. Always filled by the Pod greeting. crates/protocol/src/lib.rs:593:/// notify message, pod event body) is delivered by the immediately crates/protocol/src/lib.rs:602: /// `Method::PodEvent` — typed lifecycle report from a child Pod. crates/protocol/src/lib.rs:620: /// The accepted Method::Run produced no assistant/tool output before crates/protocol/src/lib.rs:621: /// user interruption, so the Pod rolled the submit-time turn state back crates/protocol/src/lib.rs:622: /// to its pre-submit snapshot. Clients should treat the Pod as Idle and crates/protocol/src/lib.rs:642:// Defined here so that both `manifest` (config parsing) and `protocol` crates/protocol/src/lib.rs:643:// itself (inter-pod messaging such as `PodEvent::ScopeSubDelegated`) can crates/protocol/src/lib.rs:652: /// manifest file's directory (cwd for overlay layers) before cascade crates/protocol/src/lib.rs:742: // A future client sends a segment kind this Pod has never heard of. crates/protocol/src/lib.rs:744: // unknown payload must surface as `Segment::Unknown` so the Pod