UNPKG

gepa-spo

Version:

Genetic-Pareto prompt optimizer to evolve system prompts from a few rollouts with modular support and intelligent crossover

33 lines (32 loc) 1.27 kB
/** * Lightweight budget tracker to enforce and introspect token/call budgets. * * When disabled, all methods are no-ops and `remaining()` always returns the * initial start value provided to the constructor. This allows safe wiring * into existing call sites without changing behavior. */ export declare class BudgetTracker { private readonly start; private readonly enabled; private remainingInternal; /** * Create a new tracker. * * @param start - Initial remaining budget (non-negative integer) * @param enabled - Whether tracking is active. If false, all operations are no-ops. */ constructor(start: number, enabled: boolean); /** Current remaining budget. When disabled, returns the initial `start` value. */ remaining(): number; /** * Decrease the budget by `n` (defaults to 1). Negative values are ignored. * When disabled, this is a no-op. * * @param n - Amount to decrement (defaults to 1) * @param _tag - Optional tag for future attribution (ignored in noop scaffold) */ dec(n?: number, _tag?: string): void; /** Whether there is at least `n` budget remaining. Always true when disabled. */ canAfford(n: number): boolean; } export default BudgetTracker;