// engine/multi-teammate-review/heterogeneity-gate.ts — SPEC-727
// Prevents panels staffed with two or more identical (modelId, promptHash) specialists.
// ---------------------------------------------------------------------------
// Public API
// ---------------------------------------------------------------------------
/**
 * Check that no two specialists share identical (modelId, promptHash).
 *
 * If any pair of specialists is identical, the panel would produce trivially
 * aligned critique — which defeats the multi-teammate review purpose.
 *
 * Returns { ok: true, duplicates: [] } when all pairs are distinct.
 * Returns { ok: false, duplicates: [...] } listing every duplicate pair found.
 */
export function checkHeterogeneity(specialists) {
    const duplicates = [];
    for (let i = 0; i < specialists.length; i++) {
        for (let j = i + 1; j < specialists.length; j++) {
            const a = specialists[i];
            const b = specialists[j];
            // Both are defined because we iterate within bounds
            if (a !== undefined && a.modelId === b?.modelId && a.promptHash === b.promptHash) {
                duplicates.push({
                    a: a.role,
                    b: b.role,
                    modelId: a.modelId,
                    promptHash: a.promptHash,
                });
            }
        }
    }
    return {
        ok: duplicates.length === 0,
        duplicates,
    };
}
//# sourceMappingURL=heterogeneity-gate.js.map