Mutable payload for a route invocation. args is the request arguments
object; result is the response object (None on the inbound path,
Some once the tool/resource has produced a value).
Run the post-invocation phases: result (if a response payload
is present) then post_policy. Used by orchestrators bound to a
tool_post_invoke-style hook.
Run the pre-invocation phases: args then policy. Used by
orchestrators bound to a tool_pre_invoke-style hook — by the time
post-invoke fires, the tool has produced a response, so result/
post_policy belong to evaluate_post.
Run all four phases against payload, mutating it in place.
Convenience wrapper for callers that don’t need the pre/post split
(tests, single-hook hosts). Calls evaluate_pre then evaluate_post,
skipping post entirely on a pre-side Deny. Taints from both halves
concatenate; args_modified and result_modified carry their
respective flags independently.