0
  7   1ˆl–Ãa¾”ªi?u8 ¸Ûw
˜´o�þBûN¬ã�f8Ûf9Yl_ÏÝƒq§CÜÐÂÚ G    1/**
 * ResolverPool â€” main-thread client for the parallel-resolution workers.
 *
 * resolveBatch() splits a rowid-ordered batch into ordered chunks, fans the
 * chunks across the pool, and reassembles the results IN CHUNK ORDER, so the
 * caller's admission (edge inserts, row cleanup, failure parking, deferred
 * post-pass queues) is byte-for-byte the sequence the single-threaded loop
 * would have produced. Any worker failure fails the batch â€” the caller falls
 * back to the sequential path. Kill switch: CODEGRAPH_NO_PARALLEL_RESOLVE=1.
 */
import type { Edge, UnresolvedReference } from '../types';
import type { ResolvedRef, UnresolvedRef } from './types';
/** One synthesis pass's output: its edge list + worker-measured wall clock. */
export interface SynthPassResult {
    edges: Edge[];
    ms: number;
}
export interface ChunkResult {
    resolved: ResolvedRef[];
    unresolved: UnresolvedRef[];
    deferredChain: UnresolvedRef[];
    deferredThisMember: UnresolvedRef[];
    byMethod: Record<string, number>;
}
/**
 * Minimum TOTAL pending refs before the pool is created at all. Pool boot
 * (module load + readonly DB open + framework detect + cache warm, times N
 * workers) costs real CPU that CONTENDS with sequential resolution on the
 * same cores â€” measured on a medium repo (~40k refs, ~1.2s of resolution)
 * the pool made indexing slower. It pays off when resolution runs for tens
 * of seconds to minutes (large JVM/Spring-class repos). Override:
 * CODEGRAPH_PARALLEL_RESOLVE_MIN=<refs> (0 forces the pool on).
 */
export declare function minRefsForPool(): number;
/**
 * Fewest refs still to settle for the batch loop to boot the pool mid-run
 * from its observed per-ref rate. Booting takes seconds (each worker opens the
 * database and warms a resolver), only batches of MIN_PARALLEL_BATCH refs fan
 * out, and synthesis waits for a booting pool. A rate measured on a busy
 * machine inflates every projection, so with no floor a ten-file project booted
 * the pool in half its runs under heavy load and paid seconds for nothing.
 * Repos the adaptive bar is for (Rust-class per-ref cost) have tens of
 * thousands of refs and still engage.
 */
export declare const ADAPTIVE_ENGAGE_MIN_REFS = 20000;
/** Whether the resolve loop should boot the pool mid-run (see ADAPTIVE_ENGAGE_MIN_REFS). */
export declare function shouldEngageAdaptively(projectedMs: number, remainingRefs: number, barMs: number): boolean;
export declare class ResolverPool {
    private workers;
    private nextId;
    private waiters;
    private synthWaiters;
    private recycleWaiters;
    private failed;
    /**
     * Pool size from CPU headroom, memory headroom, and the explicit override.
     * Pure â€” every input injected â€” so the whole matrix is unit-testable.
     *
     * CPU term: `availableParallelism` (cpuset/affinity-honest â€” `os.cpus()`
     * enumerates the host's CPUs and sized SIX workers inside a 2-CPU cpuset,
     * Â§7a.1's false-premise finding), minus one for the persisting main thread,
     * floored at 2 so a true 2-core box keeps the pool's ~2Ã— on synthesis,
     * capped at the long-standing 6.
     *
     * Memory term: workers hold real heap at scale (~1GB each against a 4.6GB
     * kernel-scale DB â€” six of them OOM-killed a 7GB container once real
     * 8-core concurrency let them peak simultaneously). Estimate per-worker
     * cost from the DB size, keep 30% of the budget for the main thread, and
     * let the smaller term win. Below 2 workers the pool isn't worth its boot
     * cost â€” callers get null and stay sequential.
     */
    static resolvePoolSize(opts: {
        explicit?: string;
        availableParallelism: number;
        memoryBudget: number;
        dbSizeBytes: number;
    }): number | null;
    /**
     * Create a pool when the compiled worker exists (absent when running from
     * source in tests â†’ callers use the sequential path), the kill switch is
     * off, and the machine has the cores AND memory to carry i