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(inference): add cloud provider auth error registry
Steven Enamakel0e722dd99a91
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers.rs b/crates/openhuman-core/src/config/schema/cloud_providers.rsindex 4d46858890..9b502c73c2 100644--- a/crates/openhuman-core/src/config/schema/cloud_providers.rs+++ b/crates/openhuman-core/src/config/schema/cloud_providers.rs@@ -13,7 +13,9 @@ use serde::{Deserialize, Serialize};use std::sync::LazyLock;-use tinyinference_providers::builtin::{BuiltinAuthStyle, BUILTIN_CLOUD_PROVIDERS as UPSTREAM_BUILTINS};+use tinyinference_providers::builtin::{+ BuiltinAuthStyle, BUILTIN_CLOUD_PROVIDERS as UPSTREAM_BUILTINS,+};/// A built-in cloud provider preset in the host's [`AuthStyle`] vocabulary.#[derive(Debug, Clone, Copy, PartialEq, Eq)]@@ -33,7 +35,9 @@ const OPENHUMAN_PRESET: BuiltinCloudProvider = BuiltinCloudProvider {auth_style: AuthStyle::OpenhumanJwt,};-impl From<&'static tinyinference_providers::builtin::BuiltinCloudProvider> for BuiltinCloudProvider {+impl From<&'static tinyinference_providers::builtin::BuiltinCloudProvider>+ for BuiltinCloudProvider+{fn from(preset: &'static tinyinference_providers::builtin::BuiltinCloudProvider) -> Self {Self {slug: preset.slug,diff --git a/crates/openhuman-core/src/inference/auth_error_registry.rs b/crates/openhuman-core/src/inference/auth_error_registry.rsindex 481a7436ae..5c57cde00d 100644--- a/crates/openhuman-core/src/inference/auth_error_registry.rs+++ b/crates/openhuman-core/src/inference/auth_error_registry.rs@@ -22,8 +22,8 @@use std::sync::OnceLock;use std::time::{SystemTime, UNIX_EPOCH};-use tinyinference_providers::auth_registry::ProviderAuthErrorRegistry;pub use tinyinference_providers::auth_registry::ProviderAuthError;+use tinyinference_providers::auth_registry::ProviderAuthErrorRegistry;/// The process-lived registry. Episode tracking lives in/// `tinyinference-providers`; this module supplies the process singleton, thediff --git a/crates/openhuman-core/src/inference/context_window.rs b/crates/openhuman-core/src/inference/context_window.rsindex c3e6932533..0963df4810 100644--- a/crates/openhuman-core/src/inference/context_window.rs+++ b/crates/openhuman-core/src/inference/context_window.rs@@ -28,10 +28,10 @@ use std::collections::HashSet;use std::sync::{Mutex, OnceLock};use tinyinference_llm::model::context_window::{ContextWindowInput, ContextWindowResolver};+pub(crate) use tinyinference_llm::model::context_window::{ResolvedWindow, WindowSource};use tinyinference_llm::model::discover::{model_limits_cache, DiscoveryRequest, ModelLimitsCache, ModelListingFetcher,};-pub(crate) use tinyinference_llm::model::context_window::{ResolvedWindow, WindowSource};use crate::config::Config;diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rsindex fee3980b52..bf50243ec0 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec.rs@@ -75,16 +75,17 @@ impl<'a> CloudBuild<'a> {}}- fn registry(&self) -> ProviderRegistry<impl tinyinference_llm::providers::registry::CredentialResolver + '_> {+ fn registry(+ &self,+ ) -> ProviderRegistry<impl tinyinference_llm::providers::registry::CredentialResolver + '_>+ {let key = self.key.to_string();ProviderRegistry::new(move |_: &ProviderSpec| Ok(key.clone()))}}/// Builds the chat model for a resolved cloud route through the registry.-pub(super) fn build_cloud_model(- build: CloudBuild<'_>,-) -> anyhow::Result<Arc<dyn ChatModel<()>>> {+pub(super) fn build_cloud_model(build: CloudBuild<'_>) -> anyhow::Result<Arc<dyn ChatModel<()>>> {log::debug!("[providers][cloud-spec] build slug={} kind={} auth={:?}",build.spec.provider,diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rsindex a224bfafd6..9cf06d2e33 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs@@ -39,7 +39,11 @@ fn spec_keeps_the_slug_as_provider_name_and_picks_the_kind_from_auth() {assert_eq!(openai.model, "m");assert!(!openai.requires_api_key);let claude = cloud_provider_spec(- &entry("anthropic", "https://api.anthropic.com/v1", AuthStyle::Anthropic),+ &entry(+ "anthropic",+ "https://api.anthropic.com/v1",+ AuthStyle::Anthropic,+ ),"claude",);assert_eq!(claude.kind, ProviderKind::Anthropic);@@ -65,9 +69,13 @@ fn registry_builds_a_model_for_every_unmanaged_builtin_preset() {#[test]fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {- let creds = entry("openrouter", "https://openrouter.ai/api/v1", AuthStyle::Bearer);- let request = cloud_discovery_request(&build(&creds, "m", "sk-or"))- .expect("openrouter has a listing");+ let creds = entry(+ "openrouter",+ "https://openrouter.ai/api/v1",+ AuthStyle::Bearer,+ );+ let request =+ cloud_discovery_request(&build(&creds, "m", "sk-or")).expect("openrouter has a listing");assert_eq!(request.endpoint, "https://openrouter.ai/api/v1");assert!(request.headers@@ -77,7 +85,11 @@ fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {#[test]fn discovery_request_uses_x_api_key_for_anthropic_and_skips_codex_oauth() {- let claude = entry("anthropic", "https://api.anthropic.com/v1", AuthStyle::Anthropic);+ let claude = entry(+ "anthropic",+ "https://api.anthropic.com/v1",+ AuthStyle::Anthropic,+ );let request = cloud_discovery_request(&build(&claude, "claude", "sk-ant")).expect("listing");assert!(request.headers.iter().any(|(name, _)| name == "x-api-key"));