import { type Browser, type Page } from 'puppeteer-core'; import { ServiceBubble } from '../../../types/service-bubble-class.js'; import type { BubbleContext } from '../../../types/bubble.js'; import { CredentialType } from '@bubblelab/shared-schemas'; import { type BrowserBaseParamsInput, type BrowserBaseResult } from './browserbase.schema.js'; /** * Active browser session stored in memory */ interface ActiveSession { sessionId: string; contextId: string; browser: Browser; page: Page; connectUrl: string; startTime: number; } /** * BrowserBase Service Bubble * * Provides browser automation capabilities using BrowserBase cloud browsers. * Supports session management, navigation, clicking, typing, JavaScript * execution, content extraction, screenshots, and cookie management. * * Features: * - Cloud-based browser sessions (BrowserBase) * - Session persistence via context IDs * - Cookie injection for authenticated sessions * - Full page automation (click, type, evaluate) * - Screenshot and content extraction * - Stealth mode for anti-bot avoidance * - Automatic CAPTCHA solving * - Proxy support (built-in and custom) * * Stealth Mode: * - Basic Stealth: Automatic fingerprint randomization * - Advanced Stealth: Custom Chromium for better anti-bot avoidance (Scale Plan) * - CAPTCHA Solving: Automatic detection and solving (enabled by default) * * Proxy Options: * - Built-in proxies: Residential proxies with geolocation support * - Custom proxies: Use your own HTTP/HTTPS proxies * - Routing rules: Route different domains through different proxies * * Use cases: * - Automated shopping workflows (Amazon, etc.) * - Web scraping with authentication * - Form automation and submission * - Browser-based testing * * Security Features: * - Sessions are isolated in BrowserBase cloud * - Credentials are handled securely * - Sessions are properly closed and cleaned up */ export declare class BrowserBaseBubble extends ServiceBubble> { static readonly type: "service"; static readonly service = "browserbase"; static readonly authType: "apikey"; static readonly bubbleName = "browserbase"; static readonly schema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"start_session">; context_id: import("zod").ZodOptional; cookies: import("zod").ZodOptional, "many">>; viewport_width: import("zod").ZodDefault>; viewport_height: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; proxies: import("zod").ZodOptional, import("zod").ZodArray; geolocation: import("zod").ZodOptional; state: import("zod").ZodOptional; country: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { country: string; city?: string | undefined; state?: string | undefined; }, { country: string; city?: string | undefined; state?: string | undefined; }>>; domainPattern: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { type: "browserbase"; geolocation?: { country: string; city?: string | undefined; state?: string | undefined; } | undefined; domainPattern?: string | undefined; }, { type: "browserbase"; geolocation?: { country: string; city?: string | undefined; state?: string | undefined; } | undefined; domainPattern?: string | undefined; }>, import("zod").ZodObject<{ type: import("zod").ZodLiteral<"external">; server: import("zod").ZodString; username: import("zod").ZodOptional; password: import("zod").ZodOptional; domainPattern: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { type: "external"; server: string; password?: string | undefined; username?: string | undefined; domainPattern?: string | undefined; }, { type: "external"; server: string; password?: string | undefined; username?: string | undefined; domainPattern?: string | undefined; }>]>, "many">]>>; stealth: import("zod").ZodOptional>; solveCaptchas: import("zod").ZodDefault>; captchaImageSelector: import("zod").ZodOptional; captchaInputSelector: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { advancedStealth: boolean; solveCaptchas: boolean; captchaImageSelector?: string | undefined; captchaInputSelector?: string | undefined; }, { advancedStealth?: boolean | undefined; solveCaptchas?: boolean | undefined; captchaImageSelector?: string | undefined; captchaInputSelector?: string | undefined; }>>; timeout_seconds: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { operation: "start_session"; viewport_width: number; viewport_height: number; credentials?: Partial> | undefined; stealth?: { advancedStealth: boolean; solveCaptchas: boolean; captchaImageSelector?: string | undefined; captchaInputSelector?: string | undefined; } | undefined; cookies?: { value: string; path: string; name: string; domain: string; expires: number; httpOnly: boolean; secure: boolean; }[] | undefined; context_id?: string | undefined; proxies?: true | ({ type: "browserbase"; geolocation?: { country: string; city?: string | undefined; state?: string | undefined; } | undefined; domainPattern?: string | undefined; } | { type: "external"; server: string; password?: string | undefined; username?: string | undefined; domainPattern?: string | undefined; })[] | undefined; timeout_seconds?: number | undefined; }, { operation: "start_session"; credentials?: Partial> | undefined; stealth?: { advancedStealth?: boolean | undefined; solveCaptchas?: boolean | undefined; captchaImageSelector?: string | undefined; captchaInputSelector?: string | undefined; } | undefined; cookies?: { value: string; path: string; name: string; domain: string; expires: number; httpOnly: boolean; secure: boolean; }[] | undefined; context_id?: string | undefined; viewport_width?: number | undefined; viewport_height?: number | undefined; proxies?: true | ({ type: "browserbase"; geolocation?: { country: string; city?: string | undefined; state?: string | undefined; } | undefined; domainPattern?: string | undefined; } | { type: "external"; server: string; password?: string | undefined; username?: string | undefined; domainPattern?: string | undefined; })[] | undefined; timeout_seconds?: number | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"navigate">; session_id: import("zod").ZodString; url: import("zod").ZodString; wait_until: import("zod").ZodDefault>>; timeout: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { timeout: number; url: string; operation: "navigate"; session_id: string; wait_until: "load" | "domcontentloaded" | "networkidle0" | "networkidle2"; credentials?: Partial> | undefined; }, { url: string; operation: "navigate"; session_id: string; credentials?: Partial> | undefined; timeout?: number | undefined; wait_until?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"click">; session_id: import("zod").ZodString; selector: import("zod").ZodString; wait_for_navigation: import("zod").ZodDefault>; timeout: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { timeout: number; operation: "click"; session_id: string; selector: string; wait_for_navigation: boolean; credentials?: Partial> | undefined; }, { operation: "click"; session_id: string; selector: string; credentials?: Partial> | undefined; timeout?: number | undefined; wait_for_navigation?: boolean | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"type">; session_id: import("zod").ZodString; selector: import("zod").ZodString; text: import("zod").ZodString; clear_first: import("zod").ZodDefault>; delay: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { text: string; operation: "type"; session_id: string; selector: string; delay: number; clear_first: boolean; credentials?: Partial> | undefined; }, { text: string; operation: "type"; session_id: string; selector: string; credentials?: Partial> | undefined; delay?: number | undefined; clear_first?: boolean | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"select">; session_id: import("zod").ZodString; selector: import("zod").ZodString; value: import("zod").ZodString; timeout: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { value: string; timeout: number; operation: "select"; session_id: string; selector: string; credentials?: Partial> | undefined; }, { value: string; operation: "select"; session_id: string; selector: string; credentials?: Partial> | undefined; timeout?: number | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"evaluate">; session_id: import("zod").ZodString; script: import("zod").ZodString; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { script: string; operation: "evaluate"; session_id: string; credentials?: Partial> | undefined; }, { script: string; operation: "evaluate"; session_id: string; credentials?: Partial> | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_content">; session_id: import("zod").ZodString; selector: import("zod").ZodOptional; content_type: import("zod").ZodDefault>>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "get_content"; session_id: string; content_type: "text" | "html" | "outer_html"; credentials?: Partial> | undefined; selector?: string | undefined; }, { operation: "get_content"; session_id: string; credentials?: Partial> | undefined; content_type?: "text" | "html" | "outer_html" | undefined; selector?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"screenshot">; session_id: import("zod").ZodString; selector: import("zod").ZodOptional; full_page: import("zod").ZodDefault>; format: import("zod").ZodDefault>>; quality: import("zod").ZodOptional; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { format: "png" | "webp" | "jpeg"; operation: "screenshot"; session_id: string; full_page: boolean; credentials?: Partial> | undefined; quality?: number | undefined; selector?: string | undefined; }, { operation: "screenshot"; session_id: string; format?: "png" | "webp" | "jpeg" | undefined; credentials?: Partial> | undefined; quality?: number | undefined; selector?: string | undefined; full_page?: boolean | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"wait">; session_id: import("zod").ZodString; wait_type: import("zod").ZodEnum<["selector", "timeout", "navigation"]>; selector: import("zod").ZodOptional; timeout: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { timeout: number; operation: "wait"; session_id: string; wait_type: "timeout" | "selector" | "navigation"; credentials?: Partial> | undefined; selector?: string | undefined; }, { operation: "wait"; session_id: string; wait_type: "timeout" | "selector" | "navigation"; credentials?: Partial> | undefined; timeout?: number | undefined; selector?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_cookies">; session_id: import("zod").ZodString; domain_filter: import("zod").ZodOptional; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "get_cookies"; session_id: string; credentials?: Partial> | undefined; domain_filter?: string | undefined; }, { operation: "get_cookies"; session_id: string; credentials?: Partial> | undefined; domain_filter?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"end_session">; session_id: import("zod").ZodString; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "end_session"; session_id: string; credentials?: Partial> | undefined; }, { operation: "end_session"; session_id: string; credentials?: Partial> | undefined; }>]>; static readonly resultSchema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"start_session">; success: import("zod").ZodBoolean; session_id: import("zod").ZodOptional; context_id: import("zod").ZodOptional; debug_url: import("zod").ZodOptional; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "start_session"; session_id?: string | undefined; context_id?: string | undefined; debug_url?: string | undefined; }, { error: string; success: boolean; operation: "start_session"; session_id?: string | undefined; context_id?: string | undefined; debug_url?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"navigate">; success: import("zod").ZodBoolean; url: import("zod").ZodOptional; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "navigate"; url?: string | undefined; }, { error: string; success: boolean; operation: "navigate"; url?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"click">; success: import("zod").ZodBoolean; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "click"; }, { error: string; success: boolean; operation: "click"; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"type">; success: import("zod").ZodBoolean; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "type"; }, { error: string; success: boolean; operation: "type"; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"select">; success: import("zod").ZodBoolean; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "select"; }, { error: string; success: boolean; operation: "select"; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"evaluate">; success: import("zod").ZodBoolean; result: import("zod").ZodOptional; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "evaluate"; result?: unknown; }, { error: string; success: boolean; operation: "evaluate"; result?: unknown; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_content">; success: import("zod").ZodBoolean; content: import("zod").ZodOptional; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "get_content"; content?: string | undefined; }, { error: string; success: boolean; operation: "get_content"; content?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"screenshot">; success: import("zod").ZodBoolean; data: import("zod").ZodOptional; format: import("zod").ZodOptional; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "screenshot"; format?: string | undefined; data?: string | undefined; }, { error: string; success: boolean; operation: "screenshot"; format?: string | undefined; data?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"wait">; success: import("zod").ZodBoolean; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "wait"; }, { error: string; success: boolean; operation: "wait"; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_cookies">; success: import("zod").ZodBoolean; cookies: import("zod").ZodOptional, "many">>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "get_cookies"; cookies?: { value: string; path: string; name: string; domain: string; expires: number; httpOnly: boolean; secure: boolean; }[] | undefined; }, { error: string; success: boolean; operation: "get_cookies"; cookies?: { value: string; path: string; name: string; domain: string; expires: number; httpOnly: boolean; secure: boolean; }[] | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"end_session">; success: import("zod").ZodBoolean; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "end_session"; }, { error: string; success: boolean; operation: "end_session"; }>]>; static readonly shortDescription = "Browser automation service using BrowserBase cloud browsers"; static readonly longDescription = "\n BrowserBase service integration for cloud-based browser automation.\n\n Features:\n - Cloud-based browser sessions\n - Session persistence via context IDs\n - Cookie injection for authenticated sessions\n - Full page automation (click, type, evaluate)\n - Screenshot and content extraction\n - Stealth mode for anti-bot avoidance\n - Automatic CAPTCHA solving\n - Built-in and custom proxy support\n\n Stealth Mode Options:\n - Basic Stealth: Automatic browser fingerprint randomization (default)\n - Advanced Stealth: Custom Chromium browser for better anti-bot avoidance (Scale Plan only)\n - CAPTCHA Solving: Automatic detection and solving (enabled by default, can be disabled)\n - Custom CAPTCHA selectors: For non-standard CAPTCHA providers\n\n Proxy Options:\n - Built-in proxies: Set proxies=true for residential proxies with geolocation\n - Geolocation: Specify city, state (US only), and country for proxy location\n - Custom proxies: Use your own HTTP/HTTPS proxies with authentication\n - Routing rules: Route different domains through different proxies using domainPattern\n\n Use cases:\n - Automated shopping workflows (Amazon, etc.)\n - Web scraping with authentication\n - Form automation and submission\n - Browser-based testing\n\n Security Features:\n - Sessions are isolated in BrowserBase cloud\n - Credentials are handled securely\n - Sessions are properly closed and cleaned up\n "; static readonly alias = "browser"; private static activeSessions; constructor(params?: T, context?: BubbleContext, instanceId?: string); /** * Get BrowserBase configuration from environment */ private getConfig; /** * Make an API request to BrowserBase */ private browserbaseApi; /** * Parse browser session credential data (cookies + contextId) * Credential is base64-encoded JSON to avoid escaping issues */ private parseBrowserSessionCredential; /** * Normalize proxy server to valid URL (BrowserBase requires http/https) */ private normalizeProxyServer; /** * Build proxy configuration for BrowserBase API * Converts our schema format to the API format */ private buildProxyConfig; testCredential(): Promise; protected performAction(context?: BubbleContext): Promise>; /** * Start a new browser session */ private startSession; /** * Navigate to a URL */ private navigate; /** * Click an element */ private click; /** * Type text into an element */ private typeText; /** * Select an option in a