clearcote 0.51.0 → 0.52.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 +9 -5
- 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/docker.d.ts +8 -3
- package/dist/docker.d.ts.map +1 -1
- package/dist/docker.js +26 -10
- package/dist/docker.js.map +1 -1
- package/dist/download.d.ts +19 -1
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +137 -18
- package/dist/download.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/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 +16 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -14
- 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/launchopts.d.ts +15 -2
- package/dist/launchopts.d.ts.map +1 -1
- package/dist/launchopts.js +50 -3
- package/dist/launchopts.js.map +1 -1
- 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/release.d.ts +22 -1
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +28 -0
- package/dist/release.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/warnings.d.ts.map +1 -1
- package/dist/warnings.js +3 -1
- package/dist/warnings.js.map +1 -1
- 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,GAAG,OAAO,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtD,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B;iEAC6D;IAC7D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,qFAAqF;IACrF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;+FAC2F;IAC3F,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;uDACmD;IACnD,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACnC;+BAC2B;IAC3B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACrD;AAED,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;AA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,GAAG,IAAI,CAGhE;AAED;mGACmG;AACnG,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB,CASnH;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,IAAI,EAAE,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;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=hzoptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hzoptions.js","sourceRoot":"","sources":["../src/hzoptions.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,EAAE;AACF,yGAAyG;AACzG,4GAA4G;AAC5G,wGAAwG;AACxG,EAAE;AACF,0GAA0G;AAC1G,gGAAgG;AAChG,yGAAyG;AACzG,+EAA+E;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA6CrD,MAAM,CAAC,MAAM,YAAY,GAA6C,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAgBjH,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1H,mGAAmG;AACnG,MAAM,OAAO,GAA2B,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AACjJ,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAE1D,6GAA6G;AAC7G,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,GAAG,CAAS;IACZ,MAAM,CAAS;IACf,QAAQ,CAAU;IAC3B,YAAY,GAAW,EAAE,MAAc,EAAE,QAAiB;QACxD,K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CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ;gBAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS;QAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;IACtD,OAAO,OAAO,CAAC;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.
|
|
@@ -282,13 +287,17 @@ export declare function retryOnStaleRunToken<T>(lease: LeaseSession | null, star
|
|
|
282
287
|
* cannot take (executablePath, args, userDataDir, ...) throws naming it. `close()` disconnects and
|
|
283
288
|
* ends the session.
|
|
284
289
|
*
|
|
285
|
-
* MACOS.
|
|
290
|
+
* MACOS. With a licence key on an Apple Silicon Mac, launch() runs the native macOS PRO build (a
|
|
291
|
+
* `Chromium.app` bundle, downloaded and verified like the other platforms). Its fonts and canvas text
|
|
292
|
+
* metrics stay host-native, so only `platform: "macos"` (the default there) is coherent; another
|
|
293
|
+
* platform without a `fingerprintProfile` captured on that OS warns. Without a licence key (the free
|
|
294
|
+
* build has no macOS binary), or on an Intel Mac, launch() starts the Clearcote Docker image instead
|
|
286
295
|
* (teamflatearth/clearcote:sdk-<version>; `dockerImage` or CLEARCOTE_DOCKER_IMAGE picks another) and
|
|
287
296
|
* resolves to the same Playwright `Browser`, connected to it over CDP; `close()` stops the container.
|
|
288
297
|
* The persona options, `headless`, `proxy`, `args`, `version` and the licence key go to the container;
|
|
289
298
|
* an option it cannot take throws naming it. Docker must be installed and running
|
|
290
|
-
* ({@link DockerUnavailableError} says so otherwise). `docker:
|
|
291
|
-
*
|
|
299
|
+
* ({@link DockerUnavailableError} says so otherwise). `docker: true` (or CLEARCOTE_DOCKER=1) uses the
|
|
300
|
+
* container on any OS, a licensed Mac included; `docker: false` (or CLEARCOTE_DOCKER=0) never does.
|
|
292
301
|
*/
|
|
293
302
|
export declare function launch(options?: LaunchOptions | CloudLaunchOptions): Promise<Browser>;
|
|
294
303
|
/** Options of a cloud {@link launchPersistentContext}: a cloud launch on a named cloud profile. */
|
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,
|
|
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;AAK3E,OAAO,EAAsE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE1I,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,KA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
22
22
|
import { basename, dirname, join } from "node:path";
|
|
23
23
|
import { makeRecoveredCopy, recoveredExe, removeFailedLaunchDirs } from "./winlaunch.js";
|
|
24
|
-
import { checkInstall, ensureBinary, ensureVersion, proEnsureBinary, resolvedEngineVersion, resolveReleaseChannel, warmFiles } from "./download.js";
|
|
24
|
+
import { checkInstall, ensureBinary, ensureRunnableHere, ensureVersion, proEnsureBinary, resolvedEngineVersion, resolveReleaseChannel, warmFiles } from "./download.js";
|
|
25
25
|
import { fingerprintArgs, isFingerprintPassthrough, splitFingerprintOptions } from "./fingerprint.js";
|
|
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";
|
|
32
33
|
import { measureHost } from "./profilesource.js";
|
|
33
34
|
import { defaultStickyKey, } from "./profilelib.js";
|
|
34
|
-
import { extensionArgs, portableArgs, resolveProxy, engineSupportsSwitch, warnUnsupportedEngineOptions, mergeFeatureFlags, playwrightFeatureOverrideArgs, privacySandboxArgs, quicArgs, socks5UdpArgs, webBluetoothArgs, webrtcDefaultDenyArgs, DEFAULT_IGNORED_ARGS, gpuBlocklistArgs, gpuBackendArgs, gateEngineSwitches, engineExtrasArgs, stockRuntimeArgs, stockRuntimeOn, } from "./launchopts.js";
|
|
35
|
-
import { RELEASE
|
|
35
|
+
import { extensionArgs, portableArgs, resolveProxy, engineSupportsSwitch, warnUnsupportedEngineOptions, mergeFeatureFlags, playwrightFeatureOverrideArgs, privacySandboxArgs, quicArgs, socks5UdpArgs, webBluetoothArgs, webrtcDefaultDenyArgs, DEFAULT_IGNORED_ARGS, gpuBlocklistArgs, gpuBackendArgs, macosKeychainArgs, gateEngineSwitches, engineExtrasArgs, stockRuntimeArgs, stockRuntimeOn, } from "./launchopts.js";
|
|
36
|
+
import { RELEASE } from "./release.js";
|
|
36
37
|
import { fetchWidevine, seedWidevine, widevineArgs, widevineLaunchArgs, widevineMode } from "./widevine.js";
|
|
37
38
|
import { emitCoherenceWarnings, emitWarnings, serveExposureWarnings } from "./warnings.js";
|
|
38
39
|
import { checkFontDirs, fontLaunchEnv } from "./fonts.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";
|
|
@@ -104,13 +108,6 @@ export async function applyGeoip(fp, proxy, quiet) {
|
|
|
104
108
|
fp.webrtcIp = geo.ip;
|
|
105
109
|
return geo;
|
|
106
110
|
}
|
|
107
|
-
function ensureRunnableHere(exe) {
|
|
108
|
-
if (platformRelease() === undefined) {
|
|
109
|
-
throw new Error(`Clearcote ${RELEASE.version} ships Windows x64 and Linux x64 binaries — there is no build for '${process.platform}'.\n` +
|
|
110
|
-
`Run on Windows or Linux, or pass executablePath to a compatible binary.\n` +
|
|
111
|
-
`(The binary downloaded and verified fine; it is cached at: ${exe})`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
111
|
/**
|
|
115
112
|
* Resolve the Clearcote chrome.exe path, downloading + verifying it if needed.
|
|
116
113
|
* Order: explicit `executablePath` > `CLEARCOTE_BINARY` env > PRO (when licensed) > free auto-download.
|
|
@@ -234,6 +231,9 @@ function assembleArgs(fpArgs, agArgs, extArgs, proxyArgs, disablePrivacySandbox,
|
|
|
234
231
|
// On a Linux host, render WebGL through the backend whose limits match the CLAIMED platform
|
|
235
232
|
// (read back from the built persona switch; absent = pass-through). See gpuBackendArgs.
|
|
236
233
|
base.push(...gpuBackendArgs(fpArgs.find((a) => a.startsWith("--fingerprint-platform="))?.slice("--fingerprint-platform=".length), !!extra.headed, process.platform, userArgs));
|
|
234
|
+
// macOS: the build is unsigned, so every launch would prompt for the "Chromium Safe Storage"
|
|
235
|
+
// keychain item. See macosKeychainArgs.
|
|
236
|
+
base.push(...macosKeychainArgs(process.platform, userArgs));
|
|
237
237
|
}
|
|
238
238
|
const merged = mergeFeatureFlags([...base, ...userArgs]);
|
|
239
239
|
// Last: drop 152 r22+ switches this engine does not implement (with a warning), wherever they came from.
|
|
@@ -710,13 +710,17 @@ export async function retryOnStaleRunToken(lease, start) {
|
|
|
710
710
|
* cannot take (executablePath, args, userDataDir, ...) throws naming it. `close()` disconnects and
|
|
711
711
|
* ends the session.
|
|
712
712
|
*
|
|
713
|
-
* MACOS.
|
|
713
|
+
* MACOS. With a licence key on an Apple Silicon Mac, launch() runs the native macOS PRO build (a
|
|
714
|
+
* `Chromium.app` bundle, downloaded and verified like the other platforms). Its fonts and canvas text
|
|
715
|
+
* metrics stay host-native, so only `platform: "macos"` (the default there) is coherent; another
|
|
716
|
+
* platform without a `fingerprintProfile` captured on that OS warns. Without a licence key (the free
|
|
717
|
+
* build has no macOS binary), or on an Intel Mac, launch() starts the Clearcote Docker image instead
|
|
714
718
|
* (teamflatearth/clearcote:sdk-<version>; `dockerImage` or CLEARCOTE_DOCKER_IMAGE picks another) and
|
|
715
719
|
* resolves to the same Playwright `Browser`, connected to it over CDP; `close()` stops the container.
|
|
716
720
|
* The persona options, `headless`, `proxy`, `args`, `version` and the licence key go to the container;
|
|
717
721
|
* an option it cannot take throws naming it. Docker must be installed and running
|
|
718
|
-
* ({@link DockerUnavailableError} says so otherwise). `docker:
|
|
719
|
-
*
|
|
722
|
+
* ({@link DockerUnavailableError} says so otherwise). `docker: true` (or CLEARCOTE_DOCKER=1) uses the
|
|
723
|
+
* container on any OS, a licensed Mac included; `docker: false` (or CLEARCOTE_DOCKER=0) never does.
|
|
720
724
|
*/
|
|
721
725
|
export async function launch(options = {}) {
|
|
722
726
|
if (cloudRequested(options.cloud)) {
|
|
@@ -724,7 +728,7 @@ export async function launch(options = {}) {
|
|
|
724
728
|
}
|
|
725
729
|
const { docker, dockerImage, ...notDocker } = options;
|
|
726
730
|
if (dockerRequested(docker, notDocker)) {
|
|
727
|
-
// macOS
|
|
731
|
+
// macOS without the native PRO build: the Clearcote Docker image, connected over CDP
|
|
728
732
|
return launchDocker({ ...withoutCloudOptions(notDocker), dockerImage });
|
|
729
733
|
}
|
|
730
734
|
options = notDocker;
|
|
@@ -746,6 +750,7 @@ async function launchIncognito(options = {}) {
|
|
|
746
750
|
// resolved later, once the executable is known.)
|
|
747
751
|
const merged = mergeSavedProfile(options);
|
|
748
752
|
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;
|
|
753
|
+
resolveHumanize(humanize); // true | "strict" | HumanizeOptions: an unknown option throws before anything starts
|
|
749
754
|
const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
|
|
750
755
|
const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
|
|
751
756
|
const fontDirList = checkFontDirs(fontDirs); // Linux fontconfig dirs: a typo throws before the lease
|
|
@@ -853,6 +858,7 @@ export async function launchPersistentContext(dirOrOptions, maybeOptions = {}) {
|
|
|
853
858
|
async function launchLocalPersistentContext(userDataDir, options = {}) {
|
|
854
859
|
const merged = mergeSavedProfile(options);
|
|
855
860
|
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;
|
|
861
|
+
resolveHumanize(humanize); // true | "strict" | HumanizeOptions: an unknown option throws before anything starts
|
|
856
862
|
const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
|
|
857
863
|
const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
|
|
858
864
|
const fontDirList = checkFontDirs(fontDirs); // Linux fontconfig dirs: a typo throws before the lease
|