import type { TotemConfig } from '../config-schema.js'; import type { DistanceMetric } from '../store/relevance.js'; import type { SyncOptions } from '../types.js'; /** * Verify that the current embedding config matches the index. * Throws TotemDatabaseError if there's a mismatch. */ /** * Verify that the current embedding config matches the index. * Compares provider name only — dimensions are checked at sync time * when the actual embedder resolves its effective dimensions. * Throws TotemDatabaseError if the provider has changed. */ export declare function verifyIndexMeta(totemDir: string, config: TotemConfig): void; /** * Whether a full re-index epoch is in progress (its dirty marker exists) for * the given totem dir (#2562). Exposed for callers that spawn or gate syncs * under bounded budgets — e.g. the MCP add-lesson tool's 60s-killed * convenience sync, which a promoted paced resume can never finish * (falsification round 3, MAJOR 1): such callers should skip and defer to the * running epoch instead of timing out against it. */ export declare function hasFullSyncCheckpoint(totemDir: string): boolean; /** * One entry in the index-manifest `documents[]` array. * * `lastSynced` is the time the manifest itself was written, not a per-document * sync timestamp — LanceDB rows do not currently carry per-row sync timestamps, * so every document in a single manifest carries the same `lastSynced` value * (equal to `IndexManifest.writtenAt`). Treat it as a manifest-level signal, * not as per-document staleness data. */ export interface ManifestDocument { sourceFile: string; /** * Pack name (`@scope/pkg` or `pkg`) when the source file lives under * `node_modules/`; otherwise `local`. Derived from path structure only; * never from filename- or path-identity matches. */ origin: string; rowCount: number; /** See `ManifestDocument` doc-comment — this is manifest-write time, not per-doc sync time. */ lastSynced: string; } /** * Persisted contents of `.totem/index-manifest.json`. * * Schema is versioned via {@link INDEX_MANIFEST_SCHEMA}. Consumers (e.g. the * `totem-status` Visor TUI) read this file to enumerate indexed documents * without needing the LanceDB Go/CGO bindings. * * `gitCommit` carries `git:` when a HEAD SHA is available at sync time. * The field is OMITTED entirely when no git SHA is available — never * synthesized as a fake-presence value (Tenet 14: honest absence over fake * presence; identity hashes must not masquerade as content hashes). */ export interface IndexManifest { schema: string; writtenAt: string; documents: ManifestDocument[]; gitCommit?: string; /** * The distance metric every vector query against this index is issued with * (mmnto-ai/totem#2738) — a recorded fact, so a future metric change is * visible in the artifact instead of silently re-scaling every relevance. * OPTIONAL because manifests written before #2738 do not carry it; readers * must tolerate its absence rather than treating it as a schema breach. */ vectorDistanceMetric?: DistanceMetric; } /** Current schema identifier persisted to `.totem/index-manifest.json`. */ export declare const INDEX_MANIFEST_SCHEMA = "totem-index-manifest-v0.2"; /** * Builds an {@link IndexManifest} payload from the per-document data and the * sync run's HEAD SHA + write timestamp. * * - `writtenAt` is serialized to ISO-8601. * - `gitCommit` is included as `git:` only when `input.headSha` is a * non-empty string; null / undefined / `''` cause the field to be omitted * entirely (no `sha1:unknown` or other synthesized fake-presence values). * - `schema` is always set to {@link INDEX_MANIFEST_SCHEMA}. * - `vectorDistanceMetric` is always set to {@link VECTOR_DISTANCE_METRIC} * (mmnto-ai/totem#2738) — the metric the store's vector queries are issued * with, recorded so it is not left implicit in an SDK default. * * Pure helper — does not touch the filesystem. The sync pipeline is * responsible for atomic write/rename of the returned payload. */ export declare function buildIndexManifest(input: { documents: ManifestDocument[]; headSha: string | null | undefined; writtenAt: Date; }): IndexManifest; export declare function runSync(config: TotemConfig, options: SyncOptions): Promise<{ chunksProcessed: number; filesProcessed: number; totalChunks: number; orphansPurged: number; }>; /** * Reconcile indexed paths against the working tree: an indexed path with no live * counterpart is an orphan to purge (mmnto-ai/totem#2151). Compares on a * separator-normalized key but RETURNS THE RAW indexed path (the caller deletes * via `deleteByFile`, a stored-literal match). Independent of the git diff * window — that independence is what self-heals deletions the baseline already * advanced past, and de-targeted / newly-ignored files git never reports. */ export declare function computeOrphanPaths(indexedRawPaths: string[], liveRelativePaths: string[]): string[]; /** * Order-normalized content hash of the effective index-exclusion set * (`ignorePatterns` ∪ `indexIgnorePatterns`). Patterns are sorted before hashing * so reordering the config is not a spurious mismatch — only a membership change * (a pattern added or removed) moves the hash. Persisted in sync state to detect * ignore-pattern REMOVALS between incremental syncs (mmnto-ai/totem#2366), which * the git-diff window alone never surfaces. Uses the one deterministic-hash * convention shared with run artifacts. */ export declare function hashIndexExclusionSet(patterns: string[]): string; /** * Files that are index-eligible now but absent from the index — the symmetric * complement of {@link computeOrphanPaths} (mmnto-ai/totem#2366). Removing an * ignore pattern makes files eligible without changing their bytes, so the git * diff window never reports them; this recovers them by membership alone * (live-vs-indexed), independent of the diff. Compares on a separator-normalized * key like the orphan pass but RETURNS THE RAW live relative path (the caller * re-embeds via the resolved file record). */ export declare function computeNewlyEligiblePaths(liveRelativePaths: string[], indexedRawPaths: string[]): string[]; //# sourceMappingURL=pipeline.d.ts.map