MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / evaluate

Method evaluate

crates/opencode-agent/src/agent.rs:111–125  ·  view source on GitHub ↗
(agent: &AgentInfo, tool_name: &str)

Source from the content-addressed store, hash-verified

109
110impl PermissionNext {
111 pub fn evaluate(agent: &AgentInfo, tool_name: &str) -> PermissionDecision {
112 if !agent.allowed_tools.is_empty()
113 && !agent.allowed_tools.iter().any(|tool| tool == tool_name)
114 {
115 return PermissionDecision::Deny;
116 }
117
118 let permission = tool_to_permission(tool_name);
119 let rule = evaluate_permission(permission, "*", &[agent.permission.clone()]);
120 match rule.action {
121 PermissionAction::Allow => PermissionDecision::Allow,
122 PermissionAction::Ask => PermissionDecision::Ask,
123 PermissionAction::Deny => PermissionDecision::Deny,
124 }
125 }
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]

Callers

nothing calls this directly

Calls 3

tool_to_permissionFunction · 0.85
is_emptyMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected