@browserbasehq/orca 3.0.9-alpha-4 → 3.1.0-patch.0

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 (655) hide show
  1. package/dist/esm/index.d.ts +3 -0
  2. package/dist/esm/index.js +3 -0
  3. package/dist/esm/lib/inference.d.ts +65 -0
  4. package/dist/esm/lib/inference.js +333 -0
  5. package/dist/esm/lib/inference.js.map +1 -0
  6. package/dist/esm/lib/inferenceLogUtils.d.ts +12 -0
  7. package/dist/esm/lib/inferenceLogUtils.js +92 -0
  8. package/dist/esm/lib/inferenceLogUtils.js.map +1 -0
  9. package/dist/esm/lib/logger.d.ts +69 -0
  10. package/dist/esm/lib/logger.js +323 -0
  11. package/dist/esm/lib/logger.js.map +1 -0
  12. package/dist/esm/lib/modelUtils.d.ts +14 -0
  13. package/dist/esm/lib/modelUtils.js +48 -0
  14. package/dist/esm/lib/modelUtils.js.map +1 -0
  15. package/dist/esm/lib/prompt.d.ts +14 -0
  16. package/dist/esm/lib/prompt.js +230 -0
  17. package/dist/esm/lib/prompt.js.map +1 -0
  18. package/dist/esm/lib/utils.d.ts +68 -0
  19. package/dist/esm/lib/utils.js +654 -0
  20. package/dist/esm/lib/utils.js.map +1 -0
  21. package/dist/esm/lib/v3/agent/AgentClient.d.ts +19 -0
  22. package/dist/esm/lib/v3/agent/AgentClient.js +17 -0
  23. package/dist/esm/lib/v3/agent/AgentClient.js.map +1 -0
  24. package/dist/esm/lib/v3/agent/AgentProvider.d.ts +20 -0
  25. package/dist/esm/lib/v3/agent/AgentProvider.js +77 -0
  26. package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -0
  27. package/dist/esm/lib/v3/agent/AnthropicCUAClient.d.ts +57 -0
  28. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js +822 -0
  29. package/dist/esm/lib/v3/agent/AnthropicCUAClient.js.map +1 -0
  30. package/dist/esm/lib/v3/agent/GoogleCUAClient.d.ts +74 -0
  31. package/dist/esm/lib/v3/agent/GoogleCUAClient.js +799 -0
  32. package/dist/esm/lib/v3/agent/GoogleCUAClient.js.map +1 -0
  33. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.d.ts +71 -0
  34. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js +770 -0
  35. package/dist/esm/lib/v3/agent/MicrosoftCUAClient.js.map +1 -0
  36. package/dist/esm/lib/v3/agent/OpenAICUAClient.d.ts +69 -0
  37. package/dist/esm/lib/v3/agent/OpenAICUAClient.js +615 -0
  38. package/dist/esm/lib/v3/agent/OpenAICUAClient.js.map +1 -0
  39. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.d.ts +12 -0
  40. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js +186 -0
  41. package/dist/esm/lib/v3/agent/prompts/agentSystemPrompt.js.map +1 -0
  42. package/dist/esm/lib/v3/agent/tools/act.d.ts +13 -0
  43. package/dist/esm/lib/v3/agent/tools/act.js +49 -0
  44. package/dist/esm/lib/v3/agent/tools/act.js.map +1 -0
  45. package/dist/esm/lib/v3/agent/tools/ariaTree.d.ts +5 -0
  46. package/dist/esm/lib/v3/agent/tools/ariaTree.js +31 -0
  47. package/dist/esm/lib/v3/agent/tools/ariaTree.js.map +1 -0
  48. package/dist/esm/lib/v3/agent/tools/click.d.ts +6 -0
  49. package/dist/esm/lib/v3/agent/tools/click.js +104 -0
  50. package/dist/esm/lib/v3/agent/tools/click.js.map +1 -0
  51. package/dist/esm/lib/v3/agent/tools/clickAndHold.d.ts +14 -0
  52. package/dist/esm/lib/v3/agent/tools/clickAndHold.js +68 -0
  53. package/dist/esm/lib/v3/agent/tools/clickAndHold.js.map +1 -0
  54. package/dist/esm/lib/v3/agent/tools/dragAndDrop.d.ts +7 -0
  55. package/dist/esm/lib/v3/agent/tools/dragAndDrop.js +105 -0
  56. package/dist/esm/lib/v3/agent/tools/dragAndDrop.js.map +1 -0
  57. package/dist/esm/lib/v3/agent/tools/extract.d.ts +21 -0
  58. package/dist/esm/lib/v3/agent/tools/extract.js +93 -0
  59. package/dist/esm/lib/v3/agent/tools/extract.js.map +1 -0
  60. package/dist/esm/lib/v3/agent/tools/fillFormVision.d.ts +12 -0
  61. package/dist/esm/lib/v3/agent/tools/fillFormVision.js +143 -0
  62. package/dist/esm/lib/v3/agent/tools/fillFormVision.js.map +1 -0
  63. package/dist/esm/lib/v3/agent/tools/fillform.d.ts +13 -0
  64. package/dist/esm/lib/v3/agent/tools/fillform.js +56 -0
  65. package/dist/esm/lib/v3/agent/tools/fillform.js.map +1 -0
  66. package/dist/esm/lib/v3/agent/tools/goto.d.ts +12 -0
  67. package/dist/esm/lib/v3/agent/tools/goto.js +31 -0
  68. package/dist/esm/lib/v3/agent/tools/goto.js.map +1 -0
  69. package/dist/esm/lib/v3/agent/tools/index.d.ts +92 -0
  70. package/dist/esm/lib/v3/agent/tools/index.js +74 -0
  71. package/dist/esm/lib/v3/agent/tools/index.js.map +1 -0
  72. package/dist/esm/lib/v3/agent/tools/keys.d.ts +24 -0
  73. package/dist/esm/lib/v3/agent/tools/keys.js +60 -0
  74. package/dist/esm/lib/v3/agent/tools/keys.js.map +1 -0
  75. package/dist/esm/lib/v3/agent/tools/navback.d.ts +6 -0
  76. package/dist/esm/lib/v3/agent/tools/navback.js +23 -0
  77. package/dist/esm/lib/v3/agent/tools/navback.js.map +1 -0
  78. package/dist/esm/lib/v3/agent/tools/screenshot.d.ts +6 -0
  79. package/dist/esm/lib/v3/agent/tools/screenshot.js +26 -0
  80. package/dist/esm/lib/v3/agent/tools/screenshot.js.map +1 -0
  81. package/dist/esm/lib/v3/agent/tools/scroll.d.ts +19 -0
  82. package/dist/esm/lib/v3/agent/tools/scroll.js +142 -0
  83. package/dist/esm/lib/v3/agent/tools/scroll.js.map +1 -0
  84. package/dist/esm/lib/v3/agent/tools/search.d.ts +15 -0
  85. package/dist/esm/lib/v3/agent/tools/search.js +73 -0
  86. package/dist/esm/lib/v3/agent/tools/search.js.map +1 -0
  87. package/dist/esm/lib/v3/agent/tools/think.d.ts +6 -0
  88. package/dist/esm/lib/v3/agent/tools/think.js +24 -0
  89. package/dist/esm/lib/v3/agent/tools/think.js.map +1 -0
  90. package/dist/esm/lib/v3/agent/tools/type.d.ts +7 -0
  91. package/dist/esm/lib/v3/agent/tools/type.js +106 -0
  92. package/dist/esm/lib/v3/agent/tools/type.js.map +1 -0
  93. package/dist/esm/lib/v3/agent/tools/wait.d.ts +5 -0
  94. package/dist/esm/lib/v3/agent/tools/wait.js +53 -0
  95. package/dist/esm/lib/v3/agent/tools/wait.js.map +1 -0
  96. package/dist/esm/lib/v3/agent/utils/actionMapping.d.ts +3 -0
  97. package/dist/esm/lib/v3/agent/utils/actionMapping.js +100 -0
  98. package/dist/esm/lib/v3/agent/utils/actionMapping.js.map +1 -0
  99. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.d.ts +13 -0
  100. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js +28 -0
  101. package/dist/esm/lib/v3/agent/utils/coordinateNormalization.js.map +1 -0
  102. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
  103. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js +62 -0
  104. package/dist/esm/lib/v3/agent/utils/cuaKeyMapping.js.map +1 -0
  105. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.d.ts +25 -0
  106. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js +145 -0
  107. package/dist/esm/lib/v3/agent/utils/googleCustomToolHandler.js.map +1 -0
  108. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.d.ts +22 -0
  109. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +101 -0
  110. package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -0
  111. package/dist/esm/lib/v3/agent/utils/imageCompression.d.ts +53 -0
  112. package/dist/esm/lib/v3/agent/utils/imageCompression.js +204 -0
  113. package/dist/esm/lib/v3/agent/utils/imageCompression.js.map +1 -0
  114. package/dist/esm/lib/v3/agent/utils/messageProcessing.d.ts +12 -0
  115. package/dist/esm/lib/v3/agent/utils/messageProcessing.js +164 -0
  116. package/dist/esm/lib/v3/agent/utils/messageProcessing.js.map +1 -0
  117. package/dist/esm/lib/v3/agent/utils/screenshotHandler.d.ts +10 -0
  118. package/dist/esm/lib/v3/agent/utils/screenshotHandler.js +26 -0
  119. package/dist/esm/lib/v3/agent/utils/screenshotHandler.js.map +1 -0
  120. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.d.ts +26 -0
  121. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js +79 -0
  122. package/dist/esm/lib/v3/agent/utils/validateExperimentalFeatures.js.map +1 -0
  123. package/dist/esm/lib/v3/agent/utils/xpath.d.ts +11 -0
  124. package/dist/esm/lib/v3/agent/utils/xpath.js +19 -0
  125. package/dist/esm/lib/v3/agent/utils/xpath.js.map +1 -0
  126. package/dist/esm/lib/v3/api.d.ts +86 -0
  127. package/dist/esm/lib/v3/api.js +484 -0
  128. package/dist/esm/lib/v3/api.js.map +1 -0
  129. package/dist/esm/lib/v3/cache/ActCache.d.ts +23 -0
  130. package/dist/esm/lib/v3/cache/ActCache.js +292 -0
  131. package/dist/esm/lib/v3/cache/ActCache.js.map +1 -0
  132. package/dist/esm/lib/v3/cache/AgentCache.d.ts +109 -0
  133. package/dist/esm/lib/v3/cache/AgentCache.js +640 -0
  134. package/dist/esm/lib/v3/cache/AgentCache.js.map +1 -0
  135. package/dist/esm/lib/v3/cache/CacheStorage.d.ts +17 -0
  136. package/dist/esm/lib/v3/cache/CacheStorage.js +98 -0
  137. package/dist/esm/lib/v3/cache/CacheStorage.js.map +1 -0
  138. package/dist/esm/lib/v3/cache/serverAgentCache.d.ts +7 -0
  139. package/dist/esm/lib/v3/cache/serverAgentCache.js +49 -0
  140. package/dist/esm/lib/v3/cache/serverAgentCache.js.map +1 -0
  141. package/dist/esm/lib/v3/cache/utils.d.ts +15 -0
  142. package/dist/esm/lib/v3/cache/utils.js +39 -0
  143. package/dist/esm/lib/v3/cache/utils.js.map +1 -0
  144. package/dist/esm/lib/v3/dom/a11yScripts/index.d.ts +11 -0
  145. package/dist/esm/lib/v3/dom/a11yScripts/index.js +117 -0
  146. package/dist/esm/lib/v3/dom/a11yScripts/index.js.map +1 -0
  147. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.d.ts +16 -0
  148. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js +20 -0
  149. package/dist/esm/lib/v3/dom/build/a11yScripts.generated.js.map +1 -0
  150. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.d.ts +52 -0
  151. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js +56 -0
  152. package/dist/esm/lib/v3/dom/build/locatorScripts.generated.js.map +1 -0
  153. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.d.ts +1 -0
  154. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js +2 -0
  155. package/dist/esm/lib/v3/dom/build/reRenderScriptContent.js.map +1 -0
  156. package/dist/esm/lib/v3/dom/build/rerender-index.js +1 -0
  157. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.d.ts +4 -0
  158. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js +8 -0
  159. package/dist/esm/lib/v3/dom/build/screenshotScripts.generated.js.map +1 -0
  160. package/dist/esm/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
  161. package/dist/esm/lib/v3/dom/build/scriptV3Content.js +2 -0
  162. package/dist/esm/lib/v3/dom/build/scriptV3Content.js.map +1 -0
  163. package/dist/esm/lib/v3/dom/build/v3-index.js +1 -0
  164. package/dist/esm/lib/v3/dom/genA11yScripts.d.ts +1 -0
  165. package/dist/esm/lib/v3/dom/genA11yScripts.js +54 -0
  166. package/dist/esm/lib/v3/dom/genA11yScripts.js.map +1 -0
  167. package/dist/esm/lib/v3/dom/genDomScripts.d.ts +1 -0
  168. package/dist/esm/lib/v3/dom/genDomScripts.js +38 -0
  169. package/dist/esm/lib/v3/dom/genDomScripts.js.map +1 -0
  170. package/dist/esm/lib/v3/dom/genLocatorScripts.d.ts +1 -0
  171. package/dist/esm/lib/v3/dom/genLocatorScripts.js +51 -0
  172. package/dist/esm/lib/v3/dom/genLocatorScripts.js.map +1 -0
  173. package/dist/esm/lib/v3/dom/genScreenshotScripts.d.ts +1 -0
  174. package/dist/esm/lib/v3/dom/genScreenshotScripts.js +37 -0
  175. package/dist/esm/lib/v3/dom/genScreenshotScripts.js.map +1 -0
  176. package/dist/esm/lib/v3/dom/index.d.ts +1 -0
  177. package/dist/esm/lib/v3/dom/index.js +2 -0
  178. package/dist/esm/lib/v3/dom/index.js.map +1 -0
  179. package/dist/esm/lib/v3/dom/locatorScripts/counts.d.ts +15 -0
  180. package/dist/esm/lib/v3/dom/locatorScripts/counts.js +272 -0
  181. package/dist/esm/lib/v3/dom/locatorScripts/counts.js.map +1 -0
  182. package/dist/esm/lib/v3/dom/locatorScripts/index.d.ts +4 -0
  183. package/dist/esm/lib/v3/dom/locatorScripts/index.js +5 -0
  184. package/dist/esm/lib/v3/dom/locatorScripts/index.js.map +1 -0
  185. package/dist/esm/lib/v3/dom/locatorScripts/scripts.d.ts +37 -0
  186. package/dist/esm/lib/v3/dom/locatorScripts/scripts.js +458 -0
  187. package/dist/esm/lib/v3/dom/locatorScripts/scripts.js.map +1 -0
  188. package/dist/esm/lib/v3/dom/locatorScripts/selectors.d.ts +4 -0
  189. package/dist/esm/lib/v3/dom/locatorScripts/selectors.js +283 -0
  190. package/dist/esm/lib/v3/dom/locatorScripts/selectors.js.map +1 -0
  191. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.d.ts +19 -0
  192. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js +283 -0
  193. package/dist/esm/lib/v3/dom/locatorScripts/waitForSelector.js.map +1 -0
  194. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.d.ts +76 -0
  195. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js +376 -0
  196. package/dist/esm/lib/v3/dom/locatorScripts/xpathParser.js.map +1 -0
  197. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.d.ts +9 -0
  198. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js +196 -0
  199. package/dist/esm/lib/v3/dom/locatorScripts/xpathResolver.js.map +1 -0
  200. package/dist/esm/lib/v3/dom/piercer.entry.d.ts +1 -0
  201. package/dist/esm/lib/v3/dom/piercer.entry.js +3 -0
  202. package/dist/esm/lib/v3/dom/piercer.entry.js.map +1 -0
  203. package/dist/esm/lib/v3/dom/piercer.runtime.d.ts +23 -0
  204. package/dist/esm/lib/v3/dom/piercer.runtime.js +90 -0
  205. package/dist/esm/lib/v3/dom/piercer.runtime.js.map +1 -0
  206. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.d.ts +1 -0
  207. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js +3 -0
  208. package/dist/esm/lib/v3/dom/rerenderMissingShadows.entry.js.map +1 -0
  209. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.d.ts +1 -0
  210. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js +40 -0
  211. package/dist/esm/lib/v3/dom/rerenderMissingShadows.runtime.js.map +1 -0
  212. package/dist/esm/lib/v3/dom/screenshotScripts/index.d.ts +1 -0
  213. package/dist/esm/lib/v3/dom/screenshotScripts/index.js +2 -0
  214. package/dist/esm/lib/v3/dom/screenshotScripts/index.js.map +1 -0
  215. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.d.ts +8 -0
  216. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js +82 -0
  217. package/dist/esm/lib/v3/dom/screenshotScripts/resolveMaskRect.js.map +1 -0
  218. package/dist/esm/lib/v3/external_clients/aisdk.d.ts +11 -0
  219. package/dist/esm/lib/v3/external_clients/aisdk.js +103 -0
  220. package/dist/esm/lib/v3/external_clients/aisdk.js.map +1 -0
  221. package/dist/esm/lib/v3/external_clients/customOpenAI.d.ts +18 -0
  222. package/dist/esm/lib/v3/external_clients/customOpenAI.js +220 -0
  223. package/dist/esm/lib/v3/external_clients/customOpenAI.js.map +1 -0
  224. package/dist/esm/lib/v3/flowLogger.d.ts +139 -0
  225. package/dist/esm/lib/v3/flowLogger.js +868 -0
  226. package/dist/esm/lib/v3/flowLogger.js.map +1 -0
  227. package/dist/esm/lib/v3/handlers/actHandler.d.ts +21 -0
  228. package/dist/esm/lib/v3/handlers/actHandler.js +340 -0
  229. package/dist/esm/lib/v3/handlers/actHandler.js.map +1 -0
  230. package/dist/esm/lib/v3/handlers/extractHandler.d.ts +31 -0
  231. package/dist/esm/lib/v3/handlers/extractHandler.js +139 -0
  232. package/dist/esm/lib/v3/handlers/extractHandler.js.map +1 -0
  233. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +24 -0
  234. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +623 -0
  235. package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -0
  236. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.d.ts +2 -0
  237. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js +14 -0
  238. package/dist/esm/lib/v3/handlers/handlerUtils/timeoutGuard.js.map +1 -0
  239. package/dist/esm/lib/v3/handlers/observeHandler.d.ts +17 -0
  240. package/dist/esm/lib/v3/handlers/observeHandler.js +156 -0
  241. package/dist/esm/lib/v3/handlers/observeHandler.js.map +1 -0
  242. package/dist/esm/lib/v3/handlers/v3AgentHandler.d.ts +32 -0
  243. package/dist/esm/lib/v3/handlers/v3AgentHandler.js +461 -0
  244. package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -0
  245. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.d.ts +33 -0
  246. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +528 -0
  247. package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -0
  248. package/dist/esm/lib/v3/index.d.ts +17 -0
  249. package/dist/esm/lib/v3/index.js +13 -0
  250. package/dist/esm/lib/v3/index.js.map +1 -0
  251. package/dist/esm/lib/v3/launch/browserbase.d.ts +7 -0
  252. package/dist/esm/lib/v3/launch/browserbase.js +46 -0
  253. package/dist/esm/lib/v3/launch/browserbase.js.map +1 -0
  254. package/dist/esm/lib/v3/launch/local.d.ts +15 -0
  255. package/dist/esm/lib/v3/launch/local.js +98 -0
  256. package/dist/esm/lib/v3/launch/local.js.map +1 -0
  257. package/dist/esm/lib/v3/llm/AnthropicClient.d.ts +16 -0
  258. package/dist/esm/lib/v3/llm/AnthropicClient.js +239 -0
  259. package/dist/esm/lib/v3/llm/AnthropicClient.js.map +1 -0
  260. package/dist/esm/lib/v3/llm/CerebrasClient.d.ts +17 -0
  261. package/dist/esm/lib/v3/llm/CerebrasClient.js +235 -0
  262. package/dist/esm/lib/v3/llm/CerebrasClient.js.map +1 -0
  263. package/dist/esm/lib/v3/llm/GoogleClient.d.ts +19 -0
  264. package/dist/esm/lib/v3/llm/GoogleClient.js +369 -0
  265. package/dist/esm/lib/v3/llm/GoogleClient.js.map +1 -0
  266. package/dist/esm/lib/v3/llm/GroqClient.d.ts +17 -0
  267. package/dist/esm/lib/v3/llm/GroqClient.js +236 -0
  268. package/dist/esm/lib/v3/llm/GroqClient.js.map +1 -0
  269. package/dist/esm/lib/v3/llm/LLMClient.d.ts +121 -0
  270. package/dist/esm/lib/v3/llm/LLMClient.js +23 -0
  271. package/dist/esm/lib/v3/llm/LLMClient.js.map +1 -0
  272. package/dist/esm/lib/v3/llm/LLMProvider.d.ts +13 -0
  273. package/dist/esm/lib/v3/llm/LLMProvider.js +194 -0
  274. package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -0
  275. package/dist/esm/lib/v3/llm/OpenAIClient.d.ts +15 -0
  276. package/dist/esm/lib/v3/llm/OpenAIClient.js +329 -0
  277. package/dist/esm/lib/v3/llm/OpenAIClient.js.map +1 -0
  278. package/dist/esm/lib/v3/llm/aisdk.d.ts +15 -0
  279. package/dist/esm/lib/v3/llm/aisdk.js +348 -0
  280. package/dist/esm/lib/v3/llm/aisdk.js.map +1 -0
  281. package/dist/esm/lib/v3/logger.d.ts +9 -0
  282. package/dist/esm/lib/v3/logger.js +96 -0
  283. package/dist/esm/lib/v3/logger.js.map +1 -0
  284. package/dist/esm/lib/v3/mcp/connection.d.ts +11 -0
  285. package/dist/esm/lib/v3/mcp/connection.js +49 -0
  286. package/dist/esm/lib/v3/mcp/connection.js.map +1 -0
  287. package/dist/esm/lib/v3/mcp/utils.d.ts +3 -0
  288. package/dist/esm/lib/v3/mcp/utils.js +36 -0
  289. package/dist/esm/lib/v3/mcp/utils.js.map +1 -0
  290. package/dist/esm/lib/v3/shutdown/cleanupLocal.d.ts +14 -0
  291. package/dist/esm/lib/v3/shutdown/cleanupLocal.js +30 -0
  292. package/dist/esm/lib/v3/shutdown/cleanupLocal.js.map +1 -0
  293. package/dist/esm/lib/v3/shutdown/supervisor.d.ts +9 -0
  294. package/dist/esm/lib/v3/shutdown/supervisor.js +156 -0
  295. package/dist/esm/lib/v3/shutdown/supervisor.js.map +1 -0
  296. package/dist/esm/lib/v3/shutdown/supervisorClient.d.ts +15 -0
  297. package/dist/esm/lib/v3/shutdown/supervisorClient.js +97 -0
  298. package/dist/esm/lib/v3/shutdown/supervisorClient.js.map +1 -0
  299. package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js +113 -0
  300. package/dist/esm/lib/v3/tests/agent-abort-signal.spec.js.map +7 -0
  301. package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js +80 -0
  302. package/dist/esm/lib/v3/tests/agent-cache-self-heal.spec.js.map +7 -0
  303. package/dist/esm/lib/v3/tests/agent-callbacks.spec.js +374 -0
  304. package/dist/esm/lib/v3/tests/agent-callbacks.spec.js.map +7 -0
  305. package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js +357 -0
  306. package/dist/esm/lib/v3/tests/agent-experimental-validation.spec.js.map +7 -0
  307. package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js +247 -0
  308. package/dist/esm/lib/v3/tests/agent-hybrid-mode.spec.js.map +7 -0
  309. package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js +105 -0
  310. package/dist/esm/lib/v3/tests/agent-message-continuation.spec.js.map +7 -0
  311. package/dist/esm/lib/v3/tests/agent-streaming.spec.js +126 -0
  312. package/dist/esm/lib/v3/tests/agent-streaming.spec.js.map +7 -0
  313. package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js +44 -0
  314. package/dist/esm/lib/v3/tests/cdp-session-detached.spec.js.map +7 -0
  315. package/dist/esm/lib/v3/tests/click-count.spec.js +112 -0
  316. package/dist/esm/lib/v3/tests/click-count.spec.js.map +7 -0
  317. package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js +54 -0
  318. package/dist/esm/lib/v3/tests/connect-to-existing-browser.spec.js.map +7 -0
  319. package/dist/esm/lib/v3/tests/context-addInitScript.spec.js +176 -0
  320. package/dist/esm/lib/v3/tests/context-addInitScript.spec.js.map +7 -0
  321. package/dist/esm/lib/v3/tests/default-page-tracking.spec.js +53 -0
  322. package/dist/esm/lib/v3/tests/default-page-tracking.spec.js.map +7 -0
  323. package/dist/esm/lib/v3/tests/downloads.spec.js +58 -0
  324. package/dist/esm/lib/v3/tests/downloads.spec.js.map +7 -0
  325. package/dist/esm/lib/v3/tests/envReporter.js +57 -0
  326. package/dist/esm/lib/v3/tests/envReporter.js.map +7 -0
  327. package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js +53 -0
  328. package/dist/esm/lib/v3/tests/frame-get-location-and-click.spec.js.map +7 -0
  329. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js +447 -0
  330. package/dist/esm/lib/v3/tests/iframe-ctx-addInitScript.spec.js.map +7 -0
  331. package/dist/esm/lib/v3/tests/keep-alive.child.js +92 -0
  332. package/dist/esm/lib/v3/tests/keep-alive.child.js.map +7 -0
  333. package/dist/esm/lib/v3/tests/keep-alive.helpers.js +532 -0
  334. package/dist/esm/lib/v3/tests/keep-alive.helpers.js.map +7 -0
  335. package/dist/esm/lib/v3/tests/keep-alive.spec.js +19 -0
  336. package/dist/esm/lib/v3/tests/keep-alive.spec.js.map +7 -0
  337. package/dist/esm/lib/v3/tests/keyboard.spec.js +296 -0
  338. package/dist/esm/lib/v3/tests/keyboard.spec.js.map +7 -0
  339. package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js +159 -0
  340. package/dist/esm/lib/v3/tests/locator-backend-node-id.spec.js.map +7 -0
  341. package/dist/esm/lib/v3/tests/locator-content-methods.spec.js +191 -0
  342. package/dist/esm/lib/v3/tests/locator-content-methods.spec.js.map +7 -0
  343. package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js +108 -0
  344. package/dist/esm/lib/v3/tests/locator-count-iframe.spec.js.map +7 -0
  345. package/dist/esm/lib/v3/tests/locator-count.spec.js +71 -0
  346. package/dist/esm/lib/v3/tests/locator-count.spec.js.map +7 -0
  347. package/dist/esm/lib/v3/tests/locator-fill.spec.js +118 -0
  348. package/dist/esm/lib/v3/tests/locator-fill.spec.js.map +7 -0
  349. package/dist/esm/lib/v3/tests/locator-input-methods.spec.js +136 -0
  350. package/dist/esm/lib/v3/tests/locator-input-methods.spec.js.map +7 -0
  351. package/dist/esm/lib/v3/tests/locator-nth.spec.js +157 -0
  352. package/dist/esm/lib/v3/tests/locator-nth.spec.js.map +7 -0
  353. package/dist/esm/lib/v3/tests/locator-select-option.spec.js +242 -0
  354. package/dist/esm/lib/v3/tests/locator-select-option.spec.js.map +7 -0
  355. package/dist/esm/lib/v3/tests/logger-initialization.spec.js +552 -0
  356. package/dist/esm/lib/v3/tests/logger-initialization.spec.js.map +7 -0
  357. package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js +269 -0
  358. package/dist/esm/lib/v3/tests/multi-instance-logger.spec.js.map +7 -0
  359. package/dist/esm/lib/v3/tests/nested-div.spec.js +23 -0
  360. package/dist/esm/lib/v3/tests/nested-div.spec.js.map +7 -0
  361. package/dist/esm/lib/v3/tests/page-addInitScript.spec.js +90 -0
  362. package/dist/esm/lib/v3/tests/page-addInitScript.spec.js.map +7 -0
  363. package/dist/esm/lib/v3/tests/page-console.spec.js +56 -0
  364. package/dist/esm/lib/v3/tests/page-console.spec.js.map +7 -0
  365. package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js +418 -0
  366. package/dist/esm/lib/v3/tests/page-drag-and-drop.spec.js.map +7 -0
  367. package/dist/esm/lib/v3/tests/page-goto-response.spec.js +35 -0
  368. package/dist/esm/lib/v3/tests/page-goto-response.spec.js.map +7 -0
  369. package/dist/esm/lib/v3/tests/page-hover.spec.js +167 -0
  370. package/dist/esm/lib/v3/tests/page-hover.spec.js.map +7 -0
  371. package/dist/esm/lib/v3/tests/page-screenshot.spec.js +273 -0
  372. package/dist/esm/lib/v3/tests/page-screenshot.spec.js.map +7 -0
  373. package/dist/esm/lib/v3/tests/page-scroll.spec.js +182 -0
  374. package/dist/esm/lib/v3/tests/page-scroll.spec.js.map +7 -0
  375. package/dist/esm/lib/v3/tests/page-send-cdp.spec.js +46 -0
  376. package/dist/esm/lib/v3/tests/page-send-cdp.spec.js.map +7 -0
  377. package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js +98 -0
  378. package/dist/esm/lib/v3/tests/perform-understudy-method.spec.js.map +7 -0
  379. package/dist/esm/lib/v3/tests/setinputfiles.spec.js +126 -0
  380. package/dist/esm/lib/v3/tests/setinputfiles.spec.js.map +7 -0
  381. package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js +134 -0
  382. package/dist/esm/lib/v3/tests/shadow-iframe-oopif.spec.js.map +7 -0
  383. package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js +134 -0
  384. package/dist/esm/lib/v3/tests/shadow-iframe-spif.spec.js.map +7 -0
  385. package/dist/esm/lib/v3/tests/testUtils.js +31 -0
  386. package/dist/esm/lib/v3/tests/testUtils.js.map +7 -0
  387. package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js +100 -0
  388. package/dist/esm/lib/v3/tests/text-selector-innermost.spec.js.map +7 -0
  389. package/dist/esm/lib/v3/tests/timeouts.spec.js +32 -0
  390. package/dist/esm/lib/v3/tests/timeouts.spec.js.map +7 -0
  391. package/dist/esm/lib/v3/tests/user-data-dir.spec.js +43 -0
  392. package/dist/esm/lib/v3/tests/user-data-dir.spec.js.map +7 -0
  393. package/dist/esm/lib/v3/tests/v3.config.js +15 -0
  394. package/dist/esm/lib/v3/tests/v3.config.js.map +7 -0
  395. package/dist/esm/lib/v3/tests/v3.dynamic.config.js +43 -0
  396. package/dist/esm/lib/v3/tests/v3.dynamic.config.js.map +7 -0
  397. package/dist/esm/lib/v3/tests/v3.playwright.config.js +98 -0
  398. package/dist/esm/lib/v3/tests/v3.playwright.config.js.map +7 -0
  399. package/dist/esm/lib/v3/tests/wait-for-selector.spec.js +593 -0
  400. package/dist/esm/lib/v3/tests/wait-for-selector.spec.js.map +7 -0
  401. package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js +97 -0
  402. package/dist/esm/lib/v3/tests/wait-for-timeout.spec.js.map +7 -0
  403. package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js +77 -0
  404. package/dist/esm/lib/v3/tests/xpath-for-location-deep.spec.js.map +7 -0
  405. package/dist/esm/lib/v3/timeoutConfig.d.ts +2 -0
  406. package/dist/esm/lib/v3/timeoutConfig.js +27 -0
  407. package/dist/esm/lib/v3/timeoutConfig.js.map +1 -0
  408. package/dist/esm/lib/v3/types/private/agent.d.ts +6 -0
  409. package/dist/esm/lib/v3/types/private/agent.js +2 -0
  410. package/dist/esm/lib/v3/types/private/agent.js.map +1 -0
  411. package/dist/esm/lib/v3/types/private/api.d.ts +11 -0
  412. package/dist/esm/lib/v3/types/private/api.js +2 -0
  413. package/dist/esm/lib/v3/types/private/api.js.map +1 -0
  414. package/dist/esm/lib/v3/types/private/cache.d.ts +128 -0
  415. package/dist/esm/lib/v3/types/private/cache.js +2 -0
  416. package/dist/esm/lib/v3/types/private/cache.js.map +1 -0
  417. package/dist/esm/lib/v3/types/private/evaluator.d.ts +40 -0
  418. package/dist/esm/lib/v3/types/private/evaluator.js +2 -0
  419. package/dist/esm/lib/v3/types/private/evaluator.js.map +1 -0
  420. package/dist/esm/lib/v3/types/private/handlers.d.ts +38 -0
  421. package/dist/esm/lib/v3/types/private/handlers.js +16 -0
  422. package/dist/esm/lib/v3/types/private/handlers.js.map +1 -0
  423. package/dist/esm/lib/v3/types/private/index.d.ts +7 -0
  424. package/dist/esm/lib/v3/types/private/index.js +8 -0
  425. package/dist/esm/lib/v3/types/private/index.js.map +1 -0
  426. package/dist/esm/lib/v3/types/private/internal.d.ts +39 -0
  427. package/dist/esm/lib/v3/types/private/internal.js +2 -0
  428. package/dist/esm/lib/v3/types/private/internal.js.map +1 -0
  429. package/dist/esm/lib/v3/types/private/locator.d.ts +9 -0
  430. package/dist/esm/lib/v3/types/private/locator.js +2 -0
  431. package/dist/esm/lib/v3/types/private/locator.js.map +1 -0
  432. package/dist/esm/lib/v3/types/private/network.d.ts +34 -0
  433. package/dist/esm/lib/v3/types/private/network.js +3 -0
  434. package/dist/esm/lib/v3/types/private/network.js.map +1 -0
  435. package/dist/esm/lib/v3/types/private/shutdown.d.ts +31 -0
  436. package/dist/esm/lib/v3/types/private/shutdown.js +5 -0
  437. package/dist/esm/lib/v3/types/private/shutdown.js.map +1 -0
  438. package/dist/esm/lib/v3/types/private/shutdownErrors.d.ts +12 -0
  439. package/dist/esm/lib/v3/types/private/shutdownErrors.js +22 -0
  440. package/dist/esm/lib/v3/types/private/shutdownErrors.js.map +1 -0
  441. package/dist/esm/lib/v3/types/private/snapshot.d.ts +117 -0
  442. package/dist/esm/lib/v3/types/private/snapshot.js +2 -0
  443. package/dist/esm/lib/v3/types/private/snapshot.js.map +1 -0
  444. package/dist/esm/lib/v3/types/public/agent.d.ts +595 -0
  445. package/dist/esm/lib/v3/types/public/agent.js +15 -0
  446. package/dist/esm/lib/v3/types/public/agent.js.map +1 -0
  447. package/dist/esm/lib/v3/types/public/api.d.ts +1211 -0
  448. package/dist/esm/lib/v3/types/public/api.js +915 -0
  449. package/dist/esm/lib/v3/types/public/api.js.map +1 -0
  450. package/dist/esm/lib/v3/types/public/apiErrors.d.ts +18 -0
  451. package/dist/esm/lib/v3/types/public/apiErrors.js +32 -0
  452. package/dist/esm/lib/v3/types/public/apiErrors.js.map +1 -0
  453. package/dist/esm/lib/v3/types/public/index.d.ts +12 -0
  454. package/dist/esm/lib/v3/types/public/index.js +14 -0
  455. package/dist/esm/lib/v3/types/public/index.js.map +1 -0
  456. package/dist/esm/lib/v3/types/public/locator.d.ts +9 -0
  457. package/dist/esm/lib/v3/types/public/locator.js +2 -0
  458. package/dist/esm/lib/v3/types/public/locator.js.map +1 -0
  459. package/dist/esm/lib/v3/types/public/logs.d.ts +23 -0
  460. package/dist/esm/lib/v3/types/public/logs.js +13 -0
  461. package/dist/esm/lib/v3/types/public/logs.js.map +1 -0
  462. package/dist/esm/lib/v3/types/public/methods.d.ts +56 -0
  463. package/dist/esm/lib/v3/types/public/methods.js +15 -0
  464. package/dist/esm/lib/v3/types/public/methods.js.map +1 -0
  465. package/dist/esm/lib/v3/types/public/metrics.d.ts +27 -0
  466. package/dist/esm/lib/v3/types/public/metrics.js +2 -0
  467. package/dist/esm/lib/v3/types/public/metrics.js.map +1 -0
  468. package/dist/esm/lib/v3/types/public/model.d.ts +65 -0
  469. package/dist/esm/lib/v3/types/public/model.js +2 -0
  470. package/dist/esm/lib/v3/types/public/model.js.map +1 -0
  471. package/dist/esm/lib/v3/types/public/options.d.ts +70 -0
  472. package/dist/esm/lib/v3/types/public/options.js +4 -0
  473. package/dist/esm/lib/v3/types/public/options.js.map +1 -0
  474. package/dist/esm/lib/v3/types/public/page.d.ts +18 -0
  475. package/dist/esm/lib/v3/types/public/page.js +3 -0
  476. package/dist/esm/lib/v3/types/public/page.js.map +1 -0
  477. package/dist/esm/lib/v3/types/public/screenshotTypes.d.ts +25 -0
  478. package/dist/esm/lib/v3/types/public/screenshotTypes.js +2 -0
  479. package/dist/esm/lib/v3/types/public/screenshotTypes.js.map +1 -0
  480. package/dist/esm/lib/v3/types/public/sdkErrors.d.ts +152 -0
  481. package/dist/esm/lib/v3/types/public/sdkErrors.js +305 -0
  482. package/dist/esm/lib/v3/types/public/sdkErrors.js.map +1 -0
  483. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.d.ts +15 -0
  484. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js +196 -0
  485. package/dist/esm/lib/v3/understudy/a11y/snapshot/a11yTree.js.map +1 -0
  486. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.d.ts +8 -0
  487. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js +121 -0
  488. package/dist/esm/lib/v3/understudy/a11y/snapshot/activeElement.js.map +1 -0
  489. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.d.ts +77 -0
  490. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js +336 -0
  491. package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js.map +1 -0
  492. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.d.ts +7 -0
  493. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js +129 -0
  494. package/dist/esm/lib/v3/understudy/a11y/snapshot/coordinateResolver.js.map +1 -0
  495. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.d.ts +46 -0
  496. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js +274 -0
  497. package/dist/esm/lib/v3/understudy/a11y/snapshot/domTree.js.map +1 -0
  498. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.d.ts +24 -0
  499. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js +216 -0
  500. package/dist/esm/lib/v3/understudy/a11y/snapshot/focusSelectors.js.map +1 -0
  501. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.d.ts +4 -0
  502. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js +5 -0
  503. package/dist/esm/lib/v3/understudy/a11y/snapshot/index.js.map +1 -0
  504. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.d.ts +16 -0
  505. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js +22 -0
  506. package/dist/esm/lib/v3/understudy/a11y/snapshot/sessions.js.map +1 -0
  507. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.d.ts +28 -0
  508. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js +135 -0
  509. package/dist/esm/lib/v3/understudy/a11y/snapshot/treeFormatUtils.js.map +1 -0
  510. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.d.ts +26 -0
  511. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js +102 -0
  512. package/dist/esm/lib/v3/understudy/a11y/snapshot/xpathUtils.js.map +1 -0
  513. package/dist/esm/lib/v3/understudy/a11yInvocation.d.ts +8 -0
  514. package/dist/esm/lib/v3/understudy/a11yInvocation.js +12 -0
  515. package/dist/esm/lib/v3/understudy/a11yInvocation.js.map +1 -0
  516. package/dist/esm/lib/v3/understudy/cdp.d.ts +69 -0
  517. package/dist/esm/lib/v3/understudy/cdp.js +251 -0
  518. package/dist/esm/lib/v3/understudy/cdp.js.map +1 -0
  519. package/dist/esm/lib/v3/understudy/consoleMessage.d.ts +22 -0
  520. package/dist/esm/lib/v3/understudy/consoleMessage.js +66 -0
  521. package/dist/esm/lib/v3/understudy/consoleMessage.js.map +1 -0
  522. package/dist/esm/lib/v3/understudy/context.d.ts +132 -0
  523. package/dist/esm/lib/v3/understudy/context.js +687 -0
  524. package/dist/esm/lib/v3/understudy/context.js.map +1 -0
  525. package/dist/esm/lib/v3/understudy/deepLocator.d.ts +87 -0
  526. package/dist/esm/lib/v3/understudy/deepLocator.js +218 -0
  527. package/dist/esm/lib/v3/understudy/deepLocator.js.map +1 -0
  528. package/dist/esm/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
  529. package/dist/esm/lib/v3/understudy/executionContextRegistry.js +83 -0
  530. package/dist/esm/lib/v3/understudy/executionContextRegistry.js.map +1 -0
  531. package/dist/esm/lib/v3/understudy/fileUploadUtils.d.ts +13 -0
  532. package/dist/esm/lib/v3/understudy/fileUploadUtils.js +81 -0
  533. package/dist/esm/lib/v3/understudy/fileUploadUtils.js.map +1 -0
  534. package/dist/esm/lib/v3/understudy/frame.d.ts +69 -0
  535. package/dist/esm/lib/v3/understudy/frame.js +211 -0
  536. package/dist/esm/lib/v3/understudy/frame.js.map +1 -0
  537. package/dist/esm/lib/v3/understudy/frameLocator.d.ts +50 -0
  538. package/dist/esm/lib/v3/understudy/frameLocator.js +255 -0
  539. package/dist/esm/lib/v3/understudy/frameLocator.js.map +1 -0
  540. package/dist/esm/lib/v3/understudy/frameRegistry.d.ts +101 -0
  541. package/dist/esm/lib/v3/understudy/frameRegistry.js +298 -0
  542. package/dist/esm/lib/v3/understudy/frameRegistry.js.map +1 -0
  543. package/dist/esm/lib/v3/understudy/initScripts.d.ts +2 -0
  544. package/dist/esm/lib/v3/understudy/initScripts.js +33 -0
  545. package/dist/esm/lib/v3/understudy/initScripts.js.map +1 -0
  546. package/dist/esm/lib/v3/understudy/lifecycleWatcher.d.ts +64 -0
  547. package/dist/esm/lib/v3/understudy/lifecycleWatcher.js +245 -0
  548. package/dist/esm/lib/v3/understudy/lifecycleWatcher.js.map +1 -0
  549. package/dist/esm/lib/v3/understudy/locator.d.ts +194 -0
  550. package/dist/esm/lib/v3/understudy/locator.js +753 -0
  551. package/dist/esm/lib/v3/understudy/locator.js.map +1 -0
  552. package/dist/esm/lib/v3/understudy/locatorInvocation.d.ts +8 -0
  553. package/dist/esm/lib/v3/understudy/locatorInvocation.js +12 -0
  554. package/dist/esm/lib/v3/understudy/locatorInvocation.js.map +1 -0
  555. package/dist/esm/lib/v3/understudy/navigationResponseTracker.d.ts +84 -0
  556. package/dist/esm/lib/v3/understudy/navigationResponseTracker.js +224 -0
  557. package/dist/esm/lib/v3/understudy/navigationResponseTracker.js.map +1 -0
  558. package/dist/esm/lib/v3/understudy/networkManager.d.ts +53 -0
  559. package/dist/esm/lib/v3/understudy/networkManager.js +306 -0
  560. package/dist/esm/lib/v3/understudy/networkManager.js.map +1 -0
  561. package/dist/esm/lib/v3/understudy/page.d.ts +354 -0
  562. package/dist/esm/lib/v3/understudy/page.js +1941 -0
  563. package/dist/esm/lib/v3/understudy/page.js.map +1 -0
  564. package/dist/esm/lib/v3/understudy/piercer.d.ts +4 -0
  565. package/dist/esm/lib/v3/understudy/piercer.js +61 -0
  566. package/dist/esm/lib/v3/understudy/piercer.js.map +1 -0
  567. package/dist/esm/lib/v3/understudy/response.d.ts +137 -0
  568. package/dist/esm/lib/v3/understudy/response.js +330 -0
  569. package/dist/esm/lib/v3/understudy/response.js.map +1 -0
  570. package/dist/esm/lib/v3/understudy/screenshotUtils.d.ts +16 -0
  571. package/dist/esm/lib/v3/understudy/screenshotUtils.js +352 -0
  572. package/dist/esm/lib/v3/understudy/screenshotUtils.js.map +1 -0
  573. package/dist/esm/lib/v3/understudy/selectorResolver.d.ts +38 -0
  574. package/dist/esm/lib/v3/understudy/selectorResolver.js +296 -0
  575. package/dist/esm/lib/v3/understudy/selectorResolver.js.map +1 -0
  576. package/dist/esm/lib/v3/v3.d.ts +191 -0
  577. package/dist/esm/lib/v3/v3.js +1572 -0
  578. package/dist/esm/lib/v3/v3.js.map +1 -0
  579. package/dist/esm/lib/v3/zodCompat.d.ts +12 -0
  580. package/dist/esm/lib/v3/zodCompat.js +17 -0
  581. package/dist/esm/lib/v3/zodCompat.js.map +1 -0
  582. package/dist/esm/lib/v3Evaluator.d.ts +19 -0
  583. package/dist/esm/lib/v3Evaluator.js +210 -0
  584. package/dist/esm/lib/v3Evaluator.js.map +1 -0
  585. package/dist/esm/lib/version.d.ts +5 -0
  586. package/dist/esm/lib/version.js +6 -0
  587. package/dist/esm/lib/version.js.map +1 -0
  588. package/dist/esm/package.json +3 -0
  589. package/dist/esm/tests/agent-execution-model.test.js +139 -0
  590. package/dist/esm/tests/agent-execution-model.test.js.map +7 -0
  591. package/dist/esm/tests/browserbase-session-accessors.test.js +101 -0
  592. package/dist/esm/tests/browserbase-session-accessors.test.js.map +7 -0
  593. package/dist/esm/tests/cache-llm-resolution.test.js +187 -0
  594. package/dist/esm/tests/cache-llm-resolution.test.js.map +7 -0
  595. package/dist/esm/tests/helpers/mockCDPSession.js +27 -0
  596. package/dist/esm/tests/helpers/mockCDPSession.js.map +7 -0
  597. package/dist/esm/tests/llm-provider.test.js +57 -0
  598. package/dist/esm/tests/llm-provider.test.js.map +7 -0
  599. package/dist/esm/tests/model-deprecation.test.js +135 -0
  600. package/dist/esm/tests/model-deprecation.test.js.map +7 -0
  601. package/dist/esm/tests/model-utils.test.js +43 -0
  602. package/dist/esm/tests/model-utils.test.js.map +7 -0
  603. package/dist/esm/tests/page-snapshot.test.js +36 -0
  604. package/dist/esm/tests/page-snapshot.test.js.map +7 -0
  605. package/dist/esm/tests/public-api/export-surface.test.js +53 -0
  606. package/dist/esm/tests/public-api/export-surface.test.js.map +7 -0
  607. package/dist/esm/tests/public-api/llm-and-agents.test.js +128 -0
  608. package/dist/esm/tests/public-api/llm-and-agents.test.js.map +7 -0
  609. package/dist/esm/tests/public-api/public-error-types.test.js +71 -0
  610. package/dist/esm/tests/public-api/public-error-types.test.js.map +7 -0
  611. package/dist/esm/tests/public-api/public-types.test.js +74 -0
  612. package/dist/esm/tests/public-api/public-types.test.js.map +7 -0
  613. package/dist/esm/tests/public-api/runtime-utils.test.js +31 -0
  614. package/dist/esm/tests/public-api/runtime-utils.test.js.map +7 -0
  615. package/dist/esm/tests/public-api/schema-utils.test.js +78 -0
  616. package/dist/esm/tests/public-api/schema-utils.test.js.map +7 -0
  617. package/dist/esm/tests/public-api/timeout-error-types.test.js +81 -0
  618. package/dist/esm/tests/public-api/timeout-error-types.test.js.map +7 -0
  619. package/dist/esm/tests/public-api/tool-type-export.test.js +25 -0
  620. package/dist/esm/tests/public-api/tool-type-export.test.js.map +7 -0
  621. package/dist/esm/tests/public-api/v3-core.test.js +82 -0
  622. package/dist/esm/tests/public-api/v3-core.test.js.map +7 -0
  623. package/dist/esm/tests/safety-confirmation.test.js +134 -0
  624. package/dist/esm/tests/safety-confirmation.test.js.map +7 -0
  625. package/dist/esm/tests/snapshot-a11y-resolvers.test.js +348 -0
  626. package/dist/esm/tests/snapshot-a11y-resolvers.test.js.map +7 -0
  627. package/dist/esm/tests/snapshot-a11y-tree-utils.test.js +300 -0
  628. package/dist/esm/tests/snapshot-a11y-tree-utils.test.js.map +7 -0
  629. package/dist/esm/tests/snapshot-capture-orchestration.test.js +381 -0
  630. package/dist/esm/tests/snapshot-capture-orchestration.test.js.map +7 -0
  631. package/dist/esm/tests/snapshot-cbor.test.js +197 -0
  632. package/dist/esm/tests/snapshot-cbor.test.js.map +7 -0
  633. package/dist/esm/tests/snapshot-dom-session-builders.test.js +251 -0
  634. package/dist/esm/tests/snapshot-dom-session-builders.test.js.map +7 -0
  635. package/dist/esm/tests/snapshot-dom-tree-utils.test.js +109 -0
  636. package/dist/esm/tests/snapshot-dom-tree-utils.test.js.map +7 -0
  637. package/dist/esm/tests/snapshot-focus-selectors-utils.test.js +49 -0
  638. package/dist/esm/tests/snapshot-focus-selectors-utils.test.js.map +7 -0
  639. package/dist/esm/tests/snapshot-frame-merge.test.js +391 -0
  640. package/dist/esm/tests/snapshot-frame-merge.test.js.map +7 -0
  641. package/dist/esm/tests/snapshot-tree-format-utils.test.js +113 -0
  642. package/dist/esm/tests/snapshot-tree-format-utils.test.js.map +7 -0
  643. package/dist/esm/tests/snapshot-xpath-utils.test.js +79 -0
  644. package/dist/esm/tests/snapshot-xpath-utils.test.js.map +7 -0
  645. package/dist/esm/tests/timeout-handlers.test.js +850 -0
  646. package/dist/esm/tests/timeout-handlers.test.js.map +7 -0
  647. package/dist/esm/tests/xpath-parser.test.js +317 -0
  648. package/dist/esm/tests/xpath-parser.test.js.map +7 -0
  649. package/dist/esm/tests/xpath-resolver.test.js +73 -0
  650. package/dist/esm/tests/xpath-resolver.test.js.map +7 -0
  651. package/dist/esm/tests/zod-enum-compatibility.test.js +97 -0
  652. package/dist/esm/tests/zod-enum-compatibility.test.js.map +7 -0
  653. package/package.json +37 -24
  654. package/dist/index.d.ts +0 -4363
  655. package/dist/index.js +0 -76530
@@ -0,0 +1,230 @@
1
+ export function buildUserInstructionsString(userProvidedInstructions) {
2
+ if (!userProvidedInstructions) {
3
+ return "";
4
+ }
5
+ return `\n\n# Custom Instructions Provided by the User
6
+
7
+ Please keep the user's instructions in mind when performing actions. If the user's instructions are not relevant to the current task, ignore them.
8
+
9
+ User Instructions:
10
+ ${userProvidedInstructions}`;
11
+ }
12
+ // extract
13
+ export function buildExtractSystemPrompt(isUsingPrintExtractedDataTool = false, userProvidedInstructions) {
14
+ const baseContent = `You are extracting content on behalf of a user.
15
+ If a user asks you to extract a 'list' of information, or 'all' information,
16
+ YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS.
17
+
18
+ You will be given:
19
+ 1. An instruction
20
+ 2. `;
21
+ const contentDetail = `A list of DOM elements to extract from.`;
22
+ const instructions = `
23
+ Print the exact text from the DOM elements with all symbols, characters, and endlines as is.
24
+ Print null or an empty string if no new information is found.
25
+ `.trim();
26
+ const toolInstructions = isUsingPrintExtractedDataTool
27
+ ? `
28
+ ONLY print the content using the print_extracted_data tool provided.
29
+ ONLY print the content using the print_extracted_data tool provided.
30
+ `.trim()
31
+ : "";
32
+ const additionalInstructions = "If a user is attempting to extract links or URLs, you MUST respond with ONLY the IDs of the link elements. \n" +
33
+ "Do not attempt to extract links directly from the text unless absolutely necessary. ";
34
+ const userInstructions = buildUserInstructionsString(userProvidedInstructions);
35
+ const content = `${baseContent}${contentDetail}\n\n${instructions}\n${toolInstructions}${additionalInstructions ? `\n\n${additionalInstructions}` : ""}${userInstructions ? `\n\n${userInstructions}` : ""}`.replace(/\s+/g, " ");
36
+ return {
37
+ role: "system",
38
+ content,
39
+ };
40
+ }
41
+ export function buildExtractUserPrompt(instruction, domElements, isUsingPrintExtractedDataTool = false) {
42
+ let content = `Instruction: ${instruction}
43
+ DOM: ${domElements}`;
44
+ if (isUsingPrintExtractedDataTool) {
45
+ content += `
46
+ ONLY print the content using the print_extracted_data tool provided.
47
+ ONLY print the content using the print_extracted_data tool provided.`;
48
+ }
49
+ return {
50
+ role: "user",
51
+ content,
52
+ };
53
+ }
54
+ const metadataSystemPrompt = `You are an AI assistant tasked with evaluating the progress and completion status of an extraction task.
55
+ Analyze the extraction response and determine if the task is completed or if more information is needed.
56
+ Strictly abide by the following criteria:
57
+ 1. Once the instruction has been satisfied by the current extraction response, ALWAYS set completion status to true and stop processing, regardless of remaining chunks.
58
+ 2. Only set completion status to false if BOTH of these conditions are true:
59
+ - The instruction has not been satisfied yet
60
+ - There are still chunks left to process (chunksTotal > chunksSeen)`;
61
+ export function buildMetadataSystemPrompt() {
62
+ return {
63
+ role: "system",
64
+ content: metadataSystemPrompt,
65
+ };
66
+ }
67
+ export function buildMetadataPrompt(instruction, extractionResponse) {
68
+ return {
69
+ role: "user",
70
+ content: `Instruction: ${instruction}
71
+ Extracted content: ${JSON.stringify(extractionResponse, null, 2)}`,
72
+ };
73
+ }
74
+ // observe
75
+ export function buildObserveSystemPrompt(userProvidedInstructions, supportedActions) {
76
+ const actionsString = supportedActions?.length
77
+ ? `\n\nSupported actions: ${supportedActions.join(", ")}`
78
+ : "";
79
+ const observeSystemPrompt = `
80
+ You are helping the user automate the browser by finding elements based on what the user wants to observe in the page.
81
+
82
+ You will be given:
83
+ 1. a instruction of elements to observe
84
+ 2. a hierarchical accessibility tree showing the semantic structure of the page. The tree is a hybrid of the DOM and the accessibility tree.
85
+
86
+ Return an array of elements that match the instruction if they exist, otherwise return an empty array.
87
+ When returning elements, include the appropriate method from the supported actions list.${actionsString}. When choosing non-left click actions, provide right or middle as the argument.`;
88
+ const content = observeSystemPrompt.replace(/\s+/g, " ");
89
+ return {
90
+ role: "system",
91
+ content: [content, buildUserInstructionsString(userProvidedInstructions)]
92
+ .filter(Boolean)
93
+ .join("\n\n"),
94
+ };
95
+ }
96
+ export function buildObserveUserMessage(instruction, domElements) {
97
+ return {
98
+ role: "user",
99
+ content: `instruction: ${instruction}
100
+ Accessibility Tree: \n${domElements}\n`,
101
+ };
102
+ }
103
+ export function buildActSystemPrompt(userProvidedInstructions) {
104
+ const actSystemPrompt = `
105
+ You are helping the user automate the browser by finding elements based on what action the user wants to take on the page
106
+
107
+ You will be given:
108
+ 1. a user defined instruction about what action to take
109
+ 2. a hierarchical accessibility tree showing the semantic structure of the page. The tree is a hybrid of the DOM and the accessibility tree.
110
+
111
+ Return the element that matches the instruction if it exists. Otherwise, return an empty object.`;
112
+ const content = actSystemPrompt.replace(/\s+/g, " ");
113
+ return {
114
+ role: "system",
115
+ content: [content, buildUserInstructionsString(userProvidedInstructions)]
116
+ .filter(Boolean)
117
+ .join("\n\n"),
118
+ };
119
+ }
120
+ export function buildActPrompt(action, supportedActions, variables) {
121
+ // Base instruction
122
+ let instruction = `Find the most relevant element to perform an action on given the following action: ${action}.
123
+ IF AND ONLY IF the action EXPLICITLY includes the word 'dropdown' and implies choosing/selecting an option from a dropdown, ignore the 'General Instructions' section, and follow the 'Dropdown Specific Instructions' section carefully.
124
+
125
+ General Instructions:
126
+ Provide an action for this element such as ${supportedActions.join(", ")}. Remember that to users, buttons and links look the same in most cases.
127
+ When choosing non-left click actions, provide right or middle as the argument
128
+ If the action is completely unrelated to a potential action to be taken on the page, return an empty object.
129
+ ONLY return one action. If multiple actions are relevant, return the most relevant one.
130
+ If the user is asking to scroll to a position on the page, e.g., 'halfway' or 0.75, etc, you must return the argument formatted as the correct percentage, e.g., '50%' or '75%', etc.
131
+ If the user is asking to scroll to the next chunk/previous chunk, choose the nextChunk/prevChunk method. No arguments are required here.
132
+ If the action implies a key press, e.g., 'press enter', 'press a', 'press space', etc., always choose the press method with the appropriate key as argument — e.g. 'a', 'Enter', 'Space'. Do not choose a click action on an on-screen keyboard. Capitalize the first character like 'Enter', 'Tab', 'Escape' only for special keys.
133
+
134
+ Dropdown Specific Instructions:
135
+ For interacting with dropdowns, there are two specific cases that you need to handle.
136
+
137
+ CASE 1: the element is a 'select' element.
138
+ - choose the selectOptionFromDropdown method,
139
+ - set the argument to the exact text of the option that should be selected,
140
+ - set twoStep to false.
141
+ CASE 2: the element is NOT a 'select' element:
142
+ - do not attempt to directly choose the element from the dropdown. You will need to click to expand the dropdown first. You will achieve this by following these instructions:
143
+ - choose the node that most closely corresponds to the given instruction EVEN if it is a 'StaticText' element, or otherwise does not appear to be interactable.
144
+ - choose the 'click' method
145
+ - set twoStep to true.
146
+ `;
147
+ // Add variable names (not values) to the instruction if any
148
+ if (variables && Object.keys(variables).length > 0) {
149
+ const variableNames = Object.keys(variables)
150
+ .map((key) => `%${key}%`)
151
+ .join(", ");
152
+ const variablesPrompt = `The following variables are available to use in the action: ${variableNames}. Fill the argument variables with the variable name.`;
153
+ instruction += ` ${variablesPrompt}`;
154
+ }
155
+ return instruction;
156
+ }
157
+ export function buildStepTwoPrompt(originalUserAction, previousAction, supportedActions, variables) {
158
+ // Base instruction
159
+ let instruction = `
160
+ The original user action was: ${originalUserAction}.
161
+ You have just taken the following action which completed step 1 of 2: ${previousAction}.
162
+
163
+ Now, you must find the most relevant element to perform an action on in order to complete step 2 of 2.
164
+
165
+ General Instructions:
166
+ Provide an action for this element such as ${supportedActions.join(", ")}. Remember that to users, buttons and links look the same in most cases.
167
+ If the action is completely unrelated to a potential action to be taken on the page, return an empty object.
168
+ ONLY return one action. If multiple actions are relevant, return the most relevant one.
169
+ If the user is asking to scroll to a position on the page, e.g., 'halfway' or 0.75, etc, you must return the argument formatted as the correct percentage, e.g., '50%' or '75%', etc.
170
+ If the user is asking to scroll to the next chunk/previous chunk, choose the nextChunk/prevChunk method. No arguments are required here.
171
+ If the action implies a key press, e.g., 'press enter', 'press a', 'press space', etc., always choose the press method with the appropriate key as argument — e.g. 'a', 'Enter', 'Space'. Do not choose a click action on an on-screen keyboard. Capitalize the first character like 'Enter', 'Tab', 'Escape' only for special keys.
172
+ `;
173
+ // Add variable names (not values) to the instruction if any
174
+ if (variables && Object.keys(variables).length > 0) {
175
+ const variableNames = Object.keys(variables)
176
+ .map((key) => `%${key}%`)
177
+ .join(", ");
178
+ const variablesPrompt = `The following variables are available to use in the action: ${variableNames}. Fill the argument variables with the variable name.`;
179
+ instruction += ` ${variablesPrompt}`;
180
+ }
181
+ return instruction;
182
+ }
183
+ export function buildOperatorSystemPrompt(goal) {
184
+ return {
185
+ role: "system",
186
+ content: `You are a general-purpose agent whose job is to accomplish the user's goal across multiple model calls by running actions on the page.
187
+
188
+ You will be given a goal and a list of steps that have been taken so far. Your job is to determine if either the user's goal has been completed or if there are still steps that need to be taken.
189
+
190
+ # Your current goal
191
+ ${goal}
192
+
193
+ # CRITICAL: You MUST use the provided tools to take actions. Do not just describe what you want to do - actually call the appropriate tools.
194
+
195
+ # Available tools and when to use them:
196
+ - \`act\`: Use this to interact with the page (click, type, navigate, etc.)
197
+ - \`extract\`: Use this to get information from the page
198
+ - \`goto\`: Use this to navigate to a specific URL
199
+ - \`wait\`: Use this to wait for a period of time
200
+ - \`navback\`: Use this to go back to the previous page
201
+ - \`refresh\`: Use this to refresh the current page
202
+ - \`close\`: Use this ONLY when the task is complete or cannot be achieved
203
+ - External tools: Use any additional tools (like search tools) as needed for your goal
204
+
205
+ # Important guidelines
206
+ 1. ALWAYS use tools - never just provide text responses about what you plan to do
207
+ 2. Break down complex actions into individual atomic steps
208
+ 3. For \`act\` commands, use only one action at a time, such as:
209
+ - Single click on a specific element
210
+ - Type into a single input field
211
+ - Select a single option
212
+ 4. Avoid combining multiple actions in one instruction
213
+ 5. If multiple actions are needed, they should be separate steps
214
+ 6. Only use \`close\` when the task is genuinely complete or impossible to achieve`,
215
+ };
216
+ }
217
+ export function buildCuaDefaultSystemPrompt() {
218
+ return `You are a helpful assistant that can use a web browser.\nDo not ask follow up questions, the user will trust your judgement. Today's date is ${new Date().toISOString().split("T")[0]}.`;
219
+ }
220
+ export function buildGoogleCUASystemPrompt() {
221
+ return {
222
+ role: "system",
223
+ content: `You are a general-purpose browser agent whose job is to accomplish the user's goal.
224
+ Today's date is ${new Date().toISOString().split("T")[0]}.
225
+ You have access to a search tool; however, in most cases you should operate within the page/url the user has provided. ONLY use the search tool if you're stuck or the task is impossible to complete within the current page.
226
+ You will be given a goal and a list of steps that have been taken so far. Avoid requesting the user for input as much as possible. Good luck!
227
+ `,
228
+ };
229
+ }
230
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../lib/prompt.ts"],"names":[],"mappings":"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","sourcesContent":["import { ChatMessage } from \"./v3/llm/LLMClient.js\";\n\nexport function buildUserInstructionsString(\n userProvidedInstructions?: string,\n): string {\n if (!userProvidedInstructions) {\n return \"\";\n }\n\n return `\\n\\n# Custom Instructions Provided by the User\n \nPlease keep the user's instructions in mind when performing actions. If the user's instructions are not relevant to the current task, ignore them.\n\nUser Instructions:\n${userProvidedInstructions}`;\n}\n\n// extract\nexport function buildExtractSystemPrompt(\n isUsingPrintExtractedDataTool: boolean = false,\n userProvidedInstructions?: string,\n): ChatMessage {\n const baseContent = `You are extracting content on behalf of a user.\n If a user asks you to extract a 'list' of information, or 'all' information, \n YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS.\n \n You will be given:\n1. An instruction\n2. `;\n\n const contentDetail = `A list of DOM elements to extract from.`;\n\n const instructions = `\nPrint the exact text from the DOM elements with all symbols, characters, and endlines as is.\nPrint null or an empty string if no new information is found.\n `.trim();\n\n const toolInstructions = isUsingPrintExtractedDataTool\n ? `\nONLY print the content using the print_extracted_data tool provided.\nONLY print the content using the print_extracted_data tool provided.\n `.trim()\n : \"\";\n\n const additionalInstructions =\n \"If a user is attempting to extract links or URLs, you MUST respond with ONLY the IDs of the link elements. \\n\" +\n \"Do not attempt to extract links directly from the text unless absolutely necessary. \";\n\n const userInstructions = buildUserInstructionsString(\n userProvidedInstructions,\n );\n\n const content =\n `${baseContent}${contentDetail}\\n\\n${instructions}\\n${toolInstructions}${\n additionalInstructions ? `\\n\\n${additionalInstructions}` : \"\"\n }${userInstructions ? `\\n\\n${userInstructions}` : \"\"}`.replace(/\\s+/g, \" \");\n\n return {\n role: \"system\",\n content,\n };\n}\n\nexport function buildExtractUserPrompt(\n instruction: string,\n domElements: string,\n isUsingPrintExtractedDataTool: boolean = false,\n): ChatMessage {\n let content = `Instruction: ${instruction}\nDOM: ${domElements}`;\n\n if (isUsingPrintExtractedDataTool) {\n content += `\nONLY print the content using the print_extracted_data tool provided.\nONLY print the content using the print_extracted_data tool provided.`;\n }\n\n return {\n role: \"user\",\n content,\n };\n}\n\nconst metadataSystemPrompt = `You are an AI assistant tasked with evaluating the progress and completion status of an extraction task.\nAnalyze the extraction response and determine if the task is completed or if more information is needed.\nStrictly abide by the following criteria:\n1. Once the instruction has been satisfied by the current extraction response, ALWAYS set completion status to true and stop processing, regardless of remaining chunks.\n2. Only set completion status to false if BOTH of these conditions are true:\n - The instruction has not been satisfied yet\n - There are still chunks left to process (chunksTotal > chunksSeen)`;\n\nexport function buildMetadataSystemPrompt(): ChatMessage {\n return {\n role: \"system\",\n content: metadataSystemPrompt,\n };\n}\n\nexport function buildMetadataPrompt(\n instruction: string,\n extractionResponse: object,\n): ChatMessage {\n return {\n role: \"user\",\n content: `Instruction: ${instruction}\nExtracted content: ${JSON.stringify(extractionResponse, null, 2)}`,\n };\n}\n\n// observe\nexport function buildObserveSystemPrompt(\n userProvidedInstructions?: string,\n supportedActions?: string[],\n): ChatMessage {\n const actionsString = supportedActions?.length\n ? `\\n\\nSupported actions: ${supportedActions.join(\", \")}`\n : \"\";\n\n const observeSystemPrompt = `\nYou are helping the user automate the browser by finding elements based on what the user wants to observe in the page.\n\nYou will be given:\n1. a instruction of elements to observe\n2. a hierarchical accessibility tree showing the semantic structure of the page. The tree is a hybrid of the DOM and the accessibility tree.\n\nReturn an array of elements that match the instruction if they exist, otherwise return an empty array.\nWhen returning elements, include the appropriate method from the supported actions list.${actionsString}. When choosing non-left click actions, provide right or middle as the argument.`;\n const content = observeSystemPrompt.replace(/\\s+/g, \" \");\n\n return {\n role: \"system\",\n content: [content, buildUserInstructionsString(userProvidedInstructions)]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n };\n}\n\nexport function buildObserveUserMessage(\n instruction: string,\n domElements: string,\n): ChatMessage {\n return {\n role: \"user\",\n content: `instruction: ${instruction}\nAccessibility Tree: \\n${domElements}\\n`,\n };\n}\n\nexport function buildActSystemPrompt(\n userProvidedInstructions?: string,\n): ChatMessage {\n const actSystemPrompt = `\nYou are helping the user automate the browser by finding elements based on what action the user wants to take on the page\n\nYou will be given:\n1. a user defined instruction about what action to take\n2. a hierarchical accessibility tree showing the semantic structure of the page. The tree is a hybrid of the DOM and the accessibility tree.\n\nReturn the element that matches the instruction if it exists. Otherwise, return an empty object.`;\n const content = actSystemPrompt.replace(/\\s+/g, \" \");\n\n return {\n role: \"system\",\n content: [content, buildUserInstructionsString(userProvidedInstructions)]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n };\n}\n\nexport function buildActPrompt(\n action: string,\n supportedActions: string[],\n variables?: Record<string, string>,\n): string {\n // Base instruction\n let instruction = `Find the most relevant element to perform an action on given the following action: ${action}. \n IF AND ONLY IF the action EXPLICITLY includes the word 'dropdown' and implies choosing/selecting an option from a dropdown, ignore the 'General Instructions' section, and follow the 'Dropdown Specific Instructions' section carefully.\n \n General Instructions: \n Provide an action for this element such as ${supportedActions.join(\", \")}. Remember that to users, buttons and links look the same in most cases.\n When choosing non-left click actions, provide right or middle as the argument\n If the action is completely unrelated to a potential action to be taken on the page, return an empty object. \n ONLY return one action. If multiple actions are relevant, return the most relevant one. \n If the user is asking to scroll to a position on the page, e.g., 'halfway' or 0.75, etc, you must return the argument formatted as the correct percentage, e.g., '50%' or '75%', etc.\n If the user is asking to scroll to the next chunk/previous chunk, choose the nextChunk/prevChunk method. No arguments are required here.\n If the action implies a key press, e.g., 'press enter', 'press a', 'press space', etc., always choose the press method with the appropriate key as argument — e.g. 'a', 'Enter', 'Space'. Do not choose a click action on an on-screen keyboard. Capitalize the first character like 'Enter', 'Tab', 'Escape' only for special keys. \n \n Dropdown Specific Instructions:\n For interacting with dropdowns, there are two specific cases that you need to handle. \n \n CASE 1: the element is a 'select' element. \n - choose the selectOptionFromDropdown method,\n - set the argument to the exact text of the option that should be selected,\n - set twoStep to false.\n CASE 2: the element is NOT a 'select' element:\n - do not attempt to directly choose the element from the dropdown. You will need to click to expand the dropdown first. You will achieve this by following these instructions:\n - choose the node that most closely corresponds to the given instruction EVEN if it is a 'StaticText' element, or otherwise does not appear to be interactable. \n - choose the 'click' method\n - set twoStep to true.\n `;\n\n // Add variable names (not values) to the instruction if any\n if (variables && Object.keys(variables).length > 0) {\n const variableNames = Object.keys(variables)\n .map((key) => `%${key}%`)\n .join(\", \");\n const variablesPrompt = `The following variables are available to use in the action: ${variableNames}. Fill the argument variables with the variable name.`;\n instruction += ` ${variablesPrompt}`;\n }\n\n return instruction;\n}\n\nexport function buildStepTwoPrompt(\n originalUserAction: string,\n previousAction: string,\n supportedActions: string[],\n variables?: Record<string, string>,\n): string {\n // Base instruction\n let instruction = `\n The original user action was: ${originalUserAction}.\n You have just taken the following action which completed step 1 of 2: ${previousAction}.\n \n Now, you must find the most relevant element to perform an action on in order to complete step 2 of 2. \n \n General Instructions: \n Provide an action for this element such as ${supportedActions.join(\", \")}. Remember that to users, buttons and links look the same in most cases.\n If the action is completely unrelated to a potential action to be taken on the page, return an empty object. \n ONLY return one action. If multiple actions are relevant, return the most relevant one. \n If the user is asking to scroll to a position on the page, e.g., 'halfway' or 0.75, etc, you must return the argument formatted as the correct percentage, e.g., '50%' or '75%', etc.\n If the user is asking to scroll to the next chunk/previous chunk, choose the nextChunk/prevChunk method. No arguments are required here.\n If the action implies a key press, e.g., 'press enter', 'press a', 'press space', etc., always choose the press method with the appropriate key as argument — e.g. 'a', 'Enter', 'Space'. Do not choose a click action on an on-screen keyboard. Capitalize the first character like 'Enter', 'Tab', 'Escape' only for special keys. \n `;\n\n // Add variable names (not values) to the instruction if any\n if (variables && Object.keys(variables).length > 0) {\n const variableNames = Object.keys(variables)\n .map((key) => `%${key}%`)\n .join(\", \");\n const variablesPrompt = `The following variables are available to use in the action: ${variableNames}. Fill the argument variables with the variable name.`;\n instruction += ` ${variablesPrompt}`;\n }\n\n return instruction;\n}\n\nexport function buildOperatorSystemPrompt(goal: string): ChatMessage {\n return {\n role: \"system\",\n content: `You are a general-purpose agent whose job is to accomplish the user's goal across multiple model calls by running actions on the page.\n\nYou will be given a goal and a list of steps that have been taken so far. Your job is to determine if either the user's goal has been completed or if there are still steps that need to be taken.\n\n# Your current goal\n${goal}\n\n# CRITICAL: You MUST use the provided tools to take actions. Do not just describe what you want to do - actually call the appropriate tools.\n\n# Available tools and when to use them:\n- \\`act\\`: Use this to interact with the page (click, type, navigate, etc.)\n- \\`extract\\`: Use this to get information from the page\n- \\`goto\\`: Use this to navigate to a specific URL\n- \\`wait\\`: Use this to wait for a period of time\n- \\`navback\\`: Use this to go back to the previous page\n- \\`refresh\\`: Use this to refresh the current page\n- \\`close\\`: Use this ONLY when the task is complete or cannot be achieved\n- External tools: Use any additional tools (like search tools) as needed for your goal\n\n# Important guidelines\n1. ALWAYS use tools - never just provide text responses about what you plan to do\n2. Break down complex actions into individual atomic steps\n3. For \\`act\\` commands, use only one action at a time, such as:\n - Single click on a specific element\n - Type into a single input field\n - Select a single option\n4. Avoid combining multiple actions in one instruction\n5. If multiple actions are needed, they should be separate steps\n6. Only use \\`close\\` when the task is genuinely complete or impossible to achieve`,\n };\n}\n\nexport function buildCuaDefaultSystemPrompt(): string {\n return `You are a helpful assistant that can use a web browser.\\nDo not ask follow up questions, the user will trust your judgement. Today's date is ${new Date().toISOString().split(\"T\")[0]}.`;\n}\n\nexport function buildGoogleCUASystemPrompt(): ChatMessage {\n return {\n role: \"system\",\n content: `You are a general-purpose browser agent whose job is to accomplish the user's goal.\nToday's date is ${new Date().toISOString().split(\"T\")[0]}.\nYou have access to a search tool; however, in most cases you should operate within the page/url the user has provided. ONLY use the search tool if you're stuck or the task is impossible to complete within the current page.\nYou will be given a goal and a list of steps that have been taken so far. Avoid requesting the user for input as much as possible. Good luck!\n`,\n };\n}\n"]}
@@ -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;