import { ErrorCategory } from "./error-category.type.mjs"; import { AIError, AIErrorOptions } from "./ai-error.mjs"; //#region ../ai/src/errors/budget-exceeded-error.d.ts /** * Unit of the budget being enforced. `tokens` for context/output * caps, `usd` for monetary caps, `requests` for call-count caps. */ type BudgetUnit = "tokens" | "usd" | "requests"; /** * Payload for `BudgetExceededError`. All three fields are required so * consumers can present the breach numerically without having to * reparse the message. */ type BudgetExceededErrorOptions = AIErrorOptions & { limit: number; actual: number; unit: BudgetUnit; }; /** * A user- or framework-configured budget was exceeded mid-execution. * * **Not thrown yet.** The class is defined here so v2's budget * middleware can throw it without a breaking release of the error * hierarchy. Shape is locked: `{ limit, actual, unit }`. * * @example * if (error instanceof BudgetExceededError && error.unit === "usd") { * alertFinance(error.actual, error.limit); * } */ declare class BudgetExceededError extends AIError { static readonly defaultCategory: ErrorCategory; readonly limit: number; readonly actual: number; readonly unit: BudgetUnit; constructor(message: string, options: BudgetExceededErrorOptions); } //#endregion export { BudgetExceededError, BudgetExceededErrorOptions, BudgetUnit }; //# sourceMappingURL=budget-exceeded-error.d.mts.map