ant0-browser 0.0.0-stage → 0.2.0-beta.2

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 (163) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +208 -2
  3. package/dist/canvas.d.ts +55 -0
  4. package/dist/canvas.d.ts.map +1 -0
  5. package/dist/canvas.js +82 -0
  6. package/dist/canvas.js.map +1 -0
  7. package/dist/chromium-version.d.ts +22 -0
  8. package/dist/chromium-version.d.ts.map +1 -0
  9. package/dist/chromium-version.js +22 -0
  10. package/dist/chromium-version.js.map +1 -0
  11. package/dist/claim-hints.d.ts +36 -0
  12. package/dist/claim-hints.d.ts.map +1 -0
  13. package/dist/claim-hints.js +9 -0
  14. package/dist/claim-hints.js.map +1 -0
  15. package/dist/cleanup.d.ts +35 -0
  16. package/dist/cleanup.d.ts.map +1 -0
  17. package/dist/cleanup.js +106 -0
  18. package/dist/cleanup.js.map +1 -0
  19. package/dist/content.d.ts +11 -0
  20. package/dist/content.d.ts.map +1 -0
  21. package/dist/content.js +52 -0
  22. package/dist/content.js.map +1 -0
  23. package/dist/download.d.ts +24 -0
  24. package/dist/download.d.ts.map +1 -0
  25. package/dist/download.js +227 -0
  26. package/dist/download.js.map +1 -0
  27. package/dist/errors.d.ts +49 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +53 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/fingerprint.d.ts +218 -0
  32. package/dist/fingerprint.d.ts.map +1 -0
  33. package/dist/fingerprint.js +475 -0
  34. package/dist/fingerprint.js.map +1 -0
  35. package/dist/fontpack.d.ts +13 -0
  36. package/dist/fontpack.d.ts.map +1 -0
  37. package/dist/fontpack.js +150 -0
  38. package/dist/fontpack.js.map +1 -0
  39. package/dist/fonts.d.ts +15 -0
  40. package/dist/fonts.d.ts.map +1 -0
  41. package/dist/fonts.js +86 -0
  42. package/dist/fonts.js.map +1 -0
  43. package/dist/geoip.d.ts +45 -0
  44. package/dist/geoip.d.ts.map +1 -0
  45. package/dist/geoip.js +290 -0
  46. package/dist/geoip.js.map +1 -0
  47. package/dist/geometry.d.ts +32 -0
  48. package/dist/geometry.d.ts.map +1 -0
  49. package/dist/geometry.js +85 -0
  50. package/dist/geometry.js.map +1 -0
  51. package/dist/humanize.d.ts +20 -0
  52. package/dist/humanize.d.ts.map +1 -0
  53. package/dist/humanize.js +921 -0
  54. package/dist/humanize.js.map +1 -0
  55. package/dist/identity-persistence.d.ts +88 -0
  56. package/dist/identity-persistence.d.ts.map +1 -0
  57. package/dist/identity-persistence.js +381 -0
  58. package/dist/identity-persistence.js.map +1 -0
  59. package/dist/identity.d.ts +81 -0
  60. package/dist/identity.d.ts.map +1 -0
  61. package/dist/identity.js +370 -0
  62. package/dist/identity.js.map +1 -0
  63. package/dist/index.d.ts +281 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +790 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/launch-ticket.d.ts +191 -0
  68. package/dist/launch-ticket.d.ts.map +1 -0
  69. package/dist/launch-ticket.js +549 -0
  70. package/dist/launch-ticket.js.map +1 -0
  71. package/dist/launchopts.d.ts +266 -0
  72. package/dist/launchopts.d.ts.map +1 -0
  73. package/dist/launchopts.js +623 -0
  74. package/dist/launchopts.js.map +1 -0
  75. package/dist/motion.d.ts +106 -0
  76. package/dist/motion.d.ts.map +1 -0
  77. package/dist/motion.js +311 -0
  78. package/dist/motion.js.map +1 -0
  79. package/dist/motionscore.d.ts +57 -0
  80. package/dist/motionscore.d.ts.map +1 -0
  81. package/dist/motionscore.js +215 -0
  82. package/dist/motionscore.js.map +1 -0
  83. package/dist/native/linux-x64/PRODUCT-LICENSE.txt +28 -0
  84. package/dist/native/linux-x64/ant0_runtime.node +0 -0
  85. package/dist/native/windows-x64/PRODUCT-LICENSE.txt +28 -0
  86. package/dist/native/windows-x64/ant0_runtime.node +0 -0
  87. package/dist/persona-migration.d.ts +54 -0
  88. package/dist/persona-migration.d.ts.map +1 -0
  89. package/dist/persona-migration.js +97 -0
  90. package/dist/persona-migration.js.map +1 -0
  91. package/dist/persona-profile-v2.d.ts +169 -0
  92. package/dist/persona-profile-v2.d.ts.map +1 -0
  93. package/dist/persona-profile-v2.js +454 -0
  94. package/dist/persona-profile-v2.js.map +1 -0
  95. package/dist/persona-profile-v4.d.ts +61 -0
  96. package/dist/persona-profile-v4.d.ts.map +1 -0
  97. package/dist/persona-profile-v4.js +79 -0
  98. package/dist/persona-profile-v4.js.map +1 -0
  99. package/dist/persona-rejected.d.ts +36 -0
  100. package/dist/persona-rejected.d.ts.map +1 -0
  101. package/dist/persona-rejected.js +40 -0
  102. package/dist/persona-rejected.js.map +1 -0
  103. package/dist/population-model.d.ts +45 -0
  104. package/dist/population-model.d.ts.map +1 -0
  105. package/dist/population-model.js +245 -0
  106. package/dist/population-model.js.map +1 -0
  107. package/dist/profile-file.d.ts +201 -0
  108. package/dist/profile-file.d.ts.map +1 -0
  109. package/dist/profile-file.js +736 -0
  110. package/dist/profile-file.js.map +1 -0
  111. package/dist/release-fetch.d.ts +74 -0
  112. package/dist/release-fetch.d.ts.map +1 -0
  113. package/dist/release-fetch.js +395 -0
  114. package/dist/release-fetch.js.map +1 -0
  115. package/dist/release.d.ts +16 -0
  116. package/dist/release.d.ts.map +1 -0
  117. package/dist/release.js +26 -0
  118. package/dist/release.js.map +1 -0
  119. package/dist/render.d.ts +38 -0
  120. package/dist/render.d.ts.map +1 -0
  121. package/dist/render.js +104 -0
  122. package/dist/render.js.map +1 -0
  123. package/dist/runtime-client.d.ts +47 -0
  124. package/dist/runtime-client.d.ts.map +1 -0
  125. package/dist/runtime-client.js +327 -0
  126. package/dist/runtime-client.js.map +1 -0
  127. package/dist/runtime-launch.d.ts +22 -0
  128. package/dist/runtime-launch.d.ts.map +1 -0
  129. package/dist/runtime-launch.js +92 -0
  130. package/dist/runtime-launch.js.map +1 -0
  131. package/dist/scale.d.ts +29 -0
  132. package/dist/scale.d.ts.map +1 -0
  133. package/dist/scale.js +105 -0
  134. package/dist/scale.js.map +1 -0
  135. package/dist/shaderdialect.d.ts +33 -0
  136. package/dist/shaderdialect.d.ts.map +1 -0
  137. package/dist/shaderdialect.js +47 -0
  138. package/dist/shaderdialect.js.map +1 -0
  139. package/dist/speech-coherence.d.ts +52 -0
  140. package/dist/speech-coherence.d.ts.map +1 -0
  141. package/dist/speech-coherence.js +254 -0
  142. package/dist/speech-coherence.js.map +1 -0
  143. package/dist/template-selection.d.ts +14 -0
  144. package/dist/template-selection.d.ts.map +1 -0
  145. package/dist/template-selection.js +66 -0
  146. package/dist/template-selection.js.map +1 -0
  147. package/dist/warnings.d.ts +50 -0
  148. package/dist/warnings.d.ts.map +1 -0
  149. package/dist/warnings.js +273 -0
  150. package/dist/warnings.js.map +1 -0
  151. package/dist/webgl-coherence.d.ts +30 -0
  152. package/dist/webgl-coherence.d.ts.map +1 -0
  153. package/dist/webgl-coherence.js +98 -0
  154. package/dist/webgl-coherence.js.map +1 -0
  155. package/dist/webgpu-override.d.ts +14 -0
  156. package/dist/webgpu-override.d.ts.map +1 -0
  157. package/dist/webgpu-override.js +82 -0
  158. package/dist/webgpu-override.js.map +1 -0
  159. package/dist/widevine.d.ts +44 -0
  160. package/dist/widevine.d.ts.map +1 -0
  161. package/dist/widevine.js +203 -0
  162. package/dist/widevine.js.map +1 -0
  163. package/package.json +56 -4
@@ -0,0 +1,273 @@
1
+ // Launch-time coherence warnings (mirror of the Python ant0-browser/_warnings.py).
2
+ //
3
+ // The SDK already defaults the safe things (strips --enable-automation, denies WebRTC leak,
4
+ // disables Privacy Sandbox, matches the persona to the build). What it CAN'T fix is an operator
5
+ // passing an incoherent or missing-recommended combination. coherenceWarnings() spots those at
6
+ // launch() and emitCoherenceWarnings() prints an actionable line to stderr. Never blocks the
7
+ // launch; suppressible with quiet:true or ANT0_BROWSER_NO_WARN=1. coherenceWarnings() is pure (no I/O).
8
+ import { readdirSync } from "node:fs";
9
+ import { webgpuOverridePlan } from "./webgpu-override.js";
10
+ import { CHROMIUM_MAJOR } from "./chromium-version.js";
11
+ import { canvasMode } from "./canvas.js";
12
+ const SOFTWARE_GPU = ["swiftshader", "llvmpipe", "microsoft basic render", "software adapter", "software"];
13
+ const seenNotes = new Set(); // fire-once per process for NOTE codes and ONCE_WARN_CODES
14
+ /** WARN-level codes that still print only once per process (an ignored switch repeats every launch). */
15
+ const ONCE_WARN_CODES = new Set(["gpu-string-only"]);
16
+ /** True if this Linux host exposes a DRM/GPU device (a renderD or card node under /dev/dri). Absence
17
+ * strongly implies software rendering, so callers act only on ABSENCE. Does I/O (kept out of the
18
+ * pure coherenceWarnings). */
19
+ export function linuxHostHasGpu(driDir = "/dev/dri") {
20
+ try {
21
+ return readdirSync(driDir).some((e) => e.startsWith("renderD") || e.startsWith("card"));
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ /** Return identityMode when a persona presenting a HARDWARE GPU will render on a software rasterizer
28
+ * because this Linux host has no GPU device; else undefined. Threaded into coherenceWarnings as
29
+ * _gpuHostMissing. Silent under honest GPU (disableGpuFingerprint) or a pinned software renderer.
30
+ * Does I/O. */
31
+ export function gpuHostMissingFor(fp, identityMode, hostPlatform, driDir = "/dev/dri") {
32
+ const host = hostPlatform ?? process.platform;
33
+ if ((identityMode !== "captured" && identityMode !== "synthetic") || !host.startsWith("linux"))
34
+ return undefined;
35
+ if (fp.disableGpuFingerprint)
36
+ return undefined;
37
+ const gr = String(fp.gpuRenderer ?? "").toLowerCase();
38
+ if (SOFTWARE_GPU.some((s) => gr.includes(s)))
39
+ return undefined;
40
+ if (linuxHostHasGpu(driDir))
41
+ return undefined;
42
+ return identityMode;
43
+ }
44
+ /** First engine release that closes the narrow-switch gaps: WebGPU, limits and shader precision follow
45
+ * the real GPU under --disable-gpu-string-spoof, and toBlob/convertToBlob follow --disable-canvas-noise. */
46
+ export const GPU_CANVAS_FIX_ENGINE = "158.0.8127.18-ant0.8";
47
+ const ENGINE_RE = /^(\d+)\.(\d+)\.(\d+)\.(\d+)-ant0\.(\d+)$/;
48
+ const DEV_ENGINE_RE = /^\d+\.\d+\.\d+\.\d+-ant0\.dev$/;
49
+ /** True when the running engine is ant0.8 or later. A development build (`<chromium>-ant0.dev`, built
50
+ * from main) counts as NEW, so it is not nagged about gaps main has closed; a missing or unparseable
51
+ * version counts as OLD, so the operator is warned. Compared numerically, field by field. */
52
+ export function engineHasGpuCanvasFixes(engineVersion) {
53
+ if (typeof engineVersion !== "string")
54
+ return false;
55
+ const v = engineVersion.trim();
56
+ if (DEV_ENGINE_RE.test(v))
57
+ return true;
58
+ const have = ENGINE_RE.exec(v);
59
+ if (!have)
60
+ return false;
61
+ const need = ENGINE_RE.exec(GPU_CANVAS_FIX_ENGINE);
62
+ for (let i = 1; i < need.length; i++) {
63
+ const a = Number(have[i]), b = Number(need[i]);
64
+ if (a !== b)
65
+ return a > b;
66
+ }
67
+ return true;
68
+ }
69
+ function proxyServer(proxy) {
70
+ if (!proxy)
71
+ return "";
72
+ if (typeof proxy === "object" && proxy && "server" in proxy)
73
+ return String(proxy.server ?? "");
74
+ return String(proxy);
75
+ }
76
+ function isSocks(s) {
77
+ const l = s.toLowerCase();
78
+ return l.startsWith("socks") || l.includes("://socks");
79
+ }
80
+ function hostFamily(host) {
81
+ if (host.startsWith("win"))
82
+ return "windows";
83
+ if (host === "darwin" || host.startsWith("mac"))
84
+ return "macos";
85
+ if (host.startsWith("linux"))
86
+ return "linux";
87
+ return null;
88
+ }
89
+ function gpuIncoherent(renderer, platform) {
90
+ const r = renderer.toLowerCase();
91
+ if (platform === "macos" && (r.includes("direct3d") || r.includes("d3d")))
92
+ return "macOS uses Metal/OpenGL, never Direct3D";
93
+ if (platform === "windows" && r.includes("metal"))
94
+ return "Windows uses Direct3D/ANGLE, never Metal";
95
+ if (platform === "linux" && (r.includes("direct3d") || r.includes("d3d") || r.includes("metal")))
96
+ return "Linux uses OpenGL/Vulkan, never Direct3D/Metal";
97
+ return null;
98
+ }
99
+ /** The canvas mode the launch resolves to; an invalid `canvas` value (rejected elsewhere) counts as real. */
100
+ function warnedCanvasMode(opts) {
101
+ try {
102
+ return canvasMode(opts);
103
+ }
104
+ catch {
105
+ return "real";
106
+ }
107
+ }
108
+ /** Inspect resolved options for incoherent / missing-recommended combinations. Pure. */
109
+ export function coherenceWarnings(opts, hostPlatform, buildMajor, engineVersion) {
110
+ const host = hostPlatform ?? process.platform;
111
+ const bmajor = buildMajor ?? String(CHROMIUM_MAJOR);
112
+ const out = [];
113
+ const warn = (code, message) => out.push({ severity: "warn", code, message });
114
+ const note = (code, message) => out.push({ severity: "note", code, message });
115
+ const server = proxyServer(opts.proxy);
116
+ const geoip = Boolean(opts.geoip);
117
+ const tz = opts.timezone, lang = opts.acceptLanguage;
118
+ const platform = opts.platform;
119
+ const brand = opts.brand, bver = opts.brandVersion;
120
+ const gpuR = opts.gpuRenderer, gpuV = opts.gpuVendor;
121
+ const profile = opts.fingerprintProfile;
122
+ const dgf = opts.disableGpuFingerprint, noise = opts.fingerprintNoise;
123
+ const gpuStringSpoof = opts.gpuStringSpoof, canvasNoise = opts.canvasNoise;
124
+ const fixed = engineHasGpuCanvasFixes(engineVersion);
125
+ const personaV4 = typeof profile === "object" && profile !== null
126
+ && profile.schema_version === 4;
127
+ const headless = opts.headless;
128
+ const userArgs = opts._userArgs ?? [];
129
+ if (server && !geoip && !tz && !lang)
130
+ warn("proxy-no-geo", "proxy set without geoip and no timezone/acceptLanguage - the browser's timezone and language " +
131
+ "will reflect THIS host, not the proxy's exit region (a geo-mismatch tell). Resolve the proxy " +
132
+ "location and pass timezone + acceptLanguage under overrides.");
133
+ if (server && geoip && isSocks(server))
134
+ warn("socks-geoip", "geoip cannot resolve a SOCKS proxy's exit IP - timezone/language will NOT auto-match. Set " +
135
+ "timezone + acceptLanguage (+ webrtcIp) manually for SOCKS proxies.");
136
+ const fam = hostFamily(host);
137
+ if (platform && fam && platform !== fam && !profile)
138
+ warn("platform-host-fonts", `platform='${platform}' but this host is ${fam} and no fingerprintProfile supplies that OS's ` +
139
+ `fonts/metrics - font, canvas and font-list hashes will be host-native and won't match a real ` +
140
+ `${platform} Chrome. Use a fingerprintProfile captured on ${platform}, or set platform='${fam}'.`);
141
+ if (gpuR && platform) {
142
+ const why = gpuIncoherent(gpuR, platform);
143
+ if (why)
144
+ warn("gpu-platform", `gpuRenderer is incoherent with platform='${platform}' (${why}): '${gpuR}'.`);
145
+ }
146
+ if (gpuR && SOFTWARE_GPU.some((s) => gpuR.toLowerCase().includes(s)))
147
+ warn("gpu-software", `gpuRenderer is a SOFTWARE renderer ('${gpuR}') - a real consumer machine reports a hardware GPU. ` +
148
+ "Pin a real GPU string, or use a real-GPU host.");
149
+ const wgpu = webgpuOverridePlan(opts);
150
+ if (wgpu.warning)
151
+ warn("gpu-webgpu-mismatch", wgpu.warning);
152
+ // A schema 4 persona names its own brand (chrome or edge), and the engine is built for it.
153
+ if (brand && !personaV4 && !["chrome", "google chrome"].includes(String(brand).toLowerCase()))
154
+ warn("brand-mismatch", `brand='${brand}' is advertised in UA-CH, but the binary's TLS/JA4 and engine are Chrome ${bmajor} ` +
155
+ "- a UA-vs-transport mismatch strict detectors cross-check. Keep brand='Chrome'.");
156
+ if (bver && String(bver).split(".")[0] !== bmajor)
157
+ warn("version-mismatch", `brandVersion major ${String(bver).split(".")[0]} differs from the build's Chrome ${bmajor} - ` +
158
+ `JA4/UA-CH version desync. Align brandVersion to ${bmajor} (or omit it).`);
159
+ // Canvas mode (identity API: overrides.canvas, see canvas.ts). "real" is this computer's genuine
160
+ // canvas output, the same for every profile on this computer; the SDK adds no noise switch and
161
+ // nothing below warns about noise. "noise" is unique to the profile and stable across launches and
162
+ // sites (--fingerprint-noise-key). Only noise mode can put altered pixels next to a real GPU string.
163
+ const noiseMode = warnedCanvasMode(opts) === "noise";
164
+ const REAL_HINT = " Use canvas:'real' (the default) for this computer's genuine canvas output.";
165
+ if (dgf && noiseMode)
166
+ warn("gpu-noise", "disableGpuFingerprint presents the REAL GPU, but canvas mode 'noise' makes the canvas output " +
167
+ "unique to the profile - altered pixels next to a real GPU are themselves a tell." + REAL_HINT);
168
+ // gpuStringSpoof:false. On engines before ant0.8 the switch is ignored; that case is covered by the
169
+ // gpu-string-only warning below, so this warning is for ant0.8+ only (no two messages saying the same).
170
+ if (!dgf && gpuStringSpoof === false && noiseMode && fixed)
171
+ warn("gpu-noise-string", "gpuStringSpoof:false reports the REAL WebGL vendor/renderer, but canvas mode 'noise' makes the " +
172
+ "canvas output unique to the profile - a real string over altered pixels is itself a tell." + REAL_HINT);
173
+ if (!dgf && gpuStringSpoof === false && !fixed)
174
+ warn("gpu-string-only", "engines before ant0.8 ignore gpuStringSpoof:false, so the setting has no effect until the " +
175
+ "engine is upgraded: this launch still reports the full persona GPU (WebGL vendor/renderer, " +
176
+ "getParameter limits, extension list, shader precision and the navigator.gpu WebGPU identity). " +
177
+ "Upgrade the engine to ant0.8 or later, or use disableGpuFingerprint:true to take the whole GPU " +
178
+ "surface real.");
179
+ if (canvasNoise === false && !fixed && noiseMode)
180
+ note("canvas-noise-toblob", "engines before ant0.8 ignore canvasNoise:false, so the setting has no effect until the engine " +
181
+ "is upgraded; this launch is in canvas mode 'noise'. Upgrade the engine to ant0.8 or later." + REAL_HINT);
182
+ if (noiseMode && noise === false)
183
+ warn(CANVAS_NOISE_CONFLICT_CODE, CANVAS_NOISE_CONFLICT_MESSAGE);
184
+ // A persona presenting a hardware GPU on a Linux host with NO GPU device renders on a software
185
+ // rasterizer: the renderer STRING claims a real GPU while MAX_TEXTURE_SIZE, the WebGL extension
186
+ // list and navigator.gpu (WebGPU adapter) report software-tier caps -- exactly what an enterprise
187
+ // bot-manager (e.g. Cloudflare on g2) scores. Computed via a host device check and threaded in as
188
+ // _gpuHostMissing; supersedes the vaguer headless-render note.
189
+ const gpuUnreachable = opts._gpuHostMissing;
190
+ if (gpuUnreachable)
191
+ warn("persona-gpu-unreachable", `the ${gpuUnreachable} persona presents a hardware GPU (an ANGLE/Direct3D11 discrete-GPU ` +
192
+ "renderer string), but this Linux host exposes no GPU device (/dev/dri absent), so WebGL and " +
193
+ "WebGPU fall back to a software rasterizer. A strict/enterprise detector reads the contradiction " +
194
+ "directly: the renderer STRING claims a real GPU while MAX_TEXTURE_SIZE, the WebGL extension " +
195
+ "list and navigator.gpu (the WebGPU adapter) report software-tier capabilities. Run on a host " +
196
+ "with a real GPU (and drop --disable-gpu).");
197
+ if (headless !== false && !dgf && !profile && !gpuUnreachable)
198
+ note("headless-render", "headless with no disableGpuFingerprint/fingerprintProfile - canvas and WebGL may " +
199
+ "render on software here while the persona claims a hardware GPU (a render-vs-string mismatch on " +
200
+ "canvas-scored sites). Use disableGpuFingerprint or a real-GPU host.");
201
+ if (opts._cacheDirGiven)
202
+ note("cache-dir-ignored", "cacheDir is ignored on launch: the engine comes from runtime discovery. To choose the download " +
203
+ "cache, use executablePath({ cacheDir }).");
204
+ if (userArgs.some((a) => String(a).includes("--enable-automation") || String(a).startsWith("--remote-debugging-port")))
205
+ warn("automation-arg", "your args re-introduce an automation flag (--enable-automation / --remote-debugging-port) the SDK " +
206
+ "strips by default - a strong webdriver/CDP tell.");
207
+ return out;
208
+ }
209
+ /** Print coherence warnings to stderr unless quiet or ANT0_BROWSER_NO_WARN. NOTE lines fire once/process. */
210
+ export function emitCoherenceWarnings(opts, quiet, hostPlatform, buildMajor, engineVersion) {
211
+ if (quiet || process.env.ANT0_BROWSER_NO_WARN)
212
+ return;
213
+ for (const w of coherenceWarnings(opts, hostPlatform, buildMajor, engineVersion)) {
214
+ if (w.severity === "note" || ONCE_WARN_CODES.has(w.code)) {
215
+ if (seenNotes.has(w.code))
216
+ continue;
217
+ seenNotes.add(w.code);
218
+ }
219
+ process.stderr.write(`ant0-browser: ${w.severity === "warn" ? "warning" : "note"}: ${w.message}\n`);
220
+ }
221
+ }
222
+ let canvasBridgeNoted = false;
223
+ /** One-time note that `canvasBridge` was removed and its value is ignored. Never throws. */
224
+ export function warnCanvasBridgeRemoved(quiet) {
225
+ if (canvasBridgeNoted)
226
+ return;
227
+ canvasBridgeNoted = true;
228
+ if (quiet || process.env.ANT0_BROWSER_NO_WARN)
229
+ return;
230
+ process.stderr.write("ant0-browser: note: canvasBridge was removed and is ignored. Use a host with a real GPU for hardware canvas/WebGL.\n");
231
+ }
232
+ /** Test hook: forget that the note was shown. */
233
+ export function resetCanvasBridgeNote() { canvasBridgeNoted = false; }
234
+ /** Code and text of the warning for `canvas: "noise"` together with `fingerprintNoise: false`. The
235
+ * args are unchanged (both switches are sent); the combination just contradicts itself. */
236
+ export const CANVAS_NOISE_CONFLICT_CODE = "canvas-noise-conflict";
237
+ export const CANVAS_NOISE_CONFLICT_MESSAGE = "canvas mode 'noise' is combined with fingerprint noise switched off (fingerprintNoise:false in Node, " +
238
+ "fingerprint_noise=False in Python). The SDK sends both the noise key and --disable-fingerprint-noise, " +
239
+ "and the combination contradicts itself. Drop the fingerprint noise override, or use canvas \"real\" for " +
240
+ "this computer's genuine canvas output.";
241
+ /** The text of the `canvas-noise-no-key` warning. */
242
+ export const CANVAS_NOISE_NO_KEY_MESSAGE = "canvasNoise / fingerprintNoise: true no longer turn canvas noise on; this launch uses real readback. " +
243
+ "To get a per-profile canvas, set overrides.canvas to \"noise\" (with overrides.canvasNoiseKey, or a synthetic identity, which has a key).";
244
+ /** Warn (every launch, to stderr) that legacy canvasNoise/fingerprintNoise:true does not enable noise and the launch stays real. */
245
+ export function warnCanvasNoiseNoKey(quiet) {
246
+ if (quiet || process.env.ANT0_BROWSER_NO_WARN)
247
+ return;
248
+ process.stderr.write(`ant0-browser: warning: [canvas-noise-no-key] ${CANVAS_NOISE_NO_KEY_MESSAGE}\n`);
249
+ }
250
+ /** A debug-level line: printed only when ANT0_BROWSER_DEBUG is set. */
251
+ export function debugLog(message) {
252
+ if (process.env.ANT0_BROWSER_DEBUG)
253
+ process.stderr.write(`ant0-browser: debug: ${message}\n`);
254
+ }
255
+ /** Code and text of the warning for a platform or brand override on a schema 4 persona (same in the Python SDK). */
256
+ export const PERSONA_IDENTITY_OVERRIDE_CODE = "persona-identity-override";
257
+ export const PERSONA_IDENTITY_OVERRIDE_MESSAGE = "a platform or brand override is mixed with a schema 4 persona. The override wins over the persona's " +
258
+ "identity and only the value you set is passed (the persona's versions are not carried along), so the " +
259
+ "page can show an identity the persona does not describe. Drop the override to present the persona as issued.";
260
+ export function warnPersonaIdentityOverride(quiet) {
261
+ if (quiet || process.env.ANT0_BROWSER_NO_WARN)
262
+ return;
263
+ process.stderr.write(`ant0-browser: warning: [${PERSONA_IDENTITY_OVERRIDE_CODE}] ${PERSONA_IDENTITY_OVERRIDE_MESSAGE}\n`);
264
+ }
265
+ /** Print persona notices (see profile-file.ts) to stderr as warnings, every launch, unless quiet or
266
+ * ANT0_BROWSER_NO_WARN. */
267
+ export function emitPersonaNotices(notices, quiet) {
268
+ if (quiet || process.env.ANT0_BROWSER_NO_WARN)
269
+ return;
270
+ for (const n of notices)
271
+ process.stderr.write(`ant0-browser: warning: [${n.code}] ${n.message}\n`);
272
+ }
273
+ //# sourceMappingURL=warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,+FAA+F;AAC/F,6FAA6F;AAC7F,wGAAwG;AAExG,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAE7D,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,UAAU,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAC3G,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CA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E table keyed by (os_family, browser_family). Each row lists the relations as data (the sum of
5
+ * the `sum` limits must not exceed the `max` limit) and the engine's own value for each limit a
6
+ * profile leaves out. Evaluation is over the MERGED record: webgl1 first, then webgl2 overwriting
7
+ * key by key. A relation is evaluated, with absent limits filled from the row's defaults, when at
8
+ * least one of its limits is present; a relation with none present is skipped. A present limit
9
+ * that is not a non-negative integer is a violation. A pair without a row has no rule; a new
10
+ * platform or browser family is a new row. Keep in step with the engine (patch 926) and the
11
+ * cloud's webgl-coherence-rules.ts.
12
+ */
13
+ export interface WebGLRelation {
14
+ sum: readonly string[];
15
+ max: string;
16
+ }
17
+ export interface WebGLRuleRow {
18
+ relations: readonly WebGLRelation[];
19
+ defaults: Readonly<Record<string, number>>;
20
+ }
21
+ /** Rule rows by `${os_family}/${browser_family}`. */
22
+ export declare const WEBGL_COHERENCE_RULES: Readonly<Record<string, WebGLRuleRow>>;
23
+ /**
24
+ * Violations, as readable strings, of the rule row for (osFamily, browserFamily) in the merged
25
+ * record of `webgl1` and `webgl2` parameter objects. Empty for an unknown pair.
26
+ * Message: `incoherent WebGL limits: webgl2 A (14) + B (12) exceeds C (24)`; the set label is
27
+ * webgl2 when any limit of the relation comes from webgl2, else webgl1.
28
+ */
29
+ export declare function webglLimitViolations(osFamily: string, browserFamily: string, webgl1: Record<string, unknown> | undefined, webgl2: Record<string, unknown> | undefined): string[];
30
+ //# sourceMappingURL=webgl-coherence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-coherence.d.ts","sourceRoot":"","sources":["../src/webgl-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAmBD,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAIxE,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,MAAM,EAAE,CA4CV"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * WebGL limit coherence of a persona profile, mirroring the engine's strict loader.
3
+ *
4
+ * ONE table keyed by (os_family, browser_family). Each row lists the relations as data (the sum of
5
+ * the `sum` limits must not exceed the `max` limit) and the engine's own value for each limit a
6
+ * profile leaves out. Evaluation is over the MERGED record: webgl1 first, then webgl2 overwriting
7
+ * key by key. A relation is evaluated, with absent limits filled from the row's defaults, when at
8
+ * least one of its limits is present; a relation with none present is skipped. A present limit
9
+ * that is not a non-negative integer is a violation. A pair without a row has no rule; a new
10
+ * platform or browser family is a new row. Keep in step with the engine (patch 926) and the
11
+ * cloud's webgl-coherence-rules.ts.
12
+ */
13
+ const CHROMIUM_DESKTOP = {
14
+ relations: [
15
+ { sum: ["MAX_VERTEX_UNIFORM_BLOCKS", "MAX_FRAGMENT_UNIFORM_BLOCKS"], max: "MAX_COMBINED_UNIFORM_BLOCKS" },
16
+ { sum: ["MAX_COMBINED_UNIFORM_BLOCKS"], max: "MAX_UNIFORM_BUFFER_BINDINGS" },
17
+ { sum: ["MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_IMAGE_UNITS"], max: "MAX_COMBINED_TEXTURE_IMAGE_UNITS" },
18
+ ],
19
+ defaults: {
20
+ MAX_VERTEX_UNIFORM_BLOCKS: 12,
21
+ MAX_FRAGMENT_UNIFORM_BLOCKS: 12,
22
+ MAX_COMBINED_UNIFORM_BLOCKS: 24,
23
+ MAX_UNIFORM_BUFFER_BINDINGS: 24,
24
+ MAX_VERTEX_TEXTURE_IMAGE_UNITS: 16,
25
+ MAX_TEXTURE_IMAGE_UNITS: 16,
26
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS: 32,
27
+ },
28
+ };
29
+ /** Rule rows by `${os_family}/${browser_family}`. */
30
+ export const WEBGL_COHERENCE_RULES = {
31
+ "windows/chromium": CHROMIUM_DESKTOP,
32
+ "linux/chromium": CHROMIUM_DESKTOP,
33
+ "macos/chromium": CHROMIUM_DESKTOP,
34
+ };
35
+ function isCount(value) {
36
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
37
+ }
38
+ /**
39
+ * Violations, as readable strings, of the rule row for (osFamily, browserFamily) in the merged
40
+ * record of `webgl1` and `webgl2` parameter objects. Empty for an unknown pair.
41
+ * Message: `incoherent WebGL limits: webgl2 A (14) + B (12) exceeds C (24)`; the set label is
42
+ * webgl2 when any limit of the relation comes from webgl2, else webgl1.
43
+ */
44
+ export function webglLimitViolations(osFamily, browserFamily, webgl1, webgl2) {
45
+ const row = WEBGL_COHERENCE_RULES[`${osFamily}/${browserFamily}`];
46
+ if (row === undefined)
47
+ return [];
48
+ const find = (key) => {
49
+ if (webgl2 && webgl2[key] !== undefined)
50
+ return { value: webgl2[key], set: "webgl2" };
51
+ if (webgl1 && webgl1[key] !== undefined)
52
+ return { value: webgl1[key], set: "webgl1" };
53
+ return undefined;
54
+ };
55
+ const out = [];
56
+ const reported = new Set();
57
+ for (const relation of row.relations) {
58
+ const keys = [...relation.sum, relation.max];
59
+ if (!keys.some((k) => find(k) !== undefined))
60
+ continue;
61
+ let usable = true;
62
+ let set = "webgl1";
63
+ const values = [];
64
+ for (const k of keys) {
65
+ const found = find(k);
66
+ if (found !== undefined) {
67
+ if (found.set === "webgl2")
68
+ set = "webgl2";
69
+ if (!isCount(found.value)) {
70
+ usable = false;
71
+ if (!reported.has(k)) {
72
+ reported.add(k);
73
+ out.push(`${k} must be a non-negative integer, got ${JSON.stringify(found.value)}`);
74
+ }
75
+ continue;
76
+ }
77
+ values.push(found.value);
78
+ }
79
+ else {
80
+ const fallback = row.defaults[k];
81
+ if (fallback === undefined)
82
+ usable = false;
83
+ else
84
+ values.push(fallback);
85
+ }
86
+ }
87
+ if (!usable)
88
+ continue;
89
+ const total = values.slice(0, -1).reduce((a, b) => a + b, 0);
90
+ const max = values[values.length - 1];
91
+ if (total > max) {
92
+ const sums = relation.sum.map((k, i) => `${k} (${values[i]})`).join(" + ");
93
+ out.push(`incoherent WebGL limits: ${set} ${sums} exceeds ${relation.max} (${max})`);
94
+ }
95
+ }
96
+ return out;
97
+ }
98
+ //# sourceMappingURL=webgl-coherence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-coherence.js","sourceRoot":"","sources":["../src/webgl-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,MAAM,gBAAgB,GAAiB;IACrC,SAAS,EAAE;QACT,EAAE,GAAG,EAAE,CAAC,2BAA2B,EAAE,6BAA6B,CAAC,EAAE,GAAG,EAAE,6BAA6B,EAAE;QACzG,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,EAAE,GAAG,EAAE,6BAA6B,EAAE;QAC5E,EAAE,GAAG,EAAE,CAAC,gCAAgC,EAAE,yBAAyB,CAAC,EAAE,GAAG,EAAE,kCAAkC,EAAE;KAChH;IACD,QAAQ,EAAE;QACR,yBAAyB,EAAE,EAAE;QAC7B,2BAA2B,EAAE,EAAE;QAC/B,2BAA2B,EAAE,EAAE;QAC/B,2BAA2B,EAAE,EAAE;QAC/B,8BAA8B,EAAE,EAAE;QAClC,uBAAuB,EAAE,EAAE;QAC3B,gCAAgC,EAAE,EAAE;KACrC;CACF,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAA2C;IAC3E,kBAAkB,EAAE,gBAAg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AM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3E,GAAG,CAAC,IAAI,CAAC,4BAA4B,GAAG,IAAI,IAAI,YAAY,QAAQ,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare function webgpuArchitectureFor(renderer: string): string;
2
+ export interface WebgpuOverridePlan {
3
+ args: string[];
4
+ /** Set when WebGPU may not fully match the override (family unknown, or no architecture mapping). */
5
+ warning?: string;
6
+ }
7
+ export declare function webgpuOverridePlan(o: {
8
+ gpuVendor?: unknown;
9
+ gpuRenderer?: unknown;
10
+ fingerprintProfile?: unknown;
11
+ disableGpuFingerprint?: unknown;
12
+ gpuStringSpoof?: unknown;
13
+ }): WebgpuOverridePlan;
14
+ //# sourceMappingURL=webgpu-override.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-override.d.ts","sourceRoot":"","sources":["../src/webgpu-override.ts"],"names":[],"mappings":"AAiCA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAgBD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qGAAqG;IACrG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACzE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC3D,GAAG,kBAAkB,CA8BrB"}
@@ -0,0 +1,82 @@
1
+ // A GPU override (gpuVendor / gpuRenderer) replaces only the WebGL strings in the engine. The WebGPU
2
+ // adapter (patch 075, gpu_adapter.cc) reads --fingerprint-webgpu-{vendor,architecture,device,
3
+ // description} when present, else the persona's own values, so without these flags WebGL can say
4
+ // Intel while navigator.gpu still says the persona's old AMD/NVIDIA GPU.
5
+ //
6
+ // Empty values: the adapter tests HasSwitch() first, so `--fingerprint-webgpu-architecture=` really
7
+ // yields an empty architecture (it does NOT fall back to the persona). Device and description are
8
+ // emptied the same way so the old GPU's strings cannot leak. (The persona derivation in patch 002
9
+ // does refill an empty persona.webgpu_architecture from the WebGL vendor, but the adapter never
10
+ // reads that value once the switch is present.)
11
+ import { existsSync, readFileSync } from "node:fs";
12
+ import { gpuFamilies } from "./persona-profile-v2.js";
13
+ /** Renderer text -> WebGPU architecture. Spellings: `gen-9`, `gen-12-lp`, `turing`, `ampere` appear
14
+ * in this repo's persona data (schemas/fixtures, patches/075 + 002). `pascal`/`lovelace` (NVIDIA)
15
+ * and `gcn-4`/`rdna-1`/`rdna-2`/`rdna-3` (AMD) follow Dawn's gpu_info architecture naming; they are
16
+ * not in repo fixtures. Anything not matched is left empty rather than guessed. */
17
+ const ARCHITECTURES = [
18
+ [/\b(?:uhd|hd) graphics\s*[56]\d\d\b/i, "gen-9"],
19
+ [/\biris\W*(?:\(r\)\W*)?xe\b|\buhd graphics\s*7\d\d\b/i, "gen-12-lp"],
20
+ [/\bgtx\s*10\d\d\b/i, "pascal"],
21
+ [/\bgtx\s*16\d\d\b|\brtx\s*20\d\d\b/i, "turing"],
22
+ [/\brtx\s*30\d\d\b/i, "ampere"],
23
+ [/\brtx\s*40\d\d\b/i, "lovelace"],
24
+ [/\brx\s*[45]\d\d\b/i, "gcn-4"],
25
+ [/\brx\s*5\d{3}\b/i, "rdna-1"],
26
+ [/\brx\s*6\d{3}\b/i, "rdna-2"],
27
+ [/\brx\s*7\d{3}\b/i, "rdna-3"],
28
+ ];
29
+ const SUPPORTED = new Set(["intel", "nvidia", "amd", "qualcomm"]);
30
+ export function webgpuArchitectureFor(renderer) {
31
+ return ARCHITECTURES.find(([re]) => re.test(renderer))?.[1] ?? "";
32
+ }
33
+ function profileWebgpuFamily(profile) {
34
+ let obj;
35
+ try {
36
+ obj = typeof profile === "object" ? profile : existsSync(String(profile)) ? JSON.parse(readFileSync(String(profile), "utf8")) : JSON.parse(String(profile));
37
+ }
38
+ catch {
39
+ return undefined;
40
+ }
41
+ const g = obj?.graphics?.webgpu;
42
+ if (!g || typeof g !== "object")
43
+ return undefined;
44
+ const text = [g.vendor, g.architecture, g.device, g.description].filter((s) => typeof s === "string").join(" ");
45
+ const fams = gpuFamilies(text);
46
+ return fams.size === 1 ? [...fams][0] : undefined;
47
+ }
48
+ export function webgpuOverridePlan(o) {
49
+ const vendor = typeof o.gpuVendor === "string" ? o.gpuVendor : "";
50
+ const renderer = typeof o.gpuRenderer === "string" ? o.gpuRenderer : "";
51
+ if (!vendor && !renderer)
52
+ return { args: [] };
53
+ // The real GPU is presented (or the string spoof is off): the override is not applied at all.
54
+ if (o.disableGpuFingerprint === true || o.gpuStringSpoof === false)
55
+ return { args: [] };
56
+ const fams = gpuFamilies(`${vendor} ${renderer}`);
57
+ const family = fams.size === 1 ? [...fams][0] : undefined;
58
+ if (!family || !SUPPORTED.has(family)) {
59
+ return {
60
+ args: [],
61
+ warning: `Cannot tell which GPU family gpuVendor/gpuRenderer ('${vendor}' / '${renderer}') names, so WebGPU ` +
62
+ "(navigator.gpu) keeps the persona's own adapter and may contradict WebGL. Use a recognisable " +
63
+ "Intel/NVIDIA/AMD/Qualcomm renderer string.",
64
+ };
65
+ }
66
+ if (o.fingerprintProfile !== undefined && profileWebgpuFamily(o.fingerprintProfile) === family)
67
+ return { args: [] };
68
+ const arch = webgpuArchitectureFor(renderer);
69
+ return {
70
+ // device/description are emptied so the previous GPU's strings cannot leak.
71
+ args: [
72
+ `--fingerprint-webgpu-vendor=${family}`,
73
+ `--fingerprint-webgpu-architecture=${arch}`,
74
+ "--fingerprint-webgpu-device=",
75
+ "--fingerprint-webgpu-description=",
76
+ ],
77
+ warning: arch ? undefined :
78
+ `gpuRenderer '${renderer}' is not in the WebGPU architecture table: WebGPU vendor is set to '${family}' ` +
79
+ "but its architecture, device and description are empty, which a real adapter never reports.",
80
+ };
81
+ }
82
+ //# sourceMappingURL=webgpu-override.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-override.js","sourceRoot":"","sources":["../src/webgpu-override.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,8FAA8F;AAC9F,iGAAiG;AACjG,yEAAyE;AACzE,EAAE;AACF,oGAAoG;AACpG,kGAAkG;AAClG,kGAAkG;AAClG,gGAAgG;AAChG,gDAAgD;AAEhD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;mFAGmF;AACnF,MAAM,aAAa,GAAuB;IACxC,CAAC,qCAAqC,EAAE,OAAO,CAAC;IAChD,CAAC,sDAAsD,EAAE,WAAW,CAAC;IACrE,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/B,CAAC,oCAAoC,EAAE,QAAQ,CAAC;IAChD,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/B,CAAC,mBAAmB,EAAE,UAAU,CAAC;IACjC,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAC/B,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,kBAAkB,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,Q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qB,CAAC,QAAQ,CAAC,CAAC;IAC7C,OAAO;QACL,4EAA4E;QAC5E,IAAI,EAAE;YACJ,+BAA+B,MAAM,EAAE;YACvC,qCAAqC,IAAI,EAAE;YAC3C,8BAA8B;YAC9B,mCAAmC;SACpC;QACD,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACzB,gBAAgB,QAAQ,uEAAuE,MAAM,IAAI;gBACzG,6FAA6F;KAChG,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** Chrome's component-updater app id for the Widevine CDM + Google's Omaha JSON endpoint. */
2
+ export declare const WIDEVINE_APP_ID = "oimompecagnajdejgnnjijobebaeigek";
3
+ export declare const OMAHA_URL = "https://update.googleapis.com/service/update2/json";
4
+ export declare const HINT_FILE = "latest-component-updated-widevine-cdm";
5
+ export interface WidevineOptions {
6
+ /** Destination root (default ~/.ant0-browser/WidevineCdm). */
7
+ dest?: string;
8
+ /** Suppress progress logging. */
9
+ quiet?: boolean;
10
+ }
11
+ /** Minimal Omaha v3.1 update check for the current-OS x64 Widevine CDM (version 0.0.0.0 -> latest). */
12
+ export declare function omahaRequestBody(): unknown;
13
+ /** Pull [downloadUrl, sha256, version] from an Omaha JSON response (pipelines or classic shape). */
14
+ export declare function parseUpdate(resp: any): [string, string, string];
15
+ /** A CRX3 file is 'Cr24' + u32 version + u32 headerLen + header + zip. Return the zip bytes. */
16
+ export declare function crx3ToZip(buf: Buffer): Buffer;
17
+ /**
18
+ * Download + verify the current-OS x64 Widevine CDM into `dest` (default ~/.ant0-browser/WidevineCdm/
19
+ * <version>). Returns the versioned CDM directory (manifest.json + _platform_specific/<subdir>/
20
+ * <filename>). Re-fetch is skipped if already present.
21
+ */
22
+ export declare function fetchWidevine(opts?: WidevineOptions): Promise<string>;
23
+ /**
24
+ * Make a persistent profile load the fetched CDM: copy it under <userDataDir>/WidevineCdm/<version>/
25
+ * and write the component hint file the engine reads. Fetches the CDM first if needed.
26
+ */
27
+ export declare function seedWidevine(userDataDir: string, opts?: WidevineOptions): Promise<string>;
28
+ /**
29
+ * Adjust launch args so the engine actually registers the seeded CDM. Pure — returns the new values.
30
+ *
31
+ * The un-suppress of the component updater (Playwright disables it by default via
32
+ * `--disable-component-update`) applies on BOTH platforms: `ignoreDefaultArgs` may be a list,
33
+ * `undefined`, or the boolean form Playwright accepts (`true` = ignore ALL defaults, so the updater
34
+ * is already un-suppressed); only the list/undefined forms need `--disable-component-update` added.
35
+ *
36
+ * The `--component-updater=fast-update` startup scan is Windows-ONLY: on Linux the seeded CDM hint
37
+ * file IS the registration mechanism (read at startup regardless), so no scan flag is added there.
38
+ * Verified: with these, requestMediaKeySystemAccess + createMediaKeys succeed.
39
+ */
40
+ export declare function widevineArgs(ignoreDefaultArgs: string[] | boolean | undefined, userArgs: string[]): {
41
+ ignoreDefaultArgs: string[] | boolean | undefined;
42
+ args: string[];
43
+ };
44
+ //# sourceMappingURL=widevine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widevine.d.ts","sourceRoot":"","sources":["../src/widevine.ts"],"names":[],"mappings":"AAqBA,6FAA6F;AAC7F,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAClE,eAAO,MAAM,SAAS,uDAAuD,CAAC;AAC9E,eAAO,MAAM,SAAS,0CAA0C,CAAC;AAwBjE,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAUD,uGAAuG;AACvG,wBAAgB,gBAAgB,IAAI,OAAO,CAiB1C;AAgBD,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAe/D;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC/E;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBnG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,EACjD,QAAQ,EAAE,MAAM,EAAE,GACjB;IAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAevE"}