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 egress surface and progress bridge
Steven Enamakel5d90649579d0
diff --git a/crates/openhuman-core/src/web_chat/egress_surface.rs b/crates/openhuman-core/src/web_chat/egress_surface.rsindex 33f071a197..9616906e5e 100644--- a/crates/openhuman-core/src/web_chat/egress_surface.rs+++ b/crates/openhuman-core/src/web_chat/egress_surface.rs@@ -94,7 +94,7 @@ impl EventHandler<DomainEvent> for EgressSurfaceSubscriber {descriptor.reason,request_id,);- publish_web_channel_event(&crate::core::runtime::DispatchCtx::ambient(), WebChannelEvent {+ publish_web_channel_event_in(&crate::core::runtime::DispatchCtx::ambient(), WebChannelEvent {event: "external_transfer_pending".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rsindex a176ba6843..c208529da6 100644--- a/crates/openhuman-core/src/web_chat/event_bus.rs+++ b/crates/openhuman-core/src/web_chat/event_bus.rs@@ -182,7 +182,7 @@ impl EventHandler<DomainEvent> for MemoryActivitySurfaceSubscriber {log::debug!("[web-channel] memory-activity-surface emitting memory_activity kind={event_name} thread_id={thread_id} client_id={client_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "memory_activity".to_string(),client_id,thread_id,@@ -246,7 +246,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting thread_goal_updated thread_id={thread_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "thread_goal_updated".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -258,7 +258,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting thread_goal_cleared thread_id={thread_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "thread_goal_cleared".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -269,7 +269,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting thread_todos_changed thread_id={thread_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "thread_todos_changed".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -281,7 +281,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting run_mode_changed thread_id={thread_id} mode={mode}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "run_mode_changed".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -307,7 +307,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting queue_item_queued thread_id={thread_id} item_id={item_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "queue_item_queued".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -333,7 +333,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting queue_item_delivered thread_id={thread_id} item_id={item_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "queue_item_delivered".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -364,7 +364,7 @@ impl EventHandler<DomainEvent> for AgentSurfaceSubscriber {log::debug!("[web-channel] agent-surface emitting queue_item_delivered thread_id={thread_id} item_id={item_id}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "queue_item_delivered".to_string(),client_id: String::new(),thread_id: thread_id.clone(),@@ -418,7 +418,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {log::info!("[web-channel] artifact-surface emitting artifact_ready id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "artifact_ready".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -456,7 +456,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {"[web-channel] artifact-surface emitting artifact_failed id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?} error_len={}",error.len());- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "artifact_failed".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -492,7 +492,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {log::info!("[web-channel] artifact-surface emitting artifact_pending id={artifact_id} kind={kind} thread_id={thread_id} client_id={client_id} tool_call_id={tool_call_id:?}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "artifact_pending".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -635,7 +635,7 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {log::info!("[web-channel] approval-surface emitting approval_request request_id={request_id} thread_id={thread_id} client_id={client_id} tool={tool_name}");- publish_web_channel_event(&ctx, approval_request_event(+ publish_web_channel_event_in(&ctx, approval_request_event(request_id,tool_name,action_summary,@@ -669,7 +669,7 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {log::info!("[web-channel] approval-surface emitting approval_decided request_id={request_id} thread_id={thread_id} client_id={client_id} tool={tool_name} decision={decision}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "approval_decided".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -701,7 +701,7 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {"[web-channel] plan-review-surface emitting plan_review_request request_id={request_id} thread_id={thread_id} client_id={client_id} steps={}",steps.len());- publish_web_channel_event(&ctx, plan_review_request_event(+ publish_web_channel_event_in(&ctx, plan_review_request_event(request_id,summary,steps,@@ -731,7 +731,7 @@ impl EventHandler<DomainEvent> for ApprovalSurfaceSubscriber {log::info!("[web-channel] plan-review-surface emitting plan_review_decided request_id={request_id} thread_id={thread_id} client_id={client_id} decision={decision}");- publish_web_channel_event(&ctx, WebChannelEvent {+ publish_web_channel_event_in(&ctx, WebChannelEvent {event: "plan_review_decided".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rsindex b636852fd5..1f999d16eb 100644--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs@@ -195,7 +195,7 @@ async fn cancel_chat_inner((true, Some(started_by)) => started_by,_ => client_id.to_string(),};- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_error".to_string(),client_id: client_id.clone(),thread_id: thread_id.to_string(),@@ -204,7 +204,7 @@ async fn cancel_chat_inner(error_type: Some("cancelled".to_string()),..Default::default()});- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_cancelled".to_string(),client_id,thread_id: thread_id.to_string(),@@ -384,7 +384,7 @@ pub async fn channel_web_queue_remove(drop(in_flight);if removed > 0 {log::info!("[web-channel] removed queued item thread_id={thread_id} item_id={item_id}");- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "queue_item_removed".to_string(),client_id: client_id.to_string(),thread_id: thread_id.to_string(),diff --git a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rsindex 8037a05c8d..c44752aa53 100644--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs@@ -169,7 +169,7 @@ pub(crate) async fn spawn_parallel_turn();}- publish_web_channel_event(&ctx_task, WebChannelEvent {+ publish_web_channel_event_in(&ctx_task, WebChannelEvent {event: "chat_error".to_string(),client_id: client_id_task.clone(),thread_id: thread_id_task.clone(),@@ -196,7 +196,7 @@ pub(crate) async fn spawn_parallel_turn(// `chat_error` on this path today — leaving a client// waiting on this request_id with no terminal event.// `chat_cancelled` closes it out.- publish_web_channel_event(&ctx_task, WebChannelEvent {+ publish_web_channel_event_in(&ctx_task, WebChannelEvent {event: "chat_cancelled".to_string(),client_id: client_id_task.clone(),thread_id: thread_id_task.clone(),diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex cbdb31b68a..574a3a2d30 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -455,7 +455,7 @@ async fn start_chat_inner(item_id: Some(request_id.clone()),text_preview: Some(crate::agent::queued_turn::text_preview(&message)),});- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_error".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -467,7 +467,7 @@ async fn start_chat_inner(// See channel_ops::cancel_chat_inner — `chat_cancelled` is the// structured successor to `chat_error{error_type:"cancelled"}`,// kept alongside it for one release.- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_cancelled".to_string(),client_id: client_id.clone(),thread_id: thread_id.clone(),@@ -681,7 +681,7 @@ async fn start_chat_inner();}if let Some(event) = deferred_error {- publish_web_channel_event(&ctx_task, event);+ publish_web_channel_event_in(&ctx_task, event);}if !followups.is_empty() {log::info!(diff --git a/crates/openhuman-core/src/web_chat/presentation.rs b/crates/openhuman-core/src/web_chat/presentation.rsindex 1a97db870a..0f59ad448a 100644--- a/crates/openhuman-core/src/web_chat/presentation.rs+++ b/crates/openhuman-core/src/web_chat/presentation.rs@@ -219,7 +219,7 @@ fn publish_chat_done(usage_payload: Option<TurnUsagePayload>,timing_payload: Option<crate::web_chat::TurnTimingPayload>,) {- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_done".to_string(),client_id: client_id.to_string(),thread_id: thread_id.to_string(),diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rsindex c1b1cf1178..40d9e60fe0 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs@@ -142,7 +142,7 @@ fn publish_seq_stamped() {event.seq = Some(*next_seq);*next_seq = next_seq.saturating_add(1);- publish_web_channel_event(ctx, event);+ publish_web_channel_event_in(ctx, event);}/// The trimmed narration to surface as an interim bubble, or `None` when it isdiff --git a/crates/openhuman-core/src/web_chat/suggestions.rs b/crates/openhuman-core/src/web_chat/suggestions.rsindex c21f7a43d5..99b3afc1d3 100644--- a/crates/openhuman-core/src/web_chat/suggestions.rs+++ b/crates/openhuman-core/src/web_chat/suggestions.rs@@ -189,7 +189,7 @@ async fn generate_and_emit(request_id={request_id} count={}",suggestions.len());- publish_web_channel_event(ctx, WebChannelEvent {+ publish_web_channel_event_in(ctx, WebChannelEvent {event: "chat_suggestions".to_string(),client_id: client_id.to_string(),thread_id: thread_id.to_string(),