Member Junction
    Preparing search index...

    Per-run budget tracker. One instance per search invocation; lives only as long as the SearchEngine.search call. Not thread-safe, but Node is single-threaded within a request so that's fine.

    Index

    Constructors

    Properties

    Budget: number

    Total budget in cents, or null when uncapped.

    Spent: number = 0

    Accumulated cost in cents, populated via record().

    Methods

    • Sugar for wiring into a reranker. Returns a closure that records cost on this guard — assignable directly to BaseReRanker.CostReporter.

      Returns (cents: number) => void

    • Pre-call check: does estimatedCents fit in the remaining budget? Returns true when uncapped or when remaining ≥ estimate.

      Negative estimates are treated as zero (defensive — a buggy EstimateCostCents shouldn't trigger short-circuits prematurely).

      Parameters

      • estimatedCents: number

      Returns boolean