"use strict";
// src/orchestrator/rag/Retriever.ts
// v1.13.0 — Embedding-based code retrieval.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Retriever = void 0;
class Retriever {
    embed;
    store;
    constructor(embed, store) {
        this.embed = embed;
        this.store = store;
    }
    async retrieve(query, opts = {}) {
        const topK = opts.topK ?? 8;
        const vec = await this.embed.embed(query);
        const hits = await this.store.search(vec, topK, { file: opts.file, language: opts.language });
        return hits.map(h => ({
            ref: `${h.payload.file}:${h.payload.startLine}-${h.payload.endLine}`,
            file: h.payload.file,
            startLine: h.payload.startLine,
            endLine: h.payload.endLine,
            content: h.payload.content,
            language: h.payload.language,
            score: h.score,
        }));
    }
}
exports.Retriever = Retriever;
