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
feat(web_chat): add journal shadow for web chat operations
Steven Enamakele90be8addf4c
diff --git a/crates/openhuman-core/src/web_chat/journal_shadow.rs b/crates/openhuman-core/src/web_chat/journal_shadow.rsindex c48b484cde..e2e5a5a449 100644--- a/crates/openhuman-core/src/web_chat/journal_shadow.rs+++ b/crates/openhuman-core/src/web_chat/journal_shadow.rs@@ -100,6 +100,7 @@ fn describe_signature_divergence(live: &[String], projected: &[String]) -> Strin}pub(super) async fn shadow_compare_journal_projection(+ ctx: &crate::core::runtime::DispatchCtx,request_id: &str,trace_ctx: tinyagents_harness::observability::trace_export::TraceContext,max_iterations: u32,@@ -116,7 +117,7 @@ pub(super) async fn shadow_compare_journal_projection(};let observations = match crate::agent::tinyagents::journal::read_run_events(- &crate::core::runtime::DispatchCtx::ambient(),+ ctx,&journal_run_id,0,)diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rsindex 3423a9a590..3bb1b13fd8 100644--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs@@ -230,6 +230,7 @@ async fn thread_has_live_turn(thread_id: &str, map_key: &str) -> bool {}pub async fn channel_web_chat(+ ctx: &crate::core::runtime::DispatchCtx,client_id: &str,thread_id: &str,message: &str,@@ -261,6 +262,7 @@ pub async fn channel_web_chat(}let result = start_chat(+ ctx,client_id,thread_id,message,diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rsindex 785cae1add..b86177f08e 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs@@ -278,7 +278,7 @@ pub(crate) fn spawn_progress_bridge(request_id: String,turn_state_store: std::sync::Arc<dyn TurnStates>,metadata: ChatRequestMetadata,- config: crate::config::Config, ctx: crate::core::runtime::DispatchCtx,+ config: crate::config::Config, dispatch_ctx: crate::core::runtime::DispatchCtx,) -> ProgressBridgeHandle {use crate::agent::progress::AgentProgress;use std::collections::HashMap;@@ -1164,7 +1164,7 @@ pub(crate) fn spawn_progress_bridge(let live_spans = collector.spans().to_vec();let journal_export = if let Some(trace_ctx) = journal_trace_ctx.take() {super::journal_shadow::shadow_compare_journal_projection(- &ctx, &request_id, trace_ctx.clone(), parent_max_iterations, &live_spans,+ &dispatch_ctx, &request_id, trace_ctx.clone(), parent_max_iterations, &live_spans,).await.map(|observations| (trace_ctx, observations))diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rsindex c183bf9e15..ed4b600d10 100644--- a/crates/openhuman-core/src/web_chat/schemas.rs+++ b/crates/openhuman-core/src/web_chat/schemas.rs@@ -155,7 +155,7 @@ pub fn schemas(function: &str) -> ControllerSchema {}}-fn handle_chat(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {+fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let p = deserialize_params::<WebChatParams>(params)?;// Recorded before the turn starts so it reads the new choice.@@ -165,6 +165,7 @@ fn handle_chat(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFutur)?;to_json(channel_web_chat(+ &ctx,&p.client_id,&p.thread_id,&p.message,