import type { IndexFiles } from "../indexer/index-files.js"; import type { IndexCode } from "../indexer/index-code.js"; import type { IndexGraph } from "../indexer/index-graph.js"; import type { SearchResult, CodeChunk, FileRecord } from "../types/index.js"; export type RetrievalMethod = "fts" | "vector" | "symbol" | "refs" | "graph-expand" | "module" | "path" | "upstream"; export declare const EDGE_WEIGHTS: Record; export interface InvestigateHit { chunk: CodeChunk; file: FileRecord; score: number; found_by: RetrievalMethod[]; } export interface InvestigateResult { query: string; hits: InvestigateHit[]; budget_used: Record; } export interface InvestigateOptions { query: string; scope?: string; budget?: number; /** * When true, after the four base retrievers run, expand top-20 hits * one hop along typed edges (calls / documents / imports / extends) * and fuse the expansion as a 5th ranker. Bumps recall on multi-hop * questions ("everywhere auth state mutates") at small latency cost. * Default: false (P1-9 ships the capability, callers opt in until the * eval harness shows it's a strict improvement). */ expandGraph?: boolean; /** * When true, walk the file-import graph BACKWARD from the top base * hits up to depth 2 and add chunks from the heavily-imported parent * files (top-decile PageRank) to the candidate pool. Closes the * "god-file" recall failure that bench:swe v0.17 surfaced across * Express/NestJS/Prisma — central files (lib/router/index.js, * packages/core/injector/injector.ts, LibraryEngine.ts) that every * feature file imports but no individual query lexically matches. * Default: false (v0.18 ships behind the flag, eval harness measures * whether it's a strict improvement before the default flips). */ expandUpstream?: boolean; } /** * Multi-signal investigation: runs BM25, vector, symbol lookup, and reference * expansion in parallel then RRF-fuses them. Returns hits tagged with which * retriever(s) surfaced them, so the agent can see whether a result is * semantically + structurally agreed-upon or a single-signal outlier. */ export declare function runInvestigate(indexer: IndexFiles & IndexCode & IndexGraph, opts: InvestigateOptions): Promise; /** * Pull likely symbol candidates out of a natural-language query. Splits * camelCase / snake_case, drops stopwords and very short tokens. Returns * at most 6 to keep investigate bounded. */ export declare function extractSymbolTokens(query: string): string[]; /** * Format investigate results as a single text block. Mirrors the * formatResults shape from hybrid-search so agents get a consistent view. */ export declare function formatInvestigate(result: InvestigateResult, maxHits?: number): string; export type { SearchResult };