import { resolveConfigValues } from '../../infra/config/index.js';
import { getProvider } from '../../infra/providers/index.js';
import { resolveAssistantProviderModelFromConfig, } from '../../core/config/provider-resolution.js';
import { resolveAssistantConfigLayers } from './assistantConfig.js';
export function initializeSession(cwd, personaName, assistantCliOverrides) {
    const globalConfig = resolveConfigValues(cwd, ['language', 'provider', 'model']);
    const lang = globalConfig.language === 'ja' ? 'ja' : 'en';
    const resolvedProviderModel = personaName === 'interactive'
        ? resolveAssistantProviderModelFromConfig(resolveAssistantConfigLayers(cwd), assistantCliOverrides)
        : {
            provider: globalConfig.provider,
            model: globalConfig.model,
        };
    const { provider: resolvedProvider, model } = resolvedProviderModel;
    if (!resolvedProvider) {
        throw new Error('Provider is not configured.');
    }
    return {
        provider: getProvider(resolvedProvider),
        providerType: resolvedProvider,
        model,
        lang,
        personaName,
        sessionId: undefined,
    };
}
//# sourceMappingURL=sessionInitialization.js.map