UNPKG

browser-use-typescript

Version:

A TypeScript-based browser automation framework

41 lines (40 loc) 1.5 kB
import { BaseChatModel } from "@langchain/core/language_models/chat_models"; import { BrowserContext } from "../browser/playwrightBrowser/browserContext"; import { Registry } from "./registry/service"; import { ActionResult } from "../agent/types"; import { ActionModel } from "./registry/types"; /** * Controller class for browser automation * Manages the registration and execution of browser actions */ declare global { interface Window { updateControllerPageInfo: (url: string, captcha: boolean, redirect: string) => Promise<boolean>; } } export declare class PageInfo { info: Array<{ url: string; captcha: boolean; redirect: string; }>; } export declare class Controller<Context> { registry: Registry<Context>; pageInfo: PageInfo; constructor(); /** * Decorator for registering custom actions * @param description Describe what the function does */ /** * Execute an action * @param action The action to execute * @param browserContext The browser context * @param pageExtractionLlm Optional LLM for page extraction * @param sensitiveData Optional sensitive data * @param availableFilePaths Optional available file paths * @param context Optional context */ act(action: ActionModel, browserContext: BrowserContext, pageExtractionLlm?: BaseChatModel, sensitiveData?: Record<string, string>, availableFilePaths?: string[], context?: Context): Promise<ActionResult>; }