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
refactor(web_chat): re-export event_context from the module root
Steven Enamakelcc392549bf68
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rsindex 620d244099..f406884aea 100644--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs@@ -671,7 +671,7 @@ async fn run_system_turn_on_thread(),Err(error) => crate::web_chat::publish_web_channel_event(crate::web_chat::WebChannelEvent::ChatError {- context: crate::web_chat::channel_event::event_context(+ context: crate::web_chat::event_context("system",thread_id.clone(),run_id.clone(),diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rsindex 1bb66699c9..f87c3c6583 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs@@ -62,7 +62,7 @@ impl RelayChannel {/// reply only to the caller's own stream.pub fn outbound_event(&self, message: &SendMessage) -> WebChannelEvent {WebChannelEvent::ChannelOutbound {- context: crate::web_chat::channel_event::event_context(+ context: crate::web_chat::event_context(self.client_id.clone(),self.thread_id.clone(),self.request_id.clone(),diff --git a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rsindex 64e8e9e36a..d7d8fde26e 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs@@ -78,10 +78,8 @@ async fn send_publishes_under_the_callers_stamp_and_records_the_text() {}};assert_eq!(event.event_name(), CHANNEL_OUTBOUND_EVENT);- assert_eq!(event.agent.as_deref(), Some("u-relay-test"));assert!(event.belongs_to("u-relay-test"));assert!(!event.belongs_to("u-someone-else"));- assert_eq!(event.profile.as_deref(), Some("p-relay-test"));assert!(event.belongs_to_profile("p-relay-test"));assert!(!event.belongs_to_profile("p-someone-else"));assert_eq!(channel.sent(), vec!["reply one".to_string()]);diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rsindex 1aa9c924a6..77312ab3dc 100644--- a/crates/openhuman-core/src/cron/scheduler/executor.rs+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs@@ -297,7 +297,7 @@ pub(super) fn agent_session_target_tag(target: &SessionTarget) -> &'static str {pub(super) fn publish_cron_user_error(kind: &str) {tracing::debug!("[cron] action=surface_user_error kind={kind}");crate::web_chat::publish_web_channel_event(crate::web_chat::WebChannelEvent::UserError {- context: crate::web_chat::channel_event::event_context("system", "", ""),+ context: crate::web_chat::event_context("system", "", ""),error_type: Some(kind.to_string()),error_source: Some("cron".to_string()),});diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex e4301c2829..7051a957d8 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -280,7 +280,7 @@ async fn deliver_to_web_thread(.map_err(|e| anyhow!("could not store the reply in the origin thread: {e}"))?;publish_web_channel_event(WebChannelEvent::ProactiveMessage {- context: crate::web_chat::channel_event::event_context(+ context: crate::web_chat::event_context("system",thread_id,request_id.clone(),diff --git a/crates/openhuman-core/src/flows/ops/streaming.rs b/crates/openhuman-core/src/flows/ops/streaming.rsindex e59bb64b64..95851269d1 100644--- a/crates/openhuman-core/src/flows/ops/streaming.rs+++ b/crates/openhuman-core/src/flows/ops/streaming.rs@@ -128,7 +128,7 @@ pub(super) async fn finalize_flow_stream(}Err(err) => {crate::web_chat::publish_web_channel_event(crate::web_chat::WebChannelEvent::ChatError {- context: crate::web_chat::channel_event::event_context(+ context: crate::web_chat::event_context("system",target.thread_id.clone(),target.request_id.clone(),diff --git a/crates/openhuman-core/src/web_chat/event_bus_tests.rs b/crates/openhuman-core/src/web_chat/event_bus_tests.rsindex 583f5653ae..ba2e05a12b 100644--- a/crates/openhuman-core/src/web_chat/event_bus_tests.rs+++ b/crates/openhuman-core/src/web_chat/event_bus_tests.rs@@ -559,6 +559,7 @@ async fn publish_web_channel_event_preserves_an_explicit_ts() {client_id: "ts-probe".into(),thread_id: "thread-ts-stamp-probe-explicit".into(),request_id: "ts-probe".into(),+ turn_request_id: None,seq: None,ts: Some(123),},diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rsindex ac7298056b..94631d1408 100644--- a/crates/openhuman-core/src/web_chat/mod.rs+++ b/crates/openhuman-core/src/web_chat/mod.rs@@ -18,6 +18,7 @@//! routing envelope around those typed events for its process-wide bus.mod channel_event;+pub(crate) use channel_event::event_context;mod egress_surface;mod event_bus;mod event_bus_channel;diff --git a/crates/openhuman-core/src/web_chat/surface_tests.rs b/crates/openhuman-core/src/web_chat/surface_tests.rsindex af7ea9e462..077c44d411 100644--- a/crates/openhuman-core/src/web_chat/surface_tests.rs+++ b/crates/openhuman-core/src/web_chat/surface_tests.rs@@ -1,5 +1,6 @@use super::*;use crate::core::runtime::DispatchCtx;+use crate::web_chat::ScopedWebEvent;use std::sync::Arc;fn ids(request_id: &str) -> TurnIds {diff --git a/crates/openhuman-core/src/web_chat/turn_host_tests.rs b/crates/openhuman-core/src/web_chat/turn_host_tests.rsindex df74be1af3..b8e379124a 100644--- a/crates/openhuman-core/src/web_chat/turn_host_tests.rs+++ b/crates/openhuman-core/src/web_chat/turn_host_tests.rs@@ -165,6 +165,6 @@ async fn the_heartbeat_beats_only_for_a_live_turn() {}assert_eq!(names[0], "inference_start");assert!(names.len() >= 2, "{names:?}");- assert!(names[1..].iter().all(|name| name == "inference_heartbeat"));+ assert!(names[1..].iter().all(|name| *name == "inference_heartbeat"));drop(beat);}diff --git a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rsindex 2a6b68b9a4..f73f5ec9d5 100644--- a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs@@ -699,7 +699,7 @@ fn assert_turn_timeout(event: &crate::web_chat::ScopedWebEvent) {assert_eq!(*error_retryable, Some(true));let message = message.clone();assert!(- !message.contains("openhuman_turn_wall_clock_timeout"),- "internal marker must not leak into user copy: {message}"+ !message.as_deref().unwrap_or_default().contains("openhuman_turn_wall_clock_timeout"),+ "internal marker must not leak into user copy: {message:?}");}