ant0-browser 0.2.0 → 0.2.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.
@@ -0,0 +1,57 @@
1
+ /** Windows persona coherence rules for the local population-model generator (parity with
2
+ * sdk/python/ant0browser/_windows_coherence.py and with the cloud generators).
3
+ *
4
+ * Both rules come from tells a page can read without any permission:
5
+ * - ANGLE writes the PCI device id into the WebGL renderer string as `0x` plus exactly 8 hex digits
6
+ * (`ANGLE (Intel, Intel(R) UHD Graphics 620 (0x00003EA0) Direct3D11 vs_5_0 ps_5_0, D3D11)`). A
7
+ * renderer without it cannot come from a real Chrome on Windows.
8
+ * - A generated Windows persona claims Windows 11, whose taskbar is 48 CSS px tall, at the bottom (or
9
+ * absent when it auto-hides): `availWidth` equals `width`, and `height - availHeight` is 48 or 0. A
10
+ * side taskbar is a Windows 10 tell.
11
+ * The generator only draws rows that satisfy both: a graphics row without an id is not drawn (ids are
12
+ * never made up), a display row with another work area is normalised to a 48 px bottom taskbar. */
13
+ const ANGLE_DEVICE_ID = /\(0x[0-9A-Fa-f]{8}\)/;
14
+ /** The Windows 11 taskbar height in CSS px (100, 125 and 150 % scaling). */
15
+ export const WIN11_TASKBAR_PX = 48;
16
+ /** Whether a WebGL renderer string carries ANGLE's 8-digit device id. */
17
+ export function hasAngleDeviceId(renderer) {
18
+ return typeof renderer === "string" && ANGLE_DEVICE_ID.test(renderer);
19
+ }
20
+ /** Whether the screen/available height gap is a Windows 11 taskbar: 48 px, or 0 (auto-hidden). */
21
+ export function isWin11TaskbarGap(height, availHeight) {
22
+ if (typeof height !== "number" || typeof availHeight !== "number")
23
+ return false;
24
+ const gap = height - availHeight;
25
+ return gap === WIN11_TASKBAR_PX || gap === 0;
26
+ }
27
+ /** Whether a screen's work area is a Windows 11 one: a full-width bottom taskbar of 48 px, or none. */
28
+ export function isWin11Screen(s) {
29
+ return typeof s.width === "number" && s.availWidth === s.width
30
+ && isWin11TaskbarGap(s.height, s.availHeight);
31
+ }
32
+ /** Whether a display row of the population model passes the Windows 11 screen rule. */
33
+ export function isWin11DisplayRow(payload) {
34
+ return isWin11Screen({
35
+ width: payload.width,
36
+ height: payload.height,
37
+ availWidth: payload.available_width,
38
+ availHeight: payload.available_height,
39
+ });
40
+ }
41
+ /**
42
+ * The Windows 11 form of a display row. The screen size and its weight are never touched: only the
43
+ * work area is normalised, so the size mix of the model survives.
44
+ * - already a full-width bottom 48 px taskbar, or none at all (genuine auto-hide): returned as is;
45
+ * - anything else (another gap, a side or top taskbar): a bottom taskbar of exactly 48 CSS px,
46
+ * `available_width = width`, `available_height = height - 48`.
47
+ * Returns undefined only for a row with no numeric size or a screen too short to hold a taskbar. */
48
+ export function normaliseWin11DisplayRow(payload) {
49
+ const { width, height } = payload;
50
+ if (typeof width !== "number" || typeof height !== "number" || height <= WIN11_TASKBAR_PX) {
51
+ return undefined;
52
+ }
53
+ if (isWin11DisplayRow(payload))
54
+ return payload;
55
+ return { ...payload, available_width: width, available_height: height - WIN11_TASKBAR_PX };
56
+ }
57
+ //# sourceMappingURL=windows-coherence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windows-coherence.js","sourceRoot":"","sources":["../src/windows-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;mGAWmG;AAEnG,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,QAAiB;IAChD,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxE,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,iBAAiB,CAAC,MAAe,EAAE,WAAoB;IACrE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAChF,MAAM,GAAG,GAAG,MAAM,GAAG,WAAW,CAAC;IACjC,OAAO,GAAG,KAAK,gBAAgB,IAAI,GAAG,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,aAAa,CAAC,CAE7B;IACC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,KAAK;WACzD,iBAAiB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,iBAAiB,CAAC,OAA4B;IAC5D,OAAO,aAAa,CAAC;QACnB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,eAAe;QACnC,WAAW,EAAE,OAAO,CAAC,gBAAgB;KACtC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;oGAMoG;AACpG,MAAM,UAAU,wBAAwB,CAAgC,OAAU;IAChF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,gBAAgB,EAAE,CAAC;QAC1F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,iBAAiB,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/C,OAAO,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;AAC7F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ant0-browser",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Playwright SDK for launching a separately installed Ant0 Browser engine.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",