package keyseq
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=646a1d3bab24631f8459ae5f2c37578f
sha512=5001a58307d0ccaf20ca4b198f52d5ccfdf1b62ed6b0a9acab280fc147ecddd9bea0a39ace0933d1dc858a6aa981d06609e40e75225cef8392cdb8be96df9a09
Description
keyseq turns a string into a deterministic sequence of typing events — insert, delete, delay, idle — for a renderer to play back. All randomness is explicit: the same config, random state, and input always produce the same output.
README
keyseq
Deterministic planner for human-like typing. Turns a string into a sequence of typing events — insert, delete, delay, idle — for a renderer to play back.

Requirements
- OCaml ≥ 4.14 (uses
String.get_utf_8_uchar).
Install
opam install keyseqUse
let state = Random.State.make [| 1 |] in
match Keyseq.plan Keyseq.default_config state "Hello, world." with
| Ok events -> Keyseq_terminal.run events
| Error (Keyseq.Invalid_utf8 offset) ->
Printf.eprintf "invalid UTF-8 at byte %d\n" offsetSee examples/demo.ml for a complete, runnable example.
Behavior
Sleepis an ordinary inter-character delay.Idleis a longer pause, following a sentence-ending. ! ?, during which a renderer may animate the cursor.- Mid-clause punctuation (
, ; : —) gets aSleeppause only, noIdle. - Typos are only generated for ASCII letters and Cyrillic-block letters; nothing else is ever mistyped, regardless of
typo_rate. - All randomness is explicit: callers pass a
Random.State.t, and the library never callsRandom.self_init. Same config, same unconsumed state, same input text — same output, every time.
Failure modes
Keyseq.planreturnsError (Invalid_utf8 offset)if the input isn't valid UTF-8.offsetis a byte offset.Keyseq.planraisesInvalid_argumentifconfigviolates its own preconditions (e.g.max_delay < min_delay) — this is a programmer error, not an input-validation failure.
License
ISC. See LICENSE.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building keyseq with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.1.0 (this version) | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure