/** * Wraps untrusted external content before model ingestion. * Email, webhook, and web-tool payloads must never become trusted prompt instructions. */ /** * Check if content contains suspicious patterns that may indicate injection. * * Draws entirely from the shared injection-primitives bank: the * prompt-injection phrasing in `INJECTION_PATTERNS`, the external-content * dangerous-command / forged-delimiter indicators in * `EXTERNAL_CONTENT_RISK_PATTERNS`, and obfuscation-aware keyword matching over * `INJECTION_KEYWORDS`. There is no second pattern set here. Matches are logged * for monitoring but content is still processed (wrapped safely). * * @param content - The content to check * @returns Array of matched pattern sources / keywords (empty if none) */ export declare function detectSuspiciousPatterns(content: string): string[]; /** * Source types for external content. */ export type ExternalContentSource = "email" | "webhook" | "api" | "channel_metadata" | "web_search" | "web_fetch" | "unknown"; /** * Options for wrapping external content. */ export type WrapExternalContentOptions = { /** Source of the external content */ source: ExternalContentSource; /** Original sender information (e.g., email address) */ sender?: string; /** Subject line (for emails) */ subject?: string; /** Whether to include detailed security warning */ includeWarning?: boolean; /** Runtime-selected message role; never copy this from untrusted payload metadata. */ purpose?: "reference" | "incoming_message"; }; /** * Wraps external untrusted content with security boundaries and warnings. * * This function should be used whenever processing content from external sources * (emails, webhooks, API calls from untrusted clients) before passing to LLM. * * @example * ```ts * const safeContent = wrapExternalContent(emailBody, { * source: "email", * sender: "user@example.com", * subject: "Help request" * }); * // Pass safeContent to LLM instead of raw emailBody * ``` * * @param content - The external content to wrap * @param options - Wrapping options * @returns Wrapped content with security markers */ export declare function wrapExternalContent(content: string, options: WrapExternalContentOptions): string; /** * Whether text carries the exact wrap markers or warning header this module * emits. Byte-exact predicate kept for callers that need to recognize a * verbatim envelope; delivery gating uses the variant-tolerant * {@link containsExternalEnvelopeMaterial} instead. */ export declare function containsExternalEnvelopeMarkers(text: string): boolean; /** * Variant-tolerant detector for security-envelope material in text. Unlike * {@link containsExternalEnvelopeMarkers} (byte-exact), this catches the echo * shapes a model actually produces when it regurgitates the envelope: case * changes, fullwidth/compatibility Unicode (folded via NFKC), zero-width * lacing and Cyrillic/Greek homoglyph substitution (folded via the detection * skeleton), quoted or partial marker fragments ("he said \"<<