/**
 * Query 1: Find the target file's anchor in the semantic graph.
 * Distance 0 — the starting point for the beam.
 */
import { BeamGraphClient } from "../graph-client.js";
export const anchorLookup = {
    name: "anchor-lookup",
    source: "semantic-graph",
    distance: 0,
    maxResults: 1,
    detail: "full",
    async execute(ctx) {
        const client = new BeamGraphClient(ctx.projectName);
        try {
            await client.connect();
            const rows = await client.query("MATCH (a:Anchor {path: $path, status: 'active'}) RETURN a.uuid AS uuid, a.kind AS kind, a.path AS path", { path: ctx.targetAbsolutePath });
            return rows.map((row) => ({
                source: "semantic-graph",
                distance: 0,
                detail: "full",
                content: `Anchor: ${row.kind} at ${row.path}`,
                metadata: { path: String(row.path) },
            }));
        }
        catch {
            return [];
        }
        finally {
            await client.close();
        }
    },
};
