import { DispatchOpts, JobEnvelope, JobRegistry } from "./index.js";
//#region src/do-runner.d.ts
/** Minimal `DurableObjectState` alarm surface used by the runner. */
type DurableObjectAlarmContext = {
  setAlarm(scheduledTime: number | Date): Promise<void>;
  getAlarm(): Promise<number | null>;
};
declare const REARM_DELAY_MS = 1500;
/**
 * Alarm-driven job runner — `nudge()` ensures an alarm is pending; `alarm()` drains
 * one unit per tick and self-reschedules while backlog remains (re-arm in `finally`).
 */
declare abstract class JobRunnerDO<E> {
  protected readonly ctx: DurableObjectAlarmContext;
  protected readonly registry: JobRegistry<E>;
  protected readonly env: E;
  protected readonly dispatchOpts?: DispatchOpts<E> | undefined;
  constructor(ctx: DurableObjectAlarmContext, registry: JobRegistry<E>, env: E, dispatchOpts?: DispatchOpts<E> | undefined);
  /** Idempotent wake — sets `setAlarm(now)` only when none is already pending. */
  nudge(): Promise<void>;
  protected abstract pullNext(): Promise<JobEnvelope | null>;
  protected abstract hasBacklog(): Promise<boolean>;
  alarm(): Promise<void>;
}
//#endregion
export { DurableObjectAlarmContext, JobRunnerDO, REARM_DELAY_MS };