Skip to content

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

style: apply rustfmt formatting and tidy import ordering

Steven Enamakele7977794262e
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index f54eb01ea9..167f7f391a 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -194,14 +194,14 @@ fn provider_descriptors_use_configured_slugs_and_keep_managed_aliases() {
let providers = provider_descriptors(&config);
assert_eq!(
- providers.iter().map(|provider| provider.name.as_str()).collect::<Vec<_>>(),
+ providers
+ .iter()
+ .map(|provider| provider.name.as_str())
+ .collect::<Vec<_>>(),
["custom-provider", "openhuman"]
);
assert_eq!(providers[0].aliases, Vec::<String>::new());
- assert_eq!(
- providers[1].aliases,
- ["backend", "openhuman-backend"]
- );
+ assert_eq!(providers[1].aliases, ["backend", "openhuman-backend"]);
assert_eq!(
resolve_provider_alias("backend", &providers).as_deref(),
Some("openhuman")
@@ -379,19 +379,23 @@ async fn handle_runtime_command_routes_configured_provider_slug_and_alias() {
thread_ts: None,
sender_name: None,
};
- assert!(handle_runtime_command_if_needed(
- &ctx,
- &msg,
- Some(&channel),
- &conversation_history_key(&msg),
- )
- .await);
+ assert!(
+ handle_runtime_command_if_needed(
+ &ctx,
+ &msg,
+ Some(&channel),
+ &conversation_history_key(&msg),
+ )
+ .await
+ );
}
assert_eq!(get_route_selection(&ctx, key).provider, "openhuman");
let sent = channel_impl.sent.lock().unwrap();
assert_eq!(sent.len(), 1, "the configured slug should be accepted");
- assert!(sent[0].content.contains("Provider switched to `custom-route`"));
+ assert!(sent[0]
+ .content
+ .contains("Provider switched to `custom-route`"));
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/channels/runtime/startup/chat_workload.rs b/crates/openhuman-core/src/channels/runtime/startup/chat_workload.rs
index d3f801657a..2acee0c5c2 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/chat_workload.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/chat_workload.rs
@@ -24,7 +24,10 @@ pub(super) enum ChatWorkloadResolution {
pub(super) fn resolve_chat_workload(config: &Config) -> ChatWorkloadResolution {
let resolved = provider::provider_for_role("chat", config);
let trimmed = resolved.trim();
- if trimmed.is_empty() || trimmed == "cloud" || trimmed == provider::factory::INFERENCE_BACKEND_ID {
+ if trimmed.is_empty()
+ || trimmed == "cloud"
+ || trimmed == provider::factory::INFERENCE_BACKEND_ID
+ {
return ChatWorkloadResolution::Cloud;
}
let slug = trimmed
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index ef31dfd6b8..95a1921621 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -12,8 +12,8 @@ use crate::channels::ChannelSystemPrompt;
use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
-use crate::tools::delegate::ProviderRuntimeOptions;
use crate::progress::AgentProgress;
+use crate::tools::delegate::ProviderRuntimeOptions;
use anyhow::Result;
use async_trait::async_trait;
use std::collections::HashMap;
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index 27d7f17e37..815a704c6a 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -25,7 +25,6 @@ pub use enrichers::{
};
/// RPC operations for configuration.
-
pub use ops::*;
pub use schema::{
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index a53eaf3aa6..760c7ec614 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -37,7 +37,6 @@ pub mod scheduler;
#[path = "cutover_tests.rs"]
mod cutover_tests;
-
#[cfg(test)]
pub use ops::update_cron_job;
pub use ops::{add_once, add_once_at, pause_job, resume_job};
diff --git a/crates/openhuman-core/src/inference/embedding_host/mod.rs b/crates/openhuman-core/src/inference/embedding_host/mod.rs
index 6baee7378d..10eb9a288a 100644
--- a/crates/openhuman-core/src/inference/embedding_host/mod.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/mod.rs
@@ -19,9 +19,7 @@ mod factory;
mod rpc;
mod schemas;
-pub use cloud::{
- UnavailableEmbeddingModel,
-};
+pub use cloud::UnavailableEmbeddingModel;
pub use factory::{
create_embedding_provider_for_chat, create_embedding_provider_with_config,
create_embedding_provider_with_credentials, default_embedding_provider_for_chat,
diff --git a/crates/openhuman-core/src/inference/mod.rs b/crates/openhuman-core/src/inference/mod.rs
index b9c592d48e..733a7549b5 100644
--- a/crates/openhuman-core/src/inference/mod.rs
+++ b/crates/openhuman-core/src/inference/mod.rs
@@ -38,7 +38,6 @@ mod schemas;
pub mod tokenjuice;
pub mod turn_models;
-
pub use schemas::{
all_controller_schemas as all_inference_controller_schemas,
all_registered_controllers as all_inference_registered_controllers, INFERENCE_AGENT_CHAT,
diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
index e50432a557..d788e2f154 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -3,8 +3,10 @@
//! managed entries), builds an authenticated `/models` request for it, and
//! parses the response.
-use super::{local_runtime::synthesize_local_runtime_entry, openrouter::validate_openrouter_api_key};
use super::super::openai_codex::resolve_openai_codex_routing;
+use super::{
+ local_runtime::synthesize_local_runtime_entry, openrouter::validate_openrouter_api_key,
+};
use crate::config::schema::cloud_providers::AuthStyle;
use crate::config::Config;
use tinyinference_core::sanitize::sanitize_api_error;
diff --git a/crates/openhuman-core/src/inference/provider/ops_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests.rs
index 6031d7b234..6201828d77 100644
--- a/crates/openhuman-core/src/inference/provider/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops_tests.rs
@@ -1,8 +1,12 @@
-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, list_configured_models_from_config, synthesize_local_runtime_entry};
-use super::openhuman_backend_model::PROVIDER_LABEL;
use super::factory::INFERENCE_BACKEND_ID;
-use tinyinference_core::sanitize::{sanitize_api_error, MAX_API_ERROR_CHARS};
+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, list_configured_models_from_config, synthesize_local_runtime_entry,
+};
+use super::openhuman_backend_model::PROVIDER_LABEL;
use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::Config;
use crate::security::credentials::AuthService;
@@ -19,6 +23,7 @@ use std::sync::{
Arc, Mutex,
};
use tempfile::TempDir;
+use tinyinference_core::sanitize::{sanitize_api_error, MAX_API_ERROR_CHARS};
#[derive(Clone)]
struct ModelProbeState {
diff --git a/crates/openhuman-core/src/inference/registry_tests.rs b/crates/openhuman-core/src/inference/registry_tests.rs
index f666caef80..d7b8a5e703 100644
--- a/crates/openhuman-core/src/inference/registry_tests.rs
+++ b/crates/openhuman-core/src/inference/registry_tests.rs
@@ -229,9 +229,11 @@ async fn a_registered_catalog_receives_the_entrys_provider_key() {
}),
..Config::default()
};
- let listing =
- crate::inference::provider::models::list_configured_models_from_config("p_ephemeral", &config)
- .await;
+ let listing = crate::inference::provider::models::list_configured_models_from_config(
+ "p_ephemeral",
+ &config,
+ )
+ .await;
unregister_catalog(PROVIDER_OPENHUMAN);
listing.unwrap();
assert_eq!(seen.lock().unwrap().as_str(), "entry-key");
diff --git a/crates/openhuman-core/src/security/mod.rs b/crates/openhuman-core/src/security/mod.rs
index 2a74a92e47..7b5ebd5744 100644
--- a/crates/openhuman-core/src/security/mod.rs
+++ b/crates/openhuman-core/src/security/mod.rs
@@ -21,8 +21,8 @@ pub mod policy;
pub mod prompt_injection;
pub mod scrub;
pub mod secret_storage;
-pub(crate) mod transport;
pub(crate) mod secure_open;
+pub(crate) mod transport;
pub mod turn_origin;
#[allow(unused_imports)]
diff --git a/crates/openhuman-core/src/security/transport_tests.rs b/crates/openhuman-core/src/security/transport_tests.rs
index f3c6734671..2bba84f8f1 100644
--- a/crates/openhuman-core/src/security/transport_tests.rs
+++ b/crates/openhuman-core/src/security/transport_tests.rs
@@ -9,7 +9,9 @@ fn bearer_transport_allows_tls_and_only_http_loopback() {
assert!(is_safe_endpoint_for_bearer("http://127.200.10.20:8080/v1"));
assert!(!is_safe_endpoint_for_bearer("http://192.168.1.10:8080/v1"));
- assert!(!is_safe_endpoint_for_bearer("http://127.attacker.example/v1"));
+ assert!(!is_safe_endpoint_for_bearer(
+ "http://127.attacker.example/v1"
+ ));
assert!(!is_safe_endpoint_for_bearer("ftp://localhost/v1"));
assert!(!is_safe_endpoint_for_bearer("not a url"));
}