import { type LedgerRow } from './accounts-store.js'; export interface PointsBalance { userId: string; monthlyLimit: number; bonus: number; usedThisPeriod: number; remaining: number; periodStart: number; pointsPerUsd: number; /** Admins are not gated by monthlyLimit / bonus. Never JSON-serialize Infinity. */ unlimited: boolean; } export interface ChargeInput { userId: string; tokensIn: number; tokensOut: number; model?: string; /** CLI adapter name (`claude-code`, `cursor`, …) when there is no LLM id. */ agent?: string; providerType?: string; costUsd?: number; costPer1kIn?: number; costPer1kOut?: number; } export declare class PointsError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function getPointsBalance(userId: string): PointsBalance | null; export declare function listPointsBalances(): PointsBalance[]; export declare function setPointsQuota(userId: string, patch: { monthlyLimit?: number; bonus?: number; addBonus?: number; }): PointsBalance; export declare function setPointsConfig(patch: { pointsPerUsd?: number; defaultMonthlyLimit?: number; defaultCostPer1kIn?: number; defaultCostPer1kOut?: number; }): { pointsPerUsd: number; defaultMonthlyLimit: number; defaultCostPer1kIn: number; defaultCostPer1kOut: number; }; export declare function getPointsConfig(): { pointsPerUsd: number; defaultMonthlyLimit: number; defaultCostPer1kIn: number; defaultCostPer1kOut: number; }; export declare function usdToPoints(usd: number, pointsPerUsd?: number): number; export declare function estimateChargeUsd(input: ChargeInput): { usd: number; source: 'usage' | 'override' | 'preset' | 'catalog' | 'backend' | 'default'; } | null; export declare function assertCanSpend(userId: string): PointsBalance; export declare function chargePoints(input: ChargeInput): LedgerRow; /** Best-effort debit after a native or CLI turn. No-ops when there is no * registered user or no measured usage. */ export declare function chargeTurnUsage(input: { platform?: string; userId?: string; model?: string; agent?: string; tokensIn: number; tokensOut: number; costUsd?: number; }): void; export declare function listLedger(opts?: { userId?: string; limit?: number; }): LedgerRow[]; export declare const POINTS_DAILY_DAYS = 14; export declare function utcDayKey(atMs: number): string; export interface DailyPointsSpend { day: string; spent: number; } /** UTC calendar buckets of spent points (negative ledger deltas). */ export declare function dailyPointsSeries(userId: string, days?: number, now?: number): DailyPointsSpend[]; /** * Quota belongs to the registered user. IM is only a channel: * `telegram:12345:usr_ab12` bills `usr_ab12`. Unbound IM has no * registered user, so this returns null (Agim still runs). */ export declare function resolveBillableUserId(platform: string | undefined, userId: string | undefined): string | null; //# sourceMappingURL=points.d.ts.map