Skip to content

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

style: apply rustfmt formatting across agent hooks and embed seams

Steven Enamakelcee3af3cc711
diff --git a/crates/openhuman-core/src/agent/hooks.rs b/crates/openhuman-core/src/agent/hooks.rs
index a8cb13ba56..aecbe1a2c0 100644
--- a/crates/openhuman-core/src/agent/hooks.rs
+++ b/crates/openhuman-core/src/agent/hooks.rs
@@ -10,14 +10,12 @@ use tinyagents_hooks::tool::{HookIdentity, ToolHook};
use crate::agent::tinyagents::host::OpenHumanRunContext;
-static EMBEDDER_POST_TURN_HOOKS:
- std::sync::LazyLock<std::sync::Mutex<Vec<(Option<String>, Arc<dyn LearningSink>)>>> =
- std::sync::LazyLock::new(|| std::sync::Mutex::new(Vec::new()));
-static EMBEDDER_TOOL_HOOKS:
- std::sync::LazyLock<
- std::sync::Mutex<Vec<(Option<String>, Arc<dyn ToolHook<OpenHumanRunContext>>) >>,
- > =
- std::sync::LazyLock::new(|| std::sync::Mutex::new(Vec::new()));
+static EMBEDDER_POST_TURN_HOOKS: std::sync::LazyLock<
+ std::sync::Mutex<Vec<(Option<String>, Arc<dyn LearningSink>)>>,
+> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Vec::new()));
+static EMBEDDER_TOOL_HOOKS: std::sync::LazyLock<
+ std::sync::Mutex<Vec<(Option<String>, Arc<dyn ToolHook<OpenHumanRunContext>>)>>,
+> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Vec::new()));
impl HookIdentity for OpenHumanRunContext {
fn session_id(&self) -> Option<String> {
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
index a60e284384..939ddfa53d 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
@@ -253,7 +253,11 @@ pub(super) async fn finalize_committed_turn(
if let Err(error) = hook.on_turn_complete(&summary).await {
tracing::warn!(index, %error, "post-turn learning sink failed");
} else {
- tracing::debug!(index, elapsed_ms = started.elapsed().as_millis(), "post-turn learning sink finished");
+ tracing::debug!(
+ index,
+ elapsed_ms = started.elapsed().as_millis(),
+ "post-turn learning sink finished"
+ );
}
});
}
diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rs
index 1b39899e4d..c2a7eed2e0 100644
--- a/crates/openhuman-core/src/agent/session_host/types.rs
+++ b/crates/openhuman-core/src/agent/session_host/types.rs
@@ -6,11 +6,11 @@
//! `impl OpenHumanSessionHost`/`impl SessionHostBuilder` can see them without the whole
//! crate gaining field access.
-use tinyagents_harness::host::LearningSink;
use crate::agent::prompts::SystemPromptBuilder;
use crate::agent::tinyagents::TurnModelSource;
use crate::progress::AgentProgress;
use std::sync::Arc;
+use tinyagents_harness::host::LearningSink;
use tinytools::ToolPolicySession;
use tinytools::{Tool, ToolSpec};
use tinytools_agent::dialect::ToolDialect;
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 ae4d4171a5..b86ca2de3b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -11,6 +11,7 @@ use std::time::Instant;
use crate::agent::harness::artifact_offload::offload_run_result;
use crate::agent::harness::fork_context::ParentExecutionContext;
+use crate::agent::prompts::render_subagent_system_prompt_with_format;
use crate::agent::prompts::{PromptContext, SubagentRenderOptions};
use crate::agent::subagent_host::definition_iter_cap;
use crate::agent::subagent_host::tool_prep::{
@@ -22,7 +23,6 @@ use crate::agent::subagent_host::types::{
use crate::agent::tinyagents::budget::MAX_SPAWN_DEPTH;
use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionRegistry};
use crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS;
-use crate::agent::prompts::render_subagent_system_prompt_with_format;
use tinyagents_definition::{
AgentTier, IterationPolicy, PromptSource, SandboxMode as AgentSandboxMode,
validate_tier_transition,
diff --git a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
index cbd001cd82..99b767e698 100644
--- a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs
@@ -52,7 +52,8 @@ pub(crate) struct LiveToolSurface {
pub(crate) has_thread: bool,
/// The session's agent/turn tool callbacks, registered after the
/// runtime's global ones.
- pub(crate) tool_hooks: Vec<Arc<dyn tinyagents_hooks::tool::ToolHook<super::host::OpenHumanRunContext>>>,
+ pub(crate) tool_hooks:
+ Vec<Arc<dyn tinyagents_hooks::tool::ToolHook<super::host::OpenHumanRunContext>>>,
/// The context the session acts under (its embedder hooks come from it).
pub(crate) dispatch: crate::core::runtime::DispatchCtx,
}
@@ -127,11 +128,9 @@ pub(crate) fn assemble_live_tool_harness(
let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&dispatch);
embedder_tool_hooks.extend(tool_hooks);
if !embedder_tool_hooks.is_empty() {
- harness.push_middleware(Arc::new(
- tinyagents_hooks::tool::ToolHooksMiddleware::<super::host::OpenHumanRunContext>::new(
- embedder_tool_hooks,
- ),
- ));
+ harness.push_middleware(Arc::new(tinyagents_hooks::tool::ToolHooksMiddleware::<
+ super::host::OpenHumanRunContext,
+ >::new(embedder_tool_hooks)));
}
harness
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 550e8835cd..51abb8227c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -586,11 +586,9 @@ pub(super) fn install_turn_middleware(
let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&dispatch);
embedder_tool_hooks.extend(scoped_tool_hooks);
if !embedder_tool_hooks.is_empty() {
- harness.push_middleware(Arc::new(
- tinyagents_hooks::tool::ToolHooksMiddleware::<super::host::OpenHumanRunContext>::new(
- embedder_tool_hooks,
- ),
- ));
+ harness.push_middleware(Arc::new(tinyagents_hooks::tool::ToolHooksMiddleware::<
+ super::host::OpenHumanRunContext,
+ >::new(embedder_tool_hooks)));
}
// Registered last so its `before_model` sees the request after every
diff --git a/crates/openhuman-core/src/hooks/mod.rs b/crates/openhuman-core/src/hooks/mod.rs
index 6762db2f98..4b5d7c5d7c 100644
--- a/crates/openhuman-core/src/hooks/mod.rs
+++ b/crates/openhuman-core/src/hooks/mod.rs
@@ -9,7 +9,7 @@ pub mod prompt_eval;
pub mod schemas;
mod shell;
-pub use ops::{init, PromptVerdict};
+pub use ops::{PromptVerdict, init};
pub use schemas::{
all_controller_schemas as all_hooks_controller_schemas,
all_registered_controllers as all_hooks_registered_controllers,
diff --git a/crates/openhuman-core/src/profiles/capabilities.rs b/crates/openhuman-core/src/profiles/capabilities.rs
index 62b2891966..c79b5cea52 100644
--- a/crates/openhuman-core/src/profiles/capabilities.rs
+++ b/crates/openhuman-core/src/profiles/capabilities.rs
@@ -4,7 +4,6 @@
//! call additionally passes the profile lease fence and the host permission
//! callback. These adapters never install process-wide user capabilities.
-use tinyagents_hooks::tool::{ToolHook, ToolHookContext, ToolHookDecision};
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::{HostTools, HostTurnTools, TurnContext};
use crate::config::Config;
@@ -12,6 +11,7 @@ use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx};
use crate::tools::toolpacks::{GroupMode, ToolGroups};
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
+use tinyagents_hooks::tool::{ToolHook, ToolHookContext, ToolHookDecision};
use tinytools::PermissionLevel;
/// Capabilities fixed when the profile runtime boots.
@@ -303,9 +303,7 @@ impl ToolHook<OpenHumanRunContext> for ProfilePermission {
decision.updated_input = Some(advertised.arguments);
}
}
- None => {
- ToolHookDecision::deny("this profile has no host tool permission callback")
- }
+ None => ToolHookDecision::deny("this profile has no host tool permission callback"),
}
}
}
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 8251e45ff4..c4cbf376a8 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -11,7 +11,7 @@ use uuid::Uuid;
use crate::core::events::DomainEvent;
use crate::security::prompt_injection::{
- enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,
+ PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,
};
use crate::web_chat::WebChannelEvent;
diff --git a/crates/openhuman-embed/src/agent/mod.rs b/crates/openhuman-embed/src/agent/mod.rs
index 17d6b34bce..74ecc2bd24 100644
--- a/crates/openhuman-embed/src/agent/mod.rs
+++ b/crates/openhuman-embed/src/agent/mod.rs
@@ -135,7 +135,10 @@ pub(crate) struct AgentInner {
/// The agent's own in-process tools, rebuilt per turn. See
/// [`AgentSpec::tools`](super::AgentSpec::tools) for why it is a factory.
pub(crate) host_tools: Option<openhuman_core::agent::HostTools>,
- pub(crate) hooks: tinyagents_hooks::scope::HookScope<openhuman_core::agent::tinyagents::host::OpenHumanRunContext, tinyagents_harness::cost::TurnCost>,
+ pub(crate) hooks: tinyagents_hooks::scope::HookScope<
+ openhuman_core::agent::tinyagents::host::OpenHumanRunContext,
+ tinyagents_harness::cost::TurnCost,
+ >,
pub(crate) lifecycle: lifecycle::Lifecycle,
/// Built from [`ToolScopeSpec::HostOnly`]: every turn's session is built
/// from the host tools alone.
@@ -310,7 +313,11 @@ impl Agent {
}
/// Add, replace, or remove an agent-local tool hook by name.
- pub fn tool_hook(&self, name: &str, hook: Option<Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>) {
+ pub fn tool_hook(
+ &self,
+ name: &str,
+ hook: Option<Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>,
+ ) {
self.inner.overrides.tool_hook(name, hook);
}
diff --git a/crates/openhuman-embed/src/agent/spec.rs b/crates/openhuman-embed/src/agent/spec.rs
index bc24323ce7..037ed73e65 100644
--- a/crates/openhuman-embed/src/agent/spec.rs
+++ b/crates/openhuman-embed/src/agent/spec.rs
@@ -58,7 +58,10 @@ pub struct AgentSpec {
composio: Option<ComposioHostCredential>,
config_fn: Option<ConfigEdit>,
host_tools: Option<openhuman_core::agent::HostTools>,
- hooks: tinyagents_hooks::scope::HookScope<openhuman_core::agent::tinyagents::host::OpenHumanRunContext, tinyagents_harness::cost::TurnCost>,
+ hooks: tinyagents_hooks::scope::HookScope<
+ openhuman_core::agent::tinyagents::host::OpenHumanRunContext,
+ tinyagents_harness::cost::TurnCost,
+ >,
memory: Option<MemoryBinding>,
subagents: Vec<(String, AgentDefinitionSpec)>,
}
@@ -153,7 +156,10 @@ impl AgentSpec {
}
/// Register a tool hook local to this agent, in addition to runtime hooks.
- pub fn tool_hook(mut self, hook: std::sync::Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>) -> Self {
+ pub fn tool_hook(
+ mut self,
+ hook: std::sync::Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>,
+ ) -> Self {
self.tool_hooks.push(hook);
self
}
@@ -477,7 +483,8 @@ impl AgentSpec {
pub(crate) struct AgentSpecParts {
pub(crate) id: String,
pub(crate) post_turn_hooks: Vec<std::sync::Arc<dyn crate::seams::LearningSink>>,
- pub(crate) tool_hooks: Vec<std::sync::Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>,
+ pub(crate) tool_hooks:
+ Vec<std::sync::Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>,
pub(crate) session_store: Option<std::sync::Arc<dyn crate::SessionStoreProvider>>,
pub(crate) approval_handler: Option<std::sync::Arc<dyn crate::ApprovalHandler>>,
pub(crate) definition: AgentDefinitionSpec,
@@ -500,7 +507,10 @@ pub(crate) struct AgentSpecParts {
pub(crate) composio: Option<ComposioHostCredential>,
pub(crate) config_fn: Option<ConfigEdit>,
pub(crate) host_tools: Option<openhuman_core::agent::HostTools>,
- pub(crate) hooks: tinyagents_hooks::scope::HookScope<openhuman_core::agent::tinyagents::host::OpenHumanRunContext, tinyagents_harness::cost::TurnCost>,
+ pub(crate) hooks: tinyagents_hooks::scope::HookScope<
+ openhuman_core::agent::tinyagents::host::OpenHumanRunContext,
+ tinyagents_harness::cost::TurnCost,
+ >,
pub(crate) memory: Option<MemoryBinding>,
pub(crate) subagents: Vec<(String, AgentDefinitionSpec)>,
}
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index 5cc0b87f99..3e86ad4843 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::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
/// Complete definition accepted by [`AgentDefinitionSpec::from_base`].
pub use openhuman_core::agent_registry::host_definition::AgentDefinition;
-pub use openhuman_core::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource};
/// The origin of the executing turn, with its original chat or channel route.
///
@@ -217,12 +217,14 @@ pub use runtime::{
/// agent-runtime ownership boundary.
pub mod seams {
pub use openhuman_core::agent::tinyagents::host::OpenHumanRunContext;
- pub use tinyagents_harness::host::{LearningSink, TurnSummary};
- pub use tinyagents_hooks::tool::{HookIdentity, ToolHook, ToolHookContext, ToolHookDecision, ToolHookEvent};
- pub use tinyagents_hooks::stop::BudgetStopHook;
pub use tinyagents_harness::cost::TurnCost;
+ pub use tinyagents_harness::host::{LearningSink, TurnSummary};
pub use tinyagents_harness::middleware::{PolicyDecision, ToolCallPolicy};
+ pub use tinyagents_hooks::stop::BudgetStopHook;
pub use tinyagents_hooks::stop::{StopDecision, StopHook};
+ pub use tinyagents_hooks::tool::{
+ HookIdentity, ToolHook, ToolHookContext, ToolHookDecision, ToolHookEvent,
+ };
/// Product cost snapshot passed to harness-owned stop policies.
pub type TurnState<'a> = tinyagents_hooks::stop::TurnState<'a, TurnCost>;
pub use openhuman_core::core::all::{ControllerExtension, DomainGroup};
diff --git a/crates/openhuman-embed/src/runtime/live_hooks.rs b/crates/openhuman-embed/src/runtime/live_hooks.rs
index aa9c9a6165..7862d333bd 100644
--- a/crates/openhuman-embed/src/runtime/live_hooks.rs
+++ b/crates/openhuman-embed/src/runtime/live_hooks.rs
@@ -1,8 +1,6 @@
//! Tracked runtime hooks, composed with agent-local hooks.
use super::Runtime;
-use crate::seams::{
- OpenHumanRunContext, ToolHook, ToolHookContext, ToolHookDecision,
-};
+use crate::seams::{OpenHumanRunContext, ToolHook, ToolHookContext, ToolHookDecision};
use std::sync::Arc;
pub(super) struct NamedToolHook(pub String, pub Arc<dyn ToolHook<OpenHumanRunContext>>);
@@ -62,7 +60,11 @@ impl Runtime {
/// Add, replace, or remove a runtime-wide tool hook by name.
/// This also replaces hooks installed by the builder. Changes apply to
/// subsequently assembled turns; removal restores any predecessor hook.
- pub fn tool_hook(&self, name: &str, hook: Option<Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>) {
+ pub fn tool_hook(
+ &self,
+ name: &str,
+ hook: Option<Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>>,
+ ) {
let context = self.core_runtime().context().clone();
openhuman_core::core::runtime::CoreContext::sync_scope(context.clone(), || {
let mut seams = self
diff --git a/crates/openhuman-embed/src/runtime/seams.rs b/crates/openhuman-embed/src/runtime/seams.rs
index 78b151f9ff..593c26ece5 100644
--- a/crates/openhuman-embed/src/runtime/seams.rs
+++ b/crates/openhuman-embed/src/runtime/seams.rs
@@ -22,11 +22,11 @@
use std::sync::Arc;
+use crate::seams::{LearningSink, OpenHumanRunContext, ToolHook};
use openhuman_core::agent::hooks::{
- embedder_post_turn_hook_named, embedder_tool_hooks,
- replace_embedder_post_turn_hook, replace_embedder_tool_hook,
+ embedder_post_turn_hook_named, embedder_tool_hooks, replace_embedder_post_turn_hook,
+ replace_embedder_tool_hook,
};
-use crate::seams::{LearningSink, OpenHumanRunContext, ToolHook};
use openhuman_core::agent::tinyagents::discovery::{
clear_tool_ranker, install_tool_ranker, installed_tool_ranker,
};
@@ -275,7 +275,11 @@ impl InstalledSeams {
});
}
}
- pub(crate) fn tool_hook(&mut self, name: &str, hook: Option<Arc<dyn ToolHook<OpenHumanRunContext>>>) {
+ pub(crate) fn tool_hook(
+ &mut self,
+ name: &str,
+ hook: Option<Arc<dyn ToolHook<OpenHumanRunContext>>>,
+ ) {
while let Some(index) = self
.tool_hooks
.iter()
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index 065c0a323b..0b236451ea 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -2,8 +2,8 @@
//! and the ranker tests (one slot for the whole process) serialize on a lock.
use super::*;
-use tinyagents_hooks::tool::ToolHookContext;
use tinyagents_harness::host::TurnSummary;
+use tinyagents_hooks::tool::ToolHookContext;
use tinytools::{RankCandidate, RankContext, RankError, RankHit, ToolRanker};
static RANKER_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
@@ -224,8 +224,7 @@ fn same_named_hooks_unwind_newest_first() {
assert_eq!(post_turn_marker("seams-dup-hook"), Some(1));
drop(seams);
- let restored = embedder_post_turn_hook_named("seams-dup-hook")
- .expect("a hook under the name");
+ let restored = embedder_post_turn_hook_named("seams-dup-hook").expect("a hook under the name");
assert!(
Arc::ptr_eq(&restored, &original),
"the original is back, not the runtime's first hook"
diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rs
index 9eef15bef8..eb73000daa 100644
--- a/crates/openhuman-embed/src/turn.rs
+++ b/crates/openhuman-embed/src/turn.rs
@@ -98,7 +98,10 @@ pub struct Turn {
control_deadline: Option<tokio::time::Instant>,
observer: Option<Arc<dyn crate::observe::TurnObserver>>,
trace_content: crate::observe::TraceContent,
- hooks: tinyagents_hooks::scope::HookScope<openhuman_core::agent::tinyagents::host::OpenHumanRunContext, tinyagents_harness::cost::TurnCost>,
+ hooks: tinyagents_hooks::scope::HookScope<
+ openhuman_core::agent::tinyagents::host::OpenHumanRunContext,
+ tinyagents_harness::cost::TurnCost,
+ >,
tools: Option<openhuman_core::agent::HostTools>,
tool_env: Option<tinytools_std::timeout::CommandEnvironment>,
}
@@ -143,14 +146,23 @@ impl Turn {
self
}
- pub(crate) fn with_hooks(mut self, hooks: tinyagents_hooks::scope::HookScope<openhuman_core::agent::tinyagents::host::OpenHumanRunContext, tinyagents_harness::cost::TurnCost>) -> Self {
+ pub(crate) fn with_hooks(
+ mut self,
+ hooks: tinyagents_hooks::scope::HookScope<
+ openhuman_core::agent::tinyagents::host::OpenHumanRunContext,
+ tinyagents_harness::cost::TurnCost,
+ >,
+ ) -> Self {
self.hooks = hooks;
self
}
/// Add a tool callback for this turn only, after runtime and agent hooks.
/// Does not change the agent or any other concurrent turn.
- pub fn tool_hook(mut self, hook: Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>) -> Self {
+ pub fn tool_hook(
+ mut self,
+ hook: Arc<dyn crate::seams::ToolHook<crate::seams::OpenHumanRunContext>>,
+ ) -> Self {
self.hooks.push_tool(hook);
self
}
diff --git a/crates/openhuman-embed/tests/inline_permissions.rs b/crates/openhuman-embed/tests/inline_permissions.rs
index 7aa1050b24..8698c52e84 100644
--- a/crates/openhuman-embed/tests/inline_permissions.rs
+++ b/crates/openhuman-embed/tests/inline_permissions.rs
@@ -10,10 +10,10 @@ use openhuman_embed::seams::{ToolHookContext, ToolHookDecision};
use openhuman_embed::{
AgentDefinitionSpec, AgentSpec, HostTurnTools, Runtime, Tool, ToolScopeSpec, Workspace,
};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use std::sync::{
- atomic::{AtomicUsize, Ordering},
Arc,
+ atomic::{AtomicUsize, Ordering},
};
struct Probe(Arc<AtomicUsize>);
@@ -121,9 +121,7 @@ async fn scenario() {
let second = tokio::spawn(
agent
.turn("turn-specific refusal")
- .can_use_tool(|_| {
- Box::pin(async { ToolHookDecision::deny("turn narrowed authority") })
- })
+ .can_use_tool(|_| Box::pin(async { ToolHookDecision::deny("turn narrowed authority") }))
.send(),
);
let (_, answer) = received.recv().await.unwrap();
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index 9fb9fa813e..7693d34cb4 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -9,11 +9,13 @@ use common::{
chat_completion, eventually, offline_config, route, runtime, scripted_provider, stub_backend,
tool_call_completion,
};
-use openhuman_embed::seams::{LearningSink, OpenHumanRunContext, ToolHook, ToolHookContext, TurnSummary};
+use openhuman_embed::seams::{
+ LearningSink, OpenHumanRunContext, ToolHook, ToolHookContext, TurnSummary,
+};
use openhuman_embed::{
AgentDefinitionSpec, AgentSpec, HostTurnTools, Runtime, Tool, ToolScopeSpec, Workspace,
};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tokio::sync::Barrier;
use wiremock::MockServer;
diff --git a/crates/openhuman-embed/tests/seams_runtime.rs b/crates/openhuman-embed/tests/seams_runtime.rs
index d0ae356009..0fbd2b047d 100644
--- a/crates/openhuman-embed/tests/seams_runtime.rs
+++ b/crates/openhuman-embed/tests/seams_runtime.rs
@@ -11,11 +11,11 @@ use openhuman_core::core::runtime::DispatchCtx;
use std::sync::Arc;
use common::{offline_config, runtime, stub_backend};
-use openhuman_core::core::all::{ControllerFuture, RegisteredController};
use openhuman_core::core::ControllerSchema;
+use openhuman_core::core::all::{ControllerFuture, RegisteredController};
use openhuman_embed::seams::{ControllerExtension, DomainGroup, LearningSink, SecurityPolicy};
-use openhuman_embed::{schema_for_rpc_method, Runtime, Workspace};
-use serde_json::{json, Map, Value};
+use openhuman_embed::{Runtime, Workspace, schema_for_rpc_method};
+use serde_json::{Map, Value, json};
const METHOD: &str = "openhuman.embed_seam_probe_ping";
const POLICY_MARKER: u32 = 4242;
diff --git a/crates/openhuman-embed/tests/tool_hook_context.rs b/crates/openhuman-embed/tests/tool_hook_context.rs
index ef98a95b43..3e2328ac5c 100644
--- a/crates/openhuman-embed/tests/tool_hook_context.rs
+++ b/crates/openhuman-embed/tests/tool_hook_context.rs
@@ -8,7 +8,7 @@ use common::{
};
use openhuman_embed::seams::{OpenHumanRunContext, ToolHook, ToolHookContext};
use openhuman_embed::{Access, AgentDefinitionSpec, AgentSpec, Runtime, ToolScopeSpec, Workspace};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use std::sync::{Arc, Mutex};
struct Capture(Arc<Mutex<Vec<Value>>>);
@@ -92,10 +92,12 @@ async fn scenario() {
.unwrap();
let observed = observed.lock().unwrap();
assert_eq!(observed.len(), 4);
- assert!(observed[1]["output"]
- .as_str()
- .unwrap()
- .contains("owner=isolated home=\n"));
+ assert!(
+ observed[1]["output"]
+ .as_str()
+ .unwrap()
+ .contains("owner=isolated home=\n")
+ );
for (pair, session, cwd) in [
(&observed[..2], "override-session", turn_dir.path()),
(&observed[2..], "default-session", default_dir.path()),