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 turn code

Steven Enamakel0ad7ec91d98c
diff --git a/crates/openhuman-core/src/agent/cost_tests.rs b/crates/openhuman-core/src/agent/cost_tests.rs
index 0f0ff84601..2cd6f281b7 100644
--- a/crates/openhuman-core/src/agent/cost_tests.rs
+++ b/crates/openhuman-core/src/agent/cost_tests.rs
@@ -1,5 +1,5 @@
-use tinyagents_harness::cost::CostSource;
use super::*;
+use tinyagents_harness::cost::CostSource;
fn counts(input: u64, output: u64, cached: u64) -> BilledUsage {
BilledUsage::from_counts(input, output).with_cached_input_tokens(cached)
diff --git a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
index 5f7c96e4fd..abb83de780 100644
--- a/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
+++ b/crates/openhuman-core/src/agent/orchestration/spawn_parallel/collect.rs
@@ -117,7 +117,9 @@ pub(crate) async fn project_spawn_parallel_result(
// An incomplete worker was stopped early (breaker /
// cap); its span closes at WARNING with that stop.
stop: matches!(result.status, ParallelAgentStatus::Incomplete).then(|| {
- crate::agent::turn_projection::stop_from_incomplete(error.as_deref().unwrap_or(""))
+ crate::agent::turn_projection::stop_from_incomplete(
+ error.as_deref().unwrap_or(""),
+ )
}),
})
.await
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
index 193674b87b..a4d43d633f 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
@@ -78,9 +78,7 @@ pub(crate) fn incomplete_envelope(
/// How a sub-agent handed back as `Incomplete { reason }` was stopped
/// (iteration cap or failure breaker), for its `SubagentCompleted` event.
pub(crate) fn incomplete_stop(reason: &str) -> Option<tinyagents_harness::turn_stop::TurnStop> {
- Some(crate::agent::turn_projection::stop_from_incomplete(
- reason,
- ))
+ Some(crate::agent::turn_projection::stop_from_incomplete(reason))
}
/// The parent's tool result for a sub-agent the harness stopped early: a
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
index 3004968152..727656d92e 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
@@ -5,9 +5,9 @@
use super::*;
-use tinyagents_harness::turn_stop::TurnStop;
use tinyagents_harness::observability::trace_export::otlp::otlp_requests;
use tinyagents_harness::observability::trace_export::SpanStatus;
+use tinyagents_harness::turn_stop::TurnStop;
const BREAKER_NOTE: &str = "Stopping after 2 attempt(s): failure class \
`uncertain_side_effect` still blocks operation `web_answer_tool` on \
@@ -167,7 +167,10 @@ fn a_stopped_subagent_span_closes_at_warning_with_stop_attributes() {
(AgentProgress::TurnStarted, 0),
(spawn("t-stop", "Research"), 5),
(
- subagent_completed("t-stop", Some(crate::agent::turn_projection::breaker_stop(BREAKER_NOTE))),
+ subagent_completed(
+ "t-stop",
+ Some(crate::agent::turn_projection::breaker_stop(BREAKER_NOTE)),
+ ),
40,
),
]);
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
index 62b1cc3f80..406f0c9d23 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs
@@ -3,13 +3,13 @@
//! events, and error sanitisation.
use super::super::types::OpenHumanSessionHost;
-use tinyagents_harness::agent_error::AgentError;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
use crate::security::prompt_injection::{
enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,
};
use anyhow::Result;
+use tinyagents_harness::agent_error::AgentError;
impl OpenHumanSessionHost {
// ─────────────────────────────────────────────────────────────────
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
index 55830c155c..e89c1e2c04 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
@@ -2,8 +2,8 @@
//! sanitisation, and tool-call id fallback / persistence shaping.
use super::super::types::OpenHumanSessionHost;
-use tinyagents_harness::agent_error::AgentError;
use crate::util::truncate_with_ellipsis;
+use tinyagents_harness::agent_error::AgentError;
use tinytools_agent::dialect::TranscriptEntry;
impl OpenHumanSessionHost {
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
index 1f4b4b73b9..545b734f26 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
@@ -70,10 +70,11 @@ async fn committed_progress_carries_the_sidecar_stop_on_turn_completed() {
let (tx, mut rx) = tokio::sync::mpsc::channel(4);
let mut context = crate::agent::tinyagents::host::OpenHumanRunContext::new();
context.progress = Some(tx);
- context.session_sidecar.lock().unwrap().stop = Some(crate::agent::turn_projection::breaker_stop(
- "Stopping after 2 attempt(s): failure class `uncertain_side_effect` still blocks \
+ context.session_sidecar.lock().unwrap().stop =
+ Some(crate::agent::turn_projection::breaker_stop(
+ "Stopping after 2 attempt(s): failure class `uncertain_side_effect` still blocks \
operation `web_answer_tool` on `x`. Resolve this blocker before retrying.",
- ));
+ ));
let receipt = CommitReceipt {
outcome: SessionTurnOutcome {
history: Vec::new(),
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
index 04ffeffeaf..044705a629 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
@@ -405,7 +405,9 @@ pub(in super::super) async fn run_subagent_via_graph(
.with_cache_creation_tokens(u.cache_creation_tokens)
.with_reasoning_tokens(u.reasoning_tokens);
let billed = match call_cost {
- tinyagents_harness::cost::CallCost::Charged(usd) => billed.with_charged_usd(usd),
+ tinyagents_harness::cost::CallCost::Charged(usd) => {
+ billed.with_charged_usd(usd)
+ }
tinyagents_harness::cost::CallCost::Estimated(usd) => {
billed.with_estimated_usd(usd)
}
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
index 8906630776..d520e88c45 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
@@ -81,9 +81,15 @@ pub(super) fn persist_subagent_transcript(
context_window,
cost_usd: usage.cost.known_usd,
cost_source: Some(match usage.cost.source {
- tinyagents_harness::cost::CostSource::Charged => transcript::UsageCostSource::Charged,
- tinyagents_harness::cost::CostSource::Estimated => transcript::UsageCostSource::Estimated,
- tinyagents_harness::cost::CostSource::Unknown => transcript::UsageCostSource::Unknown,
+ tinyagents_harness::cost::CostSource::Charged => {
+ transcript::UsageCostSource::Charged
+ }
+ tinyagents_harness::cost::CostSource::Estimated => {
+ transcript::UsageCostSource::Estimated
+ }
+ tinyagents_harness::cost::CostSource::Unknown => {
+ transcript::UsageCostSource::Unknown
+ }
}),
// No per-call figure reaches here; readers fall back to the mean
// request size (`spend::context_tokens_of`).
diff --git a/crates/openhuman-core/src/agent/subagent_host/types_tests.rs b/crates/openhuman-core/src/agent/subagent_host/types_tests.rs
index 4d1cbcd721..4bc42bb7fa 100644
--- a/crates/openhuman-core/src/agent/subagent_host/types_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/types_tests.rs
@@ -7,7 +7,10 @@ fn legacy_subagent_usage_keeps_its_wire_shape_and_does_not_claim_a_charge() {
"cached_input_tokens": 1, "charged_amount_usd": 0.5,
});
let mut usage: SubagentUsage = serde_json::from_value(raw.clone()).unwrap();
- assert_eq!(usage.cost_source, tinyagents_harness::cost::CostSource::Unknown);
+ assert_eq!(
+ usage.cost_source,
+ tinyagents_harness::cost::CostSource::Unknown
+ );
assert_eq!(usage.cost().usd(), None);
assert_eq!(serde_json::to_value(usage).unwrap(), raw);
usage.cost_source = tinyagents_harness::cost::CostSource::Charged;
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
index 9677466e00..edb933ea90 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
@@ -30,15 +30,15 @@ use crate::agent::tinyagents::routes;
use crate::agent::tinyagents::stop_hooks;
use crate::agent::tinyagents::tools::EarlyExitHook;
use crate::agent::tinyagents::turn_models::TurnModels;
-use tinyagents_harness::turn_outcome::{HaltSummarySlot, ToolOutcomeSink};
use crate::agent::tinyagents::turn_policy::run_policy_for_provider;
-use tinyagents_harness::turn_policy::REPEATED_TOOL_FAILURE_THRESHOLD;
use crate::agent::tinyagents::verify_before_finish;
use tinyagents_harness::middleware::{
install_unmet_deliverable, is_repeat_call_exempt, tool_sets_lookup, ResearchBudgetMiddleware,
ShellTurnBudget, TurnClockMiddleware, DIRECT_WEB_READ_LIMIT,
};
use tinyagents_harness::store::InMemoryStore as ToolResultArtifactIndexStore;
+use tinyagents_harness::turn_outcome::{HaltSummarySlot, ToolOutcomeSink};
+use tinyagents_harness::turn_policy::REPEATED_TOOL_FAILURE_THRESHOLD;
use tinyinference_llm::model::ErrorSlotModel;
use super::ToolPolicyEnforcement;
@@ -560,7 +560,9 @@ pub(super) fn assemble_turn_harness(
// has; a run with nothing but web tools answers instead. Sub-agent runs
// keep their own budgets and are not narrowed here.
if subagent_scope.is_none() {
- harness.push_middleware(Arc::new(ResearchBudgetMiddleware::with_limit(DIRECT_WEB_READ_LIMIT)));
+ harness.push_middleware(Arc::new(ResearchBudgetMiddleware::with_limit(
+ DIRECT_WEB_READ_LIMIT,
+ )));
}
// SDK-owned tool-policy projection (issue #4249 / tinyagents-full-migration
// 01.1). Keep this narrow for now: enforce sandbox requirements declared by
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
index f31aba546f..a2f156cfdb 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
@@ -2,11 +2,11 @@
//! shared tools end up registered on the assembled harness.
use super::*;
+use crate::agent::tinyagents::TurnModelSource;
+use async_trait::async_trait;
use tinyagents_harness::turn_policy::{
DEFAULT_MODEL_CALL_TIMEOUT_SECS, LOCAL_MODEL_CALL_TIMEOUT_SECS,
};
-use crate::agent::tinyagents::TurnModelSource;
-use async_trait::async_trait;
use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};
use tinytools::{Tool, ToolResult};
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 a75c2a3db6..160e23b066 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -19,14 +19,12 @@ use tokio::sync::mpsc::Sender;
use crate::agent::harness::fork_context::{AgentContextPreparedSource, ParentExecutionContext};
use crate::agent::progress::AgentProgress;
use crate::agent::subagent_host::SubagentUsage;
-use tinyagents_harness::turn_outcome::{ToolCallOutcome, ToolOutcomeSink};
-use crate::agent::tinyagents::{
- turn_policy::ToolPolicyEnforcement, TurnContextMiddleware,
-};
+use crate::agent::tinyagents::{turn_policy::ToolPolicyEnforcement, TurnContextMiddleware};
use crate::agent::turn_origin::AgentTurnOrigin;
use tinyagents_definition::SandboxMode;
use tinyagents_harness::middleware::StopHook;
use tinyagents_harness::store::InMemoryStore as ToolResultArtifactIndexStore;
+use tinyagents_harness::turn_outcome::{ToolCallOutcome, ToolOutcomeSink};
use tinyinference_llm::model::ResolvedModelRoute;
/// Allocate a durable-unique root [`RunConfig`](tinyagents_harness::context::RunConfig).
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 c29df051b0..89b43638f9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
@@ -17,8 +17,8 @@ use tinyinference_llm::model::{ModelRequest, ModelResponse, ResolvedModelRoute};
use tinytools::{ToolPolicy as TaToolPolicy, ToolResult as TaToolResult};
use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;
-use tinyagents_harness::turn_outcome::ToolCallOutcome;
use tinyagents_harness::artifacts::tool_results::ToolResultArtifactStore;
+use tinyagents_harness::turn_outcome::ToolCallOutcome;
use tinyjuice_bus::types::AgentTokenjuiceCompression;
use super::tool_output::ToolOutputMiddleware;
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
index 7c5203be60..333511eb9a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_policy_class_tests.rs
@@ -9,12 +9,12 @@
//! real names must keep their retryable timeouts from the side-effect
//! reading alone.
-#[cfg(feature = "modules")]
-use tinyagents_harness::middleware::{call_effect, tool_sets_lookup, CallEffect};
#[cfg(feature = "modules")]
use super::super::failure_policy::recovery_policy_with_effect;
use super::super::repeated_failure::recovery_policy;
use super::*;
+#[cfg(feature = "modules")]
+use tinyagents_harness::middleware::{call_effect, tool_sets_lookup, CallEffect};
/// The shape of a production refusal: the gate's marker, then its reason.
const SHELL_BLOCK: &str =
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
index b41c7e68cc..4b4a41a813 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -383,7 +383,9 @@ impl OpenhumanEventBridge {
.with_reasoning_tokens(reasoning_tokens);
let usage_info = match cost {
tinyagents_harness::cost::CallCost::Charged(usd) => usage_info.with_charged_usd(usd),
- tinyagents_harness::cost::CallCost::Estimated(usd) => usage_info.with_estimated_usd(usd),
+ tinyagents_harness::cost::CallCost::Estimated(usd) => {
+ usage_info.with_estimated_usd(usd)
+ }
tinyagents_harness::cost::CallCost::Unknown => usage_info,
};
if reasoning_tokens > 0 || cache_creation_tokens > 0 {
diff --git a/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs b/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
index 5125b99b2a..2396e0a76b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/stop_hooks_tests.rs
@@ -2,7 +2,8 @@ use super::*;
#[test]
fn a_poisoned_halt_summary_does_not_abort_stop_reporting() {
- let slot: tinyagents_harness::turn_outcome::HaltSummarySlot = Arc::new(std::sync::Mutex::new(None));
+ let slot: tinyagents_harness::turn_outcome::HaltSummarySlot =
+ Arc::new(std::sync::Mutex::new(None));
let poisoned = Arc::clone(&slot);
assert!(std::thread::spawn(move || {
let _guard = poisoned.lock().unwrap();
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs
index 9e8a540bbf..36d0602f09 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_outcome.rs
@@ -1,9 +1,9 @@
//! The outcome type a `tinyagents`-driven turn produces, plus the shared
//! sinks middleware write into to build it.
+use tinyagents_harness::turn_outcome::ToolCallOutcome;
use tinyagents_session::transcript::TranscriptMessage;
use tinyinference_llm::model::ResolvedModelRoute;
-use tinyagents_harness::turn_outcome::ToolCallOutcome;
use tinytools_agent::dialect::TranscriptEntry;
/// The outcome of a turn driven on the `tinyagents` harness.
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index 87d1e75df5..298b9c3874 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@ -85,7 +85,10 @@ pub(crate) fn local_openai_endpoint(config: &crate::config::Config) -> Option<St
/// local provider when `local`. `OPENHUMAN_AGENT_TURN_TIMEOUT_SECS` still wins;
/// `0` means "no ceiling" and yields `None`.
pub(crate) fn agent_turn_wall_clock_ms_for(local: bool) -> Option<u64> {
- turn_wall_clock_ms(env_str("OPENHUMAN_AGENT_TURN_TIMEOUT_SECS").as_deref(), local)
+ turn_wall_clock_ms(
+ env_str("OPENHUMAN_AGENT_TURN_TIMEOUT_SECS").as_deref(),
+ local,
+ )
}
/// Outer web-turn backstop for a turn on a local provider (#6042): the local
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_error.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_error.rs
index f34eaa75c9..ae39e58fc9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_error.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_error.rs
@@ -39,9 +39,11 @@ pub(super) async fn map_turn_run_error(
model,
"[tinyagents] run hit the model-call cap; mapping to MaxIterationsExceeded (not consulting error_slot) — #4457 defect B"
);
- return anyhow::Error::new(tinyagents_harness::agent_error::AgentError::MaxIterationsExceeded {
- max: max_iterations,
- });
+ return anyhow::Error::new(
+ tinyagents_harness::agent_error::AgentError::MaxIterationsExceeded {
+ max: max_iterations,
+ },
+ );
}
RunFailureKind::DepthLimit { max_depth } => {
return anyhow::Error::new(
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
index 074df2eaa0..9a0c2f3fa0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -164,7 +164,8 @@ pub(super) async fn finalize_turn_outcome(
// A run the harness stopped (breaker / cap) is traced as stopped, not as a
// clean completion. No deadline wind-down on this path: only the session
// turn carries one, and it records the stop through its sidecar.
- let stop = crate::agent::turn_projection::classify_stop(breaker_halt.as_deref(), false, hit_cap);
+ let stop =
+ crate::agent::turn_projection::classify_stop(breaker_halt.as_deref(), false, hit_cap);
if let Some(stop) = stop.as_ref().filter(|_| turn_completed_sink.is_some()) {
tracing::debug!(
model,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index f0abe22fd3..2b69ce725a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -10,9 +10,9 @@ use std::sync::Arc;
use anyhow::Result;
use futures::StreamExt;
use tinyagents_harness::agent_loop::AgentStreamItem;
-use tinyagents_harness::turn_policy::effective_max_iterations;
use tinyagents_harness::runtime::{AgentInvocation, AgentTurnRequest, InvocationRuntime};
use tinyagents_harness::store::StoreRegistry;
+use tinyagents_harness::turn_policy::effective_max_iterations;
use tinyagents_registry::DiagnosticSeverity;
use crate::agent::harness::tool_result_artifacts::TINYAGENTS_TOOL_RESULT_ARTIFACT_STORE;
diff --git a/crates/openhuman-core/src/agent/turn_projection.rs b/crates/openhuman-core/src/agent/turn_projection.rs
index 44c674079f..a51564948a 100644
--- a/crates/openhuman-core/src/agent/turn_projection.rs
+++ b/crates/openhuman-core/src/agent/turn_projection.rs
@@ -5,8 +5,8 @@
//! mapping of a stop note without a failure class to its stop-reason key
//! ([`StopReasonKind`](crate::agent::session_host::stop_summary::StopReasonKind)).
-use tinyagents_harness::cost::CostSource;
use crate::agent::tinyagents::host::LastTurnUsage;
+use tinyagents_harness::cost::CostSource;
use tinyagents_harness::middleware::ResponseUsage;
use tinyagents_harness::turn_stop::TurnStop;
diff --git a/crates/openhuman-core/src/agent/turn_projection_tests.rs b/crates/openhuman-core/src/agent/turn_projection_tests.rs
index 7276fe8d6d..a89279b3c7 100644
--- a/crates/openhuman-core/src/agent/turn_projection_tests.rs
+++ b/crates/openhuman-core/src/agent/turn_projection_tests.rs
@@ -16,7 +16,9 @@ fn a_classified_breaker_note_keeps_its_class_and_drops_its_scope() {
#[test]
fn an_unclassified_breaker_note_falls_back_to_its_stop_reason_kind() {
- let stop = breaker_stop("The last 6 tool calls in a row failed. Last error: token sk-live-123 rejected");
+ let stop = breaker_stop(
+ "The last 6 tool calls in a row failed. Last error: token sk-live-123 rejected",
+ );
assert_eq!(stop.kind, TurnStopKind::Breaker);
assert_eq!(stop.failure_class.as_deref(), Some("varied_failures"));
assert_eq!(stop.status_message(), "stopped: breaker varied_failures");
@@ -60,7 +62,12 @@ fn reported_usage_projects_as_charged_only_with_a_cost() {
assert_eq!(charged.cost_source, CostSource::Charged);
assert_eq!(charged.cost_usd, Some(0.007));
assert_eq!(
- (charged.input_tokens, charged.output_tokens, charged.cached_input_tokens, charged.reasoning_tokens),
+ (
+ charged.input_tokens,
+ charged.output_tokens,
+ charged.cached_input_tokens,
+ charged.reasoning_tokens
+ ),
(10, 5, 3, 2)
);
assert_eq!(
diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rs
index c42c155dce..f0821295c7 100644
--- a/crates/openhuman-core/src/cron/scheduler_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs
@@ -1,10 +1,10 @@
use super::*;
-use tinyagents_harness::agent_error::AgentError;
use crate::config::Config;
use crate::security::SecurityPolicy;
use chrono::{Duration as ChronoDuration, Timelike, Utc};
use std::sync::Arc;
use tempfile::TempDir;
+use tinyagents_harness::agent_error::AgentError;
use tinyflows_schedule::types::JobType;
use tinyflows_schedule::types::SessionTarget;
use {
diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rs
index a3c3d7752a..853ac50910 100644
--- a/crates/openhuman-embed/src/turn.rs
+++ b/crates/openhuman-embed/src/turn.rs
@@ -497,7 +497,8 @@ mod futures_box {
struct AgentTurnOptions {
tools: Option<openhuman_core::agent::HostTools>,
shape: std::sync::Arc<ResponseShapeScope>,
- observer: Option<std::sync::Arc<tinyagents_harness::observability::turn_observer::ObserverScope>>,
+ observer:
+ Option<std::sync::Arc<tinyagents_harness::observability::turn_observer::ObserverScope>>,
untrusted_input: bool,
attachments: Vec<openhuman_core::agent::HostAttachment>,
}
diff --git a/crates/openhuman-embed/src/turn_control.rs b/crates/openhuman-embed/src/turn_control.rs
index 8f5b5098b0..1fc3852b2d 100644
--- a/crates/openhuman-embed/src/turn_control.rs
+++ b/crates/openhuman-embed/src/turn_control.rs
@@ -348,7 +348,10 @@ impl Turn {
.map(crate::complete::ResponseFormat::into_wire),
max_output_tokens: self.max_tokens,
top_p: self.top_p,
- validator: wants_json.then(|| std::sync::Arc::new(validator) as std::sync::Arc<dyn tinyagents_harness::middleware::ResponseValidator>),
+ validator: wants_json.then(|| {
+ std::sync::Arc::new(validator)
+ as std::sync::Arc<dyn tinyagents_harness::middleware::ResponseValidator>
+ }),
structured_retries: self.structured_retries,
provider_options: self.provider_options.clone(),
require_tool_call: self.require_tool_call,
diff --git a/crates/openhuman-embed/tests/unit/turn_usage.rs b/crates/openhuman-embed/tests/unit/turn_usage.rs
index 98a9c11e2a..c116a4f746 100644
--- a/crates/openhuman-embed/tests/unit/turn_usage.rs
+++ b/crates/openhuman-embed/tests/unit/turn_usage.rs
@@ -26,7 +26,8 @@ fn reported_root_usage_preserves_children_and_session_context_without_double_cou
output_tokens: 8,
cached_input_tokens: 4,
charged_amount_usd: 0.003,
- cost_source: openhuman_core::agent::turn_projection::failure_usage(&report).cost_source,
+ cost_source: openhuman_core::agent::turn_projection::failure_usage(&report)
+ .cost_source,
},
}],
..Default::default()
@@ -48,7 +49,8 @@ fn reported_root_usage_preserves_children_and_session_context_without_double_cou
assert_eq!(usage.subagents.len(), 1);
}
captured.as_mut().unwrap().subagents[0].usage.cost_source =
- openhuman_core::agent::turn_projection::failure_usage(&ResponseUsage::default()).cost_source;
+ openhuman_core::agent::turn_projection::failure_usage(&ResponseUsage::default())
+ .cost_source;
overlay_response_usage(&mut captured, &report);
assert_eq!(captured.as_ref().unwrap().cost_usd, None);
assert_eq!(captured.as_ref().unwrap().input_tokens, 30);