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
refactor(core): extract hosted controllers into openhuman-tinyhumans crate
Steven Enamakelfc8f969a7934
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rsindex e9d300f780..a554a16a37 100644--- a/crates/openhuman-core/src/core/all.rs+++ b/crates/openhuman-core/src/core/all.rs@@ -135,7 +135,9 @@ pub enum DomainGroup {/// (`desktop/`).Desktop,/// Clients of the hosted TinyHumans backend — billing, team, referral, and- /// announcements (`hosted/`). A self-hosted build drops these as a unit.+ /// announcements. Not built into the core: `openhuman-tinyhumans::hosted`+ /// registers them through [`register_controller_extension`], and this+ /// group is what the ambient `DomainSet` gates them with.Hosted,/// Loadable native modules: the module host, its registry, and the `modules`/// RPC surface (`modules/`).@@ -966,30 +968,10 @@ fn build_registered_controllers() -> Vec<GroupedController> {Some(Capability::Sources),crate::memory::sources::all_memory_sources_registered_controllers(),);- // Referral and growth tracking- push(- &mut controllers,- DomainGroup::Hosted,- crate::hosted::referral::all_referral_registered_controllers(),- );- // Billing and subscription management- push(- &mut controllers,- DomainGroup::Hosted,- crate::hosted::billing::all_billing_registered_controllers(),- );- // Announcements surfaced on harness init- push(- &mut controllers,- DomainGroup::Hosted,- crate::hosted::announcements::all_announcements_registered_controllers(),- );- // Team and role management- push(- &mut controllers,- DomainGroup::Hosted,- crate::hosted::team::all_team_registered_controllers(),- );+ // The hosted TinyHumans proxies (`billing`, `team`, `referral`,+ // `announcements`, `DomainGroup::Hosted`) are NOT built in: they live in+ // `openhuman-tinyhumans` and arrive through `register_controller_extension`+ // when a host installs that crate. A core without it has no such RPCs.// E2E test support — `openhuman.test_reset` wipes sidecar state in-place.// Gated behind the `e2e-test-support` cargo feature so shipped binaries// never even register the destructive wipe RPC. Flipped on by the E2E@@ -1249,7 +1231,6 @@ pub fn namespace_description(namespace: &str) -> Option<&'static str> {"memory_sources" => Some("User-configured data connectors (Composio, folders, GitHub repos, RSS, web pages) that feed memory.",),- "referral" => Some("Referral codes, stats, and apply flows via the hosted backend API."),"run_ledger" => Some("Durable agent and workflow run state, child lineage, events, telemetry, and checkpoint references.",),@@ -1262,11 +1243,6 @@ pub fn namespace_description(namespace: &str) -> Option<&'static str> {"agent_team" => Some("Durable agent-team coordination: teams, members, dependency-aware task claiming, and teammate messaging.",),- "billing" => Some("Subscription plan, payment links, and credit top-up via the backend."),- "announcements" => {- Some("Latest active product announcement surfaced on harness init, via the backend.")- }- "team" => Some("Team member management, invites, and role changes via the backend."),"tool_registry" => Some("Read-only discovery for MCP stdio tools and controller-backed tools, including routes, schemas, version, allowed agents, and health.",),diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rsindex a1791dfb0f..a971edf29c 100644--- a/crates/openhuman-core/src/core/observability.rs+++ b/crates/openhuman-core/src/core/observability.rs@@ -3159,7 +3159,7 @@ pub fn is_transient_message_failure(msg: &str) -> bool {}/// Sentinel prefix stamped on a `/teams/me/usage` probe error that the-/// failure-backoff in `crate::hosted::team::ops` short-circuited — i.e. an+/// failure-backoff in `crate::integrations::client::budget_gate` short-circuited — i.e. an/// already-reported repeat within the backoff window. The FIRST failure of a/// streak propagates its real error string and reports normally; only the/// suppressed repeats carry this prefix so the JSON-RPC boundary can demotediff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rsindex e3b68683b8..58f4e9af4c 100644--- a/crates/openhuman-core/src/lib.rs+++ b/crates/openhuman-core/src/lib.rs@@ -11,7 +11,7 @@//! alphabetical, with the `rpc` re-export sitting between `platform` and//! `runtime` — keep new modules sorted the same way): `agent`, `api`,//! `channels`, `config`, `core`, `cron`, `desktop`, `flows` (feature-//! `flows`), `hooks`, `hosted`, `hosting` (feature `hosting`), `http_host`+//! `flows`), `hooks`, `hosting` (feature `hosting`), `http_host`//! (feature `http-server`), `inference`, `integrations`, `json_schema`,//! `mcp`, `media` (feature `media`), `medulla`, `memory`, `modules` (feature//! `modules`), `platform`, `runtime`, `sandbox`, `search`, `security`,@@ -61,7 +61,6 @@ pub mod desktop;#[cfg(feature = "flows")]pub mod flows;pub mod hooks;-pub mod hosted;#[cfg(feature = "hosting")]pub mod hosting;#[cfg(feature = "http-server")]diff --git a/crates/openhuman-tinyhumans/src/hosted/announcements/ops.rs b/crates/openhuman-tinyhumans/src/hosted/announcements/ops.rsindex 577eb139fb..0f01bdf7be 100644--- a/crates/openhuman-tinyhumans/src/hosted/announcements/ops.rs+++ b/crates/openhuman-tinyhumans/src/hosted/announcements/ops.rs@@ -9,17 +9,17 @@use reqwest::Method;use serde_json::Value;-use crate::api::config::effective_backend_api_url;-use crate::api::{BackendApiError, BackendOAuthClient};-use crate::config::Config;-use crate::rpc::RpcOutcome;+use openhuman_core::api::config::effective_backend_api_url;+use openhuman_core::api::{BackendApiError, BackendOAuthClient};+use openhuman_core::config::Config;+use openhuman_core::rpc::RpcOutcome;/// Canonical authed-session guard — rejects an expired token locally instead of/// firing a doomed backend 401 (see `billing/ops.rs` / #3297).fn require_token(config: &Config,-) -> Result<crate::security::credentials::session_support::BackendCredential, String> {- crate::security::credentials::session_support::resolve_backend_credential(config)+) -> Result<openhuman_core::security::credentials::session_support::BackendCredential, String> {+ openhuman_core::security::credentials::session_support::resolve_backend_credential(config)}/// `true` when `err` is the typed `BackendApiError::AnnouncementNotFound` 404@@ -56,7 +56,7 @@ pub async fn get_latest_announcement(config: &Config) -> Result<RpcOutcome<ValueValue::Null,"no announcement available (404)",)),- Err(err) => Err(crate::api::flatten_authed_error(err)),+ Err(err) => Err(openhuman_core::api::flatten_authed_error(err)),}}diff --git a/crates/openhuman-tinyhumans/src/hosted/announcements/schemas.rs b/crates/openhuman-tinyhumans/src/hosted/announcements/schemas.rsindex 07d8711a27..bdb08bfce6 100644--- a/crates/openhuman-tinyhumans/src/hosted/announcements/schemas.rs+++ b/crates/openhuman-tinyhumans/src/hosted/announcements/schemas.rs@@ -1,9 +1,9 @@use serde_json::{Map, Value};-use crate::config::rpc as config_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::rpc::RpcOutcome;+use openhuman_core::config::rpc as config_rpc;+use openhuman_core::core::all::{ControllerFuture, RegisteredController};+use openhuman_core::core::{ControllerSchema, FieldSchema, TypeSchema};+use openhuman_core::rpc::RpcOutcome;pub fn all_announcements_controller_schemas() -> Vec<ControllerSchema> {vec![announcements_schemas("announcements_get_latest")]diff --git a/crates/openhuman-tinyhumans/src/hosted/billing/ops.rs b/crates/openhuman-tinyhumans/src/hosted/billing/ops.rsindex 6049b9fdba..9e69c0e8d9 100644--- a/crates/openhuman-tinyhumans/src/hosted/billing/ops.rs+++ b/crates/openhuman-tinyhumans/src/hosted/billing/ops.rs@@ -13,18 +13,18 @@ use reqwest::Method;use serde::Serialize;use serde_json::{json, Value};-use crate::api::config::effective_backend_api_url;-use crate::api::BackendOAuthClient;-use crate::config::Config;-use crate::rpc::RpcOutcome;+use openhuman_core::api::config::effective_backend_api_url;+use openhuman_core::api::BackendOAuthClient;+use openhuman_core::config::Config;+use openhuman_core::rpc::RpcOutcome;/// Canonical authed-session guard. Delegates to `require_live_session_token`,/// which rejects an expired token locally (publishing `SessionExpired`) instead/// of firing a doomed backend 401 — see #3297 / `session_support`.fn require_token(config: &Config,-) -> Result<crate::security::credentials::session_support::BackendCredential, String> {- crate::security::credentials::session_support::resolve_backend_credential(config)+) -> Result<openhuman_core::security::credentials::session_support::BackendCredential, String> {+ openhuman_core::security::credentials::session_support::resolve_backend_credential(config)}async fn get_authed_value(@@ -44,7 +44,7 @@ async fn get_authed_value(client.authed_json(&token, method, path, body).await- .map_err(crate::api::flatten_authed_error)+ .map_err(openhuman_core::api::flatten_authed_error)}pub async fn get_current_plan(config: &Config) -> Result<RpcOutcome<Value>, String> {@@ -62,7 +62,7 @@ pub async fn get_summary(config: &Config) -> Result<RpcOutcome<Value>, String> {let data = client.fetch_billing_summary(&token).await- .map_err(crate::api::flatten_authed_error)?;+ .map_err(openhuman_core::api::flatten_authed_error)?;Ok(RpcOutcome::single_log(data, "billing summary fetched"))}diff --git a/crates/openhuman-tinyhumans/src/hosted/billing/schemas.rs b/crates/openhuman-tinyhumans/src/hosted/billing/schemas.rsindex 01097bdfe9..3cf057dd3c 100644--- a/crates/openhuman-tinyhumans/src/hosted/billing/schemas.rs+++ b/crates/openhuman-tinyhumans/src/hosted/billing/schemas.rs@@ -2,10 +2,10 @@ use serde::de::DeserializeOwned;use serde::Deserialize;use serde_json::{Map, Value};-use crate::config::rpc as config_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::rpc::RpcOutcome;+use openhuman_core::config::rpc as config_rpc;+use openhuman_core::core::all::{ControllerFuture, RegisteredController};+use openhuman_core::core::{ControllerSchema, FieldSchema, TypeSchema};+use openhuman_core::rpc::RpcOutcome;#[derive(Debug, Deserialize)]#[serde(rename_all = "camelCase")]diff --git a/crates/openhuman-tinyhumans/src/hosted/referral/ops.rs b/crates/openhuman-tinyhumans/src/hosted/referral/ops.rsindex 9949c40104..0cfc079978 100644--- a/crates/openhuman-tinyhumans/src/hosted/referral/ops.rs+++ b/crates/openhuman-tinyhumans/src/hosted/referral/ops.rs@@ -6,11 +6,11 @@use reqwest::Method;use serde_json::{json, Map, Value};-use crate::api::config::effective_backend_api_url;-use crate::api::jwt::get_session_token;-use crate::api::BackendOAuthClient;-use crate::config::Config;-use crate::rpc::RpcOutcome;+use openhuman_core::api::config::effective_backend_api_url;+use openhuman_core::api::jwt::get_session_token;+use openhuman_core::api::BackendOAuthClient;+use openhuman_core::config::Config;+use openhuman_core::rpc::RpcOutcome;fn require_token(config: &Config) -> Result<String, String> {get_session_token(config)?diff --git a/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs b/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rsindex abc5248e56..68944514a4 100644--- a/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::security::credentials::{AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME};+use openhuman_core::security::credentials::{AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME};use axum::{routing::{get, post},Json, Router,diff --git a/crates/openhuman-tinyhumans/src/hosted/referral/schemas.rs b/crates/openhuman-tinyhumans/src/hosted/referral/schemas.rsindex 166445c006..d8aebc9190 100644--- a/crates/openhuman-tinyhumans/src/hosted/referral/schemas.rs+++ b/crates/openhuman-tinyhumans/src/hosted/referral/schemas.rs@@ -2,10 +2,10 @@ use serde::de::DeserializeOwned;use serde::Deserialize;use serde_json::{Map, Value};-use crate::config::rpc as config_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::rpc::RpcOutcome;+use openhuman_core::config::rpc as config_rpc;+use openhuman_core::core::all::{ControllerFuture, RegisteredController};+use openhuman_core::core::{ControllerSchema, FieldSchema, TypeSchema};+use openhuman_core::rpc::RpcOutcome;#[derive(Debug, Deserialize)]#[serde(rename_all = "camelCase")]diff --git a/crates/openhuman-tinyhumans/src/hosted/team/mod.rs b/crates/openhuman-tinyhumans/src/hosted/team/mod.rsindex ffcf1feb2d..6e52728f69 100644--- a/crates/openhuman-tinyhumans/src/hosted/team/mod.rs+++ b/crates/openhuman-tinyhumans/src/hosted/team/mod.rs@@ -3,6 +3,6 @@mod ops;mod schemas;-pub use crate::integrations::client::budget_gate::get_usage;+pub use openhuman_core::integrations::client::budget_gate::get_usage;pub use ops::*;pub use schemas::{all_team_controller_schemas, all_team_registered_controllers, team_schemas};diff --git a/crates/openhuman-tinyhumans/src/hosted/team/ops.rs b/crates/openhuman-tinyhumans/src/hosted/team/ops.rsindex 62789af562..5102cf1a2a 100644--- a/crates/openhuman-tinyhumans/src/hosted/team/ops.rs+++ b/crates/openhuman-tinyhumans/src/hosted/team/ops.rs@@ -13,18 +13,18 @@ use reqwest::{Method, Url};use serde::Serialize;use serde_json::{json, Value};-use crate::api::config::effective_backend_api_url;-use crate::api::BackendOAuthClient;-use crate::config::Config;-use crate::rpc::RpcOutcome;+use openhuman_core::api::config::effective_backend_api_url;+use openhuman_core::api::BackendOAuthClient;+use openhuman_core::config::Config;+use openhuman_core::rpc::RpcOutcome;/// Canonical authed-session guard. Delegates to `require_live_session_token`,/// which rejects an expired token locally (publishing `SessionExpired`) instead/// of firing a doomed backend 401 — see #3297 / `session_support`.fn require_token(config: &Config,-) -> Result<crate::security::credentials::session_support::BackendCredential, String> {- crate::security::credentials::session_support::resolve_backend_credential(config)+) -> Result<openhuman_core::security::credentials::session_support::BackendCredential, String> {+ openhuman_core::security::credentials::session_support::resolve_backend_credential(config)}fn normalize_id(input: &str, field: &str) -> Result<String, String> {@@ -76,7 +76,7 @@ async fn get_authed_value(client.authed_json(&token, method, path, body).await- .map_err(crate::api::flatten_authed_error)+ .map_err(openhuman_core::api::flatten_authed_error)}pub async fn list_members(config: &Config, team_id: &str) -> Result<RpcOutcome<Value>, String> {diff --git a/crates/openhuman-tinyhumans/src/hosted/team/schemas.rs b/crates/openhuman-tinyhumans/src/hosted/team/schemas.rsindex eb42688bf3..010f52896b 100644--- a/crates/openhuman-tinyhumans/src/hosted/team/schemas.rs+++ b/crates/openhuman-tinyhumans/src/hosted/team/schemas.rs@@ -2,10 +2,10 @@ use serde::de::DeserializeOwned;use serde::Deserialize;use serde_json::{Map, Value};-use crate::config::rpc as config_rpc;-use crate::core::all::{ControllerFuture, RegisteredController};-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};-use crate::rpc::RpcOutcome;+use openhuman_core::config::rpc as config_rpc;+use openhuman_core::core::all::{ControllerFuture, RegisteredController};+use openhuman_core::core::{ControllerSchema, FieldSchema, TypeSchema};+use openhuman_core::rpc::RpcOutcome;#[derive(Debug, Deserialize)]#[serde(rename_all = "camelCase")]