Skip to content

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

style: format merged upstream Rust

Steven Enamakel05c54bd61071
diff --git a/crates/openhuman-cli/src/bin/tool_search_bench.rs b/crates/openhuman-cli/src/bin/tool_search_bench.rs
index 7d5f2013eb..af68997e1c 100644
--- a/crates/openhuman-cli/src/bin/tool_search_bench.rs
+++ b/crates/openhuman-cli/src/bin/tool_search_bench.rs
@@ -81,7 +81,11 @@ impl CatalogueEntry {
summary.push_str(&self.name.replace('_', " "));
summary.push(' ');
summary.push_str(&self.description);
- if let Some(props) = self.parameters.get("properties").and_then(|v| v.as_object()) {
+ if let Some(props) = self
+ .parameters
+ .get("properties")
+ .and_then(|v| v.as_object())
+ {
for key in props.keys() {
summary.push(' ');
summary.push_str(key);
@@ -482,12 +486,23 @@ async fn main() -> Result<()> {
r.errors,
r.percentile(0.5),
r.percentile(0.95),
- if r.input_tokens == 0 { "-".to_string() } else { r.input_tokens.to_string() },
- if r.usd == 0.0 { "-".to_string() } else { format!("${:.5}", r.usd) },
+ if r.input_tokens == 0 {
+ "-".to_string()
+ } else {
+ r.input_tokens.to_string()
+ },
+ if r.usd == 0.0 {
+ "-".to_string()
+ } else {
+ format!("${:.5}", r.usd)
+ },
);
}
for r in &reports {
- println!("\n### {} — top-1 family confusion (expected → got)", r.ranker);
+ println!(
+ "\n### {} — top-1 family confusion (expected → got)",
+ r.ranker
+ );
for (expected, gots) in &r.confusion {
let line: Vec<String> = gots.iter().map(|(g, n)| format!("{g}:{n}")).collect();
println!("- {expected}: {}", line.join(", "));
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
index 1a139169fe..03425a03a2 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
@@ -193,8 +193,7 @@ fn named_belt_opts_into_discovery_by_naming_tool_search() {
/// down: no deferred set, and a deferred tool it did not name stays hidden.
#[test]
fn named_belt_without_tool_search_reaches_no_deferred_tool() {
- let visible: std::collections::HashSet<String> =
- std::iter::once("plain".to_string()).collect();
+ let visible: std::collections::HashSet<String> = std::iter::once("plain".to_string()).collect();
let agent = build_with(direct_and_deferred(), visible);
assert!(agent.deferred_tool_names_for_test().is_empty());
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
index 59531004a3..74c7f0071a 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
@@ -129,7 +129,9 @@ impl OpenHumanSessionHost {
}
#[cfg(test)]
- pub(crate) fn tool_policy_session_for_test(&self) -> &crate::tools::agent_policy::ToolPolicySession {
+ pub(crate) fn tool_policy_session_for_test(
+ &self,
+ ) -> &crate::tools::agent_policy::ToolPolicySession {
&self.tool_policy_session
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/discovery_tests.rs b/crates/openhuman-core/src/agent/tinyagents/discovery_tests.rs
index c27c2063eb..8e3a0027e5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/discovery_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/discovery_tests.rs
@@ -54,14 +54,28 @@ async fn overlap_ranker_ranks_by_token_overlap_and_names_its_kind() {
let ranker = OverlapRanker;
assert_eq!(ranker.kind(), "overlap");
let candidates = vec![
- tinytools::RankCandidate::new("SLACK_SEND_MESSAGE", "SLACK_SEND_MESSAGE send message to a channel"),
- tinytools::RankCandidate::new("GMAIL_FETCH_EMAILS", "GMAIL_FETCH_EMAILS fetch emails from inbox"),
+ tinytools::RankCandidate::new(
+ "SLACK_SEND_MESSAGE",
+ "SLACK_SEND_MESSAGE send message to a channel",
+ ),
+ tinytools::RankCandidate::new(
+ "GMAIL_FETCH_EMAILS",
+ "GMAIL_FETCH_EMAILS fetch emails from inbox",
+ ),
];
let hits = ranker
- .rank("send a message to the channel", &tinytools::RankContext::empty(), &candidates, 3)
+ .rank(
+ "send a message to the channel",
+ &tinytools::RankContext::empty(),
+ &candidates,
+ 3,
+ )
.await
.unwrap();
- assert_eq!(hits.first().map(|h| h.key.as_str()), Some("SLACK_SEND_MESSAGE"));
+ assert_eq!(
+ hits.first().map(|h| h.key.as_str()),
+ Some("SLACK_SEND_MESSAGE")
+ );
assert!(ranker
.rank(" ", &tinytools::RankContext::empty(), &candidates, 3)
.await
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
index 58bde1d904..4633aad2e0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
@@ -229,8 +229,12 @@ async fn prompt_cache_segments_are_stable_across_a_threads_turns() {
TaMessage::user("and again, later"),
])
.with_tools(tools);
- mw.before_model(&mut ctx(), &(), &mut turn_one).await.unwrap();
- mw.before_model(&mut ctx(), &(), &mut turn_two).await.unwrap();
+ mw.before_model(&mut ctx(), &(), &mut turn_one)
+ .await
+ .unwrap();
+ mw.before_model(&mut ctx(), &(), &mut turn_two)
+ .await
+ .unwrap();
let ids = |r: &ModelRequest| {
r.cache_segments
diff --git a/crates/openhuman-core/src/agent/tinyagents/tools.rs b/crates/openhuman-core/src/agent/tinyagents/tools.rs
index 8a146eda02..2bd750dab6 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tools.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tools.rs
@@ -133,9 +133,7 @@ impl Tool for CanonicalSharedToolAdapter {
/// indexes `Deferred` ones for its `tool_search` bridge. Without this
/// every registered tool reported `Direct` and the bridge stayed inert.
fn exposure(&self) -> tinytools::ToolExposure {
- self.resolved_tool()
- .map(Tool::exposure)
- .unwrap_or_default()
+ self.resolved_tool().map(Tool::exposure).unwrap_or_default()
}
fn family(&self) -> Option<&str> {
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
index 01585d3f00..ec8016b638 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
@@ -1,8 +1,8 @@
use super::*;
use crate::inference::provider::factory::cloud_slug::{
- openrouter_default_provider_options, try_create_cloud_slug_chat_model_from_string_with_native_tools,
- OPENROUTER_PROVIDER_SORT,
+ openrouter_default_provider_options,
+ try_create_cloud_slug_chat_model_from_string_with_native_tools, OPENROUTER_PROVIDER_SORT,
};
#[test]
fn enforce_local_only_inference_errors_on_external_when_local_only() {
@@ -768,7 +768,10 @@ fn direct_openrouter_endpoints_get_price_sorted_routing_and_nothing_else() {
);
let provider = &options["provider"];
for forbidden in ["order", "allow_fallbacks", "max_price", "only", "ignore"] {
- assert!(provider.get(forbidden).is_none(), "must not set provider.{forbidden}");
+ assert!(
+ provider.get(forbidden).is_none(),
+ "must not set provider.{forbidden}"
+ );
}
// Host matching is what keys it, with or without a path or trailing slash.
assert!(openrouter_default_provider_options("https://openrouter.ai/api/v1/").is_some());
diff --git a/crates/openhuman-core/src/integrations/composio/action_tool.rs b/crates/openhuman-core/src/integrations/composio/action_tool.rs
index 797a652e0c..2a8cac0485 100644
--- a/crates/openhuman-core/src/integrations/composio/action_tool.rs
+++ b/crates/openhuman-core/src/integrations/composio/action_tool.rs
@@ -284,19 +284,19 @@ impl Tool for ComposioActionTool {
// re-resolving process-global `OPENHUMAN_WORKSPACE` (the tool is scoped to
// the user/workspace it was created for).
let live_config = match self.live_config().await {
- Ok(c) => c,
- Err(e) => {
- tracing::warn!(
- tool = %self.action_name,
- error = %e,
- "[composio] per-action execute: load_config failed"
- );
- return Ok(ToolResult::error(format!(
- "{}: failed to load live config: {e}",
- self.action_name
- )));
- }
- };
+ Ok(c) => c,
+ Err(e) => {
+ tracing::warn!(
+ tool = %self.action_name,
+ error = %e,
+ "[composio] per-action execute: load_config failed"
+ );
+ return Ok(ToolResult::error(format!(
+ "{}: failed to load live config: {e}",
+ self.action_name
+ )));
+ }
+ };
// Contract gate (#4853): the per-action tool is built from the thin
// spawn-time `list_tools` schema (often `{"type":"object"}` with no
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rs
index 37a33d8bb5..35c0a80975 100644
--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs
+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs
@@ -18,9 +18,8 @@ use tinytools_jev::{ClientConfig, JevRanker, JevRankerConfig};
/// How the ranker reads the config a search runs under. The default is the
/// core's own read path (the embedder's config when one is bound, else the
/// process-global load); a test hands in a fixed one.
-pub type ConfigLoader = Arc<
- dyn Fn() -> Pin<Box<dyn Future<Output = Result<Config, String>> + Send>> + Send + Sync,
->;
+pub type ConfigLoader =
+ Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Config, String>> + Send>> + Send + Sync>;
/// A [`JevRanker`] bound to whichever credential and backend the process has
/// at search time.
@@ -99,7 +98,10 @@ impl TinyHumansJevRanker {
.cached
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner());
- if let Some(entry) = cached.as_ref().filter(|entry| entry.fingerprint == fingerprint) {
+ if let Some(entry) = cached
+ .as_ref()
+ .filter(|entry| entry.fingerprint == fingerprint)
+ {
return Ok(entry.ranker.clone());
}
let mut client = ClientConfig::tinyhumans_openrouter(credential.into_secret());
diff --git a/crates/openhuman-tinyhumans/src/lib.rs b/crates/openhuman-tinyhumans/src/lib.rs
index 231a93cdc5..410d8019b4 100644
--- a/crates/openhuman-tinyhumans/src/lib.rs
+++ b/crates/openhuman-tinyhumans/src/lib.rs
@@ -37,9 +37,9 @@
pub use openhuman_embed as embed;
pub mod hosted;
+mod install;
#[cfg(feature = "jev")]
pub mod jev;
-mod install;
pub mod jwt;
mod runtime;
pub mod session;