/** Masks credential patterns and configured character secrets before logging or display. */ /** * Mode for sensitive text redaction. * - "off": No redaction * - "tools": Redact in tool outputs */ export type RedactSensitiveMode = "off" | "tools"; export declare const MIN_SECRET_LENGTH = 8; /** Shared credential-name policy used by model and log redaction. */ export declare function isSensitiveKeyName(key: string): boolean; /** * Options for redacting sensitive text. */ export type RedactOptions = { /** Redaction mode */ mode?: RedactSensitiveMode; /** Custom patterns to match (in addition to or instead of defaults) */ patterns?: string[]; }; /** * Options for secrets-based redaction. */ export type SecretsRedactOptions = { /** Known secrets to redact (key -> secret value) */ secrets?: Record; /** Whether to also apply pattern-based redaction */ applyPatterns?: boolean; }; /** * Redact sensitive information from text. * * @param text - The text to redact * @param options - Redaction options * @returns Text with sensitive data masked */ export declare function redactSensitiveText(text: string, options?: RedactOptions): string; /** * Get the default redaction patterns. * * Source reviewers may classify named assignments with their own literal parser. * Runtime redaction keeps broad assignment matching by default. Provider token, * quoted field, header and URL patterns remain present in both modes. * @returns Copy of default pattern strings */ export declare function getDefaultRedactPatterns(options?: { includeNamedAssignments?: boolean; }): string[]; /** * Redact known secrets from text. * * This performs literal string replacement of known secret values, * ensuring they don't appear in outputs even if they don't match * the pattern-based detection. * * @param text - Text to redact * @param secrets - Map of secret names to secret values * @returns Text with secrets replaced by [REDACTED:name] */ export declare function redactSecrets(text: string, secrets: Record): string; /** * Redact both known secrets and pattern-detected sensitive data. * * This combines literal secret replacement with pattern-based detection * for comprehensive redaction. * * @param text - Text to redact * @param options - Redaction options including known secrets * @returns Text with all sensitive data redacted */ export declare function redactWithSecrets(text: string, options?: SecretsRedactOptions): string; /** * Redact every argument in a `logger.error(...args)` call before it reaches the * transport. Consumed by log sinks so secret masking is structural, not opt-in: * `logger.error("msg", { apiKey })` masks the key with no `redact.context()` at * the call site. * * Delegates to the single fail-closed log walker in `log-redaction.ts` rather * than keeping a parallel one: a throwing getter or hostile Proxy degrades to * a per-key (or per-argument) redaction-failed marker instead of aborting the * walk, so sibling credentials are never emitted unmasked and logging never * throws into the caller. */ export declare function redactLogArgs(args: readonly unknown[]): unknown[];