/**
 * memory-rank — LLM-reasoned entity ranking.
 *
 * Flow:
 *   1. memorySearch(..., limit = candidatePoolSize) to retrieve candidates
 *      using the existing hybrid vector+BM25 pipeline and scope/agent filters.
 *   2. rankCandidates(candidates, criteria, accountId) — passes the pool to
 *      Claude Haiku with a sandboxed ranking prompt, parses the response, and
 *      filters any hallucinated nodeIds.
 *   3. Merge reasoning back onto the original memory-search results and slice
 *      to `limit`.
 *   4. On LLM unavailability (no key, API error, malformed response, etc.),
 *      fall back to the unranked memory-search results prefixed with a
 *      "[Ranking unavailable: <reason>]" notice. Degraded success — not an
 *      error response. This makes the failure visible to the agent so it can
 *      relay to the user.
 */
export interface RankParams {
    query: string;
    criteria: string;
    labels?: string[];
    accountId: string;
    limit?: number;
    candidatePoolSize?: number;
    expandHops?: number;
    allowedScopes?: string[];
    keywords?: string[];
    keywordMatch?: "any" | "all";
    agentSlug?: string;
    /** Passed through to memory-search so reactive knowledge subscriptions
     * (KNOWLEDGE_KEYWORDS env var on public agents) expand the candidate pool
     * the same way they do for memory-search. Omitting this would silently
     * give memory-rank a narrower candidate pool than memory-search for the
     * same account. */
    keywordSubscriptions?: string[];
}
export interface RankedResult {
    nodeId: string;
    labels: string[];
    properties: Record<string, unknown>;
    score: number;
    related: Array<{
        relationship: string;
        direction: string;
        labels: string[];
        properties: Record<string, unknown>;
    }>;
    rank?: number;
    reasoning?: string;
}
export interface RankResponse {
    results: RankedResult[];
    /** When present, ranking failed and results are in original memory-search score order. */
    fallbackReason?: string;
    /** Number of candidates the LLM invented that were filtered out. */
    hallucinated: number;
    /** Number of candidates returned by memory-search before ranking. */
    candidatePoolSize: number;
}
export declare function memoryRank(params: RankParams): Promise<RankResponse>;
//# sourceMappingURL=memory-rank.d.ts.map