{"version":3,"file":"browser/types.mjs","sources":["webpack://@agent-infra/browser-use/./src/browser/types.ts"],"sourcesContent":["/**\n * The following code is modified based on\n * https://github.com/nanobrowser/nanobrowser/blob/master/chrome-extension/src/background/browser/types.ts\n *\n * Apache-2.0 License\n * Copyright (c) 2024 alexchenzl\n * https://github.com/nanobrowser/nanobrowser/blob/master/LICENSE\n */\nimport type { DOMState } from '../dom/views';\n\nexport type PartialWithRequired<T, K extends keyof T> = Required<Pick<T, K>> &\n  Partial<Omit<T, K>>;\n\nexport interface BrowserContextWindowSize {\n  width: number;\n  height: number;\n}\n\nexport interface BrowserContextConfig {\n  /**\n   * Minimum time to wait before getting page state for LLM input\n   * @default 0.5\n   */\n  minimumWaitPageLoadTime: number;\n\n  /**\n   * Time to wait for network requests to finish before getting page state.\n   * Lower values may result in incomplete page loads.\n   * @default 1.0\n   */\n  waitForNetworkIdlePageLoadTime: number;\n\n  /**\n   * Maximum time to wait for page load before proceeding anyway\n   * @default 5.0\n   */\n  maximumWaitPageLoadTime: number;\n\n  /**\n   * Time to wait between multiple per step actions\n   * @default 1.0\n   */\n  waitBetweenActions: number;\n\n  /**\n   * Default browser window size\n   * @default { width: 1280, height: 1100 }\n   */\n  browserWindowSize: BrowserContextWindowSize;\n\n  /**\n   * Highlight elements in the DOM on the screen\n   * @default true\n   */\n  highlightElements: boolean;\n\n  /**\n   * Viewport expansion in pixels. This amount will increase the number of elements\n   * which are included in the state what the LLM will see.\n   * If set to -1, all elements will be included (this leads to high token usage).\n   * If set to 0, only the elements which are visible in the viewport will be included.\n   * @default 500\n   */\n  viewportExpansion: number;\n\n  /**\n   * Include dynamic attributes in the CSS selector. If you want to reuse the css_selectors, it might be better to set this to False.\n   * @default true\n   */\n  includeDynamicAttributes: boolean;\n\n  /**\n   * Home page url\n   * @default 'https://www.google.com'\n   */\n  homePageUrl: string;\n}\n\nexport const DEFAULT_BROWSER_CONTEXT_CONFIG: BrowserContextConfig = {\n  minimumWaitPageLoadTime: 1,\n  waitForNetworkIdlePageLoadTime: 1.0,\n  maximumWaitPageLoadTime: 5.0,\n  waitBetweenActions: 1.0,\n  browserWindowSize: { width: 1280, height: 1100 },\n  highlightElements: true,\n  viewportExpansion: 500,\n  includeDynamicAttributes: true,\n  homePageUrl: 'https://www.google.com',\n};\n\nexport interface PageState extends DOMState {\n  tabId: number;\n  url: string;\n  title: string;\n  screenshot: string | null;\n  pixelsAbove: number;\n  pixelsBelow: number;\n}\n\nexport interface PageInfo {\n  id: string;\n  url: string;\n  title: string;\n}\n\nexport interface BrowserState extends PageState {\n  pages?: PageInfo[];\n}\n"],"names":["DEFAULT_BROWSER_CONTEXT_CONFIG"],"mappings":";;;;AA8EO,MAAMA,iCAAuD;IAClE,yBAAyB;IACzB,gCAAgC;IAChC,yBAAyB;IACzB,oBAAoB;IACpB,mBAAmB;QAAE,OAAO;QAAM,QAAQ;IAAK;IAC/C,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;IAC1B,aAAa;AACf"}