`src/tool/permission.rs` — `PermissionCheck`
The permission decision vocabulary — a small enum, no policy engine.
Key items
PermissionCheck—Allow,Deny { reason },Ask { prompt },Modify { modified_input }.- Constructors:
allow(),deny(...),ask(...),modify(...); predicatesis_allow/deny/ask/modify.
Behavior notes
- There is no
PermissionPolicy/PermissionSettype — the policy is your function; this enum is the decision. Deny.reasonsurfaces to the model verbatim (via the middleware’s error text) — write concrete reasons.Askresolution andModifyvalidation are the caller’s responsibilities (the middleware denies unresolved Asks; Modify bypasses schema re-validation).Tool::is_read_onlyandToolContext::is_non_interactiveare the companion flags policies read.
Deep dive: Permissions.