@browserbasehq/orca 3.1.0-patch.0 → 3.1.0-patch.1

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.
Files changed (387) hide show
  1. package/dist/cjs/cli.js +183 -0
  2. package/dist/cjs/cli.js.map +7 -0
  3. package/dist/cjs/index.d.ts +1 -0
  4. package/dist/cjs/index.js +24956 -0
  5. package/dist/cjs/index.js.map +7 -0
  6. package/dist/cjs/lib/inference.d.ts +65 -0
  7. package/dist/cjs/lib/inferenceLogUtils.d.ts +12 -0
  8. package/dist/cjs/lib/logger.d.ts +69 -0
  9. package/dist/cjs/lib/modelUtils.d.ts +11 -0
  10. package/dist/cjs/lib/prompt.d.ts +14 -0
  11. package/dist/cjs/lib/utils.d.ts +68 -0
  12. package/dist/cjs/lib/v3/agent/AgentClient.d.ts +19 -0
  13. package/dist/cjs/lib/v3/agent/AgentProvider.d.ts +20 -0
  14. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.d.ts +57 -0
  15. package/dist/cjs/lib/v3/agent/GoogleCUAClient.d.ts +74 -0
  16. package/dist/cjs/lib/v3/agent/MicrosoftCUAClient.d.ts +71 -0
  17. package/dist/cjs/lib/v3/agent/OpenAICUAClient.d.ts +69 -0
  18. package/dist/cjs/lib/v3/agent/prompts/agentSystemPrompt.d.ts +12 -0
  19. package/dist/cjs/lib/v3/agent/tools/act.d.ts +12 -0
  20. package/dist/cjs/lib/v3/agent/tools/ariaTree.d.ts +5 -0
  21. package/dist/cjs/lib/v3/agent/tools/click.d.ts +6 -0
  22. package/dist/cjs/lib/v3/agent/tools/clickAndHold.d.ts +14 -0
  23. package/dist/cjs/lib/v3/agent/tools/dragAndDrop.d.ts +7 -0
  24. package/dist/cjs/lib/v3/agent/tools/extract.d.ts +20 -0
  25. package/dist/cjs/lib/v3/agent/tools/fillFormVision.d.ts +12 -0
  26. package/dist/cjs/lib/v3/agent/tools/fillform.d.ts +12 -0
  27. package/dist/cjs/lib/v3/agent/tools/goto.d.ts +12 -0
  28. package/dist/cjs/lib/v3/agent/tools/index.d.ts +92 -0
  29. package/dist/cjs/lib/v3/agent/tools/keys.d.ts +24 -0
  30. package/dist/cjs/lib/v3/agent/tools/navback.d.ts +6 -0
  31. package/dist/cjs/lib/v3/agent/tools/screenshot.d.ts +6 -0
  32. package/dist/cjs/lib/v3/agent/tools/scroll.d.ts +19 -0
  33. package/dist/cjs/lib/v3/agent/tools/search.d.ts +15 -0
  34. package/dist/cjs/lib/v3/agent/tools/think.d.ts +6 -0
  35. package/dist/cjs/lib/v3/agent/tools/type.d.ts +7 -0
  36. package/dist/cjs/lib/v3/agent/tools/wait.d.ts +5 -0
  37. package/dist/cjs/lib/v3/agent/utils/actionMapping.d.ts +3 -0
  38. package/dist/cjs/lib/v3/agent/utils/coordinateNormalization.d.ts +13 -0
  39. package/dist/cjs/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
  40. package/dist/cjs/lib/v3/agent/utils/googleCustomToolHandler.d.ts +25 -0
  41. package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.d.ts +22 -0
  42. package/dist/cjs/lib/v3/agent/utils/imageCompression.d.ts +53 -0
  43. package/dist/cjs/lib/v3/agent/utils/messageProcessing.d.ts +12 -0
  44. package/dist/cjs/lib/v3/agent/utils/screenshotHandler.d.ts +10 -0
  45. package/dist/cjs/lib/v3/agent/utils/validateExperimentalFeatures.d.ts +26 -0
  46. package/dist/cjs/lib/v3/agent/utils/xpath.d.ts +11 -0
  47. package/dist/cjs/lib/v3/api.d.ts +86 -0
  48. package/dist/cjs/lib/v3/cache/ActCache.d.ts +23 -0
  49. package/dist/cjs/lib/v3/cache/AgentCache.d.ts +109 -0
  50. package/dist/cjs/lib/v3/cache/CacheStorage.d.ts +17 -0
  51. package/dist/cjs/lib/v3/cache/serverAgentCache.d.ts +7 -0
  52. package/dist/cjs/lib/v3/cache/utils.d.ts +15 -0
  53. package/dist/cjs/lib/v3/cli.d.ts +2 -0
  54. package/dist/cjs/lib/v3/dom/a11yScripts/index.d.ts +11 -0
  55. package/dist/cjs/lib/v3/dom/build/a11yScripts.generated.d.ts +16 -0
  56. package/dist/cjs/lib/v3/dom/build/locatorScripts.generated.d.ts +52 -0
  57. package/dist/cjs/lib/v3/dom/build/reRenderScriptContent.d.ts +1 -0
  58. package/dist/cjs/lib/v3/dom/build/rerender-index.d.ts +0 -0
  59. package/dist/cjs/lib/v3/dom/build/rerender-index.js +1 -0
  60. package/dist/cjs/lib/v3/dom/build/screenshotScripts.generated.d.ts +4 -0
  61. package/dist/cjs/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
  62. package/dist/cjs/lib/v3/dom/build/v3-index.d.ts +0 -0
  63. package/dist/cjs/lib/v3/dom/build/v3-index.js +1 -0
  64. package/dist/cjs/lib/v3/dom/genA11yScripts.d.ts +1 -0
  65. package/dist/cjs/lib/v3/dom/genDomScripts.d.ts +1 -0
  66. package/dist/cjs/lib/v3/dom/genLocatorScripts.d.ts +1 -0
  67. package/dist/cjs/lib/v3/dom/genScreenshotScripts.d.ts +1 -0
  68. package/dist/cjs/lib/v3/dom/index.d.ts +1 -0
  69. package/dist/cjs/lib/v3/dom/locatorScripts/counts.d.ts +15 -0
  70. package/dist/cjs/lib/v3/dom/locatorScripts/index.d.ts +4 -0
  71. package/dist/cjs/lib/v3/dom/locatorScripts/scripts.d.ts +37 -0
  72. package/dist/cjs/lib/v3/dom/locatorScripts/selectors.d.ts +4 -0
  73. package/dist/cjs/lib/v3/dom/locatorScripts/waitForSelector.d.ts +19 -0
  74. package/dist/cjs/lib/v3/dom/locatorScripts/xpathParser.d.ts +76 -0
  75. package/dist/cjs/lib/v3/dom/locatorScripts/xpathResolver.d.ts +9 -0
  76. package/dist/cjs/lib/v3/dom/piercer.entry.d.ts +1 -0
  77. package/dist/cjs/lib/v3/dom/piercer.runtime.d.ts +23 -0
  78. package/dist/cjs/lib/v3/dom/rerenderMissingShadows.entry.d.ts +1 -0
  79. package/dist/cjs/lib/v3/dom/rerenderMissingShadows.runtime.d.ts +1 -0
  80. package/dist/cjs/lib/v3/dom/screenshotScripts/index.d.ts +1 -0
  81. package/dist/cjs/lib/v3/dom/screenshotScripts/resolveMaskRect.d.ts +8 -0
  82. package/dist/cjs/lib/v3/external_clients/aisdk.d.ts +11 -0
  83. package/dist/cjs/lib/v3/external_clients/customOpenAI.d.ts +18 -0
  84. package/dist/cjs/lib/v3/flowLogger.d.ts +139 -0
  85. package/dist/cjs/lib/v3/handlers/actHandler.d.ts +21 -0
  86. package/dist/cjs/lib/v3/handlers/extractHandler.d.ts +31 -0
  87. package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +24 -0
  88. package/dist/cjs/lib/v3/handlers/handlerUtils/timeoutGuard.d.ts +2 -0
  89. package/dist/cjs/lib/v3/handlers/observeHandler.d.ts +17 -0
  90. package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +32 -0
  91. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.d.ts +33 -0
  92. package/dist/cjs/lib/v3/index.d.ts +18 -0
  93. package/dist/cjs/lib/v3/launch/browserbase.d.ts +7 -0
  94. package/dist/cjs/lib/v3/launch/local.d.ts +15 -0
  95. package/dist/cjs/lib/v3/llm/AnthropicClient.d.ts +16 -0
  96. package/dist/cjs/lib/v3/llm/CerebrasClient.d.ts +17 -0
  97. package/dist/cjs/lib/v3/llm/GoogleClient.d.ts +19 -0
  98. package/dist/cjs/lib/v3/llm/GroqClient.d.ts +17 -0
  99. package/dist/cjs/lib/v3/llm/LLMClient.d.ts +121 -0
  100. package/dist/cjs/lib/v3/llm/LLMProvider.d.ts +13 -0
  101. package/dist/cjs/lib/v3/llm/OpenAIClient.d.ts +15 -0
  102. package/dist/cjs/lib/v3/llm/aisdk.d.ts +15 -0
  103. package/dist/cjs/lib/v3/logger.d.ts +9 -0
  104. package/dist/cjs/lib/v3/mcp/connection.d.ts +11 -0
  105. package/dist/cjs/lib/v3/mcp/utils.d.ts +3 -0
  106. package/dist/cjs/lib/v3/shutdown/cleanupLocal.d.ts +14 -0
  107. package/dist/cjs/lib/v3/shutdown/supervisor.d.ts +11 -0
  108. package/dist/cjs/lib/v3/shutdown/supervisorClient.d.ts +15 -0
  109. package/dist/cjs/lib/v3/tests/agent-abort-signal.spec.js +113 -0
  110. package/dist/cjs/lib/v3/tests/agent-abort-signal.spec.js.map +7 -0
  111. package/dist/cjs/lib/v3/tests/agent-cache-self-heal.spec.js +102 -0
  112. package/dist/cjs/lib/v3/tests/agent-cache-self-heal.spec.js.map +7 -0
  113. package/dist/cjs/lib/v3/tests/agent-callbacks.spec.js +374 -0
  114. package/dist/cjs/lib/v3/tests/agent-callbacks.spec.js.map +7 -0
  115. package/dist/cjs/lib/v3/tests/agent-experimental-validation.spec.js +354 -0
  116. package/dist/cjs/lib/v3/tests/agent-experimental-validation.spec.js.map +7 -0
  117. package/dist/cjs/lib/v3/tests/agent-hybrid-mode.spec.js +247 -0
  118. package/dist/cjs/lib/v3/tests/agent-hybrid-mode.spec.js.map +7 -0
  119. package/dist/cjs/lib/v3/tests/agent-message-continuation.spec.js +105 -0
  120. package/dist/cjs/lib/v3/tests/agent-message-continuation.spec.js.map +7 -0
  121. package/dist/cjs/lib/v3/tests/agent-streaming.spec.js +126 -0
  122. package/dist/cjs/lib/v3/tests/agent-streaming.spec.js.map +7 -0
  123. package/dist/cjs/lib/v3/tests/cdp-session-detached.spec.js +44 -0
  124. package/dist/cjs/lib/v3/tests/cdp-session-detached.spec.js.map +7 -0
  125. package/dist/cjs/lib/v3/tests/click-count.spec.js +147 -0
  126. package/dist/cjs/lib/v3/tests/click-count.spec.js.map +7 -0
  127. package/dist/cjs/lib/v3/tests/connect-to-existing-browser.spec.js +54 -0
  128. package/dist/cjs/lib/v3/tests/connect-to-existing-browser.spec.js.map +7 -0
  129. package/dist/cjs/lib/v3/tests/context-addInitScript.spec.js +176 -0
  130. package/dist/cjs/lib/v3/tests/context-addInitScript.spec.js.map +7 -0
  131. package/dist/cjs/lib/v3/tests/default-page-tracking.spec.js +53 -0
  132. package/dist/cjs/lib/v3/tests/default-page-tracking.spec.js.map +7 -0
  133. package/dist/cjs/lib/v3/tests/downloads.spec.js +80 -0
  134. package/dist/cjs/lib/v3/tests/downloads.spec.js.map +7 -0
  135. package/dist/cjs/lib/v3/tests/frame-get-location-and-click.spec.js +53 -0
  136. package/dist/cjs/lib/v3/tests/frame-get-location-and-click.spec.js.map +7 -0
  137. package/dist/cjs/lib/v3/tests/iframe-ctx-addInitScript.spec.js +493 -0
  138. package/dist/cjs/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +7 -0
  139. package/dist/cjs/lib/v3/tests/keep-alive.child.js +92 -0
  140. package/dist/cjs/lib/v3/tests/keep-alive.child.js.map +7 -0
  141. package/dist/cjs/lib/v3/tests/keep-alive.helpers.js +568 -0
  142. package/dist/cjs/lib/v3/tests/keep-alive.helpers.js.map +7 -0
  143. package/dist/cjs/lib/v3/tests/keep-alive.spec.js +15 -0
  144. package/dist/cjs/lib/v3/tests/keep-alive.spec.js.map +7 -0
  145. package/dist/cjs/lib/v3/tests/keyboard.spec.js +296 -0
  146. package/dist/cjs/lib/v3/tests/keyboard.spec.js.map +7 -0
  147. package/dist/cjs/lib/v3/tests/locator-backend-node-id.spec.js +159 -0
  148. package/dist/cjs/lib/v3/tests/locator-backend-node-id.spec.js.map +7 -0
  149. package/dist/cjs/lib/v3/tests/locator-content-methods.spec.js +191 -0
  150. package/dist/cjs/lib/v3/tests/locator-content-methods.spec.js.map +7 -0
  151. package/dist/cjs/lib/v3/tests/locator-count-iframe.spec.js +108 -0
  152. package/dist/cjs/lib/v3/tests/locator-count-iframe.spec.js.map +7 -0
  153. package/dist/cjs/lib/v3/tests/locator-count.spec.js +71 -0
  154. package/dist/cjs/lib/v3/tests/locator-count.spec.js.map +7 -0
  155. package/dist/cjs/lib/v3/tests/locator-fill.spec.js +118 -0
  156. package/dist/cjs/lib/v3/tests/locator-fill.spec.js.map +7 -0
  157. package/dist/cjs/lib/v3/tests/locator-input-methods.spec.js +136 -0
  158. package/dist/cjs/lib/v3/tests/locator-input-methods.spec.js.map +7 -0
  159. package/dist/cjs/lib/v3/tests/locator-nth.spec.js +157 -0
  160. package/dist/cjs/lib/v3/tests/locator-nth.spec.js.map +7 -0
  161. package/dist/cjs/lib/v3/tests/locator-select-option.spec.js +242 -0
  162. package/dist/cjs/lib/v3/tests/locator-select-option.spec.js.map +7 -0
  163. package/dist/cjs/lib/v3/tests/logger-initialization.spec.js +547 -0
  164. package/dist/cjs/lib/v3/tests/logger-initialization.spec.js.map +7 -0
  165. package/dist/cjs/lib/v3/tests/multi-instance-logger.spec.js +269 -0
  166. package/dist/cjs/lib/v3/tests/multi-instance-logger.spec.js.map +7 -0
  167. package/dist/cjs/lib/v3/tests/nested-div.spec.js +23 -0
  168. package/dist/cjs/lib/v3/tests/nested-div.spec.js.map +7 -0
  169. package/dist/cjs/lib/v3/tests/page-addInitScript.spec.js +90 -0
  170. package/dist/cjs/lib/v3/tests/page-addInitScript.spec.js.map +7 -0
  171. package/dist/cjs/lib/v3/tests/page-console.spec.js +56 -0
  172. package/dist/cjs/lib/v3/tests/page-console.spec.js.map +7 -0
  173. package/dist/cjs/lib/v3/tests/page-drag-and-drop.spec.js +418 -0
  174. package/dist/cjs/lib/v3/tests/page-drag-and-drop.spec.js.map +7 -0
  175. package/dist/cjs/lib/v3/tests/page-goto-response.spec.js +35 -0
  176. package/dist/cjs/lib/v3/tests/page-goto-response.spec.js.map +7 -0
  177. package/dist/cjs/lib/v3/tests/page-hover.spec.js +167 -0
  178. package/dist/cjs/lib/v3/tests/page-hover.spec.js.map +7 -0
  179. package/dist/cjs/lib/v3/tests/page-screenshot.spec.js +295 -0
  180. package/dist/cjs/lib/v3/tests/page-screenshot.spec.js.map +7 -0
  181. package/dist/cjs/lib/v3/tests/page-scroll.spec.js +182 -0
  182. package/dist/cjs/lib/v3/tests/page-scroll.spec.js.map +7 -0
  183. package/dist/cjs/lib/v3/tests/page-send-cdp.spec.js +46 -0
  184. package/dist/cjs/lib/v3/tests/page-send-cdp.spec.js.map +7 -0
  185. package/dist/cjs/lib/v3/tests/perform-understudy-method.spec.js +98 -0
  186. package/dist/cjs/lib/v3/tests/perform-understudy-method.spec.js.map +7 -0
  187. package/dist/cjs/lib/v3/tests/setinputfiles.spec.js +148 -0
  188. package/dist/cjs/lib/v3/tests/setinputfiles.spec.js.map +7 -0
  189. package/dist/cjs/lib/v3/tests/shadow-iframe-oopif.spec.js +156 -0
  190. package/dist/cjs/lib/v3/tests/shadow-iframe-oopif.spec.js.map +7 -0
  191. package/dist/cjs/lib/v3/tests/shadow-iframe-spif.spec.js +156 -0
  192. package/dist/cjs/lib/v3/tests/shadow-iframe-spif.spec.js.map +7 -0
  193. package/dist/cjs/lib/v3/tests/testUtils.js +54 -0
  194. package/dist/cjs/lib/v3/tests/testUtils.js.map +7 -0
  195. package/dist/cjs/lib/v3/tests/text-selector-innermost.spec.js +100 -0
  196. package/dist/cjs/lib/v3/tests/text-selector-innermost.spec.js.map +7 -0
  197. package/dist/cjs/lib/v3/tests/timeouts.spec.js +32 -0
  198. package/dist/cjs/lib/v3/tests/timeouts.spec.js.map +7 -0
  199. package/dist/cjs/lib/v3/tests/user-data-dir.spec.js +65 -0
  200. package/dist/cjs/lib/v3/tests/user-data-dir.spec.js.map +7 -0
  201. package/dist/cjs/lib/v3/tests/v3.config.js +36 -0
  202. package/dist/cjs/lib/v3/tests/v3.config.js.map +7 -0
  203. package/dist/cjs/lib/v3/tests/v3.dynamic.config.js +67 -0
  204. package/dist/cjs/lib/v3/tests/v3.dynamic.config.js.map +7 -0
  205. package/dist/cjs/lib/v3/tests/v3.playwright.config.js +61 -0
  206. package/dist/cjs/lib/v3/tests/v3.playwright.config.js.map +7 -0
  207. package/dist/cjs/lib/v3/tests/wait-for-selector.spec.js +593 -0
  208. package/dist/cjs/lib/v3/tests/wait-for-selector.spec.js.map +7 -0
  209. package/dist/cjs/lib/v3/tests/wait-for-timeout.spec.js +97 -0
  210. package/dist/cjs/lib/v3/tests/wait-for-timeout.spec.js.map +7 -0
  211. package/dist/cjs/lib/v3/tests/xpath-for-location-deep.spec.js +77 -0
  212. package/dist/cjs/lib/v3/tests/xpath-for-location-deep.spec.js.map +7 -0
  213. package/dist/cjs/lib/v3/timeoutConfig.d.ts +2 -0
  214. package/dist/cjs/lib/v3/types/private/agent.d.ts +6 -0
  215. package/dist/cjs/lib/v3/types/private/api.d.ts +11 -0
  216. package/dist/cjs/lib/v3/types/private/cache.d.ts +128 -0
  217. package/dist/cjs/lib/v3/types/private/evaluator.d.ts +40 -0
  218. package/dist/cjs/lib/v3/types/private/handlers.d.ts +38 -0
  219. package/dist/cjs/lib/v3/types/private/index.d.ts +7 -0
  220. package/dist/cjs/lib/v3/types/private/internal.d.ts +39 -0
  221. package/dist/cjs/lib/v3/types/private/locator.d.ts +9 -0
  222. package/dist/cjs/lib/v3/types/private/network.d.ts +34 -0
  223. package/dist/cjs/lib/v3/types/private/shutdown.d.ts +19 -0
  224. package/dist/cjs/lib/v3/types/private/shutdownErrors.d.ts +12 -0
  225. package/dist/cjs/lib/v3/types/private/snapshot.d.ts +117 -0
  226. package/dist/cjs/lib/v3/types/public/agent.d.ts +595 -0
  227. package/dist/cjs/lib/v3/types/public/api.d.ts +1211 -0
  228. package/dist/cjs/lib/v3/types/public/apiErrors.d.ts +18 -0
  229. package/dist/cjs/lib/v3/types/public/index.d.ts +12 -0
  230. package/dist/cjs/lib/v3/types/public/locator.d.ts +9 -0
  231. package/dist/cjs/lib/v3/types/public/logs.d.ts +23 -0
  232. package/dist/cjs/lib/v3/types/public/methods.d.ts +56 -0
  233. package/dist/cjs/lib/v3/types/public/metrics.d.ts +27 -0
  234. package/dist/cjs/lib/v3/types/public/model.d.ts +65 -0
  235. package/dist/cjs/lib/v3/types/public/options.d.ts +70 -0
  236. package/dist/cjs/lib/v3/types/public/page.d.ts +18 -0
  237. package/dist/cjs/lib/v3/types/public/screenshotTypes.d.ts +25 -0
  238. package/dist/cjs/lib/v3/types/public/sdkErrors.d.ts +152 -0
  239. package/dist/cjs/lib/v3/understudy/a11y/snapshot/a11yTree.d.ts +15 -0
  240. package/dist/cjs/lib/v3/understudy/a11y/snapshot/activeElement.d.ts +8 -0
  241. package/dist/cjs/lib/v3/understudy/a11y/snapshot/capture.d.ts +77 -0
  242. package/dist/cjs/lib/v3/understudy/a11y/snapshot/coordinateResolver.d.ts +7 -0
  243. package/dist/cjs/lib/v3/understudy/a11y/snapshot/domTree.d.ts +46 -0
  244. package/dist/cjs/lib/v3/understudy/a11y/snapshot/focusSelectors.d.ts +24 -0
  245. package/dist/cjs/lib/v3/understudy/a11y/snapshot/index.d.ts +4 -0
  246. package/dist/cjs/lib/v3/understudy/a11y/snapshot/sessions.d.ts +16 -0
  247. package/dist/cjs/lib/v3/understudy/a11y/snapshot/treeFormatUtils.d.ts +28 -0
  248. package/dist/cjs/lib/v3/understudy/a11y/snapshot/xpathUtils.d.ts +26 -0
  249. package/dist/cjs/lib/v3/understudy/a11yInvocation.d.ts +8 -0
  250. package/dist/cjs/lib/v3/understudy/cdp.d.ts +69 -0
  251. package/dist/cjs/lib/v3/understudy/consoleMessage.d.ts +22 -0
  252. package/dist/cjs/lib/v3/understudy/context.d.ts +132 -0
  253. package/dist/cjs/lib/v3/understudy/deepLocator.d.ts +87 -0
  254. package/dist/cjs/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
  255. package/dist/cjs/lib/v3/understudy/fileUploadUtils.d.ts +13 -0
  256. package/dist/cjs/lib/v3/understudy/frame.d.ts +69 -0
  257. package/dist/cjs/lib/v3/understudy/frameLocator.d.ts +50 -0
  258. package/dist/cjs/lib/v3/understudy/frameRegistry.d.ts +101 -0
  259. package/dist/cjs/lib/v3/understudy/initScripts.d.ts +2 -0
  260. package/dist/cjs/lib/v3/understudy/lifecycleWatcher.d.ts +64 -0
  261. package/dist/cjs/lib/v3/understudy/locator.d.ts +194 -0
  262. package/dist/cjs/lib/v3/understudy/locatorInvocation.d.ts +8 -0
  263. package/dist/cjs/lib/v3/understudy/navigationResponseTracker.d.ts +84 -0
  264. package/dist/cjs/lib/v3/understudy/networkManager.d.ts +53 -0
  265. package/dist/cjs/lib/v3/understudy/page.d.ts +354 -0
  266. package/dist/cjs/lib/v3/understudy/piercer.d.ts +4 -0
  267. package/dist/cjs/lib/v3/understudy/response.d.ts +137 -0
  268. package/dist/cjs/lib/v3/understudy/screenshotUtils.d.ts +16 -0
  269. package/dist/cjs/lib/v3/understudy/selectorResolver.d.ts +38 -0
  270. package/dist/cjs/lib/v3/v3.d.ts +191 -0
  271. package/dist/cjs/lib/v3/zodCompat.d.ts +12 -0
  272. package/dist/cjs/lib/v3Evaluator.d.ts +19 -0
  273. package/dist/cjs/lib/version.d.ts +5 -0
  274. package/dist/cjs/package.json +3 -0
  275. package/dist/cjs/tests/browserbase-session-accessors.test.js +101 -0
  276. package/dist/cjs/tests/browserbase-session-accessors.test.js.map +7 -0
  277. package/dist/cjs/tests/cache-llm-resolution.test.js +187 -0
  278. package/dist/cjs/tests/cache-llm-resolution.test.js.map +7 -0
  279. package/dist/cjs/tests/helpers/mockCDPSession.js +50 -0
  280. package/dist/cjs/tests/helpers/mockCDPSession.js.map +7 -0
  281. package/dist/cjs/tests/llm-provider.test.js +57 -0
  282. package/dist/cjs/tests/llm-provider.test.js.map +7 -0
  283. package/dist/cjs/tests/model-deprecation.test.js +132 -0
  284. package/dist/cjs/tests/model-deprecation.test.js.map +7 -0
  285. package/dist/cjs/tests/page-snapshot.test.js +58 -0
  286. package/dist/cjs/tests/page-snapshot.test.js.map +7 -0
  287. package/dist/cjs/tests/public-api/export-surface.test.js +76 -0
  288. package/dist/cjs/tests/public-api/export-surface.test.js.map +7 -0
  289. package/dist/cjs/tests/public-api/llm-and-agents.test.js +150 -0
  290. package/dist/cjs/tests/public-api/llm-and-agents.test.js.map +7 -0
  291. package/dist/cjs/tests/public-api/public-error-types.test.js +104 -0
  292. package/dist/cjs/tests/public-api/public-error-types.test.js.map +7 -0
  293. package/dist/cjs/tests/public-api/public-types.test.js +74 -0
  294. package/dist/cjs/tests/public-api/public-types.test.js.map +7 -0
  295. package/dist/cjs/tests/public-api/runtime-utils.test.js +53 -0
  296. package/dist/cjs/tests/public-api/runtime-utils.test.js.map +7 -0
  297. package/dist/cjs/tests/public-api/schema-utils.test.js +100 -0
  298. package/dist/cjs/tests/public-api/schema-utils.test.js.map +7 -0
  299. package/dist/cjs/tests/public-api/timeout-error-types.test.js +103 -0
  300. package/dist/cjs/tests/public-api/timeout-error-types.test.js.map +7 -0
  301. package/dist/cjs/tests/public-api/tool-type-export.test.js +47 -0
  302. package/dist/cjs/tests/public-api/tool-type-export.test.js.map +7 -0
  303. package/dist/cjs/tests/public-api/v3-core.test.js +104 -0
  304. package/dist/cjs/tests/public-api/v3-core.test.js.map +7 -0
  305. package/dist/cjs/tests/safety-confirmation.test.js +134 -0
  306. package/dist/cjs/tests/safety-confirmation.test.js.map +7 -0
  307. package/dist/cjs/tests/snapshot-a11y-resolvers.test.js +370 -0
  308. package/dist/cjs/tests/snapshot-a11y-resolvers.test.js.map +7 -0
  309. package/dist/cjs/tests/snapshot-a11y-tree-utils.test.js +294 -0
  310. package/dist/cjs/tests/snapshot-a11y-tree-utils.test.js.map +7 -0
  311. package/dist/cjs/tests/snapshot-capture-orchestration.test.js +403 -0
  312. package/dist/cjs/tests/snapshot-capture-orchestration.test.js.map +7 -0
  313. package/dist/cjs/tests/snapshot-cbor.test.js +197 -0
  314. package/dist/cjs/tests/snapshot-cbor.test.js.map +7 -0
  315. package/dist/cjs/tests/snapshot-dom-session-builders.test.js +246 -0
  316. package/dist/cjs/tests/snapshot-dom-session-builders.test.js.map +7 -0
  317. package/dist/cjs/tests/snapshot-dom-tree-utils.test.js +104 -0
  318. package/dist/cjs/tests/snapshot-dom-tree-utils.test.js.map +7 -0
  319. package/dist/cjs/tests/snapshot-focus-selectors-utils.test.js +45 -0
  320. package/dist/cjs/tests/snapshot-focus-selectors-utils.test.js.map +7 -0
  321. package/dist/cjs/tests/snapshot-frame-merge.test.js +388 -0
  322. package/dist/cjs/tests/snapshot-frame-merge.test.js.map +7 -0
  323. package/dist/cjs/tests/snapshot-tree-format-utils.test.js +106 -0
  324. package/dist/cjs/tests/snapshot-tree-format-utils.test.js.map +7 -0
  325. package/dist/cjs/tests/snapshot-xpath-utils.test.js +74 -0
  326. package/dist/cjs/tests/snapshot-xpath-utils.test.js.map +7 -0
  327. package/dist/cjs/tests/timeout-handlers.test.js +864 -0
  328. package/dist/cjs/tests/timeout-handlers.test.js.map +7 -0
  329. package/dist/cjs/tests/xpath-parser.test.js +314 -0
  330. package/dist/cjs/tests/xpath-parser.test.js.map +7 -0
  331. package/dist/cjs/tests/xpath-resolver.test.js +70 -0
  332. package/dist/cjs/tests/xpath-resolver.test.js.map +7 -0
  333. package/dist/cjs/tests/zod-enum-compatibility.test.js +119 -0
  334. package/dist/cjs/tests/zod-enum-compatibility.test.js.map +7 -0
  335. package/dist/esm/lib/modelUtils.d.ts +0 -3
  336. package/dist/esm/lib/modelUtils.js +2 -7
  337. package/dist/esm/lib/modelUtils.js.map +1 -1
  338. package/dist/esm/lib/v3/agent/tools/act.d.ts +1 -2
  339. package/dist/esm/lib/v3/agent/tools/act.js.map +1 -1
  340. package/dist/esm/lib/v3/agent/tools/extract.d.ts +1 -2
  341. package/dist/esm/lib/v3/agent/tools/extract.js.map +1 -1
  342. package/dist/esm/lib/v3/agent/tools/fillform.d.ts +1 -2
  343. package/dist/esm/lib/v3/agent/tools/fillform.js.map +1 -1
  344. package/dist/esm/lib/v3/agent/tools/index.d.ts +2 -2
  345. package/dist/esm/lib/v3/agent/tools/index.js.map +1 -1
  346. package/dist/esm/lib/v3/cli.d.ts +2 -0
  347. package/dist/esm/lib/v3/cli.js +10 -0
  348. package/dist/esm/lib/v3/cli.js.map +1 -0
  349. package/dist/esm/lib/v3/dom/build/rerender-index.d.ts +0 -0
  350. package/dist/esm/lib/v3/dom/build/rerender-index.js.map +1 -0
  351. package/dist/esm/lib/v3/dom/build/v3-index.d.ts +0 -0
  352. package/dist/esm/lib/v3/dom/build/v3-index.js.map +1 -0
  353. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +2 -2
  354. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  355. package/dist/esm/lib/v3/index.d.ts +1 -0
  356. package/dist/esm/lib/v3/index.js +1 -0
  357. package/dist/esm/lib/v3/index.js.map +1 -1
  358. package/dist/esm/lib/v3/shutdown/supervisor.d.ts +7 -5
  359. package/dist/esm/lib/v3/shutdown/supervisor.js +62 -52
  360. package/dist/esm/lib/v3/shutdown/supervisor.js.map +1 -1
  361. package/dist/esm/lib/v3/shutdown/supervisorClient.js +48 -52
  362. package/dist/esm/lib/v3/shutdown/supervisorClient.js.map +1 -1
  363. package/dist/esm/lib/v3/tests/click-count.spec.js +47 -12
  364. package/dist/esm/lib/v3/tests/click-count.spec.js.map +2 -2
  365. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js +67 -21
  366. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +2 -2
  367. package/dist/esm/lib/v3/tests/v3.playwright.config.js +3 -60
  368. package/dist/esm/lib/v3/tests/v3.playwright.config.js.map +2 -2
  369. package/dist/esm/lib/v3/types/private/shutdown.d.ts +1 -13
  370. package/dist/esm/lib/v3/types/private/shutdown.js.map +1 -1
  371. package/dist/esm/lib/v3/understudy/context.js +10 -1
  372. package/dist/esm/lib/v3/understudy/context.js.map +1 -1
  373. package/dist/esm/lib/v3/understudy/locator.js +2 -2
  374. package/dist/esm/lib/v3/understudy/locator.js.map +1 -1
  375. package/dist/esm/lib/v3/understudy/page.js +2 -1
  376. package/dist/esm/lib/v3/understudy/page.js.map +1 -1
  377. package/dist/esm/lib/v3/v3.js +10 -13
  378. package/dist/esm/lib/v3/v3.js.map +1 -1
  379. package/dist/esm/tests/public-api/export-surface.test.js +1 -0
  380. package/dist/esm/tests/public-api/export-surface.test.js.map +2 -2
  381. package/package.json +13 -9
  382. package/dist/esm/lib/v3/tests/envReporter.js +0 -57
  383. package/dist/esm/lib/v3/tests/envReporter.js.map +0 -7
  384. package/dist/esm/tests/agent-execution-model.test.js +0 -139
  385. package/dist/esm/tests/agent-execution-model.test.js.map +0 -7
  386. package/dist/esm/tests/model-utils.test.js +0 -43
  387. package/dist/esm/tests/model-utils.test.js.map +0 -7
@@ -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,5 @@
1
+ import type { V3 } from "../../v3.js";
2
+ export declare const ariaTreeTool: (v3: V3) => import("ai").Tool<Record<string, never>, {
3
+ content: string;
4
+ pageUrl: string;
5
+ }>;
@@ -0,0 +1,6 @@
1
+ import type { V3 } from "../../v3.js";
2
+ import type { ClickToolResult } from "../../types/public/agent.js";
3
+ export declare const clickTool: (v3: V3, provider?: string) => import("ai").Tool<{
4
+ describe: string;
5
+ coordinates: number[];
6
+ }, ClickToolResult>;
@@ -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>;