import { z } from 'zod';
import { type SourceIdentity } from './source-inline.js';
import { type CodebaseIndex, type CodeSkippedFile, type ContentMode, type IndexTruncation, type ParsedFile } from './types.js';
import type { OnProgress } from '../progress-event.js';
import { type CooperativeOption, type Yielder } from '../utils.js';
export declare const BudgetExceededBehaviorSchema: z.ZodEnum<{
    truncate: "truncate";
    throw: "throw";
}>;
export type BudgetExceededBehavior = z.infer<typeof BudgetExceededBehaviorSchema>;
export declare const BuildCodebaseOptionsSchema: z.ZodObject<{
    repoRoot: z.ZodString;
    excludeDir: z.ZodOptional<z.ZodArray<z.ZodString>>;
    noGitignore: z.ZodOptional<z.ZodBoolean>;
    ignorePatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
    overlayIgnorePatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
    contentMode: z.ZodOptional<z.ZodEnum<{
        none: "none";
        full: "full";
        excerpt: "excerpt";
    }>>;
    maxFileSizeBytes: z.ZodOptional<z.ZodNumber>;
    maxLines: z.ZodOptional<z.ZodNumber>;
    skipMinified: z.ZodOptional<z.ZodBoolean>;
    maxFiles: z.ZodOptional<z.ZodNumber>;
    maxBytes: z.ZodOptional<z.ZodNumber>;
    onBudgetExceeded: z.ZodOptional<z.ZodEnum<{
        truncate: "truncate";
        throw: "throw";
    }>>;
    parseConcurrency: z.ZodOptional<z.ZodNumber>;
    typescriptChecker: z.ZodOptional<z.ZodEnum<{
        preferred: "preferred";
        required: "required";
        disabled: "disabled";
    }>>;
}, z.core.$strip>;
export type BuildCodebaseOptions = z.infer<typeof BuildCodebaseOptionsSchema> & {
    cooperative?: CooperativeOption;
};
/**
 * Default fan-out for parseCodeFiles. parseCodeFile is async I/O (stat + read)
 * followed by a synchronous CPU parse; a small worker pool hides the I/O
 * latency while bounding the memory held by in-flight file contents.
 * worker_threads are explicitly out of scope: each worker would pay the
 * typescript module load cost (dwarfing small incremental updates) and
 * full-mode payloads would pay structured-clone overhead;
 * buildCodebaseIndexIsolated already provides process-level isolation.
 */
export declare const DEFAULT_PARSE_CONCURRENCY: number;
export declare const ParseCodeFilesOptionsSchema: z.ZodObject<{
    repoRoot: z.ZodString;
    contentMode: z.ZodOptional<z.ZodEnum<{
        none: "none";
        full: "full";
        excerpt: "excerpt";
    }>>;
    maxFileSizeBytes: z.ZodOptional<z.ZodNumber>;
    maxLines: z.ZodOptional<z.ZodNumber>;
    skipMinified: z.ZodOptional<z.ZodBoolean>;
    concurrency: z.ZodOptional<z.ZodNumber>;
    typescriptChecker: z.ZodOptional<z.ZodEnum<{
        preferred: "preferred";
        required: "required";
        disabled: "disabled";
    }>>;
}, z.core.$strip>;
export type ParseCodeFilesOptions = z.infer<typeof ParseCodeFilesOptionsSchema>;
export interface ParseCodeFilesResult {
    parsedFiles: ParsedFile[];
    skippedFiles: CodeSkippedFile[];
    /** Parsed working-tree byte identities, keyed by repository-relative path. */
    sourceIdentities: ReadonlyMap<string, SourceIdentity>;
}
export interface AssembleCodebaseIndexInput {
    repoRoot: string;
    contentMode: ContentMode;
    parsedFiles: ParsedFile[];
    skippedFiles: CodeSkippedFile[];
    truncated?: IndexTruncation;
}
export interface CodeIndexBudget {
    maxFiles?: number;
    maxBytes?: number;
    totalFiles: number;
    totalBytes: number;
}
export declare class CodeIndexBudgetExceededError extends Error {
    readonly name = "CodeIndexBudgetExceededError";
    readonly code = "OCC_CODE_INDEX_BUDGET_EXCEEDED";
    readonly budget: CodeIndexBudget;
    constructor(budget: CodeIndexBudget);
}
/**
 * Pre-parse stat snapshot for a file retained by the build. Structurally
 * compatible with the incremental manifest entry shape. Captured BEFORE
 * parsing, so an edit made while the build is running diverges from the
 * recorded stat and is detected by the next freshness check.
 */
export interface BuildFileStat {
    relativePath: string;
    size: number;
    mtimeMs: number;
    /** Present only when the pre-parse size and the bytes actually parsed agree. */
    sha256?: string;
}
export interface BuildCodebaseResult {
    index: CodebaseIndex;
    /** Stats for the budgeted file set, keyed for manifest reuse by stores. */
    fileStats: BuildFileStat[];
}
/**
 * Parse `files` with bounded concurrency. Both result arrays are returned in
 * input order (per-slot results are compacted after the pool drains).
 * Content-mode reduction happens at parse time, while content is still in
 * memory — excerpt extraction needs the full source text.
 */
export declare function parseCodeFiles(files: string[], options: ParseCodeFilesOptions, onProgress?: OnProgress, signal?: AbortSignal, yielder?: Yielder): Promise<ParseCodeFilesResult>;
export declare function buildCodebaseIndex(options: BuildCodebaseOptions, onProgress?: OnProgress, signal?: AbortSignal): Promise<CodebaseIndex>;
/**
 * Like {@link buildCodebaseIndex}, but also returns the pre-parse stat
 * snapshot of the budgeted file set so callers persisting a freshness
 * manifest don't have to re-stat every file after the build.
 */
export declare function buildCodebaseIndexWithStats(options: BuildCodebaseOptions, onProgress?: OnProgress, signal?: AbortSignal): Promise<BuildCodebaseResult>;
export declare function assembleCodebaseIndex(input: AssembleCodebaseIndexInput, onProgress?: OnProgress, signal?: AbortSignal): CodebaseIndex;
export declare function assembleCodebaseIndexCooperative(input: AssembleCodebaseIndexInput, yielder: Yielder, onProgress?: OnProgress, signal?: AbortSignal): Promise<CodebaseIndex>;
