@browserbasehq/orca 3.0.9-alpha-4 → 3.1.0-patch.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/lib/inference.d.ts +65 -0
- package/dist/esm/lib/inference.js +333 -0
- package/dist/esm/lib/inference.js.map +1 -0
- package/dist/esm/lib/inferenceLogUtils.d.ts +12 -0
- package/dist/esm/lib/inferenceLogUtils.js +92 -0
- package/dist/esm/lib/inferenceLogUtils.js.map +1 -0
- package/dist/esm/lib/logger.d.ts +69 -0
- package/dist/esm/lib/logger.js +323 -0
- package/dist/esm/lib/logger.js.map +1 -0
- package/dist/esm/lib/modelUtils.d.ts +14 -0
- package/dist/esm/lib/modelUtils.js +48 -0
- package/dist/esm/lib/modelUtils.js.map +1 -0
- package/dist/esm/lib/prompt.d.ts +14 -0
- package/dist/esm/lib/prompt.js +230 -0
- package/dist/esm/lib/prompt.js.map +1 -0
- package/dist/esm/lib/utils.d.ts +68 -0
- package/dist/esm/lib/utils.js +654 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/lib/v3/agent/AgentClient.d.ts +19 -0
- package/dist/esm/lib/v3/agent/AgentClient.js +17 -0
- package/dist/esm/lib/v3/agent/AgentClient.js.map +1 -0
- package/dist/esm/lib/v3/agent/AgentProvider.d.ts +20 -0
- package/dist/esm/lib/v3/agent/AgentProvider.js +77 -0
- package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -0
- package/dist/esm/lib/v3/agent/AnthropicCUAClient.d.ts +57 -0
- package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +822 -0
- package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -0
- package/dist/esm/lib/v3/agent/GoogleCUAClient.d.ts +74 -0
- package/dist/esm/lib/v3/agent/GoogleCUAClient.js +799 -0
- package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -0
- package/dist/esm/lib/v3/agent/MicrosoftCUAClient.d.ts +71 -0
- package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js +770 -0
- package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js.map +1 -0
- package/dist/esm/lib/v3/agent/OpenAICUAClient.d.ts +69 -0
- package/dist/esm/lib/v3/agent/OpenAICUAClient.js +615 -0
- package/dist/esm/lib/v3/agent/OpenAICUAClient.js.map +1 -0
- package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.d.ts +12 -0
- package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js +186 -0
- package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/act.d.ts +13 -0
- package/dist/esm/lib/v3/agent/tools/act.js +49 -0
- package/dist/esm/lib/v3/agent/tools/act.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/ariaTree.d.ts +5 -0
- package/dist/esm/lib/v3/agent/tools/ariaTree.js +31 -0
- package/dist/esm/lib/v3/agent/tools/ariaTree.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/click.d.ts +6 -0
- package/dist/esm/lib/v3/agent/tools/click.js +104 -0
- package/dist/esm/lib/v3/agent/tools/click.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/clickAndHold.d.ts +14 -0
- package/dist/esm/lib/v3/agent/tools/clickAndHold.js +68 -0
- package/dist/esm/lib/v3/agent/tools/clickAndHold.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/dragAndDrop.d.ts +7 -0
- package/dist/esm/lib/v3/agent/tools/dragAndDrop.js +105 -0
- package/dist/esm/lib/v3/agent/tools/dragAndDrop.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/extract.d.ts +21 -0
- package/dist/esm/lib/v3/agent/tools/extract.js +93 -0
- package/dist/esm/lib/v3/agent/tools/extract.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/fillFormVision.d.ts +12 -0
- package/dist/esm/lib/v3/agent/tools/fillFormVision.js +143 -0
- package/dist/esm/lib/v3/agent/tools/fillFormVision.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/fillform.d.ts +13 -0
- package/dist/esm/lib/v3/agent/tools/fillform.js +56 -0
- package/dist/esm/lib/v3/agent/tools/fillform.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/goto.d.ts +12 -0
- package/dist/esm/lib/v3/agent/tools/goto.js +31 -0
- package/dist/esm/lib/v3/agent/tools/goto.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/index.d.ts +92 -0
- package/dist/esm/lib/v3/agent/tools/index.js +74 -0
- package/dist/esm/lib/v3/agent/tools/index.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/keys.d.ts +24 -0
- package/dist/esm/lib/v3/agent/tools/keys.js +60 -0
- package/dist/esm/lib/v3/agent/tools/keys.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/navback.d.ts +6 -0
- package/dist/esm/lib/v3/agent/tools/navback.js +23 -0
- package/dist/esm/lib/v3/agent/tools/navback.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/screenshot.d.ts +6 -0
- package/dist/esm/lib/v3/agent/tools/screenshot.js +26 -0
- package/dist/esm/lib/v3/agent/tools/screenshot.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/scroll.d.ts +19 -0
- package/dist/esm/lib/v3/agent/tools/scroll.js +142 -0
- package/dist/esm/lib/v3/agent/tools/scroll.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/search.d.ts +15 -0
- package/dist/esm/lib/v3/agent/tools/search.js +73 -0
- package/dist/esm/lib/v3/agent/tools/search.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/think.d.ts +6 -0
- package/dist/esm/lib/v3/agent/tools/think.js +24 -0
- package/dist/esm/lib/v3/agent/tools/think.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/type.d.ts +7 -0
- package/dist/esm/lib/v3/agent/tools/type.js +106 -0
- package/dist/esm/lib/v3/agent/tools/type.js.map +1 -0
- package/dist/esm/lib/v3/agent/tools/wait.d.ts +5 -0
- package/dist/esm/lib/v3/agent/tools/wait.js +53 -0
- package/dist/esm/lib/v3/agent/tools/wait.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/actionMapping.d.ts +3 -0
- package/dist/esm/lib/v3/agent/utils/actionMapping.js +100 -0
- package/dist/esm/lib/v3/agent/utils/actionMapping.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/coordinateNormalization.d.ts +13 -0
- package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js +28 -0
- package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
- package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js +62 -0
- package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.d.ts +25 -0
- package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js +145 -0
- package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.d.ts +22 -0
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +101 -0
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/imageCompression.d.ts +53 -0
- package/dist/esm/lib/v3/agent/utils/imageCompression.js +204 -0
- package/dist/esm/lib/v3/agent/utils/imageCompression.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/messageProcessing.d.ts +12 -0
- package/dist/esm/lib/v3/agent/utils/messageProcessing.js +164 -0
- package/dist/esm/lib/v3/agent/utils/messageProcessing.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/screenshotHandler.d.ts +10 -0
- package/dist/esm/lib/v3/agent/utils/screenshotHandler.js +26 -0
- package/dist/esm/lib/v3/agent/utils/screenshotHandler.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.d.ts +26 -0
- package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js +79 -0
- package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js.map +1 -0
- package/dist/esm/lib/v3/agent/utils/xpath.d.ts +11 -0
- package/dist/esm/lib/v3/agent/utils/xpath.js +19 -0
- package/dist/esm/lib/v3/agent/utils/xpath.js.map +1 -0
- package/dist/esm/lib/v3/api.d.ts +86 -0
- package/dist/esm/lib/v3/api.js +484 -0
- package/dist/esm/lib/v3/api.js.map +1 -0
- package/dist/esm/lib/v3/cache/ActCache.d.ts +23 -0
- package/dist/esm/lib/v3/cache/ActCache.js +292 -0
- package/dist/esm/lib/v3/cache/ActCache.js.map +1 -0
- package/dist/esm/lib/v3/cache/AgentCache.d.ts +109 -0
- package/dist/esm/lib/v3/cache/AgentCache.js +640 -0
- package/dist/esm/lib/v3/cache/AgentCache.js.map +1 -0
- package/dist/esm/lib/v3/cache/CacheStorage.d.ts +17 -0
- package/dist/esm/lib/v3/cache/CacheStorage.js +98 -0
- package/dist/esm/lib/v3/cache/CacheStorage.js.map +1 -0
- package/dist/esm/lib/v3/cache/serverAgentCache.d.ts +7 -0
- package/dist/esm/lib/v3/cache/serverAgentCache.js +49 -0
- package/dist/esm/lib/v3/cache/serverAgentCache.js.map +1 -0
- package/dist/esm/lib/v3/cache/utils.d.ts +15 -0
- package/dist/esm/lib/v3/cache/utils.js +39 -0
- package/dist/esm/lib/v3/cache/utils.js.map +1 -0
- package/dist/esm/lib/v3/dom/a11yScripts/index.d.ts +11 -0
- package/dist/esm/lib/v3/dom/a11yScripts/index.js +117 -0
- package/dist/esm/lib/v3/dom/a11yScripts/index.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/a11yScripts.generated.d.ts +16 -0
- package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js +20 -0
- package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/locatorScripts.generated.d.ts +52 -0
- package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js +56 -0
- package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/reRenderScriptContent.d.ts +1 -0
- package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js +2 -0
- package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/rerender-index.js +1 -0
- package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.d.ts +4 -0
- package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js +8 -0
- package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
- package/dist/esm/lib/v3/dom/build/scriptV3Content.js +2 -0
- package/dist/esm/lib/v3/dom/build/scriptV3Content.js.map +1 -0
- package/dist/esm/lib/v3/dom/build/v3-index.js +1 -0
- package/dist/esm/lib/v3/dom/genA11yScripts.d.ts +1 -0
- package/dist/esm/lib/v3/dom/genA11yScripts.js +54 -0
- package/dist/esm/lib/v3/dom/genA11yScripts.js.map +1 -0
- package/dist/esm/lib/v3/dom/genDomScripts.d.ts +1 -0
- package/dist/esm/lib/v3/dom/genDomScripts.js +38 -0
- package/dist/esm/lib/v3/dom/genDomScripts.js.map +1 -0
- package/dist/esm/lib/v3/dom/genLocatorScripts.d.ts +1 -0
- package/dist/esm/lib/v3/dom/genLocatorScripts.js +51 -0
- package/dist/esm/lib/v3/dom/genLocatorScripts.js.map +1 -0
- package/dist/esm/lib/v3/dom/genScreenshotScripts.d.ts +1 -0
- package/dist/esm/lib/v3/dom/genScreenshotScripts.js +37 -0
- package/dist/esm/lib/v3/dom/genScreenshotScripts.js.map +1 -0
- package/dist/esm/lib/v3/dom/index.d.ts +1 -0
- package/dist/esm/lib/v3/dom/index.js +2 -0
- package/dist/esm/lib/v3/dom/index.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/counts.d.ts +15 -0
- package/dist/esm/lib/v3/dom/locatorScripts/counts.js +272 -0
- package/dist/esm/lib/v3/dom/locatorScripts/counts.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/index.d.ts +4 -0
- package/dist/esm/lib/v3/dom/locatorScripts/index.js +5 -0
- package/dist/esm/lib/v3/dom/locatorScripts/index.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/scripts.d.ts +37 -0
- package/dist/esm/lib/v3/dom/locatorScripts/scripts.js +458 -0
- package/dist/esm/lib/v3/dom/locatorScripts/scripts.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/selectors.d.ts +4 -0
- package/dist/esm/lib/v3/dom/locatorScripts/selectors.js +283 -0
- package/dist/esm/lib/v3/dom/locatorScripts/selectors.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.d.ts +19 -0
- package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js +283 -0
- package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.d.ts +76 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js +376 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js.map +1 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.d.ts +9 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js +196 -0
- package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js.map +1 -0
- package/dist/esm/lib/v3/dom/piercer.entry.d.ts +1 -0
- package/dist/esm/lib/v3/dom/piercer.entry.js +3 -0
- package/dist/esm/lib/v3/dom/piercer.entry.js.map +1 -0
- package/dist/esm/lib/v3/dom/piercer.runtime.d.ts +23 -0
- package/dist/esm/lib/v3/dom/piercer.runtime.js +90 -0
- package/dist/esm/lib/v3/dom/piercer.runtime.js.map +1 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.d.ts +1 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js +3 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js.map +1 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.d.ts +1 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js +40 -0
- package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js.map +1 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/index.d.ts +1 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/index.js +2 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/index.js.map +1 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.d.ts +8 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js +82 -0
- package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js.map +1 -0
- package/dist/esm/lib/v3/external_clients/aisdk.d.ts +11 -0
- package/dist/esm/lib/v3/external_clients/aisdk.js +103 -0
- package/dist/esm/lib/v3/external_clients/aisdk.js.map +1 -0
- package/dist/esm/lib/v3/external_clients/customOpenAI.d.ts +18 -0
- package/dist/esm/lib/v3/external_clients/customOpenAI.js +220 -0
- package/dist/esm/lib/v3/external_clients/customOpenAI.js.map +1 -0
- package/dist/esm/lib/v3/flowLogger.d.ts +139 -0
- package/dist/esm/lib/v3/flowLogger.js +868 -0
- package/dist/esm/lib/v3/flowLogger.js.map +1 -0
- package/dist/esm/lib/v3/handlers/actHandler.d.ts +21 -0
- package/dist/esm/lib/v3/handlers/actHandler.js +340 -0
- package/dist/esm/lib/v3/handlers/actHandler.js.map +1 -0
- package/dist/esm/lib/v3/handlers/extractHandler.d.ts +31 -0
- package/dist/esm/lib/v3/handlers/extractHandler.js +139 -0
- package/dist/esm/lib/v3/handlers/extractHandler.js.map +1 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +24 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +623 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.d.ts +2 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js +14 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js.map +1 -0
- package/dist/esm/lib/v3/handlers/observeHandler.d.ts +17 -0
- package/dist/esm/lib/v3/handlers/observeHandler.js +156 -0
- package/dist/esm/lib/v3/handlers/observeHandler.js.map +1 -0
- package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +32 -0
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js +461 -0
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -0
- package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.d.ts +33 -0
- package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +528 -0
- package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -0
- package/dist/esm/lib/v3/index.d.ts +17 -0
- package/dist/esm/lib/v3/index.js +13 -0
- package/dist/esm/lib/v3/index.js.map +1 -0
- package/dist/esm/lib/v3/launch/browserbase.d.ts +7 -0
- package/dist/esm/lib/v3/launch/browserbase.js +46 -0
- package/dist/esm/lib/v3/launch/browserbase.js.map +1 -0
- package/dist/esm/lib/v3/launch/local.d.ts +15 -0
- package/dist/esm/lib/v3/launch/local.js +98 -0
- package/dist/esm/lib/v3/launch/local.js.map +1 -0
- package/dist/esm/lib/v3/llm/AnthropicClient.d.ts +16 -0
- package/dist/esm/lib/v3/llm/AnthropicClient.js +239 -0
- package/dist/esm/lib/v3/llm/AnthropicClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/CerebrasClient.d.ts +17 -0
- package/dist/esm/lib/v3/llm/CerebrasClient.js +235 -0
- package/dist/esm/lib/v3/llm/CerebrasClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/GoogleClient.d.ts +19 -0
- package/dist/esm/lib/v3/llm/GoogleClient.js +369 -0
- package/dist/esm/lib/v3/llm/GoogleClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/GroqClient.d.ts +17 -0
- package/dist/esm/lib/v3/llm/GroqClient.js +236 -0
- package/dist/esm/lib/v3/llm/GroqClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/LLMClient.d.ts +121 -0
- package/dist/esm/lib/v3/llm/LLMClient.js +23 -0
- package/dist/esm/lib/v3/llm/LLMClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/LLMProvider.d.ts +13 -0
- package/dist/esm/lib/v3/llm/LLMProvider.js +194 -0
- package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -0
- package/dist/esm/lib/v3/llm/OpenAIClient.d.ts +15 -0
- package/dist/esm/lib/v3/llm/OpenAIClient.js +329 -0
- package/dist/esm/lib/v3/llm/OpenAIClient.js.map +1 -0
- package/dist/esm/lib/v3/llm/aisdk.d.ts +15 -0
- package/dist/esm/lib/v3/llm/aisdk.js +348 -0
- package/dist/esm/lib/v3/llm/aisdk.js.map +1 -0
- package/dist/esm/lib/v3/logger.d.ts +9 -0
- package/dist/esm/lib/v3/logger.js +96 -0
- package/dist/esm/lib/v3/logger.js.map +1 -0
- package/dist/esm/lib/v3/mcp/connection.d.ts +11 -0
- package/dist/esm/lib/v3/mcp/connection.js +49 -0
- package/dist/esm/lib/v3/mcp/connection.js.map +1 -0
- package/dist/esm/lib/v3/mcp/utils.d.ts +3 -0
- package/dist/esm/lib/v3/mcp/utils.js +36 -0
- package/dist/esm/lib/v3/mcp/utils.js.map +1 -0
- package/dist/esm/lib/v3/shutdown/cleanupLocal.d.ts +14 -0
- package/dist/esm/lib/v3/shutdown/cleanupLocal.js +30 -0
- package/dist/esm/lib/v3/shutdown/cleanupLocal.js.map +1 -0
- package/dist/esm/lib/v3/shutdown/supervisor.d.ts +9 -0
- package/dist/esm/lib/v3/shutdown/supervisor.js +156 -0
- package/dist/esm/lib/v3/shutdown/supervisor.js.map +1 -0
- package/dist/esm/lib/v3/shutdown/supervisorClient.d.ts +15 -0
- package/dist/esm/lib/v3/shutdown/supervisorClient.js +97 -0
- package/dist/esm/lib/v3/shutdown/supervisorClient.js.map +1 -0
- package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js +113 -0
- package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js +80 -0
- package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-callbacks.spec.js +374 -0
- package/dist/esm/lib/v3/tests/agent-callbacks.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js +357 -0
- package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js +247 -0
- package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js +105 -0
- package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/agent-streaming.spec.js +126 -0
- package/dist/esm/lib/v3/tests/agent-streaming.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js +44 -0
- package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/click-count.spec.js +112 -0
- package/dist/esm/lib/v3/tests/click-count.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js +54 -0
- package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/context-addInitScript.spec.js +176 -0
- package/dist/esm/lib/v3/tests/context-addInitScript.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/default-page-tracking.spec.js +53 -0
- package/dist/esm/lib/v3/tests/default-page-tracking.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/downloads.spec.js +58 -0
- package/dist/esm/lib/v3/tests/downloads.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/envReporter.js +57 -0
- package/dist/esm/lib/v3/tests/envReporter.js.map +7 -0
- package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js +53 -0
- package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js +447 -0
- package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/keep-alive.child.js +92 -0
- package/dist/esm/lib/v3/tests/keep-alive.child.js.map +7 -0
- package/dist/esm/lib/v3/tests/keep-alive.helpers.js +532 -0
- package/dist/esm/lib/v3/tests/keep-alive.helpers.js.map +7 -0
- package/dist/esm/lib/v3/tests/keep-alive.spec.js +19 -0
- package/dist/esm/lib/v3/tests/keep-alive.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/keyboard.spec.js +296 -0
- package/dist/esm/lib/v3/tests/keyboard.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js +159 -0
- package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-content-methods.spec.js +191 -0
- package/dist/esm/lib/v3/tests/locator-content-methods.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js +108 -0
- package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-count.spec.js +71 -0
- package/dist/esm/lib/v3/tests/locator-count.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-fill.spec.js +118 -0
- package/dist/esm/lib/v3/tests/locator-fill.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-input-methods.spec.js +136 -0
- package/dist/esm/lib/v3/tests/locator-input-methods.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-nth.spec.js +157 -0
- package/dist/esm/lib/v3/tests/locator-nth.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/locator-select-option.spec.js +242 -0
- package/dist/esm/lib/v3/tests/locator-select-option.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/logger-initialization.spec.js +552 -0
- package/dist/esm/lib/v3/tests/logger-initialization.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js +269 -0
- package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/nested-div.spec.js +23 -0
- package/dist/esm/lib/v3/tests/nested-div.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-addInitScript.spec.js +90 -0
- package/dist/esm/lib/v3/tests/page-addInitScript.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-console.spec.js +56 -0
- package/dist/esm/lib/v3/tests/page-console.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js +418 -0
- package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-goto-response.spec.js +35 -0
- package/dist/esm/lib/v3/tests/page-goto-response.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-hover.spec.js +167 -0
- package/dist/esm/lib/v3/tests/page-hover.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-screenshot.spec.js +273 -0
- package/dist/esm/lib/v3/tests/page-screenshot.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-scroll.spec.js +182 -0
- package/dist/esm/lib/v3/tests/page-scroll.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/page-send-cdp.spec.js +46 -0
- package/dist/esm/lib/v3/tests/page-send-cdp.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js +98 -0
- package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/setinputfiles.spec.js +126 -0
- package/dist/esm/lib/v3/tests/setinputfiles.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js +134 -0
- package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js +134 -0
- package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/testUtils.js +31 -0
- package/dist/esm/lib/v3/tests/testUtils.js.map +7 -0
- package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js +100 -0
- package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/timeouts.spec.js +32 -0
- package/dist/esm/lib/v3/tests/timeouts.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/user-data-dir.spec.js +43 -0
- package/dist/esm/lib/v3/tests/user-data-dir.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/v3.config.js +15 -0
- package/dist/esm/lib/v3/tests/v3.config.js.map +7 -0
- package/dist/esm/lib/v3/tests/v3.dynamic.config.js +43 -0
- package/dist/esm/lib/v3/tests/v3.dynamic.config.js.map +7 -0
- package/dist/esm/lib/v3/tests/v3.playwright.config.js +98 -0
- package/dist/esm/lib/v3/tests/v3.playwright.config.js.map +7 -0
- package/dist/esm/lib/v3/tests/wait-for-selector.spec.js +593 -0
- package/dist/esm/lib/v3/tests/wait-for-selector.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js +97 -0
- package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js.map +7 -0
- package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js +77 -0
- package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js.map +7 -0
- package/dist/esm/lib/v3/timeoutConfig.d.ts +2 -0
- package/dist/esm/lib/v3/timeoutConfig.js +27 -0
- package/dist/esm/lib/v3/timeoutConfig.js.map +1 -0
- package/dist/esm/lib/v3/types/private/agent.d.ts +6 -0
- package/dist/esm/lib/v3/types/private/agent.js +2 -0
- package/dist/esm/lib/v3/types/private/agent.js.map +1 -0
- package/dist/esm/lib/v3/types/private/api.d.ts +11 -0
- package/dist/esm/lib/v3/types/private/api.js +2 -0
- package/dist/esm/lib/v3/types/private/api.js.map +1 -0
- package/dist/esm/lib/v3/types/private/cache.d.ts +128 -0
- package/dist/esm/lib/v3/types/private/cache.js +2 -0
- package/dist/esm/lib/v3/types/private/cache.js.map +1 -0
- package/dist/esm/lib/v3/types/private/evaluator.d.ts +40 -0
- package/dist/esm/lib/v3/types/private/evaluator.js +2 -0
- package/dist/esm/lib/v3/types/private/evaluator.js.map +1 -0
- package/dist/esm/lib/v3/types/private/handlers.d.ts +38 -0
- package/dist/esm/lib/v3/types/private/handlers.js +16 -0
- package/dist/esm/lib/v3/types/private/handlers.js.map +1 -0
- package/dist/esm/lib/v3/types/private/index.d.ts +7 -0
- package/dist/esm/lib/v3/types/private/index.js +8 -0
- package/dist/esm/lib/v3/types/private/index.js.map +1 -0
- package/dist/esm/lib/v3/types/private/internal.d.ts +39 -0
- package/dist/esm/lib/v3/types/private/internal.js +2 -0
- package/dist/esm/lib/v3/types/private/internal.js.map +1 -0
- package/dist/esm/lib/v3/types/private/locator.d.ts +9 -0
- package/dist/esm/lib/v3/types/private/locator.js +2 -0
- package/dist/esm/lib/v3/types/private/locator.js.map +1 -0
- package/dist/esm/lib/v3/types/private/network.d.ts +34 -0
- package/dist/esm/lib/v3/types/private/network.js +3 -0
- package/dist/esm/lib/v3/types/private/network.js.map +1 -0
- package/dist/esm/lib/v3/types/private/shutdown.d.ts +31 -0
- package/dist/esm/lib/v3/types/private/shutdown.js +5 -0
- package/dist/esm/lib/v3/types/private/shutdown.js.map +1 -0
- package/dist/esm/lib/v3/types/private/shutdownErrors.d.ts +12 -0
- package/dist/esm/lib/v3/types/private/shutdownErrors.js +22 -0
- package/dist/esm/lib/v3/types/private/shutdownErrors.js.map +1 -0
- package/dist/esm/lib/v3/types/private/snapshot.d.ts +117 -0
- package/dist/esm/lib/v3/types/private/snapshot.js +2 -0
- package/dist/esm/lib/v3/types/private/snapshot.js.map +1 -0
- package/dist/esm/lib/v3/types/public/agent.d.ts +595 -0
- package/dist/esm/lib/v3/types/public/agent.js +15 -0
- package/dist/esm/lib/v3/types/public/agent.js.map +1 -0
- package/dist/esm/lib/v3/types/public/api.d.ts +1211 -0
- package/dist/esm/lib/v3/types/public/api.js +915 -0
- package/dist/esm/lib/v3/types/public/api.js.map +1 -0
- package/dist/esm/lib/v3/types/public/apiErrors.d.ts +18 -0
- package/dist/esm/lib/v3/types/public/apiErrors.js +32 -0
- package/dist/esm/lib/v3/types/public/apiErrors.js.map +1 -0
- package/dist/esm/lib/v3/types/public/index.d.ts +12 -0
- package/dist/esm/lib/v3/types/public/index.js +14 -0
- package/dist/esm/lib/v3/types/public/index.js.map +1 -0
- package/dist/esm/lib/v3/types/public/locator.d.ts +9 -0
- package/dist/esm/lib/v3/types/public/locator.js +2 -0
- package/dist/esm/lib/v3/types/public/locator.js.map +1 -0
- package/dist/esm/lib/v3/types/public/logs.d.ts +23 -0
- package/dist/esm/lib/v3/types/public/logs.js +13 -0
- package/dist/esm/lib/v3/types/public/logs.js.map +1 -0
- package/dist/esm/lib/v3/types/public/methods.d.ts +56 -0
- package/dist/esm/lib/v3/types/public/methods.js +15 -0
- package/dist/esm/lib/v3/types/public/methods.js.map +1 -0
- package/dist/esm/lib/v3/types/public/metrics.d.ts +27 -0
- package/dist/esm/lib/v3/types/public/metrics.js +2 -0
- package/dist/esm/lib/v3/types/public/metrics.js.map +1 -0
- package/dist/esm/lib/v3/types/public/model.d.ts +65 -0
- package/dist/esm/lib/v3/types/public/model.js +2 -0
- package/dist/esm/lib/v3/types/public/model.js.map +1 -0
- package/dist/esm/lib/v3/types/public/options.d.ts +70 -0
- package/dist/esm/lib/v3/types/public/options.js +4 -0
- package/dist/esm/lib/v3/types/public/options.js.map +1 -0
- package/dist/esm/lib/v3/types/public/page.d.ts +18 -0
- package/dist/esm/lib/v3/types/public/page.js +3 -0
- package/dist/esm/lib/v3/types/public/page.js.map +1 -0
- package/dist/esm/lib/v3/types/public/screenshotTypes.d.ts +25 -0
- package/dist/esm/lib/v3/types/public/screenshotTypes.js +2 -0
- package/dist/esm/lib/v3/types/public/screenshotTypes.js.map +1 -0
- package/dist/esm/lib/v3/types/public/sdkErrors.d.ts +152 -0
- package/dist/esm/lib/v3/types/public/sdkErrors.js +305 -0
- package/dist/esm/lib/v3/types/public/sdkErrors.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.d.ts +15 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js +196 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.d.ts +8 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js +121 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.d.ts +77 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js +336 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.d.ts +7 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js +129 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.d.ts +46 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js +274 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.d.ts +24 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js +216 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/index.d.ts +4 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js +5 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.d.ts +16 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js +22 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.d.ts +28 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js +135 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.d.ts +26 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js +102 -0
- package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js.map +1 -0
- package/dist/esm/lib/v3/understudy/a11yInvocation.d.ts +8 -0
- package/dist/esm/lib/v3/understudy/a11yInvocation.js +12 -0
- package/dist/esm/lib/v3/understudy/a11yInvocation.js.map +1 -0
- package/dist/esm/lib/v3/understudy/cdp.d.ts +69 -0
- package/dist/esm/lib/v3/understudy/cdp.js +251 -0
- package/dist/esm/lib/v3/understudy/cdp.js.map +1 -0
- package/dist/esm/lib/v3/understudy/consoleMessage.d.ts +22 -0
- package/dist/esm/lib/v3/understudy/consoleMessage.js +66 -0
- package/dist/esm/lib/v3/understudy/consoleMessage.js.map +1 -0
- package/dist/esm/lib/v3/understudy/context.d.ts +132 -0
- package/dist/esm/lib/v3/understudy/context.js +687 -0
- package/dist/esm/lib/v3/understudy/context.js.map +1 -0
- package/dist/esm/lib/v3/understudy/deepLocator.d.ts +87 -0
- package/dist/esm/lib/v3/understudy/deepLocator.js +218 -0
- package/dist/esm/lib/v3/understudy/deepLocator.js.map +1 -0
- package/dist/esm/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
- package/dist/esm/lib/v3/understudy/executionContextRegistry.js +83 -0
- package/dist/esm/lib/v3/understudy/executionContextRegistry.js.map +1 -0
- package/dist/esm/lib/v3/understudy/fileUploadUtils.d.ts +13 -0
- package/dist/esm/lib/v3/understudy/fileUploadUtils.js +81 -0
- package/dist/esm/lib/v3/understudy/fileUploadUtils.js.map +1 -0
- package/dist/esm/lib/v3/understudy/frame.d.ts +69 -0
- package/dist/esm/lib/v3/understudy/frame.js +211 -0
- package/dist/esm/lib/v3/understudy/frame.js.map +1 -0
- package/dist/esm/lib/v3/understudy/frameLocator.d.ts +50 -0
- package/dist/esm/lib/v3/understudy/frameLocator.js +255 -0
- package/dist/esm/lib/v3/understudy/frameLocator.js.map +1 -0
- package/dist/esm/lib/v3/understudy/frameRegistry.d.ts +101 -0
- package/dist/esm/lib/v3/understudy/frameRegistry.js +298 -0
- package/dist/esm/lib/v3/understudy/frameRegistry.js.map +1 -0
- package/dist/esm/lib/v3/understudy/initScripts.d.ts +2 -0
- package/dist/esm/lib/v3/understudy/initScripts.js +33 -0
- package/dist/esm/lib/v3/understudy/initScripts.js.map +1 -0
- package/dist/esm/lib/v3/understudy/lifecycleWatcher.d.ts +64 -0
- package/dist/esm/lib/v3/understudy/lifecycleWatcher.js +245 -0
- package/dist/esm/lib/v3/understudy/lifecycleWatcher.js.map +1 -0
- package/dist/esm/lib/v3/understudy/locator.d.ts +194 -0
- package/dist/esm/lib/v3/understudy/locator.js +753 -0
- package/dist/esm/lib/v3/understudy/locator.js.map +1 -0
- package/dist/esm/lib/v3/understudy/locatorInvocation.d.ts +8 -0
- package/dist/esm/lib/v3/understudy/locatorInvocation.js +12 -0
- package/dist/esm/lib/v3/understudy/locatorInvocation.js.map +1 -0
- package/dist/esm/lib/v3/understudy/navigationResponseTracker.d.ts +84 -0
- package/dist/esm/lib/v3/understudy/navigationResponseTracker.js +224 -0
- package/dist/esm/lib/v3/understudy/navigationResponseTracker.js.map +1 -0
- package/dist/esm/lib/v3/understudy/networkManager.d.ts +53 -0
- package/dist/esm/lib/v3/understudy/networkManager.js +306 -0
- package/dist/esm/lib/v3/understudy/networkManager.js.map +1 -0
- package/dist/esm/lib/v3/understudy/page.d.ts +354 -0
- package/dist/esm/lib/v3/understudy/page.js +1941 -0
- package/dist/esm/lib/v3/understudy/page.js.map +1 -0
- package/dist/esm/lib/v3/understudy/piercer.d.ts +4 -0
- package/dist/esm/lib/v3/understudy/piercer.js +61 -0
- package/dist/esm/lib/v3/understudy/piercer.js.map +1 -0
- package/dist/esm/lib/v3/understudy/response.d.ts +137 -0
- package/dist/esm/lib/v3/understudy/response.js +330 -0
- package/dist/esm/lib/v3/understudy/response.js.map +1 -0
- package/dist/esm/lib/v3/understudy/screenshotUtils.d.ts +16 -0
- package/dist/esm/lib/v3/understudy/screenshotUtils.js +352 -0
- package/dist/esm/lib/v3/understudy/screenshotUtils.js.map +1 -0
- package/dist/esm/lib/v3/understudy/selectorResolver.d.ts +38 -0
- package/dist/esm/lib/v3/understudy/selectorResolver.js +296 -0
- package/dist/esm/lib/v3/understudy/selectorResolver.js.map +1 -0
- package/dist/esm/lib/v3/v3.d.ts +191 -0
- package/dist/esm/lib/v3/v3.js +1572 -0
- package/dist/esm/lib/v3/v3.js.map +1 -0
- package/dist/esm/lib/v3/zodCompat.d.ts +12 -0
- package/dist/esm/lib/v3/zodCompat.js +17 -0
- package/dist/esm/lib/v3/zodCompat.js.map +1 -0
- package/dist/esm/lib/v3Evaluator.d.ts +19 -0
- package/dist/esm/lib/v3Evaluator.js +210 -0
- package/dist/esm/lib/v3Evaluator.js.map +1 -0
- package/dist/esm/lib/version.d.ts +5 -0
- package/dist/esm/lib/version.js +6 -0
- package/dist/esm/lib/version.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/tests/agent-execution-model.test.js +139 -0
- package/dist/esm/tests/agent-execution-model.test.js.map +7 -0
- package/dist/esm/tests/browserbase-session-accessors.test.js +101 -0
- package/dist/esm/tests/browserbase-session-accessors.test.js.map +7 -0
- package/dist/esm/tests/cache-llm-resolution.test.js +187 -0
- package/dist/esm/tests/cache-llm-resolution.test.js.map +7 -0
- package/dist/esm/tests/helpers/mockCDPSession.js +27 -0
- package/dist/esm/tests/helpers/mockCDPSession.js.map +7 -0
- package/dist/esm/tests/llm-provider.test.js +57 -0
- package/dist/esm/tests/llm-provider.test.js.map +7 -0
- package/dist/esm/tests/model-deprecation.test.js +135 -0
- package/dist/esm/tests/model-deprecation.test.js.map +7 -0
- package/dist/esm/tests/model-utils.test.js +43 -0
- package/dist/esm/tests/model-utils.test.js.map +7 -0
- package/dist/esm/tests/page-snapshot.test.js +36 -0
- package/dist/esm/tests/page-snapshot.test.js.map +7 -0
- package/dist/esm/tests/public-api/export-surface.test.js +53 -0
- package/dist/esm/tests/public-api/export-surface.test.js.map +7 -0
- package/dist/esm/tests/public-api/llm-and-agents.test.js +128 -0
- package/dist/esm/tests/public-api/llm-and-agents.test.js.map +7 -0
- package/dist/esm/tests/public-api/public-error-types.test.js +71 -0
- package/dist/esm/tests/public-api/public-error-types.test.js.map +7 -0
- package/dist/esm/tests/public-api/public-types.test.js +74 -0
- package/dist/esm/tests/public-api/public-types.test.js.map +7 -0
- package/dist/esm/tests/public-api/runtime-utils.test.js +31 -0
- package/dist/esm/tests/public-api/runtime-utils.test.js.map +7 -0
- package/dist/esm/tests/public-api/schema-utils.test.js +78 -0
- package/dist/esm/tests/public-api/schema-utils.test.js.map +7 -0
- package/dist/esm/tests/public-api/timeout-error-types.test.js +81 -0
- package/dist/esm/tests/public-api/timeout-error-types.test.js.map +7 -0
- package/dist/esm/tests/public-api/tool-type-export.test.js +25 -0
- package/dist/esm/tests/public-api/tool-type-export.test.js.map +7 -0
- package/dist/esm/tests/public-api/v3-core.test.js +82 -0
- package/dist/esm/tests/public-api/v3-core.test.js.map +7 -0
- package/dist/esm/tests/safety-confirmation.test.js +134 -0
- package/dist/esm/tests/safety-confirmation.test.js.map +7 -0
- package/dist/esm/tests/snapshot-a11y-resolvers.test.js +348 -0
- package/dist/esm/tests/snapshot-a11y-resolvers.test.js.map +7 -0
- package/dist/esm/tests/snapshot-a11y-tree-utils.test.js +300 -0
- package/dist/esm/tests/snapshot-a11y-tree-utils.test.js.map +7 -0
- package/dist/esm/tests/snapshot-capture-orchestration.test.js +381 -0
- package/dist/esm/tests/snapshot-capture-orchestration.test.js.map +7 -0
- package/dist/esm/tests/snapshot-cbor.test.js +197 -0
- package/dist/esm/tests/snapshot-cbor.test.js.map +7 -0
- package/dist/esm/tests/snapshot-dom-session-builders.test.js +251 -0
- package/dist/esm/tests/snapshot-dom-session-builders.test.js.map +7 -0
- package/dist/esm/tests/snapshot-dom-tree-utils.test.js +109 -0
- package/dist/esm/tests/snapshot-dom-tree-utils.test.js.map +7 -0
- package/dist/esm/tests/snapshot-focus-selectors-utils.test.js +49 -0
- package/dist/esm/tests/snapshot-focus-selectors-utils.test.js.map +7 -0
- package/dist/esm/tests/snapshot-frame-merge.test.js +391 -0
- package/dist/esm/tests/snapshot-frame-merge.test.js.map +7 -0
- package/dist/esm/tests/snapshot-tree-format-utils.test.js +113 -0
- package/dist/esm/tests/snapshot-tree-format-utils.test.js.map +7 -0
- package/dist/esm/tests/snapshot-xpath-utils.test.js +79 -0
- package/dist/esm/tests/snapshot-xpath-utils.test.js.map +7 -0
- package/dist/esm/tests/timeout-handlers.test.js +850 -0
- package/dist/esm/tests/timeout-handlers.test.js.map +7 -0
- package/dist/esm/tests/xpath-parser.test.js +317 -0
- package/dist/esm/tests/xpath-parser.test.js.map +7 -0
- package/dist/esm/tests/xpath-resolver.test.js +73 -0
- package/dist/esm/tests/xpath-resolver.test.js.map +7 -0
- package/dist/esm/tests/zod-enum-compatibility.test.js +97 -0
- package/dist/esm/tests/zod-enum-compatibility.test.js.map +7 -0
- package/package.json +37 -24
- package/dist/index.d.ts +0 -4363
- package/dist/index.js +0 -76530
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
import { GoogleGenAI, } from "@google/genai";
|
|
2
|
+
import { AgentClient } from "./AgentClient.js";
|
|
3
|
+
import { AgentScreenshotProviderError, LLMResponseError, StagehandClosedError, } from "../types/public/sdkErrors.js";
|
|
4
|
+
import { buildGoogleCUASystemPrompt } from "../../prompt.js";
|
|
5
|
+
import { compressGoogleConversationImages } from "./utils/imageCompression.js";
|
|
6
|
+
import { mapKeyToPlaywright } from "./utils/cuaKeyMapping.js";
|
|
7
|
+
import { executeGoogleCustomTool, isCustomTool, convertToolSetToFunctionDeclarations, } from "./utils/googleCustomToolHandler.js";
|
|
8
|
+
import { SessionFileLogger, formatCuaPromptPreview, formatCuaResponsePreview, } from "../flowLogger.js";
|
|
9
|
+
import { v7 as uuidv7 } from "uuid";
|
|
10
|
+
/**
|
|
11
|
+
* Client for Google's Computer Use Assistant API
|
|
12
|
+
* This implementation uses the Google Generative AI SDK for Computer Use
|
|
13
|
+
*/
|
|
14
|
+
export class GoogleCUAClient extends AgentClient {
|
|
15
|
+
apiKey;
|
|
16
|
+
client;
|
|
17
|
+
currentViewport = { width: 1288, height: 711 };
|
|
18
|
+
currentUrl;
|
|
19
|
+
screenshotProvider;
|
|
20
|
+
actionHandler;
|
|
21
|
+
history = [];
|
|
22
|
+
environment = "ENVIRONMENT_BROWSER";
|
|
23
|
+
generateContentConfig;
|
|
24
|
+
tools;
|
|
25
|
+
baseURL;
|
|
26
|
+
safetyConfirmationHandler;
|
|
27
|
+
constructor(type, modelName, userProvidedInstructions, clientOptions, tools) {
|
|
28
|
+
super(type, modelName, userProvidedInstructions);
|
|
29
|
+
this.tools = tools;
|
|
30
|
+
// Process client options
|
|
31
|
+
this.apiKey =
|
|
32
|
+
clientOptions?.apiKey ||
|
|
33
|
+
process.env.GEMINI_API_KEY ||
|
|
34
|
+
process.env.GOOGLE_GENERATIVE_AI_API_KEY ||
|
|
35
|
+
process.env.GOOGLE_API_KEY ||
|
|
36
|
+
"";
|
|
37
|
+
this.baseURL = clientOptions?.baseURL;
|
|
38
|
+
// Initialize the Google Generative AI client
|
|
39
|
+
const genAIOptions = {
|
|
40
|
+
apiKey: this.apiKey,
|
|
41
|
+
...(this.baseURL ? { httpOptions: { baseUrl: this.baseURL } } : {}),
|
|
42
|
+
};
|
|
43
|
+
this.client = new GoogleGenAI(genAIOptions);
|
|
44
|
+
// Get environment if specified
|
|
45
|
+
if (clientOptions?.environment &&
|
|
46
|
+
typeof clientOptions.environment === "string") {
|
|
47
|
+
this.environment = clientOptions.environment;
|
|
48
|
+
}
|
|
49
|
+
this.generateContentConfig = {
|
|
50
|
+
temperature: 1,
|
|
51
|
+
topP: 0.95,
|
|
52
|
+
topK: 40,
|
|
53
|
+
maxOutputTokens: 8192,
|
|
54
|
+
// systemInstruction: this.userProvidedInstructions
|
|
55
|
+
// ? { parts: [{ text: this.userProvidedInstructions }] }
|
|
56
|
+
// : { parts: [{ text: buildGoogleCUASystemPrompt() }] },
|
|
57
|
+
tools: [
|
|
58
|
+
{
|
|
59
|
+
computerUse: {
|
|
60
|
+
environment: this.environment,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
// Store client options for reference
|
|
66
|
+
this.clientOptions = {
|
|
67
|
+
apiKey: this.apiKey,
|
|
68
|
+
...(this.baseURL ? { baseURL: this.baseURL } : {}),
|
|
69
|
+
};
|
|
70
|
+
// Initialize tools if provided
|
|
71
|
+
if (this.tools && Object.keys(this.tools).length > 0) {
|
|
72
|
+
this.updateGenerateContentConfig();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
setViewport(width, height) {
|
|
76
|
+
this.currentViewport = { width, height };
|
|
77
|
+
}
|
|
78
|
+
setCurrentUrl(url) {
|
|
79
|
+
this.currentUrl = url;
|
|
80
|
+
}
|
|
81
|
+
setScreenshotProvider(provider) {
|
|
82
|
+
this.screenshotProvider = provider;
|
|
83
|
+
}
|
|
84
|
+
setActionHandler(handler) {
|
|
85
|
+
this.actionHandler = handler;
|
|
86
|
+
}
|
|
87
|
+
setTools(tools) {
|
|
88
|
+
this.tools = tools;
|
|
89
|
+
this.updateGenerateContentConfig();
|
|
90
|
+
}
|
|
91
|
+
setSafetyConfirmationHandler(handler) {
|
|
92
|
+
this.safetyConfirmationHandler = handler;
|
|
93
|
+
}
|
|
94
|
+
async handleSafetyConfirmation(safetyDecision, logger) {
|
|
95
|
+
const safetyMessage = typeof safetyDecision === "object"
|
|
96
|
+
? JSON.stringify(safetyDecision, null, 2)
|
|
97
|
+
: String(safetyDecision);
|
|
98
|
+
const safetyChecks = [
|
|
99
|
+
{
|
|
100
|
+
id: "google-safety-decision",
|
|
101
|
+
code: "safety_decision",
|
|
102
|
+
message: safetyMessage,
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
if (this.safetyConfirmationHandler) {
|
|
106
|
+
logger({
|
|
107
|
+
category: "agent",
|
|
108
|
+
message: `Requesting safety confirmation for Google safety decision: ${safetyMessage}`,
|
|
109
|
+
level: 1,
|
|
110
|
+
});
|
|
111
|
+
const response = await this.safetyConfirmationHandler(safetyChecks);
|
|
112
|
+
if (response.acknowledged) {
|
|
113
|
+
logger({
|
|
114
|
+
category: "agent",
|
|
115
|
+
message: `Safety decision acknowledged by user`,
|
|
116
|
+
level: 1,
|
|
117
|
+
});
|
|
118
|
+
return "true";
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
logger({
|
|
122
|
+
category: "agent",
|
|
123
|
+
message: `Safety decision rejected by user`,
|
|
124
|
+
level: 1,
|
|
125
|
+
});
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
logger({
|
|
130
|
+
category: "agent",
|
|
131
|
+
message: `Auto-acknowledging Google safety decision`,
|
|
132
|
+
level: 2,
|
|
133
|
+
});
|
|
134
|
+
return "true";
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Update the generateContentConfig with current tools
|
|
138
|
+
*/
|
|
139
|
+
updateGenerateContentConfig() {
|
|
140
|
+
const functionDeclarations = this.tools && Object.keys(this.tools).length > 0
|
|
141
|
+
? convertToolSetToFunctionDeclarations(this.tools)
|
|
142
|
+
: [];
|
|
143
|
+
this.generateContentConfig = {
|
|
144
|
+
...this.generateContentConfig,
|
|
145
|
+
tools: [
|
|
146
|
+
{
|
|
147
|
+
computerUse: {
|
|
148
|
+
environment: this.environment,
|
|
149
|
+
},
|
|
150
|
+
...(functionDeclarations.length > 0 ? { functionDeclarations } : {}),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Execute a task with the Google CUA
|
|
157
|
+
* This is the main entry point for the agent
|
|
158
|
+
* @implements AgentClient.execute
|
|
159
|
+
*/
|
|
160
|
+
async execute(executionOptions) {
|
|
161
|
+
const { options, logger } = executionOptions;
|
|
162
|
+
const { instruction } = options;
|
|
163
|
+
const maxSteps = options.maxSteps || 10;
|
|
164
|
+
let currentStep = 0;
|
|
165
|
+
let completed = false;
|
|
166
|
+
const actions = [];
|
|
167
|
+
const messageList = [];
|
|
168
|
+
let finalMessage = "";
|
|
169
|
+
this.history = []; // Clear history for new execution
|
|
170
|
+
// Start with the initial instruction
|
|
171
|
+
await this.initializeHistory(instruction);
|
|
172
|
+
let totalInputTokens = 0;
|
|
173
|
+
let totalOutputTokens = 0;
|
|
174
|
+
let totalInferenceTime = 0;
|
|
175
|
+
try {
|
|
176
|
+
// Execute steps until completion or max steps reached
|
|
177
|
+
while (!completed && currentStep < maxSteps) {
|
|
178
|
+
logger({
|
|
179
|
+
category: "agent",
|
|
180
|
+
message: `Executing step ${currentStep + 1}/${maxSteps}`,
|
|
181
|
+
level: 1,
|
|
182
|
+
});
|
|
183
|
+
const result = await this.executeStep(logger);
|
|
184
|
+
totalInputTokens += result.usage.input_tokens;
|
|
185
|
+
totalOutputTokens += result.usage.output_tokens;
|
|
186
|
+
totalInferenceTime += result.usage.inference_time_ms;
|
|
187
|
+
// Add actions to the list
|
|
188
|
+
actions.push(...result.actions);
|
|
189
|
+
// Update completion status
|
|
190
|
+
completed = result.completed;
|
|
191
|
+
// Record any message for this step
|
|
192
|
+
if (result.message) {
|
|
193
|
+
messageList.push(result.message);
|
|
194
|
+
finalMessage = result.message;
|
|
195
|
+
}
|
|
196
|
+
// Increment step counter
|
|
197
|
+
currentStep++;
|
|
198
|
+
}
|
|
199
|
+
// Return the final result
|
|
200
|
+
return {
|
|
201
|
+
success: completed,
|
|
202
|
+
actions,
|
|
203
|
+
message: finalMessage,
|
|
204
|
+
completed,
|
|
205
|
+
usage: {
|
|
206
|
+
input_tokens: totalInputTokens,
|
|
207
|
+
output_tokens: totalOutputTokens,
|
|
208
|
+
inference_time_ms: totalInferenceTime,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
214
|
+
logger({
|
|
215
|
+
category: "agent",
|
|
216
|
+
message: `Error executing agent task: ${errorMessage}`,
|
|
217
|
+
level: 0,
|
|
218
|
+
});
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
actions,
|
|
222
|
+
message: `Failed to execute task: ${errorMessage}`,
|
|
223
|
+
completed: false,
|
|
224
|
+
usage: {
|
|
225
|
+
input_tokens: totalInputTokens,
|
|
226
|
+
output_tokens: totalOutputTokens,
|
|
227
|
+
inference_time_ms: totalInferenceTime,
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Initialize conversation history with the initial instruction
|
|
234
|
+
*/
|
|
235
|
+
async initializeHistory(instruction) {
|
|
236
|
+
const parts = [{ text: instruction }];
|
|
237
|
+
// Note: The Python implementation doesn't include the initial screenshot
|
|
238
|
+
// Following the same pattern here
|
|
239
|
+
const systemPromptContent = this.userProvidedInstructions
|
|
240
|
+
? this.userProvidedInstructions
|
|
241
|
+
: buildGoogleCUASystemPrompt().content;
|
|
242
|
+
this.history = [
|
|
243
|
+
{
|
|
244
|
+
role: "user",
|
|
245
|
+
parts: [
|
|
246
|
+
{
|
|
247
|
+
text: "System prompt: " + systemPromptContent,
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
role: "user",
|
|
253
|
+
parts,
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Execute a single step of the agent
|
|
259
|
+
*/
|
|
260
|
+
async executeStep(logger) {
|
|
261
|
+
try {
|
|
262
|
+
const startTime = Date.now();
|
|
263
|
+
// Compress images in conversation history before sending to the model
|
|
264
|
+
const compressedResult = compressGoogleConversationImages(this.history, 2);
|
|
265
|
+
const compressedHistory = compressedResult.items;
|
|
266
|
+
// Use the SDK's generateContent method with retry logic (matching Python's get_model_response)
|
|
267
|
+
const maxRetries = 5;
|
|
268
|
+
const baseDelayS = 1;
|
|
269
|
+
let lastError = null;
|
|
270
|
+
let response = null;
|
|
271
|
+
// Log LLM request
|
|
272
|
+
const llmRequestId = uuidv7();
|
|
273
|
+
SessionFileLogger.logLlmRequest({
|
|
274
|
+
requestId: llmRequestId,
|
|
275
|
+
model: this.modelName,
|
|
276
|
+
operation: "CUA.generateContent",
|
|
277
|
+
prompt: formatCuaPromptPreview(compressedHistory),
|
|
278
|
+
});
|
|
279
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
280
|
+
try {
|
|
281
|
+
// Add exponential backoff delay for retries
|
|
282
|
+
if (attempt > 0) {
|
|
283
|
+
const delay = baseDelayS * Math.pow(2, attempt) * 1000; // Convert to ms
|
|
284
|
+
logger({
|
|
285
|
+
category: "agent",
|
|
286
|
+
message: `Generating content failed on attempt ${attempt + 1}. Retrying in ${delay / 1000} seconds...`,
|
|
287
|
+
level: 2,
|
|
288
|
+
});
|
|
289
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
290
|
+
}
|
|
291
|
+
// Use the SDK's generateContent method - following Python SDK pattern
|
|
292
|
+
response = await this.client.models.generateContent({
|
|
293
|
+
model: this.modelName,
|
|
294
|
+
contents: compressedHistory,
|
|
295
|
+
config: this.generateContentConfig,
|
|
296
|
+
});
|
|
297
|
+
// Check if we have valid response content
|
|
298
|
+
if (!response.candidates || response.candidates.length === 0) {
|
|
299
|
+
throw new LLMResponseError("agent", "Response has no candidates!");
|
|
300
|
+
}
|
|
301
|
+
const candidate = response.candidates[0];
|
|
302
|
+
if (!candidate.content || !candidate.content.parts) {
|
|
303
|
+
const reason = candidate.finishReason || "unknown";
|
|
304
|
+
throw new LLMResponseError("agent", `Response has no content (finish reason: ${reason})`);
|
|
305
|
+
}
|
|
306
|
+
// Success - we have a valid response
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
311
|
+
logger({
|
|
312
|
+
category: "agent",
|
|
313
|
+
message: `API call error: ${lastError.message}`,
|
|
314
|
+
level: 2,
|
|
315
|
+
});
|
|
316
|
+
// If this was the last attempt, throw the error
|
|
317
|
+
if (attempt === maxRetries - 1) {
|
|
318
|
+
logger({
|
|
319
|
+
category: "agent",
|
|
320
|
+
message: `Generating content failed after ${maxRetries} attempts.`,
|
|
321
|
+
level: 0,
|
|
322
|
+
});
|
|
323
|
+
throw lastError;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (!response) {
|
|
328
|
+
throw (lastError || new Error("Failed to get response after all retries"));
|
|
329
|
+
}
|
|
330
|
+
const endTime = Date.now();
|
|
331
|
+
const elapsedMs = endTime - startTime;
|
|
332
|
+
const { usageMetadata } = response;
|
|
333
|
+
// Log LLM response
|
|
334
|
+
SessionFileLogger.logLlmResponse({
|
|
335
|
+
requestId: llmRequestId,
|
|
336
|
+
model: this.modelName,
|
|
337
|
+
operation: "CUA.generateContent",
|
|
338
|
+
output: formatCuaResponsePreview(response),
|
|
339
|
+
inputTokens: usageMetadata?.promptTokenCount,
|
|
340
|
+
outputTokens: usageMetadata?.candidatesTokenCount,
|
|
341
|
+
});
|
|
342
|
+
// Process the response
|
|
343
|
+
const result = await this.processResponse(response, logger);
|
|
344
|
+
// Add model response to history
|
|
345
|
+
if (response.candidates && response.candidates[0]) {
|
|
346
|
+
// Sanitize any out-of-range coordinates in function calls before adding to history
|
|
347
|
+
const sanitizedContent = JSON.parse(JSON.stringify(response.candidates[0].content));
|
|
348
|
+
if (sanitizedContent.parts) {
|
|
349
|
+
for (const part of sanitizedContent.parts) {
|
|
350
|
+
if (part.functionCall?.args) {
|
|
351
|
+
if (typeof part.functionCall.args.x === "number" &&
|
|
352
|
+
part.functionCall.args.x > 999) {
|
|
353
|
+
part.functionCall.args.x = 999;
|
|
354
|
+
}
|
|
355
|
+
if (typeof part.functionCall.args.y === "number" &&
|
|
356
|
+
part.functionCall.args.y > 999) {
|
|
357
|
+
part.functionCall.args.y = 999;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
this.history.push(sanitizedContent);
|
|
363
|
+
}
|
|
364
|
+
// Execute actions and collect function responses
|
|
365
|
+
const functionResponses = [];
|
|
366
|
+
if (result.actions.length > 0) {
|
|
367
|
+
let hasError = false;
|
|
368
|
+
// Execute all actions
|
|
369
|
+
for (let i = 0; i < result.actions.length; i++) {
|
|
370
|
+
const action = result.actions[i];
|
|
371
|
+
logger({
|
|
372
|
+
category: "agent",
|
|
373
|
+
message: `Executing action ${i + 1}/${result.actions.length}: ${action.type}`,
|
|
374
|
+
level: 2,
|
|
375
|
+
});
|
|
376
|
+
// Special handling for open_web_browser - don't execute it
|
|
377
|
+
if (action.type === "open_web_browser") {
|
|
378
|
+
// Set pageUrl for open_web_browser since it doesn't go through action handler
|
|
379
|
+
action.pageUrl = this.currentUrl;
|
|
380
|
+
logger({
|
|
381
|
+
category: "agent",
|
|
382
|
+
message: "Skipping open_web_browser action",
|
|
383
|
+
level: 2,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
else if (action.type === "custom_tool") {
|
|
387
|
+
const toolName = action.name;
|
|
388
|
+
const toolArgs = action.arguments;
|
|
389
|
+
if (this.tools && toolName in this.tools) {
|
|
390
|
+
const correspondingFunctionCall = result.functionCalls.find((fc) => fc.name === toolName);
|
|
391
|
+
if (correspondingFunctionCall) {
|
|
392
|
+
const executionResult = await executeGoogleCustomTool(toolName, toolArgs, this.tools, correspondingFunctionCall, logger);
|
|
393
|
+
functionResponses.push(executionResult.functionResponse);
|
|
394
|
+
if (!executionResult.success) {
|
|
395
|
+
hasError = true;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else if (this.actionHandler) {
|
|
401
|
+
try {
|
|
402
|
+
await this.actionHandler(action);
|
|
403
|
+
// Add a delay between actions to ensure they complete properly
|
|
404
|
+
// Longer delay for typing actions to ensure fields are ready
|
|
405
|
+
if (i < result.actions.length - 1) {
|
|
406
|
+
const nextAction = result.actions[i + 1];
|
|
407
|
+
const isTypingAction = action.type === "type" || nextAction.type === "type";
|
|
408
|
+
const delay = isTypingAction ? 500 : 200;
|
|
409
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
catch (actionError) {
|
|
413
|
+
if (actionError instanceof StagehandClosedError) {
|
|
414
|
+
throw actionError;
|
|
415
|
+
}
|
|
416
|
+
logger({
|
|
417
|
+
category: "agent",
|
|
418
|
+
message: `Error executing action ${action.type}: ${actionError}`,
|
|
419
|
+
level: 0,
|
|
420
|
+
});
|
|
421
|
+
hasError = true;
|
|
422
|
+
// Continue processing other actions even if one fails
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Create function responses for computer use actions (non-custom tools)
|
|
427
|
+
// We need exactly one response per function call, regardless of how many actions were generated
|
|
428
|
+
if (result.functionCalls.length > 0 || hasError) {
|
|
429
|
+
// Filter out custom tool function calls as they've already been handled
|
|
430
|
+
const computerUseFunctionCalls = result.functionCalls.filter((fc) => !isCustomTool(fc, this.tools));
|
|
431
|
+
if (computerUseFunctionCalls.length > 0) {
|
|
432
|
+
try {
|
|
433
|
+
logger({
|
|
434
|
+
category: "agent",
|
|
435
|
+
message: `Taking screenshot after executing ${result.actions.length} actions${hasError ? " (with errors)" : ""}`,
|
|
436
|
+
level: 2,
|
|
437
|
+
});
|
|
438
|
+
const screenshot = await this.captureScreenshot();
|
|
439
|
+
const base64Data = screenshot.replace(/^data:image\/png;base64,/, "");
|
|
440
|
+
// Create one function response for each computer use function call
|
|
441
|
+
// Following Python SDK pattern: FunctionResponse with parts containing inline_data
|
|
442
|
+
for (const functionCall of computerUseFunctionCalls) {
|
|
443
|
+
let safetyAcknowledgement;
|
|
444
|
+
if (functionCall.args?.safety_decision) {
|
|
445
|
+
safetyAcknowledgement = await this.handleSafetyConfirmation(functionCall.args.safety_decision, logger);
|
|
446
|
+
}
|
|
447
|
+
const functionResponsePart = {
|
|
448
|
+
functionResponse: {
|
|
449
|
+
name: functionCall.name,
|
|
450
|
+
response: {
|
|
451
|
+
url: this.currentUrl || "",
|
|
452
|
+
...(safetyAcknowledgement !== undefined
|
|
453
|
+
? {
|
|
454
|
+
safety_acknowledgement: safetyAcknowledgement,
|
|
455
|
+
}
|
|
456
|
+
: {}),
|
|
457
|
+
},
|
|
458
|
+
parts: [
|
|
459
|
+
{
|
|
460
|
+
inlineData: {
|
|
461
|
+
mimeType: "image/png",
|
|
462
|
+
data: base64Data,
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
functionResponses.push(functionResponsePart);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
catch (error) {
|
|
472
|
+
logger({
|
|
473
|
+
category: "agent",
|
|
474
|
+
message: `Error capturing screenshot: ${error}`,
|
|
475
|
+
level: 0,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
// Add all function responses to history in a single user message
|
|
481
|
+
if (functionResponses.length > 0) {
|
|
482
|
+
logger({
|
|
483
|
+
category: "agent",
|
|
484
|
+
message: `Adding ${functionResponses.length} function responses to history`,
|
|
485
|
+
level: 2,
|
|
486
|
+
});
|
|
487
|
+
this.history.push({
|
|
488
|
+
role: "user",
|
|
489
|
+
parts: functionResponses,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return {
|
|
494
|
+
actions: result.actions,
|
|
495
|
+
message: result.message,
|
|
496
|
+
completed: result.completed,
|
|
497
|
+
usage: {
|
|
498
|
+
input_tokens: usageMetadata?.promptTokenCount || 0,
|
|
499
|
+
output_tokens: usageMetadata?.candidatesTokenCount || 0,
|
|
500
|
+
inference_time_ms: elapsedMs,
|
|
501
|
+
},
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
506
|
+
logger({
|
|
507
|
+
category: "agent",
|
|
508
|
+
message: `Error executing step: ${errorMessage}`,
|
|
509
|
+
level: 0,
|
|
510
|
+
});
|
|
511
|
+
throw error;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Process the response from Google's API
|
|
516
|
+
*/
|
|
517
|
+
async processResponse(response, logger) {
|
|
518
|
+
const actions = [];
|
|
519
|
+
let message = "";
|
|
520
|
+
const functionCalls = [];
|
|
521
|
+
if (!response.candidates || response.candidates.length === 0) {
|
|
522
|
+
return {
|
|
523
|
+
actions: [],
|
|
524
|
+
message: "No candidates in response",
|
|
525
|
+
completed: true,
|
|
526
|
+
functionCalls: [],
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
const candidate = response.candidates[0];
|
|
530
|
+
// Log the raw response for debugging
|
|
531
|
+
logger({
|
|
532
|
+
category: "agent",
|
|
533
|
+
message: `Raw response from Google: ${JSON.stringify(candidate.content, null, 2)}`,
|
|
534
|
+
level: 2,
|
|
535
|
+
});
|
|
536
|
+
// Process all parts - Google can send multiple function calls
|
|
537
|
+
for (const part of candidate.content.parts) {
|
|
538
|
+
if (part.text) {
|
|
539
|
+
message += part.text + "\n";
|
|
540
|
+
logger({
|
|
541
|
+
category: "agent",
|
|
542
|
+
message: `Reasoning: ${part.text}`,
|
|
543
|
+
level: 1,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
if (part.functionCall) {
|
|
547
|
+
functionCalls.push(part.functionCall);
|
|
548
|
+
logger({
|
|
549
|
+
category: "agent",
|
|
550
|
+
message: `Found function call: ${part.functionCall.name} with args: ${JSON.stringify(part.functionCall.args)}`,
|
|
551
|
+
level: 2,
|
|
552
|
+
});
|
|
553
|
+
// Convert function call to action(s)
|
|
554
|
+
const action = this.convertFunctionCallToAction(part.functionCall);
|
|
555
|
+
if (action) {
|
|
556
|
+
// Special handling for type_text_at - we need to click first
|
|
557
|
+
if (part.functionCall.name === "type_text_at" &&
|
|
558
|
+
action.type === "type") {
|
|
559
|
+
logger({
|
|
560
|
+
category: "agent",
|
|
561
|
+
message: `Adding action: ${JSON.stringify(action)}`,
|
|
562
|
+
level: 2,
|
|
563
|
+
});
|
|
564
|
+
// First add a click action at the same coordinates
|
|
565
|
+
actions.push({
|
|
566
|
+
type: "click",
|
|
567
|
+
x: action.x,
|
|
568
|
+
y: action.y,
|
|
569
|
+
button: "left",
|
|
570
|
+
});
|
|
571
|
+
// If clear_before_typing is true (default), add a select all
|
|
572
|
+
if (action.clearBeforeTyping) {
|
|
573
|
+
// Select all text in the field
|
|
574
|
+
actions.push({
|
|
575
|
+
type: "keypress",
|
|
576
|
+
keys: ["ControlOrMeta+A"],
|
|
577
|
+
});
|
|
578
|
+
actions.push({
|
|
579
|
+
type: "keypress",
|
|
580
|
+
keys: ["Backspace"],
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
// Then add the type action
|
|
584
|
+
actions.push(action);
|
|
585
|
+
if (action.pressEnter) {
|
|
586
|
+
actions.push({
|
|
587
|
+
type: "keypress",
|
|
588
|
+
keys: ["Enter"],
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
actions.push(action);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
logger({
|
|
598
|
+
category: "agent",
|
|
599
|
+
message: `Warning: Could not convert function call ${part.functionCall.name} to action`,
|
|
600
|
+
level: 1,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
// Log summary of what we found
|
|
606
|
+
logger({
|
|
607
|
+
category: "agent",
|
|
608
|
+
message: `Found ${functionCalls.length} function calls, converted to ${actions.length} actions`,
|
|
609
|
+
level: 2,
|
|
610
|
+
});
|
|
611
|
+
// Check if task is completed
|
|
612
|
+
const completed = functionCalls.length === 0 ||
|
|
613
|
+
(candidate.finishReason && candidate.finishReason !== "STOP");
|
|
614
|
+
return {
|
|
615
|
+
actions,
|
|
616
|
+
message: message.trim(),
|
|
617
|
+
completed,
|
|
618
|
+
functionCalls,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Convert Google function call to Stagehand action
|
|
623
|
+
*/
|
|
624
|
+
convertFunctionCallToAction(functionCall) {
|
|
625
|
+
const { name, args } = functionCall;
|
|
626
|
+
if (!name || !args) {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
switch (name) {
|
|
630
|
+
case "open_web_browser":
|
|
631
|
+
return {
|
|
632
|
+
type: "open_web_browser",
|
|
633
|
+
timestamp: Date.now(),
|
|
634
|
+
};
|
|
635
|
+
case "click_at": {
|
|
636
|
+
const { x, y } = this.normalizeCoordinates(args.x, args.y);
|
|
637
|
+
return {
|
|
638
|
+
type: "click",
|
|
639
|
+
x,
|
|
640
|
+
y,
|
|
641
|
+
button: args.button || "left",
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
case "type_text_at": {
|
|
645
|
+
const { x, y } = this.normalizeCoordinates(args.x, args.y);
|
|
646
|
+
// Google's type_text_at includes press_enter and clear_before_typing parameters
|
|
647
|
+
const pressEnter = args.press_enter ?? false;
|
|
648
|
+
const clearBeforeTyping = args.clear_before_typing ?? true;
|
|
649
|
+
// For type_text_at, we need to click first then type
|
|
650
|
+
// This matches the behavior expected by Google's CUA
|
|
651
|
+
// We'll handle this in the executeStep method by converting to two actions
|
|
652
|
+
return {
|
|
653
|
+
type: "type",
|
|
654
|
+
text: args.text,
|
|
655
|
+
x,
|
|
656
|
+
y,
|
|
657
|
+
pressEnter,
|
|
658
|
+
clearBeforeTyping,
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
case "key_combination": {
|
|
662
|
+
const keys = args.keys
|
|
663
|
+
.split("+")
|
|
664
|
+
.map((key) => key.trim())
|
|
665
|
+
.map((key) => mapKeyToPlaywright(key));
|
|
666
|
+
return {
|
|
667
|
+
type: "keypress",
|
|
668
|
+
keys,
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
case "scroll_document": {
|
|
672
|
+
const direction = args.direction.toLowerCase();
|
|
673
|
+
return {
|
|
674
|
+
type: "keypress",
|
|
675
|
+
keys: [direction === "up" ? "PageUp" : "PageDown"],
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
case "scroll_at": {
|
|
679
|
+
const { x, y } = this.normalizeCoordinates(args.x, args.y);
|
|
680
|
+
const direction = (args.direction || "down").toLowerCase();
|
|
681
|
+
const magnitude = typeof args.magnitude === "number" ? args.magnitude : 800;
|
|
682
|
+
let scroll_x = 0;
|
|
683
|
+
let scroll_y = 0;
|
|
684
|
+
if (direction === "up") {
|
|
685
|
+
scroll_y = -magnitude;
|
|
686
|
+
}
|
|
687
|
+
else if (direction === "down") {
|
|
688
|
+
scroll_y = magnitude;
|
|
689
|
+
}
|
|
690
|
+
else if (direction === "left") {
|
|
691
|
+
scroll_x = -magnitude;
|
|
692
|
+
}
|
|
693
|
+
else if (direction === "right") {
|
|
694
|
+
scroll_x = magnitude;
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
// Default to down if unknown direction
|
|
698
|
+
scroll_y = magnitude;
|
|
699
|
+
}
|
|
700
|
+
return {
|
|
701
|
+
type: "scroll",
|
|
702
|
+
x,
|
|
703
|
+
y,
|
|
704
|
+
scroll_x,
|
|
705
|
+
scroll_y,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
case "navigate":
|
|
709
|
+
return {
|
|
710
|
+
type: "goto",
|
|
711
|
+
url: args.url,
|
|
712
|
+
};
|
|
713
|
+
case "go_back":
|
|
714
|
+
return {
|
|
715
|
+
type: "back",
|
|
716
|
+
};
|
|
717
|
+
case "go_forward":
|
|
718
|
+
return {
|
|
719
|
+
type: "forward",
|
|
720
|
+
};
|
|
721
|
+
case "wait_5_seconds":
|
|
722
|
+
return {
|
|
723
|
+
type: "wait",
|
|
724
|
+
timeMs: 5000, // Google CUA waits for 5 seconds
|
|
725
|
+
};
|
|
726
|
+
case "hover_at": {
|
|
727
|
+
const { x, y } = this.normalizeCoordinates(args.x, args.y);
|
|
728
|
+
return {
|
|
729
|
+
type: "move",
|
|
730
|
+
x,
|
|
731
|
+
y,
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
case "search":
|
|
735
|
+
return {
|
|
736
|
+
type: "goto",
|
|
737
|
+
url: "https://www.google.com",
|
|
738
|
+
};
|
|
739
|
+
case "drag_and_drop": {
|
|
740
|
+
const startPoint = this.normalizeCoordinates(args.x, args.y);
|
|
741
|
+
const endPoint = this.normalizeCoordinates(args.destination_x, args.destination_y);
|
|
742
|
+
return {
|
|
743
|
+
type: "drag",
|
|
744
|
+
path: [
|
|
745
|
+
{ x: startPoint.x, y: startPoint.y },
|
|
746
|
+
{ x: endPoint.x, y: endPoint.y },
|
|
747
|
+
],
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
default:
|
|
751
|
+
if (isCustomTool(functionCall, this.tools)) {
|
|
752
|
+
return {
|
|
753
|
+
type: "custom_tool",
|
|
754
|
+
name,
|
|
755
|
+
arguments: args,
|
|
756
|
+
timestamp: Date.now(),
|
|
757
|
+
pageUrl: this.currentUrl,
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
console.warn(`Unsupported Google CUA function: ${name}`);
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Normalize coordinates from Google's 0-1000 range to viewport dimensions
|
|
766
|
+
*/
|
|
767
|
+
normalizeCoordinates(x, y) {
|
|
768
|
+
const clampedX = Math.min(999, Math.max(0, x));
|
|
769
|
+
const clampedY = Math.min(999, Math.max(0, y));
|
|
770
|
+
return {
|
|
771
|
+
x: Math.floor((clampedX / 1000) * this.currentViewport.width),
|
|
772
|
+
y: Math.floor((clampedY / 1000) * this.currentViewport.height),
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
async captureScreenshot(options) {
|
|
776
|
+
// Update current URL if provided
|
|
777
|
+
if (options?.currentUrl) {
|
|
778
|
+
this.currentUrl = options.currentUrl;
|
|
779
|
+
}
|
|
780
|
+
// Use provided options if available
|
|
781
|
+
if (options?.base64Image) {
|
|
782
|
+
return `data:image/png;base64,${options.base64Image}`;
|
|
783
|
+
}
|
|
784
|
+
// Use the screenshot provider if available
|
|
785
|
+
if (this.screenshotProvider) {
|
|
786
|
+
try {
|
|
787
|
+
const base64Image = await this.screenshotProvider();
|
|
788
|
+
return `data:image/png;base64,${base64Image}`;
|
|
789
|
+
}
|
|
790
|
+
catch (error) {
|
|
791
|
+
console.error("Error capturing screenshot:", error);
|
|
792
|
+
throw error;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
throw new AgentScreenshotProviderError("`screenshotProvider` has not been set. " +
|
|
796
|
+
"Please call `setScreenshotProvider()` with a valid function that returns a base64-encoded image");
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
//# sourceMappingURL=GoogleCUAClient.js.map
|