/**
 * economy/tier-policy — Model tier catalog and routing policy.
 *
 * Substrate-pure: no consumer-specific names anywhere.
 * Consumers inject a custom TierPolicy implementation to override defaults.
 */
// ─── Built-in tier catalog ────────────────────────────────────────────────
/** Tier 0 — local Qwen3-8B via LiteLLM proxy. Free. */
const TIER_FREE = {
    provider: "litellm",
    model: "default-fast",
    costPerMTokenIn: 0,
    costPerMTokenOut: 0,
    label: "free",
};
/** Tier 1 — DeepSeek Flash via LiteLLM proxy. Low cost. */
const TIER_CHEAP = {
    provider: "litellm",
    model: "deepseek-v4-flash",
    costPerMTokenIn: 0.14,
    costPerMTokenOut: 0.28,
    label: "cheap",
};
/** Tier 2 — Groq free tier (llama-3.3-70b-versatile). Mid quality, near-zero cost. */
const TIER_MID = {
    provider: "groq",
    model: "llama-3.3-70b-versatile",
    costPerMTokenIn: 0.0,
    costPerMTokenOut: 0.0,
    label: "mid",
};
/** Tier 3 — DeepSeek Pro via LiteLLM proxy. Premium. */
const TIER_PREMIUM = {
    provider: "litellm",
    model: "deepseek-v4-pro",
    costPerMTokenIn: 0.27,
    costPerMTokenOut: 1.1,
    label: "premium",
};
// ─── Static category → tier index mapping ─────────────────────────────────
const DEGRADED_ROUTING = {
    simple: [TIER_FREE, TIER_CHEAP],
    standard: [TIER_CHEAP, TIER_MID],
    complex: [TIER_MID, TIER_PREMIUM],
    reasoning: [TIER_PREMIUM],
};
const DEFAULT_DEGRADED = [TIER_CHEAP, TIER_MID];
// ─── DefaultTierPolicy ────────────────────────────────────────────────────
/**
 * DefaultTierPolicy — static cost-minimising routing.
 *
 * "degraded" mode: purely static, category → ordered tier list.
 * "full" mode: same tiers returned in same order; the *caller* (economy router)
 *   is responsible for re-ordering by observed cost-per-outcome from OutcomeTracker.
 *   This class only supplies the candidate set.
 */
export class DefaultTierPolicy {
    tiersFor(category, _mode) {
        // Both modes return the same candidate set; re-ordering in "full" mode
        // is the router's responsibility (Sprint D router.ts, not this class).
        const tiers = DEGRADED_ROUTING[category] ?? DEFAULT_DEGRADED;
        // Return a copy to prevent external mutation of the catalog.
        return [...tiers];
    }
}
// ─── Catalog helpers ──────────────────────────────────────────────────────
/**
 * Look up a ModelTier by provider+model from the built-in catalog.
 * Returns undefined if the model is not in the default catalog
 * (consumers may use custom tiers not registered here).
 */
export function lookupTier(provider, model) {
    const catalog = [TIER_FREE, TIER_CHEAP, TIER_MID, TIER_PREMIUM];
    return catalog.find((t) => t.provider === provider && t.model === model);
}
//# sourceMappingURL=tier-policy.js.map