/**
 * src/models/router.ts
 *
 * AUTOMATIC model routing — the cost brain. Users never pick a model (most
 * are non-technical); the system decides per task. The rule is simple:
 * spend the expensive model ONLY where judgment the owner will actually read
 * matters; run everything else on the cheapest capable model.
 *
 * This pairs with the brain's existing intent classifier (which already
 * splits owner chat into flash/brain/reasoning tiers). For owner_chat we
 * return no override and let that classifier + the env tier→model mapping
 * decide (flash=Haiku, brain=Opus, reasoning=Opus). For everything the owner
 * doesn't directly read, we force a cheaper model regardless of the brain pin.
 */
function has(env) {
    const v = process.env[env];
    return Boolean(v && v !== 'mock_google_key' && v !== 'mock_together_key');
}
/**
 * Returns a {provider, model} override for a purpose, or undefined to defer
 * to the default tier router/failover chain. Undefined is correct for
 * owner_chat (the intent classifier already routes it).
 */
export function pickModelOverride(purpose) {
    const anthropic = has('ANTHROPIC_API_KEY');
    switch (purpose) {
        case 'planning':
            // Goal decomposition, multi-step strategy — worth the top model.
            return anthropic ? { provider: 'anthropic', model: 'claude-opus-4-7' } : undefined;
        case 'background_work':
            // Goal pursuit, proactive drafts, research cycles. Owner reads the
            // output eventually, but Sonnet (5× cheaper than Opus) is plenty.
            return anthropic ? { provider: 'anthropic', model: 'claude-sonnet-4-6' } : undefined;
        case 'background_maintenance':
            // Heartbeat status, housekeeping summaries, classification. Prefer the
            // free bundled NIM chain; only reach for Haiku if Anthropic is the only
            // thing configured.
            if (has('NVIDIA_NIM_API_KEY'))
                return undefined; // default chain = free
            return anthropic ? { provider: 'anthropic', model: 'claude-haiku-4-5' } : undefined;
        case 'owner_chat':
        default:
            return undefined; // intent classifier + tier prefs decide
    }
}
//# sourceMappingURL=router.js.map