import type { AgentStore } from '../spi/agent-store.js';
import { type QuotaProvider, type QuotaQuery, type QuotaReport } from '../spi/quota-provider.js';
import type { QuotaStore } from '../spi/quota-store.js';
/** Ceilings for one window. Either, both or neither. */
export interface QuotaWindowLimits {
    tokens?: number;
    usd?: number;
}
/** Ceilings per window — what `quotas.windows({ … })` takes. */
export interface QuotaLimits {
    day?: QuotaWindowLimits;
    month?: QuotaWindowLimits;
}
/** {@link LedgerQuotaProvider}'s tuning beyond the ceilings. */
export interface LedgerQuotaOptions {
    /**
     * The soft limit: the share of a ceiling (`0..1`) past which the report carries a `warning`.
     * Stamped on every window that has a ceiling. Omit → no warnings.
     */
    warnAt?: number;
    /**
     * Whether the USD windows count ESTIMATED cost (tokens × the price row, for a provider that reports
     * none, e.g. Bedrock, OpenAI or Anthropic direct) as well as provider-reported cost. Default `true`:
     * a USD ceiling that ignored estimates would read $0 and never block for every such provider, which
     * is a budget that does not enforce. Set `false` to budget on provider-reported (gateway) cost only.
     */
    countEstimatedCost?: boolean;
    /**
     * Whose usage a window sums: `'actor'` (default) the caller's own; `'tenant'` every row of the
     * caller's tenant (`actor.tenantRef`, e.g. the active organization), so a team shares one budget;
     * `'actor-in-tenant'` the caller's rows inside that tenant only. An actor with no tenant is
     * counted on its own usage. Needs a store with `usageBetweenForTenant` (the Lucid and in-memory
     * stores have it); without it the actor's own usage is used.
     */
    per?: QuotaScope;
}
/** Whose usage a quota window sums — see {@link LedgerQuotaOptions.per}. */
export type QuotaScope = 'actor' | 'tenant' | 'actor-in-tenant';
/**
 * A {@link QuotaProvider} over the usage ledger: a day window (tokens from `quotaToday`, spend from
 * `usageBetween` when the store has it), and a month window when the store implements
 * `usageBetween`. Ceilings come from `limits`; a {@link QuotaStore} passed alongside lends the day
 * window its own token ceiling when `limits.day.tokens` does not set one.
 *
 * Spend is what the usage rows recorded: the provider-reported cost of a gateway, plus the loop's
 * estimate for a provider that reports none (unless `countEstimatedCost: false`).
 */
export declare class LedgerQuotaProvider implements QuotaProvider {
    private readonly store;
    private readonly quota?;
    private readonly limits;
    private readonly options;
    constructor(store: AgentStore, quota?: QuotaStore | undefined, limits?: QuotaLimits, options?: LedgerQuotaOptions);
    report(query: QuotaQuery): Promise<QuotaReport>;
    /** The tenant a window sums by, or `undefined` to sum the actor's own usage. */
    private tenantOf;
    private tenantReport;
    private dayWindow;
    /** The window's USD: every priced row, or (with `countEstimatedCost: false`) reported cost only. */
    private usd;
    private window;
}
//# sourceMappingURL=ledger-quota-provider.d.ts.map