t3code icon indicating copy to clipboard operation
t3code copied to clipboard

feat(desktop): add opt-in cua-driver computer use

Open injaneity opened this issue 4 months ago • 2 comments

what changed

adds opt-in computer use to the macos, linux, and windows desktop apps. when enabled, desktop passes the packaged cua-driver path and embedded module configuration to its local node server. the existing scoped embedded host owns the driver process and exposes its tools to codex.

packaged builds now download checksum-pinned driver assets for each supported platform and architecture. macos and linux use their release tarballs. windows uses its release zip and powershell expand-archive, which avoids incompatible gnu tar installations earlier on path.

macos keeps its existing permission-inheritance behavior. linux and windows need no additional permission-inheritance implementation and reuse the same embedded lifecycle without installing services, autostart entries, or persistent daemons.

why

the embedded host gives all three platforms one process-ownership model: t3 code starts the driver only after the user opts in, and the scoped finalizer stops it with the server. platform-specific code is limited to release assets, extraction, and executable paths.

validation

  • local: 43 focused tests, affected package typechecks, lint, and formatting pass.
  • cua-linux: 43 focused tests pass; checksum, extraction, binary execution, embedded startup, and clean shutdown pass.
  • cua-windows: 43 focused tests and affected package typechecks pass; checksum, powershell extraction, binary execution, embedded startup, and clean shutdown pass.
  • the windows remote runs in session 0, so gui interaction remains subject to the driver’s documented interactive-session requirement.

ui changes

the existing computer-use setting now appears on every supported desktop platform.

computer-use-enabled computer-use-disabled

checklist

  • [x] this pr is small and focused
  • [x] i explained what changed and why
  • [x] i included before/after screenshots for ui changes
  • [x] i tested the platform-specific paths on linux and windows hosts

[!NOTE]

Add opt-in embedded cua-driver computer use to the desktop app

  • Adds an enableCua toggle to client settings (default false) exposed in the desktop General Settings panel; the feature is only shown when the desktop bridge is available.
  • On startup, DesktopApp reads enableCua and calls configureCuaDriverServerEnvironment to set cua-related process env vars (T3CODE_CUA_DRIVER_PATH, T3CODE_CUA_DRIVER_HOST_BUNDLE_ID, T3CODE_CUA_DRIVER_MODULE_URL); on failure, it shows a blocking error dialog and continues with cua disabled.
  • Server startup gains a cua-driver.start phase via startEmbeddedCuaDriver, which imports the driver module by URL, starts the host, installs Codex MCP launch args via T3CODE_CODEX_APPEND_LAUNCH_ARGS_ENV, and monitors the driver process; it cleans up on scope shutdown.
  • The desktop build script now downloads, SHA-256 verifies, extracts, and stages the @trycua/cua-driver (v0.12.2) binary for the target platform/arch into prod-resources/cua-driver, then includes it as an Electron extra resource.
  • Risk: the cua-driver binary is fetched at build time from a pinned release URL; a checksum mismatch surfaces as CuaDriverChecksumMismatchError and fails the build.

Macroscope summarized 4d2f83e.


[!NOTE] Medium Risk Opt-in feature with scoped driver lifecycle, but it runs a native host, mutates process env for Codex MCP, and enables agents to control the user's machine when turned on.

Overview Adds opt-in computer use for desktop (macOS, Linux, Windows) via @trycua/cua-driver 0.12.2, default off.

Settings & UI: New enableCua on client settings (contracts + General settings when desktopBridge is present). Users must restart after toggling.

Desktop startup: If enabled, configureCuaDriverServerEnvironment sets T3CODE_CUA_DRIVER_* for the local Node server (packaged driver path, host bundle id, embedded module URL). Inherited env vars are cleared when disabled so dev overrides cannot bypass opt-in. Configuration failures show an error dialog and the app continues without computer use.

Server: startEmbeddedCuaDriver starts the embedded host when env is set, wires Codex MCP via T3CODE_CODEX_APPEND_LAUNCH_ARGS, and tears down on driver exit. Codex adapter spawn args prefer live append launch args over stale per-session env snapshots.

Packaging: Desktop artifact build downloads checksum-pinned release binaries per platform/arch, stages them into prod-resources/cua-driver, and includes them in extraResources.

Reviewed by Cursor Bugbot for commit 4d2f83e8ad0de682fd9c91a58b463956b8f06d87. Bugbot is set up for automated code reviews on this repo. Configure here.

injaneity avatar Jul 23 '26 09:07 injaneity

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f658ed38-d3d5-4952-86ae-9c55d232fc24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 23 '26 09:07 coderabbitai[bot]

Approvability

Verdict: Needs human review

This PR introduces a new opt-in computer use feature that allows agents to see and control the user's computer via cua-driver integration. The security-sensitive nature of this capability, combined with new native binary integration across all platforms and substantial new code paths, warrants human review.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot] avatar Jul 23 '26 09:07 macroscopeapp[bot]

closing as superseded by #5533, which rebuilds and attributes this computer-use contribution on the current architecture.

t3-code-bot[bot] avatar Aug 20 '26 22:08 t3-code-bot[bot]