Skip to content

feat(drive): control and visualize real mouse input - #83

Merged
kitlangton merged 6 commits into
mainfrom
mouse-recording
Sep 4, 2026
Merged

feat(drive): control and visualize real mouse input#83
kitlangton merged 6 commits into
mainfrom
mouse-recording

Conversation

@kitlangton

@kitlangton kitlangton commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Why

Agents can click in OpenCode, but cannot reliably exercise hover/leave or drag gestures through Drive's public interface. Recorded videos also hide the pointer, making those interactions difficult to follow.

What Changes

Expose real ui.mouse movement, buttons, modifiers, dragging, and scrolling. Add an opt-in pointer overlay to recordings, driven by actual coordinates and timestamps from the OpenCode recording clock.

OpenCodeDriver.use({
  tui: {
    recording: true,
    pointerOverlay: { leadMs: 180, lingerMs: 700, motionMs: 500, curve: 0.06 },
  },
}, ({ ui }) => ui.mouse({ action: "move", x: 20, y: 8 }))

The cursor appears before input, glides along a subtle bounded arc using Motion's critically damped spring, and lingers across nearby interactions. Actual input timing is unchanged, clicks arrive at their recorded cell, and held drags do not gain decorative curvature. Existing click APIs and terminal-v1 recordings remain compatible.

Demo

release-comparison.mp4

Same real production TUI recording, exported with base f6a3f55 on the left and the approved pointer implementation 961e75b on the right. Captured against the companion OpenCode implementation before its clean rebase (52974a6057). The fixture asserts native hover/leave, click-driven theme changes, and resizing. No model calls or accelerated playback. Subsequent dependency refreshes were verified with a fresh run of the same fixture against the rebased OpenCode change.

Recording and Ownership

  • Negotiate optional mouse/recording capabilities from feat(simulation): expose and record real mouse input opencode#47194; unsupported targets fail before unsupported input is sent.
  • Preserve terminal recording provenance while sampling pointer animation at the correct playback time through trims, speed changes, and holds.
  • Keep secondary TUI recording state isolated, including inherited CLI --record options.
  • Replace redundant shared-work bookkeeping with a scope-owned fiber; remove dead CLI/control code and the unused OpenTUI dependency without removing capabilities.

Versions and Scope

Refresh native canvas/terminal replay dependencies and align development/CI with Bun 1.4.0. The exact V2 client pin selects matching protocol/schema packages; the OpenCode executable is separately selected from PATH, --dev, or an explicit command. Effect remains on the current V4 rc.112, not the V3 latest tag.

The V2 client, protocol, and schema are pinned together to 0.0.0-dev-19066, the published build containing #47194. This prepares the Changesets-generated 2.1.0 release. The larger CLI lifecycle rewrite, catalog painter consolidation, and subsequent rendering performance work remain separate. This does not alter real input pacing or add blur effects.

Verification

bun run check
bun run release:validate

# From packages/drive, with OPENCODE_DEV pointing to the companion checkout:
OPENCODE_DRIVE_MEDIA_DIR="$PWD/.drive-output" bun run drive run test/manual/pointer-demo.ts
  • 274 Drive unit tests, 59 CLI integration tests, and 40 catalog tests.
  • Native hover/leave, click results, and wide/narrow recording verified in a real isolated TUI.
  • Independent review found and reproduced three recording/lifecycle defects; all fixes pass the original reproductions, 50 tests, and four targeted follow-up cases.
  • Clean packed consumer verified public imports, script checking, screenshot/video export, and replay without OpenTUI; Motion also runs without React or a browser.
  • Typechecks, catalog generation consistency/builds, package-content inspection, and configured release validation. One pre-existing lint warning remains in recording/marks.ts.

@kitlangton
kitlangton merged commit c58fdf5 into main Sep 4, 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