import { classifyIntent } from "../search/core/intent-router.js";
import { domainQualityScore } from "../search/core/domain-quality.js";
import { lexicalAlignment } from "../search/core/lexical-alignment.js";
function rankAgentSearchResults(prompt, results) {
  if (!prompt.trim() || results.length === 0) return results;
  const vertical = classifyIntent(prompt);
  return [...results].map((r) => {
    const dq = domainQualityScore(r.url, vertical, prompt);
    const la = lexicalAlignment(prompt, r.title, r.snippet);
    const final = r.relevance_score * dq * (0.5 + 0.5 * la);
    return { ...r, relevance_score: final };
  }).sort((a, b) => b.relevance_score - a.relevance_score);
}
export {
  rankAgentSearchResults
};
//# sourceMappingURL=rank.js.map