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 progress bridge for streaming updates
Steven Enamakeladdf410a8280
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rsindex a7c71d7e69..963de38e0a 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs@@ -10,6 +10,7 @@ use crate::web_chat::{SubagentProgressDetail, WebChannelEvent};use tinyagents_session::{port::TurnStates, turn_state::TurnStateMirror};use super::event_bus::publish_web_channel_event_in;+use crate::core::runtime::DispatchCtx;use super::types::ChatRequestMetadata;#[path = "progress_bridge_subagent_events.rs"]@@ -135,11 +136,7 @@ fn flush_interim_narration(/// identically to the persisted turn-state snapshot/// (conversations-timeline-refactor, Phase 4). The counter advances once per/// emitted event so each `(request_id, seq)` pair is unique within a turn.-fn publish_seq_stamped(- ctx: &crate::core::runtime::DispatchCtx,- next_seq: &mut u64,- mut event: WebChannelEvent,-) {+fn publish_seq_stamped(ctx: &DispatchCtx, next_seq: &mut u64, mut event: WebChannelEvent) {event.seq = Some(*next_seq);*next_seq = next_seq.saturating_add(1);publish_web_channel_event_in(ctx, event);@@ -284,8 +281,7 @@ pub(crate) fn spawn_progress_bridge(request_id: String,turn_state_store: std::sync::Arc<dyn TurnStates>,metadata: ChatRequestMetadata,- config: crate::config::Config,- dispatch_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;@@ -1189,11 +1185,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(- &dispatch_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/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rsindex 531b57c308..e5c1d707f5 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs@@ -114,8 +114,7 @@ async fn tool_call_completed_forwards_real_output_on_tool_result() {"req-out".into(),store,ChatRequestMetadata::default(),- config,- crate::core::runtime::DispatchCtx::ambient(),+ config, crate::core::runtime::DispatchCtx::ambient(),);tx.send(crate::agent::progress::AgentProgress::ToolCallCompleted {@@ -227,8 +226,7 @@ fn spawn_test_bridge(request_id.to_string(),store,ChatRequestMetadata::default(),- Config::default(),- crate::core::runtime::DispatchCtx::ambient(),+ Config::default(), crate::core::runtime::DispatchCtx::ambient(),);tx}@@ -423,8 +421,7 @@ async fn wait_drained_returns_after_queued_events_are_forwarded() {"req-drain".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp),- crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::ToolCallCompleted {@@ -481,8 +478,7 @@ async fn wait_drained_is_bounded_when_the_turn_never_completes() {"req-drain-timeout".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp),- crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),);assert!(!handle.wait_drained(Duration::from_millis(50)).await);// Closing the channel ends the bridge, which counts as drained.@@ -507,8 +503,7 @@ async fn short_narration_is_flushed_on_the_rounds_first_tool_call() {"req-short".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp),- crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::TextDelta {delta: "Let me check.".into(),@@ -704,8 +699,7 @@ async fn hold_text_stream_suppresses_text_delta_but_keeps_interim() {hold_text_stream: true,..Default::default()},- config,- crate::core::runtime::DispatchCtx::ambient(),+ config, crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::TextDelta {