Skip to content

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

test(channels): add hosted route policy helper and simplify test envelope builder

Steven Enamakel768baaeb02d3
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 22e442075d..01101e4bf3 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -27,6 +27,15 @@ fn provider_descriptors(config: &crate::config::Config) -> Vec<ProviderDescripto
.collect()
}
+#[cfg(test)]
+pub(crate) fn register_hosted_route_test_policy() {
+ use crate::config::schema::cloud_providers::AuthStyle;
+ crate::config::schema::cloud_providers::register_hosted_cloud_provider_policy(
+ Arc::new(|slug| slug == "openhuman"),
+ Arc::new(|style| style == AuthStyle::OpenhumanJwt),
+ );
+}
+
fn default_route_selection(ctx: &ChannelRuntimeContext) -> ChannelRouteSelection {
ChannelRouteSelection {
provider: ctx.default_provider.as_str().to_string(),
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 84483407a7..336f4c4989 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -19,29 +19,29 @@ use tinychannels_bus::{
use tinytools::{Tool, ToolResult};
fn inbound(
- message_id: impl Into<String>,
- sender_id: impl Into<String>,
- conversation_id: impl Into<String>,
- text: impl Into<String>,
- channel_id: impl Into<String>,
+ message_id: String,
+ sender_id: String,
+ conversation_id: String,
+ text: String,
+ channel_id: String,
thread_id: Option<String>,
) -> ChannelInboundEnvelope {
ChannelInboundEnvelope {
- message_id: message_id.into(),
+ message_id,
sender: SenderRef {
- id: sender_id.into(),
+ id: sender_id,
..Default::default()
},
conversation: ConversationRef {
- id: conversation_id.into(),
+ id: conversation_id,
thread_id,
..Default::default()
},
channel: ChannelRef {
- id: channel_id.into(),
+ id: channel_id,
..Default::default()
},
- text: text.into(),
+ text,
..Default::default()
}
}