The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs: add relative links to module READMEs
Steven Enamakel8a814dcab8dc
diff --git a/crates/openhuman-core/src/media/README.md b/crates/openhuman-core/src/media/README.mdindex 03fbad6dcb..fe34f89139 100644--- a/crates/openhuman-core/src/media/README.md+++ b/crates/openhuman-core/src/media/README.md@@ -60,7 +60,7 @@ account is out of managed credits.| Path | What it does || --- | --- |-| `mod.rs` | Declares `generation`. |+| [`mod.rs`](./mod.rs) | Declares [`generation`](./generation). || [`generation/`](generation/README.md) | The three `media_*` tools, the guarded OpenRouter generators, the local-reference policy, and the artifact wrapper. |Inside `generation/`:@@ -73,12 +73,12 @@ Inside `generation/`:## Key types and entry points-- `build_media_tools(&Config, &Path)` (`generation/tools.rs`) is the registry+- `build_media_tools(&Config, &Path)` ([`generation/tools.rs`](./generation/tools.rs)) is the registryentry point. It returns an empty list, not an error, when no backend isreachable.-- `managed_generators(&Config)` (`generation/provider.rs`) builds+- `managed_generators(&Config)` ([`generation/provider.rs`](./generation/provider.rs)) builds`MediaGenerators { image, video }` against the backend proxy.-- `MediaArtifactTool` (`generation/artifact_tool.rs`) is the artifact-tracking+- `MediaArtifactTool` ([`generation/artifact_tool.rs`](./generation/artifact_tool.rs)) is the artifact-trackingwrapper, following the same `create_artifact_for_call` /`finalize_artifact` / `fail_artifact` pattern the document and presentationtools use.@@ -121,8 +121,8 @@ Inside `generation/`:## Tests-`generation/tools_tests.rs` (tool schemas, reference policy, flows over mock-generators) and `generation/artifact_tool_tests.rs` (artifact filing and+[`generation/tools_tests.rs`](./generation/tools_tests.rs) (tool schemas, reference policy, flows over mock+generators) and [`generation/artifact_tool_tests.rs`](./generation/artifact_tool_tests.rs) (artifact filing andper-entry failure).```bashdiff --git a/crates/openhuman-core/src/media/generation/README.md b/crates/openhuman-core/src/media/generation/README.mdindex 1d20cdcaa8..bb7d26b630 100644--- a/crates/openhuman-core/src/media/generation/README.md+++ b/crates/openhuman-core/src/media/generation/README.md@@ -13,17 +13,17 @@ split across three layers, each with a different owner:argument parsing, artifact persistence into the workspace, and resultwording.- **This module** owns the host policy: endpoint, credential, egress,- privacy, and budget gates (`provider.rs`), plus the tool names,- descriptions, and local-reference policy (`tools.rs`).+ privacy, and budget gates ([`provider.rs`](./provider.rs)), plus the tool names,+ descriptions, and local-reference policy ([`tools.rs`](./tools.rs)).## Key files| File | Role || --- | --- |-| `provider.rs` | `managed_generators`: builds `MediaGenerators { image, video }` against the managed backend, or returns `None` when no backend transport is installed. Wraps each generator in a `Guard` that enforces local-only privacy mode and the egress disclosure before a request leaves the device, and the managed-credit budget gate before a billed submit. |-| `tools.rs` | `build_media_tools`: registers `media_generate_image`, `media_generate_video`, and `media_list_models` as `Tool` implementations over the generators from `provider.rs`. Also defines `reference_policy`, which restricts local reference files (for image edits or video first/last frames) to the action directory or workspace directory. |-| `artifact_tool.rs` | `MediaArtifactTool`: wraps a generation tool so every file it saves is also tracked as an OpenHuman artifact, following the same `create_artifact` / `finalize_artifact` pattern the document and presentation tools use. Runs the inner tool unchanged, then files each reported output and stamps an `artifact_id` (or `artifact_error`) onto its entry. |-| `mod.rs` | Re-exports: `MediaArtifactTool`, `managed_generators`, `MediaGenerators`, `OPENROUTER_PROXY_PATH`, `build_media_tools`, `media_tools_from`, `MediaListModelsTool`, and the three tool-name constants. |+| [`provider.rs`](./provider.rs) | `managed_generators`: builds `MediaGenerators { image, video }` against the managed backend, or returns `None` when no backend transport is installed. Wraps each generator in a `Guard` that enforces local-only privacy mode and the egress disclosure before a request leaves the device, and the managed-credit budget gate before a billed submit. |+| [`tools.rs`](./tools.rs) | `build_media_tools`: registers `media_generate_image`, `media_generate_video`, and `media_list_models` as `Tool` implementations over the generators from `provider.rs`. Also defines `reference_policy`, which restricts local reference files (for image edits or video first/last frames) to the action directory or workspace directory. |+| [`artifact_tool.rs`](./artifact_tool.rs) | `MediaArtifactTool`: wraps a generation tool so every file it saves is also tracked as an OpenHuman artifact, following the same `create_artifact` / `finalize_artifact` pattern the document and presentation tools use. Runs the inner tool unchanged, then files each reported output and stamps an `artifact_id` (or `artifact_error`) onto its entry. |+| [`mod.rs`](./mod.rs) | Re-exports: `MediaArtifactTool`, `managed_generators`, `MediaGenerators`, `OPENROUTER_PROXY_PATH`, `build_media_tools`, `media_tools_from`, `MediaListModelsTool`, and the three tool-name constants. |## Key typesdiff --git a/crates/openhuman-core/src/memory/README.md b/crates/openhuman-core/src/memory/README.mdindex a89d13b63b..d76f73053e 100644--- a/crates/openhuman-core/src/memory/README.md+++ b/crates/openhuman-core/src/memory/README.md@@ -29,7 +29,7 @@ The core never keeps a TinyHumans credential of its own. The bearer isfetched from the host's credential seam (`resolve_backend_credential`) onevery request, so a refreshed session takes effect at once and signing outturns memory off. The hosted engine does not go through the core's-`BackendTransport`: `engine.rs` hands TinyMemory's CortexDB client an+`BackendTransport`: [`engine.rs`](./engine.rs) hands TinyMemory's CortexDB client an`EngineSettings` with the endpoint, the attribution headers from`backend::attribution_headers` and an `EngineCredential::Dynamic(HostBearer)`,and TinyMemory's own HTTP client calls the backend's `/memory/*` routes. The@@ -65,7 +65,7 @@ Memory follows TinyMemory's standard layout (`tinymemory_tools::MemoryLayout`):+-- agent:<memory agent> one agent's conversations, one turn per item```-A `MemoryIdentity` (in `scope.rs`) is the acting agent definition and, for a+A `MemoryIdentity` (in [`scope.rs`](./scope.rs)) is the acting agent definition and, for ateam member, its team. The host scopes one around every agent turn with`scope::within_agent` or `scope::within`, which set a task-local.`MemoryIdentity::resolve` turns it into a `ResolvedIdentity` (layout root plus@@ -90,14 +90,14 @@ on each turn. The person's actor is `user:<id>` (`scope::actor_of_root`),which is also the retired root still read during the move while`[memory] legacy_user_segment_read` is on. A signed-out session gets itsroot from a random install id minted once and recorded in-`<workspace>/memory/local_root.json` as `user:local-<id>` (`local_root.rs`),+`<workspace>/memory/local_root.json` as `user:local-<id>` ([`local_root.rs`](./local_root.rs)),used as `org:local-<id>`. If that file cannot be written or read, thesession has no root and memory stays off.### Around every turn-TinyMemory's `AgentMemory` runs the lifecycle. `lifecycle/mod.rs` builds one-for an identity under the `[memory.recall]` policy, and `lifecycle/hooks.rs`+TinyMemory's `AgentMemory` runs the lifecycle. [`lifecycle/mod.rs`](./lifecycle/mod.rs) builds one+for an identity under the `[memory.recall]` policy, and [`lifecycle/hooks.rs`](./lifecycle/hooks.rs)has the three hooks the agent calls:```text@@ -141,7 +141,7 @@ A few details hang off the turn. For a message that arrived on a channel,`lifecycle::sender::channel_actor` records the sender as the observed actor(`user:+1555...` for phone-addressed channels, `user:<email>`, otherwise`<channel>:<sender>`). The session host records the channel/thread pairing-in `channels.rs` so a channel's memory can be forgotten later. With+in [`channels.rs`](./channels.rs) so a channel's memory can be forgotten later. With`[memory.recall] date_hint` on, `lifecycle::date_hint::extract` makes onesmall model call to work out which days the user means; a late or badanswer just leaves the pack in its normal order. The pack's citations are@@ -152,14 +152,14 @@ for the chat's memory chips (`tools::take_turn_citations`).`post_turn` and brain ingests return TinyMemory `BackgroundJob` values(belief builds, deferred ingests) instead of running them inline.-`lifecycle/jobs.rs` queues them in `<workspace>/memory/jobs.json`,+[`lifecycle/jobs.rs`](./lifecycle/jobs.rs) queues them in `<workspace>/memory/jobs.json`,de-duplicates them (two builds of one scope are one build), and runs eachonce it is at least `[memory.recall] build_delay_secs` old, because a beliefbuild reads facts the engine extracts from the writes and that extractionlags. An engine that cannot consolidate answers `Skipped`; the hosted enginebuilds on its own schedule (`Scheduled`).-Memory registers two system cron jobs, handled by `bus.rs`:+Memory registers two system cron jobs, handled by [`bus.rs`](./bus.rs):```textCronSystemJobDue@@ -176,15 +176,15 @@ CronSystemJobDue### The brain and sourcesThe brain is the set of documents every agent under a root shares, filed at-`source:<connector>` nodes with no agent id (`brain.rs`). A file ingested+`source:<connector>` nodes with no agent id ([`brain.rs`](./brain.rs)). A file ingestedfrom the UI (`memory_brain_ingest`) goes under `files`; synced sources are-filed by what they read. Files are converted through `convert.rs`: PDF,+filed by what they read. Files are converted through [`convert.rs`](./convert.rs): PDF,DOCX, PPTX and XLSX go through TinyMemory's `OfficeConverter` on Tokio'sblocking pool when the `documents` feature is on, then `NativeConverter`handles text, markdown, HTML and code. Every ingest queues a belief build ofthe source's scope.-Sources (`sources/`) are the `[[memory.sources]]` registry in `config.toml`:+Sources ([`sources/`](./sources/)) are the `[[memory.sources]]` registry in `config.toml`:a folder, a file, a web page, a GitHub repository or an RSS feed, plus howoften to sync it (at least every 15 minutes). Sync reads through`tinymemory-integrations`' readers and stores each item as a `Document`@@ -199,7 +199,7 @@ Deleting a chat thread, forgetting a channel (one thread deletion per threadit owned) or removing a source with `forget_items` asks the engine to deletefor good: matched items are forgotten by `memory_ids` with an explicit`redact_events` cascade (the engine's default keeps events). When memory is-off, or the call fails, `deletion.rs` records a `PendingDeletion` (`Thread`+off, or the call fails, [`deletion.rs`](./deletion.rs) records a `PendingDeletion` (`Thread`or `Source`) in `<workspace>/memory/pending_deletions.json`. The queue isdrained on the next stored credential (the `memory::pending_deletions`subscriber on `CredentialChanged`, any kind but `cleared`) and on every@@ -211,17 +211,17 @@ scope.Three flows upload data the user already has locally, and each refuses tostart without explicit consent and resumes after a restart:-- `backfill.rs` stores chats from before turns were logged, walking the+- [`backfill.rs`](./backfill.rs) stores chats from before turns were logged, walking thethread store and writing the same turn items the live hooks would, tagged`backfill`. It stops short of the first turn live logging already stored.Progress is in `conversations_backfill.json`.-- `import.rs` (with `import_retry.rs`) imports a v1 store from+- [`import.rs`](./import.rs) (with [`import_retry.rs`](./import_retry.rs)) imports a v1 store from`<workspace>/memory/memory.db` through `tinymemory-import`. A blockingreader walks the store, the async side scrubs, stores and checkpointsevery 25 items in `import_state.json`. Transient engine failures retrywith backoff; a stop caused by something that will not pass on its own(credits exhausted, signed out) waits for the user.-- `layout_migration/` moves memory written before layout v3 from the legacy+- [`layout_migration/`](./layout_migration/) moves memory written before layout v3 from the legacy`app:tinymemory/...` tree into the per-user tree. It copies page by page,verifies each item by reading it back, switches reads and writes onlyafter everything copyable is verified, catches up on writes made in@@ -239,7 +239,7 @@ Anything unknown counts as not free.### The RPC surface is confinedThe `memory_*` RPCs (and the MCP memory tools that dispatch through them)-go through `confine.rs`. It resolves the identity in scope (the agent of a+go through [`confine.rs`](./confine.rs). It resolves the identity in scope (the agent of arunning turn, else the config's own root identity), fills an unset `reach`with that identity's subtree, refuses a wider reach with `INVALID_REQUEST`,and places a `learn` with no namespace at the identity's learnings node.@@ -250,37 +250,37 @@ The agent `memory` tool applies the same confinement and overwrites any| Path | What it does || --- | --- |-| `mod.rs` | Module declarations and re-exports (`memory_is_on`, `MemoryTool`, the controller aggregators, `register_memory_subscribers`). |-| `engine.rs` | `resolve` binds the configured engine or says why memory is off; per-fingerprint cache; host engine install; CortexDB key storage. |-| `guard.rs` | `ScrubbingEngine`: scrubs every write and times every engine call. |-| `scope.rs` | `MemoryIdentity`, `ResolvedIdentity`, resolution order, `within` / `within_agent`, layout v3 roots. |-| `local_root.rs` | The persistent install-id root of a signed-out session. |-| `lifecycle/mod.rs` | Builds `AgentMemory` for an identity under the `[memory.recall]` policy. |-| `lifecycle/hooks.rs` | `pre_turn`, `post_turn`, `compaction`; `TurnPack`, `MemoryTurn`. |-| `lifecycle/jobs.rs` | The persisted background job queue and the `memory_background` run. |-| `lifecycle/views.rs` | Policy get/set, pack preview, agents list, jobs list/run for the UI. |-| `lifecycle/sender.rs` | Maps a channel message's sender to an observed actor. |-| `lifecycle/date_hint.rs` | Optional model call that works out which days a turn refers to. |-| `ops.rs` | Engine list/get/set, recall, fetch, learn, forget, erase all, items list. |-| `confine.rs` | Confines the RPC surface to the acting identity's subtree. |-| `explore.rs` | The facet explorer behind `memory_explore` and `memory_items_get`. |-| `brain.rs` | Brain source mapping and the `memory_brain_*` ops. |-| `convert.rs` | The document converter chain used by brain ingest and file sources. |-| `sources/` | The `[[memory.sources]]` registry (`mod.rs`), sync state (`state.rs`) and sync (`sync.rs`). |-| `channels.rs` | Channel to thread records, for forgetting a channel. |-| `deletion.rs` | Hard deletes and the pending-deletion queue with its drain. |-| `backfill.rs` | Consent-gated, resumable storing of past chats. |-| `import.rs`, `import_retry.rs` | Consent-gated, resumable v1 import, and retrying refused items. |-| `layout_migration/` | Legacy tree to per-user tree migration: `job.rs` (end to end), `copy.rs`, `map.rs` (placement), `cleanup.rs`, `claim.rs`, `state.rs`, `service.rs` (RPC/tick entry points), `app_host.rs` (the real host). |-| `billing.rs` | Whether background rewrites are free for the user right now. |-| `files.rs` | Owner-only (0600 / 0700 on unix) writes of the local state files. |-| `tools.rs` | The single `memory` agent tool and per-turn citations. |-| `bus.rs` | The cron subscriber and the pending-deletions subscriber. |-| `schemas.rs`, `schemas/defs.rs`, `schemas/handlers.rs` | The `openhuman.memory_*` controller schemas and thin handlers. |-| `types.rs` | RPC request and view shapes; contract types are re-exported from `tinymemory_api`. |-| `error.rs` | `MemoryError` and the seven stable error codes. |-| `status.rs` | The memory row of `subsystems.status`. |-| `test_fixtures.rs` | Shared in-memory engines for the unit tests. |+| [`mod.rs`](./mod.rs) | Module declarations and re-exports (`memory_is_on`, `MemoryTool`, the controller aggregators, `register_memory_subscribers`). |+| [`engine.rs`](./engine.rs) | `resolve` binds the configured engine or says why memory is off; per-fingerprint cache; host engine install; CortexDB key storage. |+| [`guard.rs`](./guard.rs) | `ScrubbingEngine`: scrubs every write and times every engine call. |+| [`scope.rs`](./scope.rs) | `MemoryIdentity`, `ResolvedIdentity`, resolution order, `within` / `within_agent`, layout v3 roots. |+| [`local_root.rs`](./local_root.rs) | The persistent install-id root of a signed-out session. |+| [`lifecycle/mod.rs`](./lifecycle/mod.rs) | Builds `AgentMemory` for an identity under the `[memory.recall]` policy. |+| [`lifecycle/hooks.rs`](./lifecycle/hooks.rs) | `pre_turn`, `post_turn`, `compaction`; `TurnPack`, `MemoryTurn`. |+| [`lifecycle/jobs.rs`](./lifecycle/jobs.rs) | The persisted background job queue and the `memory_background` run. |+| [`lifecycle/views.rs`](./lifecycle/views.rs) | Policy get/set, pack preview, agents list, jobs list/run for the UI. |+| [`lifecycle/sender.rs`](./lifecycle/sender.rs) | Maps a channel message's sender to an observed actor. |+| [`lifecycle/date_hint.rs`](./lifecycle/date_hint.rs) | Optional model call that works out which days a turn refers to. |+| [`ops.rs`](./ops.rs) | Engine list/get/set, recall, fetch, learn, forget, erase all, items list. |+| [`confine.rs`](./confine.rs) | Confines the RPC surface to the acting identity's subtree. |+| [`explore.rs`](./explore.rs) | The facet explorer behind `memory_explore` and `memory_items_get`. |+| [`brain.rs`](./brain.rs) | Brain source mapping and the `memory_brain_*` ops. |+| [`convert.rs`](./convert.rs) | The document converter chain used by brain ingest and file sources. |+| [`sources/`](./sources/) | The `[[memory.sources]]` registry (`mod.rs`), sync state (`state.rs`) and sync (`sync.rs`). |+| [`channels.rs`](./channels.rs) | Channel to thread records, for forgetting a channel. |+| [`deletion.rs`](./deletion.rs) | Hard deletes and the pending-deletion queue with its drain. |+| [`backfill.rs`](./backfill.rs) | Consent-gated, resumable storing of past chats. |+| [`import.rs`](./import.rs), [`import_retry.rs`](./import_retry.rs) | Consent-gated, resumable v1 import, and retrying refused items. |+| [`layout_migration/`](./layout_migration/) | Legacy tree to per-user tree migration: `job.rs` (end to end), `copy.rs`, `map.rs` (placement), `cleanup.rs`, `claim.rs`, `state.rs`, `service.rs` (RPC/tick entry points), `app_host.rs` (the real host). |+| [`billing.rs`](./billing.rs) | Whether background rewrites are free for the user right now. |+| [`files.rs`](./files.rs) | Owner-only (0600 / 0700 on unix) writes of the local state files. |+| [`tools.rs`](./tools.rs) | The single `memory` agent tool and per-turn citations. |+| [`bus.rs`](./bus.rs) | The cron subscriber and the pending-deletions subscriber. |+| [`schemas.rs`](./schemas.rs), [`schemas/defs.rs`](./schemas/defs.rs), [`schemas/handlers.rs`](./schemas/handlers.rs) | The `openhuman.memory_*` controller schemas and thin handlers. |+| [`types.rs`](./types.rs) | RPC request and view shapes; contract types are re-exported from `tinymemory_api`. |+| [`error.rs`](./error.rs) | `MemoryError` and the seven stable error codes. |+| [`status.rs`](./status.rs) | The memory row of `subsystems.status`. |+| [`test_fixtures.rs`](./test_fixtures.rs) | Shared in-memory engines for the unit tests. |## Key types and entry points@@ -294,14 +294,14 @@ The agent `memory` tool applies the same confinement and overwrites any(`lifecycle/hooks.rs`): what the agent harness calls.- `lifecycle::jobs::enqueue` and `run_due` (`lifecycle/jobs.rs`): thebackground queue.-- `MemoryTool` and `run_action` (`tools.rs`): the `recall | fetch | learn |+- `MemoryTool` and `run_action` ([`tools.rs`](./tools.rs)): the `recall | fetch | learn |forget` tool. `learn` stamps the item with facts the model does not choose:workspace, thread id, memory agent id, the learnings namespace, the toolcall, and `source.kind = agent`.- `deletion::forget_thread` (`deletion.rs`): called by `threads` when athread is deleted. `channels::forget_channel` is called by `channels` ondisconnect.-- `MemoryError` (`error.rs`): every RPC failure carries one of `MEMORY_OFF`,+- `MemoryError` ([`error.rs`](./error.rs)): every RPC failure carries one of `MEMORY_OFF`,`UNSUPPORTED`, `INVALID_REQUEST`, `UNAUTHORIZED`, `INSUFFICIENT_CREDITS`,`UNAVAILABLE` or `ENGINE` in `data.code`. The two account-wide refusals aresplit out so a caller can tell "top up" and "try later" apart from an@@ -327,17 +327,17 @@ All methods are `openhuman.memory_<function>`, listed in## PersistenceThere is no local memory database: items live in the engine. Local state-files under `<workspace>/memory/`, written owner-only through `files.rs`:+files under `<workspace>/memory/`, written owner-only through [`files.rs`](./files.rs):| File | Owner || --- | --- || `jobs.json` | `lifecycle/jobs.rs` || `channel_threads.json` | `channels.rs` || `pending_deletions.json` | `deletion.rs` |-| `sources_state.json` | `sources/state.rs` |+| `sources_state.json` | [`sources/state.rs`](./sources/state.rs) || `conversations_backfill.json` | `backfill.rs` || `import_state.json` | `import.rs` |-| `layout_migration.json` | `layout_migration/state.rs` |+| `layout_migration.json` | [`layout_migration/state.rs`](./layout_migration/state.rs) || `local_root.json` | `local_root.rs` |The sources registry is `[[memory.sources]]` in `config.toml`. The CortexDB@@ -370,7 +370,7 @@ sits in the app directory shared by all accountsglobal config instead would write to the wrong memory.- Every write must go through a bound engine so the scrubber sees it. Do nothold a raw `MemoryEngine` outside `engine.rs`.-- RPC handlers must call through `confine.rs`, not `ops.rs` directly, or a+- RPC handlers must call through `confine.rs`, not [`ops.rs`](./ops.rs) directly, or acaller can read another root's memory.- A new local state file should be written with `files::write_private`.- `engine::invalidate` clears the engine cache; tests that swap engines rely@@ -379,7 +379,7 @@ sits in the app directory shared by all accounts## TestsUnit tests sit beside each module as `<module>_tests.rs`, using the-in-memory engines in `test_fixtures.rs`. Run them with+in-memory engines in [`test_fixtures.rs`](./test_fixtures.rs). Run them with`cargo test -p openhuman memory::` or `pnpm debug rust memory`. Integrationcoverage is in `tests/memory_v2_e2e.rs` (JSON-RPC and a full web-chat turnagainst the mock backend, run with `cargo test -p openhuman-cli --testdiff --git a/crates/openhuman-core/src/modules/README.md b/crates/openhuman-core/src/modules/README.mdindex c4dfbfec0d..ec06121bb6 100644--- a/crates/openhuman-core/src/modules/README.md+++ b/crates/openhuman-core/src/modules/README.md@@ -9,7 +9,7 @@ binary: `tinycomputer`, `tinysearch`, `tinydocs`, `tinywallet`, `tinyjuice`,GitHub release, checks it against a digest compiled into this crate, letstinybus admit it, attaches it to a private in-process broker, and then callsit like any other bus service. Domains reach a module through the per-module-host files here (`documents.rs`, `wallet.rs`, `voice.rs`, ...) rather than+host files here ([`documents.rs`](./documents.rs), [`wallet.rs`](./wallet.rs), [`voice.rs`](./voice.rs), ...) rather thantalking to tinybus themselves.The `//!` comments in [`mod.rs`](mod.rs), [`host.rs`](host.rs) and@@ -170,7 +170,7 @@ containers with no cache directory.Some modules take a private configuration blob at load and onreinitialization. `ops::module_config` builds it per id: `search::module_config`-for `tinysearch`, `desktop::module_config` (from `computer_config.rs`) for+for `tinysearch`, `desktop::module_config` (from [`computer_config.rs`](./computer_config.rs)) for`tinycomputer`, and `connectors::module_config` for `tinyconnectors`.Everything else gets `{}`. When the connector configuration cannot be built(direct mode with no key, an unknown mode) the module still loads with `{}`,@@ -232,7 +232,7 @@ no host file in this folder.## Key types and entry points-- `ModuleRecord` (`types.rs`) is one compiled-in module: `id`, `description`,+- `ModuleRecord` ([`types.rs`](./types.rs)) is one compiled-in module: `id`, `description`,`bus_name`, `object_path`, `version`, `release_url`, its `assets`, and its`load` policy. `asset_for(host_key)` picks the artifact for a host key.- `PlatformAsset` (`types.rs`) is one published archive: the host key (for@@ -256,7 +256,7 @@ no host file in this folder.## RPC surface-All methods are in the `modules` namespace (`schemas.rs`), wired into the+All methods are in the `modules` namespace ([`schemas.rs`](./schemas.rs)), wired into theregistry from `core/all.rs`:| Method | What it does |@@ -330,10 +330,10 @@ loadable:`agent/multimodal.rs` and `agent/attachments/` use `documents.rs`;`voice/always_on` and `voice/streaming.rs` use `voice.rs`;`tools/impl/browser/` and `desktop/control/` use the TinyComputer files;- `integrations/composio/module_client.rs` uses `connectors.rs`;- `search/tools.rs` and `search/bus.rs` use `search/`; and+ `integrations/composio/module_client.rs` uses [`connectors.rs`](./connectors.rs);+ `search/tools.rs` and `search/bus.rs` use [`search/`](./search/); and`inference/tokenjuice` calls `ensure_loaded(config, "tinyjuice")` and is- called back through `tokenjuice_host.rs`.+ called back through [`tokenjuice_host.rs`](./tokenjuice_host.rs).## Gotchasdiff --git a/crates/openhuman-core/src/modules/registry/README.md b/crates/openhuman-core/src/modules/registry/README.mdindex 2a75c47934..44a1a6c0a4 100644--- a/crates/openhuman-core/src/modules/registry/README.md+++ b/crates/openhuman-core/src/modules/registry/README.md@@ -18,21 +18,21 @@ surface with a download step attached.Each `records_*.rs` file defines one or more `pub(crate) const ModuleRecord`values for a family of related modules:-- `records_computer.rs`: `TINYCOMPUTER` (desktop and browser control).-- `records_docs_wallet.rs`: `TINYDOCS`, `TINYWALLET`.-- `records_extra.rs`: `TINYBOX`, `TINYCHANNELS`, `TINYHOSTS`.-- `records_mcp_connectors.rs`: `TINYCONNECTORS`, `TINYMCP`.+- [`records_computer.rs`](./records_computer.rs): `TINYCOMPUTER` (desktop and browser control).+- [`records_docs_wallet.rs`](./records_docs_wallet.rs): `TINYDOCS`, `TINYWALLET`.+- [`records_extra.rs`](./records_extra.rs): `TINYBOX`, `TINYCHANNELS`, `TINYHOSTS`.+- [`records_mcp_connectors.rs`](./records_mcp_connectors.rs): `TINYCONNECTORS`, `TINYMCP`.- `records_juice.rs`: `TINYJUICE`.-- `records_runtime.rs`: `TINYRUNTIME`, `TINYRUNTIME_NODEJS`, `TINYRUNTIME_PYTHON`.-- `records_search.rs`: `TINYSEARCH`.-- `records_voice.rs`: `TINYVOICE`.+- [`records_runtime.rs`](./records_runtime.rs): `TINYRUNTIME`, `TINYRUNTIME_NODEJS`, `TINYRUNTIME_PYTHON`.+- [`records_search.rs`](./records_search.rs): `TINYSEARCH`.+- [`records_voice.rs`](./records_voice.rs): `TINYVOICE`.-`../registry.rs` (one level up from this folder) wires all of them into the+[`../registry.rs`](../registry.rs) (one level up from this folder) wires all of them into the`ALL` slice and answers `find(id)` by a linear scan.## Key types-Both live in `../types.rs`, not in this folder:+Both live in [`../types.rs`](../types.rs), not in this folder:- `ModuleRecord`: `id`, `description`, `bus_name`, `object_path`, `version`,`release_url`, a `&'static [PlatformAsset]` list of per-host artifacts, and@@ -49,20 +49,20 @@ digest in this folder is this host's half of that agreement: pinning it insource is what makes the check auditable by reading this file against therelease page. A digest recomputed from a local build would agree with itselfno matter what a release actually served, which is why the module doc comment-on `../registry.rs` says not to do that.+on [`../registry.rs`](../registry.rs) says not to do that.## How it fits`ModuleRecord::id` is the stable identifier config, RPC, and`ensure_loaded`/`ensure_language` use to name a module. `registry::find`is the lookup every load path goes through before the ABI, manifest, and-dependency admission checks in `../host.rs` run.+dependency admission checks in [`../host.rs`](../host.rs) run.## Where next- [`modules/README.md`](../README.md) for the full load path this registryfeeds into (resolution order, download, digest check, `dlopen`).-- `../types.rs` for the `ModuleRecord` / `PlatformAsset` / `LoadPolicy`+- [`../types.rs`](../types.rs) for the `ModuleRecord` / `PlatformAsset` / `LoadPolicy`definitions this folder's records are built from.-- `../host.rs` for the broker that actually resolves, downloads, verifies,+- [`../host.rs`](../host.rs) for the broker that actually resolves, downloads, verifies,and loads a record this registry returns.diff --git a/crates/openhuman-core/src/platform/README.md b/crates/openhuman-core/src/platform/README.mdindex 0fdb93a011..78b435771b 100644--- a/crates/openhuman-core/src/platform/README.md+++ b/crates/openhuman-core/src/platform/README.md@@ -38,22 +38,22 @@ startup, and two are driven by events rather than calls. In boot order:The event-driven pieces:-- `health` keeps an in-memory component registry. Its subscriber listens to+- [`health`](./health) keeps an in-memory component registry. Its subscriber listens to`system` and `channel` domain events and marks components ok or in error.`GET /health` on the RPC server reads the verdict: 503 only when a criticalcomponent (`core`) is unhealthy, 200 with a `degraded` flag otherwise.-- `service` turns a restart or shutdown request into+- [`service`](./service) turns a restart or shutdown request into`DomainEvent::SystemRestartRequested` or `SystemShutdownRequested`. Itssubscribers respawn the process or exit after a short flush window.- `update` uses the same restart path after staging a new binary.-- `socket` goes the other way. It is the core's own Socket.IO client to the+ [`update`](./update) uses the same restart path after staging a new binary.+- [`socket`](./socket) goes the other way. It is the core's own Socket.IO client to thehosted backend, and it republishes inbound server events onto the bus(`WebhookIncomingRequest`, `ComposioTriggerReceived`,`ChannelInboundMessage`, device tunnel events) for other domains to handle.Some members read state other domains own instead of keeping their own.-`doctor` reads the daemon state file `service` writes and the memory engine-status from `memory`. `connectivity` reads the `SocketManager` state to tell+[`doctor`](./doctor) reads the daemon state file `service` writes and the memory engine+status from `memory`. [`connectivity`](./connectivity) reads the `SocketManager` state to tellthe frontend which of its connection channels is broken.## Layout@@ -75,16 +75,16 @@ the frontend which of its connection channels is broken.There is no type shared across the family. The ones contributors touch most:-- `HealthSnapshot`, `mark_component_ok`, `mark_component_error` (`health/`)+- `HealthSnapshot`, `mark_component_ok`, `mark_component_error` ([`health/`](./health/))for reporting component state.- `CostTracker` and `cost::init_global` / `try_global` / `rebind_global`- (`cost/global.rs`). The tracker is bound to one workspace, and signing in or+ ([`cost/global.rs`](./cost/global.rs)). The tracker is bound to one workspace, and signing in orout rebinds it so usage lands in the right user's ledger.-- `DoctorReport` (`doctor/core/types.rs`).-- `SocketManager` and `token_provider_from_config` (`socket/`).-- `pick_listen_port_for_host` and its variants (`connectivity/`), used by the+- `DoctorReport` ([`doctor/core/types.rs`](./doctor/core/types.rs)).+- `SocketManager` and `token_provider_from_config` ([`socket/`](./socket/)).+- `pick_listen_port_for_host` and its variants ([`connectivity/`](./connectivity/)), used by theRPC host when binding.-- `ServiceStatus` and the restart and shutdown publishers (`service/`).+- `ServiceStatus` and the restart and shutdown publishers ([`service/`](./service/)).## RPC / CLI surface@@ -92,14 +92,14 @@ Method names are `openhuman.<namespace>_<function>`.| Namespace | Functions || --- | --- |-| `about_app` | `list`, `lookup`, `search` |+| [`about_app`](./about_app) | `list`, `lookup`, `search` || `connectivity` | `diag` |-| `cost` | `get_dashboard`, `get_daily_history`, `get_summary`, `get_usage_log` |-| `doctor` | `report`, `models` |+| [`cost`](./cost) | `get_dashboard`, `get_daily_history`, `get_summary`, `get_usage_log` |+| [`doctor`](./doctor) | `report`, `models` || `health` | `snapshot`, `system_info` || `service` | `install`, `start`, `stop`, `status`, `uninstall`, `restart`, `shutdown`, `daemon_host_get`, `daemon_host_set` || `socket` | `connect`, `connect_with_session`, `disconnect`, `emit`, `state` |-| `update` | `version`, `check`, `apply`, `run` |+| [`update`](./update) | `version`, `check`, `apply`, `run` |Agent tools from this family (registered in `tools/ops.rs`):`health_snapshot`, `health_system_info`, `doctor_health`, `doctor_models`,diff --git a/crates/openhuman-core/src/platform/about_app/README.md b/crates/openhuman-core/src/platform/about_app/README.mdindex ded4898ba7..03c8efd74e 100644--- a/crates/openhuman-core/src/platform/about_app/README.md+++ b/crates/openhuman-core/src/platform/about_app/README.md@@ -4,7 +4,7 @@ The single source of truth for the OpenHuman desktop app's **user-facing capabil## Responsibilities-- Define the canonical, hard-coded list of user-facing capabilities (`CAPABILITIES` in `catalog.rs`).+- Define the canonical, hard-coded list of user-facing capabilities (`CAPABILITIES` in [`catalog.rs`](./catalog.rs)).- Classify each capability by `CapabilityCategory` (conversation, intelligence, workflows, local_ai, team, settings, auth, channels, automation, mobile) and `CapabilityStatus`.- Attach optional `CapabilityPrivacy` disclosures (`leaves_device`, `data_kind`, `destinations`) so the in-app Privacy surface can render "what leaves my computer".- Provide read APIs: list all (optionally filtered by category), look up one by stable id, keyword search across id/name/domain/category/description/how_to/status.@@ -17,15 +17,15 @@ The single source of truth for the OpenHuman desktop app's **user-facing capabil| --- | --- || `crates/openhuman-core/src/platform/about_app/mod.rs` | Export-only module root + docstring. Re-exports catalog reads, ops entry points, schema registry hooks, and types. || `crates/openhuman-core/src/platform/about_app/types.rs` | Serde domain types: `Capability`, `CapabilityCategory` (with `as_str` / `FromStr` incl. aliases), `CapabilityStatus`, `CapabilityPrivacy`, `PrivacyDataKind`. Inline serde/roundtrip tests. |-| `crates/openhuman-core/src/platform/about_app/catalog.rs` | Read API over the `CAPABILITIES` data it includes from `catalog_data.rs`. Implements `all_capabilities`, `capabilities_by_category`, `lookup`, `search`, and the `ensure_validated` integrity check. |-| `crates/openhuman-core/src/platform/about_app/ops.rs` | RPC-facing logic returning `Outcome<T>`: `list_capabilities`, `lookup_capability`, `search_capabilities`. Thin wrappers over `catalog.rs` with summary logs. |+| `crates/openhuman-core/src/platform/about_app/catalog.rs` | Read API over the `CAPABILITIES` data it includes from [`catalog_data.rs`](./catalog_data.rs). Implements `all_capabilities`, `capabilities_by_category`, `lookup`, `search`, and the `ensure_validated` integrity check. |+| `crates/openhuman-core/src/platform/about_app/ops.rs` | RPC-facing logic returning `Outcome<T>`: `list_capabilities`, `lookup_capability`, `search_capabilities`. Thin wrappers over [`catalog.rs`](./catalog.rs) with summary logs. || `crates/openhuman-core/src/platform/about_app/schemas.rs` | Controller schemas + `handle_*` async handlers for the three RPC methods; param structs; the `all_about_app_controller_schemas` / `all_about_app_registered_controllers` registry pair. |-| `crates/openhuman-core/src/platform/about_app/catalog_data.rs` | The `CAPABILITIES` data itself (`LazyLock<Vec<Capability>>`) plus the shared `CapabilityPrivacy` constants, concatenated from the `catalog_conversation_intelligence.rs`, `catalog_workflows_automation.rs`, `catalog_auth_channels_team.rs`, and `catalog_localai_settings_mobile.rs` submodules. |+| `crates/openhuman-core/src/platform/about_app/catalog_data.rs` | The `CAPABILITIES` data itself (`LazyLock<Vec<Capability>>`) plus the shared `CapabilityPrivacy` constants, concatenated from the [`catalog_conversation_intelligence.rs`](./catalog_conversation_intelligence.rs), [`catalog_workflows_automation.rs`](./catalog_workflows_automation.rs), [`catalog_auth_channels_team.rs`](./catalog_auth_channels_team.rs), and [`catalog_localai_settings_mobile.rs`](./catalog_localai_settings_mobile.rs) submodules. || `crates/openhuman-core/src/platform/about_app/catalog_tests.rs` | Sibling test module (`#[path]`-included by `catalog.rs`) covering catalog behavior. |## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- **Catalog reads** (`catalog`): `all_capabilities()`, `capabilities_by_category(CapabilityCategory)`, `lookup(&str)`, `search(&str)`.- **Ops** (`ops`): `list_capabilities(Option<CapabilityCategory>) -> Outcome<Vec<Capability>>`, `lookup_capability(&str) -> Result<Outcome<Capability>, String>`, `search_capabilities(&str) -> Outcome<Vec<Capability>>`.@@ -71,7 +71,7 @@ No dependencies on other `openhuman` domains: capability metadata for other doma## Notes / gotchas-- **`privacy: None` means "unknown", not "safe"** (per `types.rs` doc). UI must not treat an unannotated capability as local-only.+- **`privacy: None` means "unknown", not "safe"** (per [`types.rs`](./types.rs) doc). UI must not treat an unannotated capability as local-only.- Adding/renaming/removing a user-facing feature requires editing `CAPABILITIES`: this is the capability catalog that CLAUDE.md's "Capability catalog" rule points at. Keep ids stable; duplicate or empty ids panic at first catalog access via `ensure_validated`.- Privacy constants encode real third-party destinations (Hugging Face, GitHub Releases, Composio `backend.composio.dev`, SearXNG, configured embedding providers, ElevenLabs, etc.): the inline comments document why several were corrected away from the generic `DERIVED_TO_BACKEND` / `LOCAL_CREDENTIALS` defaults; mirror that diligence when adding network-touching capabilities.- `Capability` fields are all `&'static str` / copy types, so `Capability` is `Copy` and the read APIs cheaply return owned `Vec`s by copying.diff --git a/crates/openhuman-core/src/platform/connectivity/README.md b/crates/openhuman-core/src/platform/connectivity/README.mdindex 9d96b44c54..c805759db0 100644--- a/crates/openhuman-core/src/platform/connectivity/README.md+++ b/crates/openhuman-core/src/platform/connectivity/README.md@@ -22,7 +22,7 @@ Diagnostics for the local core's reachability and the live backend Socket.IO sta## Public surface-- `connectivity::all_connectivity_controller_schemas()` / `all_connectivity_registered_controllers()`: registry entry points (re-exported from `schemas.rs`).+- `connectivity::all_connectivity_controller_schemas()` / `all_connectivity_registered_controllers()`: registry entry points (re-exported from [`schemas.rs`](./schemas.rs)).- `connectivity::ops::is_port_in_use(port: u16) -> bool`.- `connectivity::rpc::ConnectivityDiagResponse`: serialized diag payload (`socket_state`, `last_ws_error`, `socket_loop_active`, `socket_loop_stopped_on_failure`, `sidecar_pid`, `listen_port`, `listen_port_in_use`). The two booleans are the core's own statement of whether its backend reconnect loop is running and, if not, whether it stopped on a terminal failure (no usable session token); the frontend's connectivity chip keys "no link wanted" vs "down, retrying" vs "stopped, sign in again" off them rather than inferring liveness from `socket_state` (#6256, #6270).- `connectivity::rpc::snapshot() -> ConnectivityDiagResponse` and `connectivity::rpc::diag() -> Result<Outcome<Value>, String>`.diff --git a/crates/openhuman-core/src/platform/cost/README.md b/crates/openhuman-core/src/platform/cost/README.mdindex 763804a90f..9f6a272777 100644--- a/crates/openhuman-core/src/platform/cost/README.md+++ b/crates/openhuman-core/src/platform/cost/README.md@@ -22,14 +22,14 @@ Local API-usage cost tracking for the agent. Records per-call token usage and co| `crates/openhuman-core/src/platform/cost/global.rs` | Process-global `OnceCell<Arc<CostTracker>>` singleton: `init_global`, `try_global`, `record_provider_usage`, and `build_token_usage` (provider `UsageInfo` → `TokenUsage`). || `crates/openhuman-core/src/platform/cost/rpc.rs` | RPC-facing handlers (`dashboard`, `daily_history`, `summary`) returning `Outcome<Value>`; DTO types; `resolve_tracker` with a cached fallback tracker + error-replay TTL. || `crates/openhuman-core/src/platform/cost/schemas.rs` | Controller schemas + `handle_*` JSON-RPC dispatchers; `all_controller_schemas` / `all_registered_controllers`. |-| `crates/openhuman-core/src/platform/cost/tracker_tests.rs` | Sibling test suite for `tracker.rs` (`#[path]`-included). |+| `crates/openhuman-core/src/platform/cost/tracker_tests.rs` | Sibling test suite for [`tracker.rs`](./tracker.rs) (`#[path]`-included). || `crates/openhuman-core/src/platform/cost/catalog.rs` | Static per-model pricing + context-window catalog (`ModelPrice`, `lookup`, `estimate_cost_usd`, `PRICING_AS_OF`) and the tinyagents model-catalog adapters. || `crates/openhuman-core/src/platform/cost/route.rs` | `CostRoute` / `route_for_model`: derives from the model id whether a record counts against OpenHuman-managed credits or is BYOK/local (#5016). || `crates/openhuman-core/src/platform/cost/tools.rs` | Read-only, default-on LLM tools (`cost_get_dashboard`, `cost_get_daily_history`, …) re-exported through `crates/openhuman-core/src/tools/mod.rs`. |## Public surface-From `mod.rs` re-exports:+From [`mod.rs`](./mod.rs) re-exports:- `CostTracker`: the tracker (`tracker`).- `init_global`, `rebind_global`, `try_global`, `record_provider_usage` (`global`).@@ -49,7 +49,7 @@ Namespace `cost` (methods `openhuman.cost_*` via the registry):| `cost_get_summary` | none | Live session / daily / monthly cost summary. || `cost_get_usage_log` | `days?`, `limit?` | Recent local records, newest first, bounded to 1,000 rows. |-Handlers load config via `config_rpc::load_config_with_timeout`, then delegate to `rpc.rs`. RPC DTOs (`CostDashboardDto`, `DailyCostEntryDto`, `ModelStatsDto`, `CostSummaryDto`, `UsageLogRecordDto`) add presentation fields not on the domain types: `provider` (derived from the `provider/model` prefix), `percent_of_total`, and dashboard threshold/`enabled` flags from `cost.dashboard`. Usage-log records preserve the persisted token provenance fields (`cached_input_tokens`, `cache_creation_tokens`, `reasoning_tokens`, `cost_source`) for migration audit callers for the dedicated usage-log tab.+Handlers load config via `config_rpc::load_config_with_timeout`, then delegate to [`rpc.rs`](./rpc.rs). RPC DTOs (`CostDashboardDto`, `DailyCostEntryDto`, `ModelStatsDto`, `CostSummaryDto`, `UsageLogRecordDto`) add presentation fields not on the domain types: `provider` (derived from the `provider/model` prefix), `percent_of_total`, and dashboard threshold/`enabled` flags from `cost.dashboard`. Usage-log records preserve the persisted token provenance fields (`cached_input_tokens`, `cache_creation_tokens`, `reasoning_tokens`, `cost_source`) for migration audit callers for the dedicated usage-log tab.## Events@@ -65,7 +65,7 @@ None. The module has no `bus.rs` and no `DomainEvent` publishers/subscribers.## Dependencies- `crate::config`: `CostConfig` / `Config` (legacy display target, dashboard currency/enabled, `workspace_dir`); `config::rpc::load_config_with_timeout` in schemas.-- `crate::inference::provider::types::UsageInfo` (re-exported as `crate::inference::provider::UsageInfo`): provider usage payload translated into `TokenUsage` in `global.rs`.+- `crate::inference::provider::types::UsageInfo` (re-exported as `crate::inference::provider::UsageInfo`): provider usage payload translated into `TokenUsage` in [`global.rs`](./global.rs).- `crate::core::all`: `ControllerFuture`, `RegisteredController` for controller registration.- `crate::core`: `ControllerSchema`, `FieldSchema`, `TypeSchema`.- `crate::core::Outcome`: RPC return wrapper.diff --git a/crates/openhuman-core/src/platform/doctor/README.md b/crates/openhuman-core/src/platform/doctor/README.mdindex fe8caa7b7b..b403d1248c 100644--- a/crates/openhuman-core/src/platform/doctor/README.md+++ b/crates/openhuman-core/src/platform/doctor/README.md@@ -17,15 +17,15 @@ Diagnostic / self-check domain for OpenHuman. Runs a synchronous battery of prob| File | Role || --- | --- |-| `crates/openhuman-core/src/platform/doctor/mod.rs` | Module docstring + exports. Declares `core`, `ops`, `schemas`; re-exports `core::*`, `ops::*` (also aliased `pub use ops as rpc`), and the schema controller pair. |+| `crates/openhuman-core/src/platform/doctor/mod.rs` | Module docstring + exports. Declares [`core`](./core), `ops`, `schemas`; re-exports `core::*`, `ops::*` (also aliased `pub use ops as rpc`), and the schema controller pair. || `crates/openhuman-core/src/platform/doctor/core.rs` | All diagnostic logic + types. `run()` entry point and every `check_*` probe; `run_models()`; severity helpers; OS-specific disk/command helpers. || `crates/openhuman-core/src/platform/doctor/ops.rs` | Async JSON-RPC/CLI controller surface (`doctor_report`, `doctor_models`) wrapping the sync `core` logic in `spawn_blocking` and returning `Outcome<T>`. || `crates/openhuman-core/src/platform/doctor/schemas.rs` | Controller schemas + registry (`all_controller_schemas`, `all_registered_controllers`, `handle_report`/`handle_models`). |-| `crates/openhuman-core/src/platform/doctor/core_tests.rs` | Test suite for `core.rs` (via `#[path = "core_tests.rs"] mod tests`). |+| `crates/openhuman-core/src/platform/doctor/core_tests.rs` | Test suite for [`core.rs`](./core.rs) (via `#[path = "core_tests.rs"] mod tests`). |## Public surface-From `mod.rs` re-exports (`core::*`):+From [`mod.rs`](./mod.rs) re-exports (`core::*`):- Types: `Severity` (`Ok`/`Warn`/`Error`), `DiagnosticItem`, `DoctorSummary`, `DoctorReport`, `ModelProbeOutcome`, `ModelProbeEntry`, `ModelProbeSummary`, `ModelProbeReport`.- Functions: `run(&Config, MemoryChunkCount) -> Result<DoctorReport>` (blocking-only: keep no `.await` inside; async probes are resolved by the caller and passed in), `run_models(&Config, use_cache) -> Result<ModelProbeReport>`.@@ -51,7 +51,7 @@ Both handlers load config via `config_rpc::load_config_with_timeout()` and retur## Agent tools-None. This domain owns no agent tools (no `tools.rs`).+None. This domain owns no agent tools (no [`tools.rs`](./tools.rs)).## Events@@ -80,7 +80,7 @@ None of its own (no `store.rs`). It only **reads** existing state owned by other## Notes / gotchas- `run()` is **strictly blocking** by contract (file system, sqlite, blocking HTTP). `reqwest::blocking::Client` panics inside a tokio runtime, so `ops::doctor_report` runs the whole thing in `tokio::task::spawn_blocking`. Do not add `.await` inside `core::run`.-- An async probe therefore arrives as an **argument**, resolved in `ops` before the blocking hop: `MemoryEngineCheck` is the first of them. Do not reach for `Handle::block_on` inside `core`: it panics on a current-thread runtime and deadlocks the multi-thread one whose worker it is already occupying.+- An async probe therefore arrives as an **argument**, resolved in `ops` before the blocking hop: `MemoryEngineCheck` is the first of them. Do not reach for `Handle::block_on` inside [`core`](./core): it panics on a current-thread runtime and deadlocks the multi-thread one whose worker it is already occupying.- An engine that is down is reported as an error and memory being off as a warning, so the doctor names what is wrong instead of showing an empty store.- `run_models` / `doctor.models` is effectively a **stub**: it enumerates providers from `inference::provider::list_providers` but marks every entry `Skipped` with message "model catalog refresh removed" (catalog refresh was removed). It never actually probes auth/availability despite the schema description.- The embedding probe is capped at a 3s timeout to avoid stalling on a slow Ollama daemon; non-ollama providers short-circuit to OK.diff --git a/crates/openhuman-core/src/platform/health/README.md b/crates/openhuman-core/src/platform/health/README.mdindex bdf37e109b..40021cf3b7 100644--- a/crates/openhuman-core/src/platform/health/README.md+++ b/crates/openhuman-core/src/platform/health/README.md@@ -24,18 +24,18 @@ In-process health registry for the OpenHuman core. Tracks per-component liveness## Public surface-From `core.rs` (re-exported via `pub use core::*`):+From [`core.rs`](./core.rs) (re-exported via `pub use core::*`):- Types: `ComponentHealth`, `HealthSnapshot`, `HealthVerdict`.- Functions: `mark_component_ok(component)`, `mark_component_error(component, error)`, `bump_component_restart(component)`, `snapshot() -> HealthSnapshot`, `snapshot_json() -> serde_json::Value`, `verdict(&HealthSnapshot) -> HealthVerdict`, `is_critical_component(name) -> bool`.The HTTP `GET /health` handler (`openhuman_rpc::server::http::health::health_handler`) uses `verdict()` for its status code (200 unless a critical component is unhealthy) and adds `healthy` / `degraded` / `critical_unhealthy` / `degraded_components` fields alongside the `components` map in the body. The `components` map shape is unchanged: the new fields are additive.-From `ops.rs` (re-exported via `pub use ops::*`, also aliased `pub use ops as rpc`):+From [`ops.rs`](./ops.rs) (re-exported via `pub use ops::*`, also aliased `pub use ops as rpc`):- `health_snapshot() -> Outcome<serde_json::Value>`, `system_info() -> Outcome<SystemInfo>`, and the `SystemInfo` struct.-From `bus.rs`: `HealthSubscriber`, `register_health_subscriber()`.+From [`bus.rs`](./bus.rs): `HealthSubscriber`, `register_health_subscriber()`.-From `schemas.rs` (re-exported under aliased names): `all_health_controller_schemas`, `all_health_registered_controllers`.+From [`schemas.rs`](./schemas.rs) (re-exported under aliased names): `all_health_controller_schemas`, `all_health_registered_controllers`.## RPC / controllers@@ -87,4 +87,4 @@ None on disk. State lives in a process-global `OnceLock<HealthRegistry>` (lazy-i- `mark_component_ok` clears `last_error`; `mark_component_error` leaves `last_ok` intact (so the last-known-good time survives a failure).- `restart_count` uses `saturating_add` (won't overflow).- The `system_info` schema declares `pid` as `TypeSchema::U64`, matching `SystemInfo.pid: u32`, which serializes as a JSON number. It declared `TypeSchema::String` until #6074; the wire value has always been a number, so that fix moved only the declaration: and with it the generated frontend types and the model-facing tool `output_schema`.-- `bus.rs` short-circuits double registration via a `OnceLock` and warns (does not panic) if the bus isn't initialized.+- [`bus.rs`](./bus.rs) short-circuits double registration via a `OnceLock` and warns (does not panic) if the bus isn't initialized.diff --git a/crates/openhuman-core/src/platform/proc_metrics/README.md b/crates/openhuman-core/src/platform/proc_metrics/README.mdindex 027c26d0ee..d94851de48 100644--- a/crates/openhuman-core/src/platform/proc_metrics/README.md+++ b/crates/openhuman-core/src/platform/proc_metrics/README.md@@ -8,7 +8,7 @@ figures.| File | Role || --- | --- |-| `crates/openhuman-core/src/platform/proc_metrics/mod.rs` | `ProcSample`, `sample_self`, `/proc` parsers, and roster/report aggregation. |+| `crates/openhuman-core/src/platform/proc_metrics/mod.rs` | `ProcSample`, `sample_self`, [`/proc`](.//proc) parsers, and roster/report aggregation. || `crates/openhuman-core/src/platform/proc_metrics/tree.rs` | `sample_tree`, `ChildSample`, `TreeSample`: process-*tree* RSS including descendants. |## `ProcSample`@@ -19,11 +19,11 @@ RSS), `threads`, `binary_size_bytes`, `cpu_user_ms` / `cpu_system_ms`, and`open_fds` (`None` when the platform lookup is unavailable, never amisleading zero).-`sample_self` supports Linux (`/proc/self/status` + `/proc/self/smaps_rollup`-+ `/proc/self/stat`) and macOS (`proc_pidinfo` / `proc_pid_rusage`); it+`sample_self` supports Linux ([`/proc/self/status`](.//proc/self/status) + [`/proc/self/smaps_rollup`](.//proc/self/smaps_rollup)++ [`/proc/self/stat`](.//proc/self/stat)) and macOS (`proc_pidinfo` / `proc_pid_rusage`); itreturns a structured `anyhow::Result` error elsewhere rather than fabricatinga reading. `parse_status` and `parse_smaps_rollup` are OS-agnostic, take-`&str`, and are unit-tested against literal `/proc` text without a live+`&str`, and are unit-tested against literal [`/proc`](.//proc) text without a livefilesystem.## Aggregation@@ -39,7 +39,7 @@ budget and CI-gate ceiling for the embedded agent roster (#5046).## Process trees-`sample_tree` (in `tree.rs`) measures a process and all of its descendants,+`sample_tree` (in [`tree.rs`](./tree.rs)) measures a process and all of its descendants,the interpreter children a skill run or shell tool spawns, returning a`TreeSample` (`self_sample`, `children: Vec<ChildSample>`, `tree_rss_kib`).Descendant lookups that fail (a child that raced away, a permission error)diff --git a/crates/openhuman-core/src/platform/service/README.md b/crates/openhuman-core/src/platform/service/README.mdindex 0f17ee7ca9..f305fd1638 100644--- a/crates/openhuman-core/src/platform/service/README.md+++ b/crates/openhuman-core/src/platform/service/README.md@@ -30,12 +30,12 @@ Service-management domain for the OpenHuman core daemon. It installs/uninstalls| `crates/openhuman-core/src/platform/service/daemon.rs` | `state_file_path(config)` → `<config_dir>/daemon_state.json`, used by doctor/health. || `crates/openhuman-core/src/platform/service/daemon_host.rs` | `DaemonHostConfig { show_tray }` + async `load_for_config_dir` / `save_for_config_dir` (JSON next to config, `daemon_host_config.json`). || `crates/openhuman-core/src/platform/service/mock.rs` | File-backed deterministic mock backend gated on `OPENHUMAN_SERVICE_MOCK`; supports forced failures and an `agent_running` flag (`mock_agent_running`). |-| `crates/openhuman-core/src/platform/service/mock_tests.rs` | Sibling test suite for `mock.rs`. |+| `crates/openhuman-core/src/platform/service/mock_tests.rs` | Sibling test suite for [`mock.rs`](./mock.rs). || `crates/openhuman-core/src/platform/service/tools.rs` | LLM-callable wrappers over the domain (`service_status` / `daemon_host_prefs_get` default-on; lifecycle mutators default-off via the `service_lifecycle` user-filter toggle). |## Public surface-From `mod.rs` re-exports:+From [`mod.rs`](./mod.rs) re-exports:- `core::*`: `ServiceState`, `ServiceStatus`, and the dispatchers `install` / `start` / `stop` / `status` / `uninstall`.- `ops::*` (also aliased `rpc`): the async RPC handlers `service_install` … `service_uninstall`, `service_restart`, `service_shutdown`, `daemon_host_get`, `daemon_host_set`.@@ -64,12 +64,12 @@ Lifecycle handlers load config via `config::rpc::load_config_with_timeout`; `res## Events-Publishes (in `restart.rs` / `shutdown.rs`) to the global event bus, domain `system`:+Publishes (in [`restart.rs`](./restart.rs) / [`shutdown.rs`](./shutdown.rs)) to the global event bus, domain `system`:- `DomainEvent::SystemRestartRequested { source, reason }`- `DomainEvent::SystemShutdownRequested { source, reason }`-Subscribes (in `bus.rs`):+Subscribes (in [`bus.rs`](./bus.rs)):- `RestartSubscriber` (`name = "service::restart"`): on `SystemRestartRequested`, atomically claims a one-shot gate, calls `trigger_self_restart_now` to spawn a replacement process, then `process::exit(0)` after 150ms.- `ShutdownSubscriber` (`name = "service::shutdown"`): on `SystemShutdownRequested`, claims its gate and `process::exit(0)` after 150ms (no respawn).@@ -78,7 +78,7 @@ Both subscribers are registered idempotently from `crates/openhuman-core/src/cor## Persistence-- Daemon-host prefs: `daemon_host_config.json` next to the main config (`DaemonHostConfig { show_tray }`, default `true`); read/written async by `daemon_host.rs`.+- Daemon-host prefs: `daemon_host_config.json` next to the main config (`DaemonHostConfig { show_tray }`, default `true`); read/written async by [`daemon_host.rs`](./daemon_host.rs).- Daemon state path: `daemon_state.json` next to config (`daemon::state_file_path`), consumed by doctor/health (not written here).- Service unit files: written by the per-OS impls (macOS plist in `~/Library/LaunchAgents`, Linux systemd user unit, Windows scheduled task).- Mock state: `service-mock-state.json` (overridable via `OPENHUMAN_SERVICE_MOCK_STATE_FILE`) tracking `installed`/`running`/`agent_running`/forced `failures`, only when the mock is enabled.@@ -103,7 +103,7 @@ Both subscribers are registered idempotently from `crates/openhuman-core/src/cor## Notes / gotchas- Restart/shutdown are **two-phase**: the RPC/CLI call only acknowledges and publishes an event; the actual respawn/exit happens in the subscriber, so RPC, CLI, and internal triggers share one path with consistent logging. The subscriber must be registered or requests are no-ops.-- One-shot atomic gates exist in **both** `bus.rs` and `restart.rs` (`RESTART_IN_PROGRESS`): duplicate restart events are ignored; a failed `trigger_self_restart_now` resets the gate to allow a retry.+- One-shot atomic gates exist in **both** [`bus.rs`](./bus.rs) and [`restart.rs`](./restart.rs) (`RESTART_IN_PROGRESS`): duplicate restart events are ignored; a failed `trigger_self_restart_now` resets the gate to allow a retry.- `trigger_self_restart_now` respawns the current exe with the **original argv** (preserving launch mode) and sets `OPENHUMAN_RESTART_DELAY_MS` (default 350) on the child; the child honors it at startup via `apply_startup_restart_delay_from_env` to dodge HTTP-port bind races while the old process releases sockets.- Self-restart fails if launched with no args (`std::env::args().skip(1)` empty).- Platform support is compile-gated; on unsupported targets the dispatchers `bail!` with "supported on macOS, Linux, and Windows only".diff --git a/crates/openhuman-core/src/platform/socket/README.md b/crates/openhuman-core/src/platform/socket/README.mdindex 2e8673a38a..ebaa491f3c 100644--- a/crates/openhuman-core/src/platform/socket/README.md+++ b/crates/openhuman-core/src/platform/socket/README.md@@ -18,13 +18,13 @@ Persistent, Rust-native Socket.IO client to the OpenHuman backend. The `socket`| File | Role || --- | --- || `crates/openhuman-core/src/platform/socket/mod.rs` | Module docstring + exports only. Re-exports `SocketManager`, `global_socket_manager`, `set_global_socket_manager`, and the `all_socket_controller_schemas` / `all_socket_registered_controllers` pair. |-| `crates/openhuman-core/src/platform/socket/manager.rs` | `SocketManager` handle + `SharedState`; global `OnceLock` accessor; `connect` / `connect_with_provider` / `disconnect` / `emit` / `emit_with_ack` / `get_state`; spawns the background `ws_loop`. Holds emit/shutdown channels, ACK waiters, and the loop join handle. |+| `crates/openhuman-core/src/platform/socket/manager.rs` | `SocketManager` handle + `SharedState`; global `OnceLock` accessor; `connect` / `connect_with_provider` / `disconnect` / `emit` / `emit_with_ack` / `get_state`; spawns the background [`ws_loop`](./ws_loop). Holds emit/shutdown channels, ACK waiters, and the loop join handle. || `crates/openhuman-core/src/platform/socket/ws_loop.rs` | The background reconnection loop and a single connection attempt: Engine.IO/Socket.IO handshake, Socket.IO ACK packet dispatch, redirect-following connect, ping-timeout deadline, backoff, invalid-token decision logic, failure-escalation logging. || `crates/openhuman-core/src/platform/socket/event_handlers.rs` | Inbound SIO event dispatch (`handle_sio_event`), SIO frame parsing (`parse_sio_event`), outbound frame helper (`emit_via_channel`). Maps event names → `DomainEvent` publishes. Redacts payload content from logs. || `crates/openhuman-core/src/platform/socket/token_provider.rs` | `TokenProvider` type alias + `static_token_provider`, `token_provider_from_config`, and `is_invalid_token_error` (strict double-anchor matcher). || `crates/openhuman-core/src/platform/socket/schemas.rs` | Controller schemas + RPC handlers for the `socket` namespace. || `crates/openhuman-core/src/platform/socket/types.rs` | `WsStream` alias, `ConnectionOutcome` enum, observability event-name constants; re-exports `ConnectionStatus` / `SocketState` from `crate::platform::socket::models`. |-| `crates/openhuman-core/src/platform/socket/ops.rs` | RPC operations behind `schemas.rs` (`connect_with_session` and live-socket reuse). |+| `crates/openhuman-core/src/platform/socket/ops.rs` | RPC operations behind [`schemas.rs`](./schemas.rs) (`connect_with_session` and live-socket reuse). || `crates/openhuman-core/src/platform/socket/*_tests.rs` | Sibling test suites, included via `#[path]`. |## Public surface@@ -33,7 +33,7 @@ Persistent, Rust-native Socket.IO client to the OpenHuman backend. The `socket`- `global_socket_manager() -> Option<&'static Arc<SocketManager>>` and `set_global_socket_manager(Arc<SocketManager>)`: the process-global singleton (set once at bootstrap).- `all_socket_controller_schemas` / `all_socket_registered_controllers`: controller-registry exports wired into `crates/openhuman-core/src/core/all.rs`.-Internal-only (`pub(crate)` / `pub(super)`): `TokenProvider` and its builders, `SharedState`, `ConnectionOutcome`, `WsStream`, the `ws_loop` and event-handler helpers.+Internal-only (`pub(crate)` / `pub(super)`): `TokenProvider` and its builders, `SharedState`, `ConnectionOutcome`, `WsStream`, the [`ws_loop`](./ws_loop) and event-handler helpers.## RPC / controllers@@ -93,7 +93,7 @@ None of its own. State (`status`, `socket_id`, `error`, attached `WebhookRouter`## Notes / gotchas-- Event-name constants in `types.rs` (`runtime:socket-state-changed`, `server:event`) are grep-anchored: the frontend subscribes to those exact strings; a rename silently breaks the Tauri event bridge (locked by a test).+- Event-name constants in [`types.rs`](./types.rs) (`runtime:socket-state-changed`, `server:event`) are grep-anchored: the frontend subscribes to those exact strings; a rename silently breaks the Tauri event bridge (locked by a test).- **Payload content is never logged** at any level: webhook bodies / channel messages / Composio payloads can carry PII, secrets, or tokens. Only byte-length and structural shape are logged. This also dodged a UTF-8 char-boundary panic that used to slice raw payloads at byte 500 (OPENHUMAN-TAURI-KC / #1814).- `connect` rejects an empty/whitespace token immediately rather than spawning a doomed retry loop; `connect_with_provider` does the same eager pre-check via the provider.- The reconnect loop bounds "fresh-token immediate retry" to **one** per cycle so a provider that returns a different non-empty token every call cannot hot-loop without sleeping or escalating (CodeRabbit Major, #2905).diff --git a/crates/openhuman-core/src/platform/update/README.md b/crates/openhuman-core/src/platform/update/README.mdindex d80903638f..00fc200533 100644--- a/crates/openhuman-core/src/platform/update/README.md+++ b/crates/openhuman-core/src/platform/update/README.md@@ -23,8 +23,8 @@ Self-update domain for the `openhuman-core` binary. Checks GitHub Releases (`tin| `crates/openhuman-core/src/platform/update/*_tests.rs` | Sibling test suites (`core_tests`, `ops_tests`, `ops_tests_2_tests`, `scheduler_tests`, `schemas_tests`), included via `#[path]`. |## Public surface-- Types (`types.rs`): `UpdateInfo`, `VersionInfo`, `UpdateRunResult`, `UpdateApplyResult`, `GitHubRelease`, `GitHubAsset`.-- Core fns (`core.rs`, re-exported via `core::*`): `current_version() -> &'static str`, `platform_triple() -> &'static str`, `check_available() -> Result<UpdateInfo, String>`, `download_and_stage(...)`, `download_and_stage_with_version(...)`.+- Types ([`types.rs`](./types.rs)): `UpdateInfo`, `VersionInfo`, `UpdateRunResult`, `UpdateApplyResult`, `GitHubRelease`, `GitHubAsset`.+- Core fns ([`core.rs`](./core.rs), re-exported via `core::*`): `current_version() -> &'static str`, `platform_triple() -> &'static str`, `check_available() -> Result<UpdateInfo, String>`, `download_and_stage(...)`, `download_and_stage_with_version(...)`.- `update::rpc` (alias of `ops`): `update_version`, `update_check`, `update_apply`, `update_run`: all returning `Outcome<Value>`.- `update::scheduler::run(UpdateConfig)`: background loop entry point.- `all_update_controller_schemas()` / `all_update_registered_controllers()`.diff --git a/crates/openhuman-core/src/runtime/README.md b/crates/openhuman-core/src/runtime/README.mdindex 7e6a4868aa..ee97ef4984 100644--- a/crates/openhuman-core/src/runtime/README.md+++ b/crates/openhuman-core/src/runtime/README.md@@ -86,31 +86,31 @@ process lifecycle and the JSONL protocol are `tinyruntime_pyserver`.| --- | --- || [`client/`](client/README.md) | The single import point for `modules::runtime` (`execute`, `resolve`, `RuntimeCallError`). With the `modules` feature off it re-exports `disabled.rs`, which answers every call with `RuntimeCallError::Unavailable`. || [`node/`](node/README.md) | `NodeBootstrap`, the Node toolchain client (behind `runtime-node`), plus the ungated native-tool bridge (`ops.rs`, `types.rs`) and the `javascript.*` controllers (`schemas.rs`, `rpc.rs`). `stub.rs` carries the `NodeBootstrap` type surface when `runtime-node` is off. |-| [`javascript/`](javascript/README.md) | A re-export facade over `node` so callers import a language slot (`crate::runtime::javascript`) instead of a backend. No logic. |+| [`javascript/`](javascript/README.md) | A re-export facade over [`node`](./node) so callers import a language slot (`crate::runtime::javascript`) instead of a backend. No logic. || [`python/`](python/README.md) | `PythonBootstrap`, the Python interpreter client. || [`python_server/`](python_server/README.md) | Host side of the persistent Python worker: `ensure_started`, `status`, the backend registry and Kompress provisioning (`ensure_kompress`, `request_kompress`). || [`pool/`](pool/README.md) | Pooled inline execution (`run_inline` per language), the per-language enable decision, and `PoolRunError` classification. |## Key types and entry points-- `NodeBootstrap`, `ResolvedNode`, `NodeSource` (`node/bootstrap.rs`) are the+- `NodeBootstrap`, `ResolvedNode`, `NodeSource` ([`node/bootstrap.rs`](./node/bootstrap.rs)) are theNode toolchain client and its answer. `ShellTool` holds an`Option<Arc<NodeBootstrap>>`.-- `PythonBootstrap`, `ResolvedPython`, `PythonSource` (`python/bootstrap.rs`)+- `PythonBootstrap`, `ResolvedPython`, `PythonSource` ([`python/bootstrap.rs`](./python/bootstrap.rs))are the Python equivalents.- `pool::node::run_inline`, `pool::python::run_inline`, `PoolExecOutcome`,- `PoolRunError`, `PoolSettings` (`pool/`) are what `node_exec` and+ `PoolRunError`, `PoolSettings` ([`pool/`](./pool/)) are what `node_exec` and`python_exec` call and match on.- `python_server::ensure_started`, `status`, `request_kompress`- (`python_server/`) start the worker and send it a compress request.-- `runtime::node::execute_tool` and `list_tools` (`node/ops.rs`) build the+ ([`python_server/`](./python_server/)) start the worker and send it a compress request.+- `runtime::node::execute_tool` and `list_tools` ([`node/ops.rs`](./node/ops.rs)) build thefull agent tool registry (`tools::ops::all_tools_with_runtime`) and run onetool by name, publishing `ToolExecutionStarted` and`ToolExecutionCompleted` on the bus with session id `"javascript"`.## RPC / CLI surface-With `runtime-node` on, `node/schemas.rs` registers the `javascript`+With `runtime-node` on, [`node/schemas.rs`](./node/schemas.rs) registers the [`javascript`](./javascript)namespace through `core/all.rs`:| Method | Description |@@ -131,7 +131,7 @@ namespace through `core/all.rs`:covered in [`modules/registry`](../modules/registry/README.md).- The exec tools that use these clients live in`crates/openhuman-core/src/tools/impl/system/`.-- Runtime settings (`node`, `runtime_python`, `runtime_pool`) are defined+- Runtime settings ([`node`](./node), `runtime_python`, `runtime_pool`) are definedunder `config/schema/`.## Gotchas@@ -143,8 +143,8 @@ namespace through `core/all.rs`:instead of failing to build.- `runtime-node` (default on, and in `scripts/ci/product-features.txt`) gatesthe managed Node client, the `javascript.*` controllers, `node_exec`,- `npm_exec` and the `node_runtime` harness step. `node/ops.rs` and- `node/types.rs` stay ungated because the flows `oh:` native-tool backend+ `npm_exec` and the `node_runtime` harness step. [`node/ops.rs`](./node/ops.rs) and+ [`node/types.rs`](./node/types.rs) stay ungated because the flows `oh:` native-tool backenduses them in every build.- `PoolRunError` classification reads the module's error text("pool is at capacity", "failed after dispatch"). Anything unrecognised isdiff --git a/crates/openhuman-core/src/runtime/client/README.md b/crates/openhuman-core/src/runtime/client/README.mdindex 234a6c84fe..83307b322b 100644--- a/crates/openhuman-core/src/runtime/client/README.md+++ b/crates/openhuman-core/src/runtime/client/README.md@@ -24,8 +24,8 @@ simply is not there, not like a missing symbol.| File | Role || --- | --- |-| `mod.rs` | The feature-gated re-export: `modules::runtime`'s `execute`, `pool_stats`, `resolve`, `RuntimeCallError` when `modules` is on, `disabled`'s copies when it is off. |-| `disabled.rs` | The `modules`-off stand-in. Same three-variant `RuntimeCallError` as the real client, so callers match identically in both builds; every function returns `Unavailable` with a message naming the missing feature. |+| [`mod.rs`](./mod.rs) | The feature-gated re-export: `modules::runtime`'s `execute`, `pool_stats`, `resolve`, `RuntimeCallError` when `modules` is on, `disabled`'s copies when it is off. |+| [`disabled.rs`](./disabled.rs) | The `modules`-off stand-in. Same three-variant `RuntimeCallError` as the real client, so callers match identically in both builds; every function returns `Unavailable` with a message naming the missing feature. |## Public surfacediff --git a/crates/openhuman-core/src/runtime/javascript/README.md b/crates/openhuman-core/src/runtime/javascript/README.mdindex 1d48f4106b..2bc0c798c3 100644--- a/crates/openhuman-core/src/runtime/javascript/README.md+++ b/crates/openhuman-core/src/runtime/javascript/README.md@@ -13,7 +13,7 @@ owns no logic of its own: every symbol it exposes is a `pub use`.| File | Role || --- | --- |-| `mod.rs` | Entire module (26 lines). Module docstring plus `pub use` re-exports, some gated by the `runtime-node` feature. No types, no logic, no tests. |+| [`mod.rs`](./mod.rs) | Entire module (26 lines). Module docstring plus `pub use` re-exports, some gated by the `runtime-node` feature. No types, no logic, no tests. |## Gating (`runtime-node`)diff --git a/crates/openhuman-core/src/runtime/node/README.md b/crates/openhuman-core/src/runtime/node/README.mdindex 2bf3fd22d4..4c4a78f6ee 100644--- a/crates/openhuman-core/src/runtime/node/README.md+++ b/crates/openhuman-core/src/runtime/node/README.md@@ -47,13 +47,13 @@ entirely, the first native toolchain build removed rather than merely gated.| File | Role || --- | --- |-| `mod.rs` | Export-focused: submodule decls, the `runtime-node` gate, and `pub use` re-exports including the controller registry pair. |-| `bootstrap.rs` | The toolchain client. `NodeBootstrap` (`resolve`, `probe_installed`, `try_cached`), `ResolvedNode`, `NodeSource`. Adapts a module `ResolvedRuntime`; derives `npm` when the provider does not report it. |-| `stub.rs` | Type surface for `runtime-node`-less builds. `try_cached`/`probe_installed` return `None`; `resolve` errors with a build fact. |-| `ops.rs` | Bridge logic: `build_runtime_tools`, `list_tools`, `execute_tool` (event publish + timing). |-| `rpc.rs` | RPC param structs and `*_handler` fns; loads config and delegates through the `javascript` alias. |-| `schemas.rs` | Controller schemas + registered controllers for `javascript_list_tools` / `javascript_execute_tool`. |-| `types.rs` | `RuntimeToolSummary`, `ExecuteToolOutcome` serde types. |+| [`mod.rs`](./mod.rs) | Export-focused: submodule decls, the `runtime-node` gate, and `pub use` re-exports including the controller registry pair. |+| [`bootstrap.rs`](./bootstrap.rs) | The toolchain client. `NodeBootstrap` (`resolve`, `probe_installed`, `try_cached`), `ResolvedNode`, `NodeSource`. Adapts a module `ResolvedRuntime`; derives `npm` when the provider does not report it. |+| [`stub.rs`](./stub.rs) | Type surface for `runtime-node`-less builds. `try_cached`/`probe_installed` return `None`; `resolve` errors with a build fact. |+| [`ops.rs`](./ops.rs) | Bridge logic: `build_runtime_tools`, `list_tools`, `execute_tool` (event publish + timing). |+| [`rpc.rs`](./rpc.rs) | RPC param structs and `*_handler` fns; loads config and delegates through the `javascript` alias. |+| [`schemas.rs`](./schemas.rs) | Controller schemas + registered controllers for `javascript_list_tools` / `javascript_execute_tool`. |+| [`types.rs`](./types.rs) | `RuntimeToolSummary`, `ExecuteToolOutcome` serde types. |## Public surfacediff --git a/crates/openhuman-core/src/runtime/pool/README.md b/crates/openhuman-core/src/runtime/pool/README.mdindex 0d067a9932..991982d118 100644--- a/crates/openhuman-core/src/runtime/pool/README.md+++ b/crates/openhuman-core/src/runtime/pool/README.md@@ -38,9 +38,9 @@ and post-dispatch, move a failure out of the default.| File | Role || --- | --- |-| `mod.rs` | `PoolRunError`, the shared `run_inline` dispatch, and `classify`. |-| `node.rs` / `python.rs` | Per-language `enabled()` and `run_inline()`; they differ only in which language they name. |-| `types.rs` | `PoolExecOutcome` (with `queue_wait` kept apart from `elapsed`), `PoolLang`, `PoolSettings`. |+| [`mod.rs`](./mod.rs) | `PoolRunError`, the shared `run_inline` dispatch, and `classify`. |+| [`node.rs`](./node.rs) / [`python.rs`](./python.rs) | Per-language `enabled()` and `run_inline()`; they differ only in which language they name. |+| [`types.rs`](./types.rs) | `PoolExecOutcome` (with `queue_wait` kept apart from `elapsed`), `PoolLang`, `PoolSettings`. |## Why it existsdiff --git a/crates/openhuman-core/src/runtime/python/README.md b/crates/openhuman-core/src/runtime/python/README.mdindex 424b22062d..7e485003fc 100644--- a/crates/openhuman-core/src/runtime/python/README.md+++ b/crates/openhuman-core/src/runtime/python/README.md@@ -14,8 +14,8 @@ through [`modules::runtime`](../../modules/runtime.rs).| File | Role || --- | --- |-| `mod.rs` | Export-focused: submodule decls and `pub use` re-exports. |-| `bootstrap.rs` | The interpreter client. `PythonBootstrap` (`resolve`, `probe_installed`, `try_cached`), `ResolvedPython`, `PythonSource`. |+| [`mod.rs`](./mod.rs) | Export-focused: submodule decls and `pub use` re-exports. |+| [`bootstrap.rs`](./bootstrap.rs) | The interpreter client. `PythonBootstrap` (`resolve`, `probe_installed`, `try_cached`), `ResolvedPython`, `PythonSource`. |## Public surfacediff --git a/crates/openhuman-core/src/runtime/python_server/README.md b/crates/openhuman-core/src/runtime/python_server/README.mdindex 3839aebb62..44b28a0126 100644--- a/crates/openhuman-core/src/runtime/python_server/README.md+++ b/crates/openhuman-core/src/runtime/python_server/README.md@@ -8,7 +8,7 @@ to pick the interpreter it launches.One backend currently runs inside the worker process:-- **Kompress** (`kompress.rs`): TokenJuice's ModernBERT/torch plain-text+- **Kompress** ([`kompress.rs`](./kompress.rs)): TokenJuice's ModernBERT/torch plain-textcompressor, gated by `config.tokenjuice.ml_compression_enabled`.It is gated behind `config.runtime_python.enabled`; `registry::enabled_backends`@@ -18,10 +18,10 @@ computes the active set from that flag and `config.tokenjuice.ml_compression_ena| File | Role || --- | --- |-| `mod.rs` | Submodule decls and `pub use` re-exports. |-| `server.rs` | Host side: maps `Config` and the managed interpreter onto a `ServerLaunch`, holds the process-wide `ServerSlot` (`ensure_started`, `status`). The process lifecycle itself (spawn, handshake, request/response, restart-on-failure, idle expiry, start back-off) is `tinyruntime_pyserver::{PythonServer, ServerSlot}`. |-| `registry.rs` | `RuntimePythonBackend` enum (`Kompress`) and `enabled_backends(config)`. |-| `kompress.rs` | Kompress venv provisioning (`ensure_kompress`, `install_into`, `kompress_provisioned`) and the compress request (`request_kompress`). |+| [`mod.rs`](./mod.rs) | Submodule decls and `pub use` re-exports. |+| [`server.rs`](./server.rs) | Host side: maps `Config` and the managed interpreter onto a `ServerLaunch`, holds the process-wide `ServerSlot` (`ensure_started`, `status`). The process lifecycle itself (spawn, handshake, request/response, restart-on-failure, idle expiry, start back-off) is `tinyruntime_pyserver::{PythonServer, ServerSlot}`. |+| [`registry.rs`](./registry.rs) | `RuntimePythonBackend` enum (`Kompress`) and `enabled_backends(config)`. |+| [`kompress.rs`](./kompress.rs) | Kompress venv provisioning (`ensure_kompress`, `install_into`, `kompress_provisioned`) and the compress request (`request_kompress`). || (`tinyruntime-pyserver`) | Owns the JSONL wire types (`PROTOCOL_VERSION`, request/response/ready-line), the status types (`BackendStatus`, `ServerStatus`, re-exported here as `RuntimePythonServerStatus`) and the worker script itself (`SERVER_SCRIPT`), written to the cache root as `runtime_python_server.py` each time a server is prepared. Library crate in `vendor/tinyruntime`. |## Lifecycle@@ -73,9 +73,9 @@ computes the active set from that flag and `config.tokenjuice.ml_compression_ena| File | Role || --- | --- |-| `mod.rs` | Submodule decls and `pub use` re-exports. |-| `server.rs` | Host side: maps `Config` and the managed interpreter onto a `ServerLaunch`, holds the process-wide `ServerSlot` (`ensure_started`, `status`). The process lifecycle itself (spawn, handshake, request/response, restart-on-failure, idle expiry, start back-off) is `tinyruntime_pyserver::{PythonServer, ServerSlot}`. |-| `registry.rs` | `RuntimePythonBackend` enum (`Kompress`) and `enabled_backends(config)`. |+| [`mod.rs`](./mod.rs) | Submodule decls and `pub use` re-exports. |+| [`server.rs`](./server.rs) | Host side: maps `Config` and the managed interpreter onto a `ServerLaunch`, holds the process-wide `ServerSlot` (`ensure_started`, `status`). The process lifecycle itself (spawn, handshake, request/response, restart-on-failure, idle expiry, start back-off) is `tinyruntime_pyserver::{PythonServer, ServerSlot}`. |+| [`registry.rs`](./registry.rs) | `RuntimePythonBackend` enum (`Kompress`) and `enabled_backends(config)`. || `kompress.rs` | Kompress venv provisioning (`ensure_kompress`, `install_into`, `kompress_provisioned`) and the compress request (`request_kompress`). || (`tinyruntime-pyserver`) | Owns the JSONL wire types (`PROTOCOL_VERSION`, request/response/ready-line), the status types (`BackendStatus`, `ServerStatus`, re-exported here as `RuntimePythonServerStatus`) and the worker script itself (`SERVER_SCRIPT`), written to the cache root as `runtime_python_server.py` each time a server is prepared. Library crate in `vendor/tinyruntime`. |diff --git a/crates/openhuman-core/src/sandbox/README.md b/crates/openhuman-core/src/sandbox/README.mdindex 6147ecd80f..66cb110801 100644--- a/crates/openhuman-core/src/sandbox/README.md+++ b/crates/openhuman-core/src/sandbox/README.md@@ -7,7 +7,7 @@ flows code-runner capability call into it when the agent runs in sandboxedmode. The core process itself always runs on the host; only the spawnedcommand is confined.-`mod.rs` names three separate questions. Where a tool runs is this folder.+[`mod.rs`](./mod.rs) names three separate questions. Where a tool runs is this folder.Which tools are allowed is the security and tool policy(`security/`, `tools/agent_policy/`). Whether a tool needs host access at allis the elevated-op escape hatch, which is also declared here.@@ -42,7 +42,7 @@ backend, execute.### Resolving a policy-`resolve_sandbox_policy` (`ops.rs`) maps the agent's declared+`resolve_sandbox_policy` ([`ops.rs`](./ops.rs)) maps the agent's declared`SandboxMode` (`agent::harness::definition`) to a `SandboxBackendKind`:- `None` and `ReadOnly` resolve to `SandboxBackendKind::None`.@@ -52,7 +52,7 @@ backend, execute.`OPENHUMAN_SANDBOX` (`SANDBOX_OFF_ENV`) to `off`, `none`, `0`, `false` or`disabled`, case-insensitive. This is for hosts that already isolate thecore (a container, a CI or benchmark image, a VM), where the outer isolation- permits work such as package installs or `/etc` edits that the action-dir+ permits work such as package installs or [`/etc`](.//etc) edits that the action-dirjail would refuse.The rest of the policy follows from that. `workspace_root` is the action dir@@ -60,7 +60,7 @@ and `state_dir` is the core's internal `workspace_dir`. `allow_network` is`!is_remote_session` for `Sandboxed` and `true` for the other modes.`env_passthrough` is `SANDBOX_ENV_PASSTHROUGH`. `docker_overrides` is filledfrom `[runtime.docker]` only for the Docker backend, and the mount lists come-from `grants.rs` only for the Local backend.+from [`grants.rs`](./grants.rs) only for the Local backend.### The None backend@@ -84,7 +84,7 @@ user's project:command is wrapped to redirect its output into these files, because somebackends (macOS Seatbelt) rebuild the command and drop piped stdio.- `sandbox_scratch_root(state_dir)/<uuid>/`, exported as `TMPDIR`, `TEMP` and- `TMP` unless the caller set them. `/tmp` is not granted, so this is where+ `TMP` unless the caller set them. [`/tmp`](.//tmp) is not granted, so this is where`mktemp`, compilers and package managers write.Both are granted read-write for that spawn only and are removed on drop@@ -101,10 +101,10 @@ controlled by `[runtime.local_jail]` (`LocalJailConfig`):| --- | --- | --- || `~/.cargo/bin`, `~/.cargo/{config.toml,config,env}` | read-only | `toolchain_homes`, when present || `~/.cargo/registry`, `~/.cargo/git` | read-write | `toolchain_homes`, when present |-| `~/.rustup`, `~/.nvm`, `~/.npm`, `/usr/local`, `/opt` | read-only | `toolchain_homes`, when present |+| `~/.rustup`, `~/.nvm`, `~/.npm`, [`/usr/local`](.//usr/local), [`/opt`](.//opt) | read-only | `toolchain_homes`, when present || git config files and their `include` targets (canonicalized, depth 8) | read-only | `toolchain_homes`, when present || `extra_read_only`, `extra_read_write` | as listed | always, subject to the floor |-| `/proc` | read-only | only with `allow_proc = true` (default off) |+| [`/proc`](.//proc) | read-only | only with `allow_proc = true` (default off) |The credential floor applies to every grant: any path that`SecurityPolicy::is_always_forbidden` rejects, or that is a parent of a@@ -119,12 +119,12 @@ environment.it with `DockerCli::run_one_shot`. The container is `docker run --rm` with thehost action dir mounted read-write at `/workspace`, network `none` by default,`--cap-drop ALL` plus any extra drops, `--security-opt no-new-privileges`, a-read-only rootfs with `/tmp` and `/var/tmp` tmpfs mounts, memory and CPU+read-only rootfs with [`/tmp`](.//tmp) and [`/var/tmp`](.//var/tmp) tmpfs mounts, memory and CPUlimits (512 MB and 1 CPU by default), and only the passthrough env plus therequest's env. Containers carry the label `openhuman.sandbox=true` so`cleanup_orphaned_containers` can kill leftovers. `validate_docker_policy`-rejects host networking and a mount or workspace root of `/`, `/etc`,-`/proc`, `/sys` or the Docker socket.+rejects host networking and a mount or workspace root of `/`, [`/etc`](.//etc),+[`/proc`](.//proc), [`/sys`](.//sys) or the Docker socket.### Backend status@@ -139,16 +139,16 @@ Local derives its status from which jail backend was picked| Path | What it does || --- | --- |-| `mod.rs` | Re-exports, and `pub use tinybox_jail as cwd_jail` so host call sites have a stable path. |-| `types.rs` | `SandboxBackendKind`, `SandboxPolicy`, `DockerOverrides`, exec request and result, handle and status, `ElevatedOp`, `ELEVATED_TOOLS`. |-| `ops.rs` | Policy resolution, backend creation, routed execution (None and Local paths), the env allowlist, the host off switch, elevated ops. |-| `grants.rs` | The Local jail's filesystem grant set and its credential floor. |-| `docker.rs` | Policy-to-`OneShot` mapping, availability probe, orphan cleanup, Docker policy validation. |-| `schemas.rs` | The `sandbox.*` controllers. |+| [`mod.rs`](./mod.rs) | Re-exports, and `pub use tinybox_jail as cwd_jail` so host call sites have a stable path. |+| [`types.rs`](./types.rs) | `SandboxBackendKind`, `SandboxPolicy`, `DockerOverrides`, exec request and result, handle and status, `ElevatedOp`, `ELEVATED_TOOLS`. |+| [`ops.rs`](./ops.rs) | Policy resolution, backend creation, routed execution (None and Local paths), the env allowlist, the host off switch, elevated ops. |+| [`grants.rs`](./grants.rs) | The Local jail's filesystem grant set and its credential floor. |+| [`docker.rs`](./docker.rs) | Policy-to-`OneShot` mapping, availability probe, orphan cleanup, Docker policy validation. |+| [`schemas.rs`](./schemas.rs) | The `sandbox.*` controllers. |## Key types and entry points-- `SandboxPolicy` (`types.rs`): the resolved per-call policy. It is+- `SandboxPolicy` ([`types.rs`](./types.rs)): the resolved per-call policy. It isserializable so `sandbox.resolve_policy` can return it.- `SandboxBackendKind` (`types.rs`): `None`, `Local`, `Docker`.- `resolve_sandbox_policy(mode, action_dir, state_dir, runtime_config,@@ -217,8 +217,8 @@ The settings surface (`get_sandbox_settings`, `[security.sandbox]` and## Tests-Sibling suites: `types_tests.rs`, `ops_tests.rs`, `grants_tests.rs`,-`schemas_tests.rs`, `docker_tests.rs` and `docker_exec_tests.rs`.+Sibling suites: [`types_tests.rs`](./types_tests.rs), [`ops_tests.rs`](./ops_tests.rs), [`grants_tests.rs`](./grants_tests.rs),+[`schemas_tests.rs`](./schemas_tests.rs), [`docker_tests.rs`](./docker_tests.rs) and [`docker_exec_tests.rs`](./docker_exec_tests.rs).`ops_tests.rs` pins `local_status_for_backend` so a host with no OS jailreports `Inactive` rather than `Ready` (#3235). Run with`cargo test -p openhuman sandbox::` or `pnpm debug rust sandbox`.diff --git a/crates/openhuman-core/src/search/README.md b/crates/openhuman-core/src/search/README.mdindex 8dd5cedcfa..4615912dca 100644--- a/crates/openhuman-core/src/search/README.md+++ b/crates/openhuman-core/src/search/README.md@@ -125,15 +125,15 @@ as a direct-only provider, and a keyless managed-Parallel selection is dropped.| Path | What it does || --- | --- |-| `mod.rs` | Module declarations. Without the `modules` feature it provides a stub `build_search_tools` that returns nothing. |-| `providers.rs` | `ResolvedProvider`, `ProviderStatus`, `resolve`, `role_order`, `effective_role_providers`, and role key helpers (`ROLES`, `role_key`, `parse_role`). |-| `render.rs` | `render`, `subject`, `provider_label`, and the text, markdown, and metadata builders. |-| `tools.rs` | `TinySearchTool` (the `tinytools::Tool` bridge), `build_search_tools`, `user_facing_error`, the exhaustion latch, and the egress check. `modules` feature only. |-| `bus.rs` | `CredentialRefreshSubscriber` (`search::credential_refresh`). `modules` feature only. |+| [`mod.rs`](./mod.rs) | Module declarations. Without the `modules` feature it provides a stub `build_search_tools` that returns nothing. |+| [`providers.rs`](./providers.rs) | `ResolvedProvider`, `ProviderStatus`, `resolve`, `role_order`, `effective_role_providers`, and role key helpers (`ROLES`, `role_key`, `parse_role`). |+| [`render.rs`](./render.rs) | `render`, `subject`, `provider_label`, and the text, markdown, and metadata builders. |+| [`tools.rs`](./tools.rs) | `TinySearchTool` (the `tinytools::Tool` bridge), `build_search_tools`, `user_facing_error`, the exhaustion latch, and the egress check. `modules` feature only. |+| [`bus.rs`](./bus.rs) | `CredentialRefreshSubscriber` (`search::credential_refresh`). `modules` feature only. |## Key types and entry points-- `build_search_tools(&Config)` (`tools.rs`, stub in `mod.rs`) is what the tool+- `build_search_tools(&Config)` ([`tools.rs`](./tools.rs), stub in [`mod.rs`](./mod.rs)) is what the toolregistry calls. It returns an empty list when search is off or nothing isusable.- `TinySearchTool` (`tools.rs`) wraps one `ToolSpec`. `TinySearchTool::new`@@ -195,8 +195,8 @@ read and written through `config/ops/search.rs`.## Tests-Tests sit beside each file (`providers_tests.rs`, `render_tests.rs`,-`tools_tests.rs`, `bus_tests.rs`). Module config tests are in+Tests sit beside each file ([`providers_tests.rs`](./providers_tests.rs), [`render_tests.rs`](./render_tests.rs),+[`tools_tests.rs`](./tools_tests.rs), [`bus_tests.rs`](./bus_tests.rs)). Module config tests are in`modules/search/config_tests.rs`.```bashdiff --git a/crates/openhuman-core/src/security/README.md b/crates/openhuman-core/src/security/README.mdindex c0be2335b0..04b09ccd76 100644--- a/crates/openhuman-core/src/security/README.md+++ b/crates/openhuman-core/src/security/README.md@@ -10,21 +10,21 @@ build carries all of it.Callers are spread across the core. Every acting tool consults`SecurityPolicy` before it runs, the agent harness asks the approval gatebefore a prompted call, the credentials domain owns the `auth.*` RPC-namespace, and the RPC server asks `pairing.rs` whether a bind needs a token.+namespace, and the RPC server asks [`pairing.rs`](./pairing.rs) whether a bind needs a token.## How it works### The policy and its off switch-`SecurityPolicy` (`policy/types.rs`) is the value every tool receives. It is+`SecurityPolicy` ([`policy/types.rs`](./policy/types.rs)) is the value every tool receives. It isbuilt once per agent session by `SecurityPolicy::from_config`-(`policy/enforcement.rs`) from the `[autonomy]` config block, the workspace dir+([`policy/enforcement.rs`](./policy/enforcement.rs)) from the `[autonomy]` config block, the workspace dirand the action dir. That constructor is the single chokepoint between configand policy, so it also injects the default trusted roots: the projects home(`~/OpenHuman/projects`) as read-write, the configured `action_dir` asread-write (skipped when the action dir sits at or above `workspace_dir`), thetool-result artifacts directory as read-only, and the namespaced scratch dir-(`/tmp/openhuman`, never `/tmp` itself) as read-write.+([`/tmp/openhuman`](.//tmp/openhuman), never [`/tmp`](.//tmp) itself) as read-write.The policy is off by default. `AutonomyConfig::enabled`(`config/schema/autonomy.rs`) defaults to `false`, and `from_config` copies it@@ -39,13 +39,13 @@ answer when it is off:| Function | File | Disabled result || --- | --- | --- |-| `gate_decision` | `policy/command_checks.rs` | `GateDecision::Allow` |+| `gate_decision` | [`policy/command_checks.rs`](./policy/command_checks.rs) | `GateDecision::Allow` || `check_gated_command` | `policy/command_checks.rs` | `Ok(class)`, no structural guard || `validate_command_execution` | `policy/command_checks.rs` | `Ok(risk)`, no allowlist || `is_command_allowed` | `policy/command_checks.rs` | `true` || `can_act` | `policy/enforcement.rs` | `true` || `record_action`, `is_rate_limited` | `policy/enforcement.rs` | never limited |-| `is_path_string_allowed` | `policy/path_checks.rs` | `true` after the floor checks |+| `is_path_string_allowed` | [`policy/path_checks.rs`](./policy/path_checks.rs) | `true` after the floor checks || `is_resolved_path_allowed_for` | `policy/path_checks.rs` | `true` after the floor check || `check_resolved_against_forbidden` | `policy/path_checks.rs` | `Ok(())` after the floor check |@@ -61,7 +61,7 @@ and hold in every configuration:matched by path segment, case-insensitively: `.ssh`, `.gnupg`, `.aws`,`.azure`, `.kube`, `keychains`, and the Windows pairs`Microsoft\{Protect,Credentials,Crypto,Vault}`. System roots are matched by- absolute prefix: `/etc`, `/root`, `/boot`, `/proc`, `/sys`, `/system`,+ absolute prefix: [`/etc`](.//etc), [`/root`](.//root), [`/boot`](.//boot), [`/proc`](.//proc), [`/sys`](.//sys), `/system`,`C:\Windows`, `C:\Program Files`, `C:\Program Files (x86)`,`C:\ProgramData`. A trusted-root grant cannot reach these either, and theper-turn workspace grant is checked after this test, so it cannot either.@@ -130,18 +130,18 @@ The invariants that hold with the policy enabled:process substitution, backticks, background `&`) that could smuggle acommand past the approval the human read.- Interactive approval requests expire as denied after ten minutes- (`DEFAULT_APPROVAL_TTL` in `approval/gate.rs`; the Flow Canvas copilot path+ (`DEFAULT_APPROVAL_TTL` in [`approval/gate.rs`](./approval/gate.rs); the Flow Canvas copilot pathuses a three-minute window).The shell-string scanning itself (segment splitting, quoting, heredocstripping, segment classification, hidden-execution detection) is`tinybox_core::shell`, in `vendor/tinybox/crates/tinybox-core`.-`policy/command_checks.rs` composes it with the tier.+[`policy/command_checks.rs`](./policy/command_checks.rs) composes it with the tier.### Hot-swapping the policyA session builds its policy once and shares it immutably with every tool, so a-settings change would otherwise wait for a new session. `live_policy.rs` holds+settings change would otherwise wait for a new session. [`live_policy.rs`](./live_policy.rs) holdsthe current policy in a process-global cell. `install` is called at bootstrap(`core/runtime/bootstrap.rs`) and at channel startup, and `reload_from` iscalled by the config save path (`config/ops/agent.rs`) so `current()` reflects@@ -151,7 +151,7 @@ observe the swap at the next session boundary.### Approval-`approval/` is the human-in-the-loop gate for calls the policy prompts on.+[`approval/`](./approval/) is the human-in-the-loop gate for calls the policy prompts on.The gate persists a pending row, publishes `DomainEvent::ApprovalRequested` sothe UI can show a card, parks the tool future on a oneshot, and wakes on the`approval_decide` RPC or a typed chat reply. Timeouts and denials fail closed.@@ -176,22 +176,22 @@ decision. See [approval/README.md](approval/README.md).| [`keyring_consent/`](keyring_consent/README.md) | Consent gate for falling back from the OS keychain to local encrypted storage. || [`pii/`](pii/README.md) | Fully local PII and identification-risk scanner. || [`prompt_injection/`](prompt_injection/README.md) | Deterministic prompt-injection screening (`Allow`, `Review`, `Block`). |-| `live_policy.rs` | Process-global, hot-swappable current `SecurityPolicy` and privacy mode. |-| `scrub.rs` | Secret and PII scrubbing with the host's policy (`Policy::corroborated`) over TinyMemory's scrubbers. |-| `audit.rs` | Append-only JSON audit log of agent actions (`AuditLogger`). |-| `pairing.rs` | Non-loopback bind guard for the core RPC token; re-exports channel pairing helpers. |-| `core.rs` | `redact()`, the 4-character-prefix log redaction. |-| `ops.rs` | `security_policy_info_for_config` and `load_and_get_security_policy_info`. |-| `schemas.rs` | The `security.policy_info` controller. |-| `tools.rs` | `SecurityPolicyInfoTool`, the only agent-callable tool in this domain. |-| `secrets.rs` | One-line re-export of `keyring::encrypted_store` for older import paths. |+| [`live_policy.rs`](./live_policy.rs) | Process-global, hot-swappable current `SecurityPolicy` and privacy mode. |+| [`scrub.rs`](./scrub.rs) | Secret and PII scrubbing with the host's policy (`Policy::corroborated`) over TinyMemory's scrubbers. |+| [`audit.rs`](./audit.rs) | Append-only JSON audit log of agent actions (`AuditLogger`). |+| [`pairing.rs`](./pairing.rs) | Non-loopback bind guard for the core RPC token; re-exports channel pairing helpers. |+| [`core.rs`](./core.rs) | `redact()`, the 4-character-prefix log redaction. |+| [`ops.rs`](./ops.rs) | `security_policy_info_for_config` and `load_and_get_security_policy_info`. |+| [`schemas.rs`](./schemas.rs) | The `security.policy_info` controller. |+| [`tools.rs`](./tools.rs) | `SecurityPolicyInfoTool`, the only agent-callable tool in this domain. |+| [`secrets.rs`](./secrets.rs) | One-line re-export of `keyring::encrypted_store` for older import paths. |## Key types and entry points-- `SecurityPolicy` (`policy/types.rs`): the policy value. Build it with+- `SecurityPolicy` ([`policy/types.rs`](./policy/types.rs)): the policy value. Build it with`SecurityPolicy::from_config`. Its methods are the enforcement entry pointslisted above, plus `enforce_tool_operation` (tier plus hourly budget for an- acting tool) and `validate_path`-style helpers in `policy/path_checks.rs`.+ acting tool) and `validate_path`-style helpers in [`policy/path_checks.rs`](./policy/path_checks.rs).- `AutonomyLevel` (`ReadOnly`, `Supervised`, `Full`), `CommandClass` (`Read`,`Write`, `Network`, `Install`, `Destructive`) and `GateDecision` (`Allow`,`Prompt`, `Block`), all in `policy/types.rs`.@@ -202,20 +202,20 @@ decision. See [approval/README.md](approval/README.md).strings so the harness and model can tell a policy refusal from a toolfailure.- `validate_path_within_root`, `openhuman_scratch_dir`,- `ensure_openhuman_scratch_dir` (`policy/enforcement.rs`).+ `ensure_openhuman_scratch_dir` ([`policy/enforcement.rs`](./policy/enforcement.rs)).- `live_policy::{install, current, reload_from, reload_privacy,set_action_dir}` (`live_policy.rs`).-- `scrub::{sanitize_text, sanitize_json, has_likely_secret}` (`scrub.rs`):+- `scrub::{sanitize_text, sanitize_json, has_likely_secret}` ([`scrub.rs`](./scrub.rs)):used by the approval store, memory writes, flow memory tools and artifactoffload, so they all redact the same way.-- `AuditLogger` and `get_or_create_workspace_audit_logger` (`audit.rs`).+- `AuditLogger` and `get_or_create_workspace_audit_logger` ([`audit.rs`](./audit.rs)).- `is_public_bind` and `ensure_core_rpc_token_for_bind` (`pairing.rs`): refusea non-loopback RPC bind without an `OPENHUMAN_CORE_TOKEN`(`CORE_TOKEN_ENV_VAR`). `PairingGuard`, `constant_time_eq` and the tokenhelpers are re-exported from `tinychannels_bus::security`.-- `SecretStore` (re-exported from `keyring/`): encrypted-on-disk secrets whose+- `SecretStore` (re-exported from [`keyring/`](./keyring/)): encrypted-on-disk secrets whosemaster key lives in keychain-backed storage.-- The `egress` and `pii` re-exports at the crate root: `enforce_egress`,+- The [`egress`](./egress) and [`pii`](./pii) re-exports at the crate root: `enforce_egress`,`emit_external_transfer`, `local_only_blocks`, `local_only_tool_block`,`EgressDescriptor`, and `scan_pii` with its result types.@@ -231,10 +231,10 @@ This file registers one controller through `core/all.rs`:the same payload to the agent. Command and path gating is enforced inside theengine and is never an agent-callable tool.-The subfolders register their own namespaces: `approval.*` (`approval/`),-`auth.*` (`credentials/`), `devices.*` (`devices/`), `encrypt.secret` and-`decrypt.secret` (`encryption/`), and-`keyring_consent.*` (`keyring_consent/`). Their READMEs list the methods.+The subfolders register their own namespaces: `approval.*` ([`approval/`](./approval/)),+`auth.*` ([`credentials/`](./credentials/)), `devices.*` ([`devices/`](./devices/)), `encrypt.secret` and+`decrypt.secret` ([`encryption/`](./encryption/)), and+`keyring_consent.*` ([`keyring_consent/`](./keyring_consent/)). Their READMEs list the methods.## Boundaries@@ -250,7 +250,7 @@ The subfolders register their own namespaces: `approval.*` (`approval/`),`tinychannels` (`vendor/tinychannels`).- The core never obtains, validates, exchanges or refreshes a credential.Login-token exchange and `/auth/me` belong to the host's session owner- (`openhuman_tinyhumans::session`). `credentials/` only accepts one through+ (`openhuman_tinyhumans::session`). [`credentials/`](./credentials/) only accepts one through`auth.set_credential`.- The tinyagents runtime holds no authority. The bridge that answers its"may this tool run?" question is `agent/tinyagents/host/security_gate.rs`.@@ -259,7 +259,7 @@ The subfolders register their own namespaces: `approval.*` (`approval/`),- Tests that exercise the allowlist, the tier or containment must build theirconfig with `enabled: true`. With the shipped default they pass vacuously.- `policy/policy_disabled_tests.rs` pins the contract of the disabled path.+ [`policy/policy_disabled_tests.rs`](./policy/policy_disabled_tests.rs) pins the contract of the disabled path.- Do not move a floor check below the `if !self.enabled` return. The floor isthe part a future edit is most likely to take with it.- `SecurityPolicy::default()` is enabled, `AutonomyConfig::default()` is not.@@ -272,7 +272,7 @@ The subfolders register their own namespaces: `approval.*` (`approval/`),## TestsEach file has a sibling `<module>_tests.rs`; the policy suites live in-`policy/` (`policy_tests.rs`, `policy_disabled_tests.rs`,+[`policy/`](./policy/) (`policy_tests.rs`, `policy_disabled_tests.rs`,`policy_trusted_roots_tests.rs`, `policy_workspace_internal_tests.rs`,`proptest_tests.rs` and others). Run them with`cargo test -p openhuman security::` or `pnpm debug rust security`.diff --git a/crates/openhuman-core/src/security/approval/README.md b/crates/openhuman-core/src/security/approval/README.mdindex 6ba78374ca..1bd367a1b0 100644--- a/crates/openhuman-core/src/security/approval/README.md+++ b/crates/openhuman-core/src/security/approval/README.md@@ -19,7 +19,7 @@ Interactive approval workflow for supervised mode (issue #1339). `ApprovalGate`| --- | --- || `crates/openhuman-core/src/security/approval/mod.rs` | Export-focused: module docstring, `pub mod` decls, `pub use` re-exports including the controller-schema pair. || `crates/openhuman-core/src/security/approval/gate.rs` | `ApprovalGate` struct + `DecideMiss`, `DEFAULT_APPROVAL_TTL` (10 minutes) and the shorter `COPILOT_APPROVAL_TTL`, the `ApprovalChatContext` / `FlowRunContext` task-locals, `parse_approval_reply`, and the `ApprovalGateBootState` record. |-| `crates/openhuman-core/src/security/approval/gate_setup.rs` (`include!`d by `gate.rs`, as are the next two) | `ApprovalGate::init_global`/`try_global` (process-global install, re-install-safe) and the private constructor. |+| `crates/openhuman-core/src/security/approval/gate_setup.rs` (`include!`d by [`gate.rs`](./gate.rs), as are the next two) | `ApprovalGate::init_global`/`try_global` (process-global install, re-install-safe) and the private constructor. || `crates/openhuman-core/src/security/approval/gate_intercept.rs` | `intercept`/`intercept_audited`/`intercept_audited_bounded`: the origin check, allowlist short-circuit, persist-and-park flow, and cancellation-safe bounded park used by the Flow Canvas copilot live-run path. || `crates/openhuman-core/src/security/approval/gate_state.rs` | `decide` (resolves the parked future, emits `ApprovalDecided`), `classify_decide_miss`, `record_execution` (best-effort terminal audit row), `list_pending`/`list_recent_decisions`, the flow-trust helpers, and the thread→request routing lookups. || `crates/openhuman-core/src/security/approval/store.rs` | SQLite persistence (`pending_approvals` table). `insert_pending`, `decide`, `get_decision`, `record_execution`, `list_pending`, `list_recent_decisions`, `purge_session`, `expire_stale`, plus idempotent column migration for the v1 schema. |@@ -30,7 +30,7 @@ Interactive approval workflow for supervised mode (issue #1339). `ApprovalGate`## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- Gate: `ApprovalGate`, `ApprovalChatContext`, `FlowRunContext`, the `APPROVAL_CHAT_CONTEXT` / `APPROVAL_COPILOT_STREAM_CONTEXT` / `APPROVAL_FLOW_RUN_CONTEXT` task-locals, `parse_approval_reply`.- Redaction: `redact_args`, `summarize_action`.@@ -61,8 +61,8 @@ None. This module gates other domains' tools; it owns no tools of its own (no `tPublished via `crate::core::bus::BUS.publish` with variants from `crate::core::events::DomainEvent` (`crates/openhuman-core/src/core/events.rs`):-- `DomainEvent::ApprovalRequested { request_id, tool_name, action_summary, args_redacted, session_id, thread_id, client_id }`: emitted (`gate_intercept.rs`) when a call is parked. Bridged to the `approval_request` web-channel socket event by `ApprovalSurfaceSubscriber` (defined in `crates/openhuman-core/src/web_chat/`).-- `DomainEvent::ApprovalDecided { request_id, tool_name, decision }`: emitted (`gate_state.rs`) when a decision is applied.+- `DomainEvent::ApprovalRequested { request_id, tool_name, action_summary, args_redacted, session_id, thread_id, client_id }`: emitted ([`gate_intercept.rs`](./gate_intercept.rs)) when a call is parked. Bridged to the `approval_request` web-channel socket event by `ApprovalSurfaceSubscriber` (defined in `crates/openhuman-core/src/web_chat/`).+- `DomainEvent::ApprovalDecided { request_id, tool_name, decision }`: emitted ([`gate_state.rs`](./gate_state.rs)) when a decision is applied.- `DomainEvent::FlowApprovalRequested { request_id, flow_id, run_id, tool_name, summary }`: emitted (`gate_intercept.rs`) alongside `ApprovalRequested` when the parked call has a `Workflow` origin. It carries no thread/client id, so `ApprovalSurfaceSubscriber` drops it; `openhuman_rpc::server::socketio` broadcasts it as `flow_approval_request` for the Workflows UI.No `bus.rs` in this module. It only publishes; the subscriber (`ApprovalSurfaceSubscriber`) lives in `crates/openhuman-core/src/web_chat/event_bus.rs`.@@ -91,7 +91,7 @@ SQLite DB at `{workspace_dir}/approval/approval.db`, table `pending_approvals` (## Notes / gotchas-- **Fail-closed 10-minute TTL is an invariant, not a tunable.** `gate.rs`'s+- **Fail-closed 10-minute TTL is an invariant, not a tunable.** [`gate.rs`](./gate.rs)'s`DEFAULT_APPROVAL_TTL` (`Duration::from_secs(60 * 10)`) matches thedefault `expires_at` written into the persisted row; a parked call thattimes out resolves to `Deny`. Do not weaken this default or the fail-closed@@ -107,4 +107,4 @@ SQLite DB at `{workspace_dir}/approval/approval.db`, table `pending_approvals` (## Tests-- `gate_tests.rs`, `store_tests.rs`, `redact_tests.rs`, `schemas_tests.rs`, `types_tests.rs`.+- [`gate_tests.rs`](./gate_tests.rs), [`store_tests.rs`](./store_tests.rs), [`redact_tests.rs`](./redact_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs), [`types_tests.rs`](./types_tests.rs).diff --git a/crates/openhuman-core/src/security/credentials/README.md b/crates/openhuman-core/src/security/credentials/README.mdindex 423d0aac3f..45b599ec6d 100644--- a/crates/openhuman-core/src/security/credentials/README.md+++ b/crates/openhuman-core/src/security/credentials/README.md@@ -20,34 +20,34 @@ Credential management for the backend credential the core authenticates with and| File | Role || --- | --- |-| `mod.rs` | Export-focused. Re-exports `core::*`, `ops` (also as `rpc`), Composio-direct helpers, schema controllers (`all_credentials_controller_schemas` / `all_credentials_registered_controllers`), `crate::backend::BackendClient`, and `jwt::user_id_from_profile_payload`. |-| `core.rs` | `AuthService` facade over `AuthProfilesStore` — store/get/remove/set-active profiles, resolve bearer token, profile-id selection logic (override → active → default → any-for-provider), provider normalization, state-dir derivation. |-| `profiles.rs` | The persistence engine. `AuthProfile` / `TokenSet` / `AuthProfileKind` / `AuthProfilesData` types and `AuthProfilesStore` — atomic JSON read/write, keychain vs encrypted-JSON secret handling, legacy migration, corrupt-store quarantine, PID-aware stale-lock recovery. |-| `api_key.rs` | The `api-key` profile: `store_api_key[_in]`, `get_api_key[_in]`, `has_api_key[_in]`, `clear_api_key`. |-| `ops.rs` + `ops/` | Business logic + RPC entry points (returns `RpcOutcome<T>`). `ops/credential.rs` (`set_credential` / `clear_credential`, plus the historical `store_session` / `clear_session` names), `ops/user_scope.rs` (user-dir activation and process-global rebinding), `ops/gated_services.rs` (credential-gated services), `ops/boot_env.rs` (env seeding), `ops/session_query.rs` (`auth_get_state`, `auth_get_session_token_json`), `ops/provider_credentials.rs`, `ops/composio.rs`, `ops/secrets.rs`. Re-exported as `rpc`. |-| `schemas.rs` | `auth.*` controller schemas + `handle_*` dispatchers delegating to `ops`. Defines `all_controller_schemas` / `all_registered_controllers`. |-| `session_support.rs` | `CredentialKind`, `BackendCredential`, `resolve_backend_credential`, `require_live_session_token`, `has_backend_credential`, `build_session_state`, `get_session_token`, `load_app_session_profile`, `user_id_from_jwt_claims`, local-session detection/slug, field parsing. Shared by RPC and the HTTP host. |-| `identity.rs` | The signed-in user's identity slot (`peek_credential_user_identity`), seeded from the host-supplied payload for prompts and Sentry. |-| `responses.rs` | Response DTOs: `AuthStateResponse`, `AuthProfileSummary`. |-| `bus.rs` | `SessionExpiredSubscriber` — `EventHandler` for `DomainEvent::SessionExpired`. |-| `tools.rs` | Agent tools `credential_list`, `session_state`, `oauth_connect_url`, `oauth_list` (these two dispatch the hosted `auth_oauth_*` controllers by wire name through the registry and answer `BACKEND_UNAVAILABLE:` without the hosted layer). |+| [`mod.rs`](./mod.rs) | Export-focused. Re-exports `core::*`, [`ops`](./ops) (also as `rpc`), Composio-direct helpers, schema controllers (`all_credentials_controller_schemas` / `all_credentials_registered_controllers`), `crate::backend::BackendClient`, and `jwt::user_id_from_profile_payload`. |+| [`core.rs`](./core.rs) | `AuthService` facade over `AuthProfilesStore` — store/get/remove/set-active profiles, resolve bearer token, profile-id selection logic (override → active → default → any-for-provider), provider normalization, state-dir derivation. |+| [`profiles.rs`](./profiles.rs) | The persistence engine. `AuthProfile` / `TokenSet` / `AuthProfileKind` / `AuthProfilesData` types and `AuthProfilesStore` — atomic JSON read/write, keychain vs encrypted-JSON secret handling, legacy migration, corrupt-store quarantine, PID-aware stale-lock recovery. |+| [`api_key.rs`](./api_key.rs) | The `api-key` profile: `store_api_key[_in]`, `get_api_key[_in]`, `has_api_key[_in]`, `clear_api_key`. |+| [`ops.rs`](./ops.rs) + `ops/` | Business logic + RPC entry points (returns `RpcOutcome<T>`). [`ops/credential.rs`](./ops/credential.rs) (`set_credential` / `clear_credential`, plus the historical `store_session` / `clear_session` names), [`ops/user_scope.rs`](./ops/user_scope.rs) (user-dir activation and process-global rebinding), [`ops/gated_services.rs`](./ops/gated_services.rs) (credential-gated services), [`ops/boot_env.rs`](./ops/boot_env.rs) (env seeding), [`ops/session_query.rs`](./ops/session_query.rs) (`auth_get_state`, `auth_get_session_token_json`), [`ops/provider_credentials.rs`](./ops/provider_credentials.rs), [`ops/composio.rs`](./ops/composio.rs), [`ops/secrets.rs`](./ops/secrets.rs). Re-exported as `rpc`. |+| [`schemas.rs`](./schemas.rs) | `auth.*` controller schemas + `handle_*` dispatchers delegating to `ops`. Defines `all_controller_schemas` / `all_registered_controllers`. |+| [`session_support.rs`](./session_support.rs) | `CredentialKind`, `BackendCredential`, `resolve_backend_credential`, `require_live_session_token`, `has_backend_credential`, `build_session_state`, `get_session_token`, `load_app_session_profile`, `user_id_from_jwt_claims`, local-session detection/slug, field parsing. Shared by RPC and the HTTP host. |+| [`identity.rs`](./identity.rs) | The signed-in user's identity slot (`peek_credential_user_identity`), seeded from the host-supplied payload for prompts and Sentry. |+| [`responses.rs`](./responses.rs) | Response DTOs: `AuthStateResponse`, `AuthProfileSummary`. |+| [`bus.rs`](./bus.rs) | `SessionExpiredSubscriber` — `EventHandler` for `DomainEvent::SessionExpired`. |+| [`tools.rs`](./tools.rs) | Agent tools `credential_list`, `session_state`, `oauth_connect_url`, `oauth_list` (these two dispatch the hosted `auth_oauth_*` controllers by wire name through the registry and answer `BACKEND_UNAVAILABLE:` without the hosted layer). || `*_tests.rs` | Sibling test suites (`#[path = ...]`). |## Public surface-- **`AuthService`** (`core.rs`) — `from_config`, `new`, `load_profiles`, `store_provider_token`, `set_active_profile`, `remove_profile`, `get_profile`, `get_provider_bearer_token`.+- **`AuthService`** ([`core.rs`](./core.rs)) — `from_config`, `new`, `load_profiles`, `store_provider_token`, `set_active_profile`, `remove_profile`, `get_profile`, `get_provider_bearer_token`.- **Constants** — `APP_SESSION_PROVIDER` (`"app-session"`), `DEFAULT_AUTH_PROFILE_NAME` (`"default"`), `COMPOSIO_DIRECT_PROVIDER` (`"composio-direct"`), `api_key::API_KEY_PROVIDER` (`"api-key"`).- **Credential kinds** — `session_support::CredentialKind {Session, ApiKey, Local}` (wire values `"session"`, `"api-key"`, `"local"`). `session_support::resolve_backend_credential` returns `BackendCredential::ApiKey` when a key is stored (before any session classification) and `BackendCredential::Session` otherwise; `BackendOAuthClient::authed_json` sends an API key as `x-api-key` and a session as `Authorization: Bearer`, while `OpenHumanBackendModel::resolve_bearer` sends the key as the bearer for managed inference. Every backend caller goes through it (integrations, voice, channels, webhooks, hosted proxies); bearer-only seams (connector proxy route, memory-host `SessionBearer`, the Socket.IO handshake) use `backend_bearer_secret`, which returns the key first and the stored session otherwise — the backend accepts a key as `Authorization: Bearer` by its `tiny_` prefix. Cloud embeddings mirror `resolve_bearer`. `has_backend_credential` is the boot-time "signed in?" question the scheduler gate asks; `SessionExpired` is ignored for an API-key runtime and for a local session. A local session also has no managed bearer: `resolve_backend_credential` answers `LOCAL_SESSION_BACKEND_UNAVAILABLE` and `resolve_bearer` answers `LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE`, so neither hosted REST nor managed inference sends a token the backend will only 401 (#6932).- **Helpers** — `normalize_provider`, `default_profile_id`, `select_profile_id`, `state_dir_from_config`, `profile_id`.-- **Types** (`profiles.rs`) — `AuthProfile`, `AuthProfileKind` (`OAuth`/`Token`), `TokenSet`, `AuthProfilesData`, `AuthProfilesStore`.-- **Ops/RPC** (`ops`, re-exported as `rpc`) — `set_credential`, `clear_credential`, `store_session`, `clear_session`, `SetCredentialRequest`, `seed_api_key_from_env`, `seed_session_from_env`, `auth_get_state`, `auth_get_session_token_json`, `store_provider_credentials`, `remove_provider_credentials`, `list_provider_credentials`, `list_provider_credentials_by_prefix`, `encrypt_secret`, `decrypt_secret`, `start_credential_gated_services`, `stop_credential_gated_services`.+- **Types** ([`profiles.rs`](./profiles.rs)) — `AuthProfile`, `AuthProfileKind` (`OAuth`/`Token`), `TokenSet`, `AuthProfilesData`, `AuthProfilesStore`.+- **Ops/RPC** ([`ops`](./ops), re-exported as `rpc`) — `set_credential`, `clear_credential`, `store_session`, `clear_session`, `SetCredentialRequest`, `seed_api_key_from_env`, `seed_session_from_env`, `auth_get_state`, `auth_get_session_token_json`, `store_provider_credentials`, `remove_provider_credentials`, `list_provider_credentials`, `list_provider_credentials_by_prefix`, `encrypt_secret`, `decrypt_secret`, `start_credential_gated_services`, `stop_credential_gated_services`.- **Composio-direct** — `store_composio_api_key`, `get_composio_api_key`, `clear_composio_api_key`, `rpc_store_composio_api_key`.- **Backend re-exports** — `crate::backend::BackendClient` and `jwt::user_id_from_profile_payload`. The OAuth connect/handoff types (`IntegrationSummary`, `IntegrationTokensHandoff`) and `decrypt_handoff_blob` moved to `crates/openhuman-tinyhumans/src/hosted/oauth/` with the OAuth flows themselves.- **Schema controllers** — `all_credentials_controller_schemas`, `all_credentials_registered_controllers`.## RPC / controllers-Namespace `auth` (JSON-RPC `openhuman.auth_*` / CLI `openhuman-core auth <function>`). Defined in `schemas.rs`:+Namespace `auth` (JSON-RPC `openhuman.auth_*` / CLI `openhuman-core auth <function>`). Defined in [`schemas.rs`](./schemas.rs):| Method | Description || --- | --- |@@ -67,15 +67,15 @@ Note: `list_provider_credentials_by_prefix` and the Composio-direct/secret helpe## Agent tools-`tools.rs` — `credential_list`, `session_state` (the stored credential state and user, no token material), `oauth_connect_url`, `oauth_list` (these two dispatch the hosted `auth_oauth_*` controllers by wire name through the registry and answer `BACKEND_UNAVAILABLE:` without the hosted layer).+[`tools.rs`](./tools.rs) — `credential_list`, `session_state` (the stored credential state and user, no token material), `oauth_connect_url`, `oauth_list` (these two dispatch the hosted `auth_oauth_*` controllers by wire name through the registry and answer `BACKEND_UNAVAILABLE:` without the hosted layer).## Events-`bus.rs`: `SessionExpiredSubscriber` (`name() == "credentials::session_expired_handler"`, domain filter `["auth"]`) **subscribes** to `DomainEvent::SessionExpired`. On a non-local session it flips the scheduler gate to signed-out and drops the rejected credential (`clear_session`); for a local offline session or an API-key runtime it re-enables the gate and no-ops. This module does not publish events directly (publishers of `SessionExpired` are 401-detection sites elsewhere). The host learns of the sign-out through the Socket.IO `auth:session_expired` bridge and `auth.get_state`.+[`bus.rs`](./bus.rs): `SessionExpiredSubscriber` (`name() == "credentials::session_expired_handler"`, domain filter `["auth"]`) **subscribes** to `DomainEvent::SessionExpired`. On a non-local session it flips the scheduler gate to signed-out and drops the rejected credential (`clear_session`); for a local offline session or an API-key runtime it re-enables the gate and no-ops. This module does not publish events directly (publishers of `SessionExpired` are 401-detection sites elsewhere). The host learns of the sign-out through the Socket.IO `auth:session_expired` bridge and `auth.get_state`.## Persistence-`AuthProfilesStore` (`profiles.rs`) writes `auth-profiles.json` in the config state directory (parent of `config.config_path`, user-scoped after activation). Layout: `schema_version` (current = 1), `updated_at`, `active_profiles` (provider → profile-id), `profiles` (id → profile). The `app-session` profile's metadata carries `user_id`, `user_json` (the host-supplied payload) and `session_expires_at` (the JWT `exp`, for the local expiry precheck). Secret handling:+`AuthProfilesStore` (`profiles.rs`) writes `auth-profiles.json` in the config state directory (parent of `config.config_path`, user-scoped after activation). Layout: `schema_version` (current = 1), `updated_at`, `active_profiles` (provider → profile-id), [`profiles`](./profiles) (id → profile). The `app-session` profile's metadata carries `user_id`, `user_json` (the host-supplied payload) and `session_expires_at` (the JWT `exp`, for the local expiry precheck). Secret handling:- **OS keychain** when available (`crate::security::keyring::is_available`): all token fields stored under key `auth:{profile_id}` namespaced by a per-user id derived from the state dir; JSON keeps no secret fields.- **Encrypted-JSON fallback** (headless/CI): token fields encrypted via `SecretStore` (ChaCha20-Poly1305).@@ -90,7 +90,7 @@ Note: `list_provider_credentials_by_prefix` and the Composio-direct/secret helpe- `crate::memory::conversations` — purge pre-login threads, bind conversation persistence after activation.- `crate::memory` — bind memory client to the active workspace after activation.- `crate::inference::host_runtime`, `crate::voice::{server,dictation_listener,always_on}` — credential-gated services started/stopped.-- `crate::backend` — `BackendClient`, `backend::base_url` (via the installed transport); `jwt.rs` — JWT `exp` decode and `user_id_from_profile_payload`.+- `crate::backend` — `BackendClient`, `backend::base_url` (via the installed transport); [`jwt.rs`](./jwt.rs) — JWT `exp` decode and `user_id_from_profile_payload`.- `crate::core::all` (`ControllerFuture`, `RegisteredController`), `crate::core` (`ControllerSchema`/`FieldSchema`/`TypeSchema`), `crate::core::events::DomainEvent` + `tinybus::EventHandler`, `crate::rpc::RpcOutcome` — controller registry + RPC envelope + event bus.## Used by@@ -99,7 +99,7 @@ Many domains consume `AuthService` / session helpers / Composio-direct key, incl## Notes / gotchas-- `mod.rs` re-exports `ops` both as `ops::*` and as `pub use ops as rpc`. Call sites use `credentials::rpc::*`; this is the documented `rpc.rs`-equivalent exception (no separate `rpc.rs` file exists).+- [`mod.rs`](./mod.rs) re-exports `ops` both as `ops::*` and as `pub use ops as rpc`. Call sites use `credentials::rpc::*`; this is the documented `rpc.rs`-equivalent exception (no separate `rpc.rs` file exists).- `set_credential` does heavy orchestration beyond just storing a token (directory activation, thread purge, service startup). Treat it as the install funnel, not a thin setter, except on the same-token/same-user refresh path, which only rewrites the stored payload.- An embedder host (`CoreContext::current_embedder_config()` is set) keeps the credential under its own `config_path` scope and never touches the operator's global `active_user.toml`.- Local offline sessions are detected purely by the JWT signature segment being literally `local` (`is_local_session_token`); they are never sent anywhere and are never treated as expired.diff --git a/crates/openhuman-core/src/security/devices/README.md b/crates/openhuman-core/src/security/devices/README.mdindex d8f0446d8d..4bb9d15b9d 100644--- a/crates/openhuman-core/src/security/devices/README.md+++ b/crates/openhuman-core/src/security/devices/README.md@@ -20,7 +20,7 @@ Mobile-device pairing domain. Brokers a secure, end-to-end-encrypted tunnel betw| `crates/openhuman-core/src/security/devices/mod.rs` | Export-only: module docstring, `pub mod` decls, re-exports of schema registry fns and public types. || `crates/openhuman-core/src/security/devices/types.rs` | Serde domain types: `PairedDevice`, `PairingSession`, and the three RPC response payloads. || `crates/openhuman-core/src/security/devices/rpc.rs` | RPC handler logic for the three methods + module-level in-memory state singletons (`PENDING_KEYPAIRS`, `PERSISTED_KEYPAIRS`, `PENDING_SESSIONS`, `PEER_STATUS`), LAN-URL detection, and `SecretStore`-backed keypair persist/restore. |-| `crates/openhuman-core/src/security/devices/schemas.rs` | Controller schemas, `all_controller_schemas`/`all_registered_controllers`, and `handle_*` bridges delegating to `rpc.rs`. Mirrors `cron/schemas.rs`. |+| `crates/openhuman-core/src/security/devices/schemas.rs` | Controller schemas, `all_controller_schemas`/`all_registered_controllers`, and `handle_*` bridges delegating to [`rpc.rs`](./rpc.rs). Mirrors `cron/schemas.rs`. || `crates/openhuman-core/src/security/devices/store.rs` | SQLite persistence (`paired_devices` table) via the per-call `with_connection` pattern. || `crates/openhuman-core/src/security/devices/crypto.rs` | `DeviceKeypair` (X25519 keygen, DH, byte round-trip), `TunnelCipher` (XChaCha20-Poly1305 seal/open with a `WINDOW_SIZE`=128 replay window), and base64url helpers. || `crates/openhuman-core/src/security/devices/tunnel_client.rs` | Emits/parses `tunnel:*` events over the shared `SocketManager`; wire types; `tunnel:register` uses Socket.IO ACK via `SocketManager::emit_with_ack`. Frame cap 64 KB. |@@ -28,7 +28,7 @@ Mobile-device pairing domain. Brokers a secure, end-to-end-encrypted tunnel betw## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- `all_devices_controller_schemas` / `all_devices_registered_controllers` (alias for `schemas::all_controller_schemas` / `all_registered_controllers`).- Types: `CreatePairingResponse`, `ListDevicesResponse`, `PairedDevice`, `PairingSession`, `RevokeDeviceResponse`.diff --git a/crates/openhuman-core/src/security/egress/README.md b/crates/openhuman-core/src/security/egress/README.mdindex e9eb5da639..c42568f569 100644--- a/crates/openhuman-core/src/security/egress/README.md+++ b/crates/openhuman-core/src/security/egress/README.md@@ -8,9 +8,9 @@ plus the `LocalOnly` enforcement chokepoint built on top of it.| File | Purpose || --- | --- |-| `types.rs` | `EgressDescriptor`, `DataKind`, `EgressReason`, `IdentificationRisk`: the descriptor contract |-| `emit.rs` | `emit_external_transfer`, the single publish chokepoint, plus per-turn dedup |-| `enforce.rs` | `local_only_blocks` (pure decision) and its two side-effecting wrappers, `enforce_egress` / `local_only_tool_block` |+| [`types.rs`](./types.rs) | `EgressDescriptor`, `DataKind`, `EgressReason`, `IdentificationRisk`: the descriptor contract |+| [`emit.rs`](./emit.rs) | `emit_external_transfer`, the single publish chokepoint, plus per-turn dedup |+| [`enforce.rs`](./enforce.rs) | `local_only_blocks` (pure decision) and its two side-effecting wrappers, `enforce_egress` / `local_only_tool_block` |## Public surface@@ -75,4 +75,4 @@ Both `enforce_egress` and `local_only_tool_block` read the live mode via## Tests-- `types_tests.rs`, `emit_tests.rs`, `enforce_tests.rs`.+- [`types_tests.rs`](./types_tests.rs), [`emit_tests.rs`](./emit_tests.rs), [`enforce_tests.rs`](./enforce_tests.rs).diff --git a/crates/openhuman-core/src/security/encryption/README.md b/crates/openhuman-core/src/security/encryption/README.mdindex e92da87f39..3549df117a 100644--- a/crates/openhuman-core/src/security/encryption/README.md+++ b/crates/openhuman-core/src/security/encryption/README.md@@ -9,7 +9,7 @@ AES-256-GCM at-rest crypto for AI memory storage and the encrypt/decrypt RPC sur- `impl EncryptionKey::derive(password: &str, salt: &[u8]) -> Result<Self, String>` (`core.rs:35`): Argon2id with parameters `m=65536, t=3, p=1`.- `pub async fn encrypt_secret(config: &Config, plaintext: &str) -> Result<Outcome<String>, String>` (`ops.rs:6`): RPC handler, delegates to `credentials::rpc::encrypt_secret`.- `pub async fn decrypt_secret(config: &Config, ciphertext: &str) -> Result<Outcome<String>, String>` (`ops.rs:13`): RPC handler, delegates to `credentials::rpc::decrypt_secret`.-- RPC `encryption.{encrypt_secret, decrypt_secret}`, defined in `schemas.rs` (re-exported via `all_encryption_controller_schemas` / `all_encryption_registered_controllers`).+- RPC `encryption.{encrypt_secret, decrypt_secret}`, defined in [`schemas.rs`](./schemas.rs) (re-exported via `all_encryption_controller_schemas` / `all_encryption_registered_controllers`).- Constants: `SALT_LENGTH = 16`, `NONCE_LENGTH = 12`, `KEY_LENGTH = 32` (private but stable parameters).## Calls intodiff --git a/crates/openhuman-core/src/security/keyring/README.md b/crates/openhuman-core/src/security/keyring/README.mdindex ccecf48f03..7ef6ff944c 100644--- a/crates/openhuman-core/src/security/keyring/README.md+++ b/crates/openhuman-core/src/security/keyring/README.md@@ -26,12 +26,12 @@ OS-keychain-backed secret storage with pluggable test and debug backends, plus a| `crates/openhuman-core/src/security/keyring/crypto.rs` | Shared ChaCha20-Poly1305 helpers (`chacha20_encrypt`/`chacha20_decrypt`), random-byte generation, hex encode/decode. Used by both `encrypted_store` and `encrypted_file_backend`. || `crates/openhuman-core/src/security/keyring/error.rs` | `KeyringError` (thiserror) with variants `Os`/`InvalidUtf8`/`MigrationReadFailed`/`VerifyFailed`/`MigrationDeleteFailed`/`RandomGeneration`/`Crypto`/`Backend`, plus a log-safe `diagnostic()` that preserves the `keyring::Error` variant and `OSStatus`. || `crates/openhuman-core/src/security/keyring/keyring_tests.rs` | Module tests (backend isolation via `force_backend_for_test`). |-| `crates/openhuman-core/src/security/keyring/store_tests.rs`, `store_tests_2_tests.rs`, `store_test_scope_tests.rs` | Test-isolation regressions: test builds ignore `OPENHUMAN_WORKSPACE`, production resolution still honours it, scoped workspaces do not share secrets, and a deleted scoped workspace cannot reset the default store. |-| `crates/openhuman-core/src/security/keyring/encrypted_store_tests.rs`, `encrypted_store_crypto_migration_tests.rs`, `encrypted_store_key_management_tests.rs` | `SecretStore` tests (wired via `#[path]` from `encrypted_store.rs`). |+| `crates/openhuman-core/src/security/keyring/store_tests.rs`, [`store_tests_2_tests.rs`](./store_tests_2_tests.rs), [`store_test_scope_tests.rs`](./store_test_scope_tests.rs) | Test-isolation regressions: test builds ignore `OPENHUMAN_WORKSPACE`, production resolution still honours it, scoped workspaces do not share secrets, and a deleted scoped workspace cannot reset the default store. |+| `crates/openhuman-core/src/security/keyring/encrypted_store_tests.rs`, [`encrypted_store_crypto_migration_tests.rs`](./encrypted_store_crypto_migration_tests.rs), [`encrypted_store_key_management_tests.rs`](./encrypted_store_key_management_tests.rs) | `SecretStore` tests (wired via `#[path]` from [`encrypted_store.rs`](./encrypted_store.rs)). |## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- `KeyringBackend`: backend trait (`get`/`set`/`delete`/`name`).- `SecretStore`: config-field encrypt/decrypt; `encrypt`/`decrypt`/`decrypt_and_migrate`/`needs_migration`/`is_encrypted`/`new`.diff --git a/crates/openhuman-core/src/security/keyring_consent/README.md b/crates/openhuman-core/src/security/keyring_consent/README.mdindex e3320c9abe..fd3f60e64c 100644--- a/crates/openhuman-core/src/security/keyring_consent/README.md+++ b/crates/openhuman-core/src/security/keyring_consent/README.md@@ -19,11 +19,11 @@ so the app never silently drops to local storage without the user agreeing.| File | Purpose || --- | --- |-| `types.rs` | `StorageMode`, `KeyringFailureReason`, `KeyringStatus`, `ConsentPreference`, `PolicyDecision` |-| `policy.rs` | `check_secret_access`, `current_status`, `active_mode_for`, `record_consent`/`build_consent_preference`/`apply_consent`, `retry_probe`, `notify_master_key_unavailable`, `notify_decrypt_failure` |-| `ops.rs` | RPC handler bodies: `keyring_status`, `keyring_consent_decide`, `keyring_retry_probe` |-| `schemas.rs` | Controller registration for the `keyring_consent` RPC namespace |-| `mod.rs` | Module doc + re-exports |+| [`types.rs`](./types.rs) | `StorageMode`, `KeyringFailureReason`, `KeyringStatus`, `ConsentPreference`, `PolicyDecision` |+| [`policy.rs`](./policy.rs) | `check_secret_access`, `current_status`, `active_mode_for`, `record_consent`/`build_consent_preference`/`apply_consent`, `retry_probe`, `notify_master_key_unavailable`, `notify_decrypt_failure` |+| [`ops.rs`](./ops.rs) | RPC handler bodies: `keyring_status`, `keyring_consent_decide`, `keyring_retry_probe` |+| [`schemas.rs`](./schemas.rs) | Controller registration for the `keyring_consent` RPC namespace |+| [`mod.rs`](./mod.rs) | Module doc + re-exports |## Public surface@@ -60,7 +60,7 @@ so the app never silently drops to local storage without the user agreeing.## RPC / controllers-Namespace `keyring_consent`, three functions (`schemas.rs`):+Namespace `keyring_consent`, three functions ([`schemas.rs`](./schemas.rs)):- `keyring_consent.status`: current `KeyringStatus`.- `keyring_consent.decide`: record `mode` (`"local_encrypted"` or@@ -100,4 +100,4 @@ matches on `keyring::backend_name()`'s identifiers (`"os"`,## Tests-- `types_tests.rs`, `policy_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`.+- [`types_tests.rs`](./types_tests.rs), [`policy_tests.rs`](./policy_tests.rs), [`ops_tests.rs`](./ops_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs).diff --git a/crates/openhuman-core/src/security/pii/README.md b/crates/openhuman-core/src/security/pii/README.mdindex 00f339c6d5..dd92abd89e 100644--- a/crates/openhuman-core/src/security/pii/README.md+++ b/crates/openhuman-core/src/security/pii/README.md@@ -22,9 +22,9 @@ whether content is safe to send off-device.| File | Purpose || --- | --- |-| `types.rs` | `RiskLevel`, `PiiCategory` (with per-category `weight()` and `is_strong_identifier()`), `CategoryHit`, `PiiScanResult` |-| `detector.rs` | `scan()`, which walks the compiled rule set, tallies matches, and folds the result into a `PiiScanResult` |-| `rules.rs` | Compiled rule table: pattern rules (regex plus an optional structural validator, for example Luhn for cards) and keyword rules (word-boundaried term alternations for topical categories) |+| [`types.rs`](./types.rs) | `RiskLevel`, `PiiCategory` (with per-category `weight()` and `is_strong_identifier()`), `CategoryHit`, `PiiScanResult` |+| [`detector.rs`](./detector.rs) | `scan()`, which walks the compiled rule set, tallies matches, and folds the result into a `PiiScanResult` |+| [`rules.rs`](./rules.rs) | Compiled rule table: pattern rules (regex plus an optional structural validator, for example Luhn for cards) and keyword rules (word-boundaried term alternations for topical categories) |## Public surface@@ -65,4 +65,4 @@ whether content is safe to send off-device.## Tests-- `detector_tests.rs`, `pii_tests.rs`.+- [`detector_tests.rs`](./detector_tests.rs), [`pii_tests.rs`](./pii_tests.rs).diff --git a/crates/openhuman-core/src/security/policy/README.md b/crates/openhuman-core/src/security/policy/README.mdindex 90bce6b993..515e98862b 100644--- a/crates/openhuman-core/src/security/policy/README.md+++ b/crates/openhuman-core/src/security/policy/README.md@@ -10,7 +10,7 @@ trusted roots, and the per-hour action budget.`SecurityPolicy::enabled` mirrors `[autonomy] enabled` in config and defaultsto `false`. With the policy disabled, `SecurityPolicy::from_config`-(`enforcement.rs`) still builds the struct, but `can_act()`,+([`enforcement.rs`](./enforcement.rs)) still builds the struct, but `can_act()`,`record_action()`, and `is_rate_limited()` all short-circuit: commandclassification, the approval gate, the command allowlist, the hourly actionbudget, `workspace_only`, `forbidden_paths`, and the workspace-internal@@ -21,7 +21,7 @@ traversal and null bytes in a path. Setting `[autonomy] enabled = true`restores the full policy. Note the asymmetry with `Default`: a policy builtfrom config defaults to disabled, while a policy built with no config at all(`SecurityPolicy::default()`) defaults to enabled; see the comment on that-impl in `types.rs`.+impl in [`types.rs`](./types.rs).## Responsibilities@@ -41,10 +41,10 @@ impl in `types.rs`.| File | Purpose || --- | --- |-| `types.rs` | `SecurityPolicy` fields, `AutonomyLevel`, `CommandRiskLevel`, `CommandClass`, `GateDecision`, `ToolOperation`, `ActionTracker`, `TrustedRoot`/`TrustedAccess`, `WORKSPACE_INTERNAL_DIRS`/`WORKSPACE_INTERNAL_FILES`, the two policy markers |-| `path_checks.rs` | `is_workspace_internal_path`, `is_always_forbidden`, `check_cross_profile`, `is_within_trusted_root`, `is_resolved_path_allowed[_for]`, `check_resolved_against_forbidden` |-| `command_checks.rs` | `classify_command`, `gate_decision`, `check_gated_command`, `is_command_allowed`, `command_risk_level`, `parse_declared_class`, `is_command_executor`, `split_unquoted_segments` |-| `enforcement.rs` | `can_act`, `enforce_write_tier`, `enforce_tool_operation`, `record_action`/`is_rate_limited`, `from_config`, `with_privacy_mode`, `openhuman_scratch_dir`/`ensure_openhuman_scratch_dir`, `validate_path_within_root` |+| [`types.rs`](./types.rs) | `SecurityPolicy` fields, `AutonomyLevel`, `CommandRiskLevel`, `CommandClass`, `GateDecision`, `ToolOperation`, `ActionTracker`, `TrustedRoot`/`TrustedAccess`, `WORKSPACE_INTERNAL_DIRS`/`WORKSPACE_INTERNAL_FILES`, the two policy markers |+| [`path_checks.rs`](./path_checks.rs) | `is_workspace_internal_path`, `is_always_forbidden`, `check_cross_profile`, `is_within_trusted_root`, `is_resolved_path_allowed[_for]`, `check_resolved_against_forbidden` |+| [`command_checks.rs`](./command_checks.rs) | `classify_command`, `gate_decision`, `check_gated_command`, `is_command_allowed`, `command_risk_level`, `parse_declared_class`, `is_command_executor`, `split_unquoted_segments` |+| [`enforcement.rs`](./enforcement.rs) | `can_act`, `enforce_write_tier`, `enforce_tool_operation`, `record_action`/`is_rate_limited`, `from_config`, `with_privacy_mode`, `openhuman_scratch_dir`/`ensure_openhuman_scratch_dir`, `validate_path_within_root` || `tinybox_core::shell::{scan,classify,executor,env_guard}` (vendored) | Shell-parsing helpers behind the command checks: `split_unquoted_segments`, `skip_env_assignments`, `normalized_command_name`, `is_command_executor`, `classify_segment`, `has_hidden_execution`, `has_dangerous_env_prefix`, `contains_unquoted_char`, and the `CommandClass` enum (re-exported from `types.rs`) |## Public surface@@ -79,7 +79,7 @@ Each of these must not be weakened to make a feature work:by `check_resolved_against_forbidden` before any trusted-root grant isconsulted. Kept as two separate fields on `SecurityPolicy` (`types.rs`) sothe two roots can diverge.-- `is_workspace_internal_path` (`path_checks.rs`) is true for any path+- `is_workspace_internal_path` ([`path_checks.rs`](./path_checks.rs)) is true for any pathwhose first component under `workspace_dir` is in `WORKSPACE_INTERNAL_DIRS`or `WORKSPACE_INTERNAL_FILES` (`types.rs`), or startswith `memory-`, `memory_tree-`, or `session_raw-`. It is checked against the@@ -88,13 +88,13 @@ Each of these must not be weakened to make a feature work:- `is_always_forbidden` (`path_checks.rs`) does a case-insensitive,segment-based match against `SENSITIVE_COMPONENTS` (`.ssh`, `.gnupg`,`.aws`, `.azure`, `.kube`, `keychains`, Windows DPAPI dirs) plus a prefix- match against `SYSTEM_PREFIXES` (`/etc`, `/root`, `/boot`, `/proc`, `/sys`,+ match against `SYSTEM_PREFIXES` ([`/etc`](.//etc), [`/root`](.//root), [`/boot`](.//boot), [`/proc`](.//proc), [`/sys`](.//sys),`/system`, `C:\Windows`, `C:\Program Files[ (x86)]`, `C:\ProgramData`).It is unconditional; a `trusted_root` grant can never reach these paths.- Gray-area directories (`/usr`, `/opt`, `/var`, `~/Library`) deliberately+ Gray-area directories ([`/usr`](.//usr), [`/opt`](.//opt), [`/var`](.//var), `~/Library`) deliberatelystay in the user-overridable `forbidden_paths` list instead, so a grant canstill reach, for example, `/usr/local/...`.-- `classify_command`'s fail-closed floor (`command_checks.rs`): a+- `classify_command`'s fail-closed floor ([`command_checks.rs`](./command_checks.rs)): acommand that is not provably read-only (and not a recognizednetwork/destructive command) is at least `CommandClass::Write`. The highestclass across `;`/`|`/`&&`/`||`/newline-separated segments wins, and any@@ -122,11 +122,11 @@ Each of these must not be weakened to make a feature work:## Tests-- `policy_tests.rs`, `policy_allowlist_tests.rs`, `policy_injection_tests.rs`,- `policy_paths_and_risk_tests.rs`, `policy_trusted_roots_tests.rs`, and- `policy_workspace_internal_tests.rs`: behavior tests for classification,+- [`policy_tests.rs`](./policy_tests.rs), [`policy_allowlist_tests.rs`](./policy_allowlist_tests.rs), [`policy_injection_tests.rs`](./policy_injection_tests.rs),+ [`policy_paths_and_risk_tests.rs`](./policy_paths_and_risk_tests.rs), [`policy_trusted_roots_tests.rs`](./policy_trusted_roots_tests.rs), and+ [`policy_workspace_internal_tests.rs`](./policy_workspace_internal_tests.rs): behavior tests for classification,path checks, and tier enforcement.-- `policy_disabled_tests.rs`: behavior with `[autonomy] enabled = false`.-- `proptest_tests.rs`: property tests over command classification.-- `enforcement_scratch_dir_tests_tests.rs`: `openhuman_scratch_dir` is+- [`policy_disabled_tests.rs`](./policy_disabled_tests.rs): behavior with `[autonomy] enabled = false`.+- [`proptest_tests.rs`](./proptest_tests.rs): property tests over command classification.+- [`enforcement_scratch_dir_tests_tests.rs`](./enforcement_scratch_dir_tests_tests.rs): `openhuman_scratch_dir` isnamespaced on every platform and `ensure_openhuman_scratch_dir` creates it.diff --git a/crates/openhuman-core/src/security/prompt_injection/README.md b/crates/openhuman-core/src/security/prompt_injection/README.mdindex 4c09689949..26f932c7e8 100644--- a/crates/openhuman-core/src/security/prompt_injection/README.md+++ b/crates/openhuman-core/src/security/prompt_injection/README.md@@ -20,7 +20,7 @@ Centralized, deterministic prompt-injection screening. Given a user-provided pro## Public surface-Re-exported from `mod.rs` (all defined in `detector.rs`):+Re-exported from [`mod.rs`](./mod.rs) (all defined in [`detector.rs`](./detector.rs)):- `enforce_prompt_input(input: &str, context: PromptEnforcementContext) -> PromptEnforcementDecision`: the entry point for user-facing prompts.- `scan_tool_definition(field: &str, text: &str) -> Option<ToolDefinitionScanHit>`: same rules applied to remote MCP tool descriptions and titles; any non-`Allow` verdict is a hit and the registry rejects the tool.diff --git a/crates/openhuman-core/src/skills/README.md b/crates/openhuman-core/src/skills/README.mdindex a98f0fdd77..eabc3e6753 100644--- a/crates/openhuman-core/src/skills/README.md+++ b/crates/openhuman-core/src/skills/README.md@@ -18,9 +18,9 @@ starts a separate agent run. Skill bodies are never spliced into a chat turn.### Discovery and scope-`load_workflow_metadata(workspace_dir)` (`ops_discover/api.rs`) is what most+`load_workflow_metadata(workspace_dir)` ([`ops_discover/api.rs`](./ops_discover/api.rs)) is what mostcallers use. It returns a cached `Vec<Workflow>`; on a miss it runs-`discover_filtered` (`ops_discover/scan.rs`), which walks the roots in this+`discover_filtered` ([`ops_discover/scan.rs`](./ops_discover/scan.rs)), which walks the roots in thisorder:```text@@ -61,17 +61,17 @@ catalog on the next snapshot.### Creating, installing, uninstalling-- `create_workflow` (`ops_create.rs`) picks the root for the requested scope,+- `create_workflow` ([`ops_create.rs`](./ops_create.rs)) picks the root for the requested scope,calls `tinyskills::scaffold_bundle`, writes the `workflow.toml` sidecar(`render_workflow_toml`) from validated `[[inputs]]`, then re-discovers thenew skill.-- `install_workflow_from_url` (`ops_install/fetch.rs`) normalizes and+- `install_workflow_from_url` ([`ops_install/fetch.rs`](./ops_install/fetch.rs)) normalizes andvalidates the URL with `tinyskills`' SSRF guards (HTTPS only, no privateaddresses, GitHub blob URLs turned into raw URLs), fetches with `reqwest`under a size cap and a clamped timeout, validates the document and writesit. Plain HTTP to localhost is accepted only with`OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP=1`, for local test fixtures.-- `uninstall_workflow` (`ops_install/uninstall.rs`) searches the roots in+- `uninstall_workflow` ([`ops_install/uninstall.rs`](./ops_install/uninstall.rs)) searches the roots inorder and calls `tinyskills::remove_bundle`, which refuses symlinks andanything outside the root.@@ -101,9 +101,9 @@ and the `run_workflow` tool (`agent/tools/run_workflow.rs`) callawait_run_outcome (polls the log for a terminal result)```-`registry.rs` treats a skill as an `AgentDefinition` plus declared inputs,+[`registry.rs`](./registry.rs) treats a skill as an `AgentDefinition` plus declared inputs,flattened from the same sidecar, and `render_inputs_block` renders the-provided inputs into the run's prompt. `preflight.rs` holds gates that must+provided inputs into the run's prompt. [`preflight.rs`](./preflight.rs) holds gates that mustpass before the orchestrator boots, so a failure reaches the caller as aplain error rather than confusing agent output. Today that is the GitHub gate:Composio GitHub connected, `git` on PATH, `user.name` and `user.email` set,@@ -111,7 +111,7 @@ and an optional strict identity match.### Triggered skills-`bus.rs` indexes skills whose frontmatter declares `triggers:`+[`bus.rs`](./bus.rs) indexes skills whose frontmatter declares `triggers:`(`TriggeredWorkflowIndex`) and registers the `skills::triggered_skill`subscriber on `BUS`. `ensure_triggered_workflow_subscriber` is called from`core/runtime/bootstrap.rs` and `channels/runtime/startup/start_channels.rs`.@@ -120,7 +120,7 @@ session for a match is not implemented.### Bundled skills-`bundled/mod.rs` holds the compiled-in `BUNDLED` table: `desktop-control`+[`bundled/mod.rs`](./bundled/mod.rs) holds the compiled-in `BUNDLED` table: `desktop-control`(behind `modules`) and the flows `FLOW_AUTHORING` manual (behind `flows`).`install_bundled_skills` materializes them under`<workspace>/.openhuman/builtin-skills/`, and discovery accepts a directory@@ -132,40 +132,40 @@ there only while its bytes still match the binary| Path | What it does || --- | --- |-| `mod.rs` | The facade and the `skills` feature gate (see Gotchas). |-| `ops.rs` | Re-exports of the create, discover, install and parse entry points. |-| `ops_types.rs` | Ungated. OpenHuman names for the `tinyskills` model (`Workflow`, `WorkflowFrontmatter`, `WorkflowScope`), `SKILL_TOML`, `WORKFLOW_TOML`, the trust marker name. |-| `types.rs` | Ungated. `ToolResult` and `ToolContent` re-exported from `tinytools` for older import paths. |-| `ops_discover.rs`, `ops_discover/` | `api.rs` (public entry points, metadata cache, trust check), `scan.rs` (root order and scan engine), `resource.rs` (`read_workflow_resource`). |-| `ops_parse.rs` | Frontmatter and body split, resource inventory. |-| `ops_create.rs` | Scaffold a new skill with its sidecar. |-| `ops_install.rs`, `ops_install/` | `fetch.rs` (URL installer), `url_validation.rs`, `uninstall.rs`. |-| `registry.rs` | Skills as agent definitions with inputs; `render_inputs_block`, `prune_legacy_default_workflows`. |-| `preflight.rs` | Pre-run gates (GitHub). |-| `run_log.rs` | Per-run streaming logs; `read_run_log_slice`, `scan_runs`. |-| `search.rs` | `SkillSearchTool` (`skill_search`): a capped projection of one matching skill instead of the whole catalog. |-| `tools.rs`, `tools/`, `tools_uninstall.rs` | Agent tool wrappers, split into `read.rs`, `write.rs`, `helpers.rs` and the uninstall tool. |-| `bus.rs` | Triggered-skill index and subscriber. |-| `bundled/` | Compiled-in skills and the builtin root. |-| `schemas/` | `controller_schemas.rs`, `handlers.rs`, `helpers.rs` (workspace resolution through `Config::load_or_init()` with a 30 second timeout), `wire_types.rs`. |-| `stub.rs` | Facade used when the `skills` feature is off. |+| [`mod.rs`](./mod.rs) | The facade and the `skills` feature gate (see Gotchas). |+| [`ops.rs`](./ops.rs) | Re-exports of the create, discover, install and parse entry points. |+| [`ops_types.rs`](./ops_types.rs) | Ungated. OpenHuman names for the `tinyskills` model (`Workflow`, `WorkflowFrontmatter`, `WorkflowScope`), `SKILL_TOML`, `WORKFLOW_TOML`, the trust marker name. |+| [`types.rs`](./types.rs) | Ungated. `ToolResult` and `ToolContent` re-exported from `tinytools` for older import paths. |+| [`ops_discover.rs`](./ops_discover.rs), [`ops_discover/`](./ops_discover/) | `api.rs` (public entry points, metadata cache, trust check), `scan.rs` (root order and scan engine), `resource.rs` (`read_workflow_resource`). |+| [`ops_parse.rs`](./ops_parse.rs) | Frontmatter and body split, resource inventory. |+| [`ops_create.rs`](./ops_create.rs) | Scaffold a new skill with its sidecar. |+| [`ops_install.rs`](./ops_install.rs), [`ops_install/`](./ops_install/) | `fetch.rs` (URL installer), `url_validation.rs`, `uninstall.rs`. |+| [`registry.rs`](./registry.rs) | Skills as agent definitions with inputs; `render_inputs_block`, `prune_legacy_default_workflows`. |+| [`preflight.rs`](./preflight.rs) | Pre-run gates (GitHub). |+| [`run_log.rs`](./run_log.rs) | Per-run streaming logs; `read_run_log_slice`, `scan_runs`. |+| [`search.rs`](./search.rs) | `SkillSearchTool` (`skill_search`): a capped projection of one matching skill instead of the whole catalog. |+| [`tools.rs`](./tools.rs), [`tools/`](./tools/), [`tools_uninstall.rs`](./tools_uninstall.rs) | Agent tool wrappers, split into `read.rs`, `write.rs`, `helpers.rs` and the uninstall tool. |+| [`bus.rs`](./bus.rs) | Triggered-skill index and subscriber. |+| [`bundled/`](./bundled/) | Compiled-in skills and the builtin root. |+| [`schemas/`](./schemas/) | `controller_schemas.rs`, `handlers.rs`, `helpers.rs` (workspace resolution through `Config::load_or_init()` with a 30 second timeout), `wire_types.rs`. |+| [`stub.rs`](./stub.rs) | Facade used when the `skills` feature is off. || [`catalog/`](catalog/README.md) | Remote skill catalogs (`skill_registry.*`), install by entry id, the `skill_setup` agent. || [`runtime/`](runtime/README.md) | Run execution (`skill_runtime.*`): start, cancel, recent runs, log reads, Node/Python runtime resolution. || [`webhooks/`](webhooks/README.md) | Webhook tunnel routing. Nested here for historical reasons; not part of the `skills` feature. |## Key types and entry points-- `Workflow`, `WorkflowScope` (`ops_types.rs`): the discovered skill and its+- `Workflow`, `WorkflowScope` ([`ops_types.rs`](./ops_types.rs)): the discovered skill and itsscope (`Builtin`, `Legacy`, `User`, `Project`, `Profile`, `Flow`).- `load_workflow_metadata`, `discover_workflows`, `discover_automations`,- `is_workspace_trusted`, `init_workflows_dir` (`ops_discover/api.rs`).+ `is_workspace_trusted`, `init_workflows_dir` ([`ops_discover/api.rs`](./ops_discover/api.rs)).`config/workspace/ops.rs` calls `init_workflows_dir` during workspacebootstrap.-- `read_workflow_resource` (`ops_discover/resource.rs`): wraps+- `read_workflow_resource` ([`ops_discover/resource.rs`](./ops_discover/resource.rs)): wraps`tinyskills::resolve_skill` and `read_resource`, which enforce traversal,symlink, size (`MAX_WORKFLOW_RESOURCE_BYTES`, 128 KiB) and UTF-8 checks.- `create_workflow`, `install_workflow_from_url`, `uninstall_workflow`- (re-exported from `ops.rs`).+ (re-exported from [`ops.rs`](./ops.rs)).- `registry::{get_workflow, load_workflows, render_inputs_block}`.- `run_log::run_log_path` and the readers.@@ -189,7 +189,7 @@ is the separate `run_workflow` and `await_workflow` pair.## RPC surface-Namespace `skills` (`schemas/controller_schemas.rs`), wired in `core/all.rs`:+Namespace `skills` ([`schemas/controller_schemas.rs`](./schemas/controller_schemas.rs)), wired in `core/all.rs`:- `skills.list`, `skills.describe`: installed skills and one skill's detail.- `skills.read_resource`: one bundled resource file.@@ -227,13 +227,13 @@ flows domain contributes `Flow`-scope entries (`flows/catalogue.rs`).- The `skills` Cargo feature (default on) gates every behavioral submodule.`pub mod skills` itself always compiles as a facade: when the feature is off,- `stub.rs` supplies the functions always-on callers use with empty or no-op+ [`stub.rs`](./stub.rs) supplies the functions always-on callers use with empty or no-opbodies (`load_workflow_metadata` returns `[]`, `init_workflows_dir` returns`Ok(())`, the controller aggregators return nothing), so callers need no- `#[cfg]`. `types.rs` and `ops_types.rs` stay compiled in both builds because+ `#[cfg]`. [`types.rs`](./types.rs) and `ops_types.rs` stay compiled in both builds becauseagent-harness and prompt signatures name them; the stub re-exports them- rather than redeclaring them. `catalog` and `runtime` are facade and stub- pairs of their own, and `webhooks` is ungated. Stub signatures must match+ rather than redeclaring them. [`catalog`](./catalog) and [`runtime`](./runtime) are facade and stub+ pairs of their own, and [`webhooks`](./webhooks) is ungated. Stub signatures must matchthe real ones exactly, and `cargo check --no-default-features` is the onlything that catches drift.- Skill discovery rejects symlinked bundles. Copy a skill into a library@@ -243,11 +243,11 @@ flows domain contributes `Flow`-scope entries (`flows/catalogue.rs`).## Tests-Host wiring tests sit beside their modules (`ops_tests.rs` and its-`ops_discovery_tests.rs`, `ops_create_and_url_tests.rs`,-`ops_uninstall_tests.rs` siblings, `preflight_tests.rs`, `registry_tests.rs`,-`run_log_tests.rs`, `search_tests.rs`, `tools_tests.rs`, `bus_tests.rs` and-others). `e2e_plumbing_tests.rs` is the mock-LLM end-to-end test: create and+Host wiring tests sit beside their modules ([`ops_tests.rs`](./ops_tests.rs) and its+[`ops_discovery_tests.rs`](./ops_discovery_tests.rs), [`ops_create_and_url_tests.rs`](./ops_create_and_url_tests.rs),+[`ops_uninstall_tests.rs`](./ops_uninstall_tests.rs) siblings, [`preflight_tests.rs`](./preflight_tests.rs), [`registry_tests.rs`](./registry_tests.rs),+[`run_log_tests.rs`](./run_log_tests.rs), [`search_tests.rs`](./search_tests.rs), [`tools_tests.rs`](./tools_tests.rs), [`bus_tests.rs`](./bus_tests.rs) and+others). [`e2e_plumbing_tests.rs`](./e2e_plumbing_tests.rs) is the mock-LLM end-to-end test: create andregistry round-trip, an orchestrator turn calling `list_workflows` and`run_workflow`, and `await_run_outcome` polling. Tests for the portable pieceslive in `vendor/tinyskills/crates/tinyskills/tests/`. Run withdiff --git a/crates/openhuman-core/src/skills/catalog/README.md b/crates/openhuman-core/src/skills/catalog/README.mdindex e9aefb7d26..de255cd0bd 100644--- a/crates/openhuman-core/src/skills/catalog/README.md+++ b/crates/openhuman-core/src/skills/catalog/README.md@@ -26,17 +26,17 @@ Owns remote skill catalogs and installed-skill lifecycle:| File | Purpose || --- | --- |-| `mod.rs` | Feature gate (`skills` Cargo feature) and module wiring; re-exports the controller aggregators |-| `ops.rs` | Catalog fetch/cache, boot refresh, browse/search/sources/categories, entry ids, download-URL derivation, `find_catalog_entry`, `install_from_catalog` |-| `download.rs` | `SKILL.md` locations for ClawHub (file API) and skills.sh (GitHub repo probe plus tree lookup) |-| `store.rs` | Catalog cache at `~/.openhuman/skill-registry/cache.json`, with a 1-hour TTL, kept past TTL for stale-while-revalidate; `OPENHUMAN_SKILL_REGISTRY_CACHE_DIR` relocates it (tests) |-| `tools.rs` | LLM-callable tools `skill_registry_browse`, `skill_registry_search`, `skill_registry_sources`, `skill_registry_install`, `skill_registry_uninstall` |-| `types.rs` | `CatalogEntry` |-| `schemas/controller_schemas.rs` | `skill_registry_*` `ControllerSchema` definitions and the registered-controller table |-| `schemas/handlers.rs` | Thin RPC handlers dispatching into `ops.rs` |-| `schemas/wire_types.rs` | Request/response payload types for the handlers |-| `stub.rs` | No-op facade compiled in when the `skills` feature is off |-| `agent/skill_setup/` | Built-in `skill_setup` agent (`agent.toml`, `prompt.md`, `prompt.rs`) |+| [`mod.rs`](./mod.rs) | Feature gate (`skills` Cargo feature) and module wiring; re-exports the controller aggregators |+| [`ops.rs`](./ops.rs) | Catalog fetch/cache, boot refresh, browse/search/sources/categories, entry ids, download-URL derivation, `find_catalog_entry`, `install_from_catalog` |+| [`download.rs`](./download.rs) | `SKILL.md` locations for ClawHub (file API) and skills.sh (GitHub repo probe plus tree lookup) |+| [`store.rs`](./store.rs) | Catalog cache at `~/.openhuman/skill-registry/cache.json`, with a 1-hour TTL, kept past TTL for stale-while-revalidate; `OPENHUMAN_SKILL_REGISTRY_CACHE_DIR` relocates it (tests) |+| [`tools.rs`](./tools.rs) | LLM-callable tools `skill_registry_browse`, `skill_registry_search`, `skill_registry_sources`, `skill_registry_install`, `skill_registry_uninstall` |+| [`types.rs`](./types.rs) | `CatalogEntry` |+| [`schemas/controller_schemas.rs`](./schemas/controller_schemas.rs) | `skill_registry_*` `ControllerSchema` definitions and the registered-controller table |+| [`schemas/handlers.rs`](./schemas/handlers.rs) | Thin RPC handlers dispatching into `ops.rs` |+| [`schemas/wire_types.rs`](./schemas/wire_types.rs) | Request/response payload types for the handlers |+| [`stub.rs`](./stub.rs) | No-op facade compiled in when the `skills` feature is off |+| [`agent/skill_setup/`](./agent/skill_setup/) | Built-in `skill_setup` agent (`agent.toml`, `prompt.md`, `prompt.rs`) |## RPC surface@@ -49,28 +49,28 @@ all under the `skill_registry` namespace:- `categories`: distinct categories present in the catalog.- `install`: install a catalog entry by `entry_id` into user scope.- `uninstall`: remove an installed user-scope skill by slug.-- `schemas`: return the `skill_registry` controller schemas (CLI/RPC smoke-test generation).+- [`schemas`](./schemas): return the `skill_registry` controller schemas (CLI/RPC smoke-test generation).## Agent tools and the `skill_setup` agent-`tools.rs` exposes the browse/search/sources/install/uninstall operations as+[`tools.rs`](./tools.rs) exposes the browse/search/sources/install/uninstall operations asLLM-callable tools (`SkillRegistryBrowseTool`, `SkillRegistrySearchTool`,`SkillRegistrySourcesTool`, `SkillRegistryInstallTool`,`SkillRegistryUninstallTool`), re-exported through the`#[cfg(feature = "skills")]` glob in `crates/openhuman-core/src/tools/mod.rs`.-`agent/skill_setup/` is a built-in agent (id `skill_setup`, delegate name+[`agent/skill_setup/`](./agent/skill_setup/) is a built-in agent (id `skill_setup`, delegate name`setup_skills`) whose tool belt is the five tools above plus`list_workflows`, `describe_workflow`, `install_workflow_from_url`,`uninstall_workflow`, and `ask_user_clarification`. It is registered in`crates/openhuman-core/src/agent/registry/agents/loader.rs` behind-`#[cfg(feature = "skills")]`, which embeds `agent/skill_setup/agent.toml` via+`#[cfg(feature = "skills")]`, which embeds [`agent/skill_setup/agent.toml`](./agent/skill_setup/agent.toml) via`include_str!` and wires `agent/skill_setup/prompt.rs::build` as its promptbuilder.## Disabled build-When the `skills` Cargo feature is off, `stub.rs` takes the place of this+When the `skills` Cargo feature is off, [`stub.rs`](./stub.rs) takes the place of thismodule: the controller aggregators return empty vectors and`ops::start_boot_catalog_refresh` is a no-op, so the always-on call sites in`core/all.rs` and `core/runtime/services.rs` keep compiling without the realdiff --git a/crates/openhuman-core/src/skills/runtime/README.md b/crates/openhuman-core/src/skills/runtime/README.mdindex 0083bd86bb..07456eb104 100644--- a/crates/openhuman-core/src/skills/runtime/README.md+++ b/crates/openhuman-core/src/skills/runtime/README.md@@ -37,19 +37,19 @@ It reuses, rather than duplicates:| File | Purpose || --- | --- |-| `mod.rs` | Facade: gates the real modules behind the `skills` feature, re-exports the run machinery and controller aggregators, or pulls in `stub` |-| `ops.rs` | `RuntimeRequirement` (`all` / `node` / `python`) and `resolve_runtimes` returning `ResolveRuntimesOutcome` |-| `run_machinery.rs` | `spawn_workflow_run_background`, `WorkflowRunStarted`, `await_run_outcome` |-| `schemas.rs` | `skill_runtime` controllers: `run`, `cancel`, `recent_runs`, `read_run_log`, `resolve_runtimes`, `schemas` |-| `tools.rs` | `SkillRuntimeResolveRuntimesTool` (`skill_runtime_resolve_runtimes`), re-exported through `tools/mod.rs` under the `skills` gate |-| `stub.rs` | Disabled-feature facade: only the two controller aggregators, both returning empty vectors |+| [`mod.rs`](./mod.rs) | Facade: gates the real modules behind the `skills` feature, re-exports the run machinery and controller aggregators, or pulls in `stub` |+| [`ops.rs`](./ops.rs) | `RuntimeRequirement` (`all` / `node` / `python`) and `resolve_runtimes` returning `ResolveRuntimesOutcome` |+| [`run_machinery.rs`](./run_machinery.rs) | `spawn_workflow_run_background`, `WorkflowRunStarted`, `await_run_outcome` |+| [`schemas.rs`](./schemas.rs) | `skill_runtime` controllers: `run`, `cancel`, `recent_runs`, `read_run_log`, `resolve_runtimes`, `schemas` |+| [`tools.rs`](./tools.rs) | `SkillRuntimeResolveRuntimesTool` (`skill_runtime_resolve_runtimes`), re-exported through `tools/mod.rs` under the `skills` gate |+| [`stub.rs`](./stub.rs) | Disabled-feature facade: only the two controller aggregators, both returning empty vectors |## Compile-time gate (`skills` feature)`pub mod runtime;` in `skills/mod.rs` stays ungated because it is a facade.`agent`, `ops`, `run_machinery`, `schemas`, and `tools` are compiled onlywith the default-on `skills` Cargo feature (the same gate as `skills` and-`skills::catalog`). With the feature off, `stub.rs` supplies+`skills::catalog`). With the feature off, [`stub.rs`](./stub.rs) supplies`all_skill_runtime_registered_controllers` and`all_skill_runtime_controller_schemas` as empty lists, so the namespace isabsent from `/schema` and unknown over `/rpc`. Every other caller of the rundiff --git a/crates/openhuman-core/src/skills/webhooks/README.md b/crates/openhuman-core/src/skills/webhooks/README.mdindex 068a0ed899..f0b1e95bf8 100644--- a/crates/openhuman-core/src/skills/webhooks/README.md+++ b/crates/openhuman-core/src/skills/webhooks/README.md@@ -21,13 +21,13 @@ Client-side webhook **tunnel routing** for OpenHuman. The backend provisions and| `crates/openhuman-core/src/skills/webhooks/types.rs` | Serde domain types: `WebhookRequest`, `WebhookResponseData`, `TunnelRegistration`, `WebhookActivityEntry`, `WebhookDebugLogEntry`, debug result wrappers, `WebhookDebugEvent`. || `crates/openhuman-core/src/skills/webhooks/router.rs` | `WebhookRouter` — route map + ownership rules, disk persistence (generation-counter, spawn_blocking offload), bounded debug log ring (`MAX_DEBUG_LOG_ENTRIES = 250`), debug-event broadcast channel. || `crates/openhuman-core/src/skills/webhooks/ops.rs` | RPC handler logic returning `RpcOutcome<T>`: local routing ops (`list_registrations`, `list_logs`, `clear_logs`, `register_echo`, `unregister_echo`, `register_agent`, `trigger_agent`), and `build_echo_response`. |-| `crates/openhuman-core/src/skills/webhooks/schemas.rs` | Controller schemas + `handle_*` fns + `all_controller_schemas` / `all_registered_controllers`; deserializes params, delegates to `ops.rs`. |+| `crates/openhuman-core/src/skills/webhooks/schemas.rs` | Controller schemas + `handle_*` fns + `all_controller_schemas` / `all_registered_controllers`; deserializes params, delegates to [`ops.rs`](./ops.rs). || `crates/openhuman-core/src/skills/webhooks/bus.rs` | `WebhookRequestSubscriber` (`EventHandler`): the incoming-request routing flow; helpers `decode_webhook_body`, `run_agent_trigger`, `build_agent_response`. || `crates/openhuman-core/src/skills/webhooks/{webhooks_tests,bus_tests,ops_tests,router_tests,schemas_tests,types_tests}.rs` | Test suites, each pulled into its sibling source file via `#[cfg(test)] #[path = "..."] mod tests;` (no inline test modules). |## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- `WebhookRouter` (from `router`).- `all_webhooks_controller_schemas`, `all_webhooks_registered_controllers` (from `schemas`).@@ -57,7 +57,7 @@ None. This domain owns no `tools.rs` agent tools.## Events-Subscriber (in `bus.rs`): `WebhookRequestSubscriber`, with `name() = "webhook::request_handler"` and `domains() = ["webhook"]`. Registered in `register_domain_subscribers()` (`crates/openhuman-core/src/core/runtime/subscribers.rs`, called from `bootstrap_core_runtime()`), gated on the `Skills` domain group being enabled (`plan.skills`) and installed at most once per process; `channels/runtime/startup/start_channels.rs` deliberately does not register it, to avoid double-registration when both startup paths run in the same process.+Subscriber (in [`bus.rs`](./bus.rs)): `WebhookRequestSubscriber`, with `name() = "webhook::request_handler"` and `domains() = ["webhook"]`. Registered in `register_domain_subscribers()` (`crates/openhuman-core/src/core/runtime/subscribers.rs`, called from `bootstrap_core_runtime()`), gated on the `Skills` domain group being enabled (`plan.skills`) and installed at most once per process; `channels/runtime/startup/start_channels.rs` deliberately does not register it, to avoid double-registration when both startup paths run in the same process.- Subscribes: `DomainEvent::WebhookIncomingRequest` (published by the socket transport in `socket/event_handlers.rs`).- Publishes: `DomainEvent::WebhookRegistered` / `WebhookUnregistered` (from the router on registration changes; `WebhookUnregistered`, the `registration_changed` debug event and the route re-persist all fire only when a registration was actually removed. Unregistering an absent tunnel is a silent no-op that returns `Ok(false)`, see #6091), `DomainEvent::WebhookReceived` (when routed to a target), `DomainEvent::WebhookProcessed` (always, with status/elapsed/error).diff --git a/crates/openhuman-core/src/test_support/README.md b/crates/openhuman-core/src/test_support/README.mdindex a020c23d1a..97a1964e66 100644--- a/crates/openhuman-core/src/test_support/README.md+++ b/crates/openhuman-core/src/test_support/README.md@@ -61,7 +61,7 @@ the renderer also starts blank.### Introspection-The `introspect.rs` functions read state and change nothing.+The [`introspect.rs`](./introspect.rs) functions read state and change nothing.`workspace_root` reports `Config::workspace_dir` and whether it exists.`list_workspace_files` walks the tree with an explicit stack (no asyncrecursion), defaulting to depth 2, clamped to 6, and stopping at 2000 entries@@ -78,7 +78,7 @@ reads inside the workspace:1. A lexical component walk rejects `..` and any root or prefix component(`C:\`, `\\?\`) before touching the filesystem. `./` is allowed.-2. The workspace root is canonicalized (on macOS `/var` resolves to+2. The workspace root is canonicalized (on macOS [`/var`](.//var) resolves to`/private/var`), the relative path is joined onto it, and the candidate iscanonicalized and checked with `starts_with`. This second step catches asymlink pointing out of the workspace, which the lexical walk cannot see.@@ -92,21 +92,21 @@ listings never follow a link out of the workspace.| Path | What it does || --- | --- |-| `mod.rs` | Declares `introspect`, `rpc` and `schemas`; re-exports `all_test_support_controller_schemas` and `all_test_support_registered_controllers`. |-| `rpc.rs` | `reset()`, the `OPENHUMAN_E2E_MODE` guard and `ResetSummary`. |-| `introspect.rs` | The read-only probes, their result types, `resolve_workspace_relative` and `walk_dir`. |-| `schemas.rs` | Controller schemas and thin `handle_*` functions that call `rpc` or `introspect` and serialize with `Outcome::into_cli_compatible_json`. |+| [`mod.rs`](./mod.rs) | Declares `introspect`, `rpc` and `schemas`; re-exports `all_test_support_controller_schemas` and `all_test_support_registered_controllers`. |+| [`rpc.rs`](./rpc.rs) | `reset()`, the `OPENHUMAN_E2E_MODE` guard and `ResetSummary`. |+| [`introspect.rs`](./introspect.rs) | The read-only probes, their result types, `resolve_workspace_relative` and `walk_dir`. |+| [`schemas.rs`](./schemas.rs) | Controller schemas and thin `handle_*` functions that call `rpc` or `introspect` and serialize with `Outcome::into_cli_compatible_json`. |## Key types and entry points-- `rpc::reset() -> Result<Outcome<ResetSummary>, String>` (`rpc.rs`).+- `rpc::reset() -> Result<Outcome<ResetSummary>, String>` ([`rpc.rs`](./rpc.rs)).- `introspect::workspace_root`, `list_workspace_files(rel_root, max_depth)`,`read_workspace_file(rel_path, max_bytes)`, `in_flight_chats`,`wallet_prepared_quotes` (`introspect.rs`).- Result types: `WorkspaceRoot`, `ListEntry` and `ListResult`,`ReadFileResult`, `InFlightEntryView` and `InFlightResult`,`PreparedQuotesResult` (`introspect.rs`).-- `all_test_support_registered_controllers()` (`mod.rs`), which+- `all_test_support_registered_controllers()` ([`mod.rs`](./mod.rs)), which`core/all.rs` pushes under `DomainGroup::Platform`.`all_test_support_controller_schemas()` has no consumer outside this module.@@ -149,7 +149,7 @@ The E2E runner, its helpers and the token-file reader live under## Tests-`rpc_tests.rs` covers the `OPENHUMAN_E2E_MODE` guard. `introspect_tests.rs`+[`rpc_tests.rs`](./rpc_tests.rs) covers the `OPENHUMAN_E2E_MODE` guard. [`introspect_tests.rs`](./introspect_tests.rs)covers `resolve_workspace_relative` (`..` with missing and existing targets,leading `/` and `./`, and on Unix a symlink out of the workspace); the RPCsthemselves are exercised by the E2E specs.diff --git a/crates/openhuman-core/src/threads/README.md b/crates/openhuman-core/src/threads/README.mdindex d102720d12..a5d9c63b39 100644--- a/crates/openhuman-core/src/threads/README.md+++ b/crates/openhuman-core/src/threads/README.md@@ -63,7 +63,7 @@ Every store entry point is synchronous and takes `parking_lot` locks acrossfsync'd file I/O. Calling one straight from an `async fn` parks a tokio workerthread for the whole wait, so all request paths go through`store::blocking`, which runs each call on the blocking pool. Responses are-wrapped in `ApiEnvelope` by `ops/support.rs` (`envelope`, `counts`), which also+wrapped in `ApiEnvelope` by [`ops/support.rs`](./ops/support.rs) (`envelope`, `counts`), which alsoresolves the workspace dir and converts between store types and wire types.### Deleting and purging@@ -79,7 +79,7 @@ Purge does the same for every thread and calls the parse-independent### Edit and regenerate-`ops/edit.rs` implements `threads.edit_message` and `threads.regenerate`. Both+[`ops/edit.rs`](./ops/edit.rs) implements `threads.edit_message` and `threads.regenerate`. Bothcancel the thread's in-flight turn with `web_chat::cancel_chat`, fork thesession transcript at a cut point, truncate the message log to match(`delete_after`), drop the turn snapshots for every turn the fork removed,@@ -103,7 +103,7 @@ The cut point comes from the reply id bridge described above:A new thread starts with a placeholder title. As soon as the user sends, aninterim title derived from the first message is written(`support::update_thread_with_fallback_title`). `thread_generate_title`-(`ops/title_generation.rs`) later asks the model for a summary title using the+([`ops/title_generation.rs`](./ops/title_generation.rs)) later asks the model for a summary title using the`tinyagents_harness::title` helpers. `is_replaceable_title` only allows it toreplace the placeholder, or the interim title during the first exchange;anything the user typed is left alone. Logs use the `[threads:title]` prefix@@ -134,7 +134,7 @@ snapshot from an unclean shutdown is marked the same way. The### Channel persistence-`store::register_conversation_persistence_subscriber` (`store/bus.rs`)+`store::register_conversation_persistence_subscriber` ([`store/bus.rs`](./store/bus.rs))subscribes to `DomainEvent::ChannelMessage*` on the core bus and mirrorsinbound and processed channel turns into the store, using`conversation_history_key` for the thread id. It is registered from@@ -155,34 +155,34 @@ label from threads and renames `welcome*` session transcripts to| Path | What it does || --- | --- |-| `mod.rs` | Module declarations, re-exports of the RPC models, error type, controller aggregators and the welcome migration. |-| `rpc_models.rs` | Serde request and response types for the namespace (`ConversationThreadSummary`, `ConversationMessageRecord`, the `*Request` types). |-| `error.rs` | `ThreadsError` (`NotFound`, `Message`) and its structured RPC error with kind `ThreadNotFound`, so the frontend can drop a stale thread. |-| `ops.rs` | Re-exports the operations from `ops/`. |-| `ops/crud.rs` | List, upsert, create, message list/append/update, `delete_after`, delete, labels, title, and `transcript_search`. `message_append` enforces the multimodal attachment limits for user messages. |-| `ops/edit.rs` | Edit and regenerate (see above). |-| `ops/title_generation.rs` | Model-generated titles and the replaceable-title rule. |-| `ops/working_dir.rs` | Validating and binding a thread's working folder. |-| `ops/search.rs` | `threads.search`: cross-thread search with snippets for the global `Cmd`/`Ctrl+K` search. |-| `ops/transcript.rs` | `threads.transcript_get`: paginated display items from `tinyagents_session::transcript::view`. |-| `ops/usage.rs` | `threads.token_usage`: token and cost totals from `transcript::spend::thread_spend`, re-priced, with per-sub-agent rows and the last turn's tokens for the context gauge. |-| `ops/live_state.rs` | `threads.goal_get` and `threads.todos_get`: one-shot reads of the thread's agent goal and todo list for hydration on load. |-| `ops/turn_state_ops.rs` | `threads.turn_state_*` over the snapshot store. |-| `ops/purge.rs` | Workspace-wide purge. |-| `ops/support.rs` | Envelopes, workspace resolution, `run_to_completion`, type conversions, fallback titles. |-| `schemas/` | `schema_defs.rs` (controller schemas), `handlers.rs` (param parsing, thin handlers), `registry.rs` (the controller list). |-| `store/` | Re-export of `tinyagents_session::threads`, the `blocking` wrappers and the channel bus subscriber. See [store/README.md](store/README.md). |-| `turn_state/` | `mirror/observe.rs` (progress projection) and `rpc_types.rs` (turn-state RPC payloads). |-| `welcome_migration.rs` | The one-shot welcome-agent migration. |+| [`mod.rs`](./mod.rs) | Module declarations, re-exports of the RPC models, error type, controller aggregators and the welcome migration. |+| [`rpc_models.rs`](./rpc_models.rs) | Serde request and response types for the namespace (`ConversationThreadSummary`, `ConversationMessageRecord`, the `*Request` types). |+| [`error.rs`](./error.rs) | `ThreadsError` (`NotFound`, `Message`) and its structured RPC error with kind `ThreadNotFound`, so the frontend can drop a stale thread. |+| [`ops.rs`](./ops.rs) | Re-exports the operations from [`ops/`](./ops/). |+| [`ops/crud.rs`](./ops/crud.rs) | List, upsert, create, message list/append/update, `delete_after`, delete, labels, title, and `transcript_search`. `message_append` enforces the multimodal attachment limits for user messages. |+| [`ops/edit.rs`](./ops/edit.rs) | Edit and regenerate (see above). |+| [`ops/title_generation.rs`](./ops/title_generation.rs) | Model-generated titles and the replaceable-title rule. |+| [`ops/working_dir.rs`](./ops/working_dir.rs) | Validating and binding a thread's working folder. |+| [`ops/search.rs`](./ops/search.rs) | `threads.search`: cross-thread search with snippets for the global `Cmd`/`Ctrl+K` search. |+| [`ops/transcript.rs`](./ops/transcript.rs) | `threads.transcript_get`: paginated display items from `tinyagents_session::transcript::view`. |+| [`ops/usage.rs`](./ops/usage.rs) | `threads.token_usage`: token and cost totals from `transcript::spend::thread_spend`, re-priced, with per-sub-agent rows and the last turn's tokens for the context gauge. |+| [`ops/live_state.rs`](./ops/live_state.rs) | `threads.goal_get` and `threads.todos_get`: one-shot reads of the thread's agent goal and todo list for hydration on load. |+| [`ops/turn_state_ops.rs`](./ops/turn_state_ops.rs) | `threads.turn_state_*` over the snapshot store. |+| [`ops/purge.rs`](./ops/purge.rs) | Workspace-wide purge. |+| [`ops/support.rs`](./ops/support.rs) | Envelopes, workspace resolution, `run_to_completion`, type conversions, fallback titles. |+| [`schemas/`](./schemas/) | `schema_defs.rs` (controller schemas), `handlers.rs` (param parsing, thin handlers), `registry.rs` (the controller list). |+| [`store/`](./store/) | Re-export of `tinyagents_session::threads`, the `blocking` wrappers and the channel bus subscriber. See [store/README.md](store/README.md). |+| [`turn_state/`](./turn_state/) | `mirror/observe.rs` (progress projection) and `rpc_types.rs` (turn-state RPC payloads). |+| [`welcome_migration.rs`](./welcome_migration.rs) | The one-shot welcome-agent migration. |## Key types and entry points-- `store::blocking::*` (`store/blocking.rs`): the async API every caller in the core should use for thread and message storage.-- `ConversationThread`, `ConversationMessage` (`store/mod.rs`): the store types. `ConversationMessage` and `ConversationMessagePatch` are host names for `ThreadMessage` and `ThreadMessagePatch`.-- `ConversationThreadSummary`, `ConversationMessageRecord` (`rpc_models.rs`): their wire forms.-- `ThreadsError` (`error.rs`): the error type for handlers that can report a missing thread.-- `ops::token_usage` (`ops/usage.rs`): also called by `agent/context_breakdown.rs`.-- `ObserveProgress` (`turn_state/mirror/observe.rs`): the trait `web_chat::progress_bridge` uses to feed the mirror.+- `store::blocking::*` ([`store/blocking.rs`](./store/blocking.rs)): the async API every caller in the core should use for thread and message storage.+- `ConversationThread`, `ConversationMessage` ([`store/mod.rs`](./store/mod.rs)): the store types. `ConversationMessage` and `ConversationMessagePatch` are host names for `ThreadMessage` and `ThreadMessagePatch`.+- `ConversationThreadSummary`, `ConversationMessageRecord` ([`rpc_models.rs`](./rpc_models.rs)): their wire forms.+- `ThreadsError` ([`error.rs`](./error.rs)): the error type for handlers that can report a missing thread.+- `ops::token_usage` ([`ops/usage.rs`](./ops/usage.rs)): also called by `agent/context_breakdown.rs`.+- `ObserveProgress` ([`turn_state/mirror/observe.rs`](./turn_state/mirror/observe.rs)): the trait `web_chat::progress_bridge` uses to feed the mirror.## RPC surface@@ -230,8 +230,8 @@ todo-editing surface here.## TestsTests sit beside their modules as `*_tests.rs` (for example-`ops/edit_tests.rs`, `ops/search_tests.rs`, `store/bus_tests.rs`,-`transcript_host_tests.rs`). Tests that read the process config serialize on+[`ops/edit_tests.rs`](./ops/edit_tests.rs), [`ops/search_tests.rs`](./ops/search_tests.rs), [`store/bus_tests.rs`](./store/bus_tests.rs),+[`transcript_host_tests.rs`](./transcript_host_tests.rs)). Tests that read the process config serialize on`crate::config::TEST_ENV_LOCK` and point `OPENHUMAN_WORKSPACE` at a temp dir.Run them with `cargo test -p openhuman threads::` or`pnpm debug rust threads::`. The store's own tests live indiff --git a/crates/openhuman-core/src/threads/store/README.md b/crates/openhuman-core/src/threads/store/README.mdindex 73464daf50..fd3183acd2 100644--- a/crates/openhuman-core/src/threads/store/README.md+++ b/crates/openhuman-core/src/threads/store/README.md@@ -10,14 +10,14 @@ bus subscriber (see [`memory/`](../../memory/)).## Parts-- `mod.rs`: re-exports the store API. `ConversationMessage` and+- [`mod.rs`](./mod.rs): re-exports the store API. `ConversationMessage` and`ConversationMessagePatch` are host-spelled aliases of the crate's`ThreadMessage` / `ThreadMessagePatch`; type names never reach the disk.-- `blocking.rs`: `spawn_blocking` wrappers around every store entry point.+- [`blocking.rs`](./blocking.rs): `spawn_blocking` wrappers around every store entry point.The store is synchronous and takes `parking_lot` locks across fsync'd fileI/O, so request paths must go through `blocking` rather than calling it froman `async fn` (#5156).-- `bus.rs`: the `core::bus` subscriber+- [`bus.rs`](./bus.rs): the `core::bus` subscriber(`register_conversation_persistence_subscriber`) that mirrors inbound andprocessed channel turns into the store, so channel transcripts (Slack,Telegram, ...) persist alongside the UI's own threads.@@ -35,5 +35,5 @@ Unchanged from before the move:## Tests-`blocking_tests.rs` and `bus_tests.rs` cover the wiring; the store's own tests+[`blocking_tests.rs`](./blocking_tests.rs) and [`bus_tests.rs`](./bus_tests.rs) cover the wiring; the store's own testslive in `vendor/tinyagents/crates/tinyagents-session/src/threads/`.diff --git a/crates/openhuman-core/src/tools/README.md b/crates/openhuman-core/src/tools/README.mdindex 3215f1fb68..1b4a2d1796 100644--- a/crates/openhuman-core/src/tools/README.md+++ b/crates/openhuman-core/src/tools/README.md@@ -10,14 +10,14 @@ allowlist of tool-like operations is also exposed over JSON-RPC for thedesktop shell.Domain-owned tools (memory, cron, flows, wallet, Composio, skills, voice,-agent sub-dispatch) live in their own domains. `mod.rs` re-exports them, so a+agent sub-dispatch) live in their own domains. [`mod.rs`](./mod.rs) re-exports them, so asingle `crate::tools::*` import reaches the full set.## How it works### Building a session's registry-`ops::all_tools_with_runtime` (`ops.rs`) is the one place a full registry is+`ops::all_tools_with_runtime` ([`ops.rs`](./ops.rs)) is the one place a full registry isassembled. It is called by the session builder(`agent/session_host/builder/factory.rs`) and at channel startup(`channels/runtime/startup/start_channels.rs`). The order of work:@@ -90,16 +90,16 @@ by `mcp/registry/action_tool.rs`.Several layers narrow the registry before a schema is sent:-- `user_filter.rs` maps UI toggle ids to tool names (`TOOL_FAMILIES`). A+- [`user_filter.rs`](./user_filter.rs) maps UI toggle ids to tool names (`TOOL_FAMILIES`). Adefault-on family missing from a stale snapshot is kept; a default-offfamily (installers, mutators, service lifecycle) is stripped unless the userenabled it. Tools no family covers are always kept.-- `toolpacks/` keeps a pack's tools constructed but unadvertised. The agent+- [`toolpacks/`](./toolpacks/) keeps a pack's tools constructed but unadvertised. The agentsees `use_skill` and a short pack index instead of the real schemas. See[toolpacks/README.md](toolpacks/README.md).-- `ToolExposure::Deferred` tools (`impl/meta/deferred.rs` holds the host+- `ToolExposure::Deferred` tools ([`impl/meta/deferred.rs`](./impl/meta/deferred.rs) holds the hosthalf) are left off the wire until found with `tool_search`.-- `agent_policy/` classifies every tool against the channel's permission+- [`agent_policy/`](./agent_policy/) classifies every tool against the channel's permissionceiling into allow, require-approval, deny or hide, and renders theprompt's tool-boundary section. See [agent_policy/README.md](agent_policy/README.md).@@ -113,39 +113,39 @@ tier, the command class and the approval gate; the tool itself then checkspolicy is off by default (see [`../security/README.md`](../security/README.md)),so on a default install the path floor and the sandbox do the bounding.Process-spawning tools in sandboxed mode route through-[`../sandbox/`](../sandbox/README.md). Each call is bounded by `timeout/`, and-a failure is classified by `status/` into a plain-language cause and next+[`../sandbox/`](../sandbox/README.md). Each call is bounded by [`timeout/`](./timeout/), and+a failure is classified by [`status/`](./status/) into a plain-language cause and nextstep.## Layout| Path | What it does || --- | --- |-| `mod.rs` | Export hub: submodules, re-exports of built-in and domain tools, the `tinytools` vocabulary, and the `all_tools_*` controller pair. |-| `ops.rs` | Registry assembly (`default_tools*`, `all_tools*`), all config and feature gating, and `tool_group`. |-| `orchestrator_tools.rs` | Per-subagent `delegate_*` tools and deferred Composio action expansion. |-| `user_filter.rs` | `filter_tools_by_user_preference` and the UI toggle to tool-name map. |-| `host_extensions.rs` | Readers over `tinytools`' erased host-extension slots: `pack_registry_handle`, `delegation_target`, `tool_call_id`. |-| `schemas.rs`, `schemas/` | The `tools.*` controllers: `registry.rs` (schemas and dispatch), `composio.rs`, `web_search.rs`, `apify.rs`, `linkedin.rs`. |+| [`mod.rs`](./mod.rs) | Export hub: submodules, re-exports of built-in and domain tools, the `tinytools` vocabulary, and the `all_tools_*` controller pair. |+| [`ops.rs`](./ops.rs) | Registry assembly (`default_tools*`, `all_tools*`), all config and feature gating, and `tool_group`. |+| [`orchestrator_tools.rs`](./orchestrator_tools.rs) | Per-subagent `delegate_*` tools and deferred Composio action expansion. |+| [`user_filter.rs`](./user_filter.rs) | `filter_tools_by_user_preference` and the UI toggle to tool-name map. |+| [`host_extensions.rs`](./host_extensions.rs) | Readers over `tinytools`' erased host-extension slots: `pack_registry_handle`, `delegation_target`, `tool_call_id`. |+| [`schemas.rs`](./schemas.rs), [`schemas/`](./schemas/) | The `tools.*` controllers: `registry.rs` (schemas and dispatch), `composio.rs`, `web_search.rs`, `apify.rs`, `linkedin.rs`. || [`impl/`](impl/README.md) | Built-in tool families: `filesystem/` (the `FsGate` adapter only; the tools are `tinytools_std::filesystem`), `browser/`, `system/`, `network/`, `meta/`, and the `documents`-gated `document/` and `presentation/`. || [`toolpacks/`](toolpacks/README.md) | On-demand tool disclosure (`use_skill`, pack catalog, guides) and `ToolGroups` / `GroupMode`. || [`agent_policy/`](agent_policy/README.md) | Per-session tool boundary against a channel's permission ceiling. || [`registry/`](registry/README.md) | Read-only discovery registry across MCP stdio, controller and connected MCP tools, plus policy diagnostics. || [`timeout/`](timeout/README.md) | Process-wide tool timeout and process-group kill helpers. |-| `status/` | Tool-call lifecycle state and failure classification (`classify`, `describe`, `tool_execution_error`). |+| [`status/`](./status/) | Tool-call lifecycle state and failure classification (`classify`, `describe`, `tool_execution_error`). |Where the built-in tools come from:| Tools | Source || --- | --- |-| `file_read`, `file_write`, `edit`, `apply_patch`, `grep`, `glob`, `list`, `read_diff`, `csv_export`, `git_operations`, `run_linter`, `run_tests`, `image_info`, `read_workspace_state` | `tinytools_std::filesystem`, gated by `impl/filesystem/gate.rs` |+| `file_read`, `file_write`, `edit`, `apply_patch`, `grep`, `glob`, `list`, `read_diff`, `csv_export`, `git_operations`, `run_linter`, `run_tests`, `image_info`, `read_workspace_state` | `tinytools_std::filesystem`, gated by [`impl/filesystem/gate.rs`](./impl/filesystem/gate.rs) || `detect_tools`, `curl`, `pushover` | `tinytools_std` |-| `http_request`, `web_fetch` | `tinytools_std::network`, wired with host limits, TinyJuice extraction and the x402 handler in `impl/network/host.rs` |+| `http_request`, `web_fetch` | `tinytools_std::network`, wired with host limits, TinyJuice extraction and the x402 handler in [`impl/network/host.rs`](./impl/network/host.rs) || `current_time`, `resolve_time`, `ask_user_clarification`, `wait`, `wait_loop` | `tinyagents_harness::tools` |-| `shell`, `node_exec`, `npm_exec`, `python_exec`, `install_tool`, `schedule`, `proxy_config`, `lsp`, `update_check`, `update_apply`, `retrieve_tool_output` | `impl/system/` |-| `gitbooks_search`, `gitbooks_get_page`, `gmail_unsubscribe`, `mcp_list_servers`, `mcp_list_tools`, `mcp_call_tool`, `mcp_<server>_<tool>` | `impl/network/` (MCP tools behind `mcp`) |-| `browser`, `browser_open` | `impl/browser/` (behind `modules`) |-| `generate_document`, `generate_presentation` | `impl/document/`, `impl/presentation/` (behind `documents`) |+| `shell`, `node_exec`, `npm_exec`, `python_exec`, `install_tool`, `schedule`, `proxy_config`, `lsp`, `update_check`, `update_apply`, `retrieve_tool_output` | [`impl/system/`](./impl/system/) |+| `gitbooks_search`, `gitbooks_get_page`, `gmail_unsubscribe`, `mcp_list_servers`, `mcp_list_tools`, `mcp_call_tool`, `mcp_<server>_<tool>` | [`impl/network/`](./impl/network/) (MCP tools behind `mcp`) |+| `browser`, `browser_open` | [`impl/browser/`](./impl/browser/) (behind `modules`) |+| `generate_document`, `generate_presentation` | [`impl/document/`](./impl/document/), [`impl/presentation/`](./impl/presentation/) (behind `documents`) || `web_search` and the other search roles | `crate::search::build_search_tools` |## Key types and entry points@@ -183,7 +183,7 @@ else is agent-only.| `openhuman.tools_searxng_search` | The `search` role pinned to a self-hosted SearXNG (requires SearXNG enabled). || `openhuman.tools_apify_linkedin_scrape` | Apify LinkedIn profile scrape, returning raw JSON and rendered markdown. |-`registry/` registers a second namespace, `tool_registry` (`list`, `get`,+[`registry/`](./registry/) registers a second namespace, `tool_registry` (`list`, `get`,`diagnostics`). Dotted ids such as `tools.web_search` in that registry are`tool_id`s, not RPC methods.@@ -200,7 +200,7 @@ else is agent-only.(see [`../search/README.md`](../search/README.md)); the module itself is`tinysearch`.- New domain tools go in the owning domain's `tools.rs` and are re-exported- through `mod.rs`. Only cross-cutting families belong under `impl/`.+ through `mod.rs`. Only cross-cutting families belong under [`impl/`](./impl/).- This folder has no persistence and no event-bus subscriber. Approvalrouting reads `Tool::external_effect_with_args`; the gate itself is`security/approval/`.diff --git a/crates/openhuman-core/src/tools/agent_policy/README.md b/crates/openhuman-core/src/tools/agent_policy/README.mdindex 24d485bb3f..8c082a0237 100644--- a/crates/openhuman-core/src/tools/agent_policy/README.md+++ b/crates/openhuman-core/src/tools/agent_policy/README.md@@ -20,13 +20,13 @@ Not to be confused with `crate::agent::tool_policy` (the generic `ToolPolicy` pr| `crates/openhuman-core/src/tools/agent_policy/mod.rs` | Export-only: module docstring + `mod` decls + `pub use` re-exports of the engine, prompt renderer, and types. || `crates/openhuman-core/src/tools/agent_policy/types.rs` | Serde-free domain types: `TaskRiskLevel`, `TaskProfile`, `ToolPolicyAction`, `ToolPolicyDecision`, `ToolCapability`, `ToolPolicySession` (with query helpers). Holds the private `NO_TOOLS_ALLOWED_SENTINEL`. || `crates/openhuman-core/src/tools/agent_policy/engine.rs` | `ToolPolicyEngine::build_session` / `build_session_from_refs`: the classification logic; private `permission_for_channel` / `parse_permission_level` helpers. |-| `crates/openhuman-core/src/tools/agent_policy/engine_tests.rs` | Engine tests, attached via `#[path]` from `engine.rs`. |+| `crates/openhuman-core/src/tools/agent_policy/engine_tests.rs` | Engine tests, attached via `#[path]` from [`engine.rs`](./engine.rs). || `crates/openhuman-core/src/tools/agent_policy/prompt.rs` | `render_tool_policy_boundary` + `TOOL_POLICY_BOUNDARY_HEADING`; private UTF-8-safe `truncate_utf8`. |-| `crates/openhuman-core/src/tools/agent_policy/prompt_tests.rs` | Prompt-rendering tests, attached via `#[path]` from `prompt.rs`. |+| `crates/openhuman-core/src/tools/agent_policy/prompt_tests.rs` | Prompt-rendering tests, attached via `#[path]` from [`prompt.rs`](./prompt.rs). |## Public surface-Re-exported from `mod.rs`:+Re-exported from [`mod.rs`](./mod.rs):- `ToolPolicyEngine::build_session(agent_id, channel, entrypoint, channel_permissions: &HashMap<String,String>, tools: &[Box<dyn Tool>], visible_tool_names: &HashSet<String>) -> ToolPolicySession`.- `ToolPolicyEngine::build_session_from_refs(..., tools: &[&dyn Tool], ...)`: same classification over borrowed tools so the harness can classify its durable registry and its synthesized delegate tools together; `build_session` delegates to it.diff --git a/crates/openhuman-core/src/tools/impl/README.md b/crates/openhuman-core/src/tools/impl/README.mdindex 0ee5496552..f67f892194 100644--- a/crates/openhuman-core/src/tools/impl/README.md+++ b/crates/openhuman-core/src/tools/impl/README.md@@ -11,9 +11,9 @@ domain capability.`tools/mod.rs` mounts this directory as `#[path = "impl/mod.rs"] pub(crate) modimplementations` (`impl` is a keyword) and glob re-exports it, so tool structs-are imported as `crate::tools::*`. `impl/mod.rs` gates `document/` and-`presentation/` behind the `documents` Cargo feature; the other five families-compile unconditionally. `meta/` is declared but not glob re-exported, so its+are imported as `crate::tools::*`. `impl/mod.rs` gates [`document/`](./document/) and+[`presentation/`](./presentation/) behind the `documents` Cargo feature; the other five families+compile unconditionally. [`meta/`](./meta/) is declared but not glob re-exported, so itsitems are reached as `crate::tools::implementations::meta::...`.See [`../README.md`](../README.md) for the registry, policy, and RPC layer this@@ -29,22 +29,22 @@ tested but no production assembly site constructs it today.| Family | Tools | Registration gate || --- | --- | --- |-| `system/` | `ShellTool`, `NodeExecTool`, `NpmExecTool`, `PythonExecTool`, `InstallToolTool`, `DetectToolsTool` (from `tinytools_std`), `CurrentTimeTool` and `ResolveTimeTool` (imported directly from `tinyagents_harness::tools` at their call sites; no local copy), `ScheduleTool`, `ProxyConfigTool`, `PushoverTool`, `LspTool`, `ToolStatsTool`, `UpdateCheckTool`, `UpdateApplyTool`, `InsertSqlRecordTool`, `WorkspaceStateTool`, `RetrieveToolOutputTool` (from `tinyjuice::host`, wired by `retrieve_tool_output_tool`); shell failure rendering lives in `tinytools_std::command_output` | `node_exec`/`npm_exec` and `shell`'s PATH injection need the `runtime-node` Cargo feature plus `node.enabled`; `python_exec` needs `runtime_python.enabled`; `LspTool` needs `OPENHUMAN_LSP_ENABLED` (`lsp_capability_enabled`); `ToolStatsTool` needs `learning.enabled` and `learning.tool_tracking_enabled`; `InsertSqlRecordTool` is exported, not registered; the rest are always registered |-| `filesystem/` | Host adapter only: `SecurityPolicy` implements `tinytools_std::filesystem::FsGate`. The tools (`FileReadTool`, `FileWriteTool`, `EditFileTool`, `ApplyPatchTool`, `GrepTool`, `GlobTool`, `ListFilesTool`, `ReadDiffTool`, `CsvExportTool`, `GitOperationsTool`, `RunLinterTool`, `RunTestsTool`, `UpdateMemoryMdTool`) live in `tinytools_std::filesystem` and are imported directly by `tools/ops.rs` | always registered, except `ReadDiffTool`, `RunLinterTool`, and `RunTestsTool`, which are exported, not registered |-| `browser/` | `BrowserTool` (TinyComputer browser members and tasks), `BrowserOpenTool` (simple TinyComputer navigation), `ImageInfoTool` | Both browser tools need `browser.enabled` and the `modules` feature, and are deferred until `tool_search`; `ImageInfoTool` remains direct. Browser navigation uses the shared `http_request.allowed_domains` policy, and the checksum-pinned TinyComputer release module. |-| `network/` | `HttpRequestTool`, `WebFetchTool`, `CurlTool`, `GitbooksSearchTool`, `GitbooksGetPageTool`, `GmailUnsubscribeTool`, and under the `mcp` Cargo feature `McpListServersTool`, `McpListToolsTool`, `McpCallTool`; `url_guard.rs` is the shared SSRF/allowlist validator, not a tool | `http_request`, `web_fetch`, `curl`, `gmail_unsubscribe` always registered; `gitbooks_*` need `gitbooks.enabled` and, when the active profile sets an `mcp_allowlist`, an entry named `gitbooks`; `mcp_list_servers`/`mcp_list_tools`/`mcp_call_tool` register only when the static `[[mcp_client.servers]]` registry (after the profile allowlist) is non-empty |-| `document/` (feature `documents`) | `DocumentTool` (`generate_document`) | always registered when compiled. Builds `.docx` bytes via the pure-Rust `engine` module (`docx-rs`, no subprocess) inside `spawn_blocking` + `tokio::time::timeout`; allocates the artifact with `agent::artifacts::create_artifact` (kind `Document`), persists `args.json` next to it for the failed-card Retry path, then `finalize_artifact` or `fail_artifact` |-| `presentation/` (feature `documents`) | `PresentationTool` (`generate_presentation`) | always registered when compiled. Same shape as `document/` with `ppt-rs` producing `.pptx` and kind `Presentation` |-| `meta/` | `deferred` (`strip_deferred_from_visible`, `deferred_tool_names`, the `TOOL_SEARCH_NAME` belt opt-in constant); `collapse` helpers (`resolve`, `merge_action_schemas`, `args_without_action`, `strictest_permission`, `any_external_effect`, `unknown_action_message`, `CollapsedAction`) | not registered: `deferred` is the host's half of `ToolExposure::Deferred`: the session builder (`agent/session_host/builder/builder_build.rs`) uses it to split a belt into the advertised set and the still-registered deferred set, and the tinyagents harness advertises its intrinsic `tool_search` / `tool_call` bridge over the latter (ranked per `agent/tinyagents/discovery`). The `collapse` helpers are used by `cron/tools/collapsed.rs` and `memory/tools/collapsed.rs` to merge a multi-action tool's per-action schemas and permissions into one entry |+| [`system/`](./system/) | `ShellTool`, `NodeExecTool`, `NpmExecTool`, `PythonExecTool`, `InstallToolTool`, `DetectToolsTool` (from `tinytools_std`), `CurrentTimeTool` and `ResolveTimeTool` (imported directly from `tinyagents_harness::tools` at their call sites; no local copy), `ScheduleTool`, `ProxyConfigTool`, `PushoverTool`, `LspTool`, `ToolStatsTool`, `UpdateCheckTool`, `UpdateApplyTool`, `InsertSqlRecordTool`, `WorkspaceStateTool`, `RetrieveToolOutputTool` (from `tinyjuice::host`, wired by `retrieve_tool_output_tool`); shell failure rendering lives in `tinytools_std::command_output` | `node_exec`/`npm_exec` and `shell`'s PATH injection need the `runtime-node` Cargo feature plus `node.enabled`; `python_exec` needs `runtime_python.enabled`; `LspTool` needs `OPENHUMAN_LSP_ENABLED` (`lsp_capability_enabled`); `ToolStatsTool` needs `learning.enabled` and `learning.tool_tracking_enabled`; `InsertSqlRecordTool` is exported, not registered; the rest are always registered |+| [`filesystem/`](./filesystem/) | Host adapter only: `SecurityPolicy` implements `tinytools_std::filesystem::FsGate`. The tools (`FileReadTool`, `FileWriteTool`, `EditFileTool`, `ApplyPatchTool`, `GrepTool`, `GlobTool`, `ListFilesTool`, `ReadDiffTool`, `CsvExportTool`, `GitOperationsTool`, `RunLinterTool`, `RunTestsTool`, `UpdateMemoryMdTool`) live in `tinytools_std::filesystem` and are imported directly by `tools/ops.rs` | always registered, except `ReadDiffTool`, `RunLinterTool`, and `RunTestsTool`, which are exported, not registered |+| [`browser/`](./browser/) | `BrowserTool` (TinyComputer browser members and tasks), `BrowserOpenTool` (simple TinyComputer navigation), `ImageInfoTool` | Both browser tools need `browser.enabled` and the `modules` feature, and are deferred until `tool_search`; `ImageInfoTool` remains direct. Browser navigation uses the shared `http_request.allowed_domains` policy, and the checksum-pinned TinyComputer release module. |+| [`network/`](./network/) | `HttpRequestTool`, `WebFetchTool`, `CurlTool`, `GitbooksSearchTool`, `GitbooksGetPageTool`, `GmailUnsubscribeTool`, and under the `mcp` Cargo feature `McpListServersTool`, `McpListToolsTool`, `McpCallTool`; `url_guard.rs` is the shared SSRF/allowlist validator, not a tool | `http_request`, `web_fetch`, `curl`, `gmail_unsubscribe` always registered; `gitbooks_*` need `gitbooks.enabled` and, when the active profile sets an `mcp_allowlist`, an entry named `gitbooks`; `mcp_list_servers`/`mcp_list_tools`/`mcp_call_tool` register only when the static `[[mcp_client.servers]]` registry (after the profile allowlist) is non-empty |+| [`document/`](./document/) (feature `documents`) | `DocumentTool` (`generate_document`) | always registered when compiled. Builds `.docx` bytes via the pure-Rust `engine` module (`docx-rs`, no subprocess) inside `spawn_blocking` + `tokio::time::timeout`; allocates the artifact with `agent::artifacts::create_artifact` (kind `Document`), persists `args.json` next to it for the failed-card Retry path, then `finalize_artifact` or `fail_artifact` |+| [`presentation/`](./presentation/) (feature `documents`) | `PresentationTool` (`generate_presentation`) | always registered when compiled. Same shape as `document/` with `ppt-rs` producing `.pptx` and kind `Presentation` |+| [`meta/`](./meta/) | `deferred` (`strip_deferred_from_visible`, `deferred_tool_names`, the `TOOL_SEARCH_NAME` belt opt-in constant); `collapse` helpers (`resolve`, `merge_action_schemas`, `args_without_action`, `strictest_permission`, `any_external_effect`, `unknown_action_message`, `CollapsedAction`) | not registered: `deferred` is the host's half of `ToolExposure::Deferred`: the session builder (`agent/session_host/builder/builder_build.rs`) uses it to split a belt into the advertised set and the still-registered deferred set, and the tinyagents harness advertises its intrinsic `tool_search` / `tool_call` bridge over the latter (ranked per `agent/tinyagents/discovery`). The `collapse` helpers are used by `cron/tools/collapsed.rs` and `memory/tools/collapsed.rs` to merge a multi-action tool's per-action schemas and permissions into one entry |## Notes- `document/` and `presentation/` are kept structurally parallel (validateinput, allocate artifact, generate bytes off the async runtime, finalize orfail the artifact) so further artifact-producing tools follow the same shape.-- `meta/` sits outside `system/` because it is the model introspecting its own+- `meta/` sits outside [`system/`](./system/) because it is the model introspecting its owntool surface, not a host capability.-- `system/mod.rs` (`security_for_tool_context`) and `filesystem/gate.rs`+- [`system/mod.rs`](./system/mod.rs) (`security_for_tool_context`) and [`filesystem/gate.rs`](./filesystem/gate.rs)(`security_scoped_to_root`, behind `FsGate::scoped_to_workspace`) each grant the run's TinyAgents workspacedescriptor as `action_dir` plus a `ReadWrite` trusted root on a per-callclone of `SecurityPolicy`. They must stay in step; `is_always_forbidden` anddiff --git a/crates/openhuman-core/src/tools/registry/README.md b/crates/openhuman-core/src/tools/registry/README.mdindex f447072a1c..9ce4eba109 100644--- a/crates/openhuman-core/src/tools/registry/README.md+++ b/crates/openhuman-core/src/tools/registry/README.md@@ -8,8 +8,8 @@ Unified, read-only tool registry for OpenHuman. It builds a single discovery vie- Normalize controller `ControllerSchema` inputs/outputs into JSON Schema; attach transport (`json_rpc` / `mcp_stdio`), route metadata, tags, `allowed_agents` (`*` in this MVP), `enabled`, and `health`.- Serve `list` / `get` (by `tool_id`) RPC lookups over the registry.- Produce redacted `diagnostics`: tool counts by transport, heuristic write-capable surfaces, policy surfaces, autonomy posture, MCP allowlist summaries, MCP write-audit row counts (last 24h), the 25 most recent denials, and capability-provider counts.-- Maintain a bounded, secret-redacting in-memory log of recent policy denials (`denials.rs`).-- Normalize and validate configured external capability providers (id slugging, dedupe, trust/enabled state) for policy and diagnostics callers (`providers.rs`).+- Maintain a bounded, secret-redacting in-memory log of recent policy denials ([`denials.rs`](./denials.rs)).+- Normalize and validate configured external capability providers (id slugging, dedupe, trust/enabled state) for policy and diagnostics callers ([`providers.rs`](./providers.rs)).## Key files@@ -18,7 +18,7 @@ Unified, read-only tool registry for OpenHuman. It builds a single discovery vie| `crates/openhuman-core/src/tools/registry/mod.rs` | Export-focused. `pub mod denials` and `pub mod ops`; re-exports ops entry points, providers, schemas (as `all_tool_registry_*`), and types. || `crates/openhuman-core/src/tools/registry/ops.rs` | Core logic: `registry_entries()` / `registry_entries_for_config()`, `list_tools()`, `get_tool()`, `diagnostics()` / `diagnostics_for_config()`, plus schema→JSON-Schema conversion, tagging, write-capability heuristics, MCP write-audit health query. || `crates/openhuman-core/src/tools/registry/types.rs` | Serde response types: `ToolRegistryEntry`, `ToolRegistryList`, `ToolRegistryTransport`, `ToolRegistryHealth`, `ToolPolicyDiagnostics` + sub-structs, `RecentPolicyDenial`, `CapabilityProviderDiagnostics`. |-| `crates/openhuman-core/src/tools/registry/schemas.rs` | Controller schemas + `handle_list` / `handle_get` / `handle_diagnostics` handlers delegating to `ops.rs`. |+| `crates/openhuman-core/src/tools/registry/schemas.rs` | Controller schemas + `handle_list` / `handle_get` / `handle_diagnostics` handlers delegating to [`ops.rs`](./ops.rs). || `crates/openhuman-core/src/tools/registry/providers.rs` | `CapabilityProviderRegistry` over config: id normalization, dedupe, trust checks, redacted diagnostics. || `crates/openhuman-core/src/tools/registry/denials.rs` | Static `Mutex<VecDeque>` ring buffer (max 50) of recent policy denials; `record()` / `list()`; redacts secret markers, truncates reasons. || `crates/openhuman-core/src/tools/registry/{ops,schemas,providers,denials}_tests.rs` | Sibling `#[path]`-included test modules for each file above. |@@ -45,7 +45,7 @@ All handlers return `Outcome<T>` serialized via `into_cli_compatible_json()`.## Persistence-No owned persistence. `diagnostics()` reads the MCP write-audit log through `crate::mcp::audit::list_writes` (with a `McpWriteListQuery` whose `since_ms` is now minus 24h, capped at `tinymcp_bus::MAX_LIST_LIMIT` rows) to fill `McpWriteAuditHealth`; a query error lands in `last_error` rather than failing diagnostics. Recent denials live in a process-global, in-memory `Mutex<VecDeque>` in `denials.rs` (not durable; max 50 entries).+No owned persistence. `diagnostics()` reads the MCP write-audit log through `crate::mcp::audit::list_writes` (with a `McpWriteListQuery` whose `since_ms` is now minus 24h, capped at `tinymcp_bus::MAX_LIST_LIMIT` rows) to fill `McpWriteAuditHealth`; a query error lands in `last_error` rather than failing diagnostics. Recent denials live in a process-global, in-memory `Mutex<VecDeque>` in [`denials.rs`](./denials.rs) (not durable; max 50 entries).## Dependenciesdiff --git a/crates/openhuman-core/src/tools/timeout/README.md b/crates/openhuman-core/src/tools/timeout/README.mdindex 9edb997d05..d4588e3d82 100644--- a/crates/openhuman-core/src/tools/timeout/README.md+++ b/crates/openhuman-core/src/tools/timeout/README.md@@ -23,7 +23,7 @@ Highest precedence first:| File | Role || --- | --- || `crates/openhuman-core/src/tools/timeout/mod.rs` | Entire module: constants, env parsing, pure resolver, atomic-backed runtime value, setter, public accessors. |-| `crates/openhuman-core/src/tools/timeout/mod_tests.rs` | Unit tests for the module, run via the `#[path = "mod_tests.rs"] mod tests` include in `mod.rs`. |+| `crates/openhuman-core/src/tools/timeout/mod_tests.rs` | Unit tests for the module, run via the `#[path = "mod_tests.rs"] mod tests` include in [`mod.rs`](./mod.rs). |## Public surfacediff --git a/crates/openhuman-core/src/tools/toolpacks/README.md b/crates/openhuman-core/src/tools/toolpacks/README.mdindex 42df2ada1a..9bb68e5d7a 100644--- a/crates/openhuman-core/src/tools/toolpacks/README.md+++ b/crates/openhuman-core/src/tools/toolpacks/README.md@@ -114,7 +114,7 @@ in the orchestrator prompt's `## Skills` section(`agent/registry/agents/orchestrator/prompt.md`). Lookup detail and the stepby step loop belong in the guide.-`toolpacks_tests.rs` keeps guides honest: every guided pack must carry a+[`toolpacks_tests.rs`](./toolpacks_tests.rs) keeps guides honest: every guided pack must carry anon-empty guide, every guide stays under `GUIDE_BUDGET_BYTES` (2,400 bytes,about 550 tokens), no guide may name a removed specialist's hand-off tool(`run_code`, `do_crypto`, `manage_settings`, ...), every tool in a guided@@ -138,7 +138,7 @@ listing offers the hand-off beside the raw registry tools.- `core/runtime/builder.rs` and `core/runtime/context.rs`: `CoreBuilder::tool_groups` and the ambient `ToolGroups` on `CoreContext`.- `agent/session_host/builder/`: `builder_build.rs` strips packed namesfrom the agent's visible set and binds both registries once the tool `Arc`s- exist; `mod.rs` calls `scope_use_skill_spec` so the advertised `use_skill`+ exist; [`mod.rs`](./mod.rs) calls `scope_use_skill_spec` so the advertised `use_skill`spec lists only packs this session can call something in, and drops thespec entirely when that is none.- `agent/session_host/turn/tools.rs`: rebinds the synthesized registry@@ -165,9 +165,9 @@ listing offers the hand-off beside the raw registry tools.## Tests-`toolpacks_tests.rs` (pack-table invariants, owner rules,+[`toolpacks_tests.rs`](./toolpacks_tests.rs) (pack-table invariants, owner rules,`strip_packed_from_visible`, `use_skill` dispatch and permission / timeout /effect forwarding, dual-registry binding) and-`toolpacks_tests_scoping_and_visibility_tests.rs`+[`toolpacks_tests_scoping_and_visibility_tests.rs`](./toolpacks_tests_scoping_and_visibility_tests.rs)(`scope_use_skill_spec`, `render_pack_filtered` filtering, `route_sentence`,-rebinding); `groups_tests.rs` (`GroupMode` defaults and narrowing rules).+rebinding); [`groups_tests.rs`](./groups_tests.rs) (`GroupMode` defaults and narrowing rules).diff --git a/crates/openhuman-core/src/util/README.md b/crates/openhuman-core/src/util/README.mdindex 253a867dee..e90eec8d95 100644--- a/crates/openhuman-core/src/util/README.md+++ b/crates/openhuman-core/src/util/README.md@@ -36,13 +36,13 @@ copy.| Path | What it does || --- | --- |-| `text.rs` | Char-count truncation (`truncate_with_ellipsis`, `truncate_with_suffix`), byte-capped truncation with an ellipsis (`truncate_at_byte_boundary`), and byte-index rounding to a char boundary (`floor_char_boundary`, `ceil_char_boundary`, `utf8_safe_prefix_at_byte_boundary`). |-| `retry.rs` | `retry_with_backoff` (sync, `std::thread::sleep`) and `retry_with_backoff_async` (`tokio::time::sleep`), plus `is_transient_fs_error`. |-| `redact.rs` | `redact` hashes a string to 8 hex chars for log lines. `redact_url_for_log` replaces URL userinfo with `redacted`. |-| `url.rs` | `normalize_api_base_url`, `normalize_backend_api_base_url`, `join_url`, `host_is_local`. |-| `params.rs` | `read_required` and `read_optional`, the shared param decoders for controller handlers. |-| `sanitize.rs` | A re-export of `tinymcp_bus::sanitize`: `sanitize_for_llm`, `strip_control_chars`, `strip_instruction_fences`, `truncate_utf8_safe`, `MAX_DESCRIPTION_BYTES`, `MAX_TITLE_BYTES`. |-| `types.rs` | `MaybeSet<T>` (`Set`, `Unset`, `Null`). |+| [`text.rs`](./text.rs) | Char-count truncation (`truncate_with_ellipsis`, `truncate_with_suffix`), byte-capped truncation with an ellipsis (`truncate_at_byte_boundary`), and byte-index rounding to a char boundary (`floor_char_boundary`, `ceil_char_boundary`, `utf8_safe_prefix_at_byte_boundary`). |+| [`retry.rs`](./retry.rs) | `retry_with_backoff` (sync, `std::thread::sleep`) and `retry_with_backoff_async` (`tokio::time::sleep`), plus `is_transient_fs_error`. |+| [`redact.rs`](./redact.rs) | `redact` hashes a string to 8 hex chars for log lines. `redact_url_for_log` replaces URL userinfo with `redacted`. |+| [`url.rs`](./url.rs) | `normalize_api_base_url`, `normalize_backend_api_base_url`, `join_url`, `host_is_local`. |+| [`params.rs`](./params.rs) | `read_required` and `read_optional`, the shared param decoders for controller handlers. |+| [`sanitize.rs`](./sanitize.rs) | A re-export of `tinymcp_bus::sanitize`: `sanitize_for_llm`, `strip_control_chars`, `strip_instruction_fences`, `truncate_utf8_safe`, `MAX_DESCRIPTION_BYTES`, `MAX_TITLE_BYTES`. |+| [`types.rs`](./types.rs) | `MaybeSet<T>` (`Set`, `Unset`, `Null`). || [`tls/`](tls/README.md) | `tls_client_builder()`, the platform-conditional TLS backend for `reqwest` clients. |## Key types and entry points@@ -118,7 +118,7 @@ null" (`Null`) in partial-update payloads. The caller today is### Re-exports-`mod.rs` re-exports `read_optional`, `read_required`, `redact_url_for_log`,+[`mod.rs`](./mod.rs) re-exports `read_optional`, `read_required`, `redact_url_for_log`,the `retry` functions, the `text` functions and `MaybeSet` at the module root,so `crate::util::truncate_with_ellipsis` works without naming the submodule.`redact::redact`, `sanitize::*`, `url::*` and `tls::tls_client_builder` are@@ -131,7 +131,7 @@ uses.- The sanitization rule is owned by `tinymcp_bus` (`vendor/tinymcp`).- Hosted-backend URL resolution (defaults, `BACKEND_URL` overrides) belongsto the installed backend transport in `crates/openhuman-tinyhumans`, asked- through `crate::backend`. `url.rs` only does string and URL shape work.+ through `crate::backend`. [`url.rs`](./url.rs) only does string and URL shape work.- Secret scrubbing for logs and Sentry lives in `core::log_redaction` and`core::observability`. `redact` is only a stable hash for identifiers.@@ -148,7 +148,7 @@ uses.## Tests-Tests sit beside each file (`text_tests.rs`, `retry_tests.rs`,-`redact_tests.rs`, `url_tests.rs`, `params_tests.rs`). Run them with+Tests sit beside each file ([`text_tests.rs`](./text_tests.rs), [`retry_tests.rs`](./retry_tests.rs),+[`redact_tests.rs`](./redact_tests.rs), [`url_tests.rs`](./url_tests.rs), [`params_tests.rs`](./params_tests.rs)). Run them with`cargo test -p openhuman util::` or `pnpm debug rust util::`. The`truncate_with_ellipsis` doctest runs under `cargo test -p openhuman --doc`.diff --git a/crates/openhuman-core/src/voice/README.md b/crates/openhuman-core/src/voice/README.mdindex a52560080a..3f1e6381ba 100644--- a/crates/openhuman-core/src/voice/README.md+++ b/crates/openhuman-core/src/voice/README.md@@ -27,7 +27,7 @@ and third-party APIs.### Provider routingEvery STT and TTS request is resolved to a provider string, and the factory in-`factory/` turns that string into a boxed `SttProvider` or `TtsProvider`. The+[`factory/`](./factory/) turns that string into a boxed `SttProvider` or `TtsProvider`. Thegrammar is small:| String | STT | TTS |@@ -43,7 +43,7 @@ through to the slug lookup and fail by name rather than silently degrading;error.Which string applies is decided by `effective_stt_provider` and-`effective_tts_provider` in `factory/helpers.rs`. TTS walks the top-level+`effective_tts_provider` in [`factory/helpers.rs`](./factory/helpers.rs). TTS walks the top-level`config.tts_provider`, then `config.local_ai.tts_provider`, then defaults to`"cloud"`. STT walks `config.stt_provider` and `config.local_ai.stt_provider`but accepts a value only if it names a specific provider. An empty value or@@ -70,13 +70,13 @@ Settings is not shadowed by a legacy `"cloud"` default.The local-AI service's STT path in`inference/host_runtime/service/speech.rs` resolves its provider the same way,-which is why `voice_transcribe` in `ops.rs` goes through+which is why `voice_transcribe` in [`ops.rs`](./ops.rs) goes through`local_ai::service::transcribe_with_prompt` rather than calling a providerdirectly.### File and byte transcription-`voice.transcribe` and `voice.transcribe_bytes` (both in `ops.rs`) run the same+`voice.transcribe` and `voice.transcribe_bytes` (both in [`ops.rs`](./ops.rs)) run the samesequence. The bytes variant first writes the audio to a temp file under`openhuman_voice_input` (extension checked by `normalize_extension`) and removesit afterwards. The audio then goes through the effective STT provider. The@@ -89,8 +89,8 @@ result is a `VoiceSpeechResult` carrying both the cleaned `text` and the### Hotkey dictation-The dictation server lives in `server/` (see [server/README.md](server/README.md)).-A hotkey press starts a recording through `audio_capture.rs`; release (or a+The dictation server lives in [`server/`](./server/) (see [server/README.md](server/README.md)).+A hotkey press starts a recording through [`audio_capture.rs`](./audio_capture.rs); release (or asecond tap, depending on `ActivationMode`) stops it and hands the WAV to abackground pipeline:@@ -124,7 +124,7 @@ isolated, unregistered `VoiceServer` on purpose.### Always-on listening-`always_on/` keeps the microphone open and uses VAD to cut the stream into+[`always_on/`](./always_on/) keeps the microphone open and uses VAD to cut the stream intoutterances, so no hotkey is needed (see [always_on/README.md](always_on/README.md)).It is opt-in through `config.voice_server.always_on_enabled` and pauses whilethe screen is locked (macOS only; other platforms have no lock signal yet).@@ -134,7 +134,7 @@ through `dictation_listener::publish_transcription`.### Broadcast channels and events-`dictation_listener.rs` owns two process-global `tokio::sync::broadcast`+[`dictation_listener.rs`](./dictation_listener.rs) owns two process-global `tokio::sync::broadcast`channels: `DictationEvent` (`pressed` / `released`) through`publish_dictation_event` / `subscribe_dictation_events`, and transcript textthrough `publish_transcription` / `subscribe_transcription_results`. The@@ -144,7 +144,7 @@ frontend without Tauri-side shortcut registration. The same file starts andstops the core-side rdev listener (`start_if_enabled` / `stop`) and normalizeshotkey strings with `normalize_hotkey_for_rdev`.-Typed events go through the process-wide `BUS`. `bus.rs` publishes+Typed events go through the process-wide `BUS`. [`bus.rs`](./bus.rs) publishes`DomainEvent::Voice(VoiceEvent::PttTranscriptCommitted)` with the thread id,session id, text length, held milliseconds and a watchdog flag. The rawtranscript is never included.@@ -161,16 +161,16 @@ provider returns the same shape (Piper with a synthetic viseme timeline).### Live voice agents-`live/` runs realtime, two-way speech sessions with the agent, including tool-calls. One WebSocket at `/ws/live-voice` is one session. `live/providers.rs`+[`live/`](./live/) runs realtime, two-way speech sessions with the agent, including tool+calls. One WebSocket at `/ws/live-voice` is one session. [`live/providers.rs`](./live/providers.rs)knows four providers: `gemini-hosted` (a backend-minted Gemini Live relay-ticket), `elevenlabs-hosted` (a backend-signed agent URL from `realtime.rs`),+ticket), `elevenlabs-hosted` (a backend-signed agent URL from [`realtime.rs`](./realtime.rs)),`gemini` (BYOK with `provider:google`) and `sarvam` (BYOK with-`provider:sarvam`). `live/session.rs` builds the orchestrator's session host+`provider:sarvam`). [`live/session.rs`](./live/session.rs) builds the orchestrator's session hostfor the thread, wraps its tools in `agent::tinyagents::live_harness` (approval,tool policy, CLI/RPC-only filtering, credential scrubbing) and starts a`tinyagents_live::LiveAgent` inside a `voice` external-channel origin and-approval chat scope. `live/persist.rs` writes final transcripts back into the+approval chat scope. [`live/persist.rs`](./live/persist.rs) writes final transcripts back into thethread.```text@@ -211,7 +211,7 @@ provider's wire format.### Realtime harness turns-`realtime_harness/` is the older ElevenLabs Agents path. The backend relays each+[`realtime_harness/`](./realtime_harness/) is the older ElevenLabs Agents path. The backend relays eachturn of a hosted ElevenLabs session down the socket as `voice:harness`, and`handle_voice_harness_turn` (spawned from`platform/socket/event_handlers.rs`) runs the local orchestrator agent, the same@@ -220,7 +220,7 @@ one chat and the meet bot use, then streams the reply back as### Streaming dictation WebSocket-`streaming.rs` handles `/ws/dictation` (mounted and authenticated by+[`streaming.rs`](./streaming.rs) handles `/ws/dictation` (mounted and authenticated by`crates/openhuman-rpc/src/server/http/dictation.rs`). The client sends PCM1616 kHz mono binary frames and a `{"type":"stop"}` text frame; the coreaccumulates the audio, encodes WAV through the `tinyvoice` module, and returns@@ -232,51 +232,51 @@ per tick would multiply request count for text the client discards.| Path | What it does || --- | --- |-| `mod.rs` | Feature gate and exports. Re-exports the factory, ops, schemas and types, and defines `cloud_transcribe_default_model()` (`"whisper-v1"`). |-| `types.rs` | RPC result types `VoiceSpeechResult`, `VoiceTtsResult`, `VoiceStatus`, with `From` conversions from the local-AI types. |+| [`mod.rs`](./mod.rs) | Feature gate and exports. Re-exports the factory, ops, schemas and types, and defines `cloud_transcribe_default_model()` (`"whisper-v1"`). |+| [`types.rs`](./types.rs) | RPC result types `VoiceSpeechResult`, `VoiceTtsResult`, `VoiceStatus`, with `From` conversions from the local-AI types. || `ops.rs` | `voice_status`, `voice_transcribe`, `voice_transcribe_bytes`, `voice_tts`, `normalize_extension`. All return `Outcome<T>`. |-| `factory/` | Provider traits and implementations. `entry.rs` has `create_*_provider`, `default_*_provider`, `DEFAULT_STT_MODEL`, `DEFAULT_PIPER_VOICE`; `traits.rs` the traits; `stt_providers.rs` (`CloudSttProvider`, `ExternalSttProvider`); `tts_providers.rs` (`CloudTtsProvider`, `PiperTtsProvider`, `ExternalTtsProvider`); `helpers.rs` (`split_slug_model`, `effective_*_provider`, slug lookup in `config.voice_providers`). |-| `schemas/` | Controller schemas and handlers. `registry.rs` lists the methods and chains in the `live` controllers; `params.rs` and `helpers.rs` parse input; `handlers.rs` with `handlers/transcribe_tts.rs` and `handlers/provider_server.rs` hold the `handle_voice_*` and `handle_overlay_stt_notify` functions. |-| `cloud_transcribe.rs` | Auth adapter for hosted STT: resolves the backend credential and calls `tinyinference_voice::cloud` against `/openai/v1/audio/transcriptions`. |-| `local_speech.rs` | Config adapter for Piper: resolves the binary and voice through the local runtime and calls `tinyinference-voice`. |-| `postprocess.rs` | Config adapter for LLM transcript cleanup (`cleanup_transcription`). |-| `streaming.rs` | `/ws/dictation` handler (`handle_dictation_ws`). Compiled only with both `voice` and `http-server`. |-| `reply_speech.rs` | Agent reply synthesis through the backend speech endpoint (`synthesize_reply`, `ReplySpeechOptions`). |-| `server.rs`, `server/` | The `VoiceServer` dictation runtime: hotkey loop, recording lifecycle, gates, delivery, global singleton. [README](server/README.md). |-| `always_on.rs`, `always_on/` | VAD-driven continuous listening, screen-lock pause, wake word and intent routing. [README](always_on/README.md). |-| `audio_capture.rs` | Microphone recording to 16 kHz mono WAV (`start_recording`, `RecordingHandle`, `RecordingResult`, `list_input_devices`) with peak RMS and the host microphone-permission policy. The `cpal` stream is `tinyvoice::capture`. |-| `hotkey.rs` | Re-export of `tinyvoice::hotkey`: `ActivationMode`, `HotkeyEvent`, `HotkeyCombination`, `parse_hotkey`, `start_listener`. Its tests live in tinyvoice. |-| `dictation_listener.rs` | The two broadcast channels and the core-side rdev listener lifecycle. |-| `bus.rs` | `publish_ptt_transcript_committed`. |+| [`factory/`](./factory/) | Provider traits and implementations. `entry.rs` has `create_*_provider`, `default_*_provider`, `DEFAULT_STT_MODEL`, `DEFAULT_PIPER_VOICE`; `traits.rs` the traits; `stt_providers.rs` (`CloudSttProvider`, `ExternalSttProvider`); `tts_providers.rs` (`CloudTtsProvider`, `PiperTtsProvider`, `ExternalTtsProvider`); `helpers.rs` (`split_slug_model`, `effective_*_provider`, slug lookup in `config.voice_providers`). |+| [`schemas/`](./schemas/) | Controller schemas and handlers. `registry.rs` lists the methods and chains in the [`live`](./live) controllers; `params.rs` and `helpers.rs` parse input; `handlers.rs` with `handlers/transcribe_tts.rs` and `handlers/provider_server.rs` hold the `handle_voice_*` and `handle_overlay_stt_notify` functions. |+| [`cloud_transcribe.rs`](./cloud_transcribe.rs) | Auth adapter for hosted STT: resolves the backend credential and calls `tinyinference_voice::cloud` against `/openai/v1/audio/transcriptions`. |+| [`local_speech.rs`](./local_speech.rs) | Config adapter for Piper: resolves the binary and voice through the local runtime and calls `tinyinference-voice`. |+| [`postprocess.rs`](./postprocess.rs) | Config adapter for LLM transcript cleanup (`cleanup_transcription`). |+| [`streaming.rs`](./streaming.rs) | `/ws/dictation` handler (`handle_dictation_ws`). Compiled only with both `voice` and `http-server`. |+| [`reply_speech.rs`](./reply_speech.rs) | Agent reply synthesis through the backend speech endpoint (`synthesize_reply`, `ReplySpeechOptions`). |+| [`server.rs`](./server.rs), [`server/`](./server/) | The `VoiceServer` dictation runtime: hotkey loop, recording lifecycle, gates, delivery, global singleton. [README](server/README.md). |+| [`always_on.rs`](./always_on.rs), [`always_on/`](./always_on/) | VAD-driven continuous listening, screen-lock pause, wake word and intent routing. [README](always_on/README.md). |+| [`audio_capture.rs`](./audio_capture.rs) | Microphone recording to 16 kHz mono WAV (`start_recording`, `RecordingHandle`, `RecordingResult`, `list_input_devices`) with peak RMS and the host microphone-permission policy. The `cpal` stream is `tinyvoice::capture`. |+| [`hotkey.rs`](./hotkey.rs) | Re-export of `tinyvoice::hotkey`: `ActivationMode`, `HotkeyEvent`, `HotkeyCombination`, `parse_hotkey`, `start_listener`. Its tests live in tinyvoice. |+| [`dictation_listener.rs`](./dictation_listener.rs) | The two broadcast channels and the core-side rdev listener lifecycle. |+| [`bus.rs`](./bus.rs) | `publish_ptt_transcript_committed`. || `live/` | Live voice agents: `providers.rs`, `session.rs`, `ws.rs` (`http-server` only), `persist.rs`, `ops.rs` / `schemas.rs` (`voice.live_*`), `types.rs`, `error.rs`, and `prompt.md` (voice guidance for the model). |-| `realtime.rs` | `mint_voice_agent_signed_url`: a short-lived signed WebSocket URL from the backend's `/voice-agent/get-signed-url`. The provider API key never leaves the server. |-| `realtime_harness.rs`, `realtime_harness/` | `voice:harness` turn handler: `prompt.rs` (prompt extraction), `agent.rs` (per-turn orchestrator), `chat_delivery.rs` (socket emits, deferred chat delivery), `turn_handler.rs`. |-| `audio_toolkit/` | Podcast generation and email delivery (`audio_toolkit` RPC namespace and agent tools), under the same `voice` gate. [README](audio_toolkit/README.md). |-| `cli.rs` | `openhuman voice` / `openhuman dictate`: a blocking standalone dictation server. Domain-owned because it never returns and does not fit the controller registry. |-| `compile_status.rs` | `VOICE_COMPILED_IN`, compiled in both feature states. |-| `stub.rs` | The disabled-voice facade, compiled only when `voice` is off. |+| [`realtime.rs`](./realtime.rs) | `mint_voice_agent_signed_url`: a short-lived signed WebSocket URL from the backend's `/voice-agent/get-signed-url`. The provider API key never leaves the server. |+| [`realtime_harness.rs`](./realtime_harness.rs), [`realtime_harness/`](./realtime_harness/) | `voice:harness` turn handler: `prompt.rs` (prompt extraction), `agent.rs` (per-turn orchestrator), `chat_delivery.rs` (socket emits, deferred chat delivery), `turn_handler.rs`. |+| [`audio_toolkit/`](./audio_toolkit/) | Podcast generation and email delivery (`audio_toolkit` RPC namespace and agent tools), under the same `voice` gate. [README](audio_toolkit/README.md). |+| [`cli.rs`](./cli.rs) | `openhuman voice` / `openhuman dictate`: a blocking standalone dictation server. Domain-owned because it never returns and does not fit the controller registry. |+| [`compile_status.rs`](./compile_status.rs) | `VOICE_COMPILED_IN`, compiled in both feature states. |+| [`stub.rs`](./stub.rs) | The disabled-voice facade, compiled only when `voice` is off. |## Key types and entry points-- `SttProvider` / `TtsProvider` (`factory/traits.rs`) are the traits every+- `SttProvider` / `TtsProvider` ([`factory/traits.rs`](./factory/traits.rs)) are the traits everybackend implements. `SttResult` carries `text` and the `provider` thatproduced it.-- `create_stt_provider` / `create_tts_provider` (`factory/entry.rs`) map a+- `create_stt_provider` / `create_tts_provider` ([`factory/entry.rs`](./factory/entry.rs)) map aprovider string to an implementation. Add a new engine as a branch here plus asibling module; the doc comment in `entry.rs` describes how Kokoro would beadded.-- `effective_stt_provider` / `effective_tts_provider` (`factory/helpers.rs`)+- `effective_stt_provider` / `effective_tts_provider` ([`factory/helpers.rs`](./factory/helpers.rs))decide which provider string applies for a given config.- `voice_transcribe`, `voice_transcribe_bytes`, `voice_tts`, `voice_status`(`ops.rs`) are the business operations behind the core RPCs.-- `VoiceServer` (`server/runtime.rs`) with `global_server`, `try_global_server`,- `start_if_enabled` and `run_standalone` (`server/singleton.rs`).+- `VoiceServer` ([`server/runtime.rs`](./server/runtime.rs)) with `global_server`, `try_global_server`,+ `start_if_enabled` and `run_standalone` ([`server/singleton.rs`](./server/singleton.rs)).- `always_on::start_if_enabled` / `always_on::stop` start and stop continuouslistening; the config controller calls `start_if_enabled` again aftervoice-server settings are saved.-- `synthesize_reply` (`reply_speech.rs`) and `transcribe_cloud`- (`cloud_transcribe.rs`) are the direct hosted-backend entry points.-- `handle_live_voice_ws` (`live/ws.rs`) and `handle_dictation_ws`+- `synthesize_reply` ([`reply_speech.rs`](./reply_speech.rs)) and `transcribe_cloud`+ ([`cloud_transcribe.rs`](./cloud_transcribe.rs)) are the direct hosted-backend entry points.+- `handle_live_voice_ws` ([`live/ws.rs`](./live/ws.rs)) and `handle_dictation_ws`(`streaming.rs`) are the WebSocket handlers the RPC crate mounts.- `handle_voice_harness_turn` (`realtime_harness/`) runs one realtime harnessturn.@@ -307,9 +307,9 @@ All methods are in the `voice` namespace and registered through| `voice.live_settings_get`, `voice.live_settings_set` | Read or patch `[voice_live]`: default provider and per-provider model, voice and language. || `voice.live_test_provider` | Open a live session, wait for `Ready`, close; returns `{ ok, latency_ms, error }`. |-The CLI adapter in `cli.rs` is registered in `core/all.rs` without a feature+The CLI adapter in [`cli.rs`](./cli.rs) is registered in `core/all.rs` without a featuregate, so a voice-less build answers `openhuman voice` with a "voice disabled"-error from the stub. The `audio_toolkit` namespace is documented in its own+error from the stub. The [`audio_toolkit`](./audio_toolkit) namespace is documented in its ownREADME.## Persistence@@ -366,7 +366,7 @@ server, listener and always-on mode when gating credentials change),## Gotchas- The `voice` feature is default-on, but `pub mod voice` always compiles as a- facade. With the feature off, `stub.rs` replaces the real modules and mirrors+ facade. With the feature off, [`stub.rs`](./stub.rs) replaces the real modules and mirrorsthe surface other code depends on (`server`, `dictation_listener`,`always_on`, `streaming`, `live::ws`, `reply_speech`, `cloud_transcribe`,`cli`, `create_stt_provider`, `effective_stt_provider`, `SttProvider`,@@ -403,7 +403,7 @@ server, listener and always-on mode when gating credentials change),## TestsTests sit beside their modules as `<module>_tests.rs` (for example-`ops_tests.rs`, `factory/factory_tests.rs`, `live/session_tests.rs`), wired with+[`ops_tests.rs`](./ops_tests.rs), [`factory/factory_tests.rs`](./factory/factory_tests.rs), [`live/session_tests.rs`](./live/session_tests.rs)), wired with`#[path = ...]`. Run them with `cargo test -p openhuman voice::` or`pnpm debug rust voice`. Check the disabled build with`cargo check --no-default-features` plus every product feature except `voice`.diff --git a/crates/openhuman-core/src/voice/always_on/README.md b/crates/openhuman-core/src/voice/always_on/README.mdindex e4919dcbe3..14c270cf94 100644--- a/crates/openhuman-core/src/voice/always_on/README.md+++ b/crates/openhuman-core/src/voice/always_on/README.md@@ -14,10 +14,10 @@ The split follows the audio callback, not the cost of a call. A module call is a| File | Role || --- | --- |-| `capture.rs` | Host microphone-permission policy over `tinyvoice::capture`, which owns the `cpal` stream and its realtime callback. `spawn_capture_thread` builds the input stream on a dedicated thread and blocks on a readiness handshake; each callback converts the device sample format to `f32` and forwards the interleaved buffer untouched via `try_send` (never blocking `send`), dropping the newest chunk and counting drops when the processor falls behind. |-| `lock_watcher.rs` | The macOS screen-lock privacy hook. `spawn_lock_watcher` polls `CGSessionCopyCurrentDictionary` every two seconds and flips `PAUSED` on lock/unlock transitions. Other platforms log that the watcher is unavailable and never pause (no lock signal yet). |-| `processor.rs` | The async pipeline: owns the `ENABLED`/`PAUSED`/`RUNNING` gates, opens and retries the `tinyvoice::VadSession`, turns raw capture chunks into segmented utterances, and hands finished ones to `transcribe_and_deliver`. `start_if_enabled` is safe to call at boot and at runtime (the Settings toggle calls it through the config RPC); `stop` flips `ENABLED` off for logout without tearing down the microphone stream. |-| `transcribe.rs` | Transcribes a finished utterance through the configured STT provider (the same factory dispatch `voice.stt_dispatch` uses), applies the wake-word gate (`tinyvoice::extract_command`), and routes recognized commands either to a local fast path (`execute_intent`, media transport and volume via `osascript` on macOS) or, for `VoiceIntent::Unknown` or a failed local execution, to the agent via `crate::voice::dictation_listener::publish_transcription`. |+| [`capture.rs`](./capture.rs) | Host microphone-permission policy over `tinyvoice::capture`, which owns the `cpal` stream and its realtime callback. `spawn_capture_thread` builds the input stream on a dedicated thread and blocks on a readiness handshake; each callback converts the device sample format to `f32` and forwards the interleaved buffer untouched via `try_send` (never blocking `send`), dropping the newest chunk and counting drops when the processor falls behind. |+| [`lock_watcher.rs`](./lock_watcher.rs) | The macOS screen-lock privacy hook. `spawn_lock_watcher` polls `CGSessionCopyCurrentDictionary` every two seconds and flips `PAUSED` on lock/unlock transitions. Other platforms log that the watcher is unavailable and never pause (no lock signal yet). |+| [`processor.rs`](./processor.rs) | The async pipeline: owns the `ENABLED`/`PAUSED`/`RUNNING` gates, opens and retries the `tinyvoice::VadSession`, turns raw capture chunks into segmented utterances, and hands finished ones to `transcribe_and_deliver`. `start_if_enabled` is safe to call at boot and at runtime (the Settings toggle calls it through the config RPC); `stop` flips `ENABLED` off for logout without tearing down the microphone stream. |+| [`transcribe.rs`](./transcribe.rs) | Transcribes a finished utterance through the configured STT provider (the same factory dispatch `voice.stt_dispatch` uses), applies the wake-word gate (`tinyvoice::extract_command`), and routes recognized commands either to a local fast path (`execute_intent`, media transport and volume via `osascript` on macOS) or, for `VoiceIntent::Unknown` or a failed local execution, to the agent via `crate::voice::dictation_listener::publish_transcription`. |`always_on.rs` (one level up, in `voice/`) is the module entry point: it declares these four submodules, re-exports `start_if_enabled`/`stop`, and holds the shared `LOG_PREFIX` constant.@@ -42,7 +42,7 @@ Transcription is forced to English (`Some("en")`) because auto-detect rendered t- The microphone stream is spawned once per process and stays open for the process lifetime once started; toggling `always_on_enabled` off only stops processing, it does not close the stream. Toggling back on reuses it.- A VAD session that fails to open (for example, the module has not finished downloading) does not stop the capture thread. Audio is dropped and the open is retried on `SESSION_RETRY_INTERVAL` so the feature self-heals without a restart.-- `tinyvoice::capture` (via `capture.rs`) never blocks the realtime audio callback: a full queue drops the newest chunk, which is deliberately the newer end to lose, since the queue ahead of it is older speech closer to being transcribed.+- `tinyvoice::capture` (via [`capture.rs`](./capture.rs)) never blocks the realtime audio callback: a full queue drops the newest chunk, which is deliberately the newer end to lose, since the queue ahead of it is older speech closer to being transcribed.## See alsodiff --git a/crates/openhuman-core/src/voice/audio_toolkit/README.md b/crates/openhuman-core/src/voice/audio_toolkit/README.mdindex 956ba878c8..7788aefb54 100644--- a/crates/openhuman-core/src/voice/audio_toolkit/README.md+++ b/crates/openhuman-core/src/voice/audio_toolkit/README.md@@ -18,13 +18,13 @@ Text-to-speech "podcast" toolkit. Synthesizes text into a workspace audio file v| `crates/openhuman-core/src/voice/audio_toolkit/mod.rs` | Export-only module surface: re-exports ops fns, schema registries, and types. || `crates/openhuman-core/src/voice/audio_toolkit/types.rs` | Serde domain types: `AudioFormat`, request/result structs. || `crates/openhuman-core/src/voice/audio_toolkit/ops.rs` | Business logic: `generate_podcast`, `email_podcast`, `generate_and_email_podcast`, `resolve_email_capture_dir`, plus private helpers (path/format/voice resolution, base64 decode, MIME enforcement, slugify, email build/capture). Contains the unit-test suite. |-| `crates/openhuman-core/src/voice/audio_toolkit/schemas.rs` | RPC controller schemas + `handle_*` handlers delegating to `ops.rs`; loads `Config` via `config::rpc`. |-| `crates/openhuman-core/src/voice/audio_toolkit/tools.rs` | Re-exports the three agent tool structs from `tools/podcast.rs`. |+| `crates/openhuman-core/src/voice/audio_toolkit/schemas.rs` | RPC controller schemas + `handle_*` handlers delegating to [`ops.rs`](./ops.rs); loads `Config` via `config::rpc`. |+| `crates/openhuman-core/src/voice/audio_toolkit/tools.rs` | Re-exports the three agent tool structs from [`tools/podcast.rs`](./tools/podcast.rs). || `crates/openhuman-core/src/voice/audio_toolkit/tools/podcast.rs` | `Tool` impls: `AudioGeneratePodcastTool`, `AudioEmailPodcastTool`, `AudioGenerateAndEmailPodcastTool`; security gating + arg parsing. |## Public surface-From `mod.rs`:+From [`mod.rs`](./mod.rs):- ops: `generate_podcast`, `email_podcast`, `generate_and_email_podcast`, `resolve_email_capture_dir`. All take `&Config` and return `Result<Outcome<T>, String>` (except `resolve_email_capture_dir`, which returns `Option<PathBuf>`).- schemas: `all_audio_toolkit_registered_controllers`.@@ -45,7 +45,7 @@ Registered into the global controller registry via `crates/openhuman-core/src/co## Agent tools-From `tools/podcast.rs`. All are `PermissionLevel::Execute`, and each calls `SecurityPolicy::enforce_tool_operation(ToolOperation::Act, ...)` before running:+From [`tools/podcast.rs`](./tools/podcast.rs). All are `PermissionLevel::Execute`, and each calls `SecurityPolicy::enforce_tool_operation(ToolOperation::Act, ...)` before running:| Tool name | Backing op || --- | --- |diff --git a/crates/openhuman-core/src/voice/server/README.md b/crates/openhuman-core/src/voice/server/README.mdindex 97ce99aebf..73eedc5779 100644--- a/crates/openhuman-core/src/voice/server/README.md+++ b/crates/openhuman-core/src/voice/server/README.md@@ -17,11 +17,11 @@ standalone through the `openhuman voice`/`openhuman dictate` CLI subcommand.| File | Role || --- | --- |-| `types.rs` | `ServerState`, `VoiceServerStatus`, `VoiceServerConfig` (hotkey, activation mode, skip_cleanup, context, min duration, silence threshold, custom dictionary), plus the `DEFAULT_SILENCE_THRESHOLD` (0.002 RMS, matching OpenWhispr's default), `MAX_RECENT_TRANSCRIPTS` (5), and `MAX_INITIAL_PROMPT_CHARS` (500) tunables. |-| `runtime.rs` | `VoiceServer`: the hotkey event loop. Starts the platform hotkey listener, tracks in-progress and pending recordings, handles the race between a buffered release event and recording setup still in flight, and spawns `process_recording_bg` off the event loop so rapid consecutive presses are never missed. Owns `run`/`stop`/`status`. |-| `hotkey_listener.rs` | Picks the platform-appropriate listener. Uses `rdev` everywhere except the macOS `Fn`/Globe key, which goes through a Swift-based globe listener (`tinycomputer_accessibility` (`vendor/tinycomputer`)) instead, because `rdev`'s `CGEventTap` callback calls `TSMGetInputSourceProperty` off the main thread and macOS 26 kills the process for that (#2677). Any other hotkey is rejected on macOS with a message pointing at `hotkey = "fn"`. |-| `pipeline.rs` | `process_recording_bg`: stops the recording, applies the duration/silence/hallucination gates, builds the `initial_prompt` from the custom dictionary and recent transcripts, transcribes via `crate::voice::voice_transcribe_bytes`, and delivers the text either over Socket.IO (when the focused app is OpenHuman itself) or by pasting into the external app via `text_input::insert_text`. |-| `singleton.rs` | `global_server`/`try_global_server` (the process-global `OnceCell<Arc<VoiceServer>>`), `start_if_enabled` (embedded auto-start, gated on `config.voice_server.auto_start`), and `run_standalone` (the blocking CLI entry point, which deliberately does not register in the global singleton so CLI-started instances stay isolated from the core RPC lifecycle). |+| [`types.rs`](./types.rs) | `ServerState`, `VoiceServerStatus`, `VoiceServerConfig` (hotkey, activation mode, skip_cleanup, context, min duration, silence threshold, custom dictionary), plus the `DEFAULT_SILENCE_THRESHOLD` (0.002 RMS, matching OpenWhispr's default), `MAX_RECENT_TRANSCRIPTS` (5), and `MAX_INITIAL_PROMPT_CHARS` (500) tunables. |+| [`runtime.rs`](./runtime.rs) | `VoiceServer`: the hotkey event loop. Starts the platform hotkey listener, tracks in-progress and pending recordings, handles the race between a buffered release event and recording setup still in flight, and spawns `process_recording_bg` off the event loop so rapid consecutive presses are never missed. Owns `run`/`stop`/`status`. |+| [`hotkey_listener.rs`](./hotkey_listener.rs) | Picks the platform-appropriate listener. Uses `rdev` everywhere except the macOS `Fn`/Globe key, which goes through a Swift-based globe listener (`tinycomputer_accessibility` (`vendor/tinycomputer`)) instead, because `rdev`'s `CGEventTap` callback calls `TSMGetInputSourceProperty` off the main thread and macOS 26 kills the process for that (#2677). Any other hotkey is rejected on macOS with a message pointing at `hotkey = "fn"`. |+| [`pipeline.rs`](./pipeline.rs) | `process_recording_bg`: stops the recording, applies the duration/silence/hallucination gates, builds the `initial_prompt` from the custom dictionary and recent transcripts, transcribes via `crate::voice::voice_transcribe_bytes`, and delivers the text either over Socket.IO (when the focused app is OpenHuman itself) or by pasting into the external app via `text_input::insert_text`. |+| [`singleton.rs`](./singleton.rs) | `global_server`/`try_global_server` (the process-global `OnceCell<Arc<VoiceServer>>`), `start_if_enabled` (embedded auto-start, gated on `config.voice_server.auto_start`), and `run_standalone` (the blocking CLI entry point, which deliberately does not register in the global singleton so CLI-started instances stay isolated from the core RPC lifecycle). |## How it fitsdiff --git a/crates/openhuman-core/src/web3/README.md b/crates/openhuman-core/src/web3/README.mdindex 235b217fc2..e5deb111f0 100644--- a/crates/openhuman-core/src/web3/README.md+++ b/crates/openhuman-core/src/web3/README.md@@ -16,7 +16,7 @@ x402 payment on an HTTP 402.### The process-wide engine and service-`seams.rs` holds one `WalletEngine` and one `Web3Service` for the whole+[`seams.rs`](./seams.rs) holds one `WalletEngine` and one `Web3Service` for the wholeprocess, built lazily on first use behind a `OnceLock` (`seams::engine()`,`seams::service()`). Both come from `tinywallet-web3` and hold noconfiguration of their own. Everything host-specific reaches them through@@ -24,8 +24,8 @@ seams, each resolving its configuration per call:| Seam (from `tinywallet-web3`) | Host implementation || --- | --- |-| `Transport` | `OpenHumanTransport` (`wallet/transport.rs`) over the wallet RPC layer |-| `RpcEndpoints` | `HostEndpoints` (`wallet/endpoints.rs`), the `OPENHUMAN_WALLET_RPC_*` environment |+| `Transport` | `OpenHumanTransport` ([`wallet/transport.rs`](./wallet/transport.rs)) over the wallet RPC layer |+| `RpcEndpoints` | `HostEndpoints` ([`wallet/endpoints.rs`](./wallet/endpoints.rs)), the `OPENHUMAN_WALLET_RPC_*` environment || `WalletSigner` | `HostSigner` (`seams.rs`): keyring secret, decrypt, then the loaded wallet module || `WalletAccounts` | `HostAccounts` (`seams.rs`): the wallet's stored set-up state || `QuoteScope` | `TaskLocalScope` (`seams.rs`): the chat turn's `APPROVAL_CHAT_CONTEXT` |@@ -94,9 +94,9 @@ family, and ids the wallet cannot sign for are rejected at quote time.### Wallet and x402-The wallet (`wallet/`) owns onboarding, consent, the encrypted recovery+The wallet ([`wallet/`](./wallet/)) owns onboarding, consent, the encrypted recoveryphrase, balances, and native and token transfers across EVM, Bitcoin, Solana,-and Tron, using the same prepare, confirm, execute pattern. x402 (`x402/`)+and Tron, using the same prepare, confirm, execute pattern. x402 ([`x402/`](./x402/))intercepts an HTTP 402 challenge, checks the spending ledger, has the walletsign a payment, and retries. Each has its own README.@@ -104,12 +104,12 @@ sign a payment, and retries. Each has its own README.| Path | What it does || --- | --- |-| `mod.rs` | Facade. Declares the family, re-exports `tinywallet_web3::crypto::service` as `web3::types`, aggregates the swap, bridge, and dapp controllers (`all_web3_controller_schemas`, `all_web3_registered_controllers`) and agent tools (`all_web3_agent_tools`), and holds shared schema helpers (`req_json`, `opt_str`, `json_result`, `execute_inputs`). |-| `seams.rs` | The process-wide engine and service, and the host seam implementations listed above. |-| `client.rs` | `CryptoClient`, a thin wrapper over the shared `IntegrationClient` for `/agent-integrations/crypto/*`. Responses are passed through as `serde_json::Value`. |-| `stub.rs` | Compiled when `web3` is off: the three aggregators return empty collections. |+| [`mod.rs`](./mod.rs) | Facade. Declares the family, re-exports `tinywallet_web3::crypto::service` as `web3::types`, aggregates the swap, bridge, and dapp controllers (`all_web3_controller_schemas`, `all_web3_registered_controllers`) and agent tools (`all_web3_agent_tools`), and holds shared schema helpers (`req_json`, `opt_str`, `json_result`, `execute_inputs`). |+| [`seams.rs`](./seams.rs) | The process-wide engine and service, and the host seam implementations listed above. |+| [`client.rs`](./client.rs) | `CryptoClient`, a thin wrapper over the shared `IntegrationClient` for `/agent-integrations/crypto/*`. Responses are passed through as `serde_json::Value`. |+| [`stub.rs`](./stub.rs) | Compiled when `web3` is off: the three aggregators return empty collections. || [`swap/`](swap/README.md) | `web3_swap` controllers: `quote`, `execute`, `routes`. |-| `bridge/` | `web3_bridge` controllers: `quote`, `execute`. |+| [`bridge/`](./bridge/) | `web3_bridge` controllers: `quote`, `execute`. || [`dapp/`](dapp/README.md) | `web3_dapp` controllers: `call`, `execute`. || [`wallet/`](wallet/README.md) | Wallet controllers, onboarding and secret state (`ops/`), the engine wrapped in `Outcome` (`execution.rs`), endpoint resolution, and the chain transport. Has its own `stub.rs`. || [`x402/`](x402/README.md) | x402 controllers, wallet and proxy seams for `tinywallet-x402`, ledger budget from the environment, payment records. Has its own `stub.rs`. |@@ -122,9 +122,9 @@ sign a payment, and retries. Each has its own README.- `HostSigner`, `HostAccounts`, `TaskLocalScope`, and `HostBackend`(`seams.rs`) are the seam implementations a contributor changes when hostbehavior has to change.-- `CryptoClient::from_config` (`client.rs`) errors when no backend credential+- `CryptoClient::from_config` ([`client.rs`](./client.rs)) errors when no backend credentialis available, the same gate the Composio tools use.-- `all_web3_agent_tools()` (`mod.rs`) builds the seven swap, bridge, and dapp+- `all_web3_agent_tools()` ([`mod.rs`](./mod.rs)) builds the seven swap, bridge, and dapptools from `tinywallet_web3::tools::web3`.- `x402::request_tool()` and `x402::handle_402_and_pay` are the x402 entrypoints for the tool registry and the `http_request` 402 retry.@@ -139,8 +139,8 @@ are `openhuman.<namespace>_<function>`.| `web3_swap` | `quote`, `execute`, `routes` || `web3_bridge` | `quote`, `execute` || `web3_dapp` | `call`, `execute` |-| `wallet` | `setup`, `status`, `reveal_recovery_phrase`, `balances`, `chain_status`, `network_defaults`, `supported_assets`, `encode_erc20_transfer`, `prepare_transfer`, `execute_prepared`, `tx_status`, `tx_receipt`, `lookup_tx` |-| `x402` | `get_summary`, `list_payments`, `update_budget` |+| [`wallet`](./wallet) | `setup`, `status`, `reveal_recovery_phrase`, `balances`, `chain_status`, `network_defaults`, `supported_assets`, `encode_erc20_transfer`, `prepare_transfer`, `execute_prepared`, `tx_status`, `tx_receipt`, `lookup_tx` |+| [`x402`](./x402) | `get_summary`, `list_payments`, `update_budget` |Each `*_execute` takes `quoteId` and `confirmed`, and `confirmed` must betrue. That flag is the explicit boundary between preparing and spending.@@ -153,9 +153,9 @@ true. That flag is the explicit boundary between preparing and spending.`web3_dapp_execute`. They register unconditionally and error at call timewhen the user is not signed in.- Wallet tools (status, chain status, prepare transfer, tx status, receipt,- lookup) are re-exported through `wallet/tools.rs` and `tools/mod.rs`, and+ lookup) are re-exported through [`wallet/tools.rs`](./wallet/tools.rs) and `tools/mod.rs`, andbuilt in `tools/ops.rs`.-- `x402_request`, from `tinywallet-x402`, wired through `x402/seams.rs`.+- `x402_request`, from `tinywallet-x402`, wired through [`x402/seams.rs`](./x402/seams.rs).## Boundaries@@ -182,22 +182,22 @@ true. That flag is the explicit boundary between preparing and spending.has it. It enables `tinywallet-bus`, `tinywallet-x402`, `tinywallet-web3`,and `modules`. At runtime `DomainSet::web3` gates the same surface.- `pub mod web3`, `wallet`, and `x402` are always compiled. Each is a facade- with its own `stub.rs` for the disabled build, so always-on callers+ with its own [`stub.rs`](./stub.rs) for the disabled build, so always-on callers(`core/all.rs`, `tools/ops.rs`, `tools/impl/network/host.rs` for x402) needno `#[cfg]`. Stub signatures must match the real ones, and only`cargo check --no-default-features` catches drift.- `TaskLocalScope` reads a `tokio::task_local!`, which propagates across`.await` but not across `tokio::spawn`. If the chat path ever runs the toolloop on a freshly spawned task without re-installing the scope, the owner- gate silently becomes a no-op. `seams_tests.rs` pins that it reads the+ gate silently becomes a no-op. [`seams_tests.rs`](./seams_tests.rs) pins that it reads thetask-local.- `CryptoClient` logs only chain ids. Request bodies carry wallet addresses,which must not be logged in full.## Tests-`seams_tests.rs` composes the real wallet state and pins the task-local scope.-`stub_tests.rs` runs only in the disabled build. `wallet/` and `x402/` keep+[`seams_tests.rs`](./seams_tests.rs) composes the real wallet state and pins the task-local scope.+[`stub_tests.rs`](./stub_tests.rs) runs only in the disabled build. `wallet/` and `x402/` keeptheir own tests.```bashdiff --git a/crates/openhuman-core/src/web3/dapp/README.md b/crates/openhuman-core/src/web3/dapp/README.mdindex 0a02d639c9..eabe1ca815 100644--- a/crates/openhuman-core/src/web3/dapp/README.md+++ b/crates/openhuman-core/src/web3/dapp/README.md@@ -12,7 +12,7 @@ confirm-then-execute flow.`Web3Service::prepare_dapp_call` (in the vendored `tinywallet-web3` crate) validates the contractaddress and calldata (must be `0x`-prefixed, even-length hex), confirms thewallet has an EVM account on the requested network, and stores an-`UnsignedTx::Evm` quote. This module owns the RPC controllers (`schemas.rs`)+`UnsignedTx::Evm` quote. This module owns the RPC controllers ([`schemas.rs`](./schemas.rs))for the `web3_dapp` namespace; the validation and storage logic lives in thecrate's `crypto::service`, shared with `swap` and `bridge`, and the agent toolsin `tinywallet_web3::tools::web3`.@@ -21,8 +21,8 @@ in `tinywallet_web3::tools::web3`.| File | Role || --- | --- |-| `mod.rs` | Module docs. |-| `schemas.rs` | `web3_dapp` RPC controller schemas and handlers: `call`, `execute`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`prepare_dapp_call` / `execute_quote`), wrapping the result in `Outcome`. |+| [`mod.rs`](./mod.rs) | Module docs. |+| [`schemas.rs`](./schemas.rs) | `web3_dapp` RPC controller schemas and handlers: `call`, `execute`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`prepare_dapp_call` / `execute_quote`), wrapping the result in `Outcome`. |## RPC / controllersdiff --git a/crates/openhuman-core/src/web3/swap/README.md b/crates/openhuman-core/src/web3/swap/README.mdindex cda5da497f..5156267c5f 100644--- a/crates/openhuman-core/src/web3/swap/README.md+++ b/crates/openhuman-core/src/web3/swap/README.md@@ -12,7 +12,7 @@ the same chain. Cross-chain requests are rejected here with a pointer to`web3_bridge`, since deBridge's `/swap` endpoint is single-chain only. Theactual quote logic (address defaulting, the backend call, unsigned-txextraction) lives in `Web3Service::quote_swap` in the vendored `tinywallet-web3`-crate; this module only owns the RPC controllers (`schemas.rs`) for the+crate; this module only owns the RPC controllers ([`schemas.rs`](./schemas.rs)) for the`web3_swap` namespace. The agent tools are in`tinywallet_web3::tools::web3`.@@ -20,8 +20,8 @@ crate; this module only owns the RPC controllers (`schemas.rs`) for the| File | Role || --- | --- |-| `mod.rs` | Module docs. |-| `schemas.rs` | `web3_swap` RPC controller schemas and handlers: `quote`, `execute`, `routes`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`web3::seams::service()`): `quote_swap` / `execute_quote` / `routes`, wrapping the result in `Outcome`. |+| [`mod.rs`](./mod.rs) | Module docs. |+| [`schemas.rs`](./schemas.rs) | `web3_swap` RPC controller schemas and handlers: `quote`, `execute`, `routes`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`web3::seams::service()`): `quote_swap` / `execute_quote` / `routes`, wrapping the result in `Outcome`. |## RPC / controllersdiff --git a/crates/openhuman-core/src/web3/wallet/README.md b/crates/openhuman-core/src/web3/wallet/README.mdindex b4b45e40df..0ccd12fff8 100644--- a/crates/openhuman-core/src/web3/wallet/README.md+++ b/crates/openhuman-core/src/web3/wallet/README.md@@ -26,16 +26,16 @@ The wallet engine (balances, the prepare/confirm/execute flow, the per-chainsigning choreography, static reference data, the agent tools) lives in thevendored `tinywallet-web3` crate (`vendor/tinywallet/crates/tinywallet-web3`,`crypto::{wallet, execution, chains, defaults, abi}` and `tools::wallet`). What-stays here is the host: onboarding state and secrets (`ops`), the `Outcome`-adapters (`execution.rs`), endpoint resolution from the environment-(`endpoints.rs`), the host `Transport` (`transport.rs`, `rpc.rs`) and the RPC-controllers (`schemas.rs`). The crate reaches this module only through seams,+stays here is the host: onboarding state and secrets ([`ops`](./ops)), the `Outcome`+adapters ([`execution.rs`](./execution.rs)), endpoint resolution from the environment+([`endpoints.rs`](./endpoints.rs)), the host `Transport` ([`transport.rs`](./transport.rs), [`rpc.rs`](./rpc.rs)) and the RPC+controllers ([`schemas.rs`](./schemas.rs)). The crate reaches this module only through seams,implemented in [`web3/seams.rs`](../seams.rs).## Compile-time gate (`web3` feature)`pub mod wallet;` in `web3/mod.rs` is always compiled: it is a facade. The-real implementation (`ops`, `execution`, `endpoints`, `schemas`, `tools`,+real implementation ([`ops`](./ops), `execution`, `endpoints`, `schemas`, `tools`,`transport`) is gated behind the default-ON `web3` Cargofeature (shared with `web3` and `web3::x402`). When the feature is off,`stub` takes its place and mirrors the subset of the public surface that@@ -64,19 +64,19 @@ Signatures must match the real ones exactly; `cargo check| File | Role || --- | --- || `crates/openhuman-core/src/web3/wallet/mod.rs` | Export-focused module root; module docstring, `mod`/`pub use` re-exports. |-| `crates/openhuman-core/src/web3/wallet/ops.rs` | Onboarding metadata and secret persistence: `setup`/`status`/`reveal_recovery_phrase`, atomic `wallet-state.json` writes (temp-file + fsync), corrupt-state quarantine, keychain load/save/migrate, `validate_setup`, and `secret_material` (crate-internal) used by the host signer. `ops/types.rs` re-exports `WalletChain`/`WalletAccount`/`WalletStatus`/`WALLET_NOT_CONFIGURED_MESSAGE` from `tinywallet-web3` and keeps the persisted shape and the setup params. |+| `crates/openhuman-core/src/web3/wallet/ops.rs` | Onboarding metadata and secret persistence: `setup`/`status`/`reveal_recovery_phrase`, atomic `wallet-state.json` writes (temp-file + fsync), corrupt-state quarantine, keychain load/save/migrate, `validate_setup`, and `secret_material` (crate-internal) used by the host signer. [`ops/types.rs`](./ops/types.rs) re-exports `WalletChain`/`WalletAccount`/`WalletStatus`/`WALLET_NOT_CONFIGURED_MESSAGE` from `tinywallet-web3` and keeps the persisted shape and the setup params. || `crates/openhuman-core/src/web3/wallet/execution.rs` | `Outcome` adapters over the process-wide engine: `balances`/`network_defaults`/`supported_assets`/`chain_status`, `prepare_transfer`/`execute_prepared`, `tx_status`/`tx_receipt`/`lookup_tx`, `prepared_quotes_for_test`. Re-exports the engine's wire types. || `crates/openhuman-core/src/web3/wallet/endpoints.rs` | The `OPENHUMAN_WALLET_RPC_*` / `OPENHUMAN_SOLANA_CLUSTER` environment resolution, and `HostEndpoints`, the `RpcEndpoints` seam. The static defaults are in the crate. || `crates/openhuman-core/src/web3/wallet/schemas.rs` | RPC controller schemas and `handle_*` dispatchers delegating to `ops`/`execution`; `all_wallet_controller_schemas` / `all_wallet_registered_controllers`. || `crates/openhuman-core/src/web3/wallet/rpc.rs` | Network transport, not RPC controllers: shared `reqwest::Client`, JSON-RPC POST (`rpc_call_to`), REST GET/POST helpers, URL redaction for logs. |-| `crates/openhuman-core/src/web3/wallet/transport.rs` | OpenHuman's implementation of the `tinywallet_bus::rpc::Transport` seam: resolves a `tinywallet_bus::rpc::NetworkId` to an endpoint (including `OPENHUMAN_WALLET_RPC_<CHAIN>` overrides), redacts URLs for logs, and reuses `rpc.rs`'s shared `reqwest` client. Classifies errors conservatively: anything it cannot prove is a transport failure is reported as `TransportError::Rpc` (authoritative) rather than `Unreachable` (retryable), so an unclassifiable error stops a failover loop instead of risking a double broadcast. |+| `crates/openhuman-core/src/web3/wallet/transport.rs` | OpenHuman's implementation of the `tinywallet_bus::rpc::Transport` seam: resolves a `tinywallet_bus::rpc::NetworkId` to an endpoint (including `OPENHUMAN_WALLET_RPC_<CHAIN>` overrides), redacts URLs for logs, and reuses [`rpc.rs`](./rpc.rs)'s shared `reqwest` client. Classifies errors conservatively: anything it cannot prove is a transport failure is reported as `TransportError::Rpc` (authoritative) rather than `Unreachable` (retryable), so an unclassifiable error stops a failover loop instead of risking a double broadcast. || `crates/openhuman-core/src/web3/wallet/tools.rs` | Re-exports the six agent tool structs from `tinywallet_web3::tools::wallet`. || `crates/openhuman-core/src/web3/wallet/stub.rs` | Disabled-wallet facade compiled when `web3` is off; mirrors the subset of the real surface that always-on or other-gated callers need, with no-op or disabled-error bodies. See the Compile-time gate section. || `crates/openhuman-core/src/web3/wallet/test_support.rs` | `#[cfg(test)]` shared plumbing for the keyring/setup tests: `TEST_LOCK`, `setup_wallet_in` (deterministic "abandon ... about" mnemonic), per-chain sample addresses. The chain, execution and quote tests moved to `tinywallet-web3` with fakes. |## Public surface-From `mod.rs` re-exports:+From [`mod.rs`](./mod.rs) re-exports:- Onboarding (`ops`): `setup`, `status`, `reveal_recovery_phrase`, `RevealRecoveryPhraseResult`, `WalletAccount`, `WalletChain`, `WalletSetupParams`, `WalletSetupSource`, `WalletStatus`, `WALLET_NOT_CONFIGURED_MESSAGE`; `pub(crate) secret_material`.- Execution (`execution`): `balances`, `chain_status`, `execute_prepared`, `wallet_network_defaults`, `prepare_transfer`, `tx_status`, `tx_receipt`, `lookup_tx`, `supported_assets`, `prepared_quotes_for_test`; types `BalanceInfo`, `ChainStatus`, `ExecutePreparedParams`, `ExecutionResult`, `PrepareTransferParams`, `PreparedKind`, `PreparedStatus`, `PreparedTransaction`, `ProviderStatus`, `SupportedAsset`, `TxState`, `TxStatusInfo`, `TxReceiptInfo`, `TxLookupInfo` (all from `tinywallet-web3`).@@ -108,7 +108,7 @@ Wired into the registry in `crates/openhuman-core/src/core/all.rs` (controllers## Agent tools-Defined in `tinywallet_web3::tools::wallet`, re-exported via `tools.rs`, built over the process-wide engine in `tools/ops.rs`:+Defined in `tinywallet_web3::tools::wallet`, re-exported via [`tools.rs`](./tools.rs), built over the process-wide engine in `tools/ops.rs`:- `WalletStatusTool`, tool name `wallet_status`- `WalletChainStatusTool`, tool name `wallet_chain_status`@@ -150,7 +150,7 @@ None. The module publishes or subscribes no `DomainEvent`s and has no `bus.rs`.## Notes / gotchas-- `rpc.rs` here is network transport, not RPC controllers. RPC controllers live in `schemas.rs`. This is an exception to the canonical "`rpc.rs` = domain API" convention.+- `rpc.rs` here is network transport, not RPC controllers. RPC controllers live in [`schemas.rs`](./schemas.rs). This is an exception to the canonical "`rpc.rs` = domain API" convention.- Quote-owner binding (`tinywallet_web3::quote::QuoteStore`): `execute_prepared` only runs when the caller's `QuoteScope::current_owner()` equals the prepare-time owner. On mismatch it returns the byte-identical `quote '...' not found` error as a true miss, not an enumeration oracle. Non-chat callers (CLI, direct RPC, background/cron) have `owner == None` and can only execute quotes they also prepared with no chat context. The host's `TaskLocalScope` (`web3/seams.rs`) reads `APPROVAL_CHAT_CONTEXT` synchronously on the tool's own task and relies on the inline `.await` chain in `web_chat::run_chat_task`; detaching the tool loop onto a fresh `tokio::spawn` without re-scoping `APPROVAL_CHAT_CONTEXT` would silently disable the gate.- Quotes are consumed atomically: `QuoteStore::take_for` removes the quote before broadcast so concurrent confirmations can't double-submit; on failure the quote is restored with a refreshed TTL.- Setup requires exactly one account per chain (EVM, BTC, Solana, Tron) and a non-empty encrypted mnemonic; valid mnemonic word counts are 12/15/18/21/24.diff --git a/crates/openhuman-core/src/web3/x402/README.md b/crates/openhuman-core/src/web3/x402/README.mdindex bca93dbac1..fbb43c4ca3 100644--- a/crates/openhuman-core/src/web3/x402/README.md+++ b/crates/openhuman-core/src/web3/x402/README.md@@ -25,7 +25,7 @@ payment construction, the ledger or the tool belongs in `tinywallet`, not here.`pub mod x402;` (declared in `web3/mod.rs`) is always compiled: it is afacade. The real payment surface (`seams`, `schemas`, `budget` and the`tinywallet_x402` re-exports) is gated behind the default-ON `web3` Cargo feature (shared with-`web3` and `web3::wallet`). When the feature is off, `stub.rs` takes its+`web3` and `web3::wallet`). When the feature is off, [`stub.rs`](./stub.rs) takes itsplace and exposes only the three entry points with always-on callers:`init_ledger` (a no-op; the boot call site in `core/runtime/bootstrap.rs` is itselfruntime-gated on `DomainGroup::Web3`), `all_x402_registered_controllers`, and@@ -40,13 +40,13 @@ and does not need a stub. Signatures must match the real ones exactly;| File | Role || --- | --- |-| `mod.rs` | Facade root: feature gate; re-exports from `tinywallet_x402` (`X402Client`, `X402Error`, `X402PaymentResult`, `handle_402`, the ledger and wire types); `init_ledger`, `handle_402_and_pay` and `request_tool`, which supply the seams; the `store` accessors used by `http_request`. |-| `seams.rs` | `WalletPaymentSigner` (the crate's `PaymentSigner`: keyring secret, decrypt, `modules::wallet::{derive_account, sign_message}`), `RuntimeProxyPolicy` (`ProxyPolicy` over `config::apply_runtime_proxy_to_builder`), and the `payments()` / `request_tool()` constructors that pair them with the wallet's `OpenHumanTransport`. |-| `budget.rs` | The spending limits: the crate's defaults plus the `OPENHUMAN_X402_*` overrides. |-| `records.rs` | `pending_record`: the `Pending` ledger record for the `http_request` fallback (ledger session + chat thread). |-| `schemas.rs` | RPC controller schemas and handlers for the `x402` namespace: `get_summary`, `list_payments`, `update_budget`. |-| `stub.rs` | Disabled facade compiled when `web3` is off. See Compile-time gate above. |-| `seams_tests.rs`, `budget_tests.rs`, `stub_tests.rs` | Behavior tests. `stub_tests.rs` runs only in the disabled build. The protocol, builder, ledger and tool tests live in the crate. |+| [`mod.rs`](./mod.rs) | Facade root: feature gate; re-exports from `tinywallet_x402` (`X402Client`, `X402Error`, `X402PaymentResult`, `handle_402`, the ledger and wire types); `init_ledger`, `handle_402_and_pay` and `request_tool`, which supply the seams; the `store` accessors used by `http_request`. |+| [`seams.rs`](./seams.rs) | `WalletPaymentSigner` (the crate's `PaymentSigner`: keyring secret, decrypt, `modules::wallet::{derive_account, sign_message}`), `RuntimeProxyPolicy` (`ProxyPolicy` over `config::apply_runtime_proxy_to_builder`), and the `payments()` / `request_tool()` constructors that pair them with the wallet's `OpenHumanTransport`. |+| [`budget.rs`](./budget.rs) | The spending limits: the crate's defaults plus the `OPENHUMAN_X402_*` overrides. |+| [`records.rs`](./records.rs) | `pending_record`: the `Pending` ledger record for the `http_request` fallback (ledger session + chat thread). |+| [`schemas.rs`](./schemas.rs) | RPC controller schemas and handlers for the `x402` namespace: `get_summary`, `list_payments`, `update_budget`. |+| [`stub.rs`](./stub.rs) | Disabled facade compiled when `web3` is off. See Compile-time gate above. |+| [`seams_tests.rs`](./seams_tests.rs), [`budget_tests.rs`](./budget_tests.rs), [`stub_tests.rs`](./stub_tests.rs) | Behavior tests. `stub_tests.rs` runs only in the disabled build. The protocol, builder, ledger and tool tests live in the crate. |## The seams@@ -78,12 +78,12 @@ from the retry's outcome and the `PAYMENT-RESPONSE` header. It differs from thegeneric `http_request` tool (`tinytools_std::network::HttpRequestTool`, with its payment hook in `tools/impl/network/host.rs`), whichhandles a 402 only as a silent fallback.-The tool is built with `TaskLocalThread` (`seams.rs`), the host's+The tool is built with `TaskLocalThread` ([`seams.rs`](./seams.rs)), the host's`tinywallet_x402::thread::ThreadScope`: it reads the chat thread id from the`APPROVAL_CHAT_CONTEXT` task-local and the crate records it as`PaymentRecord.thread_id` (absent outside a chat turn). `session_id` is alwaysthe ledger's own `x402-<uuid>` boot id. The `http_request` 402 fallback builds-its record with `pending_record` (`records.rs`), which applies the same rule.+its record with `pending_record` ([`records.rs`](./records.rs)), which applies the same rule.## Persistence@@ -101,7 +101,7 @@ its record with `pending_record` (`records.rs`), which applies the same rule.carries (both writers), so it is the process's total; it is not a cap. The chatthread is recorded separately in `thread_id`. `init_ledger` seeds the limits from`OPENHUMAN_X402_PER_REQUEST_MAX` / `OPENHUMAN_X402_DAILY_MAX` /- `OPENHUMAN_X402_MONTHLY_MAX` when set (`budget.rs`); `update_budget` changes+ `OPENHUMAN_X402_MONTHLY_MAX` when set ([`budget.rs`](./budget.rs)); `update_budget` changesthem for the running process only and does not rewrite historical records.## Dependenciesdiff --git a/crates/openhuman-core/src/web_chat/README.md b/crates/openhuman-core/src/web_chat/README.mdindex 8a96239fb2..451bcc120d 100644--- a/crates/openhuman-core/src/web_chat/README.md+++ b/crates/openhuman-core/src/web_chat/README.md@@ -66,19 +66,19 @@ subscriber all listen to.approval can never be blocked by a hook.3. The queue mode decides what happens to a turn already in flight on the- thread. `QueueMode` (`types.rs`) has five values. `Interrupt` (the default)+ thread. `QueueMode` ([`types.rs`](./types.rs)) has five values. `Interrupt` (the default)cancels the current turn and starts this one. `Steer`, `Followup` and`Collect` map to TinyAgents run-queue lanes (`QueueMode::queue_lane`) andare pushed onto the running turn's `RunQueue` instead of starting a turn;with nothing in flight they start a normal turn.`Parallel` starts an isolated fork alongside whatever is running- (`ops/parallel_turn.rs`), tracked in its own `PARALLEL_IN_FLIGHT` table+ ([`ops/parallel_turn.rs`](./ops/parallel_turn.rs)), tracked in its own `PARALLEL_IN_FLIGHT` tablekeyed by request id so it never touches interrupt or queue semantics.4. For a primary turn, `start_chat` records an `InFlightEntry` in `IN_FLIGHT`and spawns a task (under `CoreContext::propagate`) that drives`run_task::run_chat_task` through `run_turn_under_cancel_and_deadline`- (`ops/turn_guards.rs`). That wrapper puts four things around the same+ ([`ops/turn_guards.rs`](./ops/turn_guards.rs)). That wrapper puts four things around the samefuture: a cooperative `CancellationToken`, the wall-clock backstop, the`AgentTurnOrigin::WebChat` scope, and the `APPROVAL_CHAT_CONTEXT`task-local.@@ -102,9 +102,9 @@ subscriber all listen to.and emits an `inference_heartbeat` every `INFERENCE_HEARTBEAT_SECS` (20 s)so a long silent prefill does not trip the frontend's roughly 120 ssilence timeout (#4270). Sub-agent arms live in- `progress_bridge_subagent_events.rs`; time to first visible output is- stamped by `turn_timing.rs`; at the end of a turn- `journal_shadow.rs` compares the live trace spans with the spans+ [`progress_bridge_subagent_events.rs`](./progress_bridge_subagent_events.rs); time to first visible output is+ stamped by [`turn_timing.rs`](./turn_timing.rs); at the end of a turn+ [`journal_shadow.rs`](./journal_shadow.rs) compares the live trace spans with the spansreprojected from the durable journal and logs what differs.7. On success the spawned task calls `presentation::deliver_response`. It@@ -120,7 +120,7 @@ subscriber all listen to.`web_chat.suggestions_enabled`.8. On failure, `run_chat_task` first consults the per-thread budget signal- (`ops/budget_correlation.rs`). An empty 200 on the same provider binding as+ ([`ops/budget_correlation.rs`](./ops/budget_correlation.rs)). An empty 200 on the same provider binding asa recent budget-exhausted failure is reclassified as out-of-credits (#3386),because the managed route closes the stream cleanly when credits run out.The spawned task then runs the error string through@@ -143,7 +143,7 @@ events (they become the turn's reply text), so they carry no key.Background-delivery notices (`agent::orchestration::background_delivery`) andgoal continuations enter through `run_system_turn_on_thread`-(`ops/system_turn.rs`) instead of `start_chat`. They skip ingress, `IN_FLIGHT`+([`ops/system_turn.rs`](./ops/system_turn.rs)) instead of `start_chat`. They skip ingress, `IN_FLIGHT`and the progress bridge, run with `SYSTEM_CLIENT_ID` ("system"), and returnthe reply text for the caller to deliver. They still go through the samesession checkout, so the model sees the conversation and the turn lands in the@@ -161,14 +161,14 @@ turn failed".### Session cache fingerprint-`SessionCacheFingerprint` (`types.rs`) decides when a cached agent can be+`SessionCacheFingerprint` ([`types.rs`](./types.rs)) decides when a cached agent can bereused. It holds the model override, the resolved effective model (so achanged managed default rebuilds even without a picker override), temperature,target agent id, provider binding, an autonomy signature and a model-registrysignature (toggling a model's vision flag keeps the model id but mustrebuild). A miss logs the fields that differ. Adding a dimension that shouldforce a rebuild means adding a field there and filling it in-`build_session_fingerprint` (`session.rs`).+`build_session_fingerprint` ([`session.rs`](./session.rs)).`session::effective_session_config` applies a concrete picker provider andmodel to the per-turn config clone. Managed `openrouter/...` defaults restore@@ -179,7 +179,7 @@ that feeds the fingerprint's binding.### Cancellation and the backstop-`cancel_chat` and `cancel_chat_scoped` (`ops/channel_ops.rs`) cancel by+`cancel_chat` and `cancel_chat_scoped` ([`ops/channel_ops.rs`](./ops/channel_ops.rs)) cancel bythread, or by request id when one is given. A stale cancel for a supersededrequest is ignored (`cancel_should_target`) so the newer turn survives. Withouta request id, a cancel also stops the thread's parallel forks and detached@@ -197,8 +197,8 @@ gets a terminal event instead of an endless heartbeat stream (#4746).### The event bus-`event_bus.rs` holds an in-process `tokio::sync::broadcast` channel of-`WebChannelEvent` (the type is defined in `channel_event.rs`). Any domain can+[`event_bus.rs`](./event_bus.rs) holds an in-process `tokio::sync::broadcast` channel of+`WebChannelEvent` (the type is defined in [`channel_event.rs`](./channel_event.rs)). Any domain canpublish to it with `publish_web_channel_event`; consumers call`subscribe_web_channel_events`. It also registers process-lifetime,`OnceLock`-guarded subscribers on `core::bus::BUS` that turn `DomainEvent`s@@ -210,7 +210,7 @@ into socket events:| `register_artifact_surface_subscriber` | `ArtifactPending`, `ArtifactReady`, `ArtifactFailed` | `artifact_pending`, `artifact_ready`, `artifact_failed` || `register_agent_surface_subscriber` | thread goal, todo and run-mode changes; run-queue queued, delivered, dispatched and interrupted | `thread_goal_updated`, `thread_goal_cleared`, `thread_todos_changed`, `run_mode_changed`, `queue_item_queued`, `queue_item_delivered` || `register_memory_activity_surface_subscriber` | `MemoryStored`, `MemoryRecalled` | `memory_activity` |-| `register_egress_surface_subscriber` (`egress_surface.rs`) | `ExternalTransferPending`, only when the transfer carries chat routing | `external_transfer_pending` |+| `register_egress_surface_subscriber` ([`egress_surface.rs`](./egress_surface.rs)) | `ExternalTransferPending`, only when the transfer carries chat routing | `external_transfer_pending` |They are registered from `core/runtime/bootstrap.rs` and`channels/runtime/startup/start_channels.rs`; the TUI registers the approval@@ -220,41 +220,41 @@ and artifact bridges itself (`openhuman-tui/src/runner.rs`).| Path | What it does || --- | --- |-| `mod.rs` | Module wiring and re-exports. No business logic. |-| `ops.rs` | Thin shell over `ops/`; re-exports the request surface and state. |-| `ops/start_chat.rs` | `start_chat` and `StartChatError`: ingress, guardrail, approval-reply routing, queue dispatch, and the spawned turn body that delivers or classifies. |-| `ops/channel_ops.rs` | `cancel_chat`, `cancel_chat_scoped`, and the `channel_web_*` RPC handlers. |-| `ops/parallel_turn.rs` | Spawns and cancels `QueueMode::Parallel` forks. |-| `ops/system_turn.rs` | `run_system_turn_on_thread` for host-authored turns. |-| `ops/state.rs` | `THREAD_SESSIONS`, `IN_FLIGHT`, `PARALLEL_IN_FLIGHT`, keying helpers, `invalidate_thread_sessions`, `cancel_should_target`. |-| `ops/turn_guards.rs` | `run_turn_under_cancel_and_deadline`, the wall-clock backstop, Sentry suppression and timeout tagging. |-| `ops/budget_correlation.rs` | `THREAD_BUDGET_SIGNALS` and `classify_budget_correlation` for the empty-200-after-budget case. |-| `ops/test_hooks.rs` | Debug/test hooks that force or block `run_chat_task`. |-| `run_task.rs` | `run_chat_task`: checkout, progress bridge, run, budget correlation on error, checkin. |-| `session.rs` | Session checkout and checkin, fingerprinting, `CheckoutPolicy`, target agent id, locale reply directive, per-turn provider and model routing. |-| `progress_bridge.rs` | `spawn_progress_bridge`: `AgentProgress` to `WebChannelEvent`, turn-state mirror, heartbeat. |-| `progress_bridge_subagent_events.rs` | The bridge's `AgentProgress::Subagent*` handlers. |-| `turn_timing.rs` | Time to first visible output, and rate limiting for live `turn_cost` events. |-| `journal_shadow.rs` | Compares live trace spans with spans reprojected from the journal and logs divergences. |-| `presentation.rs` | `deliver_response` (persist, then one `chat_done`), `deliver_response_single_bubble` for core-initiated turns, and legacy `chat_segment` helpers. |-| `reply_persistence.rs` | `persist_delivered_reply`: durable reply row under the deterministic reply id. |-| `suggestions.rs` | Post-turn follow-up suggestions (`chat_suggestions`). |-| `channel_event.rs` | `WebChannelEvent` and its payload types (`TurnUsagePayload`, `GuardrailPayload`, `QueueItemPayload`, `ChatSuggestion`, ...). |-| `event_bus.rs` | The broadcast channel and the `DomainEvent` surface subscribers. |-| `egress_surface.rs` | The `external_transfer_pending` bridge. |-| `web_errors.rs` | Thin shell over `web_errors/`: `classify.rs` (the classification ladder and `ClassifiedError`), `backend_error_code.rs`, `budget.rs`, `retry.rs`, `timeout.rs`. The class to copy table is in `inference/failure_copy/`. |-| `schemas.rs` | Controller schemas and thin handlers for the `channel` namespace. |+| [`mod.rs`](./mod.rs) | Module wiring and re-exports. No business logic. |+| [`ops.rs`](./ops.rs) | Thin shell over [`ops/`](./ops/); re-exports the request surface and state. |+| [`ops/start_chat.rs`](./ops/start_chat.rs) | `start_chat` and `StartChatError`: ingress, guardrail, approval-reply routing, queue dispatch, and the spawned turn body that delivers or classifies. |+| [`ops/channel_ops.rs`](./ops/channel_ops.rs) | `cancel_chat`, `cancel_chat_scoped`, and the `channel_web_*` RPC handlers. |+| [`ops/parallel_turn.rs`](./ops/parallel_turn.rs) | Spawns and cancels `QueueMode::Parallel` forks. |+| [`ops/system_turn.rs`](./ops/system_turn.rs) | `run_system_turn_on_thread` for host-authored turns. |+| [`ops/state.rs`](./ops/state.rs) | `THREAD_SESSIONS`, `IN_FLIGHT`, `PARALLEL_IN_FLIGHT`, keying helpers, `invalidate_thread_sessions`, `cancel_should_target`. |+| [`ops/turn_guards.rs`](./ops/turn_guards.rs) | `run_turn_under_cancel_and_deadline`, the wall-clock backstop, Sentry suppression and timeout tagging. |+| [`ops/budget_correlation.rs`](./ops/budget_correlation.rs) | `THREAD_BUDGET_SIGNALS` and `classify_budget_correlation` for the empty-200-after-budget case. |+| [`ops/test_hooks.rs`](./ops/test_hooks.rs) | Debug/test hooks that force or block `run_chat_task`. |+| [`run_task.rs`](./run_task.rs) | `run_chat_task`: checkout, progress bridge, run, budget correlation on error, checkin. |+| [`session.rs`](./session.rs) | Session checkout and checkin, fingerprinting, `CheckoutPolicy`, target agent id, locale reply directive, per-turn provider and model routing. |+| [`progress_bridge.rs`](./progress_bridge.rs) | `spawn_progress_bridge`: `AgentProgress` to `WebChannelEvent`, turn-state mirror, heartbeat. |+| [`progress_bridge_subagent_events.rs`](./progress_bridge_subagent_events.rs) | The bridge's `AgentProgress::Subagent*` handlers. |+| [`turn_timing.rs`](./turn_timing.rs) | Time to first visible output, and rate limiting for live `turn_cost` events. |+| [`journal_shadow.rs`](./journal_shadow.rs) | Compares live trace spans with spans reprojected from the journal and logs divergences. |+| [`presentation.rs`](./presentation.rs) | `deliver_response` (persist, then one `chat_done`), `deliver_response_single_bubble` for core-initiated turns, and legacy `chat_segment` helpers. |+| [`reply_persistence.rs`](./reply_persistence.rs) | `persist_delivered_reply`: durable reply row under the deterministic reply id. |+| [`suggestions.rs`](./suggestions.rs) | Post-turn follow-up suggestions (`chat_suggestions`). |+| [`channel_event.rs`](./channel_event.rs) | `WebChannelEvent` and its payload types (`TurnUsagePayload`, `GuardrailPayload`, `QueueItemPayload`, `ChatSuggestion`, ...). |+| [`event_bus.rs`](./event_bus.rs) | The broadcast channel and the `DomainEvent` surface subscribers. |+| [`egress_surface.rs`](./egress_surface.rs) | The `external_transfer_pending` bridge. |+| [`web_errors.rs`](./web_errors.rs) | Thin shell over [`web_errors/`](./web_errors/): `classify.rs` (the classification ladder and `ClassifiedError`), `backend_error_code.rs`, `budget.rs`, `retry.rs`, `timeout.rs`. The class to copy table is in `inference/failure_copy/`. |+| [`schemas.rs`](./schemas.rs) | Controller schemas and thin handlers for the `channel` namespace. || `types.rs` | `QueueMode`, `SessionEntry`, `SessionCacheFingerprint`, `InFlightEntry`, `ParallelEntry`, `WebChatTaskResult`, `ChatRequestMetadata`, RPC param structs. |## Key types and entry points-- `start_chat` (`ops/start_chat.rs`) is the entry point for every user turn.+- `start_chat` ([`ops/start_chat.rs`](./ops/start_chat.rs)) is the entry point for every user turn.It returns the new request id, or a `StartChatError`.- `run_system_turn_on_thread` (`ops/system_turn.rs`) runs a host-authored turnon a thread's own session and returns the reply text.- `cancel_chat` / `cancel_chat_scoped` (`ops/channel_ops.rs`) stop a turn bythread or request id.-- `invalidate_thread_sessions` (`ops/state.rs`) drops a thread's cached agent.+- `invalidate_thread_sessions` ([`ops/state.rs`](./ops/state.rs)) drops a thread's cached agent.Thread edit and regenerate (`threads/ops/edit.rs`) and channel remotecontrol (`channels/host/remote_control.rs`) call it.- `ChatRequestMetadata` (`types.rs`) is per-request metadata (`speak_reply`,@@ -270,7 +270,7 @@ and artifact bridges itself (`openhuman-tui/src/runner.rs`).socket surface.- `persist_delivered_reply` and `pick_target_agent_id` are also used by thecron scheduler's origin delivery (`cron/scheduler/origin_delivery.rs`).-- `classify_inference_error` (`web_errors/classify.rs`) maps a flattened+- `classify_inference_error` ([`web_errors/classify.rs`](./web_errors/classify.rs)) maps a flattenederror string to a `ClassifiedError`.## RPC surface@@ -329,10 +329,10 @@ because the in-app chat is core product surface (#5002).## Tests-Tests live in sibling `*_tests.rs` files. `web_tests.rs` and its+Tests live in sibling `*_tests.rs` files. [`web_tests.rs`](./web_tests.rs) and its`web_tests_*_tests.rs` siblings cover `start_chat`, cancellation, queueing,session concurrency and error classification end to end;-`mod_test_support_tests.rs` is the debug/test `test_support` module+[`mod_test_support_tests.rs`](./mod_test_support_tests.rs) is the debug/test `test_support` module(`classify_error_for_test`). The rest are per-file unit tests.```bash