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(channels): reflow channel module formatting and imports
Steven Enamakel2e5f6909889b
diff --git a/crates/openhuman-core/src/channels/context.rs b/crates/openhuman-core/src/channels/context.rsindex 24e00ad1f2..fee410b054 100644--- a/crates/openhuman-core/src/channels/context.rs+++ b/crates/openhuman-core/src/channels/context.rs@@ -13,14 +13,16 @@ use tinyagents_session::transcript::TranscriptMessage;use tinytools::Tool;pub(crate) use tinychannels_bus::context::{- ChannelRouteSelection,- CHANNEL_HISTORY_COMPACT_CONTENT_CHARS, CHANNEL_HISTORY_COMPACT_KEEP_MESSAGES,- CHANNEL_MESSAGE_TIMEOUT_SECS, CHANNEL_TYPING_REFRESH_INTERVAL_SECS,- DEFAULT_CHANNEL_INITIAL_BACKOFF_SECS, DEFAULT_CHANNEL_MAX_BACKOFF_SECS, MAX_CHANNEL_HISTORY,+ ChannelRouteSelection, CHANNEL_HISTORY_COMPACT_CONTENT_CHARS,+ CHANNEL_HISTORY_COMPACT_KEEP_MESSAGES, CHANNEL_MESSAGE_TIMEOUT_SECS,+ CHANNEL_TYPING_REFRESH_INTERVAL_SECS, DEFAULT_CHANNEL_INITIAL_BACKOFF_SECS,+ DEFAULT_CHANNEL_MAX_BACKOFF_SECS, MAX_CHANNEL_HISTORY,};#[cfg(test)]-pub(crate) use tinychannels::context::{MIN_CHANNEL_MESSAGE_TIMEOUT_SECS, effective_channel_message_timeout_secs};+pub(crate) use tinychannels::context::{+ effective_channel_message_timeout_secs, MIN_CHANNEL_MESSAGE_TIMEOUT_SECS,+};/// Per-sender conversation history for channel messages.pub(crate) type ConversationHistoryMap = Arc<Mutex<HashMap<String, Vec<TranscriptMessage>>>>;@@ -60,7 +62,9 @@ pub(crate) struct ChannelRuntimeContext {}/// Resolve the configured module client; unit tests use an attested bus fixture.-pub(crate) async fn module_client(ctx: &ChannelRuntimeContext) -> crate::modules::client::ModuleClient {+pub(crate) async fn module_client(+ ctx: &ChannelRuntimeContext,+) -> crate::modules::client::ModuleClient {#[cfg(test)]if ctx.config.is_none() {return super::module_fixture::client().await;@@ -110,9 +114,22 @@ pub(crate) fn compact_sender_history(ctx: &ChannelRuntimeContext, sender_key: &strue}-pub(crate) async fn is_context_window_overflow_error(ctx: &ChannelRuntimeContext, err: &anyhow::Error) -> Result<bool, crate::modules::client::ModuleCallError> {+pub(crate) async fn is_context_window_overflow_error(+ ctx: &ChannelRuntimeContext,+ err: &anyhow::Error,+) -> Result<bool, crate::modules::client::ModuleCallError> {use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};- match module_client(ctx).await.call_confidential("tinychannels", tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL, (ChannelControlRequest::Overflow { message: err.to_string() },)).await? {+ match module_client(ctx)+ .await+ .call_confidential(+ "tinychannels",+ tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL,+ (ChannelControlRequest::Overflow {+ message: err.to_string(),+ },),+ )+ .await?+ {ChannelControlResult::Overflow(overflow) => Ok(overflow),_ => {crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rsindex d59c4b31b3..9ee00b44b6 100644--- a/crates/openhuman-core/src/channels/context_tests.rs+++ b/crates/openhuman-core/src/channels/context_tests.rs@@ -120,10 +120,15 @@ fn clear_and_compact_sender_history_update_cached_messages() {#[tokio::test]async fn overflow_detection_covers_edge_cases() {let ctx = runtime_context();- assert!(is_context_window_overflow_error(&ctx, &anyhow::anyhow!(- "Maximum context length exceeded"- )).await.unwrap());- assert!(!is_context_window_overflow_error(&ctx, &anyhow::anyhow!(- "network timeout"- )).await.unwrap());+ assert!(is_context_window_overflow_error(+ &ctx,+ &anyhow::anyhow!("Maximum context length exceeded")+ )+ .await+ .unwrap());+ assert!(+ !is_context_window_overflow_error(&ctx, &anyhow::anyhow!("network timeout"))+ .await+ .unwrap()+ );}diff --git a/crates/openhuman-core/src/channels/controllers/backend.rs b/crates/openhuman-core/src/channels/controllers/backend.rsindex 2b3bf0a4a8..ba06b1e4bc 100644--- a/crates/openhuman-core/src/channels/controllers/backend.rs+++ b/crates/openhuman-core/src/channels/controllers/backend.rs@@ -2,7 +2,7 @@use async_trait::async_trait;use serde::Serialize;-use serde_json::{Value, json};+use serde_json::{json, Value};use crate::config::{ChannelsConfig, Config};use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rsindex efb9ee1e2e..f13064593b 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs@@ -1,6 +1,54 @@//! Small helpers shared across the connect/disconnect/status operations.-pub(crate) use tinychannels::controllers::channel_config_connected;+pub(crate) async fn channel_config_connected(+ config: &crate::config::Config,+ channel: &str,+ mode: tinychannels_bus::ChannelAuthMode,+) -> Result<bool, String> {+ let channels = &config.channels_config;+ let configured = [+ ("telegram", channels.telegram.is_some()),+ ("discord", channels.discord.is_some()),+ ("slack", channels.slack.is_some()),+ ("mattermost", channels.mattermost.is_some()),+ ("imessage", channels.imessage.is_some()),+ ("matrix", channels.matrix.is_some()),+ ("signal", channels.signal.is_some()),+ ("whatsapp", channels.whatsapp.is_some()),+ ("linq", channels.linq.is_some()),+ ("email", channels.email.is_some()),+ ("irc", channels.irc.is_some()),+ ("lark", channels.lark.is_some()),+ ("dingtalk", channels.dingtalk.is_some()),+ ("qq", channels.qq.is_some()),+ ("yuanbao", channels.yuanbao.is_some()),+ ]+ .into_iter()+ .filter(|(_, present)| *present)+ .map(|(name, _)| name.to_owned())+ .collect();+ let client = crate::modules::client::ModuleClient::new(config.clone());+ use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};+ match client+ .call_confidential(+ "tinychannels",+ tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL,+ (ChannelControlRequest::Connected {+ configured,+ channel: channel.into(),+ mode,+ },),+ )+ .await+ .map_err(|e| e.to_string())?+ {+ ChannelControlResult::Connected(connected) => Ok(connected),+ _ => {+ crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");+ Err(crate::modules::client::ModuleCallError::ModuleFault.to_string())+ }+ }+}/// Merge a channel's live supervised-listener health into its credential/config/// derived `connected` flag (issue #3712).diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rsindex c8b7cb09df..b6ef841a4b 100644--- a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs@@ -46,7 +46,7 @@ pub async fn channel_status(for spec in &def.auth_modes {let provider_key = credential_provider(def.id, spec.mode);let has_creds = stored_providers.iter().any(|p| p == &provider_key);- let has_config = channel_config_connected(&config.channels_config, def.id, spec.mode);+ let has_config = channel_config_connected(config, def.id, spec.mode).await?;let presence_connected = has_creds || has_config;let (connected, error) = merge_listener_health(presence_connected,diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex f48b93bb24..67d0ef5c64 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -1,16 +1,19 @@//! Host-owned approval routing and turn events over the channel module.+use crate::channels::{Channel, ChannelSendExt, SendMessage};+use crate::core::events::DomainEvent;+use crate::modules::client::ModuleClient;+use async_trait::async_trait;use std::collections::HashMap;use std::path::PathBuf;use std::sync::{Arc, Mutex};-use async_trait::async_trait;use tinybus::EventHandler;use tinychannels_bus::{capabilities_for, ChannelMessage};-use crate::channels::{Channel, ChannelSendExt, SendMessage};-use crate::core::events::DomainEvent;-use crate::modules::client::ModuleClient;#[derive(Clone)]-struct ReplyContext { reply_target: String, thread_ts: Option<String> }+struct ReplyContext {+ reply_target: String,+ thread_ts: Option<String>,+}/// Captures the account configuration and reply addresses used by approvals.pub struct ChannelApprovalSurfaceSubscriber {@@ -20,53 +23,150 @@ pub struct ChannelApprovalSurfaceSubscriber {cancellation: tokio_util::sync::CancellationToken,}impl ChannelApprovalSurfaceSubscriber {- pub fn with_config(channels: Arc<HashMap<String, Arc<dyn Channel>>>, config: Arc<crate::config::Config>) -> Self {- Self { channels, replies: Mutex::new(HashMap::new()), config: Some(config), cancellation: super::super::runtime::session::channel_session() }+ pub fn with_config(+ channels: Arc<HashMap<String, Arc<dyn Channel>>>,+ config: Arc<crate::config::Config>,+ ) -> Self {+ Self {+ channels,+ replies: Mutex::new(HashMap::new()),+ config: Some(config),+ cancellation: super::super::runtime::session::channel_session(),+ }}#[cfg(test)]pub fn new(channels: Arc<HashMap<String, Arc<dyn Channel>>>) -> Self {- Self { channels, replies: Mutex::new(HashMap::new()), config: None, cancellation: tokio_util::sync::CancellationToken::new() }+ Self {+ channels,+ replies: Mutex::new(HashMap::new()),+ config: None,+ cancellation: tokio_util::sync::CancellationToken::new(),+ }}async fn client(&self) -> ModuleClient {#[cfg(test)]- if self.config.is_none() { return crate::channels::module_fixture::client().await; }+ if self.config.is_none() {+ return crate::channels::module_fixture::client().await;+ }ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default())}}#[async_trait]impl EventHandler<DomainEvent> for ChannelApprovalSurfaceSubscriber {- fn name(&self) -> &str { "channels::approval_surface" }- fn domains(&self) -> Option<&[&str]> { Some(&["channel", "approval"]) }+ fn name(&self) -> &str {+ "channels::approval_surface"+ }+ fn domains(&self) -> Option<&[&str]> {+ Some(&["channel", "approval"])+ }async fn handle(&self, event: &DomainEvent) {- if self.cancellation.is_cancelled() { return; }+ if self.cancellation.is_cancelled() {+ return;+ }match event {- DomainEvent::ChannelMessageReceived { channel, message_id, sender, reply_target, content, thread_ts, inbound_envelope, workspace_dir } => {- if !capabilities_for(channel).chat_approvals { return; }- if self.config.as_ref().is_some_and(|config| config.workspace_dir != *workspace_dir) { return; }- let prepared = crate::modules::channel_controller::prepare_inbound(&self.client().await,+ DomainEvent::ChannelMessageReceived {+ channel,+ message_id,+ sender,+ reply_target,+ content,+ thread_ts,+ inbound_envelope,+ workspace_dir,+ } => {+ if !capabilities_for(channel).chat_approvals {+ return;+ }+ if self+ .config+ .as_ref()+ .is_some_and(|config| config.workspace_dir != *workspace_dir)+ {+ return;+ }+ let prepared = crate::modules::channel_controller::prepare_inbound(+ &self.client().await,tinychannels_bus::module_inbound::PrepareChannelInboundRequest {- namespace: "main".into(), session_policy: Default::default(),+ namespace: "main".into(),+ session_policy: Default::default(),source: tinychannels_bus::module_inbound::ChannelInboundSource::Legacy {- message: ChannelMessage { id: message_id.clone(), channel: channel.clone(), sender: sender.clone(), reply_target: reply_target.clone(), content: content.clone(), timestamp: 0, thread_ts: thread_ts.clone(), sender_name: None },+ message: ChannelMessage {+ id: message_id.clone(),+ channel: channel.clone(),+ sender: sender.clone(),+ reply_target: reply_target.clone(),+ content: content.clone(),+ timestamp: 0,+ thread_ts: thread_ts.clone(),+ sender_name: None,+ },envelope: inbound_envelope.clone(),},- }).await;+ },+ )+ .await;if let Ok(prepared) = prepared {- self.replies.lock().unwrap_or_else(|e| e.into_inner()).insert(prepared.history_key, ReplyContext { reply_target: reply_target.clone(), thread_ts: thread_ts.clone() });+ self.replies+ .lock()+ .unwrap_or_else(|e| e.into_inner())+ .insert(+ prepared.history_key,+ ReplyContext {+ reply_target: reply_target.clone(),+ thread_ts: thread_ts.clone(),+ },+ );}}- DomainEvent::ApprovalRequested { tool_name, action_summary, thread_id: Some(thread_id), client_id: Some(channel_name), .. } => {- if !capabilities_for(channel_name).chat_approvals { return; }- let reply = self.replies.lock().unwrap_or_else(|e| e.into_inner()).get(thread_id).cloned();- let (Some(reply), Some(channel)) = (reply, self.channels.get(channel_name)) else { return; };- use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};- let response = self.client().await.call_confidential::<ChannelControlResult>("tinychannels", tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL, (ChannelControlRequest::Approval { tool_name: tool_name.clone(), action_summary: action_summary.clone() },)).await;+ DomainEvent::ApprovalRequested {+ tool_name,+ action_summary,+ thread_id: Some(thread_id),+ client_id: Some(channel_name),+ ..+ } => {+ if !capabilities_for(channel_name).chat_approvals {+ return;+ }+ let reply = self+ .replies+ .lock()+ .unwrap_or_else(|e| e.into_inner())+ .get(thread_id)+ .cloned();+ let (Some(reply), Some(channel)) = (reply, self.channels.get(channel_name)) else {+ return;+ };+ use tinychannels_bus::module_control::{+ ChannelControlRequest, ChannelControlResult,+ };+ let response = self+ .client()+ .await+ .call_confidential::<ChannelControlResult>(+ "tinychannels",+ tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL,+ (ChannelControlRequest::Approval {+ tool_name: tool_name.clone(),+ action_summary: action_summary.clone(),+ },),+ )+ .await;match response {Ok(ChannelControlResult::Approval(body)) => {- if self.cancellation.is_cancelled() { return; }- let _ = channel.send_with_outbound_intent(&SendMessage::new(body, &reply.reply_target).in_thread(reply.thread_ts)).await;+ if self.cancellation.is_cancelled() {+ return;+ }+ let _ = channel+ .send_with_outbound_intent(+ &SendMessage::new(body, &reply.reply_target)+ .in_thread(reply.thread_ts),+ )+ .await;+ }+ Ok(_) => {+ ModuleClient::report_malformed_reply("tinychannels");}- Ok(_) => { ModuleClient::report_malformed_reply("tinychannels"); }Err(_) => {}}}@@ -83,30 +183,74 @@ pub struct ChannelTurnStateSubscriber {}impl ChannelTurnStateSubscriber {pub fn with_config(config: Arc<crate::config::Config>) -> Self {- Self { workspace_dir: config.workspace_dir.clone(), config: Some(config), cancellation: super::super::runtime::session::channel_session() }+ Self {+ workspace_dir: config.workspace_dir.clone(),+ config: Some(config),+ cancellation: super::super::runtime::session::channel_session(),+ }}#[cfg(test)]pub fn new(workspace_dir: PathBuf) -> Self {- Self { workspace_dir, config: None, cancellation: tokio_util::sync::CancellationToken::new() }+ Self {+ workspace_dir,+ config: None,+ cancellation: tokio_util::sync::CancellationToken::new(),+ }}async fn mark(&self, channel: &str, reply_target: &str, event_ws: &PathBuf, busy: bool) {- if self.cancellation.is_cancelled() || !capabilities_for(channel).remote_control || *event_ws != self.workspace_dir { return; }+ if self.cancellation.is_cancelled()+ || !capabilities_for(channel).remote_control+ || *event_ws != self.workspace_dir+ {+ return;+ }#[cfg(test)]- let client = if self.config.is_none() { crate::channels::module_fixture::client().await } else { ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default()) };+ let client = if self.config.is_none() {+ crate::channels::module_fixture::client().await+ } else {+ ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default())+ };#[cfg(not(test))]let client = ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default());- let result: Result<tinychannels_bus::module_remote::RemoteOperationResult, _> = client.call_confidential("tinychannels", tinychannels_bus::methods::EXECUTE_REMOTE, (tinychannels_bus::module_remote::RemoteOperation::MarkTurn { workspace_dir: self.workspace_dir.to_string_lossy().into_owned(), channel: channel.into(), reply_target: reply_target.into(), busy },)).await;- if result.is_err() { tracing::debug!("channel turn status unavailable"); }+ let result: Result<tinychannels_bus::module_remote::RemoteOperationResult, _> = client+ .call_confidential(+ "tinychannels",+ tinychannels_bus::methods::EXECUTE_REMOTE,+ (tinychannels_bus::module_remote::RemoteOperation::MarkTurn {+ workspace_dir: self.workspace_dir.to_string_lossy().into_owned(),+ channel: channel.into(),+ reply_target: reply_target.into(),+ busy,+ },),+ )+ .await;+ if result.is_err() {+ tracing::debug!("channel turn status unavailable");+ }}}#[async_trait]impl EventHandler<DomainEvent> for ChannelTurnStateSubscriber {- fn name(&self) -> &str { "channels::turn_state" }- fn domains(&self) -> Option<&[&str]> { Some(&["channel"]) }+ fn name(&self) -> &str {+ "channels::turn_state"+ }+ fn domains(&self) -> Option<&[&str]> {+ Some(&["channel"])+ }async fn handle(&self, event: &DomainEvent) {match event {- DomainEvent::ChannelMessageReceived { channel, reply_target, workspace_dir, .. } => self.mark(channel, reply_target, workspace_dir, true).await,- DomainEvent::ChannelMessageProcessed { channel, reply_target, workspace_dir, .. } => self.mark(channel, reply_target, workspace_dir, false).await,+ DomainEvent::ChannelMessageReceived {+ channel,+ reply_target,+ workspace_dir,+ ..+ } => self.mark(channel, reply_target, workspace_dir, true).await,+ DomainEvent::ChannelMessageProcessed {+ channel,+ reply_target,+ workspace_dir,+ ..+ } => self.mark(channel, reply_target, workspace_dir, false).await,_ => {}}}diff --git a/crates/openhuman-core/src/channels/module_fixture_tests.rs b/crates/openhuman-core/src/channels/module_fixture_tests.rsindex 4af9d44871..01df3263ac 100644--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs@@ -108,10 +108,10 @@ async fn linked_module_prepares_runtime_limits_over_confidential_bus_call() {#[tokio::test]async fn linked_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {- use tinychannels_bus::ChannelMessage;use tinychannels_bus::module_inbound::{ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,};+ use tinychannels_bus::ChannelMessage;let message = ChannelMessage {id: "message-1".into(),diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 31047af8e4..c8f74160b1 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -3,15 +3,15 @@use std::collections::HashMap;use std::sync::Arc;-use serde_json::{Value, json};+use serde_json::{json, Value};use super::channel::RelayChannel;use super::params::RelayInboundParams;use super::store::{self, Recorded};use crate::channels::context::MAX_CHANNEL_HISTORY;use crate::channels::runtime::{- PromptToolDescs, build_channel_turn_parts, prepare_runtime_limits,- process_channel_runtime_message, runtime_context,+ build_channel_turn_parts, prepare_runtime_limits, process_channel_runtime_message,+ runtime_context, PromptToolDescs,};use crate::config::Config;use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex 064596391b..1c1be030a1 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -1,6 +1,6 @@use super::super::channel::CHANNEL_OUTBOUND_EVENT;use super::*;-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};use crate::agent::turn_origin::AgentTurnOrigin;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};use std::sync::Mutex;diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 39d3492dd2..ec0f19b3d9 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -1,17 +1,21 @@//! Per-sender routing and runtime command handling.-use super::context::{- clear_sender_history, ChannelRouteSelection, ChannelRuntimeContext,-};+use super::context::{clear_sender_history, ChannelRouteSelection, ChannelRuntimeContext};use super::traits;use super::{Channel, ChannelSendExt, SendMessage};use crate::inference::provider;use std::sync::Arc;#[cfg(test)]use tinychannels::remote::{parse_remote_command, RemoteCommand};-use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult, ProviderDescriptor};#[cfg(test)]-use tinychannels::routes::{parse_runtime_command as parse_portable_runtime_command, resolve_provider_alias as resolve_portable_provider_alias, ChannelRuntimeCommand as PortableCommand};+use tinychannels::routes::{+ parse_runtime_command as parse_portable_runtime_command,+ resolve_provider_alias as resolve_portable_provider_alias,+ ChannelRuntimeCommand as PortableCommand,+};+use tinychannels_bus::module_control::{+ ChannelControlRequest, ChannelControlResult, ProviderDescriptor,+};#[cfg(test)]#[derive(Debug, Clone, PartialEq, Eq)]@@ -115,13 +119,18 @@ struct RouteCallbacks {#[tinybus::interface(name = "ai.tinyhumans.tinychannels.ChannelsHost")]impl RouteCallbacks {- async fn dispatch_controller_backend(&self, request: tinychannels_bus::ChannelBackendRequest) -> tinybus::Result<tinychannels_bus::ChannelBackendResult> {+ async fn dispatch_controller_backend(+ &self,+ request: tinychannels_bus::ChannelBackendRequest,+ ) -> tinybus::Result<tinychannels_bus::ChannelBackendResult> {if self.cancellation.is_cancelled() {return Err(tinybus::Error::failed("channel session ended"));}match request {tinychannels_bus::ChannelBackendRequest::RemoteControl(request) => {- super::host::remote_control::dispatch_callback(&self.context, request).await.map(tinychannels_bus::ChannelBackendResult::RemoteControl)+ super::host::remote_control::dispatch_callback(&self.context, request)+ .await+ .map(tinychannels_bus::ChannelBackendResult::RemoteControl)}_ => Err(tinybus::Error::failed("channel callback unavailable")),}@@ -140,45 +149,91 @@ pub(crate) async fn handle_runtime_command_if_needed(return false;}let current = get_route_selection(ctx, sender_key);- let history_len = ctx.conversation_histories.lock().unwrap_or_else(|e| e.into_inner()).get(sender_key).map(Vec::len).unwrap_or(0);+ let history_len = ctx+ .conversation_histories+ .lock()+ .unwrap_or_else(|e| e.into_inner())+ .get(sender_key)+ .map(Vec::len)+ .unwrap_or(0);let client = super::context::module_client(ctx).await;let operation = async {- let lease = crate::modules::channel_runtime::ChannelRuntimeLease::open(client, RouteCallbacks {- context: ctx.clone(),- cancellation: super::runtime::session::channel_session(),- }).await?;- let response: Result<ChannelControlResult, _> = lease.object().call_confidential(tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL, (ChannelControlRequest::Route {- workspace_dir: ctx.workspace_dir.to_string_lossy().into_owned(),- message: Box::new(msg.clone()),- route: tinychannels_bus::module_remote::RemoteRoute { provider: current.provider, model: current.model },- history_len,- providers: provider_descriptors(),- },)).await;+ let lease = crate::modules::channel_runtime::ChannelRuntimeLease::open(+ client,+ RouteCallbacks {+ context: ctx.clone(),+ cancellation: super::runtime::session::channel_session(),+ },+ )+ .await?;+ let response: Result<ChannelControlResult, _> = lease+ .object()+ .call_confidential(+ tinychannels_bus::methods::PREPARE_CHANNEL_CONTROL,+ (ChannelControlRequest::Route {+ workspace_dir: ctx.workspace_dir.to_string_lossy().into_owned(),+ message: Box::new(msg.clone()),+ route: tinychannels_bus::module_remote::RemoteRoute {+ provider: current.provider,+ model: current.model,+ },+ history_len,+ providers: provider_descriptors(),+ },),+ )+ .await;let close = lease.close().await;let response = response?;close?;Ok::<_, crate::modules::client::ModuleCallError>(response)- }.await;+ }+ .await;let (reply, next_route, clear_history) = match operation {- Ok(ChannelControlResult::Route { reply, next_route, clear_history }) => (reply, next_route, clear_history),+ Ok(ChannelControlResult::Route {+ reply,+ next_route,+ clear_history,+ }) => (reply, next_route, clear_history),Ok(_) => {crate::modules::client::ModuleClient::report_malformed_reply("tinychannels");return true;}Err(_) => {if let Some(channel) = target_channel {- let _ = channel.send_with_outbound_intent(&SendMessage::new("Channel module unavailable.", &msg.reply_target).in_thread(msg.thread_ts.clone())).await;+ let _ = channel+ .send_with_outbound_intent(+ &SendMessage::new("Channel module unavailable.", &msg.reply_target)+ .in_thread(msg.thread_ts.clone()),+ )+ .await;}return true;}};if let Some(route) = next_route {- set_route_selection(ctx, sender_key, ChannelRouteSelection { provider: route.provider, model: route.model });+ set_route_selection(+ ctx,+ sender_key,+ ChannelRouteSelection {+ provider: route.provider,+ model: route.model,+ },+ );+ }+ if clear_history {+ clear_sender_history(ctx, sender_key);}- if clear_history { clear_sender_history(ctx, sender_key); }- let Some(reply) = reply else { return false; };+ let Some(reply) = reply else {+ return false;+ };if let Some(channel) = target_channel {- if channel.send_with_outbound_intent(&SendMessage::new(reply, &msg.reply_target).in_thread(msg.thread_ts.clone())).await.is_err() {+ if channel+ .send_with_outbound_intent(+ &SendMessage::new(reply, &msg.reply_target).in_thread(msg.thread_ts.clone()),+ )+ .await+ .is_err()+ {tracing::warn!("channel command response failed");}}diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex aba28fddbf..88153cb220 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -1,5 +1,7 @@use super::*;-use crate::channels::context::{conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap};+use crate::channels::context::{+ conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,+};use crate::channels::host::ChannelTurnStateSubscriber;use crate::channels::traits::ChannelMessage;use crate::core::events::DomainEvent;@@ -256,7 +258,13 @@ async fn handle_runtime_command_unknown_provider_sends_helpful_error() {sender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, Some(&channel), &conversation_history_key(&msg)).await;+ let handled = handle_runtime_command_if_needed(+ &ctx,+ &msg,+ Some(&channel),+ &conversation_history_key(&msg),+ )+ .await;assert!(handled);let sent = channel_impl.sent.lock().unwrap();@@ -288,7 +296,13 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_rousender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, Some(&channel), &conversation_history_key(&msg)).await;+ let handled = handle_runtime_command_if_needed(+ &ctx,+ &msg,+ Some(&channel),+ &conversation_history_key(&msg),+ )+ .await;assert!(handled);assert!(ctx@@ -326,7 +340,13 @@ async fn handle_runtime_command_telegram_status_replies_without_agent() {sender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, Some(&channel), &conversation_history_key(&msg)).await;+ let handled = handle_runtime_command_if_needed(+ &ctx,+ &msg,+ Some(&channel),+ &conversation_history_key(&msg),+ )+ .await;assert!(handled);let sent = channel_impl.sent.lock().unwrap();@@ -349,7 +369,8 @@ async fn handle_runtime_command_without_target_channel_still_consumes_command()sender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, None, &conversation_history_key(&msg)).await;+ let handled =+ handle_runtime_command_if_needed(&ctx, &msg, None, &conversation_history_key(&msg)).await;assert!(handled);}@@ -369,7 +390,13 @@ async fn handle_runtime_command_telegram_help_replies_with_remote_command_list()sender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, Some(&channel), &conversation_history_key(&msg)).await;+ let handled = handle_runtime_command_if_needed(+ &ctx,+ &msg,+ Some(&channel),+ &conversation_history_key(&msg),+ )+ .await;assert!(handled);let sent = channel_impl.sent.lock().unwrap();@@ -400,7 +427,13 @@ async fn handle_runtime_command_telegram_sessions_reports_empty_store() {sender_name: None,};- let handled = handle_runtime_command_if_needed(&ctx, &msg, Some(&channel), &conversation_history_key(&msg)).await;+ let handled = handle_runtime_command_if_needed(+ &ctx,+ &msg,+ Some(&channel),+ &conversation_history_key(&msg),+ )+ .await;assert!(handled);let sent = channel_impl.sent.lock().unwrap();@@ -434,7 +467,15 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {thread_ts: Some("42".into()),sender_name: None,};- assert!(handle_runtime_command_if_needed(&ctx, &new_msg, Some(&channel), &conversation_history_key(&new_msg)).await);+ assert!(+ handle_runtime_command_if_needed(+ &ctx,+ &new_msg,+ Some(&channel),+ &conversation_history_key(&new_msg)+ )+ .await+ );assert!(ctx.conversation_histories.lock()@@ -479,7 +520,15 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {thread_ts: Some("42".into()),sender_name: None,};- assert!(handle_runtime_command_if_needed(&ctx, &status_msg, Some(&channel), &conversation_history_key(&status_msg)).await);+ assert!(+ handle_runtime_command_if_needed(+ &ctx,+ &status_msg,+ Some(&channel),+ &conversation_history_key(&status_msg)+ )+ .await+ );let sessions_msg = ChannelMessage {id: "4".into(),@@ -491,7 +540,15 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {thread_ts: Some("42".into()),sender_name: None,};- assert!(handle_runtime_command_if_needed(&ctx, &sessions_msg, Some(&channel), &conversation_history_key(&sessions_msg)).await);+ assert!(+ handle_runtime_command_if_needed(+ &ctx,+ &sessions_msg,+ Some(&channel),+ &conversation_history_key(&sessions_msg)+ )+ .await+ );let sent = channel_impl.sent.lock().unwrap();assert_eq!(sent.len(), 3);diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rsindex acf359e943..6bb1f945a1 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs@@ -3,13 +3,13 @@//! still goes to the orchestrator over the bus.use super::*;-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};use crate::agent::host_agents::{self, HostAgent, HostAgentResolver};-use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};+use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};use crate::channels::runtime::process_channel_message;-use crate::channels::{Channel, SendMessage, traits};+use crate::channels::{traits, Channel, SendMessage};use crate::core::runtime::{CoreContext, DomainSet};-use serde_json::{Value, json};+use serde_json::{json, Value};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};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 3756d37dbd..bf70522fad 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@@ -29,7 +29,7 @@ use crate::core::events::DomainEvent;pub(crate) mod posture;mod turn;-pub(crate) use turn::{HostChannelTurn, run_host_agent_turn, seed_rows};+pub(crate) use turn::{run_host_agent_turn, seed_rows, HostChannelTurn};/// What a channel's binding resolves to for one message.pub(crate) enum HostRoute {diff --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 a73e103e55..a7df3a5833 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 3374999e44..433662df47 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs@@ -16,8 +16,8 @@ mod processor;mod routing;pub(crate) use processor::{- RuntimeChannelMessage, process_channel_message, process_channel_runtime_message,- run_message_dispatch_loop,+ process_channel_message, process_channel_runtime_message, run_message_dispatch_loop,+ RuntimeChannelMessage,};// `channel_has_approval_surface` stays pub(crate) on processor; re-export so@@ -33,7 +33,7 @@ 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 crate::channels::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 ca20bbb05f..79e4bfa101 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::progress::AgentProgress;use crate::agent::turn_origin::AgentTurnOrigin;use crate::channels::context::{ChannelRouteSelection, ChannelRuntimeContext};diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex a97e7318bc..f73d1cf366 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -5,7 +5,7 @@use crate::agent::bus::AgentTurnResponse;use crate::agent::progress::AgentProgress;use crate::channels::context::{- ChannelRuntimeContext, compact_sender_history, is_context_window_overflow_error,+ compact_sender_history, is_context_window_overflow_error, ChannelRuntimeContext,};use crate::channels::routes::{get_or_create_turn_model_source, get_route_selection, handle_runtime_command_if_needed,@@ -22,13 +22,13 @@ 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_scoped_typing_task,+ build_channel_context_block, log_worker_join_result, spawn_scoped_typing_task,+ REPLY_LOG_TRUNCATE_CHARS,};-use super::super::host_agent::{self, HostChannelTurn, HostRoute, run_host_agent_turn, seed_rows};-use super::RuntimeChannelMessage;+use super::super::host_agent::{self, run_host_agent_turn, seed_rows, HostChannelTurn, HostRoute};use super::approval::{channel_has_approval_surface, try_route_approval_reply};use super::bus_turn::dispatch_bus_turn;+use super::RuntimeChannelMessage;pub(crate) async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>,diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/routing.rs b/crates/openhuman-core/src/channels/runtime/dispatch/routing.rsindex 849fcc08c0..55fc6543bc 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::definition::{AgentDefinition, AgentDefinitionRegistryuse 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 24fcf1af7e..205035a9e0 100644--- a/crates/openhuman-core/src/channels/runtime/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/mod.rs@@ -12,13 +12,13 @@ pub(crate) use startup::start_channels_with_session;// The hosted-channel relay (`channels::providers::relay`) runs one message// through the same pipeline, with a context built from the caller's config.pub(crate) use dispatch::process_channel_message;-pub(crate) use startup::{PromptToolDescs, build_channel_turn_parts, runtime_context};+pub(crate) use startup::{build_channel_turn_parts, runtime_context, PromptToolDescs};#[cfg(any(test, debug_assertions))]pub mod test_support;// Re-exported for `channels::tests` only; omit in normal lib builds to avoid unused-import warnings.#[cfg(test)]-pub(crate) use dispatch::{RuntimeChannelMessage, run_message_dispatch_loop};+pub(crate) use dispatch::{run_message_dispatch_loop, RuntimeChannelMessage};#[cfg(test)]pub(crate) use supervision::spawn_supervised_listener;diff --git a/crates/openhuman-core/src/channels/runtime/session_tests.rs b/crates/openhuman-core/src/channels/runtime/session_tests.rsindex 5438f6ccef..4e80f01002 100644--- a/crates/openhuman-core/src/channels/runtime/session_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/session_tests.rs@@ -1,6 +1,6 @@use super::*;-use std::sync::Arc;use std::sync::atomic::{AtomicBool, 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 b9376b0f55..4bee6c13ab 100644--- a/crates/openhuman-core/src/channels/runtime/startup.rs+++ b/crates/openhuman-core/src/channels/runtime/startup.rs@@ -52,7 +52,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};// Re-exported at module scope (rather than left as private `pub(super)`// items reached only through their owning submodule) so the `#[path]` test@@ -61,7 +61,7 @@ pub(crate) use turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_c#[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(test)]diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rsindex 82f3408db0..711b92ad61 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_store.rs@@ -4,8 +4,8 @@ use std::collections::{BTreeMap, HashMap};use std::path::{Path, PathBuf};use std::sync::{Arc, Mutex as StdMutex, OnceLock};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 tokio::sync::Mutex;diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rsindex 931d50f8a2..7882e83d76 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_store_tests.rs@@ -106,11 +106,9 @@ async fn removal_and_failed_delivery_are_idempotent_and_durable() {reopened.load_failed("failed".into()).await.unwrap(),Some(failed));- assert!(- reopened- .load_pending("pending".into())- .await- .unwrap()- .is_none()- );+ assert!(reopened+ .load_pending("pending".into())+ .await+ .unwrap()+ .is_none());}diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rsindex 625700b8c6..635fcbbdd0 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 792f6be474..d10e3dd8ca 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 ce835f5d31..e1b2658508 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, RelayInboundMessageHandler, resolve_chat_workload};+use super::{resolve_chat_workload, ChatWorkloadResolution, RelayInboundMessageHandler};use crate::config::Config;use tinychannels::relay::RelayInboundHandler;diff --git a/crates/openhuman-core/src/channels/runtime/supervision.rs b/crates/openhuman-core/src/channels/runtime/supervision.rsindex bda8b630fb..707d40a51b 100644--- a/crates/openhuman-core/src/channels/runtime/supervision.rs+++ b/crates/openhuman-core/src/channels/runtime/supervision.rs@@ -1,7 +1,7 @@//! OpenHuman observer adapter for TinyChannels listener supervision.-use super::super::Channel;use super::super::traits;+use super::super::Channel;use crate::core::bus::BUS;use crate::core::events::DomainEvent;use std::sync::Arc;@@ -60,7 +60,7 @@ pub(crate) fn spawn_supervised_listener(}#[cfg(test)]-pub(crate) use tinychannels::runtime::{MAX_JITTER_MS, jitter_millis};+pub(crate) use tinychannels::runtime::{jitter_millis, MAX_JITTER_MS};#[cfg(test)]#[path = "supervision_tests.rs"]diff --git a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs b/crates/openhuman-core/src/channels/runtime/supervision_tests.rsindex e679a59d81..bacab56eaa 100644--- a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/supervision_tests.rs@@ -1,5 +1,5 @@-use super::super::super::{Channel, traits};-use super::{MAX_JITTER_MS, jitter_millis, spawn_supervised_listener};+use super::super::super::{traits, Channel};+use super::{jitter_millis, spawn_supervised_listener, MAX_JITTER_MS};use std::sync::{Arc, Mutex};use tokio::time::Instant;diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex 1726a3042c..ee577adbb4 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -2,15 +2,15 @@pub use super::dispatch::test_support::build_channel_context_block_for_test;use super::dispatch::{- RuntimeChannelMessage, process_channel_message, process_channel_runtime_message,+ process_channel_message, process_channel_runtime_message, RuntimeChannelMessage,};pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;-use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};use crate::agent::progress::AgentProgress;+use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};+use crate::channels::traits::{ChannelMessage, SendMessage};use crate::channels::Channel;use crate::channels::ChannelSystemPrompt;-use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};-use crate::channels::traits::{ChannelMessage, SendMessage};use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};use crate::core::bus::BUS;use crate::core::events::DomainEvent;