@intuned/runtime-dev 1.3.29-stealth.0 → 1.3.32

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 (219) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/commands/common/utils/settings.d.ts +5 -0
  3. package/dist/commands/common/utils/settings.js +5 -17
  4. package/dist/common/asyncLocalStorage/index.d.ts +11 -0
  5. package/dist/common/asyncLocalStorage/index.js +4 -0
  6. package/dist/common/extension/types.d.ts +25 -25
  7. package/dist/common/extension/types.js +1 -1
  8. package/dist/common/launchBrowser.d.ts +11 -1
  9. package/dist/common/launchBrowser.js +16 -19
  10. package/dist/common/playwrightContext.d.ts +6 -0
  11. package/dist/common/playwrightContext.js +11 -2
  12. package/dist/common/runApi/index.js +24 -4
  13. package/dist/common/settingsSchema.d.ts +144 -6
  14. package/dist/common/settingsSchema.js +3 -0
  15. package/dist/vendor/runtime-interface.js +14 -3
  16. package/{dist → package/dist}/commands/api/run.js +11 -7
  17. package/{dist → package/dist}/commands/auth-sessions/load.js +2 -2
  18. package/{dist → package/dist}/commands/auth-sessions/run-check.js +8 -8
  19. package/{dist → package/dist}/commands/auth-sessions/run-create.js +6 -6
  20. package/package/dist/commands/browser/save-state.d.ts +2 -0
  21. package/package/dist/commands/browser/save-state.js +17 -0
  22. package/package/dist/commands/browser/start-browser.d.ts +2 -0
  23. package/package/dist/commands/browser/start-browser.js +14 -0
  24. package/package/dist/commands/build.d.ts +1 -0
  25. package/package/dist/commands/build.js +84 -0
  26. package/package/dist/commands/common/browserUtils.d.ts +14 -0
  27. package/package/dist/commands/common/browserUtils.js +58 -0
  28. package/package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
  29. package/package/dist/commands/common/getFirstLineNumber.js +101 -0
  30. package/package/dist/commands/common/getFirstLineNumber.test.js +228 -0
  31. package/package/dist/commands/common/projectExclusions.d.ts +2 -0
  32. package/package/dist/commands/common/projectExclusions.js +8 -0
  33. package/package/dist/commands/common/sendMessageToClient.d.ts +1 -0
  34. package/package/dist/commands/common/sendMessageToClient.js +10 -0
  35. package/package/dist/commands/common/tsNodeImport.d.ts +2 -0
  36. package/package/dist/commands/common/tsNodeImport.js +34 -0
  37. package/package/dist/commands/common/utils/fileUtils.d.ts +6 -0
  38. package/package/dist/commands/common/utils/fileUtils.js +33 -0
  39. package/package/dist/commands/common/utils/settings.d.ts +2 -0
  40. package/package/dist/commands/common/utils/settings.js +31 -0
  41. package/package/dist/commands/common/utils/template.d.ts +2 -0
  42. package/package/dist/commands/common/utils/template.js +31 -0
  43. package/package/dist/commands/common/utils/unixSocket.d.ts +9 -0
  44. package/package/dist/commands/common/utils/unixSocket.js +44 -0
  45. package/package/dist/commands/interface/run.d.ts +1 -0
  46. package/package/dist/commands/interface/run.js +216 -0
  47. package/package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
  48. package/package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
  49. package/package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
  50. package/package/dist/commands/intuned-cli/commands/attempt_api.command.js +30 -0
  51. package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
  52. package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
  53. package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
  54. package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +19 -0
  55. package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
  56. package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +24 -0
  57. package/package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
  58. package/package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
  59. package/package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
  60. package/package/dist/commands/intuned-cli/commands/authsession_record.command.js +31 -0
  61. package/package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
  62. package/package/dist/commands/intuned-cli/commands/build.command.js +12 -0
  63. package/package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
  64. package/package/dist/commands/intuned-cli/commands/command.js +9 -0
  65. package/package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
  66. package/package/dist/commands/intuned-cli/commands/deploy.command.js +38 -0
  67. package/package/dist/commands/intuned-cli/commands/index.d.ts +18 -0
  68. package/package/dist/commands/intuned-cli/commands/index.js +203 -0
  69. package/package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
  70. package/package/dist/commands/intuned-cli/commands/init.command.js +13 -0
  71. package/package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
  72. package/package/dist/commands/intuned-cli/commands/run.command.js +8 -0
  73. package/package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
  74. package/package/dist/commands/intuned-cli/commands/run_api.command.js +46 -0
  75. package/package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +28 -0
  76. package/package/dist/commands/intuned-cli/commands/run_authsession.command.js +17 -0
  77. package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
  78. package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +35 -0
  79. package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
  80. package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +35 -0
  81. package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
  82. package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +33 -0
  83. package/package/dist/commands/intuned-cli/commands/save.command.d.ts +13 -0
  84. package/package/dist/commands/intuned-cli/commands/save.command.js +42 -0
  85. package/package/dist/commands/intuned-cli/commands/types.d.ts +31 -0
  86. package/package/dist/commands/intuned-cli/commands/types.js +29 -0
  87. package/package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
  88. package/package/dist/commands/intuned-cli/constants/index.js +25 -0
  89. package/package/dist/commands/intuned-cli/controller/__test__/api.test.js +397 -0
  90. package/package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +1059 -0
  91. package/package/dist/commands/intuned-cli/controller/api.d.ts +42 -0
  92. package/package/dist/commands/intuned-cli/controller/api.js +189 -0
  93. package/package/dist/commands/intuned-cli/controller/authSession.d.ts +209 -0
  94. package/package/dist/commands/intuned-cli/controller/authSession.js +420 -0
  95. package/package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
  96. package/package/dist/commands/intuned-cli/controller/build.js +36 -0
  97. package/package/dist/commands/intuned-cli/controller/deploy.d.ts +4 -0
  98. package/package/dist/commands/intuned-cli/controller/deploy.js +139 -0
  99. package/package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
  100. package/package/dist/commands/intuned-cli/controller/index.js +46 -0
  101. package/package/dist/commands/intuned-cli/controller/save.d.ts +14 -0
  102. package/package/dist/commands/intuned-cli/controller/save.js +345 -0
  103. package/package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +103 -0
  104. package/package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +40 -0
  105. package/package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
  106. package/package/dist/commands/intuned-cli/helpers/api.js +19 -0
  107. package/package/dist/commands/intuned-cli/helpers/auth.d.ts +46 -0
  108. package/package/dist/commands/intuned-cli/helpers/auth.js +144 -0
  109. package/package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
  110. package/package/dist/commands/intuned-cli/helpers/backend.js +27 -0
  111. package/package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
  112. package/package/dist/commands/intuned-cli/helpers/browser.js +57 -0
  113. package/package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
  114. package/package/dist/commands/intuned-cli/helpers/context.js +33 -0
  115. package/package/dist/commands/intuned-cli/helpers/errors.d.ts +13 -0
  116. package/package/dist/commands/intuned-cli/helpers/errors.js +37 -0
  117. package/package/dist/commands/intuned-cli/helpers/index.d.ts +12 -0
  118. package/package/dist/commands/intuned-cli/helpers/index.js +137 -0
  119. package/package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +69 -0
  120. package/package/dist/commands/intuned-cli/helpers/intunedJson.js +71 -0
  121. package/package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
  122. package/package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
  123. package/package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
  124. package/package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
  125. package/package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
  126. package/package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
  127. package/package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
  128. package/package/dist/commands/intuned-cli/helpers/traces.js +32 -0
  129. package/package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
  130. package/package/dist/commands/intuned-cli/helpers/validation.js +14 -0
  131. package/package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
  132. package/package/dist/commands/intuned-cli/helpers/wrapper.js +60 -0
  133. package/package/dist/commands/intuned-cli/index.d.ts +1 -0
  134. package/package/dist/commands/intuned-cli/index.js +16 -0
  135. package/package/dist/commands/intuned-cli/main.d.ts +1 -0
  136. package/package/dist/commands/intuned-cli/main.js +22 -0
  137. package/package/dist/commands/intuned-cli/types.d.ts +41 -0
  138. package/package/dist/commands/intuned-cli/types.js +12 -0
  139. package/package/dist/commands/ts-check.d.ts +2 -0
  140. package/package/dist/commands/ts-check.js +56 -0
  141. package/package/dist/common/Logger/Logger/index.d.ts +12 -0
  142. package/package/dist/common/Logger/Logger/index.js +60 -0
  143. package/package/dist/common/Logger/Logger/types.d.ts +8 -0
  144. package/package/dist/common/Logger/Logger/types.js +5 -0
  145. package/package/dist/common/Logger/index.d.ts +12 -0
  146. package/package/dist/common/Logger/index.js +60 -0
  147. package/package/dist/common/Logger/types.d.ts +8 -0
  148. package/package/dist/common/Logger/types.js +5 -0
  149. package/package/dist/common/assets/browser_scripts.js +2580 -0
  150. package/package/dist/common/asyncLocalStorage/index.d.ts +16 -0
  151. package/package/dist/common/asyncLocalStorage/index.js +17 -0
  152. package/package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
  153. package/package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
  154. package/package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
  155. package/package/dist/common/cleanEnvironmentVariables.js +16 -0
  156. package/package/dist/common/constants.d.ts +10 -0
  157. package/package/dist/common/constants.js +16 -0
  158. package/package/dist/common/contextStorageStateHelpers.d.ts +21 -0
  159. package/package/dist/common/contextStorageStateHelpers.js +81 -0
  160. package/package/dist/common/extensionsHelpers.d.ts +8 -0
  161. package/package/dist/common/extensionsHelpers.js +80 -0
  162. package/package/dist/common/formatZodError.d.ts +2 -0
  163. package/package/dist/common/formatZodError.js +18 -0
  164. package/package/dist/common/jwtTokenManager.d.ts +17 -0
  165. package/package/dist/common/jwtTokenManager.js +109 -0
  166. package/package/dist/common/launchBrowser.d.ts +25 -0
  167. package/package/dist/common/launchBrowser.js +172 -0
  168. package/package/dist/common/playwrightContext.d.ts +31 -0
  169. package/package/dist/common/playwrightContext.js +144 -0
  170. package/package/dist/common/runApi/errors.d.ts +72 -0
  171. package/package/dist/common/runApi/errors.js +169 -0
  172. package/package/dist/common/runApi/importUsingImportFunction.d.ts +9 -0
  173. package/package/dist/common/runApi/importUsingImportFunction.js +46 -0
  174. package/package/dist/common/runApi/index.d.ts +11 -0
  175. package/package/dist/common/runApi/index.js +199 -0
  176. package/package/dist/common/runApi/types.d.ts +830 -0
  177. package/package/dist/common/runApi/types.js +73 -0
  178. package/package/dist/common/settingsSchema.d.ts +518 -0
  179. package/package/dist/common/settingsSchema.js +57 -0
  180. package/package/dist/common/setupContextHook.d.ts +17 -0
  181. package/package/dist/common/setupContextHook.js +22 -0
  182. package/package/dist/common/telemetry.d.ts +3 -0
  183. package/package/dist/common/telemetry.js +32 -0
  184. package/package/dist/index.d.ts +4 -0
  185. package/package/dist/index.js +69 -0
  186. package/package/dist/runtime/RunError.d.ts +5 -0
  187. package/package/dist/runtime/RunError.js +19 -0
  188. package/package/dist/runtime/attemptStore.d.ts +2 -0
  189. package/package/dist/runtime/attemptStore.js +23 -0
  190. package/package/dist/runtime/downloadDirectory.d.ts +1 -0
  191. package/package/dist/runtime/downloadDirectory.js +19 -0
  192. package/package/dist/runtime/enums.d.js +5 -0
  193. package/package/dist/runtime/enums.d.ts +11 -0
  194. package/package/dist/runtime/enums.js +18 -0
  195. package/package/dist/runtime/executionHelpers.test.js +52 -0
  196. package/package/dist/runtime/export.d.js +5 -0
  197. package/package/dist/runtime/export.d.ts +228 -0
  198. package/package/dist/runtime/extendPayload.d.ts +2 -0
  199. package/package/dist/runtime/extendPayload.js +21 -0
  200. package/package/dist/runtime/extendTimeout.d.ts +1 -0
  201. package/package/dist/runtime/extendTimeout.js +23 -0
  202. package/package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
  203. package/package/dist/runtime/getAuthSessionParameters.js +20 -0
  204. package/package/dist/runtime/index.d.ts +7 -0
  205. package/package/dist/runtime/index.js +54 -0
  206. package/package/dist/runtime/runInfo.d.ts +2 -0
  207. package/package/dist/runtime/runInfo.js +21 -0
  208. package/package.json +1 -9
  209. package/.claude/settings.local.json +0 -7
  210. package/bin/intuned-api-run +0 -4
  211. package/bin/intuned-auth-session-check +0 -4
  212. package/bin/intuned-auth-session-create +0 -4
  213. package/bin/intuned-auth-session-load +0 -4
  214. package/dist/common/intunedJson.d.ts +0 -252
  215. package/dist/common/intunedJson.js +0 -162
  216. /package/{dist → package/dist}/commands/api/run.d.ts +0 -0
  217. /package/{dist → package/dist}/commands/auth-sessions/load.d.ts +0 -0
  218. /package/{dist → package/dist}/commands/auth-sessions/run-check.d.ts +0 -0
  219. /package/{dist → package/dist}/commands/auth-sessions/run-create.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # UNRELEASED
2
2
 
3
+ - add Math captcha auto-solver via LLM image recognition (image-based arithmetic captchas configured by CSS selectors)
4
+ - add Temu captcha auto-solver via SadCaptcha API (semantic shapes challenge type)
5
+
6
+ # 1.3.29
7
+
3
8
  - add TikTok captcha auto-solver via SadCaptcha API (puzzle and rotate challenge types)
9
+ - fix headless browser user agent mismatch when running in stealth browser
4
10
 
5
11
  # 1.3.28
6
12
 
@@ -1,2 +1,7 @@
1
1
  import { IntunedSettings } from "../../../common/settingsSchema";
2
+ /**
3
+ * Assembles runtime settings from config supplied via the interface (no longer
4
+ * reads Intuned.json). Only captcha-solver config is consumed by the runtime;
5
+ * authSessions/stealthMode are handled by the caller (CLI/UDAS) and default here.
6
+ */
2
7
  export declare function getSettings(): Promise<IntunedSettings>;
@@ -4,28 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getSettings = getSettings;
7
- var _fileUtils = require("./fileUtils");
8
7
  var _settingsSchema = require("../../../common/settingsSchema");
9
- var _promises = require("fs/promises");
8
+ var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
10
9
  async function getSettings() {
11
- const settingsFilePath = (0, _fileUtils.getFullPathInProject)("Intuned.json");
12
- const settings = await (0, _promises.readFile)(settingsFilePath, {
13
- encoding: "utf-8"
14
- });
15
- if (settings) {
16
- const parsed = _settingsSchema.settingsSchema.safeParse(JSON.parse(settings));
17
- if (parsed.success) {
18
- return parsed.data;
19
- } else {
20
- throw new Error(parsed.error.message);
21
- }
22
- }
23
- return {
10
+ return _settingsSchema.settingsSchema.parse({
24
11
  authSessions: {
25
12
  enabled: false
26
13
  },
27
14
  stealthMode: {
28
15
  enabled: false
29
- }
30
- };
16
+ },
17
+ captchaSolver: (0, _asyncLocalStorage.getCaptchaSolverConfig)()
18
+ });
31
19
  }
@@ -11,6 +11,17 @@ export interface InternalRunInfo extends RunInfo {
11
11
  timeoutInfo?: TimeoutInfo;
12
12
  store?: Record<string, any>;
13
13
  getAuthSessionParameters?: () => Promise<any>;
14
+ /**
15
+ * Captcha-solver config forwarded by the caller (CLI/UDAS) through the
16
+ * interface. Consumed by the Intuned browser extension setup. Replaces the
17
+ * previous read from Intuned.json.
18
+ */
19
+ captchaSolver?: Record<string, any>;
14
20
  }
15
21
  export declare function getExecutionContext(): InternalRunInfo | undefined;
22
+ /**
23
+ * Captcha-solver config supplied via the interface, or undefined when running
24
+ * outside an execution context.
25
+ */
26
+ export declare function getCaptchaSolverConfig(): Record<string, any> | undefined;
16
27
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.asyncLocalStorage = void 0;
7
+ exports.getCaptchaSolverConfig = getCaptchaSolverConfig;
7
8
  exports.getExecutionContext = getExecutionContext;
8
9
  exports.runWithContext = runWithContext;
9
10
  var _nodeAsync_hooks = require("node:async_hooks");
@@ -14,4 +15,7 @@ function runWithContext(contextData, callback, ...args) {
14
15
  function getExecutionContext() {
15
16
  const contextData = asyncLocalStorage.getStore();
16
17
  return contextData;
18
+ }
19
+ function getCaptchaSolverConfig() {
20
+ return getExecutionContext()?.captchaSolver;
17
21
  }
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
2
+ export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
3
3
  export type CaptchaType = z.infer<typeof captchaTypeSchema>;
4
4
  export declare const captchaStatusSchema: z.ZodEnum<["attached", "solving", "solved", "error", "detached"]>;
5
5
  export type CaptchaStatus = z.infer<typeof captchaStatusSchema>;
@@ -19,17 +19,17 @@ export type CaptchaError = z.infer<typeof captchaErrorSchema>;
19
19
  declare const captchaBaseSchema: z.ZodObject<{
20
20
  id: z.ZodString;
21
21
  tabId: z.ZodNumber;
22
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
22
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
23
23
  retryCount: z.ZodOptional<z.ZodNumber>;
24
24
  message: z.ZodOptional<z.ZodString>;
25
25
  }, "strip", z.ZodTypeAny, {
26
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
26
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
27
27
  id: string;
28
28
  tabId: number;
29
29
  message?: string | undefined;
30
30
  retryCount?: number | undefined;
31
31
  }, {
32
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
32
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
33
33
  id: string;
34
34
  tabId: number;
35
35
  message?: string | undefined;
@@ -39,20 +39,20 @@ export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
39
39
  declare const captchaNonErrorSchema: z.ZodObject<{
40
40
  id: z.ZodString;
41
41
  tabId: z.ZodNumber;
42
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
42
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
43
43
  retryCount: z.ZodOptional<z.ZodNumber>;
44
44
  message: z.ZodOptional<z.ZodString>;
45
45
  } & {
46
46
  status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
47
47
  }, "strip", z.ZodTypeAny, {
48
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
48
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
49
49
  status: "attached" | "solving" | "solved" | "detached";
50
50
  id: string;
51
51
  tabId: number;
52
52
  message?: string | undefined;
53
53
  retryCount?: number | undefined;
54
54
  }, {
55
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
55
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
56
56
  status: "attached" | "solving" | "solved" | "detached";
57
57
  id: string;
58
58
  tabId: number;
@@ -63,7 +63,7 @@ export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
63
63
  declare const captchaErrorStatusSchema: z.ZodObject<{
64
64
  id: z.ZodString;
65
65
  tabId: z.ZodNumber;
66
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
66
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
67
67
  retryCount: z.ZodOptional<z.ZodNumber>;
68
68
  message: z.ZodOptional<z.ZodString>;
69
69
  } & {
@@ -83,7 +83,7 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
83
83
  code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
84
84
  error?: unknown;
85
85
  };
86
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
86
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
87
87
  status: "error";
88
88
  id: string;
89
89
  tabId: number;
@@ -94,7 +94,7 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
94
94
  code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
95
95
  error?: unknown;
96
96
  };
97
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
97
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
98
98
  status: "error";
99
99
  id: string;
100
100
  tabId: number;
@@ -105,20 +105,20 @@ export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
105
105
  export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
106
106
  id: z.ZodString;
107
107
  tabId: z.ZodNumber;
108
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
108
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
109
109
  retryCount: z.ZodOptional<z.ZodNumber>;
110
110
  message: z.ZodOptional<z.ZodString>;
111
111
  } & {
112
112
  status: z.ZodLiteral<"attached">;
113
113
  }, "strip", z.ZodTypeAny, {
114
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
114
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
115
115
  status: "attached";
116
116
  id: string;
117
117
  tabId: number;
118
118
  message?: string | undefined;
119
119
  retryCount?: number | undefined;
120
120
  }, {
121
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
121
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
122
122
  status: "attached";
123
123
  id: string;
124
124
  tabId: number;
@@ -127,20 +127,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
127
127
  }>, z.ZodObject<{
128
128
  id: z.ZodString;
129
129
  tabId: z.ZodNumber;
130
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
130
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
131
131
  retryCount: z.ZodOptional<z.ZodNumber>;
132
132
  message: z.ZodOptional<z.ZodString>;
133
133
  } & {
134
134
  status: z.ZodLiteral<"solving">;
135
135
  }, "strip", z.ZodTypeAny, {
136
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
136
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
137
137
  status: "solving";
138
138
  id: string;
139
139
  tabId: number;
140
140
  message?: string | undefined;
141
141
  retryCount?: number | undefined;
142
142
  }, {
143
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
143
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
144
144
  status: "solving";
145
145
  id: string;
146
146
  tabId: number;
@@ -149,20 +149,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
149
149
  }>, z.ZodObject<{
150
150
  id: z.ZodString;
151
151
  tabId: z.ZodNumber;
152
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
152
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
153
153
  retryCount: z.ZodOptional<z.ZodNumber>;
154
154
  message: z.ZodOptional<z.ZodString>;
155
155
  } & {
156
156
  status: z.ZodLiteral<"solved">;
157
157
  }, "strip", z.ZodTypeAny, {
158
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
158
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
159
159
  status: "solved";
160
160
  id: string;
161
161
  tabId: number;
162
162
  message?: string | undefined;
163
163
  retryCount?: number | undefined;
164
164
  }, {
165
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
165
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
166
166
  status: "solved";
167
167
  id: string;
168
168
  tabId: number;
@@ -171,20 +171,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
171
171
  }>, z.ZodObject<{
172
172
  id: z.ZodString;
173
173
  tabId: z.ZodNumber;
174
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
174
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
175
175
  retryCount: z.ZodOptional<z.ZodNumber>;
176
176
  message: z.ZodOptional<z.ZodString>;
177
177
  } & {
178
178
  status: z.ZodLiteral<"detached">;
179
179
  }, "strip", z.ZodTypeAny, {
180
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
180
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
181
181
  status: "detached";
182
182
  id: string;
183
183
  tabId: number;
184
184
  message?: string | undefined;
185
185
  retryCount?: number | undefined;
186
186
  }, {
187
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
187
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
188
188
  status: "detached";
189
189
  id: string;
190
190
  tabId: number;
@@ -193,7 +193,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
193
193
  }>, z.ZodObject<{
194
194
  id: z.ZodString;
195
195
  tabId: z.ZodNumber;
196
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
196
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
197
197
  retryCount: z.ZodOptional<z.ZodNumber>;
198
198
  message: z.ZodOptional<z.ZodString>;
199
199
  } & {
@@ -213,7 +213,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
213
213
  code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
214
214
  error?: unknown;
215
215
  };
216
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
216
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
217
217
  status: "error";
218
218
  id: string;
219
219
  tabId: number;
@@ -224,7 +224,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
224
224
  code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
225
225
  error?: unknown;
226
226
  };
227
- type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
227
+ type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
228
228
  status: "error";
229
229
  id: string;
230
230
  tabId: number;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.captchaTypeSchema = exports.captchaStatusSchema = exports.captchaSchema = exports.captchaErrorSchema = exports.captchaErrorCodeSchema = exports.TimeoutError = exports.CaptchaSolveError = void 0;
7
7
  var _zod = require("zod");
8
- const captchaTypeSchema = exports.captchaTypeSchema = _zod.z.enum(["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]);
8
+ const captchaTypeSchema = exports.captchaTypeSchema = _zod.z.enum(["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]);
9
9
  const captchaStatusSchema = exports.captchaStatusSchema = _zod.z.enum(["attached", "solving", "solved", "error", "detached"]);
10
10
  const captchaErrorCodeSchema = exports.captchaErrorCodeSchema = _zod.z.enum(["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]);
11
11
  const captchaErrorSchema = exports.captchaErrorSchema = _zod.z.object({
@@ -31,6 +31,13 @@ export type LaunchChromiumStandaloneOptions = {
31
31
  profileTemplatePath?: string;
32
32
  encryptedProfile?: boolean;
33
33
  timeout?: number;
34
+ /** Extra Chrome args supplied by the caller (e.g. `--stealth-mode`). */
35
+ browserArgs?: string[];
36
+ /** Browser window size supplied by the caller; defaults to 1280x800. */
37
+ browserSize?: {
38
+ width: number;
39
+ height: number;
40
+ };
34
41
  };
35
42
  export type LaunchChromiumCdpOptions = {
36
43
  cdpAddress: string;
@@ -42,7 +49,10 @@ export type LaunchChromiumCdpOptions = {
42
49
  export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
43
50
  export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
44
51
  export declare function getBrowserExecutablePath(): Promise<string | undefined>;
45
- export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
52
+ export declare function launchBrowser(options: (Omit<LaunchChromiumStandaloneOptions, "executablePath"> & {
53
+ /** Browser executable path supplied by the caller (e.g. the Intuned stealth browser). */
54
+ browserPath?: string;
55
+ }) | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
46
56
  export declare function getLocalCdpAddress(port: number): string;
47
57
  export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
48
58
  export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
@@ -22,10 +22,13 @@ var _intunedExtensionServer = require("./extension/intunedExtensionServer");
22
22
  var _util = require("util");
23
23
  var _neverthrow = require("neverthrow");
24
24
  var _zod = require("zod");
25
- var _intunedJson = require("./intunedJson");
26
25
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
26
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
28
27
  const execAsync = (0, _util.promisify)(_child_process.exec);
28
+ const DEFAULT_BROWSER_SIZE = {
29
+ width: 1280,
30
+ height: 800
31
+ };
29
32
  function getEncryptedProfileChromeArgs({
30
33
  encryptedProfile,
31
34
  platform = process.platform,
@@ -152,7 +155,9 @@ async function launchChromium(options) {
152
155
  ignoreHttpErrors: ignoreHttpErrorsParam,
153
156
  profileTemplatePath,
154
157
  encryptedProfile,
155
- timeout
158
+ timeout,
159
+ browserArgs,
160
+ browserSize: browserSizeOption
156
161
  } = options;
157
162
  let {
158
163
  executablePath
@@ -164,9 +169,8 @@ async function launchChromium(options) {
164
169
  encryptedProfile
165
170
  });
166
171
  extraArgs.push(...encryptedProfileArgs);
167
- const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
168
- if (stealthConfig.enabled) {
169
- extraArgs.push("--stealth-mode");
172
+ if (browserArgs) {
173
+ extraArgs.push(...browserArgs);
170
174
  }
171
175
  const userDataDir = await createUserDirWithPreferences(profileTemplatePath);
172
176
  if ((0, _extensionsHelpers.isIntunedExtensionLoaded)()) {
@@ -198,7 +202,7 @@ async function launchChromium(options) {
198
202
  executablePath = undefined;
199
203
  }
200
204
  }
201
- const browserSize = await (0, _intunedJson.getBrowserSizeConfig)();
205
+ const browserSize = browserSizeOption ?? DEFAULT_BROWSER_SIZE;
202
206
  extraArgs.push(`--window-size=${browserSize.width},${browserSize.height}`);
203
207
  const viewport = null;
204
208
  const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
@@ -247,30 +251,23 @@ async function launchChromium(options) {
247
251
  context
248
252
  };
249
253
  }
250
- async function getIntunedBrowserExecutablePath() {
251
- const intunedPath = process.env.INTUNED_STEALTH_CHROMIUM_PATH;
252
- if (intunedPath && (await fs.exists(intunedPath))) {
253
- return intunedPath;
254
- }
255
- return undefined;
256
- }
257
254
  async function getBrowserExecutablePath() {
258
255
  const browserType = getBrowserType();
259
256
  if (browserType === "brave") {
260
257
  return await getBraveExecutablePath();
261
258
  }
262
- const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
263
- if (stealthConfig.enabled) {
264
- return await getIntunedBrowserExecutablePath();
265
- }
266
259
  }
267
260
  async function launchBrowser(options) {
268
261
  if ("cdpAddress" in options) {
269
262
  return launchChromium(options);
270
263
  }
264
+ const {
265
+ browserPath,
266
+ ...standaloneOptions
267
+ } = options;
271
268
  return launchChromium({
272
- ...options,
273
- executablePath: await getBrowserExecutablePath()
269
+ ...standaloneOptions,
270
+ executablePath: browserPath ?? (await getBrowserExecutablePath())
274
271
  });
275
272
  }
276
273
  function getBrowserType() {
@@ -20,6 +20,12 @@ export declare function withPlaywrightContext<R>(options: {
20
20
  ignoreHttpErrors?: boolean;
21
21
  profileTemplatePath?: string;
22
22
  encryptedProfile?: boolean;
23
+ browserPath?: string;
24
+ browserArgs?: string[];
25
+ browserSize?: {
26
+ width: number;
27
+ height: number;
28
+ };
23
29
  } & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
24
30
  export declare function withPlaywrightContext<R>(options: {
25
31
  cdpAddress: string;
@@ -23,6 +23,9 @@ async function withPlaywrightContext({
23
23
  ignoreHttpErrors: cliIgnoreHttpErrors,
24
24
  profileTemplatePath,
25
25
  encryptedProfile,
26
+ browserPath,
27
+ browserArgs,
28
+ browserSize,
26
29
  importFunction,
27
30
  apiName,
28
31
  apiParameters
@@ -59,7 +62,10 @@ async function withPlaywrightContext({
59
62
  downloadsPath,
60
63
  ignoreHttpErrors,
61
64
  profileTemplatePath,
62
- encryptedProfile
65
+ encryptedProfile,
66
+ browserPath,
67
+ browserArgs,
68
+ browserSize
63
69
  }));
64
70
  }
65
71
  return await fn(context, page);
@@ -90,7 +96,10 @@ async function withPlaywrightContext({
90
96
  cdpPort: port,
91
97
  ignoreHttpErrors,
92
98
  profileTemplatePath,
93
- encryptedProfile
99
+ encryptedProfile,
100
+ browserPath,
101
+ browserArgs,
102
+ browserSize
94
103
  }));
95
104
  hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
96
105
  }
@@ -25,6 +25,19 @@ function getObjectSizeInBytes(obj) {
25
25
  return new TextEncoder().encode(String(obj)).length;
26
26
  }
27
27
  }
28
+ const DEFAULT_MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
29
+ const MAX_RESULT_SIZE_BYTES_ENV_VAR = "__INTUNED__MAX_RESULT_SIZE_BYTES";
30
+ function getMaxResultSizeBytes() {
31
+ const raw = process.env[MAX_RESULT_SIZE_BYTES_ENV_VAR];
32
+ if (!raw) {
33
+ return DEFAULT_MAX_RESULT_SIZE_BYTES;
34
+ }
35
+ const parsed = Number(raw);
36
+ if (!Number.isFinite(parsed) || parsed <= 0) {
37
+ return DEFAULT_MAX_RESULT_SIZE_BYTES;
38
+ }
39
+ return Math.floor(parsed);
40
+ }
28
41
  async function runApi({
29
42
  abortSignal,
30
43
  importFunction,
@@ -43,7 +56,8 @@ async function runApi({
43
56
  },
44
57
  runOptions,
45
58
  tracing,
46
- auth
59
+ auth,
60
+ captchaSolver
47
61
  } = inputParseResult.data;
48
62
  const abortSymbol = Symbol("abort");
49
63
  const abortPromise = new Promise(resolve => {
@@ -73,6 +87,9 @@ async function runApi({
73
87
  importFunction
74
88
  };
75
89
  const intunedContext = (0, _asyncLocalStorage.getExecutionContext)();
90
+ if (intunedContext) {
91
+ intunedContext.captchaSolver = captchaSolver;
92
+ }
76
93
  const runAutomationWithContext = async (context, page) => {
77
94
  async function saveTraceIfNeeded({
78
95
  errorMessage
@@ -113,10 +130,10 @@ async function runApi({
113
130
  if (automationFunctionResult === abortSymbol) {
114
131
  return (0, _neverthrow.err)(new _runtimeInterface.AbortedError());
115
132
  }
116
- const MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
133
+ const maxResultSizeBytes = getMaxResultSizeBytes();
117
134
  const resultSizeInBytes = getObjectSizeInBytes(automationFunctionResult);
118
- if (resultSizeInBytes > MAX_RESULT_SIZE_BYTES) {
119
- return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes, MAX_RESULT_SIZE_BYTES));
135
+ if (resultSizeInBytes > maxResultSizeBytes) {
136
+ return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes, maxResultSizeBytes));
120
137
  }
121
138
  if (retrieveSession) {
122
139
  return (0, _neverthrow.ok)({
@@ -150,6 +167,9 @@ async function runApi({
150
167
  ignoreHttpErrors: runOptions.ignoreHttpErrors,
151
168
  profileTemplatePath: runOptions.profileTemplatePath,
152
169
  encryptedProfile: runOptions.encryptedProfile,
170
+ browserPath: runOptions.browserPath,
171
+ browserArgs: runOptions.browserArgs,
172
+ browserSize: runOptions.browserSize,
153
173
  ...playwrightContextParameters
154
174
  }, runAutomationWithContext);
155
175
  } finally {