pub struct ShellInjection { /* private fields */ }Expand description
The authorization a !`cmd` expansion runs under — built from a
resolved crate::Config, never assembled ad hoc at a call site.
Implementations§
Source§impl ShellInjection
impl ShellInjection
Sourcepub fn from_config(config: &Config) -> Self
pub fn from_config(config: &Config) -> Self
The policy config authorizes. Disabled (the default) makes
Self::expand an identity function that spawns nothing.
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
A policy that executes nothing — the shape every caller that has no config at hand must use.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether this policy may run anything at all.
Sourcepub fn expand(&self, body: &str, allowed_tools: &[String]) -> String
pub fn expand(&self, body: &str, allowed_tools: &[String]) -> String
Replace every !`cmd` (and ```! block) in body with
that command’s output. allowed_tools is the BODY’s own
allowed-tools frontmatter, folded into the allow tier for these
commands only.
A command the engine does not resolve to
crate::permissions::Decision::Allow is never run: the token is
replaced by the refusal and its reason, in place, so the model reads
what was withheld instead of silently receiving nothing.