/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { getSettingHelp, validateSetting, parseSetting, resolveAlias, SETTINGS_REGISTRY, } from '@vybestack/llxprt-code-core';
export const ephemeralSettingHelp = getSettingHelp();
const validEphemeralKeys = SETTINGS_REGISTRY.map((s) => s.key);
export function parseEphemeralSettingValue(key, rawValue) {
    const resolved = resolveAlias(key);
    if (!validEphemeralKeys.includes(resolved)) {
        return {
            success: false,
            message: `Invalid setting key: ${key}. Valid keys are: ${validEphemeralKeys.join(', ')}`,
        };
    }
    const parsed = parseSetting(resolved, rawValue);
    const validation = validateSetting(resolved, parsed);
    if (!validation.success) {
        return {
            success: false,
            message: validation.message ?? `Validation failed for ${key}`,
        };
    }
    return {
        success: true,
        value: validation.value ?? parsed,
    };
}
/**
 * Validates whether a given key-value pair is a valid ephemeral setting.
 * Used for runtime validation of ephemeral settings.
 * @param key - The ephemeral setting key
 * @param value - The value to validate
 * @returns true if the setting is valid, false otherwise
 */
export function isValidEphemeralSetting(key, value) {
    // Resolve aliases first so 'max-tokens' etc. work the same as in parseEphemeralSettingValue
    const resolved = resolveAlias(key);
    if (!validEphemeralKeys.includes(resolved)) {
        return false;
    }
    const result = parseEphemeralSettingValue(resolved, String(value));
    return result.success;
}
//# sourceMappingURL=ephemeralSettings.js.map