pub mod attention;
#[cfg(feature = "browser")]
pub mod behavior;
#[cfg(feature = "browser")]
pub mod behavioral_grammar;
pub mod detector_fixture;
#[cfg(feature = "browser")]
pub mod element_interaction;
pub mod ime;
pub mod keyboard_event;
pub mod keystroke;
#[cfg(feature = "browser")]
pub mod mouse;
#[cfg(feature = "browser")]
mod mouse_driver;
#[cfg(feature = "browser")]
pub mod pointer;
#[cfg(feature = "browser")]
pub mod scroll;
pub mod telemetry;
pub mod timing;
#[cfg(feature = "browser")]
pub mod typing;
#[cfg(feature = "browser")]
pub mod wheel;
pub use attention::{AttentionConfig, AttentionSimulator, FocusPoint, GazePattern};
pub use detector_fixture::{bot_typing_stream, human_typing_stream, lift_ratio, timing_cv};
#[cfg(feature = "browser")]
pub use element_interaction::{assert_interactable, human_click_offset, ElementBox};
pub use ime::{plan_ime_sequence, CompositionEvent};
pub use keyboard_event::{
key_to_bidi_dispatch_key, key_to_code, key_to_key_value, needs_shift, plan_key_events,
plan_typed_text, KeyboardEvent,
};
pub use keystroke::{
bigram_gap, hold_envelope, plan_keystrokes, qwerty_neighbour, Keystroke, TypingPlan,
};
pub use telemetry::{BehavioralEvent, TelemetryCollector};
pub use timing::{ActionDelay, ReadingTimeEstimator, SessionPacing};
#[cfg(feature = "browser")]
pub use behavior::*;
#[cfg(feature = "browser")]
pub use mouse_driver::{HumanMouse, MousePersona};
#[cfg(feature = "browser")]
pub use pointer::{PointerDevice, PointerProperties};
#[cfg(feature = "browser")]
pub use scroll::{HumanScrollConfig, HumanScroller, ScrollBehavior};
#[cfg(feature = "browser")]
pub use typing::{HumanTyper, TypingConfig};
#[cfg(feature = "browser")]
pub use wheel::{WheelDevice, WheelProperties};
#[cfg(test)]
mod no_fixed_sleep_audit {
use std::fs;
use std::path::{Path, PathBuf};
fn rs_files(dir: &Path, out: &mut Vec<PathBuf>) {
let Ok(entries) = fs::read_dir(dir) else {
return;
};
for entry in entries.flatten() {
let p = entry.path();
if p.is_dir() {
rs_files(&p, out);
} else if p.extension().and_then(|e| e.to_str()) == Some("rs") {
out.push(p);
}
}
}
#[test]
fn action_path_delays_are_sampled_never_fixed() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut files = Vec::new();
rs_files(&root.join("src/human"), &mut files);
files.push(root.join("src/http/behavioral_noise.rs"));
let banned_stems = [
concat!("sleep(Duration::from_", "millis("),
concat!("sleep(Duration::from_", "secs("),
concat!("sleep(tokio::time::Duration::from_", "millis("),
concat!("sleep(tokio::time::Duration::from_", "secs("),
];
let mut sleep_sites = 0usize;
for f in &files {
let Ok(src) = fs::read_to_string(f) else {
continue;
};
for (idx, line) in src.lines().enumerate() {
if line.trim_start().starts_with("//") {
continue;
}
let compact: String = line.chars().filter(|c| !c.is_whitespace()).collect();
if compact.contains("sleep(") {
sleep_sites += 1;
}
for stem in banned_stems {
for (pos, _) in compact.match_indices(stem) {
let next = compact[pos + stem.len()..].chars().next();
if next.is_some_and(|c| c.is_ascii_digit()) {
panic!(
"{}:{}: a fixed-literal delay. `sleep` directly on \
Duration::from_millis(<N>)/from_secs(<N>), is in the action path \
(Law 7 / G143). A constant tick is a behavioral tell. Draw the delay \
from a sampled distribution (`rng.gen_range(…)`, `jittered_step(…)`, \
or a value off a sampled plan). Line: {}",
f.display(),
idx + 1,
line.trim()
);
}
}
}
}
}
assert!(
sleep_sites >= 15,
"no-fixed-sleep audit saw only {sleep_sites} sleep call sites, the action path moved \
out from under the walk and the guard is now inert"
);
}
}