@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,24 @@
|
|
|
1
|
+
import type { CDPSessionLike } from "../../cdp.js";
|
|
2
|
+
import { Page } from "../../page.js";
|
|
3
|
+
import type { FrameParentIndex, ResolvedCssFocus, ResolvedFocusFrame, Step } from "../../../types/private/snapshot.js";
|
|
4
|
+
/**
|
|
5
|
+
* Parse a cross-frame XPath into discrete steps. Each step tracks whether it
|
|
6
|
+
* represents a descendant hop (“//”) or a single-child hop (“/”).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseXPathToSteps(path: string): Step[];
|
|
9
|
+
/** Rebuild an XPath string from parsed steps. */
|
|
10
|
+
export declare function buildXPathFromSteps(steps: ReadonlyArray<Step>): string;
|
|
11
|
+
/**
|
|
12
|
+
* Given a cross-frame XPath, walk iframe steps to resolve:
|
|
13
|
+
* - the target frameId (last iframe hop)
|
|
14
|
+
* - the tail XPath (within the target frame)
|
|
15
|
+
* - the absolute XPath prefix up to the iframe element hosting that frame
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveFocusFrameAndTail(page: Page, absoluteXPath: string, parentByFrame: FrameParentIndex, rootId: string): Promise<ResolvedFocusFrame>;
|
|
18
|
+
/** Resolve focus frame and tail CSS selector using '>>' to hop iframes. */
|
|
19
|
+
export declare function resolveCssFocusFrameAndTail(page: Page, rawSelector: string, parentByFrame: FrameParentIndex, rootId: string): Promise<ResolvedCssFocus>;
|
|
20
|
+
/** Resolve an XPath to a Runtime remoteObjectId in the given CDP session. */
|
|
21
|
+
export declare function resolveObjectIdForXPath(session: CDPSessionLike, xpath: string, frameId?: string): Promise<string | null>;
|
|
22
|
+
/** Resolve a CSS selector (supports '>>' within the same frame only) to a Runtime objectId. */
|
|
23
|
+
export declare function resolveObjectIdForCss(session: CDPSessionLike, selector: string, frameId?: string): Promise<string | null>;
|
|
24
|
+
export declare function listChildrenOf(parentByFrame: FrameParentIndex, parentId: string): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CDPSessionLike } from "../../cdp.js";
|
|
2
|
+
import { Page } from "../../page.js";
|
|
3
|
+
import type { FrameParentIndex } from "../../../types/private/snapshot.js";
|
|
4
|
+
/**
|
|
5
|
+
* Session helpers ensure DOM lookups are always executed against the session
|
|
6
|
+
* that actually owns a frame. Keeping this logic centralized prevents subtle
|
|
7
|
+
* bugs when OOPIF adoption changes session ownership mid-capture.
|
|
8
|
+
*/
|
|
9
|
+
/** Return the owning session for a frame as registered on the Page. */
|
|
10
|
+
export declare function ownerSession(page: Page, frameId: string): CDPSessionLike;
|
|
11
|
+
/**
|
|
12
|
+
* DOM.getFrameOwner must be called against the parent frame's session.
|
|
13
|
+
* This helper hides the lookup (including main-frame fallback) so callers
|
|
14
|
+
* always reach for the correct connection.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parentSession(page: Page, parentByFrame: FrameParentIndex, frameId: string): CDPSessionLike;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { A11yNode } from "../../../types/private/snapshot.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render a formatted outline (with encoded ids) for the accessibility tree.
|
|
4
|
+
* Keeps indentation logic shared between modules so unit tests can cover these
|
|
5
|
+
* pure formatting helpers without a full snapshot pipeline.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatTreeLine(node: A11yNode, level?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Inject each child frame outline under the parent's iframe node line.
|
|
10
|
+
* Keys in `idToTree` are the parent's iframe encoded ids.
|
|
11
|
+
*/
|
|
12
|
+
export declare function injectSubtrees(rootOutline: string, idToTree: Map<string, string>): string;
|
|
13
|
+
export declare function indentBlock(block: string, indent: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Return the lines that appear in `nextTree` but not in `prevTree`.
|
|
16
|
+
* Comparison is done line-by-line, ignoring leading whitespace in both trees.
|
|
17
|
+
* The returned block is re-indented so the minimal indent becomes column 0.
|
|
18
|
+
*/
|
|
19
|
+
export declare function diffCombinedTrees(prevTree: string, nextTree: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Remove whitespace noise and invisible code points before rendering names.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanText(input: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Collapse all whitespace runs in a string to a single space without trimming.
|
|
26
|
+
* Exported for pruning routines that need the same normalization.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normaliseSpaces(s: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
import type { CDPSessionLike } from "../../cdp.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build the absolute XPath for a node by walking through every iframe host
|
|
5
|
+
* we've traversed so far followed by the leaf backend node.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildAbsoluteXPathFromChain(chain: Array<{
|
|
8
|
+
parentSession: CDPSessionLike;
|
|
9
|
+
iframeBackendNodeId: number;
|
|
10
|
+
}>, leafSession: CDPSessionLike, leafBackendNodeId: number): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a backend node to an absolute XPath within the provided session.
|
|
13
|
+
* The CDP Runtime is used so we can invoke a small helper that walks the DOM.
|
|
14
|
+
*/
|
|
15
|
+
export declare function absoluteXPathForBackendNode(session: CDPSessionLike, backendNodeId: number): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Prefix `child` XPath with an absolute iframe path `parentAbs`.
|
|
18
|
+
* Handles root slashes and shadow hops (“//”) cleanly.
|
|
19
|
+
*/
|
|
20
|
+
export declare function prefixXPath(parentAbs: string, child: string): string;
|
|
21
|
+
/** Normalize an XPath: strip `xpath=`, ensure leading '/', remove trailing '/'. */
|
|
22
|
+
export declare function normalizeXPath(x?: string): string;
|
|
23
|
+
/** Build per-sibling XPath steps for DOM traversal. */
|
|
24
|
+
export declare function buildChildXPathSegments(kids: Protocol.DOM.Node[]): string[];
|
|
25
|
+
/** Join two XPath fragments while preserving special shadow-root hops. */
|
|
26
|
+
export declare function joinXPath(base: string, step: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type A11yScriptName } from "../dom/build/a11yScripts.generated.js";
|
|
2
|
+
/**
|
|
3
|
+
* Wrap a generated a11y script in a self-invoking expression that first ensures
|
|
4
|
+
* the bootstrap has run, then calls the requested helper via its global ref.
|
|
5
|
+
* This mirrors the locator resolver’s injection path so any CDP Runtime.evaluate
|
|
6
|
+
* can reuse the shared bundle without inlining JS strings.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildA11yInvocation(name: A11yScriptName, args: string[]): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
/**
|
|
3
|
+
* CDP transport & session multiplexer
|
|
4
|
+
*
|
|
5
|
+
* Owns the browser WebSocket and multiplexes flattened Target sessions.
|
|
6
|
+
* Tracks inflight CDP calls, routes responses to the right session, and forwards events.
|
|
7
|
+
*
|
|
8
|
+
* This does not interpret Page/DOM/Runtime semantics — callers own that logic.
|
|
9
|
+
*/
|
|
10
|
+
export interface CDPSessionLike {
|
|
11
|
+
send<R = unknown>(method: string, params?: object): Promise<R>;
|
|
12
|
+
on<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
13
|
+
off<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
readonly id: string | null;
|
|
16
|
+
}
|
|
17
|
+
type EventHandler = (params: unknown) => void;
|
|
18
|
+
export declare class CdpConnection implements CDPSessionLike {
|
|
19
|
+
private ws;
|
|
20
|
+
private nextId;
|
|
21
|
+
private inflight;
|
|
22
|
+
private eventHandlers;
|
|
23
|
+
private sessions;
|
|
24
|
+
/** Maps sessionId -> targetId (1:1 mapping) */
|
|
25
|
+
private sessionToTarget;
|
|
26
|
+
readonly id: string | null;
|
|
27
|
+
private transportCloseHandlers;
|
|
28
|
+
/** Optional CDP logger - set this to receive all outgoing CDP method calls */
|
|
29
|
+
cdpLogger?: (info: {
|
|
30
|
+
method: string;
|
|
31
|
+
params?: object;
|
|
32
|
+
targetId?: string | null;
|
|
33
|
+
}) => void;
|
|
34
|
+
/** Optional CDP event logger - set this to receive all incoming CDP events */
|
|
35
|
+
cdpEventLogger?: (info: {
|
|
36
|
+
method: string;
|
|
37
|
+
params?: unknown;
|
|
38
|
+
targetId?: string | null;
|
|
39
|
+
}) => void;
|
|
40
|
+
onTransportClosed(handler: (why: string) => void): void;
|
|
41
|
+
offTransportClosed(handler: (why: string) => void): void;
|
|
42
|
+
private emitTransportClosed;
|
|
43
|
+
private constructor();
|
|
44
|
+
static connect(wsUrl: string): Promise<CdpConnection>;
|
|
45
|
+
enableAutoAttach(): Promise<void>;
|
|
46
|
+
send<R = unknown>(method: string, params?: object): Promise<R>;
|
|
47
|
+
on<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
48
|
+
off<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
getSession(sessionId: string): CdpSession | undefined;
|
|
51
|
+
attachToTarget(targetId: string): Promise<CdpSession>;
|
|
52
|
+
getTargets(): Promise<Protocol.Target.TargetInfo[]>;
|
|
53
|
+
private onMessage;
|
|
54
|
+
_sendViaSession<R = unknown>(sessionId: string, method: string, params?: object): Promise<R>;
|
|
55
|
+
_onSessionEvent(sessionId: string, event: string, handler: EventHandler): void;
|
|
56
|
+
_offSessionEvent(sessionId: string, event: string, handler: EventHandler): void;
|
|
57
|
+
_dispatchToSession(sessionId: string, event: string, params: unknown): void;
|
|
58
|
+
}
|
|
59
|
+
export declare class CdpSession implements CDPSessionLike {
|
|
60
|
+
private readonly root;
|
|
61
|
+
readonly id: string;
|
|
62
|
+
constructor(root: CdpConnection, id: string);
|
|
63
|
+
send<R = unknown>(method: string, params?: object): Promise<R>;
|
|
64
|
+
on<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
65
|
+
off<P = unknown>(event: string, handler: (params: P) => void): void;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
dispatch(event: string, params: unknown): void;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
import type { Page } from "./page.js";
|
|
3
|
+
type RemoteObject = Protocol.Runtime.RemoteObject;
|
|
4
|
+
export type ConsoleListener = (message: ConsoleMessage) => void;
|
|
5
|
+
export declare class ConsoleMessage {
|
|
6
|
+
private readonly event;
|
|
7
|
+
private readonly pageRef?;
|
|
8
|
+
constructor(event: Protocol.Runtime.ConsoleAPICalledEvent, pageRef?: Page);
|
|
9
|
+
type(): Protocol.Runtime.ConsoleAPICalledEvent["type"];
|
|
10
|
+
text(): string;
|
|
11
|
+
args(): RemoteObject[];
|
|
12
|
+
location(): {
|
|
13
|
+
url?: string;
|
|
14
|
+
lineNumber?: number;
|
|
15
|
+
columnNumber?: number;
|
|
16
|
+
};
|
|
17
|
+
page(): Page | undefined;
|
|
18
|
+
timestamp(): number | undefined;
|
|
19
|
+
raw(): Protocol.Runtime.ConsoleAPICalledEvent;
|
|
20
|
+
toString(): string;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
import { CdpConnection } from "./cdp.js";
|
|
3
|
+
import { Page } from "./page.js";
|
|
4
|
+
import type { StagehandAPIClient } from "../api.js";
|
|
5
|
+
import { LocalBrowserLaunchOptions } from "../types/public/index.js";
|
|
6
|
+
import { InitScriptSource } from "../types/private/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* V3Context
|
|
9
|
+
*
|
|
10
|
+
* Owns the root CDP connection and wires Target/Page events into Page.
|
|
11
|
+
* Maintains one Page per top-level target, adopts OOPIF child sessions into the owner Page,
|
|
12
|
+
* and tracks target→page and (root) frame→target mappings for lookups.
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: FrameId → session ownership is managed inside Page (via its FrameRegistry).
|
|
15
|
+
* Context never “guesses” owners; it simply forwards events (with the emitting session)
|
|
16
|
+
* so Page can record the correct owner at event time.
|
|
17
|
+
*/
|
|
18
|
+
export declare class V3Context {
|
|
19
|
+
readonly conn: CdpConnection;
|
|
20
|
+
private readonly env;
|
|
21
|
+
private readonly apiClient;
|
|
22
|
+
private readonly localBrowserLaunchOptions;
|
|
23
|
+
private constructor();
|
|
24
|
+
private readonly _piercerInstalled;
|
|
25
|
+
private _lastPopupSignalAt;
|
|
26
|
+
private readonly _targetSessionListeners;
|
|
27
|
+
private readonly _sessionInit;
|
|
28
|
+
private pagesByTarget;
|
|
29
|
+
private mainFrameToTarget;
|
|
30
|
+
private sessionOwnerPage;
|
|
31
|
+
private frameOwnerPage;
|
|
32
|
+
private pendingOopifByMainFrame;
|
|
33
|
+
private createdAtByTarget;
|
|
34
|
+
private typeByTarget;
|
|
35
|
+
private _pageOrder;
|
|
36
|
+
private pendingCreatedTargetUrl;
|
|
37
|
+
private readonly initScripts;
|
|
38
|
+
private installTargetSessionListeners;
|
|
39
|
+
/**
|
|
40
|
+
* Create a Context for a given CDP websocket URL and bootstrap target wiring.
|
|
41
|
+
*/
|
|
42
|
+
static create(wsUrl: string, opts?: {
|
|
43
|
+
env?: "LOCAL" | "BROWSERBASE";
|
|
44
|
+
apiClient?: StagehandAPIClient | null;
|
|
45
|
+
localBrowserLaunchOptions?: LocalBrowserLaunchOptions | null;
|
|
46
|
+
}): Promise<V3Context>;
|
|
47
|
+
/**
|
|
48
|
+
* Wait until at least one top-level Page has been created and registered.
|
|
49
|
+
* We poll internal maps that bootstrap/onAttachedToTarget populate.
|
|
50
|
+
*/
|
|
51
|
+
private waitForFirstTopLevelPage;
|
|
52
|
+
private waitForInitialTopLevelTargets;
|
|
53
|
+
private ensurePiercer;
|
|
54
|
+
/** Mark a page target as the most-recent one (active). */
|
|
55
|
+
private _pushActive;
|
|
56
|
+
/** Remove a page target from the recency list (used on close). */
|
|
57
|
+
private _removeFromOrder;
|
|
58
|
+
/** Return the current active Page (most-recent page that still exists). */
|
|
59
|
+
activePage(): Page | undefined;
|
|
60
|
+
/** Explicitly mark a known Page as the most-recent active page (and focus it). */
|
|
61
|
+
setActivePage(page: Page): void;
|
|
62
|
+
addInitScript<Arg>(script: InitScriptSource<Arg>, arg?: Arg): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Return top-level `Page`s (oldest → newest). OOPIF targets are not included.
|
|
65
|
+
*/
|
|
66
|
+
pages(): Page[];
|
|
67
|
+
private applyInitScriptsToPage;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve an owning `Page` by the **top-level main frame id**.
|
|
70
|
+
* Note: child (OOPIF) roots are intentionally not present in this mapping.
|
|
71
|
+
*/
|
|
72
|
+
resolvePageByMainFrameId(frameId: string): Page | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Serialize the full frame tree for a given top-level main frame id.
|
|
75
|
+
*/
|
|
76
|
+
getFullFrameTreeByMainFrameId(rootMainFrameId: string): Promise<Protocol.Page.FrameTree>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new top-level page (tab) with the given URL and return its Page object.
|
|
79
|
+
* Waits until the target is attached and registered.
|
|
80
|
+
*/
|
|
81
|
+
newPage(url?: string): Promise<Page>;
|
|
82
|
+
/**
|
|
83
|
+
* Close CDP and clear all mappings. Best-effort cleanup.
|
|
84
|
+
*/
|
|
85
|
+
close(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Bootstrap target lifecycle:
|
|
88
|
+
* - Attach to existing targets.
|
|
89
|
+
* - Handle auto-attach events.
|
|
90
|
+
* - Clean up on detach/destroy.
|
|
91
|
+
*/
|
|
92
|
+
private bootstrap;
|
|
93
|
+
/**
|
|
94
|
+
* Handle a newly attached target (top-level or potential OOPIF):
|
|
95
|
+
* - Enable Page domain and lifecycle events.
|
|
96
|
+
* - If top-level → create Page, wire listeners, resume.
|
|
97
|
+
* - Else → probe child root frame id via `Page.getFrameTree` and adopt immediately
|
|
98
|
+
* if the parent is known; otherwise stage until parent `frameAttached`.
|
|
99
|
+
* - Resume the target only after listeners are wired.
|
|
100
|
+
*/
|
|
101
|
+
private onAttachedToTarget;
|
|
102
|
+
/**
|
|
103
|
+
* Detach handler:
|
|
104
|
+
* - Remove child session ownership and prune its subtree.
|
|
105
|
+
* - If a top-level target, cleanup its `Page` and mappings.
|
|
106
|
+
* - Drop any staged child for this session.
|
|
107
|
+
*/
|
|
108
|
+
private onDetachedFromTarget;
|
|
109
|
+
/**
|
|
110
|
+
* Cleanup a top-level Page by target id, removing its root and staged children.
|
|
111
|
+
*/
|
|
112
|
+
private cleanupByTarget;
|
|
113
|
+
/**
|
|
114
|
+
* Wire Page-domain frame events for a session into the owning Page & mappings.
|
|
115
|
+
* We forward the *emitting session* with every event so Page can stamp ownership precisely.
|
|
116
|
+
*/
|
|
117
|
+
private installFrameEventBridges;
|
|
118
|
+
/**
|
|
119
|
+
* Register that a session belongs to a Page (used by event routing).
|
|
120
|
+
*/
|
|
121
|
+
private wireSessionToOwnerPage;
|
|
122
|
+
/**
|
|
123
|
+
* Utility: reverse-lookup the top-level target id that owns a given Page.
|
|
124
|
+
*/
|
|
125
|
+
private findTargetIdByPage;
|
|
126
|
+
private _notePopupSignal;
|
|
127
|
+
/**
|
|
128
|
+
* Await the current active page, waiting briefly if a popup/open was just triggered.
|
|
129
|
+
* Normal path returns immediately; popup path waits up to timeoutMs for the new page.
|
|
130
|
+
*/
|
|
131
|
+
awaitActivePage(timeoutMs?: number): Promise<Page>;
|
|
132
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Locator } from "./locator.js";
|
|
2
|
+
import type { Frame } from "./frame.js";
|
|
3
|
+
import type { Page } from "./page.js";
|
|
4
|
+
export type ResolvedLocatorTarget = {
|
|
5
|
+
frame: Frame;
|
|
6
|
+
selector: string;
|
|
7
|
+
};
|
|
8
|
+
/** Build a Locator scoped to the correct frame for a deep XPath crossing iframes. */
|
|
9
|
+
export declare function deepLocatorThroughIframes(page: Page, root: Frame, xpathOrSelector: string): Promise<Locator>;
|
|
10
|
+
/**
|
|
11
|
+
* Unified resolver that supports '>>' hop notation, deep XPath across iframes,
|
|
12
|
+
* and plain single-frame selectors. Keeps hop logic in one shared place.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveLocatorTarget(page: Page, root: Frame, selectorRaw: string): Promise<ResolvedLocatorTarget>;
|
|
15
|
+
export declare function resolveLocatorWithHops(page: Page, root: Frame, selectorRaw: string): Promise<Locator>;
|
|
16
|
+
/**
|
|
17
|
+
* DeepLocatorDelegate: a lightweight wrapper that looks like a Locator and
|
|
18
|
+
* resolves to the correct frame/element on each call using hop/deep-XPath logic.
|
|
19
|
+
*
|
|
20
|
+
* Returned by `page.deepLocator()` for ergonomic, await-free chaining:
|
|
21
|
+
* page.deepLocator('iframe#ifrA >> #btn').click()
|
|
22
|
+
*/
|
|
23
|
+
export declare class DeepLocatorDelegate {
|
|
24
|
+
private readonly page;
|
|
25
|
+
private readonly root;
|
|
26
|
+
private readonly selector;
|
|
27
|
+
private readonly nthIndex;
|
|
28
|
+
constructor(page: Page, root: Frame, selector: string, nthIndex?: number);
|
|
29
|
+
private real;
|
|
30
|
+
click(options?: {
|
|
31
|
+
button?: "left" | "right" | "middle";
|
|
32
|
+
clickCount?: number;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
count(): Promise<number>;
|
|
35
|
+
hover(): Promise<void>;
|
|
36
|
+
fill(value: string): Promise<void>;
|
|
37
|
+
type(text: string, options?: {
|
|
38
|
+
delay?: number;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
selectOption(values: string | string[]): Promise<string[]>;
|
|
41
|
+
scrollTo(percent: number | string): Promise<void>;
|
|
42
|
+
isVisible(): Promise<boolean>;
|
|
43
|
+
isChecked(): Promise<boolean>;
|
|
44
|
+
inputValue(): Promise<string>;
|
|
45
|
+
textContent(): Promise<string>;
|
|
46
|
+
innerHtml(): Promise<string>;
|
|
47
|
+
innerText(): Promise<string>;
|
|
48
|
+
centroid(): Promise<{
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}>;
|
|
52
|
+
backendNodeId(): Promise<number>;
|
|
53
|
+
highlight(options?: {
|
|
54
|
+
durationMs?: number;
|
|
55
|
+
borderColor?: {
|
|
56
|
+
r: number;
|
|
57
|
+
g: number;
|
|
58
|
+
b: number;
|
|
59
|
+
a?: number;
|
|
60
|
+
};
|
|
61
|
+
contentColor?: {
|
|
62
|
+
r: number;
|
|
63
|
+
g: number;
|
|
64
|
+
b: number;
|
|
65
|
+
a?: number;
|
|
66
|
+
};
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
sendClickEvent(options?: {
|
|
69
|
+
bubbles?: boolean;
|
|
70
|
+
cancelable?: boolean;
|
|
71
|
+
composed?: boolean;
|
|
72
|
+
detail?: number;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
setInputFiles(files: string | string[] | {
|
|
75
|
+
name: string;
|
|
76
|
+
mimeType: string;
|
|
77
|
+
buffer: ArrayBuffer | Uint8Array | Buffer | string;
|
|
78
|
+
} | Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
mimeType: string;
|
|
81
|
+
buffer: ArrayBuffer | Uint8Array | Buffer | string;
|
|
82
|
+
}>): Promise<void>;
|
|
83
|
+
first(): DeepLocatorDelegate;
|
|
84
|
+
nth(index: number): DeepLocatorDelegate;
|
|
85
|
+
}
|
|
86
|
+
/** Factory to create a deep locator delegate from a Page + root frame. */
|
|
87
|
+
export declare function deepLocatorFromPage(page: Page, root: Frame, selector: string): DeepLocatorDelegate;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Protocol } from "devtools-protocol";
|
|
2
|
+
import type { CDPSessionLike } from "./cdp.js";
|
|
3
|
+
type FrameId = Protocol.Page.FrameId;
|
|
4
|
+
type ExecId = Protocol.Runtime.ExecutionContextId;
|
|
5
|
+
export declare class ExecutionContextRegistry {
|
|
6
|
+
private readonly byFrame;
|
|
7
|
+
private readonly byExec;
|
|
8
|
+
/** Wire listeners for this session. Call BEFORE Runtime.enable. */
|
|
9
|
+
attachSession(session: CDPSessionLike): void;
|
|
10
|
+
getMainWorld(session: CDPSessionLike, frameId: FrameId): ExecId | null;
|
|
11
|
+
waitForMainWorld(session: CDPSessionLike, frameId: FrameId, timeoutMs?: number): Promise<ExecId>;
|
|
12
|
+
private register;
|
|
13
|
+
}
|
|
14
|
+
export declare const executionContexts: ExecutionContextRegistry;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { SetInputFilesArgument } from "../types/public/locator.js";
|
|
3
|
+
import { NormalizedFilePayload } from "../types/private/locator.js";
|
|
4
|
+
/**
|
|
5
|
+
* Normalize user-provided setInputFiles arguments into in-memory payloads.
|
|
6
|
+
* - Resolves string paths relative to the provided base directory.
|
|
7
|
+
* - Validates that each path exists and is a regular file.
|
|
8
|
+
* - Converts all buffers into Node Buffers for downstream processing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeInputFiles(files: SetInputFilesArgument, opts?: {
|
|
11
|
+
baseDir?: string;
|
|
12
|
+
}): Promise<NormalizedFilePayload[]>;
|
|
13
|
+
export declare function toBuffer(data: ArrayBuffer | Uint8Array | Buffer | string): Buffer;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Protocol } from "devtools-protocol";
|
|
2
|
+
import type { CDPSessionLike } from "./cdp.js";
|
|
3
|
+
import { Locator } from "./locator.js";
|
|
4
|
+
interface FrameManager {
|
|
5
|
+
session: CDPSessionLike;
|
|
6
|
+
frameId: string;
|
|
7
|
+
pageId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Frame
|
|
11
|
+
*
|
|
12
|
+
* A thin, session-bound handle to a specific DOM frame (by frameId).
|
|
13
|
+
* All CDP calls in this class go through `this.session`, which MUST be the
|
|
14
|
+
* owning session for `this.frameId`. Page is responsible for constructing
|
|
15
|
+
* Frames with the correct session.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Frame implements FrameManager {
|
|
18
|
+
session: CDPSessionLike;
|
|
19
|
+
frameId: string;
|
|
20
|
+
pageId: string;
|
|
21
|
+
private readonly remoteBrowser;
|
|
22
|
+
/** Owning CDP session id (useful for logs); null for root connection (should not happen for targets) */
|
|
23
|
+
readonly sessionId: string | null;
|
|
24
|
+
constructor(session: CDPSessionLike, frameId: string, pageId: string, remoteBrowser: boolean);
|
|
25
|
+
/** True when the controlled browser runs on a different machine. */
|
|
26
|
+
isBrowserRemote(): boolean;
|
|
27
|
+
/** DOM.getNodeForLocation → DOM.describeNode */
|
|
28
|
+
getNodeAtLocation(x: number, y: number): Promise<Protocol.DOM.Node>;
|
|
29
|
+
/** CSS selector → DOM.querySelector → DOM.getBoxModel */
|
|
30
|
+
getLocationForSelector(selector: string): Promise<{
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}>;
|
|
36
|
+
/** Accessibility.getFullAXTree (+ recurse into child frames if requested) */
|
|
37
|
+
getAccessibilityTree(withFrames?: boolean): Promise<Protocol.Accessibility.AXNode[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Evaluate a function or expression in this frame's main world.
|
|
40
|
+
* - If a string is provided, treated as a JS expression.
|
|
41
|
+
* - If a function is provided, it is stringified and invoked with the optional argument.
|
|
42
|
+
*/
|
|
43
|
+
evaluate<R = unknown, Arg = unknown>(pageFunctionOrExpression: string | ((arg: Arg) => R | Promise<R>), arg?: Arg): Promise<R>;
|
|
44
|
+
/** Page.captureScreenshot (frame-scoped session) */
|
|
45
|
+
screenshot(options?: {
|
|
46
|
+
fullPage?: boolean;
|
|
47
|
+
clip?: {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
};
|
|
53
|
+
type?: "png" | "jpeg";
|
|
54
|
+
quality?: number;
|
|
55
|
+
scale?: number;
|
|
56
|
+
}): Promise<Buffer>;
|
|
57
|
+
/** Child frames via Page.getFrameTree */
|
|
58
|
+
childFrames(): Promise<Frame[]>;
|
|
59
|
+
/** Wait for a lifecycle state (load/domcontentloaded/networkidle) */
|
|
60
|
+
waitForLoadState(state?: "load" | "domcontentloaded" | "networkidle", timeoutMs?: number): Promise<void>;
|
|
61
|
+
/** Simple placeholder for your own locator abstraction */
|
|
62
|
+
locator(selector: string, options?: {
|
|
63
|
+
deep?: boolean;
|
|
64
|
+
depth?: number;
|
|
65
|
+
}): Locator;
|
|
66
|
+
/** Resolve the main-world execution context id for this frame. */
|
|
67
|
+
private getMainWorldExecutionContextId;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Page } from "./page.js";
|
|
2
|
+
import { Frame } from "./frame.js";
|
|
3
|
+
/**
|
|
4
|
+
* FrameLocator: resolves iframe elements to their child Frames and allows
|
|
5
|
+
* creating locators scoped to that frame. Supports chaining.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameLocator {
|
|
8
|
+
private readonly parent?;
|
|
9
|
+
private readonly selector;
|
|
10
|
+
private readonly page;
|
|
11
|
+
private readonly root?;
|
|
12
|
+
constructor(page: Page, selector: string, parent?: FrameLocator, root?: Frame);
|
|
13
|
+
/** Create a nested FrameLocator under this one. */
|
|
14
|
+
frameLocator(selector: string): FrameLocator;
|
|
15
|
+
/** Resolve to the concrete Frame for this FrameLocator chain. */
|
|
16
|
+
resolveFrame(): Promise<Frame>;
|
|
17
|
+
/** Return a Locator scoped to this frame. Methods delegate to the frame lazily. */
|
|
18
|
+
locator(selector: string): LocatorDelegate;
|
|
19
|
+
}
|
|
20
|
+
/** A small delegating wrapper that resolves the frame lazily per call. */
|
|
21
|
+
declare class LocatorDelegate {
|
|
22
|
+
private readonly fl;
|
|
23
|
+
private readonly sel;
|
|
24
|
+
private readonly nthIndex;
|
|
25
|
+
constructor(fl: FrameLocator, sel: string, nthIndex?: number);
|
|
26
|
+
private real;
|
|
27
|
+
click(options?: {
|
|
28
|
+
button?: "left" | "right" | "middle";
|
|
29
|
+
clickCount?: number;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
hover(): Promise<void>;
|
|
32
|
+
fill(value: string): Promise<void>;
|
|
33
|
+
type(text: string, options?: {
|
|
34
|
+
delay?: number;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
selectOption(values: string | string[]): Promise<string[]>;
|
|
37
|
+
scrollTo(percent: number | string): Promise<void>;
|
|
38
|
+
isVisible(): Promise<boolean>;
|
|
39
|
+
isChecked(): Promise<boolean>;
|
|
40
|
+
inputValue(): Promise<string>;
|
|
41
|
+
textContent(): Promise<string>;
|
|
42
|
+
innerHtml(): Promise<string>;
|
|
43
|
+
innerText(): Promise<string>;
|
|
44
|
+
count(): Promise<number>;
|
|
45
|
+
first(): LocatorDelegate;
|
|
46
|
+
nth(index: number): LocatorDelegate;
|
|
47
|
+
}
|
|
48
|
+
/** Factory to start a FrameLocator chain from an arbitrary root Frame. */
|
|
49
|
+
export declare function frameLocatorFromFrame(page: Page, root: Frame, selector: string): FrameLocator;
|
|
50
|
+
export {};
|