Skip to content

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

refactor(core): restrict public visibility of internal structs

Steven Enamakeldffe64cbf463
diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rs
index ded73fdbdd..a43c0625af 100644
--- a/crates/openhuman-core/src/channels/host/channel_events.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events.rs
@@ -12,14 +12,14 @@ use tinybus::EventHandler;
use tinychannels_bus::{approvals::ReplyContext, ChannelMessage};
/// Captures the account configuration and reply addresses used by approvals.
-pub struct ChannelApprovalSurfaceSubscriber {
+pub(crate) struct ChannelApprovalSurfaceSubscriber {
channels: Arc<HashMap<String, Arc<ChannelHandle>>>,
replies: Mutex<HashMap<String, ReplyContext>>,
config: Option<Arc<crate::config::Config>>,
cancellation: tokio_util::sync::CancellationToken,
}
impl ChannelApprovalSurfaceSubscriber {
- pub fn with_config(
+ pub(crate) fn with_config(
channels: Arc<HashMap<String, Arc<ChannelHandle>>>,
config: Arc<crate::config::Config>,
) -> Self {
@@ -31,7 +31,7 @@ impl ChannelApprovalSurfaceSubscriber {
}
}
#[cfg(test)]
- pub fn new(channels: Arc<HashMap<String, Arc<ChannelHandle>>>) -> Self {
+ pub(crate) fn new(channels: Arc<HashMap<String, Arc<ChannelHandle>>>) -> Self {
Self {
channels,
replies: Mutex::new(HashMap::new()),
diff --git a/crates/openhuman-core/src/channels/host/mod.rs b/crates/openhuman-core/src/channels/host/mod.rs
index 10e8cc3aa0..8000635207 100644
--- a/crates/openhuman-core/src/channels/host/mod.rs
+++ b/crates/openhuman-core/src/channels/host/mod.rs
@@ -8,7 +8,8 @@ pub(crate) mod remote_control;
pub(crate) mod voice;
pub(crate) use adapters::{ConfigAllowlistStore, OpenHumanEventSink};
-pub use channel_events::{ChannelApprovalSurfaceSubscriber, ChannelTurnStateSubscriber};
+pub(crate) use channel_events::ChannelApprovalSurfaceSubscriber;
+pub use channel_events::ChannelTurnStateSubscriber;
#[cfg(test)]
#[path = "host_tests.rs"]
diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rs
index 36bcb3d677..1ca036d412 100644
--- a/crates/openhuman-core/src/channels/proactive.rs
+++ b/crates/openhuman-core/src/channels/proactive.rs
@@ -33,7 +33,7 @@ fn proactive_approval_gate() -> Option<Arc<crate::security::approval::ApprovalGa
}
/// Routes proactive messages to the user's preferred channel.
-pub struct ProactiveMessageSubscriber {
+pub(crate) struct ProactiveMessageSubscriber {
/// External channels (Telegram, Discord, etc.) keyed by name.
/// Empty in the desktop/web-only runtime.
channels_by_name: Arc<HashMap<String, Arc<ChannelHandle>>>,
@@ -46,7 +46,7 @@ pub struct ProactiveMessageSubscriber {
impl ProactiveMessageSubscriber {
/// Construct with access to the external channels map and a
/// preferred channel name (from `channels_config.active_channel`).
- pub fn new(
+ pub(crate) fn new(
channels_by_name: Arc<HashMap<String, Arc<ChannelHandle>>>,
active_channel: Option<String>,
) -> Self {
diff --git a/crates/openhuman-core/src/cron/bus.rs b/crates/openhuman-core/src/cron/bus.rs
index 33fea9a559..04618c89de 100644
--- a/crates/openhuman-core/src/cron/bus.rs
+++ b/crates/openhuman-core/src/cron/bus.rs
@@ -15,12 +15,12 @@ use tinychannels_bus::SendMessage;
/// Subscribes to `CronDeliveryRequested` events and dispatches
/// the output to the named channel.
-pub struct CronDeliverySubscriber {
+pub(crate) struct CronDeliverySubscriber {
channels_by_name: Arc<HashMap<String, Arc<ChannelHandle>>>,
}
impl CronDeliverySubscriber {
- pub fn new(channels_by_name: Arc<HashMap<String, Arc<ChannelHandle>>>) -> Self {
+ pub(crate) fn new(channels_by_name: Arc<HashMap<String, Arc<ChannelHandle>>>) -> Self {
Self { channels_by_name }
}
}