import { z } from 'zod';
import type { ChunkStrategy, ContentType } from './config-schema.js';
/**
 * A single chunk produced by any chunker.
 * This is the unit that gets embedded and stored.
 */
export interface Chunk {
    /** The text content to embed */
    content: string;
    /** Contextual prefix prepended before embedding */
    contextPrefix: string;
    /** Source file path (relative to project root) */
    filePath: string;
    /** Content type for metadata filtering */
    type: ContentType;
    /** Chunking strategy that produced this chunk */
    strategy: ChunkStrategy;
    /** Human-readable identifier (function name, heading path, etc.) */
    label: string;
    /** Start line in original file (1-indexed) */
    startLine: number;
    /** End line in original file (1-indexed) */
    endLine: number;
    /** Optional structured metadata (frontmatter fields, etc.) */
    metadata: Record<string, string>;
}
/**
 * A stored record in LanceDB — chunk + its embedding vector.
 */
export interface StoredChunk {
    id: string;
    content: string;
    contextPrefix: string;
    filePath: string;
    type: string;
    strategy: string;
    label: string;
    startLine: number;
    endLine: number;
    metadata: string;
    vector: number[];
}
/**
 * Source context for a LanceStore — identifies which repository the store's
 * results originate from and where on disk that repository lives. Injected
 * at LanceStore construction time and stamped onto every SearchResult via
 * `rowToSearchResult` in the search hot path.
 *
 * Used by mmnto/totem#1294 (Cross-Repo Context Mesh) so agents receiving
 * federated results can distinguish between primary-repo and linked-repo
 * hits, and so they have an absolute path for `Read` tool calls without
 * having to reason about which repo root to resolve `filePath` against.
 */
export interface SourceContext {
    /**
     * Semantic identifier for the source repo. `undefined` for the primary
     * store (local repo); set to the linked-index name for cross-repo hits
     * (e.g., `'strategy'`). Safe to display in agent-facing formatters.
     */
    sourceRepo?: string;
    /**
     * Absolute filesystem path to the root of the repository that owns this
     * store. Used to resolve `filePath` (which is stored relative to this
     * root) into `absoluteFilePath` on every SearchResult.
     */
    absolutePathRoot: string;
}
/**
 * Result returned from a search query.
 */
export interface SearchResult {
    content: string;
    contextPrefix: string;
    /**
     * File path relative to the source repository root. Unchanged from the
     * pre-mmnto/totem#1294 shape — kept for display, lesson-linking, and
     * incremental-sync purposes.
     */
    filePath: string;
    /**
     * Absolute on-disk path to the source file, computed by joining
     * `filePath` with the owning LanceStore's `absolutePathRoot`. Always
     * populated, even for primary-store results. Agents should prefer this
     * for `Read` / `Edit` tool calls; `filePath` is for display.
     *
     * mmnto/totem#1294 rationale: the context window is hostile to agents.
     * Relative paths invite hallucinated tool calls that resolve against the
     * wrong repo root. An explicit absolute path eliminates that class of
     * error at the cost of a few extra bytes per result.
     */
    absoluteFilePath: string;
    /**
     * Semantic tag identifying the source repo. `undefined` for primary-store
     * hits; set to the linked-index name (e.g., `'strategy'`) for federated
     * cross-repo hits. Safe to display in agent-facing formatters to
     * disambiguate local from cross-repo results.
     */
    sourceRepo?: string;
    type: ContentType;
    label: string;
    score: number;
    metadata: Record<string, string>;
}
/**
 * Options for the sync operation.
 */
export interface SyncOptions {
    /** Project root directory (where totem.config.ts lives) */
    projectRoot: string;
    /** If true, only process files changed since last sync */
    incremental: boolean;
    /** If provided, only sync files matching these changed paths */
    changedFiles?: string[];
    /** Callback for progress reporting */
    onProgress?: (message: string) => void;
}
/**
 * Persisted state for incremental sync tracking.
 */
export interface SyncState {
    lastSyncSha: string;
    timestamp: number;
    /**
     * Order-normalized content hash of the effective index-exclusion set
     * (`ignorePatterns` ∪ `indexIgnorePatterns`) at the last sync. A change on the
     * next incremental sync means the patterns moved — including a REMOVAL, which
     * the git-diff window cannot surface — so the newly-eligible files are
     * re-enqueued (mmnto-ai/totem#2366). Optional: absent in state written before
     * #2366; readers treat absence as a mismatch (benign — the enqueue is
     * near-empty for an up-to-date index).
     */
    indexExclusionHash?: string;
}
/**
 * Options for search queries.
 */
export interface SearchOptions {
    query: string;
    typeFilter?: ContentType;
    maxResults?: number;
    /** When true, combines vector + FTS results using RRF reranking. Requires an FTS index. */
    hybrid?: boolean;
    /** File path prefix(es) to restrict results to an architectural boundary. Accepts a single prefix or an array for multi-prefix partitions. */
    boundary?: string | string[];
}
/**
 * Result of a health check against the LanceDB index.
 */
export interface HealthCheckResult {
    healthy: boolean;
    durationMs: number;
    totalChunks: number;
    expectedDimensions: number;
    storedDimensions: number | null;
    dimensionMatch: boolean;
    canarySearchOk: boolean;
    ftsAvailable: boolean;
    issues: string[];
}
export declare const LessonRoleSchema: z.ZodEnum<["mutator", "boundary", "aggregator", "hot-path", "boundary-test", "infrastructure", "presentation", "any"]>;
export type LessonRole = z.infer<typeof LessonRoleSchema>;
export declare const LessonFrontmatterSchema: z.ZodObject<{
    type: z.ZodDefault<z.ZodLiteral<"trap">>;
    category: z.ZodOptional<z.ZodEnum<["security", "architecture", "performance", "style"]>>;
    severity: z.ZodDefault<z.ZodEnum<["error", "warning"]>>;
    tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
    scope: z.ZodOptional<z.ZodObject<{
        globs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
    }, "strip", z.ZodTypeAny, {
        globs?: string[] | undefined;
    }, {
        globs?: string[] | undefined;
    }>>;
    appliesTo: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodEnum<["mutator", "boundary", "aggregator", "hot-path", "boundary-test", "infrastructure", "presentation", "any"]>, "many">, ("mutator" | "boundary" | "aggregator" | "hot-path" | "boundary-test" | "infrastructure" | "presentation" | "any")[], unknown>>;
    ecosystem: z.ZodOptional<z.ZodObject<{
        frameworks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
        version: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        version?: string | undefined;
        frameworks?: string[] | undefined;
    }, {
        version?: string | undefined;
        frameworks?: string[] | undefined;
    }>>;
    lifecycle: z.ZodDefault<z.ZodEnum<["nursery", "stable", "deprecated"]>>;
    rpn: z.ZodOptional<z.ZodNumber>;
    compilation: z.ZodOptional<z.ZodObject<{
        engine: z.ZodOptional<z.ZodEnum<["regex", "ast", "ast-grep"]>>;
        pattern: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
    }, "strip", z.ZodTypeAny, {
        pattern?: string | Record<string, unknown> | undefined;
        engine?: "regex" | "ast" | "ast-grep" | undefined;
    }, {
        pattern?: string | Record<string, unknown> | undefined;
        engine?: "regex" | "ast" | "ast-grep" | undefined;
    }>>;
}, "strip", z.ZodTypeAny, {
    type: "trap";
    severity: "error" | "warning";
    tags: string[];
    appliesTo: ("mutator" | "boundary" | "aggregator" | "hot-path" | "boundary-test" | "infrastructure" | "presentation" | "any")[];
    lifecycle: "nursery" | "stable" | "deprecated";
    category?: "security" | "architecture" | "style" | "performance" | undefined;
    scope?: {
        globs?: string[] | undefined;
    } | undefined;
    ecosystem?: {
        version?: string | undefined;
        frameworks?: string[] | undefined;
    } | undefined;
    rpn?: number | undefined;
    compilation?: {
        pattern?: string | Record<string, unknown> | undefined;
        engine?: "regex" | "ast" | "ast-grep" | undefined;
    } | undefined;
}, {
    type?: "trap" | undefined;
    category?: "security" | "architecture" | "style" | "performance" | undefined;
    severity?: "error" | "warning" | undefined;
    tags?: string[] | undefined;
    scope?: {
        globs?: string[] | undefined;
    } | undefined;
    appliesTo?: unknown;
    ecosystem?: {
        version?: string | undefined;
        frameworks?: string[] | undefined;
    } | undefined;
    lifecycle?: "nursery" | "stable" | "deprecated" | undefined;
    rpn?: number | undefined;
    compilation?: {
        pattern?: string | Record<string, unknown> | undefined;
        engine?: "regex" | "ast" | "ast-grep" | undefined;
    } | undefined;
}>;
export type LessonFrontmatter = z.infer<typeof LessonFrontmatterSchema>;
//# sourceMappingURL=types.d.ts.map