Skip to content

refactor(humanizer): route to cloakbrowser-patched Playwright methods#14

Merged
yfe404 merged 1 commit intomainfrom
refactor/humanizer-passthrough
Apr 14, 2026
Merged

refactor(humanizer): route to cloakbrowser-patched Playwright methods#14
yfe404 merged 1 commit intomainfrom
refactor/humanizer-passthrough

Conversation

@yfe404
Copy link
Copy Markdown
Owner

@yfe404 yfe404 commented Apr 14, 2026

Summary

  • Humanizer engine was duplicating cloakbrowser's own `humanize: true` layer (Bezier, realistic typing) AND bypassing it by calling low-level `page.keyboard.press` — which dropped uppercase + symbol case.
  • Replaces `src/humanizer/engine.ts` with thin wrappers over `page.click` / `page.mouse.*` / `page.keyboard.type`, all patched by cloakbrowser with CDP-trusted Shift handling (`Input.dispatchKeyEvent`, `isTrusted=true`).
  • Deletes `src/humanizer/path.ts` and `src/humanizer/timing.ts` (463 LOC of dead code).
  • Adds `scripts/humanizer-case-test.ts` — round-trips "Hello World! ABC @#$%" through a textarea to verify the case-drop fix.

Tool param changes (breaking)

  • `humanizer_click`: `move_duration_ms` removed, `timeout_ms` added (default 15000).
  • `humanizer_type`: `wpm` + `error_rate` removed, `delay_ms` added (optional passthrough to `keyboard.type`).
  • `humanizer_scroll`: `duration_ms` removed (now a single wheel event).
  • `humanizer_move`: `duration_ms` removed.

Version bump 2.1.0 → 2.2.0.

Test plan

  • Unit tests pass (74/74).
  • `npx tsx scripts/humanizer-case-test.ts` — mixed-case + symbols preserved.
  • Manual: `humanizer_click` on a real form.
  • Manual: `humanizer_type` on a login field, verify submit works.

The custom Bezier/Fitts/WPM/bigram/typo code in src/humanizer/{path,timing}.ts
duplicated cloakbrowser's own `humanize: true` layer and bypassed it by calling
low-level `page.keyboard.press` — which dropped uppercase and symbol case.

Engine now calls `page.click` / `page.mouse.*` / `page.keyboard.type` directly;
cloakbrowser patches all of them with Bezier paths, realistic typing cadence,
and CDP-trusted Shift handling (`Input.dispatchKeyEvent`, `isTrusted=true`).

Smoke test (scripts/humanizer-case-test.ts) confirms "Hello World! ABC @#$%"
round-trips through a textarea unchanged.

Tool param surface:
- humanizer_click: `move_duration_ms` → `timeout_ms`
- humanizer_type:  `wpm`+`error_rate` → `delay_ms` (optional passthrough)
- humanizer_scroll: `duration_ms` removed (single wheel event)
- humanizer_move:  `duration_ms` removed

Deletes 463 LOC of dead timing code.

Bumps to 2.2.0.
@yfe404 yfe404 merged commit e93804f into main Apr 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant