import type { WorkflowRecord } from "./contracts.js"; import { type ScholarDatabase } from "./database.js"; export type WorkflowKind = WorkflowRecord["kind"]; /** One FIFO is enough: browser mutations have one observable order. */ export declare class BrowserMutationWorker { private readonly queue; private running; private closing; private idleWaiters; enqueue(run: () => T | PromiseLike): Promise; private pump; close(): Promise; } export interface WorkflowUpdateInput { readonly progress?: number; readonly message?: string; } export interface WorkflowFinishOptions extends WorkflowUpdateInput { readonly errorCode?: string; readonly errorMessage?: string; } export declare function workflowFailureMessage(value: unknown): string; export declare class WorkflowCoordinator { readonly db: ScholarDatabase; constructor(db: ScholarDatabase); get(requestId: string): WorkflowRecord | undefined; list(): WorkflowRecord[]; /** Insert a queued workflow inside a caller-owned SQLite transaction. */ queueInTransaction(kind: WorkflowKind, requestId: string, idempotencyKey?: string): WorkflowRecord; beginWorkflow(kind: WorkflowKind, idempotencyKey?: string): WorkflowRecord; failRunningWorkflows(options: WorkflowFinishOptions): WorkflowRecord[]; updateWorkflow(requestId: string, input?: WorkflowUpdateInput): WorkflowRecord; finishWorkflow(requestId: string, status: "succeeded" | "failed", options?: WorkflowFinishOptions): WorkflowRecord; } //# sourceMappingURL=workflows.d.ts.map