import type { Task } from "../models.js"; export type Conflict = "reuse" | "reject" | "replace"; export interface SubmitInput { name: string; payload: unknown; queue?: string; key?: string | null; conflict?: Conflict; maxAttempts?: number; priority?: number; metadata?: unknown; parentId?: string | null; rootId?: string | null; correlationId?: string | null; runAtDelayMs?: number; } export interface ListInput { status?: string | null; queue?: string | null; name?: string | null; rootId?: string | null; correlationId?: string | null; limit?: number; offset?: number; } /** The storage seam. SQLiteStore is the only MVP implementation. */ export interface TaskStore { connect(): Promise; close(): Promise; protocolVersion(): Promise; submit(input: SubmitInput): Promise; get(taskId: string): Promise; getByKey(key: string): Promise; list(input?: ListInput): Promise; cancel(taskId: string): Promise; cancelByKey(key: string): Promise; retry(taskId: string, opts?: { resetAttempt?: boolean }): Promise; retryByKey(key: string, opts?: { resetAttempt?: boolean }): Promise; claim(input: { queues: string[]; workerId: string; leaseMs?: number; limit?: number; }): Promise; heartbeat(input: { taskId: string; workerId: string; leaseMs?: number }): Promise; progress(input: { taskId: string; workerId: string; progress: number | null; message: string | null; }): Promise; succeed(input: { taskId: string; workerId: string; result: unknown }): Promise; complete(input: { taskId: string; workerId: string; result: unknown }): Promise; fail(input: { taskId: string; workerId: string; error: unknown; retryable?: boolean; delayMs?: number; }): Promise; }