import { Context, Effect, Layer, type Scope } from "effect";
import type { ScheduledTask } from "./ScheduledTask.js";
declare const InvalidScheduleError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
readonly _tag: "InvalidScheduleError";
} & Readonly;
/** `register` rejected a task whose cron expression does not parse. */
export declare class InvalidScheduleError extends InvalidScheduleError_base<{
readonly task: string;
readonly schedule: string;
readonly cause: unknown;
}> {
get message(): string;
}
export interface SchedulerShape {
/**
* Registers a task. Its requirements are captured from the caller's context
* now, so register inside the layer or program that has them.
*/
register(task: ScheduledTask): Effect.Effect;
/**
* Forks one fiber per registered task into the caller's scope. Closing that
* scope (or calling `shutdown`) stops scheduling and waits for any run in
* flight to finish; runs are never interrupted midway.
*/
readonly start: Effect.Effect;
/** Stops scheduling and waits for runs in flight. Idempotent. */
readonly shutdown: Effect.Effect;
/** Names and expressions of the registered tasks. */
readonly tasks: Effect.Effect>;
}
declare const Scheduler_base: Context.ServiceClass;
/**
* Runs `ScheduledTask`s on Effect's `Cron`/`Schedule`. Each task runs in its
* own fiber, so a slow task never delays another; within a task, runs are
* sequential (a fire that lands during a run is skipped, the next match after
* completion fires).
*/
export declare class Scheduler extends Scheduler_base {
static readonly layer: Layer.Layer;
}
export {};