/** * The prefix a worker puts on a batch id to leave the batch pending. */ export declare const RETRY_PREFIX = "!RETRY:"; /** * The tally keys that count against a batch rather than toward it, beside every `reject:` key. */ export declare const REJECT_KEYS: readonly string[]; /** * The number of completed batches between two checkpoint writes during a run. */ export declare const CHECKPOINT_EVERY = 25; /** * A tally of outcomes by key, as Python's `Counter`. */ export type Tally = Map; /** * Adds `amount` to `key`. */ export declare function tallyOutcome(tally: Tally, key: string, amount?: number): void; /** * The rows a run asked for and didn't get, by every way it can fail to get one. */ export declare function rejects(tally: Tally): number; /** * The two append-only files of a run: the canonical rows, and one raw response entry per request. * * Appends are queued in call order, so two workers finishing together never interleave their lines. * A resumed run appends to the earlier run's files. */ export declare class DeepSeekSink { #private; readonly canonicalPath: string; readonly rawLogPath: string; constructor(canonicalPath: string, rawLogPath: string); /** * Appends canonical rows, one JSON line each. */ writeRows(rows: readonly unknown[]): Promise; /** * Appends the raw response entry of one request, so a row can be traced to the call that produced it. */ writeResponse(entry: Record): Promise; /** * Waits for every queued append. */ flush(): Promise; } /** * The batch ids a previous run completed, or an empty set on the first run. * * @throws When the checkpoint exists without a `done` list, because a run that * read it as empty would pay for every batch again. */ export declare function loadCheckpoint(path: string, log?: (line: string) => void): Promise>; /** * A mode's worker: requests one batch, writes its rows, and answers the batch id and its tally. */ export type DeepSeekWorker = (batch: Batch) => Promise; /** * Options for {@linkcode runBatches}. */ export interface RunBatchesOptions { /** * The ids already complete. * Each batch that completes is added. */ done: Set; checkpointPath: string; concurrency: number; /** * Names the mode in the closing summary. */ label: string; sink: DeepSeekSink; log?: (line: string) => void; /** * Milliseconds since an arbitrary origin, for the rate in the progress line. */ now?: () => number; } /** * Runs every pending batch with at most `concurrency` requests in flight, checkpointing completed * ids every {@linkcode CHECKPOINT_EVERY} completions and once at the end, and prints the summary. * * A worker's rejection isn't caught: a worker answers an API failure as a tally, * so a rejection is a defect in the run, and the checkpoint keeps the ids completed before it. */ export declare function runBatches(pending: readonly Batch[], worker: DeepSeekWorker, options: RunBatchesOptions): Promise; //# sourceMappingURL=run.d.ts.map