/** * Zero-dependency concurrency limiter. * * Motivation: `doDeepSearch` previously ran every search-angle in parallel * via `Promise.allSettled`. For `maxRounds = 8` that means 8 simultaneous * upstream requests against a single BYOK provider, which (a) blows past * Brave's 1 req/s free-tier limit and (b) fans out paid Tavily/Exa calls * faster than the user wanted when they asked for "deep" research. * * `createLimiter(N)` returns a `run(fn)` wrapper that never executes more * than N callbacks at the same time. Callers keep their existing * `Promise.allSettled` + `.map` shape — only the body is wrapped. * * Semantics match p-limit: in-flight count is capped, queued work is * dispatched FIFO as slots free up, a callback that throws still frees * its slot. */ export interface Limiter { (fn: () => Promise): Promise; readonly activeCount: number; readonly pendingCount: number; readonly concurrency: number; } export declare function createLimiter(concurrency: number): Limiter; //# sourceMappingURL=concurrency.d.ts.map