export interface SessionStorageStat {
    size: number;
    mtimeMs: number;
    mtime: Date;
}
export interface SessionStorageWriter {
    /**
     * Append one newline-terminated line. File and memory storage perform the
     * write synchronously in-body; indexed backends queue in call order.
     *
     * `line` MUST include the trailing newline.
     */
    append(line: string): Promise<void>;
    /** Resolve once all queued appends complete. No fsync. */
    flush(): Promise<void>;
    /** False once close() has begun/finished. */
    isOpen(): boolean;
    close(): Promise<void>;
    getError(): Error | undefined;
}
export interface SessionStorage {
    ensureDirSync(dir: string): void;
    existsSync(path: string): boolean;
    writeTextSync(path: string, content: string): void;
    statSync(path: string): SessionStorageStat;
    listFilesSync(dir: string, pattern: string): string[];
    exists(path: string): Promise<boolean>;
    readText(path: string): Promise<string>;
    /** Read the requested UTF-8 byte windows from the head and tail of the file. */
    readTextSlices(path: string, prefixBytes: number, suffixBytes: number): Promise<[string, string]>;
    writeText(path: string, content: string): Promise<void>;
    writeTextAtomic(path: string, content: string): Promise<void>;
    rename(path: string, nextPath: string): Promise<void>;
    unlink(path: string): Promise<void>;
    deleteSessionWithArtifacts(sessionPath: string): Promise<void>;
    openWriter(path: string, options?: {
        flags?: "a" | "w";
        onError?: (err: Error) => void;
    }): SessionStorageWriter;
}
export declare class FileSessionStorage implements SessionStorage {
    #private;
    ensureDirSync(dir: string): void;
    existsSync(path: string): boolean;
    writeTextSync(fpath: string, content: string): void;
    statSync(path: string): SessionStorageStat;
    listFilesSync(dir: string, pattern: string): string[];
    exists(path: string): Promise<boolean>;
    readText(path: string): Promise<string>;
    readTextSlices(path: string, prefixBytes: number, suffixBytes: number): Promise<[string, string]>;
    writeText(path: string, content: string): Promise<void>;
    writeTextAtomic(fpath: string, content: string): Promise<void>;
    rename(path: string, nextPath: string): Promise<void>;
    unlink(path: string): Promise<void>;
    openWriter(path: string, options?: {
        flags?: "a" | "w";
        onError?: (err: Error) => void;
    }): SessionStorageWriter;
    /**
     * Delete a session file and its artifacts directory.
     * Artifacts are stored in a sibling directory with the same name minus .jsonl extension.
     */
    deleteSessionWithArtifacts(sessionPath: string): Promise<void>;
}
export declare class MemorySessionStorage implements SessionStorage {
    #private;
    ensureDirSync(_dir: string): void;
    existsSync(path: string): boolean;
    writeTextSync(path: string, content: string): void;
    /**
     * Internal O(1) append used by {@link MemorySessionStorageWriter}. Lazily
     * creates the entry. External callers should go through `openWriter()`
     * rather than touching the mirror directly.
     */
    appendSync(path: string, chunk: string): void;
    statSync(path: string): SessionStorageStat;
    listFilesSync(dir: string, pattern: string): string[];
    exists(path: string): Promise<boolean>;
    readText(path: string): Promise<string>;
    readTextSlices(path: string, prefixBytes: number, suffixBytes: number): Promise<[string, string]>;
    writeText(path: string, content: string): Promise<void>;
    writeTextAtomic(path: string, content: string): Promise<void>;
    rename(path: string, nextPath: string): Promise<void>;
    unlink(path: string): Promise<void>;
    deleteSessionWithArtifacts(_sessionPath: string): Promise<void>;
    openWriter(path: string, options?: {
        flags?: "a" | "w";
        onError?: (err: Error) => void;
    }): SessionStorageWriter;
}
