Open
Conversation
Covers click, type, press key, scroll, and drag mouse with performance-first algorithms (zero additional xdotool process spawns). Includes the existing Bezier curve mouse movement as reference. Co-authored-by: Cursor <cursoragent@cursor.com>
6b34ba9 to
f508bfa
Compare
rgarcia
reviewed
Mar 11, 2026
- Type text: use O(words) separate xdotool calls with Go-side sleeps instead of single-call chaining, since xdotool type consumes rest of argv and can't be chained with sleep. - Type text: keep trailing delimiters (space, punctuation) with the preceding chunk so pauses happen after word boundaries. - Scroll: use bounded total duration (default 200ms) instead of fixed per-tick slowMs/fastMs, so large tick counts don't block input. Made-with: Cursor
Introduces optional typo_chance parameter for realistic typing errors. Uses geometric gap sampling (O(typos) random calls, not O(chars)) with QWERTY adjacency lookup for adjacent-key substitution. Includes correction sequence with "realization" pause before backspace. Made-with: Cursor
Adds smooth typing mode to POST /computer/type that types text in word-sized chunks with variable intra-word delays and natural inter-word pauses via xdotool, following the same Go-side sleep pattern as doMoveMouseSmooth. Optionally injects realistic typos (adjacent-key, doubling, transpose) using geometric gap sampling (O(typos) random calls, not O(chars)) with QWERTY adjacency lookup, then corrects them with backspace after a "realization" pause. New API fields on TypeTextRequest: - smooth: boolean (default false) - enable human-like timing - typo_chance: number 0.0-0.10 (default 0) - per-char typo rate New package: server/lib/typinghumanizer with word chunking, QWERTY adjacency map, and typo position generation. Made-with: Cursor
This reverts commit 5abb339.
4 tasks
ulziibay-kernel
added a commit
that referenced
this pull request
Apr 8, 2026
## Summary - Adds `smooth` and `typo_chance` fields to `POST /computer/type` for human-like typing via xdotool - When `smooth=true`, text is typed in word-sized chunks with variable intra-word delays ([50, 120]ms) and inter-word pauses ([80, 200]ms, 1.5x at sentence boundaries) - When `typo_chance` is set (0.0-0.10), realistic typos are injected using geometric gap sampling (O(typos) random calls, not O(chars)) and corrected with backspace after a "realization" pause ### New package: `server/lib/typinghumanizer` - `SplitWordChunks` -- word chunking with trailing delimiters attached to preceding word - `UniformJitter` -- random duration in a range, clamped to minimum - `IsSentenceEnd` -- sentence boundary detection for longer pauses - `AdjacentKey` -- QWERTY neighbor lookup from static `[26][]byte` array, O(1) - `GenerateTypoPositions` -- geometric gap sampling for typo placement ### Typo types (weighted distribution) | Type | Weight | Mechanism | |---|---|---| | Adjacent key | 60% | QWERTY neighbor substitution | | Doubling | 20% | Character typed twice | | Transpose | 15% | Swap with next character | | Extra char | 5% | Random adjacent key inserted | Related: #169 (plan document) ## Demo  ## Test plan - [x] All 17 typinghumanizer tests pass (word chunking, adjacency, typo generation, distribution) - [x] Builds clean, no lint issues - [ ] Manual test with `smooth: true` on a running instance - [ ] Manual test with `smooth: true, typo_chance: 0.03` to verify typo/correction behavior Made with [Cursor](https://cursor.com) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes the `POST /computer/type` behavior by defaulting to a new smooth-typing path that introduces randomized delays and optional typo/backspace correction, which could affect automation timing and determinism. Also modifies the generated OpenAPI client/server glue via new post-generation patching, which can subtly impact request/response handling if the codegen output format changes. > > **Overview** > Adds human-like typing to `POST /computer/type` via new request fields `smooth` (defaults to true) and `typo_chance` (0–0.10), enabling variable per-chunk delays, inter-word pauses, and optional typo injection with backspace correction. > > Introduces `server/lib/typinghumanizer` (with tests) to chunk text, generate jittered timings, and compute realistic typo positions/adjacent-key substitutions, and wires this into the API implementation. > > Updates OpenAPI (`openapi.yaml` + regenerated `lib/oapi/oapi.go`) and the `server/Makefile` to run an additional codegen patch step (`patch_strict_optional_json`) to tolerate empty JSON bodies for optional-body endpoints and restore `omitempty` tags; adds a small demo page + Python script to record side-by-side typing behavior. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d63ab1d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a plan to implement human like interactions for all Computer Controls. https://www.kernel.sh/docs/browsers/computer-controls#computer-controls.
#148 added human like mouse movements. However, there are other movements like clicking, scrolling, typing, pressing that could use human like improvements.
Note
Low Risk
Documentation-only change that adds an implementation plan; no runtime code, APIs, or generated artifacts are modified in this PR.
Overview
Adds
plans/humanize-computer-endpoints.md, a detailed performance-focused design plan for humanizing all computer interaction endpoints (click, type, press key, scroll, drag) while minimizingxdotoolprocess spawns.The document proposes new
smoothflags and typing options (e.g., optional typo injection), plus a small sharedhumanizehelper library and related OpenAPI/type regeneration steps, but these are not implemented here.Written by Cursor Bugbot for commit b8fb87c. This will update automatically on new commits. Configure here.