Skip to main content

resolve_script_permissions

Function resolve_script_permissions 

Source
pub fn resolve_script_permissions(
    perms: &ScriptToolPermissions,
    resolve_builtin: &dyn Fn(&str) -> ToolPolicy,
) -> ScriptAllow
Expand description

Resolve [tool_script_permissions] into concrete allow/deny booleans.

Allow/Deny map directly. Inherit means:

  • read_file / write_file / shell: permitted only when the agent’s resolved policy for the equivalent built-in (resolve_builtin) is ToolPolicy::Allow. This is evaluated once against the entry stage’s permission layers; a later stage’s tool_permissions do not re-gate a script’s host calls.
  • http_get / http_post / env_var: permitted (no built-in equivalent to inherit from, and the tool itself is still gated by Layers 1/2/4).

resolve_builtin is a &dyn Fn (not impl Fn) so this function has a single monomorphization; otherwise each distinct caller closure type gets its own copy of the net/filelike match arms, and coverage is attributed per-instantiation (each only exercises the arms that caller hits).