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): replace Telegram-specific remote control with generic remote command
Steven Enamakel4e7b0dd37a62
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 68186b1887..03fd5f39b9 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -7,6 +7,8 @@ use super::traits;use super::{Channel, ChannelSendExt, SendMessage};use crate::inference::provider;use std::sync::Arc;+use tinychannels::remote::{execute_remote_command, parse_remote_command, RemoteCommand};+use tinychannels::remote::RemoteCommandContext;use tinychannels::routes::{build_models_help_response, build_providers_help_response,parse_runtime_command as parse_portable_runtime_command,@@ -17,11 +19,7 @@ use tinychannels::routes::{#[derive(Debug, Clone, PartialEq, Eq)]enum ChannelRuntimeCommand {Portable(PortableCommand),- TelegramRemote(super::providers::telegram::TelegramRemoteCommand),-}--fn supports_telegram_remote_control(channel_name: &str) -> bool {- channel_name == "telegram"+ Remote(RemoteCommand),}fn parse_runtime_command(channel_name: &str, content: &str) -> Option<ChannelRuntimeCommand> {@@ -30,11 +28,9 @@ fn parse_runtime_command(channel_name: &str, content: &str) -> Option<ChannelRunreturn None;}- if supports_telegram_remote_control(channel_name) {- if let Some(remote) =- super::providers::telegram::remote_control::parse_telegram_remote_command(content)- {- return Some(ChannelRuntimeCommand::TelegramRemote(remote));+ if tinychannels::capabilities_for(channel_name).remote_control {+ if let Some(remote) = parse_remote_command(content) {+ return Some(ChannelRuntimeCommand::Remote(remote));}}@@ -129,11 +125,15 @@ pub(crate) async fn handle_runtime_command_if_needed(let mut current = get_route_selection(ctx, &sender_key);let response = match command {- ChannelRuntimeCommand::TelegramRemote(remote) => {- super::providers::telegram::remote_control::build_remote_command_response(- ctx, msg, remote,- )- .await+ ChannelRuntimeCommand::Remote(remote) => {+ let host = super::host::remote_control::RuntimeRemoteControl { ctx };+ let remote_ctx = RemoteCommandContext {+ channel: msg.channel.clone(),+ reply_target: msg.reply_target.clone(),+ sender_key: sender_key.clone(),+ workspace_dir: ctx.workspace_dir.to_path_buf(),+ };+ execute_remote_command(&host, &remote_ctx, remote).await}ChannelRuntimeCommand::Portable(PortableCommand::ShowProviders) => {build_providers_help_response(¤t, &provider_descriptors())diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod_approval_surface_gating_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod_approval_surface_gating_tests_tests.rsindex 7eac8bc24a..3ebb6074da 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod_approval_surface_gating_tests_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod_approval_surface_gating_tests_tests.rs@@ -3,23 +3,30 @@ use super::channel_has_approval_surface;// Sub-issue 2 of #3098: this gate is what decides whether the dispatch// loop sets an `ApprovalChatContext` (→ gate fires for `Prompt`-class// tools) versus the legacy bypass (→ tool calls silently allowed).-// Pin the matrix so silently broadening to a new channel can't-// accidentally TTL-deny every parked tool call there.+// Pin the matrix: every chat channel is served by+// `ChannelApprovalSurfaceSubscriber`; channels with no conversational reply+// path must not be scoped, or every parked call would TTL-deny.#[test]-fn telegram_has_approval_surface() {- assert!(channel_has_approval_surface("telegram"));+fn chat_channels_have_an_approval_surface() {+ for channel in [+ "telegram",+ "discord",+ "slack",+ "imessage",+ "mattermost",+ "signal",+ "whatsapp",+ "irc",+ ] {+ assert!(channel_has_approval_surface(channel), "{channel}");+ }}#[test]-fn other_channels_do_not_yet_have_an_approval_surface() {- for channel in ["discord", "slack", "imessage", "mattermost", "web", "irc"] {- assert!(- !channel_has_approval_surface(channel),- "channel {channel:?} is not (yet) wired to a per-channel approval surface; \- the dispatch loop must not scope an ApprovalChatContext for it or every \- Prompt-class tool call will park with nobody to answer and TTL-deny"- );+fn channels_without_a_reply_path_do_not_have_an_approval_surface() {+ for channel in ["email", "cli", "webhook", "web"] {+ assert!(!channel_has_approval_surface(channel), "{channel}");}}