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 README files for core modules and update engines documentation
Steven Enamakel6e6045fd9035
diff --git a/crates/openhuman-core/src/memory/README.md b/crates/openhuman-core/src/memory/README.mdindex 3b6b8245e9..0cc28ea27a 100644--- a/crates/openhuman-core/src/memory/README.md+++ b/crates/openhuman-core/src/memory/README.md@@ -4,7 +4,7 @@ Host layer over the memory stack. The substance of the memory subsystem wasextracted into [`tinymemory-core`](https://github.com/tinyhumansai/tinymemory): theSQLite/vector store, the markdown summary tree, the provider sync pipelines,ingestion, recall/query/search, the ingest queue, conversations, people,-goals and the tool-memory rules. That crate names no OpenHuman type — see+goals and the tool-memory rules. That crate names no OpenHuman type: see[its README](https://github.com/tinyhumansai/tinymemory#readme) for the extractedside of this split.@@ -15,47 +15,47 @@ runner and fails the link check.What stays here, per that split:-- **RPC surface** — [`schemas/`](schemas/) + [`schema/`](schema/), the+- **RPC surface**: [`schemas/`](schemas/) + [`schema/`](schema/), thememory\_\* controller registrations, and [`read_rpc/`](read_rpc/) for reads.-- **Agent tools** — [`tools/`](tools/), [`agent/`](agent/) (the memory agent+- **Agent tools**: [`tools/`](tools/), [`agent/`](agent/) (the memory agent+ prompt), and the consolidated `memory_query` agent tool in[`query/`](query/) (it came back from the extracted crate because theengine crate cannot name the `Tool` trait).-- **Guard** — [`guard/`](guard/), the taint/scope/budget policy gate over+- **Guard**: [`guard/`](guard/), the taint/scope/budget policy gate overevery provider call.-- **Driver binding** — [`binding.rs`](binding.rs) (`memory::binding::for_config`,+- **Driver binding**: [`binding.rs`](binding.rs) (`memory::binding::for_config`,the workspace-keyed driver binding the Layer rules below reference) and[`driver/`](driver/), which provider backs a workspace. The built-in driveris the compiled TinyMemory TinyBus module; there is no in-process enginedriver any more.-- **Ops** — [`ops/`](ops/), RPC handlers that delegate into the core.-- **Contract facade** — [`api.rs`](api.rs) (`memory::api`), the selective- re-export of `tinymemory-api` that is the bus vocabulary — see its own+- **Ops**: [`ops/`](ops/), RPC handlers that delegate into the core.+- **Contract facade**: [`api.rs`](api.rs) (`memory::api`), the selective+ re-export of `tinymemory-api` that is the bus vocabulary: see its ownmodule docs for what it excludes and why.-- **Seam impls** — [`host.rs`](host.rs) — `install_memory_event_sink` and+- **Seam impls**: [`host.rs`](host.rs): `install_memory_event_sink` and`MemoryHostConfig for Config`. Its sibling `host_impls.rs` held the half thatonly an in-process engine could use, and went with the engine when the testbuild stopped linking one (openhuman#6161).-- **Host-owned wire shapes** — [`rpc_models.rs`](rpc_models.rs) /+- **Host-owned wire shapes**: [`rpc_models.rs`](rpc_models.rs) /[`ingestion_models.rs`](ingestion_models.rs), the RPC request/responseshapes that used to live in `tinymemory_core::rpc_models`, re-exported flatfrom [`mod.rs`](mod.rs) (`pub use rpc_models::*`).- **Host-only policy modules**, each with its own reasoning for why it is notthe engine's:- - [`auto_recall/`](auto_recall/) — Lane C, the gated, bounded pre-turn+ - [`auto_recall/`](auto_recall/): Lane C, the gated, bounded pre-turnrecall of facts about the user (#6040).- - [`safety.rs`](safety.rs) — the host-side secret/PII scrubbers applied to+ - [`safety.rs`](safety.rs): the host-side secret/PII scrubbers applied toanything this host persists or hands on.- - [`source_scope.rs`](source_scope.rs) — the host-side per-turn+ - [`source_scope.rs`](source_scope.rs): the host-side per-turnmemory-source allowlist.- - [`obsidian_registry.rs`](obsidian_registry.rs) — is the memory content+ - [`obsidian_registry.rs`](obsidian_registry.rs): is the memory contentroot a vault Obsidian already knows about.- [`exit.rs`](exit.rs), [`sync_activity.rs`](sync_activity.rs),[`sync_events_bridge.rs`](sync_events_bridge.rs),- [`preferences/`](preferences/) — smaller host-side seams; see each file's+ [`preferences/`](preferences/): smaller host-side seams; see each file'sown doc comment.-This module used to be mostly a **re-export** of the engine crate — a wall of+This module used to be mostly a **re-export** of the engine crate: a wall of`pub use tinymemory_core::{chat, global, ingest_pipeline, ingestion,preferences, remember, rpc_models, store, sync_events, traits, util, …}` in[`mod.rs`](mod.rs), so the ~550 `crate::memory::…` paths elsewhere@@ -69,12 +69,12 @@ contract crate is what both this host and the loaded TinyMemory module compileagainst; the engine crate is what the module carries and this binary does notlink. `memory::api` is the re-export of the contract, and its own module docsexplain which parts of `tinymemory-api` are the *bus* surface and which are the-host's own use of the crate — they are not the same set.+host's own use of the crate: they are not the same set.## Wiring`core/all.rs` registers the nine schema families behind the `all_memory_*_registered_controllers`-aliases re-exported from [`mod.rs`](mod.rs) — `core_recall`, `documents`,+aliases re-exported from [`mod.rs`](mod.rs): `core_recall`, `documents`,`ingest`, `files`, `kv_graph`, `sync`, `learn`, `provider`, `tool_memory` —plus [`goals`](goals/)'s, [`people`](people/)'s, and[`tree`](tree/)'s own `all_memory_tree_*`, `all_retrieval_*`, and@@ -106,7 +106,7 @@ wrapper over `pub use tinymemory_core::<domain>::*;` as well.| [`goals/`](goals/) | Goal tracking RPC. || [`people/`](people/) | People/contacts RPC. || [`sources/`](sources/) | Source-registration RPC. |-| [`sync/`](sync/) | `composio/` bus subscribers + providers (incl. Slack), and `sync_status/` — per-connection sync status/progress RPC. |+| [`sync/`](sync/) | `composio/` bus subscribers + providers (incl. Slack), and `sync_status/`: per-connection sync status/progress RPC. || [`tool_memory/`](tool_memory/) | Tool-scoped rules + agent read/write tools. || [`tree/`](tree/) | Tree walk/retrieval RPC. |@@ -124,13 +124,13 @@ owned by TinyCortex and used at ingest time.## Layer rules- **No storage in this module.** All persistence goes through the bound- driver — `memory::binding::for_config(..)` and the `MemoryProvider`+ driver: `memory::binding::for_config(..)` and the `MemoryProvider`capability families behind it. If you are tempted to open a SQLiteconnection here, it belongs on the other side of that contract, in whateverengine the driver fronts. This crate does not link one.- **RPC + tools + guard live here.** Domain logic belongs behind the contract;this module surfaces it over `/rpc` and to agents, and owns the policy that- is genuinely the host's — the taint/scope/budget guard, the approval gate,+ is genuinely the host's: the taint/scope/budget guard, the approval gate,and the workspace a binding is keyed on.- **Surface high-level tool calls** that route to the right submodule;don't expose internals at the call site.diff --git a/crates/openhuman-core/src/memory/agent/README.md b/crates/openhuman-core/src/memory/agent/README.mdindex 1413172438..29268eee70 100644--- a/crates/openhuman-core/src/memory/agent/README.md+++ b/crates/openhuman-core/src/memory/agent/README.md@@ -1,17 +1,17 @@# agent_memory-Memory agent domain — owns the retrieval-focused memory agent, its prompt, and performance instrumentation for memory tree walking and chunk retrieval.+Memory agent domain: owns the retrieval-focused memory agent, its prompt, and performance instrumentation for memory tree walking and chunk retrieval.## PurposeThe memory agent is a specialist sub-agent that navigates the user's memory tree to answer questions. It combines multiple retrieval strategies:-1. **Vector search** — semantic similarity across all stored embeddings-2. **Keyword search** — pattern matching across raw content files on disk-3. **Entity search** — canonical entity lookup and relationship following-4. **Tree browse** — hierarchical navigation of time-based summary trees-5. **Content read** — direct file reads from raw/wiki/episodic/document stores-6. **Source listing** — discovery of available sources and content types+1. **Vector search**: semantic similarity across all stored embeddings+2. **Keyword search**: pattern matching across raw content files on disk+3. **Entity search**: canonical entity lookup and relationship following+4. **Tree browse**: hierarchical navigation of time-based summary trees+5. **Content read**: direct file reads from raw/wiki/episodic/document stores+6. **Source listing**: discovery of available sources and content types## Module layout@@ -21,7 +21,7 @@ The memory agent is a specialist sub-agent that navigates the user's memory tree| `types.rs` | Benchmark and performance tracking types || `ops.rs` | Benchmarking harness for memory walk performance || `tools.rs` | `call_memory_agent` tool implementation, re-exported from [`tools/mod.rs`](../../tools/mod.rs) (`pub use crate::memory::agent::tools::*;`) |-| `memory_loader.rs` | What is left of the old per-turn memory loader: `CROSS_CHAT_HEADER` (the `[Cross-chat context]` block header, bound by `agent/harness/memory_context.rs` and the orchestrator prompt so the wording cannot drift), `MemoryCitation`, and `collect_recall_citations` (called from `agent/session_host/turn/core_turn.rs`; the citations reach `web_chat`'s reply presentation). The per-turn `load_context()` block — two full scans of the `global` namespace every turn — was removed from `core_turn.rs`; see [`memory/auto_recall/mod.rs`](../auto_recall/mod.rs) for what replaced it. The `PRIOR_CONVERSATION_*` constants are leftovers of that block and have no caller. |+| `memory_loader.rs` | What is left of the old per-turn memory loader: `CROSS_CHAT_HEADER` (the `[Cross-chat context]` block header, bound by `agent/harness/memory_context.rs` and the orchestrator prompt so the wording cannot drift), `MemoryCitation`, and `collect_recall_citations` (called from `agent/session_host/turn/core_turn.rs`; the citations reach `web_chat`'s reply presentation). The per-turn `load_context()` block: two full scans of the `global` namespace every turn: was removed from `core_turn.rs`; see [`memory/auto_recall/mod.rs`](../auto_recall/mod.rs) for what replaced it. The `PRIOR_CONVERSATION_*` constants are leftovers of that block and have no caller. |## Memory tree structure@@ -62,8 +62,8 @@ Use the benchmark script to measure retrieval performance:## Agent definitionThe built-in agent is registered at `crates/openhuman-core/src/memory/agent/agent/`:-- `agent.toml` — tool allowlist, model hint, iteration cap-- `prompt.rs` — dynamic prompt builder-- `prompt.md` — system prompt archetype+- `agent.toml`: tool allowlist, model hint, iteration cap+- `prompt.rs`: dynamic prompt builder+- `prompt.md`: system prompt archetype-`agent.toml`'s `[tools] named` allowlist is `memory_recall`, `memory_tree`, `query_memory`, `memory_doctor`, `memory_flavour`, and `ask_user_clarification`. `memory_tree` is the [`memory/query/`](../query/) dispatcher, so its `walk`/`smart_walk`/`search_entities`/`query_source`/`cover_window`/`drill_down`/`fetch_leaves` modes are all reachable; `prompt.md` steers the model to `walk` first. The allowlist is per tool name, not per mode, so the write mode `ingest_document` is technically callable too — nothing in `memory/query/` checks `current_sandbox_mode`, and `sandbox_mode = "read_only"` is only consulted by the Composio tools and by orchestration's write-capability checks, not by memory writes. The agent is read-only by prompt and by intent (`prompt.md` never mentions ingest), not by enforcement.+`agent.toml`'s `[tools] named` allowlist is `memory_recall`, `memory_tree`, `query_memory`, `memory_doctor`, `memory_flavour`, and `ask_user_clarification`. `memory_tree` is the [`memory/query/`](../query/) dispatcher, so its `walk`/`smart_walk`/`search_entities`/`query_source`/`cover_window`/`drill_down`/`fetch_leaves` modes are all reachable; `prompt.md` steers the model to `walk` first. The allowlist is per tool name, not per mode, so the write mode `ingest_document` is technically callable too: nothing in `memory/query/` checks `current_sandbox_mode`, and `sandbox_mode = "read_only"` is only consulted by the Composio tools and by orchestration's write-capability checks, not by memory writes. The agent is read-only by prompt and by intent (`prompt.md` never mentions ingest), not by enforcement.diff --git a/crates/openhuman-core/src/memory/conversations/README.md b/crates/openhuman-core/src/memory/conversations/README.mdindex e8eb77321c..12490b8f91 100644--- a/crates/openhuman-core/src/memory/conversations/README.md+++ b/crates/openhuman-core/src/memory/conversations/README.md@@ -1,26 +1,26 @@# conversations-Workspace-backed conversation thread/message storage — transcript+Workspace-backed conversation thread/message storage: transcriptpersistence, not semantic indexing. This is the JSONL store of rawthread/message records plus a trigram/CJK-bigram index for cross-threadsubstring search; the summary-tree archival of the same transcripts is adifferent index answering a different question and lives in[`memory/tree/`](../tree/). See `mod.rs` for the full accounting of how this-code came back from `tinycortex::memory::conversations` in #5560 — it is not+code came back from `tinycortex::memory::conversations` in #5560: it is notrepeated here.## Three parts-- **`store/`** — the implementation: on-disk format, root lifecycle, sharded+- **`store/`**: the implementation: on-disk format, root lifecycle, shardedmetadata/message locks, the warm index cache, and CRUD/search. Everythingit exposes is re-exported from `mod.rs`, so callers always name`crate::memory::conversations::{…}`, never the `store` subtree directly.-- **`blocking.rs`** — `spawn_blocking` wrappers around every store entry+- **`blocking.rs`**: `spawn_blocking` wrappers around every store entrypoint. The store is synchronous and takes `parking_lot` locks acrossfsync'd file I/O, so calling it from an `async fn` directly would park atokio worker thread for the whole wait; request paths must go through`blocking` instead (#5156).-- **`bus.rs`** — the `core::bus` subscriber+- **`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.diff --git a/crates/openhuman-core/src/memory/guard/README.md b/crates/openhuman-core/src/memory/guard/README.mdindex 7f8b7c4fa1..c2cba1f6e7 100644--- a/crates/openhuman-core/src/memory/guard/README.md+++ b/crates/openhuman-core/src/memory/guard/README.md@@ -6,40 +6,40 @@ and `docs/specs/memory-guard-allowlist.md`; those files were removed from thetree in `0017c58d86`, so the citations are historical and the code commentsare what remains of the argument. `MemoryGuard` implements`MemoryProvider` over the bound driver, so it is the only handle product code-should hold — a caller writes the same code against the guard as against the+should hold: a caller writes the same code against the guard as against theraw driver, and there is no second, unguarded shape to reach for instead.## Public surface-- `pub struct MemoryGuard` (`provider.rs`) — the decorator. Its `as_*`+- `pub struct MemoryGuard` (`provider.rs`): the decorator. Its `as_*`overrides (one per optional family, twenty-three today) hand back guardedfamily handles instead of the inner driver's; see `families.rs` for whythat has to be an owned field per family rather than a value built ondemand.-- `pub struct GuardPolicy` (`policy.rs`) — the resolved policy bundle the+- `pub struct GuardPolicy` (`policy.rs`): the resolved policy bundle theguard and all family decorators share: `enforce_read` / `enforce_write`(the `SecurityPolicy` tier check), `ambient_scope` (source-scope querypredicate), `stamp_taint`, `redact_outbound`, `check_egress`. Binding facts(driver id, `DriverClass`, hook budgets, trust state) are cached at bindtime; the `SecurityPolicy` itself is re-read live on every call so anautonomy change takes effect immediately.-- Family decorators (`families.rs` + `families/` — `types.rs`,+- Family decorators (`families.rs` + `families/`: `types.rs`,`ingest_and_tree.rs`, `retrieval_and_profile.rs`, `graph_and_bookkeeping.rs`,- `typed_ingest_and_answer.rs`) — one+ `typed_ingest_and_answer.rs`): one`decorator!`-generated struct per optional capability family (`GuardedTree`,- `GuardedProfile`, `GuardedGraph`, … — 23 of the contract's 26 families),+ `GuardedProfile`, `GuardedGraph`, …: 23 of the contract's 26 families),each present exactly when the bound driver advertises that family. (The"ten decorators" / "thirteen families" figures still in `families.rs`,`policy.rs` and `test_support.rs` predate the contract growing.)-- `mandatory.rs` — the three families every driver has (`MemoryCore`,+- `mandatory.rs`: the three families every driver has (`MemoryCore`,`MemoryRecall`, `MemoryPortability`), where steps 3, 4 and 6 land for thealways-present surface.-- `budget.rs` — pure char-budget truncation, step 6.-- `audit.rs` — the tracing span and audit event, step 7.-- `in_memory.rs` — `#[doc(hidden)]` in-memory `MemoryProvider` fake for tests+- `budget.rs`: pure char-budget truncation, step 6.+- `audit.rs`: the tracing span and audit event, step 7.+- `in_memory.rs`: `#[doc(hidden)]` in-memory `MemoryProvider` fake for teststhat need a genuine round trip. Not `#[cfg(test)]`: integration tests linkit too.-- `test_support*.rs` — a recording fake that proves a call was made without+- `test_support*.rs`: a recording fake that proves a call was made withoutstoring data.## The seven enforcement steps@@ -47,10 +47,10 @@ raw driver, and there is no second, unguarded shape to reach for instead.| # | Step | Where || - | ---- | ----- || 1 | `SecurityPolicy` tier | `GuardPolicy::enforce_read` / `enforce_write` |-| 1b | path rules | no-op — no contract method carries a path |-| 2 | source scope as a query predicate | `GuardPolicy::ambient_scope`, applied in `GuardedTree::query_source` (not recall — the bound driver refuses a scoped recall) |+| 1b | path rules | no-op: no contract method carries a path |+| 2 | source scope as a query predicate | `GuardPolicy::ambient_scope`, applied in `GuardedTree::query_source` (not recall: the bound driver refuses a scoped recall) || 3 | taint stamping | `GuardPolicy::stamp_taint` (raises, never overrides) |-| 4 | redaction | `GuardPolicy::redact_outbound` — a no-op for embedded drivers |+| 4 | redaction | `GuardPolicy::redact_outbound`: a no-op for embedded drivers || 5 | egress + trust | `GuardPolicy::check_egress` || 6 | char budgets | `budget.rs`, driven by `MemoryHooksConfig` || 7 | audit + tracing | `audit.rs` |@@ -64,29 +64,29 @@ the allowlist test tracks what has not moved onto it).## Calls into- `crate::memory::api::provider::MemoryProvider` (the `tinymemory-api`- contract) — what the guard decorates.-- `crate::security::SecurityPolicy` — the tier check in step 1.-- `crate::memory::source_scope` — the ambient per-turn source allowlist read+ contract): what the guard decorates.+- `crate::security::SecurityPolicy`: the tier check in step 1.+- `crate::memory::source_scope`: the ambient per-turn source allowlist readin step 2.-- `crate::config::schema::MemoryHooksConfig` — the budgets read in step 6.+- `crate::config::schema::MemoryHooksConfig`: the budgets read in step 6.## Called by-- `crate::memory::ops::guard::active_memory_guard` — how a memory RPC+- `crate::memory::ops::guard::active_memory_guard`: how a memory RPChandler reaches the guarded driver (the unguarded`helpers::active_memory_client` it used to sit beside is gone, #5560).-- `CoreContext::memory` (`crate::core::runtime::context`) — resolves+- `CoreContext::memory` (`crate::core::runtime::context`): resolves`memory_binding()` and returns its `.guard()`; this is additive next to`CoreContext::memory_binding()`, which still hands out the bare driver forcallers (like the health probe) that must not run through the tier check.-- `crate::memory::binding` — constructs the `MemoryGuard` at bind time+- `crate::memory::binding`: constructs the `MemoryGuard` at bind time(`MemoryGuard::new`).## Tests- `budget_tests.rs`, `families_tests.rs`, `policy_tests.rs`,- `provider_tests.rs` — unit coverage per file above.-- `../bypass_allowlist_tests.rs` — the ratchet lint: a needle list+ `provider_tests.rs`: unit coverage per file above.+- `../bypass_allowlist_tests.rs`: the ratchet lint: a needle list(`binding::for_workspace(`, `.memory_binding(`, `.unguarded_provider(`,`.profile_store(`, …) scanned over production files, with an `ALLOWED`list carrying a reason per entry (the CLI and `CoreContext` bind sites, thediff --git a/crates/openhuman-core/src/memory/ops/README.md b/crates/openhuman-core/src/memory/ops/README.mdindex 211a4aa73f..4ba34518ba 100644--- a/crates/openhuman-core/src/memory/ops/README.md+++ b/crates/openhuman-core/src/memory/ops/README.md@@ -1,6 +1,6 @@# ops-RPC handlers for the memory system — each returns `RpcOutcome<T>`+RPC handlers for the memory system: each returns `RpcOutcome<T>`(`crate::rpc::RpcOutcome`, `openhuman_rpc::RpcOutcome` re-exported through`pub use openhuman_rpc as rpc;` in `crates/openhuman-core/src/lib.rs`).`memory::ops` is re-exported flat from `crate::memory::mod` (`pub use@@ -13,16 +13,16 @@ rpc;`) kept for call sites that predate the tinymemory-core extraction.| ------ | ---------- || `envelope.rs` | `ApiEnvelope`/`ApiError` wrapping shared by every envelope-style handler (init, list_documents, query_namespace, recall_*, ai_*_memory_file). || `helpers.rs` | Formatting, default constants, path validators, and `current_workspace_dir`. It used to own `active_memory_client`, the unguarded engine lookup; that is gone (#5560) and the file carries a note where it stood. |-| `guard.rs` | `active_memory_guard` — how a handler reaches the guarded driver (`CoreContext::memory()` under dispatch, a `binding::for_workspace` fallback for pre-context tests). Handlers that need the binding itself use `memory::binding::for_config`. |+| `guard.rs` | `active_memory_guard`: how a handler reaches the guarded driver (`CoreContext::memory()` under dispatch, a `binding::for_workspace` fallback for pre-context tests). Handlers that need the binding itself use `memory::binding::for_config`. || `documents.rs` | Document/namespace direct API and the envelope-style façade (`memory_init`, `memory_list_documents`, `memory_query_namespace`, `recall_*`). || `kv_graph.rs` | Key-value and knowledge-graph handlers. || `sync.rs` | `memory_sync_*` and `memory_ingestion_status`. || `learn.rs` | `memory_learn_all`. |-| `provider.rs` | `memory_provider_status` / `memory_subsystem_status` — reports what the memory driver slot is bound to; its health probe deliberately uses `unguarded_provider()` (a liveness probe is not product code; allowlisted in `../bypass_allowlist_tests.rs`). |+| `provider.rs` | `memory_provider_status` / `memory_subsystem_status`: reports what the memory driver slot is bound to; its health probe deliberately uses `unguarded_provider()` (a liveness probe is not product code; allowlisted in `../bypass_allowlist_tests.rs`). || `files.rs` | `ai_*_memory_file` handlers (`tokio::fs`). || `maintenance.rs` | Scheduler-driven housekeeping against the `Maintenance` capability family. || `tool_memory.rs` | Tool-scoped rule read/write handlers. |-| `test_support/` | `shared_memory_test_workspace` — one shared, leaked workspace so concurrent family tests agree on a path instead of racing to bind different ones. |+| `test_support/` | `shared_memory_test_workspace`: one shared, leaked workspace so concurrent family tests agree on a path instead of racing to bind different ones. |## The ops ↔ schemas mirror@@ -34,11 +34,11 @@ The seven handler families (`documents`, `kv_graph`, `sync`, `learn`,calls into. On the schema side `documents` is partitioned three ways(`core_recall` / `documents` / `ingest`), which is why nine`all_<family>_controller_schemas()` / `all_<family>_registered_controllers()`-pairs come out of seven files — so `core::all` can register one capability+pairs come out of seven files: so `core::all` can register one capabilityfamily at a time rather than the namespace as a whole.Do not confuse `memory/schemas/` (this mirror) with `memory/schema/`-(singular) — that is the `memory_tree` namespace's controller schemas+(singular): that is the `memory_tree` namespace's controller schemas(`definitions.rs` / `handlers.rs` / `registry.rs`: chunk store, entities,graph and maintenance methods), deliberately kept as one registry andre-exported through `memory::tree::all_memory_tree_*`, which `core/all.rs`@@ -46,7 +46,7 @@ registers from the tree domain's own push site.## Wiring-`crates/openhuman-core/src/core/all.rs` (around lines 730–790) registers each+`crates/openhuman-core/src/core/all.rs` (around lines 730 to 790) registers eachfamily behind its own alias re-exported from `memory::mod`:`all_memory_core_recall_registered_controllers`,`all_memory_documents_registered_controllers`,diff --git a/crates/openhuman-core/src/memory/query/README.md b/crates/openhuman-core/src/memory/query/README.mdindex 5d75119d4c..930b0e8c02 100644--- a/crates/openhuman-core/src/memory/query/README.md+++ b/crates/openhuman-core/src/memory/query/README.md@@ -8,7 +8,7 @@ This directory lives under `memory/query` rather than instructure, policy, summarisation, and read/write mechanics; `query/` is theLLM-facing surface on top of it. It exists as OpenHuman code (not in theextracted `tinymemory-core` engine crate) because, per [`memory/README.md`](../README.md),-the engine crate cannot name the `Tool` trait — a tool that dispatches by+the engine crate cannot name the `Tool` trait: a tool that dispatches by`mode` has to live on the host side of that split.## The tool@@ -31,8 +31,8 @@ the engine crate cannot name the `Tool` trait — a tool that dispatches byand `smart_walk` both go to `fast_walk::run_fast_walk`. All six per-modestructs are re-exported from this module (and re-exported again, flat,through [`memory/tools.rs`](../tools.rs) via `pub use crate::memory::query::*`)-so callers that want a single mode directly — rather than going through the-`mode`-dispatching wrapper — can still register or call them individually.+so callers that want a single mode directly: rather than going through the+`mode`-dispatching wrapper: can still register or call them individually.Each per-mode struct has its own `name()` (`memory_tree_search_entities`,`memory_tree_ingest_document`, …), which is why the capability match in`tools/ops.rs` has a `starts_with("memory_tree_")` fallback arm.@@ -42,7 +42,7 @@ and `fetch_leaves` call into (`query_source_scope`, `query_source_kind`,`drill_down`, `fetch_leaves`). It resolves the bound driver through`crate::memory::ops::guard::active_memory_guard()` and calls the`MemoryRetrieval` family on the returned `MemoryGuard`, rather than reaching-into `tinymemory_core::tree::retrieval` directly — see the module doc in+into `tinymemory_core::tree::retrieval` directly: see the module doc in`backend.rs` (the spec it cites is not checked in). Every`scope` argument passed to the guard is `None`; the guard intersects that withthe ambient per-turn allowlist, so this can only narrow what a turn may see,diff --git a/crates/openhuman-core/src/memory/read_rpc/README.md b/crates/openhuman-core/src/memory/read_rpc/README.mdindex 283f385bdc..5cf35b5e06 100644--- a/crates/openhuman-core/src/memory/read_rpc/README.md+++ b/crates/openhuman-core/src/memory/read_rpc/README.md@@ -8,7 +8,7 @@ the same authentication, telemetry, and discovery.Distinct from [`memory::ops`](../ops/) (re-exported as `memory::rpc`: the`memory_*` document/KV/graph handlers) and [`memory::tree::retrieval`](../tree/retrieval/)-(LLM-callable retrieval primitives) — see `mod.rs`'s module doc for how the+(LLM-callable retrieval primitives): see `mod.rs`'s module doc for how thethree surfaces divide the space.## Files@@ -18,7 +18,7 @@ three surfaces divide the space.| `admin.rs` | `backfill_connector_trees_rpc`, `delete_source_rpc`, `flush_now_rpc`, `flush_source_tree_rpc`, `reset_tree_rpc`, `wipe_all_rpc` || `chunks.rs` | `list_chunks_rpc`, `list_sources_rpc`, `recall_rpc`, `search_rpc`, plus the `display_name_for_source` / `read_chunk_row` helpers || `entities.rs` | `chunk_score_rpc`, `chunks_for_entity_rpc`, `delete_chunk_rpc`, `entity_index_for_rpc`, `top_entities_rpc` |-| `graph.rs` | `graph_export_rpc` (summary-forest + leaf-chunk graph for the Memory tab, built from `MemoryTree::{summary_forest, recent_leaves}` and `MemoryChunks`/`MemoryEntities` reads — not the contract's key/value `MemoryGraph`) |+| `graph.rs` | `graph_export_rpc` (summary-forest + leaf-chunk graph for the Memory tab, built from `MemoryTree::{summary_forest, recent_leaves}` and `MemoryChunks`/`MemoryEntities` reads: not the contract's key/value `MemoryGraph`) || `vault.rs` | `obsidian_vault_status_rpc`, `vault_health_check_rpc` (filesystem probes behind `spawn_blocking`, delegating the registration check to `crate::memory::obsidian_registry`) || `types.rs` | Wire DTOs shared across the above (`ChunkRow`, `ChunkFilter`, `EntityRef`, `Source`, the `*Response` types, and size limits like `MAX_LIST_LIMIT`) |@@ -29,7 +29,7 @@ super::*;`.Handlers are registered in [`memory/schema/handlers.rs`](../schema/handlers.rs),which calls each `read_rpc::*_rpc` function under the `memory_tree.*`-controller schemas defined in [`memory/schema/`](../schema/) — for example+controller schemas defined in [`memory/schema/`](../schema/): for example`read_rpc::list_chunks_rpc`, `read_rpc::graph_export_rpc`,`read_rpc::wipe_all_rpc`. There is no separate `read_rpc`-only namespace orregistry; it rides the same `memory_tree` controller set as the rest ofdiff --git a/crates/openhuman-core/src/memory/sources/README.md b/crates/openhuman-core/src/memory/sources/README.mdindex 91ba9f46b1..bed6fdcc96 100644--- a/crates/openhuman-core/src/memory/sources/README.md+++ b/crates/openhuman-core/src/memory/sources/README.md@@ -5,7 +5,7 @@ GitHub repos, RSS, web pages, Twitter queries), the readers that pull itemsout of them, per-source sync status, and the `memory_sources_*` JSON-RPCsurface over all three. See `mod.rs` for the #5560 rationale (why this usedto glob `tinymemory_core::sources::*` and what came home versus stayed-upstream) — this file is a map of the directory, not a repeat of that+upstream): this file is a map of the directory, not a repeat of thathistory.The vocabulary is the engine-neutral `tinymemory-sources` crate: `pub mod@@ -21,7 +21,7 @@ of `mod.rs`.| `rpc.rs` + `rpc/` (`registry_crud.rs`, `source_sync.rs`, `apply_all.rs`, `coding_sessions.rs`, `cost_reporting.rs`, `status_toolkits.rs`) | RPC handler implementations for memory sources. || `schemas.rs` + `schemas/` (`registry_schemas.rs`, `sync_schemas.rs`, `apply_all_schemas.rs`, `coding_session_schemas.rs`, `cost_schemas.rs`, `status_schemas.rs`) | Controller-registry schemas for `openhuman.memory_sources_*`. || `status.rs` | Per-source sync status: the chunk-key prefix (derived from the registry entry) and freshness label are host-side; in-flight/chunk counts go through `MemoryChunks::source_ingest_status`. |-| `sync.rs` | `derive_scopes` — which tree scope and raw-archive id a configured source maps onto; the only production-reached piece of the old engine sync pipeline. |+| `sync.rs` | `derive_scopes`: which tree scope and raw-archive id a configured source maps onto; the only production-reached piece of the old engine sync pipeline. || `reconcile.rs` | Startup/list-time reconciliation of active Composio connections into the registry, built on `memory::sync::composio::scan_active_sync_targets`. || `readers/mod.rs` | `SourceReader` trait (takes `&Config`, unlike the crate's `&Path` trait) plus one implementation per `SourceKind`: `composio`, `conversation`, `folder`, `github`, `rss`, `twitter`, `web_page`. This module's `reader_for` hands out all seven, network kinds included, because its callers are RPC handlers acting on an explicit user request; the crate's `reader_for` returns `None` for network kinds. Do not call it from a polling loop. |@@ -40,13 +40,13 @@ re-exported from `schemas::all_registered_controllers`.## Related modules-- [`../sync/`](../sync/) — the bus-driven side: the Composio trigger and+- [`../sync/`](../sync/): the bus-driven side: the Composio trigger andconfig-changed subscribers, `list_sync_targets` (which reads this registryfirst, then falls back to a live scan), the Slack RPC pair, and`sync_status/` for per-connection progress. The data movement itself is`integrations::composio::ops::providers_ops::run_sync_pass`. `sources/`owns *which* connectors are configured and *what* they map onto.-- [`../read_rpc/`](../read_rpc/) — the Memory tab's read RPCs+- [`../read_rpc/`](../read_rpc/): the Memory tab's read RPCs(list/inspect/search over the tree, under the `memory_tree` namespace).`memory_sources.status_list` is the one status read that lives hereinstead, because it is keyed on the registry.diff --git a/crates/openhuman-core/src/memory/tools/README.md b/crates/openhuman-core/src/memory/tools/README.mdindex 5cdbc84b1f..fc439688d7 100644--- a/crates/openhuman-core/src/memory/tools/README.md+++ b/crates/openhuman-core/src/memory/tools/README.md@@ -3,7 +3,7 @@Agent-facing memory tools: `Tool` implementations the model can call directly(as opposed to [`memory/ops/`](../ops/), the RPC handlers used by the app andCLI). The module file for this directory is [`memory/tools.rs`](../tools.rs)-— there is no `tools/mod.rs` — so start there when tracing what is declared+— there is no `tools/mod.rs`: so start there when tracing what is declaredwhere.## Layout@@ -12,7 +12,7 @@ where.directory (`collapsed`, `doctor`, `forget`, `recall`, `store`) plus one`pub(crate)` module (`flavour`, kept crate-visible because`crate::flows::tinyflows::memory_adapter` calls `flavour::lookup_flavour`-directly — see that module's doc comment). Four more are `pub mod` and came+directly: see that module's doc comment). Four more are `pub mod` and cameback from `tinymemory-core` when the memory subsystem was extracted; theirdirectory names track their origin in that crate: `raw_store` was`store/tools/`, `search` was `search/tools/`, `tool_memory` was@@ -41,7 +41,7 @@ per-mode structs are also reachable through this module.`tool_memory/` here (agent tools for reading/writing tool-scoped rules) isdistinct from [`memory/tool_memory/`](../tool_memory/) (the rule store and-prompt rendering it calls into) — same name, different layer, do not confuse+prompt rendering it calls into): same name, different layer, do not confusethe two when grepping.## Wiring@@ -49,7 +49,7 @@ the two when grepping.[`tools/mod.rs`](../../tools/mod.rs) re-exports this module twice: `pub usecrate::memory::agent::tools::*;` (the `call_memory_agent` tool, a siblingdomain) and `pub use crate::memory::tools::goals::*; pub use-crate::memory::tools::*;` — the latter glob brings every struct above, plus+crate::memory::tools::*;`: the latter glob brings every struct above, plusthe re-exported `query/` tools, into `crate::tools::*`.Registration happens in `tools/ops.rs`, which constructs the concrete tool@@ -64,7 +64,7 @@ driver does not advertise a family). Three exported structs have noregistration call site anywhere in the crate as of this writing:`MemoryTool` (the collapsed `memory` action-dispatcher over the eleven`memory_*` tools, which `ops.rs` still registers individually),-`MemoryToolsListTool`, and `MemoryToolsPutTool` — flagged here rather than+`MemoryToolsListTool`, and `MemoryToolsPutTool`: flagged here rather thanassumed wired.`store.rs`'s `MemoryStoreTool` and `forget.rs`'s `MemoryForgetTool` take an@@ -72,7 +72,7 @@ assumed wired.`enforce_tool_operation(ToolOperation::Act, "<tool name>")` before writing:that is the autonomy read-only tier check plus the hourly action budget,nothing content-specific. Neither overrides `permission_level`, so both-still declare the `ReadOnly` default to the approval gate — `collapsed.rs`'s+still declare the `ReadOnly` default to the approval gate: `collapsed.rs`'smodule doc records that as pre-existing and deliberately left alone. Theread tools in this directory take no policy handle.diff --git a/crates/openhuman-core/src/memory/tree/README.md b/crates/openhuman-core/src/memory/tree/README.mdindex ec810a02ee..5149446b14 100644--- a/crates/openhuman-core/src/memory/tree/README.md+++ b/crates/openhuman-core/src/memory/tree/README.md@@ -7,7 +7,7 @@ which the engine crate cannot see, so this directory is what stayed behind:RPC surface, not tree mechanics.`mod.rs` carries the module's own #5560 accounting for why the old `pub use-tinymemory_core::tree::*` glob was deleted — read it there rather than here+tinymemory_core::tree::*` glob was deleted: read it there rather than herefor that history. What resolves under `memory::tree::…` today is the foursubmodules below plus the controller-registry re-exports `mod.rs` aggregatesfrom them (they cannot live in the extracted crate alongside the rest of@@ -19,19 +19,19 @@ from them (they cannot live in the extracted crate alongside the rest of| --- | --- || [`tree/`](tree/) | Host surface over what used to be `tinymemory_core::tree::tree`: the `memory_tree` write/status handlers in `rpc.rs` (`ingest_rpc`, `list_chunks_rpc`, `get_chunk_rpc`, `backfill_status_rpc`, `pipeline_status_rpc`, `doctor_rpc`, `retry_failed_rpc`, `set_enabled_rpc`), and the canonical chat/email/document ingest payload shapes in `canonicalize_types.rs`. Called from [`memory/schema/handlers.rs`](../schema/handlers.rs). || [`tree_runtime/`](tree_runtime/) | The markdown time tree's host surface: JSON-RPC handlers (`ops.rs`, `schemas.rs`), the `tree-summarizer` CLI (`cli.rs`), and an event subscriber (`bus.rs`). Reaches the tree through the contract's six runtime doors (`runtime_buffer_write`, `runtime_read_node`, `runtime_read_children`, `runtime_tree_status`, `runtime_summarize`, `runtime_rebuild`) rather than building an engine config host-side. |-| [`retrieval/`](retrieval/) | Host layer over `tinymemory_core::tree::retrieval`: the retrieval primitives (`query_source`, `cover_window`, `search_entities`, `drill_down`, `fetch_leaves`) as `memory_tree.*` JSON-RPC methods. `rpc.rs` calls the contract's `MemoryRetrieval` family on the **unguarded** `binding.provider()`, so it passes `source_scope::as_bus_scope()` explicitly on every scoped call — read its module doc before touching a scope argument. |-| [`health/`](health/) | The pipeline failure taxonomy (`FailureCode`, `FailureClass`, `PipelineFailure`, `DegradedState`) and the `user_error` wire payload for a web channel, plus the doctor `report` that reads the bound driver's `MemoryMaintenance::{diagnose, degraded_state}`. Not to be confused with `tinymemory_api::health::MemoryHealth` (driver liveness) — see the module doc for the name collision. |+| [`retrieval/`](retrieval/) | Host layer over `tinymemory_core::tree::retrieval`: the retrieval primitives (`query_source`, `cover_window`, `search_entities`, `drill_down`, `fetch_leaves`) as `memory_tree.*` JSON-RPC methods. `rpc.rs` calls the contract's `MemoryRetrieval` family on the **unguarded** `binding.provider()`, so it passes `source_scope::as_bus_scope()` explicitly on every scoped call: read its module doc before touching a scope argument. |+| [`health/`](health/) | The pipeline failure taxonomy (`FailureCode`, `FailureClass`, `PipelineFailure`, `DegradedState`) and the `user_error` wire payload for a web channel, plus the doctor `report` that reads the bound driver's `MemoryMaintenance::{diagnose, degraded_state}`. Not to be confused with `tinymemory_api::health::MemoryHealth` (driver liveness): see the module doc for the name collision. |## Registered RPC namespaces`mod.rs` re-exports three controller registries, wired into `core/all.rs`:- `all_memory_tree_registered_controllers` (from [`memory/schema/`](../schema/),- `mod.rs`'s `pub use crate::memory::schema::{...}`) — the core `memory_tree`+ `mod.rs`'s `pub use crate::memory::schema::{...}`): the core `memory_tree`namespace: `ingest`, `list_chunks`, `get_chunk`, `pipeline_status`,`set_enabled`, `doctor`, `retry_failed`, `memory_backfill_status`,`smart_walk`, plus every [`memory/read_rpc/`](../read_rpc/) method.-- `all_retrieval_registered_controllers` (`retrieval/schemas.rs`) — Phase 4+- `all_retrieval_registered_controllers` (`retrieval/schemas.rs`): Phase 4retrieval tools, also under the `memory_tree` namespace (kept in the samenamespace deliberately, "to keep the tool surface tightly grouped with thePhase 1-3 ingest controllers"): `query_source`, `cover_window`,diff --git a/crates/openhuman-core/src/modules/README.md b/crates/openhuman-core/src/modules/README.mdindex 2e2a7d537b..d4d73c7d4e 100644--- a/crates/openhuman-core/src/modules/README.md+++ b/crates/openhuman-core/src/modules/README.md@@ -1,9 +1,9 @@# modules-The native loadable-module host. A module is a first-party `cdylib` — `tinydocs`,+The native loadable-module host. A module is a first-party `cdylib`: `tinydocs`,`tinywallet`, `tinymemory`, `tinyjuice`, `tinyvoice`, `tinyruntime` (+`tinyruntime-nodejs` / `tinyruntime-python`), `tinymcp`, `tinyconnectors`,-`tinybox`, `tinychannels`, `tinyhosts`, `tinysearch` — that+`tinybox`, `tinychannels`, `tinyhosts`, `tinysearch`: thatspeaks the tinybus module ABI. It is downloaded from a pinned GitHub release,verified against a digest compiled into [`registry.rs`](registry.rs), admittedthrough tinybus's ABI/manifest gates, and attached to a private in-process@@ -31,7 +31,7 @@ directory on `modules`.| `host.rs` | The module broker: a dedicated process-lifetime tokio runtime, its `ModuleHost`, and the host's own `Connection` for calling into loaded modules || `resolution.rs` | One resolution slot per module id, replacing a single global lock so unrelated modules never queue behind each other || `ops.rs` | `ensure_loaded` / `ensure_loaded_within` / `state_of` / `LoadError`; the release cache under `install_dir`; failure caching |-| `boot.rs` | What loads at startup: search-path artifacts, then every `LoadPolicy::Eager` record — deliberately not every registry entry |+| `boot.rs` | What loads at startup: search-path artifacts, then every `LoadPolicy::Eager` record: deliberately not every registry entry || `schemas.rs` | The `modules` RPC namespace (`list`, `status`, `load`) || `documents.rs` | Host half of `tinydocs` (feature `documents`): the three document operations || `browser.rs`, `browser_task.rs` | Typed TinyBrowser bus calls, shared website policy, and bounded Jev task routing; the browser engine remains in the loadable module |@@ -67,7 +67,7 @@ layer.5. The release cache (`tinybus::module::CachedRelease`) downloads if`modules.allow_download`, fetches the release's own `checksum.toml`, checksit against the digest pinned in `registry.rs`, hashes the archive, extracts,- and `dlopen`s — on the module runtime's blocking pool so a cold download+ and `dlopen`s: on the module runtime's blocking pool so a cold downloadnever stalls another task.On Windows desktop installs, the installer contains the registry-pinned`windows-2022-x86_64` archives and their extracted DLLs under@@ -78,7 +78,7 @@ layer.6. tinybus's ABI descriptor, manifest, and dependency gates decide whether theartifact is *admitted*; a faulted or refused module is recorded as`Resolution::Failed` in the resolution table (surfaced as- `LoadError::Failed`) and never retried in this process — restart is the+ `LoadError::Failed`) and never retried in this process: restart is theonly recovery, because tinybus never unloads a library.`boot::load_declared_modules` does two things at startup: it loads search-path@@ -86,7 +86,7 @@ artifacts directly through the host, then calls `ensure_loaded` for every`LoadPolicy::Eager` record (currently only `tinymemory`, and only when`memory::binding::admit` selects the module-backed driver; its host callbacksare installed first). It never fails the boot. Everything else is-`LoadPolicy::Lazy` and resolves on first `ensure_loaded` call — deliberately+`LoadPolicy::Lazy` and resolves on first `ensure_loaded` call: deliberatelynot eager, so a user who never touches a feature never pays its download.## TinySearch development pin@@ -133,13 +133,13 @@ contract, runtime/config/security policy stays in this host.## Security and operational invariantsA loaded module shares this process's address space, privileges, and crash-domain — it is first-party code that happens to ship separately, not a+domain: it is first-party code that happens to ship separately, not asandbox boundary. From `AGENTS.md`, do not weaken these:- Only the compiled registry (`registry.rs`) may select which artifacts canload. There is no RPC method to name an arbitrary path.- Pin release checksums verbatim from the release's own `checksum.toml`. Never- compute a replacement digest from a local build — that would make the check+ compute a replacement digest from a local build: that would make the checkagree with whatever was served instead of with what the release published.- Keep the ABI, manifest, dependency, and digest admission checks intact.- Never unload or repeatedly retry a faulted module in the same process; a@@ -154,14 +154,14 @@ sandbox boundary. From `AGENTS.md`, do not weaken these:## Used by-- `crate::runtime::client` — the ungated facade re-exporting `resolve`,+- `crate::runtime::client`: the ungated facade re-exporting `resolve`,`execute`, `pool_stats`, and `RuntimeCallError` from `modules::runtime`, soa build without `modules` still compiles.-- `memory::binding` — binds `ModuleMemoryProvider` when the memory driver+- `memory::binding`: binds `ModuleMemoryProvider` when the memory driverselects the module-backed class.-- `core::all::all_registered_controllers` — wires the `modules` RPC namespace+- `core::all::all_registered_controllers`: wires the `modules` RPC namespace(`crate::modules::all_registered_controllers()`).-- `config::schema::modules::ModulesConfig` — `enabled`, `allow_download`,+- `config::schema::modules::ModulesConfig`: `enabled`, `allow_download`,`install_dir`, and `overrides` control only whether (and from where) thecompiled-in modules in this directory load, never what is loadable.- The per-module host halves are called from their domains:diff --git a/crates/openhuman-core/src/platform/about_app/README.md b/crates/openhuman-core/src/platform/about_app/README.mdindex 05b3027dcc..2415db7b97 100644--- a/crates/openhuman-core/src/platform/about_app/README.md+++ b/crates/openhuman-core/src/platform/about_app/README.md@@ -1,6 +1,6 @@# about_app-The single source of truth for the OpenHuman desktop app's **user-facing capability catalog**. It enumerates every capability the app exposes to end users — what each one does, where it lives in the UI (`how_to`), its maturity (`stable` / `beta` / `coming_soon` / `deprecated`), and a per-capability privacy disclosure (what data, if any, leaves the device and where it goes). The catalog is a compile-time static table; the module exposes read-only list / lookup / search over it via JSON-RPC. It is stateless — no persistence, no event subscribers, no agent tools.+The single source of truth for the OpenHuman desktop app's **user-facing capability catalog**. It enumerates every capability the app exposes to end users: what each one does, where it lives in the UI (`how_to`), its maturity (`stable` / `beta` / `coming_soon` / `deprecated`), and a per-capability privacy disclosure (what data, if any, leaves the device and where it goes). The catalog is a compile-time static table; the module exposes read-only list / lookup / search over it via JSON-RPC. It is stateless: no persistence, no event subscribers, no agent tools.## Responsibilities@@ -58,22 +58,22 @@ None. No `store.rs`. The catalog is a compile-time `&'static [Capability]` const## Dependencies-- `crate::rpc::RpcOutcome` — return-type contract for ops/handlers.-- `crate::core::all::{ControllerFuture, RegisteredController}` — controller registration types (schemas.rs).-- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller schema definitions (schemas.rs).+- `crate::rpc::RpcOutcome`: return-type contract for ops/handlers.+- `crate::core::all::{ControllerFuture, RegisteredController}`: controller registration types (schemas.rs).+- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: controller schema definitions (schemas.rs).-No dependencies on other `openhuman` domains — capability metadata for other domains is hand-authored text in `catalog.rs`, not imports.+No dependencies on other `openhuman` domains: capability metadata for other domains is hand-authored text in `catalog.rs`, not imports.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers the controllers/schemas into the global RPC/CLI registry and supplies the `about_app` namespace description.-- `crates/openhuman-core/src/memory/sources/rpc/coding_sessions.rs` — references `platform/about_app/catalog_data.rs` in a doc comment, noting `max_sessions` is an untrusted, advertised programmatic RPC input (no code dependency).+- `crates/openhuman-core/src/core/all.rs`: registers the controllers/schemas into the global RPC/CLI registry and supplies the `about_app` namespace description.+- `crates/openhuman-core/src/memory/sources/rpc/coding_sessions.rs`: references `platform/about_app/catalog_data.rs` in a doc comment, noting `max_sessions` is an untrusted, advertised programmatic RPC input (no code dependency).## Notes / gotchas- **`privacy: None` means "unknown", not "safe"** (per `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.+- **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.- A capability's `domain` is a free-text label and does not always equal its `category` wire name (e.g. `embeddings`, `wallet`, `runtime_python`, `devices`, `desktop_companion`, `security`, `tools`, `memory`).- `CapabilityCategory::FromStr` is lenient (case-insensitive, accepts `local-ai`/`local ai`/`localai` aliases); `as_str` emits the canonical snake_case wire name used by serde.diff --git a/crates/openhuman-core/src/platform/connectivity/README.md b/crates/openhuman-core/src/platform/connectivity/README.mdindex c85e2a6563..625d693d53 100644--- a/crates/openhuman-core/src/platform/connectivity/README.md+++ b/crates/openhuman-core/src/platform/connectivity/README.md@@ -1,6 +1,6 @@# connectivity-Diagnostics for the local core's reachability and the live backend Socket.IO state, plus the listen-port selection logic the core uses when it boots its embedded HTTP listener. The frontend has four independent connectivity channels — browser internet, the local core HTTP, the renderer's Socket.IO link to that core, and (via this module's diag snapshot, #6256) the core's own Socket.IO link to the hosted backend — and issue #1527 split them in the UI so users see *which* channel is broken instead of one conflated "Disconnected" pill. This module exposes a cheap `openhuman.connectivity_diag` RPC that snapshots in-memory backend-socket state plus the local core's PID and listening port (no I/O beyond a single TCP probe), suitable for poll-based health checks.+Diagnostics for the local core's reachability and the live backend Socket.IO state, plus the listen-port selection logic the core uses when it boots its embedded HTTP listener. The frontend has four independent connectivity channels: browser internet, the local core HTTP, the renderer's Socket.IO link to that core, and (via this module's diag snapshot, #6256) the core's own Socket.IO link to the hosted backend: and issue #1527 split them in the UI so users see *which* channel is broken instead of one conflated "Disconnected" pill. This module exposes a cheap `openhuman.connectivity_diag` RPC that snapshots in-memory backend-socket state plus the local core's PID and listening port (no I/O beyond a single TCP probe), suitable for poll-based health checks.## Responsibilities@@ -8,7 +8,7 @@ Diagnostics for the local core's reachability and the live backend Socket.IO sta- Resolve the configured core RPC port from the environment (`OPENHUMAN_CORE_RPC_URL` then `OPENHUMAN_CORE_PORT`, defaulting to `7788`).- Snapshot the backend Socket.IO connection state from the global `SocketManager` (reports `"uninitialized"` when the manager singleton isn't registered yet).- Probe whether a TCP port on loopback is already bound (`is_port_in_use`).-- Pick a listen port for the embedded core HTTP listener (`pick_listen_port` / `pick_listen_port_for_host`): try preferred, retry transient `AddrInUse` races, request stale-listener takeover when another OpenHuman core owns the port (#1130) — the embedded desktop path; headless `serve` passes `OccupiedByCore::Fallback` to `pick_listen_port_for_host_with` and moves on instead — otherwise fall back to a port pool.+- Pick a listen port for the embedded core HTTP listener (`pick_listen_port` / `pick_listen_port_for_host`): try preferred, retry transient `AddrInUse` races, request stale-listener takeover when another OpenHuman core owns the port (#1130): the embedded desktop path; headless `serve` passes `OccupiedByCore::Fallback` to `pick_listen_port_for_host_with` and moves on instead: otherwise fall back to a port pool.- Handle Windows OS-excluded port ranges (`WSAEACCES` / os error 10013, Sentry OPENHUMAN-TAURI-500) by routing straight to fallback ports instead of failing.## Key files@@ -16,42 +16,42 @@ Diagnostics for the local core's reachability and the live backend Socket.IO sta| File | Role || --- | --- || `crates/openhuman-core/src/platform/connectivity/mod.rs` | Module docstring + exports; re-exports schema entry points as `all_connectivity_controller_schemas` / `all_connectivity_registered_controllers`. |-| `crates/openhuman-core/src/platform/connectivity/ops.rs` | Pure helper `is_port_in_use(port)` — binds an ephemeral loopback listener to detect an occupied port; unit-tested in isolation. |+| `crates/openhuman-core/src/platform/connectivity/ops.rs` | Pure helper `is_port_in_use(port)`: binds an ephemeral loopback listener to detect an occupied port; unit-tested in isolation. || `crates/openhuman-core/src/platform/connectivity/rpc.rs` | Core logic: `ConnectivityDiagResponse`, `snapshot()`, `diag()` RPC, env port resolution, socket-state snapshot, and the `pick_listen_port*` family with fingerprinting (`identify_listener`) and OS-exclusion handling. || `crates/openhuman-core/src/platform/connectivity/schemas.rs` | Controller schema for the single `connectivity_diag` controller + `handle_diag` delegating to `rpc::diag()`. |## 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`).- `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::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<RpcOutcome<Value>, String>`.- `connectivity::rpc::pick_listen_port(preferred)` / `pick_listen_port_for_host(host, preferred)` → `Result<PickListenPortResult, PickListenPortError>`.- `connectivity::rpc::PickListenPortResult` (`listener`, `port`, `fallback_from`) and `PickListenPortError` (`WouldTakeOver` / `NoAvailablePort` / `BindFailed`).## RPC / controllers-- **`openhuman.connectivity_diag`** (namespace `connectivity`, function `diag`) — read-only, no inputs. Returns a single output field `diag` (JSON) containing the `ConnectivityDiagResponse` snapshot. Described as cheap and safe to poll. Registered via `all_registered_controllers` → `handle_diag` → `rpc::diag()`.+- **`openhuman.connectivity_diag`** (namespace `connectivity`, function `diag`): read-only, no inputs. Returns a single output field `diag` (JSON) containing the `ConnectivityDiagResponse` snapshot. Described as cheap and safe to poll. Registered via `all_registered_controllers` → `handle_diag` → `rpc::diag()`.-Restart/mutate operations are intentionally **not** here — they live in the Tauri shell (`restart_core_process` in `crates/openhuman-app/src/lib.rs`) because they touch the host process tree and can't be answered from inside the core itself.+Restart/mutate operations are intentionally **not** here: they live in the Tauri shell (`restart_core_process` in `crates/openhuman-app/src/lib.rs`) because they touch the host process tree and can't be answered from inside the core itself.## Persistence-None — the module holds no state. The diag snapshot reads only the environment, the in-memory `SocketManager`, and a live TCP probe.+None: the module holds no state. The diag snapshot reads only the environment, the in-memory `SocketManager`, and a live TCP probe.## Dependencies-- `crate::platform::socket::manager::global_socket_manager` — read the live backend Socket.IO `ConnectionStatus` and last error for the diag snapshot.-- `crate::core::all::{ControllerFuture, RegisteredController}` — controller registration types.-- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller schema shape.-- `crate::rpc::RpcOutcome` — RPC return envelope (`RpcOutcome::single_log`).+- `crate::platform::socket::manager::global_socket_manager`: read the live backend Socket.IO `ConnectionStatus` and last error for the diag snapshot.+- `crate::core::all::{ControllerFuture, RegisteredController}`: controller registration types.+- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: controller schema shape.+- `crate::rpc::RpcOutcome`: RPC return envelope (`RpcOutcome::single_log`).- External crates: `reqwest` (HTTP fingerprint probe of a listener's `GET /` root), `tokio` (async `TcpListener`, retry backoff), `serde`/`serde_json`, `url`, `tracing`/`log`.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers the controller (`all_connectivity_registered_controllers`) and schema (`all_connectivity_controller_schemas`), and routes the `"connectivity"` namespace.-- `crates/openhuman-core/src/core/runtime/builder.rs` — calls `connectivity::rpc::pick_listen_port_for_host(...)` during core bind to select the embedded HTTP listener port; afterward syncs `OPENHUMAN_CORE_RPC_URL` to the actual bound port so `resolve_listen_port()` (and thus `connectivity_diag`) reports the live listener after a fallback.-- `crates/openhuman-core/src/platform/mod.rs` — declares the module.+- `crates/openhuman-core/src/core/all.rs`: registers the controller (`all_connectivity_registered_controllers`) and schema (`all_connectivity_controller_schemas`), and routes the `"connectivity"` namespace.+- `crates/openhuman-core/src/core/runtime/builder.rs`: calls `connectivity::rpc::pick_listen_port_for_host(...)` during core bind to select the embedded HTTP listener port; afterward syncs `OPENHUMAN_CORE_RPC_URL` to the actual bound port so `resolve_listen_port()` (and thus `connectivity_diag`) reports the live listener after a fallback.+- `crates/openhuman-core/src/platform/mod.rs`: declares the module.## Notes / gotchasdiff --git a/crates/openhuman-core/src/platform/cost/README.md b/crates/openhuman-core/src/platform/cost/README.mdindex d830972697..0abc4defd6 100644--- a/crates/openhuman-core/src/platform/cost/README.md+++ b/crates/openhuman-core/src/platform/cost/README.md@@ -31,7 +31,7 @@ Local API-usage cost tracking for the agent. Records per-call token usage and coFrom `mod.rs` re-exports:-- `CostTracker` — the tracker (`tracker`).+- `CostTracker`: the tracker (`tracker`).- `init_global`, `try_global`, `record_provider_usage` (`global`).- `all_cost_controller_schemas`, `all_cost_registered_controllers` (`schemas`).- Types: `BudgetStatus`, `CostDashboard`, `CostRecord`, `CostSource`, `CostSummary`, `DailyCostEntry`, `ModelStats`, `TokenUsage`, `UsagePeriod`.@@ -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 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@@ -64,20 +64,20 @@ 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::core::all` — `ControllerFuture`, `RegisteredController` for controller registration.-- `crate::core` — `ControllerSchema`, `FieldSchema`, `TypeSchema`.-- `crate::rpc::RpcOutcome` — RPC return wrapper.+- `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::core::all`: `ControllerFuture`, `RegisteredController` for controller registration.+- `crate::core`: `ControllerSchema`, `FieldSchema`, `TypeSchema`.+- `crate::rpc::RpcOutcome`: RPC return wrapper.- External: `chrono`, `serde`/`serde_json`, `uuid`, `parking_lot`, `once_cell`, `anyhow`, `tempfile` (tests).## Used by-- `crates/openhuman-core/src/core/all.rs` — registers `all_cost_registered_controllers` / `all_cost_controller_schemas`.-- `crates/openhuman-core/src/core/jsonrpc.rs` — calls `cost::init_global(cfg.cost.clone(), &workspace_dir)` at bootstrap.-- `crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs`, `agent/tinyagents/turn_outcome.rs`, `agent/tinyagents/host/budget_gate.rs`, and `agent/subagent_host/` — call `cost::record_provider_usage` after provider calls to log per-turn (and subagent) usage.-- `crates/openhuman-core/src/tools/mod.rs` — re-exports `platform::cost::tools::*`.-- `crates/openhuman-core/src/config/schema/identity_cost.rs` — `CostConfig` retains legacy budget-display fields for wire compatibility.+- `crates/openhuman-core/src/core/all.rs`: registers `all_cost_registered_controllers` / `all_cost_controller_schemas`.+- `crates/openhuman-core/src/core/jsonrpc.rs`: calls `cost::init_global(cfg.cost.clone(), &workspace_dir)` at bootstrap.+- `crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs`, `agent/tinyagents/turn_outcome.rs`, `agent/tinyagents/host/budget_gate.rs`, and `agent/subagent_host/`: call `cost::record_provider_usage` after provider calls to log per-turn (and subagent) usage.+- `crates/openhuman-core/src/tools/mod.rs`: re-exports `platform::cost::tools::*`.+- `crates/openhuman-core/src/config/schema/identity_cost.rs`: `CostConfig` retains legacy budget-display fields for wire compatibility.## Notes / gotchasdiff --git a/crates/openhuman-core/src/platform/doctor/README.md b/crates/openhuman-core/src/platform/doctor/README.mdindex a9334dbaaa..0a5d617772 100644--- a/crates/openhuman-core/src/platform/doctor/README.md+++ b/crates/openhuman-core/src/platform/doctor/README.md@@ -4,14 +4,14 @@ Diagnostic / self-check domain for OpenHuman. Runs a synchronous battery of prob## Responsibilities-- Validate config semantics: config file presence, `api_url` (with fallback resolution), app session JWT / sign-in state, `default_model`, temperature range (0.0–2.0), legacy `reliability.fallback_providers`, model & embedding route entries (empty hints/models, invalid embedding providers, `dimensions=0`), `memory.embedding_model` `hint:` cross-reference, at least one channel configured, and delegate-agent models.+- Validate config semantics: config file presence, `api_url` (with fallback resolution), app session JWT / sign-in state, `default_model`, temperature range (0.0 to 2.0), legacy `reliability.fallback_providers`, model & embedding route entries (empty hints/models, invalid embedding providers, `dimensions=0`), `memory.embedding_model` `hint:` cross-reference, at least one channel configured, and delegate-agent models.- Check workspace integrity: directory existence, write probe (create/write/delete a temp probe file), `memory/` dir, `SYSTEM.md` prompt, and best-effort free disk space (warns under 512 MB; uses `df -m` on Unix, PowerShell `Get-PSDrive` on Windows).- Inspect daemon state file: presence, JSON validity, heartbeat freshness (stale > 30s = error), scheduler component health (stale > 120s), and per-channel component freshness (stale > 300s).- Probe environment commands: `git --version`, `curl --version`, `$SHELL`, and `$HOME`/`$USERPROFILE`.- Probe memory-tree DB: warn on stale `-shm`/`-wal` SQLite side-files or not-yet-created DB; otherwise report the chunk count the bound memory driver answered with (`MemoryMaintenance::store_stats`), taken by `ops::memory_chunk_count` before the blocking hop.- Probe embedding-model health: if provider is `ollama`, do a 3s blocking HTTP GET to `<base_url>/api/tags` and verify the configured model is installed; non-ollama providers report OK without a local probe.- Probe the Claude Agent SDK: if enabled, run `<binary> --version`.-- Probe provider model availability via `run_models` (currently a stub — see Notes).+- Probe provider model availability via `run_models` (currently a stub: see Notes).## Key files@@ -28,8 +28,8 @@ Diagnostic / self-check domain for OpenHuman. Runs a synchronous battery of probFrom `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>`.-- Type alias: `MemoryChunkCount = Result<u64, String>` — the hoisted chunk-count probe.+- 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>`.+- Type alias: `MemoryChunkCount = Result<u64, String>`: the hoisted chunk-count probe.From `ops` (also re-exported as `doctor::rpc`):@@ -63,25 +63,25 @@ None of its own (no `store.rs`). It only **reads** existing state owned by other## Dependencies-- `crate::config::{Config, rpc}` — reads the live config for all probes; `config_rpc::load_config_with_timeout` in the handlers.-- `crate::platform::service::daemon` — `state_file_path` for the daemon heartbeat/component snapshot.-- `crate::memory::binding` — resolves the workspace's bound memory driver so `ops::memory_chunk_count` can ask `MemoryMaintenance::store_stats` for the chunk count. The engine crate is no longer named here (#5560).-- `crate::inference::embedding_host::effective_embedding_settings` — resolves the intended embedding provider/model.-- `crate::inference::{provider, local}` — `provider::list_providers` (model targets) and `local::ollama_base_url` (embedding probe).-- `crate::api::{config, jwt}` — `effective_api_url` fallback resolution and `get_session_token` for sign-in state.-- `crate::core::all::{ControllerFuture, RegisteredController}`, `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller/schema plumbing.-- `crate::rpc::RpcOutcome` — handler return contract.+- `crate::config::{Config, rpc}`: reads the live config for all probes; `config_rpc::load_config_with_timeout` in the handlers.+- `crate::platform::service::daemon`: `state_file_path` for the daemon heartbeat/component snapshot.+- `crate::memory::binding`: resolves the workspace's bound memory driver so `ops::memory_chunk_count` can ask `MemoryMaintenance::store_stats` for the chunk count. The engine crate is no longer named here (#5560).+- `crate::inference::embedding_host::effective_embedding_settings`: resolves the intended embedding provider/model.+- `crate::inference::{provider, local}`: `provider::list_providers` (model targets) and `local::ollama_base_url` (embedding probe).+- `crate::api::{config, jwt}`: `effective_api_url` fallback resolution and `get_session_token` for sign-in state.+- `crate::core::all::{ControllerFuture, RegisteredController}`, `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: controller/schema plumbing.+- `crate::rpc::RpcOutcome`: handler return contract.- External: `reqwest` (blocking client + URL parse), `serde`/`serde_json`, `chrono`, `anyhow`.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers the doctor controllers/schemas into the global RPC + CLI registry (the only in-tree consumer).+- `crates/openhuman-core/src/core/all.rs`: registers the doctor controllers/schemas into the global RPC + CLI registry (the only in-tree consumer).## 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 — `MemoryChunkCount` 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.-- The chunk count comes from the bound driver, and a driver that does not serve `Maintenance` is reported as a **failed probe** rather than as zero. That is the opposite of what the `memory_tree` status RPCs do with a missing family, and deliberately so: a status panel is better off showing an empty store than an error, while the doctor exists to name what is wrong — and "0 chunks" from a driver that cannot count is indistinguishable from a store the user has just watched themselves fill.+- An async probe therefore arrives as an **argument**, resolved in `ops` before the blocking hop: `MemoryChunkCount` 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.+- The chunk count comes from the bound driver, and a driver that does not serve `Maintenance` is reported as a **failed probe** rather than as zero. That is the opposite of what the `memory_tree` status RPCs do with a missing family, and deliberately so: a status panel is better off showing an empty store than an error, while the doctor exists to name what is wrong: and "0 chunks" from a driver that cannot count is indistinguishable from a store the user has just watched themselves fill.- `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.- `model_matches` treats `name` vs `name:tag` as a match only when at most one side is tagged; two differently-tagged names are not considered equal.diff --git a/crates/openhuman-core/src/platform/health/README.md b/crates/openhuman-core/src/platform/health/README.mdindex 008b8b9bd4..06950891ed 100644--- a/crates/openhuman-core/src/platform/health/README.md+++ b/crates/openhuman-core/src/platform/health/README.md@@ -1,13 +1,13 @@# health-In-process health registry for the OpenHuman core. Tracks per-component liveness (status, last-ok / last-error timestamps, restart counts) plus process metadata (PID, uptime), exposes a snapshot over JSON-RPC/CLI, and keeps itself current by subscribing to `system`/`channel` domain events on the global event bus. State is purely in-memory (a process-global `OnceLock` registry) — nothing is persisted to disk. It also serves static system info (version/OS/arch/PID).+In-process health registry for the OpenHuman core. Tracks per-component liveness (status, last-ok / last-error timestamps, restart counts) plus process metadata (PID, uptime), exposes a snapshot over JSON-RPC/CLI, and keeps itself current by subscribing to `system`/`channel` domain events on the global event bus. State is purely in-memory (a process-global `OnceLock` registry): nothing is persisted to disk. It also serves static system info (version/OS/arch/PID).## Responsibilities- Maintain a process-global registry of named components, each with `status`, `updated_at`, `last_ok`, `last_error`, `restart_count`.- Provide mutators: `mark_component_ok`, `mark_component_error`, `bump_component_restart`.- Produce a point-in-time `HealthSnapshot` (PID, uptime seconds, components map) and its JSON form.-- Classify a snapshot into a `HealthVerdict` (`verdict()`): a single degraded *non-critical* component no longer makes the container unhealthy — `/health` returns 503 only when a *critical* component (`CRITICAL_COMPONENTS` = `core`, `memory_tree_db`) is unhealthy; non-critical components (scheduler, channels, update_checker, …) return 200 + a `degraded` flag (#3312).+- Classify a snapshot into a `HealthVerdict` (`verdict()`): a single degraded *non-critical* component no longer makes the container unhealthy: `/health` returns 503 only when a *critical* component (`CRITICAL_COMPONENTS` = `core`, `memory_tree_db`) is unhealthy; non-critical components (scheduler, channels, update_checker, …) return 200 + a `degraded` flag (#3312).- Drive component state automatically from `DomainEvent`s via an event-bus subscriber.- Expose `health.snapshot` and `health.system_info` RPC/CLI controllers.@@ -28,7 +28,7 @@ From `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 (`core::jsonrpc::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.+The HTTP `GET /health` handler (`core::jsonrpc::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`):- `health_snapshot() -> RpcOutcome<serde_json::Value>`, `system_info() -> RpcOutcome<SystemInfo>`, and the `SystemInfo` struct.@@ -68,17 +68,17 @@ None on disk. State lives in a process-global `OnceLock<HealthRegistry>` (lazy-i## Dependencies-- `crate::core::bus::BUS.subscribe` (`crate::core::events::DomainEvent`, `tinybus::SubscriptionHandle`) — to receive system/channel events.-- `crate::core::all` (`ControllerFuture`, `RegisteredController`) and `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — controller registry wiring.-- `crate::rpc::RpcOutcome` — RPC handler return contract.+- `crate::core::bus::BUS.subscribe` (`crate::core::events::DomainEvent`, `tinybus::SubscriptionHandle`): to receive system/channel events.+- `crate::core::all` (`ControllerFuture`, `RegisteredController`) and `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: controller registry wiring.+- `crate::rpc::RpcOutcome`: RPC handler return contract.- External crates: `chrono` (RFC3339 timestamps), `parking_lot::Mutex`, `serde`/`serde_json`, `async_trait`.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers `all_health_*` controllers into the registry.-- `crates/openhuman-core/src/core/jsonrpc.rs` — references health (snapshot/system_info surface).-- `crates/openhuman-core/src/channels/runtime/{startup,supervision}.rs` and `crates/openhuman-core/src/channels/tests/health.rs` — channel runtime updates component health.-- `crates/openhuman-core/src/cron/scheduler.rs`, `crates/openhuman-core/src/platform/update/scheduler.rs` — emit/consume health signals.+- `crates/openhuman-core/src/core/all.rs`: registers `all_health_*` controllers into the registry.+- `crates/openhuman-core/src/core/jsonrpc.rs`: references health (snapshot/system_info surface).+- `crates/openhuman-core/src/channels/runtime/{startup,supervision}.rs` and `crates/openhuman-core/src/channels/tests/health.rs`: channel runtime updates component health.+- `crates/openhuman-core/src/cron/scheduler.rs`, `crates/openhuman-core/src/platform/update/scheduler.rs`: emit/consume health signals.## Notes / gotchas@@ -86,5 +86,5 @@ None on disk. State lives in a process-global `OnceLock<HealthRegistry>` (lazy-i- `upsert_component` creates entries lazily with initial status `"starting"` and always refreshes `updated_at` after the update closure.- `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`.+- 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.diff --git a/crates/openhuman-core/src/platform/proc_metrics/README.md b/crates/openhuman-core/src/platform/proc_metrics/README.mdindex 5c17d5146a..8b344587cf 100644--- a/crates/openhuman-core/src/platform/proc_metrics/README.md+++ b/crates/openhuman-core/src/platform/proc_metrics/README.md@@ -9,7 +9,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/tree.rs` | `sample_tree`, `ChildSample`, `TreeSample` — process-*tree* RSS including descendants. |+| `crates/openhuman-core/src/platform/proc_metrics/tree.rs` | `sample_tree`, `ChildSample`, `TreeSample`: process-*tree* RSS including descendants. |## `ProcSample`@@ -40,7 +40,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*-— the interpreter children a skill run or shell tool spawns — returning a+— 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)are skipped with a stderr note rather than aborting the sample.@@ -48,8 +48,8 @@ are skipped with a stderr note rather than aborting the sample.## Used by- `crates/openhuman-cli/src/bin/rss_bench.rs` and `bin/library_profile/`- (feature `rss-bench`) — the RSS/memory benchmark binaries this module was+ (feature `rss-bench`): the RSS/memory benchmark binaries this module wasbuilt for.- [`docs/library-benchmarking.md`](../../../../../docs/library-benchmarking.md)- — documents the benchmark methodology and points readers here for the+ : documents the benchmark methodology and points readers here for thesampling implementation.diff --git a/crates/openhuman-core/src/platform/service/README.md b/crates/openhuman-core/src/platform/service/README.mdindex 3c16fcb594..4bca8b1e54 100644--- a/crates/openhuman-core/src/platform/service/README.md+++ b/crates/openhuman-core/src/platform/service/README.md@@ -37,8 +37,8 @@ Service-management domain for the OpenHuman core daemon. It installs/uninstallsFrom `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`.+- `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`.- `restart::{apply_startup_restart_delay_from_env, RestartStatus}` (and `restart::trigger_self_restart_now` via the `restart` module path).- `shutdown::ShutdownStatus`.- `schemas::all_service_controller_schemas` / `all_service_registered_controllers`.@@ -50,14 +50,14 @@ Namespace `service` (called as `openhuman.service_<fn>` / `service.<fn>`). All n| Method | Inputs | Output || --- | --- | --- |-| `service.install` | — | `ServiceStatus` |-| `service.start` | — | `ServiceStatus` |-| `service.stop` | — | `ServiceStatus` |-| `service.status` | — | `ServiceStatus` |-| `service.uninstall` | — | `ServiceStatus` |+| `service.install` |: | `ServiceStatus` |+| `service.start` |: | `ServiceStatus` |+| `service.stop` |: | `ServiceStatus` |+| `service.status` |: | `ServiceStatus` |+| `service.uninstall` |: | `ServiceStatus` || `service.restart` | `source?`, `reason?` | restart ack JSON (`RestartStatus`) || `service.shutdown` | `source?`, `reason?` | shutdown ack JSON (`ShutdownStatus`) |-| `service.daemon_host_get` | — | `DaemonHostConfig` |+| `service.daemon_host_get` |: | `DaemonHostConfig` || `service.daemon_host_set` | `show_tray` (required) | `DaemonHostConfig` |Lifecycle handlers load config via `config::rpc::load_config_with_timeout`; `restart`/`shutdown` are intentionally config-free (they target the running process).@@ -71,43 +71,43 @@ Publishes (in `restart.rs` / `shutdown.rs`) to the global event bus, domain `sysSubscribes (in `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).+- `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).Both subscribers are registered idempotently from `crates/openhuman-core/src/core/jsonrpc.rs` at startup via `register_restart_subscriber` / `register_shutdown_subscriber`; handles are held in process-lifetime `OnceLock`s so they are never dropped.## 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 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.+- **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 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.## Dependencies-- `crate::config` — `Config` (paths, config dir) for every lifecycle/path operation; `config::rpc::load_config_with_timeout` in the schema handlers.-- `crate::core::bus::BUS` (`tinybus::OnceBus<DomainEvent>`) — `publish` / `subscribe` for restart/shutdown orchestration; `crate::core::events::DomainEvent` for the event catalog.-- `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`) and `crate::core::all` (`ControllerFuture`, `RegisteredController`) — controller schema/registration contract.-- `crate::rpc::RpcOutcome` — standard RPC result envelope.+- `crate::config`: `Config` (paths, config dir) for every lifecycle/path operation; `config::rpc::load_config_with_timeout` in the schema handlers.+- `crate::core::bus::BUS` (`tinybus::OnceBus<DomainEvent>`): `publish` / `subscribe` for restart/shutdown orchestration; `crate::core::events::DomainEvent` for the event catalog.+- `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`) and `crate::core::all` (`ControllerFuture`, `RegisteredController`): controller schema/registration contract.+- `crate::rpc::RpcOutcome`: standard RPC result envelope.- External: `anyhow`, `serde`/`serde_json`, `tokio`, `async_trait`, plus OS CLIs (`launchctl`, `systemctl`, `schtasks`).## Used by-- `crates/openhuman-core/src/core/all.rs` — registers the service controllers (`all_service_registered_controllers`).-- `crates/openhuman-core/src/core/jsonrpc.rs` — registers the restart/shutdown event-bus subscribers at startup.-- `crates/openhuman-core/src/platform/doctor/core.rs` — reads `service::daemon::state_file_path`.-- `crates/openhuman-core/src/platform/update/ops.rs` (`rpc::service_restart` after a self-replace), `crates/openhuman-core/src/config/ops/loader/runtime_flags.rs` (`mock::mock_agent_running`), `crates/openhuman-core/src/desktop/app_state/ops/{types,runtime_snapshot}.rs` (`ServiceState`/`ServiceStatus`, `status`) — call into `crate::platform::service`.-- `crates/openhuman-core/src/tools/mod.rs` — re-exports `platform::service::tools::*`.-- `lib.rs` — module wiring.+- `crates/openhuman-core/src/core/all.rs`: registers the service controllers (`all_service_registered_controllers`).+- `crates/openhuman-core/src/core/jsonrpc.rs`: registers the restart/shutdown event-bus subscribers at startup.+- `crates/openhuman-core/src/platform/doctor/core.rs`: reads `service::daemon::state_file_path`.+- `crates/openhuman-core/src/platform/update/ops.rs` (`rpc::service_restart` after a self-replace), `crates/openhuman-core/src/config/ops/loader/runtime_flags.rs` (`mock::mock_agent_running`), `crates/openhuman-core/src/desktop/app_state/ops/{types,runtime_snapshot}.rs` (`ServiceState`/`ServiceStatus`, `status`): call into `crate::platform::service`.+- `crates/openhuman-core/src/tools/mod.rs`: re-exports `platform::service::tools::*`.+- `lib.rs`: module wiring.## 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` and `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".-- `OPENHUMAN_SERVICE_MOCK` short-circuits **every** lifecycle dispatcher to the file-backed mock — used for deterministic E2E; it can also inject forced per-operation failures.+- `OPENHUMAN_SERVICE_MOCK` short-circuits **every** lifecycle dispatcher to the file-backed mock: used for deterministic E2E; it can also inject forced per-operation failures.- Windows command spawns set `CREATE_NO_WINDOW` (`common::no_window`) so polled `schtasks /Query` calls don't flash a console.- Lifecycle RPCs are deliberately **not** unit-tested (they mutate real OS state or kill the process); RPC-adapter coverage lives in `tests/json_rpc_e2e.rs`. `daemon_host_get`/`set` and the restart/shutdown publish paths are unit-tested.- `daemon.rs::state_file_path` and `common.rs::state_file_path` (mock) both compute paths next to config but for different files (`daemon_state.json` vs the mock state file).diff --git a/crates/openhuman-core/src/platform/socket/README.md b/crates/openhuman-core/src/platform/socket/README.mdindex 13e26873ed..944c89865e 100644--- a/crates/openhuman-core/src/platform/socket/README.md+++ b/crates/openhuman-core/src/platform/socket/README.md@@ -7,7 +7,7 @@ Persistent, Rust-native Socket.IO client to the OpenHuman backend. The `socket`- Open and maintain a persistent Socket.IO connection to the backend over a raw WebSocket; perform the Engine.IO OPEN and Socket.IO CONNECT handshakes by hand.- Authenticate the SIO CONNECT with a JWT and reconnect automatically with exponential backoff (1 s → 30 s cap). Every connect attempt (DNS + TCP + TLS + upgrade) is bounded at 10 s per redirect hop (`CONNECT_TIMEOUT`), so a path that accepts the connection and then goes silent fails the attempt instead of parking the loop until the far end gives up (#6256).- Follow HTTP 3xx redirects during the upgrade (up to 3 hops) so a `http://`-configured `BACKEND_URL` behind a TLS-forcing edge connects cleanly; pin the resolved URL for subsequent reconnects and surface a one-shot "stale BACKEND_URL" warning for permanent redirects.-- Refresh the session token before every reconnect via a `TokenProvider` callback (live re-read of the profile store) instead of caching a single token — fixes the "Invalid token" retry storm (#2892 / TAURI-RUST-9C).+- Refresh the session token before every reconnect via a `TokenProvider` callback (live re-read of the profile store) instead of caching a single token: fixes the "Invalid token" retry storm (#2892 / TAURI-RUST-9C).- Fast-fail on a definitively dead token (server "Invalid token" + no fresher token available) rather than burning the whole backoff budget.- Track connection status / socket id / last user-visible error / loop liveness (`SharedState::loop_active` + `loop_stopped_on_failure`, `SocketManager::is_loop_active` / `loop_stopped_on_failure`, surfaced as `connectivity_diag.socket_loop_active` / `socket_loop_stopped_on_failure`) in shared state and expose it via RPC. A loop that exits because no usable session token exists raises the failure flag so the frontend can say "sign in again" instead of showing nothing. Between attempts the loop reports `Reconnecting`; `Disconnected` means the loop is not running (signed out, session expired, shutdown), which is what the frontend's connectivity chip relies on to show "down, retrying" and stay quiet for "never wanted" (#6256).- Parse inbound Socket.IO EVENT frames and publish them as `DomainEvent`s for other domains to consume; emit outbound events.@@ -29,9 +29,9 @@ Persistent, Rust-native Socket.IO client to the OpenHuman backend. The `socket`## Public surface-- `SocketManager` — the connection handle. Key methods: `new`, `connect(url, token)`, `connect_with_provider(url, provider)`, `disconnect`, `emit(event, data)`, `emit_with_ack(event, data, timeout)`, `get_state() -> SocketState`, `is_connected`, `set_webhook_router` / `webhook_router`.-- `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`.+- `SocketManager`: the connection handle. Key methods: `new`, `connect(url, token)`, `connect_with_provider(url, provider)`, `disconnect`, `emit(event, data)`, `emit_with_ack(event, data, timeout)`, `get_state() -> SocketState`, `is_connected`, `set_webhook_router` / `webhook_router`.+- `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.@@ -42,16 +42,16 @@ Namespace `socket` (called as `openhuman.socket_<function>`):| Function | Inputs | Output | Notes || --- | --- | --- | --- || `connect` | `url` (str, req), `token` (str, req) | `status` | Connect with an explicit static token. |-| `disconnect` | — | `status` | Tear down the loop. |-| `state` | — | `state` (JSON: status, socket_id, error) | |+| `disconnect` |: | `status` | Tear down the loop. |+| `state` |: | `state` (JSON: status, socket_id, error) | || `emit` | `event` (str, req), `data` (JSON, opt) | `ok` (bool) | Emit a SIO event to the backend. |-| `connect_with_session` | — | `status` | Loads config, derives the API URL, and connects with a **live-refresh** token provider reading the stored session token from the profile store on every reconnect. |+| `connect_with_session` |: | `status` | Loads config, derives the API URL, and connects with a **live-refresh** token provider reading the stored session token from the profile store on every reconnect. |All handlers go through `require_manager()` and error with `"SocketManager not initialized"` if the global singleton is unset.## Events-`event_handlers::handle_sio_event` is a thin transport router — it does not run domain logic itself. It mutates connection status for `ready`/`error` and publishes the following `DomainEvent`s via `crate::core::bus::BUS.publish` for other domains' bus subscribers:+`event_handlers::handle_sio_event` is a thin transport router: it does not run domain logic itself. It mutates connection status for `ready`/`error` and publishes the following `DomainEvent`s via `crate::core::bus::BUS.publish` for other domains' bus subscribers:| Inbound SIO event | Published `DomainEvent` | Consumer domain || --- | --- | --- |@@ -63,7 +63,7 @@ All handlers go through `require_manager()` and error with `"SocketManager not i| `*:message` (suffix match) | `ChannelInboundMessage { event_name, channel, message, sender, reply_target, thread_ts, raw_data }` | channels |-This module is a **publisher only** — it owns no `bus.rs` / `EventHandler` impls.+This module is a **publisher only**: it owns no `bus.rs` / `EventHandler` impls.## Persistence@@ -71,35 +71,35 @@ None of its own. State (`status`, `socket_id`, `error`, attached `WebhookRouter`## Dependencies-- `crate::api::models::socket` — `ConnectionStatus`, `SocketState` DTOs.-- `crate::api::socket::websocket_url`, `crate::api::config::effective_backend_api_url`, `crate::api::jwt::get_session_token` — URL derivation and session-token lookup.-- `crate::core::all` — `ControllerFuture`, `RegisteredController` for the controller registry.-- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}` — RPC schema types.-- `crate::core::bus::BUS.publish` / `crate::core::events::DomainEvent` — for routing inbound events.-- `crate::core::observability::report_error_or_expected` — one-shot sustained-outage classification at the failure threshold.-- `crate::skills::webhooks` — `WebhookRouter` (attached for parse-error logging / response emission) and `WebhookRequest`.-- `crate::integrations::composio` — `ComposioTriggerEvent` DTO for `composio:trigger` deserialization.-- `crate::security::devices::tunnel_client` — `TunnelPeerStatus`, `TunnelFrame` DTOs for tunnel events.-- `crate::config` — `Config` + `rpc::load_config_with_timeout` for `connect_with_session`.-- `crate::util::utf8_safe_prefix_at_byte_boundary` — UTF-8-safe log truncation of raw packets.+- `crate::api::models::socket`: `ConnectionStatus`, `SocketState` DTOs.+- `crate::api::socket::websocket_url`, `crate::api::config::effective_backend_api_url`, `crate::api::jwt::get_session_token`: URL derivation and session-token lookup.+- `crate::core::all`: `ControllerFuture`, `RegisteredController` for the controller registry.+- `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`: RPC schema types.+- `crate::core::bus::BUS.publish` / `crate::core::events::DomainEvent`: for routing inbound events.+- `crate::core::observability::report_error_or_expected`: one-shot sustained-outage classification at the failure threshold.+- `crate::skills::webhooks`: `WebhookRouter` (attached for parse-error logging / response emission) and `WebhookRequest`.+- `crate::integrations::composio`: `ComposioTriggerEvent` DTO for `composio:trigger` deserialization.+- `crate::security::devices::tunnel_client`: `TunnelPeerStatus`, `TunnelFrame` DTOs for tunnel events.+- `crate::config`: `Config` + `rpc::load_config_with_timeout` for `connect_with_session`.+- `crate::util::utf8_safe_prefix_at_byte_boundary`: UTF-8-safe log truncation of raw packets.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers the socket controllers.-- `crates/openhuman-core/src/core/jsonrpc.rs` (`set_global_socket_manager` at bootstrap), `crates/openhuman-core/src/core/runtime/services.rs` (backend auto-connect with `token_provider_from_config`), `crates/openhuman-core/src/core/observability.rs` — reference the socket namespace/state.-- `crates/openhuman-core/src/platform/connectivity/rpc.rs` — connectivity/status surfacing.-- `crates/openhuman-core/src/skills/webhooks/{ops.rs,bus.rs}` — emit webhook responses back through the global manager.-- `crates/openhuman-core/src/security/devices/tunnel_client.rs` — emits tunnel frames/registration over the socket.+- `crates/openhuman-core/src/core/all.rs`: registers the socket controllers.+- `crates/openhuman-core/src/core/jsonrpc.rs` (`set_global_socket_manager` at bootstrap), `crates/openhuman-core/src/core/runtime/services.rs` (backend auto-connect with `token_provider_from_config`), `crates/openhuman-core/src/core/observability.rs`: reference the socket namespace/state.+- `crates/openhuman-core/src/platform/connectivity/rpc.rs`: connectivity/status surfacing.+- `crates/openhuman-core/src/skills/webhooks/{ops.rs,bus.rs}`: emit webhook responses back through the global manager.+- `crates/openhuman-core/src/security/devices/tunnel_client.rs`: emits tunnel frames/registration over the socket.## 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).-- **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).+- **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).+- **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).- A genuinely fresh token from the invalid-token decision is **carried forward** (`pending_token`) so the next iteration uses the exact validated value, avoiding a redundant profile-store lock/disk read.- Sentry escalation fires exactly once, on the 5th consecutive failure (~15 s of accumulated backoff), and is routed through the observability classifier so offline/transport shapes demote to a breadcrumb (OPENHUMAN-TAURI-8M / -BH).-- A connect attempt that outlives `CONNECT_TIMEOUT` is rendered as `WsError::Io(TimedOut)` with the `operation timed out` phrase on purpose — that is the substring `is_network_unreachable_message` demotes, so a sustained blackhole never pages. Keep the wording if you touch it.+- A connect attempt that outlives `CONNECT_TIMEOUT` is rendered as `WsError::Io(TimedOut)` with the `operation timed out` phrase on purpose: that is the substring `is_network_unreachable_message` demotes, so a sustained blackhole never pages. Keep the wording if you touch it.- The ping-timeout warning carries the connection age, the number of Engine.IO pings the connection ever received, and the frames sent since the last server frame; a successful handshake after an outage logs `Reconnected after Ns (N failed attempt(s))`. Both exist so a drop report can be root-caused from the log alone (#6256): drops that always land at the same connection age point at a lifetime ceiling on the path (#5603), zero pings on a minutes-old connection point at the server.- Redirect following only persists the "update BACKEND_URL" warning for permanent redirects (301/308); temporary (302/307) hops don't (CodeRabbit, #1547).-- No agent tools and no `bus.rs` — this is a transport domain that publishes events for others to handle.+- No agent tools and no `bus.rs`: this is a transport domain that publishes events for others to handle.diff --git a/crates/openhuman-core/src/platform/startup/README.md b/crates/openhuman-core/src/platform/startup/README.mdindex 18f329a448..c657cc1cc8 100644--- a/crates/openhuman-core/src/platform/startup/README.md+++ b/crates/openhuman-core/src/platform/startup/README.md@@ -1,6 +1,6 @@# startup-Generic OpenHuman process-startup helpers. Currently a thin, stateless module whose sole job is to run one-shot workspace migrations during core boot. It centralizes "do this once when the process comes up" logic so the transport layer (`crates/openhuman-core/src/core/jsonrpc.rs`) can fire it without owning migration details. Failures are logged and never abort startup — individual migration helpers own their own idempotency markers.+Generic OpenHuman process-startup helpers. Currently a thin, stateless module whose sole job is to run one-shot workspace migrations during core boot. It centralizes "do this once when the process comes up" logic so the transport layer (`crates/openhuman-core/src/core/jsonrpc.rs`) can fire it without owning migration details. Failures are logged and never abort startup: individual migration helpers own their own idempotency markers.## Responsibilities@@ -14,11 +14,11 @@ Generic OpenHuman process-startup helpers. Currently a thin, stateless module wh| File | Role || --- | --- || `crates/openhuman-core/src/platform/startup/mod.rs` | Export-only: module docstring + `pub mod ops;` + re-export of `run_workspace_migrations`. |-| `crates/openhuman-core/src/platform/startup/ops.rs` | Implementation of `run_workspace_migrations` — orchestrates the two workspace migrations and logging. |+| `crates/openhuman-core/src/platform/startup/ops.rs` | Implementation of `run_workspace_migrations`: orchestrates the two workspace migrations and logging. |## Public surface-- `run_workspace_migrations(workspace_dir: &Path)` (re-exported from `ops`) — the only public entry point. Returns nothing; all failure handling is internal/logged.+- `run_workspace_migrations(workspace_dir: &Path)` (re-exported from `ops`): the only public entry point. Returns nothing; all failure handling is internal/logged.## RPC / controllers@@ -38,16 +38,16 @@ No own state/store. It triggers migrations that mutate on-disk workspace artifac## Dependencies-- `tinyagents_session::transcript` — owns the durable session layout and transcript transitions.-- `crate::threads::migrate_welcome_agent_artifacts` — performs the welcome-agent → orchestrator artifact migration.+- `tinyagents_session::transcript`: owns the durable session layout and transcript transitions.+- `crate::threads::migrate_welcome_agent_artifacts`: performs the welcome-agent → orchestrator artifact migration.## Used by-- `crates/openhuman-core/src/core/jsonrpc.rs` (core boot path) — the only caller; invokes `run_workspace_migrations(&workspace_dir)` during core startup, after approval-gate wiring and before MCP registry boot-spawn.+- `crates/openhuman-core/src/core/jsonrpc.rs` (core boot path): the only caller; invokes `run_workspace_migrations(&workspace_dir)` during core startup, after approval-gate wiring and before MCP registry boot-spawn.## Notes / gotchas- **Non-fatal by design**: every migration branch logs and continues; a failed migration must never block startup.-- **Idempotency is delegated**: this module does not track whether a migration already ran — it relies on each helper's own `already_done` markers. Re-running is safe.+- **Idempotency is delegated**: this module does not track whether a migration already ran: it relies on each helper's own `already_done` markers. Re-running is safe.- **Grep-friendly log prefixes**: `[runtime]` for session-layout, `[migration::welcome-to-orchestrator]` for the thread/artifact migration.-- Module is intentionally minimal — no `types.rs`/`store.rs`/`schemas.rs` because it holds no domain types, no persisted state, and no RPC surface.+- Module is intentionally minimal: no `types.rs`/`store.rs`/`schemas.rs` because it holds no domain types, no persisted state, and no RPC surface.diff --git a/crates/openhuman-core/src/platform/update/README.md b/crates/openhuman-core/src/platform/update/README.mdindex cc5c13e20d..f9fe445b3b 100644--- a/crates/openhuman-core/src/platform/update/README.md+++ b/crates/openhuman-core/src/platform/update/README.md@@ -25,23 +25,23 @@ Self-update domain for the `openhuman-core` binary. Checks GitHub Releases (`tin## 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(...)`.-- `update::rpc` (alias of `ops`): `update_version`, `update_check`, `update_apply`, `update_run` — all returning `RpcOutcome<Value>`.-- `update::scheduler::run(UpdateConfig)` — background loop entry point.+- `update::rpc` (alias of `ops`): `update_version`, `update_check`, `update_apply`, `update_run`: all returning `RpcOutcome<Value>`.+- `update::scheduler::run(UpdateConfig)`: background loop entry point.- `all_update_controller_schemas()` / `all_update_registered_controllers()`.## RPC / controllersAll under namespace `update` (i.e. `openhuman.update_*`):| Method | Inputs | Output || --- | --- | --- |-| `update.version` | none | `version_info` (`VersionInfo`) — cheap, no network. |+| `update.version` | none | `version_info` (`VersionInfo`): cheap, no network. || `update.check` | none | `update_info` (`UpdateInfo`). |-| `update.apply` | `download_url` (req), `asset_name` (req), `staging_dir` (optional, **ignored** — always default dir) | `apply_result` (`UpdateApplyResult`). |-| `update.run` | none | `run_result` (`UpdateRunResult`) — orchestrated check→stage→restart. |+| `update.apply` | `download_url` (req), `asset_name` (req), `staging_dir` (optional, **ignored**: always default dir) | `apply_result` (`UpdateApplyResult`). |+| `update.run` | none | `run_result` (`UpdateRunResult`): orchestrated check→stage→restart. |`apply` and `run` are gated by `enforce_update_mutation_policy` (fail-closed if config can't load) and re-validate the URL (must be HTTPS GitHub host) and asset name (must start `openhuman-core-`, no path separators / `..`).## Agent tools-Not owned here — the domain has no `tools.rs`. Two cross-cutting system tools wrap it: `crates/openhuman-core/src/tools/impl/system/update_check.rs` (read-only, calls `update::rpc::update_check`) and `crates/openhuman-core/src/tools/impl/system/update_apply.rs` (calls `update::rpc::update_run`).+Not owned here: the domain has no `tools.rs`. Two cross-cutting system tools wrap it: `crates/openhuman-core/src/tools/impl/system/update_check.rs` (read-only, calls `update::rpc::update_check`) and `crates/openhuman-core/src/tools/impl/system/update_apply.rs` (calls `update::rpc::update_run`).## EventsNo `bus.rs`. The scheduler *publishes* (via `crate::core::bus::BUS.publish`):@@ -51,30 +51,30 @@ No `bus.rs`. The scheduler *publishes* (via `crate::core::bus::BUS.publish`):It also calls `crate::core::bus::init()` (idempotent against an already-initialised bus) and `health::bus::register_health_subscriber()` on start.## Persistence-None. No `store.rs` — staged binaries are written to the filesystem (current-exe dir by default), but the domain holds no persisted state of its own. Configuration is read from `config.update`.+None. No `store.rs`: staged binaries are written to the filesystem (current-exe dir by default), but the domain holds no persisted state of its own. Configuration is read from `config.update`.## Dependencies-- `crate::config` — reads `UpdateConfig` (`enabled`, `interval_minutes`, `rpc_mutations_enabled`, `restart_strategy`) and `UpdateRestartStrategy`; `ops` loads it via `config::rpc::load_config_with_timeout`.-- `crate::platform::service` — `service::rpc::service_restart` to publish the self-restart for `SelfReplace`.-- `crate::platform::health` — `health::bus::register_health_subscriber` in the scheduler.-- `crate::util` — `utf8_safe_prefix_at_byte_boundary` for safe error-body truncation.-- `crate::core::bus` — `BUS.publish`, `crate::core::events::DomainEvent`, and `bus::init()` to bring up the in-process broker.-- `crate::core::observability` — Sentry reporting + transient-failure classifiers (`report_error`, `is_updater_transient_message`, `is_updater_transient_http_status`).-- `crate::core::all` — `ControllerFuture`, `RegisteredController` (schemas wiring); `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`.-- `crate::rpc::RpcOutcome` — RPC return contract.+- `crate::config`: reads `UpdateConfig` (`enabled`, `interval_minutes`, `rpc_mutations_enabled`, `restart_strategy`) and `UpdateRestartStrategy`; `ops` loads it via `config::rpc::load_config_with_timeout`.+- `crate::platform::service`: `service::rpc::service_restart` to publish the self-restart for `SelfReplace`.+- `crate::platform::health`: `health::bus::register_health_subscriber` in the scheduler.+- `crate::util`: `utf8_safe_prefix_at_byte_boundary` for safe error-body truncation.+- `crate::core::bus`: `BUS.publish`, `crate::core::events::DomainEvent`, and `bus::init()` to bring up the in-process broker.+- `crate::core::observability`: Sentry reporting + transient-failure classifiers (`report_error`, `is_updater_transient_message`, `is_updater_transient_http_status`).+- `crate::core::all`: `ControllerFuture`, `RegisteredController` (schemas wiring); `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`.+- `crate::rpc::RpcOutcome`: RPC return contract.- External crates: `reqwest` (HTTP), `url` (URL validation), `serde`/`serde_json`, `tokio`.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers `all_update_registered_controllers()` / `all_update_controller_schemas()` into the controller registry.-- `crates/openhuman-core/src/core/runtime/services.rs` — spawns `update::scheduler::run(config.update)` as a background service at core start.-- `crates/openhuman-core/src/tools/impl/system/update_check.rs` and `update_apply.rs` — agent tools wrapping the RPC layer.+- `crates/openhuman-core/src/core/all.rs`: registers `all_update_registered_controllers()` / `all_update_controller_schemas()` into the controller registry.+- `crates/openhuman-core/src/core/runtime/services.rs`: spawns `update::scheduler::run(config.update)` as a background service at core start.+- `crates/openhuman-core/src/tools/impl/system/update_check.rs` and `update_apply.rs`: agent tools wrapping the RPC layer.## Notes / gotchas-- **`staging_dir` is intentionally ignored** by `update_apply` — it always uses the safe default (current-exe parent dir) regardless of caller input, for security.+- **`staging_dir` is intentionally ignored** by `update_apply`: it always uses the safe default (current-exe parent dir) regardless of caller input, for security.- **Fail-closed policy**: if `config.update.rpc_mutations_enabled` is false (or config fails to load) `apply`/`run` are rejected; `check`/`version` remain available.- **Restart strategies** (`UpdateRestartStrategy`): `SelfReplace` publishes a `service_restart` (process exits shortly after the RPC returns; `restart_requested` reflects whether the publish succeeded); `Supervisor` stages only and expects an external supervisor to restart.- **Scheduler interval floor**: requested `interval_minutes` is clamped up to `MIN_INTERVAL_MINUTES = 10` to avoid GitHub unauthenticated rate-limits; the first check runs immediately.-- **Version compare** (`is_newer`) is dot-split numeric with `v`-prefix stripping — not full semver (no pre-release/build metadata handling).+- **Version compare** (`is_newer`) is dot-split numeric with `v`-prefix stripping: not full semver (no pre-release/build metadata handling).- **Sentry hygiene**: transport-level reqwest failures (`is_connect`/`is_timeout`/`is_request`) and transient HTTP statuses are logged at `warn` and skipped from `report_error`; a regression guard test hits an unroutable TEST-NET-1 host to lock the classifier.- **Test env locking**: tests touching `update_apply` take `config::TEST_ENV_LOCK` because the mutation policy is resolved through the process-global `OPENHUMAN_WORKSPACE` env var and would otherwise race.- Network-hitting paths (`update_check` success, `update_apply` success, scheduler `tick`) are deferred to integration tests, not unit-tested.diff --git a/crates/openhuman-core/src/runtime/javascript/README.md b/crates/openhuman-core/src/runtime/javascript/README.mdindex f259f2a1ca..9b68a46e3b 100644--- a/crates/openhuman-core/src/runtime/javascript/README.md+++ b/crates/openhuman-core/src/runtime/javascript/README.md@@ -5,7 +5,7 @@ re-export facade: it gives the rest of the codebase a stable`crate::runtime::javascript` import path that talks to a *language*(`javascript`) rather than to a concrete backend. Today the implementationbackend is the managed Node.js client in [`crate::runtime::node`](../node/README.md),-which is itself a client for the vendored `tinyruntime` module — the facade+which is itself a client for the vendored `tinyruntime` module: the facadeexists so the backend underneath can be swapped without churning callers. Itowns no logic of its own: every symbol it exposes is a `pub use`.@@ -17,7 +17,7 @@ owns no logic of its own: every symbol it exposes is a `pub use`.## Gating (`runtime-node`)-The facade itself is **always compiled** — `ShellTool` and the other exec+The facade itself is **always compiled**: `ShellTool` and the other exectools hold an `Option<Arc<NodeBootstrap>>`, so the bootstrap type surface mustexist in every build:@@ -32,7 +32,7 @@ exist in every build:`all_runtime_node_registered_controllers`). The controller pair only existswith the feature on; the dispatcher behind `execute_tool` / `list_tools`(`runtime::node::ops`) is itself always compiled because the ungated `flows`- `oh:` backend calls it directly — only this facade's alias is gated, since+ `oh:` backend calls it directly: only this facade's alias is gated, sinceits sole consumer here is the gated `runtime::node::rpc` bridge.## Public surface@@ -51,7 +51,7 @@ through this facade's `all_javascript_*` aliases:| Method | Inputs | Outputs || --- | --- | --- |-| `javascript.list_tools` | — | `tools`: array of tool metadata (`name`, `description`, `category`, `permission_level`, `scope`, `supports_markdown`, `parameters`). |+| `javascript.list_tools` |: | `tools`: array of tool metadata (`name`, `description`, `category`, `permission_level`, `scope`, `supports_markdown`, `parameters`). || `javascript.execute_tool` | `tool_name` (required), `args` (optional Json, defaults to `{}`), `prefer_markdown` (optional bool) | `tool_name`, `elapsed_ms` (u64), `result` (MCP-style `ToolResult`: `{content, is_error, markdownFormatted?}`). |Handlers live in `runtime::node::rpc`, load config via@@ -68,20 +68,20 @@ Handlers live in `runtime::node::rpc`, load config via## Used by-- `crates/openhuman-core/src/core/all.rs` — wires+- `crates/openhuman-core/src/core/all.rs`: wires`all_javascript_registered_controllers` into the controller registry.-- `crates/openhuman-core/src/tools/ops.rs` — constructs the shared+- `crates/openhuman-core/src/tools/ops.rs`: constructs the shared`Arc<NodeBootstrap>` (only when `runtime-node` is on and `config.node.enabled`);`tools/impl/system/{shell,node_exec,npm_exec}.rs` hold it for Node binaryresolution.-- `crates/openhuman-core/src/runtime/node/rpc.rs` — calls back into+- `crates/openhuman-core/src/runtime/node/rpc.rs`: calls back into`javascript::{list_tools, execute_tool}` through the facade alias.## Notes / gotchas- This is a rename-only facade: no `types.rs` / `ops.rs` / `store.rs` here bydesign. Edit behavior in [`runtime/node`](../node/README.md), not here.-- `javascript.execute_tool` rebuilds the entire tool set on every call — there+- `javascript.execute_tool` rebuilds the entire tool set on every call: thereis no persistent tool cache at this layer.- See [`runtime/node/README.md`](../node/README.md) for everything the facadeforwards to, including what moved out to the `tinyruntime` module.diff --git a/crates/openhuman-core/src/runtime/python/README.md b/crates/openhuman-core/src/runtime/python/README.mdindex 330c0c76ff..b2cfb0d9b6 100644--- a/crates/openhuman-core/src/runtime/python/README.md+++ b/crates/openhuman-core/src/runtime/python/README.md@@ -13,7 +13,7 @@ through [`modules::runtime`](../../modules/runtime.rs).## What stayed, and why-`process.rs` launches stdio Python children — the runtime Python server, and the+`process.rs` launches stdio Python children: the runtime Python server, and thestdio MCP servers. That is deliberately **not** the module's pooled execution:those children outlive a single job, speak their own protocols, and are owned bythe subsystem that started them. The module resolves the interpreter; this core@@ -44,24 +44,24 @@ This module reads `config.runtime_python` (`enabled`, `prefer_system`,## Dependencies-- `crate::modules::runtime` — the module client this delegates to.-- `crate::config` — the settings each request carries.-- `crate::inference::host_runtime::process_util` — the Windows no-console+- `crate::modules::runtime`: the module client this delegates to.+- `crate::config`: the settings each request carries.+- `crate::inference::host_runtime::process_util`: the Windows no-consolehook, shared with the other child-spawning paths.External crates: `tinyruntime-bus`, `tokio`, `anyhow`, `tracing`. No HTTP-client, no archive crates, no `walkdir`, no `fs2` — those went with the pipeline.+client, no archive crates, no `walkdir`, no `fs2`: those went with the pipeline.## Used by-- `crates/openhuman-core/src/runtime/python_server/` — resolves an interpreter, then spawns+- `crates/openhuman-core/src/runtime/python_server/`: resolves an interpreter, then spawnsand supervises the long-lived model server with `spawn_stdio`.-- `crates/openhuman-core/src/tools/impl/system/{python_exec,shell}.rs` — hold an+- `crates/openhuman-core/src/tools/impl/system/{python_exec,shell}.rs`: hold an`Arc<PythonBootstrap>`; `python_exec` calls `resolve()`, `shell` uses thenon-blocking `try_cached()` for `PATH` injection.-- `crates/openhuman-core/src/skills/runtime/ops.rs` — resolves an interpreter for+- `crates/openhuman-core/src/skills/runtime/ops.rs`: resolves an interpreter forPython-backed skills.-- `crates/openhuman-core/src/agent/harness_init/registry.rs` — the Python init step uses+- `crates/openhuman-core/src/agent/harness_init/registry.rs`: the Python init step uses`probe_installed()` to decide whether provisioning is visible work.## Notes / gotchasdiff --git a/crates/openhuman-core/src/runtime/python_server/README.md b/crates/openhuman-core/src/runtime/python_server/README.mdindex c29f9bc43b..4746ca742b 100644--- a/crates/openhuman-core/src/runtime/python_server/README.md+++ b/crates/openhuman-core/src/runtime/python_server/README.md@@ -8,9 +8,9 @@ to pick the interpreter it launches.Two backends currently run inside the one worker process:-- **spaCy** (`spacy.rs`) — NER extraction for the memory tree's query+- **spaCy** (`spacy.rs`): NER extraction for the memory tree's queryextractor, gated by `config.memory_tree.spacy_enabled`.-- **Kompress** (`kompress.rs`) — TokenJuice's ModernBERT/torch plain-text+- **Kompress** (`kompress.rs`): TokenJuice's ModernBERT/torch plain-textcompressor, gated by `config.tokenjuice.ml_compression_enabled`.Both are gated behind `config.runtime_python.enabled`; `registry::enabled_backends`@@ -37,7 +37,7 @@ computes the active set from all three flags together.- If the enabled backend set has changed since the cached server launched(e.g. Kompress toggled on after a spaCy-only start), the cache is discarded- and a new server is started — the running process was never provisioned for+ and a new server is started: the running process was never provisioned forthe new backend.- If the Kompress backend has been idle longer than`config.tokenjuice.ml_sidecar_idle_timeout_secs`, the server is torn down and@@ -99,7 +99,7 @@ the same venv build.## Status`RuntimePythonServerStatus { enabled, running, backends: Vec<BackendStatus>, message }`-is returned by `status()` and reflects the cache directly — `Empty` reports+is returned by `status()` and reflects the cache directly: `Empty` reports`disabled`, `Failed` reports the last error, `Ready` reports each backend's`ready` flag from the worker's handshake `backends` list. There is no publicRPC method for this; `crates/openhuman-core/src/agent/harness_init/registry.rs`@@ -121,7 +121,7 @@ No domain store. `spacy::python_server_cache_root` picks the root:## SecurityThe worker runs under whichever interpreter `runtime::python::PythonBootstrap`-or the venv provisioning resolved — it does not choose or sandbox that+or the venv provisioning resolved: it does not choose or sandbox thatinterpreter itself, and it is spawned through`runtime::python::process::spawn_stdio_process` with the core's ownenvironment inherited (there is no `env_clear`). On top of that the module@@ -136,11 +136,11 @@ sent, not here.## Used by-- `crates/openhuman-core/src/agent/harness_init/registry.rs` — the `runtime_python_server`,+- `crates/openhuman-core/src/agent/harness_init/registry.rs`: the `runtime_python_server`,`spacy`, and `kompress` init steps.-- `crates/openhuman-core/src/modules/memory_host.rs` — `extract_spacy` for the memory+- `crates/openhuman-core/src/modules/memory_host.rs`: `extract_spacy` for the memorytree's query extractor.-- `crates/openhuman-core/src/inference/tokenjuice/ml/mod.rs` — `request_kompress` for+- `crates/openhuman-core/src/inference/tokenjuice/ml/mod.rs`: `request_kompress` forplain-text compression.## Notes / gotchasdiff --git a/crates/openhuman-core/src/sandbox/cwd_jail/README.md b/crates/openhuman-core/src/sandbox/cwd_jail/README.mdindex 2e8a91ce5f..b6e4081a25 100644--- a/crates/openhuman-core/src/sandbox/cwd_jail/README.md+++ b/crates/openhuman-core/src/sandbox/cwd_jail/README.md@@ -1,87 +1,152 @@# cwd_jail-Cross-platform directory-jail facade. Given a declarative description of a workspace (`Jail`), it picks the strongest available OS sandbox backend and spawns a child process caged into a single read/write root (plus optional read-only paths), with toggles for outbound network and subprocess creation. It is the user-facing complement to `crates/openhuman-core/src/security/` — the autonomy gate decides *whether* a command may run; `cwd_jail` decides *what filesystem* the approved child process sees. It jails the *child* it spawns, never the core process itself.+Cross-platform directory-jail facade. Given a declarative description of a+workspace (`Jail`), it picks the strongest available OS sandbox backend and+spawns a child process caged into a single read/write root (plus optional+read-only paths), with toggles for outbound network and subprocess creation.+It is the user-facing complement to `crates/openhuman-core/src/security/`:+the autonomy gate decides whether a command may run, and `cwd_jail` decides+what filesystem the approved child process sees. It jails the child it+spawns, never the core process itself.## Responsibilities-- Describe a jail declaratively via a builder (`Jail::new(root, label)` + `.add_read_only(...)`, `.deny_net()`, `.deny_subprocess()`).-- Auto-detect and cache the strongest backend for the current OS (Landlock / Seatbelt / AppContainer / noop).-- Spawn a `std::process::Command` inside the jail, canonicalizing `root` (and read-only paths) first so backends never see `..` or symlink trickery.-- Provide a persistent registry to manage many jailed workspaces side-by-side, each with a stable id, label, directory, and metadata, indexed in a JSON file.-- Fall back gracefully (`noop`) when no OS-level sandbox is available, while still letting callers rely on application-layer path checks.+- Describe a jail declaratively via a builder (`Jail::new(root, label)` plus+ `.add_read_only(...)`, `.deny_net()`, `.deny_subprocess()`).+- Auto-detect and cache the strongest backend for the current OS (Landlock,+ Seatbelt, AppContainer, or noop).+- Spawn a `std::process::Command` inside the jail, canonicalizing `root`+ (and read-only paths) first so backends never see `..` or symlink+ trickery.+- Provide a persistent registry to manage many jailed workspaces side by+ side, each with a stable id, label, directory, and metadata, indexed in a+ JSON file.+- Fall back to `noop` when no OS-level sandbox is available, while still+ letting callers rely on application-layer path checks.## Key files| File | Role || --- | --- |-| `crates/openhuman-core/src/sandbox/cwd_jail/mod.rs` | Module docstring + the thin facade: `spawn` / `spawn_with` / `default_backend` (cached via `OnceLock`). Re-exports the public surface. |-| `crates/openhuman-core/src/sandbox/cwd_jail/jail.rs` | Core types: the `Jail` description struct (builder + `canonicalize`/`canonicalize_or_log`) and the `JailBackend` trait (`name`/`is_available`/`spawn`). |-| `crates/openhuman-core/src/sandbox/cwd_jail/detect.rs` | `pick_backend()` — cfg-gated platform selection; returns the first available backend or `NoopBackend`. |-| `crates/openhuman-core/src/sandbox/cwd_jail/noop.rs` | `NoopBackend` — no enforcement, plain `Command::spawn`. Always available. |-| `crates/openhuman-core/src/sandbox/cwd_jail/linux.rs` | `LandlockBackend` — kernel 5.13+ Landlock LSM applied in `pre_exec` (child-side, after fork, before exec). Gated on the `sandbox-landlock` cargo feature. |-| `crates/openhuman-core/src/sandbox/cwd_jail/macos.rs` | `SeatbeltBackend` — wraps the command in `/usr/bin/sandbox-exec -p '<profile>'`. Renders an allow-default-reads / deny-default-writes Seatbelt profile. |-| `crates/openhuman-core/src/sandbox/cwd_jail/windows.rs` | `AppContainerBackend` — `CreateAppContainerProfile` + DACL grant + `STARTUPINFOEX`/`CreateProcessW` via `windows-sys`. |-| `crates/openhuman-core/src/sandbox/cwd_jail/registry.rs` | `JailRegistry` + `JailRecord` — multi-jail manager persisted to `index.json`, with atomic-rename writes and containment checks. |+| `crates/openhuman-core/src/sandbox/cwd_jail/mod.rs` | Module docstring plus the thin facade: `spawn` / `spawn_with` / `default_backend` (cached via `OnceLock`). Re-exports the public surface. |+| `crates/openhuman-core/src/sandbox/cwd_jail/jail.rs` | Core types: the `Jail` description struct (builder plus `canonicalize`/`canonicalize_or_log`) and the `JailBackend` trait (`name`/`is_available`/`spawn`). |+| `crates/openhuman-core/src/sandbox/cwd_jail/detect.rs` | `pick_backend()`: cfg-gated platform selection; returns the first available backend or `NoopBackend`. |+| `crates/openhuman-core/src/sandbox/cwd_jail/noop.rs` | `NoopBackend`: no enforcement, plain `Command::spawn`. Always available. |+| `crates/openhuman-core/src/sandbox/cwd_jail/linux.rs` | `LandlockBackend`: kernel 5.13+ Landlock LSM applied in `pre_exec` (child-side, after fork, before exec). Gated on the `sandbox-landlock` cargo feature. |+| `crates/openhuman-core/src/sandbox/cwd_jail/macos.rs` | `SeatbeltBackend`: wraps the command in `/usr/bin/sandbox-exec -p '<profile>'`. Renders an allow-default-reads / deny-default-writes Seatbelt profile. |+| `crates/openhuman-core/src/sandbox/cwd_jail/windows.rs` | `AppContainerBackend`: `CreateAppContainerProfile` plus a DACL grant and `STARTUPINFOEX`/`CreateProcessW` via `windows-sys`. |+| `crates/openhuman-core/src/sandbox/cwd_jail/registry.rs` | `JailRegistry` and `JailRecord`: multi-jail manager persisted to `index.json`, with atomic-rename writes and containment checks. || `crates/openhuman-core/src/sandbox/cwd_jail/{mod,jail,noop,macos,windows,registry}_tests.rs` | Sibling test suites, each `#[path]`-included from its source file. |## Public surfaceRe-exported from `mod.rs`:-- `Jail`, `JailBackend` — the declarative jail description and the OS-enforcement trait.-- `NoopBackend`, `NOOP_BACKEND_NAME` — the unenforced fallback backend and its `name()` string (`sandbox/ops.rs` compares against it to report `Inactive`).-- `JailRecord`, `JailRegistry` — persisted multi-jail manager.+- `Jail`, `JailBackend`: the declarative jail description and the+ OS-enforcement trait.+- `NoopBackend`, `NOOP_BACKEND_NAME`: the unenforced fallback backend and its+ `name()` string (`sandbox/ops.rs` compares against it to report+ `Inactive`).+- `JailRecord`, `JailRegistry`: persisted multi-jail manager.Free functions in `mod.rs`:-- `default_backend() -> Arc<dyn JailBackend>` — process-wide cached, lazily auto-detected backend.-- `spawn(jail: &Jail, cmd: Command) -> io::Result<Child>` — canonicalize + spawn under the default backend.-- `spawn_with(backend: &dyn JailBackend, jail: &Jail, cmd: Command) -> io::Result<Child>` — same, with an explicit backend (tests / forced weaker backend).+- `default_backend() -> Arc<dyn JailBackend>`: process-wide cached, lazily+ auto-detected backend.+- `spawn(jail: &Jail, cmd: Command) -> io::Result<Child>`: canonicalize and+ spawn under the default backend.+- `spawn_with(backend: &dyn JailBackend, jail: &Jail, cmd: Command) -> io::Result<Child>`:+ same, with an explicit backend (tests or a forced weaker backend).-`JailRegistry` methods: `open`, `base`, `create`, `get`, `list`, `find_by_label`, `rename`, `set_notes`, `delete`, `clear`, `spawn_in`, `spawn_in_with`.+`JailRegistry` methods: `open`, `base`, `create`, `get`, `list`,+`find_by_label`, `rename`, `set_notes`, `delete`, `clear`, `spawn_in`,+`spawn_in_with`.## Persistence-`JailRegistry` is rooted at a base directory (e.g. `~/.openhuman/jails/` or `<workspace>/jails/`). Each jail is a `<base>/<id>/` directory; metadata for all jails lives in `<base>/index.json`.--- `JailRecord` fields: `id`, `label`, `dir`, `backend_at_create`, `created_at_unix`, `updated_at_unix`, optional `notes`.-- The on-disk index is the source of truth; in-memory state (`Index`, a `BTreeMap` for deterministic ordering) is rebuilt on every `open()`.-- Writes are atomic (write-temp + rename, with a direct-overwrite fallback if rename-over fails). Mutating ops roll back the in-memory change if persistence fails.-- Ids are generated as `j<ts_hex><counter_hex>` (not cryptographically random — used as directory names), with a collision-retry loop on `create`.-- Concurrency is guarded by a `std::sync::Mutex`; multi-*process* access is an explicit non-goal (no OS file locking).+`JailRegistry` is rooted at a base directory (for example `~/.openhuman/jails/`+or `<workspace>/jails/`). Each jail is a `<base>/<id>/` directory; metadata+for all jails lives in `<base>/index.json`.++- `JailRecord` fields: `id`, `label`, `dir`, `backend_at_create`,+ `created_at_unix`, `updated_at_unix`, optional `notes`.+- The on-disk index is the source of truth; in-memory state (`Index`, a+ `BTreeMap` for deterministic ordering) is rebuilt on every `open()`.+- Writes are atomic (write-temp then rename, with a direct-overwrite+ fallback if rename-over fails). Mutating ops roll back the in-memory+ change if persistence fails.+- Ids are generated as `j<ts_hex><counter_hex>` (not cryptographically+ random, used only as directory names), with a collision-retry loop on+ `create`.+- Concurrency is guarded by a `std::sync::Mutex`; multi-process access is an+ explicit non-goal (no OS file locking).## Dependencies-This module is notably self-contained: its own files contain **no** `use crate::` or `use crate::core::` imports. Dependencies are external/std only:--- `std::process` (`Command`/`Child`), `std::fs`, `std::sync` (`Mutex`/`OnceLock`/`Arc`), `std::time`.-- `serde` / `serde_json` — `JailRecord` and the index serialization (registry).-- `landlock` crate — Linux backend, gated on the `sandbox-landlock` cargo feature.-- `windows-sys` — Windows AppContainer FFI (Security/Isolation, Threading, Memory APIs).+This module is notably self-contained: its own files contain no+`use crate::` or `use crate::core::` imports. Dependencies are external or+std only:++- `std::process` (`Command`/`Child`), `std::fs`, `std::sync`+ (`Mutex`/`OnceLock`/`Arc`), `std::time`.+- `serde` / `serde_json`: `JailRecord` and the index serialization+ (registry).+- `landlock` crate: Linux backend, gated on the `sandbox-landlock` cargo+ feature.+- `windows-sys`: Windows AppContainer FFI (Security/Isolation, Threading,+ Memory APIs).- macOS backend shells out to the system binary `/usr/bin/sandbox-exec`.-The Linux backend's docstring references `crate::security::landlock` as conceptual prior art, but the implementation here is self-contained (it does not import that module).+The Linux backend's docstring references `crate::security::landlock` as+conceptual prior art, but the implementation here is self-contained; it does+not import that module.## Used by- Declared in `crates/openhuman-core/src/sandbox/mod.rs` (`pub mod cwd_jail;`).-- `crates/openhuman-core/src/sandbox/ops.rs` — `execute_local_jail` builds a+- `crates/openhuman-core/src/sandbox/ops.rs`: `execute_local_jail` builds a`Jail` from the resolved `SandboxPolicy` and spawns through- `cwd_jail::default_backend()`, falling back to `cwd_jail::NoopBackend`- when no OS jail is available.-- `crates/openhuman-core/src/agent/platform_shell.rs` — doc references to+ `cwd_jail::default_backend()`, falling back to `cwd_jail::NoopBackend` when+ no OS jail is available.+- `crates/openhuman-core/src/agent/platform_shell.rs`: doc references to`cwd_jail::spawn` when explaining why shell-spawning is routed through ashared, Windows-aware command builder.- `crates/openhuman-core/src/tools/impl/system/{node_exec,npm_exec}.rs`mention `cwd_jail` in comments/docs when describing the `Local` sandboxbackend.-## Notes / gotchas--- **Not RPC-facing, no agent tools, no event bus.** There is no `schemas.rs`, `tools.rs`, or `bus.rs`; the module exposes no `openhuman.*` RPC methods, owns no agent tools, and publishes/subscribes to no `DomainEvent`s.-- **Backends differ in what `allow_net` / `read_only` mean.** Landlock does not gate network at all; macOS Seatbelt grants `allow default` (full network) and treats `read_only` as informational since reads are already allowed; Windows AppContainer is the only backend that honors `read_only` as a real read grant and maps `allow_net` to the strictly outbound-only `internetClient` capability (LAN/inbound capabilities deliberately excluded).-- **Windows `spawn` currently returns an error after a successful launch.** `spawn_in_container` creates the process successfully but cannot bridge the raw `HANDLE` into a `std::process::Child` (the needed `FromRawHandle for Child` is unstable), so it closes the handle and returns `io::ErrorKind::Unsupported`. See the TODO in `windows.rs`. The Windows path is compile-checked but flagged as needing real-hardware testing.-- **macOS stdio is inherited** — the Seatbelt wrapper cannot re-apply the original command's `Stdio` config; it uses `sandbox-exec` defaults (inherit). The profile re-allows writes under canonicalized `root` and `/private/tmp`, plus the exact `/dev/null` device for shell redirection; it does not grant `/dev` generally. Callers must canonicalize the root first (the `spawn` facade does this automatically) or writes inside it may be denied (e.g. `/tmp` → `/private/tmp`).-- **Linux Landlock runs in `pre_exec`** (child-side after fork) so the parent keeps its privileges; read-only paths also get `Execute` so the child can run binaries found there (e.g. `/usr/bin/sh`).-- **Registry containment guard:** both `delete` and `jail_for` (used by `spawn_in`/`spawn_in_with`) refuse to operate on a record whose canonicalized `dir` is not under the canonicalized `base`, defending against a corrupted index pointing at `/`.-- **Free-form input is length-logged, not value-logged** (labels/notes) to avoid leaking arbitrary text into logs.+## Notes and gotchas++- Not RPC-facing, no agent tools, no event bus. There is no `schemas.rs`,+ `tools.rs`, or `bus.rs`; the module exposes no `openhuman.*` RPC methods,+ owns no agent tools, and publishes or subscribes to no `DomainEvent`s.+- Backends differ in what `allow_net` and `read_only` mean. Landlock does+ not gate network at all; macOS Seatbelt grants `allow default` (full+ network) and treats `read_only` as informational since reads are already+ allowed; Windows AppContainer is the only backend that honors `read_only`+ as a real read grant and maps `allow_net` to the strictly outbound-only+ `internetClient` capability (LAN and inbound capabilities are deliberately+ excluded).+- Windows `spawn` currently returns an error after a successful launch.+ `spawn_in_container` creates the process successfully but cannot bridge+ the raw `HANDLE` into a `std::process::Child` (the needed+ `FromRawHandle for Child` is unstable), so it closes the handle and+ returns `io::ErrorKind::Unsupported`. See the TODO in `windows.rs`. The+ Windows path is compile-checked but flagged as needing real-hardware+ testing.+- macOS stdio is inherited: the Seatbelt wrapper cannot re-apply the+ original command's `Stdio` config, so it uses `sandbox-exec` defaults+ (inherit). The profile re-allows writes under the canonicalized `root` and+ `/private/tmp`, plus the exact `/dev/null` device for shell redirection;+ it does not grant `/dev` generally. Callers must canonicalize the root+ first (the `spawn` facade does this automatically) or writes inside it may+ be denied (for example `/tmp` resolving to `/private/tmp`).+- Linux Landlock runs in `pre_exec` (child-side, after fork), so the parent+ keeps its privileges; read-only paths also get `Execute` so the child can+ run binaries found there (for example `/usr/bin/sh`).+- Registry containment guard: both `delete` and `jail_for` (used by+ `spawn_in`/`spawn_in_with`) refuse to operate on a record whose+ canonicalized `dir` is not under the canonicalized `base`, defending+ against a corrupted index pointing at `/`.+- Free-form input is length-logged, not value-logged (labels and notes), to+ avoid leaking arbitrary text into logs.diff --git a/crates/openhuman-core/src/search/README.md b/crates/openhuman-core/src/search/README.mdindex 3728004be6..a6cfa7681d 100644--- a/crates/openhuman-core/src/search/README.md+++ b/crates/openhuman-core/src/search/README.md@@ -13,13 +13,13 @@ Top-level home for web search selection and agent-facing search tool registratio`search.engine` accepts:-- `disabled` — register no search tools.-- `managed` — register backend-proxied `web_search_tool`.-- `parallel` — register the Parallel family plus `web_search_tool` when configured.-- `brave` — register Brave web/news/image/video search when configured.-- `querit` — register Querit search plus `web_search_tool` when configured.-- `exa` — BYOK: register `exa_search`, `exa_find_similar`, `exa_get_contents` plus `web_search_tool` when configured. Calls go directly to `https://api.exa.ai` with the user's own key, never through the managed backend.-- `tavily` — BYOK: register `tavily_search` (web/news/finance, search depth, time-range/date filters, domain include/exclude) and `tavily_extract` plus `web_search_tool` when configured. Calls go directly to `https://api.tavily.com` with the user's own key, never through the managed backend.+- `disabled`: register no search tools.+- `managed`: register backend-proxied `web_search_tool`.+- `parallel`: register the Parallel family plus `web_search_tool` when configured.+- `brave`: register Brave web/news/image/video search when configured.+- `querit`: register Querit search plus `web_search_tool` when configured.+- `exa`: BYOK: register `exa_search`, `exa_find_similar`, `exa_get_contents` plus `web_search_tool` when configured. Calls go directly to `https://api.exa.ai` with the user's own key, never through the managed backend.+- `tavily`: BYOK: register `tavily_search` (web/news/finance, search depth, time-range/date filters, domain include/exclude) and `tavily_extract` plus `web_search_tool` when configured. Calls go directly to `https://api.tavily.com` with the user's own key, never through the managed backend.A BYO engine with no key configured falls back to the managed surface, so `managed` stays the effective default until a key is saved.@@ -48,7 +48,7 @@ When search is disabled, search tools are absent from the agent runtime tool lis`engines` is `pub(crate)`. Each file (`managed`, `parallel`, `brave`,`querit`, `exa`, `tavily`, `disabled`) exports a single`pub(crate) fn build(root_config: &Config, params: SearchToolParams) -> Vec<Box<dyn Tool>>`-that constructs that engine's tool set — e.g. `managed::build` returns a single+that constructs that engine's tool set: e.g. `managed::build` returns a single`WebSearchTool`, which posts to the backend's`/agent-integrations/parallel/search`. `parallel::build` registers the same`WebSearchTool` alongside the Parallel family, and falls back to it alone whendiff --git a/crates/openhuman-core/src/search/tools/README.md b/crates/openhuman-core/src/search/tools/README.mdindex 1ab7f13afe..c98259a016 100644--- a/crates/openhuman-core/src/search/tools/README.md+++ b/crates/openhuman-core/src/search/tools/README.md@@ -9,19 +9,19 @@ provider family; `mod.rs` re-exports the full public surface with| File | Exported tools | `name()` | Transport || --- | --- | --- | --- || `brave.rs` | `BraveWebSearchTool`, `BraveNewsSearchTool`, `BraveImageSearchTool`, `BraveVideoSearchTool` | `web_search_tool`, `brave_news_search`, `brave_image_search`, `brave_video_search` | Direct to `api.search.brave.com`, `X-Subscription-Token` header |-| `exa.rs` | `ExaSearchTool`, `ExaFindSimilarTool`, `ExaGetContentsTool` | `exa_search` or `web_search_tool` (constructor-selected), `exa_find_similar`, `exa_get_contents` | BYOK, direct to `api.exa.ai`, `x-api-key` header — never proxied |-| `parallel.rs` (+ `parallel/` — `search.rs`, `extract.rs`, `chat.rs`, `research.rs`, `enrich.rs`, `dataset.rs`) | `ParallelSearchTool`, `ParallelExtractTool`, `ParallelChatTool`, `ParallelResearchTool`, `ParallelEnrichTool`, `ParallelDatasetTool` | `parallel_search`, `parallel_extract`, `parallel_chat`, `parallel_research`, `parallel_enrich`, `parallel_dataset` | Backend-proxied via `crate::integrations::IntegrationClient` (`/agent-integrations/parallel/*`) |+| `exa.rs` | `ExaSearchTool`, `ExaFindSimilarTool`, `ExaGetContentsTool` | `exa_search` or `web_search_tool` (constructor-selected), `exa_find_similar`, `exa_get_contents` | BYOK, direct to `api.exa.ai`, `x-api-key` header: never proxied |+| `parallel.rs` (+ `parallel/`: `search.rs`, `extract.rs`, `chat.rs`, `research.rs`, `enrich.rs`, `dataset.rs`) | `ParallelSearchTool`, `ParallelExtractTool`, `ParallelChatTool`, `ParallelResearchTool`, `ParallelEnrichTool`, `ParallelDatasetTool` | `parallel_search`, `parallel_extract`, `parallel_chat`, `parallel_research`, `parallel_enrich`, `parallel_dataset` | Backend-proxied via `crate::integrations::IntegrationClient` (`/agent-integrations/parallel/*`) || `querit.rs` | `QueritSearchTool` | `querit_search` or `web_search_tool` (constructor-selected) | Direct to `api.querit.ai`, `Authorization: Bearer` header || `searxng.rs` | `SearxngSearchTool`, plus `normalize_categories`, `SearxngSearchArgs`, `SearxngSearchResponse`, `MAX_RESULTS` (re-exported as `SEARXNG_MAX_RESULTS`) | `searxng_search` | Direct to a user-configured, self-hosted SearXNG instance (`GET /search?format=json`) || `seltz.rs` | `SeltzSearchTool` | `seltz_search` | Direct to `api.seltz.ai`, `x-api-key` header |-| `tavily.rs` (+ `tavily/` — `client.rs`, `search_tool.rs`, `extract_tool.rs`, `types.rs`) | `TavilySearchTool`, `TavilyExtractTool` | `tavily_search` or `web_search_tool` (constructor-selected), `tavily_extract` | BYOK, direct to `api.tavily.com`, `Authorization: Bearer` header — never proxied |+| `tavily.rs` (+ `tavily/`: `client.rs`, `search_tool.rs`, `extract_tool.rs`, `types.rs`) | `TavilySearchTool`, `TavilyExtractTool` | `tavily_search` or `web_search_tool` (constructor-selected), `tavily_extract` | BYOK, direct to `api.tavily.com`, `Authorization: Bearer` header: never proxied || `tinyfish.rs` | `TinyFishSearchTool`, `TinyFishFetchTool`, `TinyFishAgentRunTool` | `tinyfish_search`, `tinyfish_fetch`, `tinyfish_agent_run` | Backend-proxied via `IntegrationClient` (`/agent-integrations/tinyfish/*`); search/fetch are read-oriented, agent-run drives goal-based browser automation || `web_search.rs` | `WebSearchTool` (+ crate-internal `resolve_managed_provider`) | `web_search_tool` | Backend-proxied managed search (`POST /agent-integrations/parallel/search` via `IntegrationClient`); `resolve_managed_provider` labels the response with the provider the backend reports, falling back to `Exa`, for UI attribution. `with_direct_search(Option<SeltzSearchTool>)` can short-circuit the proxy, but only `web_search_tests.rs` uses it |Several providers construct their primary tool with a `tool_name` field so thesame struct can register under either its own name (e.g. `exa_search`,`querit_search`, `tavily_search`) or the canonical `web_search_tool` slot when-that engine is the active `search.engine` — see `exa.rs`, `querit.rs`, and+that engine is the active `search.engine`: see `exa.rs`, `querit.rs`, and`tavily/search_tool.rs`.## Registration@@ -34,7 +34,7 @@ active, provided the engine is not `disabled`, an `IntegrationClient` can bebuilt (user signed in), and `config.integrations.tinyfish.is_active()`.`SearxngSearchTool` and `SeltzSearchTool` are not reachable through the engine-registry at all — they are constructed per call by the `tools.searxng_search`+registry at all: they are constructed per call by the `tools.searxng_search`(`handle_searxng_search`) and `tools.seltz_search` (`handle_seltz_search`)RPC handlers, both in `crates/openhuman-core/src/tools/schemas/web_search.rs`.Those handlers take the query and `max_results` from the RPCdiff --git a/crates/openhuman-core/src/security/approval/README.md b/crates/openhuman-core/src/security/approval/README.mdindex 0d349d54fb..1d76124033 100644--- a/crates/openhuman-core/src/security/approval/README.md+++ b/crates/openhuman-core/src/security/approval/README.md@@ -6,9 +6,9 @@ Interactive approval workflow for supervised mode (issue #1339). `ApprovalGate`- Intercept external-effect tool calls and gate them behind explicit user consent.- Short-circuit to `Allow` when the tool is on the user's `autonomy.auto_approve` allowlist (read live via `security::live_policy`).-- Allow through (never park) when there is no live chat context — background/triage/cron turns carry no `ApprovalChatContext` and are pre-authorized.+- Allow through (never park) when there is no live chat context: background/triage/cron turns carry no `ApprovalChatContext` and are pre-authorized.- Persist pending requests in SQLite so they survive a core restart; lazily expire stale rows; keep a durable decided/executed audit trail.-- Resolve a parked call on a user decision (`approve_once` / `approve_always_for_tool` / `deny`), TTL timeout, or channel drop — failing closed in every non-approve path.+- Resolve a parked call on a user decision (`approve_once` / `approve_always_for_tool` / `deny`), TTL timeout, or channel drop, failing closed in every non-approve path.- Redact arguments (`redact_args`) and build safe action summaries (`summarize_action`) before anything leaves the gate.- Route a thread's yes/no chat reply back to a parked approval (`pending_for_thread` + `parse_approval_reply`).- On `approve_always_for_tool`, persist the tool onto `autonomy.auto_approve` (config save + live-policy reload) so it skips prompting next time.diff --git a/gitbooks/developing/engines.md b/gitbooks/developing/engines.mdnew file mode 100644index 0000000000..a46abae949--- /dev/null+++ b/gitbooks/developing/engines.md@@ -0,0 +1,114 @@+# Pluggable engines++OpenHuman routes four kinds of work, chat and reasoning, embeddings, memory,+and web search, through a config key rather than a hardcoded client. Each has+a managed default that needs no key, plus a bring-your-own-key or local path.+This page is the map of what's supported and the exact key or environment+variable that selects it; the linked pages under Features cover setup and+tradeoffs.++## LLM providers++Chat, reasoning, vision, and coding workloads route through per-workload+provider fields (`chat_provider`, `reasoning_provider`, `agentic_provider`,+`coding_provider`, `vision_provider`, and more), each a string of the form+`<slug>:<model>`. Leaving a field unset, blank, or set to `cloud` keeps it on+the managed default.++Supported routes:++- **Managed (TinyHumans)**: the default. Access to the OpenRouter model+ catalogue with no key to manage.+- **Local**: Ollama or LM Studio, set under `[local_ai]` with+ `provider = "ollama"` or `"lm_studio"`, plus MLX on macOS.+- **A local OpenAI-compatible endpoint**: any server that speaks the OpenAI+ chat API, registered with its own slug and endpoint.+- **Claude Code / Claude Agent SDK**: a provider slug that shells out to an+ installed Claude Code CLI instead of calling a hosted API.+- **26 BYOK slugs**, each shipped with a preset endpoint so only a key is+ needed: `openai`, `anthropic`, `google`, `openrouter`, `orcarouter`, `groq`,+ `mistral`, `deepseek`, `together`, `fireworks`, `cerebras`, `xai`,+ `moonshot`, `gmi`, `huggingface`, `nvidia`, `zai`, `minimax`, `stepfun`,+ `kilocode`, `deepinfra`, `novita`, `venice`, `vercel-ai-gateway`, `sumopod`,+ `modelscope`.++Provider definitions live under `crates/openhuman-core/src/inference/provider/`+(`factory.rs` resolves a `<slug>:<model>` string to a client; `types.rs` holds+the provider shapes). Full setup, the local-model capability table, and RAM+tier presets are in [Local models & bring your own+key](../features/model-routing/local-and-byok-models.md); routing behavior+and fallback order are in [Automatic Model+Routing](../features/model-routing/README.md).++## Embeddings++Memory Tree embeddings route through a separate provider selection+(`embeddings.update_settings` over RPC, or `embeddings_provider` for+per-workload override), independent of the chat provider:++- **Managed** (default): the OpenHuman backend's Voyage-backed embedding+ endpoint. Works on a fresh install with no local daemon.+- **Voyage**: direct Voyage AI API with your own key.+- **OpenAI**: cloud embeddings via the OpenAI API.+- **Cohere**: the Cohere embed API with your own key.+- **Ollama**: a local model, `bge-m3` recommended. The Memory Tree's on-disk+ vector format is fixed at 1024 dimensions, so a smaller embedding model+ (`all-minilm`, 384 dimensions, or `nomic-embed-text`, 768) fails the+ dimension check at embed time.+- **Custom**: any OpenAI-compatible embeddings endpoint.++Implementation: `crates/openhuman-core/src/inference/embedding_host/` (`mod.rs`+lists the providers; `factory.rs` builds the client; `schemas.rs` defines the+`embeddings.*` RPC surface, including `set_api_key` per provider slug).++## Memory++The memory contract (`tinymemory-api`, vendored at `vendor/tinymemory/`)+defines a driver-neutral `MemoryProvider` trait and ships adapter crates for+six remote engines: Supermemory, Mem0, Cognee, CortexDB, AgentMemory, and+LivingBrain (`vendor/tinymemory/crates/tinymemory-remote/`).++What actually binds today is narrower than that adapter list. OpenHuman's+host-side binding (`crates/openhuman-core/src/memory/binding.rs`, function+`admit`) only accepts the compiled TinyMemory module (id `tinymemory`, with+`tinycortex` kept as a legacy config alias) or the `null` driver; an external+driver configured under `[subsystems.memory.drivers.<id>]` is refused with+"external driver transport is not implemented yet." TinyCortex is the memory+engine every OpenHuman install actually runs. The `[subsystems.memory]`+config block (`driver`, `hooks`, `drivers`, and the `OPENHUMAN_MEMORY_DRIVER`+env var) already parses and persists, ahead of the wiring that will make a+non-default `driver` value actually switch engines; nothing reads it at+runtime yet beyond the module/null choice above.++Related pages: [Memory](../features/obsidian-wiki/README.md) and its+sub-pages for what TinyCortex actually does (memory tree, scoring, retrieval,+git-backed diffs).++## Web search++`[search] engine` selects the active provider; only one is active at a time,+mirroring the LLM provider model:++- `managed` (default): backend-proxied, no key needed.+- `parallel`: search, extract, chat, research, enrich, and dataset tools+ against the Parallel API.+- `brave`: Brave Search (web, news, images, videos).+- `querit`: Querit web search.+- `exa`: Exa neural search (search, find-similar, contents). Direct to+ `api.exa.ai`, never through the managed backend.+- `tavily`: Tavily search and extract (web, news, finance). Direct to+ `api.tavily.com`.+- `disabled`: no search tools registered.++A BYOK engine selected without a stored key falls back to `managed` rather+than leaving the agent with no search tool at all.++SearXNG is a separate toggle (`[searxng] enabled`, `base_url`) rather than a+`search.engine` value, since it points at a self-hosted instance instead of a+vendor API. Engine definitions live under+`crates/openhuman-core/src/search/engines/`, one file per provider; the+selector and provider resolution are in `crates/openhuman-core/src/search/mod.rs`+and `crates/openhuman-core/src/config/schema/tools/search.rs`.++See [Web Search](../features/native-tools/web-search.md) for the tool surface+each engine exposes.