Repository navigation
Expose cursor position and modifier keys for computer actions - #136
Merged
Merged
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
AHarmlessPyro
approved these changes
Oct 7, 2026
This reverts commit 9e92e34.
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
Expose desktop cursor position and pointer modifier keys through existing browserctrl functionality. Keep the existing coordinate-based scroll API intact, with a separate helper for scrolling at the current pointer and the standard
ComputerActionResponsefor every action.Changes
cursor_position()returning the standardComputerActionResponsethrough the shared request dispatcher; no dedicated response model or generic response-model transport helper.ComputerAction.CURSOR_POSITIONand its request/coordinate variants to the existing general action and response unions.ScrollAtCursorActionParamsin both TypedDict and legacy modelComputerActionParamsunions; sync/asyncscroll_at_cursor()uses the shared request dispatcher, which validates both scroll payload shapes.scroll()and its request models/TypedDicts; usescroll_at_cursor()for coordinate-free scrolling. Python's existing coordinate-optionalclick()behavior is unchanged.keysto click, drag and scroll, preserving existing positional arguments and no-modifier wire payloads.1.9.4→1.10.0; no backend changes or new dependencies.Compatibility
Existing click/scroll signatures and coordinate-based
ScrollActionParamsfields are preserved. The main request unions also accept coordinate-free scroll payloads; generic scroll-request consumers must check for coordinates before reading them. Incomplete or null coordinates remain rejected. The general action enum, request union and response-data union gain cursor position, following prior SDK expansion practice: strict exhaustive switches/maps and generic response consumers may need to handle the new variant. All actions returnComputerActionResponse; callers useisinstance(data, ComputerActionResponseDataCursorPosition)before reading cursor coordinates.Validation
poetry run ruff check .; changed-fileruff format --check;git diff --checkpoetry run pytest tests --ignore=tests/sandbox/e2e -q: 632 passed, including mypy and Pyright fixturespoetry check --lock;poetry build(1.10.0)Note
Low Risk
SDK-only API expansion with backward-compatible signatures; consumers with exhaustive action/response unions may need new variants.
Overview
Adds cursor position and scroll-at-cursor computer actions on sync/async
client.computer_action, with new request/response types (CursorPositionActionParams,ScrollAtCursorActionParams,ComputerActionResponseDataCursorPosition) wired through the shared action dispatcher. Coordinate-basedscroll()stays required forx/y; dict payloads without coordinates resolve to scroll-at-cursor.Optional modifier
keysare added toclick,drag, and both scroll helpers (omitted from the wire when unset). Bumps package version 1.9.4 → 1.10.0 with regression tests and typecheck fixtures for wire parity and invalidkeystypes.Reviewed by Cursor Bugbot for commit 7591ce8. Bugbot is set up for automated code reviews on this repo. Configure here.