The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: apply rustfmt formatting across core crate
Steven Enamakelcb5e7f6daeae
diff --git a/crates/openhuman-core/src/agent/artifacts/files_tests.rs b/crates/openhuman-core/src/agent/artifacts/files_tests.rsindex 8c8f94f3bc..210ad49076 100644--- a/crates/openhuman-core/src/agent/artifacts/files_tests.rs+++ b/crates/openhuman-core/src/agent/artifacts/files_tests.rs@@ -15,9 +15,16 @@ async fn create_ready(title: &str,bytes: &[u8],) -> ArtifactMeta {- let (meta, path) = create_artifact(workspace, files_dir, ArtifactKind::Document, title, "txt", None)- .await- .expect("create_artifact");+ let (meta, path) = create_artifact(+ workspace,+ files_dir,+ ArtifactKind::Document,+ title,+ "txt",+ None,+ )+ .await+ .expect("create_artifact");tokio::fs::write(&path, bytes).await.unwrap();finalize_artifact(workspace, &meta.id, bytes.len() as u64, None).awaitdiff --git a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs b/crates/openhuman-core/src/agent/artifacts/ops_tests.rsindex 98d718df8b..fc06e97353 100644--- a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs+++ b/crates/openhuman-core/src/agent/artifacts/ops_tests.rs@@ -371,7 +371,9 @@ async fn get_returns_the_files_folder_path() {.await.unwrap();std::fs::write(&path, b"plan").unwrap();- finalize_artifact(tmp.path(), &meta.id, 4, None).await.unwrap();+ finalize_artifact(tmp.path(), &meta.id, 4, None)+ .await+ .unwrap();let value = ai_get_artifact(&config, &meta.id).await@@ -403,7 +405,9 @@ async fn get_reports_a_ready_file_removed_outside_openhuman() {.await.unwrap();std::fs::write(&path, b"plan").unwrap();- finalize_artifact(tmp.path(), &meta.id, 4, None).await.unwrap();+ finalize_artifact(tmp.path(), &meta.id, 4, None)+ .await+ .unwrap();std::fs::remove_file(&path).unwrap();let err = ai_get_artifact(&config, &meta.id).await.unwrap_err();diff --git a/crates/openhuman-core/src/agent/artifacts/store.rs b/crates/openhuman-core/src/agent/artifacts/store.rsindex b0d8373c87..b7a1918e9d 100644--- a/crates/openhuman-core/src/agent/artifacts/store.rs+++ b/crates/openhuman-core/src/agent/artifacts/store.rs@@ -580,7 +580,9 @@ pub async fn fail_artifact(/// non-chat callers (CLI, cron, sub-agent runners) so artifact emit hooks/// degrade gracefully: the event is still published but the web subscriber/// drops it for lack of a routing target.-fn chat_route(chat: Option<&ApprovalChatContext>) -> (Option<String>, Option<String>, Option<String>) {+fn chat_route(+ chat: Option<&ApprovalChatContext>,+) -> (Option<String>, Option<String>, Option<String>) {match chat {Some(ctx) => (Some(ctx.thread_id.clone()),diff --git a/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs b/crates/openhuman-core/src/agent/attachments/mod_access_tests.rsindex 243048c1f8..21ef4eea0e 100644--- a/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs@@ -77,7 +77,7 @@ async fn direct_upload_requires_runtime_authority_and_external_input_cannot_creaasync fn delegation_rejects_malformed_explicit_paths_and_external_reads_before_configuration() {assert_eq!(delegation_prompt(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"mention picture.png in prose",&serde_json::json!({}),None,@@ -95,7 +95,7 @@ async fn delegation_rejects_malformed_explicit_paths_and_external_reads_before_cserde_json::json!(["picture\u{0}.png"]),] {assert!(delegation_prompt(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"task",&serde_json::json!({"image_paths": image_paths}),None,@@ -105,7 +105,7 @@ async fn delegation_rejects_malformed_explicit_paths_and_external_reads_before_c.is_err());}let error = delegation_prompt(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"task",&serde_json::json!({"image_paths": ["picture.png"]}),None,diff --git a/crates/openhuman-core/src/agent/goals/runtime_tests.rs b/crates/openhuman-core/src/agent/goals/runtime_tests.rsindex 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/harness/graph.rs b/crates/openhuman-core/src/agent/harness/graph.rsindex 0b5625f9f9..75e4898587 100644--- a/crates/openhuman-core/src/agent/harness/graph.rs+++ b/crates/openhuman-core/src/agent/harness/graph.rs@@ -105,10 +105,7 @@ pub(crate) async fn run_channel_turn_via_graph(anyhow::bail!("attachments are disabled for this channel input");}if attachment_config.is_none() {- let mut config = dispatch- .load_config()- .await- .map_err(anyhow::Error::msg)?;+ let mut config = dispatch.load_config().await.map_err(anyhow::Error::msg)?;config.multimodal = multimodal.clone();config.multimodal_files = multimodal_files.clone();attachment_config = Some(config);@@ -144,8 +141,8 @@ pub(crate) async fn run_channel_turn_via_graph("[channel:graph] routing channel turn through tinyagents harness");let turn_origin = origin.clone();- let mut run_context = crate::agent::tinyagents::host::OpenHumanRunContext::new()- .with_core(dispatch.into_core());+ let mut run_context =+ crate::agent::tinyagents::host::OpenHumanRunContext::new().with_core(dispatch.into_core());run_context.origin = origin;run_context.approval = approval;run_context.memory_identity = Some(memory_identity);diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rsindex 78f0d4f1fa..f0c4f187da 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs@@ -29,8 +29,8 @@ use std::path::{Path, PathBuf};use std::sync::Arc;use serde_json::Value;-use tinystoragedrivers::BlobStore;use tinyagents_harness::artifacts::tool_results::{self, ArtifactRead, ToolResultArtifactStore};+use tinystoragedrivers::BlobStore;use crate::agent::harness::artifact_offload::{SanitizingRedactor, READ_TOOL};use tinytools_std::filesystem::FileReadTool;diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rsindex 4828497bc5..17d69363ae 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs@@ -37,7 +37,10 @@ async fn threshold_persists_to_blobs_and_file_read_serves_the_key() {assert!(out.contains(&format!("artifact_path: {key}\n")), "{out}");assert!(out.contains("[preview]"));assert!(!out.contains(secret));- assert!(!root.exists(), "nothing is on disk until a read asks for it");+ assert!(+ !root.exists(),+ "nothing is on disk until a read asks for it"+ );assert_eq!(std::fs::read_dir(&project).unwrap().count(), 0);// The model's `file_read {"path": key}` is recognised and pointed at the@@ -46,7 +49,10 @@ async fn threshold_persists_to_blobs_and_file_read_serves_the_key() {let read = artifact_read_target(Some(&store), "file_read", &args).expect("artifact read");store.resolve_read(&mut args, &read).await;let pointer = args["path"].as_str().unwrap().to_string();- assert_eq!(std::path::Path::new(&pointer), root.join("session_one/shell/call-1.txt"));+ assert_eq!(+ std::path::Path::new(&pointer),+ root.join("session_one/shell/call-1.txt")+ );let cfg = crate::config::AutonomyConfig {enabled: true,diff --git a/crates/openhuman-core/src/agent/hooks_scope.rs b/crates/openhuman-core/src/agent/hooks_scope.rsindex 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/multimodal_attachment_handling_tests.rs b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rsindex fd8417bce8..3f772e6b0d 100644--- a/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs+++ b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs@@ -19,7 +19,9 @@ async fn prepare_messages_handles_mixed_image_and_file_markers() {txt_path.display()))];- let prepared = prepare_messages_for_provider(&DispatchCtx::ambient(), &messages,+ let prepared = prepare_messages_for_provider(+ &DispatchCtx::ambient(),+ &messages,&MultimodalConfig::default(),&MultimodalFileConfig::default(),)@@ -93,9 +95,14 @@ async fn prepare_messages_rejects_absolute_file_marker_under_untrusted_channel_clet messages = vec![TranscriptMessage::user("please summarise [FILE:/etc/passwd]".to_string(),)];- let err = prepare_messages_for_provider(&DispatchCtx::ambient(), &messages, &MultimodalConfig::default(), &cfg)- .await- .expect_err("absolute file marker on a channel turn must be rejected");+ let err = prepare_messages_for_provider(+ &DispatchCtx::ambient(),+ &messages,+ &MultimodalConfig::default(),+ &cfg,+ )+ .await+ .expect_err("absolute file marker on a channel turn must be rejected");assert!(err.to_string().contains("multimodal file limit exceeded"),"expected TooManyFiles, got {err}"@@ -111,9 +118,14 @@ async fn prepare_messages_rejects_relative_file_marker_under_untrusted_channel_clet messages = vec![TranscriptMessage::user("what does [FILE:./relative.txt] say?".to_string(),)];- let err = prepare_messages_for_provider(&DispatchCtx::ambient(), &messages, &MultimodalConfig::default(), &cfg)- .await- .expect_err("relative file marker on a channel turn must be rejected");+ let err = prepare_messages_for_provider(+ &DispatchCtx::ambient(),+ &messages,+ &MultimodalConfig::default(),+ &cfg,+ )+ .await+ .expect_err("relative file marker on a channel turn must be rejected");assert!(err.to_string().contains("multimodal file limit exceeded"),"expected TooManyFiles, got {err}"@@ -127,9 +139,14 @@ async fn prepare_messages_under_untrusted_channel_config_passes_plain_text_throu// ordinary channel chatter.let cfg = MultimodalFileConfig::for_untrusted_channel_input();let messages = vec![TranscriptMessage::user("hello, how are you?".to_string())];- let prepared = prepare_messages_for_provider(&DispatchCtx::ambient(), &messages, &MultimodalConfig::default(), &cfg)- .await- .expect("plain channel text must pass through the hardened config");+ let prepared = prepare_messages_for_provider(+ &DispatchCtx::ambient(),+ &messages,+ &MultimodalConfig::default(),+ &cfg,+ )+ .await+ .expect("plain channel text must pass through the hardened config");assert!(!prepared.contains_files);assert!(!prepared.contains_images);assert_eq!(prepared.messages.len(), 1);@@ -141,7 +158,12 @@ async fn prepare_messages_under_untrusted_channel_config_passes_plain_text_throuasync fn inline_file_attachments_replaces_marker_with_extracted_text() {// base64("hello world") = aGVsbG8gd29ybGQ=let msg = "summarize [FILE:data:text/plain;base64,aGVsbG8gd29ybGQ=]";- let out = inline_file_attachments(&DispatchCtx::ambient(), msg, &MultimodalFileConfig::default()).await;+ let out = inline_file_attachments(+ &DispatchCtx::ambient(),+ msg,+ &MultimodalFileConfig::default(),+ )+ .await;assert!(out.contains("[FILE-EXTRACTED"),"extracted block present: {out}"@@ -157,7 +179,12 @@ async fn inline_file_attachments_replaces_marker_with_extracted_text() {#[tokio::test]async fn inline_file_attachments_noop_without_marker() {let msg = "just a normal message";- let out = inline_file_attachments(&DispatchCtx::ambient(), msg, &MultimodalFileConfig::default()).await;+ let out = inline_file_attachments(+ &DispatchCtx::ambient(),+ msg,+ &MultimodalFileConfig::default(),+ )+ .await;assert_eq!(out, msg);}@@ -209,7 +236,9 @@ async fn image_placeholder_rehydrates_to_inline_data_uri_for_provider() {// Round-trip: the provider prep step re-reads the file back into a data URI,// so the model still receives inline image bytes.- let prepared = prepare_messages_for_provider(&DispatchCtx::ambient(), &rehydrated,+ let prepared = prepare_messages_for_provider(+ &DispatchCtx::ambient(),+ &rehydrated,&MultimodalConfig::default(),&MultimodalFileConfig::default(),)diff --git a/crates/openhuman-core/src/agent/multimodal_marker_extraction_tests.rs b/crates/openhuman-core/src/agent/multimodal_marker_extraction_tests.rsindex 37c9b472fa..da8fd5e366 100644--- a/crates/openhuman-core/src/agent/multimodal_marker_extraction_tests.rs+++ b/crates/openhuman-core/src/agent/multimodal_marker_extraction_tests.rs@@ -12,9 +12,14 @@ async fn prepare_messages_rejects_too_many_images() {allow_remote_fetch: false,};- let error = prepare_messages_for_provider(&crate::core::runtime::DispatchCtx::ambient(), &messages, &config, &MultimodalFileConfig::default())- .await- .expect_err("should reject image count overflow");+ let error = prepare_messages_for_provider(+ &crate::core::runtime::DispatchCtx::ambient(),+ &messages,+ &config,+ &MultimodalFileConfig::default(),+ )+ .await+ .expect_err("should reject image count overflow");assert!(error.to_string()@@ -66,9 +71,14 @@ async fn prepare_messages_rejects_oversized_file() {..Default::default()};- let err = prepare_messages_for_provider(&crate::core::runtime::DispatchCtx::ambient(), &messages, &MultimodalConfig::default(), &file_config)- .await- .expect_err("oversized file must be rejected");+ let err = prepare_messages_for_provider(+ &crate::core::runtime::DispatchCtx::ambient(),+ &messages,+ &MultimodalConfig::default(),+ &file_config,+ )+ .await+ .expect_err("oversized file must be rejected");assert!(err.to_string()diff --git a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rsindex 9e0c14135d..fc204c7ac4 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs@@ -232,14 +232,15 @@ impl DelegateGraphTool {}};- let config = match crate::config::ops::load_current_or_init(&run_context.dispatch_ctx()).await {- Ok(cfg) => Arc::new(cfg),- Err(e) => {- return Ok(ToolResult::error(format!(- "delegate: failed to load config: {e}"- )));- }- };+ let config =+ match crate::config::ops::load_current_or_init(&run_context.dispatch_ctx()).await {+ Ok(cfg) => Arc::new(cfg),+ Err(e) => {+ return Ok(ToolResult::error(format!(+ "delegate: failed to load config: {e}"+ )));+ }+ };match run_subagent_delegation_with_parent_context(config,diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rsindex 52226cc065..d4628b6c93 100644--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs@@ -168,7 +168,11 @@ pub async fn stop_workflow_run(config: &Config, id: &str) -> Result<Option<Workf/// phase whose dependencies are satisfied. Returns the run row (now `Running`),/// or an error if the run is unknown / already terminal-complete / its/// definition no longer exists.-pub async fn resume_workflow_run(ctx: &DispatchCtx, config: &Config, id: &str) -> Result<WorkflowRun> {+pub async fn resume_workflow_run(+ ctx: &DispatchCtx,+ config: &Config,+ id: &str,+) -> Result<WorkflowRun> {log::debug!(target: LOG_TARGET, "[workflow_run_engine] resume.entry run={id}");let run = get_workflow_run(config, id)?.ok_or_else(|| anyhow!("unknown workflow run: {id}"))?;diff --git a/crates/openhuman-core/src/agent/orchestration/worktree_schemas.rs b/crates/openhuman-core/src/agent/orchestration/worktree_schemas.rsindex b24b87b6d2..37bca01040 100644--- a/crates/openhuman-core/src/agent/orchestration/worktree_schemas.rs+++ b/crates/openhuman-core/src/agent/orchestration/worktree_schemas.rs@@ -115,11 +115,9 @@ fn schema_for(function: &str) -> ControllerSchema {/// Resolve the project repo root every worktree op anchors on — the agent's/// `action_dir` from the loaded config.async fn repo_root(ctx: &DispatchCtx, cid: &str) -> Result<PathBuf, String> {- let config = ctx.load_config()- .await- .inspect_err(|err| {- log::warn!(target: "worktree_rpc", "[worktree_rpc][{cid}] config_failed err={err}");- })?;+ let config = ctx.load_config().await.inspect_err(|err| {+ log::warn!(target: "worktree_rpc", "[worktree_rpc][{cid}] config_failed err={err}");+ })?;Ok(config.action_dir.clone())}diff --git a/crates/openhuman-core/src/agent/progress_tracing/export.rs b/crates/openhuman-core/src/agent/progress_tracing/export.rsindex f1818ea6af..08de1d9924 100644--- a/crates/openhuman-core/src/agent/progress_tracing/export.rs+++ b/crates/openhuman-core/src/agent/progress_tracing/export.rs@@ -152,16 +152,17 @@ pub(crate) async fn export_subagent_journal_trace();return;}- let observations = match crate::agent::tinyagents::journal::read_run_events(ctx, journal_run_id, 0)- .await- {- Ok(observations) if !observations.is_empty() => observations,- Ok(_) => return,- Err(err) => {- log::warn!("[agent-tracing] child journal read failed run_id={journal_run_id}: {err}");- return;- }- };+ let observations =+ match crate::agent::tinyagents::journal::read_run_events(ctx, journal_run_id, 0).await {+ Ok(observations) if !observations.is_empty() => observations,+ Ok(_) => return,+ Err(err) => {+ log::warn!(+ "[agent-tracing] child journal read failed run_id={journal_run_id}: {err}"+ );+ return;+ }+ };let first = &observations[0];let user_id = crate::security::credentials::identity::peek_credential_user_identity().and_then(|identity| identity.id.or(identity.email));diff --git a/crates/openhuman-core/src/agent/registry/ops.rs b/crates/openhuman-core/src/agent/registry/ops.rsindex c968449fba..3e9acd28c0 100644--- a/crates/openhuman-core/src/agent/registry/ops.rs+++ b/crates/openhuman-core/src/agent/registry/ops.rs@@ -4,15 +4,18 @@ use std::collections::HashMap;use crate::agent::harness::host_definition::AgentDefinitionRegistry;use crate::agent::OpenHumanSessionHost;-use crate::core::runtime::DispatchCtx;use crate::config::Config;+use crate::core::runtime::DispatchCtx;use super::defaults::default_agents;use super::types::{AgentRegistryEntry, AgentRegistryPatch, AgentRegistrySource, AgentToolInfo};const ORCHESTRATOR_AGENT_ID: &str = "orchestrator";-pub async fn list_agents(ctx: &DispatchCtx, include_disabled: bool) -> Result<Vec<AgentRegistryEntry>, String> {+pub async fn list_agents(+ ctx: &DispatchCtx,+ include_disabled: bool,+) -> Result<Vec<AgentRegistryEntry>, String> {let config = ctx.load_config().await?;Ok(merge_entries(&config.agent_registry.entries,@@ -104,7 +107,11 @@ pub async fn update_agent(Ok(updated)}-pub async fn set_agent_enabled(ctx: &DispatchCtx, id: &str, enabled: bool) -> Result<AgentRegistryEntry, String> {+pub async fn set_agent_enabled(+ ctx: &DispatchCtx,+ id: &str,+ enabled: bool,+) -> Result<AgentRegistryEntry, String> {update_agent(ctx,id,diff --git a/crates/openhuman-core/src/agent/registry/rpc.rs b/crates/openhuman-core/src/agent/registry/rpc.rsindex 5f49e6fb8a..25f3b4865d 100644--- a/crates/openhuman-core/src/agent/registry/rpc.rs+++ b/crates/openhuman-core/src/agent/registry/rpc.rs@@ -22,7 +22,10 @@ pub struct ListResponse {pub agents: Vec<AgentRegistryEntry>,}-pub async fn list_rpc(ctx: &DispatchCtx, req: ListRequest) -> Result<Outcome<ListResponse>, String> {+pub async fn list_rpc(+ ctx: &DispatchCtx,+ req: ListRequest,+) -> Result<Outcome<ListResponse>, String> {Ok(Outcome::new(ListResponse {agents: ops::list_agents(ctx, req.include_disabled).await?,@@ -118,7 +121,10 @@ impl CreateCustomRequest {}}-pub async fn create_custom_rpc(ctx: &DispatchCtx, req: CreateCustomRequest) -> Result<Outcome<AgentResponse>, String> {+pub async fn create_custom_rpc(+ ctx: &DispatchCtx,+ req: CreateCustomRequest,+) -> Result<Outcome<AgentResponse>, String> {Ok(Outcome::new(AgentResponse {agent: ops::upsert_custom_agent(ctx, req.into_entry()).await?,@@ -137,7 +143,10 @@ pub struct AgentResponse {pub agent: AgentRegistryEntry,}-pub async fn upsert_custom_rpc(ctx: &DispatchCtx, req: UpsertCustomRequest) -> Result<Outcome<AgentResponse>, String> {+pub async fn upsert_custom_rpc(+ ctx: &DispatchCtx,+ req: UpsertCustomRequest,+) -> Result<Outcome<AgentResponse>, String> {Ok(Outcome::new(AgentResponse {agent: ops::upsert_custom_agent(ctx, req.agent).await?,@@ -153,7 +162,10 @@ pub struct UpdateRequest {pub patch: AgentRegistryPatch,}-pub async fn update_rpc(ctx: &DispatchCtx, req: UpdateRequest) -> Result<Outcome<AgentResponse>, String> {+pub async fn update_rpc(+ ctx: &DispatchCtx,+ req: UpdateRequest,+) -> Result<Outcome<AgentResponse>, String> {Ok(Outcome::new(AgentResponse {agent: ops::update_agent(ctx, &req.id, req.patch).await?,@@ -168,7 +180,10 @@ pub struct SetEnabledRequest {pub enabled: bool,}-pub async fn set_enabled_rpc(ctx: &DispatchCtx, req: SetEnabledRequest) -> Result<Outcome<AgentResponse>, String> {+pub async fn set_enabled_rpc(+ ctx: &DispatchCtx,+ req: SetEnabledRequest,+) -> Result<Outcome<AgentResponse>, String> {Ok(Outcome::new(AgentResponse {agent: ops::set_agent_enabled(ctx, &req.id, req.enabled).await?,@@ -187,7 +202,10 @@ pub struct RemoveResponse {pub removed: bool,}-pub async fn remove_rpc(ctx: &DispatchCtx, req: RemoveRequest) -> Result<Outcome<RemoveResponse>, String> {+pub async fn remove_rpc(+ ctx: &DispatchCtx,+ req: RemoveRequest,+) -> Result<Outcome<RemoveResponse>, String> {Ok(Outcome::new(RemoveResponse {removed: ops::remove_agent(ctx, &req.id).await?,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.rsindex 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.rsindex 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.rsindex 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.rsindex 843efc04e2..72b20d748b 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<_>>();@@ -332,7 +334,9 @@ impl OpenHumanTurnPrelude {visible_tool_names: &visible_tool_names,tool_call_format: self.tool_dispatcher.tool_call_format(),connected_integrations: &mutable.connected_integrations,- connected_identities_md: crate::agent::prompts::render_connected_identities(&self.dispatch_ctx()),+ connected_identities_md: crate::agent::prompts::render_connected_identities(+ &self.dispatch_ctx(),+ ),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),personality_roster: vec![],agents_md_global: agents_md.global,diff --git a/crates/openhuman-core/src/agent/session_host/tool_progress.rs b/crates/openhuman-core/src/agent/session_host/tool_progress.rsindex 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/turn/context.rs b/crates/openhuman-core/src/agent/session_host/turn/context.rsindex d835ba3231..8d5d486578 100644--- a/crates/openhuman-core/src/agent/session_host/turn/context.rs+++ b/crates/openhuman-core/src/agent/session_host/turn/context.rs@@ -58,7 +58,9 @@ impl OpenHumanSessionHost {visible_tool_names: &prompt_visible_tool_names,tool_call_format: self.tool_dispatcher.tool_call_format(),connected_integrations: &self.connected_integrations,- connected_identities_md: crate::agent::prompts::render_connected_identities(&self.dispatch_ctx()),+ connected_identities_md: crate::agent::prompts::render_connected_identities(+ &self.dispatch_ctx(),+ ),user_identity: crate::security::credentials::identity::peek_credential_user_identity(),personality_roster: vec![], // TODO: build_personality_roster(&workspace_dir)agents_md_global: agents_md.global,diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rsindex 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.rsindex 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/session_store/workspace_tests.rs b/crates/openhuman-core/src/agent/session_store/workspace_tests.rsindex a3dbc916bc..84e0833f1c 100644--- a/crates/openhuman-core/src/agent/session_store/workspace_tests.rs+++ b/crates/openhuman-core/src/agent/session_store/workspace_tests.rs@@ -118,10 +118,16 @@ fn releasing_defaults_lets_the_next_call_open_afresh() {let ws = scratch();let before = fallback_provider(ws.path());let cached = fallback_provider(ws.path());- assert!(Arc::ptr_eq(&before, &cached), "a repeat call reuses the provider");+ assert!(+ Arc::ptr_eq(&before, &cached),+ "a repeat call reuses the provider"+ );release_workspace_defaults();let after = fallback_provider(ws.path());- assert!(!Arc::ptr_eq(&before, &after), "release drops the cached provider");+ assert!(+ !Arc::ptr_eq(&before, &after),+ "release drops the cached provider"+ );}#[test]diff --git a/crates/openhuman-core/src/agent/stop_hooks.rs b/crates/openhuman-core/src/agent/stop_hooks.rsindex 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.rsindex 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/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex 8e16bf734a..e471bb911e 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -13,8 +13,8 @@ use crate::agent::harness::artifact_offload::offload_run_result;use crate::agent::harness::fork_context::ParentExecutionContext;use crate::agent::harness::host_definition::{AgentDefinition, AgentDefinitionRegistry};use crate::agent::prompts::{- render_connected_identities,- render_subagent_system_prompt_with_format, PromptContext, SubagentRenderOptions,+ render_connected_identities, render_subagent_system_prompt_with_format, PromptContext,+ SubagentRenderOptions,};use crate::agent::subagent_host::definition_iter_cap;use crate::agent::subagent_host::tool_prep::{diff --git a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rsindex f1618abdf2..e864faa4c3 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs@@ -127,8 +127,10 @@ impl OpenHumanHostBundleFactory {inputs: OpenHumanHostBundleInputs,turn: &OpenHumanRunContext,) -> OpenHumanHostBundle {- let context = Arc::new(OpenHumanContextComposer::new(Arc::clone(&inputs.config))- .with_dispatch(turn.dispatch_ctx()));+ let context = Arc::new(+ OpenHumanContextComposer::new(Arc::clone(&inputs.config))+ .with_dispatch(turn.dispatch_ctx()),+ );let registered_tools = Arc::new(inputs.tool_setsdiff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 3b00f266bc..864c762e3a 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -414,12 +414,12 @@ pub(crate) struct HarnessHostPolicy {pub(crate) tool_call_cap: Option<usize>,}+#[cfg(test)]+pub(crate) use super::operation_context::tool_context_with_approval;pub(crate) use super::operation_context::{approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool, parent_agent_id_for_tool,sandbox_mode_for_tool, task_recency_window_for_tool, HostOperationContext, OpenHumanRunExt,};-#[cfg(test)]-pub(crate) use super::operation_context::tool_context_with_approval;impl Default for OpenHumanRunContext {fn default() -> Self {@@ -677,7 +677,10 @@ impl OpenHumanRunContext {.as_ref().map(|parent| parent.agent_definition_id.clone()),memory_identity: self.memory_identity.clone(),- dispatch: self.core.clone().map(crate::core::runtime::DispatchCtx::new),+ dispatch: self+ .core+ .clone()+ .map(crate::core::runtime::DispatchCtx::new),});let context = tinyagents_harness::context::RunContext::new(config, self).with_cancellation(cancellation)diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rsindex 86e6eaeced..ce7b323ae9 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs@@ -605,9 +605,7 @@ fn the_memory_identity_rides_the_run_and_its_children() {);}-fn tool_context_for(- run: OpenHumanRunContext,-) -> tinyagents_harness::tool::ToolExecutionContext {+fn tool_context_for(run: OpenHumanRunContext) -> tinyagents_harness::tool::ToolExecutionContext {let run = run.into_tinyagents(tinyagents_harness::context::RunConfig::new("core-carrier"));tinyagents_harness::tool::ToolExecutionContext::from_run_context(&run,diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rsindex cfd7090488..54e4851434 100644--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs@@ -104,7 +104,9 @@ async fn resolve_workspace(ctx: &DispatchCtx) -> anyhow::Result<PathBuf> {/// The journal and run-status stores a turn's events and status go to: the/// calling tenant's, in the storage backend.-async fn journal_stores(ctx: &DispatchCtx) -> anyhow::Result<(Arc<dyn AppendStore>, DriverStatusStore)> {+async fn journal_stores(+ ctx: &DispatchCtx,+) -> anyhow::Result<(Arc<dyn AppendStore>, DriverStatusStore)> {let workspace = resolve_workspace(ctx).await?;let stores = crate::agent::session_store::stores_or_ephemeral(&workspace);let status = crate::agent::session_store::status_store_for(&workspace);diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rsindex 1974cf7f12..024e4bd1cb 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs@@ -21,9 +21,7 @@ use crate::agent::harness::tool_result_artifacts::{};use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use crate::inference::tokenjuice::generate::GenerateTicket;-use tinyagents_harness::artifacts::tool_results::{- ArtifactRead, ToolResultArtifactOutcome,-};+use tinyagents_harness::artifacts::tool_results::{ArtifactRead, ToolResultArtifactOutcome};use tinyagents_harness::middleware::library::{plan_output_stages, run_output_ladder, CompactedOutput, OutputCapPolicy, OutputLadderInput,OutputProcessor,@@ -447,11 +445,7 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext> for Too}}if let Some(read) =- artifact_read_target(- self.artifact_store.as_deref(),- &call.name,- &call.arguments,- )+ artifact_read_target(self.artifact_store.as_deref(), &call.name, &call.arguments){tracing::debug!(tool = %call.name,diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rsindex afe12796b4..713a97aa83 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs@@ -16,8 +16,8 @@ use tinyinference_llm::message::Message;use tinyinference_llm::model::{ModelRequest, ModelResponse, ResolvedModelRoute};use tinytools::{ToolPolicy as TaToolPolicy, ToolResult as TaToolResult};-use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use crate::agent::harness::tool_result_artifacts::HostArtifactStore;+use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use tinyagents_harness::turn_outcome::ToolCallOutcome;use tinyjuice_bus::types::AgentTokenjuiceCompression;diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_approval_guard_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_approval_guard_tests.rsindex b02e7b5298..ebed472f3e 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware_approval_guard_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_approval_guard_tests.rs@@ -69,10 +69,22 @@ async fn desktop_external_effect_inner() {assert!(middleware.has_external_effect("desktop_goal", &json!({})));assert!(!middleware- .requires_approval(&crate::core::runtime::DispatchCtx::ambient(), "desktop_goal", &json!({}))+ .requires_approval(+ &crate::core::runtime::DispatchCtx::ambient(),+ "desktop_goal",+ &json!({})+ )+ .await+ );+ assert!(+ middleware+ .requires_approval(+ &crate::core::runtime::DispatchCtx::ambient(),+ "send_email",+ &json!({})+ ).await);- assert!(middleware.requires_approval(&crate::core::runtime::DispatchCtx::ambient(), "send_email", &json!({})).await);match previous {Some(value) => unsafe { std::env::set_var("OPENHUMAN_WORKSPACE", value) },None => unsafe { std::env::remove_var("OPENHUMAN_WORKSPACE") },diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex 64352e909e..2c8cccc1b1 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;@@ -76,6 +76,7 @@ pub(crate) use crate::agent::message_convert::ta_call_to_oh_call;pub(crate) use embeddings::ProviderEmbeddingModel;pub(crate) use observability::SubagentScope;pub(crate) use reasoning::{apply_requested_effort, parse_reasoning_effort};+pub(crate) use turn_exec::TurnSpec;pub use turn_models::TurnModelSource;pub(crate) use turn_models::TurnModels;pub(crate) use turn_outcome::TinyagentsTurnOutcome;@@ -85,7 +86,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::TurnSpec;// Test-only glue so `tinyagents_tests.rs`'s `use super::*;` sees the// lower-level policy helpers it exercises directly (they otherwise staydiff --git a/crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs b/crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rsindex 1d93b58599..75507c31a6 100644--- a/crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs+++ b/crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs@@ -118,8 +118,7 @@ impl HarnessPayloadSummarizer<OpenHumanRunContext> for SubagentPayloadSummarizerOk(Box::new(move |request: GenerateRequest| {let dispatch = dispatch.clone();Box::pin(async move {- let config_loaded =- crate::config::ops::load_current_or_init(&dispatch).await;+ let config_loaded = crate::config::ops::load_current_or_init(&dispatch).await;let (source, model) = subagent_host::resolve_subagent_source(&definition.model,&definition.id,diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rsindex 18288a9a08..b04fe8ccf1 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs@@ -313,7 +313,9 @@ async fn drive_turn(}// `session_kv_store` self-gates on the dual-write flag (config default ON +// env kill switch), returning `None` when disabled or unresolvable.- if let Some(session_kv) = crate::agent::session_import::live::session_kv_store(&run_context.dispatch_ctx()).await {+ if let Some(session_kv) =+ crate::agent::session_import::live::session_kv_store(&run_context.dispatch_ctx()).await+ {stores.get_or_insert_with(StoreRegistry::new).register(crate::agent::session_import::live::TINYAGENTS_SESSION_KV_STORE,session_kv,@@ -400,8 +402,14 @@ async fn drive_turn(let journal_thread_id = subagent_scope.as_ref().map(|scope| tinyagents_harness::ids::ThreadId::new(scope.task_id.clone()));- let turn_journal =- journal::attach_turn_journal(&run_context.dispatch_ctx(), &sink, model, journal_run_id.clone(), journal_thread_id).await;+ let turn_journal = journal::attach_turn_journal(+ &run_context.dispatch_ctx(),+ &sink,+ model,+ journal_run_id.clone(),+ journal_thread_id,+ )+ .await;if !is_subagent {if let Some(crate::agent::turn_origin::AgentTurnOrigin::WebChat {request_id: Some(request_id),diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models.rsindex 83e2f95af6..d015b1bd13 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models.rs@@ -217,10 +217,9 @@ fn build_turn_models_crate(}).unwrap_or_else(|| factory::resolves_to_managed_backend(role, config));if managed {- let (backend, _) =- factory::make_openhuman_backend_model_for_thread(- role, config, m, true, thread_id, &egress,- )?;+ let (backend, _) = factory::make_openhuman_backend_model_for_thread(+ role, config, m, true, thread_id, &egress,+ )?;return Ok(Arc::new(RouteRecordingModel::new(crate::agent::attachments::provider::wrap(backend,@@ -262,89 +261,88 @@ fn build_turn_models_crate(};let (primary, routes, summarizer): BuiltTurnModels = (|| {- let primary = build_primary(model)?;-- // Additive workload-tier routes: one crate-native model per tier (skipping the- // turn's own model, which is registered as the default primary), each pinned to- // the tier alias so the crate registry resolves cross-route fallback across them.- let mut routes: TierRoutes = Vec::new();- for &tier in tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS {- if tier == model {- continue;- }- let tier_role = factory::role_for_model_tier(tier);- if let Some(custom) = crate::core::runtime::CoreContext::current_host_overrides()- .and_then(|local| {- local- .role_models- .get(tier)- .or_else(|| local.role_models.get(tier_role))- .cloned()- })- {- routes.push((- tier.to_string(),- crate::agent::attachments::provider::wrap_injected(- custom,+ let primary = build_primary(model)?;++ // Additive workload-tier routes: one crate-native model per tier (skipping the+ // turn's own model, which is registered as the default primary), each pinned to+ // the tier alias so the crate registry resolves cross-route fallback across them.+ let mut routes: TierRoutes = Vec::new();+ for &tier in tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS {+ if tier == model {+ continue;+ }+ let tier_role = factory::role_for_model_tier(tier);+ if let Some(custom) = crate::core::runtime::CoreContext::current_host_overrides()+ .and_then(|local| {+ local+ .role_models+ .get(tier)+ .or_else(|| local.role_models.get(tier_role))+ .cloned()+ })+ {+ routes.push((+ tier.to_string(),+ crate::agent::attachments::provider::wrap_injected(+ custom,+ Arc::new(config.clone()),+ ),+ ));+ continue;+ }+ let route = if factory::resolves_to_managed_backend(tier_role, config) {+ factory::make_openhuman_backend_model_for_thread(+ tier_role, config, tier, true, thread_id, &egress,+ )+ .map(|(backend, _)| (backend, "openhuman".to_string(), tier.to_string()))+ } else {+ factory::create_turn_chat_model_with_native_tools_and_route(+ tier_role,+ config,+ tier,+ temperature,+ true,+ &egress,+ )+ };+ match route {+ Ok((route_model, provider, resolved_model)) => routes.push((+ tier.to_string(),+ Arc::new(RouteRecordingModel::new(+ crate::agent::attachments::provider::wrap(+ route_model,Arc::new(config.clone()),+ &resolved_model,+ &provider,),- ));- continue;- }- let route = if factory::resolves_to_managed_backend(tier_role, config) {- factory::make_openhuman_backend_model_for_thread(- tier_role, config, tier, true, thread_id, &egress,- )- .map(|(backend, _)| (backend, "openhuman".to_string(), tier.to_string()))- } else {- factory::create_turn_chat_model_with_native_tools_and_route(- tier_role,- config,- tier,- temperature,- true,- &egress,- )- };- match route {- Ok((route_model, provider, resolved_model)) => routes.push((- tier.to_string(),- Arc::new(RouteRecordingModel::new(- crate::agent::attachments::provider::wrap(- route_model,- Arc::new(config.clone()),- &resolved_model,- &provider,- ),- ResolvedModelRoute::new(provider, resolved_model, tier),- )),+ ResolvedModelRoute::new(provider, resolved_model, tier),)),- Err(e) => {- // A route that can't be built (e.g. an unconfigured BYOK tier) is- // skipped, not fatal — the primary still dispatches (parity with the- // `Provider` path, where an unresolved tier simply isn't registered).- tracing::debug!(- route = tier,- error = %e,- "[models] skipping crate-native workload route that failed to build"- );- }+ )),+ Err(e) => {+ // A route that can't be built (e.g. an unconfigured BYOK tier) is+ // skipped, not fatal — the primary still dispatches (parity with the+ // `Provider` path, where an unresolved tier simply isn't registered).+ tracing::debug!(+ route = tier,+ error = %e,+ "[models] skipping crate-native workload route that failed to build"+ );}}+ }- // The summarizer is a distinct adapter instance (own empty error slot).- let summarizer = match crate::core::runtime::CoreContext::current_host_overrides()- .and_then(|local| local.role_models.get("summarization").cloned())- {- Some(custom) => crate::agent::attachments::provider::wrap_injected(- custom,- Arc::new(config.clone()),- ),- None => build_primary(model)?,- };+ // The summarizer is a distinct adapter instance (own empty error slot).+ let summarizer = match crate::core::runtime::CoreContext::current_host_overrides()+ .and_then(|local| local.role_models.get("summarization").cloned())+ {+ Some(custom) => {+ crate::agent::attachments::provider::wrap_injected(custom, Arc::new(config.clone()))+ }+ None => build_primary(model)?,+ };- anyhow::Ok((primary, routes, summarizer))- })()?;+ anyhow::Ok((primary, routes, summarizer))+ })()?;let supports_vision = primary.profile().is_some_and(|p| p.modalities.image_in);Ok(TurnModels {diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rsindex 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.tooldiff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rsindex 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, PackRegistryHandlet 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,diff --git a/crates/openhuman-core/src/agent/triage/escalation_tests.rs b/crates/openhuman-core/src/agent/triage/escalation_tests.rsindex f4ca9e6adc..e6407d592e 100644--- a/crates/openhuman-core/src/agent/triage/escalation_tests.rs+++ b/crates/openhuman-core/src/agent/triage/escalation_tests.rs@@ -124,9 +124,13 @@ async fn apply_decision_drop_only_publishes_evaluated() {})}));- apply_decision(&crate::core::runtime::DispatchCtx::ambient(), run(TriageAction::Drop), &envelope)- .await- .expect("drop should not fail");+ apply_decision(+ &crate::core::runtime::DispatchCtx::ambient(),+ run(TriageAction::Drop),+ &envelope,+ )+ .await+ .expect("drop should not fail");let captured = collect.await.expect("event collector should not panic");assert!(captured.iter().any(|event| matches!(@@ -163,9 +167,13 @@ async fn apply_decision_acknowledge_only_publishes_evaluated() {})}));- apply_decision(&crate::core::runtime::DispatchCtx::ambient(), run(TriageAction::Acknowledge), &envelope)- .await- .expect("acknowledge should not fail");+ apply_decision(+ &crate::core::runtime::DispatchCtx::ambient(),+ run(TriageAction::Acknowledge),+ &envelope,+ )+ .await+ .expect("acknowledge should not fail");let captured = collect.await.expect("event collector should not panic");assert!(captured.iter().any(|event| matches!(diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 16fe49d7cf..27d2b1da53 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -462,8 +462,7 @@ pub(crate) async fn process_channel_runtime_message()),};let llm_result =- tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call)- .await;+ tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call).await;// Wait for draft updater to finishif let Some(handle) = draft_updater {diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 63eb9e7425..beef7d1a38 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -538,7 +538,9 @@ impl CoreContext {/// it would turn a labelled turn into an unlabelled one the approval gate/// refuses.pub async fn scope<F: Future>(ctx: Arc<CoreContext>, fut: F) -> F::Output {- CURRENT_CONTEXT.scope(Self::keeping_turn_origin(ctx), fut).await+ CURRENT_CONTEXT+ .scope(Self::keeping_turn_origin(ctx), fut)+ .await}/// [`scope`](Self::scope) for a synchronous closure.diff --git a/crates/openhuman-core/src/core/runtime/context_test_support.rs b/crates/openhuman-core/src/core/runtime/context_test_support.rsindex e9d610fce7..741aca0b3a 100644--- a/crates/openhuman-core/src/core/runtime/context_test_support.rs+++ b/crates/openhuman-core/src/core/runtime/context_test_support.rs@@ -35,9 +35,12 @@ impl CoreContext {/// Test-only: given `[components]` switches.pub(crate) fn for_test_with_components(c: crate::core::runtime::ComponentSet) -> Arc<Self> {- let mut ctx = Arc::try_unwrap(Self::for_test(crate::core::runtime::DomainSet::full(), None))- .ok()- .unwrap();+ let mut ctx = Arc::try_unwrap(Self::for_test(+ crate::core::runtime::DomainSet::full(),+ None,+ ))+ .ok()+ .unwrap();ctx.components = c;Arc::new(ctx)}diff --git a/crates/openhuman-core/src/flows/builder_host.rs b/crates/openhuman-core/src/flows/builder_host.rsindex bbe1098195..634f6ade36 100644--- a/crates/openhuman-core/src/flows/builder_host.rs+++ b/crates/openhuman-core/src/flows/builder_host.rs@@ -222,9 +222,12 @@ impl BuilderGates for FlowsHost {#[async_trait]impl AgentDirectory for FlowsHost {async fn list(&self) -> PortResult<Vec<AgentDefinition>> {- let agents = crate::agent::registry::list_agents(&crate::core::runtime::DispatchCtx::ambient(), false)- .await- .map_err(|e| e.to_string())?;+ let agents = crate::agent::registry::list_agents(+ &crate::core::runtime::DispatchCtx::ambient(),+ false,+ )+ .await+ .map_err(|e| e.to_string())?;Ok(agents.iter().map(|a| AgentDefinition {diff --git a/crates/openhuman-core/src/flows/ops/builder_gates.rs b/crates/openhuman-core/src/flows/ops/builder_gates.rsindex fd074f4c76..6f189f277f 100644--- a/crates/openhuman-core/src/flows/ops/builder_gates.rs+++ b/crates/openhuman-core/src/flows/ops/builder_gates.rs@@ -384,7 +384,13 @@ pub(crate) async fn validate_agent_refs(config: &Config, graph: &WorkflowGraph)}AgentRoute::RegistryFallback => {if custom_registry.is_none() {- custom_registry = Some(crate::agent::registry::list_agents(&crate::core::runtime::DispatchCtx::ambient(), true).await);+ custom_registry = Some(+ crate::agent::registry::list_agents(+ &crate::core::runtime::DispatchCtx::ambient(),+ true,+ )+ .await,+ );}match custom_registry.as_ref().expect("just populated") {Ok(entries) => match entries.iter().find(|entry| entry.id == agent_ref) {diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rsindex 4193e22995..298e4dd8d1 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs@@ -509,15 +509,18 @@ impl OpenHumanAgentRunner {conn: Option<&str>,) -> Result<Value> {// Resolve + validate the requested agent kind against the registry.- let entry = crate::agent::registry::get_agent(&crate::core::runtime::DispatchCtx::ambient(), agent_ref)- .await- .map_err(EngineError::Capability)?- .ok_or_else(|| {- EngineError::Capability(format!(- "agent node: unknown agent_ref '{agent_ref}' (neither a harness definition nor \+ let entry = crate::agent::registry::get_agent(+ &crate::core::runtime::DispatchCtx::ambient(),+ agent_ref,+ )+ .await+ .map_err(EngineError::Capability)?+ .ok_or_else(|| {+ EngineError::Capability(format!(+ "agent node: unknown agent_ref '{agent_ref}' (neither a harness definition nor \a custom agent registry entry)"- ))- })?;+ ))+ })?;if !entry.enabled {return Err(EngineError::Capability(format!("agent node: agent_ref '{agent_ref}' is disabled"diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/http.rs b/crates/openhuman-core/src/flows/tinyflows/caps/http.rsindex 85ba896c2f..61be564050 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/http.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/http.rs@@ -184,8 +184,7 @@ impl HttpClient for OpenHumanHttp {let summary = crate::security::approval::summarize_action(TOOL_NAME, &request);let redacted = crate::security::approval::redact_args(&request);let (outcome, audit_id) =- gate_call_for_tier(&self.approval, tier_decision, TOOL_NAME, &summary, redacted)- .await;+ gate_call_for_tier(&self.approval, tier_decision, TOOL_NAME, &summary, redacted).await;if let crate::security::approval::GateOutcome::Deny { reason } = outcome {return Err(EngineError::Capability(reason));}diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rsindex 53b09cfadf..027147e7a7 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs@@ -172,7 +172,8 @@ impl ToolBackend for ComposioToolBackend {let (outcome, audit_id) = if tier_decision == GateDecision::Allow {(crate::security::approval::GateOutcome::Allow, None)} else {- super::super::gate_call_for_tier(ctx.approval, tier_decision, slug, &summary, redacted).await+ super::super::gate_call_for_tier(ctx.approval, tier_decision, slug, &summary, redacted)+ .await};if let crate::security::approval::GateOutcome::Deny { reason } = outcome {tracing::warn!(diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rsindex 06cb06d465..e7ca8050ed 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs@@ -48,9 +48,14 @@ impl ToolBackend for NativeToolBackend {let tier_decision = super::super::enforce_node_tier_gate(ctx.security, class, "tool_call")?;let summary = crate::security::approval::summarize_action(tool_name, &args);let redacted = crate::security::approval::redact_args(&args);- let (outcome, audit_id) =- super::super::gate_call_for_tier(ctx.approval, tier_decision, tool_name, &summary, redacted)- .await;+ let (outcome, audit_id) = super::super::gate_call_for_tier(+ ctx.approval,+ tier_decision,+ tool_name,+ &summary,+ redacted,+ )+ .await;if let crate::security::approval::GateOutcome::Deny { reason } = outcome {return Err(EngineError::Capability(reason));}diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rsindex 5d1db2d475..e82623af8e 100644--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs@@ -144,9 +144,14 @@ impl OpenHumanMemory {let tier_decision = enforce_node_tier_gate(&self.security, CommandClass::Write, op)?;let summary = summarize_action(&tool_name, action);let redacted = redact_args(action);- let (outcome, audit_id) =- gate_call_for_tier(&self.approval, tier_decision, &tool_name, &summary, redacted)- .await;+ let (outcome, audit_id) = gate_call_for_tier(+ &self.approval,+ tier_decision,+ &tool_name,+ &summary,+ redacted,+ )+ .await;if let GateOutcome::Deny { reason } = outcome {tracing::warn!(target: "flows", op, "{LOG_PREFIX} write: approval gate denied");return Err(EngineError::Capability(reason));diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rsindex 096fe6f09e..0893a77549 100644--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs@@ -72,24 +72,31 @@ pub(super) fn create_chat_model_with_model_id_inner(if resolves_to_managed_backend(role, config) {return make_openhuman_backend_model(role, config);}- if let Some(result) = try_create_claude_agent_sdk_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) =+ try_create_claude_agent_sdk_chat_model(role, config, &EgressLedger::none())+ {return result;}- if let Some(result) = try_create_claude_code_chat_model(role, config, None, &EgressLedger::none()) {+ if let Some(result) =+ try_create_claude_code_chat_model(role, config, None, &EgressLedger::none())+ {return result;}// Local OpenAI-compatible runtimes (Ollama / LM Studio / MLX / OMLX /// local-openai) → crate-native `ChatModel` (issue #4727 Motion B) instead// of a crate-adapted host provider. Cloud/BYOK/bespoke providers// return `None` here and fall through to the `Provider` path below.- if let Some(result) = try_create_local_runtime_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) =+ try_create_local_runtime_chat_model(role, config, &EgressLedger::none())+ {return result;}// Wire-equivalent BYOK cloud slugs (Anthropic / None / plain-Bearer, no// codex-oauth or `/v1/responses` fallback) → crate-native `ChatModel`// (issue #4727 Phase 3, conservative subset). `openai`/codex, custom// proxy slugs, and the managed entry return `None` and fall through.- if let Some(result) = try_create_cloud_slug_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) = try_create_cloud_slug_chat_model(role, config, &EgressLedger::none())+ {return result;}}@@ -229,35 +236,29 @@ pub(super) fn create_chat_model_from_string_with_model_id_inner(if resolved == PROVIDER_OPENHUMAN {return make_openhuman_backend_model(role, config);}- if let Some(result) =- try_create_claude_agent_sdk_chat_model_from_string(- role,- &resolved,- config,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_claude_agent_sdk_chat_model_from_string(+ role,+ &resolved,+ config,+ &EgressLedger::none(),+ ) {return result;}- if let Some(result) =- try_create_claude_code_chat_model_from_string(- role,- &resolved,- config,- None,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_claude_code_chat_model_from_string(+ role,+ &resolved,+ config,+ None,+ &EgressLedger::none(),+ ) {return result;}- if let Some(result) =- try_create_local_runtime_chat_model_from_string(- role,- &resolved,- config,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_local_runtime_chat_model_from_string(+ role,+ &resolved,+ config,+ &EgressLedger::none(),+ ) {return result;}if let Some(result) = try_create_cloud_slug_chat_model_from_string(@@ -265,8 +266,7 @@ pub(super) fn create_chat_model_from_string_with_model_id_inner(&resolved,config,&EgressLedger::none(),- )- {+ ) {return result;}}diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex 6c51247ea1..ad6d7d4836 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -338,16 +338,15 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(}let model_override =(!effective_model.trim().is_empty()).then_some(effective_model.as_str());- let (backend, pinned_model) =- match resolve_managed_backend_with_model_override(- role,- config,- model_override,- egress,- ) {- Ok(result) => result,- Err(error) => return Some(Err(error)),- };+ let (backend, pinned_model) = match resolve_managed_backend_with_model_override(+ role,+ config,+ model_override,+ egress,+ ) {+ Ok(result) => result,+ Err(error) => return Some(Err(error)),+ };return Some(Ok((Arc::new(backend.with_native_tool_calling(native_tool_calling)),pinned_model,diff --git a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs b/crates/openhuman-core/src/inference/provider/factory/turn_model.rsindex 6c8f3df1be..4c6830b62c 100644--- a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/turn_model.rs@@ -151,14 +151,12 @@ pub(super) fn create_turn_chat_model_with_native_tools_and_route_inner(return result.map(|(chat, resolved_model)| (chat, provider_name.clone(), resolved_model));}- if let Some(result) =- try_create_cloud_slug_chat_model_with_native_tools(- role,- config,- native_tool_calling,- egress,- )- {+ if let Some(result) = try_create_cloud_slug_chat_model_with_native_tools(+ role,+ config,+ native_tool_calling,+ egress,+ ) {return result.map(|(chat, resolved_model)| (chat, provider_name.clone(), resolved_model));}diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex 95909f9a84..eb058a1499 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -697,7 +697,10 @@ async fn managed_construction_ledger_collapses_repeat_disclosures() {build(&EgressLedger::none());let sentinel = "egress-ledger-factory-sentinel";- crate::security::egress::emit_external_transfer(None, crate::security::egress::EgressDescriptor::network_fetch(sentinel));+ crate::security::egress::emit_external_transfer(+ None,+ crate::security::egress::EgressDescriptor::network_fetch(sentinel),+ );let mut disclosures = 0;loop {match rx.recv().await {diff --git a/crates/openhuman-core/src/integrations/client_api_key_tests.rs b/crates/openhuman-core/src/integrations/client_api_key_tests.rsindex 733517af99..1106a5392b 100644--- a/crates/openhuman-core/src/integrations/client_api_key_tests.rs+++ b/crates/openhuman-core/src/integrations/client_api_key_tests.rs@@ -44,7 +44,10 @@ async fn json_requests_send_the_api_key_as_x_api_key_and_no_bearer() {let client = api_key_client(start_mock_backend(app).await);assert!(client.uses_api_key());client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect("an API-key client reaches composio");@@ -69,7 +72,10 @@ async fn binary_download_sends_the_api_key_as_x_api_key() {);let client = api_key_client(start_mock_backend(app).await);let (bytes, _, _) = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await.expect("download with an API key");assert_eq!(&bytes[..], b"bytes");@@ -108,7 +114,10 @@ async fn presigned_download_redirect_does_not_forward_api_key() {);let client = api_key_client(start_mock_backend(backend).await);let (bytes, _, _) = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await.unwrap();assert_eq!(&bytes[..], b"stored bytes");diff --git a/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs b/crates/openhuman-core/src/integrations/client_error_propagation_tests.rsindex e3d6615bc2..e394972079 100644--- a/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs+++ b/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs@@ -182,14 +182,22 @@ async fn verb_methods_block_user_data_egress_under_local_only() {assert_blocked("upload_multipart",client- .upload_multipart::<serde_json::Value>(&Default::default(), path, reqwest::multipart::Form::new())+ .upload_multipart::<serde_json::Value>(+ &Default::default(),+ path,+ reqwest::multipart::Form::new(),+ ).await.unwrap_err().to_string(),);assert_blocked("get_bytes",- client.get_bytes(&Default::default(), path).await.unwrap_err().to_string(),+ client+ .get_bytes(&Default::default(), path)+ .await+ .unwrap_err()+ .to_string(),);}@@ -250,7 +258,10 @@ async fn verb_methods_never_expose_admin_or_webhook_routes() {);assert_blocked("get_bytes",- client.get_bytes(&Default::default(), "/webhooks/core").await.unwrap_err(),+ client+ .get_bytes(&Default::default(), "/webhooks/core")+ .await+ .unwrap_err(),);}@@ -394,7 +405,10 @@ async fn local_only_rejects_user_data_verb_before_transport() {// gate and DOES reach transport (surfaces the mock's 403) — proving the// gate is selective, not a blanket network kill.let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("control-plane reaches transport and surfaces the mock 403");let msg = format!("{err:#}");@@ -419,7 +433,10 @@ async fn get_403_propagates_backend_error_envelope_message() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("403 must surface as Err");let msg = format!("{err:#}");diff --git a/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs b/crates/openhuman-core/src/integrations/client_session_expiry_tests.rsindex dbca617357..4c580411a9 100644--- a/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs+++ b/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs@@ -95,7 +95,10 @@ async fn get_401_session_jwt_classifies_as_session_expired() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("401 must surface as Err");let msg = format!("{err:#}");@@ -137,7 +140,10 @@ async fn non_401_4xx_does_not_classify_as_session_expired() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("403 must surface as Err");let msg = format!("{err:#}");@@ -247,7 +253,10 @@ async fn get_401_composio_triggers_keeps_sentinel_for_in_place_cta() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/triggers/available?toolkit=gmail")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/triggers/available?toolkit=gmail",+ ).await.expect_err("401 must surface as Err");let msg = format!("{err:#}");diff --git a/crates/openhuman-core/src/integrations/client_tests.rs b/crates/openhuman-core/src/integrations/client_tests.rsindex 25e1e7f87e..19623e2618 100644--- a/crates/openhuman-core/src/integrations/client_tests.rs+++ b/crates/openhuman-core/src/integrations/client_tests.rs@@ -86,10 +86,17 @@ async fn product_identity_seen_by_backend() -> ProductIdentitySeen {let client = client_for(base);let sdk_result = client- .post::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/execute", &json!({}))+ .post::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/execute",+ &json!({}),+ ).await;let download_result = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await;sdk_result.expect("mock backend returns a success envelope");diff --git a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rsindex a1444575f7..9f7cc56820 100644--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs@@ -192,7 +192,16 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {// spawned task, because `AGENT_TURN_ORIGIN` is a task-local// and does not cross `tokio::spawn`.let origin = remote_trigger_origin(&envelope);- if let Err(e) = with_origin(origin, apply_decision(&crate::core::runtime::DispatchCtx::ambient(), run, &envelope)).await {+ if let Err(e) = with_origin(+ origin,+ apply_decision(+ &crate::core::runtime::DispatchCtx::ambient(),+ run,+ &envelope,+ ),+ )+ .await+ {tracing::error!(label = %envelope.display_label,error = %e,diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rsindex 8259a27fc8..e8f8d5edfe 100644--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs@@ -110,14 +110,16 @@ impl Tool for ComposioExecuteTool {_options: ToolCallOptions,context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- let (config, outcome) = Box::pin(self.execute_unredacted(- args,- sandbox_mode_for_tool(context),- task_recency_window_for_tool(context),- crate::agent::tinyagents::host::run_context::approval_for_tool(context)- .chat- .as_ref(),- ))+ let (config, outcome) = Box::pin(+ self.execute_unredacted(+ args,+ sandbox_mode_for_tool(context),+ task_recency_window_for_tool(context),+ crate::agent::tinyagents::host::run_context::approval_for_tool(context)+ .chat+ .as_ref(),+ ),+ ).await;redact_composio_outcome(&config, outcome)}diff --git a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rsindex 49d066ce54..4c3fbc01e4 100644--- a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs@@ -198,7 +198,12 @@ async fn connect_tool_validates_before_gating_in_chat_context() {client_id: "c-test".into(),request_id: None,};- let result = tool.execute_with_context(serde_json::json!({ "toolkit": "google_drive" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(ctx)))+ let result = tool+ .execute_with_context(+ serde_json::json!({ "toolkit": "google_drive" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(ctx)),+ ).await.unwrap();assert!(result.is_error);diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/list.rs b/crates/openhuman-core/src/integrations/file_storage/tools/list.rsindex ea731dfe8b..9e0b46161b 100644--- a/crates/openhuman-core/src/integrations/file_storage/tools/list.rs+++ b/crates/openhuman-core/src/integrations/file_storage/tools/list.rs@@ -63,7 +63,11 @@ impl StorageListFilesTool {approval: &crate::security::approval::ApprovalTurnContext,) -> anyhow::Result<ToolResult> {tracing::debug!("[file_storage] listing files");- match self.client.get::<ListFilesResponse>(approval, FILES_PATH).await {+ match self+ .client+ .get::<ListFilesResponse>(approval, FILES_PATH)+ .await+ {Ok(resp) => {let mut lines = vec![format!("{} file(s), using {} of {} bytes:",diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs b/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rsindex 49b02a00c6..8e83b47b19 100644--- a/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs+++ b/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs@@ -105,7 +105,8 @@ impl StorageSetVisibilityTool {tracing::debug!("[file_storage] setting visibility={visibility} for file_id={file_id}");match self.client- .patch::<FileMeta>(approval,+ .patch::<FileMeta>(+ approval,&file_path(&file_id, ""),&json!({ "visibility": visibility }),)diff --git a/crates/openhuman-core/src/integrations/tools/stock_prices.rs b/crates/openhuman-core/src/integrations/tools/stock_prices.rsindex 220db092d3..6aea5592e3 100644--- a/crates/openhuman-core/src/integrations/tools/stock_prices.rs+++ b/crates/openhuman-core/src/integrations/tools/stock_prices.rs@@ -209,7 +209,11 @@ impl StockQuoteTool {tracing::info!("[stock_quote] symbol={}", symbol);let body = json!({ "symbol": symbol });- match self.client.post::<QuoteResponse>(approval, PATH_QUOTE, &body).await {+ match self+ .client+ .post::<QuoteResponse>(approval, PATH_QUOTE, &body)+ .await+ {Ok(resp) => {let q = &resp.quote;let mut out = format!(diff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rsindex a85e2ccc06..c02f0f5f55 100644--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs@@ -63,9 +63,8 @@ pub struct MediaArtifactTool<T: Tool> {per_call: Option<PerCallInner<T>>,}-type PerCallInner<T> = std::sync::Arc<- dyn Fn(ProgressFn, Option<&ApprovalChatContext>) -> T + Send + Sync,->;+type PerCallInner<T> =+ std::sync::Arc<dyn Fn(ProgressFn, Option<&ApprovalChatContext>) -> T + Send + Sync>;impl<T: Tool> MediaArtifactTool<T> {/// `kind` is the artifact category to file every generated output@@ -146,8 +145,16 @@ impl<T: Tool> MediaArtifactTool<T> {else {continue;};- self.file_one(entry, &src_path, args, index, total, call_id.as_deref(), chat)- .await;+ self.file_one(+ entry,+ &src_path,+ args,+ index,+ total,+ call_id.as_deref(),+ chat,+ )+ .await;}result}@@ -199,14 +206,21 @@ impl<T: Tool> MediaArtifactTool<T> {}}Err(err) => {- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat)- .await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &err,+ chat,+ )+ .await;set_artifact_error(entry, &err);}}}Err(err) => {- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat).await;+ let _ =+ fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat).await;tracing::warn!(target: "media_generation",err = %err,diff --git a/crates/openhuman-core/src/media/generation/provider.rs b/crates/openhuman-core/src/media/generation/provider.rsindex b5bb1f4df6..719412a1a6 100644--- a/crates/openhuman-core/src/media/generation/provider.rs+++ b/crates/openhuman-core/src/media/generation/provider.rs@@ -39,8 +39,11 @@ use crate::security::credentials::session_support::{pub const OPENROUTER_PROXY_PATH: &str = "/agent-integrations/openrouter";/// Rebuilds the generators so their egress disclosures reach `chat`.-type GeneratorRouter =- Arc<dyn Fn(Option<ApprovalChatContext>) -> (Arc<dyn ImageGenerator>, Arc<dyn VideoGenerator>) + Send + Sync>;+type GeneratorRouter = Arc<+ dyn Fn(Option<ApprovalChatContext>) -> (Arc<dyn ImageGenerator>, Arc<dyn VideoGenerator>)+ + Send+ + Sync,+>;/// The image and video generators for this process.pub struct MediaGenerators {diff --git a/crates/openhuman-core/src/media/generation/provider_tests.rs b/crates/openhuman-core/src/media/generation/provider_tests.rsindex 318a6f4fd8..60343427b4 100644--- a/crates/openhuman-core/src/media/generation/provider_tests.rs+++ b/crates/openhuman-core/src/media/generation/provider_tests.rs@@ -80,4 +80,3 @@ fn generators_without_a_router_are_returned_as_they_are() {assert!(Arc::ptr_eq(&generators.image, &routed.image));assert!(Arc::ptr_eq(&generators.video, &routed.video));}-diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rsindex f83b792ff8..6d14d2ec17 100644--- a/crates/openhuman-core/src/sandbox/shell_exec.rs+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs@@ -97,7 +97,10 @@ pub(crate) static USE_FIXTURE: std::sync::atomic::AtomicBool =/// Run `run` through the module and collect its output.////// A worker owns cancellation and resource cleanup if the caller drops its wait.-pub(crate) async fn run(config: &Config, mut run: NativeShellRun) -> anyhow::Result<SandboxExecResult> {+pub(crate) async fn run(+ config: &Config,+ mut run: NativeShellRun,+) -> anyhow::Result<SandboxExecResult> {#[cfg(test)]if !run.is_jailed() && USE_FIXTURE.load(std::sync::atomic::Ordering::SeqCst) {let _ = config;diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rsindex 46c73f565a..e8eb394d6d 100644--- a/crates/openhuman-core/src/security/approval/gate_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs@@ -212,7 +212,7 @@ mod subagent_tests;mod tenant_tests;#[path = "gate_triage_tests.rs"]mod triage_tests;-#[path = "gate_turn_context_tests.rs"]-mod turn_context_tests;#[path = "gate_ttl_and_triage_tests.rs"]mod ttl_and_triage_tests;+#[path = "gate_turn_context_tests.rs"]+mod turn_context_tests;diff --git a/crates/openhuman-core/src/security/devices/owner_tests.rs b/crates/openhuman-core/src/security/devices/owner_tests.rsindex 0c78d211af..69a2901e45 100644--- a/crates/openhuman-core/src/security/devices/owner_tests.rs+++ b/crates/openhuman-core/src/security/devices/owner_tests.rs@@ -49,7 +49,8 @@ async fn a_remembered_owner_that_lost_the_device_is_forgotten() {scoped_config(tmp.path()),);remember("owner-test-stale", None);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()), "owner-test-stale", None),).await;@@ -68,8 +69,13 @@ async fn a_revoked_device_is_not_its_agents_any_more() {crate::core::runtime::DomainSet::full(),config,);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-revoked", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-revoked",+ None,+ ),).await;assert_eq!(owner, Ok(None));@@ -105,7 +111,8 @@ async fn a_device_found_in_the_local_scope_belongs_to_local_and_is_remembered()crate::core::runtime::DomainSet::full(),config,);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()), "owner-test-found", None),).await;@@ -120,8 +127,13 @@ async fn a_channel_no_scope_knows_is_local_and_not_remembered() {crate::core::runtime::DomainSet::full(),scoped_config(tmp.path()),);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-missing", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-missing",+ None,+ ),).await;assert_eq!(owner, Ok(None));@@ -171,8 +183,13 @@ async fn a_revoked_device_with_a_live_cipher_is_dropped() {super::super::crypto::TunnelCipher::new(&[7u8; 32]),)),);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-cipher", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-cipher",+ None,+ ),).await;super::super::rpc::ACTIVE_CIPHERS@@ -226,7 +243,8 @@ async fn a_leftover_pairing_session_does_not_outlive_a_revocation() {super::super::store::insert_device(&config, "owner-test-leftover", "label", "pk", "hash").unwrap();super::super::store::revoke_device(&config, "owner-test-leftover").unwrap();- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()),"owner-test-leftover",diff --git a/crates/openhuman-core/src/security/egress/emit_tests.rs b/crates/openhuman-core/src/security/egress/emit_tests.rsindex abcd36e9d9..7fffe44e59 100644--- a/crates/openhuman-core/src/security/egress/emit_tests.rs+++ b/crates/openhuman-core/src/security/egress/emit_tests.rs@@ -58,7 +58,10 @@ async fn local_transfer_does_not_publish() {// A local (non-external) transfer must NOT emit; a following external one// must. If we reach the sentinel without having seen the local marker, the// local transfer was correctly suppressed.- emit_external_transfer(None, EgressDescriptor::inference("ollama", local_marker, false));+ emit_external_transfer(+ None,+ EgressDescriptor::inference("ollama", local_marker, false),+ );emit_external_transfer(None, EgressDescriptor::network_fetch(sentinel_marker));loop {diff --git a/crates/openhuman-core/src/skills/webhooks/bus.rs b/crates/openhuman-core/src/skills/webhooks/bus.rsindex fb80b5fde1..6a034449e7 100644--- a/crates/openhuman-core/src/skills/webhooks/bus.rs+++ b/crates/openhuman-core/src/skills/webhooks/bus.rs@@ -304,9 +304,10 @@ fn decode_webhook_body(base64_body: &str) -> Result<serde_json::Value, String> {async fn run_agent_trigger(envelope: &crate::agent::triage::TriggerEnvelope,) -> Result<String, String> {- let outcome = crate::agent::triage::run_triage(&crate::core::runtime::DispatchCtx::ambient(), envelope)- .await- .map_err(|e| format!("triage evaluation failed: {e}"))?;+ let outcome =+ crate::agent::triage::run_triage(&crate::core::runtime::DispatchCtx::ambient(), envelope)+ .await+ .map_err(|e| format!("triage evaluation failed: {e}"))?;match outcome {crate::agent::triage::TriageOutcome::Decision(run) => {diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rsindex ed3b09ceb3..58b8e9025a 100644--- a/crates/openhuman-core/src/tools/impl/document/mod.rs+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs@@ -291,7 +291,14 @@ impl DocumentTool {.map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();let reason = format!("failed to write generated document ({filename}): {err}");- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &reason, chat).await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &reason,+ chat,+ )+ .await;tracing::warn!(target: "document",err = %err,@@ -303,7 +310,8 @@ impl DocumentTool {}let size_bytes = bytes.len() as u64;- let updated = match finalize_artifact(&self.workspace_dir, &meta.id, size_bytes, chat).await {+ let updated = match finalize_artifact(&self.workspace_dir, &meta.id, size_bytes, chat).await+ {Ok(updated) => updated,Err(err) => {let reason = format!("failed to finalize artifact: {err}");@@ -312,8 +320,14 @@ impl DocumentTool {// stuck `Pending` spinner. Fail-artifact errors are// swallowed — they can only recur if the same ledger backend// is unavailable.- let _ =- fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &reason, chat).await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &reason,+ chat,+ )+ .await;tracing::warn!(target: "document",err = %err,diff --git a/crates/openhuman-core/src/tools/impl/network/gate_tests.rs b/crates/openhuman-core/src/tools/impl/network/gate_tests.rsindex 96c9991686..b82d8a4eb7 100644--- a/crates/openhuman-core/src/tools/impl/network/gate_tests.rs+++ b/crates/openhuman-core/src/tools/impl/network/gate_tests.rs@@ -14,7 +14,13 @@ fn policy(autonomy: AutonomyLevel, max_actions_per_hour: u32) -> Arc<SecurityPol}fn http(security: Arc<SecurityPolicy>) -> HttpRequestTool {- super::super::host::http_request_tool(&crate::core::runtime::DispatchCtx::ambient(), security, vec!["example.com".into()], 1_000_000, 30)+ super::super::host::http_request_tool(+ &crate::core::runtime::DispatchCtx::ambient(),+ security,+ vec!["example.com".into()],+ 1_000_000,+ 30,+ )}// --- the gate answers with the policy's own decisions -----------------------diff --git a/crates/openhuman-core/src/tools/impl/network/host.rs b/crates/openhuman-core/src/tools/impl/network/host.rsindex b22ec2a51e..f34f4fbaed 100644--- a/crates/openhuman-core/src/tools/impl/network/host.rs+++ b/crates/openhuman-core/src/tools/impl/network/host.rs@@ -302,7 +302,8 @@ mod x402 {.ok_or_else(|| {"402 response is missing a valid PAYMENT-REQUIRED header".to_string()})?;- let config = self.ctx+ let config = self+ .ctx.load_config().await.map_err(|error| format!("x402 payment failed: {error}"))?;diff --git a/crates/openhuman-core/src/tools/impl/network/host_tests.rs b/crates/openhuman-core/src/tools/impl/network/host_tests.rsindex b943890e89..66a7ae4eab 100644--- a/crates/openhuman-core/src/tools/impl/network/host_tests.rs+++ b/crates/openhuman-core/src/tools/impl/network/host_tests.rs@@ -96,20 +96,22 @@ async fn tinyjuice_detects_and_converts_html() {assert!(TinyJuiceHtml {ctx: crate::core::runtime::DispatchCtx::ambient(),}- .looks_like_html(page).await.unwrap());+ .looks_like_html(page)+ .await+ .unwrap());assert!(!TinyJuiceHtml {- ctx: crate::core::runtime::DispatchCtx::ambient(),- }- .looks_like_html("# Just a README\n\nSome prose.\n")- .await- .unwrap());+ ctx: crate::core::runtime::DispatchCtx::ambient(),+ }+ .looks_like_html("# Just a README\n\nSome prose.\n")+ .await+ .unwrap());assert!(TinyJuiceHtml {- ctx: crate::core::runtime::DispatchCtx::ambient(),- }- .to_markdown(page)- .await- .unwrap()- .contains("hi"));+ ctx: crate::core::runtime::DispatchCtx::ambient(),+ }+ .to_markdown(page)+ .await+ .unwrap()+ .contains("hi"));}#[cfg(feature = "web3")]diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rsindex bd58c67bfd..1579019a01 100644--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs@@ -304,8 +304,12 @@ impl Tool for PresentationTool {context: Option<&dyn tinytools::ToolRunContext>,) -> anyhow::Result<ToolResult> {let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);- self.run(args, approval.chat.as_ref(), &dispatch_ctx_for_tool(context))- .await+ self.run(+ args,+ approval.chat.as_ref(),+ &dispatch_ctx_for_tool(context),+ )+ .await}}diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rsindex d64089813c..2f72f6bbf6 100644--- a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs@@ -34,7 +34,12 @@ fn chat_tool_context(#[tokio::test]async fn blocked_when_install_disabled() {let tool = InstallToolTool::new(policy(false, AutonomyLevel::Full));- let result = tool.execute_with_context(json!({ "package": "jq" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);@@ -44,7 +49,12 @@ async fn blocked_when_install_disabled() {#[tokio::test]async fn blocked_when_readonly() {let tool = InstallToolTool::new(policy(true, AutonomyLevel::ReadOnly));- let result = tool.execute_with_context(json!({ "package": "jq" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);@@ -54,7 +64,12 @@ async fn blocked_when_readonly() {#[tokio::test]async fn rejects_injection_in_package_name() {let tool = InstallToolTool::new(policy(true, AutonomyLevel::Full));- let result = tool.execute_with_context(json!({ "package": "jq; rm -rf /" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq; rm -rf /" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rsindex 4bbca6b76b..84ceea7025 100644--- a/crates/openhuman-core/src/tools/impl/system/shell.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs@@ -3,8 +3,8 @@ use super::shell_description::{command_param_description, shell_description};use super::shell_support::container_environment;use super::shell_support::{command_failure, exec_result, python_utf8_env, tool_timeout_message};use crate::agent::host_runtime::RuntimeAdapter;-use crate::config::Config;use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;+use crate::config::Config;use crate::core::runtime::DispatchCtx;use crate::security::{AuditLogger, CommandExecutionLog, SecurityPolicy};use async_trait::async_trait;diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rsindex bca567cd96..0fbbdb0191 100644--- a/crates/openhuman-core/src/tools/mod.rs+++ b/crates/openhuman-core/src/tools/mod.rs@@ -1,9 +1,9 @@pub mod host_extensions;pub(crate) mod native_ops;-pub(crate) mod per_call;mod native_ops_types;pub mod ops;pub mod orchestrator_tools;+pub(crate) mod per_call;pub(crate) mod policy_session;pub mod registry;pub mod rules;diff --git a/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs b/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rsindex 64124b3ff0..9be8d3cc60 100644--- a/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs@@ -119,7 +119,13 @@ async fn readonly_acting_tools_carry_policy_blocked_marker() {serde_json::json!({ "url": "https://example.com" }),),(- Box::new(http_request_tool(&crate::core::runtime::DispatchCtx::ambient(), sec.clone(), vec![], 0, 0)),+ Box::new(http_request_tool(+ &crate::core::runtime::DispatchCtx::ambient(),+ sec.clone(),+ vec![],+ 0,+ 0,+ )),serde_json::json!({ "url": "https://example.com" }),),];diff --git a/crates/openhuman-core/src/tools/per_call_tests.rs b/crates/openhuman-core/src/tools/per_call_tests.rsindex bf242520b5..57f4bf683f 100644--- a/crates/openhuman-core/src/tools/per_call_tests.rs+++ b/crates/openhuman-core/src/tools/per_call_tests.rs@@ -130,7 +130,8 @@ async fn each_call_is_built_around_its_runs_dispatch_context() {let core = CoreContext::for_test(DomainSet::full(), None);let ambient = CoreContext::for_test(DomainSet::full(), None);- let run = crate::agent::tinyagents::host::OpenHumanRunContext::new().with_core(Some(core.clone()));+ let run =+ crate::agent::tinyagents::host::OpenHumanRunContext::new().with_core(Some(core.clone()));let run = run.into_tinyagents(tinyagents_harness::context::RunConfig::new("per-call-ctx"));let context = tinyagents_harness::tool::ToolExecutionContext::from_run_context(&run,diff --git a/crates/openhuman-core/src/web_chat/journal_shadow.rs b/crates/openhuman-core/src/web_chat/journal_shadow.rsindex 457333e4b9..c48b484cde 100644--- a/crates/openhuman-core/src/web_chat/journal_shadow.rs+++ b/crates/openhuman-core/src/web_chat/journal_shadow.rs@@ -115,8 +115,12 @@ pub(super) async fn shadow_compare_journal_projection(return None;};- let observations = match crate::agent::tinyagents::journal::read_run_events(&crate::core::runtime::DispatchCtx::ambient(), &journal_run_id, 0)- .await+ let observations = match crate::agent::tinyagents::journal::read_run_events(+ &crate::core::runtime::DispatchCtx::ambient(),+ &journal_run_id,+ 0,+ )+ .await{Ok(observations) => observations,Err(err) => {