/** * Independent safety oracles for the structural benchmark. * * The benchmark exists to detect the failure this project is built to prevent: a message that had * content going in and has none coming out. It cannot do that by asking the extractor, and the * previous version did exactly that: * * const hadContent = visibleChars + hiddenChars > 0; * * That reads "did the input have content" off the output. When extraction dropped everything the * flag went false, the catastrophic counter did not increment, and the benchmark reported zero * losses while a reproducible total loss case existed. * * So the code here shares the *definition* of a body with the extractor, and shares none of its * *implementation*. It re-parses the message, walks the flat part list itself, and never calls the * selection logic it is meant to check. Re-parsing costs a second MIME pass per message, which is * the right trade for a release gate. */ import { type MimePart, type ParsedMessage } from '../mime/model'; /** Part ids that sit inside an embedded `message/rfc822`, which is content and not the outer body. */ export declare function embeddedPartIds(message: ParsedMessage): Set; /** A decoded body-bearing leaf, by the written MIME rules rather than by the selection heuristic. */ export declare function eligibleBodyParts(message: ParsedMessage): MimePart[]; export interface InputInventory { /** Characters of plausibly visible body text across every eligible part. */ visibleChars: number; /** Eligible non attachment body leaves, whether or not they hold visible text. */ eligibleParts: number; /** True when at least one eligible part holds visible text. */ hasVisibleText: boolean; } /** * Count plausible visible body text in a parsed message, before extraction runs. * * Deliberately over-inclusive: it counts every eligible part, including both members of a * `multipart/alternative`, because its only question is whether the message had anything visible to * show. It is not, and must not be used as, a demand that every part appear in the output. * * Script, style, comment and markup text is excluded, so an image-only newsletter or a body that is * nothing but a tracking pixel does not count as visible text that extraction then lost. */ export declare function inventoryVisibleInput(message: ParsedMessage): InputInventory; /** * A piece of the message that the output has to represent somehow. * * Per-part coverage would be wrong. A normal `multipart/alternative` carries both a plain and an * HTML rendering, and HTML-primary output deliberately contains only HTML-derived segments; * demanding both part ids would report most valid mail as lossy. So the unit is a *group*, and any * one supported member satisfies it. */ export interface CoverageGroup { /** Stable identifier: the container part for an alternative, the leaf itself otherwise. */ id: string; /** True when the group is one alternative rendering set rather than independent content. */ alternative: boolean; /** Part ids, any one of which represents this group. */ members: string[]; } /** * Required coverage groups for a parsed message. * * Written from the decision table rather than by calling `planBody()`. Sharing the implementation * would make the oracle agree with the selection code by construction, which is exactly the * property a gate must not have. The two are reviewed against the same table and are expected to * agree; when they do not, one of them is wrong and the run says so. */ export declare function requiredCoverageGroups(message: ParsedMessage): CoverageGroup[]; export interface CoverageReport { required: number; covered: number; /** Group ids with no member anywhere in the output. Each one is content that vanished. */ missing: string[]; /** Alternative members deliberately not emitted. Informational, never a failure. */ alternativesNotEmitted: string[]; /** Groups present only in `hiddenSegments`. */ hiddenOnly: string[]; } /** Compare the required groups against the MIME parts the result actually names. */ export declare function coverageOf(groups: readonly CoverageGroup[], visibleParts: ReadonlySet, hiddenParts: ReadonlySet): CoverageReport; //# sourceMappingURL=oracle.d.ts.map