/**
 * Prompt Guard Service — Prompt Injection Protection
 *
 * Detects and blocks prompt injection attempts that try to extract API keys,
 * secrets, or sensitive environment variables through agent commands.
 *
 * Integrates with the tool registry to block dangerous bash commands and
 * logs blocked attempts to the audit trail.
 *
 * @module services/agent/crewly-agent/prompt-guard.service
 *
 * @example
 * ```typescript
 * const guard = new PromptGuardService();
 * const result = guard.checkCommand('echo $ANTHROPIC_API_KEY');
 * // { blocked: true, reason: 'Key extraction attempt: echo env var', pattern: '...' }
 * ```
 */
import type { AuditEntry } from './types.js';
/**
 * A pattern that detects key extraction attempts.
 */
export interface GuardPattern {
    /** Regex to match the dangerous command or prompt */
    pattern: RegExp;
    /** Human-readable reason for blocking */
    reason: string;
    /** Category for audit logging */
    category: 'env_extraction' | 'key_dump' | 'prompt_injection' | 'file_exfiltration';
}
/**
 * Result of a prompt guard check.
 */
export interface GuardCheckResult {
    /** Whether the command/prompt was blocked */
    blocked: boolean;
    /** Reason for blocking (empty if not blocked) */
    reason: string;
    /** Category of the threat (undefined if not blocked) */
    category?: GuardPattern['category'];
    /** The matched pattern source (for audit logging) */
    matchedPattern?: string;
}
/**
 * Patterns that detect attempts to extract API keys or secrets via bash commands.
 */
export declare const KEY_EXTRACTION_PATTERNS: readonly GuardPattern[];
/**
 * Prompt-level injection patterns (detected in natural language prompts, not just commands).
 */
export declare const PROMPT_INJECTION_PATTERNS: readonly GuardPattern[];
/**
 * Additional blocked command patterns for tool-registry.ts integration.
 * These extend the existing BLOCKED_COMMAND_PATTERNS with key extraction blocks.
 */
export declare const KEY_EXTRACTION_BLOCKED_COMMANDS: RegExp[];
/**
 * Service that detects and blocks prompt injection and key extraction attempts.
 */
export declare class PromptGuardService {
    private readonly commandPatterns;
    private readonly promptPatterns;
    /**
     * Creates a new PromptGuardService.
     *
     * @param additionalCommandPatterns - Extra command-level patterns
     * @param additionalPromptPatterns - Extra prompt-level patterns
     */
    constructor(additionalCommandPatterns?: GuardPattern[], additionalPromptPatterns?: GuardPattern[]);
    /**
     * Checks a bash command for key extraction attempts.
     *
     * @param command - Raw bash command string
     * @returns Guard check result
     */
    checkCommand(command: string): GuardCheckResult;
    /**
     * Checks a user/agent prompt for injection attempts targeting secrets.
     *
     * @param prompt - The text prompt or message
     * @returns Guard check result
     */
    checkPrompt(prompt: string): GuardCheckResult;
    /**
     * Checks both command and prompt patterns.
     * Use this for comprehensive scanning of any agent input.
     *
     * @param text - Text to check (command or prompt)
     * @returns Guard check result
     */
    check(text: string): GuardCheckResult;
    /**
     * Creates an audit entry for a blocked attempt.
     *
     * @param sessionName - Agent session that triggered the block
     * @param toolName - Tool that was used (e.g. 'bash_exec')
     * @param command - The blocked command
     * @param guardResult - The guard check result
     * @returns AuditEntry suitable for the audit log
     */
    createAuditEntry(sessionName: string, toolName: string, command: string, guardResult: GuardCheckResult): AuditEntry;
}
//# sourceMappingURL=prompt-guard.service.d.ts.map