import { CdpClient, type CdpClientOptions } from "./cdp-client.js";
import type { BrowserContentResult, BrowserNavigateResult, BrowserScreenshotResult, BrowserSessionMeta, CdpReachability } from "./types.js";
import { type CostClass, type EvidenceStore, type SideFileWriteResult } from "@oscharko-dev/keiko-contracts";
export type BrowserEventKind = "session-opened" | "navigated" | "screenshot-captured" | "page-content-captured" | "session-closed" | "trust-warning" | "error";
export interface BrowserEventEnvelope {
    readonly schemaVersion: "1";
    readonly type: `browser:${BrowserEventKind}`;
    readonly runId: string;
    readonly fingerprint: string;
    readonly seq: number;
    readonly ts: number;
    readonly kind: BrowserEventKind;
    readonly sessionId: string;
    readonly payload: Readonly<Record<string, unknown>>;
}
export type BrowserEventEmitter = (event: BrowserEventEnvelope) => void;
export type BrowserSideFileWriter = (basename: string, bytes: Buffer, runId: string) => SideFileWriteResult;
export interface BrowserSessionManagerOptions {
    readonly evidenceDir: string;
    readonly evidenceStore?: EvidenceStore | undefined;
    readonly redactor?: (value: unknown) => unknown;
    readonly cdpClientFactory?: (url: string, opts: CdpClientOptions) => CdpClient;
    readonly fetchVersion?: (url: string) => Promise<unknown>;
    readonly costClassResolver?: (modelId: string) => CostClass | "unknown";
    readonly sideFileWriter?: BrowserSideFileWriter;
    readonly idleTtlMs?: number;
    readonly nowMs?: () => number;
}
export interface BrowserSessionManager {
    readonly checkStatus: (cdpPort: number) => Promise<CdpReachability>;
    readonly openSession: (cdpPort: number) => Promise<BrowserSessionMeta>;
    readonly closeSession: (sessionId: string) => Promise<void>;
    readonly navigate: (sessionId: string, url: string) => Promise<BrowserNavigateResult>;
    readonly screenshot: (sessionId: string) => Promise<BrowserScreenshotResult>;
    readonly applyScreenshot: (sessionId: string, captureSeq: number) => Promise<BrowserScreenshotResult>;
    readonly content: (sessionId: string) => Promise<BrowserContentResult>;
    readonly listSessionIds: () => readonly string[];
    readonly hasSession: (sessionId: string) => boolean;
    readonly dispose: () => Promise<void>;
    readonly subscribe: (sessionId: string, listener: BrowserEventEmitter) => () => void;
    readonly counterAccessor: () => {
        readonly navigations: number;
    };
}
export declare function createBrowserSessionManager(options: BrowserSessionManagerOptions): BrowserSessionManager;
//# sourceMappingURL=session.d.ts.map