Skip to content

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

test(channels): add send_typed to recording channel doubles

Steven Enamakel02fba15b16fa
diff --git a/crates/openhuman-core/src/channels/tests/common.rs b/crates/openhuman-core/src/channels/tests/common.rs
index 04ef5fafcc..ebfd74d536 100644
--- a/crates/openhuman-core/src/channels/tests/common.rs
+++ b/crates/openhuman-core/src/channels/tests/common.rs
@@ -1,4 +1,4 @@
-use crate::channels::{Channel, SendMessage};
+use crate::channels::Channel;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
@@ -140,7 +140,8 @@ impl Channel for TelegramRecordingChannel {
"telegram"
}
- async fn send(&self, message: &SendMessage) -> anyhow::Result<()> {
+ #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.sent_messages
.lock()
.await
@@ -148,6 +149,19 @@ impl Channel for TelegramRecordingChannel {
Ok(())
}
+ async fn send_typed(
+ &self,
+ message: &traits::ChannelOutboundMessage,
+ ) -> anyhow::Result<()> {
+ self.sent_messages.lock().await.push(format!(
+ "{}:{}",
+ message.conversation_id,
+ message.legacy_text()?
+ ));
+ Ok(())
+ }
+
+ #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -170,7 +184,8 @@ impl Channel for RecordingChannel {
"test-channel"
}
- async fn send(&self, message: &SendMessage) -> anyhow::Result<()> {
+ #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.sent_messages
.lock()
.await
@@ -178,6 +193,19 @@ impl Channel for RecordingChannel {
Ok(())
}
+ async fn send_typed(
+ &self,
+ message: &traits::ChannelOutboundMessage,
+ ) -> anyhow::Result<()> {
+ self.sent_messages.lock().await.push(format!(
+ "{}:{}",
+ message.conversation_id,
+ message.legacy_text()?
+ ));
+ Ok(())
+ }
+
+ #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -387,10 +415,12 @@ impl Channel for AlwaysFailChannel {
self.name
}
- async fn send(&self, _message: &SendMessage) -> anyhow::Result<()> {
+ #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ async fn send(&self, _message: &traits::SendMessage) -> anyhow::Result<()> {
Ok(())
}
+ #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,