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
style: apply rustfmt formatting across agent, cost, and approval modules
Steven Enamakel171c77c8b3ea
diff --git a/crates/openhuman-core/src/agent/tinyagents/embeddings.rs b/crates/openhuman-core/src/agent/tinyagents/embeddings.rsindex da3f907ac2..07e381ad97 100644--- a/crates/openhuman-core/src/agent/tinyagents/embeddings.rs+++ b/crates/openhuman-core/src/agent/tinyagents/embeddings.rs@@ -6,8 +6,8 @@use std::sync::Arc;-use async_trait::async_trait;use crate::core::runtime::DispatchCtx;+use async_trait::async_trait;use tinyinference_embeddings::{EmbeddingModel, Result as EmbedResult};/// Wraps the host-bound [`EmbeddingModel`] (credentials, rate limit anddiff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rsindex 1aa2d5645a..38b9c6f70f 100644--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs@@ -426,7 +426,7 @@ impl OpenhumanEventBridge {Some(&self.provider_id),subagent,)- .with_definition(self.definition.get().map(String::as_str)),+ .with_definition(self.definition.get().map(String::as_str)),);// The cost footer is a top-level surface; for a child run the globaldiff --git a/crates/openhuman-core/src/agent/tinyagents/turn_outcome_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_outcome_tests.rsindex 20608d07c7..f7e7fa78b9 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_outcome_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_outcome_tests.rs@@ -2,10 +2,24 @@ use super::*;#[test]fn an_all_zero_unobserved_turn_is_not_recorded() {- assert!(!record_unobserved_turn_usage(&crate::core::runtime::DispatchCtx::ambient(), "m", 0, 0, 0, None));+ assert!(!record_unobserved_turn_usage(+ &crate::core::runtime::DispatchCtx::ambient(),+ "m",+ 0,+ 0,+ 0,+ None+ ));}#[test]fn an_unobserved_turn_with_tokens_is_recorded_once() {- assert!(record_unobserved_turn_usage(&crate::core::runtime::DispatchCtx::ambient(), "m", 10, 5, 2, Some(0.01)));+ assert!(record_unobserved_turn_usage(+ &crate::core::runtime::DispatchCtx::ambient(),+ "m",+ 10,+ 5,+ 2,+ Some(0.01)+ ));}diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rsindex 4e51a406be..cb66dfa3ec 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs@@ -118,8 +118,7 @@ pub(super) async fn finalize_turn_outcome(.with_cached_input_tokens(cached),);crate::agent::tinyagents::turn_outcome::record_unobserved_turn_usage(- dispatch,- model, input, output, cached, estimate,+ dispatch, model, input, output, cached, estimate,);let mut cost = tinyagents_harness::cost::CostTally::default();cost.add(match estimate {diff --git a/crates/openhuman-core/src/platform/cost/global.rs b/crates/openhuman-core/src/platform/cost/global.rsindex 3981e0e82d..2810980444 100644--- a/crates/openhuman-core/src/platform/cost/global.rs+++ b/crates/openhuman-core/src/platform/cost/global.rs@@ -19,8 +19,8 @@ use std::sync::Arc;use parking_lot::RwLock;-use crate::core::runtime::DispatchCtx;use crate::config::CostConfig;+use crate::core::runtime::DispatchCtx;use crate::inference::provider::types::BilledUsage;use super::tracker::CostTracker;diff --git a/crates/openhuman-core/src/platform/cost/scope.rs b/crates/openhuman-core/src/platform/cost/scope.rsindex f3f49e6368..ae5c6078ab 100644--- a/crates/openhuman-core/src/platform/cost/scope.rs+++ b/crates/openhuman-core/src/platform/cost/scope.rs@@ -26,9 +26,7 @@ impl UsageScope {) -> Self {let origin = crate::core::runtime::CoreContext::current_turn_origin();let (thread_id, origin) = describe_origin(origin.as_ref());- let session_agent = ctx.tenant()- .ok()- .and_then(|tenant| tenant.agent);+ let session_agent = ctx.tenant().ok().and_then(|tenant| tenant.agent);let (agent_id, subagent_task_id) = match subagent {Some((agent, task)) => (Some(agent.to_string()), Some(task.to_string())),None => (None, None),diff --git a/crates/openhuman-core/src/security/approval/gate_agent_tests.rs b/crates/openhuman-core/src/security/approval/gate_agent_tests.rsindex 118cf1b565..4dcea50b90 100644--- a/crates/openhuman-core/src/security/approval/gate_agent_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_agent_tests.rs@@ -233,11 +233,19 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {.expect("ApprovalRequested for alpha");assert_eq!(seen.as_deref(), Some("route-alpha"));- let alpha_rows = gate.list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), Some("route-alpha")).unwrap();+ let alpha_rows = gate+ .list_pending_for_agent(+ &crate::core::runtime::DispatchCtx::ambient(),+ Some("route-alpha"),+ )+ .unwrap();assert_eq!(alpha_rows.len(), 1);assert_eq!(alpha_rows[0].request_id, alpha_request);assert_eq!(alpha_rows[0].agent_id.as_deref(), Some("route-alpha"));- assert!(gate.list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), None).unwrap().is_empty());+ assert!(gate+ .list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), None)+ .unwrap()+ .is_empty());let refused = gate.decide_for_agent("route-alpha", &beta_request, ApprovalDecision::ApproveOnce)@@ -267,7 +275,11 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {);let denied = gate- .deny_all_for_agent(&crate::core::runtime::DispatchCtx::ambient(), "route-beta", "agent_removed")+ .deny_all_for_agent(+ &crate::core::runtime::DispatchCtx::ambient(),+ "route-beta",+ "agent_removed",+ ).unwrap();assert_eq!(denied, 1);let (outcome, _) = beta.await.unwrap();@@ -295,7 +307,10 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {other => panic!("unexpected event {other:?}"),}assert!(gate- .list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), Some("route-beta"))+ .list_pending_for_agent(+ &crate::core::runtime::DispatchCtx::ambient(),+ Some("route-beta")+ ).unwrap().is_empty());}diff --git a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs b/crates/openhuman-core/src/security/approval/store_persistence_tests.rsindex 4d342edc13..a9c36e6dba 100644--- a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs+++ b/crates/openhuman-core/src/security/approval/store_persistence_tests.rs@@ -473,11 +473,18 @@ fn agent_id_round_trips_and_older_rows_read_as_the_process() {).unwrap();- let alpha = list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), &config, Some("alpha")).unwrap();+ let alpha = list_pending_for_agent(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ Some("alpha"),+ )+ .unwrap();assert_eq!(alpha.len(), 1);assert_eq!(alpha[0].request_id, "owned");assert_eq!(alpha[0].agent_id.as_deref(), Some("alpha"));- let process = list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), &config, None).unwrap();+ let process =+ list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), &config, None)+ .unwrap();assert_eq!(process.len(), 1);assert_eq!(process[0].request_id, "process");diff --git a/crates/openhuman-embed/src/agent/approval_handler.rs b/crates/openhuman-embed/src/agent/approval_handler.rsindex 00f913abb6..0409e645ff 100644--- a/crates/openhuman-embed/src/agent/approval_handler.rs+++ b/crates/openhuman-embed/src/agent/approval_handler.rs@@ -69,8 +69,7 @@ impl EventHandler<DomainEvent> for Handler {if agent_id.as_deref() != Some(&self.agent_id) || *self.removed.borrow() {return;}- let approvals =- Approvals::new(+ let approvals = Approvals::new(&self.agent_id,self.removed.clone(),self.lifecycle.clone(),diff --git a/crates/openhuman-embed/src/agent/lifecycle_tests.rs b/crates/openhuman-embed/src/agent/lifecycle_tests.rsindex d5da23ca9e..1618385af7 100644--- a/crates/openhuman-embed/src/agent/lifecycle_tests.rs+++ b/crates/openhuman-embed/src/agent/lifecycle_tests.rs@@ -137,7 +137,8 @@ async fn a_claimed_removal_refuses_turns_before_approvals_are_settled() {fn a_claimed_removal_refuses_approval_decisions_before_denial_finishes() {let lifecycle = Arc::new(Lifecycle::new());let shared_scope = lifecycle.approval_scope();- let approvals = crate::Approvals::new("a", lifecycle.removed(), lifecycle.approval_state(), None);+ let approvals =+ crate::Approvals::new("a", lifecycle.removed(), lifecycle.approval_state(), None);let removing = lifecycle.clone();let (entered, callback_entered) = std::sync::mpsc::channel();let (release, callback_release) = std::sync::mpsc::channel();diff --git a/crates/openhuman-embed/tests/agent_lifecycle.rs b/crates/openhuman-embed/tests/agent_lifecycle.rsindex 6e71f679c9..c8cff0865a 100644--- a/crates/openhuman-embed/tests/agent_lifecycle.rs+++ b/crates/openhuman-embed/tests/agent_lifecycle.rs@@ -158,7 +158,10 @@ fn removing_an_agent_releases_everything_it_held() {removed(closing_turn.await.unwrap(), "closing");assert!(!scratch.path().join("closing-wrote").exists());assert!(gate- .list_pending_for_agent(&openhuman_core::core::runtime::DispatchCtx::ambient(), Some("closing"))+ .list_pending_for_agent(+ &openhuman_core::core::runtime::DispatchCtx::ambient(),+ Some("closing")+ ).unwrap().is_empty());diff --git a/crates/openhuman-embed/tests/flow_approvals.rs b/crates/openhuman-embed/tests/flow_approvals.rsindex 19523d6f5f..e0e57ec8d9 100644--- a/crates/openhuman-embed/tests/flow_approvals.rs+++ b/crates/openhuman-embed/tests/flow_approvals.rs@@ -184,7 +184,12 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {assert_eq!(payload["summary"], "flow action");assert_eq!(payload["decision"], action.action_id);}- let rows = gate.list_pending_for_agent(&openhuman_core::core::runtime::DispatchCtx::ambient(), Some("flow-agent")).unwrap();+ let rows = gate+ .list_pending_for_agent(+ &openhuman_core::core::runtime::DispatchCtx::ambient(),+ Some("flow-agent"),+ )+ .unwrap();assert_eq!(rows.len(), 1);assert_eq!(rows[0].request_id, request_id);assert!(matches!(&rows[0].source_context,@@ -291,7 +296,10 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {);assert!(request.is_none());assert!(gate- .list_pending_for_agent(&openhuman_core::core::runtime::DispatchCtx::ambient(), Some("flow-removed"))+ .list_pending_for_agent(+ &openhuman_core::core::runtime::DispatchCtx::ambient(),+ Some("flow-removed")+ ).unwrap().is_empty());assert!(