Skip to content

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

chore: format Rust files after upstream merge

Steven Enamakel9f3d66b4ec97
diff --git a/crates/openhuman-core/src/agent/goals/runtime_tests.rs b/crates/openhuman-core/src/agent/goals/runtime_tests.rs
index fe49d1f860..4f42dd8d48 100644
--- a/crates/openhuman-core/src/agent/goals/runtime_tests.rs
+++ b/crates/openhuman-core/src/agent/goals/runtime_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use tinyagents_harness::cost::TurnCost;
use crate::inference::provider::BilledUsage;
+use tinyagents_harness::cost::TurnCost;
fn cost_with_tokens(input: u64, output: u64) -> TurnCost {
let mut tc = crate::agent::cost::turn_cost();
diff --git a/crates/openhuman-core/src/agent/hooks_scope.rs b/crates/openhuman-core/src/agent/hooks_scope.rs
index e3c2ac076f..153f398516 100644
--- a/crates/openhuman-core/src/agent/hooks_scope.rs
+++ b/crates/openhuman-core/src/agent/hooks_scope.rs
@@ -19,7 +19,8 @@ use super::{PostTurnHook, ToolHook};
pub struct HookScope {
tools: Vec<Arc<dyn ToolHook>>,
post_turn: Vec<Arc<dyn PostTurnHook>>,
- stop: Vec<Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>>,
+ stop:
+ Vec<Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>>,
}
impl HookScope {
@@ -54,7 +55,8 @@ impl HookScope {
/// The scope's own stop policies, in registration order.
pub fn stop_hooks(
&self,
- ) -> &[Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>] {
+ ) -> &[Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>]
+ {
&self.stop
}
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
index 9693fbecbb..caee89bb6a 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
@@ -485,9 +485,9 @@ impl SessionHostBuilder {
omit_memory_context: self.omit_memory_context.unwrap_or(false),
payload_summarizer: self.payload_summarizer,
tokenjuice_compression: self.tokenjuice_compression,
- tool_policy: self
- .tool_policy
- .unwrap_or_else(|| Arc::new(crate::agent::tinyagents::middleware::AllowAllToolPolicy)),
+ tool_policy: self.tool_policy.unwrap_or_else(|| {
+ Arc::new(crate::agent::tinyagents::middleware::AllowAllToolPolicy)
+ }),
last_seen_integrations_hash: 0,
composio_integrations_rx: None,
skill_events_rx: None,
diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_only.rs b/crates/openhuman-core/src/agent/session_host/builder/host_only.rs
index 1f916aa7e3..fd8754ec5f 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/host_only.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/host_only.rs
@@ -42,13 +42,28 @@ use tinyagents_definition::{SandboxMode, ToolScope};
/// host's policy and never widens it.
pub struct HostOnlyToolPolicy {
allowed: HashSet<String>,
- host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,
+ host: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
}
impl HostOnlyToolPolicy {
/// Admit exactly `allowed`, subject to `host`'s own decision.
#[must_use]
- pub fn new(allowed: HashSet<String>, host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>) -> Self {
+ pub fn new(
+ allowed: HashSet<String>,
+ host: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
+ ) -> Self {
Self { allowed, host }
}
}
@@ -59,7 +74,11 @@ impl ToolCallPolicy<OpenHumanRunContext> for HostOnlyToolPolicy {
"host_only"
}
- async fn check(&self, ctx: &RunContext<OpenHumanRunContext>, call: &ToolCall) -> PolicyDecision {
+ async fn check(
+ &self,
+ ctx: &RunContext<OpenHumanRunContext>,
+ call: &ToolCall,
+ ) -> PolicyDecision {
if !self.allowed.contains(&call.name) {
log::debug!(
"[agent::host_only] denied tool outside the host belt: {}",
@@ -90,8 +109,20 @@ pub(super) fn empty_belt() -> HashSet<String> {
pub(super) fn session_policy(
host_only: bool,
tools: &[Box<dyn tinytools::Tool>],
- host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,
-) -> Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>> {
+ host: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
+) -> Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+> {
if !host_only {
return host;
}
diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
index 2013b161f0..d2dac7f629 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
@@ -61,7 +61,13 @@ pub struct HostTurnTools {
/// enforce one through the session's tool policy.
pub withheld: HashSet<String>,
/// The session's admission gate, if the host sets one.
- pub policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,
+ pub policy: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
}
impl HostTurnTools {
@@ -170,7 +176,14 @@ impl HostTurnTools {
/// session should keep an existing policy for calls the host does not own,
/// the host composes the two and passes the result here.
#[must_use]
- pub fn with_policy(mut self, policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>) -> Self {
+ pub fn with_policy(
+ mut self,
+ policy: Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ ) -> Self {
self.policy = Some(policy);
self
}
@@ -189,7 +202,13 @@ impl HostTurnTools {
/// The parts of a host turn belt that the session builder applies after
/// expanding the agent's static scope.
pub(super) struct MergedHostTurnTools {
- pub policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,
+ pub policy: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
pub withheld: HashSet<String>,
pub permanent: HashSet<String>,
pub scope_additions: HashSet<String>,
diff --git a/crates/openhuman-core/src/agent/session_host/builder/setters.rs b/crates/openhuman-core/src/agent/session_host/builder/setters.rs
index 19ab57288e..93d4c4568e 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/setters.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/setters.rs
@@ -379,7 +379,14 @@ impl SessionHostBuilder {
///
/// The default policy allows all calls. Custom policies can deny a call
/// before `Tool::execute_with_options` runs.
- pub fn tool_policy(mut self, policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>) -> Self {
+ pub fn tool_policy(
+ mut self,
+ policy: Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ ) -> Self {
self.tool_policy = Some(policy);
self
}
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 15854cfd7b..a1abe4aef7 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -74,7 +74,11 @@ struct OpenHumanTurnPrelude {
/// Host prompt/utilisation state, shared by the runtime hooks. It is not
/// generic conversation state and the runtime never persists it.
context: Arc<std::sync::Mutex<crate::agent::context::ContextManager>>,
- tool_policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>,
+ tool_policy: Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
tool_dispatcher: Arc<dyn tinytools_agent::dialect::ToolDialect>,
workspace_dir: std::path::PathBuf,
action_dir: std::path::PathBuf,
@@ -278,9 +282,7 @@ impl OpenHumanTurnPrelude {
.filter(|spec| !withheld.contains(&spec.name))
.filter(|spec| {
self.thread_id.is_some()
- || !crate::agent::tinyagents::tool_registration::is_thread_goal_tool(
- &spec.name,
- )
+ || !crate::agent::tinyagents::tool_registration::is_thread_goal_tool(&spec.name)
})
.map(|spec| spec.as_ref().clone())
.collect::<Vec<_>>();
diff --git a/crates/openhuman-core/src/agent/session_host/tool_progress.rs b/crates/openhuman-core/src/agent/session_host/tool_progress.rs
index 73aa006c1a..3a8f8feaa9 100644
--- a/crates/openhuman-core/src/agent/session_host/tool_progress.rs
+++ b/crates/openhuman-core/src/agent/session_host/tool_progress.rs
@@ -9,9 +9,9 @@
use async_trait::async_trait;
-use tinyagents_harness::cost::TurnCost;
use crate::agent::progress::AgentProgress;
use crate::inference::provider::ProviderDelta;
+use tinyagents_harness::cost::TurnCost;
/// What the engine emits as a turn progresses. All methods default to no-ops so
/// an impl only overrides the events its flavor cares about.
diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rs
index d79fd77cca..e35e46fb9b 100644
--- a/crates/openhuman-core/src/agent/session_host/types.rs
+++ b/crates/openhuman-core/src/agent/session_host/types.rs
@@ -448,7 +448,11 @@ pub struct OpenHumanSessionHost {
/// Pre-execution policy hook for tool calls in this session. The
/// default policy allows all calls so existing agents keep their
/// behaviour unless a caller opts into stricter policy.
- pub(super) tool_policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>,
+ pub(super) tool_policy: Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
/// Hash of the Composio connection set this OpenHumanSessionHost last reconciled
/// against. Compared at top-of-turn to a fresh hash computed from
/// [`crate::integrations::composio::cached_active_integrations`]; on
@@ -633,7 +637,13 @@ pub struct SessionHostBuilder {
/// Per-agent TokenJuice tool-output compression profile.
pub(super) tokenjuice_compression: tinyjuice_bus::types::AgentTokenjuiceCompression,
/// Optional pre-execution tool policy. Defaults to allow-all.
- pub(super) tool_policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,
+ pub(super) tool_policy: Option<
+ Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
+ >,
}
impl Default for SessionHostBuilder {
diff --git a/crates/openhuman-core/src/agent/session_store/mod.rs b/crates/openhuman-core/src/agent/session_store/mod.rs
index 059a6eef56..72d2d6f42e 100644
--- a/crates/openhuman-core/src/agent/session_store/mod.rs
+++ b/crates/openhuman-core/src/agent/session_store/mod.rs
@@ -25,10 +25,10 @@ mod workspace;
pub use rebound::{rebind_all, ReboundSessionStores};
pub use workspace::{
- artifact_blobs_for, attachment_stash_for, current_documents_for, default_turn_states_for, ledger_for,
- provider_for_workspace, release_workspace_defaults, require_ledger, status_store_for,
- stores_for, stores_or_ephemeral, turn_states_for, with_ledger, with_ledger_async,
- WorkspaceSessionStores,
+ artifact_blobs_for, attachment_stash_for, current_documents_for, default_turn_states_for,
+ ledger_for, provider_for_workspace, release_workspace_defaults, require_ledger,
+ status_store_for, stores_for, stores_or_ephemeral, turn_states_for, with_ledger,
+ with_ledger_async, WorkspaceSessionStores,
};
static PROVIDER: LazyLock<RwLock<Option<Arc<dyn SessionStoreProvider>>>> =
diff --git a/crates/openhuman-core/src/agent/stop_hooks.rs b/crates/openhuman-core/src/agent/stop_hooks.rs
index a03d900765..02116dab85 100644
--- a/crates/openhuman-core/src/agent/stop_hooks.rs
+++ b/crates/openhuman-core/src/agent/stop_hooks.rs
@@ -19,8 +19,8 @@
//! The per-turn tool budget ([`tool_call_limit`]) also lives here; a host
//! narrows it through `HostTurnEnv::tool_call_limit`.
-use tinyagents_harness::cost::TurnCost;
use async_trait::async_trait;
+use tinyagents_harness::cost::TurnCost;
use tinyagents_harness::middleware::{StopDecision, StopHook, TurnState};
diff --git a/crates/openhuman-core/src/agent/stop_hooks_tests.rs b/crates/openhuman-core/src/agent/stop_hooks_tests.rs
index a7daa44065..c59b88eef5 100644
--- a/crates/openhuman-core/src/agent/stop_hooks_tests.rs
+++ b/crates/openhuman-core/src/agent/stop_hooks_tests.rs
@@ -14,7 +14,8 @@ fn host_tool_cap_only_narrows_the_default_and_keeps_zero() {
#[test]
fn host_tool_cap_and_stop_hooks_flow_into_the_run_context_and_its_children() {
- let hook: Arc<dyn StopHook<tinyagents_harness::cost::TurnCost>> = Arc::new(BudgetStopHook::new(1.0));
+ let hook: Arc<dyn StopHook<tinyagents_harness::cost::TurnCost>> =
+ Arc::new(BudgetStopHook::new(1.0));
let mut hooks = crate::agent::hooks::HookScope::default();
hooks.push_stop(Arc::clone(&hook));
let env = crate::agent::turn_env::HostTurnEnv {
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index ffada0ecdc..f9ff244012 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -57,14 +57,14 @@ mod steering_forwarder;
pub(crate) mod stop_hooks;
pub mod todos;
pub(crate) mod tool_registration;
+mod turn_exec;
+mod turn_middleware;
mod turn_models;
mod turn_outcome;
+mod turn_plan;
mod turn_policy;
mod turn_run_error;
mod turn_run_finalize;
-mod turn_exec;
-mod turn_middleware;
-mod turn_plan;
mod use_skill_dispatch;
mod verify_before_finish;
@@ -79,6 +79,7 @@ pub(crate) use middleware::{
};
pub(crate) use observability::SubagentScope;
pub(crate) use reasoning::{apply_requested_effort, parse_reasoning_effort};
+pub(crate) use turn_exec::{run_root_turn_via_hosted_agent, run_turn_via_tinyagents_shared};
pub use turn_models::TurnModelSource;
pub(crate) use turn_models::TurnModels;
pub(crate) use turn_outcome::TinyagentsTurnOutcome;
@@ -88,7 +89,6 @@ pub(crate) use turn_policy::{
agent_turn_wall_clock_ms_for, chat_provider_is_local, local_web_turn_backstop_secs,
ToolPolicyEnforcement,
};
-pub(crate) use turn_exec::{run_root_turn_via_hosted_agent, run_turn_via_tinyagents_shared};
// Test-only glue so `tinyagents_tests.rs`'s `use super::*;` sees the
// lower-level policy helpers it exercises directly (they otherwise stay
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index 6d3fadeac6..fe8f937f30 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@ -21,7 +21,11 @@ use crate::agent::tinyagents::budget::MAX_SPAWN_DEPTH;
/// paths, which carry their own gating).
#[derive(Clone)]
pub(crate) struct ToolPolicyEnforcement {
- pub policy: std::sync::Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>,
+ pub policy: std::sync::Arc<
+ dyn tinyagents_harness::middleware::ToolCallPolicy<
+ crate::agent::tinyagents::host::OpenHumanRunContext,
+ >,
+ >,
/// The session's channel-permission snapshot — enforces the per-channel
/// permission ceiling (deny + per-call permission-level gate) the in-house
/// engine ran in `agent_tool_exec`.
diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs
index 210bd1a88d..2680a01bec 100644
--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs
@@ -31,8 +31,8 @@ use tinyagents_harness::context::RunContext;
use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};
use tinytools::{Tool, ToolCallOptions, ToolResult};
-use super::tool_registration::typed_dispatch_for;
use super::host::OpenHumanRunContext;
+use super::tool_registration::typed_dispatch_for;
use crate::tools::toolpacks::registry::CATALOG;
use tinyagents_harness::tool::packs::{named_tool, PackRegistryHandle};
@@ -96,9 +96,8 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {
.get("args")
.cloned()
.unwrap_or_else(|| serde_json::json!({}));
- let Some(inner_adapter) =
- super::tool_registration::shared_tool_adapter(vec![tools], name)
- .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)
+ let Some(inner_adapter) = super::tool_registration::shared_tool_adapter(vec![tools], name)
+ .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)
else {
// Freeze the not-found result too: a target appearing after
// authorization must not turn a rejected call into an execution.
@@ -167,9 +166,8 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {
// adapter is equivalent to the one that would have been registered
// had the model reached `name` directly instead of through
// `use_skill`.
- let Some(inner_adapter) =
- super::tool_registration::shared_tool_adapter(vec![tools], &name)
- .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)
+ let Some(inner_adapter) = super::tool_registration::shared_tool_adapter(vec![tools], &name)
+ .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)
else {
return self
.tool
diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
index b89b14005b..555701d00d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
@@ -135,11 +135,8 @@ fn build_use_skill_dispatch_with_handle() -> (UseSkillDispatch, PackRegistryHand
let durable: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![use_skill_tool, create_image_tool]);
handle.bind(Arc::downgrade(&durable));
- let adapter = shared_tool_adapter(
- vec![durable],
- tinyagents_harness::tool::packs::USE_SKILL,
- )
- .expect("use_skill resolves in the durable registry it was just placed in");
+ let adapter = shared_tool_adapter(vec![durable], tinyagents_harness::tool::packs::USE_SKILL)
+ .expect("use_skill resolves in the durable registry it was just placed in");
(
UseSkillDispatch::new(Arc::new(adapter), handle.clone()),
handle,