import type { AtomicTextRange, SemanticChunker, TextChunk } from '../chunker/index.js'; import { type EmbedderInterface } from '../chunker/semantic-chunker.js'; import type { ParseResult } from '../parser/index.js'; import type { ImageRendition } from '../pdf-visual/types.js'; import { type SourceContext, type SourceMap } from '../utils/source-context.js'; import type { VectorChunk, VisualAttachment } from '../vectordb/index.js'; /** `embeddings` has the same length as `chunks`, index for index. */ export interface BuildChunksAndEmbeddingsResult { chunks: (TextChunk & { sourceContext?: SourceContext; })[]; embeddings: number[][]; } export interface BuildChunksFromParseResultResult extends BuildChunksAndEmbeddingsResult { visualAttachments: Map; omittedImageCount: number; } export declare function findNearestChunk(chunks: readonly TextChunk[], sourceOffset: number): TextChunk | undefined; export declare function createVisualAttachment(imageIndex: number, rendition: ImageRendition): VisualAttachment; /** * Compute semantic chunks and their embeddings for already-extracted text. * * Does not fail fast on zero chunks — the MCP handler throws, the CLI warns * and returns 0. Chunker and embedder errors propagate verbatim. */ export declare function buildChunksAndEmbeddings(text: string, chunker: SemanticChunker, embedder: EmbedderInterface, options?: { sourceMap?: SourceMap | undefined; atomicRanges?: readonly AtomicTextRange[] | undefined; title?: string | null | undefined; }): Promise; /** * Preserve the parser content/range mapping at one shared boundary. The title * affects embeddings only when the embedder opts into the title prefix. */ export declare function buildChunksFromParseResult(result: ParseResult, chunker: SemanticChunker, embedder: EmbedderInterface): Promise; /** * Content identity of a source file: SHA-256 of its raw BYTES, not of the * parsed text, so any caller that can read the file reproduces it — which is * what lets a later sync decide "unchanged" without re-parsing. */ export declare function computeContentHash(bytes: Uint8Array): string; /** * Build persistable `VectorChunk`s from computed chunks + embeddings — the * single chunk→row mapping for both the MCP handler and both CLI paths. One * shared `timestamp` per call, a fresh `id`, and `fileName`/`fileType` derived * with `node:path` so they hold on Windows. * * Throws when a chunk has no embedding; the two arrays must align 1:1. * * `contentHash` is `null` for a chunk set with no source file, and the key is * then omitted rather than stored empty, so a hashless row is never mistaken * for a real hash. Required, not optional, so a new call site cannot silently * write hashless rows. * * `visualProfile` is the requested visual intent of this ingestion, copied to * every row. It accepts `null`/`undefined` and then omits the optional property, * so a caller holding a nullable value can pass it directly under * `exactOptionalPropertyTypes` and a caller with no visual concept can omit it. */ export declare function buildVectorChunks(params: { filePath: string; chunks: (TextChunk & { sourceContext?: SourceContext; })[]; embeddings: number[][]; fileTitle: string | null; contentHash: string | null; visualAttachments?: ReadonlyMap; visualProfile?: string | null; }): VectorChunk[]; //# sourceMappingURL=compute.d.ts.map