import type { SurfaceRegistry } from "../surfaces/registry.js";
import { type BrowserPerformanceMetrics, type BrowserPageSnapshot, type BrowserRuntimeEvent } from "../surfaces/browser.js";
export type PreviewStatus = "starting" | "ready" | "error" | "stopped";
export type PreviewMode = "local" | "docker" | "url";
export interface PreviewLogEntry {
    id: number;
    stream: "stdout" | "stderr" | "system";
    text: string;
    timestamp: string;
}
export interface PreviewSession {
    id: string;
    sessionId: string;
    projectRoot: string | null;
    mode: PreviewMode;
    status: PreviewStatus;
    target: string | null;
    command: string | null;
    port: number | null;
    url: string | null;
    browserId: string | null;
    processId: number | null;
    containerId: string | null;
    logs: PreviewLogEntry[];
    browserEvents: BrowserRuntimeEvent[];
    metrics: BrowserPerformanceMetrics | null;
    remoteBrowser: PreviewRemoteBrowserSession | null;
    lastError: string | null;
    createdAt: string;
    updatedAt: string;
}
export interface PreviewRemoteBrowserSession {
    containerName: string;
    novncUrl: string;
    vncPort: number;
    novncPort: number;
    startedAt: string;
}
export interface StartPreviewInput {
    sessionId: string;
    projectRoot?: string | null;
    target?: string | null;
    command?: string | null;
    port?: number | null;
    frameworkHint?: string | null;
}
export declare class PreviewService {
    private readonly surfaceRegistry;
    private readonly sessions;
    private nextLogId;
    private readonly runner;
    private _onSessionChanged;
    constructor(surfaceRegistry: SurfaceRegistry);
    onSessionChanged(callback: (session: PreviewSession) => void): void;
    private notifyChanged;
    start(input: StartPreviewInput): Promise<PreviewSession>;
    restart(sessionId: string): Promise<PreviewSession | null>;
    stop(sessionId: string): Promise<boolean>;
    get(sessionId: string): PreviewSession | null;
    refreshSessionCapture(sessionId: string): Promise<PreviewSession | null>;
    getLogs(sessionId: string, sinceId?: number): PreviewLogEntry[];
    list(): PreviewSession[];
    screenshot(sessionId: string): Promise<string | null>;
    snapshot(sessionId: string): Promise<string | null>;
    inspect(sessionId: string, selector?: string): Promise<{
        status: PreviewStatus;
        url: string | null;
        browserEvents: BrowserRuntimeEvent[];
        metrics: BrowserPerformanceMetrics | null;
        logs: PreviewLogEntry[];
        screenshot: string | null;
        page: BrowserPageSnapshot | null;
        snapshot: string | null;
        target?: import("../surfaces/browser.js").BrowserTargetDiagnostics | null;
    } | null>;
    stopAll(): Promise<void>;
    private ensureBrowser;
    private readLiveView;
    private readBrowserEvents;
    private inspectBrowserPage;
    private readBrowserMetrics;
    private formatInspectionSnapshot;
    private appendLog;
    private toPublicSession;
}
//# sourceMappingURL=preview.d.ts.map