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
package/dist/keys.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// Pure keyboard planning for humanized typing (lane D of SC 232): a faithful port of the Python SDK's
|
|
2
|
+
// clearcote/_keys.py, mirrored in .NET Keys.cs. Nothing here touches a page: given a persona seed and an
|
|
3
|
+
// RNG it decides how long a hand waits between two keys (a bigram flight model on the persona's WPM), how
|
|
4
|
+
// a chord splits into modifiers and key, how an OS auto-repeats a held key, and the pause before Enter or
|
|
5
|
+
// Tab after typing. sdk/testdata/humanize_typing_vectors.json pins the three SDKs to identical answers.
|
|
6
|
+
//
|
|
7
|
+
// The typing identity comes from a SALTED side stream of the persona seed (mulberry32(seed ^ salt)), like
|
|
8
|
+
// rolloverRate and shapeTraits, so makePersona's draw order -- every existing seed's motor identity -- is
|
|
9
|
+
// unchanged.
|
|
10
|
+
//
|
|
11
|
+
// Measured before this existed (SDK 0.51.0): Node's inter-key gap was uniform 45-150 ms with the 6 %
|
|
12
|
+
// thinking pause REPLACING the gap, while Python and .NET drew max(25, N(85, 45)) plus the pause -- one seed,
|
|
13
|
+
// two cadences; every bigram took the same time; a chord went down as one press (modifier and key within
|
|
14
|
+
// ~1 ms); Enter followed the last character after one key gap.
|
|
15
|
+
import { gaussFrom, mulberry32 } from "./motion.js";
|
|
16
|
+
const KEYS_SALT = 0xd3a2646c; // own stream (was 0x27d4eb2f = the aim salt: WPM moved with the aim spread)
|
|
17
|
+
const NOMINAL_DWELL_MS = 80;
|
|
18
|
+
export const MIN_FLIGHT_MS = 25;
|
|
19
|
+
// Calibration of the flight base (SC 232 triage, 10-16): the drawn WPM is the REALIZED speed on neutral English text --
|
|
20
|
+
// the class mix of consecutive key pairs on a 500-pair English sample (same finger 6 %, same hand 21 %, alternating 34 %,
|
|
21
|
+
// 39 % with a space or punctuation on one side; ~27 % of the same-finger / same-hand pairs are row jumps, x1.15), the
|
|
22
|
+
// flight noise's mean exp(0.35^2 / 2) and ~48 ms of pauses per character. Same constants as _keys.py / Keys.cs.
|
|
23
|
+
const EN_SAME_FINGER = 0.06, EN_SAME_HAND = 0.21, EN_ALTERNATE = 0.34, EN_NONE = 0.39;
|
|
24
|
+
const EN_ROW_JUMP = 1.04;
|
|
25
|
+
const EN_PAUSE_MS = 48.0;
|
|
26
|
+
const LOGNORMAL_MEAN = Math.exp(0.35 * 0.35 / 2);
|
|
27
|
+
const lerp = (a, b, t) => a + (b - a) * t;
|
|
28
|
+
/** The typing identity of persona seed `seedInt` (Persona.seed). Draw order as _keys.typing_traits. */
|
|
29
|
+
export function typingTraits(seedInt) {
|
|
30
|
+
const r = mulberry32((seedInt ^ KEYS_SALT) >>> 0);
|
|
31
|
+
const wpm = lerp(28, 75, r());
|
|
32
|
+
const sameFinger = lerp(1.5, 1.9, r());
|
|
33
|
+
const sameHand = lerp(1.1, 1.3, r());
|
|
34
|
+
const alternate = lerp(0.85, 1.0, r());
|
|
35
|
+
const tabPref = lerp(0.6, 0.85, r());
|
|
36
|
+
const typoRate = lerp(0.005, 0.04, r());
|
|
37
|
+
const submitCenterMs = lerp(400, 750, r());
|
|
38
|
+
const tabCenterMs = lerp(190, 330, r());
|
|
39
|
+
const selectStyle = r() < 0.55 ? "triple" : "keys";
|
|
40
|
+
const blurStyle = r() < 0.5 ? "tab" : "click";
|
|
41
|
+
const repeatFirstMs = lerp(252, 498, r()); // the two repeat draws came last (R1): every earlier trait is unchanged
|
|
42
|
+
const repeatGapMs = lerp(26, 39, r());
|
|
43
|
+
return { wpm, sameFinger, sameHand, alternate, tabPref, typoRate, submitCenterMs, tabCenterMs, selectStyle, blurStyle,
|
|
44
|
+
repeatFirstMs, repeatGapMs };
|
|
45
|
+
}
|
|
46
|
+
// US QWERTY touch-typing fingers: 0-3 left pinky..index, 4-7 right index..pinky; rows 0 (digits)..3.
|
|
47
|
+
const ROWS = ["`1234567890-=", "qwertyuiop[]\\", "asdfghjkl;'", "zxcvbnm,./"];
|
|
48
|
+
const FINGERS = [
|
|
49
|
+
[0, 0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7, 7],
|
|
50
|
+
[0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7, 7, 7],
|
|
51
|
+
[0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7],
|
|
52
|
+
[0, 1, 2, 3, 3, 4, 4, 5, 6, 7],
|
|
53
|
+
];
|
|
54
|
+
const SHIFTED = '~!@#$%^&*()_+{}|:"<>?';
|
|
55
|
+
const SHIFT_BASE = "`1234567890-=[]\\;',./";
|
|
56
|
+
const FINGER_MAP = new Map();
|
|
57
|
+
ROWS.forEach((keys, row) => Array.from(keys).forEach((k, i) => FINGER_MAP.set(k, [FINGERS[row][i], row])));
|
|
58
|
+
/** [finger 0..7, row 0..3] of the key that types `ch`, or null. Capitals / shifted symbols: their base key. */
|
|
59
|
+
export function fingerOf(ch) {
|
|
60
|
+
if (!ch || ch.length !== 1)
|
|
61
|
+
return null;
|
|
62
|
+
let c = ch.toLowerCase();
|
|
63
|
+
const j = SHIFTED.indexOf(c);
|
|
64
|
+
if (j >= 0)
|
|
65
|
+
c = SHIFT_BASE[j];
|
|
66
|
+
return FINGER_MAP.get(c) ?? null;
|
|
67
|
+
}
|
|
68
|
+
/** How the hand gets from `prev` to `ch`, and whether it is a two-row reach on the same hand. */
|
|
69
|
+
export function bigramClass(prev, ch) {
|
|
70
|
+
const a = fingerOf(prev), b = fingerOf(ch);
|
|
71
|
+
if (!a || !b)
|
|
72
|
+
return ["none", false];
|
|
73
|
+
if (a[0] === b[0])
|
|
74
|
+
return ["same_finger", Math.abs(a[1] - b[1]) >= 2];
|
|
75
|
+
if ((a[0] < 4) === (b[0] < 4))
|
|
76
|
+
return ["same_hand", Math.abs(a[1] - b[1]) >= 2];
|
|
77
|
+
return ["alternate", false];
|
|
78
|
+
}
|
|
79
|
+
const PUNCT = ".,;:!?";
|
|
80
|
+
const isWs = (c) => c === " " || c === "\t" || c === "\n";
|
|
81
|
+
/** How much this persona's finger factors and the flight noise stretch a neutral flight on English text (_keys.english_inflation). */
|
|
82
|
+
export function englishInflation(t) {
|
|
83
|
+
return (EN_SAME_FINGER * t.sameFinger * EN_ROW_JUMP + EN_SAME_HAND * t.sameHand * EN_ROW_JUMP
|
|
84
|
+
+ EN_ALTERNATE * t.alternate + EN_NONE) * LOGNORMAL_MEAN;
|
|
85
|
+
}
|
|
86
|
+
/** The neutral bigram's flight, calibrated so the mean keydown interval on English text is 60000 / (wpm x 5) (_keys.base_flight_ms). */
|
|
87
|
+
export function baseFlightMs(t) {
|
|
88
|
+
return Math.max(30, (60000 / (t.wpm * 5) - NOMINAL_DWELL_MS - EN_PAUSE_MS) / englishInflation(t));
|
|
89
|
+
}
|
|
90
|
+
/** Flight (ms) from key `prev` to key `ch`; draw order as _keys.flight_ms. */
|
|
91
|
+
export function flightMs(t, prev, ch, rng) {
|
|
92
|
+
const [cls, jump] = bigramClass(prev, ch);
|
|
93
|
+
let f = cls === "same_finger" ? t.sameFinger : cls === "same_hand" ? t.sameHand : cls === "alternate" ? t.alternate : 1;
|
|
94
|
+
if (jump)
|
|
95
|
+
f *= 1.15;
|
|
96
|
+
let ms = baseFlightMs(t) * f * Math.exp(0.35 * gaussFrom(rng));
|
|
97
|
+
if (prev != null && isWs(prev) && !isWs(ch))
|
|
98
|
+
ms += lerp(40, 120, rng());
|
|
99
|
+
if (prev != null && prev.length === 1 && PUNCT.includes(prev))
|
|
100
|
+
ms += lerp(80, 250, rng());
|
|
101
|
+
return Math.max(MIN_FLIGHT_MS, ms);
|
|
102
|
+
}
|
|
103
|
+
/** The whole sleep between key `prev` coming up and key `ch` going down (_keys.plan_gap). */
|
|
104
|
+
export function planGap(t, prev, ch, rng, tempo = 1, pauseScale = 1) {
|
|
105
|
+
let ms = flightMs(t, prev, ch, rng);
|
|
106
|
+
if (prev != null && isWs(prev))
|
|
107
|
+
ms += lerp(20, 100, rng());
|
|
108
|
+
if (rng() < 0.06 * pauseScale)
|
|
109
|
+
ms += lerp(180, 450, rng());
|
|
110
|
+
return ms * tempo; // tempo / pauseScale: lane A's presets (persona.tempo, persona.pauseScale); 1 = as planned
|
|
111
|
+
}
|
|
112
|
+
export const WORD_FIX_RATE = 0.3;
|
|
113
|
+
export const SEARCH_SLIP_RATE = 0.1;
|
|
114
|
+
/** Playwright's key string split into [modifiers, key] ("Shift++" -> [["Shift"], "+"]). */
|
|
115
|
+
export function splitChord(key) {
|
|
116
|
+
if (key === "+")
|
|
117
|
+
return [[], "+"];
|
|
118
|
+
if (key.endsWith("++"))
|
|
119
|
+
return [key.slice(0, -2).split("+"), "+"];
|
|
120
|
+
const parts = key.split("+");
|
|
121
|
+
return [parts.slice(0, -1), parts[parts.length - 1]];
|
|
122
|
+
}
|
|
123
|
+
export const modifierLeadMs = (rng) => lerp(40, 110, rng());
|
|
124
|
+
export const modifierLagMs = (rng) => lerp(20, 80, rng());
|
|
125
|
+
/** OS auto-repeat timing for one held key: the persona's repeat delay and interval (a machine setting,
|
|
126
|
+
* typingTraits) seen through +-2 / +-1 ms of timer jitter per run, and the hand's release. Draw order: first
|
|
127
|
+
* jitter, gap jitter, release (_keys.plan_repeat). */
|
|
128
|
+
export function planRepeat(t, rng) {
|
|
129
|
+
const firstMs = t.repeatFirstMs + lerp(-2, 2, rng());
|
|
130
|
+
const gapMs = t.repeatGapMs + lerp(-1, 1, rng());
|
|
131
|
+
const releaseMs = lerp(20, 60, rng());
|
|
132
|
+
return { firstMs, gapMs, releaseMs };
|
|
133
|
+
}
|
|
134
|
+
export const submitPauseMs = (t, rng) => Math.min(900, Math.max(250, t.submitCenterMs + (rng() - 0.5) * 300));
|
|
135
|
+
export const tabPauseMs = (t, rng) => Math.min(400, Math.max(120, t.tabCenterMs + (rng() - 0.5) * 140));
|
|
136
|
+
// ------------------------------------------------------------ isolated-world reads (same as _keys.py)
|
|
137
|
+
export const FOCUSABLE = "a[href], area[href], button, input, select, textarea, summary, iframe, [tabindex], "
|
|
138
|
+
+ "[contenteditable], audio[controls], video[controls]";
|
|
139
|
+
export const TAB_DISTANCE = `function (b) {
|
|
140
|
+
const up = n => n.parentElement || (n.parentNode && n.parentNode.nodeType === 11 && n.parentNode.host) || null;
|
|
141
|
+
const FOC = '${FOCUSABLE}';
|
|
142
|
+
const same = r => Math.abs(r.x - b.x) <= 1.5 && Math.abs(r.y - b.y) <= 1.5 &&
|
|
143
|
+
Math.abs(r.width - b.width) <= 1.5 && Math.abs(r.height - b.height) <= 1.5;
|
|
144
|
+
let t = null;
|
|
145
|
+
if (b.sel) { try { t = document.querySelector(b.sel); } catch (e) { t = null; } }
|
|
146
|
+
if (!t) {
|
|
147
|
+
for (let e = this.nodeType === 1 ? this : this.parentElement, n = 0; e && n < 64; e = up(e), n++)
|
|
148
|
+
if (e.matches && e.matches(FOC)) { t = e; break; }
|
|
149
|
+
}
|
|
150
|
+
if (!t || !t.matches(FOC) || !same(t.getBoundingClientRect())) return null;
|
|
151
|
+
const ti = e => { const v = parseInt(e.getAttribute('tabindex'), 10); return isNaN(v) ? 0 : v; };
|
|
152
|
+
const vis = e => { const s = getComputedStyle(e); return s.visibility !== 'hidden' && s.display !== 'none' && e.getClientRects().length > 0; };
|
|
153
|
+
const tabbable = e => !e.disabled && !(e.tagName === 'INPUT' && e.type === 'hidden') && ti(e) >= 0 &&
|
|
154
|
+
!(e.tagName === 'A' && !e.hasAttribute('href')) && vis(e);
|
|
155
|
+
const all = Array.from(document.querySelectorAll(FOC)).filter(tabbable);
|
|
156
|
+
const pos = all.filter(e => ti(e) > 0).sort((x, y) => ti(x) - ti(y));
|
|
157
|
+
const order = pos.concat(all.filter(e => ti(e) <= 0));
|
|
158
|
+
let a = document.activeElement;
|
|
159
|
+
while (a && a.shadowRoot && a.shadowRoot.activeElement) a = a.shadowRoot.activeElement;
|
|
160
|
+
const ai = a ? order.indexOf(a) : -1, tix = order.indexOf(t);
|
|
161
|
+
const VALUE_TYPES = ['checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'image', 'range', 'color', 'hidden'];
|
|
162
|
+
const text = e => !!e && ((e.tagName === 'INPUT' && VALUE_TYPES.indexOf(e.type) < 0) || e.tagName === 'TEXTAREA' || !!e.isContentEditable);
|
|
163
|
+
const role = t.getAttribute('role') || '';
|
|
164
|
+
const act = ['BUTTON', 'A', 'SUMMARY', 'SELECT'].indexOf(t.tagName) >= 0 ||
|
|
165
|
+
(t.tagName === 'INPUT' && VALUE_TYPES.indexOf(t.type) >= 0) ||
|
|
166
|
+
['button', 'link', 'checkbox', 'radio', 'switch', 'tab', 'menuitem', 'option'].indexOf(role) >= 0;
|
|
167
|
+
let near = null;
|
|
168
|
+
if (tix >= 0) for (const off of [1, 2, 3, -1]) {
|
|
169
|
+
const c = order[tix - off];
|
|
170
|
+
if (!c || c === a || !text(c) || c.disabled) continue;
|
|
171
|
+
const q = c.getBoundingClientRect();
|
|
172
|
+
if (q.width >= 2 && q.height >= 2 && q.left >= 0 && q.top >= 0 && q.right <= innerWidth && q.bottom <= innerHeight) {
|
|
173
|
+
near = { off, rect: [q.x, q.y, q.width, q.height] }; break; }
|
|
174
|
+
}
|
|
175
|
+
return { dist: ai >= 0 && tix >= 0 ? tix - ai : null, fromText: text(a), focused: a === t,
|
|
176
|
+
activatable: act, text: text(t), tag: t.tagName.toLowerCase(), type: t.tagName === 'INPUT' ? t.type : '',
|
|
177
|
+
n: order.length, noAnchor: ai < 0, near }; }`;
|
|
178
|
+
export const BLANK_POINT = `(a) => { const b = a.box, FOC = '${FOCUSABLE}, label, [onclick], [role]';
|
|
179
|
+
const cands = [];
|
|
180
|
+
for (const dy of [28, 56, 96]) cands.push([b.x + b.width * 0.5, b.y + b.height + dy]);
|
|
181
|
+
for (const dx of [32, 72, 128]) cands.push([b.x + b.width + dx, b.y + b.height * 0.5]);
|
|
182
|
+
for (const dx of [32, 72]) cands.push([b.x - dx, b.y + b.height * 0.5]);
|
|
183
|
+
for (const dy of [40, 80]) cands.push([b.x + b.width * 0.5, b.y - dy]);
|
|
184
|
+
const PLAIN = ['HTML', 'BODY', 'DIV', 'SECTION', 'MAIN', 'FORM', 'ARTICLE', 'P', 'SPAN', 'FIELDSET', 'UL', 'LI', 'HEADER', 'FOOTER', 'NAV', 'ASIDE', 'TD', 'TR', 'TABLE'];
|
|
185
|
+
for (const [x, y] of cands) {
|
|
186
|
+
if (x < 4 || y < 4 || x > a.vw - 4 || y > a.vh - 4) continue;
|
|
187
|
+
const e = document.elementFromPoint(x, y);
|
|
188
|
+
if (!e) continue;
|
|
189
|
+
if (PLAIN.indexOf(e.tagName) < 0 || e.isContentEditable) continue;
|
|
190
|
+
if (e.closest(FOC)) continue;
|
|
191
|
+
return [x, y];
|
|
192
|
+
}
|
|
193
|
+
return null; }`;
|
|
194
|
+
export const SELECTION_STATE = `() => { let e = document.activeElement;
|
|
195
|
+
while (e && e.shadowRoot && e.shadowRoot.activeElement) e = e.shadowRoot.activeElement;
|
|
196
|
+
if (!e) return null;
|
|
197
|
+
if (typeof e.selectionStart === 'number' && typeof e.value === 'string')
|
|
198
|
+
return [e.selectionStart, e.selectionEnd, e.value.length];
|
|
199
|
+
if (e.isContentEditable) { const s = getSelection(); return [0, s ? s.toString().length : 0, (e.textContent || '').length]; }
|
|
200
|
+
return null; }`;
|
|
201
|
+
//# sourceMappingURL=keys.js.map
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AU,GAAG,CAAC,CAAe,EAAE,GAAQ,EAAU,EAAE,CAC9D,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AAEpE,uGAAuG;AACvG,MAAM,CAAC,MAAM,SAAS,GAAG,qFAAqF;MAC1G,qDAAqD,CAAC;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG;;iBAEX,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAoCuB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,oCAAoC,SAAS;;;;;;;;;;;;;;;iBAevD,CAAC;AAElB,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;iBAMd,CAAC"}
|
package/dist/motion.d.ts
CHANGED
|
@@ -32,27 +32,62 @@ export interface Persona {
|
|
|
32
32
|
maxCorrections: number;
|
|
33
33
|
/** Handedness/approach curvature bias (signed, radians-ish) applied to path bow. */
|
|
34
34
|
approachBias: number;
|
|
35
|
-
/**
|
|
35
|
+
/** The HUMAN BANDS every timing draw is clamped to (ms); the per-identity medians inside them come from
|
|
36
|
+
* the salted timing stream ({@link timingTraits}). Grab hesitation after mouse.down: */
|
|
36
37
|
grabMinMs: number;
|
|
37
38
|
grabMaxMs: number;
|
|
38
|
-
/** Pre-release settle
|
|
39
|
+
/** Pre-release settle before mouse.up (ms). */
|
|
39
40
|
releaseMinMs: number;
|
|
40
41
|
releaseMaxMs: number;
|
|
41
|
-
/** Click press-hold
|
|
42
|
+
/** Click press-hold band — mousedown→mouseup (ms), 55–230; a scripted click is ~2 ms. */
|
|
42
43
|
clickHoldMinMs: number;
|
|
43
44
|
clickHoldMaxMs: number;
|
|
44
|
-
/** Per-key dwell
|
|
45
|
+
/** Per-key dwell band — keydown→keyup (ms), 45–120; scripted typing ~2–3 ms. */
|
|
45
46
|
keyDwellMinMs: number;
|
|
46
47
|
keyDwellMaxMs: number;
|
|
47
48
|
}
|
|
48
49
|
/** Derive a stable motor persona from a fingerprint seed (or random when unseeded). */
|
|
49
50
|
export declare function makePersona(seed?: string | number): Persona;
|
|
50
|
-
/**
|
|
51
|
-
|
|
51
|
+
/** Per-identity timing medians (ms) and tempo, stable per seed (see timingTraits). */
|
|
52
|
+
export interface TimingTraits {
|
|
53
|
+
/** Median mousedown→mouseup hold, 70–140. */
|
|
54
|
+
clickHoldMs: number;
|
|
55
|
+
/** Median keydown→keyup dwell, 60–95. */
|
|
56
|
+
keyDwellMs: number;
|
|
57
|
+
/** Median grab hesitation after a drag's mousedown, 180–280. */
|
|
58
|
+
grabMs: number;
|
|
59
|
+
/** Median settle before a drag's mouseup, 120–180. */
|
|
60
|
+
releaseMs: number;
|
|
61
|
+
/** Median gap between the two presses of a double click, 90–140. */
|
|
62
|
+
dblclickGapMs: number;
|
|
63
|
+
/** Scale on deliberation pauses (select popup, datetime segments), 0.8–1.25. */
|
|
64
|
+
pauseScale: number;
|
|
65
|
+
/** Per-character fat-finger rate, 0.005–0.04. */
|
|
66
|
+
typoRate: number;
|
|
67
|
+
}
|
|
68
|
+
/** The persona's timing traits, drawn from a salted stream of its seed. Before this every identity shared
|
|
69
|
+
* ONE fixed window per timing (click hold 60–150, key dwell 45–120, grab 130–360, release 90–230,
|
|
70
|
+
* double-click gap 70–170, select-popup pauses, datetime gaps, the 2 % typo rate). Each value is the
|
|
71
|
+
* identity's MEDIAN; samples around it are log-normal and clamped to the persona's human band. Same values
|
|
72
|
+
* as Python `_motion.timing_traits` and .NET `Motion.TimingTraitsOf`. */
|
|
73
|
+
export declare function timingTraits(p: Persona): TimingTraits;
|
|
74
|
+
/** `median * exp(sigma * N(0,1))` clamped to [lo, hi]: a right-skewed human timing around a per-identity median. */
|
|
75
|
+
export declare function lognormalMs(median: number, sigma: number, lo: number, hi: number, rng: Rng): number;
|
|
76
|
+
/** The preset's tempo on `p` (HumanizeOptions: careful 1.4 / default 1 / quick 0.7, set by applyToPersona after
|
|
77
|
+
* makePersona; 1 on a bare persona, so every vector is unchanged). */
|
|
78
|
+
export declare function tempoOf(p: Persona | null | undefined): number;
|
|
79
|
+
/** A human mousedown→mouseup click hold (ms): log-normal (σ 0.25) around the persona's own median
|
|
80
|
+
* (70–140 ms), clamped to its band (55–230 ms). */
|
|
52
81
|
export declare function clickHold(p: Persona, rng?: Rng): number;
|
|
53
|
-
/** A human per-key keydown→keyup dwell (ms)
|
|
54
|
-
*
|
|
82
|
+
/** A human per-key keydown→keyup dwell (ms): log-normal (σ 0.22) around the persona's own median
|
|
83
|
+
* (60–95 ms), clamped to its band (45–120 ms). */
|
|
55
84
|
export declare function keyDwell(p: Persona, rng?: Rng): number;
|
|
85
|
+
/** The gap between the two presses of a double click (ms): log-normal (σ 0.15) around the persona's
|
|
86
|
+
* median (90–140), clamped to 70–170. */
|
|
87
|
+
export declare function dblclickGap(p: Persona, rng?: Rng): number;
|
|
88
|
+
/** A deliberation pause (ms) from [lo, hi], scaled by the persona's tempo (pauseScale 0.8–1.25).
|
|
89
|
+
* Without a persona: the plain window. */
|
|
90
|
+
export declare function pauseMs(p: Persona | null | undefined, lo: number, hi: number, rng?: Rng): number;
|
|
56
91
|
/** Share of eligible key pairs this persona types with ROLLOVER: the next key goes down before the
|
|
57
92
|
* previous one comes up, the way people type fast common pairs. Stable per seed, 0.12–0.38.
|
|
58
93
|
*
|
|
@@ -143,7 +178,31 @@ export declare function planDrag(from: Point, to: Point, p: Persona, opts?: {
|
|
|
143
178
|
settle?: boolean;
|
|
144
179
|
rng?: Rng;
|
|
145
180
|
}): Step[];
|
|
146
|
-
/**
|
|
181
|
+
/** The drag-start hesitation window (ms): a hand that has just closed on a handle holds 100-300 ms. */
|
|
182
|
+
export declare const HESITATION_MS: readonly [number, number];
|
|
183
|
+
/** ... creeping a few px, never this far, before the leg proper. */
|
|
184
|
+
export declare const HESITATION_MAX_PX = 8;
|
|
185
|
+
/** The still-but-not-frozen moment between the grab and the drag leg from->to: samples spanning
|
|
186
|
+
* 100-300 ms (centred per persona; `durMs`, 40-300, overrides the length but the persona's draw is still
|
|
187
|
+
* made), creeping < 8 px toward `to` with a little sideways wobble. Same numbers as Python
|
|
188
|
+
* `_motion.drag_hesitation` and .NET `Motion.DragHesitation` (sdk/testdata/humanize_scroll_vectors.json).
|
|
189
|
+
* Measured on r38 / SDK 0.51.0 (SC 232): every drag's first held move was already the full-speed leg. */
|
|
190
|
+
export declare function dragHesitation(from: Point, to: Point, p: Persona, rng?: Rng, durMs?: number | null): Step[];
|
|
191
|
+
/** When (ms from the start of `steps`) the walk first leaves the `radius` circle around `from`. */
|
|
192
|
+
export declare function legExitMs(from: Point, steps: Step[], radius?: number): number;
|
|
193
|
+
/** The held part of a drag: the hesitation creep, then the planDrag leg, planned together so the pointer
|
|
194
|
+
* stays inside 8 px of the press for `windowMs` (clamped 100-300: the persona's grab dwell) and then goes.
|
|
195
|
+
* Same as Python `hesitate_then_drag`. */
|
|
196
|
+
export declare function hesitateThenDrag(from: Point, to: Point, p: Persona, windowMs: number, settle?: boolean, rng?: Rng): {
|
|
197
|
+
steps: Step[];
|
|
198
|
+
creep: number;
|
|
199
|
+
};
|
|
200
|
+
/** Where a reading hand parks the pointer before a wheel: x ~ 0.5w ± 0.10w clamped [0.12w, 0.88w], y ~ 0.34h
|
|
201
|
+
* ± 0.09h clamped [0.10h, 0.62h] (two gaussians, x first). One model in all three SDKs (Python
|
|
202
|
+
* `wheel_anchor_point`, .NET `Motion.WheelAnchorPoint`); before 0.52 Node used 0.48/0.36 and other clamps. */
|
|
203
|
+
export declare function wheelAnchorPoint(vw: number, vh: number, rng?: Rng): [number, number];
|
|
204
|
+
/** Grab/release dwell times (ms) for a held-button drag: log-normal (σ 0.2) around the persona's medians,
|
|
205
|
+
* inside its grab/release bands. */
|
|
147
206
|
export declare function dragDwell(p: Persona, rng?: Rng): {
|
|
148
207
|
grabMs: number;
|
|
149
208
|
releaseMs: number;
|
|
@@ -154,9 +213,27 @@ export interface Box {
|
|
|
154
213
|
width: number;
|
|
155
214
|
height: number;
|
|
156
215
|
}
|
|
157
|
-
/**
|
|
158
|
-
|
|
159
|
-
|
|
216
|
+
/** Per-identity aiming traits, stable per seed (see aimTraits). */
|
|
217
|
+
export interface AimTraits {
|
|
218
|
+
/** Landing dispersion, sd as a share of the box, 0.10–0.20. */
|
|
219
|
+
spread: number;
|
|
220
|
+
/** Pull toward the side the cursor came from, share of the box, 0.06–0.16. */
|
|
221
|
+
undershoot: number;
|
|
222
|
+
/** Handedness: lateral offset as a share of the box width (approachBias × 0.4, −0.1–0.1). */
|
|
223
|
+
sideBias: number;
|
|
224
|
+
/** Share of visible checkbox / radio clicks that land on the label text, 0.25–0.55 (lane F's label aim). */
|
|
225
|
+
labelShare: number;
|
|
226
|
+
}
|
|
227
|
+
/** The persona's aiming traits from a salted stream of its seed. Same values as Python `aim_traits` and
|
|
228
|
+
* .NET `Motion.AimTraitsOf`. */
|
|
229
|
+
export declare function aimTraits(p: Persona): AimTraits;
|
|
230
|
+
/** A human click point inside `box`: a 2D gaussian toward the centre with the persona's dispersion
|
|
231
|
+
* (sd 0.10–0.20 of the box), nudged toward the approach side (undershoot 6–16 %) and sideways by its
|
|
232
|
+
* handedness (approachBias), clamped a couple px inside the edges. The SEED fixes the persona's spread,
|
|
233
|
+
* undershoot and handedness (it was one dispersion for everyone); each click's draw is unseeded (Math.random
|
|
234
|
+
* unless `rng` is given), like every per-action draw, so no two visits of one identity replay the same
|
|
235
|
+
* landing sequence. Without a persona: sd 0.15, 12 % undershoot, no handedness. */
|
|
236
|
+
export declare function clickPoint(box: Box, from: Point, p?: Persona | null, rng?: Rng): Point;
|
|
160
237
|
export interface Viewport {
|
|
161
238
|
width: number;
|
|
162
239
|
height: number;
|
|
@@ -167,4 +244,45 @@ export interface Viewport {
|
|
|
167
244
|
* biggest reason a challenge/slider is shown to headless automation). Returns ~`ms` of samples.
|
|
168
245
|
*/
|
|
169
246
|
export declare function planAmbient(from: Point, vp: Viewport, p: Persona, ms: number, rng?: Rng): Step[];
|
|
247
|
+
/** The pointer keeps within this many px of where a hover arrived while it dwells there. */
|
|
248
|
+
export declare const DWELL_RADIUS_PX = 3;
|
|
249
|
+
/** A move-off after a click is kept this far inside the viewport. */
|
|
250
|
+
export declare const MOVE_OFF_MARGIN_PX = 8;
|
|
251
|
+
/** Per-identity after-action traits, stable per seed (see afterTraits). */
|
|
252
|
+
export interface AfterTraits {
|
|
253
|
+
/** Centre of this hand's hover dwell, 250–700 ms (draws stay in 150–900). */
|
|
254
|
+
dwellMs: number;
|
|
255
|
+
/** Share of clicks followed by a move-off, 0.64–0.82 (a 40-click run stays in 60–85 %). */
|
|
256
|
+
moveOffRate: number;
|
|
257
|
+
/** Centre of the release → move-off gap, 300–600 ms (draws stay in 200–700). */
|
|
258
|
+
moveOffDelayMs: number;
|
|
259
|
+
/** Scale on the attention model's read pause, 0.85–1.15. */
|
|
260
|
+
readTempo: number;
|
|
261
|
+
}
|
|
262
|
+
/** The persona's after-action traits: the first four draws of its salted after-action stream.
|
|
263
|
+
*
|
|
264
|
+
* Measured on r42 / SDK 0.51.0 (SC 232 review): a hover stopped dead on arrival (0 samples after the
|
|
265
|
+
* glide's last one) and the pointer never left the pressed pixel after a click. Same values as Python
|
|
266
|
+
* `after_traits` and .NET `Motion.AfterTraitsOf`. */
|
|
267
|
+
export declare function afterTraits(p: Persona): AfterTraits;
|
|
268
|
+
/** The persona's after-action stream positioned AFTER its four trait draws. Used by the shared vectors only, to
|
|
269
|
+
* compare the SDKs draw for draw: the humanizer's per-action draws are unseeded (Math.random), as in planMove --
|
|
270
|
+
* the seed fixes traits only, or every session of an identity would replay one sequence. */
|
|
271
|
+
export declare function afterRng(p: Persona): Rng;
|
|
272
|
+
/** How long a hover dwells on arrival: the persona's centre × 0.6–1.4, kept in 150–800 ms (150–900 as the page
|
|
273
|
+
* measures it, with the glide's slow tail). */
|
|
274
|
+
export declare function dwellMs(p: Persona, rng?: Rng): number;
|
|
275
|
+
/** Plan the pointer's rest on a hover target: OU drift + 8–12 Hz tremor around `at` for about `ms` (at
|
|
276
|
+
* least 3 samples), every sample within DWELL_RADIUS_PX of `at` and inside `box` (1 px in; null: no box).
|
|
277
|
+
* The hand is not braced on a hover the way it is before a press: drift ×2, tremor ×1.5 of a glide's. */
|
|
278
|
+
export declare function planDwell(at: Point, box: Box | null, p: Persona, ms: number, rng?: Rng): Step[];
|
|
279
|
+
/** Does this click get a move-off? In `afterTraits(p).moveOffRate` of clicks: a draw against the rate,
|
|
280
|
+
* nudged by how far the page's running share (`hits` of `n` earlier clicks) has drifted from it. */
|
|
281
|
+
export declare function moveOffRoll(p: Persona, rng?: Rng, hits?: number, n?: number): boolean;
|
|
282
|
+
/** The release → move-off gap: the persona's centre × 0.7–1.3, kept in 200–660 ms (200–700 as the page measures it). */
|
|
283
|
+
export declare function moveOffDelayMs(p: Persona, rng?: Rng): number;
|
|
284
|
+
/** Where the hand drifts after a click: 40–200 px from `from` at an angle in the downward half-plane
|
|
285
|
+
* (20–160°, y down: the gateway's moveOnTarget model), kept MOVE_OFF_MARGIN_PX inside `vp`; mirrored
|
|
286
|
+
* upward when the clamp would leave it on the spot (a click near the bottom edge). */
|
|
287
|
+
export declare function planMoveOff(from: Point, vp: Viewport, p: Persona, rng?: Rng): Point;
|
|
170
288
|
//# sourceMappingURL=motion.d.ts.map
|
package/dist/motion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AA6BA;iGACiG;AACjG,MAAM,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC;AAE/B,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAQ/C;AAED,+FAA+F;AAC/F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CA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