import type { ScheduledTask, ParsedSchedule } from '../types.js';
export declare function setExecuteCallback(cb: (task: ScheduledTask) => Promise<void>): void;
/**
 * Bind the scheduler to a specific bot (larkAppId).  In multi-bot setups every
 * daemon process runs its own scheduler; this filter prevents double-execution
 * by ensuring each task is only handled by the daemon whose bot is actually
 * a member of the task's origin chat.
 *
 * @param larkAppId — this daemon's bot app id
 * @param isPrimary — true only for bot-0; legacy tasks without larkAppId are
 *                    routed here as a compatibility fallback
 */
export declare function setOwnerFilter(larkAppId: string, isPrimary: boolean): void;
/** Public ownership check — used by dashboard IPC to filter list-by-owner. */
export declare function belongsToOwner(task: ScheduledTask): boolean;
/**
 * Parse a bare schedule string (no prompt).  Supports:
 *   - Chinese NL: "每日17:50" / "每周一10:00" / "30分钟后" / "明天9:00"
 *   - English duration: "30m", "2h", "1d" (one-shot from now)
 *   - English interval: "every 30m", "every 2h"
 *   - Cron expression: "0 9 * * *" (5 space-separated fields)
 *   - ISO timestamp: "2026-05-01T10:00:00" (one-shot at time)
 */
export declare function parseSchedule(input: string): ParsedSchedule;
interface ParseNLResult {
    parsed: ParsedSchedule;
    prompt: string;
    name: string;
}
/**
 * Parse a natural-language /schedule command, splitting the schedule portion
 * from the prompt (the task instruction).  Used by the /schedule command
 * handler where user types e.g. "/schedule 每日17:50 帮我看看AI新闻".
 */
export declare function parseNaturalSchedule(input: string): ParseNLResult | null;
/** Compute the next run time for a parsed schedule. Returns ISO string, or null if exhausted. */
export declare function computeNextRun(parsed: ParsedSchedule, lastRunAt?: string): string | null;
export declare function startScheduler(): void;
export declare function stopScheduler(): void;
export declare function addTask(params: {
    name: string;
    schedule: string;
    prompt: string;
    workingDir: string;
    chatId: string;
    rootMessageId?: string;
    scope?: 'thread' | 'chat';
    chatType?: 'group' | 'p2p' | 'topic_group';
    larkAppId?: string;
    creatorChatId?: string;
    creatorRootMessageId?: string;
    creatorLarkAppId?: string;
    parsed?: ParsedSchedule;
    repeat?: {
        times: number | null;
        completed: number;
    };
    deliver?: 'origin' | 'local';
}): ScheduledTask;
export declare function removeTask(id: string): boolean;
export declare function enableTask(id: string): boolean;
export declare function disableTask(id: string): boolean;
export declare function runTaskNow(id: string): boolean;
export declare function getNextRun(id: string): Date | null;
/**
 * Fire a scheduled task immediately. Returns ok=false if id not found or the
 * scheduler hasn't been initialised with an executeCallback yet.  Emits a
 * `schedule.fired` event on completion (success or error).
 */
export declare function runNow(id: string): {
    ok: boolean;
    error?: string;
};
/**
 * Toggle a task's `enabled` flag and persist.  When enabling a task we also
 * recompute `nextRunAt` so the next tick can pick it up.  Emits a
 * `schedule.updated` event.
 */
export declare function setEnabled(id: string, enabled: boolean): {
    ok: boolean;
    error?: string;
};
export {};
//# sourceMappingURL=scheduler.d.ts.map