import { type UsageLedger } from "./usage-ledger.js"; /** The scope a query is asking about. */ export declare function scopeOf(filter?: { callerKind?: string; callerId?: string; }): string; /** Every scope a single event counts toward. One event is counted once per * scope, so an org-wide read and a per-member read both see it. */ export declare function scopesFor(event: { caller?: { kind?: string; id?: string; }; }): string[]; /** Default name of the Stripe Billing Meter the per-caller scopes report to. * * Deliberately NOT the org meter's event name. They could share one — the scopes * are separated by customer either way — but a separate meter keeps a shadow * customer's usage out of anything the org meter is ever attached to for actual * billing. One extra account-level object, not one per org. */ export declare const SCOPE_METER_EVENT = "billing_tools_scope_usage"; /** Marks a customer as a counter rather than someone who buys anything. Read by * the doctor, which must not sample these when it checks customer currency. */ export declare const USAGE_SCOPE_KIND = "usage_counter"; /** Where the scope string is stored, so the customer can be found again from * nothing but the scope. */ export declare const USAGE_SCOPE_KEY = "bt_usage_scope"; /** Forget resolved scope customers — for a test, or after deleting one. */ export declare function invalidateUsageScopes(): void; export interface ScopeLedgerOptions { /** Meter event name. Defaults to `SCOPE_METER_EVENT`. */ eventName?: string; /** * Where WALLET-funded per-caller usage is read from. Defaults to the balance * ledger, which is exact and has no lag because the debit IS the record. * * A seam so a test can substitute one; there is no second right answer. * * There used to be a `null` here meaning "never read the wallet", because that * walk is the most expensive read in this file. It is gone: it was a * per-DEPLOYMENT switch for a per-QUERY fact, and the same plan can have a * member window that overflows into the wallet and an agent window that is * wallet-only — so one flag could not be right for both, and setting it wrong * under-reported, which reads as generosity and refuses no one. * `UsageQuery.sources` carries it per read instead, and `resolveAllowance` * derives it from the plan, so nothing has to be declared by hand. */ wallet?: UsageLedger; } /** * A per-CALLER `UsageLedger` backed entirely by Stripe. * * Built to be the `perCaller` leg of the composite, which is the only thing that * ever asks it a caller-filtered question: * * ```ts * stripeUsageLedger({ perCaller: stripeScopeUsageLedger() }) * ``` * * `covers.orgIncluded` is false because it does not answer org-wide windows — the * composite's own meter leg does, on the org's real customer, unchanged. */ export declare function stripeScopeUsageLedger(opts?: ScopeLedgerOptions): UsageLedger; //# sourceMappingURL=usage-scopes.d.ts.map