import type { ReadableSpan, SpanExporter } from '../types.js';
/** Configuration for LocalLedgerExporter. */
export interface LocalLedgerConfig {
    /**
     * Absolute path to the output file (e.g. `/home/user/.goodvibes/telemetry/spans.jsonl`).
     */
    readonly filePath: string;
    /**
     * Maximum file size in bytes before rotation.
     * When the file exceeds this size, it is renamed to `<filePath>.1` and a
     * fresh file is started. Defaults to 10 MB.
     */
    readonly maxFileSizeBytes?: number;
    /**
     * Optional path for the typed event ledger file.
     * When provided, `recordEvent()` appends `LedgerEntry` lines here.
     * Defaults to `<filePath>.ledger.jsonl`.
     */
    readonly ledgerFilePath?: string;
}
/**
 * A single typed event entry in the replay ledger.
 *
 * Each entry captures the run identifier, a monotonically increasing
 * revision counter, the event name, payload, and wall-clock timestamp.
 * The revision counter is used by the deterministic replay engine for
 * seek and stepwise playback.
 */
export interface LedgerEntry {
    /** Run identifier — groups entries belonging to the same recorded run. */
    readonly runId: string;
    /** Monotonically increasing revision counter within the run (starts at 1). */
    readonly rev: number;
    /** Event name recorded in the typed runtime ledger. */
    readonly eventName: string;
    /** Full event payload, JSON-serialisable. */
    readonly payload: unknown;
    /** Wall-clock timestamp (epoch ms) when the event was recorded. */
    readonly ts: number;
}
/**
 * LocalLedgerExporter — writes spans as JSON lines to a rotating file.
 *
 * Usage:
 * ```ts
 * const exporter = new LocalLedgerExporter({
 *   filePath: '/home/user/.goodvibes/telemetry/spans.jsonl',
 *   maxFileSizeBytes: 5 * 1024 * 1024,
 * });
 * ```
 */
export declare class LocalLedgerExporter implements SpanExporter {
    readonly name = "local-ledger";
    private readonly filePath;
    private readonly maxFileSizeBytes;
    private readonly ledgerFilePath;
    constructor(config: LocalLedgerConfig);
    /**
     * Export a batch of spans as JSON lines (fire-and-forget).
     *
     * Intentionally not awaited by the tracer — failures are swallowed here
     * and logged to avoid any runtime impact.
     */
    export(spans: ReadableSpan[]): Promise<void>;
    /**
     * Record a typed event entry to the ledger file (fire-and-forget).
     *
     * Used by the deterministic replay engine to build a per-run event log.
     * Failures are logged but never thrown.
     *
     * @param entry - The ledger entry to append.
     *
     * @remarks
     * This method is used by the event recording integration that
     * wires typed runtime events to the ledger. The integration subscribes to the
     * runtime bus at session start and calls `recordEvent()` for each event that should
     * be included in the replay ledger. See `DeterministicReplayEngine.load()`
     * for the consumer side of this pipeline.
     */
    recordEvent(entry: LedgerEntry): void;
    /**
     * Read all ledger entries for a given run.
     *
     * Parses the ledger file line-by-line. Malformed lines are skipped.
     * Returns entries sorted by revision (ascending).
     *
     * @param runId - The run to retrieve entries for.
     * @returns Ordered ledger entries for the run.
     */
    readRunEntries(runId: string): LedgerEntry[];
    /**
     * List all run IDs recorded in the ledger.
     */
    listRunIds(): string[];
    /** Flush is a no-op for synchronous append-only writes. */
    flush(): Promise<void>;
    /** Shutdown is a no-op for file-based exports. */
    shutdown(): Promise<void>;
    /**
     * Rotate the log file if it exceeds the configured maximum size.
     * Renames the current file to `<filePath>.1` (overwrites any existing `.1`).
     */
    private _rotateIfNeeded;
}
//# sourceMappingURL=local-ledger.d.ts.map