import * as ops from "./service/ops.js";
import { type CronServiceDeps } from "./service/state.js";
import type { CronJob, CronJobCreate, CronJobPatch, CronTaskRepairRecoveryAction, CronTaskSourceListFilters } from "./types.js";
export type { CronEvent, CronServiceDeps } from "./service/state.js";
export declare class CronService {
    private readonly state;
    constructor(deps: CronServiceDeps);
    start(): Promise<void>;
    stop(): void;
    status(): Promise<{
        enabled: boolean;
        storePath: string;
        jobs: number;
        nextWakeAtMs: number | null;
        queue: import("./task-run-queue.ts").CronTaskRunQueueSummary;
    }>;
    list(opts?: {
        includeDisabled?: boolean;
    }): Promise<CronJob[]>;
    listPage(opts?: ops.CronListPageOptions): Promise<{
        jobs: CronJob[];
        total: number;
        offset: number;
        limit: number;
        hasMore: boolean;
        nextOffset: number | null;
    }>;
    add(input: CronJobCreate): Promise<CronJob>;
    update(id: string, patch: CronJobPatch): Promise<CronJob>;
    repair(id: string, params: {
        action: CronTaskRepairRecoveryAction;
        source?: string;
        sourceNodeId?: string;
    }): Promise<import("./types.js").CronTaskRepairRecoveryResult>;
    sourcesList(opts?: CronTaskSourceListFilters): Promise<import("./types.js").CronTaskSourceListResult>;
    sourcesUpdate(id: string, patch: {
        active?: boolean;
    }): Promise<import("./types.js").CronTaskSourceUpdateResult>;
    sourcesRemove(id: string): Promise<import("./types.js").CronTaskSourceRemoveResult>;
    remove(id: string): Promise<{
        readonly ok: false;
        readonly removed: false;
    } | {
        readonly ok: true;
        readonly removed: boolean;
    }>;
    run(id: string, mode?: "due" | "force"): Promise<{
        ok: boolean;
        ran: boolean;
        reason: "already-running";
        readonly jobId?: undefined;
        readonly runId?: undefined;
    } | {
        ok: boolean;
        ran: boolean;
        reason: "not-due";
        readonly jobId?: undefined;
        readonly runId?: undefined;
    } | {
        ok: boolean;
        ran: boolean;
        reason: "needs-access";
        readonly jobId?: undefined;
        readonly runId?: undefined;
    } | {
        readonly ok: false;
        readonly ran?: undefined;
        reason?: undefined;
        readonly runId?: undefined;
        readonly detail?: undefined;
    } | {
        readonly ok: true;
        readonly ran: false;
        readonly reason: "running" | "queued";
        readonly runId: string;
        readonly detail: string | undefined;
    } | {
        readonly ok: true;
        readonly ran: false;
        readonly reason: "error" | "blocked";
        readonly runId: string;
        readonly detail: string | undefined;
    } | {
        readonly ok: true;
        readonly ran: true;
        reason?: undefined;
        readonly runId?: undefined;
        readonly detail?: undefined;
    }>;
    queueCancel(runId: string, reason?: string): Promise<ops.CronQueueControlResult>;
    queueRetry(runId: string, reason?: string): Promise<ops.CronQueueControlResult>;
    queueClearStale(runId: string, reason?: string): Promise<ops.CronQueueControlResult>;
    work(opts?: {
        maxRuns?: number;
        leaseOwner?: string;
    }): Promise<{
        ok: true;
        processed: number;
        outcomes: {
            jobId: string;
            status: import("./types.js").CronRunStatus;
            error: string | undefined;
            sessionId: string | undefined;
            sessionKey: string | undefined;
            delivered: boolean | undefined;
            startedAt: number;
            endedAt: number;
            model: string | undefined;
            provider: string | undefined;
            policy: import("./types.js").CronRunPolicyTelemetry | undefined;
        }[];
    }>;
    getJob(id: string): CronJob | undefined;
    wake(opts: {
        mode: "now" | "next-heartbeat";
        text: string;
    }): {
        readonly ok: false;
    } | {
        readonly ok: true;
    };
}
