import { type CodeIndexStore, type StoreStrategy } from '../code/store.js';
import { type CodeChunk, type CodeChunkOptions } from '../code/chunk.js';
import { type DocumentChunk, type DocumentChunkOptions } from '../doc/chunk.js';
import { type CooperativeOption } from '../utils.js';
import type { CodebaseIndex, ContentMode, TypeScriptCheckerMode } from '../code/types.js';
import type { CodebaseIndexSlim } from '../code/slim.js';
import type { CodebaseSizePreview } from '../code/preview.js';
import type { OnProgress } from '../progress-event.js';
import type { WorkspaceAnalysis, WorkspaceDescription, WorkspaceDocumentSet } from './types.js';
export interface WorkspaceBundleOptions {
    excludeDir?: string[];
    noGitignore?: boolean;
    ignorePatterns?: string[];
    overlayIgnorePatterns?: string[];
    largeFileLimitMb?: number;
    includeDescription?: boolean;
    includeAnalysis?: boolean;
    includeDocuments?: boolean;
    includeCode?: boolean;
    includeDocumentChunks?: boolean;
    includeCodeChunks?: boolean;
    includeCorpusChunks?: boolean;
    includeCodeDocumentReferences?: boolean;
    includeDataFiles?: boolean;
    /**
     * When code chunks are requested, read each indexed file on demand to produce
     * chunks instead of forcing the retained code index to `contentMode: 'full'`.
     * Defaults to false for backward-compatible memory/cache behavior.
     */
    streamCodeChunks?: boolean;
    contentMode?: ContentMode;
    /** TypeScript semantic-resolution policy. Defaults to `preferred`. */
    typescriptChecker?: TypeScriptCheckerMode;
    slimCodeIndex?: boolean;
    maxDocumentFiles?: number;
    maxReferenceFiles?: number;
    maxCodeFiles?: number;
    maxCodeBytes?: number;
    maxDocumentChunks?: number;
    maxCodeChunks?: number;
    maxCorpusChunks?: number;
    maxCodeDocumentReferences?: number;
    chunk?: Pick<DocumentChunkOptions, 'maxTokens' | 'overlapTokens' | 'countTokens'>;
    codeChunk?: Pick<CodeChunkOptions, 'maxTokens' | 'overlapTokens' | 'countTokens' | 'files'>;
    /**
     * Persistent code-index cache directory. When set (and no `store` is
     * provided), the bundle resolves its code index through
     * `openCodeIndexStore` instead of `buildCodebaseIndexIsolated`: cache hits
     * skip parsing entirely, and cache misses build **in-process** (no
     * subprocess isolation — this is an explicit opt-in). Cache entries are
     * keyed by `(contentMode, build-option fingerprint)`, so the bundle options
     * must match the consumer's own store options to share an entry — when in
     * doubt, pass `store` directly (recommended).
     */
    cacheDir?: string;
    /** Store strategy used with `cacheDir`/`store` (default `'ensure-fresh'`). */
    cacheStrategy?: StoreStrategy;
    /**
     * Bring-your-own code index store. Takes precedence over `cacheDir`; the
     * bundle never disposes a caller-provided store.
     */
    store?: CodeIndexStore;
    /**
     * Run the description / analysis / documents / code phases concurrently
     * (default `true`). `false` restores the literal sequential path.
     */
    concurrentPhases?: boolean;
    /**
     * Yield to the host event loop during CPU-bound in-process bundle work
     * (cache-backed code build/assembly, chunking, reference detection, slim).
     * `true` uses the default cadence; an object can tune it and observe yields.
     */
    cooperative?: CooperativeOption;
    /**
     * Run the entire bundle in a forked child process so OCC CPU work does not
     * execute on the caller's event loop. Caller-provided `store` instances
     * cannot cross the process boundary.
     */
    offThread?: boolean;
    signal?: AbortSignal;
    onProgress?: OnProgress;
}
export interface WorkspaceOutlineNode {
    id: string;
    kind: 'root' | 'project' | 'module' | 'document' | 'section';
    title: string;
    path?: string;
    metrics?: Record<string, number | string | boolean>;
    children: WorkspaceOutlineNode[];
}
export interface WorkspaceCodeDocumentReference {
    documentPath: string;
    symbolName: string;
    symbolType: string;
    symbolPath: string;
    symbolLine?: number;
    line: number;
    context: string;
}
export interface WorkspaceCorpusChunk {
    kind: 'code' | 'document';
    chunkId: string;
    filePath: string;
    relativePath: string;
    title: string;
    content: string;
    chunkIndex: number;
    startLine?: number;
    endLine?: number;
    language?: string;
    format?: string;
    headingPath?: string[];
    anchor?: string;
    symbolNames?: string[];
    symbolTypes?: string[];
    tokenEstimate?: number;
    wordCount?: number;
}
export interface WorkspaceBundle {
    schemaVersion: 1;
    rootDir: string;
    generatedAt: string;
    description?: WorkspaceDescription;
    analysis?: WorkspaceAnalysis;
    documents?: WorkspaceDocumentSet;
    codePreview?: CodebaseSizePreview;
    codeIndex?: CodebaseIndex | CodebaseIndexSlim;
    documentChunks?: DocumentChunk[];
    codeChunks?: CodeChunk[];
    corpusChunks?: WorkspaceCorpusChunk[];
    outline: WorkspaceOutlineNode;
    codeDocumentReferences: WorkspaceCodeDocumentReference[];
    errors: Array<{
        scope: string;
        path?: string;
        message: string;
    }>;
}
export declare function bundleWorkspaceIsolated(rootDir: string, options?: WorkspaceBundleOptions, onProgress?: OnProgress): Promise<WorkspaceBundle>;
export declare function bundleWorkspace(rootDir: string, options?: WorkspaceBundleOptions): Promise<WorkspaceBundle>;
