Skip to content

feat: add mode-aware native mouse input - #179

Open
pmarreck wants to merge 2 commits into
coder:mainfrom
pmarreck:feat/mouse-input
Open

pmarreck wants to merge 2 commits into
coder:mainfrom
pmarreck:feat/mouse-input

Conversation

@pmarreck

@pmarreck pmarreck commented Sep 27, 2026 •

Copy link
Copy Markdown

Add mode-aware mouse input for terminal automation through the native libghostty-vt backend. For example, a left press, move, and release now produces a drag using the child's negotiated tracking mode and wire format.

  • Add the mouse CLI/RPC command and batch steps with zero-based row/column coordinates, modifiers, held-button state, wheel presses, and optional pixel cell dimensions.
  • Pass native Buffers directly to the PTY and preserve exact bytes in input_mouse events as base64, including raw X10 bytes. Suppressed events return reported: false and still receive a sequence number.
  • Expose the mouse-input capability and CAPABILITY_UNAVAILABLE (exit 12) for unsupported renderers or older native packages. Update schemas, replay/export handling, CLI docs, and public skill guidance together.

Depends on libghostty-vt-node PR #12. The optional dependency and lockfile retain the published package; they need updating after a mouse-capable native release. The development recipe pins tested binding revision 8318d03 and explains how to build/install its tarball. Native integration tests run when that API is available; AGENT_TTY_REQUIRE_MOUSE_NATIVE=1 makes missing support fail rather than skip.

Validation on x86_64 Linux with Node 24.18.1, npm 10.9.8, and binding 8318d03:

  • AGENT_TTY_REQUIRE_MOUSE_NATIVE=1 npm run verify passes: formatting, lint, typecheck, all 1,673 tests across 161 files, build, and isolated tarball installation. Tested after merging upstream a269ca4 and installing its lockfile with aube 1.10.4 (Vitest 4.1.11). NixOS verification used steam-run, browser libraries, Python/Make/GCC, and an isolated home. npm 10.9.8 avoids the npm 12 pack JSON change in the existing packaging script.
  • Real raw-mode PTY tests check SGR, SGR-pixels, X10, UTF-8, URXVT, disabled reporting, press/drag/release, concurrent held-button requests during backend startup, exact event-log bytes, and subsequent replay.
  • Regression tests first demonstrated dropped held-button state during concurrent backend startup; holding the renderer lock through encoding, PTY delivery, and state commit fixes it.
  • No screenshot rendering changes or architecture deviations.

GitHub Actions for head 47102f9 require maintainer approval (action_required). The PR is conflict-free; local verification does not imply upstream CI has run.

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