Expand description
Pure-math input synthesis for vibesurfer’s three input modes.
The crate is intentionally narrow: given a start and end point,
some text to type, or a scroll delta, return a sequence of
discrete Steps tagged with relative time. The engine crate
consumes that sequence and translates each step into a
platform-native event (NSEvent on macOS, GdkEvent on Linux,
Input.dispatchMouseEvent over CDP on Windows).
The split keeps the math testable without WebKit and the per-platform code testable without doing humanization math. It also concentrates the realism work in one place: improving the Bezier sampler or the keystroke distribution lifts every backend at once.
§Modes
| Mode | Sequence shape |
|---|---|
| Human | Bezier path, Fitts arrival, digraph keys |
| Careful | Single-shot dispatch, no path or per-key delay |
| Robotic | Empty sequence — caller falls back to JS path |
See InputMode for details.
§Determinism
Every entry point takes a seed: u64. Same seed + same inputs
produce byte-identical output. This lets tests assert exact
sequences and lets the daemon persist a per-session seed so a
given agent produces consistent typing patterns across runs
against the same site.
Structs§
- Key
- One key, identified by a USB HID-ish
code(engines map this to their platform’s keycode space) and an optional UTF-32 character. - KeyStep
- One key event in a synthesized sequence.
- Mouse
Step - One mouse event in a synthesized sequence.
- Point
- 2D point in CSS pixels. The caller picks the coordinate frame (page-local or viewport-local); we just emit numbers.
- Vec2
- 2D vector (delta).
- Wheel
Step - One wheel-tick event.
Enums§
- Input
Mode - Which input style to synthesize.
- KeyStep
Kind - What kind of key event this step is.
- Mouse
Button - Which physical button the step refers to. Vibesurfer only uses
Lefttoday, butMiddleandRightare exposed so future primitives don’t need a wire-format break. - Mouse
Step Kind - What kind of mouse event this step is.
Functions§
- key_
sequence - Synthesize a key sequence for typing
text. - mouse_
path - Synthesize a left-click mouse path from
starttoend. - scroll_
sequence - Synthesize a scroll sequence delivering total
deltaover time.