feat(browser): type() anti-detect — probabilistic paste branch for long text#9
Merged
Merged
Conversation
Perfect per-key rhythm on a long string is a classic bot signal. Route type(text, selector=...) through the real-clipboard paste path (from the previous release) when the input passes both gates: len(text) > TYPE_PASTE_MIN_CHARS (500) AND random() < TYPE_PASTE_PROBABILITY (0.625) Short text, no-selector calls, and the ~37.5% "keep humanized" case stay on the existing per-char Ceki.typeText path. paste() and the new type() branch share a private _hotkey_paste_into() helper — zero duplication. Minor bump to 2.35.0.
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.
Summary
Task 4109.
Browser.type(text, selector=...)probabilistically routes long text through the real-clipboard paste path (from 4091/4098) when BOTH gates pass:len(text) > TYPE_PASTE_MIN_CHARS(500)random() < TYPE_PASTE_PROBABILITY(0.625)Otherwise falls through to per-char
Ceki.typeText. Short text, no-selector calls, and the ~37.5% "keep humanized" case stay on the existing path. Constants at module scope.paste()and the new branch share a private_hotkey_paste_into()helper — zero duplication. copy/paste (hotkey version) is already on master via #7; this PR only adds the type() anti-detect branch.Test plan
tests/test_type_paste_branch.py12/12 — paste-path gates, constant values, hotkey wire sequence, JSON-escape, statistical sanitytests/test_copy_paste.py11/11 still green (no regression)insertFromPaste, short text stays per-char