/**
 * Iron Dome — Kill Switch
 *
 * Handles kill phrase detection. When the kill phrase is detected
 * in input, Iron Dome immediately halts all processing.
 */
import { logIronDomeAudit } from './audit.js';
/**
 * Check if the input contains the kill phrase.
 */
export function handleKillPhrase(input, config) {
    if (!config.enabled || !config.killPhrase) {
        return { triggered: false, phrase: '' };
    }
    const normInput = input.toLowerCase().trim();
    const normPhrase = config.killPhrase.toLowerCase().trim();
    const triggered = normInput.includes(normPhrase);
    if (triggered) {
        logIronDomeAudit({
            action: 'kill_switch',
            allowed: false,
            reason: `Kill phrase "${config.killPhrase}" detected`,
        });
    }
    return {
        triggered,
        phrase: config.killPhrase,
    };
}
