services/approval/approval
Approval service — pure functions for approval caching and decision-making. No process dictionary. Cache is an explicit value threaded through calls.
Values
pub fn cache_approval(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
scope: guardrails.ApprovalScope,
) -> List(#(String, String, guardrails.ApprovalScope))
Store an approval in the cache with the given scope.
pub fn clear_session(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
) -> List(#(String, String, guardrails.ApprovalScope))
Remove Session and Once entries for a session. Always entries survive.
pub fn consume_approval(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
) -> #(List(#(String, String, guardrails.ApprovalScope)), Bool)
Consume a Once-scoped approval after use. Returns the updated cache and whether anything was consumed.
pub fn empty() -> List(
#(String, String, guardrails.ApprovalScope),
)
Create an empty approval cache.
pub fn is_approved(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
) -> Bool
Check if a command has been approved for a given session.
pub fn new_guardrail() -> behaviours.Guardrail
Build a Guardrail behaviour record with real approval cache functions.