import type { ScheduledTask, ParsedSchedule } from '../types.js';
/**
 * Raised by `createTask` when an `id` is supplied but a task already exists
 * with that id AND its canonical input differs from the incoming params.
 *
 * Workflow runtime uses this to detect "same attempt asked to create a
 * different schedule" — a sign the attempt is being mutated (forbidden by
 * attempt-immutability rule, events doc §4.2).
 */
export declare class IdempotencyConflictError extends Error {
    readonly taskId: string;
    readonly existingInputHash: string;
    readonly incomingInputHash: string;
    constructor(detail: {
        taskId: string;
        existingInputHash: string;
        incomingInputHash: string;
    });
}
export declare function getTaskOutputDir(taskId: string): string;
/**
 * Create a scheduled task — or return the existing one with the same input
 * when called with a workflow-supplied `id` that already exists.
 *
 * Behaviour matrix (events doc v0.1.2 §2.2 Option A):
 *
 *   | scenario                                   | result                       |
 *   |--------------------------------------------|------------------------------|
 *   | no `id`                                    | randomUUID(8) — legacy path  |
 *   | `id` not in store                          | create with the given id     |
 *   | `id` in store + canonical input matches    | return existing (no mutation)|
 *   | `id` in store + canonical input differs    | IdempotencyConflictError     |
 *
 * Use `wf_<hash...>` prefixed ids when called from workflow runtime to
 * avoid collisions with the 8-char randomUUID legacy namespace.
 */
export declare function createTask(params: {
    id?: string;
    name: string;
    schedule: string;
    parsed: ParsedSchedule;
    prompt: string;
    workingDir: string;
    chatId: string;
    rootMessageId?: string;
    scope?: 'thread' | 'chat';
    chatType?: 'group' | 'p2p' | 'topic_group';
    larkAppId?: string;
    creatorChatId?: string;
    creatorRootMessageId?: string;
    creatorLarkAppId?: string;
    nextRunAt?: string;
    repeat?: {
        times: number | null;
        completed: number;
    };
    deliver?: 'origin' | 'local';
}): ScheduledTask;
export declare function getTask(id: string): ScheduledTask | undefined;
export declare function removeTask(id: string): boolean;
export declare function updateTask(id: string, updates: Partial<Pick<ScheduledTask, 'enabled' | 'lastRunAt' | 'nextRunAt' | 'lastStatus' | 'lastError' | 'lastDeliveryError' | 'repeat' | 'rootMessageId' | 'chatType'>>): void;
/**
 * Record a run outcome and auto-manage repeat counter.  If the task has a
 * finite repeat count and we've hit it, the task is removed.
 */
export declare function markRun(id: string, success: boolean, error?: string, deliveryError?: string): void;
export declare function listTasks(): ScheduledTask[];
/** Ensure per-task output dir exists and return path to today's run log. */
export declare function appendOutputLog(taskId: string, content: string): string;
export declare function startExternalWriteWatcher(): void;
//# sourceMappingURL=schedule-store.d.ts.map