Rulvar API reference / @rulvar/core / QuotaRule
Interface: QuotaRule
Defined in: packages/core/src/model/quota.ts:52
One shared-quota rule. The dimension fields select which requests the rule governs (an absent dimension matches every value); EVERY matching rule must admit a request, and a grant consumes capacity from each of them. The counters are rule-scoped: one rule matching two models pools them under one cap; write one rule per model for per-model buckets.
Window semantics, named as the deliberate compromise it is (RV708): every PerMinute cap counts over FIXED epoch-aligned 60 s windows (QUOTA_WINDOW_MS), not a sliding minute. Each fixed window enforces its cap exactly, and a burst placed astride a boundary can therefore consume up to TWO caps inside one sliding 60 s; that bounded burst is the price of cross-process parity (every reference limiter in every process computes the same window from the same clock with no shared sliding state), and provider-side minute windows are themselves fuzzy. Size caps with the boundary burst in mind; the semantics are pinned as intended, not scheduled to change.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
account? | string | Scope-dimension pins (RV4205): a rule naming any of these matches only reservations whose run scope carries the same value, so a host caps by billing account, project, legal domain, region, or provider account without a limiter fork. A reservation with no scope (an unscoped run) matches none of them, exactly the tenant rule's semantics. | packages/core/src/model/quota.ts:65 |
legalDomain? | string | - | packages/core/src/model/quota.ts:67 |
model? | string | - | packages/core/src/model/quota.ts:55 |
project? | string | - | packages/core/src/model/quota.ts:66 |
provider? | string | Adapter id, as in concurrency.perProvider keys. | packages/core/src/model/quota.ts:54 |
providerAccount? | string | - | packages/core/src/model/quota.ts:69 |
region? | string | - | packages/core/src/model/quota.ts:68 |
requestsPerMinute? | number | Wire attempts admitted per window; the exact, hard cap. | packages/core/src/model/quota.ts:73 |
sponsor? | string | The sponsoring principal (RV4408), the newest scope dimension. | packages/core/src/model/quota.ts:71 |
tenant? | string | - | packages/core/src/model/quota.ts:56 |
tokensPerMinute? | number | Input plus output tokens admitted per window: estimated at admission, reconciled to actual usage. | packages/core/src/model/quota.ts:78 |