export declare const RECORD_JOINT_CAP = 1000; export type AbortSignal = { readonly aborted: boolean; }; export declare const perfNow: () => number; export declare function throwIfAborted(signal: AbortSignal | undefined): void; /** Which limit of an {@link AnalysisBudget} tripped. */ export type BudgetKind = 'time' | 'steps'; export interface AnalysisBudget { /** `perfNow()` timestamp past which analysis must stop; `Infinity` = none. */ deadline: number; /** Hard cap on charged steps; `Infinity` = none. */ maxSteps: number; /** Running count of charged steps (mutable, shared across cloned envs). */ steps: number; /** Steps remaining until the next (relatively expensive) clock/signal poll. */ untilCheck: number; /** Cooperative cancellation, polled at the same cadence as the deadline. */ signal: AbortSignal | undefined; /** Set once a limit fires, recording which one (for diagnostics). */ exceeded: BudgetKind | null; } /** Thrown when an {@link AnalysisBudget}'s deadline or step cap is exceeded. * The orchestrator catches it and surfaces a `tier: 'budget-exceeded'` * result rather than letting it escape `analyze`. */ export declare class BudgetExceededError extends Error { readonly kind: BudgetKind; constructor(kind: BudgetKind); } /** A shared, never-tripping budget used when the caller supplied no bound, so * the charge sites can early-out with a single reference compare. */ export declare const NO_BUDGET: AnalysisBudget; export declare function makeBudget(opts: { maxAnalysisMs?: number; maxAnalysisSteps?: number; signal?: AbortSignal; }): AnalysisBudget; /** * Charge `n` steps against the budget and enforce its limits. Throws * {@link BudgetExceededError} when the step cap or deadline is exceeded, or an * `AbortError` when the signal is aborted. A no-op for {@link NO_BUDGET}. */ export declare function chargeBudget(budget: AnalysisBudget, n?: number): void;