camoucore 0.3.0 → 0.6.1

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 (168) hide show
  1. package/LICENSE +4 -3
  2. package/dist/camoufox/__main__.d.ts +10 -0
  3. package/dist/camoufox/__main__.js +1175 -0
  4. package/dist/camoufox/__version__.d.ts +31 -0
  5. package/dist/camoufox/__version__.js +32 -0
  6. package/dist/camoufox/_humanize_playwright.d.ts +54 -0
  7. package/dist/camoufox/_humanize_playwright.js +429 -0
  8. package/dist/camoufox/addons.d.ts +21 -0
  9. package/dist/camoufox/addons.js +56 -0
  10. package/dist/camoufox/async_api.d.ts +9 -0
  11. package/dist/camoufox/async_api.js +9 -0
  12. package/dist/camoufox/browser-pin.d.ts +46 -0
  13. package/dist/camoufox/browser-pin.js +96 -0
  14. package/dist/camoufox/cli.d.ts +7 -0
  15. package/dist/camoufox/cli.js +20 -0
  16. package/dist/camoufox/coherence.d.ts +141 -0
  17. package/dist/camoufox/coherence.js +708 -0
  18. package/dist/camoufox/data-files/browser-pin.json +7 -0
  19. package/dist/camoufox/data-files/essential-fonts.json +5 -0
  20. package/dist/camoufox/data-files/fingerprint-presets-v150.json +14544 -0
  21. package/dist/camoufox/data-files/fingerprint-presets.json +5192 -0
  22. package/dist/camoufox/data-files/font-bases.json +1887 -0
  23. package/dist/camoufox/data-files/font-groups.json +716 -0
  24. package/dist/camoufox/data-files/fonts.json +240 -0
  25. package/dist/camoufox/data-files/fpgen.yml +44 -0
  26. package/dist/camoufox/data-files/launcher-constants.json +66 -0
  27. package/dist/camoufox/data-files/media-devices.json +148 -0
  28. package/dist/camoufox/data-files/repos.yml +40 -0
  29. package/dist/camoufox/data-files/voice-manifests.json +1864 -0
  30. package/dist/camoufox/data-files/voice-uris.json +188 -0
  31. package/dist/camoufox/data-files/warnings.yml +132 -0
  32. package/dist/camoufox/display_profile.d.ts +17 -0
  33. package/dist/camoufox/display_profile.js +72 -0
  34. package/dist/camoufox/driver_defaults.d.ts +25 -0
  35. package/dist/camoufox/driver_defaults.js +114 -0
  36. package/dist/camoufox/exceptions.d.ts +78 -0
  37. package/dist/camoufox/exceptions.js +135 -0
  38. package/dist/camoufox/fingerprints.d.ts +341 -0
  39. package/dist/camoufox/fingerprints.js +1682 -0
  40. package/dist/camoufox/gpudisplay.d.ts +158 -0
  41. package/dist/camoufox/gpudisplay.js +695 -0
  42. package/dist/camoufox/host_rendering.d.ts +38 -0
  43. package/dist/camoufox/host_rendering.js +180 -0
  44. package/dist/camoufox/humanize.d.ts +89 -0
  45. package/dist/camoufox/humanize.js +143 -0
  46. package/dist/camoufox/index.d.ts +21 -0
  47. package/dist/camoufox/index.js +21 -0
  48. package/dist/camoufox/ip.d.ts +45 -0
  49. package/dist/camoufox/ip.js +114 -0
  50. package/dist/camoufox/multiversion.d.ts +131 -0
  51. package/dist/camoufox/multiversion.js +489 -0
  52. package/dist/camoufox/node-floor.d.ts +5 -0
  53. package/dist/camoufox/node-floor.js +17 -0
  54. package/dist/camoufox/paths.d.ts +45 -0
  55. package/dist/camoufox/paths.js +59 -0
  56. package/dist/camoufox/pkgman.d.ts +331 -0
  57. package/dist/camoufox/pkgman.js +972 -0
  58. package/dist/camoufox/product.d.ts +8 -0
  59. package/dist/camoufox/product.js +8 -0
  60. package/dist/camoufox/pycompat.d.ts +97 -0
  61. package/dist/camoufox/pycompat.js +458 -0
  62. package/dist/camoufox/server.d.ts +36 -0
  63. package/dist/camoufox/server.js +82 -0
  64. package/dist/camoufox/sync_api.d.ts +77 -0
  65. package/dist/camoufox/sync_api.js +194 -0
  66. package/dist/camoufox/utils.d.ts +515 -0
  67. package/dist/camoufox/utils.js +1995 -0
  68. package/dist/camoufox/warnings.d.ts +16 -0
  69. package/dist/camoufox/warnings.js +65 -0
  70. package/dist/camoufox/webgl.d.ts +52 -0
  71. package/dist/camoufox/webgl.js +264 -0
  72. package/dist/camouwolf/__main__.d.ts +10 -0
  73. package/dist/camouwolf/__main__.js +1180 -0
  74. package/dist/camouwolf/__version__.d.ts +31 -0
  75. package/dist/camouwolf/__version__.js +32 -0
  76. package/dist/camouwolf/_humanize_playwright.d.ts +53 -0
  77. package/dist/camouwolf/_humanize_playwright.js +427 -0
  78. package/dist/camouwolf/addons.d.ts +42 -0
  79. package/dist/camouwolf/addons.js +113 -0
  80. package/dist/camouwolf/async_api.d.ts +9 -0
  81. package/dist/camouwolf/async_api.js +9 -0
  82. package/dist/camouwolf/browser-pin.d.ts +46 -0
  83. package/dist/camouwolf/browser-pin.js +96 -0
  84. package/dist/camouwolf/cli.d.ts +7 -0
  85. package/dist/camouwolf/cli.js +20 -0
  86. package/dist/camouwolf/clienthints.d.ts +61 -0
  87. package/dist/camouwolf/clienthints.js +176 -0
  88. package/dist/camouwolf/coherence.d.ts +152 -0
  89. package/dist/camouwolf/coherence.js +554 -0
  90. package/dist/camouwolf/data-files/browser-pin.json +7 -0
  91. package/dist/camouwolf/data-files/camouwolf.defaults.json +118 -0
  92. package/dist/camouwolf/data-files/data/bundle-fonts.json +1983 -0
  93. package/dist/camouwolf/data-files/data/chrome-languages.json +517 -0
  94. package/dist/camouwolf/data-files/data/properties.json +321 -0
  95. package/dist/camouwolf/data-files/data/system-colors.json +35 -0
  96. package/dist/camouwolf/data-files/data/ubo.json +6 -0
  97. package/dist/camouwolf/data-files/fpgen.yml +41 -0
  98. package/dist/camouwolf/data-files/launcher-constants.json +26 -0
  99. package/dist/camouwolf/data-files/repos.yml +23 -0
  100. package/dist/camouwolf/data-files/warnings.yml +96 -0
  101. package/dist/camouwolf/driver_defaults.d.ts +25 -0
  102. package/dist/camouwolf/driver_defaults.js +114 -0
  103. package/dist/camouwolf/exceptions.d.ts +95 -0
  104. package/dist/camouwolf/exceptions.js +150 -0
  105. package/dist/camouwolf/fingerprints.d.ts +227 -0
  106. package/dist/camouwolf/fingerprints.js +753 -0
  107. package/dist/camouwolf/gpudisplay.d.ts +171 -0
  108. package/dist/camouwolf/gpudisplay.js +711 -0
  109. package/dist/camouwolf/host_rendering.d.ts +18 -0
  110. package/dist/camouwolf/host_rendering.js +114 -0
  111. package/dist/camouwolf/humanize.d.ts +84 -0
  112. package/dist/camouwolf/humanize.js +128 -0
  113. package/dist/camouwolf/index.d.ts +22 -0
  114. package/dist/camouwolf/index.js +21 -0
  115. package/dist/camouwolf/multiversion.d.ts +131 -0
  116. package/dist/camouwolf/multiversion.js +491 -0
  117. package/dist/camouwolf/node-floor.d.ts +5 -0
  118. package/dist/camouwolf/node-floor.js +17 -0
  119. package/dist/camouwolf/paths.d.ts +34 -0
  120. package/dist/camouwolf/paths.js +58 -0
  121. package/dist/camouwolf/pkgman.d.ts +331 -0
  122. package/dist/camouwolf/pkgman.js +972 -0
  123. package/dist/camouwolf/product.d.ts +3 -0
  124. package/dist/camouwolf/product.js +3 -0
  125. package/dist/camouwolf/pycompat.d.ts +92 -0
  126. package/dist/camouwolf/pycompat.js +461 -0
  127. package/dist/camouwolf/server.d.ts +36 -0
  128. package/dist/camouwolf/server.js +81 -0
  129. package/dist/camouwolf/switches.d.ts +77 -0
  130. package/dist/camouwolf/switches.js +222 -0
  131. package/dist/camouwolf/sync_api.d.ts +84 -0
  132. package/dist/camouwolf/sync_api.js +173 -0
  133. package/dist/camouwolf/utils.d.ts +644 -0
  134. package/dist/camouwolf/utils.js +2057 -0
  135. package/dist/camouwolf/warnings.d.ts +14 -0
  136. package/dist/camouwolf/warnings.js +59 -0
  137. package/dist/camouwolf/webgl.d.ts +41 -0
  138. package/dist/camouwolf/webgl.js +198 -0
  139. package/dist/data.d.ts +1 -1
  140. package/dist/data.js +3 -3
  141. package/dist/download.js +1 -1
  142. package/dist/exceptions.d.ts +1 -1
  143. package/dist/exceptions.js +1 -1
  144. package/dist/geolocation.js +1 -1
  145. package/dist/host.js +1 -1
  146. package/dist/ip.js +1 -1
  147. package/dist/locales.js +1 -1
  148. package/dist/mcp/cli.d.ts +15 -0
  149. package/dist/mcp/cli.js +108 -0
  150. package/dist/mcp/index.d.ts +8 -0
  151. package/dist/mcp/index.js +8 -0
  152. package/dist/mcp/main.d.ts +2 -0
  153. package/dist/mcp/main.js +8 -0
  154. package/dist/mcp/secrets.d.ts +50 -0
  155. package/dist/mcp/secrets.js +193 -0
  156. package/dist/mcp/server.d.ts +48 -0
  157. package/dist/mcp/server.js +653 -0
  158. package/dist/mcp/tree.d.ts +10 -0
  159. package/dist/mcp/tree.js +36 -0
  160. package/dist/passthrough.d.ts +1 -1
  161. package/dist/product.js +1 -1
  162. package/dist/settings.js +1 -1
  163. package/dist/telemetry.d.ts +0 -1
  164. package/dist/telemetry.js +5 -4
  165. package/dist/virtdisplay.d.ts +1 -1
  166. package/dist/virtdisplay.js +1 -1
  167. package/dist/warnings.js +1 -1
  168. package/package.json +57 -13
@@ -0,0 +1,135 @@
1
+ /**
2
+ * TypeScript twin of python/camoucore/src/camoucore/camoufox/exceptions.py. The errors the core
3
+ * raises are camoucore's, re-exported so `catch` sites keep one import.
4
+ *
5
+ * The Python hierarchy leans on builtin bases (FileNotFoundError, ValueError,
6
+ * ImportError) that have no JS analogue; those become plain Error subclasses
7
+ * here. Every relationship that callers actually catch on -- LocaleError,
8
+ * VirtualDisplayError -- is preserved.
9
+ */
10
+ import { VirtualDisplayError } from "../exceptions.js";
11
+ export { CannotExecuteXvfb, CannotFindXvfb, CorruptedDownload, InvalidIP, InvalidLocale, InvalidProxy, LocaleError, NotInstalledGeoIPExtra, UnknownIPLocation, UnknownLanguage, UnknownTerritory, UnsupportedOS, VirtualDisplayError, VirtualDisplayNotSupported, } from "../exceptions.js";
12
+ /** The Python twin relies on the builtin FileNotFoundError; JS has no such
13
+ * class, so version-lookup misses raise this instead. */
14
+ export class FileNotFoundError extends Error {
15
+ constructor(message) {
16
+ super(message ?? "File couldn't be found.");
17
+ this.name = "FileNotFoundError";
18
+ }
19
+ }
20
+ export class UnsupportedVersion extends Error {
21
+ constructor(message) {
22
+ super(message ?? "The Camoufox executable is outdated.");
23
+ this.name = "UnsupportedVersion";
24
+ }
25
+ }
26
+ export class MissingRelease extends Error {
27
+ constructor(message) {
28
+ super(message ?? "A required GitHub release asset is missing.");
29
+ this.name = "MissingRelease";
30
+ }
31
+ }
32
+ export class UnsupportedArchitecture extends Error {
33
+ constructor(message) {
34
+ super(message ?? "The architecture is not supported.");
35
+ this.name = "UnsupportedArchitecture";
36
+ }
37
+ }
38
+ export class InvalidPropertyType extends Error {
39
+ constructor(message) {
40
+ super(message ?? "The property type is invalid.");
41
+ this.name = "InvalidPropertyType";
42
+ }
43
+ }
44
+ export class InvalidAddonPath extends FileNotFoundError {
45
+ constructor(message) {
46
+ super(message ?? "The addon path is invalid.");
47
+ this.name = "InvalidAddonPath";
48
+ }
49
+ }
50
+ export class NonFirefoxFingerprint extends Error {
51
+ constructor(message) {
52
+ super(message ?? "A passed fingerprint is not a Firefox fingerprint.");
53
+ this.name = "NonFirefoxFingerprint";
54
+ }
55
+ }
56
+ export class InvalidOS extends Error {
57
+ constructor(message) {
58
+ super(message ?? "The target OS is invalid.");
59
+ this.name = "InvalidOS";
60
+ }
61
+ }
62
+ export class GpuDisplayError extends VirtualDisplayError {
63
+ constructor(message) {
64
+ super(message ?? "The headless='virtual-gpu' display cannot be used.");
65
+ this.name = "GpuDisplayError";
66
+ }
67
+ }
68
+ export class NoGpuFound extends GpuDisplayError {
69
+ constructor(message) {
70
+ super(message ?? "No GPU render node with a PCI address was found.");
71
+ this.name = "NoGpuFound";
72
+ }
73
+ }
74
+ export class AmbiguousGpuSelection extends GpuDisplayError {
75
+ constructor(message) {
76
+ super(message ?? "Several GPUs match, or several exist and none was named.");
77
+ this.name = "AmbiguousGpuSelection";
78
+ }
79
+ }
80
+ export class GpuNotFound extends GpuDisplayError {
81
+ constructor(message) {
82
+ super(message ?? "The GPU selector matches no GPU.");
83
+ this.name = "GpuNotFound";
84
+ }
85
+ }
86
+ export class CannotFindXorg extends GpuDisplayError {
87
+ constructor(message) {
88
+ super(message ?? "Xorg cannot be found.");
89
+ this.name = "CannotFindXorg";
90
+ }
91
+ }
92
+ export class CannotExecuteXorg extends GpuDisplayError {
93
+ constructor(message) {
94
+ super(message ?? "Xorg cannot be started, or exited right after starting.");
95
+ this.name = "CannotExecuteXorg";
96
+ }
97
+ }
98
+ export class GpuVtTakeover extends GpuDisplayError {
99
+ constructor(message) {
100
+ super(message ?? "The Xorg server switched the active console VT.");
101
+ this.name = "GpuVtTakeover";
102
+ }
103
+ }
104
+ export class GpuSoftwareFallback extends GpuDisplayError {
105
+ constructor(message) {
106
+ super(message ?? "The browser on a GPU display never rendered on the GPU.");
107
+ this.name = "GpuSoftwareFallback";
108
+ }
109
+ }
110
+ export class CamoufoxNotInstalled extends FileNotFoundError {
111
+ constructor(message) {
112
+ super(message ?? "Camoufox is not installed.");
113
+ this.name = "CamoufoxNotInstalled";
114
+ }
115
+ }
116
+ /** Raised when Camoufox's required runtime directory cannot be prepared. */
117
+ export class ProfileDirectoryError extends Error {
118
+ constructor(message, options) {
119
+ super(message ?? "Camoufox's runtime directory could not be prepared.", options);
120
+ this.name = "ProfileDirectoryError";
121
+ }
122
+ }
123
+ /**
124
+ * Thrown in strict mode (CAMOUFOX_STRICT_CONFIG=1) when the launcher writes a
125
+ * config key the browser's properties.json does not declare. Outside strict
126
+ * mode such a key is reported and skipped, so a newer library still launches
127
+ * an older build. (A KeyError in Python; pycompat imports this module, so it
128
+ * cannot extend pycompat's KeyError here.)
129
+ */
130
+ export class UnknownProperty extends Error {
131
+ constructor(message) {
132
+ super(message ?? "The property is unknown to this browser build.");
133
+ this.name = "UnknownProperty";
134
+ }
135
+ }
@@ -0,0 +1,341 @@
1
+ export type { TargetOS } from "./webgl.js";
2
+ type Config = Record<string, any>;
3
+ export declare const SUPPORTED_OS: readonly ["linux", "macos", "windows"];
4
+ export type SupportedOS = (typeof SUPPORTED_OS)[number];
5
+ /** The fpgen -> Camoufox config mapping. */
6
+ export declare const FPGEN_DATA: Readonly<Record<string, Record<string, string>>>;
7
+ export declare const FPGEN_OS: Readonly<Record<string, string>>;
8
+ export interface ScreenBounds {
9
+ minWidth?: number | null;
10
+ maxWidth?: number | null;
11
+ minHeight?: number | null;
12
+ maxHeight?: number | null;
13
+ }
14
+ /**
15
+ * A bound on the screen a generated fingerprint may claim (the twin of the
16
+ * Python dataclass that replaced browserforge's Screen).
17
+ */
18
+ export declare class Screen {
19
+ minWidth: number | null;
20
+ maxWidth: number | null;
21
+ minHeight: number | null;
22
+ maxHeight: number | null;
23
+ constructor({ minWidth, maxWidth, minHeight, maxHeight, }?: ScreenBounds);
24
+ /**
25
+ * The bound as fpgen conditions: one predicate over the whole screen node.
26
+ * fpgen resolves screen.width and screen.height to that same node and each
27
+ * condition resets its evidence (build_evidence), so with one per field
28
+ * only the height bound held and 1280x1024 met a 1300 px minimum width.
29
+ */
30
+ asConditions(): Record<string, (value: unknown) => boolean>;
31
+ /** dataclasses.asdict(), with the Python field names (for identitySalt). */
32
+ toPyDict(): Record<string, number | null>;
33
+ }
34
+ export interface Preset {
35
+ navigator?: Record<string, any>;
36
+ screen?: Record<string, any>;
37
+ webgl?: Record<string, any>;
38
+ timezone?: string;
39
+ fonts?: string[];
40
+ speechVoices?: Array<string | VoiceObject>;
41
+ [key: string]: any;
42
+ }
43
+ export interface PresetBundle {
44
+ presets?: Partial<Record<SupportedOS, Preset[]>>;
45
+ [key: string]: any;
46
+ }
47
+ export declare const PRESETS_FILE: string;
48
+ export declare const PRESETS_V150_FILE: string;
49
+ /** Firefox major version at which the v150 preset bundle becomes preferred. */
50
+ export declare const PRESETS_V150_MIN_FF = 149;
51
+ export declare const MACOS_MARKER_FONTS: readonly string[];
52
+ export declare const LINUX_MARKER_FONTS: readonly string[];
53
+ export declare const WINDOWS_MARKER_FONTS: readonly string[];
54
+ /** The full OS font lists (fonts.json). */
55
+ export declare function loadOsFonts(): Record<string, string[]>;
56
+ export declare const ESSENTIAL_FONTS_MACOS: readonly string[];
57
+ export declare const ESSENTIAL_FONTS_WINDOWS: readonly string[];
58
+ export declare const ESSENTIAL_FONTS_LINUX: readonly string[];
59
+ /**
60
+ * Fonts only a Windows 11 base has: a Windows identity whose font list
61
+ * contains them presents Windows 11, and the rest of the identity must agree.
62
+ */
63
+ export declare const WINDOWS_11_MARKER_FONTS: ReadonlySet<string>;
64
+ /**
65
+ * The entropy that makes identitySeed() belong to ONE identity.
66
+ *
67
+ * Pass whatever the caller pinned the identity with -- an fpgen fingerprint,
68
+ * a preset, the caller's own config -- for a salt that is stable across
69
+ * launches of that identity; pass nothing for a fresh, random one. The salt
70
+ * is the first 8 bytes (big-endian) of the SHA-256 of the orjson
71
+ * serialization with sorted keys, exactly as Python computes it, so a pinned
72
+ * identity draws the same fonts, voices, GPU and noise seeds in both
73
+ * launchers. (Integral floats and integers above 2**53 only hash like
74
+ * Python's when they arrive as PyFloat / bigint -- see pycompat.parsePyJson.)
75
+ */
76
+ export declare function identitySalt(pinned?: unknown): bigint;
77
+ /**
78
+ * The UA with the browser's version taken out, for identitySeed(). A saved
79
+ * identity on a newer browser claims the new engine version and nothing else
80
+ * changes, so the seed must not move with it (Python: versionless_ua).
81
+ */
82
+ export declare function versionlessUa(userAgent: string): string;
83
+ /**
84
+ * A seed for the per-identity draws: a pure function of the presented
85
+ * identity (UA without its version, platform, screen, cores) and its salt --
86
+ * zlib.crc32 of the values' Python str() joined by "|".
87
+ */
88
+ export declare function identitySeed(config: Config, salt?: number | bigint): number;
89
+ /**
90
+ * audio:seed is gone: the browser renders audio as stock Firefox does. A
91
+ * caller's seed is dropped with a warning rather than sent to a browser that
92
+ * would noise with it (a released one) or ignore it (this one).
93
+ */
94
+ export declare function dropAudioSeed(config: Record<string, unknown>): void;
95
+ /**
96
+ * The font list of one plausible machine of the given OS
97
+ * (`_generate_random_font_subset`): one OS-version base by weight, never
98
+ * subsetted, then each addition unit at its own measured probability, then
99
+ * the marker fonts.
100
+ *
101
+ * @param locale gates the units the manifest marks `requiresLocale`.
102
+ * @param native the identity is the host's own OS (macOS / Windows), where the
103
+ * real system fonts are used: only the OS base is claimed.
104
+ */
105
+ export declare function generateRandomFontSubset(targetOs: string, seed?: number | bigint | null, native?: boolean, locale?: string | null): string[];
106
+ export interface VoiceObject {
107
+ name: string;
108
+ lang: string;
109
+ voiceUri: string;
110
+ isDefault: boolean;
111
+ isLocalService: boolean;
112
+ }
113
+ export declare const MAC_NOVELTY_VOICES: ReadonlySet<string>;
114
+ export declare const MAC_ELOQUENCE_VOICES: ReadonlySet<string>;
115
+ /** A voiceUri matching what real Firefox emits for the OS backend. */
116
+ export declare function voiceUri(osKey: string, name: string, lang: string): string;
117
+ /** A Linux identity's speech-dispatcher voices (`voices:speechd`). */
118
+ export interface SpeechdGrid {
119
+ languages: Array<[string, string]>;
120
+ variants: string[];
121
+ }
122
+ /**
123
+ * (name, lang) per voice in speech-dispatcher's order (`_speechd_voices`):
124
+ * each language alone, then with every variant.
125
+ */
126
+ export declare function speechdVoices(grid: SpeechdGrid): Array<[string, string]>;
127
+ /**
128
+ * The identity's voices as the config keys the browser reads
129
+ * (`draw_voice_config`): `voices` on macOS and Windows, `voices:speechd` on
130
+ * Linux, whose ~15000 voices only fit in the environment as their grid.
131
+ */
132
+ export declare function drawVoiceConfig(targetOs: string, locale?: string | null, seed?: number | bigint | null): Record<string, any>;
133
+ /**
134
+ * The speech voice list for the given OS as MaskConfig voice objects
135
+ * (`_generate_random_voice_subset`), following the measured per-OS model in
136
+ * voice-manifests.json. Seeded by the identity so it always reports the same
137
+ * list. macOS marks its system voice default; Windows and Linux mark none.
138
+ */
139
+ export declare function generateRandomVoiceSubset(targetOs: string, locale?: string | null, seed?: number | bigint | null): VoiceObject[];
140
+ /**
141
+ * Coerce a preset's `speechVoices` into MaskConfig voice objects: presets
142
+ * store "Name:lang:type" strings, which MaskConfig drops. Objects pass through.
143
+ */
144
+ export declare function normalizePresetVoices(voices: Array<string | VoiceObject>, targetOs: string): VoiceObject[];
145
+ /**
146
+ * Logical CPUs this process may run on (affinity aware), as they were before
147
+ * any launch pinned it: see cpu_affinity.hostCoreCount().
148
+ */
149
+ export declare function hostCpuCount(): number | null;
150
+ /**
151
+ * Core counts real desktop machines ship with, from the recorded fingerprint
152
+ * corpus. 2 is excluded: no Apple Silicon part has 2 cores, and 85% of macOS
153
+ * identities draw an Apple GPU (see fingerprints.py).
154
+ */
155
+ export declare const PLAUSIBLE_CORE_COUNTS: readonly number[];
156
+ export interface HostCpu {
157
+ /** Logical CPUs of the host (default: hostCpuCount()). */
158
+ cpuCount?: number | null;
159
+ /** Whether the host can pin processes to cores (default: cpu_affinity.supported()). */
160
+ canPinHost?: boolean;
161
+ }
162
+ /**
163
+ * navigator.hardwareConcurrency = the host's parallelism, snapped DOWN into
164
+ * PLAUSIBLE_CORE_COUNTS -- or the fingerprint's own value (snapped, capped by
165
+ * the host) when the browser can be pinned to that many cores.
166
+ *
167
+ * On an Intel Mac the count yields to the GPU: the GPU is read before this
168
+ * runs, and a count no Mac with it reports would drop it (#1090). Apple
169
+ * Silicon is snapped to its GPU by the apple-silicon-cores repair.
170
+ *
171
+ * @param canPin false when nothing will pin the browser (launchServer, or
172
+ * launchOptions used directly); undefined/null: whatever the host supports.
173
+ * @param host overrides for the host probes (tests).
174
+ * @param targetOs the launch's OS key; the GPU bound applies to "mac" only.
175
+ */
176
+ export declare function fixHardwareConcurrency(config: Config, canPin?: boolean | null, host?: HostCpu, targetOs?: string | null): void;
177
+ /** Force navigator.platform AND navigator.oscpu to match the UA's arch (Linux). */
178
+ export declare function fixNavigatorArch(config: Config, targetOs: string): void;
179
+ export declare const BASELINE_TASKBAR_HEIGHT: Record<string, number>;
180
+ export declare const BASELINE_MULTI_TOUCH_POINTS: number;
181
+ /**
182
+ * Claim the available screen and touch points the browser will report.
183
+ * clampWindowDimensions then fits the window inside that screen.
184
+ */
185
+ export declare function followBaselineProtection(config: Config, targetOs: string): void;
186
+ /** Enforce inner <= outer <= avail <= screen on both axes. */
187
+ export declare function clampWindowDimensions(config: Config): void;
188
+ /**
189
+ * Shrink screen.width/height down to the bounds of the real display, keeping
190
+ * the taskbar delta. Run clampWindowDimensions afterwards.
191
+ */
192
+ export declare function clampScreenToDisplay(config: Config, maxWidth: number | null | undefined, maxHeight: number | null | undefined): void;
193
+ /**
194
+ * Keep the window box inside the available screen: 0 <= screenX/Y <= avail -
195
+ * outer. The available screen, not the whole one: pages are fitted to the
196
+ * window on screen.availHeight, and a window at y=2 whose outer
197
+ * height is the available height ran 2 px into the taskbar, so every new
198
+ * context drew a larger screen for it. Only `keys` are moved.
199
+ */
200
+ export declare function clampWindowPosition(config: Config, keys?: ReadonlySet<string>): void;
201
+ /** The smallest screen mainstream hardware still ships. */
202
+ export declare const MODERN_SCREEN_FLOOR: readonly [number, number];
203
+ /**
204
+ * Lift netbook-era screen geometry to the modern floor, keeping the
205
+ * screen-to-avail gaps. Call BEFORE clampScreenToDisplay.
206
+ */
207
+ export declare function raiseScreenToModernFloor(config: Config): void;
208
+ /**
209
+ * Draw one machine's media devices for `osKey` ('win'|'mac'|'lin'): the
210
+ * mediaDevices:* config keys, counts plus aligned label and group lists.
211
+ */
212
+ export declare function drawMediaDevices(osKey: string, seed: number | bigint | null | undefined): Config;
213
+ /**
214
+ * Give the identity a plausible set of media devices, drawn from the common
215
+ * desktop population for its OS and seeded by the identity. Nothing is drawn
216
+ * when the caller already set any mediaDevices: key.
217
+ */
218
+ export declare function setMediaDevicesDefaults(config: Config, salt?: number | bigint): void;
219
+ /**
220
+ * Intel's share of the x86 desktop CPUs running Firefox (Firefox Public Data
221
+ * Report, week of 2026-11-02: Intel 76.86%, AMD 17.61%); fingerprints.py.
222
+ */
223
+ export declare const X86_INTEL_SHARE: number;
224
+ /**
225
+ * Fill in the identity's CPU (cpu:arch, cpu:manufacturer), as
226
+ * fingerprints.set_cpu_default does. The GPU decides what it can (an Apple
227
+ * GPU is an Apple ARM CPU, an Intel iGPU or Intel Mac an Intel one, a Radeon
228
+ * iGPU an AMD one), then a core count only Intel ships; any other x86
229
+ * identity's vendor is drawn at Firefox's own x86 split, seeded by the
230
+ * identity. An ARM identity whose GPU names no single SoC maker keeps its
231
+ * manufacturer unset: every ARM64 CPU computes alike. Run after the GPU and
232
+ * navigator.hardwareConcurrency are final. Keys the caller set are kept.
233
+ */
234
+ export declare function setCpuDefault(config: Config, targetOs: string, salt?: number | bigint): void;
235
+ /** Reduce a reported renderer to Gecko's sanitized device bucket. */
236
+ export declare function rendererBucket(renderer: string): string;
237
+ /** Whether `renderer` is a software rasterizer rather than real hardware. */
238
+ export declare function isSoftwareRenderer(renderer: string | null | undefined): boolean;
239
+ /** Whether `renderer` is a GPU that plausibly drives a `width` x `height` screen. */
240
+ export declare function gpuScreenIsPlausible(renderer: string | null | undefined, width: number | null | undefined, height: number | null | undefined): boolean;
241
+ /** The bundled-presets file for a Firefox version (v150 bundle from 149 up). */
242
+ export declare function selectPresetsFile(ffVersion?: string | number | null): string;
243
+ /** Load the bundled fingerprint presets. */
244
+ export declare function loadPresets(ffVersion?: string | number | null): PresetBundle | null;
245
+ /**
246
+ * A random preset for the given OS (or OSes), or null when none is bundled.
247
+ * Draws from python-random's module-level `choice` (Python's random.choice).
248
+ */
249
+ export declare function getRandomPreset(os?: string | readonly string[] | null, ffVersion?: string | number | null): Preset | null;
250
+ /**
251
+ * The appVersion Firefox reports for a browser sending this user agent:
252
+ * "5.0 (<OS tokens>)" without the architecture, the Gecko revision, or the
253
+ * Windows build number.
254
+ */
255
+ export declare function appVersionFromUserAgent(userAgent: string | null | undefined): string | null;
256
+ /**
257
+ * Convert a real fingerprint preset to CAMOU_CONFIG format.
258
+ *
259
+ * `salt` (identitySalt) keys the font/voice draws; undefined draws a fresh
260
+ * one, so two users of the same recorded device do not share its font list.
261
+ */
262
+ export declare function fromPreset(preset: Preset, ffVersion?: string | number | null, salt?: number | bigint | null): Config;
263
+ export interface InitValues {
264
+ navigatorPlatform?: string;
265
+ navigatorOscpu?: string;
266
+ navigatorUserAgent?: string;
267
+ navigatorAppVersion?: string;
268
+ hardwareConcurrency?: number;
269
+ webglVendor?: string;
270
+ webglRenderer?: string;
271
+ screenWidth?: number;
272
+ screenHeight?: number;
273
+ screenColorDepth?: number;
274
+ timezone?: string;
275
+ fontList?: string[];
276
+ speechVoices?: Array<string | VoiceObject> | {
277
+ speechd: SpeechdGrid;
278
+ };
279
+ webrtcIP?: string;
280
+ }
281
+ /**
282
+ * The JavaScript init script that calls the per-context window.setXxx()
283
+ * functions. Those self-destruct after their first call, so they must run
284
+ * via addInitScript.
285
+ */
286
+ export declare function buildInitScript(values: InitValues): string;
287
+ export interface ContextFingerprint {
288
+ init_script: string;
289
+ context_options: Record<string, any>;
290
+ config: Config;
291
+ preset: Preset;
292
+ }
293
+ /** The OS a navigator.platform value presents, as a Camoufox OS name. */
294
+ export declare function targetOsFromPlatform(plat: string): SupportedOS;
295
+ /**
296
+ * Fingerprint values for a single per-context identity: the init script plus
297
+ * the Playwright context options (camelCase, for playwright-core).
298
+ *
299
+ * By default an fpgen fingerprint is generated; pass a preset to use a real
300
+ * recorded one instead.
301
+ *
302
+ * @param timezone IANA timezone; takes priority over the preset's.
303
+ * @param locale BCP-47 locale; also sets context_options.locale.
304
+ * @param config_overrides CAMOU_CONFIG keys applied after the config is built
305
+ * and before the init script is rendered.
306
+ * @param webgl_config The [vendor, renderer] a drawn identity claims, instead
307
+ * of drawing one.
308
+ */
309
+ export declare function generateContextFingerprint({ preset, os, ff_version, webrtc_ip, timezone, locale, config_overrides, webgl_config, }?: {
310
+ preset?: Preset | null;
311
+ os?: string | null;
312
+ ff_version?: string | null;
313
+ webrtc_ip?: string | null;
314
+ timezone?: string | null;
315
+ locale?: string | null;
316
+ config_overrides?: Config | null;
317
+ webgl_config?: [string, string] | null;
318
+ }): ContextFingerprint;
319
+ /** Converts an fpgen fingerprint to a Camoufox config. */
320
+ export declare function fromFpgen(fingerprint: Record<string, any>, ffVersion?: string | number | null): Config;
321
+ /** Sets a custom outer window size and centers it in the screen (in place). */
322
+ export declare function handleWindowSize(fp: Record<string, any>, outerWidth: number, outerHeight: number): void;
323
+ export interface GenerateFingerprintOptions {
324
+ /** Outer window size [width, height], applied after generation. */
325
+ window?: readonly [number, number] | null;
326
+ /** A bound on the generated screen (best-effort, see below). */
327
+ screen?: Screen | null;
328
+ /** Camoufox OS name(s): 'linux', 'macos', 'windows' (or lin/mac/win). */
329
+ os?: string | readonly string[] | null;
330
+ /** Any other fpgen conditions. */
331
+ [condition: string]: any;
332
+ }
333
+ /**
334
+ * Generates a Firefox fingerprint with fpgen (the model must be installed:
335
+ * `await ensureModel()` from fpgen).
336
+ *
337
+ * `screen` bounds the generated screen; `window` overrides the outer window
338
+ * size afterwards; `os` is Camoufox's name for the platform; anything else is
339
+ * passed to fpgen as a condition.
340
+ */
341
+ export declare function generateFingerprint({ window, screen, os, ...conditions }?: GenerateFingerprintOptions): Record<string, any>;