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
test(channels): migrate channel tests to envelope helpers
Steven Enamakele8ac9087a7a9
diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rsindex 1a68e04794..9d31af9673 100644--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs@@ -28,7 +28,7 @@ use super::super::context::{};use super::super::runtime::process_channel_message;use super::super::{Channel, SendMessage};-use super::common::HistoryCaptureModel;+use super::common::{channel_envelope, HistoryCaptureModel};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};@@ -260,12 +260,10 @@ async fn discord_thread_ts_splits_conversation_history_end_to_end() {None);- let second = traits::ChannelMessage {- id: "discord_msg_b".to_string(),- thread_ts: Some("thread-B".to_string()),- content: "second thread message".to_string(),- ..first.clone()- };+ let mut second = first.clone();+ second.message_id = "discord_msg_b".to_string();+ second.conversation.thread_id = Some("thread-B".to_string());+ second.text = "second thread message".to_string();// Sanity: the key function itself must split these. Without this, the// end-to-end expectations below would be ambiguous — is the splitdiff --git a/crates/openhuman-core/src/channels/tests/runtime_debounce.rs b/crates/openhuman-core/src/channels/tests/runtime_debounce.rsindex 6fc0794f88..a11e177809 100644--- a/crates/openhuman-core/src/channels/tests/runtime_debounce.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_debounce.rs@@ -1,7 +1,7 @@use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};use super::super::runtime::{run_message_dispatch_loop, RuntimeChannelMessage};use super::super::Channel;-use super::common::{RecordingChannel, SlowModel, TelegramRecordingChannel};+use super::common::{channel_envelope, RecordingChannel, SlowModel, TelegramRecordingChannel};use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};use crate::config::InboundDebounceConfig;use crate::core::bus_testing::MockBusGuard;@@ -10,8 +10,6 @@ use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use std::time::Duration;-use tinychannels_bus as traits;-use tinychannels_bus::module_inbound::PreparedChannelInbound;use tokio::sync::{mpsc, Notify};use tokio::task::JoinHandle;@@ -130,19 +128,19 @@ impl Running {}}- fn message(&mut self, sender: &str, content: &str) -> traits::ChannelMessage {+ fn message(&mut self, sender: &str, content: &str) -> tinychannels_bus::ChannelInboundEnvelope {let ts = self.next_ts;self.next_ts += 1;- traits::ChannelMessage {- id: format!("m{ts}"),- sender: sender.to_string(),- reply_target: sender.to_string(),- content: content.to_string(),- channel: self.channel.to_string(),- timestamp: ts,- thread_ts: None,- sender_name: None,- }+ channel_envelope(+ self.channel,+ sender,+ sender,+ content,+ &format!("m{ts}"),+ ts,+ None,+ None,+ )}async fn send(&mut self, sender: &str, content: &str) {@@ -152,27 +150,13 @@ impl Running {fn prepared(&mut self, sender: &str, content: &str) -> RuntimeChannelMessage {let message = self.message(sender, content);- let history_key = format!("{}_{sender}_{sender}", self.channel);- let prepared = PreparedChannelInbound {- message: message.clone(),- envelope: Default::default(),- history_key: history_key.clone(),- thread_id: history_key.clone(),- client_id: self.channel.to_string(),- session_key: history_key,- };- RuntimeChannelMessage {- message,- inbound_envelope: None,- authenticated_relay: false,- prepared_inbound: Some(prepared),- }+ RuntimeChannelMessage::with_inbound_envelope(message)}async fn send_unprepared(&mut self, sender: &str, content: &str) {let message = self.message(sender, content);self.tx- .send(RuntimeChannelMessage::from(message))+ .send(RuntimeChannelMessage::with_inbound_envelope(message)).await.unwrap();}