/**
 * Nexus Prime — Selector Precedence
 *
 * Defines the deterministic precedence order for memory-class-based selection.
 * AI Lead requirement: this must be visible in every SelectionProof.
 */
/**
 * Memory class precedence: highest trust → lowest trust.
 * Tie-breaking: recency wins within the same class.
 */
export const SELECTOR_PRECEDENCE = [
    'reusable_pattern', // highest trust — repeated verified evidence
    'project_fact', // validated in this project
    'session_learning', // recent but unconfirmed
    'scratch', // ephemeral — never shortcut to reusable_pattern
];
/**
 * Asset selection order (after memory classes).
 * This hierarchy must be visible in proofs.
 */
export const ASSET_SELECTION_ORDER = [
    'memory', // evidence and priors
    'patterns', // strategic suggestions
    'specialists', // perspective and constraints
    'crews', // topology templates
    'skills', // tactical execution aids
    'workflows', // reusable execution sequences
    'hooks', // lifecycle interventions only
    'automations', // bounded follow-up only
];
/**
 * Get the precedence rank of a memory class (lower = higher priority).
 */
export function getClassPrecedence(memoryClass) {
    const idx = SELECTOR_PRECEDENCE.indexOf(memoryClass);
    return idx === -1 ? SELECTOR_PRECEDENCE.length : idx;
}
/**
 * Compare two items by memory class precedence, then by recency.
 */
export function compareBySelectorPrecedence(a, b) {
    const pa = getClassPrecedence(a.memoryClass);
    const pb = getClassPrecedence(b.memoryClass);
    if (pa !== pb)
        return pa - pb; // lower index = higher priority
    return b.timestamp - a.timestamp; // newer first within same class
}
