/** * On-disk store plumbing for the RVF MCP server: data-dir path confinement * and the per-store metadata log. * * Vectors live in a real `.rvf` file (via @ruvector/rvf). The native backend * does not store per-vector metadata, so the server keeps it beside the store * in `.mcp-meta.jsonl`: a header line, then `["s",id,metadata]` / * `["d",id]` ops. It is rewritten (temp file + rename) on close/compact and * whenever the appended tail outgrows the last rewrite. */ export type Metadata = Record; export declare const META_SUFFIX = ".mcp-meta.jsonl"; /** Default data directory: $RVF_MCP_DATA_DIR, else ~/.rvf-mcp-server. */ export declare function defaultDataDir(): string; /** * Resolve a model-supplied store path inside `dataDir`. * * Tool arguments are untrusted: absolute paths, `..` segments, NUL bytes and * symlinks that lead outside the data dir are all rejected, and containment * is checked before anything is created. With `create`, missing * intermediate directories are then made inside the data dir. */ export declare function resolveStorePath(dataDir: string, storePath: string, create: boolean): string; export interface MetaHeader { dimensions: number; metric: string; } /** Metadata for one store, persisted as an append-only log. */ export declare class MetadataLog { readonly file: string; private readonly readOnly; readonly entries: Map; header: MetaHeader | null; private bytes; private compactedBytes; constructor(file: string, readOnly: boolean); /** Load the log if present. A torn final line (crash mid-append) is ignored. */ load(): void; private parse; /** Record new metadata (or its removal) for ids, then persist. */ apply(sets: Array<[string, Metadata]>, deletes: string[]): void; /** Rewrite the log as header + current entries (atomic). */ rewrite(): void; } /** True when `meta` matches every field of `filter` exactly. */ export declare function matchesFilter(meta: Metadata | undefined, filter: Metadata): boolean; /** * The distance metric an open `.rvf` file was created with, read from the * native store. @ruvector/rvf has no public accessor for it yet, so this asks * the native handle directly and returns undefined if that is unavailable. */ export declare function storedMetric(db: unknown): string | undefined; /** * Native per-vector metadata field holding the vector's string id. The * @ruvector/rvf string-id map lives in a `.idmap.json` sidecar; with * the id also inside the `.rvf`, a store copied without that sidecar still * answers with (and filters by) the original ids. */ export declare const ID_FIELD = "rvf_mcp_id"; /** True when neither the id-map snapshot nor its journal is beside `file`. */ export declare function idMapMissing(file: string): boolean; export declare function missingIdMapError(storePath: string): Error;