/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Tab } from './tab';
import type * as playwrightTypes from '../../..';
import type { SessionLog } from './sessionLog';
import type { ToolCapability } from './tool';
export type ContextConfig = {
    allowUnrestrictedFileAccess?: boolean;
    capabilities?: ToolCapability[];
    codegen?: 'typescript' | 'none';
    console?: {
        level?: 'error' | 'warning' | 'info' | 'debug';
    };
    imageResponses?: 'allow' | 'omit';
    network?: {
        allowedOrigins?: string[];
        blockedOrigins?: string[];
    };
    outputDir?: string;
    outputMode?: 'file' | 'stdout';
    saveSession?: boolean;
    saveTrace?: boolean;
    secrets?: Record<string, string>;
    snapshot?: {
        mode?: 'full' | 'none';
    };
    testIdAttribute?: string;
    timeouts?: {
        action?: number;
        navigation?: number;
        expect?: number;
    };
    browser?: {
        initScript?: string[];
        initPage?: string[];
    };
    skillMode?: boolean;
};
type ContextOptions = {
    config: ContextConfig;
    sessionLog?: SessionLog;
    cwd: string;
};
export type RouteEntry = {
    pattern: string;
    status?: number;
    body?: string;
    contentType?: string;
    addHeaders?: Record<string, string>;
    removeHeaders?: string[];
    handler: (route: playwrightTypes.Route) => Promise<void>;
};
export type FilenameTemplate = {
    prefix: string;
    ext: string;
    suggestedFilename?: string;
    date?: Date;
};
type VideoParams = {
    size?: {
        width: number;
        height: number;
    };
};
export declare class Context {
    readonly config: ContextConfig;
    readonly sessionLog: SessionLog | undefined;
    readonly options: ContextOptions;
    private _rawBrowserContext;
    private _browserContextPromise;
    private _tabs;
    private _currentTab;
    private _routes;
    private _video;
    private _disposables;
    private _runningToolName;
    private _pendingUnhandledRejections;
    private _unhandledRejectionListeners;
    private _onUnhandledRejection;
    constructor(browserContext: playwrightTypes.BrowserContext, options: ContextOptions);
    dispose(): Promise<void>;
    drainPendingUnhandledRejections(): unknown[];
    onUnhandledRejection(listener: (reason: unknown) => void): () => void;
    debugger(): playwrightTypes.Debugger;
    tabs(): Tab[];
    currentTab(): Tab | undefined;
    currentTabOrDie(): Tab;
    newTab(): Promise<Tab>;
    selectTab(index: number): Promise<Tab>;
    ensureTab(): Promise<Tab>;
    closeTab(index: number | undefined): Promise<string>;
    workspaceFile(fileName: string, perCallWorkspaceDir: string | undefined): Promise<string>;
    outputFile(template: FilenameTemplate, options: {
        origin: 'code' | 'llm';
    }): Promise<string>;
    startVideoRecording(fileName: string, params: VideoParams): Promise<void>;
    stopVideoRecording(): Promise<string[]>;
    private _startPageVideo;
    private _onPageCreated;
    private _onPageClosed;
    routes(): RouteEntry[];
    addRoute(entry: RouteEntry): Promise<void>;
    removeRoute(pattern?: string): Promise<number>;
    isRunningTool(): boolean;
    setRunningTool(name: string | undefined): void;
    private _setupRequestInterception;
    ensureBrowserContext(): Promise<playwrightTypes.BrowserContext>;
    private _initializeBrowserContext;
    checkUrlAllowed(url: string): void;
    lookupSecret(secretName: string): {
        value: string;
        code: string;
    };
}
export declare function workspaceFile(options: ContextOptions, fileName: string, perCallWorkspaceDir?: string): Promise<string>;
export declare function outputDir(options: ContextOptions): string;
export declare function outputFile(options: ContextOptions, fileName: string, flags: {
    origin: 'code' | 'llm';
}): Promise<string>;
export {};
//# sourceMappingURL=context.d.ts.map