"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.policyTemplates = void 0;
exports.getPolicyTemplate = getPolicyTemplate;
exports.listPolicyTemplates = listPolicyTemplates;
exports.listPolicyTemplatesWithKeys = listPolicyTemplatesWithKeys;
exports.applyPolicyTemplate = applyPolicyTemplate;
exports.recommendTemplate = recommendTemplate;
exports.policyTemplates = {
    strict: {
        name: 'Strict',
        description: 'Low limits, fast kills - Best for production',
        useCase: 'Production environments, cost-sensitive operations',
        config: {
            enabled: true,
            runMaxDurationMs: 60000,
            runMaxTokens: 8000,
            runIdleMs: 15000,
            loopWindow: 10,
            loopMax: 3,
            runMaxCost: 0.50
        }
    },
    development: {
        name: 'Development',
        description: 'High limits, warnings only - Best for dev/testing',
        useCase: 'Development, testing, experimentation',
        config: {
            enabled: true,
            runMaxDurationMs: 300000,
            runMaxTokens: 50000,
            runIdleMs: 60000,
            loopWindow: 30,
            loopMax: 10,
            runMaxCost: 5.00
        }
    },
    costConscious: {
        name: 'Cost-Conscious',
        description: 'Aggressive cost limits - Best for budget-constrained ops',
        useCase: 'Budget-constrained operations',
        config: {
            enabled: true,
            runMaxDurationMs: 120000,
            runMaxTokens: 12000,
            runIdleMs: 20000,
            loopWindow: 15,
            loopMax: 5,
            runMaxCost: 0.25
        }
    },
    performance: {
        name: 'Performance',
        description: 'Focus on timeout/idle - Best for performance-critical apps',
        useCase: 'Performance-critical applications',
        config: {
            enabled: true,
            runMaxDurationMs: 30000,
            runMaxTokens: 20000,
            runIdleMs: 10000,
            loopWindow: 20,
            loopMax: 7,
            runMaxCost: 1.00
        }
    },
    balanced: {
        name: 'Balanced',
        description: 'Moderate limits - Best for general purpose',
        useCase: 'General purpose, balanced approach',
        config: {
            enabled: true,
            runMaxDurationMs: 120000,
            runMaxTokens: 16000,
            runIdleMs: 30000,
            loopWindow: 15,
            loopMax: 5,
            runMaxCost: 1.00
        }
    },
    permissive: {
        name: 'Permissive',
        description: 'Very high limits - Best for research/experimentation',
        useCase: 'Research, experimentation, one-off tasks',
        config: {
            enabled: true,
            runMaxDurationMs: 600000,
            runMaxTokens: 100000,
            runIdleMs: 120000,
            loopWindow: 60,
            loopMax: 20,
            runMaxCost: 10.00
        }
    }
};
function getPolicyTemplate(name) {
    const normalized = name.toLowerCase();
    if (exports.policyTemplates[normalized]) {
        return exports.policyTemplates[normalized];
    }
    const camelCase = normalized.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
    if (exports.policyTemplates[camelCase]) {
        return exports.policyTemplates[camelCase];
    }
    if (name && name.length > 0) {
        const firstChar = name[0];
        if (firstChar) {
            const firstLower = firstChar.toLowerCase() + name.slice(1);
            if (exports.policyTemplates[firstLower]) {
                return exports.policyTemplates[firstLower];
            }
        }
    }
    return undefined;
}
function listPolicyTemplates() {
    return Object.values(exports.policyTemplates);
}
function listPolicyTemplatesWithKeys() {
    return Object.entries(exports.policyTemplates).map(([key, template]) => ({
        key,
        ...template,
    }));
}
function applyPolicyTemplate(templateName) {
    const template = getPolicyTemplate(templateName);
    if (!template) {
        return null;
    }
    return template.config;
}
function recommendTemplate(useCase) {
    const lowerUseCase = useCase.toLowerCase();
    if (lowerUseCase.includes('production') || lowerUseCase.includes('prod')) {
        return exports.policyTemplates['strict'] || null;
    }
    if (lowerUseCase.includes('development') || lowerUseCase.includes('dev') || lowerUseCase.includes('test')) {
        return exports.policyTemplates['development'] || null;
    }
    if (lowerUseCase.includes('cost') || lowerUseCase.includes('budget')) {
        return exports.policyTemplates['costConscious'] || null;
    }
    if (lowerUseCase.includes('performance') || lowerUseCase.includes('speed')) {
        return exports.policyTemplates['performance'] || null;
    }
    if (lowerUseCase.includes('research') || lowerUseCase.includes('experiment')) {
        return exports.policyTemplates['permissive'] || null;
    }
    return exports.policyTemplates['balanced'] || null;
}
//# sourceMappingURL=policy-templates.js.map