Skip to content

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

chore(openhuman-embed): apply rustfmt formatting

Steven Enamakel157baac8b98a
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index b33fc4df1f..fc03d5952e 100644
--- a/crates/openhuman-embed/src/lib.rs
+++ b/crates/openhuman-embed/src/lib.rs
@@ -63,9 +63,9 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
-pub use openhuman_core::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
/// Complete definition accepted by [`AgentDefinitionSpec::from_base`].
pub use openhuman_core::agent_registry::host_definition::AgentDefinition;
+pub use openhuman_core::security::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
/// The origin of the executing turn, with its original chat or channel route.
///
diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rs
index 7297b7ec7d..0f0bd10bb0 100644
--- a/crates/openhuman-embed/src/turn.rs
+++ b/crates/openhuman-embed/src/turn.rs
@@ -42,10 +42,10 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use super::error::CoreError;
-use openhuman_core::progress::AgentProgress;
-use openhuman_core::security::turn_origin::AgentTurnOrigin;
use openhuman_core::core::runtime::CoreRuntime;
use openhuman_core::inference::INFERENCE_AGENT_CHAT as AGENT_CHAT;
+use openhuman_core::progress::AgentProgress;
+use openhuman_core::security::turn_origin::AgentTurnOrigin;
#[path = "turn_types.rs"]
mod types;
diff --git a/crates/openhuman-embed/src/turn_control.rs b/crates/openhuman-embed/src/turn_control.rs
index 958ba26647..dfef19f60d 100644
--- a/crates/openhuman-embed/src/turn_control.rs
+++ b/crates/openhuman-embed/src/turn_control.rs
@@ -402,7 +402,9 @@ impl Turn {
let dispatch = dispatch(self.target, self.request, self.seed.take(), usage, options);
let reply = match self.origin {
- Some(origin) => openhuman_core::security::turn_origin::with_origin(origin, dispatch).await,
+ Some(origin) => {
+ openhuman_core::security::turn_origin::with_origin(origin, dispatch).await
+ }
None => dispatch.await,
}
.inspect_err(|err| {
diff --git a/crates/openhuman-embed/tests/agent_lifecycle.rs b/crates/openhuman-embed/tests/agent_lifecycle.rs
index a1e696b3a7..6efe391093 100644
--- a/crates/openhuman-embed/tests/agent_lifecycle.rs
+++ b/crates/openhuman-embed/tests/agent_lifecycle.rs
@@ -133,10 +133,11 @@ fn removing_an_agent_releases_everything_it_held() {
.is_none(),
"a closed instance must refuse direct gate decisions"
);
- assert!(gate
- .decide_for_agent("closing", &closing_request.request_id, decision)
- .unwrap()
- .is_none());
+ assert!(
+ gate.decide_for_agent("closing", &closing_request.request_id, decision)
+ .unwrap()
+ .is_none()
+ );
}
assert_eq!(
gate.classify_decide_miss(&closing_request.request_id),
@@ -144,26 +145,29 @@ fn removing_an_agent_releases_everything_it_held() {
"a removal barrier is a benign decision miss, not a lost registration"
);
for owner in [None, Some("closing")] {
- assert!(openhuman_core::security::approval::rpc::approval_decide(
- &openhuman_core::core::runtime::DispatchCtx::process_default(),
- &closing_request.request_id,
- openhuman_embed::ApprovalDecision::ApproveOnce,
- owner,
- )
- .await
- .is_err());
+ assert!(
+ openhuman_core::security::approval::rpc::approval_decide(
+ &openhuman_core::core::runtime::DispatchCtx::process_default(),
+ &closing_request.request_id,
+ openhuman_embed::ApprovalDecision::ApproveOnce,
+ owner,
+ )
+ .await
+ .is_err()
+ );
}
assert_eq!(closing.approvals().pending().unwrap().len(), 1);
runtime.remove_agent("closing").await.unwrap();
removed(closing_turn.await.unwrap(), "closing");
assert!(!scratch.path().join("closing-wrote").exists());
- assert!(gate
- .list_pending_for_agent(
+ assert!(
+ gate.list_pending_for_agent(
&openhuman_core::core::runtime::DispatchCtx::ambient(),
Some("closing")
)
.unwrap()
- .is_empty());
+ .is_empty()
+ );
// Reusing the public id installs a fresh barrier: the new request
// remains answerable through the same context-free gate entry point.
@@ -178,13 +182,14 @@ fn removing_an_agent_releases_everything_it_held() {
})
.await;
assert_ne!(replacement_request.request_id, closing_request.request_id);
- assert!(gate
- .decide(
+ assert!(
+ gate.decide(
&replacement_request.request_id,
openhuman_embed::ApprovalDecision::ApproveOnce,
)
.unwrap()
- .is_some());
+ .is_some()
+ );
assert!(replacement_turn.await.unwrap().is_ok());
assert!(scratch.path().join("closing-wrote").exists());
runtime.remove_agent("closing").await.unwrap();
@@ -265,7 +270,7 @@ fn removing_an_agent_releases_everything_it_held() {
agent_id,
..
}) if request_id == request.request_id => {
- break (decision, resolution, agent_id)
+ break (decision, resolution, agent_id);
}
Some(_) => {}
None => panic!("bus closed"),
diff --git a/crates/openhuman-embed/tests/flow_approvals.rs b/crates/openhuman-embed/tests/flow_approvals.rs
index 650350e2bd..4706752969 100644
--- a/crates/openhuman-embed/tests/flow_approvals.rs
+++ b/crates/openhuman-embed/tests/flow_approvals.rs
@@ -4,11 +4,11 @@ mod common;
use std::time::Duration;
-use openhuman_core::security::turn_origin::{self, TrustedAutomationSource};
use openhuman_core::core::events::DomainEvent;
use openhuman_core::core::runtime::{AgentContextRegistry, CoreContext};
use openhuman_core::security::approval::{ApprovalGate, ApprovalSourceContext, GateOutcome};
use openhuman_core::security::approval::{ApprovalTurnContext, FlowRunContext};
+use openhuman_core::security::turn_origin::{self, TrustedAutomationSource};
use openhuman_embed::{
Access, AgentDefinitionSpec, AgentSpec, AgentTurnOrigin, ApprovalDecision, Runtime,
ToolScopeSpec, TrustedAccess, Workspace,
@@ -192,10 +192,11 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
assert!(matches!(&rows[0].source_context,
Some(ApprovalSourceContext::Flow { flow_id, run_id, node_id })
if flow_id == "flow-live" && run_id == "run-direct" && node_id.is_none()));
- assert!(gate
- .decide(&request_id, ApprovalDecision::Deny)
- .unwrap()
- .is_some());
+ assert!(
+ gate.decide(&request_id, ApprovalDecision::Deny)
+ .unwrap()
+ .is_some()
+ );
let (outcome, audited_request) = park.await.unwrap();
assert!(matches!(outcome, GateOutcome::Deny { .. }));
// Only an allowed call returns an execution-audit id; a refusal
@@ -224,10 +225,11 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
})
.await
.unwrap();
- assert!(gate
- .decide(&request_id, ApprovalDecision::ApproveOnce)
- .unwrap()
- .is_none());
+ assert!(
+ gate.decide(&request_id, ApprovalDecision::ApproveOnce)
+ .unwrap()
+ .is_none()
+ );
// Exercise the actual tool dispatcher too: a refused flow approval
// must produce a denied tool result and never create the marker.
@@ -253,8 +255,10 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
let requests = common::chat_requests(&provider).await;
// Human approval refusals deliberately omit the policy-failure
// marker so the model can explain that the action was not done.
- assert!(requests.iter().any(|request| common::tool_results(request)
- .contains("This action was refused and must not be performed this turn")));
+ assert!(requests.iter().any(|request| {
+ common::tool_results(request)
+ .contains("This action was refused and must not be performed this turn")
+ }));
// A retained context belongs to its old instance after removal.
// Its late flow registration must create neither rows nor surfaces.
@@ -292,13 +296,14 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
matches!(outcome, GateOutcome::Deny { reason } if reason.contains("agent_removed"))
);
assert!(request.is_none());
- assert!(gate
- .list_pending_for_agent(
+ assert!(
+ gate.list_pending_for_agent(
&openhuman_core::core::runtime::DispatchCtx::ambient(),
Some("flow-removed")
)
.unwrap()
- .is_empty());
+ .is_empty()
+ );
assert!(
tokio::time::timeout(Duration::from_millis(100), async {
loop {
@@ -306,12 +311,12 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
DomainEvent::ApprovalRequested { agent_id, .. }
if agent_id.as_deref() == Some("flow-removed") =>
{
- break
+ break;
}
DomainEvent::FlowApprovalRequested { flow_id, .. }
if flow_id == "flow-closed" =>
{
- break
+ break;
}
_ => {}
}