@browserbasehq/orca 3.2.0-preview.3 → 3.2.0-preview.5

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 (313) hide show
  1. package/dist/cjs/lib/inference.d.ts +3 -1
  2. package/dist/cjs/lib/inference.js +2 -2
  3. package/dist/cjs/lib/inference.js.map +1 -1
  4. package/dist/cjs/lib/prompt.d.ts +1 -1
  5. package/dist/cjs/lib/prompt.js +11 -2
  6. package/dist/cjs/lib/prompt.js.map +1 -1
  7. package/dist/cjs/lib/utils.d.ts +1 -0
  8. package/dist/cjs/lib/utils.js +4 -0
  9. package/dist/cjs/lib/utils.js.map +1 -1
  10. package/dist/cjs/lib/v3/agent/AgentClient.d.ts +8 -0
  11. package/dist/cjs/lib/v3/agent/AgentClient.js +13 -0
  12. package/dist/cjs/lib/v3/agent/AgentClient.js.map +1 -1
  13. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js +6 -7
  14. package/dist/cjs/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
  15. package/dist/cjs/lib/v3/agent/GoogleCUAClient.js +6 -7
  16. package/dist/cjs/lib/v3/agent/GoogleCUAClient.js.map +1 -1
  17. package/dist/cjs/lib/v3/agent/MicrosoftCUAClient.js +1 -0
  18. package/dist/cjs/lib/v3/agent/MicrosoftCUAClient.js.map +1 -1
  19. package/dist/cjs/lib/v3/agent/OpenAICUAClient.d.ts +4 -4
  20. package/dist/cjs/lib/v3/agent/OpenAICUAClient.js +67 -8
  21. package/dist/cjs/lib/v3/agent/OpenAICUAClient.js.map +1 -1
  22. package/dist/cjs/lib/v3/agent/prompts/agentSystemPrompt.d.ts +2 -2
  23. package/dist/cjs/lib/v3/agent/prompts/agentSystemPrompt.js +10 -11
  24. package/dist/cjs/lib/v3/agent/prompts/agentSystemPrompt.js.map +1 -1
  25. package/dist/cjs/lib/v3/agent/tools/act.js +1 -10
  26. package/dist/cjs/lib/v3/agent/tools/act.js.map +1 -1
  27. package/dist/cjs/lib/v3/agent/tools/ariaTree.js +1 -12
  28. package/dist/cjs/lib/v3/agent/tools/ariaTree.js.map +1 -1
  29. package/dist/cjs/lib/v3/agent/tools/braveSearch.js.map +1 -1
  30. package/dist/cjs/lib/v3/agent/tools/browserbaseSearch.js.map +1 -1
  31. package/dist/cjs/lib/v3/agent/tools/click.js.map +1 -1
  32. package/dist/cjs/lib/v3/agent/tools/clickAndHold.js.map +1 -1
  33. package/dist/cjs/lib/v3/agent/tools/dragAndDrop.js.map +1 -1
  34. package/dist/cjs/lib/v3/agent/tools/extract.js +1 -10
  35. package/dist/cjs/lib/v3/agent/tools/extract.js.map +1 -1
  36. package/dist/cjs/lib/v3/agent/tools/fillFormVision.js.map +1 -1
  37. package/dist/cjs/lib/v3/agent/tools/fillform.d.ts +0 -1
  38. package/dist/cjs/lib/v3/agent/tools/fillform.js +8 -20
  39. package/dist/cjs/lib/v3/agent/tools/fillform.js.map +1 -1
  40. package/dist/cjs/lib/v3/agent/tools/index.d.ts +2 -2
  41. package/dist/cjs/lib/v3/agent/tools/index.js +53 -5
  42. package/dist/cjs/lib/v3/agent/tools/index.js.map +1 -1
  43. package/dist/cjs/lib/v3/agent/tools/keys.d.ts +1 -1
  44. package/dist/cjs/lib/v3/agent/tools/keys.js.map +1 -1
  45. package/dist/cjs/lib/v3/agent/tools/type.js.map +1 -1
  46. package/dist/cjs/lib/v3/agent/utils/captchaSolver.d.ts +76 -0
  47. package/dist/cjs/lib/v3/agent/utils/captchaSolver.js +175 -0
  48. package/dist/cjs/lib/v3/agent/utils/captchaSolver.js.map +1 -0
  49. package/dist/cjs/lib/v3/agent/utils/variables.d.ts +5 -0
  50. package/dist/cjs/lib/v3/agent/utils/variables.js +9 -0
  51. package/dist/cjs/lib/v3/agent/utils/variables.js.map +1 -1
  52. package/dist/cjs/lib/v3/flowlogger/EventEmitter.d.ts +7 -0
  53. package/dist/cjs/lib/v3/flowlogger/EventEmitter.js +30 -0
  54. package/dist/cjs/lib/v3/flowlogger/EventEmitter.js.map +1 -0
  55. package/dist/cjs/lib/v3/flowlogger/EventSink.d.ts +44 -0
  56. package/dist/cjs/lib/v3/flowlogger/EventSink.js +217 -0
  57. package/dist/cjs/lib/v3/flowlogger/EventSink.js.map +1 -0
  58. package/dist/cjs/lib/v3/flowlogger/EventStore.d.ts +26 -0
  59. package/dist/cjs/lib/v3/flowlogger/EventStore.js +135 -0
  60. package/dist/cjs/lib/v3/flowlogger/EventStore.js.map +1 -0
  61. package/dist/cjs/lib/v3/flowlogger/FlowLogger.d.ts +99 -0
  62. package/dist/cjs/lib/v3/flowlogger/FlowLogger.js +591 -0
  63. package/dist/cjs/lib/v3/flowlogger/FlowLogger.js.map +1 -0
  64. package/dist/cjs/lib/v3/flowlogger/prettify.d.ts +6 -0
  65. package/dist/cjs/lib/v3/flowlogger/prettify.js +395 -0
  66. package/dist/cjs/lib/v3/flowlogger/prettify.js.map +1 -0
  67. package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.js +43 -57
  68. package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -1
  69. package/dist/cjs/lib/v3/handlers/observeHandler.js +2 -1
  70. package/dist/cjs/lib/v3/handlers/observeHandler.js.map +1 -1
  71. package/dist/cjs/lib/v3/handlers/v3AgentHandler.d.ts +2 -5
  72. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js +112 -78
  73. package/dist/cjs/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  74. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.d.ts +5 -0
  75. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js +134 -14
  76. package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
  77. package/dist/cjs/lib/v3/llm/aisdk.js +11 -17
  78. package/dist/cjs/lib/v3/llm/aisdk.js.map +1 -1
  79. package/dist/cjs/lib/v3/types/private/cache.d.ts +0 -1
  80. package/dist/cjs/lib/v3/types/private/cache.js.map +1 -1
  81. package/dist/cjs/lib/v3/types/private/handlers.d.ts +1 -0
  82. package/dist/cjs/lib/v3/types/private/handlers.js.map +1 -1
  83. package/dist/cjs/lib/v3/types/public/api.d.ts +24 -7
  84. package/dist/cjs/lib/v3/types/public/api.js +41 -14
  85. package/dist/cjs/lib/v3/types/public/api.js.map +1 -1
  86. package/dist/cjs/lib/v3/types/public/methods.d.ts +1 -0
  87. package/dist/cjs/lib/v3/types/public/methods.js.map +1 -1
  88. package/dist/cjs/lib/v3/types/public/options.d.ts +7 -0
  89. package/dist/cjs/lib/v3/types/public/options.js.map +1 -1
  90. package/dist/cjs/lib/v3/types/public/variables.d.ts +7 -0
  91. package/dist/cjs/lib/v3/types/public/variables.js +22 -0
  92. package/dist/cjs/lib/v3/types/public/variables.js.map +1 -0
  93. package/dist/cjs/lib/v3/understudy/cdp.d.ts +3 -12
  94. package/dist/cjs/lib/v3/understudy/cdp.js +134 -21
  95. package/dist/cjs/lib/v3/understudy/cdp.js.map +1 -1
  96. package/dist/cjs/lib/v3/understudy/page.js +28 -18
  97. package/dist/cjs/lib/v3/understudy/page.js.map +1 -1
  98. package/dist/cjs/lib/v3/v3.d.ts +12 -2
  99. package/dist/cjs/lib/v3/v3.js +194 -160
  100. package/dist/cjs/lib/v3/v3.js.map +1 -1
  101. package/dist/cjs/lib/version.d.ts +1 -1
  102. package/dist/cjs/lib/version.js +1 -1
  103. package/dist/cjs/lib/version.js.map +1 -1
  104. package/dist/cjs/tests/integration/agent-captcha-autosolve.spec.d.ts +1 -0
  105. package/dist/cjs/tests/integration/agent-captcha-autosolve.spec.js +56 -0
  106. package/dist/cjs/tests/integration/agent-captcha-autosolve.spec.js.map +1 -0
  107. package/dist/cjs/tests/integration/agent-hybrid-mode.spec.js +6 -6
  108. package/dist/cjs/tests/integration/agent-hybrid-mode.spec.js.map +1 -1
  109. package/dist/cjs/tests/integration/flowLogger.spec.d.ts +1 -0
  110. package/dist/cjs/tests/integration/flowLogger.spec.js +714 -0
  111. package/dist/cjs/tests/integration/flowLogger.spec.js.map +1 -0
  112. package/dist/cjs/tests/integration/testUtils.d.ts +33 -0
  113. package/dist/cjs/tests/integration/testUtils.js +144 -0
  114. package/dist/cjs/tests/integration/testUtils.js.map +1 -1
  115. package/dist/cjs/tests/integration/timeouts.spec.js +113 -3
  116. package/dist/cjs/tests/integration/timeouts.spec.js.map +1 -1
  117. package/dist/cjs/tests/unit/agent-captcha-hooks.test.d.ts +1 -0
  118. package/dist/cjs/tests/unit/agent-captcha-hooks.test.js +285 -0
  119. package/dist/cjs/tests/unit/agent-captcha-hooks.test.js.map +1 -0
  120. package/dist/cjs/tests/unit/agent-execution-model.test.js +25 -3
  121. package/dist/cjs/tests/unit/agent-execution-model.test.js.map +1 -1
  122. package/dist/cjs/tests/unit/agent-system-prompt-variables.test.d.ts +1 -0
  123. package/dist/cjs/tests/unit/agent-system-prompt-variables.test.js +23 -0
  124. package/dist/cjs/tests/unit/agent-system-prompt-variables.test.js.map +1 -0
  125. package/dist/cjs/tests/unit/api-client-observe-variables.test.d.ts +1 -0
  126. package/dist/cjs/tests/unit/api-client-observe-variables.test.js +86 -0
  127. package/dist/cjs/tests/unit/api-client-observe-variables.test.js.map +1 -0
  128. package/dist/cjs/tests/unit/api-variables-schema.test.d.ts +1 -0
  129. package/dist/cjs/tests/unit/api-variables-schema.test.js +37 -0
  130. package/dist/cjs/tests/unit/api-variables-schema.test.js.map +1 -0
  131. package/dist/cjs/tests/unit/browserbase-session-accessors.test.js +20 -0
  132. package/dist/cjs/tests/unit/browserbase-session-accessors.test.js.map +1 -1
  133. package/dist/cjs/tests/unit/captcha-solver.test.d.ts +1 -0
  134. package/dist/cjs/tests/unit/captcha-solver.test.js +154 -0
  135. package/dist/cjs/tests/unit/captcha-solver.test.js.map +1 -0
  136. package/dist/cjs/tests/unit/flowlogger-capturing-cdp.test.d.ts +1 -0
  137. package/dist/cjs/tests/unit/flowlogger-capturing-cdp.test.js +95 -0
  138. package/dist/cjs/tests/unit/flowlogger-capturing-cdp.test.js.map +1 -0
  139. package/dist/cjs/tests/unit/flowlogger-capturing-llm.test.d.ts +1 -0
  140. package/dist/cjs/tests/unit/flowlogger-capturing-llm.test.js +43 -0
  141. package/dist/cjs/tests/unit/flowlogger-capturing-llm.test.js.map +1 -0
  142. package/dist/cjs/tests/unit/flowlogger-eventstore.test.d.ts +1 -0
  143. package/dist/cjs/tests/unit/flowlogger-eventstore.test.js +250 -0
  144. package/dist/cjs/tests/unit/flowlogger-eventstore.test.js.map +1 -0
  145. package/dist/cjs/tests/unit/openai-cua-client.test.d.ts +1 -0
  146. package/dist/cjs/tests/unit/openai-cua-client.test.js +71 -0
  147. package/dist/cjs/tests/unit/openai-cua-client.test.js.map +1 -0
  148. package/dist/cjs/tests/unit/prompt-observe-variables.test.d.ts +1 -0
  149. package/dist/cjs/tests/unit/prompt-observe-variables.test.js +19 -0
  150. package/dist/cjs/tests/unit/prompt-observe-variables.test.js.map +1 -0
  151. package/dist/cjs/tests/unit/public-api/public-types.test.js.map +1 -1
  152. package/dist/cjs/tests/unit/timeout-handlers.test.js +50 -0
  153. package/dist/cjs/tests/unit/timeout-handlers.test.js.map +1 -1
  154. package/dist/esm/lib/inference.d.ts +3 -1
  155. package/dist/esm/lib/inference.js +2 -2
  156. package/dist/esm/lib/inference.js.map +1 -1
  157. package/dist/esm/lib/prompt.d.ts +1 -1
  158. package/dist/esm/lib/prompt.js +11 -2
  159. package/dist/esm/lib/prompt.js.map +1 -1
  160. package/dist/esm/lib/utils.d.ts +1 -0
  161. package/dist/esm/lib/utils.js +3 -0
  162. package/dist/esm/lib/utils.js.map +1 -1
  163. package/dist/esm/lib/v3/agent/AgentClient.d.ts +8 -0
  164. package/dist/esm/lib/v3/agent/AgentClient.js +13 -0
  165. package/dist/esm/lib/v3/agent/AgentClient.js.map +1 -1
  166. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +6 -7
  167. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -1
  168. package/dist/esm/lib/v3/agent/GoogleCUAClient.js +6 -7
  169. package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -1
  170. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js +1 -0
  171. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js.map +1 -1
  172. package/dist/esm/lib/v3/agent/OpenAICUAClient.d.ts +4 -4
  173. package/dist/esm/lib/v3/agent/OpenAICUAClient.js +67 -8
  174. package/dist/esm/lib/v3/agent/OpenAICUAClient.js.map +1 -1
  175. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.d.ts +2 -2
  176. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js +10 -11
  177. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js.map +1 -1
  178. package/dist/esm/lib/v3/agent/tools/act.js +1 -10
  179. package/dist/esm/lib/v3/agent/tools/act.js.map +1 -1
  180. package/dist/esm/lib/v3/agent/tools/ariaTree.js +1 -12
  181. package/dist/esm/lib/v3/agent/tools/ariaTree.js.map +1 -1
  182. package/dist/esm/lib/v3/agent/tools/braveSearch.js.map +1 -1
  183. package/dist/esm/lib/v3/agent/tools/browserbaseSearch.js.map +1 -1
  184. package/dist/esm/lib/v3/agent/tools/click.js.map +1 -1
  185. package/dist/esm/lib/v3/agent/tools/clickAndHold.js.map +1 -1
  186. package/dist/esm/lib/v3/agent/tools/dragAndDrop.js.map +1 -1
  187. package/dist/esm/lib/v3/agent/tools/extract.js +1 -10
  188. package/dist/esm/lib/v3/agent/tools/extract.js.map +1 -1
  189. package/dist/esm/lib/v3/agent/tools/fillFormVision.js.map +1 -1
  190. package/dist/esm/lib/v3/agent/tools/fillform.d.ts +0 -1
  191. package/dist/esm/lib/v3/agent/tools/fillform.js +8 -20
  192. package/dist/esm/lib/v3/agent/tools/fillform.js.map +1 -1
  193. package/dist/esm/lib/v3/agent/tools/index.d.ts +2 -2
  194. package/dist/esm/lib/v3/agent/tools/index.js +53 -5
  195. package/dist/esm/lib/v3/agent/tools/index.js.map +1 -1
  196. package/dist/esm/lib/v3/agent/tools/keys.d.ts +1 -1
  197. package/dist/esm/lib/v3/agent/tools/keys.js.map +1 -1
  198. package/dist/esm/lib/v3/agent/tools/type.js.map +1 -1
  199. package/dist/esm/lib/v3/agent/utils/captchaSolver.d.ts +76 -0
  200. package/dist/esm/lib/v3/agent/utils/captchaSolver.js +171 -0
  201. package/dist/esm/lib/v3/agent/utils/captchaSolver.js.map +1 -0
  202. package/dist/esm/lib/v3/agent/utils/variables.d.ts +5 -0
  203. package/dist/esm/lib/v3/agent/utils/variables.js +8 -0
  204. package/dist/esm/lib/v3/agent/utils/variables.js.map +1 -1
  205. package/dist/esm/lib/v3/flowlogger/EventEmitter.d.ts +7 -0
  206. package/dist/esm/lib/v3/flowlogger/EventEmitter.js +26 -0
  207. package/dist/esm/lib/v3/flowlogger/EventEmitter.js.map +1 -0
  208. package/dist/esm/lib/v3/flowlogger/EventSink.d.ts +44 -0
  209. package/dist/esm/lib/v3/flowlogger/EventSink.js +206 -0
  210. package/dist/esm/lib/v3/flowlogger/EventSink.js.map +1 -0
  211. package/dist/esm/lib/v3/flowlogger/EventStore.d.ts +26 -0
  212. package/dist/esm/lib/v3/flowlogger/EventStore.js +127 -0
  213. package/dist/esm/lib/v3/flowlogger/EventStore.js.map +1 -0
  214. package/dist/esm/lib/v3/flowlogger/FlowLogger.d.ts +99 -0
  215. package/dist/esm/lib/v3/flowlogger/FlowLogger.js +583 -0
  216. package/dist/esm/lib/v3/flowlogger/FlowLogger.js.map +1 -0
  217. package/dist/esm/lib/v3/flowlogger/prettify.d.ts +6 -0
  218. package/dist/esm/lib/v3/flowlogger/prettify.js +389 -0
  219. package/dist/esm/lib/v3/flowlogger/prettify.js.map +1 -0
  220. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +43 -57
  221. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -1
  222. package/dist/esm/lib/v3/handlers/observeHandler.js +2 -1
  223. package/dist/esm/lib/v3/handlers/observeHandler.js.map +1 -1
  224. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +2 -5
  225. package/dist/esm/lib/v3/handlers/v3AgentHandler.js +112 -78
  226. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
  227. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.d.ts +5 -0
  228. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +134 -14
  229. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
  230. package/dist/esm/lib/v3/llm/aisdk.js +11 -17
  231. package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
  232. package/dist/esm/lib/v3/types/private/cache.d.ts +0 -1
  233. package/dist/esm/lib/v3/types/private/cache.js.map +1 -1
  234. package/dist/esm/lib/v3/types/private/handlers.d.ts +1 -0
  235. package/dist/esm/lib/v3/types/private/handlers.js.map +1 -1
  236. package/dist/esm/lib/v3/types/public/api.d.ts +24 -7
  237. package/dist/esm/lib/v3/types/public/api.js +36 -12
  238. package/dist/esm/lib/v3/types/public/api.js.map +1 -1
  239. package/dist/esm/lib/v3/types/public/methods.d.ts +1 -0
  240. package/dist/esm/lib/v3/types/public/methods.js.map +1 -1
  241. package/dist/esm/lib/v3/types/public/options.d.ts +7 -0
  242. package/dist/esm/lib/v3/types/public/options.js.map +1 -1
  243. package/dist/esm/lib/v3/types/public/variables.d.ts +7 -0
  244. package/dist/esm/lib/v3/types/public/variables.js +19 -0
  245. package/dist/esm/lib/v3/types/public/variables.js.map +1 -0
  246. package/dist/esm/lib/v3/understudy/cdp.d.ts +3 -12
  247. package/dist/esm/lib/v3/understudy/cdp.js +134 -21
  248. package/dist/esm/lib/v3/understudy/cdp.js.map +1 -1
  249. package/dist/esm/lib/v3/understudy/page.js +28 -18
  250. package/dist/esm/lib/v3/understudy/page.js.map +1 -1
  251. package/dist/esm/lib/v3/v3.d.ts +12 -2
  252. package/dist/esm/lib/v3/v3.js +194 -160
  253. package/dist/esm/lib/v3/v3.js.map +1 -1
  254. package/dist/esm/lib/version.d.ts +1 -1
  255. package/dist/esm/lib/version.js +1 -1
  256. package/dist/esm/lib/version.js.map +1 -1
  257. package/dist/esm/tests/integration/agent-captcha-autosolve.spec.d.ts +1 -0
  258. package/dist/esm/tests/integration/agent-captcha-autosolve.spec.js +54 -0
  259. package/dist/esm/tests/integration/agent-captcha-autosolve.spec.js.map +1 -0
  260. package/dist/esm/tests/integration/agent-hybrid-mode.spec.js +6 -6
  261. package/dist/esm/tests/integration/agent-hybrid-mode.spec.js.map +1 -1
  262. package/dist/esm/tests/integration/flowLogger.spec.d.ts +1 -0
  263. package/dist/esm/tests/integration/flowLogger.spec.js +712 -0
  264. package/dist/esm/tests/integration/flowLogger.spec.js.map +1 -0
  265. package/dist/esm/tests/integration/testUtils.d.ts +33 -0
  266. package/dist/esm/tests/integration/testUtils.js +138 -0
  267. package/dist/esm/tests/integration/testUtils.js.map +1 -1
  268. package/dist/esm/tests/integration/timeouts.spec.js +113 -3
  269. package/dist/esm/tests/integration/timeouts.spec.js.map +1 -1
  270. package/dist/esm/tests/unit/agent-captcha-hooks.test.d.ts +1 -0
  271. package/dist/esm/tests/unit/agent-captcha-hooks.test.js +283 -0
  272. package/dist/esm/tests/unit/agent-captcha-hooks.test.js.map +1 -0
  273. package/dist/esm/tests/unit/agent-execution-model.test.js +25 -3
  274. package/dist/esm/tests/unit/agent-execution-model.test.js.map +1 -1
  275. package/dist/esm/tests/unit/agent-system-prompt-variables.test.d.ts +1 -0
  276. package/dist/esm/tests/unit/agent-system-prompt-variables.test.js +21 -0
  277. package/dist/esm/tests/unit/agent-system-prompt-variables.test.js.map +1 -0
  278. package/dist/esm/tests/unit/api-client-observe-variables.test.d.ts +1 -0
  279. package/dist/esm/tests/unit/api-client-observe-variables.test.js +84 -0
  280. package/dist/esm/tests/unit/api-client-observe-variables.test.js.map +1 -0
  281. package/dist/esm/tests/unit/api-variables-schema.test.d.ts +1 -0
  282. package/dist/esm/tests/unit/api-variables-schema.test.js +35 -0
  283. package/dist/esm/tests/unit/api-variables-schema.test.js.map +1 -0
  284. package/dist/esm/tests/unit/browserbase-session-accessors.test.js +20 -0
  285. package/dist/esm/tests/unit/browserbase-session-accessors.test.js.map +1 -1
  286. package/dist/esm/tests/unit/captcha-solver.test.d.ts +1 -0
  287. package/dist/esm/tests/unit/captcha-solver.test.js +152 -0
  288. package/dist/esm/tests/unit/captcha-solver.test.js.map +1 -0
  289. package/dist/esm/tests/unit/flowlogger-capturing-cdp.test.d.ts +1 -0
  290. package/dist/esm/tests/unit/flowlogger-capturing-cdp.test.js +93 -0
  291. package/dist/esm/tests/unit/flowlogger-capturing-cdp.test.js.map +1 -0
  292. package/dist/esm/tests/unit/flowlogger-capturing-llm.test.d.ts +1 -0
  293. package/dist/esm/tests/unit/flowlogger-capturing-llm.test.js +41 -0
  294. package/dist/esm/tests/unit/flowlogger-capturing-llm.test.js.map +1 -0
  295. package/dist/esm/tests/unit/flowlogger-eventstore.test.d.ts +1 -0
  296. package/dist/esm/tests/unit/flowlogger-eventstore.test.js +248 -0
  297. package/dist/esm/tests/unit/flowlogger-eventstore.test.js.map +1 -0
  298. package/dist/esm/tests/unit/openai-cua-client.test.d.ts +1 -0
  299. package/dist/esm/tests/unit/openai-cua-client.test.js +69 -0
  300. package/dist/esm/tests/unit/openai-cua-client.test.js.map +1 -0
  301. package/dist/esm/tests/unit/prompt-observe-variables.test.d.ts +1 -0
  302. package/dist/esm/tests/unit/prompt-observe-variables.test.js +17 -0
  303. package/dist/esm/tests/unit/prompt-observe-variables.test.js.map +1 -0
  304. package/dist/esm/tests/unit/public-api/public-types.test.js.map +1 -1
  305. package/dist/esm/tests/unit/timeout-handlers.test.js +50 -0
  306. package/dist/esm/tests/unit/timeout-handlers.test.js.map +1 -1
  307. package/package.json +4 -2
  308. package/dist/cjs/lib/v3/flowLogger.d.ts +0 -139
  309. package/dist/cjs/lib/v3/flowLogger.js +0 -881
  310. package/dist/cjs/lib/v3/flowLogger.js.map +0 -1
  311. package/dist/esm/lib/v3/flowLogger.d.ts +0 -139
  312. package/dist/esm/lib/v3/flowLogger.js +0 -868
  313. package/dist/esm/lib/v3/flowLogger.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../lib/version.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,iBAAiB,GAAG,OAAgB,CAAC","sourcesContent":["/**\n * AUTO-GENERATED — DO NOT EDIT BY HAND\n * Run `pnpm run gen-version` to refresh.\n */\nexport const STAGEHAND_VERSION = \"3.1.0\" as const;\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../lib/version.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,iBAAiB,GAAG,OAAgB,CAAC","sourcesContent":["/**\n * AUTO-GENERATED — DO NOT EDIT BY HAND\n * Run `pnpm run gen-version` to refresh.\n */\nexport const STAGEHAND_VERSION = \"3.2.0\" as const;\n"]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_1 = require("@playwright/test");
4
+ const v3_js_1 = require("../../lib/v3/v3.js");
5
+ const v3_config_js_1 = require("./v3.config.js");
6
+ const isBrowserbase = (process.env.STAGEHAND_BROWSER_TARGET ?? "local").toLowerCase() ===
7
+ "browserbase";
8
+ test_1.test.describe("Agent captcha auto-solve on Browserbase", () => {
9
+ test_1.test.skip(!isBrowserbase, "Requires Browserbase environment");
10
+ let v3;
11
+ let logs;
12
+ test_1.test.beforeEach(async () => {
13
+ logs = [];
14
+ v3 = new v3_js_1.V3((0, v3_config_js_1.getV3TestConfig)({
15
+ env: "BROWSERBASE",
16
+ verbose: 2,
17
+ logger: (line) => {
18
+ logs.push(line);
19
+ console.log(`[${line.category}] ${line.message}`);
20
+ },
21
+ browserbaseSessionCreateParams: {
22
+ browserSettings: {
23
+ solveCaptchas: true,
24
+ },
25
+ },
26
+ }));
27
+ await v3.init();
28
+ console.log("BB session URL:", v3.browserbaseSessionURL);
29
+ });
30
+ test_1.test.afterEach(async () => {
31
+ await v3?.close?.().catch(() => { });
32
+ });
33
+ (0, test_1.test)("reCAPTCHA v2 auto-solve (Google demo)", async () => {
34
+ test_1.test.setTimeout(180_000);
35
+ const page = v3.context.pages()[0];
36
+ // Google's official reCAPTCHA v2 demo — same URL the stealth team tests.
37
+ // Use domcontentloaded since BB's route interception can delay full load.
38
+ await page.goto("https://www.google.com/recaptcha/api2/demo", {
39
+ waitUntil: "domcontentloaded",
40
+ });
41
+ // Give BB time to intercept the anchor request and solve the captcha
42
+ await new Promise((r) => setTimeout(r, 30_000));
43
+ const agent = v3.agent({
44
+ mode: "dom",
45
+ model: "anthropic/claude-haiku-4-5-20251001",
46
+ });
47
+ const result = await agent.execute({
48
+ instruction: 'Click the "Submit" button and report the exact text shown on the result page.',
49
+ maxSteps: 15,
50
+ });
51
+ console.log("reCAPTCHA v2 result:", result.message);
52
+ (0, test_1.expect)(result.completed).toBe(true);
53
+ (0, test_1.expect)(result.message.toLowerCase()).toContain("success");
54
+ });
55
+ });
56
+ //# sourceMappingURL=agent-captcha-autosolve.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-captcha-autosolve.spec.js","sourceRoot":"","sources":["../../../../tests/integration/agent-captcha-autosolve.spec.ts"],"names":[],"mappings":";;AAAA,2CAAgD;AAChD,8CAAwC;AACxC,iDAAiD;AAGjD,MAAM,aAAa,GACjB,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,OAAO,CAAC,CAAC,WAAW,EAAE;IAC/D,aAAa,CAAC;AAEhB,WAAI,CAAC,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IAC5D,WAAI,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,kCAAkC,CAAC,CAAC;IAE9D,IAAI,EAAM,CAAC;IACX,IAAI,IAAe,CAAC;IAEpB,WAAI,CAAC,UAAU,CA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CAAC,KAAK,CAAC;YACrB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,qCAAqC;SAC7C,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC;YACjC,WAAW,EACT,+EAA+E;YACjF,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAA,aAAM,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,IAAA,aAAM,EAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"@playwright/test\";\nimport { V3 } from \"../../lib/v3/v3.js\";\nimport { getV3TestConfig } from \"./v3.config.js\";\nimport type { LogLine } from \"../../lib/v3/types/public/logs.js\";\n\nconst isBrowserbase =\n (process.env.STAGEHAND_BROWSER_TARGET ?? \"local\").toLowerCase() ===\n \"browserbase\";\n\ntest.describe(\"Agent captcha auto-solve on Browserbase\", () => {\n test.skip(!isBrowserbase, \"Requires Browserbase environment\");\n\n let v3: V3;\n let logs: LogLine[];\n\n test.beforeEach(async () => {\n logs = [];\n v3 = new V3(\n getV3TestConfig({\n env: \"BROWSERBASE\",\n verbose: 2,\n logger: (line: LogLine) => {\n logs.push(line);\n console.log(`[${line.category}] ${line.message}`);\n },\n browserbaseSessionCreateParams: {\n browserSettings: {\n solveCaptchas: true,\n },\n },\n }),\n );\n await v3.init();\n console.log(\"BB session URL:\", v3.browserbaseSessionURL);\n });\n\n test.afterEach(async () => {\n await v3?.close?.().catch(() => {});\n });\n\n test(\"reCAPTCHA v2 auto-solve (Google demo)\", async () => {\n test.setTimeout(180_000);\n const page = v3.context.pages()[0];\n // Google's official reCAPTCHA v2 demo — same URL the stealth team tests.\n // Use domcontentloaded since BB's route interception can delay full load.\n await page.goto(\"https://www.google.com/recaptcha/api2/demo\", {\n waitUntil: \"domcontentloaded\",\n });\n\n // Give BB time to intercept the anchor request and solve the captcha\n await new Promise((r) => setTimeout(r, 30_000));\n\n const agent = v3.agent({\n mode: \"dom\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n const result = await agent.execute({\n instruction:\n 'Click the \"Submit\" button and report the exact text shown on the result page.',\n maxSteps: 15,\n });\n\n console.log(\"reCAPTCHA v2 result:\", result.message);\n\n expect(result.completed).toBe(true);\n expect(result.message.toLowerCase()).toContain(\"success\");\n });\n});\n"]}
@@ -110,24 +110,24 @@ test_1.test.describe("Stagehand agent hybrid mode", () => {
110
110
  (0, test_1.expect)(prompt).toContain("customInstructions");
111
111
  (0, test_1.expect)(prompt).toContain(customInstructions);
112
112
  });
113
- (0, test_1.test)("System prompt includes Browserbase captcha message when isBrowserbase is true", () => {
113
+ (0, test_1.test)("System prompt includes captcha instructions when captchasAutoSolve is true", () => {
114
114
  const prompt = (0, agentSystemPrompt_js_1.buildAgentSystemPrompt)({
115
115
  url: "https://example.com",
116
116
  executionInstruction: "Test instruction",
117
117
  mode: "dom",
118
- isBrowserbase: true,
118
+ captchasAutoSolve: true,
119
119
  });
120
120
  (0, test_1.expect)(prompt).toContain("captcha");
121
- (0, test_1.expect)(prompt).toContain("automatically be solved");
121
+ (0, test_1.expect)(prompt).toContain("automatically detected and solved");
122
122
  });
123
- (0, test_1.test)("System prompt does not include captcha message when isBrowserbase is false", () => {
123
+ (0, test_1.test)("System prompt does not include captcha instructions when captchasAutoSolve is false", () => {
124
124
  const prompt = (0, agentSystemPrompt_js_1.buildAgentSystemPrompt)({
125
125
  url: "https://example.com",
126
126
  executionInstruction: "Test instruction",
127
127
  mode: "dom",
128
- isBrowserbase: false,
128
+ captchasAutoSolve: false,
129
129
  });
130
- (0, test_1.expect)(prompt).not.toContain("automatically be solved");
130
+ (0, test_1.expect)(prompt).not.toContain("automatically detected and solved");
131
131
  });
132
132
  });
133
133
  test_1.test.describe("Agent creation with mode", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"agent-hybrid-mode.spec.js","sourceRoot":"","sources":["../../../../tests/integration/agent-hybrid-mode.spec.ts"],"names":[],"mappings":";;AAAA,2CAAgD;AAChD,8CAAwC;AACxC,iDAA8C;AAC9C,gEAAqE;AACrE,0FAAyF;AAGzF,WAAI,CAAC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAChD,IAAI,EAAM,CAAC;IAEX,WAAI,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;QACzB,EAAE,GAAG,IAAI,UAAE,CAAC;YACV,GAAG,2BAAY;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,WAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,WAAI,CAAC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC3C,IAAA,WAAI,EAAC,uEAAuE,EAAE,GAAG,EAAE;YACjF,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAEpD,mCAAmC;YACnC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACpC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACzC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACzC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,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AC9C,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACpD,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAA,WAAI,EAAC,uCAAuC,EAAE,GAAG,EAAE;YACjD,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,WAAI,CAAC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAC5C,IAAA,WAAI,EAAC,qCAAqC,EAAE,GAAG,EAAE;YAC/C,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACpD,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,IAAA,WAAI,EAAC,wCAAwC,EAAE,GAAG,EAAE;YAClD,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"@playwright/test\";\nimport { V3 } from \"../../lib/v3/v3.js\";\nimport { v3TestConfig } from \"./v3.config.js\";\nimport { createAgentTools } from \"../../lib/v3/agent/tools/index.js\";\nimport { buildAgentSystemPrompt } from \"../../lib/v3/agent/prompts/agentSystemPrompt.js\";\nimport type { StepResult, ToolSet } from \"ai\";\n\ntest.describe(\"Stagehand agent hybrid mode\", () => {\n let v3: V3;\n\n test.beforeEach(async () => {\n v3 = new V3({\n ...v3TestConfig,\n experimental: true,\n });\n await v3.init();\n });\n\n test.afterEach(async () => {\n await v3?.close?.().catch(() => {});\n });\n\n test.describe(\"Tool filtering by mode\", () => {\n test(\"DOM mode includes DOM-based tools and excludes coordinate-based tools\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n\n // DOM mode should have these tools\n expect(tools).toHaveProperty(\"act\");\n expect(tools).toHaveProperty(\"fillForm\");\n expect(tools).toHaveProperty(\"ariaTree\");\n expect(tools).toHaveProperty(\"screenshot\");\n expect(tools).toHaveProperty(\"extract\");\n expect(tools).toHaveProperty(\"goto\");\n expect(tools).toHaveProperty(\"scroll\");\n expect(tools).toHaveProperty(\"wait\");\n expect(tools).toHaveProperty(\"navback\");\n expect(tools).toHaveProperty(\"keys\");\n expect(tools).toHaveProperty(\"think\");\n\n // DOM mode should NOT have coordinate-based tools\n expect(tools).not.toHaveProperty(\"click\");\n expect(tools).not.toHaveProperty(\"type\");\n expect(tools).not.toHaveProperty(\"dragAndDrop\");\n expect(tools).not.toHaveProperty(\"clickAndHold\");\n expect(tools).not.toHaveProperty(\"fillFormVision\");\n });\n\n test(\"Hybrid mode includes coordinate-based tools and excludes DOM fillForm\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n\n // Hybrid mode should have coordinate-based tools\n expect(tools).toHaveProperty(\"click\");\n expect(tools).toHaveProperty(\"type\");\n expect(tools).toHaveProperty(\"dragAndDrop\");\n expect(tools).toHaveProperty(\"clickAndHold\");\n expect(tools).toHaveProperty(\"fillFormVision\");\n\n // Hybrid mode should also have common tools\n expect(tools).toHaveProperty(\"act\");\n expect(tools).toHaveProperty(\"ariaTree\");\n expect(tools).toHaveProperty(\"screenshot\");\n expect(tools).toHaveProperty(\"extract\");\n expect(tools).toHaveProperty(\"goto\");\n expect(tools).toHaveProperty(\"scroll\");\n expect(tools).toHaveProperty(\"wait\");\n expect(tools).toHaveProperty(\"navback\");\n expect(tools).toHaveProperty(\"keys\");\n expect(tools).toHaveProperty(\"think\");\n\n // Hybrid mode should NOT have DOM-based fillForm\n expect(tools).not.toHaveProperty(\"fillForm\");\n });\n\n test(\"Default mode is DOM when not specified\", () => {\n const tools = createAgentTools(v3, {});\n\n // Should behave like DOM mode\n expect(tools).toHaveProperty(\"fillForm\");\n expect(tools).not.toHaveProperty(\"click\");\n expect(tools).not.toHaveProperty(\"type\");\n });\n });\n\n test.describe(\"System prompt generation\", () => {\n test(\"DOM mode system prompt emphasizes ariaTree and act tool\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n });\n\n // DOM mode should prioritize ariaTree\n expect(prompt).toContain(\"ariaTree\");\n expect(prompt).toContain(\"act\");\n expect(prompt).toContain(\"fillForm\");\n\n // Should have DOM-specific strategy\n expect(prompt).toContain(\"Use act tool for all clicking and typing\");\n expect(prompt).toContain(\"Always check ariaTree first\");\n });\n\n test(\"Hybrid mode system prompt emphasizes screenshot and coordinate tools\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"hybrid\",\n });\n\n // Hybrid mode should have coordinate-based tools mentioned\n expect(prompt).toContain(\"click\");\n expect(prompt).toContain(\"type\");\n expect(prompt).toContain(\"fillFormVision\");\n expect(prompt).toContain(\"dragAndDrop\");\n\n // Should have hybrid-specific strategy\n expect(prompt).toContain(\n \"Use specific tools (click, type) when elements are visible\",\n );\n expect(prompt).toContain(\"Always use screenshot\");\n });\n\n test(\"System prompt includes custom instructions when provided\", () => {\n const customInstructions = \"Always be polite and thorough\";\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n systemInstructions: customInstructions,\n });\n\n expect(prompt).toContain(\"customInstructions\");\n expect(prompt).toContain(customInstructions);\n });\n\n test(\"System prompt includes Browserbase captcha message when isBrowserbase is true\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n isBrowserbase: true,\n });\n\n expect(prompt).toContain(\"captcha\");\n expect(prompt).toContain(\"automatically be solved\");\n });\n\n test(\"System prompt does not include captcha message when isBrowserbase is false\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n isBrowserbase: false,\n });\n\n expect(prompt).not.toContain(\"automatically be solved\");\n });\n });\n\n test.describe(\"Agent creation with mode\", () => {\n test(\"agent({ mode: 'dom' }) creates DOM-mode agent\", () => {\n const agent = v3.agent({\n mode: \"dom\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"agent({ mode: 'hybrid' }) creates hybrid-mode agent\", () => {\n const agent = v3.agent({\n mode: \"hybrid\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"agent without mode defaults to DOM mode\", () => {\n const agent = v3.agent({\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"hybrid mode can be combined with streaming\", () => {\n const agent = v3.agent({\n mode: \"hybrid\",\n stream: true,\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n });\n\n test.describe(\"Hybrid mode execution\", () => {\n test(\"hybrid mode agent uses coordinate-based tools when available\", async () => {\n test.setTimeout(90000);\n\n const toolCalls: Array<{ toolName: string; input: unknown }> = [];\n\n const agent = v3.agent({\n mode: \"hybrid\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n const page = v3.context.pages()[0];\n await page.goto(\"https://example.com\");\n\n await agent.execute({\n instruction:\n \"Take a screenshot to see the page, then describe what you see briefly and mark the task as complete.\",\n maxSteps: 5,\n callbacks: {\n onStepFinish: async (event: StepResult<ToolSet>) => {\n if (event.toolCalls) {\n for (const tc of event.toolCalls) {\n toolCalls.push({\n toolName: tc.toolName,\n input: tc.input,\n });\n }\n }\n },\n },\n });\n\n // Should have captured tool calls\n expect(toolCalls.length).toBeGreaterThan(0);\n\n const toolNames = toolCalls.map((tc) => tc.toolName);\n // Should include screenshot (hybrid mode emphasizes visual)\n expect(toolNames).toContain(\"screenshot\");\n });\n\n test(\"DOM mode agent uses DOM-based tools\", async () => {\n test.setTimeout(90000);\n\n const toolCalls: Array<{ toolName: string; input: unknown }> = [];\n\n const agent = v3.agent({\n mode: \"dom\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n const page = v3.context.pages()[0];\n await page.goto(\"https://example.com\");\n\n await agent.execute({\n instruction:\n \"Use the ariaTree to understand the page, then provide the final requested output or a summary of the page.\",\n maxSteps: 5,\n callbacks: {\n onStepFinish: async (event: StepResult<ToolSet>) => {\n if (event.toolCalls) {\n for (const tc of event.toolCalls) {\n toolCalls.push({\n toolName: tc.toolName,\n input: tc.input,\n });\n }\n }\n },\n },\n });\n\n // Should have captured tool calls\n expect(toolCalls.length).toBeGreaterThan(0);\n\n // Should include ariaTree (DOM mode emphasizes aria-based interaction)\n const toolNames = toolCalls.map((tc) => tc.toolName);\n expect(toolNames).toContain(\"ariaTree\");\n });\n });\n\n test.describe(\"Scroll tool variants by mode\", () => {\n test(\"DOM mode uses simple scroll tool without coordinates\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n\n expect(tools).toHaveProperty(\"scroll\");\n // The DOM scroll tool should exist\n expect(typeof tools.scroll).toBe(\"object\");\n });\n\n test(\"Hybrid mode uses vision scroll tool with optional coordinates\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n\n expect(tools).toHaveProperty(\"scroll\");\n // The hybrid scroll tool should exist\n expect(typeof tools.scroll).toBe(\"object\");\n });\n });\n\n test.describe(\"Keys tool availability in both modes\", () => {\n test(\"Keys tool is available in DOM mode\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n expect(tools).toHaveProperty(\"keys\");\n });\n\n test(\"Keys tool is available in hybrid mode\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n expect(tools).toHaveProperty(\"keys\");\n });\n });\n\n test.describe(\"Think tool availability\", () => {\n test(\"Think tool is available in DOM mode\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n expect(tools).toHaveProperty(\"think\");\n });\n\n test(\"Think tool is available in hybrid mode\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n expect(tools).toHaveProperty(\"think\");\n });\n });\n});\n"]}
1
+ {"version":3,"file":"agent-hybrid-mode.spec.js","sourceRoot":"","sources":["../../../../tests/integration/agent-hybrid-mode.spec.ts"],"names":[],"mappings":";;AAAA,2CAAgD;AAChD,8CAAwC;AACxC,iDAA8C;AAC9C,gEAAqE;AACrE,0FAAyF;AAGzF,WAAI,CAAC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAChD,IAAI,EAAM,CAAC;IAEX,WAAI,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;QACzB,EAAE,GAAG,IAAI,UAAE,CAAC;YACV,GAAG,2BAAY;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,WAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,WAAI,CAAC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC3C,IAAA,WAAI,EAAC,uEAAuE,EAAE,GAAG,EAAE;YACjF,MAAM,KAA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AAA,2BAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"@playwright/test\";\nimport { V3 } from \"../../lib/v3/v3.js\";\nimport { v3TestConfig } from \"./v3.config.js\";\nimport { createAgentTools } from \"../../lib/v3/agent/tools/index.js\";\nimport { buildAgentSystemPrompt } from \"../../lib/v3/agent/prompts/agentSystemPrompt.js\";\nimport type { StepResult, ToolSet } from \"ai\";\n\ntest.describe(\"Stagehand agent hybrid mode\", () => {\n let v3: V3;\n\n test.beforeEach(async () => {\n v3 = new V3({\n ...v3TestConfig,\n experimental: true,\n });\n await v3.init();\n });\n\n test.afterEach(async () => {\n await v3?.close?.().catch(() => {});\n });\n\n test.describe(\"Tool filtering by mode\", () => {\n test(\"DOM mode includes DOM-based tools and excludes coordinate-based tools\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n\n // DOM mode should have these tools\n expect(tools).toHaveProperty(\"act\");\n expect(tools).toHaveProperty(\"fillForm\");\n expect(tools).toHaveProperty(\"ariaTree\");\n expect(tools).toHaveProperty(\"screenshot\");\n expect(tools).toHaveProperty(\"extract\");\n expect(tools).toHaveProperty(\"goto\");\n expect(tools).toHaveProperty(\"scroll\");\n expect(tools).toHaveProperty(\"wait\");\n expect(tools).toHaveProperty(\"navback\");\n expect(tools).toHaveProperty(\"keys\");\n expect(tools).toHaveProperty(\"think\");\n\n // DOM mode should NOT have coordinate-based tools\n expect(tools).not.toHaveProperty(\"click\");\n expect(tools).not.toHaveProperty(\"type\");\n expect(tools).not.toHaveProperty(\"dragAndDrop\");\n expect(tools).not.toHaveProperty(\"clickAndHold\");\n expect(tools).not.toHaveProperty(\"fillFormVision\");\n });\n\n test(\"Hybrid mode includes coordinate-based tools and excludes DOM fillForm\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n\n // Hybrid mode should have coordinate-based tools\n expect(tools).toHaveProperty(\"click\");\n expect(tools).toHaveProperty(\"type\");\n expect(tools).toHaveProperty(\"dragAndDrop\");\n expect(tools).toHaveProperty(\"clickAndHold\");\n expect(tools).toHaveProperty(\"fillFormVision\");\n\n // Hybrid mode should also have common tools\n expect(tools).toHaveProperty(\"act\");\n expect(tools).toHaveProperty(\"ariaTree\");\n expect(tools).toHaveProperty(\"screenshot\");\n expect(tools).toHaveProperty(\"extract\");\n expect(tools).toHaveProperty(\"goto\");\n expect(tools).toHaveProperty(\"scroll\");\n expect(tools).toHaveProperty(\"wait\");\n expect(tools).toHaveProperty(\"navback\");\n expect(tools).toHaveProperty(\"keys\");\n expect(tools).toHaveProperty(\"think\");\n\n // Hybrid mode should NOT have DOM-based fillForm\n expect(tools).not.toHaveProperty(\"fillForm\");\n });\n\n test(\"Default mode is DOM when not specified\", () => {\n const tools = createAgentTools(v3, {});\n\n // Should behave like DOM mode\n expect(tools).toHaveProperty(\"fillForm\");\n expect(tools).not.toHaveProperty(\"click\");\n expect(tools).not.toHaveProperty(\"type\");\n });\n });\n\n test.describe(\"System prompt generation\", () => {\n test(\"DOM mode system prompt emphasizes ariaTree and act tool\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n });\n\n // DOM mode should prioritize ariaTree\n expect(prompt).toContain(\"ariaTree\");\n expect(prompt).toContain(\"act\");\n expect(prompt).toContain(\"fillForm\");\n\n // Should have DOM-specific strategy\n expect(prompt).toContain(\"Use act tool for all clicking and typing\");\n expect(prompt).toContain(\"Always check ariaTree first\");\n });\n\n test(\"Hybrid mode system prompt emphasizes screenshot and coordinate tools\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"hybrid\",\n });\n\n // Hybrid mode should have coordinate-based tools mentioned\n expect(prompt).toContain(\"click\");\n expect(prompt).toContain(\"type\");\n expect(prompt).toContain(\"fillFormVision\");\n expect(prompt).toContain(\"dragAndDrop\");\n\n // Should have hybrid-specific strategy\n expect(prompt).toContain(\n \"Use specific tools (click, type) when elements are visible\",\n );\n expect(prompt).toContain(\"Always use screenshot\");\n });\n\n test(\"System prompt includes custom instructions when provided\", () => {\n const customInstructions = \"Always be polite and thorough\";\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n systemInstructions: customInstructions,\n });\n\n expect(prompt).toContain(\"customInstructions\");\n expect(prompt).toContain(customInstructions);\n });\n\n test(\"System prompt includes captcha instructions when captchasAutoSolve is true\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n captchasAutoSolve: true,\n });\n\n expect(prompt).toContain(\"captcha\");\n expect(prompt).toContain(\"automatically detected and solved\");\n });\n\n test(\"System prompt does not include captcha instructions when captchasAutoSolve is false\", () => {\n const prompt = buildAgentSystemPrompt({\n url: \"https://example.com\",\n executionInstruction: \"Test instruction\",\n mode: \"dom\",\n captchasAutoSolve: false,\n });\n\n expect(prompt).not.toContain(\"automatically detected and solved\");\n });\n });\n\n test.describe(\"Agent creation with mode\", () => {\n test(\"agent({ mode: 'dom' }) creates DOM-mode agent\", () => {\n const agent = v3.agent({\n mode: \"dom\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"agent({ mode: 'hybrid' }) creates hybrid-mode agent\", () => {\n const agent = v3.agent({\n mode: \"hybrid\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"agent without mode defaults to DOM mode\", () => {\n const agent = v3.agent({\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n\n test(\"hybrid mode can be combined with streaming\", () => {\n const agent = v3.agent({\n mode: \"hybrid\",\n stream: true,\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n expect(agent).toHaveProperty(\"execute\");\n });\n });\n\n test.describe(\"Hybrid mode execution\", () => {\n test(\"hybrid mode agent uses coordinate-based tools when available\", async () => {\n test.setTimeout(90000);\n\n const toolCalls: Array<{ toolName: string; input: unknown }> = [];\n\n const agent = v3.agent({\n mode: \"hybrid\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n const page = v3.context.pages()[0];\n await page.goto(\"https://example.com\");\n\n await agent.execute({\n instruction:\n \"Take a screenshot to see the page, then describe what you see briefly and mark the task as complete.\",\n maxSteps: 5,\n callbacks: {\n onStepFinish: async (event: StepResult<ToolSet>) => {\n if (event.toolCalls) {\n for (const tc of event.toolCalls) {\n toolCalls.push({\n toolName: tc.toolName,\n input: tc.input,\n });\n }\n }\n },\n },\n });\n\n // Should have captured tool calls\n expect(toolCalls.length).toBeGreaterThan(0);\n\n const toolNames = toolCalls.map((tc) => tc.toolName);\n // Should include screenshot (hybrid mode emphasizes visual)\n expect(toolNames).toContain(\"screenshot\");\n });\n\n test(\"DOM mode agent uses DOM-based tools\", async () => {\n test.setTimeout(90000);\n\n const toolCalls: Array<{ toolName: string; input: unknown }> = [];\n\n const agent = v3.agent({\n mode: \"dom\",\n model: \"anthropic/claude-haiku-4-5-20251001\",\n });\n\n const page = v3.context.pages()[0];\n await page.goto(\"https://example.com\");\n\n await agent.execute({\n instruction:\n \"Use the ariaTree to understand the page, then provide the final requested output or a summary of the page.\",\n maxSteps: 5,\n callbacks: {\n onStepFinish: async (event: StepResult<ToolSet>) => {\n if (event.toolCalls) {\n for (const tc of event.toolCalls) {\n toolCalls.push({\n toolName: tc.toolName,\n input: tc.input,\n });\n }\n }\n },\n },\n });\n\n // Should have captured tool calls\n expect(toolCalls.length).toBeGreaterThan(0);\n\n // Should include ariaTree (DOM mode emphasizes aria-based interaction)\n const toolNames = toolCalls.map((tc) => tc.toolName);\n expect(toolNames).toContain(\"ariaTree\");\n });\n });\n\n test.describe(\"Scroll tool variants by mode\", () => {\n test(\"DOM mode uses simple scroll tool without coordinates\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n\n expect(tools).toHaveProperty(\"scroll\");\n // The DOM scroll tool should exist\n expect(typeof tools.scroll).toBe(\"object\");\n });\n\n test(\"Hybrid mode uses vision scroll tool with optional coordinates\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n\n expect(tools).toHaveProperty(\"scroll\");\n // The hybrid scroll tool should exist\n expect(typeof tools.scroll).toBe(\"object\");\n });\n });\n\n test.describe(\"Keys tool availability in both modes\", () => {\n test(\"Keys tool is available in DOM mode\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n expect(tools).toHaveProperty(\"keys\");\n });\n\n test(\"Keys tool is available in hybrid mode\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n expect(tools).toHaveProperty(\"keys\");\n });\n });\n\n test.describe(\"Think tool availability\", () => {\n test(\"Think tool is available in DOM mode\", () => {\n const tools = createAgentTools(v3, { mode: \"dom\" });\n expect(tools).toHaveProperty(\"think\");\n });\n\n test(\"Think tool is available in hybrid mode\", () => {\n const tools = createAgentTools(v3, { mode: \"hybrid\" });\n expect(tools).toHaveProperty(\"think\");\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};