← all modules

Std.Ai.Policy

Std.Ai.Policy

Types
  type Risk = Low | Medium | High
  type alias Action
  type Decision = Allow | Deny String | NeedsApproval String
  type Outcome a = Ran a | Denied String | Pending String

Values
  action : String -> String -> Risk -> Action
  allowAll : Action -> Decision
      A policy that allows everything. For a trusted internal tool, or a test.
  denyAll : String -> Action -> Decision
      A policy that refuses everything with a fixed reason.
  gate : (Action -> Decision) -> Action -> Task Error a -> Task Error (Outcome a)
      Gate an effect behind a policy. Only `Allow` runs `effect`; `Deny` and
  requireApprovalAbove : Risk -> Action -> Decision
      Allow actions at or below `threshold` risk; require human approval above it.