Skip to content

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

refactor(channels): drop test-only runtime command shims

Steven Enamakel2482960d883b
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 6edb91416d..c1d2985ab3 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -1,50 +1,14 @@
//! Per-sender routing and runtime command handling.
use super::context::{clear_sender_history, ChannelRouteSelection, ChannelRuntimeContext};
-use tinychannels_bus as traits;
use super::{Channel, ChannelSendExt, SendMessage};
use crate::inference::provider;
use std::sync::Arc;
-#[cfg(test)]
-use tinychannels::remote::{parse_remote_command, RemoteCommand};
-#[cfg(test)]
-use tinychannels::routes::{
- parse_runtime_command as parse_portable_runtime_command,
- resolve_provider_alias as resolve_portable_provider_alias,
- ChannelRuntimeCommand as PortableCommand,
-};
+use tinychannels_bus as traits;
use tinychannels_bus::module_control::{
ChannelControlRequest, ChannelControlResult, ProviderDescriptor,
};
-#[cfg(test)]
-#[derive(Debug, Clone, PartialEq, Eq)]
-enum ChannelRuntimeCommand {
- Portable(PortableCommand),
- Remote(RemoteCommand),
-}
-
-#[cfg(test)]
-fn parse_runtime_command(channel_name: &str, content: &str) -> Option<ChannelRuntimeCommand> {
- let trimmed = content.trim();
- if !trimmed.starts_with('/') {
- return None;
- }
-
- if tinychannels::capabilities_for(channel_name).remote_control {
- if let Some(remote) = parse_remote_command(content) {
- return Some(ChannelRuntimeCommand::Remote(remote));
- }
- }
-
- parse_portable_runtime_command(channel_name, trimmed).map(ChannelRuntimeCommand::Portable)
-}
-
-#[cfg(test)]
-fn resolve_provider_alias(name: &str) -> Option<String> {
- resolve_portable_provider_alias(name, &provider_descriptors())
-}
-
fn provider_descriptors() -> Vec<ProviderDescriptor> {
provider::list_providers()
.into_iter()
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 0560f42f31..3a986e5962 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -3,7 +3,6 @@ use crate::channels::context::{
conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,
};
use crate::channels::host::ChannelTurnStateSubscriber;
-use tinychannels_bus::ChannelMessage;
use crate::core::events::DomainEvent;
use async_trait::async_trait;
use std::collections::HashMap;
@@ -13,6 +12,8 @@ use std::sync::{Arc, Mutex};
use std::task::{Context, Poll, Wake, Waker};
use tinyagents_session::transcript::TranscriptMessage;
use tinybus::EventHandler;
+use tinychannels::routes::resolve_provider_alias;
+use tinychannels_bus::ChannelMessage;
use tinytools::{Tool, ToolResult};
struct DummyTool;
@@ -132,52 +133,6 @@ async fn module_route_help_response(
}
}
-#[test]
-fn runtime_command_parsing_and_provider_support_are_channel_scoped() {
- assert_eq!(
- parse_runtime_command("telegram", "/models"),
- Some(ChannelRuntimeCommand::Portable(
- PortableCommand::ShowProviders
- ))
- );
- assert_eq!(
- parse_runtime_command("discord", "/models openai"),
- Some(ChannelRuntimeCommand::Portable(
- PortableCommand::SetProvider("openai".into())
- ))
- );
- assert_eq!(
- parse_runtime_command("telegram", "/model gpt-5"),
- Some(ChannelRuntimeCommand::Portable(PortableCommand::SetModel(
- "gpt-5".into()
- )))
- );
- assert_eq!(
- parse_runtime_command("telegram", "/model"),
- Some(ChannelRuntimeCommand::Portable(PortableCommand::ShowModel))
- );
- assert_eq!(
- parse_runtime_command("telegram", "/status@OpenHumanBot"),
- Some(ChannelRuntimeCommand::Remote(RemoteCommand::Status))
- );
- assert_eq!(
- parse_runtime_command("telegram", "/help"),
- Some(ChannelRuntimeCommand::Remote(RemoteCommand::Help))
- );
- assert_eq!(parse_runtime_command("slack", "/models"), None);
- // Remote control is a provider capability, not a Telegram special case.
- assert_eq!(
- parse_runtime_command("discord", "/status"),
- Some(ChannelRuntimeCommand::Remote(RemoteCommand::Status))
- );
- assert_eq!(
- parse_runtime_command("slack", "/new"),
- Some(ChannelRuntimeCommand::Remote(RemoteCommand::New))
- );
- assert_eq!(parse_runtime_command("email", "/status"), None);
- assert_eq!(parse_runtime_command("telegram", "hello"), None);
-}
-
#[test]
fn provider_alias_and_route_selection_round_trip() {
let first_provider = provider::list_providers()
@@ -185,10 +140,10 @@ fn provider_alias_and_route_selection_round_trip() {
.next()
.expect("provider registry should not be empty");
assert_eq!(
- resolve_provider_alias(first_provider.name).as_deref(),
+ resolve_provider_alias(first_provider.name, &provider_descriptors()).as_deref(),
Some(first_provider.name)
);
- assert!(resolve_provider_alias(" ").is_none());
+ assert!(resolve_provider_alias(" ", &provider_descriptors()).is_none());
let ctx = runtime_context(PathBuf::from("/tmp"));
let sender_key = "telegram_alice_reply";