capiumbrowser 1.3.1 → 1.3.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.
package/lib/channels.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "_comment": "SINGLE SOURCE OF TRUTH for the current stable Capium browser build per OS/arch. Each OS reaches stable independently -- edit one entry without touching the others. This file ships inside the wheel (the SDK reads it to pick each host's stable build) AND is published to the download server by the release pipeline. `version` is the reported Chromium version (what the browser reports to the customer, names the R2 folder); `engine_version` is the actual built Chromium engine (box_package verifies the binary against it) -- it differs from `version` when a platform reports a spoofed patch (Windows/macOS report .48 on the .47 engine). `revision` is our packaging counter -- the served R2 folder is chromium-v<version>.<revision>/, ALWAYS dotted-suffixed starting at 1. A Chromium version bump resets revision to 1. `published: false` means the tag is declared but no artifact exists yet.",
3
3
  "schema": 1,
4
- "updated": "2026-10-24",
4
+ "updated": "2026-10-27",
5
5
  "channels": {
6
6
  "stable": {
7
7
  "windows-x64": {
8
8
  "version": "156.0.8078.48",
9
9
  "engine_version": "156.0.8078.47",
10
- "revision": 2,
11
- "sha256": "76fa0d609f3d3fcac05436681884b3150405aaa470730d9a9ad1453ff6ad8276",
10
+ "revision": 3,
11
+ "sha256": "ad26bd1e62343ec741b3cd2ce8f73e00dfc6c25564654bfba828efb29a372a69",
12
12
  "published": true,
13
13
  "license_status_protocol": 1
14
14
  },
15
15
  "macos-arm64": {
16
16
  "version": "156.0.8078.48",
17
17
  "engine_version": "156.0.8078.47",
18
- "revision": 2,
19
- "sha256": "3b883146c0f41fcb409113d3f43764b7e7061bb6c64d58cddb26b2619887275f",
18
+ "revision": 3,
19
+ "sha256": "ce85cf43d57ff5ab4d35416b874d50560705c07e296c0b41b5cb78ee0d6f6eda",
20
20
  "published": true,
21
21
  "license_status_protocol": 1
22
22
  },
23
23
  "linux-x64": {
24
24
  "version": "156.0.8078.47",
25
25
  "engine_version": "156.0.8078.47",
26
- "revision": 2,
27
- "sha256": "5fc9954366d8052e09d8f528d1cdbcedcf6d0cb1ae43c36441ce975a1e60c749",
26
+ "revision": 3,
27
+ "sha256": "0ecad673f91b68b251e1185d88df6c46da35be592c46f45f015e189cd57b3152",
28
28
  "published": true,
29
29
  "license_status_protocol": 1
30
30
  },
package/lib/human.js CHANGED
@@ -1,12 +1,15 @@
1
1
  /**
2
- * human -- realistic mouse / typing / scroll for Playwright AND Puppeteer pages.
2
+ * human -- realistic mouse / typing / scroll / press-and-hold for Playwright AND Puppeteer pages.
3
3
  *
4
- * Anti-bot systems increasingly score *behavior*: instant teleport-clicks, zero-jitter typing
5
- * and single-delta scrolls are bot tells. These helpers move the cursor along a bezier path
6
- * with variable speed, type with per-key jitter, and scroll in eased increments. Pure driver
7
- * input (page.mouse / page.keyboard) -- no CDP tricks, so it stays consistent with the stealth
8
- * binary. The Playwright and Puppeteer input APIs align on everything used here except
9
- * mouse.wheel, which is bridged below.
4
+ * Anti-bot systems increasingly score *behavior*, and the modern ones (PX/HUMAN press-and-hold,
5
+ * DataDome slider) score pointer BIOMETRICS, not just "did a cursor arrive": velocity profile
6
+ * (humans accelerate then decelerate into the target -- Fitts's law -- never constant speed),
7
+ * orthogonal micro-jitter along the path, overshoot-and-correct on long moves, and physiological
8
+ * tremor during a sustained press (a hand cannot hold a mouse perfectly still; a rock-still
9
+ * multi-second hold is a machine signature). These helpers produce all of that with pure driver
10
+ * input (page.mouse / page.keyboard) -- no CDP tricks, so the event stream stays consistent with
11
+ * the stealth binary (isTrusted=true, normal coalescing). The Playwright and Puppeteer input
12
+ * APIs align on everything used here except mouse.wheel, which is bridged below.
10
13
  *
11
14
  * Presets tune the timing:
12
15
  * "default" -> natural human pace
@@ -16,9 +19,11 @@
16
19
 
17
20
  const PRESETS = {
18
21
  default: { moveSteps: [18, 34], stepMs: [6, 16], keyMs: [45, 130],
19
- clickPauseMs: [40, 140], scrollStep: [90, 220], scrollMs: [30, 90] },
22
+ clickPauseMs: [40, 140], scrollStep: [90, 220], scrollMs: [30, 90],
23
+ tremorPx: 1.1, tremorMs: [35, 110] },
20
24
  careful: { moveSteps: [30, 55], stepMs: [12, 28], keyMs: [80, 220],
21
- clickPauseMs: [120, 320], scrollStep: [50, 130], scrollMs: [60, 150] },
25
+ clickPauseMs: [120, 320], scrollStep: [50, 130], scrollMs: [60, 150],
26
+ tremorPx: 0.9, tremorMs: [50, 140] },
22
27
  };
23
28
 
24
29
  const cfg = (preset) => PRESETS[preset] || PRESETS.default;
@@ -26,54 +31,97 @@ const rand = (lo, hi) => lo + Math.random() * (hi - lo);
26
31
  const randMs = ([lo, hi]) => rand(lo, hi);
27
32
  const randInt = (lo, hi) => Math.round(rand(lo, hi));
28
33
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
34
+ const gauss = (mu, sigma) => {
35
+ // Box-Muller
36
+ const u = Math.random() || 1e-9;
37
+ const v = Math.random() || 1e-9;
38
+ return mu + sigma * Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
39
+ };
29
40
 
30
41
  function pos(page) {
31
42
  return page._capiumMouse || [randInt(2, 60), randInt(2, 60)];
32
43
  }
33
44
 
45
+ // Smoothstep time-warp: sampling the curve at these t values yields a bell-shaped velocity
46
+ // profile -- slow start, fast middle, decelerating arrival (Fitts-like) -- instead of the
47
+ // constant speed that uniform sampling produces.
48
+ const velocityWarp = (t) => t * t * (3 - 2 * t);
49
+
34
50
  function bezier(x0, y0, x1, y1, steps) {
35
- // two random control points -> a curved, non-linear path
51
+ // Two random control points -> a curved, non-linear path; velocity-warped sampling +
52
+ // orthogonal micro-jitter (largest mid-path, vanishing at the endpoints).
36
53
  const cx1 = x0 + (x1 - x0) * rand(0.2, 0.45) + rand(-40, 40);
37
54
  const cy1 = y0 + (y1 - y0) * rand(0.2, 0.45) + rand(-40, 40);
38
55
  const cx2 = x0 + (x1 - x0) * rand(0.55, 0.8) + rand(-40, 40);
39
56
  const cy2 = y0 + (y1 - y0) * rand(0.55, 0.8) + rand(-40, 40);
57
+ const dx = x1 - x0, dy = y1 - y0;
58
+ const dist = Math.hypot(dx, dy) || 1;
59
+ const nx = -dy / dist, ny = dx / dist; // unit normal to the gross direction
60
+ const jmax = Math.min(1.6, dist / 120); // short hops barely wobble
40
61
  const pts = [];
41
62
  for (let i = 1; i <= steps; i++) {
42
- const t = i / steps;
63
+ const lt = i / steps;
64
+ const t = velocityWarp(lt);
43
65
  const mt = 1 - t;
44
- pts.push([
45
- mt ** 3 * x0 + 3 * mt ** 2 * t * cx1 + 3 * mt * t ** 2 * cx2 + t ** 3 * x1,
46
- mt ** 3 * y0 + 3 * mt ** 2 * t * cy1 + 3 * mt * t ** 2 * cy2 + t ** 3 * y1,
47
- ]);
66
+ const x = mt ** 3 * x0 + 3 * mt ** 2 * t * cx1 + 3 * mt * t ** 2 * cx2 + t ** 3 * x1;
67
+ const y = mt ** 3 * y0 + 3 * mt ** 2 * t * cy1 + 3 * mt * t ** 2 * cy2 + t ** 3 * y1;
68
+ const j = Math.sin(Math.PI * lt) * rand(-jmax, jmax);
69
+ pts.push([x + nx * j, y + ny * j]);
48
70
  }
49
71
  return pts;
50
72
  }
51
73
 
74
+ async function runPath(page, pts, c) {
75
+ for (const [px, py] of pts) {
76
+ await page.mouse.move(px, py);
77
+ let d = randMs(c.stepMs);
78
+ if (Math.random() < 0.02) d += rand(30, 80); // occasional motor hitch
79
+ await sleep(d);
80
+ }
81
+ }
82
+
52
83
  async function wheel(page, dx, dy) {
53
84
  // Playwright: mouse.wheel(dx, dy). Puppeteer: mouse.wheel({deltaX, deltaY}).
54
85
  if (page.mouse.wheel.length >= 2) return page.mouse.wheel(dx, dy);
55
86
  return page.mouse.wheel({ deltaX: dx, deltaY: dy });
56
87
  }
57
88
 
58
- /** Move the cursor to (x, y) along a human-like curved path. */
89
+ /**
90
+ * Move the cursor to (x, y) along a human-like curved path.
91
+ *
92
+ * Long moves overshoot the target by a few pixels and correct -- the characteristic human
93
+ * "land past it, pull back" arrival that biometric scorers look for (its absence over many
94
+ * moves is a tell).
95
+ */
59
96
  async function move(page, x, y, preset = 'default') {
60
97
  const c = cfg(preset);
61
98
  const [x0, y0] = pos(page);
99
+ const dist = Math.hypot(x - x0, y - y0);
62
100
  const steps = randInt(...c.moveSteps);
63
- for (const [px, py] of bezier(x0, y0, x, y, steps)) {
64
- await page.mouse.move(px, py);
65
- await sleep(randMs(c.stepMs));
101
+ if (dist > 180 && Math.random() < 0.6) {
102
+ const ux = (x - x0) / dist, uy = (y - y0) / dist;
103
+ const over = rand(3, 14);
104
+ const ox = x + ux * over, oy = y + uy * over;
105
+ await runPath(page, bezier(x0, y0, ox, oy, steps), c);
106
+ await runPath(page, bezier(ox, oy, x, y, randInt(4, 8)), c);
107
+ } else {
108
+ await runPath(page, bezier(x0, y0, x, y, steps), c);
66
109
  }
67
110
  page._capiumMouse = [x, y];
68
111
  }
69
112
 
113
+ /** Target: a selector string, or an [x, y] pair. */
114
+ async function resolvePoint(page, target) {
115
+ if (Array.isArray(target) && target.length === 2) return [Number(target[0]), Number(target[1])];
116
+ const el = await page.waitForSelector(target, { state: 'visible', visible: true });
117
+ const box = await el.boundingBox();
118
+ return [box.x + box.width * rand(0.3, 0.7), box.y + box.height * rand(0.3, 0.7)];
119
+ }
120
+
70
121
  /** Move to a random point inside `selector` and click with a natural pause. */
71
122
  async function click(page, selector, preset = 'default') {
72
123
  const c = cfg(preset);
73
- const el = await page.waitForSelector(selector, { state: 'visible', visible: true });
74
- const box = await el.boundingBox();
75
- const tx = box.x + box.width * rand(0.3, 0.7);
76
- const ty = box.y + box.height * rand(0.3, 0.7);
124
+ const [tx, ty] = await resolvePoint(page, selector);
77
125
  await move(page, tx, ty, preset);
78
126
  await sleep(randMs(c.clickPauseMs));
79
127
  await page.mouse.down();
@@ -81,6 +129,36 @@ async function click(page, selector, preset = 'default') {
81
129
  await page.mouse.up();
82
130
  }
83
131
 
132
+ /**
133
+ * Press-and-hold on `target` (selector or [x, y]) for ~`seconds`, with tremor.
134
+ *
135
+ * Built for press-and-hold challenges (PX/HUMAN and similar), which measure the pointer
136
+ * DURING the press: a real hand drifts and trembles ~1px around the anchor the whole time,
137
+ * and releases slightly late. A hold with zero pointer events between mousedown and mouseup
138
+ * reads as synthetic no matter how good the approach path was. `seconds` should be the
139
+ * challenge's required duration; a natural human release lag is added on top.
140
+ */
141
+ async function hold(page, target, seconds, preset = 'default') {
142
+ const c = cfg(preset);
143
+ const [tx, ty] = await resolvePoint(page, target);
144
+ await move(page, tx, ty, preset);
145
+ await sleep(randMs(c.clickPauseMs));
146
+ await page.mouse.down();
147
+ const amp = c.tremorPx;
148
+ let ax = tx, ay = ty; // slow random-walk drift anchor
149
+ const end = Date.now() + Number(seconds) * 1000 + rand(150, 450);
150
+ while (Date.now() < end) {
151
+ await sleep(randMs(c.tremorMs));
152
+ if (Math.random() < 0.7) { // tremor tick: micro-move near the anchor
153
+ ax = Math.min(tx + 3, Math.max(tx - 3, ax + rand(-0.35, 0.35)));
154
+ ay = Math.min(ty + 3, Math.max(ty - 3, ay + rand(-0.35, 0.35)));
155
+ await page.mouse.move(ax + gauss(0, amp * 0.5), ay + gauss(0, amp * 0.5));
156
+ }
157
+ }
158
+ await page.mouse.up();
159
+ page._capiumMouse = [ax, ay];
160
+ }
161
+
84
162
  /** Click the field, then type with per-key jitter (occasional longer pauses). */
85
163
  async function typeText(page, selector, text, preset = 'default') {
86
164
  const c = cfg(preset);
@@ -112,7 +190,7 @@ async function dwell(loSec = 0.4, hiSec = 1.8) {
112
190
  }
113
191
 
114
192
  /**
115
- * Attach page.humanMove / humanClick / humanType / humanScroll / humanDwell.
193
+ * Attach page.humanMove / humanClick / humanType / humanScroll / humanHold / humanDwell.
116
194
  *
117
195
  * target may be a Page or a BrowserContext (all current + future pages are patched).
118
196
  * Returns target (chainable). Does NOT override page.click/type so existing code is safe;
@@ -126,6 +204,7 @@ function humanize(target, preset = 'default') {
126
204
  page.humanClick = (sel, p = preset) => click(page, sel, p);
127
205
  page.humanType = (sel, text, p = preset) => typeText(page, sel, text, p);
128
206
  page.humanScroll = (dy, p = preset) => scroll(page, dy, p);
207
+ page.humanHold = (sel, seconds, p = preset) => hold(page, sel, seconds, p);
129
208
  page.humanDwell = dwell;
130
209
  };
131
210
 
@@ -139,4 +218,4 @@ function humanize(target, preset = 'default') {
139
218
  return target;
140
219
  }
141
220
 
142
- module.exports = { humanize, move, click, typeText, scroll, dwell, PRESETS };
221
+ module.exports = { humanize, move, click, typeText, scroll, dwell, hold, PRESETS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capiumbrowser",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Drop-in stealth browser SDK on top of Playwright or Puppeteer (Capium Chromium).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Capzy (https://capzy.ai)",