import type { AssetRecord } from "./wire.js"; /** Where downloads land, relative to the project root. */ export declare const DOWNLOAD_DIR: string; /** * Slugify a subject for use in a filename. * * Everything outside [a-z0-9-] is dropped rather than escaped, which removes `/`, * `\`, `.` and `%` as a class instead of enumerating them. A subject that reduces * to nothing yields "asset", so the filename never starts with the separator or * collapses into the extension. */ export declare function safeSubject(subject: string | undefined): string; /** The extension, from `format` — admitted only as png/webp, else png. */ export declare function safeExt(format: string | undefined): string; /** * `-.`, e.g. `pumpkin-lib_7f3a2c67d4e5b6a7.png`. * * Throws when `id` is not id-shaped. The id is the one component that could carry * a separator if a compromised or drifted API returned something unexpected, and a * throw here is strictly better than composing a path from it: the id has ALREADY * been validated against the same regex on the way in, so a failure means the wire * disagrees with the contract and writing anything at that point is guesswork. */ export declare function downloadFilename(a: AssetRecord): string; /** * The absolute path a record downloads to, under `dir`. * * The join is re-checked against the resolved base: even with a validated filename, * asserting containment is one line and it is the assertion that stays true if * someone later relaxes downloadFilename. */ export declare function downloadPath(baseDir: string, a: AssetRecord): string; export interface WriteResult { path: string; bytes: number; } /** Does the file already exist? (Used for the refuse-to-overwrite gate.) */ export declare function exists(p: string): Promise; export declare function writeAsset(p: string, bytes: Uint8Array): Promise; /** * The overwrite refusal names the INTERESTING reason, not "file exists": B37 means * the bytes at a library URL never change, so the copy on disk is already identical * and re-downloading achieves nothing. That teaches immutability in passing and is * more useful than a bare flag suggestion. */ export declare function overwriteRefusalLines(relPath: string): string[];