Skip to content

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

feat(embed): expose ScopedWebEvent in profile event streams

Steven Enamakele487522a49b4
diff --git a/crates/openhuman-core/src/web_chat/channel_event.rs b/crates/openhuman-core/src/web_chat/channel_event.rs
index f1ba6a0ce6..92867cb38f 100644
--- a/crates/openhuman-core/src/web_chat/channel_event.rs
+++ b/crates/openhuman-core/src/web_chat/channel_event.rs
@@ -57,6 +57,11 @@ impl ScopedWebEvent {
self.event.context()
}
+ /// The canonical owner event carried by this host-routing envelope.
+ pub fn wire_event(&self) -> &WebChannelEvent {
+ &self.event
+ }
+
/// Historical Socket.IO discriminator for this canonical event.
pub fn event_name(&self) -> String {
serde_json::to_value(&self.event)
diff --git a/crates/openhuman-embed/src/chat_surface.rs b/crates/openhuman-embed/src/chat_surface.rs
index 1fd074ac22..f39d319ad7 100644
--- a/crates/openhuman-embed/src/chat_surface.rs
+++ b/crates/openhuman-embed/src/chat_surface.rs
@@ -7,5 +7,6 @@
pub use openhuman_core::web_chat::{
publish_web_channel_event, register_approval_surface_subscriber,
- register_artifact_surface_subscriber, subscribe_web_channel_events, WebChannelEvent,
+ register_artifact_surface_subscriber, subscribe_web_channel_events, ScopedWebEvent,
+ WebChannelEvent,
};
diff --git a/crates/openhuman-embed/src/profiles.rs b/crates/openhuman-embed/src/profiles.rs
index 45632b5a07..7a699d123d 100644
--- a/crates/openhuman-embed/src/profiles.rs
+++ b/crates/openhuman-embed/src/profiles.rs
@@ -78,7 +78,7 @@ pub use openhuman_core::profiles::cron::SweepReport as CronSweepReport;
pub use openhuman_core::profiles::{OpenError, ProfileId, ProfileIdMode, ProfileSummary};
pub use openhuman_core::storage::lease::LeaseRecord;
pub use openhuman_core::threads::{ConversationMessageRecord, ConversationThreadSummary};
-pub use openhuman_core::web_chat::WebChannelEvent;
+pub use openhuman_core::web_chat::{ScopedWebEvent, WebChannelEvent};
/// The kind of backend credential a profile holds (see
/// [`ProfileRuntime::set_credential`]).
diff --git a/crates/openhuman-embed/src/profiles/handle.rs b/crates/openhuman-embed/src/profiles/handle.rs
index 32d2a25088..9bfa2bafab 100644
--- a/crates/openhuman-embed/src/profiles/handle.rs
+++ b/crates/openhuman-embed/src/profiles/handle.rs
@@ -19,7 +19,7 @@ use tokio::sync::broadcast;
use super::RelayMessage;
use super::{
ConversationMessageRecord, ConversationThreadSummary, Inner, ProfileError, ProfileId,
- WebChannelEvent,
+ ScopedWebEvent,
};
use crate::call::call_in;
use crate::error::CoreError;
@@ -91,13 +91,13 @@ pub struct RelayAccepted {
/// filter the gateway's `/events` stream applies.
pub struct ProfileEvents {
profile: String,
- rx: broadcast::Receiver<WebChannelEvent>,
+ rx: broadcast::Receiver<ScopedWebEvent>,
}
impl ProfileEvents {
/// The next event of this profile, or `None` once the bus is gone.
/// Events the receiver fell too far behind on are skipped.
- pub async fn recv(&mut self) -> Option<WebChannelEvent> {
+ pub async fn recv(&mut self) -> Option<ScopedWebEvent> {
loop {
match self.rx.recv().await {
Ok(event) if event.belongs_to_profile(&self.profile) => return Some(event),