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: files changed src/openhuman/agent/tinyagents/middleware.rs,src/openhuman/agent/tinyagents/mid
Steven Enamakel1c3a18369580
diff --git a/src/openhuman/agent/tinyagents/middleware.rs b/src/openhuman/agent/tinyagents/middleware.rsindex eb2fd08dc3..8b9e8955ff 100644--- a/src/openhuman/agent/tinyagents/middleware.rs+++ b/src/openhuman/agent/tinyagents/middleware.rs@@ -29,3 +29,4 @@ include!("middleware_part_03.rs");include!("middleware_part_04.rs");include!("middleware_part_05.rs");include!("middleware_part_06.rs");+include!("middleware_part_07.rs");diff --git a/src/openhuman/agent/tinyagents/middleware_part_02.rs b/src/openhuman/agent/tinyagents/middleware_part_02.rsindex f507e275dc..ace6fce672 100644--- a/src/openhuman/agent/tinyagents/middleware_part_02.rs+++ b/src/openhuman/agent/tinyagents/middleware_part_02.rs@@ -695,71 +695,6 @@ impl ToolPolicyMiddleware {})}- /// The channel-permission gate the engine ran before the builder policy: a- /// session-level deny, then a per-call permission-level ceiling check. Returns- /// the blocking message when the call must not execute.- fn channel_permission_block(&self, call: &TaToolCall) -> Option<String> {- let decision = self.session.decision_for(&call.name);- if decision.is_denied() {- return Some(- PolicyDenial::SessionForbidden {- tool: &call.name,- required: decision.required_permission,- allowed: decision.allowed_permission,- channel: &self.channel,- }- .render(),- );- }- let tool = self.resolve_tool(&call.name)?;- let call_required = tool.permission_level_with_args(&call.arguments);- if call_required > decision.allowed_permission {- return Some(- PolicyDenial::PermissionTooLow {- tool: &call.name,- required: call_required,- allowed: decision.allowed_permission,- channel: &self.channel,- }- .render(),- );- }- // For `use_skill`, also validate the resolved inner tool against the- // session allowlist. Role-hidden packed tools are not checked by the- // outer policy name; without this check `use_skill` would bypass the- // session's effective allowlist for any packed tool.- if call.name == "use_skill" {- if let Some(inner_tool) = call- .arguments- .get("tool")- .and_then(serde_json::Value::as_str)- {- // `blocks_execution`, NOT `is_denied`. Every withheld packed- // tool is `HideFromPrompt`, and `use_skill` is the only route it- // has — gating that route on `is_denied` refused all of them.- let inner_decision = self.session.decision_for(inner_tool);- if inner_decision.blocks_execution() {- // Name the route. A bare denial gives the model nothing to- // do differently, and a model with no next step retries the- // same call: one live turn burned its whole budget on six- // identical `use_skill` denials and died on the- // repeated-failure breaker. Same sentence the listing uses,- // resolved against the same session, so the two cannot- // tell the model different stories.- 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- }-fn generated_context(&self,name: &str,diff --git a/src/openhuman/agent/tinyagents/middleware_part_07.rs b/src/openhuman/agent/tinyagents/middleware_part_07.rsnew file mode 100644index 0000000000..760d423274--- /dev/null+++ b/src/openhuman/agent/tinyagents/middleware_part_07.rs@@ -0,0 +1,66 @@+impl ToolPolicyMiddleware {+ /// The channel-permission gate the engine ran before the builder policy: a+ /// session-level deny, then a per-call permission-level ceiling check. Returns+ /// the blocking message when the call must not execute.+ fn channel_permission_block(&self, call: &TaToolCall) -> Option<String> {+ let decision = self.session.decision_for(&call.name);+ if decision.is_denied() {+ return Some(+ PolicyDenial::SessionForbidden {+ tool: &call.name,+ required: decision.required_permission,+ allowed: decision.allowed_permission,+ channel: &self.channel,+ }+ .render(),+ );+ }+ let tool = self.resolve_tool(&call.name)?;+ let call_required = tool.permission_level_with_args(&call.arguments);+ if call_required > decision.allowed_permission {+ return Some(+ PolicyDenial::PermissionTooLow {+ tool: &call.name,+ required: call_required,+ allowed: decision.allowed_permission,+ channel: &self.channel,+ }+ .render(),+ );+ }+ // For `use_skill`, also validate the resolved inner tool against the+ // session allowlist. Role-hidden packed tools are not checked by the+ // outer policy name; without this check `use_skill` would bypass the+ // session's effective allowlist for any packed tool.+ if call.name == "use_skill" {+ if let Some(inner_tool) = call+ .arguments+ .get("tool")+ .and_then(serde_json::Value::as_str)+ {+ // `blocks_execution`, NOT `is_denied`. Every withheld packed+ // tool is `HideFromPrompt`, and `use_skill` is the only route it+ // has — gating that route on `is_denied` refused all of them.+ let inner_decision = self.session.decision_for(inner_tool);+ if inner_decision.blocks_execution() {+ // Name the route. A bare denial gives the model nothing to+ // do differently, and a model with no next step retries the+ // same call: one live turn burned its whole budget on six+ // identical `use_skill` denials and died on the+ // repeated-failure breaker. Same sentence the listing uses,+ // resolved against the same session, so the two cannot+ // tell the model different stories.+ 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+ }+}