Allow/block command rules and their resolution (PRD §8).
Resolution order (normative, §8.2):
- More specific pattern wins —
"github:issues.create"beats"github:issues.*"beats"github:*"beats"*:*". Command specificity dominates endpoint specificity. - Block beats allow at equal specificity.
- Narrower scope beats wider at equal specificity + effect
(
:call>:session>{:until, _}>:always). - No matching rule ⇒
:ask(default-deny: never default-allow). - Expired
{:until, t}rules never match (and stores prune them lazily).
Summary
Functions
Decide the outcome for endpoint:command given candidate rules.
True when the rule's time scope has lapsed.
Does a rule pattern match the given endpoint + command?
Build a rule with generated id + timestamp.
Functions
@spec decide( [GenAI.Approval.Permission.Rule.t()], String.t(), String.t(), DateTime.t() ) :: {:allow, GenAI.Approval.Permission.Rule.t()} | {:block, GenAI.Approval.Permission.Rule.t()} | :ask
Decide the outcome for endpoint:command given candidate rules.
Returns {:allow, rule}, {:block, rule}, or :ask.
@spec expired?(GenAI.Approval.Permission.Rule.t(), DateTime.t()) :: boolean()
True when the rule's time scope has lapsed.
Does a rule pattern match the given endpoint + command?
@spec new(keyword()) :: GenAI.Approval.Permission.Rule.t()
Build a rule with generated id + timestamp.