/**
 * `OtlpFileTraceStore` — read-only OTLP-JSONL trace store for the
 * trace-analyst.
 *
 * Wire shape. Each line of the input file is one OTLP-shaped span. The
 * store understands flattened OTLP JSONL plus the OpenInference vocab.
 * We project upstream's full
 * span shape down to `TraceAnalystSpan` lazily — full materialisation
 * only happens for the spans the agent actually requests.
 *
 * Indexing. On first read the store builds an in-memory index keyed
 * by `trace_id` carrying:
 *   - byte offsets + lengths for each span line (for surgical reads
 *     without re-parsing the whole file)
 *   - a `TraceAnalystTraceSummary` rollup
 *   - sets of services / agents / models / tools / has_errors
 *   - byte size of the trace's JSONL slab
 *
 * Memory bound. The index keeps span metadata only — names, kinds,
 * offsets, status. Attribute payloads stay on disk until requested.
 * For a 50MB JSONL with 50k spans, the index is ~5MB.
 *
 * Concurrency. The store builds the index once on first read and
 * caches it. Subsequent reads reuse the index. The file is opened on
 * each read; we never hold a long-lived FD.
 */
import { NotFoundError } from '../errors';
import { type TraceAnalysisStore } from './store';
import { type DatasetOverview, type QueryTracesPage, type SearchSpanResult, type SearchTraceResult, type TraceAnalystFilters, type ViewSpansResult, type ViewTraceResult } from './types';
export interface OtlpFileTraceStoreOptions {
    /** Path to the OTLP-JSONL file. */
    path: string;
    /** Override the discovery (`viewTrace`) per-attribute byte cap. */
    perAttributeViewBudget?: number;
    /** Override the surgical (`viewSpans`) per-attribute byte cap. */
    perAttributeSpanBudget?: number;
    /** Override the per-call ceiling that triggers oversized summaries. */
    perCallByteCeiling?: number;
    /** Override the per-match text budget. */
    perMatchTextBudget?: number;
    /**
     * Hard ceiling on the trace file size in bytes. The store reads the
     * whole file into one Buffer and indexes it in memory, so an
     * unbounded file OOMs the process. Above this size the store fails
     * loud with `TraceFileTooLargeError` instead of degrading silently.
     * Default 256 MiB.
     */
    maxFileBytes?: number;
}
/** Default ceiling for {@link OtlpFileTraceStoreOptions.maxFileBytes}. */
export declare const DEFAULT_MAX_TRACE_FILE_BYTES: number;
export declare class OtlpFileTraceStore implements TraceAnalysisStore {
    private readonly path;
    private readonly perAttributeViewBudget;
    private readonly perAttributeSpanBudget;
    private readonly perCallByteCeiling;
    private readonly perMatchTextBudget;
    private readonly maxFileBytes;
    private indexPromise?;
    /** Cached UTF-8 buffer of the file. We pin it once because every
     *  read needs slice access and re-reading on each call balloons the
     *  syscall count. */
    private bufferPromise?;
    constructor(opts: OtlpFileTraceStoreOptions);
    getOverview(filters?: TraceAnalystFilters): Promise<DatasetOverview>;
    queryTraces(opts: {
        filters?: TraceAnalystFilters;
        limit: number;
        offset?: number;
    }): Promise<QueryTracesPage>;
    countTraces(filters?: TraceAnalystFilters): Promise<number>;
    viewTrace(opts: {
        trace_id: string;
        per_attribute_byte_cap?: number;
    }): Promise<ViewTraceResult>;
    viewSpans(opts: {
        trace_id: string;
        span_ids: readonly string[];
        per_attribute_byte_cap?: number;
    }): Promise<ViewSpansResult>;
    searchTrace(opts: {
        trace_id: string;
        regex_pattern: string;
        max_matches?: number;
    }): Promise<SearchTraceResult>;
    searchSpan(opts: {
        trace_id: string;
        span_id: string;
        regex_pattern: string;
        max_matches?: number;
    }): Promise<SearchSpanResult>;
    /** Force the index to materialise. Useful to amortise startup cost
     *  before the first agent call. */
    ensureIndexed(): Promise<void>;
    private buffer;
    /** Stat-then-read so an oversized file fails loud BEFORE we allocate a
     *  multi-hundred-MB Buffer and OOM the process. A missing file surfaces
     *  as TraceFileMissingError; any other stat/read error propagates. */
    private readGuarded;
    private index;
    private buildIndex;
    private matchedTraces;
    private toSummary;
    private projectSpan;
    private buildOversizedSummary;
    private scanSpanForMatches;
}
export declare class TraceFileMissingError extends NotFoundError {
    constructor(path: string);
}
export declare class TraceFileTooLargeError extends Error {
    readonly path: string;
    readonly size_bytes: number;
    readonly max_bytes: number;
    constructor(path: string, size_bytes: number, max_bytes: number);
}
export declare class TraceNotFoundError extends NotFoundError {
    readonly trace_id: string;
    constructor(trace_id: string);
}
export declare class SpanNotFoundError extends NotFoundError {
    readonly trace_id: string;
    readonly span_id: string;
    constructor(trace_id: string, span_id: string);
}
//# sourceMappingURL=store-otlp.d.ts.map