/**
 * Generic pending-job tracker for coordinating two-phase orchestrator pipelines
 * (build-then-execute, init-then-execute, dynamic-eval-then-execute).
 *
 * The orchestrator dispatches a precursor job (build / init / dynamic eval) and
 * needs to wait for the agent to report completion before continuing. This
 * tracker exposes a deferred Promise per jobId that resolves with a typed
 * payload (or rejects on failure / disconnect).
 *
 * Usage:
 * - dispatcher calls track(jobId), awaits the returned promise
 * - terminal-status handler calls resolve(jobId, value) or reject(jobId, err)
 * - cleanup(jobId) is invoked on agent disconnect to reject with a fixed error
 */
export interface PendingTrackerOptions<T> {
    /** Logger prefix, e.g. 'pending-builds'. */
    logPrefix: string;
    /** Noun used in log messages, e.g. 'build', 'init', 'dynamic eval'. */
    itemLabel: string;
    /** Error message used when cleanup() rejects a pending entry on disconnect. */
    disconnectError: string;
    /**
     * Optional extractor that derives extra structured log fields from the
     * resolved value (e.g. `jobCount` for dynamic-eval results). The returned
     * keys are merged into the `resolve` log line for telemetry / debugging.
     */
    extractResolveMeta?: (value: T) => Record<string, unknown>;
}
export declare class PendingTracker<T> {
    private readonly pending;
    private readonly logger;
    private readonly opts;
    constructor(opts: PendingTrackerOptions<T>);
    /**
     * Register a pending job and return a promise that resolves when the agent
     * reports completion (or rejects on failure / disconnect).
     *
     * Each call creates a new Promise. If track() is called for the same jobId
     * twice, the previous Promise's callbacks are replaced -- the previous
     * caller's Promise will never settle (orphaned). Callers (e.g. BuildCoordinator)
     * are responsible for coalescing duplicate work upstream.
     */
    track(jobId: string): Promise<T>;
    /**
     * Resolve a pending entry (agent reported success).
     */
    resolve(jobId: string, value: T): void;
    /**
     * Reject a pending entry (agent reported failure).
     */
    reject(jobId: string, error: Error): void;
    /**
     * Clean up on agent disconnect. Rejects with the configured disconnect error.
     */
    cleanup(jobId: string): void;
    /**
     * Check if an entry is pending for a given jobId.
     */
    has(jobId: string): boolean;
    /**
     * Number of pending entries (for metrics / debugging).
     */
    get size(): number;
}
//# sourceMappingURL=pending-tracker.d.ts.map