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(provider): clean up imports and structure in provider modules
Steven Enamakel5800db541c29
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rsindex d9dfde6d12..e7303276e5 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs@@ -1,5 +1,5 @@use super::*;-use serde_json::{Value, json};+use serde_json::{json, Value};use tinyinference_llm::message::Message;use tinyinference_llm::model::ResponseFormat;use tinyinference_llm::tool::ToolSchema;diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rsindex 5937a1caaf..fb9a62767d 100644--- a/crates/openhuman-core/src/inference/provider/factory.rs+++ b/crates/openhuman-core/src/inference/provider/factory.rs@@ -55,8 +55,8 @@ use cloud_slug::{try_create_cloud_slug_chat_model_with_native_tools_for,};use local_runtime::{- OptionalChatModelResult, try_create_local_runtime_chat_model,- try_create_local_runtime_chat_model_from_string,+ try_create_local_runtime_chat_model, try_create_local_runtime_chat_model_from_string,+ OptionalChatModelResult,};#[cfg(test)]pub(crate) use managed_backend::make_openhuman_backend_model_for_thread;@@ -91,16 +91,16 @@ pub mod test_provider_override;#[path = "factory_tests.rs"]mod factory_tests;-use crate::config::Config;use crate::config::schema::cloud_providers::AuthStyle;+use crate::config::Config;use crate::security::credentials::AuthService;use crate::security::egress::EgressLedger;use std::sync::Arc;use tinyagents_harness::providers::claude_agent_sdk::ClaudeAgentSdkProvider;use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse, ModelStream};use tinyinference_llm::providers::openai::codex::{- OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,- openai_codex_client_version, openai_codex_user_agent,+ openai_codex_client_version, openai_codex_user_agent, OPENAI_CODEX_ACCOUNT_HEADER,+ OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,};/// Sentinel meaning "use the OpenHuman backend session JWT".diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex 3cb652b9ee..47478170b0 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -10,7 +10,7 @@ use crate::inference::provider::factory::access_gates::verify_session_active;use crate::inference::provider::fallback_diagnostics;use tinyinference_llm::providers::anthropic::endpoint_is_anthropic_messages;use tinyinference_llm::providers::registry::{- ProviderBuildOptions, ProviderRegistry, resolve_slug_model,+ resolve_slug_model, ProviderBuildOptions, ProviderRegistry,};/// Look up a `cloud_providers` entry by slug and build the 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 5ce712f220..8df8286c07 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@@ -88,12 +88,10 @@ fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {.unwrap().expect("openrouter has a listing");assert_eq!(request.endpoint, "https://openrouter.ai/api/v1");- assert!(- request- .headers- .iter()- .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or")- );+ assert!(request+ .headers+ .iter()+ .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or"));}#[test]@@ -146,24 +144,18 @@ fn discovery_request_builds_codex_oauth_listing_request() {"https://chatgpt.com/backend-api/codex/models?client_version=0.130.0");assert_eq!(request.model, "gpt");- assert!(- request- .headers- .iter()- .any(|(name, value)| name == "Authorization" && value == "Bearer tok")- );- assert!(- request- .headers- .iter()- .any(|(name, value)| name == "ChatGPT-Account-ID" && value == "account-123")- );- assert!(- request- .headers- .iter()- .any(|(name, value)| name == "originator" && value == "codex_cli_rs")- );+ assert!(request+ .headers+ .iter()+ .any(|(name, value)| name == "Authorization" && value == "Bearer tok"));+ assert!(request+ .headers+ .iter()+ .any(|(name, value)| name == "ChatGPT-Account-ID" && value == "account-123"));+ assert!(request+ .headers+ .iter()+ .any(|(name, value)| name == "originator" && value == "codex_cli_rs"));assert!(request.headers.iter().any(|(name, value)| {name == "User-Agent" && value == "codex_cli_rs/0.0.0 (OpenHuman 0.64.18)"}));diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rsindex 681dec5917..e03ae768c2 100644--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::config::Config;use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};+use crate::config::Config;use crate::security::credentials::AuthService;use tempfile::TempDir;@@ -231,7 +231,7 @@ fn deepseek_entry(id: &str) -> CloudProviderCreds {/// A config carrying a resolved model, as `agent_chat` leaves it after applying/// `model_override` and before building the agent.fn routed_config(endpoint: &str, api_key: &str, model: &str) -> Config {- use crate::config::schema::ephemeral_route::{EphemeralRoute, apply};+ use crate::config::schema::ephemeral_route::{apply, EphemeralRoute};let mut config = Config {default_model: Some(model.to_string()),..Config::default()diff --git a/crates/openhuman-core/src/inference/provider/mod.rs b/crates/openhuman-core/src/inference/provider/mod.rsindex d87ab54b1f..546468f36c 100644--- a/crates/openhuman-core/src/inference/provider/mod.rs+++ b/crates/openhuman-core/src/inference/provider/mod.rs@@ -11,9 +11,9 @@ pub mod http_error;pub mod models;pub use factory::{- BYOK_INCOMPLETE_SENTINEL, create_chat_model_from_string,- create_chat_model_from_string_with_model_id, create_chat_model_in,- create_chat_model_with_model_id_in, probe_inference_readiness, provider_for_role,+ create_chat_model_from_string, create_chat_model_from_string_with_model_id,+ create_chat_model_in, create_chat_model_with_model_id_in, probe_inference_readiness,+ provider_for_role, BYOK_INCOMPLETE_SENTINEL,};#[cfg(test)]diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rsindex 5aa934a780..a2ef9b5852 100644--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs@@ -6,13 +6,13 @@use super::super::factory::resolve_codex_routing;use super::local_runtime::synthesize_local_runtime_entry;use tinyinference_llm::catalog::{- ModelInfo, append_query_param, endpoint_hosts_models_listing, is_openrouter_provider,- list_models, merge_openai_codex_model_hints, validate_openrouter_key,+ append_query_param, endpoint_hosts_models_listing, is_openrouter_provider, list_models,+ merge_openai_codex_model_hints, validate_openrouter_key, ModelInfo,};use tinyinference_llm::model::discover::DiscoveryRequest;use tinyinference_llm::providers::openai::codex::{+ openai_codex_client_version, openai_codex_user_agent, OpenAiCodexRouting,OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,- OpenAiCodexRouting, openai_codex_client_version, openai_codex_user_agent,};/// Resolve the API key used to probe a provider's `/models` endpoint.diff --git a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rsindex cf9aba0188..c6cf38d2ba 100644--- a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs+++ b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs@@ -281,13 +281,11 @@ fn persist_openai_oauth_token_stores_oauth_profile_with_metadata() {.and_then(|set| set.refresh_token.as_deref()),Some("refresh-token"));- assert!(- profile- .token_set- .as_ref()- .and_then(|set| set.expires_at)- .is_some()- );+ assert!(profile+ .token_set+ .as_ref()+ .and_then(|set| set.expires_at)+ .is_some());let data = AuthProfilesStore::new(tmp.path(), false).load().unwrap();let stored = data.profiles.get(&profile.id).unwrap();@@ -454,7 +452,7 @@ fn import_codex_cli_auth_file_reports_missing_file_with_login_hint() {/// `.codex/auth.json` anchor from a message, this test fails in CI.#[test]fn codex_import_user_state_errors_classify_as_expected() {- use crate::core::observability::{ExpectedErrorKind, expected_error_kind};+ use crate::core::observability::{expected_error_kind, ExpectedErrorKind};let tmp = tempdir().unwrap();let config = test_config(&tmp);