@skyvern/client 1.0.0 → 1.0.3

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 (311) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Client.d.ts +75 -6
  3. package/dist/cjs/Client.js +328 -14
  4. package/dist/cjs/api/client/requests/CreateCredentialRequest.d.ts +1 -1
  5. package/dist/cjs/api/client/requests/DownloadFilesRequest.d.ts +37 -0
  6. package/dist/cjs/api/{resources/browserProfiles/client/requests/ListBrowserProfilesV1BrowserProfilesGetRequest.d.ts → client/requests/ListBrowserProfilesRequest.d.ts} +1 -1
  7. package/dist/cjs/api/client/requests/LoginRequest.d.ts +8 -6
  8. package/dist/cjs/api/client/requests/index.d.ts +3 -0
  9. package/dist/cjs/api/errors/ConflictError.d.ts +5 -0
  10. package/dist/cjs/api/errors/ConflictError.js +50 -0
  11. package/dist/cjs/api/errors/index.d.ts +1 -0
  12. package/dist/cjs/api/errors/index.js +1 -0
  13. package/dist/cjs/api/resources/index.d.ts +0 -4
  14. package/dist/cjs/api/resources/index.js +1 -8
  15. package/dist/cjs/api/types/ActionBlock.d.ts +4 -1
  16. package/dist/cjs/api/types/ActionBlockYaml.d.ts +4 -1
  17. package/dist/cjs/api/types/ActionType.d.ts +1 -0
  18. package/dist/cjs/api/types/ActionType.js +1 -0
  19. package/dist/cjs/api/types/BlockType.d.ts +1 -0
  20. package/dist/cjs/api/types/BlockType.js +1 -0
  21. package/dist/cjs/api/types/BranchCondition.d.ts +11 -0
  22. package/dist/cjs/api/types/BranchConditionCriteria.d.ts +10 -0
  23. package/dist/cjs/api/types/BranchConditionYaml.d.ts +7 -0
  24. package/dist/cjs/api/types/BranchCriteriaYaml.d.ts +12 -0
  25. package/dist/cjs/api/types/BranchCriteriaYaml.js +11 -0
  26. package/dist/cjs/api/types/CodeBlock.d.ts +4 -0
  27. package/dist/cjs/api/types/CodeBlockYaml.d.ts +4 -0
  28. package/dist/cjs/api/types/ConditionalBlock.d.ts +16 -0
  29. package/dist/cjs/api/types/ConditionalBlockYaml.d.ts +11 -0
  30. package/dist/cjs/api/types/CredentialResponse.d.ts +1 -1
  31. package/dist/cjs/api/types/CredentialTypeOutput.d.ts +1 -0
  32. package/dist/cjs/api/types/CredentialTypeOutput.js +1 -0
  33. package/dist/cjs/api/types/DownloadToS3Block.d.ts +4 -0
  34. package/dist/cjs/api/types/DownloadToS3BlockYaml.d.ts +4 -0
  35. package/dist/cjs/api/types/ExtractionBlock.d.ts +4 -1
  36. package/dist/cjs/api/types/ExtractionBlockYaml.d.ts +4 -1
  37. package/dist/cjs/api/types/FileDownloadBlock.d.ts +4 -1
  38. package/dist/cjs/api/types/FileDownloadBlockYaml.d.ts +4 -1
  39. package/dist/cjs/api/types/FileParserBlock.d.ts +4 -0
  40. package/dist/cjs/api/types/FileParserBlockYaml.d.ts +4 -0
  41. package/dist/cjs/api/types/FileUploadBlock.d.ts +4 -0
  42. package/dist/cjs/api/types/FileUploadBlockYaml.d.ts +4 -0
  43. package/dist/cjs/api/types/ForLoopBlock.d.ts +4 -0
  44. package/dist/cjs/api/types/ForLoopBlockLoopBlocksItem.d.ts +4 -1
  45. package/dist/cjs/api/types/ForLoopBlockYaml.d.ts +4 -0
  46. package/dist/cjs/api/types/ForLoopBlockYamlLoopBlocksItem.d.ts +4 -1
  47. package/dist/cjs/api/types/GeoTarget.d.ts +21 -0
  48. package/dist/cjs/api/types/GeoTarget.js +3 -0
  49. package/dist/cjs/api/types/HttpRequestBlock.d.ts +5 -0
  50. package/dist/cjs/api/types/HttpRequestBlockYaml.d.ts +5 -0
  51. package/dist/cjs/api/types/HumanInteractionBlock.d.ts +4 -1
  52. package/dist/cjs/api/types/HumanInteractionBlockYaml.d.ts +4 -0
  53. package/dist/cjs/api/types/JinjaBranchCriteria.d.ts +7 -0
  54. package/dist/cjs/api/types/JinjaBranchCriteria.js +3 -0
  55. package/dist/cjs/api/types/LocateElementAction.d.ts +7 -0
  56. package/dist/cjs/api/types/LocateElementAction.js +3 -0
  57. package/dist/cjs/api/types/LoginBlock.d.ts +4 -1
  58. package/dist/cjs/api/types/LoginBlockYaml.d.ts +4 -1
  59. package/dist/cjs/api/types/NavigationBlock.d.ts +4 -1
  60. package/dist/cjs/api/types/NavigationBlockYaml.d.ts +4 -1
  61. package/dist/cjs/api/types/NonEmptyPasswordCredential.d.ts +2 -0
  62. package/dist/cjs/api/types/PasswordCredentialResponse.d.ts +2 -0
  63. package/dist/cjs/api/types/PdfParserBlock.d.ts +4 -0
  64. package/dist/cjs/api/types/PdfParserBlockYaml.d.ts +4 -0
  65. package/dist/cjs/api/types/PromptAction.d.ts +11 -0
  66. package/dist/cjs/api/types/PromptAction.js +3 -0
  67. package/dist/cjs/api/types/PromptBranchCriteria.d.ts +7 -0
  68. package/dist/cjs/api/types/PromptBranchCriteria.js +3 -0
  69. package/dist/cjs/api/types/RunSdkActionRequestAction.d.ts +10 -1
  70. package/dist/cjs/api/types/SecretCredential.d.ts +9 -0
  71. package/dist/cjs/api/types/SecretCredential.js +3 -0
  72. package/dist/cjs/api/types/SecretCredentialResponse.d.ts +7 -0
  73. package/dist/cjs/api/types/SecretCredentialResponse.js +3 -0
  74. package/dist/cjs/api/types/SendEmailBlock.d.ts +4 -0
  75. package/dist/cjs/api/types/SendEmailBlockYaml.d.ts +4 -0
  76. package/dist/cjs/api/types/SkyvernForgeSdkSchemasCredentialsCredentialType.d.ts +1 -0
  77. package/dist/cjs/api/types/SkyvernForgeSdkSchemasCredentialsCredentialType.js +1 -0
  78. package/dist/cjs/api/types/TaskBlock.d.ts +4 -1
  79. package/dist/cjs/api/types/TaskBlockYaml.d.ts +4 -1
  80. package/dist/cjs/api/types/TaskRunRequest.d.ts +29 -1
  81. package/dist/cjs/api/types/TaskV2Block.d.ts +4 -0
  82. package/dist/cjs/api/types/TaskV2BlockYaml.d.ts +4 -0
  83. package/dist/cjs/api/types/TextPromptBlock.d.ts +4 -0
  84. package/dist/cjs/api/types/TextPromptBlockYaml.d.ts +4 -0
  85. package/dist/cjs/api/types/UploadToS3Block.d.ts +4 -0
  86. package/dist/cjs/api/types/UploadToS3BlockYaml.d.ts +4 -0
  87. package/dist/cjs/api/types/UrlBlock.d.ts +4 -1
  88. package/dist/cjs/api/types/UrlBlockYaml.d.ts +4 -0
  89. package/dist/cjs/api/types/ValidateAction.d.ts +9 -0
  90. package/dist/cjs/api/types/ValidateAction.js +3 -0
  91. package/dist/cjs/api/types/ValidationBlock.d.ts +4 -1
  92. package/dist/cjs/api/types/ValidationBlockYaml.d.ts +4 -0
  93. package/dist/cjs/api/types/WaitBlock.d.ts +4 -0
  94. package/dist/cjs/api/types/WaitBlockYaml.d.ts +4 -0
  95. package/dist/cjs/api/types/Workflow.d.ts +4 -1
  96. package/dist/cjs/api/types/WorkflowCreateYamlRequest.d.ts +4 -1
  97. package/dist/cjs/api/types/WorkflowDefinition.d.ts +1 -0
  98. package/dist/cjs/api/types/WorkflowDefinitionBlocksItem.d.ts +4 -1
  99. package/dist/cjs/api/types/WorkflowDefinitionYaml.d.ts +1 -0
  100. package/dist/cjs/api/types/WorkflowDefinitionYamlBlocksItem.d.ts +4 -1
  101. package/dist/cjs/api/types/WorkflowRunBlock.d.ts +4 -0
  102. package/dist/cjs/api/types/WorkflowRunRequest.d.ts +31 -1
  103. package/dist/cjs/api/types/index.d.ts +14 -1
  104. package/dist/cjs/api/types/index.js +14 -1
  105. package/dist/cjs/index.d.ts +3 -1
  106. package/dist/cjs/index.js +7 -2
  107. package/dist/cjs/library/Skyvern.d.ts +124 -0
  108. package/dist/cjs/library/Skyvern.js +315 -0
  109. package/dist/cjs/library/SkyvernBrowser.d.ts +76 -0
  110. package/dist/cjs/library/SkyvernBrowser.js +119 -0
  111. package/dist/cjs/library/SkyvernBrowserPage.d.ts +69 -0
  112. package/dist/cjs/library/SkyvernBrowserPage.js +162 -0
  113. package/dist/cjs/library/SkyvernBrowserPageAgent.d.ts +135 -0
  114. package/dist/cjs/library/SkyvernBrowserPageAgent.js +256 -0
  115. package/dist/cjs/library/SkyvernBrowserPageAi.d.ts +85 -0
  116. package/dist/cjs/library/SkyvernBrowserPageAi.js +248 -0
  117. package/dist/cjs/library/constants.d.ts +3 -0
  118. package/dist/cjs/library/constants.js +6 -0
  119. package/dist/cjs/library/index.d.ts +10 -0
  120. package/dist/cjs/library/index.js +20 -0
  121. package/dist/cjs/library/logger.d.ts +15 -0
  122. package/dist/cjs/library/logger.js +56 -0
  123. package/dist/cjs/version.d.ts +1 -1
  124. package/dist/cjs/version.js +1 -1
  125. package/dist/esm/Client.d.mts +75 -6
  126. package/dist/esm/Client.mjs +326 -12
  127. package/dist/esm/api/client/requests/CreateCredentialRequest.d.mts +1 -1
  128. package/dist/esm/api/client/requests/DownloadFilesRequest.d.mts +37 -0
  129. package/dist/esm/api/{resources/browserProfiles/client/requests/ListBrowserProfilesV1BrowserProfilesGetRequest.d.mts → client/requests/ListBrowserProfilesRequest.d.mts} +1 -1
  130. package/dist/esm/api/client/requests/LoginRequest.d.mts +8 -6
  131. package/dist/esm/api/client/requests/index.d.mts +3 -0
  132. package/dist/esm/api/errors/ConflictError.d.mts +5 -0
  133. package/dist/esm/api/errors/ConflictError.mjs +13 -0
  134. package/dist/esm/api/errors/index.d.mts +1 -0
  135. package/dist/esm/api/errors/index.mjs +1 -0
  136. package/dist/esm/api/resources/index.d.mts +0 -4
  137. package/dist/esm/api/resources/index.mjs +0 -4
  138. package/dist/esm/api/types/ActionBlock.d.mts +4 -1
  139. package/dist/esm/api/types/ActionBlockYaml.d.mts +4 -1
  140. package/dist/esm/api/types/ActionType.d.mts +1 -0
  141. package/dist/esm/api/types/ActionType.mjs +1 -0
  142. package/dist/esm/api/types/BlockType.d.mts +1 -0
  143. package/dist/esm/api/types/BlockType.mjs +1 -0
  144. package/dist/esm/api/types/BranchCondition.d.mts +11 -0
  145. package/dist/esm/api/types/BranchConditionCriteria.d.mts +10 -0
  146. package/dist/esm/api/types/BranchConditionYaml.d.mts +7 -0
  147. package/dist/esm/api/types/BranchCriteriaYaml.d.mts +12 -0
  148. package/dist/esm/api/types/BranchCriteriaYaml.mjs +8 -0
  149. package/dist/esm/api/types/CodeBlock.d.mts +4 -0
  150. package/dist/esm/api/types/CodeBlockYaml.d.mts +4 -0
  151. package/dist/esm/api/types/ConditionalBlock.d.mts +16 -0
  152. package/dist/esm/api/types/ConditionalBlockYaml.d.mts +11 -0
  153. package/dist/esm/api/types/CredentialResponse.d.mts +1 -1
  154. package/dist/esm/api/types/CredentialTypeOutput.d.mts +1 -0
  155. package/dist/esm/api/types/CredentialTypeOutput.mjs +1 -0
  156. package/dist/esm/api/types/DownloadToS3Block.d.mts +4 -0
  157. package/dist/esm/api/types/DownloadToS3BlockYaml.d.mts +4 -0
  158. package/dist/esm/api/types/ExtractionBlock.d.mts +4 -1
  159. package/dist/esm/api/types/ExtractionBlockYaml.d.mts +4 -1
  160. package/dist/esm/api/types/FileDownloadBlock.d.mts +4 -1
  161. package/dist/esm/api/types/FileDownloadBlockYaml.d.mts +4 -1
  162. package/dist/esm/api/types/FileParserBlock.d.mts +4 -0
  163. package/dist/esm/api/types/FileParserBlockYaml.d.mts +4 -0
  164. package/dist/esm/api/types/FileUploadBlock.d.mts +4 -0
  165. package/dist/esm/api/types/FileUploadBlockYaml.d.mts +4 -0
  166. package/dist/esm/api/types/ForLoopBlock.d.mts +4 -0
  167. package/dist/esm/api/types/ForLoopBlockLoopBlocksItem.d.mts +4 -1
  168. package/dist/esm/api/types/ForLoopBlockYaml.d.mts +4 -0
  169. package/dist/esm/api/types/ForLoopBlockYamlLoopBlocksItem.d.mts +4 -1
  170. package/dist/esm/api/types/GeoTarget.d.mts +21 -0
  171. package/dist/esm/api/types/GeoTarget.mjs +2 -0
  172. package/dist/esm/api/types/HttpRequestBlock.d.mts +5 -0
  173. package/dist/esm/api/types/HttpRequestBlockYaml.d.mts +5 -0
  174. package/dist/esm/api/types/HumanInteractionBlock.d.mts +4 -1
  175. package/dist/esm/api/types/HumanInteractionBlockYaml.d.mts +4 -0
  176. package/dist/esm/api/types/JinjaBranchCriteria.d.mts +7 -0
  177. package/dist/esm/api/types/JinjaBranchCriteria.mjs +2 -0
  178. package/dist/esm/api/types/LocateElementAction.d.mts +7 -0
  179. package/dist/esm/api/types/LocateElementAction.mjs +2 -0
  180. package/dist/esm/api/types/LoginBlock.d.mts +4 -1
  181. package/dist/esm/api/types/LoginBlockYaml.d.mts +4 -1
  182. package/dist/esm/api/types/NavigationBlock.d.mts +4 -1
  183. package/dist/esm/api/types/NavigationBlockYaml.d.mts +4 -1
  184. package/dist/esm/api/types/NonEmptyPasswordCredential.d.mts +2 -0
  185. package/dist/esm/api/types/PasswordCredentialResponse.d.mts +2 -0
  186. package/dist/esm/api/types/PdfParserBlock.d.mts +4 -0
  187. package/dist/esm/api/types/PdfParserBlockYaml.d.mts +4 -0
  188. package/dist/esm/api/types/PromptAction.d.mts +11 -0
  189. package/dist/esm/api/types/PromptAction.mjs +2 -0
  190. package/dist/esm/api/types/PromptBranchCriteria.d.mts +7 -0
  191. package/dist/esm/api/types/PromptBranchCriteria.mjs +2 -0
  192. package/dist/esm/api/types/RunSdkActionRequestAction.d.mts +10 -1
  193. package/dist/esm/api/types/SecretCredential.d.mts +9 -0
  194. package/dist/esm/api/types/SecretCredential.mjs +2 -0
  195. package/dist/esm/api/types/SecretCredentialResponse.d.mts +7 -0
  196. package/dist/esm/api/types/SecretCredentialResponse.mjs +2 -0
  197. package/dist/esm/api/types/SendEmailBlock.d.mts +4 -0
  198. package/dist/esm/api/types/SendEmailBlockYaml.d.mts +4 -0
  199. package/dist/esm/api/types/SkyvernForgeSdkSchemasCredentialsCredentialType.d.mts +1 -0
  200. package/dist/esm/api/types/SkyvernForgeSdkSchemasCredentialsCredentialType.mjs +1 -0
  201. package/dist/esm/api/types/TaskBlock.d.mts +4 -1
  202. package/dist/esm/api/types/TaskBlockYaml.d.mts +4 -1
  203. package/dist/esm/api/types/TaskRunRequest.d.mts +29 -1
  204. package/dist/esm/api/types/TaskV2Block.d.mts +4 -0
  205. package/dist/esm/api/types/TaskV2BlockYaml.d.mts +4 -0
  206. package/dist/esm/api/types/TextPromptBlock.d.mts +4 -0
  207. package/dist/esm/api/types/TextPromptBlockYaml.d.mts +4 -0
  208. package/dist/esm/api/types/UploadToS3Block.d.mts +4 -0
  209. package/dist/esm/api/types/UploadToS3BlockYaml.d.mts +4 -0
  210. package/dist/esm/api/types/UrlBlock.d.mts +4 -1
  211. package/dist/esm/api/types/UrlBlockYaml.d.mts +4 -0
  212. package/dist/esm/api/types/ValidateAction.d.mts +9 -0
  213. package/dist/esm/api/types/ValidateAction.mjs +2 -0
  214. package/dist/esm/api/types/ValidationBlock.d.mts +4 -1
  215. package/dist/esm/api/types/ValidationBlockYaml.d.mts +4 -0
  216. package/dist/esm/api/types/WaitBlock.d.mts +4 -0
  217. package/dist/esm/api/types/WaitBlockYaml.d.mts +4 -0
  218. package/dist/esm/api/types/Workflow.d.mts +4 -1
  219. package/dist/esm/api/types/WorkflowCreateYamlRequest.d.mts +4 -1
  220. package/dist/esm/api/types/WorkflowDefinition.d.mts +1 -0
  221. package/dist/esm/api/types/WorkflowDefinitionBlocksItem.d.mts +4 -1
  222. package/dist/esm/api/types/WorkflowDefinitionYaml.d.mts +1 -0
  223. package/dist/esm/api/types/WorkflowDefinitionYamlBlocksItem.d.mts +4 -1
  224. package/dist/esm/api/types/WorkflowRunBlock.d.mts +4 -0
  225. package/dist/esm/api/types/WorkflowRunRequest.d.mts +31 -1
  226. package/dist/esm/api/types/index.d.mts +14 -1
  227. package/dist/esm/api/types/index.mjs +14 -1
  228. package/dist/esm/index.d.mts +3 -1
  229. package/dist/esm/index.mjs +2 -1
  230. package/dist/esm/library/Skyvern.d.mts +124 -0
  231. package/dist/esm/library/Skyvern.mjs +278 -0
  232. package/dist/esm/library/SkyvernBrowser.d.mts +76 -0
  233. package/dist/esm/library/SkyvernBrowser.mjs +115 -0
  234. package/dist/esm/library/SkyvernBrowserPage.d.mts +69 -0
  235. package/dist/esm/library/SkyvernBrowserPage.mjs +158 -0
  236. package/dist/esm/library/SkyvernBrowserPageAgent.d.mts +135 -0
  237. package/dist/esm/library/SkyvernBrowserPageAgent.mjs +252 -0
  238. package/dist/esm/library/SkyvernBrowserPageAi.d.mts +85 -0
  239. package/dist/esm/library/SkyvernBrowserPageAi.mjs +244 -0
  240. package/dist/esm/library/constants.d.mts +3 -0
  241. package/dist/esm/library/constants.mjs +3 -0
  242. package/dist/esm/library/index.d.mts +10 -0
  243. package/dist/esm/library/index.mjs +7 -0
  244. package/dist/esm/library/logger.d.mts +15 -0
  245. package/dist/esm/library/logger.mjs +52 -0
  246. package/dist/esm/version.d.mts +1 -1
  247. package/dist/esm/version.mjs +1 -1
  248. package/package.json +4 -1
  249. package/reference.md +0 -654
  250. package/dist/cjs/api/resources/browserProfiles/client/Client.d.ts +0 -69
  251. package/dist/cjs/api/resources/browserProfiles/client/Client.js +0 -309
  252. package/dist/cjs/api/resources/browserProfiles/client/index.d.ts +0 -1
  253. package/dist/cjs/api/resources/browserProfiles/client/index.js +0 -17
  254. package/dist/cjs/api/resources/browserProfiles/client/requests/index.d.ts +0 -2
  255. package/dist/cjs/api/resources/browserProfiles/client/requests/index.js +0 -2
  256. package/dist/cjs/api/resources/browserProfiles/index.d.ts +0 -1
  257. package/dist/cjs/api/resources/browserProfiles/index.js +0 -17
  258. package/dist/cjs/api/resources/workflows/client/Client.d.ts +0 -108
  259. package/dist/cjs/api/resources/workflows/client/Client.js +0 -465
  260. package/dist/cjs/api/resources/workflows/client/index.d.ts +0 -1
  261. package/dist/cjs/api/resources/workflows/client/index.js +0 -17
  262. package/dist/cjs/api/resources/workflows/client/requests/DeleteFolderV1FoldersFolderIdDeleteRequest.d.ts +0 -10
  263. package/dist/cjs/api/resources/workflows/client/requests/FolderCreate.d.ts +0 -12
  264. package/dist/cjs/api/resources/workflows/client/requests/FolderUpdate.d.ts +0 -10
  265. package/dist/cjs/api/resources/workflows/client/requests/GetFoldersV1FoldersGetRequest.d.ts +0 -16
  266. package/dist/cjs/api/resources/workflows/client/requests/UpdateWorkflowFolderRequest.d.ts +0 -8
  267. package/dist/cjs/api/resources/workflows/client/requests/index.d.ts +0 -5
  268. package/dist/cjs/api/resources/workflows/client/requests/index.js +0 -2
  269. package/dist/cjs/api/resources/workflows/index.d.ts +0 -1
  270. package/dist/cjs/api/resources/workflows/index.js +0 -17
  271. package/dist/cjs/api/types/Folder.d.ts +0 -15
  272. package/dist/esm/api/resources/browserProfiles/client/Client.d.mts +0 -69
  273. package/dist/esm/api/resources/browserProfiles/client/Client.mjs +0 -272
  274. package/dist/esm/api/resources/browserProfiles/client/index.d.mts +0 -1
  275. package/dist/esm/api/resources/browserProfiles/client/index.mjs +0 -1
  276. package/dist/esm/api/resources/browserProfiles/client/requests/index.d.mts +0 -2
  277. package/dist/esm/api/resources/browserProfiles/client/requests/index.mjs +0 -1
  278. package/dist/esm/api/resources/browserProfiles/index.d.mts +0 -1
  279. package/dist/esm/api/resources/browserProfiles/index.mjs +0 -1
  280. package/dist/esm/api/resources/workflows/client/Client.d.mts +0 -108
  281. package/dist/esm/api/resources/workflows/client/Client.mjs +0 -428
  282. package/dist/esm/api/resources/workflows/client/index.d.mts +0 -1
  283. package/dist/esm/api/resources/workflows/client/index.mjs +0 -1
  284. package/dist/esm/api/resources/workflows/client/requests/DeleteFolderV1FoldersFolderIdDeleteRequest.d.mts +0 -10
  285. package/dist/esm/api/resources/workflows/client/requests/FolderCreate.d.mts +0 -12
  286. package/dist/esm/api/resources/workflows/client/requests/FolderUpdate.d.mts +0 -10
  287. package/dist/esm/api/resources/workflows/client/requests/GetFoldersV1FoldersGetRequest.d.mts +0 -16
  288. package/dist/esm/api/resources/workflows/client/requests/UpdateWorkflowFolderRequest.d.mts +0 -8
  289. package/dist/esm/api/resources/workflows/client/requests/index.d.mts +0 -5
  290. package/dist/esm/api/resources/workflows/client/requests/index.mjs +0 -1
  291. package/dist/esm/api/resources/workflows/index.d.mts +0 -1
  292. package/dist/esm/api/resources/workflows/index.mjs +0 -1
  293. package/dist/esm/api/types/Folder.d.mts +0 -15
  294. /package/dist/cjs/api/{resources/browserProfiles/client → client}/requests/CreateBrowserProfileRequest.d.ts +0 -0
  295. /package/dist/cjs/api/{resources/browserProfiles/client → client}/requests/CreateBrowserProfileRequest.js +0 -0
  296. /package/dist/cjs/api/{resources/browserProfiles/client/requests/ListBrowserProfilesV1BrowserProfilesGetRequest.js → client/requests/DownloadFilesRequest.js} +0 -0
  297. /package/dist/cjs/api/{resources/workflows/client/requests/DeleteFolderV1FoldersFolderIdDeleteRequest.js → client/requests/ListBrowserProfilesRequest.js} +0 -0
  298. /package/dist/cjs/api/{resources/workflows/client/requests/FolderCreate.js → types/BranchCondition.js} +0 -0
  299. /package/dist/cjs/api/{resources/workflows/client/requests/FolderUpdate.js → types/BranchConditionCriteria.js} +0 -0
  300. /package/dist/cjs/api/{resources/workflows/client/requests/GetFoldersV1FoldersGetRequest.js → types/BranchConditionYaml.js} +0 -0
  301. /package/dist/cjs/api/{resources/workflows/client/requests/UpdateWorkflowFolderRequest.js → types/ConditionalBlock.js} +0 -0
  302. /package/dist/cjs/api/types/{Folder.js → ConditionalBlockYaml.js} +0 -0
  303. /package/dist/esm/api/{resources/browserProfiles/client → client}/requests/CreateBrowserProfileRequest.d.mts +0 -0
  304. /package/dist/esm/api/{resources/browserProfiles/client → client}/requests/CreateBrowserProfileRequest.mjs +0 -0
  305. /package/dist/esm/api/{resources/browserProfiles/client/requests/ListBrowserProfilesV1BrowserProfilesGetRequest.mjs → client/requests/DownloadFilesRequest.mjs} +0 -0
  306. /package/dist/esm/api/{resources/workflows/client/requests/DeleteFolderV1FoldersFolderIdDeleteRequest.mjs → client/requests/ListBrowserProfilesRequest.mjs} +0 -0
  307. /package/dist/esm/api/{resources/workflows/client/requests/FolderCreate.mjs → types/BranchCondition.mjs} +0 -0
  308. /package/dist/esm/api/{resources/workflows/client/requests/FolderUpdate.mjs → types/BranchConditionCriteria.mjs} +0 -0
  309. /package/dist/esm/api/{resources/workflows/client/requests/GetFoldersV1FoldersGetRequest.mjs → types/BranchConditionYaml.mjs} +0 -0
  310. /package/dist/esm/api/{resources/workflows/client/requests/UpdateWorkflowFolderRequest.mjs → types/ConditionalBlock.mjs} +0 -0
  311. /package/dist/esm/api/types/{Folder.mjs → ConditionalBlockYaml.mjs} +0 -0
@@ -0,0 +1,315 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __rest = (this && this.__rest) || function (s, e) {
45
+ var t = {};
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
47
+ t[p] = s[p];
48
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
49
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
50
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
51
+ t[p[i]] = s[p[i]];
52
+ }
53
+ return t;
54
+ };
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.Skyvern = void 0;
57
+ const playwright_1 = require("playwright");
58
+ const Client_js_1 = require("../Client.js");
59
+ const environments_js_1 = require("../environments.js");
60
+ const SkyvernBrowser_js_1 = require("./SkyvernBrowser.js");
61
+ const logger_js_1 = require("./logger.js");
62
+ const core = __importStar(require("../core/index.js"));
63
+ /**
64
+ * Main entry point for the Skyvern SDK.
65
+ *
66
+ * This class provides methods to launch and connect to browsers (both local and cloud-hosted),
67
+ * and access the Skyvern API client for task and workflow management. It combines browser
68
+ * automation capabilities with AI-powered task execution.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * // Remote mode: Connect to Skyvern Cloud (API key required)
73
+ * const skyvern = new Skyvern({ apiKey: "your-api-key" });
74
+ *
75
+ * // Launch a cloud browser
76
+ * const browser = await skyvern.launchCloudBrowser();
77
+ * const page = await browser.getWorkingPage();
78
+ *
79
+ * // Execute AI-powered tasks
80
+ * await page.agent.runTask("Fill out the form and submit it");
81
+ * ```
82
+ */
83
+ class Skyvern extends Client_js_1.SkyvernClient {
84
+ constructor(options) {
85
+ var _a, _b;
86
+ super(Object.assign(Object.assign({}, options), { environment: (_a = options.environment) !== null && _a !== void 0 ? _a : environments_js_1.SkyvernEnvironment.Cloud }));
87
+ this._browsers = new Set();
88
+ this._apiKey = options.apiKey;
89
+ this._environment = ((_b = options.environment) !== null && _b !== void 0 ? _b : environments_js_1.SkyvernEnvironment.Cloud);
90
+ }
91
+ get environment() {
92
+ return this._environment;
93
+ }
94
+ runTask(request, requestOptions) {
95
+ return core.HttpResponsePromise.fromPromise(this.__runTaskWithCompletion(request, requestOptions));
96
+ }
97
+ __runTaskWithCompletion(request, requestOptions) {
98
+ const _super = Object.create(null, {
99
+ runTask: { get: () => super.runTask }
100
+ });
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const { waitForCompletion, timeout } = request, taskRequest = __rest(request, ["waitForCompletion", "timeout"]);
103
+ const response = yield _super.runTask.call(this, taskRequest, requestOptions).withRawResponse();
104
+ if (waitForCompletion) {
105
+ const completedRun = yield this._waitForRunCompletion(response.data.run_id, timeout !== null && timeout !== void 0 ? timeout : 1800);
106
+ return { data: completedRun, rawResponse: response.rawResponse };
107
+ }
108
+ return response;
109
+ });
110
+ }
111
+ runWorkflow(request, requestOptions) {
112
+ return core.HttpResponsePromise.fromPromise(this.__runWorkflowWithCompletion(request, requestOptions));
113
+ }
114
+ __runWorkflowWithCompletion(request, requestOptions) {
115
+ const _super = Object.create(null, {
116
+ runWorkflow: { get: () => super.runWorkflow }
117
+ });
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const { waitForCompletion, timeout } = request, workflowRequest = __rest(request, ["waitForCompletion", "timeout"]);
120
+ const response = yield _super.runWorkflow.call(this, workflowRequest, requestOptions).withRawResponse();
121
+ if (waitForCompletion) {
122
+ const completedRun = yield this._waitForRunCompletion(response.data.run_id, timeout !== null && timeout !== void 0 ? timeout : 1800);
123
+ return { data: completedRun, rawResponse: response.rawResponse };
124
+ }
125
+ return response;
126
+ });
127
+ }
128
+ login(request, requestOptions) {
129
+ return core.HttpResponsePromise.fromPromise(this.__loginWithCompletion(request, requestOptions));
130
+ }
131
+ __loginWithCompletion(request, requestOptions) {
132
+ const _super = Object.create(null, {
133
+ login: { get: () => super.login }
134
+ });
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const { waitForCompletion, timeout } = request, loginRequest = __rest(request, ["waitForCompletion", "timeout"]);
137
+ const response = yield _super.login.call(this, loginRequest, requestOptions).withRawResponse();
138
+ if (waitForCompletion) {
139
+ const completedRun = yield this._waitForRunCompletion(response.data.run_id, timeout !== null && timeout !== void 0 ? timeout : 1800);
140
+ return { data: completedRun, rawResponse: response.rawResponse };
141
+ }
142
+ return response;
143
+ });
144
+ }
145
+ downloadFiles(request, requestOptions) {
146
+ return core.HttpResponsePromise.fromPromise(this.__downloadFilesWithCompletion(request, requestOptions));
147
+ }
148
+ __downloadFilesWithCompletion(request, requestOptions) {
149
+ const _super = Object.create(null, {
150
+ downloadFiles: { get: () => super.downloadFiles }
151
+ });
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ const { waitForCompletion, timeout } = request, downloadFilesRequest = __rest(request, ["waitForCompletion", "timeout"]);
154
+ const response = yield _super.downloadFiles.call(this, downloadFilesRequest, requestOptions).withRawResponse();
155
+ if (waitForCompletion) {
156
+ const completedRun = yield this._waitForRunCompletion(response.data.run_id, timeout !== null && timeout !== void 0 ? timeout : 1800);
157
+ return { data: completedRun, rawResponse: response.rawResponse };
158
+ }
159
+ return response;
160
+ });
161
+ }
162
+ /**
163
+ * Launch a new cloud-hosted browser session.
164
+ *
165
+ * This creates a new browser session in Skyvern's cloud infrastructure and connects to it.
166
+ *
167
+ * @param options - Optional configuration
168
+ * @param options.timeout - Timeout in minutes for the session. Timeout is applied after the session is started.
169
+ * Must be between 5 and 1440. Defaults to 60.
170
+ * @param options.proxyLocation - Geographic proxy location to route the browser traffic through.
171
+ * This is only available in Skyvern Cloud.
172
+ *
173
+ * @returns SkyvernBrowser instance connected to the new cloud session.
174
+ */
175
+ launchCloudBrowser(options) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ this._ensureCloudEnvironment();
178
+ const browserSession = yield this.createBrowserSession({
179
+ timeout: options === null || options === void 0 ? void 0 : options.timeout,
180
+ proxy_location: options === null || options === void 0 ? void 0 : options.proxyLocation,
181
+ });
182
+ logger_js_1.LOG.info("Launched new cloud browser session", { browser_session_id: browserSession.browser_session_id });
183
+ return this._connectToCloudBrowserSession(browserSession);
184
+ });
185
+ }
186
+ /**
187
+ * Connect to an existing cloud-hosted browser session by ID.
188
+ *
189
+ * @param browserSessionId - The ID of the cloud browser session to connect to.
190
+ *
191
+ * @returns SkyvernBrowser instance connected to the cloud session.
192
+ */
193
+ connectToCloudBrowserSession(browserSessionId) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ this._ensureCloudEnvironment();
196
+ const browserSession = yield this.getBrowserSession(browserSessionId);
197
+ logger_js_1.LOG.info("Connecting to existing cloud browser session", { browser_session_id: browserSession.browser_session_id });
198
+ return this._connectToCloudBrowserSession(browserSession);
199
+ });
200
+ }
201
+ /**
202
+ * Get or create a cloud browser session.
203
+ *
204
+ * This method attempts to reuse the most recent available cloud browser session.
205
+ * If no session exists, it creates a new one. This is useful for cost efficiency
206
+ * and session persistence.
207
+ *
208
+ * @param options - Optional configuration
209
+ * @param options.timeout - Timeout in minutes for the session. Timeout is applied after the session is started.
210
+ * Must be between 5 and 1440. Defaults to 60. Only used when creating a new session.
211
+ * @param options.proxyLocation - Geographic proxy location to route the browser traffic through.
212
+ * This is only available in Skyvern Cloud. Only used when creating a new session.
213
+ *
214
+ * @returns SkyvernBrowser instance connected to an existing or new cloud session.
215
+ */
216
+ useCloudBrowser(options) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ this._ensureCloudEnvironment();
219
+ const browserSessions = yield this.getBrowserSessions();
220
+ const browserSession = browserSessions
221
+ .filter((s) => s.runnable_id == null)
222
+ .sort((a, b) => {
223
+ const aTime = a.started_at ? new Date(a.started_at).getTime() : 0;
224
+ const bTime = b.started_at ? new Date(b.started_at).getTime() : 0;
225
+ return bTime - aTime;
226
+ })[0];
227
+ if (!browserSession) {
228
+ logger_js_1.LOG.info("No existing cloud browser session found, launching a new session");
229
+ return this.launchCloudBrowser(options);
230
+ }
231
+ logger_js_1.LOG.info("Reusing existing cloud browser session", { browser_session_id: browserSession.browser_session_id });
232
+ return this._connectToCloudBrowserSession(browserSession);
233
+ });
234
+ }
235
+ /**
236
+ * Connect to an existing browser instance via Chrome DevTools Protocol (CDP).
237
+ *
238
+ * Use this to connect to a browser that's already running with CDP enabled,
239
+ * whether local or remote.
240
+ *
241
+ * @param cdpUrl - The CDP WebSocket URL (e.g., "http://localhost:9222").
242
+ *
243
+ * @returns SkyvernBrowser instance connected to the existing browser.
244
+ */
245
+ connectToBrowserOverCdp(cdpUrl) {
246
+ return __awaiter(this, void 0, void 0, function* () {
247
+ var _a;
248
+ const browser = yield playwright_1.chromium.connectOverCDP(cdpUrl);
249
+ const browserContext = (_a = browser.contexts()[0]) !== null && _a !== void 0 ? _a : (yield browser.newContext());
250
+ const skyvernBrowser = new SkyvernBrowser_js_1.SkyvernBrowser(this, browserContext, { browser, browserAddress: cdpUrl });
251
+ this._browsers.add(skyvernBrowser);
252
+ return skyvernBrowser;
253
+ });
254
+ }
255
+ /**
256
+ * Close all browsers and release resources.
257
+ */
258
+ close() {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ yield Promise.all(Array.from(this._browsers).map((browser) => browser.close()));
261
+ this._browsers.clear();
262
+ });
263
+ }
264
+ _untrackBrowser(browser) {
265
+ this._browsers.delete(browser);
266
+ }
267
+ _ensureCloudEnvironment() {
268
+ if (this._environment !== environments_js_1.SkyvernEnvironment.Cloud && this._environment !== environments_js_1.SkyvernEnvironment.Staging) {
269
+ throw new Error("Cloud browser sessions are supported only in the cloud environment");
270
+ }
271
+ }
272
+ _connectToCloudBrowserSession(browserSession) {
273
+ return __awaiter(this, void 0, void 0, function* () {
274
+ var _a;
275
+ if (!browserSession.browser_address) {
276
+ throw new Error(`Browser address is missing for session ${browserSession.browser_session_id}`);
277
+ }
278
+ const browser = yield playwright_1.chromium.connectOverCDP(browserSession.browser_address, {
279
+ headers: { "x-api-key": this._apiKey },
280
+ });
281
+ const browserContext = (_a = browser.contexts()[0]) !== null && _a !== void 0 ? _a : (yield browser.newContext());
282
+ const skyvernBrowser = new SkyvernBrowser_js_1.SkyvernBrowser(this, browserContext, {
283
+ browser,
284
+ browserSessionId: browserSession.browser_session_id,
285
+ });
286
+ this._browsers.add(skyvernBrowser);
287
+ return skyvernBrowser;
288
+ });
289
+ }
290
+ _waitForRunCompletion(runId, timeoutSeconds) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ const startTime = Date.now();
293
+ const timeoutMs = timeoutSeconds * 1000;
294
+ while (true) {
295
+ const run = yield this.getRun(runId);
296
+ // Check if the run is in a final state
297
+ const status = run.status;
298
+ if (status === "completed" ||
299
+ status === "failed" ||
300
+ status === "terminated" ||
301
+ status === "timed_out" ||
302
+ status === "canceled") {
303
+ return run;
304
+ }
305
+ // Check timeout
306
+ if (Date.now() - startTime >= timeoutMs) {
307
+ throw new Error(`Timeout waiting for run ${runId} to complete after ${timeoutSeconds} seconds`);
308
+ }
309
+ // Wait before polling again
310
+ yield new Promise((resolve) => setTimeout(resolve, 10000)); // 10 seconds
311
+ }
312
+ });
313
+ }
314
+ }
315
+ exports.Skyvern = Skyvern;
@@ -0,0 +1,76 @@
1
+ import type { Browser, BrowserContext } from "playwright";
2
+ import type { Skyvern } from "./Skyvern.js";
3
+ import { type SkyvernBrowserPage } from "./SkyvernBrowserPage.js";
4
+ /**
5
+ * A browser context wrapper that creates Skyvern-enabled pages.
6
+ *
7
+ * This class wraps a Playwright BrowserContext and provides methods to create
8
+ * SkyvernBrowserPage instances that combine traditional browser automation with
9
+ * AI-powered task execution capabilities. It manages browser session state and
10
+ * enables persistent browser sessions across multiple pages.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const skyvern = Skyvern.local();
15
+ * const browser = await skyvern.launchCloudBrowser();
16
+ *
17
+ * // Get or create the working page
18
+ * const page = await browser.getWorkingPage();
19
+ *
20
+ * // Create a new page
21
+ * const newPage = await browser.newPage();
22
+ * ```
23
+ */
24
+ export declare class SkyvernBrowser {
25
+ private readonly _skyvern;
26
+ private readonly _browserContext;
27
+ private readonly _browser?;
28
+ private readonly _browserSessionId?;
29
+ private readonly _browserAddress?;
30
+ workflowRunId?: string;
31
+ constructor(skyvern: Skyvern, browserContext: BrowserContext, options?: {
32
+ browser?: Browser;
33
+ browserSessionId?: string;
34
+ browserAddress?: string;
35
+ });
36
+ get browserSessionId(): string | undefined;
37
+ get browserAddress(): string | undefined;
38
+ get skyvern(): Skyvern;
39
+ get context(): BrowserContext;
40
+ /**
41
+ * Get the most recent page or create a new one if none exists.
42
+ *
43
+ * This method returns the last page in the browser context, or creates a new page
44
+ * if the context has no pages. This is useful for continuing work on an existing
45
+ * page without creating unnecessary new tabs.
46
+ *
47
+ * @returns SkyvernBrowserPage: The most recent page wrapped with Skyvern capabilities.
48
+ */
49
+ getWorkingPage(): Promise<SkyvernBrowserPage>;
50
+ /**
51
+ * Create a new page (tab) in the browser context.
52
+ *
53
+ * This method always creates a new page, similar to opening a new tab in a browser.
54
+ * The new page will have both Playwright's standard API and Skyvern's AI capabilities.
55
+ *
56
+ * @returns SkyvernBrowserPage: A new page wrapped with Skyvern capabilities.
57
+ */
58
+ newPage(): Promise<SkyvernBrowserPage>;
59
+ pages(): SkyvernBrowserPage[];
60
+ /**
61
+ * Close the browser and optionally close the browser session.
62
+ *
63
+ * This method closes the browser context. If the browser is associated with a
64
+ * cloud browser session (has a browserSessionId), it will also close the
65
+ * browser session via the API, marking it as completed.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const browser = await skyvern.launchCloudBrowser();
70
+ * // ... use the browser ...
71
+ * await browser.close(); // Closes both browser and cloud session
72
+ * ```
73
+ */
74
+ close(): Promise<void>;
75
+ private _createSkyvernPage;
76
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SkyvernBrowser = void 0;
13
+ const SkyvernBrowserPage_js_1 = require("./SkyvernBrowserPage.js");
14
+ /**
15
+ * A browser context wrapper that creates Skyvern-enabled pages.
16
+ *
17
+ * This class wraps a Playwright BrowserContext and provides methods to create
18
+ * SkyvernBrowserPage instances that combine traditional browser automation with
19
+ * AI-powered task execution capabilities. It manages browser session state and
20
+ * enables persistent browser sessions across multiple pages.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const skyvern = Skyvern.local();
25
+ * const browser = await skyvern.launchCloudBrowser();
26
+ *
27
+ * // Get or create the working page
28
+ * const page = await browser.getWorkingPage();
29
+ *
30
+ * // Create a new page
31
+ * const newPage = await browser.newPage();
32
+ * ```
33
+ */
34
+ class SkyvernBrowser {
35
+ constructor(skyvern, browserContext, options) {
36
+ this._skyvern = skyvern;
37
+ this._browserContext = browserContext;
38
+ this._browser = options === null || options === void 0 ? void 0 : options.browser;
39
+ this._browserSessionId = options === null || options === void 0 ? void 0 : options.browserSessionId;
40
+ this._browserAddress = options === null || options === void 0 ? void 0 : options.browserAddress;
41
+ }
42
+ get browserSessionId() {
43
+ return this._browserSessionId;
44
+ }
45
+ get browserAddress() {
46
+ return this._browserAddress;
47
+ }
48
+ get skyvern() {
49
+ return this._skyvern;
50
+ }
51
+ get context() {
52
+ return this._browserContext;
53
+ }
54
+ /**
55
+ * Get the most recent page or create a new one if none exists.
56
+ *
57
+ * This method returns the last page in the browser context, or creates a new page
58
+ * if the context has no pages. This is useful for continuing work on an existing
59
+ * page without creating unnecessary new tabs.
60
+ *
61
+ * @returns SkyvernBrowserPage: The most recent page wrapped with Skyvern capabilities.
62
+ */
63
+ getWorkingPage() {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const pages = this._browserContext.pages();
66
+ const page = pages.length > 0 ? pages[pages.length - 1] : yield this._browserContext.newPage();
67
+ return this._createSkyvernPage(page);
68
+ });
69
+ }
70
+ /**
71
+ * Create a new page (tab) in the browser context.
72
+ *
73
+ * This method always creates a new page, similar to opening a new tab in a browser.
74
+ * The new page will have both Playwright's standard API and Skyvern's AI capabilities.
75
+ *
76
+ * @returns SkyvernBrowserPage: A new page wrapped with Skyvern capabilities.
77
+ */
78
+ newPage() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const page = yield this._browserContext.newPage();
81
+ return this._createSkyvernPage(page);
82
+ });
83
+ }
84
+ pages() {
85
+ return this._browserContext.pages().map((page) => SkyvernBrowserPage_js_1.SkyvernBrowserPageCore.create(this, page));
86
+ }
87
+ /**
88
+ * Close the browser and optionally close the browser session.
89
+ *
90
+ * This method closes the browser context. If the browser is associated with a
91
+ * cloud browser session (has a browserSessionId), it will also close the
92
+ * browser session via the API, marking it as completed.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const browser = await skyvern.launchCloudBrowser();
97
+ * // ... use the browser ...
98
+ * await browser.close(); // Closes both browser and cloud session
99
+ * ```
100
+ */
101
+ close() {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ if (this._browser) {
104
+ yield this._browser.close();
105
+ }
106
+ else {
107
+ yield this._browserContext.close();
108
+ }
109
+ if (this._browserSessionId) {
110
+ yield this._skyvern.closeBrowserSession(this._browserSessionId);
111
+ }
112
+ this._skyvern._untrackBrowser(this);
113
+ });
114
+ }
115
+ _createSkyvernPage(page) {
116
+ return SkyvernBrowserPage_js_1.SkyvernBrowserPageCore.create(this, page);
117
+ }
118
+ }
119
+ exports.SkyvernBrowser = SkyvernBrowser;
@@ -0,0 +1,69 @@
1
+ import type { Page } from "playwright";
2
+ import type { SkyvernBrowser } from "./SkyvernBrowser.js";
3
+ import { SkyvernBrowserPageAgent } from "./SkyvernBrowserPageAgent.js";
4
+ /**
5
+ * A browser page wrapper that combines Playwright's page API with Skyvern's AI capabilities.
6
+ *
7
+ * This class provides a unified interface for both traditional browser automation (via Playwright)
8
+ * and AI-powered task execution (via Skyvern). It exposes standard page methods like click, fill,
9
+ * goto, etc., while also providing access to Skyvern's task and workflow execution through the
10
+ * `agent` attribute.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Use standard Playwright methods
15
+ * await page.goto("https://example.com");
16
+ * await page.fill("#username", "user@example.com");
17
+ * await page.click("#login-button");
18
+ *
19
+ * // Or use Skyvern's AI capabilities
20
+ * await page.agent.runTask("Fill out the contact form and submit it");
21
+ * ```
22
+ */
23
+ export declare class SkyvernBrowserPageCore {
24
+ private readonly _browser;
25
+ private readonly _page;
26
+ private readonly _ai;
27
+ readonly agent: SkyvernBrowserPageAgent;
28
+ private readonly _proxy;
29
+ private constructor();
30
+ static create(browser: SkyvernBrowser, page: Page): SkyvernBrowserPage;
31
+ get page(): Page;
32
+ get browser(): SkyvernBrowser;
33
+ click(selector: string, options?: Parameters<Page["click"]>[1]): Promise<void>;
34
+ click(options: {
35
+ prompt: string;
36
+ } & Partial<Parameters<Page["click"]>[1]>): Promise<void>;
37
+ fill(selector: string, value: string, options?: Parameters<Page["fill"]>[2]): Promise<void>;
38
+ fill(options: {
39
+ prompt: string;
40
+ value?: string;
41
+ } & Partial<Parameters<Page["fill"]>[2]>): Promise<void>;
42
+ selectOption(selector: string, values: string | string[], options?: Parameters<Page["selectOption"]>[2]): Promise<string[]>;
43
+ selectOption(options: {
44
+ prompt: string;
45
+ value?: string;
46
+ } & Partial<Parameters<Page["selectOption"]>[2]>): Promise<string[]>;
47
+ /**
48
+ * Perform an action on the page using AI based on a natural language prompt.
49
+ *
50
+ * @param prompt - Natural language description of the action to perform.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Simple action
55
+ * await page.act("Click the login button");
56
+ * ```
57
+ */
58
+ act(prompt: string): Promise<void>;
59
+ extract(options: {
60
+ prompt: string;
61
+ schema?: Record<string, unknown> | unknown[] | string;
62
+ errorCodeMapping?: Record<string, string>;
63
+ intention?: string;
64
+ data?: string | Record<string, unknown>;
65
+ }): Promise<Record<string, unknown> | unknown[] | string | null>;
66
+ validate(prompt: string, model?: Record<string, unknown> | string): Promise<boolean>;
67
+ prompt(prompt: string, schema?: Record<string, unknown>, model?: Record<string, unknown> | string): Promise<Record<string, unknown> | unknown[] | string | null>;
68
+ }
69
+ export type SkyvernBrowserPage = SkyvernBrowserPageCore & Page;