/** * Disk-backed adapter for the code-anchored memory engine. * (change: add-code-anchored-memory-staleness) * * Bridges the pure {@link ./anchor.ts} engine to the running project: it reads * the call graph from the edge store and function/file source from disk to supply * {@link AnchorNode}s (for resolution) and a {@link GraphFreshnessView} (for * verdicts). All operations are deterministic static analysis — no LLM. * * File buffers are read once and cached per operation; an anchor set touches only * a handful of files, so this stays cheap. The freshness-view builder is exported * standalone ({@link makeFreshnessView}) so callers that already hold an open * edge store (e.g. orient) can reuse it instead of opening a second handle. */ import { EdgeStore } from '../services/edge-store.js'; import type { StructuralAnchor, GroundingCertificate } from '../../types/index.js'; import { type AnchorNode, type GraphFreshnessView } from './anchor.js'; /** * Build a {@link GraphFreshnessView} over an already-open edge store + disk. The * view carries its own short-lived file cache. No rename map by default — a * missing symbol is `orphaned` unless the caller supplies `renameOf`. */ export declare function makeFreshnessView(store: EdgeStore, rootPath: string, renameOf?: (nodeId: string) => string | undefined): GraphFreshnessView; export declare class AnchorContext { private readonly store; private readonly rootPath; private fileCache; private constructor(); /** Open the adapter, or return null when no analysis (edge store) exists yet. */ static open(rootPath: string): AnchorContext | null; close(): void; private spanHash; /** Build resolvable {@link AnchorNode}s for every internal node in the given files. */ anchorNodesForFiles(files: readonly string[]): AnchorNode[]; /** Current whole-file content hash, or undefined when the file is gone. */ fileContentHash(filePath: string): string | undefined; /** A {@link GraphFreshnessView} backed by this adapter's edge store + disk. */ freshnessView(): GraphFreshnessView; /** * Build a grounding certificate for an anchor — the evidence behind a `fresh` * verdict (add-trust-calibrated-context-economy). For a symbol anchor it is the * node's symbol/file/line-span and the *current* span hash (the same hash the * freshness check compared); for a relocated symbol it follows the stable id; * for a file anchor it is the file path and whole-file hash. Returns undefined * when the anchored ground can no longer be located (caller only builds these * for `fresh` facts, where it resolves). No new extraction beyond the span hash * the freshness check already computes. */ certificateForAnchor(anchor: StructuralAnchor): GroundingCertificate | undefined; /** * The current span hash AND 1-based inclusive line range of a node, computed * from its code-unit offsets against the live file (the edge store keeps * offsets, not lines). Reuses the same span — and the same {@link sliceNodeSpan} * — that the freshness hash covers, so `contentHash` here equals the hash the * freshness check compared, and the cited line range matches the hashed span. */ private nodeSpanInfo; /** * Resolve anchors for a decision: symbol-level anchors for any function in the * affected files whose name is mentioned verbatim in the decision text, plus a * file-level anchor (with a captured baseline hash) for each affected file. */ resolveDecisionAnchors(affectedFiles: readonly string[], text: string): StructuralAnchor[]; /** * Resolve caller-supplied anchor hints (for `remember`). Each hint may name a * symbol and/or a file. A symbol that resolves to exactly one node becomes a * symbol anchor; otherwise the file (if given) becomes a file anchor. */ resolveInputAnchors(hints: ReadonlyArray<{ symbol?: string; file?: string; }>): StructuralAnchor[]; } /** Whole-word, case-sensitive mention test for a symbol name in free text. */ export declare function isNamedIn(text: string, name: string): boolean; //# sourceMappingURL=anchor-adapter.d.ts.map