@browserbasehq/orca 3.1.0-patch.0 → 3.1.0-patch.2
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/cjs/cli.js +183 -0
- package/dist/cjs/cli.js.map +7 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +24956 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/lib/inference.d.ts +65 -0
- package/dist/cjs/lib/inferenceLogUtils.d.ts +12 -0
- package/dist/cjs/lib/logger.d.ts +69 -0
- package/dist/cjs/lib/modelUtils.d.ts +11 -0
- package/dist/cjs/lib/prompt.d.ts +14 -0
- package/dist/cjs/lib/utils.d.ts +68 -0
- package/dist/cjs/lib/v3/agent/AgentClient.d.ts +19 -0
- package/dist/cjs/lib/v3/agent/AgentProvider.d.ts +20 -0
- package/dist/cjs/lib/v3/agent/AnthropicCUAClient.d.ts +57 -0
- package/dist/cjs/lib/v3/agent/GoogleCUAClient.d.ts +74 -0
- package/dist/cjs/lib/v3/agent/MicrosoftCUAClient.d.ts +71 -0
- package/dist/cjs/lib/v3/agent/OpenAICUAClient.d.ts +69 -0
- package/dist/cjs/lib/v3/agent/prompts/agentSystemPrompt.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/tools/act.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/tools/ariaTree.d.ts +5 -0
- package/dist/cjs/lib/v3/agent/tools/click.d.ts +6 -0
- package/dist/cjs/lib/v3/agent/tools/clickAndHold.d.ts +14 -0
- package/dist/cjs/lib/v3/agent/tools/dragAndDrop.d.ts +7 -0
- package/dist/cjs/lib/v3/agent/tools/extract.d.ts +20 -0
- package/dist/cjs/lib/v3/agent/tools/fillFormVision.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/tools/fillform.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/tools/goto.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/tools/index.d.ts +92 -0
- package/dist/cjs/lib/v3/agent/tools/keys.d.ts +24 -0
- package/dist/cjs/lib/v3/agent/tools/navback.d.ts +6 -0
- package/dist/cjs/lib/v3/agent/tools/screenshot.d.ts +6 -0
- package/dist/cjs/lib/v3/agent/tools/scroll.d.ts +19 -0
- package/dist/cjs/lib/v3/agent/tools/search.d.ts +15 -0
- package/dist/cjs/lib/v3/agent/tools/think.d.ts +6 -0
- package/dist/cjs/lib/v3/agent/tools/type.d.ts +7 -0
- package/dist/cjs/lib/v3/agent/tools/wait.d.ts +5 -0
- package/dist/cjs/lib/v3/agent/utils/actionMapping.d.ts +3 -0
- package/dist/cjs/lib/v3/agent/utils/coordinateNormalization.d.ts +13 -0
- package/dist/cjs/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
- package/dist/cjs/lib/v3/agent/utils/googleCustomToolHandler.d.ts +25 -0
- package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.d.ts +22 -0
- package/dist/cjs/lib/v3/agent/utils/imageCompression.d.ts +53 -0
- package/dist/cjs/lib/v3/agent/utils/messageProcessing.d.ts +12 -0
- package/dist/cjs/lib/v3/agent/utils/screenshotHandler.d.ts +10 -0
- package/dist/cjs/lib/v3/agent/utils/validateExperimentalFeatures.d.ts +26 -0
- package/dist/cjs/lib/v3/agent/utils/xpath.d.ts +11 -0
- package/dist/cjs/lib/v3/api.d.ts +86 -0
- package/dist/cjs/lib/v3/cache/ActCache.d.ts +23 -0
- package/dist/cjs/lib/v3/cache/AgentCache.d.ts +109 -0
- package/dist/cjs/lib/v3/cache/CacheStorage.d.ts +17 -0
- package/dist/cjs/lib/v3/cache/serverAgentCache.d.ts +7 -0
- package/dist/cjs/lib/v3/cache/utils.d.ts +15 -0
- package/dist/cjs/lib/v3/cli.d.ts +2 -0
- package/dist/cjs/lib/v3/dom/a11yScripts/index.d.ts +11 -0
- package/dist/cjs/lib/v3/dom/build/a11yScripts.generated.d.ts +16 -0
- package/dist/cjs/lib/v3/dom/build/locatorScripts.generated.d.ts +52 -0
- package/dist/cjs/lib/v3/dom/build/reRenderScriptContent.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/build/rerender-index.d.ts +0 -0
- package/dist/cjs/lib/v3/dom/build/rerender-index.js +1 -0
- package/dist/cjs/lib/v3/dom/build/screenshotScripts.generated.d.ts +4 -0
- package/dist/cjs/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/build/v3-index.d.ts +0 -0
- package/dist/cjs/lib/v3/dom/build/v3-index.js +1 -0
- package/dist/cjs/lib/v3/dom/genA11yScripts.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/genDomScripts.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/genLocatorScripts.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/genScreenshotScripts.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/index.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/counts.d.ts +15 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/index.d.ts +4 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/scripts.d.ts +37 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/selectors.d.ts +4 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/waitForSelector.d.ts +19 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/xpathParser.d.ts +76 -0
- package/dist/cjs/lib/v3/dom/locatorScripts/xpathResolver.d.ts +9 -0
- package/dist/cjs/lib/v3/dom/piercer.entry.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/piercer.runtime.d.ts +23 -0
- package/dist/cjs/lib/v3/dom/rerenderMissingShadows.entry.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/rerenderMissingShadows.runtime.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/screenshotScripts/index.d.ts +1 -0
- package/dist/cjs/lib/v3/dom/screenshotScripts/resolveMaskRect.d.ts +8 -0
- package/dist/cjs/lib/v3/external_clients/aisdk.d.ts +11 -0
- package/dist/cjs/lib/v3/external_clients/customOpenAI.d.ts +18 -0
- package/dist/cjs/lib/v3/flowLogger.d.ts +139 -0
- package/dist/cjs/lib/v3/handlers/actHandler.d.ts +21 -0
- package/dist/cjs/lib/v3/handlers/extractHandler.d.ts +31 -0
- package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +24 -0
- package/dist/cjs/lib/v3/handlers/handlerUtils/timeoutGuard.d.ts +2 -0
- package/dist/cjs/lib/v3/handlers/observeHandler.d.ts +17 -0
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +32 -0
- package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.d.ts +33 -0
- package/dist/cjs/lib/v3/index.d.ts +18 -0
- package/dist/cjs/lib/v3/launch/browserbase.d.ts +7 -0
- package/dist/cjs/lib/v3/launch/local.d.ts +15 -0
- package/dist/cjs/lib/v3/llm/AnthropicClient.d.ts +16 -0
- package/dist/cjs/lib/v3/llm/CerebrasClient.d.ts +17 -0
- package/dist/cjs/lib/v3/llm/GoogleClient.d.ts +19 -0
- package/dist/cjs/lib/v3/llm/GroqClient.d.ts +17 -0
- package/dist/cjs/lib/v3/llm/LLMClient.d.ts +121 -0
- package/dist/cjs/lib/v3/llm/LLMProvider.d.ts +13 -0
- package/dist/cjs/lib/v3/llm/OpenAIClient.d.ts +15 -0
- package/dist/cjs/lib/v3/llm/aisdk.d.ts +15 -0
- package/dist/cjs/lib/v3/logger.d.ts +9 -0
- package/dist/cjs/lib/v3/mcp/connection.d.ts +11 -0
- package/dist/cjs/lib/v3/mcp/utils.d.ts +3 -0
- package/dist/cjs/lib/v3/shutdown/cleanupLocal.d.ts +14 -0
- package/dist/cjs/lib/v3/shutdown/supervisor.d.ts +11 -0
- package/dist/cjs/lib/v3/shutdown/supervisorClient.d.ts +15 -0
- package/dist/cjs/lib/v3/tests/agent-abort-signal.spec.js +113 -0
- package/dist/cjs/lib/v3/tests/agent-abort-signal.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-cache-self-heal.spec.js +102 -0
- package/dist/cjs/lib/v3/tests/agent-cache-self-heal.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-callbacks.spec.js +374 -0
- package/dist/cjs/lib/v3/tests/agent-callbacks.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-experimental-validation.spec.js +354 -0
- package/dist/cjs/lib/v3/tests/agent-experimental-validation.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-hybrid-mode.spec.js +247 -0
- package/dist/cjs/lib/v3/tests/agent-hybrid-mode.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-message-continuation.spec.js +105 -0
- package/dist/cjs/lib/v3/tests/agent-message-continuation.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/agent-streaming.spec.js +126 -0
- package/dist/cjs/lib/v3/tests/agent-streaming.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/cdp-session-detached.spec.js +44 -0
- package/dist/cjs/lib/v3/tests/cdp-session-detached.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/click-count.spec.js +147 -0
- package/dist/cjs/lib/v3/tests/click-count.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/connect-to-existing-browser.spec.js +54 -0
- package/dist/cjs/lib/v3/tests/connect-to-existing-browser.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/context-addInitScript.spec.js +176 -0
- package/dist/cjs/lib/v3/tests/context-addInitScript.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/default-page-tracking.spec.js +53 -0
- package/dist/cjs/lib/v3/tests/default-page-tracking.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/downloads.spec.js +80 -0
- package/dist/cjs/lib/v3/tests/downloads.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/frame-get-location-and-click.spec.js +53 -0
- package/dist/cjs/lib/v3/tests/frame-get-location-and-click.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/iframe-ctx-addInitScript.spec.js +493 -0
- package/dist/cjs/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/keep-alive.child.js +92 -0
- package/dist/cjs/lib/v3/tests/keep-alive.child.js.map +7 -0
- package/dist/cjs/lib/v3/tests/keep-alive.helpers.js +568 -0
- package/dist/cjs/lib/v3/tests/keep-alive.helpers.js.map +7 -0
- package/dist/cjs/lib/v3/tests/keep-alive.spec.js +15 -0
- package/dist/cjs/lib/v3/tests/keep-alive.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/keyboard.spec.js +296 -0
- package/dist/cjs/lib/v3/tests/keyboard.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-backend-node-id.spec.js +159 -0
- package/dist/cjs/lib/v3/tests/locator-backend-node-id.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-content-methods.spec.js +191 -0
- package/dist/cjs/lib/v3/tests/locator-content-methods.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-count-iframe.spec.js +108 -0
- package/dist/cjs/lib/v3/tests/locator-count-iframe.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-count.spec.js +71 -0
- package/dist/cjs/lib/v3/tests/locator-count.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-fill.spec.js +118 -0
- package/dist/cjs/lib/v3/tests/locator-fill.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-input-methods.spec.js +136 -0
- package/dist/cjs/lib/v3/tests/locator-input-methods.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-nth.spec.js +157 -0
- package/dist/cjs/lib/v3/tests/locator-nth.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/locator-select-option.spec.js +242 -0
- package/dist/cjs/lib/v3/tests/locator-select-option.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/logger-initialization.spec.js +547 -0
- package/dist/cjs/lib/v3/tests/logger-initialization.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/multi-instance-logger.spec.js +269 -0
- package/dist/cjs/lib/v3/tests/multi-instance-logger.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/nested-div.spec.js +23 -0
- package/dist/cjs/lib/v3/tests/nested-div.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-addInitScript.spec.js +90 -0
- package/dist/cjs/lib/v3/tests/page-addInitScript.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-console.spec.js +56 -0
- package/dist/cjs/lib/v3/tests/page-console.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-drag-and-drop.spec.js +418 -0
- package/dist/cjs/lib/v3/tests/page-drag-and-drop.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-goto-response.spec.js +35 -0
- package/dist/cjs/lib/v3/tests/page-goto-response.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-hover.spec.js +167 -0
- package/dist/cjs/lib/v3/tests/page-hover.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-screenshot.spec.js +295 -0
- package/dist/cjs/lib/v3/tests/page-screenshot.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-scroll.spec.js +182 -0
- package/dist/cjs/lib/v3/tests/page-scroll.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/page-send-cdp.spec.js +46 -0
- package/dist/cjs/lib/v3/tests/page-send-cdp.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/perform-understudy-method.spec.js +98 -0
- package/dist/cjs/lib/v3/tests/perform-understudy-method.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/setinputfiles.spec.js +148 -0
- package/dist/cjs/lib/v3/tests/setinputfiles.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/shadow-iframe-oopif.spec.js +156 -0
- package/dist/cjs/lib/v3/tests/shadow-iframe-oopif.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/shadow-iframe-spif.spec.js +156 -0
- package/dist/cjs/lib/v3/tests/shadow-iframe-spif.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/testUtils.js +54 -0
- package/dist/cjs/lib/v3/tests/testUtils.js.map +7 -0
- package/dist/cjs/lib/v3/tests/text-selector-innermost.spec.js +100 -0
- package/dist/cjs/lib/v3/tests/text-selector-innermost.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/timeouts.spec.js +32 -0
- package/dist/cjs/lib/v3/tests/timeouts.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/user-data-dir.spec.js +65 -0
- package/dist/cjs/lib/v3/tests/user-data-dir.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/v3.config.js +36 -0
- package/dist/cjs/lib/v3/tests/v3.config.js.map +7 -0
- package/dist/cjs/lib/v3/tests/v3.dynamic.config.js +67 -0
- package/dist/cjs/lib/v3/tests/v3.dynamic.config.js.map +7 -0
- package/dist/cjs/lib/v3/tests/v3.playwright.config.js +61 -0
- package/dist/cjs/lib/v3/tests/v3.playwright.config.js.map +7 -0
- package/dist/cjs/lib/v3/tests/wait-for-selector.spec.js +593 -0
- package/dist/cjs/lib/v3/tests/wait-for-selector.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/wait-for-timeout.spec.js +97 -0
- package/dist/cjs/lib/v3/tests/wait-for-timeout.spec.js.map +7 -0
- package/dist/cjs/lib/v3/tests/xpath-for-location-deep.spec.js +77 -0
- package/dist/cjs/lib/v3/tests/xpath-for-location-deep.spec.js.map +7 -0
- package/dist/cjs/lib/v3/timeoutConfig.d.ts +2 -0
- package/dist/cjs/lib/v3/types/private/agent.d.ts +6 -0
- package/dist/cjs/lib/v3/types/private/api.d.ts +11 -0
- package/dist/cjs/lib/v3/types/private/cache.d.ts +128 -0
- package/dist/cjs/lib/v3/types/private/evaluator.d.ts +40 -0
- package/dist/cjs/lib/v3/types/private/handlers.d.ts +38 -0
- package/dist/cjs/lib/v3/types/private/index.d.ts +7 -0
- package/dist/cjs/lib/v3/types/private/internal.d.ts +39 -0
- package/dist/cjs/lib/v3/types/private/locator.d.ts +9 -0
- package/dist/cjs/lib/v3/types/private/network.d.ts +34 -0
- package/dist/cjs/lib/v3/types/private/shutdown.d.ts +19 -0
- package/dist/cjs/lib/v3/types/private/shutdownErrors.d.ts +12 -0
- package/dist/cjs/lib/v3/types/private/snapshot.d.ts +117 -0
- package/dist/cjs/lib/v3/types/public/agent.d.ts +595 -0
- package/dist/cjs/lib/v3/types/public/api.d.ts +1211 -0
- package/dist/cjs/lib/v3/types/public/apiErrors.d.ts +18 -0
- package/dist/cjs/lib/v3/types/public/index.d.ts +12 -0
- package/dist/cjs/lib/v3/types/public/locator.d.ts +9 -0
- package/dist/cjs/lib/v3/types/public/logs.d.ts +23 -0
- package/dist/cjs/lib/v3/types/public/methods.d.ts +56 -0
- package/dist/cjs/lib/v3/types/public/metrics.d.ts +27 -0
- package/dist/cjs/lib/v3/types/public/model.d.ts +65 -0
- package/dist/cjs/lib/v3/types/public/options.d.ts +70 -0
- package/dist/cjs/lib/v3/types/public/page.d.ts +18 -0
- package/dist/cjs/lib/v3/types/public/screenshotTypes.d.ts +25 -0
- package/dist/cjs/lib/v3/types/public/sdkErrors.d.ts +152 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/a11yTree.d.ts +15 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/activeElement.d.ts +8 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/capture.d.ts +77 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/coordinateResolver.d.ts +7 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/domTree.d.ts +46 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/focusSelectors.d.ts +24 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/index.d.ts +4 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/sessions.d.ts +16 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/treeFormatUtils.d.ts +28 -0
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/xpathUtils.d.ts +26 -0
- package/dist/cjs/lib/v3/understudy/a11yInvocation.d.ts +8 -0
- package/dist/cjs/lib/v3/understudy/cdp.d.ts +69 -0
- package/dist/cjs/lib/v3/understudy/consoleMessage.d.ts +22 -0
- package/dist/cjs/lib/v3/understudy/context.d.ts +132 -0
- package/dist/cjs/lib/v3/understudy/deepLocator.d.ts +87 -0
- package/dist/cjs/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
- package/dist/cjs/lib/v3/understudy/fileUploadUtils.d.ts +13 -0
- package/dist/cjs/lib/v3/understudy/frame.d.ts +69 -0
- package/dist/cjs/lib/v3/understudy/frameLocator.d.ts +50 -0
- package/dist/cjs/lib/v3/understudy/frameRegistry.d.ts +101 -0
- package/dist/cjs/lib/v3/understudy/initScripts.d.ts +2 -0
- package/dist/cjs/lib/v3/understudy/lifecycleWatcher.d.ts +64 -0
- package/dist/cjs/lib/v3/understudy/locator.d.ts +194 -0
- package/dist/cjs/lib/v3/understudy/locatorInvocation.d.ts +8 -0
- package/dist/cjs/lib/v3/understudy/navigationResponseTracker.d.ts +84 -0
- package/dist/cjs/lib/v3/understudy/networkManager.d.ts +53 -0
- package/dist/cjs/lib/v3/understudy/page.d.ts +354 -0
- package/dist/cjs/lib/v3/understudy/piercer.d.ts +4 -0
- package/dist/cjs/lib/v3/understudy/response.d.ts +137 -0
- package/dist/cjs/lib/v3/understudy/screenshotUtils.d.ts +16 -0
- package/dist/cjs/lib/v3/understudy/selectorResolver.d.ts +38 -0
- package/dist/cjs/lib/v3/v3.d.ts +191 -0
- package/dist/cjs/lib/v3/zodCompat.d.ts +12 -0
- package/dist/cjs/lib/v3Evaluator.d.ts +19 -0
- package/dist/cjs/lib/version.d.ts +5 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/tests/browserbase-session-accessors.test.js +101 -0
- package/dist/cjs/tests/browserbase-session-accessors.test.js.map +7 -0
- package/dist/cjs/tests/cache-llm-resolution.test.js +187 -0
- package/dist/cjs/tests/cache-llm-resolution.test.js.map +7 -0
- package/dist/cjs/tests/helpers/mockCDPSession.js +50 -0
- package/dist/cjs/tests/helpers/mockCDPSession.js.map +7 -0
- package/dist/cjs/tests/llm-provider.test.js +57 -0
- package/dist/cjs/tests/llm-provider.test.js.map +7 -0
- package/dist/cjs/tests/model-deprecation.test.js +132 -0
- package/dist/cjs/tests/model-deprecation.test.js.map +7 -0
- package/dist/cjs/tests/page-snapshot.test.js +58 -0
- package/dist/cjs/tests/page-snapshot.test.js.map +7 -0
- package/dist/cjs/tests/public-api/export-surface.test.js +76 -0
- package/dist/cjs/tests/public-api/export-surface.test.js.map +7 -0
- package/dist/cjs/tests/public-api/llm-and-agents.test.js +150 -0
- package/dist/cjs/tests/public-api/llm-and-agents.test.js.map +7 -0
- package/dist/cjs/tests/public-api/public-error-types.test.js +104 -0
- package/dist/cjs/tests/public-api/public-error-types.test.js.map +7 -0
- package/dist/cjs/tests/public-api/public-types.test.js +74 -0
- package/dist/cjs/tests/public-api/public-types.test.js.map +7 -0
- package/dist/cjs/tests/public-api/runtime-utils.test.js +53 -0
- package/dist/cjs/tests/public-api/runtime-utils.test.js.map +7 -0
- package/dist/cjs/tests/public-api/schema-utils.test.js +100 -0
- package/dist/cjs/tests/public-api/schema-utils.test.js.map +7 -0
- package/dist/cjs/tests/public-api/timeout-error-types.test.js +103 -0
- package/dist/cjs/tests/public-api/timeout-error-types.test.js.map +7 -0
- package/dist/cjs/tests/public-api/tool-type-export.test.js +47 -0
- package/dist/cjs/tests/public-api/tool-type-export.test.js.map +7 -0
- package/dist/cjs/tests/public-api/v3-core.test.js +104 -0
- package/dist/cjs/tests/public-api/v3-core.test.js.map +7 -0
- package/dist/cjs/tests/safety-confirmation.test.js +134 -0
- package/dist/cjs/tests/safety-confirmation.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-a11y-resolvers.test.js +370 -0
- package/dist/cjs/tests/snapshot-a11y-resolvers.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-a11y-tree-utils.test.js +294 -0
- package/dist/cjs/tests/snapshot-a11y-tree-utils.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-capture-orchestration.test.js +403 -0
- package/dist/cjs/tests/snapshot-capture-orchestration.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-cbor.test.js +197 -0
- package/dist/cjs/tests/snapshot-cbor.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-dom-session-builders.test.js +246 -0
- package/dist/cjs/tests/snapshot-dom-session-builders.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-dom-tree-utils.test.js +104 -0
- package/dist/cjs/tests/snapshot-dom-tree-utils.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-focus-selectors-utils.test.js +45 -0
- package/dist/cjs/tests/snapshot-focus-selectors-utils.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-frame-merge.test.js +388 -0
- package/dist/cjs/tests/snapshot-frame-merge.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-tree-format-utils.test.js +106 -0
- package/dist/cjs/tests/snapshot-tree-format-utils.test.js.map +7 -0
- package/dist/cjs/tests/snapshot-xpath-utils.test.js +74 -0
- package/dist/cjs/tests/snapshot-xpath-utils.test.js.map +7 -0
- package/dist/cjs/tests/timeout-handlers.test.js +864 -0
- package/dist/cjs/tests/timeout-handlers.test.js.map +7 -0
- package/dist/cjs/tests/xpath-parser.test.js +314 -0
- package/dist/cjs/tests/xpath-parser.test.js.map +7 -0
- package/dist/cjs/tests/xpath-resolver.test.js +70 -0
- package/dist/cjs/tests/xpath-resolver.test.js.map +7 -0
- package/dist/cjs/tests/zod-enum-compatibility.test.js +119 -0
- package/dist/cjs/tests/zod-enum-compatibility.test.js.map +7 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/lib/v3/api.d.ts +16 -1
- package/dist/esm/lib/v3/api.js +41 -5
- package/dist/esm/lib/v3/api.js.map +1 -1
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +0 -3
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +22 -20
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -1
- package/dist/esm/lib/v3/llm/aisdk.js +5 -2
- package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
- package/dist/esm/lib/v3/types/public/api.d.ts +8 -0
- package/dist/esm/lib/v3/types/public/api.js +5 -3
- package/dist/esm/lib/v3/types/public/api.js.map +1 -1
- package/dist/esm/lib/v3/types/public/index.d.ts +1 -0
- package/dist/esm/lib/v3/types/public/index.js.map +1 -1
- package/dist/esm/lib/v3/types/public/sdkErrors.d.ts +3 -0
- package/dist/esm/lib/v3/types/public/sdkErrors.js +12 -6
- package/dist/esm/lib/v3/types/public/sdkErrors.js.map +1 -1
- package/dist/esm/tests/api-multiregion.test.js +73 -0
- package/dist/esm/tests/api-multiregion.test.js.map +7 -0
- package/dist/esm/tests/public-api/public-error-types.test.js +2 -1
- package/dist/esm/tests/public-api/public-error-types.test.js.map +2 -2
- package/dist/esm/tests/understudy-command-exception.test.js +55 -0
- package/dist/esm/tests/understudy-command-exception.test.js.map +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
/**
|
|
3
|
+
* FrameRegistry
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* A single, authoritative source of truth for **both**:
|
|
7
|
+
* 1) Frame topology (parent/children, current main/root id, last-seen CDP `Frame`)
|
|
8
|
+
* 2) Frame → Session ownership (which CDP session owns a given frameId)
|
|
9
|
+
* 3) Optional iframe-owner metadata (backendNodeId of the <iframe> element in the parent doc)
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* Model:
|
|
13
|
+
* - This class is **CDP-agnostic**; it stores **sessionId strings** (not session objects).
|
|
14
|
+
* - Context bridges (wiring Target/Page events) must call the mutators below (onAttached,
|
|
15
|
+
* onNavigated, onDetached, adoptChildSession, seedFromFrameTree, setOwnerBackendNodeId).
|
|
16
|
+
* - Consumers ask read APIs (getOwnerSessionId, getParent, asProtocolFrameTree, listAll, …)
|
|
17
|
+
* and never probe ownership at run time.
|
|
18
|
+
*/
|
|
19
|
+
type FrameId = string;
|
|
20
|
+
type SessionId = string;
|
|
21
|
+
export declare class FrameRegistry {
|
|
22
|
+
/** Owner target id (top-level target); informational only */
|
|
23
|
+
private readonly ownerTargetId;
|
|
24
|
+
/** Current main/root frame id (changes on root swaps) */
|
|
25
|
+
private rootFrameId;
|
|
26
|
+
/** frameId → FrameInfo */
|
|
27
|
+
private frames;
|
|
28
|
+
/** sessionId → Set<frameId> (inverse map for diagnostics/fast membership checks) */
|
|
29
|
+
private framesBySession;
|
|
30
|
+
constructor(ownerTargetId: string, mainFrameId: FrameId);
|
|
31
|
+
/**
|
|
32
|
+
* Record that a frame attached. If `parentId` is null and `frameId` differs from the current
|
|
33
|
+
* root, this is a root swap and we rename the root id.
|
|
34
|
+
*
|
|
35
|
+
* IMPORTANT: The emitter's `sessionId` is the **owner** for the new/attached frame.
|
|
36
|
+
*/
|
|
37
|
+
onFrameAttached(frameId: FrameId, parentId: FrameId | null, sessionId: SessionId): void;
|
|
38
|
+
/**
|
|
39
|
+
* Record a navigation with the full CDP `Frame`. Also updates ownership based on the emitting
|
|
40
|
+
* session id. Handles root swap if the navigated frame is the new main (no parentId).
|
|
41
|
+
*/
|
|
42
|
+
onFrameNavigated(frame: Protocol.Page.Frame, sessionId: SessionId): void;
|
|
43
|
+
onNavigatedWithinDocument(frameId: FrameId, url: string, sessionId: SessionId): void;
|
|
44
|
+
/**
|
|
45
|
+
* Record that a frame detached. If `reason !== "swap"`, remove the subtree from the graph,
|
|
46
|
+
* and clean the inverse maps. For “swap” we keep the node to preserve continuity.
|
|
47
|
+
*/
|
|
48
|
+
onFrameDetached(frameId: FrameId, reason?: "remove" | "swap" | string): void;
|
|
49
|
+
/**
|
|
50
|
+
* An adopted OOPIF child session was created whose **main** frame id equals the parent iframe’s frameId.
|
|
51
|
+
* We mark the entire child subtree as owned by `childSessionId`.
|
|
52
|
+
* (Topology edges remain aligned by the parent session’s `frameAttached` events.)
|
|
53
|
+
*/
|
|
54
|
+
adoptChildSession(childSessionId: SessionId, childMainFrameId: FrameId): void;
|
|
55
|
+
/**
|
|
56
|
+
* Seed topology and ownership from an existing `Page.getFrameTree` snapshot, typically right after
|
|
57
|
+
* a session is attached. This is a best-effort: we record frames and set the provided `sessionId`
|
|
58
|
+
* as owner for the subtree **if** an owner isn't already set.
|
|
59
|
+
*/
|
|
60
|
+
seedFromFrameTree(sessionId: SessionId, frameTree: Protocol.Page.FrameTree): void;
|
|
61
|
+
/**
|
|
62
|
+
* Set the backendNodeId of the `<iframe>` element for a child frame **as seen from its parent**.
|
|
63
|
+
* This is useful for building absolute XPath prefixes later (from the parent document).
|
|
64
|
+
*/
|
|
65
|
+
setOwnerBackendNodeId(childFrameId: FrameId, backendNodeId: number): void;
|
|
66
|
+
mainFrameId(): FrameId;
|
|
67
|
+
/**
|
|
68
|
+
* Return the owner session id for this frame. If unknown, returns `undefined`.
|
|
69
|
+
*/
|
|
70
|
+
getOwnerSessionId(frameId: FrameId): SessionId | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Return the owner backendNodeId (iframe element) if recorded.
|
|
73
|
+
* This is in the **parent** document; pair it with `getParent`.
|
|
74
|
+
*/
|
|
75
|
+
getOwnerBackendNodeId(frameId: FrameId): number | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Return the parent frame id, or null for root/unknown.
|
|
78
|
+
*/
|
|
79
|
+
getParent(frameId: FrameId): FrameId | null;
|
|
80
|
+
/**
|
|
81
|
+
* List frame ids in root-first DFS order (same shape as CDP’s FrameTree traversal).
|
|
82
|
+
*/
|
|
83
|
+
listAllFrames(): FrameId[];
|
|
84
|
+
/**
|
|
85
|
+
* Serialize to `Protocol.Page.FrameTree` starting at the given root id (typically mainFrameId()).
|
|
86
|
+
*/
|
|
87
|
+
asProtocolFrameTree(rootId: FrameId): Protocol.Page.FrameTree;
|
|
88
|
+
/**
|
|
89
|
+
* For diagnostics: return the current owner sessions for a frame id (0..n),
|
|
90
|
+
* usually 0 or 1, but helpful to see potential inconsistencies during wiring.
|
|
91
|
+
*/
|
|
92
|
+
sessionsForFrame(frameId: FrameId): SessionId[];
|
|
93
|
+
/**
|
|
94
|
+
* For diagnostics: return current frame set per session.
|
|
95
|
+
*/
|
|
96
|
+
framesForSession(sessionId: SessionId): FrameId[];
|
|
97
|
+
private ensureNode;
|
|
98
|
+
private renameNodeId;
|
|
99
|
+
private setOwnerSessionIdInternal;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LoadState } from "../types/public/page.js";
|
|
2
|
+
import type { CDPSessionLike } from "./cdp.js";
|
|
3
|
+
import type { NetworkManager } from "./networkManager.js";
|
|
4
|
+
import type { Page } from "./page.js";
|
|
5
|
+
/**
|
|
6
|
+
* Coordinates page lifecycle waits (load/domcontentloaded/networkidle) while
|
|
7
|
+
* following main-frame swaps and navigation aborts. Each navigation spawns a
|
|
8
|
+
* one-off watcher that listens for relevant CDP events and resolves or rejects
|
|
9
|
+
* depending on the requested `waitUntil` state.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Small utility that mirrors Playwright's lifecycle watcher semantics. Bridges
|
|
13
|
+
* main-frame lifecycle events with the NetworkManager's idle signal so callers
|
|
14
|
+
* can await `load`, `domcontentloaded`, or `networkidle` with a single promise.
|
|
15
|
+
*/
|
|
16
|
+
export declare class LifecycleWatcher {
|
|
17
|
+
private readonly page;
|
|
18
|
+
private readonly mainSession;
|
|
19
|
+
private readonly networkManager;
|
|
20
|
+
private readonly waitUntil;
|
|
21
|
+
private readonly timeoutMs;
|
|
22
|
+
private readonly startTime;
|
|
23
|
+
private readonly navigationCommandId;
|
|
24
|
+
private currentLoaderId;
|
|
25
|
+
private idleStartTime;
|
|
26
|
+
private cleanupCallbacks;
|
|
27
|
+
private idleHandle;
|
|
28
|
+
private abortReject;
|
|
29
|
+
private abortPromise;
|
|
30
|
+
private abortError;
|
|
31
|
+
private disposed;
|
|
32
|
+
private expectedLoaderId;
|
|
33
|
+
private initialLoaderId;
|
|
34
|
+
private pendingFollowupNavigation;
|
|
35
|
+
/**
|
|
36
|
+
* Create a watcher; callers should subsequently invoke {@link wait}.
|
|
37
|
+
*/
|
|
38
|
+
constructor(params: {
|
|
39
|
+
page: Page;
|
|
40
|
+
mainSession: CDPSessionLike;
|
|
41
|
+
networkManager: NetworkManager;
|
|
42
|
+
waitUntil: LoadState;
|
|
43
|
+
timeoutMs: number;
|
|
44
|
+
navigationCommandId: number;
|
|
45
|
+
});
|
|
46
|
+
/** Hint the watcher with the loader id returned by Page.navigate. */
|
|
47
|
+
setExpectedLoaderId(loaderId: string | undefined): void;
|
|
48
|
+
/** Wait for the requested lifecycle state or throw on timeout/abort. */
|
|
49
|
+
wait(): Promise<void>;
|
|
50
|
+
/** Cancel any outstanding network-idle waits and remove event listeners. */
|
|
51
|
+
dispose(): void;
|
|
52
|
+
/** Subscribe to main-frame events to detect abort conditions. */
|
|
53
|
+
private installSessionListeners;
|
|
54
|
+
/** Compute remaining time until the shared deadline elapses. */
|
|
55
|
+
private timeRemaining;
|
|
56
|
+
/** Await an operation but abort early if navigation replacement fires. */
|
|
57
|
+
private awaitWithAbort;
|
|
58
|
+
/** Mark the watcher as aborted and reject any pending waiters. */
|
|
59
|
+
private triggerAbort;
|
|
60
|
+
private waitForNetworkIdle;
|
|
61
|
+
private shouldRestartAfterFollowup;
|
|
62
|
+
private adoptNewMainLoader;
|
|
63
|
+
private buildIdleFilter;
|
|
64
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Protocol } from "devtools-protocol";
|
|
2
|
+
import type { Frame } from "./frame.js";
|
|
3
|
+
import { SetInputFilesArgument, MouseButton } from "../types/public/locator.js";
|
|
4
|
+
/**
|
|
5
|
+
* Locator
|
|
6
|
+
*
|
|
7
|
+
* Purpose:
|
|
8
|
+
* A small, CDP-based element interaction helper scoped to a specific `Frame`.
|
|
9
|
+
* It resolves a CSS/XPath selector inside the frame’s **isolated world**, and then
|
|
10
|
+
* performs low-level actions (click, type, select) using DOM/Runtime/Input
|
|
11
|
+
* protocol domains with minimal abstraction.
|
|
12
|
+
*
|
|
13
|
+
* Key change:
|
|
14
|
+
* - Prefer **objectId**-based CDP calls (scroll, geometry) to avoid brittle
|
|
15
|
+
* frontend nodeId mappings. nodeId is resolved on a best-effort basis and
|
|
16
|
+
* returned for compatibility, but actions do not depend on it.
|
|
17
|
+
*
|
|
18
|
+
* Notes:
|
|
19
|
+
* - Resolution is lazy: every action resolves the selector again.
|
|
20
|
+
* - Uses `Page.createIsolatedWorld` so evaluation is isolated from page scripts.
|
|
21
|
+
* - Releases remote objects (`Runtime.releaseObject`) where appropriate.
|
|
22
|
+
*/
|
|
23
|
+
export declare class Locator {
|
|
24
|
+
private readonly frame;
|
|
25
|
+
private readonly selector;
|
|
26
|
+
private readonly options?;
|
|
27
|
+
private readonly selectorResolver;
|
|
28
|
+
private readonly selectorQuery;
|
|
29
|
+
private readonly nthIndex;
|
|
30
|
+
constructor(frame: Frame, selector: string, options?: {
|
|
31
|
+
deep?: boolean;
|
|
32
|
+
depth?: number;
|
|
33
|
+
}, nthIndex?: number);
|
|
34
|
+
/** Return the owning Frame for this locator (typed accessor, no private access). */
|
|
35
|
+
getFrame(): Frame;
|
|
36
|
+
/**
|
|
37
|
+
* Set files on an <input type="file"> element.
|
|
38
|
+
*
|
|
39
|
+
* Mirrors Playwright's Locator.setInputFiles basics:
|
|
40
|
+
* - Accepts file path(s) or payload object(s) { name, mimeType, buffer }.
|
|
41
|
+
* - Uses CDP DOM.setFileInputFiles under the hood.
|
|
42
|
+
* - Best‑effort dispatches change/input via CDP (Chrome does by default).
|
|
43
|
+
* - Passing an empty array clears the selection.
|
|
44
|
+
*/
|
|
45
|
+
setInputFiles(files: SetInputFilesArgument): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Remote browser fallback: build File objects inside the page and attach them via JS.
|
|
48
|
+
*
|
|
49
|
+
* When Stagehand is driving a browser that cannot see the local filesystem (Browserbase,
|
|
50
|
+
* remote CDP, etc.), CDP's DOM.setFileInputFiles would fail because Chrome can't reach
|
|
51
|
+
* our temp files. Instead we base64-encode the payloads, send them into the page, and
|
|
52
|
+
* let a DOM helper create File objects + dispatch change/input events.
|
|
53
|
+
*/
|
|
54
|
+
private assignFilesViaPayloadInjection;
|
|
55
|
+
/**
|
|
56
|
+
* Return the DOM backendNodeId for this locator's target element.
|
|
57
|
+
* Useful for identity comparisons without needing element handles.
|
|
58
|
+
*/
|
|
59
|
+
backendNodeId(): Promise<Protocol.DOM.BackendNodeId>;
|
|
60
|
+
/** Return how many nodes the current selector resolves to. */
|
|
61
|
+
count(): Promise<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Return the center of the element's bounding box in the owning frame's viewport
|
|
64
|
+
* (CSS pixels), rounded to integers. Scrolls into view best-effort.
|
|
65
|
+
*/
|
|
66
|
+
centroid(): Promise<{
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Highlight the element's bounding box using the CDP Overlay domain.
|
|
72
|
+
* - Scrolls element into view best-effort.
|
|
73
|
+
* - Shows a semi-transparent overlay briefly, then hides it.
|
|
74
|
+
*/
|
|
75
|
+
highlight(options?: {
|
|
76
|
+
durationMs?: number;
|
|
77
|
+
borderColor?: {
|
|
78
|
+
r: number;
|
|
79
|
+
g: number;
|
|
80
|
+
b: number;
|
|
81
|
+
a?: number;
|
|
82
|
+
};
|
|
83
|
+
contentColor?: {
|
|
84
|
+
r: number;
|
|
85
|
+
g: number;
|
|
86
|
+
b: number;
|
|
87
|
+
a?: number;
|
|
88
|
+
};
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Move the mouse cursor to the element's visual center without clicking.
|
|
92
|
+
* - Scrolls into view best-effort, resolves geometry, then dispatches a mouse move.
|
|
93
|
+
*/
|
|
94
|
+
hover(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Click the element at its visual center.
|
|
97
|
+
* Steps:
|
|
98
|
+
* 1) Resolve selector to { objectId } in the frame world.
|
|
99
|
+
* 2) Scroll into view via `DOM.scrollIntoViewIfNeeded({ objectId })`.
|
|
100
|
+
* 3) Read geometry via `DOM.getBoxModel({ objectId })` → compute a center point.
|
|
101
|
+
* 4) Synthesize mouse press + release via `Input.dispatchMouseEvent`.
|
|
102
|
+
*/
|
|
103
|
+
click(options?: {
|
|
104
|
+
button?: MouseButton;
|
|
105
|
+
clickCount?: number;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Dispatch a DOM 'click' MouseEvent on the element itself.
|
|
109
|
+
* - Does not synthesize real pointer input; directly dispatches an event.
|
|
110
|
+
* - Useful for elements that rely on click handlers without needing hit-testing.
|
|
111
|
+
*/
|
|
112
|
+
sendClickEvent(options?: {
|
|
113
|
+
bubbles?: boolean;
|
|
114
|
+
cancelable?: boolean;
|
|
115
|
+
composed?: boolean;
|
|
116
|
+
detail?: number;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Scroll the element vertically to a given percentage (0–100).
|
|
120
|
+
* - If the element is <html> or <body>, scrolls the window/document.
|
|
121
|
+
* - Otherwise, scrolls the element itself via element.scrollTo.
|
|
122
|
+
*/
|
|
123
|
+
scrollTo(percent: number | string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Fill an input/textarea/contenteditable element.
|
|
126
|
+
* Mirrors Playwright semantics: the DOM helper either applies the native
|
|
127
|
+
* value setter (for special input types) or asks us to type text via the CDP
|
|
128
|
+
* Input domain after focusing/selecting.
|
|
129
|
+
*/
|
|
130
|
+
fill(value: string): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Type text into the element (focuses first).
|
|
133
|
+
* - Focus via element.focus() in page JS (no DOM.focus(nodeId)).
|
|
134
|
+
* - If no delay, uses `Input.insertText` for efficiency.
|
|
135
|
+
* - With delay, synthesizes `keyDown`/`keyUp` per character.
|
|
136
|
+
*/
|
|
137
|
+
type(text: string, options?: {
|
|
138
|
+
delay?: number;
|
|
139
|
+
}): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Select one or more options on a `<select>` element.
|
|
142
|
+
* Returns the values actually selected after the operation.
|
|
143
|
+
*/
|
|
144
|
+
selectOption(values: string | string[]): Promise<string[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Return true if the element is attached and visible (rough heuristic).
|
|
147
|
+
*/
|
|
148
|
+
isVisible(): Promise<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Return true if the element is an input[type=checkbox|radio] and is checked.
|
|
151
|
+
* Also considers aria-checked for ARIA widgets.
|
|
152
|
+
*/
|
|
153
|
+
isChecked(): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Return the element's input value (for input/textarea/select/contenteditable).
|
|
156
|
+
*/
|
|
157
|
+
inputValue(): Promise<string>;
|
|
158
|
+
/**
|
|
159
|
+
* Return the element's textContent (raw, not innerText).
|
|
160
|
+
*/
|
|
161
|
+
textContent(): Promise<string>;
|
|
162
|
+
/**
|
|
163
|
+
* Return the element's innerHTML string.
|
|
164
|
+
*/
|
|
165
|
+
innerHtml(): Promise<string>;
|
|
166
|
+
/**
|
|
167
|
+
* Return the element's innerText (layout-aware, visible text).
|
|
168
|
+
*/
|
|
169
|
+
innerText(): Promise<string>;
|
|
170
|
+
/**
|
|
171
|
+
* Return a locator narrowed to the first match.
|
|
172
|
+
*/
|
|
173
|
+
first(): Locator;
|
|
174
|
+
/** Return a locator narrowed to the element at the given zero-based index. */
|
|
175
|
+
nth(index: number): Locator;
|
|
176
|
+
/**
|
|
177
|
+
* Resolve `this.selector` within the frame to `{ objectId, nodeId? }`:
|
|
178
|
+
* Delegates to a shared selector resolver so all selector logic stays in sync.
|
|
179
|
+
*/
|
|
180
|
+
resolveNode(): Promise<{
|
|
181
|
+
nodeId: Protocol.DOM.NodeId | null;
|
|
182
|
+
objectId: Protocol.Runtime.RemoteObjectId;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Resolve all matching nodes for this locator.
|
|
186
|
+
* If the locator is narrowed via nth(), only that index is returned.
|
|
187
|
+
*/
|
|
188
|
+
resolveNodesForMask(): Promise<Array<{
|
|
189
|
+
nodeId: Protocol.DOM.NodeId | null;
|
|
190
|
+
objectId: Protocol.Runtime.RemoteObjectId;
|
|
191
|
+
}>>;
|
|
192
|
+
/** Compute a center point from a BoxModel content quad */
|
|
193
|
+
private centerFromBoxContent;
|
|
194
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LocatorScriptName } from "../dom/build/locatorScripts.generated.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build an expression that injects the locator bundle (if needed) and invokes a
|
|
4
|
+
* specific helper via its stable global reference. This keeps Runtime.evaluate
|
|
5
|
+
* payloads tiny while guaranteeing our selector utilities are present in any
|
|
6
|
+
* execution context.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildLocatorInvocation(name: LocatorScriptName, args: string[]): string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavigationResponseTracker
|
|
3
|
+
* -------------------------
|
|
4
|
+
*
|
|
5
|
+
* Tracks DevTools Protocol network events for a single navigation command so
|
|
6
|
+
* Stagehand can surface a Playwright-like response object from `Page.goto` and
|
|
7
|
+
* related APIs. The tracker listens for `Network.responseReceived` events that
|
|
8
|
+
* correspond to the targeted document navigation, handles loader-id churn that
|
|
9
|
+
* arises from redirects or preloading, and enriches the resulting
|
|
10
|
+
* `Response` with extra header information. It also observes
|
|
11
|
+
* `Network.loadingFinished` / `Network.loadingFailed` to fulfil the
|
|
12
|
+
* `response.finished()` contract exposed to consumers.
|
|
13
|
+
*/
|
|
14
|
+
import type { CDPSessionLike } from "./cdp.js";
|
|
15
|
+
import type { Page } from "./page.js";
|
|
16
|
+
import { Response } from "./response.js";
|
|
17
|
+
/**
|
|
18
|
+
* Watches CDP events on a given session and resolves with the navigation's
|
|
19
|
+
* primary document response once identified.
|
|
20
|
+
*/
|
|
21
|
+
export declare class NavigationResponseTracker {
|
|
22
|
+
private readonly page;
|
|
23
|
+
private readonly session;
|
|
24
|
+
private readonly navigationCommandId;
|
|
25
|
+
private expectedLoaderId;
|
|
26
|
+
private selectedRequestId;
|
|
27
|
+
private selectedResponse;
|
|
28
|
+
private acceptNextWithoutLoader;
|
|
29
|
+
private responseResolved;
|
|
30
|
+
private resolveResponse;
|
|
31
|
+
private responsePromise;
|
|
32
|
+
private readonly pendingResponsesByLoader;
|
|
33
|
+
private readonly pendingExtraInfo;
|
|
34
|
+
private readonly listeners;
|
|
35
|
+
/**
|
|
36
|
+
* Create a tracker bound to a specific navigation command. The tracker begins
|
|
37
|
+
* listening for network events immediately so it should be constructed before
|
|
38
|
+
* the navigation request is dispatched.
|
|
39
|
+
*/
|
|
40
|
+
constructor(params: {
|
|
41
|
+
page: Page;
|
|
42
|
+
session: CDPSessionLike;
|
|
43
|
+
navigationCommandId: number;
|
|
44
|
+
});
|
|
45
|
+
/** Stop listening for CDP events and release any pending bookkeeping. */
|
|
46
|
+
dispose(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Hint the tracker with the loader id returned by `Page.navigate`. Chrome only
|
|
49
|
+
* emits this once the browser begins navigating, so we store early responses
|
|
50
|
+
* and match them once the loader id is known.
|
|
51
|
+
*/
|
|
52
|
+
setExpectedLoaderId(loaderId: string | undefined): void;
|
|
53
|
+
/**
|
|
54
|
+
* Some navigation APIs (reload/history traversal) do not provide a loader id
|
|
55
|
+
* up front. This flag instructs the tracker to accept the next qualifying
|
|
56
|
+
* document response even if no loader id has been announced yet.
|
|
57
|
+
*/
|
|
58
|
+
expectNavigationWithoutKnownLoader(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a promise that resolves with the matched response (or `null` when
|
|
61
|
+
* no document response was observed).
|
|
62
|
+
*/
|
|
63
|
+
navigationCompleted(): Promise<Response | null>;
|
|
64
|
+
/** Expose the raw response promise (mainly for tests). */
|
|
65
|
+
response(): Promise<Response | null>;
|
|
66
|
+
/** Register all CDP listeners relevant to navigation tracking. */
|
|
67
|
+
private installListeners;
|
|
68
|
+
/** Attach a CDP listener and track it for later disposal. */
|
|
69
|
+
private addListener;
|
|
70
|
+
/** Handle the initial response payload for document navigations. */
|
|
71
|
+
private onResponseReceived;
|
|
72
|
+
/** Merge auxiliary header information once Chrome exposes it. */
|
|
73
|
+
private onResponseReceivedExtraInfo;
|
|
74
|
+
/** Resolve the response's finished promise when the request completes. */
|
|
75
|
+
private onLoadingFinished;
|
|
76
|
+
/** Resolve the response's finished promise with an error on failure. */
|
|
77
|
+
private onLoadingFailed;
|
|
78
|
+
/**
|
|
79
|
+
* Create the `Response` wrapper for the chosen document response and
|
|
80
|
+
* resolve awaiting consumers. Subsequent events flesh out the header/body
|
|
81
|
+
* helpers and mark the request as finished.
|
|
82
|
+
*/
|
|
83
|
+
private selectResponse;
|
|
84
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CDPSessionLike } from "./cdp.js";
|
|
2
|
+
import { NetworkObserver, WaitForIdleHandle, WaitForIdleOptions } from "../types/private/network.js";
|
|
3
|
+
/**
|
|
4
|
+
* Cross-session network tracker.
|
|
5
|
+
*
|
|
6
|
+
* Centralises network bookkeeping for a Page: every CDP session (top-level and OOPIF)
|
|
7
|
+
* funnels `Network.*` events through here so higher-level waiters can reason about
|
|
8
|
+
* in-flight requests across the entire frame tree. The manager exposes a simple
|
|
9
|
+
* observer interface plus a "wait until idle" helper that resolves once no filtered
|
|
10
|
+
* requests remain for a quiet window.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Aggregates network information for all CDP sessions owned by a Page.
|
|
14
|
+
*/
|
|
15
|
+
export declare class NetworkManager {
|
|
16
|
+
private readonly sessions;
|
|
17
|
+
private readonly observers;
|
|
18
|
+
private readonly requests;
|
|
19
|
+
private readonly documentRequestsByFrame;
|
|
20
|
+
/**
|
|
21
|
+
* Begin tracking network traffic for a CDP session (top-level or OOPIF).
|
|
22
|
+
* Safe to call multiple times; duplicate registrations are ignored.
|
|
23
|
+
*/
|
|
24
|
+
trackSession(session: CDPSessionLike): void;
|
|
25
|
+
/**
|
|
26
|
+
* Stop tracking a session and discard any inflight bookkeeping owned by it.
|
|
27
|
+
*/
|
|
28
|
+
untrackSession(rawSessionId: string | undefined): void;
|
|
29
|
+
/**
|
|
30
|
+
* Register a passive observer for request lifecycle notifications.
|
|
31
|
+
* Returns a disposer that removes the observer.
|
|
32
|
+
*/
|
|
33
|
+
addObserver(observer: NetworkObserver): () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve once no (filtered) requests are in flight for the given quiet window.
|
|
36
|
+
* The waiter automatically unregisters itself on completion or timeout.
|
|
37
|
+
*/
|
|
38
|
+
waitForIdle(options: WaitForIdleOptions): WaitForIdleHandle;
|
|
39
|
+
/**
|
|
40
|
+
* Tear down all session listeners and clear observers/bookkeeping.
|
|
41
|
+
*/
|
|
42
|
+
dispose(): void;
|
|
43
|
+
/** Fan-out helper when a tracked request starts. */
|
|
44
|
+
private emitStart;
|
|
45
|
+
/** Fan-out helper when a tracked request completes successfully. */
|
|
46
|
+
private emitFinish;
|
|
47
|
+
/** Fan-out helper when a tracked request fails mid-flight. */
|
|
48
|
+
private emitFailure;
|
|
49
|
+
/** Compute a stable key for a session (falls back to synthetic root id). */
|
|
50
|
+
private sessionKey;
|
|
51
|
+
/** Compose the unique key for tracking a request under a session. */
|
|
52
|
+
private requestKey;
|
|
53
|
+
}
|