import type { WorkerDelegationRunOutcome } from "../agent-session-contracts.ts"; import type { LaneRecord } from "../autonomy/lane-tracker.ts"; import { registerInFlightWork } from "../reload-blockers.ts"; import type { WorkerDelegationRequest } from "./worker-delegation-request.ts"; export type WorkerDispatchAdmission = { action: "start"; } | { action: "wait"; reason?: "capacity" | "dependencies" | "objective" | "write_reservation"; } | { action: "cancel"; reasonCode: string; }; export interface WorkerDispatchSchedulerOptions { agentDir: string; /** Test seam for proving queue insertion rollback when reload-gate registration fails. */ registerInFlightWork?: typeof registerInFlightWork; isDisposed(): boolean; admit(request: WorkerDelegationRequest, record: LaneRecord): WorkerDispatchAdmission; getRecord(laneId: string): LaneRecord | undefined; run(request: WorkerDelegationRequest, record: LaneRecord): Promise; cancel(laneId: string, reasonCode: string): void; warn(message: string): void; } /** * Single owner of worker queue and promise transitions. Execution policy and durable lifecycle stay * outside; this class only decides when a prepared durable attempt moves from queued to running. */ export declare class WorkerDispatchScheduler { private readonly options; private readonly queued; private readonly queuedDeregisters; private readonly running; private readonly pendingCancellations; private readonly reservationBlocked; private readonly queueCapacityListeners; private draining; private redrainRequested; private reservationAvailabilityRequested; private queueCapacityNotificationPending; constructor(options: WorkerDispatchSchedulerOptions); get queuedCount(): number; hasQueueCapacity(priority?: boolean): boolean; /** Notify retained priority work when a bounded queue slot is released. */ onQueueCapacityAvailable(listener: () => void): () => void; enqueue(record: LaneRecord, request: WorkerDelegationRequest, recovered?: boolean, priority?: boolean): void; track(laneId: string, promise: Promise): void; private retainPendingCancellation; private registerPendingCancellation; private retryPendingCancellations; private removePendingCancellation; private cancelBestEffort; private finishTrackedRun; private warnBestEffort; drain(reservationAvailable?: boolean): void; cancelQueued(): void; dropQueued(laneId: string): boolean; private removeQueued; private notifyQueueCapacityAvailable; } //# sourceMappingURL=worker-dispatch-scheduler.d.ts.map