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
refactor: simplify conditional branches and redundant expressions
Steven Enamakel0f9cb94bf265
diff --git a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rsindex 1c33df49a4..314bacd81e 100644--- a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs+++ b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs@@ -53,10 +53,9 @@ pub(super) fn claude_agent_sdk_model_from_string(let provider = provider.trim();let model = if provider == CLAUDE_AGENT_SDK_PROVIDER {config.claude_agent_sdk.default_model.clone()- } else if let Some(model) = provider.strip_prefix(CLAUDE_AGENT_SDK_PREFIX) {- model.trim().to_string()} else {- return None;+ let model = provider.strip_prefix(CLAUDE_AGENT_SDK_PREFIX)?;+ model.trim().to_string()};Some(model)}diff --git a/crates/openhuman-core/src/integrations/composio/tools/visibility.rs b/crates/openhuman-core/src/integrations/composio/tools/visibility.rsindex 29a9c14d20..247db81819 100644--- a/crates/openhuman-core/src/integrations/composio/tools/visibility.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/visibility.rs@@ -180,7 +180,7 @@ pub(super) async fn filter_list_tools_response(ToolDecision::Allow | ToolDecision::PassthroughCheckScope { .. }));}- let drained: Vec<_> = resp.tools.drain(..).collect();+ let drained = std::mem::take(&mut resp.tools);resp.tools = drained.into_iter().zip(keep)diff --git a/crates/openhuman-core/src/integrations/tools/google_places.rs b/crates/openhuman-core/src/integrations/tools/google_places.rsindex b37509a76d..673b0138b6 100644--- a/crates/openhuman-core/src/integrations/tools/google_places.rs+++ b/crates/openhuman-core/src/integrations/tools/google_places.rs@@ -253,7 +253,7 @@ impl Tool for GooglePlacesDetailsTool {Ok(resp) => {let p = &resp.place;let mut lines = vec![- format!("{}", p.name),+ p.name.to_string(),format!("Address: {}", p.formatted_address),];diff --git a/crates/openhuman-core/src/memory/error.rs b/crates/openhuman-core/src/memory/error.rsindex eb25f4ba99..cb6e3d5862 100644--- a/crates/openhuman-core/src/memory/error.rs+++ b/crates/openhuman-core/src/memory/error.rs@@ -134,10 +134,9 @@ impl MemoryError {E::Unauthorized(message.to_string())} else if let Some(message) = reason.strip_prefix("unavailable: ") {E::Unavailable(message.to_string())- } else if let Some(message) = reason.strip_prefix("engine error: ") {- E::Engine(message.to_string())} else {- return None;+ let message = reason.strip_prefix("engine error: ")?;+ E::Engine(message.to_string())};Some(Self::from(error)).filter(Self::is_account_wide)}diff --git a/crates/openhuman-core/src/skills/runtime/run_machinery.rs b/crates/openhuman-core/src/skills/runtime/run_machinery.rsindex 7e55e5ce37..2d9240be94 100644--- a/crates/openhuman-core/src/skills/runtime/run_machinery.rs+++ b/crates/openhuman-core/src/skills/runtime/run_machinery.rs@@ -212,7 +212,7 @@ pub async fn spawn_workflow_run_background(agent.set_event_context(run_id.clone(), "skill");agent.set_agent_definition_name(format!("orchestrator-skill-{}",- &run_id.get(..8).unwrap_or(&run_id)+ run_id.get(..8).unwrap_or(&run_id)));let (tx, rx) = tokio::sync::mpsc::channel(256);agent.set_on_progress(Some(tx));