import type { FsStat, DirentEntry, DirentStatEntry, WalkEntry, MkdirOptions, RmOptions, CpOptions, ReadFileRangeOptions, ReadFileLinesOptions, ReadFileLinesResult, SearchOptions, ChunkSearchResult, BlobChunk, BackfillChunksResult, IndexChunkEmbeddingsResult } from "./types.js"; import { FsWriteOpsBase } from "./filesystem/base/write-ops.js"; import { filesystemOpsContext } from "./filesystem/ops/context.js"; import type { FilesystemOpsContext } from "./filesystem/ops/context.js"; import { type FilesystemOpsApi } from "./filesystem/ops/index.js"; export declare class PgFileSystem extends FsWriteOpsBase { [filesystemOpsContext](): FilesystemOpsContext; init(): Promise; /** * One read that tells whether init() would change nothing: the version * root, the labeled version, and a root entry owned by that version all * exist (the full path's root insert would hit ON CONFLICT DO NOTHING). * Apps that init() on every request skip a write transaction with a * no-op insert. Writable top-level instances with rootDir "/" only: a * read-only init() must keep failing with EPERM, a rootDir also needs its * directory created, and a fork that doesn't own a root row yet gets one. * Any failure here falls through to the full path and its errors. */ private isAlreadyInitialized; dispose(): Promise; readFile(path: string, _options?: { encoding?: string | null; } | string): Promise; /** Coalesces concurrent `readFile` fetches; see `Coalescer`. */ private readonly fileReads; private internalReadFile; /** * Turn a fetched row into file content, with readFile's checks in order: * missing/tombstone, symlink (followed from here, against `tx` when given), * directory, `maxReadSize`. */ private contentOfReadRow; /** * `fetchReadRow` for many paths in one round-trip, keyed by the requested * internal path. Same shape as resolveEntries (DISTINCT ON over the * MATERIALIZED path lookup) plus the blob join. Lone reads use * `fetchReadRow` and its tighter plan (the coalescer routes them there). */ private fetchReadRows; private fetchReadRow; readFileRange(path: string, options?: ReadFileRangeOptions): Promise; private internalReadFileRange; readFileLines(path: string, options?: ReadFileLinesOptions): Promise; private internalReadFileLines; /** * The stored chunk-level index rows for a file, in document order (empty * when the file's blob has no chunks — e.g. chunking was off when it was * written and `backfillChunks()` hasn't run). Line ranges address the * file's current content 1-indexed, so a chunk hydrates via * `readFileLines(path, { offset: startLine, limit: endLine - startLine + 1 })`. */ readFileChunks(path: string): Promise; private internalReadFileChunks; /** * resolveEntry + the entry's chunk rows in one statement (chunks only for * a file). `chunks` is null when they weren't fetched: a database without * `fs_blob_chunks` takes resolveEntry alone here, so a missing path or a * directory still fails with ENOENT/EISDIR before the chunk query raises * the setup error, as it did when these were two statements. */ private fetchEntryWithChunks; /** * Chunk every text blob that predates the `chunking` option: blobs * visible at this instance's current version (the same depth-resolved * projection the searches use — shadowed blobs and other versions' content * don't count) that have no chunk rows yet. Honors the instance's * excludes/mounts. Content-addressed, so it never re-chunks and is safe * to re-run; runs in one transaction. Requires the `chunking` option, * since the rows it writes must match what the write path would produce. */ backfillChunks(): Promise; /** * Embed every distinct chunk content visible at this instance's current * version that misses the per-content embedding cache * (`fs_chunk_embeddings`), in batches through the injected `embed`. * Version-scoped like every other operation on the handle — the target * flow is `fork("crawl")` → writes → `branch.indexChunkEmbeddings()` → * `promoteTo("main")`, so main is fully indexed the moment it becomes * visible and stale or abandoned versions never cost an embedding call. * Honors the instance's excludes/mounts. Content-addressed on top: an * edit to one section of a ten-section page costs one embedding call — * the other nine cache-hit (the cache itself stays workspace-wide and * append-only, which is what makes promotion free). Safe to re-run. */ indexChunkEmbeddings(): Promise; /** * Like `rethrowMissingChunkTable`, but for the embedding cache: the table * only ships when setup() runs with vector search enabled. */ private rethrowMissingEmbeddingTable; readFileBuffer(path: string): Promise; private internalReadFileBuffer; writeFile(path: string, content: string | Uint8Array, _options?: { encoding?: string; } | string): Promise; appendFile(path: string, content: string | Uint8Array, _options?: { encoding?: string; } | string): Promise; exists(path: string): Promise; stat(path: string): Promise; lstat(path: string): Promise; realpath(path: string): Promise; private internalRealpath; mkdir(path: string, options?: MkdirOptions): Promise; readdir(path: string): Promise; readdirWithFileTypes(path: string): Promise; readdirWithStats(path: string): Promise; walk(path: string): Promise; rm(path: string, options?: RmOptions): Promise; cp(src: string, dest: string, options?: CpOptions): Promise; mv(src: string, dest: string): Promise; chmod(path: string, mode: number): Promise; utimes(path: string, _atime: Date, mtime: Date): Promise; symlink(target: string, linkPath: string): Promise; link(existingPath: string, newPath: string): Promise; readlink(path: string): Promise; resolvePath(base: string, path: string): string; getAllPaths(): string[]; /** * Whether an `embed` option was injected — `semanticSearch()`, * `hybridSearch()` and `indexChunkEmbeddings()` work. Lets a host that * receives a configured handle (e.g. the `semgrep` command factory) pick * the strongest search the handle supports. */ get hasEmbedder(): boolean; /** * BM25 lexical search. Requires the full-text-search setup * (`enableFullTextSearch`). */ textSearch(query: string, opts?: SearchOptions): Promise; /** * Vector search over the per-content embedding cache (filled by * `indexChunkEmbeddings()`). Nearest-neighbor: always ranks something, so * irrelevant queries return low-rank hits, not nothing. The query is * embedded through the `embed` option (a single-item batch). Requires the * vector setup (`enableVectorSearch`). */ semanticSearch(query: string, opts?: SearchOptions): Promise; /** * The BM25 and vector rankings fused with reciprocal-rank fusion — an * exact rare token and a synonym-only paraphrase each still surface, and * chunks not yet embedded stay reachable through the lexical side. * Requires both the full-text-search and vector setups. */ hybridSearch(query: string, opts?: SearchOptions): Promise; /** The shared wrapper: read guard, scope mapping, missing-schema stories. */ private runChunkSearch; glob(pattern: string, opts?: { cwd?: string; }): Promise; } export interface PgFileSystem extends FilesystemOpsApi { } //# sourceMappingURL=filesystem.d.ts.map