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(app): add local data reset and workspace path handling
Steven Enamakel83a214e20325
diff --git a/crates/openhuman-app/src/artifact_commands.rs b/crates/openhuman-app/src/artifact_commands.rsindex d81d7da545..80ba28622f 100644--- a/crates/openhuman-app/src/artifact_commands.rs+++ b/crates/openhuman-app/src/artifact_commands.rs@@ -31,14 +31,14 @@ use std::path::{Path, PathBuf};/// in the given workspace. Isolated from config loading for unit testing.async fn resolve_source(workspace_dir: &Path,- roots: &openhuman_core::agent::artifacts::FileRoots,+ roots: &openhuman_rpc::embed::artifacts::FileRoots,artifact_id: &str,) -> Result<PathBuf, String> {let artifact_id = artifact_id.trim();if artifact_id.is_empty() {return Err("artifact_id must not be empty".to_string());}- openhuman_core::agent::artifacts::resolve_ready_file(workspace_dir, roots, artifact_id).await+ openhuman_rpc::embed::artifacts::resolve_ready_file(workspace_dir, roots, artifact_id).await}/// Copy `source` to `dest`, returning the byte count. Isolated so it is@@ -62,8 +62,8 @@ pub async fn download_artifact_to_downloads(if artifact_id.trim().is_empty() {return Err("artifact_id must not be empty".to_string());}- let config = openhuman_core::config::rpc::load_config_with_timeout().await?;- let roots = openhuman_core::agent::artifacts::FileRoots::from_config(&config);+ let config = openhuman_rpc::embed::config::load_config_with_timeout().await?;+ let roots = openhuman_rpc::embed::artifacts::FileRoots::from_config(&config);let source = resolve_source(&config.workspace_dir, &roots, &artifact_id).await?;if filename.trim().is_empty() {return Err("filename must not be empty".to_string());diff --git a/crates/openhuman-app/src/artifact_commands_tests.rs b/crates/openhuman-app/src/artifact_commands_tests.rsindex 0da3a9aec2..b5f7ac4604 100644--- a/crates/openhuman-app/src/artifact_commands_tests.rs+++ b/crates/openhuman-app/src/artifact_commands_tests.rs@@ -1,5 +1,5 @@use super::*;-use openhuman_core::agent::artifacts::FileRoots;+use openhuman_rpc::embed::artifacts::FileRoots;#[test]fn sanitize_rejects_path_separators() {@@ -22,7 +22,7 @@ fn sanitize_accepts_plain_names() {}async fn ready_artifact(workspace: &Path, files_dir: &Path) -> String {- use openhuman_core::agent::artifacts::{create_artifact, finalize_artifact, ArtifactKind};+ use openhuman_rpc::embed::artifacts::{create_artifact, finalize_artifact, ArtifactKind};let (meta, path) = create_artifact(workspace,files_dir,@@ -75,7 +75,7 @@ async fn resolve_source_rejects_unknown_ids_and_paths() {#[tokio::test]async fn resolve_source_refuses_a_file_the_store_does_not_vouch_for() {- use openhuman_core::agent::artifacts::{ArtifactKind, ArtifactMeta, ArtifactStatus};+ use openhuman_rpc::embed::artifacts::{ArtifactKind, ArtifactMeta, ArtifactStatus};let temp = tempfile::tempdir().unwrap();let secret = temp.path().join("secret.txt");std::fs::write(&secret, b"private").unwrap();@@ -110,7 +110,7 @@ async fn resolve_source_refuses_a_file_the_store_does_not_vouch_for() {/// refused because that root is not one of the vouched-for files folders.#[tokio::test]async fn resolve_source_refuses_a_record_that_claims_its_own_root() {- use openhuman_core::agent::artifacts::{ArtifactKind, ArtifactMeta, ArtifactStatus};+ use openhuman_rpc::embed::artifacts::{ArtifactKind, ArtifactMeta, ArtifactStatus};let temp = tempfile::tempdir().unwrap();let home = temp.path().join("home");std::fs::create_dir_all(&home).unwrap();diff --git a/crates/openhuman-app/src/core_process_tests.rs b/crates/openhuman-app/src/core_process_tests.rsindex 0d26d84238..c0edfa5873 100644--- a/crates/openhuman-app/src/core_process_tests.rs+++ b/crates/openhuman-app/src/core_process_tests.rs@@ -28,8 +28,8 @@ fn env_lock() -> MutexGuard<'static, ()> {fn core_test_runtime() -> tokio::runtime::Runtime {tokio::runtime::Builder::new_multi_thread().enable_all()- .thread_stack_size(openhuman_core::core::runtime::AGENT_WORKER_STACK_BYTES)- .max_blocking_threads(openhuman_core::core::runtime::MAX_BLOCKING_THREADS)+ .thread_stack_size(openhuman_rpc::embed::process::AGENT_WORKER_STACK_BYTES)+ .max_blocking_threads(openhuman_rpc::embed::process::MAX_BLOCKING_THREADS).build().expect("build core test runtime")}@@ -82,7 +82,7 @@ fn core_process_handle_new_creates_instance() {#[test]fn ready_signal_updates_runtime_port_and_fallback_notice() {let handle = CoreProcessHandle::new(7788);- handle.apply_embedded_ready_signal(openhuman_rpc::server::EmbeddedReadySignal {+ handle.apply_embedded_ready_signal(openhuman_rpc::host::EmbeddedReadySignal {port: 7789,fallback_from: Some(7788),});diff --git a/crates/openhuman-app/src/file_logging.rs b/crates/openhuman-app/src/file_logging.rsindex 1e1c77d6ad..638fb9a490 100644--- a/crates/openhuman-app/src/file_logging.rs+++ b/crates/openhuman-app/src/file_logging.rs@@ -2,7 +2,7 @@//!//! Resolves the OpenHuman data directory the same way the core does//! (`~/.openhuman` or `OPENHUMAN_WORKSPACE` override) and hands it to-//! [`openhuman_core::core::logging::init_for_embedded`], which installs a+//! [`openhuman_rpc::embed::process::init_for_embedded`], which installs a//! daily-rotated file appender so packaged GUI builds — where stderr is//! invisible — still produce a log users can share for support.//!@@ -11,7 +11,7 @@use std::path::PathBuf;-use openhuman_core::core::logging::{self, log_directory};+use openhuman_rpc::embed::process::{self as logging, log_directory};/// Initialize logging for the Tauri shell + embedded core. Idempotent and/// safe to call from any startup position; the underlying `Once` guard means@@ -41,7 +41,7 @@ pub(crate) fn resolve_data_dir() -> PathBuf {return PathBuf::from(workspace);}}- openhuman_core::config::default_root_openhuman_dir().unwrap_or_else(|err| {+ openhuman_rpc::embed::config::default_root_openhuman_dir().unwrap_or_else(|err| {eprintln!("[file_logging] default_root_openhuman_dir failed ({err}); falling back to temp dir");diff --git a/crates/openhuman-app/src/file_logging_tests.rs b/crates/openhuman-app/src/file_logging_tests.rsindex 9b832e9a4d..63fbba7099 100644--- a/crates/openhuman-app/src/file_logging_tests.rs+++ b/crates/openhuman-app/src/file_logging_tests.rs@@ -50,7 +50,7 @@ fn reveal_logs_folder_errors_when_uninitialized() {// If logging hasn't been initialized, the command must surface a// typed error so the UI can show it instead of silently launching// an `open` against an empty path.- if openhuman_core::core::logging::log_directory().is_none() {+ if openhuman_rpc::embed::process::log_directory().is_none() {let err = reveal_logs_folder().expect_err("must error pre-init");assert!(err.contains("not initialized"), "unexpected error: {err}");}diff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rsindex 6538ee586c..c4c6427f6f 100644--- a/crates/openhuman-app/src/lib.rs+++ b/crates/openhuman-app/src/lib.rs@@ -1,8 +1,11 @@//! 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+//! The core is linked in-process; its JSON-RPC server runs as a tokio task+//! (`core_process`, booted through `openhuman_rpc::host::desktop`) instead of+//! a spawned sidecar. `openhuman-rpc` is this crate's only openhuman+//! dependency: the embed facades and the TinyHumans session owner are reached+//! as `openhuman_rpc::embed` and `openhuman_rpc::tinyhumans`. The renderer//! reaches it over `http://127.0.0.1:<port>/rpc`, using the per-launch//! bearer returned by the `core_rpc_token` command.//!@@ -12,7 +15,7 @@//!//! The Cargo features `gateways`, `custom-protocol`, `e2e-test-support`, and//! `sandbox-bubblewrap` are shell-local and not part of the product feature-//! list; the `openhuman_core` product gates are forwarded explicitly in+//! list; the product gates are forwarded explicitly on `openhuman-rpc` in//! `Cargo.toml` and guarded by the `VOICE_COMPILED_IN` ///! `HTTP_SERVER_COMPILED_IN` compile-time asserts below.//!diff --git a/crates/openhuman-app/src/local_data_reset.rs b/crates/openhuman-app/src/local_data_reset.rsindex 7abbbaab8e..b675573689 100644--- a/crates/openhuman-app/src/local_data_reset.rs+++ b/crates/openhuman-app/src/local_data_reset.rs@@ -89,7 +89,7 @@ pub async fn reset_local_data(// below to fail with `ERROR_SHARING_VIOLATION` (os error 32). Drop// the writer guard now so the background flushing thread exits and// the file handle is closed before the removal walks the tree.- let log_guard_dropped = openhuman_core::core::logging::shutdown_file_guard();+ let log_guard_dropped = openhuman_rpc::embed::process::shutdown_file_guard();log::info!("[core] reset_local_data: shutdown_file_guard dropped guard = {log_guard_dropped}");// ── 4. Remove the paths ─────────────────────────────────────────────diff --git a/crates/openhuman-app/src/main.rs b/crates/openhuman-app/src/main.rsindex 0a72934fe9..a04931d382 100644--- a/crates/openhuman-app/src/main.rs+++ b/crates/openhuman-app/src/main.rs@@ -7,14 +7,10 @@fn main() {// Every path below boots a core that must reach the hosted backend- // (billing, integrations, channel relay, login): give it the SDK-backed- // transport before the first dispatch. The core itself carries none.- if let Err(err) = openhuman_tinyhumans::install(openhuman_tinyhumans::InstallOptions::default())- {- eprintln!("failed to install the TinyHumans backend transport: {err}");- std::process::exit(1);- }-+ // (billing, integrations, channel relay, login). Each boots through an+ // `openhuman_rpc::host` entry (`cli` for `core`/`mcp`, `desktop` for the+ // GUI's embedded server), which connects the TinyHumans backend transport+ // itself, so there is no separate install step here.let args: Vec<String> = std::env::args().collect();let sub = args.get(1).map(String::as_str);if sub == Some("core") {diff --git a/crates/openhuman-app/src/session/commands.rs b/crates/openhuman-app/src/session/commands.rsindex 71226a0e87..da91b81653 100644--- a/crates/openhuman-app/src/session/commands.rs+++ b/crates/openhuman-app/src/session/commands.rs@@ -1,13 +1,13 @@//! Tauri commands the renderer uses to drive login, logout and the current//! user. Each is a one-line delegate to the managed `SessionHost`; the-//! `Err(String)` carries `openhuman_tinyhumans::SessionError`'s stable+//! `Err(String)` carries `openhuman_rpc::tinyhumans::SessionError`'s stable//! `PREFIX:` so the frontend can classify without parsing prose.-use openhuman_tinyhumans::{CachedUser, SessionState};+use openhuman_rpc::tinyhumans::{CachedUser, SessionState};use super::SessionHost;-fn err(error: openhuman_tinyhumans::SessionError) -> String {+fn err(error: openhuman_rpc::tinyhumans::SessionError) -> String {error.to_string()}diff --git a/crates/openhuman-app/src/session/link.rs b/crates/openhuman-app/src/session/link.rsindex af98df65d8..0cc6c718dd 100644--- a/crates/openhuman-app/src/session/link.rs+++ b/crates/openhuman-app/src/session/link.rs@@ -5,7 +5,7 @@//! loopback.use async_trait::async_trait;-use openhuman_tinyhumans::CoreLink;+use openhuman_rpc::tinyhumans::CoreLink;use serde_json::Value;use crate::core_process::CoreProcessHandle;diff --git a/crates/openhuman-app/src/session/mod.rs b/crates/openhuman-app/src/session/mod.rsindex 0934d1cc5c..0e6e404e6d 100644--- a/crates/openhuman-app/src/session/mod.rs+++ b/crates/openhuman-app/src/session/mod.rs@@ -13,7 +13,7 @@ mod link;use std::sync::Arc;-use openhuman_tinyhumans::{ClientHeaders, SessionEvent, SessionManager};+use openhuman_rpc::tinyhumans::{ClientHeaders, SessionEvent, SessionManager};use tauri::{AppHandle, Emitter, Manager};use crate::core_process::CoreProcessHandle;@@ -22,7 +22,7 @@ use crate::AppRuntime;pub(crate) use link::HttpCoreLink;/// Tauri event emitted whenever the credential or the current user changes.-/// Payload: `openhuman_tinyhumans::SessionState`.+/// Payload: `openhuman_rpc::tinyhumans::SessionState`.pub const AUTH_CHANGED_EVENT: &str = "auth://changed";/// Tauri event emitted when the backend rejected the stored credential and it/// has been cleared. Payload: `{ source }`.@@ -37,7 +37,7 @@ impl SessionHost {pub fn new(desktop: CoreProcessHandle) -> Self {// The shell and the core ship as one release, so one version answers// for both `x-core-version` and `x-tauri-version`.- let headers = ClientHeaders::new(openhuman_tinyhumans::product_identity().as_str())+ let headers = ClientHeaders::new(openhuman_rpc::tinyhumans::product_identity().as_str()).with_core_version(env!("CARGO_PKG_VERSION")).with_tauri_version(env!("CARGO_PKG_VERSION"));let link = Arc::new(HttpCoreLink::new(desktop));@@ -89,5 +89,5 @@ pub fn install(app: &AppHandle<AppRuntime>, desktop: CoreProcessHandle) {/// The signed-in user id, for synchronous callers (Sentry `before_send`).pub fn peek_user_id() -> Option<String> {- openhuman_tinyhumans::identity::peek_user_id()+ openhuman_rpc::tinyhumans::identity::peek_user_id()}diff --git a/crates/openhuman-app/src/workspace_paths.rs b/crates/openhuman-app/src/workspace_paths.rsindex 0060752aeb..0d8b17df7a 100644--- a/crates/openhuman-app/src/workspace_paths.rs+++ b/crates/openhuman-app/src/workspace_paths.rs@@ -52,7 +52,7 @@ pub async fn preview_workspace_text(path: String) -> Result<WorkspaceTextPreview}async fn active_workspace_root() -> Result<PathBuf, String> {- let config = openhuman_core::config::Config::load_or_init()+ let config = openhuman_rpc::embed::config::load_or_init().await.map_err(|err| workspace_path_error(format!("failed to load OpenHuman config: {err}")))?;fs::create_dir_all(&config.workspace_dir).map_err(|err| {