@intuned/runtime-dev 1.3.17-source.0 → 1.3.17

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 (88) hide show
  1. package/.babelrc +6 -0
  2. package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
  3. package/InterfaceTemplate/index.playwright.ts +1 -1
  4. package/bin/intuned +0 -0
  5. package/bin/intuned-interface +7 -0
  6. package/dist/commands/api/run.js +3 -3
  7. package/dist/commands/auth-sessions/run-check.js +3 -3
  8. package/dist/commands/auth-sessions/run-create.js +3 -3
  9. package/dist/commands/build.js +1 -3
  10. package/dist/commands/common/browserUtils.d.ts +3 -3
  11. package/dist/commands/common/browserUtils.js +3 -4
  12. package/dist/commands/common/getFirstLineNumber.test.js +1 -2
  13. package/dist/commands/common/tsNodeImport.d.ts +1 -1
  14. package/dist/commands/common/tsNodeImport.js +1 -2
  15. package/dist/commands/common/utils/fileUtils.js +1 -2
  16. package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
  17. package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
  18. package/dist/commands/common/utils/template.js +1 -2
  19. package/dist/commands/interface/run.js +23 -49
  20. package/dist/commands/intuned-cli/commands/deploy.command.js +2 -2
  21. package/dist/commands/intuned-cli/commands/provision.command.d.ts +2 -2
  22. package/dist/commands/intuned-cli/commands/provision.command.js +1 -1
  23. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +5 -1
  24. package/dist/commands/intuned-cli/commands/types.d.ts +5 -1
  25. package/dist/commands/intuned-cli/commands/types.js +5 -3
  26. package/dist/commands/intuned-cli/controller/__test__/api.test.js +6 -5
  27. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +6 -5
  28. package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
  29. package/dist/commands/intuned-cli/controller/api.js +3 -3
  30. package/dist/commands/intuned-cli/controller/authSession.d.ts +13 -13
  31. package/dist/commands/intuned-cli/controller/authSession.js +3 -2
  32. package/dist/commands/intuned-cli/controller/build.js +1 -2
  33. package/dist/commands/intuned-cli/controller/deploy.js +1 -2
  34. package/dist/commands/intuned-cli/controller/index.js +1 -2
  35. package/dist/commands/intuned-cli/controller/provision.js +1 -2
  36. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +39 -2
  37. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +3 -3
  38. package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
  39. package/dist/commands/intuned-cli/helpers/auth.js +2 -2
  40. package/dist/commands/intuned-cli/helpers/browser.d.ts +3 -4
  41. package/dist/commands/intuned-cli/helpers/browser.js +31 -2
  42. package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
  43. package/dist/commands/intuned-cli/helpers/errors.js +2 -2
  44. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
  45. package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
  46. package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
  47. package/dist/commands/intuned-cli/helpers/wrapper.js +2 -2
  48. package/dist/commands/intuned-cli/main.js +1 -2
  49. package/dist/commands/intuned-cli/types.d.ts +8 -8
  50. package/dist/commands/ts-check.js +1 -2
  51. package/dist/common/binStartupScript.js +16 -7
  52. package/dist/common/browserTabs.d.ts +72 -0
  53. package/dist/common/browserTabs.js +74 -0
  54. package/dist/common/constants.d.ts +1 -0
  55. package/dist/common/constants.js +2 -1
  56. package/dist/common/contextStorageStateHelpers.d.ts +4 -3
  57. package/dist/common/contextStorageStateHelpers.js +4 -1
  58. package/dist/common/extension/extensionsHelpers.d.ts +1 -1
  59. package/dist/common/extension/types.d.ts +14 -7
  60. package/dist/common/formatZodError.d.ts +1 -1
  61. package/dist/common/intunedJson.d.ts +29 -14
  62. package/dist/common/intunedJson.js +24 -3
  63. package/dist/common/jwtTokenManager.js +10 -6
  64. package/dist/common/launchBrowser.d.ts +1 -0
  65. package/dist/common/launchBrowser.js +32 -5
  66. package/dist/common/playwrightContext.d.ts +3 -5
  67. package/dist/common/playwrightContext.js +9 -11
  68. package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
  69. package/dist/common/runApi/importUsingImportFunction.js +7 -7
  70. package/dist/common/runApi/index.d.ts +3 -6
  71. package/dist/common/runApi/index.js +25 -51
  72. package/dist/common/settingsSchema.d.ts +49 -45
  73. package/dist/common/settingsSchema.js +1 -2
  74. package/dist/common/setupContextHook.d.ts +1 -2
  75. package/dist/common/setupContextHook.js +2 -2
  76. package/dist/common/telemetry.js +1 -2
  77. package/dist/index.d.ts +0 -1
  78. package/dist/index.js +0 -7
  79. package/dist/runtime/downloadDirectory.js +2 -2
  80. package/dist/vendor/runtime-interface.d.ts +1 -0
  81. package/dist/vendor/runtime-interface.js +491 -0
  82. package/package.json +17 -10
  83. package/tsup.config.ts +12 -0
  84. package/WebTemplate.zip +0 -0
  85. package/dist/common/runApi/errors.d.ts +0 -72
  86. package/dist/common/runApi/errors.js +0 -169
  87. package/dist/common/runApi/types.d.ts +0 -830
  88. package/dist/common/runApi/types.js +0 -73
@@ -3,17 +3,17 @@ declare const fileNodeSchema: z.ZodObject<{
3
3
  file: z.ZodObject<{
4
4
  contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
5
5
  }, "strip", z.ZodTypeAny, {
6
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
6
+ contents: string | Uint8Array;
7
7
  }, {
8
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
8
+ contents: string | Uint8Array;
9
9
  }>;
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  file: {
12
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
12
+ contents: string | Uint8Array;
13
13
  };
14
14
  }, {
15
15
  file: {
16
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
16
+ contents: string | Uint8Array;
17
17
  };
18
18
  }>;
19
19
  export type FileNode = z.infer<typeof fileNodeSchema>;
@@ -26,17 +26,17 @@ export declare const fileSystemTreeSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[
26
26
  file: z.ZodObject<{
27
27
  contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
28
28
  }, "strip", z.ZodTypeAny, {
29
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
29
+ contents: string | Uint8Array;
30
30
  }, {
31
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
31
+ contents: string | Uint8Array;
32
32
  }>;
33
33
  }, "strip", z.ZodTypeAny, {
34
34
  file: {
35
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
35
+ contents: string | Uint8Array;
36
36
  };
37
37
  }, {
38
38
  file: {
39
- contents: (string | Uint8Array) & (string | Uint8Array | undefined);
39
+ contents: string | Uint8Array;
40
40
  };
41
41
  }>]>>;
42
42
  export type FileSystemTree = z.infer<typeof fileSystemTreeSchema>;
@@ -6,8 +6,7 @@ var _commander = require("commander");
6
6
  var fs = _interopRequireWildcard(require("fs-extra"));
7
7
  var path = _interopRequireWildcard(require("path"));
8
8
  var _template = require("./common/utils/template");
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
9
+ 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); }
11
10
  _commander.program.description("Check TypeScript types in the project").option("-t, --template <type>", "template to use", "InterfaceTemplate").allowUnknownOption().action(async ({
12
11
  template
13
12
  }) => {
@@ -3,28 +3,37 @@
3
3
  var _dotenv = _interopRequireDefault(require("dotenv"));
4
4
  var path = _interopRequireWildcard(require("path"));
5
5
  var _intunedJson = require("./intunedJson");
6
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
7
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
6
+ 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); }
8
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
8
  _dotenv.default.config({
10
9
  path: `.env`
11
10
  });
12
- function isStealthModeEnabled() {
11
+ function getStealthModeConfig() {
13
12
  try {
14
13
  const settingsResult = (0, _intunedJson.loadIntunedJsonSync)();
15
14
  if (settingsResult.isErr()) {
16
15
  console.error(`Warning: Failed to load Intuned settings: ${settingsResult.error}
17
16
  Stealth mode will not be enabled.`);
18
- return false;
17
+ return {
18
+ enabled: false,
19
+ type: "patchright"
20
+ };
19
21
  }
20
- return settingsResult.value.stealthMode?.enabled === true;
22
+ return {
23
+ enabled: settingsResult.value.stealthMode?.enabled === true,
24
+ type: settingsResult.value.stealthMode?.type || "patchright"
25
+ };
21
26
  } catch (error) {
22
27
  console.error("Error reading Intuned.json:", error.message);
23
- return false;
28
+ return {
29
+ enabled: false,
30
+ type: "patchright"
31
+ };
24
32
  }
25
33
  }
26
34
  try {
27
- if (isStealthModeEnabled()) {
35
+ const stealthConfig = getStealthModeConfig();
36
+ if (stealthConfig.enabled && stealthConfig.type === "patchright") {
28
37
  const currentNodeModules = path.resolve(process.cwd(), "node_modules");
29
38
  process.env.NODE_PATH = process.env.NODE_PATH ? `${process.env.NODE_PATH}:${currentNodeModules}` : currentNodeModules;
30
39
  require("module").Module._initPaths();
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Tab management utilities using CDP HTTP API.
3
+ *
4
+ * Provides functions to interact with browser tabs via Chrome DevTools Protocol HTTP endpoints.
5
+ * Refer to https://chromedevtools.github.io/devtools-protocol/ for the endpoints documentation.
6
+ * This approach is simpler than using the playwright API because it doesn't require us to create a playwright context.
7
+ */
8
+ export interface CDPTabInfo {
9
+ id: string;
10
+ type: string;
11
+ title: string;
12
+ url: string;
13
+ webSocketDebuggerUrl?: string;
14
+ devtoolsFrontendUrl?: string;
15
+ faviconUrl?: string;
16
+ description?: string;
17
+ }
18
+ /**
19
+ * Fetch current tabs from CDP /json endpoint.
20
+ *
21
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
22
+ * @returns List of tab info dictionaries from CDP (filtered to only "page" type)
23
+ *
24
+ * @example
25
+ * const tabs = await getCDPTabs("http://localhost:9222");
26
+ * // Returns:
27
+ * // [
28
+ * // {
29
+ * // "id": "1234",
30
+ * // "type": "page",
31
+ * // "title": "Google",
32
+ * // "url": "https://google.com",
33
+ * // ...
34
+ * // }
35
+ * // ]
36
+ */
37
+ export declare function getCDPTabs(cdpAddress: string): Promise<CDPTabInfo[]>;
38
+ /**
39
+ * Create new tab via CDP /json/new endpoint with optional URL.
40
+ *
41
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
42
+ * @param url - Initial URL for the tab (default: "about:blank")
43
+ * @returns Tab info dictionary from CDP
44
+ *
45
+ * @example
46
+ * const tab = await createCDPTab("http://localhost:9222", "https://google.com");
47
+ * // Returns:
48
+ * // {
49
+ * // "id": "1234",
50
+ * // "type": "page",
51
+ * // "title": "New Tab",
52
+ * // "url": "about:blank",
53
+ * // ...
54
+ * // }
55
+ */
56
+ export declare function createCDPTab(cdpAddress: string, url?: string): Promise<CDPTabInfo>;
57
+ /**
58
+ * Close tab via CDP /json/close/{id} endpoint.
59
+ *
60
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
61
+ * @param cdpTargetId - Full CDP target ID to close
62
+ * @returns True if successful, False otherwise
63
+ */
64
+ export declare function closeCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
65
+ /**
66
+ * Activate/bring to front a tab via CDP /json/activate/{id} endpoint.
67
+ *
68
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
69
+ * @param cdpTargetId - Full CDP target ID to activate
70
+ * @returns True if successful, False otherwise
71
+ */
72
+ export declare function activateCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.activateCDPTab = activateCDPTab;
7
+ exports.closeCDPTab = closeCDPTab;
8
+ exports.createCDPTab = createCDPTab;
9
+ exports.getCDPTabs = getCDPTabs;
10
+ const DEFAULT_TIMEOUT = 5000;
11
+ async function getCDPTabs(cdpAddress) {
12
+ const controller = new AbortController();
13
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
14
+ try {
15
+ const response = await fetch(`${cdpAddress}/json`, {
16
+ signal: controller.signal
17
+ });
18
+ if (!response.ok) {
19
+ throw new Error(`HTTP error! status: ${response.status}`);
20
+ }
21
+ const tabs = await response.json();
22
+ return tabs.filter(tab => tab.type === "page");
23
+ } finally {
24
+ clearTimeout(timeoutId);
25
+ }
26
+ }
27
+ async function createCDPTab(cdpAddress, url = "about:blank") {
28
+ const controller = new AbortController();
29
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
30
+ try {
31
+ let endpoint = `${cdpAddress}/json/new`;
32
+ if (url && url !== "about:blank") {
33
+ endpoint = `${endpoint}?${url}`;
34
+ }
35
+ const response = await fetch(endpoint, {
36
+ method: "PUT",
37
+ signal: controller.signal
38
+ });
39
+ if (!response.ok) {
40
+ throw new Error(`HTTP error! status: ${response.status}`);
41
+ }
42
+ return await response.json();
43
+ } finally {
44
+ clearTimeout(timeoutId);
45
+ }
46
+ }
47
+ async function closeCDPTab(cdpAddress, cdpTargetId) {
48
+ const controller = new AbortController();
49
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
50
+ try {
51
+ const response = await fetch(`${cdpAddress}/json/close/${cdpTargetId}`, {
52
+ signal: controller.signal
53
+ });
54
+ return response.status === 200;
55
+ } catch {
56
+ return false;
57
+ } finally {
58
+ clearTimeout(timeoutId);
59
+ }
60
+ }
61
+ async function activateCDPTab(cdpAddress, cdpTargetId) {
62
+ const controller = new AbortController();
63
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
64
+ try {
65
+ const response = await fetch(`${cdpAddress}/json/activate/${cdpTargetId}`, {
66
+ signal: controller.signal
67
+ });
68
+ return response.status === 200;
69
+ } catch {
70
+ return false;
71
+ } finally {
72
+ clearTimeout(timeoutId);
73
+ }
74
+ }
@@ -5,6 +5,7 @@ export declare const WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
5
5
  export declare const EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
6
6
  export declare const PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
7
7
  export declare const API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
8
+ export declare const AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
8
9
  export declare const API_KEY_HEADER_NAME = "x-api-key";
9
10
  export declare const API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
10
11
  export declare const CLI_ENV_VAR_KEY = "INTUNED_CLI";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
6
+ exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
7
7
  const API_FOLDER_NAME = exports.API_FOLDER_NAME = "api";
8
8
  const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
9
9
  const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
@@ -11,6 +11,7 @@ const WORKSPACE_ID_ENV_VAR_KEY = exports.WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WOR
11
11
  const EXTENSION_PATH_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
12
12
  const PROJECT_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
13
13
  const API_KEY_ENV_VAR_KEY = exports.API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
14
+ const AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
14
15
  const API_KEY_HEADER_NAME = exports.API_KEY_HEADER_NAME = "x-api-key";
15
16
  const API_BASE_URL_ENV_VAR_KEY = exports.API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
16
17
  const CLI_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = "INTUNED_CLI";
@@ -1,4 +1,5 @@
1
- import * as playwright from "playwright";
1
+ import type * as playwright from "playwright";
2
+ import type { RunApiStorageState } from "@intuned/runtime-interface";
2
3
  interface StorageEntry {
3
4
  name: string;
4
5
  value: string;
@@ -16,6 +17,6 @@ export interface StorageState {
16
17
  origins?: LocalStorageState[] | null;
17
18
  sessionStorage?: SessionStorageState[] | null;
18
19
  }
19
- export declare function setStorageState(context: playwright.BrowserContext, state: StorageState): Promise<void>;
20
- export declare function getStorageState(context: playwright.BrowserContext): Promise<StorageState>;
20
+ export declare function setStorageState(context: playwright.BrowserContext, state: RunApiStorageState): Promise<void>;
21
+ export declare function getStorageState(context: playwright.BrowserContext): Promise<RunApiStorageState>;
21
22
  export {};
@@ -50,7 +50,10 @@ async function setStorageState(context, state) {
50
50
  await page.close();
51
51
  }
52
52
  async function getStorageState(context) {
53
- const result = {};
53
+ const result = {
54
+ cookies: [],
55
+ origins: []
56
+ };
54
57
  const storageState = await context.storageState();
55
58
  result.cookies = storageState.cookies;
56
59
  result.origins = storageState.origins;
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright";
1
+ import type * as playwright from "playwright";
2
2
  import { CaptchaSolverSettings, CaptchaSolverSettingsWithRunContext } from "../settingsSchema";
3
3
  export declare function resolveCaptchaSolverSettings(input?: unknown): Promise<CaptchaSolverSettings>;
4
4
  export declare function isIntunedExtensionLoaded(): boolean;
@@ -34,10 +34,11 @@ declare const captchaBaseSchema: z.ZodObject<{
34
34
  }>;
35
35
  export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
36
36
  declare const captchaNonErrorSchema: z.ZodObject<{
37
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
38
37
  id: z.ZodString;
39
38
  tabId: z.ZodNumber;
39
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
40
40
  retryCount: z.ZodOptional<z.ZodNumber>;
41
+ } & {
41
42
  status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
42
43
  }, "strip", z.ZodTypeAny, {
43
44
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -54,10 +55,11 @@ declare const captchaNonErrorSchema: z.ZodObject<{
54
55
  }>;
55
56
  export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
56
57
  declare const captchaErrorStatusSchema: z.ZodObject<{
57
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
58
58
  id: z.ZodString;
59
59
  tabId: z.ZodNumber;
60
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
60
61
  retryCount: z.ZodOptional<z.ZodNumber>;
62
+ } & {
61
63
  status: z.ZodLiteral<"error">;
62
64
  error: z.ZodObject<{
63
65
  code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
@@ -92,10 +94,11 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
92
94
  }>;
93
95
  export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
94
96
  export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
95
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
96
97
  id: z.ZodString;
97
98
  tabId: z.ZodNumber;
99
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
98
100
  retryCount: z.ZodOptional<z.ZodNumber>;
101
+ } & {
99
102
  status: z.ZodLiteral<"attached">;
100
103
  }, "strip", z.ZodTypeAny, {
101
104
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -110,10 +113,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
110
113
  tabId: number;
111
114
  retryCount?: number | undefined;
112
115
  }>, z.ZodObject<{
113
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
114
116
  id: z.ZodString;
115
117
  tabId: z.ZodNumber;
118
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
116
119
  retryCount: z.ZodOptional<z.ZodNumber>;
120
+ } & {
117
121
  status: z.ZodLiteral<"solving">;
118
122
  }, "strip", z.ZodTypeAny, {
119
123
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -128,10 +132,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
128
132
  tabId: number;
129
133
  retryCount?: number | undefined;
130
134
  }>, z.ZodObject<{
131
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
132
135
  id: z.ZodString;
133
136
  tabId: z.ZodNumber;
137
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
134
138
  retryCount: z.ZodOptional<z.ZodNumber>;
139
+ } & {
135
140
  status: z.ZodLiteral<"solved">;
136
141
  }, "strip", z.ZodTypeAny, {
137
142
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -146,10 +151,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
146
151
  tabId: number;
147
152
  retryCount?: number | undefined;
148
153
  }>, z.ZodObject<{
149
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
150
154
  id: z.ZodString;
151
155
  tabId: z.ZodNumber;
156
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
152
157
  retryCount: z.ZodOptional<z.ZodNumber>;
158
+ } & {
153
159
  status: z.ZodLiteral<"detached">;
154
160
  }, "strip", z.ZodTypeAny, {
155
161
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -164,10 +170,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
164
170
  tabId: number;
165
171
  retryCount?: number | undefined;
166
172
  }>, z.ZodObject<{
167
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
168
173
  id: z.ZodString;
169
174
  tabId: z.ZodNumber;
175
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
170
176
  retryCount: z.ZodOptional<z.ZodNumber>;
177
+ } & {
171
178
  status: z.ZodLiteral<"error">;
172
179
  error: z.ZodObject<{
173
180
  code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
@@ -1,2 +1,2 @@
1
- import { ZodError } from "zod";
1
+ import { ZodError } from "zod/v3";
2
2
  export declare function formatZodError(zodError: ZodError): string[];
@@ -18,10 +18,13 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
18
18
  }>>>;
19
19
  stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
20
20
  enabled: z.ZodBoolean;
21
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["intunedBrowser", "patchright"]>>>;
21
22
  }, "strip", z.ZodTypeAny, {
23
+ type: "intunedBrowser" | "patchright";
22
24
  enabled: boolean;
23
25
  }, {
24
26
  enabled: boolean;
27
+ type?: "intunedBrowser" | "patchright" | undefined;
25
28
  }>>>;
26
29
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
27
30
  projectName: z.ZodOptional<z.ZodString>;
@@ -41,10 +44,13 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
41
44
  }>>>;
42
45
  stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
43
46
  enabled: z.ZodBoolean;
47
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["intunedBrowser", "patchright"]>>>;
44
48
  }, "strip", z.ZodTypeAny, {
49
+ type: "intunedBrowser" | "patchright";
45
50
  enabled: boolean;
46
51
  }, {
47
52
  enabled: boolean;
53
+ type?: "intunedBrowser" | "patchright" | undefined;
48
54
  }>>>;
49
55
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
50
56
  projectName: z.ZodOptional<z.ZodString>;
@@ -64,10 +70,13 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
64
70
  }>>>;
65
71
  stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
66
72
  enabled: z.ZodBoolean;
73
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["intunedBrowser", "patchright"]>>>;
67
74
  }, "strip", z.ZodTypeAny, {
75
+ type: "intunedBrowser" | "patchright";
68
76
  enabled: boolean;
69
77
  }, {
70
78
  enabled: boolean;
79
+ type?: "intunedBrowser" | "patchright" | undefined;
71
80
  }>>>;
72
81
  }, z.ZodTypeAny, "passthrough">>, z.ZodUnion<[z.ZodObject<{
73
82
  authSessions: z.ZodObject<{
@@ -111,12 +120,12 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
111
120
  startUrl: z.ZodOptional<z.ZodString>;
112
121
  finishUrl: z.ZodOptional<z.ZodString>;
113
122
  }, "strip", z.ZodTypeAny, {
114
- type: "API" | "MANUAL";
123
+ type: "MANUAL" | "API";
115
124
  enabled: true;
116
125
  startUrl?: string | undefined;
117
126
  finishUrl?: string | undefined;
118
127
  }, {
119
- type: "API" | "MANUAL";
128
+ type: "MANUAL" | "API";
120
129
  enabled: true;
121
130
  startUrl?: string | undefined;
122
131
  finishUrl?: string | undefined;
@@ -132,7 +141,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
132
141
  authSessions: {
133
142
  enabled: false;
134
143
  } | {
135
- type: "API" | "MANUAL";
144
+ type: "MANUAL" | "API";
136
145
  enabled: true;
137
146
  startUrl?: string | undefined;
138
147
  finishUrl?: string | undefined;
@@ -144,7 +153,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
144
153
  authSessions: {
145
154
  enabled: false;
146
155
  } | {
147
- type: "API" | "MANUAL";
156
+ type: "MANUAL" | "API";
148
157
  enabled: true;
149
158
  startUrl?: string | undefined;
150
159
  finishUrl?: string | undefined;
@@ -156,16 +165,17 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
156
165
  export type IntunedJson = z.infer<typeof intunedJsonSchema>;
157
166
  export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
158
167
  export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
159
- projectName?: string | undefined;
168
+ stealthMode?: {
169
+ type: "intunedBrowser" | "patchright";
170
+ enabled: boolean;
171
+ } | undefined;
160
172
  workspaceId?: string | undefined;
173
+ projectName?: string | undefined;
161
174
  metadata?: {
162
175
  defaultJobInput?: Record<string, any> | undefined;
163
176
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
164
177
  testAuthSessionInput?: Record<string, any> | undefined;
165
178
  } | undefined;
166
- stealthMode?: {
167
- enabled: boolean;
168
- } | undefined;
169
179
  } & {
170
180
  [k: string]: unknown;
171
181
  } & ({
@@ -179,7 +189,7 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
179
189
  authSessions: {
180
190
  enabled: false;
181
191
  } | {
182
- type: "API" | "MANUAL";
192
+ type: "MANUAL" | "API";
183
193
  enabled: true;
184
194
  startUrl?: string | undefined;
185
195
  finishUrl?: string | undefined;
@@ -195,16 +205,17 @@ export declare function getIntunedSettingsFile(): Promise<Ok<{
195
205
  }, never> | Err<never, string>>;
196
206
  export declare function getIntunedSettingsFileName(): Promise<Err<never, string> | Ok<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml", never>>;
197
207
  export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
198
- projectName?: string | undefined;
208
+ stealthMode?: {
209
+ type: "intunedBrowser" | "patchright";
210
+ enabled: boolean;
211
+ } | undefined;
199
212
  workspaceId?: string | undefined;
213
+ projectName?: string | undefined;
200
214
  metadata?: {
201
215
  defaultJobInput?: Record<string, any> | undefined;
202
216
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
203
217
  testAuthSessionInput?: Record<string, any> | undefined;
204
218
  } | undefined;
205
- stealthMode?: {
206
- enabled: boolean;
207
- } | undefined;
208
219
  } & {
209
220
  [k: string]: unknown;
210
221
  } & ({
@@ -218,7 +229,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
218
229
  authSessions: {
219
230
  enabled: false;
220
231
  } | {
221
- type: "API" | "MANUAL";
232
+ type: "MANUAL" | "API";
222
233
  enabled: true;
223
234
  startUrl?: string | undefined;
224
235
  finishUrl?: string | undefined;
@@ -227,3 +238,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
227
238
  enabled: true;
228
239
  };
229
240
  }), never>;
241
+ export declare function getStealthModeConfig(): Promise<{
242
+ enabled: boolean;
243
+ type: "intunedBrowser" | "patchright";
244
+ }>;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getIntunedSettingsFile = getIntunedSettingsFile;
7
7
  exports.getIntunedSettingsFileName = getIntunedSettingsFileName;
8
+ exports.getStealthModeConfig = getStealthModeConfig;
8
9
  exports.intunedSettingsFileNames = exports.intunedJsonSchema = void 0;
9
10
  exports.loadIntunedJson = loadIntunedJson;
10
11
  exports.loadIntunedJsonSync = loadIntunedJsonSync;
@@ -16,8 +17,7 @@ var YAML = _interopRequireWildcard(require("yaml"));
16
17
  var TOML = _interopRequireWildcard(require("smol-toml"));
17
18
  var _neverthrow = require("neverthrow");
18
19
  var _formatZodError = require("./formatZodError");
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ 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); }
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  const playwright = undefined;
23
23
  const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
@@ -29,7 +29,8 @@ const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
29
29
  testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
30
30
  }).optional().catch(undefined),
31
31
  stealthMode: _zod.z.object({
32
- enabled: _zod.z.boolean()
32
+ enabled: _zod.z.boolean(),
33
+ type: _zod.z.enum(["intunedBrowser", "patchright"]).optional().default("patchright")
33
34
  }).optional().catch(undefined)
34
35
  }).passthrough().and(_zod.z.union([_zod.z.object({
35
36
  authSessions: _zod.z.object({
@@ -130,4 +131,24 @@ function getIntunedSettingsFileSync() {
130
131
  }
131
132
  }
132
133
  return (0, _neverthrow.err)("No Intuned settings file found.");
134
+ }
135
+ async function getStealthModeConfig() {
136
+ try {
137
+ const settingsResult = await loadIntunedJson();
138
+ if (settingsResult.isErr()) {
139
+ return {
140
+ enabled: false,
141
+ type: "patchright"
142
+ };
143
+ }
144
+ return {
145
+ enabled: settingsResult.value.stealthMode?.enabled === true,
146
+ type: settingsResult.value.stealthMode?.type || "patchright"
147
+ };
148
+ } catch {
149
+ return {
150
+ enabled: false,
151
+ type: "patchright"
152
+ };
153
+ }
133
154
  }