Skip to content

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

style(dispatch): apply rustfmt formatting to channel turn modules

Steven Enamakel0f855837b790
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.rs
index 04a9cb002b..fb875e68bb 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 tinychannels_bus as traits;
pub(crate) mod posture;
mod turn;
-pub(crate) use turn::{run_host_agent_turn, HostChannelTurn};
+pub(crate) use turn::{HostChannelTurn, run_host_agent_turn};
/// Resolve the config-owned target selected for an unbound channel into the
/// same trusted host-agent carrier used by channel bindings. The effective
@@ -42,7 +42,10 @@ pub(crate) async fn configured_agent(
let dispatch = ctx.dispatch_ctx();
let mut config = match &ctx.config {
Some(config) => config.as_ref().clone(),
- None => dispatch.load_config().await.map_err(|error| error.to_string())?,
+ None => dispatch
+ .load_config()
+ .await
+ .map_err(|error| error.to_string())?,
};
let scoping = super::routing::resolve_target_agent(channel).await;
let agent_id = scoping
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
index f7e34b7f9b..607ac381e4 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
@@ -92,5 +92,9 @@ pub(crate) async fn run_host_agent_turn(
turn_deadline,
)
.await?;
- Ok(AgentTurnResponse::with_resolved_route(text, format!("agent:{agent_id}"), model))
+ Ok(AgentTurnResponse::with_resolved_route(
+ text,
+ format!("agent:{agent_id}"),
+ model,
+ ))
}
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index b2550966d9..de2ec23159 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -3,7 +3,7 @@
//! delivering the draft/final reply.
use crate::agent::bus::AgentTurnResponse;
-use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeContext};
+use crate::channels::context::{ChannelRuntimeContext, is_context_window_overflow_error};
use crate::channels::routes::{
get_or_create_turn_model_source, get_route_selection, handle_runtime_command_if_needed,
};
@@ -20,13 +20,13 @@ use tokio_util::sync::CancellationToken;
use tokio_util::task::AbortOnDropHandle;
use super::super::helpers::{
- build_channel_context_block, log_worker_join_result, spawn_typing_task,
- REPLY_LOG_TRUNCATE_CHARS,
+ REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,
+ spawn_typing_task,
};
-use super::super::host_agent::{self, run_host_agent_turn, seed_rows, HostChannelTurn, HostRoute};
+use super::super::host_agent::{self, HostChannelTurn, HostRoute, run_host_agent_turn, seed_rows};
+use super::RuntimeChannelMessage;
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>,
@@ -424,20 +424,16 @@ pub(crate) async fn process_channel_runtime_message(
let mut configured_agent_error = None;
let selected_host = match bound_agent {
Some(host) => Some(*host),
- None if ctx.config.is_some() => match host_agent::configured_agent(
- ctx.as_ref(),
- &msg.channel,
- &route,
- )
- .await
- {
- Ok(host) => Some(host),
- Err(error) => {
- tracing::warn!(channel = %msg.channel, %error, "[dispatch] configured channel agent could not be built");
- configured_agent_error = Some(error);
- None
+ None if ctx.config.is_some() => {
+ match host_agent::configured_agent(ctx.as_ref(), &msg.channel, &route).await {
+ Ok(host) => Some(host),
+ Err(error) => {
+ tracing::warn!(channel = %msg.channel, %error, "[dispatch] configured channel agent could not be built");
+ configured_agent_error = Some(error);
+ None
+ }
}
- },
+ }
None => None,
};
let cancellation = CancellationToken::new();
@@ -470,18 +466,19 @@ pub(crate) async fn process_channel_runtime_message(
tinyagents_session::transcript::TranscriptMessage::user(&enriched_message),
];
Box::pin(dispatch_bus_turn(
- ctx.as_ref(),
- &msg,
- &route,
- history,
- active_turn_model_source,
- progress_tx,
- turn_origin,
- approval,
+ ctx.as_ref(),
+ &msg,
+ &route,
+ history,
+ active_turn_model_source,
+ progress_tx,
+ turn_origin,
+ approval,
))
}
};
- let llm_result = tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call).await;
+ let llm_result =
+ tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call).await;
cancellation.cancel();
// Wait for draft updater to finish