export interface BoundedReadLimits { /** Refuse anything at or over this, before allocating it. */ maxBytes: number; /** How long the chunk loop may run before the read is a refusal rather than a wait. */ timeoutMs: number; /** Injected only by tests; production passes nothing and gets the wall clock. */ now?: () => number; } /** * Why a bounded read did not produce text. * * A discriminated reason rather than a thrown error, because the two callers disagree about what a failure * MEANS — an unreadable registry is a governance refusal naming the file, while an unreadable `SKILL.md` is * one definition that will not be offered — and a shared reader must not decide that for them. */ export type BoundedReadFailure = { why: "unopenable"; detail: string; } | { why: "not-a-regular-file"; detail: string; } | { why: "too-large"; detail: string; size: number; } | { why: "grew-while-reading"; detail: string; } | { why: "timed-out"; detail: string; } | { why: "unreadable"; detail: string; }; export type BoundedReadResult = { ok: true; text: string; } | ({ ok: false; } & BoundedReadFailure); export type BoundedReadBytes = { ok: true; bytes: Buffer; } | ({ ok: false; } & BoundedReadFailure); /** * The same read, handing back raw bytes. * * `skill-packages.ts` needs the bytes rather than a string, because it asserts that a definition survives a * UTF-8 round trip unchanged — a latin-1 byte that decodes to U+FFFD changes the file's digest, and that * check is only possible against the original buffer. Decoding here and re-encoding there would defeat it. */ export declare function readBoundedFile(path: string, limits: BoundedReadLimits): Promise; export declare function readBoundedBytes(path: string, limits: BoundedReadLimits): Promise; //# sourceMappingURL=bounded-read.d.ts.map