Skip to content

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

style: reformat middleware code to satisfy rustfmt

Steven Enamakele7105d2ee429
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_outcome_capture.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_outcome_capture.rs
index 208e32a842..681cb8f699 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_outcome_capture.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_outcome_capture.rs
@@ -133,12 +133,16 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
.filter(|v| v.is_object() && v.get("kind").is_some());
// TinyAgents owns call timing, argument correlation and the outcome
// record. Run it after host enrichment so the sink sees the final text.
- self.capture.after_tool(ctx, state, invocation, result).await?;
- let captured = self
- .sink
- .lock()
- .ok()
- .and_then(|outcomes| outcomes.iter().rev().find(|outcome| outcome.call_id == call_id).cloned());
+ self.capture
+ .after_tool(ctx, state, invocation, result)
+ .await?;
+ let captured = self.sink.lock().ok().and_then(|outcomes| {
+ outcomes
+ .iter()
+ .rev()
+ .find(|outcome| outcome.call_id == call_id)
+ .cloned()
+ });
if let (Some(captured), Ok(mut map)) = (captured, self.failure_map.lock()) {
// Keep duration + rendered output size as a compatibility fallback
// for old/deserialized completion events; TinyAgents 1.6 supplies
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
index 5e46bed38c..d91f69e3e5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
@@ -71,14 +71,12 @@ impl ToolPolicyMiddleware {
Self {
gate: ToolPolicyGate::new(policy),
render_denial: Arc::new(|call, policy, decision| match decision {
- PolicyDecision::RequireApproval { reason } => {
- PolicyDenial::ApprovalRequired {
- tool: &call.name,
- policy,
- reason,
- }
- .render()
+ PolicyDecision::RequireApproval { reason } => PolicyDenial::ApprovalRequired {
+ tool: &call.name,
+ policy,
+ reason,
}
+ .render(),
PolicyDecision::Deny { reason } => PolicyDenial::PolicyDenied {
tool: &call.name,
policy,
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
index c698055802..6ecb42aa99 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
@@ -226,7 +226,9 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
invocation: &tinyagents_harness::middleware::ToolInvocationIdentity,
result: &mut TaToolResult,
) -> TaResult<()> {
- self.owner.after_tool(ctx, state, invocation, result).await?;
+ self.owner
+ .after_tool(ctx, state, invocation, result)
+ .await?;
sync_owner_snapshot(&self.owner_sink, &self.sink);
Ok(())
}
@@ -237,7 +239,9 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
state: &(),
request: &mut ModelRequest,
) -> TaResult<()> {
- self.owner.before_model_dispatch(ctx, state, request).await?;
+ self.owner
+ .before_model_dispatch(ctx, state, request)
+ .await?;
sync_owner_snapshot(&self.owner_sink, &self.sink);
Ok(())
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
index 91f00abdbf..1daeeba19c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs
@@ -63,10 +63,8 @@ async fn transcript_snapshot_keeps_a_completed_failed_tool_row() {
.before_tool(&mut context, &(), &mut call)
.await
.expect("snapshot accepts tool start");
- let invocation = tinyagents_harness::middleware::ToolInvocationIdentity::new(
- "failed-call",
- "write_file",
- );
+ let invocation =
+ tinyagents_harness::middleware::ToolInvocationIdentity::new("failed-call", "write_file");
let mut result = TaToolResult::error("permission denied");
middleware
.after_tool(&mut context, &(), &invocation, &mut result)
@@ -114,13 +112,14 @@ async fn owner_snapshot_spend_is_not_counted_twice_and_cache_replay_stays_free()
.before_model_dispatch(&mut context, &(), &mut first)
.await
.expect("snapshot first dispatched request");
- let mut answered = tinyinference_llm::model::ModelResponse::assistant("answer one")
- .with_usage(tinyinference_llm::usage::Usage {
+ let mut answered = tinyinference_llm::model::ModelResponse::assistant("answer one").with_usage(
+ tinyinference_llm::usage::Usage {
input_tokens: 12,
output_tokens: 4,
cache_read_tokens: 3,
..Default::default()
- });
+ },
+ );
middleware
.after_model(&mut context, &(), &mut answered)
.await
@@ -170,13 +169,14 @@ async fn owner_snapshot_spend_is_not_counted_twice_and_cache_replay_stays_free()
.before_model_dispatch(&mut context, &(), &mut replay_request)
.await
.expect("snapshot cache replay request");
- let mut replay = tinyinference_llm::model::ModelResponse::assistant("answer three")
- .with_usage(tinyinference_llm::usage::Usage {
+ let mut replay = tinyinference_llm::model::ModelResponse::assistant("answer three").with_usage(
+ tinyinference_llm::usage::Usage {
input_tokens: 7,
output_tokens: 3,
cache_read_tokens: 7,
..Default::default()
- });
+ },
+ );
replay.served_from_cache = true;
middleware
.after_model(&mut context, &(), &mut replay)