// engine/sdd-flow/model-router.ts — SPEC-583: Default + override model routing
const BALANCED_ROUTING = {
    planner: 'opus',
    reviewer: 'opus',
    executor: 'sonnet',
    validator: 'haiku',
    merger: 'sonnet',
    releaser: 'haiku',
};
const COST_OPTIMAL_ROUTING = {
    planner: 'sonnet',
    reviewer: 'sonnet',
    executor: 'sonnet',
    validator: 'haiku',
    merger: 'haiku',
    releaser: 'haiku',
};
const QUALITY_OPTIMAL_ROUTING = {
    planner: 'opus',
    reviewer: 'opus',
    executor: 'opus',
    validator: 'sonnet',
    merger: 'opus',
    releaser: 'sonnet',
};
const COST_PER_TEAMMATE = {
    haiku: 0.25,
    sonnet: 1.0,
    opus: 4.0,
};
export function resolveModelRouting(strategy) {
    if (strategy === 'cost-optimal') {
        return COST_OPTIMAL_ROUTING;
    }
    if (strategy === 'quality-optimal') {
        return QUALITY_OPTIMAL_ROUTING;
    }
    return BALANCED_ROUTING;
}
export function resolveTeammateModel(specId, baseModel, overrides) {
    return overrides?.[specId] ?? baseModel;
}
export function estimateCost(specIds, routing, perTeammateOverrides) {
    const stageCosts = [
        COST_PER_TEAMMATE[routing.planner],
        COST_PER_TEAMMATE[routing.reviewer] * specIds.length,
        specIds.reduce((sum, id) => {
            const model = resolveTeammateModel(id, routing.executor, perTeammateOverrides);
            return sum + COST_PER_TEAMMATE[model];
        }, 0),
        COST_PER_TEAMMATE[routing.validator] * specIds.length,
        COST_PER_TEAMMATE[routing.merger] * specIds.length,
        COST_PER_TEAMMATE[routing.releaser],
    ];
    return Math.round(stageCosts.reduce((a, b) => a + b, 0) * 100) / 100;
}
//# sourceMappingURL=model-router.js.map