/**
 * Normalize tool parameters to handle common LLM mistakes:
 * - Case-insensitive language/framework values
 * - Common parameter name aliases
 */
const LANGUAGE_MAP = {
    typescript: "typescript",
    javascript: "javascript",
    python: "python",
    java: "java",
    ts: "typescript",
    js: "javascript",
    py: "python",
};
const FRAMEWORK_MAP = {
    playwright: "playwright",
    pytest: "pytest",
    junit: "junit",
    robot: "robot",
};
/**
 * Normalize language and framework to lowercase accepted values.
 */
export function normalizeLanguageParams(params) {
    if (typeof params.language === "string") {
        const lower = params.language.toLowerCase();
        params.language = LANGUAGE_MAP[lower] || lower;
    }
    if (typeof params.framework === "string") {
        const lower = params.framework.toLowerCase();
        params.framework = FRAMEWORK_MAP[lower] || lower;
    }
}
/**
 * Resolve common parameter name aliases that LLMs use.
 * e.g., zipPath -> playwrightInput, testFilePath -> testFile
 */
export function resolveParamAliases(params, aliases) {
    for (const [alias, canonical] of Object.entries(aliases)) {
        if (params[alias] !== undefined && params[canonical] === undefined) {
            params[canonical] = params[alias];
            delete params[alias];
        }
    }
}
