/**
 * In-memory job queue for worker nodes.
 *
 * Workers receive jobs directly from the coordinator via P2P dispatch,
 * not from a database queue. This implementation satisfies the JobQueue
 * interface with ephemeral in-memory storage, allowing the dispatcher
 * subsystem to work unchanged on workers.
 *
 * Jobs enqueued here (when no agent is immediately available) are stored
 * in memory and dequeued when an agent with matching labels connects.
 */
import { DispatchQueueStatus, type QueuedJobInput, type QueuedJob } from '../queue/job-queue.js';
export declare class InMemoryJobQueue {
    private readonly jobs;
    /** Jobs handed to an agent, retained so requeue / lookups can restore them. */
    private readonly dispatched;
    /** Per-job re-dispatch counter (parity with dispatch_queue.dispatch_attempts). */
    private readonly attempts;
    /** Enqueue a job in memory and return its ID. */
    enqueue(input: QueuedJobInput): Promise<string>;
    /**
     * Returns a generated UUID for direct-dispatch tracking, or honors the
     * caller's pre-allocated jobId when set (cluster reroute path).
     */
    insertDispatched(input: QueuedJobInput): Promise<string>;
    /**
     * Dequeue the first pending job matching the given labels.
     *
     * `agentMandatoryLabels` mirrors the DB-backed `JobQueue.dequeueForLabels`
     * gate: a job is only dequeued when its `runsOnLabels` includes every
     * label in the gate set. Empty (default) is a no-op for static / non-scaler
     * agents — the gate trivially passes.
     */
    dequeueForLabels(agentLabels: string[], agentMandatoryLabels?: string[]): Promise<QueuedJob | null>;
    /**
     * Dequeue a specific pending job by id, validating that the agent's labels
     * still satisfy the job's runsOn / excludeLabels and the agent's
     * `mandatoryLabels` gate. Mirrors the DB-backed `JobQueue.dequeueById`
     * used by `Dispatcher.dispatchBoundJob()` when a scaler-managed agent
     * registers and the scaler had bound a queued jobId to that agent at
     * spawn time. Returns null if the job is missing, no longer Pending,
     * labels no longer match, or the agent's gate is not satisfied.
     */
    dequeueById(jobId: string, agentLabels: string[], agentMandatoryLabels?: string[]): Promise<QueuedJob | null>;
    /** Return count of pending jobs. */
    getDepth(): Promise<number>;
    /** No-op — the job is already tracked in `dispatched` from dequeue. */
    markDispatched(_jobId: string, _agentId: string): Promise<void>;
    /** Drop the dispatched entry — the job reached a terminal state. */
    markFailed(jobId: string, _reason: string): Promise<void>;
    /** Drop the dispatched entry — the job completed. */
    markCompleted(jobId: string): Promise<void>;
    /** No-op. */
    markRecovering(_jobId: string): Promise<void>;
    /**
     * No-op. The worker's dispatch-ack deadline lives entirely in the
     * in-memory timer; HA-safe persistence belongs to the coord's DB-backed
     * queue, not the worker's in-memory queue.
     */
    setAckDeadline(_jobId: string, _deadline: Date, _agentId: string): Promise<void>;
    /** No-op (see setAckDeadline). */
    clearAckDeadline(_jobId: string): Promise<void>;
    /** Always empty — the worker never rehydrates ack timers from a DB. */
    getDispatchedAwaitingAck(): Promise<Array<{
        id: string;
        runId: string;
        agentId: string | null;
        deadline: Date;
    }>>;
    /** Always empty — the worker is never the leader running the ack sweep. */
    listExpiredAckDeadlines(_now: Date): Promise<Array<{
        id: string;
        runId: string;
        agentId: string | null;
    }>>;
    /**
     * Return a dispatched job to pending for re-dispatch, bumping its attempt
     * counter. Mirrors the DB-backed `JobQueue.requeue`. Returns the new
     * attempt count, or null when the job is not currently dispatched.
     */
    requeue(jobId: string): Promise<number | null>;
    /** Full job lookup across pending and dispatched jobs. */
    getFullJobById(jobId: string): Promise<QueuedJob | null>;
    /** Return all pending jobs. */
    getPendingJobs(): Promise<QueuedJob[]>;
    /** Always returns empty array. */
    getDispatchedJobIdsByRunId(_runId: string): Promise<string[]>;
    /** Lookup across pending and dispatched jobs (id / runId / status). */
    getJobById(jobId: string): Promise<{
        id: string;
        runId: string;
        status: DispatchQueueStatus;
    } | null>;
    /** Always returns false. */
    markFailedIfRecovering(_jobId: string, _reason: string): Promise<boolean>;
    /** Always returns false. */
    markDispatchedIfRecovering(_jobId: string): Promise<boolean>;
    /** Always returns empty array. */
    getJobsByStatus(_status: DispatchQueueStatus): Promise<Array<{
        id: string;
        runId: string;
        status: DispatchQueueStatus;
    }>>;
    /** No-op — nothing to expire. */
    markExpired(): Promise<number>;
}
//# sourceMappingURL=in-memory-job-queue.d.ts.map