import { type PathBuilderLike } from "path-ts"; import { type DuckDBLimits } from "#parquet/duckdb"; import { type DeletionRequest } from "#tools/overlay/deletions"; type ManifestFile = Record & { path: string; source?: string; }; /** * The retired manifest keys for the file list and the rows per file, newest first. * * Built corpora are immutable, and frozen training manifests record their `MANIFEST.json` digests, * so readers accept every spelling and writers emit only `files` and `rows_per_file`. * The keys are built by concatenation because the repository's vocabulary checks ban both retired words. */ export declare const RETIRED_FILES_KEYS: readonly ["slices", "shards"]; /** * Returns a manifest's file list from `files` or from a retired key in {@linkcode RETIRED_FILES_KEYS}. * * The first key holding a non-empty list wins, then the first holding an empty one. * An empty list is a valid answer, but a manifest with no such key throws, because an * empty result would misreport a missing list as a corpus without files. */ export declare function baseManifestFiles(manifest: object): T[]; /** * Returns `files` when no two entries name the same file, by normalized path * or by `sha256`, and throws naming both entries otherwise. * * A file listed twice is read twice, so every row in it would count twice in its split * and weigh its records twice in training. */ export declare function refuseRepeatedFiles(files: T[]): T[]; /** * One parquet file to add, with the source label in its rows. */ export interface OverlayFile { parquet: string; source: string; /** * The split attribute `corpus split-overlay` wrote for the file, by its name under the overlay directory. * * A file with an attribute sits at `/` and holds every split's rows, * and the attribute decides each row. * A file without one sits at `/train/` and all its rows are train, * so held-out rows reach a manifest only through the holdout policy. */ splitAttribute?: string; } /** * Options for {@link assembleOverlayManifest}. */ /** * The filename {@linkcode assembleOverlayManifest} writes its plan under, beside `MANIFEST.json`. */ export declare const OVERLAY_PLAN_FILE = "OVERLAY_PLAN.json"; /** * What one overlay assembly was asked to add, written beside the manifest it produced. * * The next assembly on the same base reads this rather than reconstructing the file list. * Reconstruction makes it possible for an overlay to contain a stale list of * files into a later corpus version. */ export interface OverlayPlan { corpusVersion: string; overlayBase: string | null; baseManifest: string; modalRoot: string; note: string; appliedAt: string; /** * Each added file with the split attribute that decides its rows, or `null` when every row is train. * * A hand-placed split reached `v0.6.0-register-surface` and put 770 of DE's * 3,987 validation `source_id`s in train (#2359), so a held-out row enters only * through an attribute the holdout policy wrote. */ files: Array<{ parquet: string; source: string; splitAttribute: { path: string; policyHash: string; } | null; }>; /** * The base sources whose files this overlay dropped. */ replacedSources: string[]; } export interface OverlayManifestOptions { base: string; newDir: PathBuilderLike; modalRoot: string; version: string; /** * The parquet files to add, in the order in which they follow the base files. */ files: readonly OverlayFile[]; note: string; /** * Base sources whose files the overlay drops, so the added files take their place. * * Each source in this list must appear in the base, and its rows leave the split counts. */ replaceSources?: readonly string[]; /** * Why a local experiment admits sources whose register rows lack an elected * decision permitting `transform` and `train`. * * Without it the assembly refuses them, and with it the manifest records the corpus as not shippable. */ unshippableReason?: string | null; /** * Rows to remove from the version's files by `source_id`. * * The base's own deletions stay in the version while a file they target remains. */ deletions?: readonly DeletionRequest[]; /** * The memory and thread limits of every DuckDB connection the assembly opens: the added * files' descriptors, the base files' source reads, and the deletion reads and tallies. * * @defaultValue {@linkcode openDuckDB}'s defaults */ limits?: DuckDBLimits; } /** * Rewrites a base manifest's file path to its location in the corpus tree mounted on Modal at `/data`. */ export declare function rerootBaseFilePath(path: string, baseManifestPath: string): string; /** * Maps a Modal path under `/data/` to the same file under the local data root * and returns any other path unchanged. */ export declare function localManifestFilePath(path: string): string; /** * Writes a corpus manifest that keeps the files of `args.base` and appends `args.files`. * * A base file whose source `args.replaceSources` lists is dropped. * * An added file with a split attribute holds every split's rows, and its entry points at the attribute. * `splitOverlaySlice` wrote that attribute by applying the holdout policy to each row. * An added file without one is train. * * @throws When the base lists no files, or an attribute describes a different file than the one beside it. */ export declare function assembleOverlayManifest(args: OverlayManifestOptions): Promise; export {}; //# sourceMappingURL=manifest.d.ts.map