Skip to content

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

refactor(tui): project scoped web events through a view

Steven Enamakela4d7a1ceb0dc
diff --git a/crates/openhuman-tui/src/app.rs b/crates/openhuman-tui/src/app.rs
index 2a51a131a1..9153a6e315 100644
--- a/crates/openhuman-tui/src/app.rs
+++ b/crates/openhuman-tui/src/app.rs
@@ -23,7 +23,7 @@ use serde_json::json;
use tokio::sync::broadcast;
use openhuman_rpc::embed::chat_surface as web_chat;
-use openhuman_rpc::embed::chat_surface::WebChannelEvent;
+use openhuman_rpc::embed::chat_surface::ScopedWebEvent;
use openhuman_rpc::embed::CoreRuntime;
use super::actions::Action;
@@ -60,7 +60,7 @@ pub async fn run(
runtime: Arc<CoreRuntime>,
client_id: String,
thread_id: String,
- mut web_rx: broadcast::Receiver<WebChannelEvent>,
+ mut web_rx: broadcast::Receiver<ScopedWebEvent>,
options: LaunchOptions,
) -> anyhow::Result<()> {
let mut state = TranscriptState::new(client_id.clone());
diff --git a/crates/openhuman-tui/src/app/events.rs b/crates/openhuman-tui/src/app/events.rs
index 7c9a3fa2a1..a24882aaab 100644
--- a/crates/openhuman-tui/src/app/events.rs
+++ b/crates/openhuman-tui/src/app/events.rs
@@ -1,11 +1,13 @@
//! Runtime event projection and pending decisions.
use super::*;
+use crate::event_view::WebEventView;
pub(super) fn handle_web_event(
- ev: &WebChannelEvent,
+ scoped: &ScopedWebEvent,
state: &mut TranscriptState,
ui: &mut UiState,
) {
+ let ev = WebEventView::from_event(scoped.wire_event());
if ui.thread_id.is_empty() || ev.client_id != state.client_id() || ev.thread_id != ui.thread_id
{
return;
@@ -78,6 +80,6 @@ pub(super) fn handle_web_event(
present_pending_plan_review(ui);
}
}
- _ => state.apply_event(ev),
+ _ => state.apply_event(scoped.wire_event()),
}
}