Skip to content

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

style: apply rustfmt import ordering and assertion formatting

Steven Enamakelb50374413d7f
diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rs
index f4614afcb4..7247b41fdb 100644
--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs
+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use crate::agent::harness::host_definition::AgentDefinition;
use crate::agent::progress::AgentProgress;
use crate::agent::subagent_host::{
- run_subagent_with_parent, SubagentRunOptions, SubagentRunStatus,
+ SubagentRunOptions, SubagentRunStatus, run_subagent_with_parent,
};
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::config::Config;
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index cd4ed90a5d..ad96d32374 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -92,7 +92,6 @@ pub(super) fn tier_gate_decision(
Ok(())
}
-
/// Run a sub-agent based on its definition and a task prompt.
///
/// This is the primary entry point for agent delegation. It performs the following:
@@ -1047,4 +1046,3 @@ async fn run_typed_mode(
tinyagents_orchestration::subagent::SubagentPersistenceDisposition::TerminalExisting,
})
}
-
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate_tests.rs
index 5ffa34e7ed..fe593773b2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate_tests.rs
@@ -245,9 +245,10 @@ fn a_refusing_budget_refuses_the_agent_over_it() {
fn a_warning_budget_never_refuses() {
let (_tmp, tracker) = ledger_with(2.0, "planner");
let gate = budgeted_gate(crate::config::BudgetAction::Warn);
- assert!(gate
- .check_budgets_against(&estimate_for("planner"), &gate.live_budgets(), &tracker)
- .is_none());
+ assert!(
+ gate.check_budgets_against(&estimate_for("planner"), &gate.live_budgets(), &tracker)
+ .is_none()
+ );
}
#[tokio::test]
@@ -312,9 +313,10 @@ fn a_call_is_checked_against_its_own_model() {
// Another call left a different model in the shared attribution.
*gate.last_model.write() = "other".into();
let policies = gate.live_budgets();
- assert!(gate
- .check_budgets_against(&estimate_for("planner"), &policies, &tracker)
- .is_some());
+ assert!(
+ gate.check_budgets_against(&estimate_for("planner"), &policies, &tracker)
+ .is_some()
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
index 8b85865150..1719cc17e4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
@@ -43,9 +43,9 @@ pub use bundle::{
};
pub use definition_registry::OpenHumanDefinitionRegistry;
pub use run_context::{
- decide_dispatch, DispatchDecision, DispatchInputs, LastTurnUsage, OpenHumanRunContext,
- OpenHumanRunExt, SubagentUsageEntry, TurnDispatchState,
+ DispatchDecision, DispatchInputs, LastTurnUsage, OpenHumanRunContext, OpenHumanRunExt,
+ SubagentUsageEntry, TurnDispatchState, decide_dispatch,
};
-pub(crate) use run_context::{direct_subagent_child, HarnessHostPolicy};
+pub(crate) use run_context::{HarnessHostPolicy, direct_subagent_child};
pub use security_gate::OpenHumanSecurityGate;
pub use tool_outcome_classifier::OpenHumanToolOutcomeClassifier;
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index 5683b70df1..a1edd64da6 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -415,13 +415,13 @@ pub(crate) struct HarnessHostPolicy {
pub(crate) tool_call_cap: Option<usize>,
}
+pub use super::operation_context::OpenHumanRunExt;
#[cfg(test)]
pub(crate) use super::operation_context::tool_context_with_approval;
-pub use super::operation_context::OpenHumanRunExt;
pub(crate) use super::operation_context::{
- approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool, memory_in_prompt_for_tool,
- parent_agent_id_for_tool, sandbox_mode_for_tool, task_recency_window_for_tool,
- turn_origin_for_tool, HostOperationContext,
+ HostOperationContext, approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool,
+ memory_in_prompt_for_tool, parent_agent_id_for_tool, sandbox_mode_for_tool,
+ task_recency_window_for_tool, turn_origin_for_tool,
};
impl Default for OpenHumanRunContext {
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
index 821af67226..594f3bb1ca 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
@@ -109,16 +109,20 @@ fn child_inherits_tree_handles_but_isolates_observations_and_usage() {
assert_eq!(child.spawn_depth, 1);
assert_eq!(child.thread_id.as_deref(), Some("thread-a"));
assert!(child.file_state_agent_id().is_none());
- assert!(child
- .resolved_route
- .lock()
- .expect("child route lock")
- .is_none());
- assert!(child
- .subagent_usage
- .lock()
- .expect("child usage lock")
- .is_empty());
+ assert!(
+ child
+ .resolved_route
+ .lock()
+ .expect("child route lock")
+ .is_none()
+ );
+ assert!(
+ child
+ .subagent_usage
+ .lock()
+ .expect("child usage lock")
+ .is_empty()
+ );
parent.cancellation.cancel();
assert!(child.cancellation.is_cancelled());
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
index 8e8a0db94e..0e749a924e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
@@ -84,7 +84,7 @@ use tinyagents_harness::host::security_gate::{GateDecision, ToolCallRequest};
use crate::agent::tinyagents::policy_denial::PolicyDenial;
use crate::security::approval::{
- redact_args, summarize_action, ApprovalGate, ApprovalTurnContext, GateOutcome,
+ ApprovalGate, ApprovalTurnContext, GateOutcome, redact_args, summarize_action,
};
use crate::security::policy::{GateDecision as PolicyGateDecision, SecurityPolicy};
use tinybox_bus::CommandClass;
@@ -93,7 +93,7 @@ use tinytools::{ToolPolicyAction, ToolPolicySession};
#[path = "security_gate_shell_analysis.rs"]
mod shell_analysis;
-use shell_analysis::{shell_analysis_for_call, SHELL_TOOL};
+use shell_analysis::{SHELL_TOOL, shell_analysis_for_call};
/// The channel tool-policy's verdict for one tool, as three explicit outcomes.
///
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
index 0875ff229d..915cd7fef2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
@@ -6,7 +6,7 @@ use tinyagents_harness::host::security_gate::{
use super::OpenHumanSecurityGate;
use crate::security::prompt_injection::{
- enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,
+ PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,
};
#[async_trait]
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
index 202bfa1b0d..413e0222c7 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
@@ -301,10 +301,12 @@ async fn a_nested_call_is_refused_even_for_a_read_only_tool() {
.await
.unwrap();
assert!(!decision.is_allowed());
- assert!(decision
- .denial_reason()
- .expect("denial reason")
- .contains("may not call other tools"));
+ assert!(
+ decision
+ .denial_reason()
+ .expect("denial reason")
+ .contains("may not call other tools")
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
index 0997a5fa40..795ef7c6ce 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
@@ -202,20 +202,24 @@ async fn an_unregistered_tool_is_denied_not_allowed() {
.await
.unwrap();
assert!(!decision.is_allowed());
- assert!(decision
- .denial_reason()
- .expect("denial reason")
- .contains("definitely_not_a_tool"));
+ assert!(
+ decision
+ .denial_reason()
+ .expect("denial reason")
+ .contains("definitely_not_a_tool")
+ );
}
#[tokio::test]
async fn an_empty_registry_denies_everything() {
let gate = OpenHumanSecurityGate::new(policy(AutonomyLevel::Full), Vec::new());
- assert!(!gate
- .authorize_tool(&req("read_file", json!({})))
- .await
- .unwrap()
- .is_allowed());
+ assert!(
+ !gate
+ .authorize_tool(&req("read_file", json!({})))
+ .await
+ .unwrap()
+ .is_allowed()
+ );
}
#[tokio::test]
@@ -347,10 +351,12 @@ async fn a_write_shell_command_is_blocked_outright_in_read_only() {
.await
.unwrap();
assert!(!decision.is_allowed());
- assert!(decision
- .denial_reason()
- .expect("denial reason")
- .contains(tinytools::status::POLICY_BLOCKED_MARKER));
+ assert!(
+ decision
+ .denial_reason()
+ .expect("denial reason")
+ .contains(tinytools::status::POLICY_BLOCKED_MARKER)
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs b/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
index 0cb9617de8..26281cfcaf 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
@@ -75,7 +75,7 @@ use std::sync::Arc;
use tinyagents_harness::host::{OutcomeClass, ToolOutcomeClassifier};
use tinytools::ToolResult;
-use tinytools::status::{classify, ToolFailureClass};
+use tinytools::status::{ToolFailureClass, classify};
/// OpenHuman's [`ToolOutcomeClassifier`], backed by
/// [`tinytools::status::classify`].