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 several core modules
Steven Enamakelc4b464cfde43
diff --git a/crates/openhuman-core/src/channels/runtime/README.md b/crates/openhuman-core/src/channels/runtime/README.mdnew file mode 100644index 0000000000..545d4cc492--- /dev/null+++ b/crates/openhuman-core/src/channels/runtime/README.md@@ -0,0 +1,40 @@+# Runtime++Boots every enabled channel, keeps their listeners alive, and dispatches inbound messages into the agent loop.++## Files++| Path | Purpose |+| --- | --- |+| `startup.rs` (+ `startup_part_01.rs`, `startup_part_02.rs`) | `start_channels` — reads config, resolves per-channel secrets (email, yuanbao), constructs each enabled `Channel`, and spawns a supervised listener per channel into a shared dispatch queue |+| `supervision.rs` | `spawn_supervised_listener` — wraps a channel listener task so a crashed listener is respawned instead of silently dying |+| `dispatch/` | The inbound message pipeline that turns a received `RuntimeChannelMessage` into an agent turn and a reply |+| `test_support.rs` | Test/debug-only helpers (`#[cfg(any(test, debug_assertions))]`) shared across the runtime's own tests and `channels/tests/` |++## Inbound path++1. A provider listener (spawned in `startup_part_01.rs`, one per enabled channel) receives a message and sends it as a `RuntimeChannelMessage` on a bounded `mpsc` channel (capacity 100).+2. `spawn_supervised_listener` (`supervision.rs`) owns the listener task and restarts it if it exits unexpectedly, so a single crashed provider connection doesn't take the process down.+3. `run_message_dispatch_loop` (`dispatch/processor.rs`, called once from `startup_part_01.rs` after every listener is spawned) drains the shared receiver with bounded concurrency (`compute_max_in_flight_messages`) and hands each message to `process_channel_message`.+4. `process_channel_message` runs the full per-message pipeline: typing indicator, ACK reaction, approval-reply interception (`try_route_approval_reply`, gated by `channel_has_approval_surface`), agent-scoping (`dispatch/routing.rs`: `resolve_target_agent` + `build_visible_tool_set`), the agent turn itself, draft updates, and the reply send.++## `dispatch/`++| Path | Purpose |+| --- | --- |+| `helpers.rs` | Stateless helpers: per-turn context block for non-web channels, deterministic ACK-emoji picker, worker/typing-task lifecycle utilities |+| `routing.rs` | `AgentScoping`, `resolve_target_agent`, `build_visible_tool_set` — picks the active agent and its visible/delegation tool surface for a turn, reading `Config` + `AgentDefinitionRegistry` + connected integrations |+| `processor.rs` (+ `processor_part_01.rs..03.rs`) | `channel_has_approval_surface` (per-channel approval-context gate), `try_route_approval_reply`, `process_channel_message`, `run_message_dispatch_loop` |+| `mod.rs` | Wires the three submodules and their `#[cfg(test)]` / `#[cfg(any(test, debug_assertions))]` re-exports |++Approval-surface gating and per-sender agent scoping are the two policy points a new channel provider needs to account for: whether inbound approval replies (yes/no) short-circuit a fresh agent turn, and which agent/tools a given sender is routed to.++## Called by++`channels::start_channels` is exported from `channels/mod.rs` and invoked from `crates/openhuman-core/src/core/runtime/services.rs` during boot, unless `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set. It is skipped for web-chat-only cores (see `core/jsonrpc.rs` boot comments and `skills/bus.rs`).++## Tests++- `startup_tests.rs`, plus secret-resolution coverage in `startup_email_secret_tests_tests.rs` and `startup_yuanbao_secret_tests_tests.rs`.+- `supervision_tests.rs`.+- `dispatch_tests.rs` (top-level dispatch loop behavior), `dispatch/mod_scoping_tests_tests.rs` (agent scoping), `dispatch/mod_approval_surface_gating_tests_tests.rs` (approval-surface gate), `dispatch/routing_connected_fallback_tests_tests.rs` (fallback routing when no connected agent matches).diff --git a/crates/openhuman-core/src/config/migrations/README.md b/crates/openhuman-core/src/config/migrations/README.mdindex 3a74ba7f75..5a705a45da 100644--- a/crates/openhuman-core/src/config/migrations/README.md+++ b/crates/openhuman-core/src/config/migrations/README.md@@ -61,8 +61,8 @@ Does not own a `store.rs`. Its effects are written through other layers:## Used by-- `crates/openhuman-core/src/config/schema/load.rs` — calls `migrations::run_pending(&mut config)` from `Config::load_or_init` (three call sites) and seeds new configs with `schema_version: CURRENT_SCHEMA_VERSION`.-- `crates/openhuman-core/src/mod.rs` — declares `pub mod migrations;`.+- `crates/openhuman-core/src/config/schema/load/impl_load.rs` — calls `migrations::run_pending(&mut config)` from `Config::load_or_init` (three call sites) and seeds new configs via `migrations::seed_new_workspace` with `schema_version: CURRENT_SCHEMA_VERSION`.+- `crates/openhuman-core/src/config/mod.rs` — declares `pub mod migrations;`.## Notes / gotchasdiff --git a/crates/openhuman-core/src/memory/mod.rs b/crates/openhuman-core/src/memory/mod.rsindex ec8b269bc9..96a9299451 100644--- a/crates/openhuman-core/src/memory/mod.rs+++ b/crates/openhuman-core/src/memory/mod.rs@@ -16,8 +16,12 @@//! | [`driver`] | driver binding — which provider backs this workspace |//! | [`ops`] | RPC handlers, delegating into the core |//! | [`agent`] | the memory agent and its prompt |-//! | [`global`] | the per-workspace singleton |+//! | [`binding`] | the workspace-keyed driver binding (`for_config`) |//! | [`host`] | the seam impls — [`host::install_memory_event_sink`] and `MemoryHostConfig for Config` |+//! | [`auto_recall`] | Lane C — gated, bounded pre-turn recall of facts about the user |+//! | [`safety`] | the host-side secret / PII scrubbers |+//! | [`source_scope`] | the host-side per-turn memory-source allowlist |+//! | [`obsidian_registry`] | is the memory content root a vault Obsidian already knows about |//!//! What is left below is a handful of flat **type** re-exports, kept so the//! ~550 `crate::memory::…` paths elsewhere in this crate keepdiff --git a/crates/openhuman-core/src/sandbox/cwd_jail/README.md b/crates/openhuman-core/src/sandbox/cwd_jail/README.mdindex 1ac19a7c22..6c17ea682a 100644--- a/crates/openhuman-core/src/sandbox/cwd_jail/README.md+++ b/crates/openhuman-core/src/sandbox/cwd_jail/README.md@@ -64,7 +64,17 @@ The Linux backend's docstring references `crate::security::landlock` as conceptu## Used by-- Declared at `crates/openhuman-core/src/mod.rs:37` (`pub mod cwd_jail;`). No other `src/` Rust files currently reference `openhuman::sandbox::cwd_jail` — it is a self-standing facade not yet wired into a calling domain.+- 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+ `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::spawn` when explaining why shell-spawning is routed through a+ shared, Windows-aware command builder.+- `crates/openhuman-core/src/tools/impl/system/{node_exec,npm_exec}.rs` and+ `agent/profiles/guard.rs` mention `cwd_jail` in comments/docs when+ describing the `Local` sandbox backend.## Notes / gotchasdiff --git a/crates/openhuman-core/src/sandbox/cwd_jail/mod.rs b/crates/openhuman-core/src/sandbox/cwd_jail/mod.rsindex 17cea0814a..a923a141f0 100644--- a/crates/openhuman-core/src/sandbox/cwd_jail/mod.rs+++ b/crates/openhuman-core/src/sandbox/cwd_jail/mod.rs@@ -21,7 +21,7 @@//! ## Quick start//!//! ```ignore-//! use openhuman::openhuman::sandbox::cwd_jail::{spawn, Jail};+//! use openhuman_core::sandbox::cwd_jail::{spawn, Jail};//! use std::process::Command;//!//! let mut jail = Jail::new("/Users/x/work/proj", "agent.delegate")diff --git a/crates/openhuman-core/src/voice/README.md b/crates/openhuman-core/src/voice/README.mdindex dc7ce4f645..0e820f20e3 100644--- a/crates/openhuman-core/src/voice/README.md+++ b/crates/openhuman-core/src/voice/README.md@@ -1,44 +1,70 @@# voice-Speech-to-text (STT) and text-to-speech (TTS) domain. Exposes the `openhuman.voice_*` RPC namespace for transcription, synthesis, availability checks, provider configuration, agent reply-speech (with mascot lip-sync visemes), and a standalone voice **dictation server** (hotkey → record → transcribe → insert text). Routing between cloud (hosted backend proxy) and local engines (whisper.cpp / Piper) is decided by a provider factory driven by config. The low-level inference implementations themselves now live under `crate::inference::voice` and are re-exported through this module's surface for back-compat.--## Responsibilities--- Transcribe audio (file path, raw bytes, or base64) via whisper.cpp (local) or the hosted backend STT proxy, with optional LLM cleanup and hallucination filtering.-- Synthesize speech via local Piper, the hosted ElevenLabs proxy, or third-party providers (OpenAI-compatible / Deepgram / ElevenLabs) keyed by slug.-- Resolve effective STT/TTS providers from config and construct boxed `SttProvider` / `TtsProvider` trait objects (the factory).-- Run a hotkey-driven dictation server: capture mic audio, gate on duration/silence/hallucination, transcribe, then either deliver via Socket.IO (when OpenHuman is focused) or paste into the active external app.-- Provide a core-side dictation hotkey listener that broadcasts press/release and transcription events to the Socket.IO bridge.-- Synthesize agent replies with Oculus-15 viseme alignment for mascot lip-sync.-- Persist STT/TTS provider selection and the voice provider registry into config.-- Report STT/TTS binary + model availability and the active provider selection.+Speech-to-text (STT) and text-to-speech (TTS) domain. Exposes the `voice_*` RPC+namespace for transcription, synthesis, availability checks, provider+configuration, agent reply-speech (with mascot lip-sync visemes), a realtime+ElevenLabs Agents bootstrap, and a standalone voice **dictation server**+(hotkey → record → transcribe → insert text). Routing between the hosted+backend proxy, local Piper, and third-party providers is decided by a provider+factory driven by config. The low-level inference implementations (cloud STT,+local speech, streaming, postprocess) live under `crate::inference::voice` and+are re-exported through this module's surface for back-compat.++**There is no local STT engine.** The bundled whisper.cpp engine was removed+(`config::migrations::retire_local_whisper_stt`); all STT is either the hosted+backend proxy or a third-party API via the voice provider registry. TTS still+has a local option (Piper) alongside the hosted proxy and third-party APIs.++## Compile-time gate (`voice` feature)++`pub mod voice` is always compiled — it is a facade. The real implementation+(the submodules below and the `inference::voice` re-exports) is gated behind+the default-ON `voice` Cargo feature. When the feature is off, [`stub`] takes+its place and mirrors the subset of the public surface that always-on / other+gated callers depend on (`server`, `dictation_listener`, `streaming`,+`reply_speech`, `cloud_transcribe`, `create_stt_provider`,+`effective_stt_provider`, `publish_ptt_transcript_committed`) with+no-op / disabled-error bodies. `compile_status::VOICE_COMPILED_IN` is+deliberately ungated so a consumer that requires voice (the desktop shell) can+assert at compile time that it did not silently get the stub build (#4901).+Keeping the two surfaces in lockstep is enforced by the disabled-build check+(`cargo check --no-default-features --features "<all-but-voice>"`).## Key files| File | Role || --- | --- |-| `mod.rs` | Module docstring + exports; re-exports inference-side voice submodules (`cloud_transcribe`, `hallucination`, `local_speech`, `postprocess`, `streaming`); defines `cloud_transcribe_default_model()` (`"whisper-v1"`). |+| `mod.rs` | Module docstring, feature gate, and exports; re-exports inference-side voice submodules (`cloud_transcribe`, `local_speech`, `postprocess`, `streaming`); defines `cloud_transcribe_default_model()` (`"whisper-v1"`). || `types.rs` | RPC DTOs: `VoiceSpeechResult`, `VoiceTtsResult`, `VoiceStatus` + `From<LocalAi*>` conversions. || `ops.rs` | Business logic returning `RpcOutcome<T>`: `voice_status`, `voice_transcribe`, `voice_transcribe_bytes`, `voice_tts`, `normalize_extension`. |-| `schemas.rs` | Controller schemas, registry exports, and all `handle_voice_*` / `handle_overlay_stt_notify` RPC handlers (param structs, provider-string validation, `voice_list_models` presets, `voice_test_provider`). |-| `factory.rs` | `SttProvider` / `TtsProvider` traits; cloud/whisper/piper/external implementations; `create_stt_provider` / `create_tts_provider`; `effective_*_provider`; slug:model parsing; `DEFAULT_WHISPER_MODEL`, `DEFAULT_PIPER_VOICE`, `WHISPER_MODEL_PRESETS`. |+| `factory/` | `SttProvider` / `TtsProvider` traits; cloud/piper/external implementations; `create_stt_provider` / `create_tts_provider`; `effective_*_provider`; slug:model parsing; `DEFAULT_STT_MODEL`, `DEFAULT_PIPER_VOICE`. Split into `entry.rs` (public entry points + constants), `traits.rs`, `stt_providers.rs`, `tts_providers.rs`, `helpers.rs`. |+| `schemas/` | Controller schemas, registry exports, and all `handle_voice_*` / `handle_overlay_stt_notify` RPC handlers. Split into `registry.rs`, `params.rs`, `helpers.rs`, `handlers.rs` (+ `handlers/provider_server.rs`, `handlers/transcribe_tts.rs`). || `server.rs` | The `VoiceServer` dictation runtime: hotkey event loop, recording lifecycle, duration/silence/hallucination gates, background processing, global singleton (`global_server` / `try_global_server` / `start_if_enabled` / `run_standalone`). |+| `always_on.rs` | Phase 2 always-on listening: keeps the mic open continuously and uses VAD to carve utterances instead of gating on a hotkey. Owns the `cpal` stream and thread discipline; everything else (segmenting, resample, energies, wake-word gate) runs in the `tinyvoice` module. Opt-in (`config.voice_server.always_on_enabled`), pauses on screen lock. |+| `bus.rs` | Publishes `DomainEvent::Voice(VoiceEvent::PttTranscriptCommitted)` via `publish_ptt_transcript_committed`. |+| `compile_status.rs` | `VOICE_COMPILED_IN` — see the gate section above. || `hotkey.rs` | rdev-based global hotkey listener; `ActivationMode` (Tap/Push), `HotkeyEvent`, `HotkeyCombination`, `parse_hotkey`, `start_listener`. |-| `audio_capture.rs` | cpal mic capture → 16 kHz mono WAV bytes; `RecordingHandle`, silence-gate ring buffer, peak-RMS reporting. |+| `audio_capture.rs` | cpal mic capture → 16 kHz mono WAV bytes; `RecordingHandle`, silence-gate ring buffer, peak-RMS reporting. Delegates framing/resample/energy math to `crate::modules::voice` (the `tinyvoice` module). |+| `audio_toolkit/` | Podcast generation + email delivery (`audio_toolkit` RPC namespace), gated by the same `voice` feature. See its own [README](audio_toolkit/README.md). || `text_input.rs` | Clipboard-paste text insertion (`insert_text`) — writes clipboard then simulates Cmd/Ctrl+V via enigo, restoring prior clipboard. || `dictation_listener.rs` | Core-side dictation broadcast bus: `DictationEvent`, `publish_dictation_event` / `subscribe_dictation_events`, `publish_transcription` / `subscribe_transcription_results`, rdev listener lifecycle (`start_if_enabled` / `stop`), `normalize_hotkey_for_rdev`. || `reply_speech.rs` | Agent reply synthesis via backend `/openai/v1/audio/speech`; `ReplySpeechResult`, `VisemeFrame`, `AlignmentFrame`, `ReplySpeechOptions`, `synthesize_reply`, tolerant response normalization. |+| `realtime.rs` | Mints a short-lived signed WebSocket URL from the backend's `/voice-agent/get-signed-url` so the desktop client can open an ElevenLabs Agents session directly (#5399); the provider API key never leaves the server. |+| `realtime_harness.rs` | `voice:harness` socket turn handler for realtime sessions: runs the local orchestrator agent (same brain as chat/meet) on each turn the backend relays from the ElevenLabs Custom-LLM proxy, streaming `voice:harness:delta` / `:done` / `:error` back. |+| `stub.rs` | Disabled-voice facade compiled when `voice` is OFF; mirrors the real public surface with no-op / error bodies. || `cli.rs` | `openhuman voice` / `openhuman dictate` subcommand adapter — runs a blocking standalone dictation server (domain-owned, since it blocks forever and doesn't fit the controller registry). |-| `*_tests.rs` | Sibling test suites: `audio_capture_tests.rs`, `schemas_tests.rs`, `server_tests.rs` (wired via `#[path = ...]`); other files use inline `#[cfg(test)]`. |+| `*_tests.rs` | Sibling test suites wired via `#[path = ...]`: `always_on_tests.rs`, `audio_capture_tests.rs`, `bus_tests.rs`, `compile_status_tests.rs`, `dictation_listener_tests.rs`, `hotkey_tests.rs`, `ops_tests.rs`, `realtime_harness_tests.rs`, `realtime_tests.rs`, `reply_speech_tests.rs`, `schemas_tests.rs`, `server_tests.rs`, `text_input_tests.rs`, `types_tests.rs`; other files use inline `#[cfg(test)]`. |## Public surface- Types: `VoiceSpeechResult`, `VoiceStatus`, `VoiceTtsResult` (from `types`).- Ops (`pub use ops::*`): `voice_status`, `voice_transcribe`, `voice_transcribe_bytes`, `voice_tts`.-- Factory: `create_stt_provider`, `create_tts_provider`, `default_stt_provider`, `default_tts_provider`, `effective_stt_provider`, `effective_tts_provider`, traits `SttProvider` / `TtsProvider`, `SttResult`, `ExternalSttProvider`, `ExternalTtsProvider`, constants `DEFAULT_PIPER_VOICE`, `DEFAULT_WHISPER_MODEL`, `WHISPER_MODEL_PRESETS`.+- Factory: `create_stt_provider`, `create_tts_provider`, `default_stt_provider`, `default_tts_provider`, `effective_stt_provider`, `effective_tts_provider`, traits `SttProvider` / `TtsProvider`, `SttResult`, `ExternalSttProvider`, `ExternalTtsProvider`, constants `DEFAULT_PIPER_VOICE`, `DEFAULT_STT_MODEL`.- Schemas: `all_voice_controller_schemas`, `all_voice_registered_controllers`, `voice_schemas`.-- Re-exported inference submodules: `cloud_transcribe`, `hallucination`, `local_speech`, `postprocess`, `streaming`.-- Submodules `server`, `hotkey`, `dictation_listener`, `reply_speech`, `text_input`, `audio_capture`, `factory` are `pub`.+- Events: `publish_ptt_transcript_committed` (from `bus`).+- Compile status: `VOICE_COMPILED_IN` (from `compile_status`, always available regardless of the feature gate).+- Re-exported inference submodules: `cloud_transcribe`, `local_speech`, `postprocess`, and `streaming` (only when `http-server` is also enabled).+- Submodules `server`, `hotkey`, `dictation_listener`, `reply_speech`, `text_input`, `audio_capture`, `factory`, `always_on`, `bus`, `realtime`, `realtime_harness`, `audio_toolkit` are `pub`.## RPC / controllers@@ -47,12 +73,13 @@ Namespace `voice` (registered in `all_voice_registered_controllers`):| RPC method | Purpose || --- | --- || `voice.status` | STT/TTS binary + model availability and active provider selection. |-| `voice.transcribe` | Transcribe a file path (whisper.cpp), optional LLM cleanup. |+| `voice.agent_signed_url` | Mint a short-lived signed WebSocket URL for a realtime ElevenLabs Agents session. |+| `voice.transcribe` | Transcribe a file path, optional LLM cleanup. || `voice.transcribe_bytes` | Transcribe raw audio bytes (writes temp file), with hallucination filter + cleanup. || `voice.tts` | Synthesize speech to a file via Piper. || `voice.reply_synthesize` | Synthesize an agent reply through the effective TTS provider; returns base64 audio + visemes. || `voice.cloud_transcribe` | Transcribe base64 audio via the hosted backend STT proxy (back-compat path). |-| `voice.stt_dispatch` | Factory-dispatched STT (cloud / whisper / `<slug>:<model>`); returns `{ text, provider }`. |+| `voice.stt_dispatch` | Factory-dispatched STT (cloud / `<slug>:<model>`); returns `{ text, provider }`. || `voice.tts_dispatch` | Factory-dispatched TTS (cloud / piper / `<slug>:<voice>`); returns `ReplySpeechResult`. || `voice.set_providers` | Persist STT/TTS provider + model/voice into `config.local_ai.*`. || `voice.update_provider_settings` | Persist the voice provider registry + routing strings (mirrors inference model settings). |@@ -61,43 +88,75 @@ Namespace `voice` (registered in `all_voice_registered_controllers`):| `voice.server_start` / `voice.server_stop` / `voice.server_status` | Control the global dictation server. || `voice.overlay_stt_notify` | Bridge chat-button STT state transitions into the dictation/transcription buses. |-Provider strings follow the grammar `cloud`/`openhuman` (backend proxy), `whisper`/`piper` (local), `<slug>` or `<slug>:<model|voice>` (registry lookup in `config.voice_providers`).+Provider strings follow the grammar `cloud` / `openhuman` / `backend` (hosted+proxy), `piper` (local TTS), `<slug>` or `<slug>:<model|voice>` (registry+lookup in `config.voice_providers`). `"whisper"` and `"local"` used to select+the bundled whisper.cpp engine; that engine is gone, so both strings now fall+through to the slug lookup and error by name — `config::migrations` rewrites+persisted configs so a user never reaches that error.## Events-Does not use the typed `DomainEvent` bus. Instead `dictation_listener` owns two process-global `tokio::sync::broadcast` channels:+`bus.rs` publishes `DomainEvent::Voice(VoiceEvent::PttTranscriptCommitted)`+(thread id, session id, text length, held-ms, watchdog flag — never the raw+transcript, per the PII-safe logging rule) through the process-wide `BUS`.++Separately, `dictation_listener` owns two process-global `tokio::sync::broadcast`+channels that predate the typed event bus:- `DictationEvent` (`pressed`/`released`) — `publish_dictation_event` / `subscribe_dictation_events`.- transcription text — `publish_transcription` / `subscribe_transcription_results`.-`crates/openhuman-core/src/core/socketio.rs` subscribes to both and forwards them to Socket.IO clients (so dictation hotkeys and results reach the frontend without Tauri-side shortcut registration).+`crates/openhuman-core/src/core/socketio.rs` subscribes to both broadcast+channels and forwards them to Socket.IO clients (so dictation hotkeys and+results reach the frontend without Tauri-side shortcut registration).++## Contract crates++- `tinyvoice-bus` (`crates/openhuman-core/Cargo.toml`, optional, gated by the+ `voice` feature) — the wire contract for the loaded `tinyvoice` module.+- `crate::modules::voice` — the loaded `tinyvoice` native module. `audio_capture.rs`+ and `always_on.rs` call into it (as `tinyvoice`) for frame preparation, resample,+ per-frame energies, and WAV framing; this crate owns only the `cpal` stream and+ policy decisions, not the audio math.## Persistence-No dedicated `store.rs`. State is persisted into the shared TOML `Config` via the config domain: `config.local_ai.{stt,tts}_provider`, `config.local_ai.{stt_model_id,tts_voice_id}`, top-level `config.{stt,tts}_provider`, and `config.voice_providers` (the registry). The dictation `VoiceServer` keeps in-memory runtime state only (state machine, transcription count, rolling recent-transcript buffer for whisper context) behind a `OnceCell` singleton.+No dedicated `store.rs`. State is persisted into the shared TOML `Config` via+the config domain: `config.local_ai.{stt,tts}_provider`,+`config.local_ai.{stt_model_id,tts_voice_id}`, top-level+`config.{stt,tts}_provider`, and `config.voice_providers` (the registry). The+dictation `VoiceServer` keeps in-memory runtime state only (state machine,+transcription count, rolling recent-transcript buffer for context) behind a+`OnceCell` singleton.## Dependencies-- `crate::inference` — local AI runtime (`local::global`, model id/path resolution) and the relocated voice inference impls (`inference::voice::{cloud_transcribe, local_speech, hallucination, postprocess, streaming}`); also `inference::provider::factory::lookup_key_for_slug` for provider API keys.+- `crate::inference` — local AI runtime (`local::global`, model id/path resolution) and the relocated voice inference impls (`inference::voice::{cloud_transcribe, local_speech, postprocess, streaming}`); also `inference::provider::factory::lookup_key_for_slug` for provider API keys.- `crate::config` — `Config`, `config::rpc::load_config_with_timeout`, voice-server / dictation config sections, and `config::schema::voice_providers` (`VoiceProviderCreds`, capability/auth/API-style enums).- `crate::desktop::accessibility` (macOS only) — focused-text inspection (`focused_text_context_verbose`) and the Swift globe-key listener (`globe_listener_start` / `globe_listener_poll`) used in place of rdev for the Fn key.-- `crate::api` — `BackendOAuthClient`, `effective_backend_api_url`, `get_session_token` for backend-proxied reply-speech.-- `crate::core::all` (`ControllerFuture`, `RegisteredController`), `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`, `crate::core::logging` (CLI run init), and `crate::rpc::RpcOutcome`.-- External crates: `cpal` (capture), `rdev` (hotkeys), `enigo` + `arboard` (paste insertion), `reqwest` (external provider HTTP), `tokio`/`tokio-util`, `once_cell`.+- `crate::api` — `BackendOAuthClient`, `effective_backend_api_url`, `get_session_token` for backend-proxied reply-speech and the realtime signed-URL bootstrap.+- `crate::modules::voice` (`tinyvoice`) — frame prep, resample, energy, and WAV framing math shared with `audio_toolkit` and `always_on`.+- `crate::core::all` (`ControllerFuture`, `RegisteredController`), `crate::core::{ControllerSchema, FieldSchema, TypeSchema}`, `crate::core::bus::BUS` + `crate::core::events` (event publishing), `crate::core::logging` (CLI run init), and `crate::rpc::RpcOutcome`.+- External crates: `cpal` (capture), `rdev` (hotkeys), `enigo` + `arboard` (paste insertion), `reqwest` (external provider HTTP + realtime bootstrap), `tokio`/`tokio-util`, `once_cell`.## Used by- `crates/openhuman-core/src/core/all.rs` — registers the voice controllers.- `crates/openhuman-core/src/core/socketio.rs` — subscribes to the dictation/transcription broadcast buses; `streaming::handle_dictation_ws`.-- `crates/openhuman-core/src/core/jsonrpc.rs` — wiring.-- `crates/openhuman-core/src/desktop_companion/pipeline.rs`, `crates/openhuman-core/src/meet/agent/brain.rs`, `crates/openhuman-core/src/voice/audio_toolkit/ops.rs`, `crates/openhuman-core/src/security/credentials/ops.rs` — call factory / TTS / transcription helpers.-- `crates/openhuman-core/src/inference/local/install_piper.rs` — references voice constants/presets.+- `crates/openhuman-core/src/core/jsonrpc.rs` — WebSocket upgrade for streaming dictation.+- `crates/openhuman-core/src/web_chat/run_task.rs` — synthesizes agent reply speech and publishes PTT transcript-committed events.+- `crates/openhuman-core/src/channels/host/adapters.rs` — channel-side STT/TTS provider dispatch and reply synthesis.+- `crates/openhuman-core/src/security/credentials/ops_part_01.rs` — starts/stops the dictation server, dictation listener, and always-on listener when credentials that gate them change.+- `crates/openhuman-core/src/inference/local/install_piper.rs` — references `DEFAULT_PIPER_VOICE`.+- `crates/openhuman-core/src/desktop/overlay/` — the notch overlay subscribes to the same dictation/transcription pattern.## Notes / gotchas- **macOS hotkey safety (#2677):** rdev's CGEventTap callback calls `TSMGetInputSourceProperty` off the main thread, which crashes with `EXC_BREAKPOINT` on macOS 26. So on macOS the core-side `dictation_listener::start_if_enabled` is a no-op and the voice server only supports the `fn` (Globe) key via the Swift globe listener; all other keys return an error. Non-macOS uses rdev for all keys.- **Two server instances:** `global_server` registers the singleton observed by the `voice.server_*` RPCs; `run_standalone` (CLI) deliberately creates an isolated, unregistered `VoiceServer`.-- **Reply-speech approval-gate classification is "internal"** — if `reply_speech` is ever wrapped in a `Tool`, `external_effect()` MUST stay `false` so the approval gate never prompts on TTS (see file docstring + #1339/#1206).+- **Reply-speech and realtime approval-gate classification is "internal"** — if `reply_speech` is ever wrapped in a `Tool`, `external_effect()` MUST stay `false` so the approval gate never prompts on TTS (see file docstring + #1339/#1206). `realtime_harness` turns are classified `ExternalChannel` instead, since they originate as user speech over a channel.- **Provider precedence:** `effective_*_provider` prefers the top-level `config.{stt,tts}_provider`, falls back to `config.local_ai.*_provider`, then defaults to `"cloud"`.- **Piper-voice guard:** dispatch handlers only default to `DEFAULT_PIPER_VOICE` when the active provider is `piper`; sending a Piper voice id to a cloud/external endpoint would be invalid.- **Dictation pipeline gates** (in `server.rs`): minimum duration → peak-RMS silence threshold → hallucination filter → empty-text — each drops the recording before delivery. A `session_generation` counter discards stale state transitions from superseded recordings.-- **Kokoro TTS is intentionally not implemented** in this cut; the doc in `factory.rs` describes how to add it as a new branch + sibling module.+- **Kokoro TTS is intentionally not implemented** in this cut; the doc in `factory/entry.rs` describes how to add it as a new branch + sibling module.+- **No local STT branch:** `"whisper"`/`"local"` provider strings are legacy and error rather than silently falling back — a real misconfiguration should surface, not degrade quietly (see `factory/entry.rs::create_stt_provider`).diff --git a/crates/openhuman-core/src/web3/wallet/README.md b/crates/openhuman-core/src/web3/wallet/README.mdindex c6b4081474..7cd9c923bd 100644--- a/crates/openhuman-core/src/web3/wallet/README.md+++ b/crates/openhuman-core/src/web3/wallet/README.md@@ -28,7 +28,7 @@ drift.- Build prepared-transaction quotes (validated, fee-estimated, TTL'd) that must be explicitly confirmed before execution.- Sign and broadcast confirmed quotes per chain; restore (and TTL-refresh) the quote on failure so it stays retryable.- Bind each quote to the chat thread that prepared it so a leaked `quote_id` in a shared channel can't be hijacked from another agent session.-- Expose six agent tools (`wallet_status`, `wallet_chain_status`, `wallet_prepare_transfer`, `wallet_tx_status`, `wallet_tx_receipt`, `wallet_lookup_tx`) and twelve `wallet` RPC controllers.+- Expose six agent tools (`wallet_status`, `wallet_chain_status`, `wallet_prepare_transfer`, `wallet_tx_status`, `wallet_tx_receipt`, `wallet_lookup_tx`) and twelve `wallet.*` RPC controllers.- Provide crate-internal `sign_and_broadcast_evm` / `sign_and_broadcast_solana` primitives for the `web3` layer (sign+broadcast an externally-built unsigned transaction). Not exposed to the agent / RPC surface.## Key files