import type { ActResult, AgentConfig, AgentExecuteOptions, AgentResult, ExtractResult, ObserveResult, LogLine, StagehandMetrics, BrowserbaseRegion, ActOptions, ExtractOptions, ObserveOptions, Api } from "./types/public/index.js";
import type { SerializableResponse, AgentCacheTransferPayload } from "./types/private/index.js";
import type { StagehandZodSchema } from "./zodCompat.js";
/**
 * Mapping of Browserbase regions to their corresponding Stagehand API base URLs.
 * Users should configure their client to hit the API endpoint that matches
 * the region where their browser session is running.
 */
export declare const REGION_API_URLS: Record<BrowserbaseRegion, string>;
/**
 * Returns the full API URL (with /v1 suffix) for a given Browserbase region.
 * If no region is specified or the region is unknown, defaults to us-west-2.
 *
 * @param region - The Browserbase region (e.g., "us-west-2", "eu-central-1")
 * @returns The full API URL including /v1 suffix
 */
export declare function getApiUrlForRegion(region: BrowserbaseRegion | undefined): string;
/**
 * Constructor parameters for StagehandAPIClient
 */
interface StagehandAPIConstructorParams {
    apiKey: string;
    projectId: string;
    logger: (message: LogLine) => void;
    /**
     * When true, enables server-side caching by default for all requests.
     * When false, disables server-side caching.
     * Defaults to true (caching enabled).
     * Can be overridden per-method in act(), extract(), and observe() options.
     */
    serverCache?: boolean;
}
/**
 * Parameters for starting a session via the API client.
 * Extends Api.SessionStartRequest with client-specific field (modelApiKey).
 *
 * Wire format: Api.SessionStartRequest (modelApiKey sent via header, not body)
 */
interface ClientSessionStartParams extends Api.SessionStartRequest {
    /** Model API key - sent via x-model-api-key header, not in request body */
    modelApiKey: string;
}
/**
 * Client parameters for act() method.
 * Derives structure from Api.ActRequest but uses SDK's ActOptions (which includes `page`).
 * Before serialization, `page` is stripped to produce Api.ActRequest wire format.
 */
interface ClientActParameters {
    input: Api.ActRequest["input"];
    options?: ActOptions;
    frameId?: Api.ActRequest["frameId"];
}
/**
 * Client parameters for extract() method.
 * Derives structure from Api.ExtractRequest but uses SDK's ExtractOptions (which includes `page`)
 * and accepts Zod schema (converted to JSON schema for wire format).
 */
interface ClientExtractParameters {
    instruction?: Api.ExtractRequest["instruction"];
    schema?: StagehandZodSchema;
    options?: ExtractOptions;
    frameId?: Api.ExtractRequest["frameId"];
}
/**
 * Client parameters for observe() method.
 * Derives structure from Api.ObserveRequest but uses SDK's ObserveOptions (which includes `page`).
 * Before serialization, `page` is stripped to produce Api.ObserveRequest wire format.
 */
interface ClientObserveParameters {
    instruction?: Api.ObserveRequest["instruction"];
    options?: ObserveOptions;
    frameId?: Api.ObserveRequest["frameId"];
}
export declare class StagehandAPIClient {
    private apiKey;
    private projectId;
    private sessionId?;
    private modelApiKey;
    private modelProvider?;
    private region?;
    private logger;
    private fetchWithCookies;
    private serverCache;
    private lastFinishedEventData;
    private latestAgentCacheEntry;
    constructor({ apiKey, projectId, logger, serverCache, }: StagehandAPIConstructorParams);
    init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: ClientSessionStartParams): Promise<Api.SessionStartResult>;
    act({ input, options, frameId, }: ClientActParameters): Promise<ActResult>;
    extract<T extends StagehandZodSchema>({ instruction, schema: zodSchema, options, frameId, }: ClientExtractParameters): Promise<ExtractResult<T>>;
    observe({ instruction, options, frameId, }: ClientObserveParameters): Promise<ObserveResult>;
    goto(url: string, options?: Api.NavigateRequest["options"], frameId?: string): Promise<SerializableResponse | null>;
    agentExecute(agentConfig: AgentConfig, executeOptions: AgentExecuteOptions | string, frameId?: string, shouldCache?: boolean): Promise<AgentResult>;
    consumeLatestAgentCacheEntry(): AgentCacheTransferPayload | null;
    end(): Promise<Response>;
    getReplayMetrics(): Promise<StagehandMetrics>;
    /**
     * Prepares a model configuration for the API payload by ensuring the `apiKey`
     * is included. If the model is passed as a string, converts it to an object
     * with `modelName` and `apiKey`.
     *
     * In API mode, we only attempt to load an API key from env vars when the
     * model provider differs from the one used to init the session.
     */
    private prepareModelConfig;
    private consumeFinishedEventData;
    private execute;
    /**
     * Resolves the final cache status from the response header or SSE event data,
     * logs it, and attaches it to act/extract results before returning.
     */
    private attachCacheStatus;
    /**
     * Determine if caching should be enabled for a request.
     * Method-level setting takes precedence over instance-level setting.
     */
    private shouldUseCache;
    private request;
}
export {};
