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
style: reorder imports and collapse multi-line assertions
Steven Enamakel11883cbb5cd7
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rsindex 4c14bbdd3c..720598f460 100644--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs@@ -8,13 +8,13 @@ use std::sync::Arc;use async_trait::async_trait;use tinyagents_graph::goals::GoalToolKind;-use tinyagents_harness::tool::packs::{PackSelection, USE_SKILL, UseSkillDispatch};+use tinyagents_harness::tool::packs::{PackSelection, UseSkillDispatch, USE_SKILL};use tinyagents_harness::tool::{CanonicalSharedToolAdapter, ToolDispatch, ToolExecScope, ToolExecution, ToolExecutionContext,};use tinyagents_registry::{CapabilityRegistry, ComponentKind, RegistryDiagnostic};use tinyagents_runtime::turn_driver::{SharedToolSet, ToolSetBuilder};-use tinyagents_runtime::{ToolAdmission, project_descriptors};+use tinyagents_runtime::{project_descriptors, ToolAdmission};use tinyinference_llm::model::ChatModel;use tinytools::{Tool, ToolCallOptions, ToolResult, ToolRunContext};@@ -22,8 +22,8 @@ use crate::agent::orchestration::tools::{ContinueSubagentDispatch, DelegateGraphDispatch, DelegationDispatch,SpawnAsyncSubagentDispatch, SpawnParallelAgentsDispatch, SpawnSubagentDispatch,};-use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::host::run_context::HostOperationContext;+use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::turn_policy::is_subagent_spawn_or_delegate_tool;use crate::agent::tools::TodoToolDispatch;use crate::core::runtime::CoreContext;diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rsindex 77e33e08f0..aece9c8e55 100644--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs@@ -131,7 +131,7 @@ async fn static_live_harness_builder_resolves_control_aliases_from_the_executionDurableSubagentSession, DurableSubagentStatus, SubagentSessionStore,};use tinyagents_harness::{- ComponentId, agent_loop::phases::execute_tool_batch, context::RunConfig,+ agent_loop::phases::execute_tool_batch, context::RunConfig, ComponentId,};let workspace = tempfile::tempdir().expect("live harness workspace");@@ -242,7 +242,7 @@ async fn live_close_alias_enforces_parent_thread_ownership() {DurableSubagentSession, DurableSubagentStatus, SubagentSessionStore,};use tinyagents_harness::{- ComponentId, agent_loop::phases::execute_tool_batch, context::RunConfig,+ agent_loop::phases::execute_tool_batch, context::RunConfig, ComponentId,};let workspace = tempfile::tempdir().expect("live harness workspace");@@ -379,7 +379,7 @@ async fn live_close_alias_enforces_parent_thread_ownership() {#[tokio::test]async fn registered_memory_dispatch_enforces_one_budget_across_distinct_calls() {use crate::memory::test_fixtures::{bind_reference, config_in};- use tinyagents_harness::{CallId, context::RunConfig};+ use tinyagents_harness::{context::RunConfig, CallId};use tinytools::ToolCallOptions;let workspace = tempfile::tempdir().unwrap();let config = config_in(&workspace);diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rsindex a24d1845da..4632efa8da 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs@@ -21,9 +21,9 @@ use async_trait::async_trait;use serde_json::json;use std::path::Path;use std::sync::Arc;-use tinyagents_harness::CallId;use tinyagents_harness::context::RunConfig;-use tinyagents_harness::tool::packs::{PackRegistryHandle, USE_SKILL, UseSkillTool};+use tinyagents_harness::tool::packs::{PackRegistryHandle, UseSkillTool, USE_SKILL};+use tinyagents_harness::CallId;use tinyinference_llm::message::Message;use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};use tinytools::{Tool, ToolCallOptions, ToolResult};diff --git a/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs b/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rsindex 3f568b3905..f72c061f44 100644--- a/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs+++ b/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs@@ -141,7 +141,6 @@ fn coding_agent_prompts_reference_action_sandbox_not_stale_workspace() {coding.contains("action sandbox") || coding.contains("action_dir"),"guides/coding.md must reference the action sandbox or action_dir (see #3236)");-}#[test]diff --git a/crates/openhuman-core/src/agent_registry/agents/loader_tests_orchestrator_tier_tests.rs b/crates/openhuman-core/src/agent_registry/agents/loader_tests_orchestrator_tier_tests.rsindex f3241328dd..b73959e4a3 100644--- a/crates/openhuman-core/src/agent_registry/agents/loader_tests_orchestrator_tier_tests.rs+++ b/crates/openhuman-core/src/agent_registry/agents/loader_tests_orchestrator_tier_tests.rs@@ -159,10 +159,7 @@ fn orchestrator_is_chat_tier() {#[test]fn other_builtins_default_to_worker_tier() {for def in load_builtins().unwrap() {- if matches!(- def.id.as_str(),- "orchestrator" | "flow_discovery"- ) {+ if matches!(def.id.as_str(), "orchestrator" | "flow_discovery") {continue;}assert_eq!(diff --git a/crates/openhuman-core/src/agent_runs/schemas_tests.rs b/crates/openhuman-core/src/agent_runs/schemas_tests.rsindex 1715ad2d5d..c9c36629b2 100644--- a/crates/openhuman-core/src/agent_runs/schemas_tests.rs+++ b/crates/openhuman-core/src/agent_runs/schemas_tests.rs@@ -1,6 +1,6 @@use super::*;-use crate::core::TypeSchema;use crate::core::runtime::DispatchCtx;+use crate::core::TypeSchema;use serde_json::json;#[test]@@ -30,26 +30,21 @@ fn schemas_expose_expected_inputs_and_unknown_fallback() {assert_eq!(chat.namespace, "agent");assert_eq!(chat.inputs.len(), 5);assert!(matches!(chat.inputs[1].ty, TypeSchema::Option(_)));- assert!(- chat.inputs- .iter()- .any(|input| input.name == "thread_id" && !input.required)- );+ assert!(chat+ .inputs+ .iter()+ .any(|input| input.name == "thread_id" && !input.required));let triage = schemas("triage_evaluate");assert_eq!(triage.inputs.len(), 7);- assert!(- triage- .inputs- .iter()- .any(|input| input.name == "payload" && input.required)- );- assert!(- triage- .inputs- .iter()- .any(|input| input.name == "dry_run" && !input.required)- );+ assert!(triage+ .inputs+ .iter()+ .any(|input| input.name == "payload" && input.required));+ assert!(triage+ .inputs+ .iter()+ .any(|input| input.name == "dry_run" && !input.required));let unknown = schemas("nope");assert_eq!(unknown.function, "unknown");@@ -130,13 +125,11 @@ async fn reload_and_definition_handlers_cover_missing_registry_paths() {.await.expect("reload handler should always succeed");assert_eq!(reload.get("status").and_then(Value::as_str), Some("noop"));- assert!(- reload- .get("note")- .and_then(Value::as_str)- .unwrap()- .contains("Restart")- );+ assert!(reload+ .get("note")+ .and_then(Value::as_str)+ .unwrap()+ .contains("Restart"));let list_result = handle_list_definitions(DispatchCtx::process_default(), Map::new()).await;match list_result {diff --git a/crates/openhuman-core/src/core/agent_cli.rs b/crates/openhuman-core/src/core/agent_cli.rsindex 8efede7f6e..6e1e60d323 100644--- a/crates/openhuman-core/src/core/agent_cli.rs+++ b/crates/openhuman-core/src/core/agent_cli.rs@@ -17,13 +17,13 @@//! `--agent orchestrator` for the orchestrator prompt; otherwise pass//! any built-in or workspace-custom agent id (e.g. `orchestrator`, `researcher`).-use anyhow::{Result, anyhow};+use anyhow::{anyhow, Result};use std::path::PathBuf;use crate::agent_registry::host_definition::AgentDefinitionRegistry;-use crate::core::agent_cli::debug::prompt_size::{PromptSizeReport, render_text};+use crate::core::agent_cli::debug::prompt_size::{render_text, PromptSizeReport};use crate::core::agent_cli::debug::{- DumpPromptOptions, DumpedPrompt, dump_agent_prompt, dump_all_agent_prompts, write_prompt_dumps,+ dump_agent_prompt, dump_all_agent_prompts, write_prompt_dumps, DumpPromptOptions, DumpedPrompt,};pub(crate) mod debug;diff --git a/crates/openhuman-core/src/core/agent_cli/debug/mod.rs b/crates/openhuman-core/src/core/agent_cli/debug/mod.rsindex 2f273e4f98..dddcf89a38 100644--- a/crates/openhuman-core/src/core/agent_cli/debug/mod.rs+++ b/crates/openhuman-core/src/core/agent_cli/debug/mod.rs@@ -14,7 +14,7 @@use std::path::PathBuf;-use anyhow::{Context, Result, anyhow};+use anyhow::{anyhow, Context, Result};pub mod dump_writer;pub mod prompt_size;diff --git a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size.rs b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size.rsindex 1e2b1a37af..07584d8771 100644--- a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size.rs+++ b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size.rs@@ -30,7 +30,7 @@use anyhow::Result;-use super::{DumpPromptOptions, DumpedPrompt, dump_agent_prompt};+use super::{dump_agent_prompt, DumpPromptOptions, DumpedPrompt};/// Rough bytes-per-token for English prose and JSON on a BPE tokenizer.///diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rsindex ce99ae01b2..6134a05160 100644--- a/tests/json_rpc_e2e.rs+++ b/tests/json_rpc_e2e.rs@@ -19,17 +19,17 @@ use std::sync::{Arc, Mutex, OnceLock};use std::time::Duration;use axum::extract::State;-use axum::http::{HeaderMap, StatusCode, Uri, header::AUTHORIZATION};+use axum::http::{header::AUTHORIZATION, HeaderMap, StatusCode, Uri};use axum::routing::{get, post};use axum::{Json, Router};use futures_util::StreamExt;-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::{Digest, Sha256};use tempfile::tempdir;use tinyinference_llm::message::Message;use tinyinference_llm::model::ModelRequest;-use openhuman_core::core::auth::{CORE_TOKEN_ENV_VAR, init_rpc_token};+use openhuman_core::core::auth::{init_rpc_token, CORE_TOKEN_ENV_VAR};use openhuman_core::platform::connectivity::rpc::pick_listen_port;use openhuman_rpc::server::build_core_http_router;@@ -1539,12 +1539,10 @@ async fn json_rpc_tokenjuice_detect_and_cache_stats() {).await;let stats_result = assert_no_jsonrpc_error(&stats, "tokenjuice_cache_stats");- assert!(- stats_result- .get("entries")- .and_then(Value::as_u64)- .is_some()- );+ assert!(stats_result+ .get("entries")+ .and_then(Value::as_u64)+ .is_some());assert!(stats_result.get("bytes").and_then(Value::as_u64).is_some());rpc_join.abort();@@ -1569,18 +1567,14 @@ async fn json_rpc_tokenjuice_settings_and_savings() {let settings = get_result.get("settings").expect("settings_get returns a settings object");- assert!(- settings- .get("router_enabled")- .and_then(Value::as_bool)- .is_some()- );- assert!(- settings- .get("ccr_min_tokens")- .and_then(Value::as_u64)- .is_some()- );+ assert!(settings+ .get("router_enabled")+ .and_then(Value::as_bool)+ .is_some());+ assert!(settings+ .get("ccr_min_tokens")+ .and_then(Value::as_u64)+ .is_some());// settings_update: flip the CCR token threshold and confirm it round-trips.let updated = post_json_rpc(@@ -1609,13 +1603,11 @@ async fn json_rpc_tokenjuice_settings_and_savings() {.await;let savings_result = assert_no_jsonrpc_error(&savings, "tokenjuice_savings_stats");assert!(savings_result.get("attributionModel").is_some());- assert!(- savings_result- .get("total")- .and_then(|t| t.get("tokensSaved"))- .and_then(Value::as_u64)- .is_some()- );+ assert!(savings_result+ .get("total")+ .and_then(|t| t.get("tokensSaved"))+ .and_then(Value::as_u64)+ .is_some());assert!(savings_result.get("cache").is_some());// savings_reset: zeroes the totals.@@ -1825,32 +1817,24 @@ async fn json_rpc_agent_registry_manages_defaults_and_custom_agents() {.iter().find(|definition| definition.get("id").and_then(Value::as_str) == Some("summarizer")).expect("safe agent library should include summarizer");- assert!(- memory_agent- .get("display_name")- .and_then(Value::as_str)- .is_some()- );- assert!(- memory_agent- .get("when_to_use")- .and_then(Value::as_str)- .is_some()- );+ assert!(memory_agent+ .get("display_name")+ .and_then(Value::as_str)+ .is_some());+ assert!(memory_agent+ .get("when_to_use")+ .and_then(Value::as_str)+ .is_some());assert!(memory_agent.get("system_prompt").is_none());assert!(memory_agent.get("tools").is_some());- assert!(- memory_agent- .get("direct_tool_count")- .and_then(Value::as_u64)- .is_some()- );- assert!(- memory_agent- .get("can_run_as_user_facing_worker")- .and_then(Value::as_bool)- .is_some()- );+ assert!(memory_agent+ .get("direct_tool_count")+ .and_then(Value::as_u64)+ .is_some());+ assert!(memory_agent+ .get("can_run_as_user_facing_worker")+ .and_then(Value::as_bool)+ .is_some());let missing = post_json_rpc(&rpc_base,@@ -3370,12 +3354,10 @@ async fn json_rpc_thread_working_dir_binds_before_the_first_message() {).await;let cleared = assert_no_jsonrpc_error(&cleared, "threads_update_working_dir clear");- assert!(- cleared- .get("data")- .and_then(|d| d.get("actionDir"))- .is_none()- );+ assert!(cleared+ .get("data")+ .and_then(|d| d.get("actionDir"))+ .is_none());// 3. A protected folder is refused.let ssh = home.join(".ssh");@@ -3771,13 +3753,11 @@ async fn json_rpc_thread_turn_state_lifecycle() {).await;let missing_outer = assert_no_jsonrpc_error(&get_turn_missing, "turn_state_get_turn (absent)");- assert!(- missing_outer- .get("data")- .and_then(|d| d.get("turnState"))- .map(|v| v.is_null())- .unwrap_or(true)- );+ assert!(missing_outer+ .get("data")+ .and_then(|d| d.get("turnState"))+ .map(|v| v.is_null())+ .unwrap_or(true));// clear → cleared:truelet cleared = post_json_rpc(@@ -3805,13 +3785,11 @@ async fn json_rpc_thread_turn_state_lifecycle() {).await;let again_outer = assert_no_jsonrpc_error(&got_again, "turn_state_get (after clear)");- assert!(- again_outer- .get("data")- .and_then(|d| d.get("turnState"))- .map(|v| v.is_null())- .unwrap_or(true)- );+ assert!(again_outer+ .get("data")+ .and_then(|d| d.get("turnState"))+ .map(|v| v.is_null())+ .unwrap_or(true));api_join.abort();rpc_join.abort();@@ -6920,14 +6898,12 @@ async fn json_rpc_local_ai_ollama_endpoint_normalizes_bind_address_and_clears()).await;let clear_result = assert_no_jsonrpc_error(&clear, "clear ollama base_url");- assert!(- clear_result- .get("result")- .and_then(|value| value.get("config"))- .and_then(|config| config.get("local_ai"))- .and_then(|local_ai| local_ai.get("base_url"))- .is_none_or(Value::is_null)- );+ assert!(clear_result+ .get("result")+ .and_then(|value| value.get("config"))+ .and_then(|config| config.get("local_ai"))+ .and_then(|local_ai| local_ai.get("base_url"))+ .is_none_or(Value::is_null));mock_join.abort();rpc_join.abort();@@ -7709,12 +7685,10 @@ async fn voice_live_settings_round_trip_over_json_rpc() {.await;let tested = assert_no_jsonrpc_error(&tested, "voice_live_test_provider");assert_eq!(tested["ok"], false);- assert!(- tested["error"]- .as_str()- .unwrap_or_default()- .contains("not_configured")- );+ assert!(tested["error"]+ .as_str()+ .unwrap_or_default()+ .contains("not_configured"));mock_join.abort();rpc_join.abort();@@ -9998,11 +9972,9 @@ async fn json_rpc_task_sources_crud_and_status() {.as_array().expect("list returns array").clone();- assert!(- sources- .iter()- .any(|s| s.get("id").and_then(Value::as_str) == Some(id.as_str()))- );+ assert!(sources+ .iter()+ .any(|s| s.get("id").and_then(Value::as_str) == Some(id.as_str())));// ── get roundtrips ───────────────────────────────────────────────let get = post_json_rpc(diff --git a/tests/support/scripted_stack.rs b/tests/support/scripted_stack.rsindex 0371c76ffd..d5126d5470 100644--- a/tests/support/scripted_stack.rs+++ b/tests/support/scripted_stack.rs@@ -13,9 +13,9 @@use std::sync::{Mutex, MutexGuard};-use axum::Json;use axum::http::HeaderMap;-use serde_json::{Value, json};+use axum::Json;+use serde_json::{json, Value};/// Lock `m`, recovering the data when a panicking test poisoned it.pub fn lock_or_recover<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {