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
fix(middleware): flatten nested if-let chain in tool policy check
Steven Enamakela61550bce20c
diff --git a/src/openhuman/agent/tinyagents/middleware_part_03.rs b/src/openhuman/agent/tinyagents/middleware_part_03.rsindex 8f2d6a3927..e41a4bea86 100644--- a/src/openhuman/agent/tinyagents/middleware_part_03.rs+++ b/src/openhuman/agent/tinyagents/middleware_part_03.rs@@ -134,21 +134,23 @@ impl ToolPolicyMiddleware {}.render());}- if call.name == "use_skill"- && let Some(inner_tool) = call+ if call.name == "use_skill" {+ if let Some(inner_tool) = call.arguments.get("tool").and_then(serde_json::Value::as_str)- && self.session.decision_for(inner_tool).blocks_execution()- {- let hint = crate::openhuman::tools::toolpacks::pack_for_tool(inner_tool)- .map(|pack| self.route_for_pack(pack))- .filter(|h| !h.is_empty())- .map(|h| format!(" {h}"))- .unwrap_or_default();- return Some(format!(- "Tool `{inner_tool}` is not allowed in the current session and cannot be used through `use_skill`.{hint}"- ));+ {+ if self.session.decision_for(inner_tool).blocks_execution() {+ let hint = crate::openhuman::tools::toolpacks::pack_for_tool(inner_tool)+ .map(|pack| self.route_for_pack(pack))+ .filter(|h| !h.is_empty())+ .map(|h| format!(" {h}"))+ .unwrap_or_default();+ return Some(format!(+ "Tool `{inner_tool}` is not allowed in the current session and cannot be used through `use_skill`.{hint}"+ ));+ }+ }}None}