import type { ExternalAnalyzerResults, AnalyzerLeadProvenance } from "audit-tools/shared"; import type { GraphBundle } from "audit-tools/shared"; export type FileAnchorKind = "boundary" | "import" | "export" | "symbol" | "route" | "keyword" | "graph" | "analyzer_signal"; export interface FileAnchor { kind: FileAnchorKind; name: string; line?: number; /** * Approximate END line of a `symbol`-kind anchor's body (increment 2d, * `path::symbol` slicing). Computed deterministically as the line before the * next top-level declaration boundary (`symbol`/`route` start), clamped to the * file's line count — a lightweight, language-neutral, brace-agnostic extent * (no nesting awareness). Advisory ONLY: it seeds a targeted symbol-span read * so a worker need not re-read a whole god-file, but the worker always * fail-safes to reading more when evidence crosses the span. Present only on * `symbol` anchors that have a `line`; absent everywhere else. */ end_line?: number; detail?: string; /** * Content-anchored lead identity (item C), present only on `analyzer_signal` * anchors whose source signal carried one. Rendered into the packet prompt so * the worker can copy it verbatim into `analyzer_provenance` on a finding * born from this lead. */ provenance?: AnalyzerLeadProvenance; } export interface FileAnchorSummary { contract_version: "audit-code-file-anchors/v1alpha1"; path: string; total_lines: number; review_mode: "isolated_large_file"; scope_basis: string[]; anchors: FileAnchor[]; omitted_anchor_count: number; counts: { symbols: number; routes: number; keywords: number; graph_edges: number; analyzer_signals: number; }; } /** * Path-keyed index of external-analyzer signal anchors (rule/line/summary), * built ONCE per dispatch from the whole `externalAnalyzerResults` set so * per-task/per-file prompt rendering is an O(1) map read rather than an * O(tasks × files × total-results) re-flatten. Key = normalized lowercased * path; each bucket is pre-sorted by (line_start, id), matching the original * per-path ordering. See {@link analyzerSignalAnchorsForPath} for the reader. */ export type AnalyzerSignalAnchorIndex = Map; export declare function buildAnalyzerSignalAnchorIndex(externalAnalyzerResults: ExternalAnalyzerResults[] | undefined): AnalyzerSignalAnchorIndex; /** * External-analyzer signal anchors (rule/line/summary) for one path — an O(1) * read of the pre-built {@link AnalyzerSignalAnchorIndex}. Split out of * {@link buildFileAnchorSummary} so packet-level prompt rendering (any * multi-file packet, not just isolated-large-file mode) can surface the same * grounded lead detail without paying for whole-file content scanning. */ export declare function analyzerSignalAnchorsForPath(path: string, index: AnalyzerSignalAnchorIndex | undefined): FileAnchor[]; export declare function buildFileAnchorSummary(params: { path: string; content: string; totalLines: number; graphBundle?: GraphBundle; externalAnalyzerResults?: ExternalAnalyzerResults[]; }): FileAnchorSummary; //# sourceMappingURL=fileAnchors.d.ts.map