services/guardrails/approval_cache
In-memory approval cache — pure list-based functions. Process-dictionary functions have been removed and replaced by services/approval/approval.gleam which provides an explicit cache API.
Values
pub fn cache_approval(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
scope: guardrails.ApprovalScope,
) -> List(#(String, String, guardrails.ApprovalScope))
Cache an approval with the given scope.
pub fn clear_session(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
) -> List(#(String, String, guardrails.ApprovalScope))
Remove guardrails.Once and Session entries for a session (on session reset). guardrails.Always-scoped entries survive.
pub fn consume_approval(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
) -> #(List(#(String, String, guardrails.ApprovalScope)), Bool)
Consume guardrails.Once-scoped approvals after use. Returns (new_cache, was_consumed). guardrails.Once entries are removed on first hit; Session and guardrails.Always entries persist.
pub fn is_approved(
cache: List(#(String, String, guardrails.ApprovalScope)),
session_id: String,
command: String,
) -> Bool
Check if a command has been approved for this session.
pub fn redact_secrets(text: String) -> String
Redact secret-looking key-value pairs from text for display in approval
messages. Handles both JSON ("key": "value") and shell (--key value,
KEY=value) patterns. Follows zeroclaw’s secret key list.