import type { PathBuilderLike } from "path-ts"; /** * The four append-only outputs of the align phase, by the name in each file. */ export declare const ALIGN_OUTPUTS: readonly ["train", "val", "test", "quarantine"]; export type AlignOutputName = (typeof ALIGN_OUTPUTS)[number]; /** * The settings that change what the align phase writes for a given input row. * * A resume under different settings would mix two policies inside one output file, * so the checkpoint records these and a mismatch refuses the resume rather than continuing. */ export interface AlignSettings { corpus_version: string; synthesize: boolean; license_policy: string; exclude_licenses: readonly string[]; profile: string; holdout_digest: string; /** * Each capped source's `trainShare`, present only when one is capped. */ train_shares?: Record; } /** * The align phase's state at an adapter boundary. */ export interface AlignCheckpoint { settings: AlignSettings; /** * Adapter ids whose rows are already in the four outputs, in the order they were aligned. * * A resume requires this to be a prefix of the current run's adapter order. * Alignment appends, so a different order would place a later adapter's rows * before an earlier one's and change every split file's contents. */ completed_adapters: string[]; /** * Byte length of each output at the checkpoint, after its writes were flushed. * * A resumed build shortens each file to this length. * The shortening discards whatever the interrupted adapter wrote past the boundary. */ offsets: Record; /** * Byte length of each split's source-id list at the checkpoint. * A resumed build shortens each list to this length. * * Absent from a checkpoint written before align recorded ids. * A build resumed from one writes no list, and its split phase reads the ids * from the labeled files instead. */ source_id_offsets?: Record<"train" | "val" | "test", number>; counts: Record<"train" | "val" | "test", number>; aligned: number; quarantined: number; license_counts: Record; refused_by_kind: Record; /** * Rows the license policy refused, counted per `source`, so a resumed build keeps the tally * rather than restarting it at zero and understating the refusal in its manifest. */ refused_by_source: Record; /** * Training rows each source's `trainShare` left out. * A checkpoint written before the share existed has none. */ train_rows_left_out_by_source?: Record; excluded_by_license: number; admitted_unresolved_license_rows: number; excluded_by_eligibility: number; rows_by_source: Record; /** * Base rows failing each component rule, per source then rule. * * Absent from a checkpoint written before the counts existed. * A resume refuses such a checkpoint. */ component_findings_by_source?: Record>; /** * The component rules the aligned adapters' rows weren't checked against. */ unchecked_component_rules?: string[]; written_at: string; } /** * Read the align checkpoint, or return `null` when the build hasn't reached one. * * @throws When the checkpoint describes different settings, or an adapter order * the current run doesn't begin with. * Both cases would append this run's rows to a file written under different rules. * The resulting corpus could report a row count that later readers accept. */ export declare function readAlignCheckpoint(path: PathBuilderLike, expected: { settings: AlignSettings; adapterOrder: readonly string[]; }): Promise; /** * Write the align checkpoint. * * The caller flushes the four outputs before calling this, so every byte the offsets count is on disk. */ export declare function writeAlignCheckpoint(path: PathBuilderLike, checkpoint: AlignCheckpoint): Promise; //# sourceMappingURL=checkpoint.d.ts.map