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
chore(tui): tidy imports and test event construction
Steven Enamakelfb492ffc37b6
diff --git a/crates/openhuman-core/src/web_chat/surface_tests.rs b/crates/openhuman-core/src/web_chat/surface_tests.rsindex bf20ad1ab3..42e66e9877 100644--- a/crates/openhuman-core/src/web_chat/surface_tests.rs+++ b/crates/openhuman-core/src/web_chat/surface_tests.rs@@ -55,9 +55,18 @@ async fn output_events_keep_the_turns_ids_and_one_increasing_seq() {assert_eq!(first.event_name(), "text_delta");assert_eq!(first.context().client_id, "surface-client");assert_eq!(first.context().thread_id, "surface-thread-surface-seq");- assert_eq!((first_wire["delta"].as_str(), first_wire["round"].as_u64()), (Some("a"), Some(2)));- assert_eq!((first.context().seq, second.context().seq), (Some(1), Some(2)));- assert!(first.context().ts.is_some(), "every event carries a wall-clock stamp");+ assert_eq!(+ (first_wire["delta"].as_str(), first_wire["round"].as_u64()),+ (Some("a"), Some(2))+ );+ assert_eq!(+ (first.context().seq, second.context().seq),+ (Some(1), Some(2))+ );+ assert!(+ first.context().ts.is_some(),+ "every event carries a wall-clock stamp"+ );}#[tokio::test]diff --git a/crates/openhuman-tui/src/app.rs b/crates/openhuman-tui/src/app.rsindex 5641653925..f29ea06c22 100644--- a/crates/openhuman-tui/src/app.rs+++ b/crates/openhuman-tui/src/app.rs@@ -13,8 +13,8 @@//! subscriber (see `logging::init_for_tui`); nothing is ever `println!`'d.use std::io::Write;-use std::sync::atomic::{AtomicBool, Ordering};use std::sync::Arc;+use std::sync::atomic::{AtomicBool, Ordering};use std::time::Duration;use base64::Engine as _;@@ -22,9 +22,9 @@ use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifieruse serde_json::json;use tokio::sync::broadcast;+use openhuman_rpc::embed::CoreRuntime;use openhuman_rpc::embed::chat_surface as web_chat;use openhuman_rpc::embed::chat_surface::ScopedWebEvent;-use openhuman_rpc::embed::CoreRuntime;use super::actions::Action;use super::cockpit::{Overlay, OverlayKind, OverlayRow, PendingApproval, PendingPlanReview};@@ -392,7 +392,7 @@ async fn dispatch_action(}match action {Action::Command(command) => {- return execute_command(command, runtime, client_id, state, ui).await+ return execute_command(command, runtime, client_id, state, ui).await;}Action::View(tab) => {ui.active_tab = tab;diff --git a/crates/openhuman-tui/src/app_tests.rs b/crates/openhuman-tui/src/app_tests.rsindex 675c880933..c9b3490784 100644--- a/crates/openhuman-tui/src/app_tests.rs+++ b/crates/openhuman-tui/src/app_tests.rs@@ -1,4 +1,9 @@use super::*;+use openhuman_rpc::embed::chat_surface::WebChannelEvent;++fn web_event(value: serde_json::Value) -> WebChannelEvent {+ serde_json::from_value(value).expect("test event matches TinyChannels' web contract")+}fn key(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent {KeyEvent::new(code, modifiers)@@ -80,14 +85,10 @@ fn inbound_approval_preserves_typed_overlay_input() {overlay.input = Some("draft title".into());ui.overlay = Some(overlay);handle_web_event(- &WebChannelEvent {- event: "approval_request".into(),- client_id: "client".into(),- thread_id: "thread".into(),- request_id: "approval-1".into(),- tool_name: Some("shell".into()),- ..Default::default()- },+ &web_event(json!({+ "event":"approval_request","client_id":"client","thread_id":"thread",+ "request_id":"approval-1","tool_name":"shell"+ })),&mut state,&mut ui,);@@ -109,15 +110,11 @@ fn inbound_plan_review_waits_for_typed_overlay_to_close() {overlay.input = Some("draft title".into());ui.overlay = Some(overlay);handle_web_event(- &WebChannelEvent {- event: "plan_review_request".into(),- client_id: "client".into(),- thread_id: "thread".into(),- request_id: "review-1".into(),- message: Some("Review this plan".into()),- args: Some(json!({"steps": ["Inspect", "Implement"]})),- ..Default::default()- },+ &web_event(json!({+ "event":"plan_review_request","client_id":"client","thread_id":"thread",+ "request_id":"review-1","message":"Review this plan",+ "args":{"steps":["Inspect","Implement"]}+ })),&mut state,&mut ui,);@@ -151,24 +148,18 @@ fn failed_account_thread_replacement_rejects_old_and_unscoped_activity() {state.push_system("Could not create a new thread (see logs).");for thread in ["previous-account-thread", ""] {handle_web_event(- &WebChannelEvent {- event: "text_delta".into(),- client_id: "client".into(),- thread_id: thread.into(),- delta: Some("old secret".into()),- ..Default::default()- },+ &web_event(json!({+ "event":"text_delta","client_id":"client","thread_id":thread,+ "delta":"old secret"+ })),&mut state,&mut ui,);handle_web_event(- &WebChannelEvent {- event: "approval_request".into(),- client_id: "client".into(),- thread_id: thread.into(),- request_id: "old-approval".into(),- ..Default::default()- },+ &web_event(json!({+ "event":"approval_request","client_id":"client","thread_id":thread,+ "request_id":"old-approval"+ })),&mut state,&mut ui,);diff --git a/crates/openhuman-tui/src/event_view.rs b/crates/openhuman-tui/src/event_view.rsindex 25ce64579b..094b17d1e8 100644--- a/crates/openhuman-tui/src/event_view.rs+++ b/crates/openhuman-tui/src/event_view.rs@@ -51,13 +51,11 @@ impl WebEventView {..Self::default()};use WebChannelEvent as E;- let subagent_view = |detail| {- SubagentView {- task_id: Some(detail.task_id.clone()),- display_name: detail.display_name.clone(),- elapsed_ms: detail.elapsed_ms,- output: detail.output.clone(),- }+ let subagent_view = |detail| SubagentView {+ task_id: Some(detail.task_id.clone()),+ display_name: detail.display_name.clone(),+ elapsed_ms: detail.elapsed_ms,+ output: detail.output.clone(),};match event {E::ChatDone { full_response, .. }