Skip to content

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

refactor(channels): move capabilities lookup into core

Steven Enamakel3bc0a0183330
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rs
index ecbe152fd3..4df01bde8f 100644
--- a/crates/openhuman-core/src/channels/bus/delivery.rs
+++ b/crates/openhuman-core/src/channels/bus/delivery.rs
@@ -70,7 +70,9 @@ impl ManagedTransport {
request: ProgressiveTransportRequest,
) -> ProgressiveTransportResult {
let result = match request {
- ProgressiveTransportRequest::Send { channel, message } => {
+ ProgressiveTransportRequest::Send {
+ channel, message, ..
+ } => {
self.client
.send_channel_message(&channel, &self.credential, message)
.await
@@ -79,6 +81,7 @@ impl ManagedTransport {
channel,
message_id,
text,
+ ..
} => {
self.client
.send_channel_edit(
@@ -92,12 +95,13 @@ impl ManagedTransport {
ProgressiveTransportRequest::Delete {
channel,
message_id,
+ ..
} => {
self.client
.send_channel_delete(&channel, &message_id, &self.credential)
.await
}
- ProgressiveTransportRequest::Typing { channel } => {
+ ProgressiveTransportRequest::Typing { channel, .. } => {
self.client
.send_channel_typing(&channel, &self.credential)
.await
@@ -115,7 +119,7 @@ fn request_channel(request: &ProgressiveTransportRequest) -> &str {
ProgressiveTransportRequest::Send { channel, .. }
| ProgressiveTransportRequest::Edit { channel, .. }
| ProgressiveTransportRequest::Delete { channel, .. }
- | ProgressiveTransportRequest::Typing { channel } => channel,
+ | ProgressiveTransportRequest::Typing { channel, .. } => channel,
}
}
@@ -129,7 +133,7 @@ impl ManagedTransport {
return Err(tinybus::Error::failed("callback capability unavailable"));
};
Ok(ChannelBackendResult::ProgressiveTransport(
- self.execute(request).await,
+ self.execute(*request).await,
))
}
}
diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rs
index cd9b7ea42e..9a4c681ea3 100644
--- a/crates/openhuman-core/src/channels/host/channel_events.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events.rs
@@ -7,7 +7,8 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use tinybus::module::ModuleClient;
use tinybus::EventHandler;
-use tinychannels_bus::{capabilities_for, ChannelMessage};
+use crate::channels::capabilities::capabilities_for;
+use tinychannels_bus::ChannelMessage;
#[derive(Clone)]
struct ReplyContext {
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index 05ceb3485d..4e74572852 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -6,6 +6,7 @@
//! lifecycle orchestration.
// Always-compiled carve-outs (see module docs).
+pub(crate) mod capabilities;
pub mod contract_schema;
#[cfg(any(feature = "voice", feature = "channels"))]
pub(crate) mod credentials;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs
index a5216c9832..fe188acc2d 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/approval.rs
@@ -17,7 +17,7 @@ use tinychannels_bus as traits;
/// [`ApprovalChatContext`]: crate::security::approval::ApprovalChatContext
/// [`ApprovalGate`]: crate::security::approval::ApprovalGate
pub(crate) fn channel_has_approval_surface(channel: &str) -> bool {
- tinychannels_bus::capabilities_for(channel).chat_approvals
+ crate::channels::capabilities::capabilities_for(channel).chat_approvals
}
/// If the inbound message is a yes/no reply for a parked approval on
diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index 8038030836..c71dbd3d6e 100644
--- a/crates/openhuman-core/src/threads/store/bus.rs
+++ b/crates/openhuman-core/src/threads/store/bus.rs
@@ -499,7 +499,7 @@ fn channel_thread_title(
// Providers whose thread_ts is only a reply target (Telegram topics)
// share one conversation, so the title leaves it out too.
Some(thread_ts)
- if !tinychannels_bus::capabilities_for(channel).history_key_ignores_thread =>
+ if !crate::channels::capabilities::capabilities_for(channel).history_key_ignores_thread =>
{
format!("{channel} · {sender} · {reply_target} · thread {thread_ts}")
}