1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Browser typing compatibility wrappers backed by canonical human-typing
//! primitives.
use SeedableRng;
use Page;
use Duration;
/// Type text with human-like cadence via [`crate::human::HumanTyper`].
///
/// This legacy convenience wrapper keeps the old
/// `guise::human::behavior::type_realistic` path while routing execution
/// through the canonical configurable browser typer.
///
/// # Example
///
/// ```rust,no_run
/// use guise::human::behavior::type_realistic;
/// # async fn example(page: &runtime_foxdriver::Page) -> anyhow::Result<()> {
/// type_realistic(page, "hello world").await?;
/// # Ok(()) }
/// ```
pub async
/// Type text with bigram-aware human keystroke timing.
///
/// Uses [`crate::human::plan_keystrokes`] (re-exported from [`crate::human::keystroke`]) to produce a
/// schedule whose per-bigram inter-key gaps and per-character
/// hold-times match real-human envelopes (Dhakal et al. CHI 2018
/// envelope), then dispatches each keydown/keyup with the planned
/// timing.
///
/// Compared to the older uniform-delay implementation this replaced:
///
/// - Hot bigrams (`th`, `he`, `in`, ...) are typed at 60–110ms
/// intervals - over-trained motor programs are FAST.
/// - Cold bigrams (`qz`, `xj`, ...) are typed at 180–320ms intervals.
/// - Digit-pairs use a slower envelope because the number row is
/// not over-trained.
/// - Optional typo injection: at low probability (1.5% by default),
/// types a QWERTY-neighbour wrong character then a backspace then
/// the correct character - exactly the pattern detectors look for
/// to confirm a human typist.
/// - Optional thinking pauses (200–600ms) at the configured rate.
///
/// Backspaces (Unicode BS, `\u{0008}`) emitted by the planner are
/// dispatched as the `Backspace` named key via BiDi.
///
/// # Example
///
/// ```rust,no_run
/// use guise::human::behavior::type_human;
/// # async fn example(page: &runtime_foxdriver::Page) -> anyhow::Result<()> {
/// type_human(page, "the quick brown fox").await?;
/// # Ok(()) }
/// ```
pub async