feat(macos): make each native macOS app its own device

Merged
JA
1mo ago
+2506-227

Summary

With AGENT_DEVICE_MACOS_APP_BACKEND=native, each app opened on the app surface is its own device (<mac>:app:<bundle id>). The per-device lock, claim, session check, and open --wait apply unchanged, so agents drive different apps of one Mac at once. A host and its app devices overlap; two app devices do not.

  • An app device opens in the background. It opens and closes only its own app, sends a bare link to that app, keeps the app surface, and refuses clipboard/settings (unsupported-device-scope).
  • A macos-app lease binds its app device and takes its claim (ADR 0007 amended).
  • XCTest, desktop, menubar, and frontmost-app keep the whole Mac. Bundle ids match without case.

Replaces the first design (an app scope on the Mac); credits @janicduplessis. Closes #3322; implements #3338. ADR 0035 is "macOS App Devices".

export AGENT_DEVICE_MACOS_APP_BACKEND=native
agent-device open TextEdit --platform macos --session one
agent-device open Calculator --platform macos --session two

Validation

Head 7519086c1f4b83b1214ed30ff100bd05e75e9714 (on main 6ac6611).

  • check:affected --run --head <head>: passed, run-gzpZB4, exactCommit: true, 11,813 related tests.
  • Live at this head (raw output), native backend: parallel app sessions in one daemon; cross-daemon conflicts both ways; clipboard refused; frontmost unchanged; kill -9 recovery and cleanup passed; policy (Mac or one app) held; close <other app> refused with the session intact.
  • Same-Mac locks never wait mid-request, including batch steps. Lease tenants see no foreign owner metadata.

🤖 Generated with Claude Code