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(computer): add live e2e test for TinyComputer module
Steven Enamakel65a79b43108b
diff --git a/Cargo.lock b/Cargo.lockindex b56d525303..cc1e796093 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4001,6 +4001,7 @@ dependencies = ["tinyagents-session","tinybus","tinychannels",+ "tinycomputer-bus","tinyinference-core","tinyinference-llm","tinyinference-local",diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 1f6f15ce9d..435d239a20 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -122,6 +122,12 @@ path = "../../tests/observability_smoke.rs"# The `is_*_event` Sentry filters are all `#[cfg(feature = "crash-reporting")]`.required-features = ["crash-reporting"]+[[test]]+name = "computer_bali_live_e2e"+path = "../../tests/computer_bali_live_e2e.rs"+# Loads the TinyComputer module through the registry.+required-features = ["modules"]+[[test]]name = "x402_twit_sh_live"path = "../../tests/x402_twit_sh_live.rs"@@ -374,6 +380,8 @@ uuid = { version = "1", features = ["v4"] }[dev-dependencies]aes-gcm = "0.10"+# The TinyComputer contract, for the live computer-use e2e (`computer_bali_live_e2e`).+tinycomputer-bus = { path = "../../vendor/tinycomputer/crates/tinycomputer-bus" }# sentry's TestTransport for the observability before_send smoke tests;# `default-features = false` keeps actix out of the graph (see the core manifest).sentry = { version = "0.47.0", default-features = false, features = ["test"] }diff --git a/crates/openhuman-cli/src/bin/library_profile/mock.rs b/crates/openhuman-cli/src/bin/library_profile/mock.rsindex f074544a3c..9c1c8afae6 100644--- a/crates/openhuman-cli/src/bin/library_profile/mock.rs+++ b/crates/openhuman-cli/src/bin/library_profile/mock.rs@@ -294,9 +294,7 @@ impl SubagentMock {fn reply_orchestrator_driven(&self, joined: &str) -> ChatResponse {// presentation_agent worker: return its finding.if self.is_worker_turn(joined) {- let i = self- .worker_index(joined)- .expect("worker turn has a marker");+ let i = self.worker_index(joined).expect("worker turn has a marker");return response(&finding_text(i));}// Orchestrator: fan out, then merge once every finding is back.diff --git a/crates/openhuman-core/src/modules/computer.rs b/crates/openhuman-core/src/modules/computer.rsindex a4eaecd88c..5fe9c7b9d3 100644--- a/crates/openhuman-core/src/modules/computer.rs+++ b/crates/openhuman-core/src/modules/computer.rs@@ -76,7 +76,10 @@ pub async fn status(config: &Config, load: bool) -> ComputerStatus {.find(|item| item.id == super::desktop::MODULE_ID)};let before = module();- let ask = load || before.as_ref().is_some_and(|m| m.state == ModuleState::Ready);+ let ask = load+ || before+ .as_ref()+ .is_some_and(|m| m.state == ModuleState::Ready);let (capabilities, error) = if ask {match describe(config).await {Ok(capabilities) => (Some(capabilities.into()), None),diff --git a/crates/openhuman-core/src/modules/computer_config_tests.rs b/crates/openhuman-core/src/modules/computer_config_tests.rsindex 60b526d526..55d1c22b19 100644--- a/crates/openhuman-core/src/modules/computer_config_tests.rs+++ b/crates/openhuman-core/src/modules/computer_config_tests.rs@@ -62,7 +62,10 @@ fn open_jev_and_sage_use_their_own_keys() {config.computer.decision_model = DecisionModel::OpenJev;let value = module_config(&config);- assert_eq!(value["jev"], json!({"api_key": "oj_test", "provider": "open_jev"}));+ assert_eq!(+ value["jev"],+ json!({"api_key": "oj_test", "provider": "open_jev"})+ );assert_eq!(billing_route(&config), "open_jev");config.computer.decision_model = DecisionModel::Sage;@@ -81,5 +84,8 @@ fn chrome_path_is_the_module_browser_executable() {let mut config = config_in(dir.path());config.browser.chrome_path = Some("/Applications/Chrome.app".into());let value = module_config(&config);- assert_eq!(value["browser"], json!({"executable": "/Applications/Chrome.app"}));+ assert_eq!(+ value["browser"],+ json!({"executable": "/Applications/Chrome.app"})+ );}diff --git a/crates/openhuman-core/src/modules/resolution_tests.rs b/crates/openhuman-core/src/modules/resolution_tests.rsindex 8a01155c9f..4f8c691d1f 100644--- a/crates/openhuman-core/src/modules/resolution_tests.rs+++ b/crates/openhuman-core/src/modules/resolution_tests.rs@@ -131,5 +131,8 @@ fn a_ready_module_that_faults_settles_as_failed() {table.peek("m"),ResolutionState::Failed("configuration refused".into()));- assert!(matches!(table.claim("m"), Claim::Done(Resolution::Failed(_))));+ assert!(matches!(+ table.claim("m"),+ Claim::Done(Resolution::Failed(_))+ ));}diff --git a/crates/openhuman-core/src/modules/schemas.rs b/crates/openhuman-core/src/modules/schemas.rsindex 8aa593d427..61df5e4b64 100644--- a/crates/openhuman-core/src/modules/schemas.rs+++ b/crates/openhuman-core/src/modules/schemas.rs@@ -201,8 +201,10 @@ fn handle_computer_status(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let load = params.get("load").and_then(Value::as_bool).unwrap_or(false);let config = config_rpc::load_config_with_timeout().await?;- Ok(serde_json::to_value(super::computer::status(&config, load).await)- .map_err(|error| error.to_string())?)+ Ok(+ serde_json::to_value(super::computer::status(&config, load).await)+ .map_err(|error| error.to_string())?,+ )})}diff --git a/tests/computer_bali_live_e2e.rs b/tests/computer_bali_live_e2e.rsindex 2baef06745..3809b5bfea 100644--- a/tests/computer_bali_live_e2e.rs+++ b/tests/computer_bali_live_e2e.rs@@ -66,7 +66,15 @@ fn summarize(view: &TaskView) -> String {let step = view.step.as_ref()- .map(|step| format!(" step {}/{} {} ({})", step.index + 1, step.total, step.kind, step.intent))+ .map(|step| {+ format!(+ " step {}/{} {} ({})",+ step.index + 1,+ step.total,+ step.kind,+ step.intent+ )+ }).unwrap_or_default();format!("[{:>3.0}%]{step} — {}", view.progress * 100.0, view.summary)}@@ -94,7 +102,11 @@ async fn books_a_bali_flight_up_to_the_payment_page() {let capabilities = status.capabilities.unwrap_or_else(|| panic!("TinyComputer did not describe itself: {:?}", status.error));- assert!(capabilities.compatible, "contract {:?}", capabilities.contract_version);+ assert!(+ capabilities.compatible,+ "contract {:?}",+ capabilities.contract_version+ );assert!(capabilities.jev_configured, "no decision model configured");assert!(capabilities.planner_configured, "no planner configured");assert!(capabilities.rescue_configured, "no rescue model configured");@@ -111,19 +123,30 @@ async fn books_a_bali_flight_up_to_the_payment_page() {.unwrap_or(20u64);let deadline = Instant::now() + Duration::from_secs(minutes * 60);- let mut view = browser_task::start(&config, &task).await.expect("StartTask");+ let mut view = browser_task::start(&config, &task)+ .await+ .expect("StartTask");println!("task {} started", view.id);loop {println!("{}", summarize(&view));match &view.status {TaskStatus::Running => {- assert!(Instant::now() < deadline, "task still running after {minutes} min");- view = browser_task::wait(&config, view.id.clone()).await.expect("AwaitTask");+ assert!(+ Instant::now() < deadline,+ "task still running after {minutes} min"+ );+ view = browser_task::wait(&config, view.id.clone())+ .await+ .expect("AwaitTask");}TaskStatus::NeedsInput { fields } => {let inputs: BTreeMap<String, String> = fields.iter()- .filter_map(|field| facts.get(&field.name).map(|v| (field.name.clone(), v.clone())))+ .filter_map(|field| {+ facts+ .get(&field.name)+ .map(|v| (field.name.clone(), v.clone()))+ }).collect();assert!(!inputs.is_empty(),