pub fn run_agent(
files: &[(PathBuf, TaskFile)],
name: &str,
args: &[String],
cwd: &Path,
) -> Result<Output, RunError>Expand description
The agent gate: run name for an MCP or agent surface, captured, failing
closed. Enforced, in order:
- The nearest definition of
nameacross the layered files must carryAgent: allow, elseRunError::NotAllowed. A nearer non-allowed definition shadows a farther allowed one (stillNotAllowed), and a name that resolves nowhere isNotAllowedtoo: the agent never learns whether a hidden job exists. - The target must not raw-template a declared arg into its script via
{{ arg }}(the agent controls the value), elseRunError::Injects. The author must read the value from the environment instead. - The
Requires:chain is resolved within the target’s own file, not by the cross-file nearest-wins scanrunuses. The author who wroteAgent: allowvouched for their file’s jobs; a nearer, untrusted task file in the invocation directory must not be able to shadow a dependency and run attacker-controlled code through an allowed entry point. A dependency is never independently callable and never listed.
Only the target receives args; dependencies run argless with author-controlled
defaults, so the target is the sole injection surface.