package com.correx.core.context.compression

/**
 * Stage 5 ordering/selection: score a candidate text's relevance to the current query (cheap
 * embedding cosine similarity). Recency picks the compression *level*; relevance picks what to
 * *prioritize* when the budget forces a drop — turn 3 may matter more than turn 40 (pipeline §6,
 * "relevance-reranked history" + "query-conditioned compression").
 *
 * Returns a score in [0,1]; higher = keep. Suspend because embedding may hit an out-of-process
 * embedder. Environment observations (the embeddings) are the caller's to record as events if
 * they cross into replay-relevant state (invariant #9) — for ephemeral prompt assembly they don't.
 */
interface RelevanceScorer {
    suspend fun score(query: String, candidates: List<String>): List<Double>
}

/** Default (scorer unconfigured): everything equally relevant, so ordering falls back to recency. */
object UniformRelevanceScorer : RelevanceScorer {
    override suspend fun score(query: String, candidates: List<String>): List<Double> =
        candidates.map { 1.0 }
}
