Skip to content

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

refactor(channels): update thread_id derivation to use tinychannels_runtime

Steven Enamakel2400dfc5b4d1
diff --git a/crates/openhuman-core/src/channels/bus.rs b/crates/openhuman-core/src/channels/bus.rs
index 5539395bb2..183972cd02 100644
--- a/crates/openhuman-core/src/channels/bus.rs
+++ b/crates/openhuman-core/src/channels/bus.rs
@@ -6,15 +6,10 @@
mod delivery;
mod subscriber;
-#[cfg(test)]
-mod thread_id;
pub(crate) use delivery::NativeProgressiveReply;
pub use subscriber::ChannelInboundSubscriber;
-#[cfg(test)]
-pub(crate) use thread_id::derive_inbound_thread_id;
-
#[cfg(test)]
#[path = "bus_inbound_thread_id_tests_tests.rs"]
mod inbound_thread_id_tests;
diff --git a/crates/openhuman-core/src/channels/bus/thread_id.rs b/crates/openhuman-core/src/channels/bus/thread_id.rs
deleted file mode 100644
index e7bbe9b83d..0000000000
--- a/crates/openhuman-core/src/channels/bus/thread_id.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-//! Compatibility re-exports for the TinyChannels inbound identity contract.
-
-pub(crate) use tinychannels_bus::channel::derive_inbound_thread_id;
diff --git a/crates/openhuman-core/src/channels/bus_test_support_tests.rs b/crates/openhuman-core/src/channels/bus_test_support_tests.rs
index 6ecc68b630..864dce2329 100644
--- a/crates/openhuman-core/src/channels/bus_test_support_tests.rs
+++ b/crates/openhuman-core/src/channels/bus_test_support_tests.rs
@@ -1,6 +1,6 @@
//! Debug-build seams for raw integration coverage of channel inbound helpers.
-use tinychannels::channel::derive_inbound_thread_id;
+use tinychannels_runtime::channel::derive_inbound_thread_id;
use tinychannels::delivery::progressive::{
extract_message_id, latest_thinking_snippet, StreamingState,
};
diff --git a/crates/openhuman-core/src/channels/providers/relay/params.rs b/crates/openhuman-core/src/channels/providers/relay/params.rs
index 1bc603e76f..b021539ac2 100644
--- a/crates/openhuman-core/src/channels/providers/relay/params.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/params.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
#[cfg(test)]
-use crate::channels::bus::derive_inbound_thread_id;
+use tinychannels_runtime::channel::derive_inbound_thread_id;
use tinychannels_bus::ChannelMessage;
/// Longest channel name: `telegram`, `imessage`, `discord`, ...
@@ -107,7 +107,7 @@ impl RelayInboundParams {
/// The conversation's thread: `channel:<channel>/<sender>/<chat>`, the
/// same derivation as the backend-relayed inbound path
- /// (`channels::bus::derive_inbound_thread_id`). A user cannot mint such
+ /// (`tinychannels_runtime::channel::derive_inbound_thread_id`). A user cannot mint such
/// an id through `threads_upsert`, which reserves `channel:`.
#[cfg(test)]
pub fn thread_id(&self) -> String {
diff --git a/crates/openhuman-core/src/channels/providers/relay/params_tests.rs b/crates/openhuman-core/src/channels/providers/relay/params_tests.rs
index cf2ea8a660..5db7f83ba5 100644
--- a/crates/openhuman-core/src/channels/providers/relay/params_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/params_tests.rs
@@ -28,7 +28,7 @@ fn the_thread_id_is_a_reserved_channel_id() {
assert_eq!(id, "channel:telegram/42/-100123");
assert_eq!(
id,
- tinychannels::channel::derive_inbound_thread_id(
+ tinychannels_runtime::channel::derive_inbound_thread_id(
"telegram",
Some("42"),
Some("-100123"),
diff --git a/crates/openhuman-core/src/profiles/surface_tests.rs b/crates/openhuman-core/src/profiles/surface_tests.rs
index 48a4118c06..3865829ceb 100644
--- a/crates/openhuman-core/src/profiles/surface_tests.rs
+++ b/crates/openhuman-core/src/profiles/surface_tests.rs
@@ -143,7 +143,12 @@ fn delete_purge_and_the_channel_relay_are_open_to_users() {
fn users_still_cannot_mint_channel_threads() {
// The relay derives `channel:` ids itself; a user choosing one is refused.
let relayed =
- tinychannels::channel::derive_inbound_thread_id("telegram", Some("1"), Some("2"), None);
+ tinychannels_runtime::channel::derive_inbound_thread_id(
+ "telegram",
+ Some("1"),
+ Some("2"),
+ None,
+ );
assert!(relayed.starts_with("channel:"), "{relayed}");
assert!(validate_user_thread_id(&relayed).is_err());
}