@browserbasehq/orca 3.0.9-alpha-3 → 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 +42 -27
- package/dist/index.d.ts +0 -4321
- package/dist/index.js +0 -69585
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import OpenAI from "openai";
|
|
2
|
+
import { AgentClient } from "./AgentClient.js";
|
|
3
|
+
import { AgentScreenshotProviderError, StagehandClosedError, } from "../types/public/sdkErrors.js";
|
|
4
|
+
import { SessionFileLogger, formatCuaPromptPreview, formatCuaResponsePreview, } from "../flowLogger.js";
|
|
5
|
+
import { v7 as uuidv7 } from "uuid";
|
|
6
|
+
/**
|
|
7
|
+
* Client for OpenAI's Computer Use Assistant API
|
|
8
|
+
* This implementation uses the official OpenAI Responses API for Computer Use
|
|
9
|
+
*/
|
|
10
|
+
export class OpenAICUAClient extends AgentClient {
|
|
11
|
+
apiKey;
|
|
12
|
+
organization;
|
|
13
|
+
baseURL;
|
|
14
|
+
client;
|
|
15
|
+
lastResponseId;
|
|
16
|
+
currentViewport = { width: 1288, height: 711 };
|
|
17
|
+
currentUrl;
|
|
18
|
+
screenshotProvider;
|
|
19
|
+
actionHandler;
|
|
20
|
+
reasoningItems = new Map();
|
|
21
|
+
environment = "browser"; // "browser", "mac", "windows", or "ubuntu"
|
|
22
|
+
tools;
|
|
23
|
+
safetyConfirmationHandler;
|
|
24
|
+
constructor(type, modelName, userProvidedInstructions, clientOptions, tools) {
|
|
25
|
+
super(type, modelName, userProvidedInstructions);
|
|
26
|
+
// Process client options
|
|
27
|
+
this.apiKey =
|
|
28
|
+
clientOptions?.apiKey || process.env.OPENAI_API_KEY || "";
|
|
29
|
+
this.baseURL = clientOptions?.baseURL || undefined;
|
|
30
|
+
this.organization =
|
|
31
|
+
clientOptions?.organization || process.env.OPENAI_ORG;
|
|
32
|
+
// Get environment if specified
|
|
33
|
+
if (clientOptions?.environment &&
|
|
34
|
+
typeof clientOptions.environment === "string") {
|
|
35
|
+
this.environment = clientOptions.environment;
|
|
36
|
+
}
|
|
37
|
+
// Store client options for reference
|
|
38
|
+
this.clientOptions = {
|
|
39
|
+
apiKey: this.apiKey,
|
|
40
|
+
};
|
|
41
|
+
if (this.baseURL) {
|
|
42
|
+
this.clientOptions.baseURL = this.baseURL;
|
|
43
|
+
}
|
|
44
|
+
// Initialize the OpenAI client
|
|
45
|
+
this.client = new OpenAI(this.clientOptions);
|
|
46
|
+
this.tools = tools;
|
|
47
|
+
}
|
|
48
|
+
setViewport(width, height) {
|
|
49
|
+
this.currentViewport = { width, height };
|
|
50
|
+
}
|
|
51
|
+
setCurrentUrl(url) {
|
|
52
|
+
this.currentUrl = url;
|
|
53
|
+
}
|
|
54
|
+
setScreenshotProvider(provider) {
|
|
55
|
+
this.screenshotProvider = provider;
|
|
56
|
+
}
|
|
57
|
+
setActionHandler(handler) {
|
|
58
|
+
this.actionHandler = handler;
|
|
59
|
+
}
|
|
60
|
+
setTools(tools) {
|
|
61
|
+
this.tools = tools;
|
|
62
|
+
}
|
|
63
|
+
setSafetyConfirmationHandler(handler) {
|
|
64
|
+
this.safetyConfirmationHandler = handler;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Execute a task with the OpenAI CUA
|
|
68
|
+
* This is the main entry point for the agent
|
|
69
|
+
* @implements AgentClient.execute
|
|
70
|
+
*/
|
|
71
|
+
async execute(executionOptions) {
|
|
72
|
+
const { options, logger } = executionOptions;
|
|
73
|
+
const { instruction } = options;
|
|
74
|
+
const maxSteps = options.maxSteps || 10;
|
|
75
|
+
let currentStep = 0;
|
|
76
|
+
let completed = false;
|
|
77
|
+
const actions = [];
|
|
78
|
+
const messageList = [];
|
|
79
|
+
let finalMessage = "";
|
|
80
|
+
this.reasoningItems.clear(); // Clear any previous reasoning items
|
|
81
|
+
// Start with the initial instruction
|
|
82
|
+
let inputItems = this.createInitialInputItems(instruction);
|
|
83
|
+
let previousResponseId = undefined;
|
|
84
|
+
let totalInputTokens = 0;
|
|
85
|
+
let totalOutputTokens = 0;
|
|
86
|
+
let totalInferenceTime = 0;
|
|
87
|
+
try {
|
|
88
|
+
// Execute steps until completion or max steps reached
|
|
89
|
+
while (!completed && currentStep < maxSteps) {
|
|
90
|
+
logger({
|
|
91
|
+
category: "agent",
|
|
92
|
+
message: `Executing step ${currentStep + 1}/${maxSteps}`,
|
|
93
|
+
level: 1,
|
|
94
|
+
});
|
|
95
|
+
const result = await this.executeStep(inputItems, previousResponseId, logger);
|
|
96
|
+
totalInputTokens += result.usage.input_tokens;
|
|
97
|
+
totalOutputTokens += result.usage.output_tokens;
|
|
98
|
+
totalInferenceTime += result.usage.inference_time_ms;
|
|
99
|
+
// Add actions to the list
|
|
100
|
+
actions.push(...result.actions);
|
|
101
|
+
// Update completion status
|
|
102
|
+
completed = result.completed;
|
|
103
|
+
// Store the previous response ID for the next request
|
|
104
|
+
previousResponseId = result.responseId;
|
|
105
|
+
// Update the input items for the next step if we're continuing
|
|
106
|
+
if (!completed) {
|
|
107
|
+
inputItems = result.nextInputItems;
|
|
108
|
+
}
|
|
109
|
+
// Record any message for this step
|
|
110
|
+
if (result.message) {
|
|
111
|
+
messageList.push(result.message);
|
|
112
|
+
finalMessage = result.message;
|
|
113
|
+
}
|
|
114
|
+
// Increment step counter
|
|
115
|
+
currentStep++;
|
|
116
|
+
}
|
|
117
|
+
// Return the final result
|
|
118
|
+
return {
|
|
119
|
+
success: completed,
|
|
120
|
+
actions,
|
|
121
|
+
message: finalMessage,
|
|
122
|
+
completed,
|
|
123
|
+
usage: {
|
|
124
|
+
input_tokens: totalInputTokens,
|
|
125
|
+
output_tokens: totalOutputTokens,
|
|
126
|
+
inference_time_ms: totalInferenceTime,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
132
|
+
logger({
|
|
133
|
+
category: "agent",
|
|
134
|
+
message: `Error executing agent task: ${errorMessage}`,
|
|
135
|
+
level: 0,
|
|
136
|
+
});
|
|
137
|
+
return {
|
|
138
|
+
success: false,
|
|
139
|
+
actions,
|
|
140
|
+
message: `Failed to execute task: ${errorMessage}`,
|
|
141
|
+
completed: false,
|
|
142
|
+
usage: {
|
|
143
|
+
input_tokens: totalInputTokens,
|
|
144
|
+
output_tokens: totalOutputTokens,
|
|
145
|
+
inference_time_ms: totalInferenceTime,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Execute a single step of the agent
|
|
152
|
+
* This coordinates the flow: Request → Get Action → Execute Action
|
|
153
|
+
*/
|
|
154
|
+
async executeStep(inputItems, previousResponseId, logger) {
|
|
155
|
+
try {
|
|
156
|
+
// Get response from the model
|
|
157
|
+
const result = await this.getAction(inputItems, previousResponseId);
|
|
158
|
+
const output = result.output;
|
|
159
|
+
const responseId = result.responseId;
|
|
160
|
+
const usage = {
|
|
161
|
+
input_tokens: result.usage.input_tokens,
|
|
162
|
+
output_tokens: result.usage.output_tokens,
|
|
163
|
+
inference_time_ms: result.usage.inference_time_ms,
|
|
164
|
+
};
|
|
165
|
+
// Add any reasoning items to our map
|
|
166
|
+
for (const item of output) {
|
|
167
|
+
if (item.type === "reasoning") {
|
|
168
|
+
this.reasoningItems.set(item.id, item);
|
|
169
|
+
logger({
|
|
170
|
+
category: "agent",
|
|
171
|
+
message: `Reasoning: ${String(item.content || "")}`,
|
|
172
|
+
level: 1,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Extract actions from the output
|
|
177
|
+
const stepActions = [];
|
|
178
|
+
for (const item of output) {
|
|
179
|
+
if (item.type === "computer_call" && this.isComputerCallItem(item)) {
|
|
180
|
+
logger({
|
|
181
|
+
category: "agent",
|
|
182
|
+
message: `Found computer_call: ${item.action.type}, call_id: ${item.call_id}`,
|
|
183
|
+
level: 2,
|
|
184
|
+
});
|
|
185
|
+
const action = this.convertComputerCallToAction(item);
|
|
186
|
+
if (action) {
|
|
187
|
+
stepActions.push(action);
|
|
188
|
+
logger({
|
|
189
|
+
category: "agent",
|
|
190
|
+
message: `Converted computer_call to action: ${action.type}`,
|
|
191
|
+
level: 2,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (item.type === "function_call" &&
|
|
196
|
+
this.isFunctionCallItem(item)) {
|
|
197
|
+
logger({
|
|
198
|
+
category: "agent",
|
|
199
|
+
message: `Found function_call: ${item.name}, call_id: ${item.call_id}`,
|
|
200
|
+
level: 2,
|
|
201
|
+
});
|
|
202
|
+
const action = this.convertFunctionCallToAction(item);
|
|
203
|
+
if (action) {
|
|
204
|
+
stepActions.push(action);
|
|
205
|
+
logger({
|
|
206
|
+
category: "agent",
|
|
207
|
+
message: `Converted function_call to action: ${action.type}`,
|
|
208
|
+
level: 2,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Extract message text
|
|
214
|
+
let message = "";
|
|
215
|
+
for (const item of output) {
|
|
216
|
+
if (item.type === "message") {
|
|
217
|
+
logger({
|
|
218
|
+
category: "agent",
|
|
219
|
+
message: `Found message block`,
|
|
220
|
+
level: 2,
|
|
221
|
+
});
|
|
222
|
+
if (item.content && Array.isArray(item.content)) {
|
|
223
|
+
for (const content of item.content) {
|
|
224
|
+
if (content.type === "output_text" && content.text) {
|
|
225
|
+
message += content.text + "\n";
|
|
226
|
+
logger({
|
|
227
|
+
category: "agent",
|
|
228
|
+
message: `Message text: ${String(content.text || "")}`,
|
|
229
|
+
level: 1,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Take actions and get results
|
|
237
|
+
const nextInputItems = await this.takeAction(output, logger);
|
|
238
|
+
// Check if completed
|
|
239
|
+
const completed = output.length === 0 ||
|
|
240
|
+
output.every((item) => item.type === "message" || item.type === "reasoning");
|
|
241
|
+
return {
|
|
242
|
+
actions: stepActions,
|
|
243
|
+
message: message.trim(),
|
|
244
|
+
completed,
|
|
245
|
+
nextInputItems,
|
|
246
|
+
responseId,
|
|
247
|
+
usage: usage,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
252
|
+
logger({
|
|
253
|
+
category: "agent",
|
|
254
|
+
message: `Error executing step: ${errorMessage}`,
|
|
255
|
+
level: 0,
|
|
256
|
+
});
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
isComputerCallItem(item) {
|
|
261
|
+
return (item.type === "computer_call" &&
|
|
262
|
+
"call_id" in item &&
|
|
263
|
+
"action" in item &&
|
|
264
|
+
typeof item.action === "object");
|
|
265
|
+
}
|
|
266
|
+
async handleSafetyConfirmation(pendingSafetyChecks, logger) {
|
|
267
|
+
if (this.safetyConfirmationHandler) {
|
|
268
|
+
logger({
|
|
269
|
+
category: "agent",
|
|
270
|
+
message: `Requesting safety confirmation for ${pendingSafetyChecks.length} check(s): ${pendingSafetyChecks.map((c) => c.code).join(", ")}`,
|
|
271
|
+
level: 1,
|
|
272
|
+
});
|
|
273
|
+
const response = await this.safetyConfirmationHandler(pendingSafetyChecks);
|
|
274
|
+
if (response.acknowledged) {
|
|
275
|
+
logger({
|
|
276
|
+
category: "agent",
|
|
277
|
+
message: `Safety checks acknowledged by user`,
|
|
278
|
+
level: 1,
|
|
279
|
+
});
|
|
280
|
+
return pendingSafetyChecks;
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
logger({
|
|
284
|
+
category: "agent",
|
|
285
|
+
message: `Safety checks rejected by user`,
|
|
286
|
+
level: 1,
|
|
287
|
+
});
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
logger({
|
|
292
|
+
category: "agent",
|
|
293
|
+
message: `Auto-acknowledging ${pendingSafetyChecks.length} safety check(s)`,
|
|
294
|
+
level: 2,
|
|
295
|
+
});
|
|
296
|
+
return pendingSafetyChecks;
|
|
297
|
+
}
|
|
298
|
+
isFunctionCallItem(item) {
|
|
299
|
+
return (item.type === "function_call" &&
|
|
300
|
+
"call_id" in item &&
|
|
301
|
+
"name" in item &&
|
|
302
|
+
"arguments" in item);
|
|
303
|
+
}
|
|
304
|
+
createInitialInputItems(instruction) {
|
|
305
|
+
// For the initial request, we use a simple array with the user's instruction
|
|
306
|
+
return [
|
|
307
|
+
{
|
|
308
|
+
role: "system",
|
|
309
|
+
content: this.userProvidedInstructions,
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
role: "user",
|
|
313
|
+
content: instruction,
|
|
314
|
+
},
|
|
315
|
+
];
|
|
316
|
+
}
|
|
317
|
+
async getAction(inputItems, previousResponseId) {
|
|
318
|
+
try {
|
|
319
|
+
// Create the request parameters
|
|
320
|
+
const requestParams = {
|
|
321
|
+
model: this.modelName,
|
|
322
|
+
tools: [
|
|
323
|
+
{
|
|
324
|
+
type: "computer_use_preview",
|
|
325
|
+
display_width: this.currentViewport.width,
|
|
326
|
+
display_height: this.currentViewport.height,
|
|
327
|
+
environment: this.environment,
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
input: inputItems,
|
|
331
|
+
truncation: "auto",
|
|
332
|
+
};
|
|
333
|
+
// Add custom tools if available
|
|
334
|
+
if (this.tools && Object.keys(this.tools).length > 0) {
|
|
335
|
+
const customTools = Object.entries(this.tools).map(([name, tool]) => ({
|
|
336
|
+
type: "function",
|
|
337
|
+
name,
|
|
338
|
+
function: {
|
|
339
|
+
name,
|
|
340
|
+
description: tool.description,
|
|
341
|
+
parameters: tool.inputSchema,
|
|
342
|
+
},
|
|
343
|
+
}));
|
|
344
|
+
requestParams.tools = [
|
|
345
|
+
...requestParams.tools,
|
|
346
|
+
...customTools,
|
|
347
|
+
];
|
|
348
|
+
}
|
|
349
|
+
// Add previous_response_id if available
|
|
350
|
+
if (previousResponseId) {
|
|
351
|
+
requestParams.previous_response_id = previousResponseId;
|
|
352
|
+
}
|
|
353
|
+
// Log LLM request
|
|
354
|
+
const llmRequestId = uuidv7();
|
|
355
|
+
SessionFileLogger.logLlmRequest({
|
|
356
|
+
requestId: llmRequestId,
|
|
357
|
+
model: this.modelName,
|
|
358
|
+
operation: "CUA.getAction",
|
|
359
|
+
prompt: formatCuaPromptPreview(inputItems),
|
|
360
|
+
});
|
|
361
|
+
const startTime = Date.now();
|
|
362
|
+
// Create the response using the OpenAI Responses API
|
|
363
|
+
// @ts-expect-error - Force type to match what the OpenAI SDK expects
|
|
364
|
+
const response = await this.client.responses.create(requestParams);
|
|
365
|
+
const endTime = Date.now();
|
|
366
|
+
const elapsedMs = endTime - startTime;
|
|
367
|
+
// Extract only the input_tokens and output_tokens
|
|
368
|
+
const usage = {
|
|
369
|
+
input_tokens: response.usage.input_tokens,
|
|
370
|
+
output_tokens: response.usage.output_tokens,
|
|
371
|
+
inference_time_ms: elapsedMs,
|
|
372
|
+
};
|
|
373
|
+
// Log LLM response
|
|
374
|
+
SessionFileLogger.logLlmResponse({
|
|
375
|
+
requestId: llmRequestId,
|
|
376
|
+
model: this.modelName,
|
|
377
|
+
operation: "CUA.getAction",
|
|
378
|
+
output: formatCuaResponsePreview(response.output),
|
|
379
|
+
inputTokens: response.usage.input_tokens,
|
|
380
|
+
outputTokens: response.usage.output_tokens,
|
|
381
|
+
});
|
|
382
|
+
// Store the response ID for future use
|
|
383
|
+
this.lastResponseId = response.id;
|
|
384
|
+
// Return the output and response ID
|
|
385
|
+
return {
|
|
386
|
+
output: response.output,
|
|
387
|
+
responseId: response.id,
|
|
388
|
+
usage,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
console.error("Error getting action from OpenAI:", error);
|
|
393
|
+
throw error;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
async takeAction(output, logger) {
|
|
397
|
+
const nextInputItems = [];
|
|
398
|
+
// Process each output item
|
|
399
|
+
for (const item of output) {
|
|
400
|
+
if (item.type === "computer_call" && this.isComputerCallItem(item)) {
|
|
401
|
+
// Handle computer calls
|
|
402
|
+
try {
|
|
403
|
+
const action = this.convertComputerCallToAction(item);
|
|
404
|
+
if (action && this.actionHandler) {
|
|
405
|
+
logger({
|
|
406
|
+
category: "agent",
|
|
407
|
+
message: `Executing computer action: ${action.type}`,
|
|
408
|
+
level: 1,
|
|
409
|
+
});
|
|
410
|
+
await this.actionHandler(action);
|
|
411
|
+
}
|
|
412
|
+
// Capture a screenshot
|
|
413
|
+
const screenshot = await this.captureScreenshot();
|
|
414
|
+
// Create a computer_call_output for the next request
|
|
415
|
+
const outputItem = {
|
|
416
|
+
type: "computer_call_output",
|
|
417
|
+
call_id: item.call_id,
|
|
418
|
+
output: {
|
|
419
|
+
type: "input_image",
|
|
420
|
+
image_url: screenshot,
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
logger({
|
|
424
|
+
category: "agent",
|
|
425
|
+
message: `Added computer_call_output for call_id: ${item.call_id}`,
|
|
426
|
+
level: 2,
|
|
427
|
+
});
|
|
428
|
+
// Add current URL if available
|
|
429
|
+
if (this.currentUrl) {
|
|
430
|
+
const computerCallOutput = outputItem;
|
|
431
|
+
computerCallOutput.output.current_url = this.currentUrl;
|
|
432
|
+
}
|
|
433
|
+
if (item.pending_safety_checks &&
|
|
434
|
+
item.pending_safety_checks.length > 0) {
|
|
435
|
+
const acknowledgedChecks = await this.handleSafetyConfirmation(item.pending_safety_checks, logger);
|
|
436
|
+
if (acknowledgedChecks) {
|
|
437
|
+
const computerCallOutput = outputItem;
|
|
438
|
+
computerCallOutput.acknowledged_safety_checks =
|
|
439
|
+
acknowledgedChecks;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
nextInputItems.push(outputItem);
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
if (error instanceof StagehandClosedError) {
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
449
|
+
logger({
|
|
450
|
+
category: "agent",
|
|
451
|
+
message: `Error executing computer call: ${errorMessage}`,
|
|
452
|
+
level: 0,
|
|
453
|
+
});
|
|
454
|
+
try {
|
|
455
|
+
// Capture a screenshot even on error
|
|
456
|
+
const screenshot = await this.captureScreenshot();
|
|
457
|
+
const errorOutputItem = {
|
|
458
|
+
type: "computer_call_output",
|
|
459
|
+
call_id: item.call_id,
|
|
460
|
+
output: {
|
|
461
|
+
type: "input_image",
|
|
462
|
+
image_url: screenshot,
|
|
463
|
+
error: errorMessage,
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
// Add current URL if available
|
|
467
|
+
if (this.currentUrl) {
|
|
468
|
+
const computerCallOutput = errorOutputItem;
|
|
469
|
+
computerCallOutput.output.current_url = this.currentUrl;
|
|
470
|
+
}
|
|
471
|
+
if (item.pending_safety_checks &&
|
|
472
|
+
item.pending_safety_checks.length > 0) {
|
|
473
|
+
const acknowledgedChecks = await this.handleSafetyConfirmation(item.pending_safety_checks, logger);
|
|
474
|
+
if (acknowledgedChecks) {
|
|
475
|
+
const computerCallOutput = errorOutputItem;
|
|
476
|
+
computerCallOutput.acknowledged_safety_checks =
|
|
477
|
+
acknowledgedChecks;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
nextInputItems.push(errorOutputItem);
|
|
481
|
+
}
|
|
482
|
+
catch (screenshotError) {
|
|
483
|
+
if (screenshotError instanceof StagehandClosedError) {
|
|
484
|
+
throw screenshotError;
|
|
485
|
+
}
|
|
486
|
+
// If we can't capture a screenshot, just send the error
|
|
487
|
+
logger({
|
|
488
|
+
category: "agent",
|
|
489
|
+
message: `Error capturing screenshot: ${String(screenshotError)}`,
|
|
490
|
+
level: 0,
|
|
491
|
+
});
|
|
492
|
+
// For error cases without a screenshot, we need to use a string output
|
|
493
|
+
nextInputItems.push({
|
|
494
|
+
type: "computer_call_output",
|
|
495
|
+
call_id: item.call_id,
|
|
496
|
+
output: `Error: ${errorMessage}`,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
else if (item.type === "function_call" &&
|
|
502
|
+
this.isFunctionCallItem(item)) {
|
|
503
|
+
// Handle function calls (tool calls)
|
|
504
|
+
try {
|
|
505
|
+
const action = this.convertFunctionCallToAction(item);
|
|
506
|
+
if (action && this.actionHandler) {
|
|
507
|
+
await this.actionHandler(action);
|
|
508
|
+
}
|
|
509
|
+
// Execute the tool if available
|
|
510
|
+
let toolResult = "Tool executed successfully";
|
|
511
|
+
if (this.tools && item.name in this.tools) {
|
|
512
|
+
try {
|
|
513
|
+
const tool = this.tools[item.name];
|
|
514
|
+
const args = JSON.parse(item.arguments);
|
|
515
|
+
logger({
|
|
516
|
+
category: "agent",
|
|
517
|
+
message: `Executing tool call: ${item.name} with args: ${item.arguments}`,
|
|
518
|
+
level: 1,
|
|
519
|
+
});
|
|
520
|
+
const result = await tool.execute(args, {
|
|
521
|
+
toolCallId: item.call_id,
|
|
522
|
+
messages: [],
|
|
523
|
+
});
|
|
524
|
+
toolResult = JSON.stringify(result);
|
|
525
|
+
logger({
|
|
526
|
+
category: "agent",
|
|
527
|
+
message: `Tool ${item.name} completed successfully. Result: ${toolResult}`,
|
|
528
|
+
level: 1,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
catch (toolError) {
|
|
532
|
+
const errorMessage = toolError instanceof Error
|
|
533
|
+
? toolError.message
|
|
534
|
+
: String(toolError);
|
|
535
|
+
toolResult = `Error executing tool: ${errorMessage}`;
|
|
536
|
+
logger({
|
|
537
|
+
category: "agent",
|
|
538
|
+
message: `Error executing tool ${item.name}: ${errorMessage}`,
|
|
539
|
+
level: 0,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// Create a function_call_output for the next request
|
|
544
|
+
const outputItem = {
|
|
545
|
+
type: "function_call_output",
|
|
546
|
+
call_id: item.call_id,
|
|
547
|
+
output: toolResult,
|
|
548
|
+
};
|
|
549
|
+
nextInputItems.push(outputItem);
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
if (error instanceof StagehandClosedError) {
|
|
553
|
+
throw error;
|
|
554
|
+
}
|
|
555
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
556
|
+
logger({
|
|
557
|
+
category: "agent",
|
|
558
|
+
message: `Error executing function call: ${errorMessage}`,
|
|
559
|
+
level: 0,
|
|
560
|
+
});
|
|
561
|
+
// Send error result back
|
|
562
|
+
const errorOutputItem = {
|
|
563
|
+
type: "function_call_output",
|
|
564
|
+
call_id: item.call_id,
|
|
565
|
+
output: `Error: ${errorMessage}`,
|
|
566
|
+
};
|
|
567
|
+
nextInputItems.push(errorOutputItem);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return nextInputItems;
|
|
572
|
+
}
|
|
573
|
+
convertComputerCallToAction(call) {
|
|
574
|
+
const { action } = call;
|
|
575
|
+
// Instead of wrapping the action in a params object, spread the action properties directly
|
|
576
|
+
// This ensures properties like x, y, button, etc. are directly accessible on the AgentAction
|
|
577
|
+
return {
|
|
578
|
+
type: action.type,
|
|
579
|
+
...action, // Spread all properties from the action
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
convertFunctionCallToAction(call) {
|
|
583
|
+
try {
|
|
584
|
+
const args = JSON.parse(call.arguments);
|
|
585
|
+
return {
|
|
586
|
+
type: call.name,
|
|
587
|
+
params: args,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
catch (error) {
|
|
591
|
+
console.error("Error parsing function call arguments:", error);
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
async captureScreenshot(options) {
|
|
596
|
+
// Use provided options if available
|
|
597
|
+
if (options?.base64Image) {
|
|
598
|
+
return `data:image/png;base64,${options.base64Image}`;
|
|
599
|
+
}
|
|
600
|
+
// Use the screenshot provider if available
|
|
601
|
+
if (this.screenshotProvider) {
|
|
602
|
+
try {
|
|
603
|
+
const base64Image = await this.screenshotProvider();
|
|
604
|
+
return `data:image/png;base64,${base64Image}`;
|
|
605
|
+
}
|
|
606
|
+
catch (error) {
|
|
607
|
+
console.error("Error capturing screenshot:", error);
|
|
608
|
+
throw error;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
throw new AgentScreenshotProviderError("`screenshotProvider` has not been set. " +
|
|
612
|
+
"Please call `setScreenshotProvider()` with a valid function that returns a base64-encoded image");
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
//# sourceMappingURL=OpenAICUAClient.js.map
|