feat(mac): Pair iPhone… — native QR pairing in the menu bar (M3)#171
Conversation
A GUI counterpart to `lisa pair` so non-terminal users can pair Lisa Pocket. The
menu-bar popover gains a "Pair iPhone…" button (shown when the backend is up) that:
- POSTs the loopback-only /api/pair/start to mint a per-device token,
- detects the Mac's LAN IP (first non-internal IPv4, like pair.ts),
- builds the same lisa-pair://v1?host=&port=&token=&name= deep-link,
- renders it as a QR (CoreImage) in a window to scan, with a Copy-link fallback
and the host:port shown for a sanity check.
New PairController.swift mirrors src/cli/pair.ts exactly, so the URL round-trips
through the iOS parsePairing. Pairs with decision ② (#169): the phone reaches the
Mac at the LAN IP and authenticates with the minted device token.
Verify: swift build → Build complete; URL format + LAN detection verified via the
swift interpreter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review — native QR pairing ✅
Minor (non-blocking), worth a follow-up:
LGTM — merging. |
Review (post-merge) — solid; integrates correctly with #169This merged before I got to it, so a review-after-the-fact. No action needed — it holds up. I verified the parts most likely to be wrong against the source it claims to mirror:
Integration build I ran (CI can't): the repo's CI is Minor / future (non-blocking)
|
#173) Two follow-ups to #171's "Pair iPhone…": - detectLanHost now ranks interfaces instead of taking the first non-loopback IPv4: real Ethernet/Wi-Fi (en*) beats VPN/virtual/Internet-Sharing (utun, bridge, vmnet, …) and AWDL (awdl/llw, up but not LAN-routable). A phone on the same Wi-Fi can't reach a Tailscale utun or a Parallels vnic, which the old "first IPv4" could land on. en0 still wins ties (getifaddrs order preserved). - showPairing() refocuses an open QR window instead of minting a fresh device token, so repeated taps don't leave orphan entries in devices.ts. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
M3 of
docs/PLAN_IOS_ONBOARDING_v1.0.md— the Mac-side GUI QR, so users who don't live in a terminal can pair Lisa Pocket without runninglisa pair.What
The menu-bar popover gains a "Pair iPhone…" button (shown when the backend is up). It:
/api/pair/startto mint a per-device token,pair.ts),lisa-pair://v1?host=&port=&token=&name=deep-link,host:portshown so the user can sanity-check the address.PairController.swiftmirrorssrc/cli/pair.tsexactly, so the URL round-trips through the iOSparsePairing(verified). Pairs with #169 (decision ②): the phone reaches the Mac at the LAN IP and authenticates with the minted device token.Scope / independence
Mac-only —
PairController.swift(new) + a button inMenuBarController.swift. No iOS / server changes. Independent of the onboarding PRs (#167 / #170); most useful once #169 (LAN bind) lands.Notes
Host auto-detect mirrors
pair.ts(first non-internal IPv4); the window shows the IP so a wrong pick (e.g. a VPN interface) is visible. A future refinement could let the user override it.Verification
swift build --package-path packaging/mac-client→ Build complete (only the pre-existingWKProcessPooldeprecation warning).swiftinterpreter (ALL OK); the URL parses back through the sameq("host")/q("token")logic the iOS app uses.🤖 Generated with Claude Code