clearcote 0.51.1 → 0.53.0
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/README.md +38 -2
- package/dist/attention.d.ts +26 -0
- package/dist/attention.d.ts.map +1 -0
- package/dist/attention.js +82 -0
- package/dist/attention.js.map +1 -0
- package/dist/cloud.d.ts +10 -3
- package/dist/cloud.d.ts.map +1 -1
- package/dist/cloud.js +9 -1
- package/dist/cloud.js.map +1 -1
- package/dist/forms.d.ts +8 -0
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +56 -0
- package/dist/forms.js.map +1 -1
- package/dist/frames.d.ts +33 -0
- package/dist/frames.d.ts.map +1 -0
- package/dist/frames.js +415 -0
- package/dist/frames.js.map +1 -0
- package/dist/geometry.d.ts +94 -10
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +162 -9
- package/dist/geometry.js.map +1 -1
- package/dist/hold.d.ts +14 -7
- package/dist/hold.d.ts.map +1 -1
- package/dist/hold.js +33 -6
- package/dist/hold.js.map +1 -1
- package/dist/humanize.d.ts +49 -20
- package/dist/humanize.d.ts.map +1 -1
- package/dist/humanize.js +2024 -261
- package/dist/humanize.js.map +1 -1
- package/dist/hzoptions.d.ts +78 -0
- package/dist/hzoptions.d.ts.map +1 -0
- package/dist/hzoptions.js +171 -0
- package/dist/hzoptions.js.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -16
- package/dist/index.js.map +1 -1
- package/dist/isolated.d.ts +6 -0
- package/dist/isolated.d.ts.map +1 -1
- package/dist/isolated.js +57 -1
- package/dist/isolated.js.map +1 -1
- package/dist/keys.d.ts +69 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +201 -0
- package/dist/keys.js.map +1 -0
- package/dist/motion.d.ts +130 -12
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +258 -19
- package/dist/motion.js.map +1 -1
- package/dist/motionscore.d.ts +81 -0
- package/dist/motionscore.d.ts.map +1 -1
- package/dist/motionscore.js +279 -2
- package/dist/motionscore.js.map +1 -1
- package/dist/pacing.d.ts +5 -0
- package/dist/pacing.d.ts.map +1 -1
- package/dist/pacing.js +10 -0
- package/dist/pacing.js.map +1 -1
- package/dist/scroll.d.ts +143 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +426 -0
- package/dist/scroll.js.map +1 -0
- package/dist/trace.d.ts +12 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +60 -0
- package/dist/trace.js.map +1 -0
- package/dist/windowgeom.d.ts +40 -0
- package/dist/windowgeom.d.ts.map +1 -0
- package/dist/windowgeom.js +167 -0
- package/dist/windowgeom.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export type HumanizePreset = "careful" | "default" | "quick";
|
|
2
|
+
export type HumanizeEngine = "auto" | "all" | "coords" | "off";
|
|
3
|
+
export type HumanizeAmbient = "off" | "load" | "idle";
|
|
4
|
+
/** One action handed to Playwright's own call. */
|
|
5
|
+
export interface HumanizeFallbackEvent {
|
|
6
|
+
/** The API that was called ("page.click", "locator.fill", ...). */
|
|
7
|
+
api: string;
|
|
8
|
+
/** Why the humanized route did not apply. */
|
|
9
|
+
reason: string;
|
|
10
|
+
/** The selector, when there is one. */
|
|
11
|
+
selector?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The `humanize:` options (all optional; `{}` is `humanize: true`). */
|
|
14
|
+
export interface HumanizeOptions {
|
|
15
|
+
/** Every planned duration (glides, presses, key dwell and gaps) x1.4 / x1.0 / x0.7, and the rate of
|
|
16
|
+
* thinking pauses scaled the same way. Default "default". */
|
|
17
|
+
preset?: HumanizePreset;
|
|
18
|
+
/** Throw ClearcoteStrictError instead of falling back to a stock Playwright call. */
|
|
19
|
+
strict?: boolean;
|
|
20
|
+
/** Which clicks the engine's pointer path walks: "auto" (CLEARCOTE_HUMANIZE_ENGINE_CLICKS, else
|
|
21
|
+
* "coords"), "all", "coords", "off". Replaces the environment variable when not "auto". */
|
|
22
|
+
engine?: HumanizeEngine;
|
|
23
|
+
/** "load": a short ambient burst on every page load (the old `page._clearcoteAutoAmbient`); "idle":
|
|
24
|
+
* idle drifts between actions; "off" (default). */
|
|
25
|
+
ambient?: HumanizeAmbient;
|
|
26
|
+
/** Per-character slip rate 0..1; unset = CLEARCOTE_HUMANIZE_TYPO_RATE, else 0.02. */
|
|
27
|
+
typoRate?: number;
|
|
28
|
+
/** "left" | "right"; unset = the persona's. */
|
|
29
|
+
handedness?: "left" | "right";
|
|
30
|
+
/** The pointer's report rate (Hz) in place of the persona's. */
|
|
31
|
+
deviceHz?: number;
|
|
32
|
+
/** "mouse" | "trackpad"; unset = the persona's. */
|
|
33
|
+
inputDevice?: "mouse" | "trackpad";
|
|
34
|
+
/** Called each time an action is handed to Playwright's own call (not in strict mode). Throwing from it
|
|
35
|
+
* stops the stock call. */
|
|
36
|
+
onFallback?: (event: HumanizeFallbackEvent) => void;
|
|
37
|
+
}
|
|
38
|
+
/** What `humanize:` accepts. */
|
|
39
|
+
export type HumanizeSetting = boolean | "strict" | HumanizeOptions;
|
|
40
|
+
export declare const PRESET_TEMPO: Readonly<Record<HumanizePreset, number>>;
|
|
41
|
+
/** A validated HumanizeOptions with its defaults filled in. */
|
|
42
|
+
export interface ResolvedHumanize {
|
|
43
|
+
preset: HumanizePreset;
|
|
44
|
+
strict: boolean;
|
|
45
|
+
engine: HumanizeEngine;
|
|
46
|
+
ambient?: HumanizeAmbient;
|
|
47
|
+
typoRate?: number;
|
|
48
|
+
handedness?: "left" | "right";
|
|
49
|
+
deviceHz?: number;
|
|
50
|
+
inputDevice?: "mouse" | "trackpad";
|
|
51
|
+
onFallback?: (event: HumanizeFallbackEvent) => void;
|
|
52
|
+
tempo: number;
|
|
53
|
+
}
|
|
54
|
+
/** Thrown in strict mode where the humanized route would have handed the action to Playwright's own call. */
|
|
55
|
+
export declare class ClearcoteStrictError extends Error {
|
|
56
|
+
readonly api: string;
|
|
57
|
+
readonly reason: string;
|
|
58
|
+
readonly selector?: string;
|
|
59
|
+
constructor(api: string, reason: string, selector?: string);
|
|
60
|
+
}
|
|
61
|
+
/** `humanize:` as given -> the resolved options, or null for off. Throws on what it does not know. */
|
|
62
|
+
export declare function resolveHumanize(value: unknown): ResolvedHumanize | null;
|
|
63
|
+
/** The JSON-able options (no callback, unset values left out): what a cloud launch sends as humanizeOptions. */
|
|
64
|
+
export declare function humanizePayload(r: ResolvedHumanize): Record<string, unknown>;
|
|
65
|
+
/** Run `fn` with `api` as the outermost public entry point (kept when one is already set). */
|
|
66
|
+
export declare function withCallerApi<R>(api: string, fn: () => Promise<R>): Promise<R>;
|
|
67
|
+
export declare function optionsOf(page: unknown): ResolvedHumanize | null;
|
|
68
|
+
/** One humanized action is about to be handed to Playwright's own call: tell onFallback (its error
|
|
69
|
+
* propagates and stops the stock call), or, in strict mode, throw ClearcoteStrictError instead. */
|
|
70
|
+
export declare function reportFallback(page: unknown, api: string, reason: string, selector?: string): HumanizeFallbackEvent;
|
|
71
|
+
/** The engine click mode: the page's option unless "auto", else the environment's. */
|
|
72
|
+
export declare function engineModeFor(page: unknown, envMode: () => "off" | "coords" | "all"): "off" | "coords" | "all";
|
|
73
|
+
export declare function typoRateFor(page: unknown, envRate: () => number): number;
|
|
74
|
+
/** The options a planner reads from the persona, set as plain fields after makePersona (no RNG draw, so the
|
|
75
|
+
* seed -> persona map is unchanged). The timing windows are scaled by the preset here; other planners read
|
|
76
|
+
* tempo / pauseScale / handedness / inputDevice defensively. */
|
|
77
|
+
export declare function applyToPersona<P extends object>(persona: P, r: ResolvedHumanize): P;
|
|
78
|
+
//# sourceMappingURL=hzoptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hzoptions.d.ts","sourceRoot":"","sources":["../src/hzoptions.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS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OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAG9G;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,GAAG,MAAM,CAGxE;AAED;;gEAEgE;AAChE,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAmBnF"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// `humanize:` options: the object form of the switch, the fallback report and strict mode.
|
|
2
|
+
//
|
|
3
|
+
// `humanize` accepts `true` / `false` (as before), `"strict"` (`{ strict: true }`), or a HumanizeOptions
|
|
4
|
+
// object (an unknown key throws). `humanize: true` is exactly `{}`: every default reproduces 0.51.0, and no
|
|
5
|
+
// option draws from the persona's RNG stream, so a seed keeps the same motor persona whatever is given.
|
|
6
|
+
//
|
|
7
|
+
// Every place where the humanized route hands an action to Playwright's own (stock, untimed) call reports
|
|
8
|
+
// it through reportFallback: by default `onFallback({ api, reason, selector })` is called; with
|
|
9
|
+
// `strict: true` a ClearcoteStrictError is thrown instead and the stock call does not run. Same options,
|
|
10
|
+
// same meaning, in the Python (`_hzoptions.py`) and .NET (`Humanize.cs`) SDKs.
|
|
11
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
12
|
+
export const PRESET_TEMPO = { careful: 1.4, default: 1.0, quick: 0.7 };
|
|
13
|
+
const KEYS = ["preset", "strict", "engine", "ambient", "typoRate", "handedness", "deviceHz", "inputDevice", "onFallback"];
|
|
14
|
+
// snake_case spellings accepted too, so one options object works in every SDK and in the cloud API
|
|
15
|
+
const ALIASES = { typo_rate: "typoRate", device_hz: "deviceHz", input_device: "inputDevice", on_fallback: "onFallback" };
|
|
16
|
+
const RESOLVED = Symbol.for("clearcote.humanizeResolved");
|
|
17
|
+
/** Thrown in strict mode where the humanized route would have handed the action to Playwright's own call. */
|
|
18
|
+
export class ClearcoteStrictError extends Error {
|
|
19
|
+
api;
|
|
20
|
+
reason;
|
|
21
|
+
selector;
|
|
22
|
+
constructor(api, reason, selector) {
|
|
23
|
+
super(`humanize strict: ${selector ? JSON.stringify(selector) : "the action"} would fall back to a stock Playwright call (${reason})`);
|
|
24
|
+
this.name = "ClearcoteStrictError";
|
|
25
|
+
this.api = api;
|
|
26
|
+
this.reason = reason;
|
|
27
|
+
this.selector = selector;
|
|
28
|
+
// worded by the caller's API like Playwright's own errors (humanize.ts asApiError)
|
|
29
|
+
this[Symbol.for("clearcote.playwrightError")] = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function oneOf(name, v, allowed) {
|
|
33
|
+
if (v === undefined || v === null)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (typeof v !== "string" || !allowed.includes(v)) {
|
|
36
|
+
throw new TypeError(`humanize ${name} must be ${allowed.map((a) => `"${a}"`).join(", ")}, not ${JSON.stringify(v)}`);
|
|
37
|
+
}
|
|
38
|
+
return v;
|
|
39
|
+
}
|
|
40
|
+
/** `humanize:` as given -> the resolved options, or null for off. Throws on what it does not know. */
|
|
41
|
+
export function resolveHumanize(value) {
|
|
42
|
+
if (value === undefined || value === null || value === false)
|
|
43
|
+
return null;
|
|
44
|
+
if (value && typeof value === "object" && value[RESOLVED])
|
|
45
|
+
return value;
|
|
46
|
+
let o;
|
|
47
|
+
if (value === true)
|
|
48
|
+
o = {};
|
|
49
|
+
else if (value === "strict")
|
|
50
|
+
o = { strict: true };
|
|
51
|
+
else if (typeof value === "object" && !Array.isArray(value)) {
|
|
52
|
+
o = {};
|
|
53
|
+
for (const [k0, v] of Object.entries(value)) {
|
|
54
|
+
const k = ALIASES[k0] ?? k0;
|
|
55
|
+
if (!KEYS.includes(k))
|
|
56
|
+
throw new TypeError(`unknown humanize option "${k0}" (known: ${KEYS.join(", ")})`);
|
|
57
|
+
o[k] = v;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
throw new TypeError(`humanize must be true, false, "strict" or an options object, not ${JSON.stringify(value)}`);
|
|
62
|
+
}
|
|
63
|
+
const preset = oneOf("preset", o.preset, ["careful", "default", "quick"]) ?? "default";
|
|
64
|
+
if (o.strict !== undefined && typeof o.strict !== "boolean")
|
|
65
|
+
throw new TypeError("humanize strict must be true or false");
|
|
66
|
+
const r = {
|
|
67
|
+
preset,
|
|
68
|
+
strict: o.strict === true,
|
|
69
|
+
engine: oneOf("engine", o.engine, ["auto", "all", "coords", "off"]) ?? "auto",
|
|
70
|
+
tempo: PRESET_TEMPO[preset],
|
|
71
|
+
};
|
|
72
|
+
const ambient = oneOf("ambient", o.ambient, ["off", "load", "idle"]);
|
|
73
|
+
if (ambient)
|
|
74
|
+
r.ambient = ambient;
|
|
75
|
+
if (o.typoRate !== undefined && o.typoRate !== null) {
|
|
76
|
+
const t = o.typoRate;
|
|
77
|
+
if (typeof t !== "number" || !(t >= 0 && t <= 1))
|
|
78
|
+
throw new TypeError("humanize typoRate must be a number from 0 to 1");
|
|
79
|
+
r.typoRate = t;
|
|
80
|
+
}
|
|
81
|
+
const hand = oneOf("handedness", o.handedness, ["left", "right"]);
|
|
82
|
+
if (hand)
|
|
83
|
+
r.handedness = hand;
|
|
84
|
+
if (o.deviceHz !== undefined && o.deviceHz !== null) {
|
|
85
|
+
const h = o.deviceHz;
|
|
86
|
+
if (typeof h !== "number" || !Number.isInteger(h) || h < 30 || h > 8000)
|
|
87
|
+
throw new TypeError("humanize deviceHz must be a whole number of Hz from 30 to 8000");
|
|
88
|
+
r.deviceHz = h;
|
|
89
|
+
}
|
|
90
|
+
const dev = oneOf("inputDevice", o.inputDevice, ["mouse", "trackpad"]);
|
|
91
|
+
if (dev)
|
|
92
|
+
r.inputDevice = dev;
|
|
93
|
+
if (o.onFallback !== undefined && o.onFallback !== null) {
|
|
94
|
+
if (typeof o.onFallback !== "function")
|
|
95
|
+
throw new TypeError("humanize onFallback must be a function");
|
|
96
|
+
r.onFallback = o.onFallback;
|
|
97
|
+
}
|
|
98
|
+
Object.defineProperty(r, RESOLVED, { value: true, enumerable: false });
|
|
99
|
+
return r;
|
|
100
|
+
}
|
|
101
|
+
/** The JSON-able options (no callback, unset values left out): what a cloud launch sends as humanizeOptions. */
|
|
102
|
+
export function humanizePayload(r) {
|
|
103
|
+
const out = { preset: r.preset, strict: r.strict, engine: r.engine };
|
|
104
|
+
for (const k of ["ambient", "typoRate", "handedness", "deviceHz", "inputDevice"])
|
|
105
|
+
if (r[k] !== undefined)
|
|
106
|
+
out[k] = r[k];
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
// The public API a call came in through ("locator.click" when a locator routes through page.click).
|
|
110
|
+
const caller = new AsyncLocalStorage();
|
|
111
|
+
/** Run `fn` with `api` as the outermost public entry point (kept when one is already set). */
|
|
112
|
+
export function withCallerApi(api, fn) {
|
|
113
|
+
return caller.getStore() === undefined ? caller.run(api, fn) : fn();
|
|
114
|
+
}
|
|
115
|
+
export function optionsOf(page) {
|
|
116
|
+
const o = page?._clearcoteHz;
|
|
117
|
+
return o && o[RESOLVED] ? o : null;
|
|
118
|
+
}
|
|
119
|
+
/** One humanized action is about to be handed to Playwright's own call: tell onFallback (its error
|
|
120
|
+
* propagates and stops the stock call), or, in strict mode, throw ClearcoteStrictError instead. */
|
|
121
|
+
export function reportFallback(page, api, reason, selector) {
|
|
122
|
+
const ev = { api: caller.getStore() ?? api, reason, ...(selector !== undefined ? { selector } : {}) };
|
|
123
|
+
// the newest event is kept on the page either way (a test and hook-less caller seam)
|
|
124
|
+
try {
|
|
125
|
+
page._clearcoteLastFallback = ev;
|
|
126
|
+
}
|
|
127
|
+
catch { /* a frozen or non-object page */ }
|
|
128
|
+
const o = optionsOf(page);
|
|
129
|
+
if (!o)
|
|
130
|
+
return ev;
|
|
131
|
+
if (o.strict)
|
|
132
|
+
throw new ClearcoteStrictError(ev.api, reason, selector);
|
|
133
|
+
if (o.onFallback)
|
|
134
|
+
o.onFallback(ev);
|
|
135
|
+
return ev;
|
|
136
|
+
}
|
|
137
|
+
/** The engine click mode: the page's option unless "auto", else the environment's. */
|
|
138
|
+
export function engineModeFor(page, envMode) {
|
|
139
|
+
const o = optionsOf(page);
|
|
140
|
+
return o && o.engine !== "auto" ? o.engine : envMode();
|
|
141
|
+
}
|
|
142
|
+
export function typoRateFor(page, envRate) {
|
|
143
|
+
const o = optionsOf(page);
|
|
144
|
+
return o && o.typoRate !== undefined ? o.typoRate : envRate();
|
|
145
|
+
}
|
|
146
|
+
/** The options a planner reads from the persona, set as plain fields after makePersona (no RNG draw, so the
|
|
147
|
+
* seed -> persona map is unchanged). The timing windows are scaled by the preset here; other planners read
|
|
148
|
+
* tempo / pauseScale / handedness / inputDevice defensively. */
|
|
149
|
+
export function applyToPersona(persona, r) {
|
|
150
|
+
const p = persona;
|
|
151
|
+
const t = r.tempo;
|
|
152
|
+
p.tempo = t;
|
|
153
|
+
p.pauseScale = t;
|
|
154
|
+
p.handedness = r.handedness;
|
|
155
|
+
if ((r.handedness === "left" || r.handedness === "right") && typeof p.approachBias === "number") {
|
|
156
|
+
// the persona's handedness is the sign of its approach bias (path bow side, click side bias): the option fixes
|
|
157
|
+
// the sign and keeps the drawn magnitude ("right" = positive)
|
|
158
|
+
p.approachBias = r.handedness === "right" ? Math.abs(p.approachBias) : -Math.abs(p.approachBias);
|
|
159
|
+
}
|
|
160
|
+
p.inputDevice = r.inputDevice;
|
|
161
|
+
if (t !== 1) {
|
|
162
|
+
for (const k of ["grabMinMs", "grabMaxMs", "releaseMinMs", "releaseMaxMs", "clickHoldMinMs", "clickHoldMaxMs", "keyDwellMinMs", "keyDwellMaxMs"]) {
|
|
163
|
+
if (typeof p[k] === "number")
|
|
164
|
+
p[k] *= t;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (r.deviceHz !== undefined)
|
|
168
|
+
p.deviceHz = r.deviceHz;
|
|
169
|
+
return persona;
|
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AAC;AACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Browser, BrowserContext, BrowserContextOptions, LaunchOptions as P
|
|
|
3
3
|
import { type DownloadOptions } from "./download.js";
|
|
4
4
|
import { type FingerprintOptions } from "./fingerprint.js";
|
|
5
5
|
import { type Geo } from "./geoip.js";
|
|
6
|
-
import { type
|
|
6
|
+
import { type HumanizeLaunchOptions } from "./humanize.js";
|
|
7
7
|
import { type AgentOptions } from "./agent.js";
|
|
8
8
|
import { Profile } from "./profile.js";
|
|
9
9
|
import { type AutoOptions } from "./profileauto.js";
|
|
@@ -25,8 +25,13 @@ export { resolveReleaseChannel, type ReleaseChannel } from "./download.js";
|
|
|
25
25
|
export { isFingerprintPassthrough } from "./fingerprint.js";
|
|
26
26
|
export { DEFAULT_IGNORED_ARGS, gpuBlocklistArgs, gpuBackendArgs, xDisplayAvailable, mesaEglAvailable, gateEngineSwitches, engineSupportsSwitch } from "./launchopts.js";
|
|
27
27
|
export { serveMultiplex, type MultiplexOptions, type MultiplexServer } from "./multiplex.js";
|
|
28
|
-
export type {
|
|
28
|
+
export type { HumanizeLaunchOptions } from "./humanize.js";
|
|
29
|
+
export { ClearcoteStrictError, resolveHumanize } from "./hzoptions.js";
|
|
30
|
+
export type { HumanizeAmbient, HumanizeEngine, HumanizeFallbackEvent, HumanizeOptions, HumanizePreset, HumanizeSetting, } from "./hzoptions.js";
|
|
29
31
|
export { pressAndHold, type PressAndHoldOptions, type HoldButton } from "./hold.js";
|
|
32
|
+
export { scoreAction, scoreMotion, scoreTyped, scoreWheel, scoreDrag, scoreHover, scoreAmbient, extractFeatures, stepsToSamples, fingerOf, type ActionScore, type ActionKind, type MotionScore, type MotionFeatures, type Sample as MotionSample, type KeySample, type WheelSample, } from "./motionscore.js";
|
|
33
|
+
export { record as recordHumanizeAction, traceEnabled as humanizeScoreEnabled } from "./trace.js";
|
|
34
|
+
export type { DragByOptions } from "./humanize.js";
|
|
30
35
|
export { Profile, listProfiles, loadProfile, PROFILE_DIR, type ProfileOptions } from "./profile.js";
|
|
31
36
|
export { selectProfile, scoreProfile, eligible, gpuVendorClass, defaultStickyKey, DEFAULT_MAX_ENCODED, type HostFacts, type ProfileIndexEntry, type SelectMode, type SelectOptions, type Selection, } from "./profilelib.js";
|
|
32
37
|
export { importDirectory, loadImportedProfile, indexEntryFromProfile, type ImportResult, } from "./profileimport.js";
|
|
@@ -186,10 +191,10 @@ interface CloudSwitchOption {
|
|
|
186
191
|
apiUrl?: string;
|
|
187
192
|
}
|
|
188
193
|
/** Options for {@link launch}: Playwright launch options + Clearcote fingerprint + agent + download options. */
|
|
189
|
-
export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, EphemeralProfileOption,
|
|
194
|
+
export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, EphemeralProfileOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, DockerOption, WidevineOption {
|
|
190
195
|
}
|
|
191
196
|
/** Options for {@link launchPersistentContext}. */
|
|
192
|
-
export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption,
|
|
197
|
+
export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, ExtensionsOption, HumanizeLaunchOptions, DownloadOptions, LicenseOptions, ShaderDialectOption, PersonaEnvOption, FontDirsOption, Socks5UdpOption, EngineExtrasOption, CloudSwitchOption, WidevineOption {
|
|
193
198
|
}
|
|
194
199
|
/**
|
|
195
200
|
* Fill unset timezone/acceptLanguage/location/webrtcIp on `fp` from the proxy's exit-IP geo.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIzE,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,aAAa,IAAI,uBAAuB,EAEzC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA2I,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9L,OAAO,EAAsE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/H,OAAO,EAAyD,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAA6C,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIzE,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,aAAa,IAAI,uBAAuB,EAEzC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA2I,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9L,OAAO,EAAsE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/H,OAAO,EAAyD,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAA6C,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAyB,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAA6I,KAAK,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AA+BhN,OAAO,EAAE,aAAa,EAAE,YAAY,EAAkD,MAAM,eAAe,CAAC;AAG5G,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM3E,OAAO,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EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;;;;;;;AACzD,wBAiBE"}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { fingerprintArgs, isFingerprintPassthrough, splitFingerprintOptions } fr
|
|
|
26
26
|
import { resolveGeoDetailed, startEgressDriftCheck, GeoipError } from "./geoip.js";
|
|
27
27
|
import { defaultColorScheme, engineDecidesColorScheme, installColorSchemeDefault } from "./colorscheme.js";
|
|
28
28
|
import { installHumanize, installHumanizeOnContext } from "./humanize.js";
|
|
29
|
+
import { resolveHumanize } from "./hzoptions.js";
|
|
29
30
|
import { agentArgs, splitAgentOptions } from "./agent.js";
|
|
30
31
|
import { resolveProfileOptions, Profile } from "./profile.js";
|
|
31
32
|
import { resolveAuto, engineSupportsProfiles, MIN_PROFILE_ENGINE_MAJOR, profileWithWindows11Faces } from "./profileauto.js";
|
|
@@ -38,7 +39,7 @@ import { emitCoherenceWarnings, emitWarnings, serveExposureWarnings } from "./wa
|
|
|
38
39
|
import { checkFontDirs, fontLaunchEnv } from "./fonts.js";
|
|
39
40
|
import { withShaderDialect } from "./shaderdialect.js";
|
|
40
41
|
import { apply as applyPersonaEnv } from "./personaenv.js";
|
|
41
|
-
import { applyHeadlessGeometry, fitServedWindow,
|
|
42
|
+
import { applyHeadlessGeometry, fitServedWindow, headedLinuxFit, installWindowFixup, placeWindow, servedGeometry, FIT_PLAN, } from "./geometry.js";
|
|
42
43
|
import { acquireLease, resolveLicenseKey, withRunToken, STALE_TOKEN_REFUSAL } from "./license.js";
|
|
43
44
|
import { offlineKeyPath, requireOfflineBinary } from "./offline.js";
|
|
44
45
|
export { OfflineKeyError, offlineLease, loadOfflineKey, OFFLINE_KEY_ENV } from "./offline.js";
|
|
@@ -54,7 +55,10 @@ export { resolveReleaseChannel } from "./download.js";
|
|
|
54
55
|
export { isFingerprintPassthrough } from "./fingerprint.js";
|
|
55
56
|
export { DEFAULT_IGNORED_ARGS, gpuBlocklistArgs, gpuBackendArgs, xDisplayAvailable, mesaEglAvailable, gateEngineSwitches, engineSupportsSwitch } from "./launchopts.js";
|
|
56
57
|
export { serveMultiplex } from "./multiplex.js";
|
|
58
|
+
export { ClearcoteStrictError, resolveHumanize } from "./hzoptions.js";
|
|
57
59
|
export { pressAndHold } from "./hold.js";
|
|
60
|
+
export { scoreAction, scoreMotion, scoreTyped, scoreWheel, scoreDrag, scoreHover, scoreAmbient, extractFeatures, stepsToSamples, fingerOf, } from "./motionscore.js";
|
|
61
|
+
export { record as recordHumanizeAction, traceEnabled as humanizeScoreEnabled } from "./trace.js";
|
|
58
62
|
export { Profile, listProfiles, loadProfile, PROFILE_DIR } from "./profile.js";
|
|
59
63
|
// Profile library: real captured personas, selected for coherence with THIS host.
|
|
60
64
|
export { selectProfile, scoreProfile, eligible, gpuVendorClass, defaultStickyKey, DEFAULT_MAX_ENCODED, } from "./profilelib.js";
|
|
@@ -163,22 +167,33 @@ export async function download(options = {}) {
|
|
|
163
167
|
* `chromium.launch()` takes none, so it rides on newPage/newContext instead, with the window fit to
|
|
164
168
|
* the work area (the persona's, the display `--screen-info` set, or headed the X display's). See
|
|
165
169
|
* ./geometry.ts for why each is needed. */
|
|
166
|
-
function installHeadlessGeometry(browser, args) {
|
|
170
|
+
function installHeadlessGeometry(browser, args, plan = FIT_PLAN) {
|
|
167
171
|
// Same shape as installHeadedViewport. Each new context is a new window, so each also gets the
|
|
168
|
-
// window fit
|
|
172
|
+
// window step: the fit on older engines, nothing for an r39+ persona window (the engine opened it at
|
|
173
|
+
// the persona's bounds) except a position reconcile when a call passes its own viewport. Any
|
|
174
|
+
// per-call geometry option wins.
|
|
169
175
|
const merge = (o = {}) => "viewport" in o || "screen" in o ? o : { ...o, viewport: null };
|
|
176
|
+
const perCall = (o) => plan && plan.mode === "persona-native"
|
|
177
|
+
? {
|
|
178
|
+
...plan,
|
|
179
|
+
reconcile: o.viewport !== null && o.viewport !== undefined,
|
|
180
|
+
viewport: o.viewport !== null && o.viewport !== undefined ? o.viewport : null,
|
|
181
|
+
}
|
|
182
|
+
: plan;
|
|
170
183
|
const origNewPage = browser.newPage.bind(browser);
|
|
171
184
|
const origNewContext = browser.newContext.bind(browser);
|
|
172
185
|
browser.newPage =
|
|
173
186
|
async (o = {}) => {
|
|
174
|
-
const
|
|
175
|
-
await
|
|
187
|
+
const merged = merge(o);
|
|
188
|
+
const page = await origNewPage(merged);
|
|
189
|
+
await placeWindow(page, args, perCall(merged));
|
|
176
190
|
return page;
|
|
177
191
|
};
|
|
178
192
|
browser.newContext =
|
|
179
193
|
async (o = {}) => {
|
|
180
|
-
const
|
|
181
|
-
await
|
|
194
|
+
const merged = merge(o);
|
|
195
|
+
const context = await origNewContext(merged);
|
|
196
|
+
await installWindowFixup(context, args, perCall(merged));
|
|
182
197
|
return context;
|
|
183
198
|
};
|
|
184
199
|
}
|
|
@@ -746,6 +761,7 @@ async function launchIncognito(options = {}) {
|
|
|
746
761
|
// resolved later, once the executable is known.)
|
|
747
762
|
const merged = mergeSavedProfile(options);
|
|
748
763
|
const { profile, profileSelect, extensions, portableProfile, shaderDialect, personaEnv, fontDirs, socks5Udp, encryptionKey, disablePrivacySandbox, executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, widevine, version, licenseKey, licenseApiBase, licenseThroughProxy, offlineKey, releaseChannel, allowThirdPartyCookies, transparentProxy, stockRuntime, ...rest } = merged;
|
|
764
|
+
resolveHumanize(humanize); // true | "strict" | HumanizeOptions: an unknown option throws before anything starts
|
|
749
765
|
const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
|
|
750
766
|
const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
|
|
751
767
|
const fontDirList = checkFontDirs(fontDirs); // Linux fontconfig dirs: a typo throws before the lease
|
|
@@ -803,7 +819,7 @@ async function launchIncognito(options = {}) {
|
|
|
803
819
|
// switches go on the command line; the fit keeps reading the caller's own engineArgs.
|
|
804
820
|
const geom = headed
|
|
805
821
|
? null
|
|
806
|
-
: applyHeadlessGeometry({ ...pwOptions }, fingerprint.fingerprint, engineArgs, fingerprint);
|
|
822
|
+
: applyHeadlessGeometry({ ...pwOptions }, fingerprint.fingerprint, engineArgs, fingerprint, exe);
|
|
807
823
|
const launchArgs = [...engineArgs, ...(geom?.args ?? []), ...widevineCdm];
|
|
808
824
|
const browser = await releaseLeaseOnFailure(lease, () => retryOnStaleRunToken(lease, () => winAvRetry((exePath) => {
|
|
809
825
|
// Last step on both: on a 1021 engine the persona leaves the command line for the env (./personaenv.ts).
|
|
@@ -822,7 +838,7 @@ async function launchIncognito(options = {}) {
|
|
|
822
838
|
// Release the concurrency slot + remove the run-token file when the browser closes.
|
|
823
839
|
if (lease)
|
|
824
840
|
browser.on("disconnected", () => { void lease.stop(); launchToken?.release(); });
|
|
825
|
-
if (headed && headedLinuxFit(engineArgs)) {
|
|
841
|
+
if (headed && headedLinuxFit(engineArgs, process.platform, exe)) {
|
|
826
842
|
// Headed Linux with no window manager (Xvfb: every Docker/VPS headful run) leaves Chrome's
|
|
827
843
|
// 945x1060 default window at (10,10); the same first-page fit as headless maximizes it (SC 180).
|
|
828
844
|
installHeadlessGeometry(browser, engineArgs);
|
|
@@ -830,7 +846,7 @@ async function launchIncognito(options = {}) {
|
|
|
830
846
|
else if (headed)
|
|
831
847
|
installHeadedViewport(browser); // launch() takes no viewport option -> wrap newPage/newContext
|
|
832
848
|
else if (geom)
|
|
833
|
-
installHeadlessGeometry(browser, engineArgs);
|
|
849
|
+
installHeadlessGeometry(browser, engineArgs, geom);
|
|
834
850
|
// r32+: the persona's colour scheme reaches the page instead of Playwright's emulated light.
|
|
835
851
|
if (engineDecidesColorScheme(exe))
|
|
836
852
|
installColorSchemeDefault(browser);
|
|
@@ -853,6 +869,7 @@ export async function launchPersistentContext(dirOrOptions, maybeOptions = {}) {
|
|
|
853
869
|
async function launchLocalPersistentContext(userDataDir, options = {}) {
|
|
854
870
|
const merged = mergeSavedProfile(options);
|
|
855
871
|
const { profile, profileSelect, extensions, portableProfile, shaderDialect, personaEnv, fontDirs, socks5Udp, encryptionKey, disablePrivacySandbox, executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, widevine, version, licenseKey, licenseApiBase, licenseThroughProxy, offlineKey, releaseChannel, allowThirdPartyCookies, transparentProxy, stockRuntime, ...rest } = merged;
|
|
872
|
+
resolveHumanize(humanize); // true | "strict" | HumanizeOptions: an unknown option throws before anything starts
|
|
856
873
|
const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
|
|
857
874
|
const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
|
|
858
875
|
const fontDirList = checkFontDirs(fontDirs); // Linux fontconfig dirs: a typo throws before the lease
|
|
@@ -931,8 +948,8 @@ async function launchLocalPersistentContext(userDataDir, options = {}) {
|
|
|
931
948
|
// window fit, which maximizes the window as headless does (SC 180).
|
|
932
949
|
const geom = opts.headless === false
|
|
933
950
|
? null
|
|
934
|
-
: applyHeadlessGeometry(opts, fingerprint.fingerprint, engineArgs, fingerprint);
|
|
935
|
-
const headedFit = opts.headless === false && headedLinuxFit(engineArgs);
|
|
951
|
+
: applyHeadlessGeometry(opts, fingerprint.fingerprint, engineArgs, fingerprint, exe);
|
|
952
|
+
const headedFit = opts.headless === false && headedLinuxFit(engineArgs, process.platform, exe);
|
|
936
953
|
const launchArgs = [...engineArgs, ...(geom?.args ?? []), ...widevineCdm];
|
|
937
954
|
const context = await releaseLeaseOnFailure(lease, () => retryOnStaleRunToken(lease, () => winAvRetry((exePath) => {
|
|
938
955
|
// Last step on both: on a 1021 engine the persona leaves the command line for the env (./personaenv.ts).
|
|
@@ -949,7 +966,7 @@ async function launchLocalPersistentContext(userDataDir, options = {}) {
|
|
|
949
966
|
if (lease)
|
|
950
967
|
context.on("close", () => { void lease.stop(); launchToken?.release(); });
|
|
951
968
|
if (geom || headedFit)
|
|
952
|
-
await installWindowFixup(context, engineArgs);
|
|
969
|
+
await installWindowFixup(context, engineArgs, geom ?? FIT_PLAN);
|
|
953
970
|
installHumanizeOnContext(context, { humanize, showCursor, seed: fingerprint.fingerprint }); // seed => stable motor persona
|
|
954
971
|
await egressDrift;
|
|
955
972
|
return context;
|
|
@@ -1185,7 +1202,7 @@ export async function serve(options = {}) {
|
|
|
1185
1202
|
cdpArgs.push(...serveInfobarArgs(headless, [...engineArgs, ...cdpArgs]));
|
|
1186
1203
|
// Headless geometry for a raw endpoint: the display and window are set browser-wide, since no
|
|
1187
1204
|
// client's context options or CDP overrides would reach every page (see ./geometry.ts).
|
|
1188
|
-
const geometry = servedGeometry(engineArgs, fingerprint, headless);
|
|
1205
|
+
const geometry = servedGeometry(engineArgs, fingerprint, headless, exe, windowSize);
|
|
1189
1206
|
if (geometry)
|
|
1190
1207
|
cdpArgs.push(...geometry.args);
|
|
1191
1208
|
cdpArgs.push(...widevineCdm);
|
|
@@ -1236,8 +1253,9 @@ export async function serve(options = {}) {
|
|
|
1236
1253
|
// Before any client attaches: the window onto the work area (and, under a persona, the headless
|
|
1237
1254
|
// display onto the persona's). Its own connection, closed again; never fails the launch. A caller's
|
|
1238
1255
|
// own --window-position keeps its place (fit: false).
|
|
1239
|
-
if (geometry?.fit)
|
|
1240
|
-
await fitServedWindow(await srv.wsUrl().catch(() => undefined), { persona: geometry.persona, windowSize });
|
|
1256
|
+
if (geometry?.fit) {
|
|
1257
|
+
await fitServedWindow(await srv.wsUrl().catch(() => undefined), { persona: geometry.persona, windowSize, native: geometry.native });
|
|
1258
|
+
}
|
|
1241
1259
|
if (!quiet) {
|
|
1242
1260
|
process.stderr.write(`[clearcote] CDP endpoint ready: ${srv.cdpUrl}\n` +
|
|
1243
1261
|
` attach any client: connectOverCDP(${JSON.stringify(srv.cdpUrl)}) / puppeteer.connect({ browserURL })\n`);
|