Skip to content

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

refactor(channels): use ChannelInboundEnvelope in bus turn dispatch

Steven Enamakelb5ac03a09f68
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.rs
index 641e2608d4..37f50c1cb2 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
@@ -9,14 +9,14 @@ use crate::security::turn_origin::AgentTurnOrigin;
use std::sync::Arc;
use tinyagents_session::transcript::TranscriptMessage;
use tinybus::NativeRequestError;
-use tinychannels_bus as traits;
+use tinychannels_bus::ChannelInboundEnvelope;
use super::super::routing::resolve_target_agent;
/// Run `msg`'s turn as the orchestrator over the bus.
pub(super) async fn dispatch_bus_turn(
ctx: &ChannelRuntimeContext,
- msg: &traits::ChannelMessage,
+ msg: &ChannelInboundEnvelope,
route: &ChannelRouteSelection,
history: Vec<TranscriptMessage>,
active_turn_model_source: Option<crate::agent::tinyagents::TurnModelSource>,
@@ -36,7 +36,7 @@ pub(super) async fn dispatch_bus_turn(
// Pick the active agent for this turn (always orchestrator) and
// synthesise its delegation tool surface. Fresh disk read of
// `Config::onboarding_completed` happens inside `resolve_target_agent`.
- let scoping = resolve_target_agent(&msg.channel).await;
+ let scoping = resolve_target_agent(&msg.channel.id).await;
// A channel's explicitly-registered `tools_registry` tools are always visible
// to the model. The resolved agent's visible-tool scope is meant to filter the
@@ -73,7 +73,7 @@ pub(super) async fn dispatch_bus_turn(
model: route.model.clone(),
temperature: ctx.temperature,
silent: true,
- channel_name: msg.channel.clone(),
+ channel_name: msg.channel.id.clone(),
multimodal: ctx.multimodal.clone(),
// Channel-sourced text is untrusted (Slack / Discord / Telegram
// / WhatsApp / etc. — anyone who can DM the bot can put bytes
@@ -100,7 +100,7 @@ pub(super) async fn dispatch_bus_turn(
approval,
};
tracing::debug!(
- channel = %msg.channel,
+ channel = %msg.channel.id,
provider = %route.provider,
model = %route.model,
"[channels::dispatch] dispatching {AGENT_RUN_TURN_METHOD} via native bus"