Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(inference): replace glob imports with explicit imports

Steven Enamakel7a19a765690a
diff --git a/crates/openhuman-core/src/config/schema/types.rs b/crates/openhuman-core/src/config/schema/types.rs
index ff18f98aa6..0174810ff2 100644
--- a/crates/openhuman-core/src/config/schema/types.rs
+++ b/crates/openhuman-core/src/config/schema/types.rs
@@ -23,3 +23,7 @@ use crate::config::schema::{CapabilityProviderTrustState, TeamModelConfig};
#[cfg(test)]
#[path = "types_model_pin_tests.rs"]
mod model_pin_tests;
+
+#[cfg(test)]
+#[path = "types_model_ids_tests.rs"]
+mod model_ids_tests;
diff --git a/crates/openhuman-core/src/config/schema/types_model_ids_tests.rs b/crates/openhuman-core/src/config/schema/types_model_ids_tests.rs
new file mode 100644
index 0000000000..55a99b811b
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/types_model_ids_tests.rs
@@ -0,0 +1,10 @@
+use super::WORKLOAD_ROLES;
+
+#[test]
+fn workload_roles_follow_the_native_workload_route_order() {
+ let native = tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS
+ .iter()
+ .map(|route| route.strip_prefix("hint:").expect("native hint route"))
+ .collect::<Vec<_>>();
+ assert_eq!(native, WORKLOAD_ROLES);
+}
diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
index bb658cdb3e..8fe6ea263b 100644
--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
@@ -1,13 +1,33 @@
//! One-shot `create_chat_model*` entry points, the readiness probe, the
//! default-temperature wrapper, and the unresolved-route error builder.
-use super::*;
+use super::{
+ access_gates::{emit_inference_egress, enforce_local_only_inference, verify_session_active},
+ chat_model::{unresolved_chat_model_error_for_access, with_default_temperature},
+ cloud_slug::{
+ try_create_cloud_slug_chat_model_for_inspection_with_identity,
+ try_create_cloud_slug_chat_model_from_string_with_native_tools_for,
+ },
+ local_runtime::{
+ try_create_local_runtime_chat_model_for_inspection,
+ try_create_local_runtime_chat_model_from_string, OptionalChatModelResult,
+ },
+ managed_backend::{make_openhuman_backend_model_for_thread_in, managed_chat_model_for},
+ provider_for_role, resolves_to_managed_backend, OpenHumanMcpEndpoint,
+ CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
+};
use crate::config::ops::resolve_primary_cloud_provider_string;
+use crate::config::schema::cloud_providers::AuthStyle;
+use crate::config::Config;
use crate::core::runtime::DispatchCtx;
+use crate::security::egress::EgressLedger;
+use std::sync::Arc;
use tinyagents_harness::host::{
BuildOpts, ModelBuildGate, ModelBuildRequest, ModelFactory, ModelPurpose,
};
-use tinyinference_llm::model::{ModelRequestDefaults, ProfileOverrideModel, ResolvedModelRoute};
+use tinyinference_llm::model::{
+ ChatModel, ModelRequestDefaults, ProfileOverrideModel, ResolvedModelRoute,
+};
use tinyinference_providers::route::{ProviderRoute, RouteKind};
/// OpenHuman's host policy and construction adapter for a harness turn.
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index a4172ea5ec..37d54aed4b 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -1,13 +1,24 @@
//! `<slug>:<model>` BYOK cloud providers: shared slug resolution (model fallback,
//! abstract-tier remapping, credentials, codex routing) and the crate-native builders.
-use super::*;
+use super::{
+ access_gates::{enforce_local_only_inference, emit_inference_egress},
+ credentials::CredentialAccess,
+ openai_bearer_is_oauth, provider_for_role, resolve_codex_routing,
+ InspectionOutputBudgetCapability, OptionalChatModelResult, PROVIDER_OPENHUMAN,
+ CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER,
+};
use crate::config::ops::resolve_primary_cloud_provider_string;
+use crate::config::schema::cloud_providers::AuthStyle;
+use crate::config::Config;
#[cfg(not(test))]
use crate::inference::provider::factory::access_gates::verify_backend_session_active;
#[cfg(not(test))]
use crate::inference::provider::factory::access_gates::verify_session_active;
use crate::inference::provider::fallback_diagnostics;
+use crate::security::egress::EgressLedger;
+use std::sync::Arc;
+use tinyinference_llm::model::ChatModel;
use tinyinference_llm::providers::anthropic::endpoint_is_anthropic_messages;
use tinyinference_llm::providers::registry::{
resolve_slug_model, ProviderBuildOptions, ProviderRegistry,
diff --git a/crates/openhuman-core/src/inference/provider/factory/inspection.rs b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
index ddf50157ff..b734e0c0af 100644
--- a/crates/openhuman-core/src/inference/provider/factory/inspection.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
@@ -1,8 +1,25 @@
//! Read-only provider preparation for doctor inspections.
-use super::*;
+use super::{
+ chat_model::{resolves_to_managed_backend, unresolved_chat_model_error_for_access, with_default_temperature},
+ cloud_slug::try_create_cloud_slug_chat_model_for_inspection_with_identity,
+ credentials::CredentialAccess,
+ local_runtime::try_create_local_runtime_chat_model_for_inspection,
+ managed_backend::managed_chat_model_build_for_inspection,
+ provider_for_role,
+ subprocess_providers::{
+ try_create_claude_agent_sdk_chat_model_for_inspection,
+ try_create_claude_code_chat_model_for_inspection,
+ },
+ InspectionOutputBudgetCapability, PreparedInspectionChatModel, InspectionRequestIdentity,
+ PROVIDER_OPENHUMAN,
+};
use crate::config::resolve_primary_cloud_provider_string;
+use crate::config::Config;
use crate::core::runtime::DispatchCtx;
+use crate::security::egress::EgressLedger;
+use std::sync::Arc;
+use tinyinference_llm::model::ChatModel;
/// Build a chat model for static inspection, sharing the runtime constructor
/// while resolving stored credentials through the read-only profile snapshot.
@@ -35,9 +52,7 @@ pub(crate) fn create_chat_model_with_identity_in_for_inspection(
resolved = resolve_primary_cloud_provider_string(config);
}
if resolves_to_managed_backend(role, config) {
- let build = managed_backend::managed_chat_model_build_for_inspection(
- extensions, role, config, None,
- )?;
+ let build = managed_chat_model_build_for_inspection(extensions, role, config, None)?;
return Ok(prepared_inspection_model(
build.model,
build.model_id.clone(),
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
index 383ac6773c..a24fffe489 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -231,8 +231,6 @@ fn managed_hint_roles_follow_the_native_workload_route_order() {
.iter()
.map(|route| route.strip_prefix("hint:").expect("native hint route"))
.collect::<Vec<_>>();
- let public = openhuman_embed::__host::config::WORKLOAD_ROLES;
- assert_eq!(native, public);
for (route, role) in tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS
.iter()
.zip(native)