/** * decide/decide -- Core decide() and select() helper functions. * * decide() evaluates rules in order (first-match) and returns a DecisionResult. * select() evaluates ALL rules and returns a SelectionResult with all matches. * * Each rule's `when` can be: * - A function: (s) => s.creditScore > 700 (auto-captures reads via temp recorder) * - A filter: { creditScore: { gt: 700 } } (captures reads + operators + thresholds) */ import type { DecideRule, DecisionResult, SelectionResult } from './types.js'; /** * Evaluates rules in order (first-match). Returns a branded DecisionResult. * * @param scope - TypedScope or ScopeFacade * @param rules - Array of DecideRule (function or filter when clauses) * @param defaultBranch - Branch ID if no rule matches * * **Error behavior:** If a `when` function throws during evaluation, the rule is * treated as non-matching (`matched: false`) and the error message is captured in * `matchError` on that rule's `RuleEvidence` entry. Execution continues with * subsequent rules; errors do not propagate to the caller. * * **Empty-filter behavior (anti-vacuous-truth):** a filter rule whose `when` is * `{}` (no evaluable conditions) NEVER matches. This deliberately inverts the * Prisma/SQL `where: {}` intuition ("match everything") — a rule that asserts * nothing must not win a branch on vacuous truth. Use `defaultBranch` for the * catch-all instead. Unknown filter operators also never match (dev mode warns). */ export declare function decide(scope: S, rules: DecideRule[], defaultBranch: string): DecisionResult; /** * Evaluates ALL rules (not first-match). Returns a branded SelectionResult. * * @param scope - TypedScope or ScopeFacade * @param rules - Array of DecideRule (function or filter when clauses) * * **Error behavior:** If a `when` function throws during evaluation, the rule is * treated as non-matching (`matched: false`) and the error message is captured in * `matchError` on that rule's `RuleEvidence` entry. Evaluation continues with * remaining rules; errors do not propagate to the caller. * * **Empty-filter behavior (anti-vacuous-truth):** a filter rule whose `when` is * `{}` (no evaluable conditions) NEVER matches — same rule as `decide()`; an * always-selected branch must be expressed explicitly, not via an empty filter. * Unknown filter operators also never match (dev mode warns). */ export declare function select(scope: S, rules: DecideRule[]): SelectionResult;