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
feat(embed): add error handling and runtime context to harness
Steven Enamakel028d210bca76
diff --git a/Cargo.toml b/Cargo.tomlindex 6d1d28e2ba..97ce7a0592 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,7 +1,12 @@-# Virtual workspace root. OpenHuman's implementation and package manifest live-# under `crates/openhuman-core`. Vendored-# module workspaces are excluded so their workspace-inherited keys continue to-# resolve against their own roots.+# Virtual workspace root. Members: `crates/openhuman-core` (package `openhuman`,+# the core + `openhuman-core` CLI), `crates/openhuman-embed` (library facade),+# `crates/openhuman-rpc` (shared RPC contracts/client), and `crates/openhuman-tui`+# (terminal client). `crates/openhuman-app` is deliberately excluded: it is its+# own Cargo world with its own lockfile and target directory so that root-only+# Cargo commands don't resolve GTK/WebKit/Tauri, and it must mirror this file's+# `[patch]` tables rather than inherit them. Vendored module workspaces are also+# excluded so their workspace-inherited keys continue to resolve against their+# own roots.[workspace]resolver = "2"members = ["crates/openhuman-core", "crates/openhuman-embed", "crates/openhuman-rpc", "crates/openhuman-tui"]diff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rsindex 3a88a502ee..7390212c0d 100644--- a/crates/openhuman-app/src/lib.rs+++ b/crates/openhuman-app/src/lib.rs@@ -1,3 +1,27 @@+//! Desktop host for OpenHuman: Tauri v2 + Wry, targeting Windows, macOS, and+//! Linux.+//!+//! `openhuman_core` is linked in-process; its JSON-RPC server runs as a+//! tokio task (`core_process`) instead of a spawned sidecar. The renderer+//! reaches it over `http://127.0.0.1:<port>/rpc`, using the per-launch+//! bearer returned by the `core_rpc_token` command.+//!+//! Public surface is exactly two functions: [`run`] starts the Tauri+//! application, and [`run_core_from_args`] dispatches straight into the+//! core CLI for the `core`/`mcp` subcommands `main.rs` routes here.+//!+//! Shell-local Cargo features (`gateways`, `custom-protocol`,+//! `e2e-test-support`, `sandbox-bubblewrap`) gate desktop-only behavior; the+//! `openhuman_core` product feature list is forwarded explicitly below and+//! guarded by the `VOICE_COMPILED_IN` / `HTTP_SERVER_COMPILED_IN` compile-time+//! asserts.+//!+//! This crate is excluded from the root Cargo workspace — build it with+//! `cargo check --manifest-path crates/openhuman-app/Cargo.toml`. See+//! `README.md` in this crate and+//! [`gitbooks/developing/architecture/tauri-shell.md`](../../../gitbooks/developing/architecture/tauri-shell.md)+//! for the full IPC surface and lifecycle model.+// Desktop targets: Windows, macOS, Linux. iOS + Android live in// `app/src-tauri-mobile/`.#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]@@ -3595,11 +3619,11 @@ pub fn run_core_from_args(args: &[String]) -> Result<(), String> {/// Canonical release tag: `openhuman@<version>[+<short_sha>]`.///-/// Mirrors `build_release_tag` in the core sidecar's `src/main.rs` and the+/// Mirrors `build_release_tag` in `crates/openhuman-core/src/main.rs` and the/// `SENTRY_RELEASE` value computed in `app/vite.config.ts` so events from-/// every surface (React frontend, core sidecar, Tauri shell) group under the-/// same release in Sentry and benefit from the same source-map / debug-info-/// upload.+/// every surface (React frontend, standalone `openhuman-core` binary, Tauri+/// shell) group under the same release in Sentry and benefit from the same+/// source-map / debug-info upload./// Return `true` when the Sentry event is a "Failed to request/// http://localhost:…" message originating from the vendored/// `tauri-runtime-cef` dev-server proxy.diff --git a/crates/openhuman-core/src/bin/fleet.rs b/crates/openhuman-core/src/bin/fleet.rsindex d36881fe46..72285da668 100644--- a/crates/openhuman-core/src/bin/fleet.rs+++ b/crates/openhuman-core/src/bin/fleet.rs@@ -3,7 +3,7 @@//! Hosts one `openhuman-core` process per user/workspace and fronts them behind//! a single endpoint so a team server can manage many members' assistants while//! every existing client (`CloudHttpTransport`) keeps working unchanged. This is-//! Phase 4 of the pluggable-core plan (`docs/plans/pluggable-core/phase-4-fleet-host.md`).+//! Phase 4 of the pluggable-core work (see `core::runtime`).//!//! Design (process-per-user, not in-process multi-tenancy)://! - Each tenant gets its own OS process (`openhuman-core run --headless-api`),diff --git a/crates/openhuman-core/src/core/jsonrpc.rs b/crates/openhuman-core/src/core/jsonrpc.rsindex 47bbadd495..5da59c4b95 100644--- a/crates/openhuman-core/src/core/jsonrpc.rs+++ b/crates/openhuman-core/src/core/jsonrpc.rs@@ -1855,7 +1855,7 @@ async fn run_server_with_services(// background services on (`ServiceSet::desktop`), Socket.IO per the caller// flag, and the legacy `embedded_core` → `HostKind` mapping (embedded ==// Tauri shell; standalone splits CLI / Docker via `detect_standalone`).- // See `docs/plans/pluggable-core/phase-1-corebuilder.md`.+ // See the pluggable-core work (`core::runtime`).let host_kind = if embedded_core {crate::core::types::HostKind::TauriShell} else {diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rsindex 383ed088c3..1c81464a00 100644--- a/crates/openhuman-core/src/core/runtime/builder.rs+++ b/crates/openhuman-core/src/core/runtime/builder.rs@@ -17,7 +17,8 @@//! The legacy entry points (`run_server`, `run_server_embedded`,//! `run_server_embedded_with_ready`) are now thin shims over this builder, so//! the desktop shell, the standalone CLI, and any new embedder share one path.-//! See `docs/plans/pluggable-core/phase-1-corebuilder.md`.+//! See the pluggable-core work (`core::runtime`) for how this fits with+//! [`context`](crate::core::runtime::context) and `services`.use std::sync::Arc;diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 6b2d65e67b..fca12a4b23 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -5,7 +5,8 @@//! the workspace-bound stores, and run pure `bootstrap_core_runtime` registration. Today it is a//! facade — the store init still targets the process globals — but centralizing//! the sequence here is the seam the later stages build on (handler-threaded-//! context, per-context stores). See `docs/plans/pluggable-core/phase-2-corecontext.md`.+//! context, per-context stores). See the pluggable-core work (`core::runtime`)+//! for how this fits with [`builder`](crate::core::runtime::builder).//!//! [`init_stores`] initializes the process-global stores bound to a single//! resolved workspace directory (memory, image attachments, WhatsApp data,@@ -73,7 +74,7 @@ pub struct CoreContext {/// `Config::load_or_init()` and re-resolves the process-global workspace./// An embedder that supplied a config would therefore watch its turns run/// against `~/.openhuman` anyway. Publishing it on the context — the seam- /// phase 2 of `docs/plans/pluggable-core/` introduced for exactly this+ /// phase 2 of the pluggable-core work (`core::runtime`) introduced for exactly this/// migration — lets that loader prefer it without any handler changing.embedder_config: Option<crate::config::Config>,/// Per-tool-group disclosure for this context (seediff --git a/crates/openhuman-embed/src/harness/error.rs b/crates/openhuman-embed/src/harness/error.rsindex 19db83fb61..03e74bc26d 100644--- a/crates/openhuman-embed/src/harness/error.rs+++ b/crates/openhuman-embed/src/harness/error.rs@@ -37,10 +37,10 @@ pub enum HarnessError {////// Not a limitation of the harness but of the core it wraps: the keyring/// master key, the RPC bearer, the global event bus and the `Once`-guarded- /// domain subscribers are all process-scoped (see the pluggable-core plan's- /// phase 3). Two harnesses would share those while believing they had- /// separate workspaces, which corrupts state quietly rather than loudly.- /// Failing here is the loud version.+ /// domain subscribers are all process-scoped (see+ /// [`openhuman_core::core::runtime`]). Two harnesses would share those while+ /// believing they had separate workspaces, which corrupts state quietly+ /// rather than loudly. Failing here is the loud version.#[error("an OpenHuman harness is already running in this process; \core state (keyring, event bus, domain subscribers) is process-scoped, \diff --git a/crates/openhuman-embed/src/harness/mod.rs b/crates/openhuman-embed/src/harness/mod.rsindex 7f60302246..77f5cf8905 100644--- a/crates/openhuman-embed/src/harness/mod.rs+++ b/crates/openhuman-embed/src/harness/mod.rs@@ -77,8 +77,9 @@//! global event bus and the `Once`-guarded domain subscribers are all//! process-scoped, so two harnesses would silently share them while believing//! they had separate workspaces. [`HarnessBuilder::build`] returns-//! [`HarnessError::AlreadyRunning`] rather than letting that happen. Lifting the-//! restriction is phase 3 of `docs/plans/pluggable-core/`.+//! [`HarnessError::AlreadyRunning`] rather than letting that happen. See+//! [`openhuman_core::core::runtime`] for how the underlying process-scoped+//! state is composed.mod access;mod builder;diff --git a/crates/openhuman-tui/src/lib.rs b/crates/openhuman-tui/src/lib.rsindex 16af4f4b37..20bb63e8ce 100644--- a/crates/openhuman-tui/src/lib.rs+++ b/crates/openhuman-tui/src/lib.rs@@ -12,6 +12,20 @@//!//! The terminal dependencies and UI code live entirely in this crate, keeping//! the shared core crate free of terminal-specific dependencies.+//!+//! Public surface: [`run_from_cli`] (the CLI entry point — see its doc for the+//! flag list, or `README.md` for a rendered flag table), [`init_crash_reporting`],+//! and the [`TranscriptState`] / [`Entry`] / [`EntryKind`] reducer types used by+//! `state.rs` and its tests. RPC envelope decoding comes from+//! [`openhuman_rpc::unwrap_rpc`](openhuman_rpc::unwrap_rpc), re-exported from+//! `cockpit.rs`, the same shape the desktop app decodes over HTTP.+//!+//! The `crash-reporting` feature (default on) pulls in `sentry` and `dotenvy`+//! and forwards `openhuman-core/crash-reporting`. Without it,+//! [`init_crash_reporting`] compiles to a no-op at the same call site — see+//! `crash_reporting.rs`.+//!+//! See `README.md` for build/run instructions and the packaging story.mod app;mod cockpit;