AlphaA composite rule: "deal is won AND user is admin"
const rule: Rule = {
type: 'all',
rules: [
{ type: 'ref', id: 'limetech.deal-status', args: { status: 'won' } },
{ type: 'ref', id: 'limetech.is-admin' },
],
};
Referencing a saved rule
const rule: Rule = {
type: 'not',
rule: { type: 'ref', id: 'mycorp.high-value-deal' },
};
A serializable boolean tree, persisted as config and consumed by RuleRegistry.compile.
Leaves reference primitives or saved rules by id (
{ type: 'ref'; id }). Branches combine children withall,any, ornot.Primitives and saved rules share a single id namespace, so a
refresolves to one or the other whencompileruns. If the id belongs to a registered primitive, the suppliedargsare bound and a predicate is built. If it belongs to a saved rule, the saved tree is expanded in place, anyargson the outerrefare ignored at compile time (a saved rule is already a complete tree), and validate reports theargs-on-saved-rulediagnostic so authoring tools can prompt for cleanup. Registering a primitive with the same id as an existing saved rule, or vice versa, is an error.Saved rules are loaded by the host client from its own config layer at boot, there is no public API on RuleRegistry for registering or listing them. A
refto an unknown id surfaces as anunknown-refdiagnostic at compile or validate time.allandanyshort-circuit during evaluation:allstops at the first child that returnsfalse,anyat the first that returnstrue. Later children are not evaluated.