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(inference): flatten provider ops module into parent
Steven Enamakeld5aa8b21c583
diff --git a/crates/openhuman-core/src/inference/provider/mod.rs b/crates/openhuman-core/src/inference/provider/mod.rsindex a3d9b6936c..a16edb47e3 100644--- a/crates/openhuman-core/src/inference/provider/mod.rs+++ b/crates/openhuman-core/src/inference/provider/mod.rs@@ -32,9 +32,10 @@ pub(crate) use factory::is_raw_passthrough_model;pub use factory::{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, role_for_model_tier, BYOK_INCOMPLETE_SENTINEL, INFERENCE_BACKEND_ID,-};-pub use models::{- list_configured_models, list_configured_models_from_config, synthesize_local_runtime_entry,+ provider_for_role, role_for_model_tier, BYOK_INCOMPLETE_SENTINEL,};pub use openhuman_backend_model::PROVIDER_LABEL;++#[cfg(test)]+#[path = "ops_tests.rs"]+mod model_listing_tests;diff --git a/crates/openhuman-core/src/inference/provider/models/mod.rs b/crates/openhuman-core/src/inference/provider/models/mod.rsindex 0cf68d521c..56260f49ff 100644--- a/crates/openhuman-core/src/inference/provider/models/mod.rs+++ b/crates/openhuman-core/src/inference/provider/models/mod.rs@@ -39,5 +39,5 @@ pub use local_runtime::synthesize_local_runtime_entry;use openrouter::validate_openrouter_api_key;#[cfg(test)]-#[path = "models_tests.rs"]+# [path = "../models_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/inference/provider/models_tests.rs b/crates/openhuman-core/src/inference/provider/models_tests.rsindex eea79a9567..54fbb597ec 100644--- a/crates/openhuman-core/src/inference/provider/models_tests.rs+++ b/crates/openhuman-core/src/inference/provider/models_tests.rs@@ -1,4 +1,4 @@-use super::resolve_local_runtime_key;+use super::models::catalog_listing::resolve_local_runtime_key;use crate::config::Config;#[test]@@ -67,7 +67,7 @@ async fn claude_code_cli_provider_lists_no_models_without_a_request() {let tmp = tempfile::tempdir().expect("tempdir");let config = workspace_with_provider(&tmp, "claude-code", "cli://claude-code", AuthStyle::None);- let outcome = super::list_configured_models_from_config("claude-code", &config)+ let outcome = super::models::list_configured_models_from_config("claude-code", &config).await.expect("claude-code must list an empty catalog, not fail");assert_eq!(outcome.value["models"], serde_json::json!([]));@@ -81,7 +81,7 @@ async fn non_http_endpoint_lists_no_models_without_a_request() {let tmp = tempfile::tempdir().expect("tempdir");let config = workspace_with_provider(&tmp, "custom-cli", "cli://custom", AuthStyle::None);- let outcome = super::list_configured_models_from_config("custom-cli", &config)+ let outcome = super::models::list_configured_models_from_config("custom-cli", &config).await.expect("non-http endpoint must list an empty catalog, not fail");assert_eq!(outcome.value["models"], serde_json::json!([]));@@ -100,7 +100,7 @@ async fn unsupported_scheme_endpoint_still_surfaces_an_error() {AuthStyle::None,);- let result = super::list_configured_models_from_config("custom-ftp", &config).await;+ let result = super::models::list_configured_models_from_config("custom-ftp", &config).await;assert!(result.is_err(), "ftp:// must not read as an empty catalog");}@@ -117,7 +117,7 @@ async fn unregistered_managed_catalog_lists_no_models() {AuthStyle::OpenhumanJwt,);for provider in ["openhuman", "custom-managed"] {- let outcome = super::list_configured_models_from_config(provider, &config)+ let outcome = super::models::list_configured_models_from_config(provider, &config).await.expect("an unregistered managed catalog is empty, not an error");assert_eq!(outcome.value["models"], serde_json::json!([]), "{provider}");diff --git a/crates/openhuman-core/src/inference/provider/ops/mod.rs b/crates/openhuman-core/src/inference/provider/ops/mod.rsdeleted file mode 100644index 0bfdcce991..0000000000--- a/crates/openhuman-core/src/inference/provider/ops/mod.rs+++ /dev/null@@ -1,39 +0,0 @@-//! Provider operations — split from a single `ops.rs` into sub-modules.-//!-//! Sub-modules:-//! - `sanitize` — secret scrubbing, error formatting-//! - `http_error` — HTTP error classification, Sentry routing, `api_error`-//! - `models` — model listing (`list_configured_models`, parsing)-//! - `provider_factory` — provider construction (`create_*`, `ProviderRuntimeOptions`)--mod http_error;-mod models;-mod provider_factory;--// ── public surface (preserves the original `pub use ops::*` contract) ──--#[cfg(test)]-pub(crate) use http_error::config_rejection_demoted;-pub use http_error::{- api_error, is_backend_auth_failure, is_backend_error_code_owned, log_byo_provider_auth_failure,- publish_backend_session_expired, should_report_provider_http_failure,-};--pub use models::{- list_configured_models, list_configured_models_from_config, synthesize_local_runtime_entry,-};--pub use provider_factory::{- list_providers, ProviderInfo, ProviderRuntimeOptions, INFERENCE_BACKEND_ID,-};--// ── test re-exports for ops_tests.rs ──--#[cfg(test)]-pub(crate) use super::openhuman_backend_model;--// ── test companion ──--#[cfg(test)]-#[path = "../ops_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/inference/provider/ops/provider_factory.rs b/crates/openhuman-core/src/inference/provider/ops/provider_factory.rsdeleted file mode 100644index b4f51e92bb..0000000000--- a/crates/openhuman-core/src/inference/provider/ops/provider_factory.rs+++ /dev/null@@ -1,43 +0,0 @@-use std::path::PathBuf;--/// Fixed id for the single inference backend (OpenHuman API).-pub const INFERENCE_BACKEND_ID: &str = "openhuman";--#[derive(Debug, Clone)]-pub struct ProviderRuntimeOptions {- pub auth_profile_override: Option<String>,- pub openhuman_dir: Option<PathBuf>,- pub secrets_encrypt: bool,- pub reasoning_enabled: Option<bool>,-}--impl Default for ProviderRuntimeOptions {- fn default() -> Self {- Self {- auth_profile_override: None,- openhuman_dir: None,- secrets_encrypt: true,- reasoning_enabled: None,- }- }-}--/// Information about a supported provider for display purposes.-pub struct ProviderInfo {- pub name: &'static str,- pub display_name: &'static str,- pub aliases: &'static [&'static str],- pub local: bool,-}--/// Return known providers for display (single backend path).-pub fn list_providers() -> Vec<ProviderInfo> {- vec![ProviderInfo {- name: INFERENCE_BACKEND_ID,- display_name: "OpenHuman (backend)",- aliases: &["backend", "openhuman-backend"],- local: false,- }]-}--// Legacy provider alias stubs (integrations / config); remote providers were removed.diff --git a/crates/openhuman-core/src/inference/provider/ops_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests.rsindex 1d06c87593..43e5e0eadf 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests.rs@@ -1,4 +1,12 @@-use super::*;+use super::http_error::{api_error, is_backend_auth_failure, is_backend_error_code_owned, should_report_provider_http_failure};+use super::models::{list_configured_models_from_config, synthesize_local_runtime_entry};+use super::openhuman_backend_model::PROVIDER_LABEL;+use super::models::{list_configured_models,};+use super::factory::INFERENCE_BACKEND_ID;+use super::models::list_configured_models_from_config as _;+use super::models::list_configured_models as _;+use super::models::synthesize_local_runtime_entry as _;+use tinyinference_core::sanitize::{sanitize_api_error, MAX_API_ERROR_CHARS};use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::config::Config;use crate::security::credentials::AuthService;@@ -15,7 +23,6 @@ use std::sync::{Arc, Mutex,};use tempfile::TempDir;-use tinyinference_core::sanitize::{sanitize_api_error, MAX_API_ERROR_CHARS};#[derive(Clone)]struct ModelProbeState {