feat(record): match the iOS USB capture source by its learned uniqueID

Merged
AR
1d ago
+776-57

Summary

Invariant: a learned capture source opens only while it has the device name, and a name match skips sources learned for other devices. Records are append/replace only.

  • The helper takes --device-uid and --exclude-device-uid, and prints capture-source-uid before the first frame. A learned source that is missing or renamed falls back to a name match in the same start.
  • A name match is exact when every other device with that name learned its source. Only an exact match writes ~/.agent-device/ios-usb-capture-sources/ (0700 dir, 0600 files). Same-named phones learn one at a time, without a rename.
  • Not-found keeps the record. A source another device learns during a start falls back with ios_usb_capture_source_of_another_device.
  • Only records this user owns privately are trusted. Store failures never fail a recording.

Closes #5288

Before / after

Base: phones that share a name fall back with ios_usb_capture_device_name_shared. Head: both record through USB capture.

Validation

4f0ceb077, Mac mini (macOS 27.2.1). An iPhone 15 Pro (iOS 18.5) and an iPhone 13 Pro were both named iPhone:

  • The 13 Pro learned by elimination. Each phone alone, and both at once from two sessions, reported iOS USB screen capture with no recorderFallbackReason: 1180x2556 and 1170x2532 at about 59 fps. The JSON and ffprobe output are in this comment.
  • Not run live: source_of_another_device, the uid-to-name fallback, and a Mac restart.
  • Focused tests pass; CI pending.

šŸ¤– Generated with Claude Code