secreq-rule
The AssemblyScript SDK for writing a programmable rule — for the decisions that pattern matching cannot express. A rule is one file exporting decide(ctx: RuleCtx): Decision: read the request through the RuleCtx you are handed, then return approve(), pass() to leave it to the human, or deny(reason).
Functions
approvefunctionAuto-approve the ask without prompting.denyfunctionAuto-deny the ask. `reason` is shown to the user.passfunctionNo opinion — fall through to declarative rules / the consent prompt.promptfunctionRequire the consent prompt: no rule may auto-approve this ask. The gap `pass()` leaves. `pass()` means "no opinion", so another rule's approve still carries the ask through silently — right for a request your rule does not recognise, wrong for one it recognises as needing a human. `prompt()` says the second thing: not suspicious enough to refuse, too consequential to release unattended. Ranks between the two it sits under. A `deny()` from any rule still wins, and this beats every approve. `reason` is shown to the user, so write it as the answer to "why am I being asked?" — e.g. `prompt('publishing to a registry you have not used before')`.