pub async fn check_dispatch_admin(
auth: &Option<Arc<AuthState>>,
headers: &HeaderMap,
) -> Result<(), StatusCode>Expand description
16F: gate for the per-agent dispatch surface (/xagent/{name}).
The OUTER dispatch must be performed by a HUMAN with a THQ role
(admin/user/developer): agents may never dispatch agents, and service
is read-only by design. The impersonated INNER request is separately
authenticated and Cedar-gated AS THE AGENT (per-action matrix), so this
gate answers exactly one question: “may this principal dispatch
agent-users at all”.
Open mode (no auth configured) allows dispatch, consistent with the
posture check_auth already applies. Dev-mode human tokens carry no role
and are therefore rejected — dispatch testing requires a real JWT.
v0.23.10 (issue eb385e4f): user/developer humans dispatch (the THQ
console is the owner-scoped plane) — see [dispatch_allowed].