import { GuardrailDefinition } from "../types.js"; //#region src/guardrails/builtins/pii-detection.d.ts /** * One pattern in the catalogue. The `kind` discriminator surfaces in * audit metadata so SIEM dashboards can filter by sensitive type. * * @stable */ interface PiiPattern { readonly kind: string; readonly pattern: RegExp; /** Optional post-match validator (e.g. Luhn check for credit cards). */ readonly validate?: (match: string) => boolean; } /** * Default catalogue of PII patterns. * * @stable */ declare const DEFAULT_PII_PATTERNS: ReadonlyArray; /** * Options for `piiDetection(...)`. * * @stable */ interface PiiDetectionOptions { /** Additional patterns merged with the default catalogue. */ readonly extraPatterns?: ReadonlyArray; /** Replace the default catalogue entirely. */ readonly patterns?: ReadonlyArray; /** * Action to take on a match. Defaults to `'rewrite'` (mask the * detected substring with `[REDACTED:]`). */ readonly action?: 'block' | 'warn' | 'rewrite'; /** Stage the guardrail applies to. Defaults to `'input'`. */ readonly stage?: 'input' | 'output'; /** Override guardrail name. */ readonly name?: string; } /** * FIDES-lattice: does `text` contain any catalogued PII (email, SSN, * phone, Luhn-valid card, …)? A pure, allocation-light predicate that returns on * the first valid match and honours per-pattern `validate` (e.g. Luhn). Used to * feed user/PII content into the dataflow taint ledger's `sensitiveSeen` leg so * PII exfiltration trips the lethal-trifecta gate even without a `'secret'` tag. * * @stable */ declare function containsPii(text: string, patterns?: ReadonlyArray): boolean; /** * Construct the PII detection guardrail. * * Note on normalization: the boolean detect predicate * ({@link containsPii}) matches against the NFKC + zero-width-stripped * form of the text, so cheap character-injection obfuscation cannot * dodge detection. The guardrail's REWRITE path (`redactText` / * `redactValue`) deliberately keeps matching the raw text: offset-based * replacement needs the original string, and a normalized-offset remap * is not worth the complexity for a best-effort redactor. * * @stable */ declare function piiDetection(opts?: PiiDetectionOptions): GuardrailDefinition; /** * Luhn checksum for credit-card validation. * * @stable */ declare function luhn(value: string): boolean; //#endregion export { DEFAULT_PII_PATTERNS, PiiDetectionOptions, PiiPattern, containsPii, luhn, piiDetection }; //# sourceMappingURL=pii-detection.d.ts.map