Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(tinyagents): remove unused middleware methods from part 03

Steven Enamakelf0e78cd03ac1
diff --git a/src/openhuman/agent/tinyagents/middleware_part_03.rs b/src/openhuman/agent/tinyagents/middleware_part_03.rs
index e41a4bea86..e7e76df8cb 100644
--- a/src/openhuman/agent/tinyagents/middleware_part_03.rs
+++ b/src/openhuman/agent/tinyagents/middleware_part_03.rs
@@ -110,66 +110,6 @@ impl ToolMiddleware<()> for ToolPolicyMiddleware {
}
}
-impl ToolPolicyMiddleware {
- /// The channel-permission gate the engine ran before the builder policy.
- 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());
- }
- if call.name == "use_skill" {
- if let Some(inner_tool) = call
- .arguments
- .get("tool")
- .and_then(serde_json::Value::as_str)
- {
- 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
- }
-
- fn generated_context(
- &self,
- name: &str,
- args: &serde_json::Value,
- ) -> Option<crate::openhuman::agent::tool_policy::GeneratedToolRuntimeContext> {
- self.tool_sets
- .iter()
- .flat_map(|set| set.iter())
- .find(|t| t.name() == name)
- .and_then(|t| {
- crate::openhuman::tools::traits::generated_runtime_context(t.as_ref(), args)
- })
- }
-}
-
/// `after_tool`: capture each tool call's execution outcome (success + content)
/// into a shared sink before the harness folds the result into a `Message::tool`
/// that drops the `error` flag (issue #4249). Without this, a post-turn