/**
 * ThinkingConfig utility functions for constructing thinking configuration objects.
 *
 * This module provides helper functions to create thinkingConfig objects consistently
 * across the codebase, reducing duplication in CLI and providers.
 */
/**
 * Default token budget for thinking operations
 */
export const DEFAULT_THINKING_BUDGET_TOKENS = 10000;
/**
 * Default thinking level for Gemini 3 models
 */
export const DEFAULT_THINKING_LEVEL = "high";
/**
 * Creates a thinkingConfig object from CLI-style options.
 *
 * This helper consolidates the pattern used in CLI command handlers
 * to convert simple CLI flags into the full thinkingConfig structure.
 *
 * @param options - CLI-style options with thinking, thinkingBudget, thinkingLevel
 * @returns ThinkingConfig object or undefined if thinking is not enabled
 *
 * @example
 * ```typescript
 * // From CLI options
 * const config = createThinkingConfig({
 *   thinking: true,
 *   thinkingBudget: 15000,
 *   thinkingLevel: "high"
 * });
 * // Returns: { enabled: true, budgetTokens: 15000, thinkingLevel: "high" }
 * ```
 */
export function createThinkingConfig(options) {
    // Only create config if thinking is explicitly enabled or thinkingLevel is set
    if (!options.thinking && !options.thinkingLevel) {
        return undefined;
    }
    return {
        enabled: true,
        budgetTokens: options.thinkingBudget ?? DEFAULT_THINKING_BUDGET_TOKENS,
        thinkingLevel: options.thinkingLevel,
    };
}
/**
 * Creates a thinkingConfig from record-style options (useful for CLI handlers).
 *
 * This handles the type casting that's commonly needed when working with
 * CLI argument records.
 *
 * @param options - Record-style options from CLI argv
 * @returns ThinkingConfig object or undefined if thinking is not enabled
 *
 * @example
 * ```typescript
 * const config = createThinkingConfigFromRecord(argv as Record<string, unknown>);
 * ```
 */
export function createThinkingConfigFromRecord(options) {
    const thinking = options.thinking;
    const thinkingLevel = options.thinkingLevel;
    const thinkingBudget = options.thinkingBudget;
    return createThinkingConfig({
        thinking,
        thinkingLevel,
        thinkingBudget,
    });
}
/**
 * Creates thinkingConfig for native Gemini SDK (not AI SDK).
 *
 * This is used for direct calls to the Gemini SDK where the config
 * structure is different from the AI SDK providerOptions.
 *
 * @param config - The thinkingConfig from options
 * @returns NativeThinkingConfig object or undefined
 *
 * @example
 * ```typescript
 * const nativeConfig = createNativeThinkingConfig(options.thinkingConfig);
 * if (nativeConfig) {
 *   sdkConfig.thinkingConfig = nativeConfig;
 * }
 * ```
 */
export function createNativeThinkingConfig(config) {
    if (!config?.enabled && !config?.thinkingLevel) {
        return undefined;
    }
    return {
        includeThoughts: true,
        thinkingLevel: config.thinkingLevel ?? DEFAULT_THINKING_LEVEL,
    };
}
/**
 * Checks if thinkingConfig should be applied based on options.
 *
 * @param config - The thinkingConfig from options
 * @returns true if thinking should be enabled
 */
export function shouldEnableThinking(config) {
    return Boolean(config?.enabled || config?.thinkingLevel);
}
//# sourceMappingURL=thinkingConfig.js.map