@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,65 @@
|
|
|
1
|
+
import { LogLine } from "./v3/types/public/logs.js";
|
|
2
|
+
import { LLMClient } from "./v3/llm/LLMClient.js";
|
|
3
|
+
import type { InferStagehandSchema, StagehandZodObject } from "./v3/zodCompat.js";
|
|
4
|
+
export type { LLMParsedResponse, LLMUsage } from "./v3/llm/LLMClient.js";
|
|
5
|
+
export declare function extract<T extends StagehandZodObject>({ instruction, domElements, schema, llmClient, logger, userProvidedInstructions, logInferenceToFile, }: {
|
|
6
|
+
instruction: string;
|
|
7
|
+
domElements: string;
|
|
8
|
+
schema: T;
|
|
9
|
+
llmClient: LLMClient;
|
|
10
|
+
userProvidedInstructions?: string;
|
|
11
|
+
logger: (message: LogLine) => void;
|
|
12
|
+
logInferenceToFile?: boolean;
|
|
13
|
+
}): Promise<InferStagehandSchema<T> & {
|
|
14
|
+
metadata: {
|
|
15
|
+
completed: boolean;
|
|
16
|
+
progress: string;
|
|
17
|
+
};
|
|
18
|
+
prompt_tokens: number;
|
|
19
|
+
completion_tokens: number;
|
|
20
|
+
reasoning_tokens: number;
|
|
21
|
+
cached_input_tokens: number;
|
|
22
|
+
inference_time_ms: number;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function observe({ instruction, domElements, llmClient, userProvidedInstructions, logger, logInferenceToFile, supportedActions, }: {
|
|
25
|
+
instruction: string;
|
|
26
|
+
domElements: string;
|
|
27
|
+
llmClient: LLMClient;
|
|
28
|
+
userProvidedInstructions?: string;
|
|
29
|
+
logger: (message: LogLine) => void;
|
|
30
|
+
logInferenceToFile?: boolean;
|
|
31
|
+
supportedActions?: string[];
|
|
32
|
+
}): Promise<{
|
|
33
|
+
elements: {
|
|
34
|
+
elementId: string;
|
|
35
|
+
description: string;
|
|
36
|
+
method: string;
|
|
37
|
+
arguments: string[];
|
|
38
|
+
}[];
|
|
39
|
+
prompt_tokens: number;
|
|
40
|
+
completion_tokens: number;
|
|
41
|
+
reasoning_tokens: number;
|
|
42
|
+
cached_input_tokens: number;
|
|
43
|
+
inference_time_ms: number;
|
|
44
|
+
}>;
|
|
45
|
+
export declare function act({ instruction, domElements, llmClient, userProvidedInstructions, logger, logInferenceToFile, }: {
|
|
46
|
+
instruction: string;
|
|
47
|
+
domElements: string;
|
|
48
|
+
llmClient: LLMClient;
|
|
49
|
+
userProvidedInstructions?: string;
|
|
50
|
+
logger: (message: LogLine) => void;
|
|
51
|
+
logInferenceToFile?: boolean;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
element: {
|
|
54
|
+
elementId: string;
|
|
55
|
+
description: string;
|
|
56
|
+
method: string;
|
|
57
|
+
arguments: string[];
|
|
58
|
+
};
|
|
59
|
+
prompt_tokens: number;
|
|
60
|
+
completion_tokens: number;
|
|
61
|
+
reasoning_tokens: number;
|
|
62
|
+
cached_input_tokens: number;
|
|
63
|
+
inference_time_ms: number;
|
|
64
|
+
twoStep: boolean;
|
|
65
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appends a new entry to the act_summary.json file, then writes the file back out.
|
|
3
|
+
*/
|
|
4
|
+
export declare function appendSummary<T>(inferenceType: string, entry: T): void;
|
|
5
|
+
/**
|
|
6
|
+
* Writes `data` as JSON into a file in `directory`, using a prefix plus timestamp.
|
|
7
|
+
* Returns both the file name and the timestamp used, so you can log them.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeTimestampedTxtFile(directory: string, prefix: string, data: unknown): {
|
|
10
|
+
fileName: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import pino from "pino";
|
|
2
|
+
import { LogLine } from "./v3/types/public/logs.js";
|
|
3
|
+
export interface LoggerOptions {
|
|
4
|
+
pretty?: boolean;
|
|
5
|
+
level?: pino.Level;
|
|
6
|
+
destination?: pino.DestinationStream;
|
|
7
|
+
usePino?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a configured Pino logger instance
|
|
11
|
+
*/
|
|
12
|
+
export declare function createLogger(options?: LoggerOptions): import("pino").Logger<never, boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* StagehandLogger class that wraps Pino for our specific needs
|
|
15
|
+
*
|
|
16
|
+
* LOGGING PRECEDENCE:
|
|
17
|
+
*
|
|
18
|
+
* Test environments:
|
|
19
|
+
* - External logger provided -> external logger only.
|
|
20
|
+
* - No external logger -> console fallback only (Pino disabled).
|
|
21
|
+
*
|
|
22
|
+
* Non-test environments:
|
|
23
|
+
* - usePino === true -> emit via Pino and also call the external logger when present.
|
|
24
|
+
* - usePino === false -> disable Pino; use the external logger when present, otherwise console fallback.
|
|
25
|
+
* - usePino === undefined -> prefer the external logger when present; otherwise use Pino.
|
|
26
|
+
*
|
|
27
|
+
* SHARED PINO OPTIMIZATION:
|
|
28
|
+
* We maintain a single shared Pino instance when `usePino` is enabled.
|
|
29
|
+
* This prevents spawning a new worker thread for every Stagehand instance
|
|
30
|
+
* (which happens when `pino-pretty` transport is used), eliminating the
|
|
31
|
+
* memory/RSS growth observed when many Stagehand objects are created and
|
|
32
|
+
* disposed within the same process (e.g. a request-per-instance API).
|
|
33
|
+
*/
|
|
34
|
+
export declare class StagehandLogger {
|
|
35
|
+
/**
|
|
36
|
+
* Shared Pino logger instance across all StagehandLogger instances.
|
|
37
|
+
* First instance to enable Pino creates it, subsequent instances reuse it.
|
|
38
|
+
*/
|
|
39
|
+
private static sharedPinoLogger;
|
|
40
|
+
private logger?;
|
|
41
|
+
private verbose;
|
|
42
|
+
private externalLogger?;
|
|
43
|
+
private usePino;
|
|
44
|
+
private isTest;
|
|
45
|
+
constructor(options?: LoggerOptions, externalLogger?: (logLine: LogLine) => void);
|
|
46
|
+
/**
|
|
47
|
+
* Set the verbosity level
|
|
48
|
+
*/
|
|
49
|
+
setVerbosity(level: 0 | 1 | 2): void;
|
|
50
|
+
/**
|
|
51
|
+
* Log a message using our LogLine format
|
|
52
|
+
*/
|
|
53
|
+
log(logLine: LogLine): void;
|
|
54
|
+
/**
|
|
55
|
+
* Helper to format auxiliary data for structured logging
|
|
56
|
+
*/
|
|
57
|
+
private formatAuxiliaryData;
|
|
58
|
+
/**
|
|
59
|
+
* Convenience methods for different log levels
|
|
60
|
+
*/
|
|
61
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
62
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
63
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
64
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
65
|
+
/**
|
|
66
|
+
* Convert a plain object to our auxiliary format
|
|
67
|
+
*/
|
|
68
|
+
private convertToAuxiliary;
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions, ModelConfiguration } from "./v3/types/public/model.js";
|
|
2
|
+
export declare function splitModelName(model: string): {
|
|
3
|
+
provider: string;
|
|
4
|
+
modelName: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function resolveModel(model: string | ModelConfiguration): {
|
|
7
|
+
provider: string;
|
|
8
|
+
modelName: string;
|
|
9
|
+
clientOptions: ClientOptions;
|
|
10
|
+
isCua: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChatMessage } from "./v3/llm/LLMClient.js";
|
|
2
|
+
export declare function buildUserInstructionsString(userProvidedInstructions?: string): string;
|
|
3
|
+
export declare function buildExtractSystemPrompt(isUsingPrintExtractedDataTool?: boolean, userProvidedInstructions?: string): ChatMessage;
|
|
4
|
+
export declare function buildExtractUserPrompt(instruction: string, domElements: string, isUsingPrintExtractedDataTool?: boolean): ChatMessage;
|
|
5
|
+
export declare function buildMetadataSystemPrompt(): ChatMessage;
|
|
6
|
+
export declare function buildMetadataPrompt(instruction: string, extractionResponse: object): ChatMessage;
|
|
7
|
+
export declare function buildObserveSystemPrompt(userProvidedInstructions?: string, supportedActions?: string[]): ChatMessage;
|
|
8
|
+
export declare function buildObserveUserMessage(instruction: string, domElements: string): ChatMessage;
|
|
9
|
+
export declare function buildActSystemPrompt(userProvidedInstructions?: string): ChatMessage;
|
|
10
|
+
export declare function buildActPrompt(action: string, supportedActions: string[], variables?: Record<string, string>): string;
|
|
11
|
+
export declare function buildStepTwoPrompt(originalUserAction: string, previousAction: string, supportedActions: string[], variables?: Record<string, string>): string;
|
|
12
|
+
export declare function buildOperatorSystemPrompt(goal: string): ChatMessage;
|
|
13
|
+
export declare function buildCuaDefaultSystemPrompt(): string;
|
|
14
|
+
export declare function buildGoogleCUASystemPrompt(): ChatMessage;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Schema } from "@google/genai";
|
|
2
|
+
import { z, ZodTypeAny } from "zod";
|
|
3
|
+
import { LogLine } from "./v3/types/public/logs.js";
|
|
4
|
+
import { ModelProvider } from "./v3/types/public/model.js";
|
|
5
|
+
import { ZodPathSegments } from "./v3/types/private/internal.js";
|
|
6
|
+
import type { StagehandZodSchema } from "./v3/zodCompat.js";
|
|
7
|
+
export declare function getZFactory(schema: StagehandZodSchema): typeof z;
|
|
8
|
+
export declare function validateZodSchema(schema: StagehandZodSchema, data: unknown): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Detects if the code is running in the Bun runtime environment.
|
|
11
|
+
* @returns {boolean} True if running in Bun, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isRunningInBun(): boolean;
|
|
14
|
+
export declare function toGeminiSchema(zodSchema: StagehandZodSchema): Schema;
|
|
15
|
+
export declare function getZodType(schema: StagehandZodSchema): string;
|
|
16
|
+
/**
|
|
17
|
+
* Recursively traverses a given Zod schema, scanning for any fields of type `z.string().url()`.
|
|
18
|
+
* For each such field, it replaces the `z.string().url()` with `z.number()`.
|
|
19
|
+
*
|
|
20
|
+
* This function is used internally by higher-level utilities (e.g., transforming entire object schemas)
|
|
21
|
+
* and handles nested objects, arrays, unions, intersections, optionals.
|
|
22
|
+
*
|
|
23
|
+
* @param schema - The Zod schema to transform.
|
|
24
|
+
* @param currentPath - An array of string/number keys representing the current schema path (used internally for recursion).
|
|
25
|
+
* @returns A two-element tuple:
|
|
26
|
+
* 1. The updated Zod schema, with any `.url()` fields replaced by `z.number()`.
|
|
27
|
+
* 2. An array of {@link ZodPathSegments} objects representing each replaced field, including the path segments.
|
|
28
|
+
*/
|
|
29
|
+
export declare function transformSchema(schema: StagehandZodSchema, currentPath: Array<string | number>): [StagehandZodSchema, ZodPathSegments[]];
|
|
30
|
+
/**
|
|
31
|
+
* Once we get the final extracted object that has numeric IDs in place of URLs,
|
|
32
|
+
* use `injectUrls` to walk the object and replace numeric IDs
|
|
33
|
+
* with the real URL strings from idToUrlMapping. The `path` may include `*`
|
|
34
|
+
* for array indices (indicating "all items in the array").
|
|
35
|
+
*/
|
|
36
|
+
export declare function injectUrls(obj: unknown, path: Array<string | number>, idToUrlMapping: Record<string, string>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Mapping from LLM provider names to their corresponding environment variable names for API keys.
|
|
39
|
+
*/
|
|
40
|
+
export declare const providerEnvVarMap: Partial<Record<ModelProvider | string, string | Array<string>>>;
|
|
41
|
+
/**
|
|
42
|
+
* Loads an API key for a provider, checking environment variables.
|
|
43
|
+
* @param provider The name of the provider (e.g., 'openai', 'anthropic')
|
|
44
|
+
* @param logger Optional logger for info/error messages
|
|
45
|
+
* @returns The API key if found, undefined otherwise
|
|
46
|
+
*/
|
|
47
|
+
export declare function loadApiKeyFromEnv(provider: string | undefined, logger: (logLine: LogLine) => void): string | undefined;
|
|
48
|
+
export declare function trimTrailingTextNode(path: string | undefined): string | undefined;
|
|
49
|
+
export interface JsonSchemaProperty {
|
|
50
|
+
type: string;
|
|
51
|
+
enum?: unknown[];
|
|
52
|
+
items?: JsonSchemaProperty;
|
|
53
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
54
|
+
required?: string[];
|
|
55
|
+
minimum?: number;
|
|
56
|
+
maximum?: number;
|
|
57
|
+
description?: string;
|
|
58
|
+
format?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface JsonSchema extends JsonSchemaProperty {
|
|
61
|
+
type: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts a JSON Schema object to a Zod schema
|
|
65
|
+
* @param schema The JSON Schema object to convert
|
|
66
|
+
* @returns A Zod schema equivalent to the input JSON Schema
|
|
67
|
+
*/
|
|
68
|
+
export declare function jsonSchemaToZod(schema: JsonSchema): ZodTypeAny;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AgentAction, AgentResult, AgentType, AgentExecutionOptions } from "../types/public/agent.js";
|
|
2
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for agent clients
|
|
5
|
+
* This provides a common interface for all agent implementations
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class AgentClient {
|
|
8
|
+
type: AgentType;
|
|
9
|
+
modelName: string;
|
|
10
|
+
clientOptions: ClientOptions;
|
|
11
|
+
userProvidedInstructions?: string;
|
|
12
|
+
constructor(type: AgentType, modelName: string, userProvidedInstructions?: string);
|
|
13
|
+
abstract execute(options: AgentExecutionOptions): Promise<AgentResult>;
|
|
14
|
+
abstract captureScreenshot(options?: Record<string, unknown>): Promise<unknown>;
|
|
15
|
+
abstract setViewport(width: number, height: number): void;
|
|
16
|
+
abstract setCurrentUrl(url: string): void;
|
|
17
|
+
abstract setScreenshotProvider(provider: () => Promise<string>): void;
|
|
18
|
+
abstract setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ToolSet } from "ai/dist";
|
|
2
|
+
import { AgentProviderType } from "../types/public/agent.js";
|
|
3
|
+
import { LogLine } from "../types/public/logs.js";
|
|
4
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
5
|
+
import { AgentClient } from "./AgentClient.js";
|
|
6
|
+
export declare const modelToAgentProviderMap: Record<string, AgentProviderType>;
|
|
7
|
+
/**
|
|
8
|
+
* Provider for agent clients
|
|
9
|
+
* This class is responsible for creating the appropriate agent client
|
|
10
|
+
* based on the provider type
|
|
11
|
+
*/
|
|
12
|
+
export declare class AgentProvider {
|
|
13
|
+
private logger;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new agent provider
|
|
16
|
+
*/
|
|
17
|
+
constructor(logger: (message: LogLine) => void);
|
|
18
|
+
getClient(modelName: string, clientOptions?: ClientOptions, userProvidedInstructions?: string, tools?: ToolSet): AgentClient;
|
|
19
|
+
static getAgentProvider(modelName: string): AgentProviderType;
|
|
20
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AgentAction, AgentResult, AgentType, AnthropicContentBlock, AnthropicMessage, AnthropicToolResult, AgentExecutionOptions, ToolUseItem } from "../types/public/agent.js";
|
|
2
|
+
import { LogLine } from "../types/public/logs.js";
|
|
3
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
4
|
+
import { ToolSet } from "ai";
|
|
5
|
+
import { AgentClient } from "./AgentClient.js";
|
|
6
|
+
export type ResponseInputItem = AnthropicMessage | AnthropicToolResult;
|
|
7
|
+
/**
|
|
8
|
+
* Client for Anthropic's Computer Use API
|
|
9
|
+
* This implementation uses the official Anthropic Messages API for Computer Use
|
|
10
|
+
*/
|
|
11
|
+
export declare class AnthropicCUAClient extends AgentClient {
|
|
12
|
+
private apiKey;
|
|
13
|
+
private baseURL?;
|
|
14
|
+
private client;
|
|
15
|
+
lastMessageId?: string;
|
|
16
|
+
private currentViewport;
|
|
17
|
+
private currentUrl?;
|
|
18
|
+
private screenshotProvider?;
|
|
19
|
+
private actionHandler?;
|
|
20
|
+
private thinkingBudget;
|
|
21
|
+
private tools?;
|
|
22
|
+
constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: ClientOptions, tools?: ToolSet);
|
|
23
|
+
setViewport(width: number, height: number): void;
|
|
24
|
+
setCurrentUrl(url: string): void;
|
|
25
|
+
setScreenshotProvider(provider: () => Promise<string>): void;
|
|
26
|
+
setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
|
|
27
|
+
setTools(tools: ToolSet): void;
|
|
28
|
+
/**
|
|
29
|
+
* Execute a task with the Anthropic CUA
|
|
30
|
+
* This is the main entry point for the agent
|
|
31
|
+
* @implements AgentClient.execute
|
|
32
|
+
*/
|
|
33
|
+
execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
|
|
34
|
+
executeStep(inputItems: ResponseInputItem[], logger: (message: LogLine) => void): Promise<{
|
|
35
|
+
actions: AgentAction[];
|
|
36
|
+
message: string;
|
|
37
|
+
completed: boolean;
|
|
38
|
+
nextInputItems: ResponseInputItem[];
|
|
39
|
+
usage: {
|
|
40
|
+
input_tokens: number;
|
|
41
|
+
output_tokens: number;
|
|
42
|
+
inference_time_ms: number;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
private createInitialInputItems;
|
|
46
|
+
getAction(inputItems: ResponseInputItem[]): Promise<{
|
|
47
|
+
content: AnthropicContentBlock[];
|
|
48
|
+
id: string;
|
|
49
|
+
usage: Record<string, number>;
|
|
50
|
+
}>;
|
|
51
|
+
takeAction(toolUseItems: ToolUseItem[], logger: (message: LogLine) => void): Promise<AnthropicToolResult[]>;
|
|
52
|
+
private convertToolUseToAction;
|
|
53
|
+
captureScreenshot(options?: {
|
|
54
|
+
base64Image?: string;
|
|
55
|
+
currentUrl?: string;
|
|
56
|
+
}): Promise<string>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LogLine } from "../types/public/logs.js";
|
|
2
|
+
import { AgentAction, AgentResult, AgentType, AgentExecutionOptions, SafetyConfirmationHandler } from "../types/public/agent.js";
|
|
3
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
4
|
+
import { AgentClient } from "./AgentClient.js";
|
|
5
|
+
import { ToolSet } from "ai";
|
|
6
|
+
/**
|
|
7
|
+
* Client for Google's Computer Use Assistant API
|
|
8
|
+
* This implementation uses the Google Generative AI SDK for Computer Use
|
|
9
|
+
*/
|
|
10
|
+
export declare class GoogleCUAClient extends AgentClient {
|
|
11
|
+
private apiKey;
|
|
12
|
+
private client;
|
|
13
|
+
private currentViewport;
|
|
14
|
+
private currentUrl?;
|
|
15
|
+
private screenshotProvider?;
|
|
16
|
+
private actionHandler?;
|
|
17
|
+
private history;
|
|
18
|
+
private environment;
|
|
19
|
+
private generateContentConfig;
|
|
20
|
+
private tools?;
|
|
21
|
+
private baseURL?;
|
|
22
|
+
private safetyConfirmationHandler?;
|
|
23
|
+
constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: ClientOptions, tools?: ToolSet);
|
|
24
|
+
setViewport(width: number, height: number): void;
|
|
25
|
+
setCurrentUrl(url: string): void;
|
|
26
|
+
setScreenshotProvider(provider: () => Promise<string>): void;
|
|
27
|
+
setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
|
|
28
|
+
setTools(tools: ToolSet): void;
|
|
29
|
+
setSafetyConfirmationHandler(handler?: SafetyConfirmationHandler): void;
|
|
30
|
+
private handleSafetyConfirmation;
|
|
31
|
+
/**
|
|
32
|
+
* Update the generateContentConfig with current tools
|
|
33
|
+
*/
|
|
34
|
+
private updateGenerateContentConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Execute a task with the Google CUA
|
|
37
|
+
* This is the main entry point for the agent
|
|
38
|
+
* @implements AgentClient.execute
|
|
39
|
+
*/
|
|
40
|
+
execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Initialize conversation history with the initial instruction
|
|
43
|
+
*/
|
|
44
|
+
private initializeHistory;
|
|
45
|
+
/**
|
|
46
|
+
* Execute a single step of the agent
|
|
47
|
+
*/
|
|
48
|
+
executeStep(logger: (message: LogLine) => void): Promise<{
|
|
49
|
+
actions: AgentAction[];
|
|
50
|
+
message: string;
|
|
51
|
+
completed: boolean;
|
|
52
|
+
usage: {
|
|
53
|
+
input_tokens: number;
|
|
54
|
+
output_tokens: number;
|
|
55
|
+
inference_time_ms: number;
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Process the response from Google's API
|
|
60
|
+
*/
|
|
61
|
+
private processResponse;
|
|
62
|
+
/**
|
|
63
|
+
* Convert Google function call to Stagehand action
|
|
64
|
+
*/
|
|
65
|
+
private convertFunctionCallToAction;
|
|
66
|
+
/**
|
|
67
|
+
* Normalize coordinates from Google's 0-1000 range to viewport dimensions
|
|
68
|
+
*/
|
|
69
|
+
private normalizeCoordinates;
|
|
70
|
+
captureScreenshot(options?: {
|
|
71
|
+
base64Image?: string;
|
|
72
|
+
currentUrl?: string;
|
|
73
|
+
}): Promise<string>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AgentAction, AgentResult, AgentType, AgentExecutionOptions } from "../types/public/agent.js";
|
|
2
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
3
|
+
import { AgentClient } from "./AgentClient.js";
|
|
4
|
+
/**
|
|
5
|
+
* Client for FARA (Function-based Autonomous Research Agent) by Microsoft
|
|
6
|
+
* This implementation uses OpenAI-compatible API with XML-based tool calling
|
|
7
|
+
*/
|
|
8
|
+
export declare class MicrosoftCUAClient extends AgentClient {
|
|
9
|
+
private apiKey;
|
|
10
|
+
private baseURL;
|
|
11
|
+
private client;
|
|
12
|
+
private currentViewport;
|
|
13
|
+
private currentUrl?;
|
|
14
|
+
private screenshotProvider?;
|
|
15
|
+
private actionHandler?;
|
|
16
|
+
private conversationHistory;
|
|
17
|
+
private actionHistory;
|
|
18
|
+
private maxImages;
|
|
19
|
+
private temperature;
|
|
20
|
+
private facts;
|
|
21
|
+
private readonly MLM_PROCESSOR_IM_CFG;
|
|
22
|
+
private resizedViewport;
|
|
23
|
+
constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: ClientOptions);
|
|
24
|
+
setViewport(width: number, height: number): void;
|
|
25
|
+
setCurrentUrl(url: string): void;
|
|
26
|
+
setScreenshotProvider(provider: () => Promise<string>): void;
|
|
27
|
+
setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Smart resize algorithm from FARA
|
|
30
|
+
* Ensures dimensions are divisible by factor and within pixel limits
|
|
31
|
+
*/
|
|
32
|
+
private smartResize;
|
|
33
|
+
/**
|
|
34
|
+
* Generate system prompt with tool description
|
|
35
|
+
* Simplified to match Python's minimal approach
|
|
36
|
+
*/
|
|
37
|
+
private generateSystemPrompt;
|
|
38
|
+
/**
|
|
39
|
+
* Parse thoughts and action from model response
|
|
40
|
+
* FARA uses XML-based tool calling: <tool_call>\n{...}\n</tool_call>
|
|
41
|
+
*/
|
|
42
|
+
private parseThoughtsAndAction;
|
|
43
|
+
/**
|
|
44
|
+
* Convert FARA function call to Stagehand AgentAction
|
|
45
|
+
*/
|
|
46
|
+
private convertFunctionCallToAction;
|
|
47
|
+
/**
|
|
48
|
+
* Capture a screenshot and return as base64 data URL
|
|
49
|
+
*/
|
|
50
|
+
captureScreenshot(): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Remove old screenshots from history
|
|
53
|
+
* Matches Python's maybe_remove_old_screenshots
|
|
54
|
+
*/
|
|
55
|
+
private maybeRemoveOldScreenshots;
|
|
56
|
+
/**
|
|
57
|
+
* Reconstruct history for API call
|
|
58
|
+
* Merges conceptual chat history with raw action history
|
|
59
|
+
*/
|
|
60
|
+
private reconstructHistory;
|
|
61
|
+
/**
|
|
62
|
+
* Execute a single step
|
|
63
|
+
*/
|
|
64
|
+
private executeStep;
|
|
65
|
+
/**
|
|
66
|
+
* Execute a task with the FARA CUA
|
|
67
|
+
* This is the main entry point for the agent
|
|
68
|
+
* @implements AgentClient.execute
|
|
69
|
+
*/
|
|
70
|
+
execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LogLine } from "../types/public/logs.js";
|
|
2
|
+
import { AgentAction, AgentResult, AgentType, AgentExecutionOptions, ResponseInputItem, ResponseItem, SafetyConfirmationHandler } from "../types/public/agent.js";
|
|
3
|
+
import { ClientOptions } from "../types/public/model.js";
|
|
4
|
+
import { AgentClient } from "./AgentClient.js";
|
|
5
|
+
import { ToolSet } from "ai";
|
|
6
|
+
/**
|
|
7
|
+
* Client for OpenAI's Computer Use Assistant API
|
|
8
|
+
* This implementation uses the official OpenAI Responses API for Computer Use
|
|
9
|
+
*/
|
|
10
|
+
export declare class OpenAICUAClient extends AgentClient {
|
|
11
|
+
private apiKey;
|
|
12
|
+
private organization?;
|
|
13
|
+
private baseURL;
|
|
14
|
+
private client;
|
|
15
|
+
lastResponseId?: string;
|
|
16
|
+
private currentViewport;
|
|
17
|
+
private currentUrl?;
|
|
18
|
+
private screenshotProvider?;
|
|
19
|
+
private actionHandler?;
|
|
20
|
+
private reasoningItems;
|
|
21
|
+
private environment;
|
|
22
|
+
private tools?;
|
|
23
|
+
private safetyConfirmationHandler?;
|
|
24
|
+
constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: ClientOptions, tools?: ToolSet);
|
|
25
|
+
setViewport(width: number, height: number): void;
|
|
26
|
+
setCurrentUrl(url: string): void;
|
|
27
|
+
setScreenshotProvider(provider: () => Promise<string>): void;
|
|
28
|
+
setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
|
|
29
|
+
setTools(tools: ToolSet): void;
|
|
30
|
+
setSafetyConfirmationHandler(handler?: SafetyConfirmationHandler): void;
|
|
31
|
+
/**
|
|
32
|
+
* Execute a task with the OpenAI CUA
|
|
33
|
+
* This is the main entry point for the agent
|
|
34
|
+
* @implements AgentClient.execute
|
|
35
|
+
*/
|
|
36
|
+
execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Execute a single step of the agent
|
|
39
|
+
* This coordinates the flow: Request → Get Action → Execute Action
|
|
40
|
+
*/
|
|
41
|
+
executeStep(inputItems: ResponseInputItem[], previousResponseId: string | undefined, logger: (message: LogLine) => void): Promise<{
|
|
42
|
+
actions: AgentAction[];
|
|
43
|
+
message: string;
|
|
44
|
+
completed: boolean;
|
|
45
|
+
nextInputItems: ResponseInputItem[];
|
|
46
|
+
responseId: string;
|
|
47
|
+
usage: {
|
|
48
|
+
input_tokens: number;
|
|
49
|
+
output_tokens: number;
|
|
50
|
+
inference_time_ms: number;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
private isComputerCallItem;
|
|
54
|
+
private handleSafetyConfirmation;
|
|
55
|
+
private isFunctionCallItem;
|
|
56
|
+
private createInitialInputItems;
|
|
57
|
+
getAction(inputItems: ResponseInputItem[], previousResponseId?: string): Promise<{
|
|
58
|
+
output: ResponseItem[];
|
|
59
|
+
responseId: string;
|
|
60
|
+
usage: Record<string, number>;
|
|
61
|
+
}>;
|
|
62
|
+
takeAction(output: ResponseItem[], logger: (message: LogLine) => void): Promise<ResponseInputItem[]>;
|
|
63
|
+
private convertComputerCallToAction;
|
|
64
|
+
private convertFunctionCallToAction;
|
|
65
|
+
captureScreenshot(options?: {
|
|
66
|
+
base64Image?: string;
|
|
67
|
+
currentUrl?: string;
|
|
68
|
+
}): Promise<string>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentToolMode } from "../../types/public/agent.js";
|
|
2
|
+
export interface AgentSystemPromptOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
executionInstruction: string;
|
|
5
|
+
mode: AgentToolMode;
|
|
6
|
+
systemInstructions?: string;
|
|
7
|
+
/** Whether running on Browserbase (enables captcha solver messaging) */
|
|
8
|
+
isBrowserbase?: boolean;
|
|
9
|
+
/** Tools to exclude from the system prompt */
|
|
10
|
+
excludeTools?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function buildAgentSystemPrompt(options: AgentSystemPromptOptions): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { V3 } from "../../v3.js";
|
|
2
|
+
import type { Action } from "../../types/public/methods.js";
|
|
3
|
+
export declare const actTool: (v3: V3, executionModel?: string) => import("ai").Tool<{
|
|
4
|
+
action: string;
|
|
5
|
+
}, {
|
|
6
|
+
success: boolean;
|
|
7
|
+
action: string;
|
|
8
|
+
playwrightArguments?: Action;
|
|
9
|
+
} | {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: any;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { V3 } from "../../v3.js";
|
|
2
|
+
export declare const clickAndHoldTool: (v3: V3, provider?: string) => import("ai").Tool<{
|
|
3
|
+
describe: string;
|
|
4
|
+
duration: number;
|
|
5
|
+
coordinates: number[];
|
|
6
|
+
}, {
|
|
7
|
+
success: boolean;
|
|
8
|
+
describe: string;
|
|
9
|
+
error?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
success: boolean;
|
|
12
|
+
error: string;
|
|
13
|
+
describe?: undefined;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { V3 } from "../../v3.js";
|
|
2
|
+
import type { DragAndDropToolResult } from "../../types/public/agent.js";
|
|
3
|
+
export declare const dragAndDropTool: (v3: V3, provider?: string) => import("ai").Tool<{
|
|
4
|
+
describe: string;
|
|
5
|
+
startCoordinates: number[];
|
|
6
|
+
endCoordinates: number[];
|
|
7
|
+
}, DragAndDropToolResult>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { V3 } from "../../v3.js";
|
|
2
|
+
export declare const extractTool: (v3: V3, executionModel?: string) => import("ai").Tool<{
|
|
3
|
+
instruction: string;
|
|
4
|
+
schema?: {
|
|
5
|
+
[x: string]: unknown;
|
|
6
|
+
type?: string;
|
|
7
|
+
properties?: Record<string, unknown>;
|
|
8
|
+
items?: unknown;
|
|
9
|
+
enum?: string[];
|
|
10
|
+
format?: "email" | "uuid" | "url";
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
success: boolean;
|
|
14
|
+
result: unknown;
|
|
15
|
+
error?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
success: boolean;
|
|
18
|
+
error: string;
|
|
19
|
+
result?: undefined;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { V3 } from "../../v3.js";
|
|
2
|
+
import type { FillFormVisionToolResult } from "../../types/public/agent.js";
|
|
3
|
+
export declare const fillFormVisionTool: (v3: V3, provider?: string) => import("ai").Tool<{
|
|
4
|
+
fields: {
|
|
5
|
+
action: string;
|
|
6
|
+
value: string;
|
|
7
|
+
coordinates: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
12
|
+
}, FillFormVisionToolResult>;
|