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
refactor(runtime): clean up imports and module re-exports
Steven Enamakel4b901da4855d
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rsindex b73ef0d8e9..078dcd024d 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs@@ -1,7 +1,7 @@use super::*;use crate::core::runtime::DispatchCtx;use std::sync::Arc;-use tokio::sync::{Notify, oneshot};+use tokio::sync::{oneshot, Notify};#[tokio::test]async fn canceled_waiter_closes_handle_returned_by_in_flight_typing_start() {diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rsindex 8fb505d8b5..efd1855b5a 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs@@ -20,8 +20,8 @@use std::sync::Arc;use crate::agent::host_agents::HostAgent;-use crate::channels::SendMessage;use crate::channels::context::ChannelRuntimeContext;+use crate::channels::SendMessage;use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;@@ -29,7 +29,7 @@ use tinychannels_bus as traits;pub(crate) mod posture;mod turn;-pub(crate) use turn::{HostChannelTurn, run_host_agent_turn};+pub(crate) use turn::{run_host_agent_turn, HostChannelTurn};/// Resolve the config-owned target selected for an unbound channel into the/// same trusted host-agent carrier used by channel bindings. The effectivediff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rsindex 512bb00296..897b06d53f 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture.rs@@ -11,8 +11,8 @@use tinytools::{PermissionLevel, Tool};-use crate::agent::HostTools;use crate::agent::turn_origin::AgentTurnOrigin;+use crate::agent::HostTools;use crate::config::Config;/// The most a host agent may do on a turn from `origin`; `None` leaves thediff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rsindex 75b07b6cf6..ee804b5dfe 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/posture_tests.rs@@ -1,8 +1,8 @@use super::*;use crate::agent::HostTurnTools;-use serde_json::{Value, json};-use std::sync::Arc;+use serde_json::{json, Value};use std::sync::atomic::{AtomicUsize, Ordering};+use std::sync::Arc;use tinytools::{ToolCallOptions, ToolResult};fn external() -> AgentTurnOrigin {diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rsindex 9bd79b5bb0..43862f6b3a 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs@@ -17,14 +17,14 @@ mod processor;mod routing;pub(crate) use processor::progressive::{- NativeProgressiveTarget, delivery_succeeded, hosted_relay_target,+ delivery_succeeded, hosted_relay_target, NativeProgressiveTarget,};#[cfg(test)]pub(crate) use processor::process_channel_message;pub(crate) use processor::{- RuntimeChannelMessage, process_channel_runtime_message, reset_durable_channel_session,- run_message_dispatch_loop,+ process_channel_runtime_message, reset_durable_channel_session, run_message_dispatch_loop,+ RuntimeChannelMessage,};// `channel_has_approval_surface` stays pub(crate) on processor; re-export so@@ -40,7 +40,7 @@ pub(crate) use helpers::build_channel_context_block;use helpers::select_acknowledgment_reaction;#[cfg(test)]-use routing::{AgentScoping, build_visible_tool_set};+use routing::{build_visible_tool_set, AgentScoping};#[cfg(any(test, debug_assertions))]use tinychannels_bus as traits;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rsindex 114c265c62..67770808b1 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs@@ -1,7 +1,7 @@//! The orchestrator path: an unbound channel's turn goes over the native bus//! to the `agent.run_turn` handler, with the orchestrator's tool scoping.-use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};use crate::agent::turn_origin::AgentTurnOrigin;use crate::channels::context::{ChannelRouteSelection, ChannelRuntimeContext};use crate::core::bus::BUS;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 382f1caef4..1d7a1fd0fa 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -1,11 +1,11 @@//! The per-message pipeline: typing indicator, ACK reaction, durable-session//! dispatch through the shared runner, and final reply delivery.-use crate::channels::SendMessage;-use crate::channels::context::{ChannelRuntimeContext, is_context_window_overflow_error};+use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeContext};#[cfg(test)]use crate::channels::routes::get_or_create_turn_model_source;use crate::channels::routes::{get_route_selection, handle_runtime_command_with_reset};+use crate::channels::SendMessage;use crate::core::bus::BUS;use crate::core::events::DomainEvent;use crate::util::truncate_with_ellipsis;@@ -15,12 +15,12 @@ use tokio_util::sync::CancellationToken;use tokio_util::task::AbortOnDropHandle;use super::super::helpers::{- REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,- spawn_typing_task,+ build_channel_context_block, log_worker_join_result, spawn_typing_task,+ REPLY_LOG_TRUNCATE_CHARS,};use super::super::host_agent::{self, HostRoute};-use super::RuntimeChannelMessage;use super::approval::{channel_has_approval_surface, try_route_approval_reply};+use super::RuntimeChannelMessage;fn inbound_console_preview(envelope: &tinychannels_bus::ChannelInboundEnvelope,diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rsindex 195095eb90..803fd74a03 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs@@ -10,8 +10,8 @@ use crate::agent::harness::host_definition::{AgentDefinition, AgentDefinitionReguse crate::agent::prompts::ConnectedIntegration;use crate::config::Config;use crate::integrations::composio::{- FetchConnectedIntegrationsStatus, cached_active_integrations,- fetch_connected_integrations_status,+ cached_active_integrations, fetch_connected_integrations_status,+ FetchConnectedIntegrationsStatus,};use crate::tools::orchestrator_tools;use std::collections::HashSet;diff --git a/crates/openhuman-core/src/channels/runtime/mod.rs b/crates/openhuman-core/src/channels/runtime/mod.rsindex 0fe7ce7382..aca5a7a8cc 100644--- a/crates/openhuman-core/src/channels/runtime/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/mod.rs@@ -4,23 +4,23 @@ pub(crate) mod dispatch;pub(crate) mod session;mod startup;-pub(crate) use startup::ChannelHandle;-#[cfg(test)]-pub(crate) use startup::TestChannel;pub(crate) use startup::hydrate_channel_credentials;-#[cfg(test)]-pub(crate) use startup::prepare_module_runtime_for_test_in_context;pub(crate) use startup::prepare_runtime_limits;pub use startup::start_channels;pub(crate) use startup::start_channels_with_session;+pub(crate) use startup::ChannelHandle;+#[cfg(test)]+pub(crate) use startup::TestChannel;#[cfg(test)]-pub(crate) use startup::{ModuleRuntimeTestGuard, prepare_module_runtime_for_test};+pub(crate) use startup::{prepare_module_runtime_for_test, ModuleRuntimeTestGuard};+#[cfg(test)]+pub(crate) use startup::prepare_module_runtime_for_test_in_context;// The hosted-channel relay (`channels::providers::relay`) runs one message// through the same pipeline, with a context built from the caller's config.#[cfg(test)]pub(crate) use dispatch::process_channel_message;-pub(crate) use dispatch::{RuntimeChannelMessage, process_channel_runtime_message};-pub(crate) use startup::{PromptToolDescs, build_channel_turn_parts, runtime_context};+pub(crate) use dispatch::{process_channel_runtime_message, RuntimeChannelMessage};+pub(crate) use startup::{build_channel_turn_parts, runtime_context, PromptToolDescs};#[cfg(test)]pub mod test_support;diff --git a/crates/openhuman-core/src/channels/runtime/session_tests.rs b/crates/openhuman-core/src/channels/runtime/session_tests.rsindex 3502a55425..6aa6d4da36 100644--- a/crates/openhuman-core/src/channels/runtime/session_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/session_tests.rs@@ -1,7 +1,7 @@use super::*;use crate::core::runtime::DispatchCtx;-use std::sync::Arc;use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};+use std::sync::Arc;#[tokio::test]async fn independent_local_runtime_does_not_need_an_account_session() {diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rsindex 46f330f0a6..dbd5fe4f6b 100644--- a/crates/openhuman-core/src/channels/runtime/startup.rs+++ b/crates/openhuman-core/src/channels/runtime/startup.rs@@ -277,7 +277,7 @@ pub(crate) async fn prepare_runtime_limits(pub(crate) use credentials::hydrate_channel_credentials;pub use start_channels::start_channels;pub(crate) use start_channels::start_channels_with_session;-pub(crate) use turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};+pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};/// Owns a real module-backed channel runtime for channel policy tests.///@@ -296,8 +296,9 @@ impl ModuleRuntimeTestGuard {pub(crate) fn module_objects(&self,- ) -> std::sync::Arc<std::collections::HashMap<String, tinybus::module::ModuleObjectClient>>- {+ ) -> std::sync::Arc<+ std::collections::HashMap<String, tinybus::module::ModuleObjectClient>,+ > {self.0.module_objects()}@@ -351,7 +352,7 @@ pub(crate) async fn prepare_module_runtime_for_test_in_context(#[cfg(test)]use crate::config::Config;#[cfg(test)]-use chat_workload::{ChatWorkloadResolution, resolve_chat_workload};+use chat_workload::{resolve_chat_workload, ChatWorkloadResolution};#[cfg(any(test, debug_assertions))]use credentials::resolve_yuanbao_app_secret;#[cfg(any(test, debug_assertions))]diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rsindex dd61e0e670..1c4827b34f 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs@@ -163,16 +163,14 @@ fn callback_for_channels(let context_slot: Arc<OnceLock<Weak<ChannelRuntimeContext>>> = Arc::new(OnceLock::new());assert!(context_slot.set(Arc::downgrade(&context)).is_ok());let progressive_slot = Arc::new(OnceLock::new());- assert!(- progressive_slot- .set(Arc::new(- progressive_channels- .into_iter()- .map(|(name, adapter)| (name, Arc::downgrade(&adapter)))- .collect()- ))- .is_ok()- );+ assert!(progressive_slot+ .set(Arc::new(+ progressive_channels+ .into_iter()+ .map(|(name, adapter)| (name, Arc::downgrade(&adapter)))+ .collect()+ ))+ .is_ok());let (dispatch, _receiver) = tokio::sync::mpsc::channel::<RuntimeChannelMessage>(1);let mut callback = ChannelHostCallbacks::new(&crate::core::runtime::DispatchCtx::host_default(),@@ -598,16 +596,14 @@ async fn native_progressive_callbacks_stop_after_channel_session_cancellation());callback.cancellation.cancel();- assert!(- callback- .dispatch_controller_backend(output_event_request(- Some("telegram:bot-b"),- Some("chat-42"),- Some("turn-15"),- ))- .await- .is_err()- );+ assert!(callback+ .dispatch_controller_backend(output_event_request(+ Some("telegram:bot-b"),+ Some("chat-42"),+ Some("turn-15"),+ ))+ .await+ .is_err());assert!(observer.seen.lock().await.is_empty());}@@ -639,16 +635,14 @@ async fn native_progressive_callbacks_fail_closed_after_transport_owner_drops()drop(context);drop(adapter);- assert!(- callback- .dispatch_controller_backend(output_event_request(- Some("telegram:bot-b"),- Some("chat-42"),- Some("turn-16"),- ))- .await- .is_err()- );+ assert!(callback+ .dispatch_controller_backend(output_event_request(+ Some("telegram:bot-b"),+ Some("chat-42"),+ Some("turn-16"),+ ))+ .await+ .is_err());}#[path = "callback_inbound_tests.rs"]diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rsindex ea1823dc6b..2b0eb9d56b 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs@@ -23,11 +23,11 @@use std::collections::BTreeMap;use std::path::Path;-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::Digest;use tinychannels_bus::module_delivery::{- DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES, DELIVERY_RESULT_CAPACITY,- DELIVERY_RESULT_TTL_SECONDS, DeliveryQueueEntry, DeliveryTerminalResult,+ DeliveryQueueEntry, DeliveryTerminalResult, DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES,+ DELIVERY_RESULT_CAPACITY, DELIVERY_RESULT_TTL_SECONDS,};use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rsindex 3f823619a5..0ef78cbd00 100644--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs@@ -9,11 +9,11 @@ use anyhow::{Context, Result};use std::collections::HashMap;use std::sync::{Arc, OnceLock, Weak};use tinybus::module::{ModuleCallError, ModuleClient, ModuleObjectClient};-use tinychannels_bus::SendMessage;use tinychannels_bus::module_runtime::{ChannelIngressKind, ChannelMessagePreparation, ConfiguredChannelInfo,};use tinychannels_bus::module_supervision::ChannelSupervisionPolicy;+use tinychannels_bus::SendMessage;use tinychannels_bus::{ChannelInteraction, ChannelInteractionResult};use tokio::sync::mpsc;diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers_hosted_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers_hosted_tests.rsindex 4e09e82437..de96908b6f 100644--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers_hosted_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers_hosted_tests.rs@@ -301,16 +301,14 @@ async fn hosted_target_projects_typed_media_and_voice_to_web_and_gateway_once()assert_eq!(image_gateway.context().thread_id, thread_id);assert!(image_gateway.belongs_to("relay-typed-output-agent"));assert!(image_gateway.belongs_to_profile("relay-typed-output-profile"));- assert!(- image_gateway_wire["structured"]["parts"]- .as_array()- .expect("typed provider parts")- .iter()- .any(|part| {- part["part"]["kind"] == "image"- && part["part"]["media"]["opaqueId"] == "media:tenant7/thread42/image1"- })- );+ assert!(image_gateway_wire["structured"]["parts"]+ .as_array()+ .expect("typed provider parts")+ .iter()+ .any(|part| {+ part["part"]["kind"] == "image"+ && part["part"]["media"]["opaqueId"] == "media:tenant7/thread42/image1"+ }));let voice_gateway = gateway_terminals.iter().find(|event| {@@ -323,17 +321,15 @@ async fn hosted_target_projects_typed_media_and_voice_to_web_and_gateway_once()assert_eq!(voice_gateway.context().thread_id, thread_id);assert!(voice_gateway.belongs_to("relay-typed-output-agent"));assert!(voice_gateway.belongs_to_profile("relay-typed-output-profile"));- assert!(- voice_gateway_wire["structured"]["parts"]- .as_array()- .expect("typed voice provider parts")- .iter()- .any(|part| {- part["kind"] == "voice"- && part["voice"]["kind"] == "media"- && part["voice"]["media"]["opaqueId"] == "media:tenant7/thread42/voice1"- })- );+ assert!(voice_gateway_wire["structured"]["parts"]+ .as_array()+ .expect("typed voice provider parts")+ .iter()+ .any(|part| {+ part["kind"] == "voice"+ && part["voice"]["kind"] == "media"+ && part["voice"]["media"]["opaqueId"] == "media:tenant7/thread42/voice1"+ }));let expected_channel_ref = serde_json::to_value(&channel).expect("expected channel ref");let expected_conversation_ref =serde_json::to_value(&conversation).expect("expected conversation ref");diff --git a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rsindex 271b99d4bb..040e6521f0 100644--- a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs@@ -39,7 +39,7 @@ fn module_callback_error_does_not_expose_provider_details() {#[test]fn receipt_scope_requires_exact_channel_and_full_conversation_identity() {- use tinychannels_bus::channel::{MessageReceipt, types::ConversationKind};+ use tinychannels_bus::channel::{types::ConversationKind, MessageReceipt};use tinychannels_bus::{ChannelRef, ConversationRef};let channel = ChannelRef {diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rsindex 5389f2d905..0073b73aed 100644--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs@@ -3,7 +3,7 @@use super::super::dispatch::run_message_dispatch_loop;use super::module_providers::ModuleChannelRuntime;-use super::turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};+use super::turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rsindex ac5a8befb5..29e21c6cf9 100644--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs@@ -6,7 +6,7 @@//! the caller's own config and policy, so a relayed turn never runs with the//! operator's tools or workspace.-use super::chat_workload::{ChatWorkloadResolution, resolve_chat_workload};+use super::chat_workload::{resolve_chat_workload, ChatWorkloadResolution};use super::prompt::format_access_context;use crate::agent::host_runtime;use crate::channels::context::ChannelRuntimeContext;diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rsindex 2977d557c1..42c2c7dde8 100644--- a/crates/openhuman-core/src/channels/runtime/startup_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup_tests.rs@@ -7,7 +7,7 @@//! (cloud) path is preserved for users who haven't picked a local ///! BYOK model, and the override path activates for those who have.-use super::{ChatWorkloadResolution, resolve_chat_workload};+use super::{resolve_chat_workload, ChatWorkloadResolution};use crate::config::Config;fn config_with_chat_provider(s: Option<&str>) -> Config {