Skip to content

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

refactor(config): move primary cloud helpers into config ops

Steven Enamakel78ff58ecba94
diff --git a/crates/openhuman-core/src/config/ops/README.md b/crates/openhuman-core/src/config/ops/README.md
index 15addf5efe..5009bc1d19 100644
--- a/crates/openhuman-core/src/config/ops/README.md
+++ b/crates/openhuman-core/src/config/ops/README.md
@@ -14,8 +14,10 @@ fn, which returns `Outcome<T>`.
| File | Responsibility |
| --- | --- |
| [`agent.rs`](./agent.rs) | Autonomy, agent, agent-paths, and memory-sync settings. |
+| [`cloud_providers.rs`](./cloud_providers.rs) | Cloud-provider RPC input conversion and validation. |
| [`loader.rs`](./loader.rs) | Config loading/snapshotting and runtime flags; split into submodules [`loader/load.rs`](./loader/load.rs), [`loader/paths.rs`](./loader/paths.rs), [`loader/reset_local_data.rs`](./loader/reset_local_data.rs), [`loader/runtime_flags.rs`](./loader/runtime_flags.rs), [`loader/snapshot.rs`](./loader/snapshot.rs). |
| [`model.rs`](./model.rs) | AI-provider, memory, runtime, local-AI, and Composio-trigger settings. |
+| [`primary_cloud.rs`](./primary_cloud.rs) | Primary cloud selection and legacy direct-inference compatibility. |
| [`privacy.rs`](./privacy.rs) | Privacy Mode (`[privacy]`) get/set. |
| [`sandbox.rs`](./sandbox.rs) | Sandbox / Docker runtime (`[sandbox]`, `[runtime.docker]`) settings. |
| [`ui.rs`](./ui.rs) | Browser, analytics, and onboarding-flag settings. |
@@ -45,6 +47,10 @@ section back out, usually as `Outcome<serde_json::Value>`. `ui.rs`'s
- `model.rs`: `apply_model_settings`, `apply_memory_settings`,
`apply_runtime_settings`, `apply_local_ai_settings`,
`apply_composio_trigger_settings`, `load_and_resolve_api_url`.
+- `cloud_providers.rs`: `build_cloud_provider_creds` converts settings RPC
+ inputs into validated cloud-provider config entries.
+- `primary_cloud.rs`: primary cloud selection and matching legacy
+ `inference_url` compatibility used by inference routing and credentials.
- `privacy.rs`: `apply_privacy_settings`, `get_privacy_mode`.
- `sandbox.rs`: `apply_sandbox_settings`, `get_sandbox_settings`.
- `search.rs`: `apply_search_settings` / `get_search_settings`,
diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route.rs b/crates/openhuman-core/src/config/schema/ephemeral_route.rs
index 09b48b5193..3fffec0ab4 100644
--- a/crates/openhuman-core/src/config/schema/ephemeral_route.rs
+++ b/crates/openhuman-core/src/config/schema/ephemeral_route.rs
@@ -70,7 +70,7 @@ impl std::fmt::Debug for EphemeralRoute {
f.debug_struct("EphemeralRoute")
.field(
"endpoint",
- &crate::inference::provider::factory::redact_endpoint(&self.endpoint),
+ &tinyinference_core::sanitize::redact_url(&self.endpoint),
)
.field("api_key", &"[redacted]")
.field("header_count", &self.headers.len())
@@ -124,7 +124,7 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {
let Some(model) = model else {
log::warn!(
"[config][ephemeral-route] ignoring route to {} — no model resolved for this call",
- crate::inference::provider::factory::redact_endpoint(&route.endpoint)
+ tinyinference_core::sanitize::redact_url(&route.endpoint)
);
return;
};
@@ -155,7 +155,7 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {
log::info!(
"[config][ephemeral-route] this call routed to {} model={}",
- crate::inference::provider::factory::redact_endpoint(&route.endpoint),
+ tinyinference_core::sanitize::redact_url(&route.endpoint),
model
);
diff --git a/crates/openhuman-core/src/inference/provider/README.md b/crates/openhuman-core/src/inference/provider/README.md
index d036a9b3d1..31abc29352 100644
--- a/crates/openhuman-core/src/inference/provider/README.md
+++ b/crates/openhuman-core/src/inference/provider/README.md
@@ -10,7 +10,7 @@ previously `providers/` (pre-consolidation single-crate layout); see
## Public surface
-- **Factory** ([`factory.rs`](./factory.rs) + `factory/`: `routing.rs`, `tiers.rs`, `turn_model.rs`, `subprocess_providers.rs`, `access_gates.rs`, `chat_model.rs`, `cloud_slug.rs`, `credentials.rs`, `local_runtime.rs`, `managed_backend.rs`, `primary_cloud.rs`), `create_chat_model`,
+- **Factory** ([`factory.rs`](./factory.rs) + `factory/`: `routing.rs`, `tiers.rs`, `turn_model.rs`, `subprocess_providers.rs`, `access_gates.rs`, `chat_model.rs`, `cloud_slug.rs`, `credentials.rs`, `local_runtime.rs`, `managed_backend.rs`), `create_chat_model`,
`create_chat_model_from_string[_with_model_id]`,
`create_chat_model_with_model_id`, `provider_for_role`, `role_for_model_tier`,
`probe_inference_readiness`, `BYOK_INCOMPLETE_SENTINEL`. Parses the
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index 92ad47ae4b..eca287b709 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -46,7 +46,6 @@ mod credentials;
mod discovery;
mod local_runtime;
mod managed_backend;
-mod primary_cloud;
mod routing;
mod subprocess_providers;
mod tiers;
@@ -93,7 +92,6 @@ pub(crate) use managed_backend::{
make_openhuman_backend_model_for_options, make_openhuman_backend_model_for_thread,
};
use managed_backend::{managed_chat_model, resolve_managed_model};
-use primary_cloud::{legacy_inference_slug, resolve_primary_cloud_provider_string};
use subprocess_providers::{
prepare_claude_agent_sdk_chat_model, try_create_claude_agent_sdk_chat_model,
try_create_claude_agent_sdk_chat_model_from_string, try_create_claude_code_chat_model,
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 4b067205b4..f5c6caf277 100644
--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
@@ -437,3 +437,4 @@ pub(super) fn unresolved_chat_model_error(
}
// ── Internal helpers ──────────────────────────────────────────────────────────
+use crate::config::ops::resolve_primary_cloud_provider_string;
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 2b8c3eccfe..fd87a16d47 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -417,3 +417,4 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(
});
Some(chat.map(|chat| (chat, effective_model)))
}
+use crate::config::ops::resolve_primary_cloud_provider_string;
diff --git a/crates/openhuman-core/src/inference/provider/factory/credentials.rs b/crates/openhuman-core/src/inference/provider/factory/credentials.rs
index 1b252cc682..2fe249f50b 100644
--- a/crates/openhuman-core/src/inference/provider/factory/credentials.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/credentials.rs
@@ -175,3 +175,4 @@ pub fn redact_endpoint(url: &str) -> String {
}
"<endpoint>".to_string()
}
+use crate::config::ops::legacy_inference_slug;
diff --git a/crates/openhuman-core/src/inference/provider/factory/routing.rs b/crates/openhuman-core/src/inference/provider/factory/routing.rs
index dbb3dd1962..5f3d4fca9e 100644
--- a/crates/openhuman-core/src/inference/provider/factory/routing.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/routing.rs
@@ -256,3 +256,4 @@ pub(super) fn route_has_usable_credentials(resolved: &str, config: &Config) -> b
#[cfg(test)]
#[path = "routing_tests.rs"]
mod routing_tests;
+use crate::config::ops::resolve_primary_cloud_provider_string;