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): use inbound envelope as the sole message type
Steven Enamakelf2b8ddfd0e10
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rsindex b9396b2b14..ec1d8e1005 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs@@ -31,24 +31,15 @@ pub(crate) async fn admit_runtime_message(use tinychannels_bus::module_inbound::{ChannelInboundSource, PrepareChannelInboundRequest};let RuntimeChannelMessage {message,- inbound_envelope,authenticated_relay,prepared_inbound,} = runtime_msg;let prepared = match prepared_inbound {Some(prepared) => prepared,None => {- let source = if message.channel.is_empty() {- let envelope = inbound_envelope?;- ChannelInboundSource::Envelope {- envelope,- timestamp: 0,- }- } else {- ChannelInboundSource::Legacy {- message,- envelope: inbound_envelope,- }+ let source = ChannelInboundSource::Envelope {+ envelope: message,+ timestamp: 0,};match crate::modules::channel_controller::prepare_inbound(&crate::channels::context::module_client(&ctx).await,@@ -68,30 +59,30 @@ pub(crate) async fn admit_runtime_message(}}};- let msg = prepared.message;+ let msg = prepared.envelope;let history_key = prepared.history_key;- let mut envelope = prepared.envelope;- envelope.access.delivered_via_upstream_relay = authenticated_relay;+ let mut msg = msg;+ msg.access.delivered_via_upstream_relay = authenticated_relay;println!(" 💬 [{}] from {}: {}",- msg.channel,- msg.sender,- truncate_with_ellipsis(&msg.content, 80)+ msg.channel.id,+ msg.sender.id,+ truncate_with_ellipsis(&msg.text, 80));BUS.publish(DomainEvent::ChannelMessageReceived {- channel: msg.channel.clone(),- message_id: msg.id.clone(),- sender: msg.sender.clone(),- reply_target: msg.reply_target.clone(),- content: msg.content.clone(),- thread_ts: msg.thread_ts.clone(),- inbound_envelope: Some(envelope),+ channel: msg.channel.id.clone(),+ message_id: msg.message_id.clone(),+ sender: msg.sender.id.clone(),+ reply_target: msg.conversation.id.clone(),+ content: msg.text.clone(),+ thread_ts: msg.conversation.thread_id.clone(),+ inbound_envelope: Some(msg.clone()),workspace_dir: ctx.workspace_dir.as_ref().clone(),});- let target_channel = ctx.channels_by_name.get(&msg.channel).cloned();+ let target_channel = ctx.channels_by_name.get(&msg.channel.id).cloned();if handle_runtime_command_if_needed(ctx.as_ref(), &msg, target_channel.as_ref(), &history_key).await{diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rsindex e760c1577e..3a18d6ea2c 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs@@ -29,7 +29,7 @@ pub(crate) fn channel_has_approval_surface(channel: Option<&dyn crate::channels:////// [`ApprovalGate::decide`]: crate::security::approval::ApprovalGate::decidepub(super) async fn try_route_approval_reply(- msg: &traits::ChannelMessage,+ msg: &traits::ChannelInboundEnvelope,thread_id: &str,) -> bool {let Some(gate) = crate::security::approval::ApprovalGate::try_global() else {@@ -38,14 +38,14 @@ pub(super) async fn try_route_approval_reply(let Some(request_id) = gate.pending_for_thread(thread_id) else {return false;};- let Some(decision) = crate::security::approval::parse_approval_reply(&msg.content) else {+ let Some(decision) = crate::security::approval::parse_approval_reply(&msg.text) else {return false;};match gate.decide(&request_id, decision) {Ok(Some(_)) => {tracing::info!("[dispatch] routed chat reply to approval gate channel={} thread_id={} request_id={} decision={}",- msg.channel,+ msg.channel.id,thread_id,request_id,decision.as_str()@@ -58,7 +58,7 @@ pub(super) async fn try_route_approval_reply(// intercept; fall through so the reply lands as a normal turn.tracing::warn!("[dispatch] approval reply targeted a non-pending request channel={} thread_id={} request_id={} — dispatching as fresh turn",- msg.channel,+ msg.channel.id,thread_id,request_id);@@ -67,7 +67,7 @@ pub(super) async fn try_route_approval_reply(Err(err) => {tracing::warn!("[dispatch] approval gate decide failed channel={} thread_id={} request_id={}: {err}",- msg.channel,+ msg.channel.id,thread_id,request_id);