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
feat(channels): gate listener startup on configured channels or relay
Steven Enamakel28c283daf715
diff --git a/crates/openhuman-core/src/channels/commands.rs b/crates/openhuman-core/src/channels/commands.rsindex a7ed0b94c4..19881ddec0 100644--- a/crates/openhuman-core/src/channels/commands.rs+++ b/crates/openhuman-core/src/channels/commands.rs@@ -110,6 +110,17 @@ pub(crate) fn configured_providers(config: &Config) -> Vec<&'static str> {.collect()}+/// Whether config contains a channel or relay that needs the native module+/// runtime. Push webhooks remain host-server work and do not start listeners.+pub(crate) fn has_listener_configuration(config: &Config) -> bool {+ !configured_providers(config).is_empty()+ || config+ .channels_config+ .relay+ .as_ref()+ .is_some_and(|relay| !relay.url.trim().is_empty() && !relay.identities.is_empty())+}+#[cfg(test)]#[path = "commands_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex 8344daf543..7f1025c1d5 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -19,6 +19,8 @@ pub mod bus;#[cfg(feature = "channels")]mod commands;#[cfg(feature = "channels")]+pub(crate) use commands::{configured_providers, has_listener_configuration};+#[cfg(feature = "channels")]pub(crate) mod context;#[cfg(feature = "channels")]pub mod controllers;@@ -42,66 +44,66 @@ pub(crate) use system_prompt::ChannelSystemPrompt;mod tests;// Stable `channels::<provider>` paths (implementation lives under `providers/`).-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::dingtalk;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::discord;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::email_channel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::imessage;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::irc;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::lark;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::linq;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::mattermost;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::qq;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::signal;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::slack;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::telegram;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::whatsapp;-#[cfg(feature = "whatsapp-web")]+#[cfg(all(feature = "whatsapp-web", test))]pub use providers::whatsapp_web;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use providers::yuanbao;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use dingtalk::DingTalkChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use discord::DiscordChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use email_channel::EmailChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use imessage::IMessageChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use irc::IrcChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use lark::LarkChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use linq::LinqChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use mattermost::MattermostChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use qq::QQChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use signal::SignalChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use slack::SlackChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use telegram::TelegramChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use whatsapp::WhatsAppChannel;-#[cfg(feature = "whatsapp-web")]+#[cfg(all(feature = "whatsapp-web", test))]pub use whatsapp_web::WhatsAppWebChannel;-#[cfg(feature = "channels")]+#[cfg(all(feature = "channels", test))]pub use yuanbao::YuanbaoChannel;#[cfg(all(feature = "channels", any(test, debug_assertions)))]diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rsindex 635fcbbdd0..a1761e48fb 100644--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs@@ -143,7 +143,7 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->);}- let configured = crate::channels::commands::configured_providers(&config);+ let configured = crate::channels::configured_providers(&config);let relay_configured = config.channels_config.relaydiff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rsindex bcb9f13a33..2a73402bb7 100644--- a/crates/openhuman-core/src/core/runtime/services.rs+++ b/crates/openhuman-core/src/core/runtime/services.rs@@ -18,8 +18,6 @@// this file is plain field access on OpenHuman's own `Config`.use crate::config::Config;use crate::core::runtime::ServiceSet;-#[cfg(feature = "channels")]-use tinychannels_runtime::config::ChannelsConfigExt as _;/// The long-lived background services a runtime started, so it can stop them.///@@ -303,7 +301,7 @@ pub fn spawn_channels_service() -> Option<tokio::task::JoinHandle<()>> {return;}};- if !config.channels_config.has_listening_integrations() {+ if !crate::channels::has_listener_configuration(&config) {log::debug!("[channels] no channel integrations configured; not spawning listeners");