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): improve config schema and provider handling
Steven Enamakel7cf8b18a9aec
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers.rs b/crates/openhuman-core/src/config/schema/cloud_providers.rsindex 9ca1f98529..de593ce25b 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers.rs@@ -149,7 +149,9 @@ fn provider_presets(hosted: &[BuiltinCloudProvider]) -> BuiltinPresets {// converted into runtime bearer authentication.auth_style: match preset.auth_style {AuthStyle::Anthropic => BuiltinAuthStyle::Anthropic,- AuthStyle::Bearer | AuthStyle::OpenhumanJwt | AuthStyle::None => BuiltinAuthStyle::Bearer,+ AuthStyle::Bearer | AuthStyle::OpenhumanJwt | AuthStyle::None => {+ BuiltinAuthStyle::Bearer+ }},}))}diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex af51ef690e..8198c680e0 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -23,7 +23,13 @@ fn generate_provider_id_with_prefix(prefix: &str, slug: &str) -> String {}let safe_slug: String = slug.chars()- .map(|c| if c.is_ascii_alphanumeric() || c == '-' { c } else { '_' })+ .map(|c| {+ if c.is_ascii_alphanumeric() || c == '-' {+ c+ } else {+ '_'+ }+ }).take(20).collect();format!("{prefix}_{safe_slug}_{suffix}")diff --git a/crates/openhuman-core/src/inference/embedding_host/factory.rs b/crates/openhuman-core/src/inference/embedding_host/factory.rsindex f322b79a1c..9ad18ffe1f 100644--- a/crates/openhuman-core/src/inference/embedding_host/factory.rs+++ b/crates/openhuman-core/src/inference/embedding_host/factory.rs@@ -3,12 +3,12 @@use std::sync::Arc;use crate::config::Config;-use tinyinference_providers::route::custom_provider_string;use tinyinference_embeddings::factory::{create_configured_embedding_model, create_default_embedding_model, CredentialResolver,EmbeddingFactorySettings, ManagedModelFactory,};use tinyinference_embeddings::EmbeddingModel;+use tinyinference_providers::route::custom_provider_string;use super::cloud::UnavailableEmbeddingModel;use crate::inference::provider::factory::PROVIDER_OPENHUMAN;diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc.rs b/crates/openhuman-core/src/inference/embedding_host/rpc.rsindex 5d7587867d..546a0ef770 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc.rs@@ -77,11 +77,7 @@ fn build_embedder(pub(crate) fn resolve_api_key(config: &Config, provider_name: &str) -> String {let (slug, endpoint) = split_custom_provider(provider_name);- let slug = if endpoint.is_some() {- "custom"- } else {- &slug- };+ let slug = if endpoint.is_some() { "custom" } else { &slug };let cred_provider = format!("embeddings:{slug}");let auth = AuthService::from_config(config);auth.get_provider_bearer_token(&cred_provider, None)diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rsindex 41da274a8a..143ebc2447 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs@@ -5,8 +5,8 @@ use crate::core::Outcome;use super::{resolve_api_key, LOG_PREFIX};use crate::inference::embedding_host::factory::create_embedding_provider_with_config;-use tinyinference_providers::route::split_custom_provider;use tinyinference_embeddings::probe::probe_custom_embeddings;+use tinyinference_providers::route::split_custom_provider;/// Generates embeddings for the given input texts using the currently/// configured provider.diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rsindex 4152da4a5f..d52c940120 100644--- a/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs@@ -225,7 +225,9 @@ pub async fn update_settings(// Resolve the provider string exactly as it will be persisted so the// signature reported to callers describes the saved configuration.let effective_provider = match &custom_endpoint {- Some(ep) if new_provider == "custom" || new_provider.starts_with("custom:") => {+ Some(ep)+ if new_provider == "custom" || split_custom_provider(&new_provider).1.is_some() =>+ {custom_provider_string("custom", Some(ep))}_ => new_provider.clone(),diff --git a/crates/openhuman-core/src/inference/http/backend.rs b/crates/openhuman-core/src/inference/http/backend.rsindex c9f0ee451a..2364cd36bb 100644--- a/crates/openhuman-core/src/inference/http/backend.rs+++ b/crates/openhuman-core/src/inference/http/backend.rs@@ -12,7 +12,9 @@//! - `"openhuman"` -> OpenHuman backend (session JWT)use async_trait::async_trait;-use tinyinference_llm::providers::openai::server_http::{BackendFailure, ChatBackend, ListedModel, ResolvedChat};+use tinyinference_llm::providers::openai::server_http::{+ BackendFailure, ChatBackend, ListedModel, ResolvedChat,+};use tinyinference_providers::route::{bare_model_route, route_owner};use tracing::{debug, warn};diff --git a/crates/openhuman-core/src/inference/http/backend_tests.rs b/crates/openhuman-core/src/inference/http/backend_tests.rsindex 5509a8b8bd..1e2b150c26 100644--- a/crates/openhuman-core/src/inference/http/backend_tests.rs+++ b/crates/openhuman-core/src/inference/http/backend_tests.rs@@ -31,7 +31,7 @@ fn configured_managed_default_keeps_colon_bearing_model_owner() {..Config::default()};let listed = configured_models(&config);- assert!(listed.iter().any(|model| {- model.id == "qwen3:14b" && model.owned_by == "openhuman"- }));+ assert!(listed+ .iter()+ .any(|model| { model.id == "qwen3:14b" && model.owned_by == "openhuman" }));}diff --git a/crates/openhuman-tinyhumans/src/hosted_config_tests.rs b/crates/openhuman-tinyhumans/src/hosted_config_tests.rsindex 97985f86e1..79e803ca02 100644--- a/crates/openhuman-tinyhumans/src/hosted_config_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted_config_tests.rs@@ -7,9 +7,11 @@ fn hosted_openhuman_preset_and_legacy_auth_policy_are_registered_before_config_llet preset = super::openhuman_preset();assert_eq!(preset.endpoint, "https://api.openhuman.ai/v1");assert_eq!(preset.auth_style, AuthStyle::OpenhumanJwt);- assert!(openhuman_embed::__host::config::schema::cloud_providers::is_hosted_cloud_identity(- "openhuman"- ));+ assert!(+ openhuman_embed::__host::config::schema::cloud_providers::is_hosted_cloud_identity(+ "openhuman"+ )+ );assert!(openhuman_embed::__host::config::schema::cloud_providers::endpoint_host_is_chat_completions_only(preset.endpoint));